From: David Edmondson <email@example.com> To: Aaron Lewis <firstname.lastname@example.org> Cc: Sean Christopherson <email@example.com>, Jim Mattson <firstname.lastname@example.org>, kvm list <email@example.com> Subject: Re: [PATCH v5 1/2] kvm: x86: Allow userspace to handle emulation errors Date: Mon, 10 May 2021 10:37:36 +0100 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <CAAAPnDFVR9xXEF_3_rEDhNhbe7r7QCEEiJ399Zv6h+ZUX=EfWA@mail.gmail.com> On Friday, 2021-05-07 at 07:27:07 -07, Aaron Lewis wrote: >> > +7.24 KVM_CAP_EXIT_ON_EMULATION_FAILURE >> > +-------------------------------------- >> > + >> > +:Architectures: x86 >> > +:Parameters: args whether the feature should be enabled or not >> > + >> > +When this capability is enabled the in-kernel instruction emulator packs >> > +the exit struct of KVM_INTERNAL_ERROR with the instruction length and >> > +instruction bytes when an error occurs while emulating an instruction. This >> > +will also happen when the emulation type is set to EMULTYPE_SKIP, but with this >> > +capability enabled this becomes the default behavior regarless of how the >> >> s/regarless/regardless/ >> >> > +emulation type is set unless it is a VMware #GP; in that case a #GP is injected >> > +and KVM does not exit to userspace. >> > + >> > +When this capability is enabled use the emulation_failure struct instead of the >> > +internal struct for the exit struct. They have the same layout, but the >> > +emulation_failure struct matches the content better. It also explicitly defines >> > +the 'flags' field which is used to describe the fields in the struct that are >> > +valid (ie: if KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES is set in the >> > +'flags' field then 'insn_size' and 'insn_bytes' has valid data in them.) >> >> Starting both paragraphs with "With this capability enabled..." would >> probably cause me to stop reading if I didn't enable the capability, but >> as the first paragraph goes on to say, EMULTYPE_SKIP will also cause the >> instruction to be provided. >> > > What about this instead? Reads better to me, thanks. > When this capability is enabled, an emulation failure will result in an exit > to userspace with KVM_INTERNAL_ERROR (except when the emulator was invoked > to handle a VMware backdoor instruction). Furthermore, KVM will now provide up > to 15 instruction bytes for any exit to userspace resulting from an emulation > failure. When these exits to userspace occur use the emulation_failure struct > instead of the internal struct. They both have the same layout, but the > emulation_failure struct matches the content better. It also explicitly > defines the 'flags' field which is used to describe the fields in the struct > that are valid (ie: if KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES is > set in the 'flags' field then both 'insn_size' and 'insn_bytes' have valid data > in them.) > > I left out the part about EMULTYPE_SKIP because that behavior is not > affected by setting KVM_CAP_EXIT_ON_EMULATION_FAILURE, so I thought it > wasn't needed in the documentation here. dme. -- We're up all night to get lucky.
next prev parent reply other threads:[~2021-05-10 9:37 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-30 14:37 [PATCH v5 0/2] fallback for " Aaron Lewis 2021-04-30 14:37 ` [PATCH v5 1/2] kvm: x86: Allow userspace to handle " Aaron Lewis 2021-05-05 12:34 ` David Edmondson 2021-05-07 14:27 ` Aaron Lewis 2021-05-10 9:37 ` David Edmondson [this message] 2021-04-30 14:37 ` [PATCH v5 2/2] selftests: kvm: Allows " Aaron Lewis 2021-04-30 17:39 ` Jim Mattson 2021-05-03 18:04 ` Jim Mattson
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 \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH v5 1/2] kvm: x86: Allow userspace to handle emulation errors' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).