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

Re: [XEN][PATCH] x86/hvm: move save/restore under HVM_SAVE_RESTORE config


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Wed, 26 Nov 2025 12:13:26 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QeTzvXON8jlwjV7l3O0H4hbOXk8aCtEmPSffh71G754=; b=edX3Rstrs0A7g9ep4Lw0qAsEo3uZXg8DDHycGNlSqWgq7nujs1NIMQWvf79Xh6Mw3zEWcJmFp103SZH8Epb7/BQaL/2882mrODTX57YsXUzixImWsoyYolCWVCMLyfjklYGZcL+3Afvyyhka3UFzGFSMc57nyQZHHQUHTVPr1Q20uAfvaamYzN6NOyc33p5XiEhoIYSsRv/xLpzDDQINAzuYfsD5XTiW6ksNZRweSxrWw+rO245t9q1ucgYkADA9+cxjo0613J4SQrC6ZjOpla3Xt6Sz8u93RGTvox3lfAO4g+/9+6WYqYp/fyQWCvs9GwOhBr8KkugTLaOW20tNEQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WpRXcXx02YFnNQU6xBApi5zx3IvMc9sTZnPzuZ99uQO2QSuXFBcVfJJhVzHsNasTp0vOhYDYO6T6/VIs5Cc7t7F7xiT6CJCizszT9KeSJ3kBxClzzy/MFB6KJxjn7j9yHDXWPO86509dlK1ytD/kvXNRwszV7bOB5/KYJsdmqmB1xhpFHKNdwD8Ztdes1CB8KbcOorMNE965u2rQ1/Rf7P0xpMKoVOvWOBLSG2YErPHzWiKsstPPLTiKT+YzwL/7SwiDKUsAsPvkTKvfHF4Z04MjPXtzzbFRRGSlA+xhY1yq7526sbQc6ux05spLeMz+vYtnMFgaE2NY/awnJOmGYA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 26 Nov 2025 10:13:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 26.11.25 08:59, Jan Beulich wrote:
On 26.11.2025 00:00, Grygorii Strashko wrote:
From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>

Introduce separate HVM_SAVE_RESTORE config for HVM save/restore feature,
which is enabled by default for HVM and depends on MGMT_HYPERCALLS config.

This allows to make MGMT_HYPERCALLS specific changes more granular and, if
required, make HVM save/restore optional, selectable feature.

Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
I'd like to propose this patch as a replacement of Patch 19 [1]

[1] 
https://patchwork.kernel.org/project/xen-devel/patch/20251121105801.1251262-20-Penny.Zheng@xxxxxxx/

  xen/arch/x86/cpu/mcheck/vmce.c       | 4 ++--
  xen/arch/x86/emul-i8254.c            | 4 +++-
  xen/arch/x86/hvm/Kconfig             | 6 ++++++
  xen/arch/x86/hvm/Makefile            | 2 +-
  xen/arch/x86/hvm/hpet.c              | 3 ++-
  xen/arch/x86/hvm/hvm.c               | 4 ++++
  xen/arch/x86/hvm/irq.c               | 2 ++
  xen/arch/x86/hvm/mtrr.c              | 2 ++
  xen/arch/x86/hvm/pmtimer.c           | 2 ++
  xen/arch/x86/hvm/rtc.c               | 2 ++
  xen/arch/x86/hvm/vioapic.c           | 2 ++
  xen/arch/x86/hvm/viridian/viridian.c | 2 ++
  xen/arch/x86/hvm/vlapic.c            | 3 ++-
  xen/arch/x86/hvm/vpic.c              | 2 ++
  xen/arch/x86/include/asm/hvm/save.h  | 5 ++++-
  15 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/vmce.c b/xen/arch/x86/cpu/mcheck/vmce.c
index 1a7e92506ac8..ba27f6f8bd91 100644
--- a/xen/arch/x86/cpu/mcheck/vmce.c
+++ b/xen/arch/x86/cpu/mcheck/vmce.c
@@ -349,7 +349,7 @@ int vmce_wrmsr(uint32_t msr, uint64_t val)
      return ret;
  }
-#if CONFIG_HVM
+#if defined(CONFIG_HVM_SAVE_RESTORE)

#if wasn't really correct to use here; #ifdef was and is wanted.

  static int cf_check vmce_save_vcpu_ctxt(struct vcpu *v, hvm_domain_context_t 
*h)
  {
      struct hvm_vmce_vcpu ctxt = {
@@ -380,10 +380,10 @@ static int cf_check vmce_load_vcpu_ctxt(struct domain *d, 
hvm_domain_context_t *
return err ?: vmce_restore_vcpu(v, &ctxt);
  }
+#endif /* CONFIG_HVM_SAVE_RESTORE */
HVM_REGISTER_SAVE_RESTORE(VMCE_VCPU, vmce_save_vcpu_ctxt, NULL,
                            vmce_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
-#endif

Why would this #endif move? (It gaining a comment is fine of course.)

Huh. Initially I've used __maybe_unused with save/restore callbacks and
HVM_REGISTER_SAVE_RESTORE() defines as NOP.

I'll correct and drop empty HVM_REGISTER_SAVE_RESTORE()

--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -93,4 +93,10 @@ config MEM_SHARING
        depends on INTEL_VMX
        depends on MGMT_HYPERCALLS
+config HVM_SAVE_RESTORE
+       depends on MGMT_HYPERCALLS
+       def_bool y
+       help
+         Enables HVM save/load functionality.
+
  endif

This wants to move up some imo; MEM_SHARING is clearing the more niche feature.


Could you clarify preferred place - before which Kconfig option in hvm/Kconfig?


--
Best regards,
-grygorii




 


Rackspace

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