[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220412195846.3692374-3-zhanwei@google.com>
Date: Tue, 12 Apr 2022 19:58:46 +0000
From: Wei Zhang <zhanwei@...gle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Wei Zhang <zhanwei@...gle.com>,
Suleiman Souhlal <suleiman@...gle.com>,
Sangwhan Moon <sxm@...gle.com>, Ingo Molnar <mingo@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] KVM: x86: illustrative example for sending guest _stext
with a hypercall
A guest could send its _stext with the newly added hypercall. The
statistics collected afterwards will be correct in the kernel.
Signed-off-by: Wei Zhang <zhanwei@...gle.com>
---
arch/x86/kernel/setup.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c95b9ac5a457..ee8c4fd4efe9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -24,6 +24,7 @@
#include <linux/static_call.h>
#include <linux/swiotlb.h>
+#include <uapi/linux/kvm_para.h>
#include <uapi/linux/mount.h>
#include <xen/xen.h>
@@ -1241,6 +1242,11 @@ void __init setup_arch(char **cmdline_p)
#endif
unwind_init();
+
+ /*
+ * Send the _stext to the host kernel.
+ */
+ kvm_hypercall1(KVM_HC_GUEST_STEXT, (unsigned long)_stext);
}
#ifdef CONFIG_X86_32
--
2.35.1.1178.g4f1659d476-goog
Powered by blists - more mailing lists