public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	kvm@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] KVM/x86: don't use a literal 1 instead of RET_PF_RETRY
Date: Sat, 9 Nov 2024 10:29:36 +0100	[thread overview]
Message-ID: <c6f47bcf-d75d-4e00-b693-7df97599973c@suse.com> (raw)
In-Reply-To: <54f44f6a-f504-4b56-a70f-cf96720ff1b8@redhat.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1633 bytes --]

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

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

      reply	other threads:[~2024-11-09  9:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 16:13 [PATCH] KVM/x86: don't use a literal 1 instead of RET_PF_RETRY Juergen Gross
2024-11-08 17:13 ` Paolo Bonzini
2024-11-08 18:44   ` Sean Christopherson
2024-11-08 19:18     ` Jürgen Groß
2024-11-08 22:12       ` Sean Christopherson
2024-11-09  7:06         ` Jürgen Groß
2024-11-09  8:03     ` Paolo Bonzini
2024-11-09  9:29       ` Jürgen Groß [this message]

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=c6f47bcf-d75d-4e00-b693-7df97599973c@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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