[PATCH] x86/mm: correct PG_log_dirty definition again

Jan Beulich posted 1 patch 1 week ago
Failed in applying to current master (apply log)
[PATCH] x86/mm: correct PG_log_dirty definition again
Posted by Jan Beulich 1 week ago
The earlier change wasn't correct as far as shim-exclusive mode goes:
Shadow mode is still to be enabled permitted there, yet the generic
paging-log-dirty (and more generally domctl) part of the code still is
unwanted (and cannot be used anyway, as domctl_lock_acquire() isn't
available).

Fixes: 2ae8a68df21e ("x86/mm: correct PG_log_dirty definition")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
While a backwards move, properly untangling this will need to be left for
later, I expect.

--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -55,7 +55,7 @@
 #define PG_translate   0
 #define PG_external    0
 #endif
-#ifdef CONFIG_PAGING
+#if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
 /* Enable log dirty mode */
 #define PG_log_dirty   (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
 #else
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -197,7 +197,7 @@ dm_op(domid_t domid, unsigned int nr_buf
 #ifdef CONFIG_SYSCTL
 sysctl(xen_sysctl_t *u_sysctl)
 #endif
-#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
+#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
 paging_domctl_cont(xen_domctl_t *u_domctl)
 #endif
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
@@ -298,7 +298,7 @@ dm_op                              compa
 hypfs_op                           do       do       do       do       do
 #endif
 mca                                do       do       -        -        -
-#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
+#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
 paging_domctl_cont                 do       do       do       do       -
 #endif
Re: [PATCH] x86/mm: correct PG_log_dirty definition again
Posted by Stefano Stabellini 6 days, 20 hours ago
On Wed, 21 Oct 2025, Jan Beulich wrote:
> The earlier change wasn't correct as far as shim-exclusive mode goes:
> Shadow mode is still to be enabled permitted there, yet the generic
> paging-log-dirty (and more generally domctl) part of the code still is
> unwanted (and cannot be used anyway, as domctl_lock_acquire() isn't
> available).
> 
> Fixes: 2ae8a68df21e ("x86/mm: correct PG_log_dirty definition")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> While a backwards move, properly untangling this will need to be left for
> later, I expect.

I also had considered this set of changes as an alternative of the
SHADOW_PAGING kconfig change I made. I tested this patch together with
mine and everything looks good so far:
https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines

Tested-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

I'll resend both patches together for simplicity.


> --- a/xen/arch/x86/include/asm/paging.h
> +++ b/xen/arch/x86/include/asm/paging.h
> @@ -55,7 +55,7 @@
>  #define PG_translate   0
>  #define PG_external    0
>  #endif
> -#ifdef CONFIG_PAGING
> +#if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
>  /* Enable log dirty mode */
>  #define PG_log_dirty   (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
>  #else
> --- a/xen/include/hypercall-defs.c
> +++ b/xen/include/hypercall-defs.c
> @@ -197,7 +197,7 @@ dm_op(domid_t domid, unsigned int nr_buf
>  #ifdef CONFIG_SYSCTL
>  sysctl(xen_sysctl_t *u_sysctl)
>  #endif
> -#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
> +#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
>  paging_domctl_cont(xen_domctl_t *u_domctl)
>  #endif
>  #ifndef CONFIG_PV_SHIM_EXCLUSIVE
> @@ -298,7 +298,7 @@ dm_op                              compa
>  hypfs_op                           do       do       do       do       do
>  #endif
>  mca                                do       do       -        -        -
> -#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
> +#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
>  paging_domctl_cont                 do       do       do       do       -
>  #endif
>  
>