[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c6f47bcf-d75d-4e00-b693-7df97599973c@suse.com>
Date: Sat, 9 Nov 2024 10:29:36 +0100
From: Jürgen Groß <jgross@...e.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] KVM/x86: don't use a literal 1 instead of RET_PF_RETRY
On 09.11.24 09:03, Paolo Bonzini wrote:
> On 11/8/24 19:44, Sean Christopherson wrote:
>> On Fri, Nov 08, 2024, Paolo Bonzini wrote:
>>> Queued, thanks.
>>
>> Noooo! Can you un-queue?
>
> Yes, I hadn't even pushed it to kvm/queue. I applied it out of a whim but then
> realized that it wasn't really -rc7 material.
>
>> The return from kvm_mmu_page_fault() is NOT RET_PF_xxx, it's KVM outer 0/1/-
>> errno.
>> I.e. '1' is saying "resume the guest", it has *nothing* to do with RET_PF_RETRY.
>> E.g. that path also handles RET_PF_FIXED, RET_PF_SPURIOUS, etc.
>
> Gah, I even checked the function and was messed up by the other "return
> RET_PF_RETRY".
>
> If you add X86EMUL_* to the mix, it's even worse. I had to read this three
> times to understand that it was *not* returning X86EMUL_CONTINUE by mistake.
> Can I haz strongly-typed enums like in C++?...
>
> r = kvm_check_emulate_insn(vcpu, emulation_type, insn, insn_len);
> if (r != X86EMUL_CONTINUE) {
> ...
> }
>
> if (!(emulation_type & EMULTYPE_NO_DECODE)) {
> kvm_clear_exception_queue(vcpu);
> if (kvm_vcpu_check_code_breakpoint(vcpu, emulation_type, &r))
> return r;
> ...
> }
>
> So yeah this really has to be fixed the right way, after all even RET_PF_*
> started out as a conversion from 0/1.
>
> Obligatory bikeshedding, how do KVM_RET_USER and KVM_RET_GUEST sound like?
+1
Juergen
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3684 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists