[PATCH] x86/monitor: allow fast-singlestepping without enabling singlestep monitor

Petr Beneš posted 1 patch 2 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/4dfbc4c3cfdd36601e0b9b100fa6cd02682be3c6.1713118660.git.w1benny@gmail.com
xen/arch/x86/hvm/monitor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] x86/monitor: allow fast-singlestepping without enabling singlestep monitor
Posted by Petr Beneš 2 weeks, 5 days ago
From: Petr Beneš <w1benny@gmail.com>

Reorder the condition checks within the HVM_MONITOR_SINGLESTEP_BREAKPOINT
case to enable fast singlestepping independently of the singlestep monitor
being enabled. Previously, fast singlestepping required the singlestep
monitor to be explicitly enabled through xc_monitor_singlestep, even though
it operates entirely within Xen and does not generate external events.

Signed-off-by: Petr Beneš <w1benny@gmail.com>
---
 xen/arch/x86/hvm/monitor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index 4f500beaf5..2a8ff07ec9 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -178,8 +178,6 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
         break;
 
     case HVM_MONITOR_SINGLESTEP_BREAKPOINT:
-        if ( !ad->monitor.singlestep_enabled )
-            return 0;
         if ( curr->arch.hvm.fast_single_step.enabled )
         {
             p2m_altp2m_check(curr, curr->arch.hvm.fast_single_step.p2midx);
@@ -188,6 +186,8 @@ int hvm_monitor_debug(unsigned long rip, enum hvm_monitor_debug_type type,
             curr->arch.hvm.fast_single_step.p2midx = 0;
             return 0;
         }
+        if ( !ad->monitor.singlestep_enabled )
+            return 0;
         req.reason = VM_EVENT_REASON_SINGLESTEP;
         req.u.singlestep.gfn = gfn_of_rip(rip);
         sync = true;
-- 
2.34.1


Re: [PATCH] x86/monitor: allow fast-singlestepping without enabling singlestep monitor
Posted by Tamas K Lengyel 1 week, 3 days ago
On Sun, Apr 14, 2024 at 2:21 PM Petr Beneš <w1benny@gmail.com> wrote:
>
> From: Petr Beneš <w1benny@gmail.com>
>
> Reorder the condition checks within the HVM_MONITOR_SINGLESTEP_BREAKPOINT
> case to enable fast singlestepping independently of the singlestep monitor
> being enabled. Previously, fast singlestepping required the singlestep
> monitor to be explicitly enabled through xc_monitor_singlestep, even though
> it operates entirely within Xen and does not generate external events.
>
> Signed-off-by: Petr Beneš <w1benny@gmail.com>

Acked-by: Tamas K Lengyel <tamas@tklengyel.com>