[PATCH for-4.22] x86/hvm: Partially revert ("xen/mem_access: wrap memory access when VM_EVENT=n")

Andrew Cooper posted 1 patch 2 days, 9 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260605194157.2762581-1-andrew.cooper3@citrix.com
xen/arch/x86/hvm/hvm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH for-4.22] x86/hvm: Partially revert ("xen/mem_access: wrap memory access when VM_EVENT=n")
Posted by Andrew Cooper 2 days, 9 hours ago
It is erroneous to check current like this.  e.g. Dom0 does not have VM_EVENT
active when it's introspecting domUs.

The use of vm_event_is_enabled() is only for the IS_ENABLED(CONFIG_VM_EVENT)
short circut, so just use that directly.

Reported-by: Hady Azzam <hadyazzam@protonmail.com>
Fixes: b18e38e42da6 ("xen/mem_access: wrap memory access when VM_EVENT=n")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Hady Azzam <hadyazzam@protonmail.com>
CC: Tamas K Lengyel <tamas@tklengyel.com>
CC: Jason Andryuk <jason.andryuk@amd.com>
CC: Penny Zheng <Penny.Zheng@amd.com>
CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>

For 4.22.  This is a regression vs 4.21.

Only compile tested.
---
 xen/arch/x86/hvm/hvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f759a397c557..cbcef18449ee 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4789,7 +4789,7 @@ static int do_altp2m_op(
         break;
 
     case HVMOP_altp2m_set_mem_access:
-        if ( !vm_event_is_enabled(current) )
+        if ( !IS_ENABLED(CONFIG_VM_EVENT) )
         {
             rc = -EOPNOTSUPP;
             break;
@@ -4804,7 +4804,7 @@ static int do_altp2m_op(
         break;
 
     case HVMOP_altp2m_set_mem_access_multi:
-        if ( !vm_event_is_enabled(current) )
+        if ( !IS_ENABLED(CONFIG_VM_EVENT) )
         {
             rc = -EOPNOTSUPP;
             break;
@@ -4841,7 +4841,7 @@ static int do_altp2m_op(
         break;
 
     case HVMOP_altp2m_get_mem_access:
-        if ( !vm_event_is_enabled(current) )
+        if ( !IS_ENABLED(CONFIG_VM_EVENT) )
         {
             rc = -EOPNOTSUPP;
             break;

base-commit: 3c4e804607a5a1254b168d88572cb9ec311543a9
-- 
2.39.5


Re: [PATCH for-4.22] x86/hvm: Partially revert ("xen/mem_access: wrap memory access when VM_EVENT=n")
Posted by Jason Andryuk 2 days, 4 hours ago
On 2026-06-05 15:41, Andrew Cooper wrote:
> It is erroneous to check current like this.  e.g. Dom0 does not have VM_EVENT
> active when it's introspecting domUs.
> 
> The use of vm_event_is_enabled() is only for the IS_ENABLED(CONFIG_VM_EVENT)
> short circut, so just use that directly.
> 
> Reported-by: Hady Azzam <hadyazzam@protonmail.com>
> Fixes: b18e38e42da6 ("xen/mem_access: wrap memory access when VM_EVENT=n")
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Re: [PATCH for-4.22] x86/hvm: Partially revert ("xen/mem_access: wrap memory access when VM_EVENT=n")
Posted by Hady 15 hours ago
On Saturday, June 6th, 2026 at 4:13 AM, Jason Andryuk jason.andryuk@amd.com wrote:

> On 2026-06-05 15:41, Andrew Cooper wrote:
> 
> > It is erroneous to check current like this. e.g. Dom0 does not have VM_EVENT
> > active when it's introspecting domUs.
> > 
> > The use of vm_event_is_enabled() is only for the IS_ENABLED(CONFIG_VM_EVENT)
> > short circut, so just use that directly.
> > 
> > Reported-by: Hady Azzam hadyazzam@protonmail.com
> > Fixes: b18e38e42da6 ("xen/mem_access: wrap memory access when VM_EVENT=n")
> > Signed-off-by: Andrew Cooper andrew.cooper3@citrix.com
> 
> Reviewed-by: Jason Andryuk jason.andryuk@amd.com

Tested-by: Hady Azzam <hadyazzam@protonmail.com>