Re: [kvm-unit-tests PATCH v3 04/11] lib: x86: Import insn decoder from Linux

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

 



On Thu, Feb 24, 2022, Varad Gautam wrote:
> Processing #VC exceptions on AMD SEV-ES requires instruction decoding
> logic to set up the right GHCB state before exiting to the host.
> 
> Pull in the instruction decoder from Linux for this purpose.

Do we really need Linux's decoder for this?  Linux needs a more robust decoder
because it has to deal with userspace crud, but KUT should have full control over
what code it encounters in a #VC handler, e.g. we should never have to worry about
ignore prefixes on a WRMSR.  And looking at future patches, KUT is still looking
at raw opcode bytes, e.g. 

	/* Is it a WRMSR? */
	exit_info_1 = (ctxt->insn.opcode.bytes[1] == 0x30) ? 1 : 0;

and the giant switch in vc_ioio_exitinfo().

The decoder does bring a bit of cleanliness, but 2k+ lines of code that's likely
to get stale fairly quickly is going to be a maintenance burden.  And we certainly
don't need things like VEX prefix handling :-)

Do you happen to have data on how often each flavors of instructions is encountered?
E.g. can we get away with a truly minimal "decoder" by modifying select tests to
avoid hard-to-decode instructions?  Or even patch them to do VMGEXIT directly?



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux