From: Wei Zhang <zhanwei@google.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Wei Zhang <zhanwei@google.com>,
Suleiman Souhlal <suleiman@google.com>,
Sangwhan Moon <sxm@google.com>, Ingo Molnar <mingo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] KVM: x86: illustrative example for sending guest _stext with a hypercall
Date: Tue, 12 Apr 2022 19:58:46 +0000 [thread overview]
Message-ID: <20220412195846.3692374-3-zhanwei@google.com> (raw)
In-Reply-To: <20220412195846.3692374-1-zhanwei@google.com>
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@google.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
next prev parent reply other threads:[~2022-04-12 20:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 19:58 [PATCH 0/2] KVM: x86: Fix incorrect VM-exit profiling Wei Zhang
2022-04-12 19:58 ` [PATCH 1/2] KVM: x86: allow guest to send its _stext for kvm profiling Wei Zhang
2022-05-09 23:55 ` Sean Christopherson
2022-05-11 16:45 ` Wei Zhang
2022-04-12 19:58 ` Wei Zhang [this message]
2022-05-09 23:57 ` [PATCH 0/2] KVM: x86: Fix incorrect VM-exit profiling Sean Christopherson
2022-05-11 16:45 ` Wei Zhang
2022-05-11 19:42 ` Sean Christopherson
2022-05-16 19:30 ` Wei Zhang
2022-05-18 4:27 ` Suleiman Souhlal
2022-05-18 15:34 ` Sean Christopherson
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=20220412195846.3692374-3-zhanwei@google.com \
--to=zhanwei@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=suleiman@google.com \
--cc=sxm@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox