All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Penny Zheng <Penny.Zheng@amd.com>
Cc: ray.huang@amd.com, oleksii.kurochko@gmail.com,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Tamas K Lengyel" <tamas@tklengyel.com>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 26/28] xen/domctl: wrap arch-specific domctl-op with CONFIG_MGMT_HYPERCALLS
Date: Thu, 30 Oct 2025 14:24:47 +0100	[thread overview]
Message-ID: <604ba4aa-a527-40af-9683-473ee331fcbb@suse.com> (raw)
In-Reply-To: <20251013101540.3502842-27-Penny.Zheng@amd.com>

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@amd.com>
> ---
> 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


  reply	other threads:[~2025-10-30 13:25 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 10:15 [PATCH v3 00/28] Disable domctl-op via CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-13 10:15 ` [PATCH v3 01/28] xen/xsm: remove redundant xsm_iomem_mapping() Penny Zheng
2025-10-13 11:18   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 02/28] xen/mem_sharing: wrap hvm_copy_context_and_params() with CONFIG_MEM_SHARING Penny Zheng
2025-10-14 14:43   ` Grygorii Strashko
2025-10-28 17:01   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 03/28] xen/altp2m: move p2m_set_suppress_ve_multi() forward Penny Zheng
2025-10-28 17:03   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 04/28] xen/sched: remove vcpu_set_soft_affinity() Penny Zheng
2025-10-13 10:24   ` Jürgen Groß
2025-10-13 10:15 ` [PATCH v3 05/28] xen/sysctl: replace CONFIG_SYSCTL with CONFIG_MGMT_DOMCTL Penny Zheng
2025-10-13 10:41   ` Jürgen Groß
2025-10-29 14:30   ` Jan Beulich
2025-10-29 21:26   ` Stewart Hildebrand
2025-11-19  6:33     ` Penny, Zheng
2025-10-13 10:15 ` [PATCH v3 06/28] xen/x86: move domctl.o out of PV_SHIM_EXCLUSIVE Penny Zheng
2025-10-29 14:33   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 07/28] xen/domctl: make MGMT_HYPERCALLS transiently def_bool Penny Zheng
2025-10-29 14:37   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 09/28] xen/vm_event: consolidate CONFIG_VM_EVENT Penny Zheng
2025-10-21 13:24   ` Grygorii Strashko
2025-10-29 15:57   ` Jan Beulich
2025-11-11  7:08     ` Penny, Zheng
2025-11-11  8:13       ` Jan Beulich
2025-11-11  9:46         ` Penny, Zheng
2025-10-13 10:15 ` [PATCH v3 10/28] xen/vm_event: make VM_EVENT depend on CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-13 10:15 ` [PATCH v3 11/28] xen/xsm: wrap xsm_vm_event_control() with CONFIG_VM_EVENT Penny Zheng
2025-10-13 10:15 ` [PATCH v3 12/28] xen/domctl: wrap domain_pause_by_systemcontroller() with MGMT_HYPERCALLS Penny Zheng
2025-10-30 11:28   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 13/28] xen/domctl: wrap domain_soft_reset() with CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 12:14   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 14/28] xen/domctl: wrap domain_resume() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 15/28] xen/domctl: wrap domain_kill() " Penny Zheng
2025-10-30 12:43   ` Jan Beulich
2025-11-12  8:58     ` Penny, Zheng
2025-11-12 10:02       ` Jan Beulich
2025-11-13  4:11         ` Penny, Zheng
2025-11-13  4:40     ` Penny, Zheng
2025-10-13 10:15 ` [PATCH v3 16/28] xen/domctl: wrap domain_set_node_affinity() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 17/28] xen/domctl: wrap vcpu_affinity_domctl() " Penny Zheng
2025-10-13 10:44   ` Jürgen Groß
2025-10-13 10:15 ` [PATCH v3 18/28] xen/domctl: wrap sched_adjust() " Penny Zheng
2025-10-13 11:03   ` Jürgen Groß
2025-10-13 11:13     ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 19/28] xen/domctl: wrap xsm_irq_permission " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 20/28] xen/domctl: wrap arch-specific domain_set_time_offset() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 21/28] xen/domctl: wrap xsm_set_target() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 22/28] xen/domctl: wrap iommu-related domctl op " Penny Zheng
2025-10-30 13:09   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 23/28] xen/domctl: wrap arch_{get,set}_paging_mempool_size() " Penny Zheng
2025-10-13 10:15 ` [PATCH v3 24/28] xen/domctl: make CONFIG_X86_PSR depend on CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-13 10:15 ` [PATCH v3 25/28] xen/domctl: avoid unreachable codes when both MGMT_HYPERCALLS and MEM_SHARING unset Penny Zheng
2025-10-30 13:13   ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 26/28] xen/domctl: wrap arch-specific domctl-op with CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 13:24   ` Jan Beulich [this message]
2025-10-13 10:15 ` [PATCH v3 27/28] xen/domctl: make HVM_PARAM_IDENT_PT conditional upon CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 13:34   ` Jan Beulich
2025-11-18  6:45     ` Penny, Zheng
2025-11-18  7:12       ` Jan Beulich
2025-10-13 10:15 ` [PATCH v3 28/28] xen/domctl: wrap common/domctl.c with CONFIG_MGMT_HYPERCALLS Penny Zheng
2025-10-30 13:40   ` Jan Beulich
2025-11-18  6:43     ` Penny, Zheng
2025-11-18  7:14       ` Jan Beulich
2025-11-18  7:51         ` Penny, Zheng
2025-11-18 19:29           ` Jason Andryuk
2025-11-20  4:09             ` Penny, Zheng
     [not found] ` <20251013101540.3502842-9-Penny.Zheng@amd.com>
2025-10-29 15:02   ` [PATCH v3 08/28] xen/vm_event: introduce vm_event_is_enabled() Jan Beulich
2025-10-30 11:10     ` Grygorii Strashko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=604ba4aa-a527-40af-9683-473ee331fcbb@suse.com \
    --to=jbeulich@suse.com \
    --cc=Penny.Zheng@amd.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=bertrand.marquis@arm.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=ray.huang@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tamas@tklengyel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.