KVM Archive on lore.kernel.org
 help / color / Atom feed
* Intercepting RDTSC instruction by causing a VMEXIT
@ 2021-04-17  4:54 Arnabjyoti Kalita
  2021-04-19 16:46 ` Sean Christopherson
  0 siblings, 1 reply; 7+ messages in thread
From: Arnabjyoti Kalita @ 2021-04-17  4:54 UTC (permalink / raw)
  To: kvm

Hello all,

I'm having a requirement to record values obtained by reading tsc clock.

The command line I use to start QEMU in KVM mode is as below -

sudo ./qemu-system-x86_64 -m 1024 --machine pc-i440fx-2.5 -cpu
qemu64,-vme,-x2apic,-kvmclock,+lahf_lm,+3dnowprefetch,+vmx -enable-kvm
-netdev tap,id=tap1,ifname=tap0,script=no,downscript=no -device
virtio-net-pci,netdev=tap1,mac=00:00:00:00:00:00 -drive
-device virtio-blk-pci,drive=img-direct

I am using QEMU version 2.11.92 and the guest kernel is a
4.4.0-116-generic. I use the CPU model "qemu64" because I have a
requirement to create a snapshot of this guest and load the snapshot
in TCG mode. The generic CPU model helps, in this regard.

Now when the guest is running, I want to intercept all rdtsc
instructions and record the tsc clock values. I know that for this to
happen, the CPU_BASED_RDTSC_EXITING flag needs to exist for the
particular CPU model.

How do I start adding support for causing VMEXIT upon rdtsc execution?

I see that a fairly recent commit in QEMU helps adding nested VMX
controls to named CPU models, but not "qemu64". Can I extend this
commit to add these controls to "qemu64" as well? Will making this
change immediately add support for intercepting VMEXITS for "qemu64"

Thank you very much.

Best Regards,
Arnabjyoti Kalita

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-17  4:54 Intercepting RDTSC instruction by causing a VMEXIT Arnabjyoti Kalita
2021-04-19 16:46 ` Sean Christopherson
2021-04-20  2:33   ` Arnabjyoti Kalita
     [not found]     ` <CAJGDS+GT1mKHz6K=qHQf54S_97ym=nRP12MfO6OSEOpLYGht=A@mail.gmail.com>
2021-04-26  1:51       ` Arnabjyoti Kalita
2021-04-26 16:05       ` Sean Christopherson
2021-04-27  2:19         ` Arnabjyoti Kalita
2021-04-30 17:16           ` Arnabjyoti Kalita

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git