[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 26/28] xen/domctl: wrap arch-specific domctl-op with CONFIG_MGMT_HYPERCALLS


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Oct 2025 14:24:47 +0100
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: ray.huang@xxxxxxx, oleksii.kurochko@xxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 30 Oct 2025 13:25:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.10.2025 12:15, Penny Zheng wrote:
> Function arch_do_domctl() is responsible for arch-specific domctl-op,
> and shall be wrapped with CONFIG_MGMT_HYPERCALLS
> Tracking its calling chain and the following functions shall be wrapped with
> CONFIG_MGMT_HYPERCALLS too. Otherwise they will all become unreachable when
> MGMT_HYPERCALLS=n, and hence violating Misra Rule 2.1.
> For x86:
> - hvm_save_one
> - hvm_acpi_power_button
> - hvm_acpi_sleep_button
> - hvm_debug_op
> - mem_sharing_domctl
> - make P2M_AUDIT depend on CONFIG_MGMT_HYPERCALLS
> - make PG_log_dirty depend on CONFIG_MGMT_HYPERCALLS
> - do_vmtrace_op
>   - hvm_vmtrace_control
>     - hvm_funcs.vmtrace_control
>   - hvm_vmtrace_get_option
>     - hvm_funcs.vmtrace_get_option
>   - hvm_vmtrace_set_option
>     - hvm_funcs.vmtrace_set_option
>   - hvm_vmtrace_output_position
>     - hvm_funcs.vmtrace_output_position
> - paging_domctl_cont
> - make policy.o/msr.o depend on CONFIG_MGMT_HYPERCALLS
> For ARM:
> - subarch_do_domctl
> We put the guardian in Makefile for the arch-specific domctl.o compilation.
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
> ---
> v1 -> v2:
> - split out xsm parts
> - adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS"
> - wrap default-case and arch_get_domain_info() transiently
> ---
> v2 -> v3:
> - add missing guardian in arm/Makefile
> - cover RTIT_CTL{,STATUS}_MASK #define-s
> - add missing guardian for .vmtrace_output_position
> - guard the whole static inline function
> - address "violating Misra rule 2.1" in commit message
> - remove transient wrapping around default-case and arch_get_domain_info()
> ---
>  xen/Kconfig.debug                  | 2 +-
>  xen/arch/arm/Makefile              | 2 +-
>  xen/arch/arm/arm32/Makefile        | 2 +-
>  xen/arch/arm/arm64/Makefile        | 2 +-
>  xen/arch/x86/Makefile              | 2 +-
>  xen/arch/x86/hvm/hvm.c             | 2 ++
>  xen/arch/x86/hvm/pmtimer.c         | 2 ++
>  xen/arch/x86/hvm/vmx/vmx.c         | 4 ++++
>  xen/arch/x86/include/asm/hvm/hvm.h | 4 ++++
>  xen/arch/x86/include/asm/p2m.h     | 2 +-
>  xen/arch/x86/include/asm/paging.h  | 2 +-
>  xen/arch/x86/mm/mem_sharing.c      | 2 ++
>  xen/include/hypercall-defs.c       | 4 ++--
>  xen/lib/x86/Makefile               | 4 ++--
>  14 files changed, 25 insertions(+), 11 deletions(-)

This again might better be split, perhaps (at least) into an Arm and an x86 
patch.
Possibly the do_vmtrace_op() set of changes could also be a separate patch.

> --- a/xen/Kconfig.debug
> +++ b/xen/Kconfig.debug
> @@ -15,7 +15,7 @@ if DEBUG || EXPERT
>  
>  config GDBSX
>       bool "Guest debugging with gdbsx"
> -     depends on X86
> +     depends on X86 && MGMT_HYPERCALLS

Likely better

        depends on MGMT_HYPERCALLS
        depends on X86

such that when (if ever) another arch is to be added, a simpler modification 
will
do.

> --- a/xen/arch/x86/mm/mem_sharing.c
> +++ b/xen/arch/x86/mm/mem_sharing.c
> @@ -2322,6 +2322,7 @@ out:
>      return rc;
>  }
>  
> +#ifdef CONFIG_MGMT_HYPERCALLS
>  int mem_sharing_domctl(struct domain *d, struct xen_domctl_mem_sharing_op 
> *mec)
>  {
>      int rc;
> @@ -2339,6 +2340,7 @@ int mem_sharing_domctl(struct domain *d, struct 
> xen_domctl_mem_sharing_op *mec)
>  
>      return rc;
>  }
> +#endif /* CONFIG_MGMT_HYPERCALLS */

See again my MEM_SHARING related remark.

> --- a/xen/lib/x86/Makefile
> +++ b/xen/lib/x86/Makefile
> @@ -1,3 +1,3 @@
>  obj-y += cpuid.o
> -obj-y += msr.o
> -obj-y += policy.o
> +obj-$(CONFIG_MGMT_HYPERCALLS) += msr.o
> +obj-$(CONFIG_MGMT_HYPERCALLS) += policy.o

What about e.g. x86_cpuid_copy_{to,from}_buffer(), living in cpuid.o?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.