From: Paolo Bonzini <pbonzini@redhat.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
x86@kernel.org, "Peter Zijlstra" <peterz@infradead.org>,
"H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/5] KVM: VMX: Add error handling to VMREAD helper
Date: Mon, 29 Jul 2019 11:20:16 +0200 [thread overview]
Message-ID: <abcf50fc-0037-446f-36a3-1bd00091ce4f@redhat.com> (raw)
In-Reply-To: <20190728193641.mjxrtcc6ps72z3sp@treble>
On 28/07/19 21:36, Josh Poimboeuf wrote:
> On Fri, Jul 19, 2019 at 01:41:08PM -0700, Sean Christopherson wrote:
>> @@ -68,8 +67,22 @@ static __always_inline unsigned long __vmcs_readl(unsigned long field)
>> {
>> unsigned long value;
>>
>> - asm volatile (__ex_clear("vmread %1, %0", "%k0")
>> - : "=r"(value) : "r"(field));
>> + asm volatile("1: vmread %2, %1\n\t"
>> + ".byte 0x3e\n\t" /* branch taken hint */
>> + "ja 3f\n\t"
>> + "mov %2, %%" _ASM_ARG1 "\n\t"
>> + "xor %%" _ASM_ARG2 ", %%" _ASM_ARG2 "\n\t"
>> + "2: call vmread_error\n\t"
>> + "xor %k1, %k1\n\t"
>> + "3:\n\t"
>> +
>> + ".pushsection .fixup, \"ax\"\n\t"
>> + "4: mov %2, %%" _ASM_ARG1 "\n\t"
>> + "mov $1, %%" _ASM_ARG2 "\n\t"
>> + "jmp 2b\n\t"
>> + ".popsection\n\t"
>> + _ASM_EXTABLE(1b, 4b)
>> + : ASM_CALL_CONSTRAINT, "=r"(value) : "r"(field) : "cc");
>
> Was there a reason you didn't do the asm goto thing here like you did
> for the previous patch? That seemed cleaner, and needs less asm.
It's because asm goto doesn't support outputs.
Paolo
> I think the branch hints aren't needed -- they're ignored on modern
> processors. Ditto for the previous patch.
>
> Also please use named asm operands whereever you can, like "%[field]"
> instead of "%2". It helps a lot with readability.
>
next prev parent reply other threads:[~2019-07-29 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 20:41 [PATCH v2 0/5] KVM: VMX: Optimize VMX instrs error/fault handling Sean Christopherson
2019-07-19 20:41 ` [PATCH v2 1/5] objtool: KVM: x86: Check kvm_rebooting in kvm_spurious_fault() Sean Christopherson
2019-07-19 20:41 ` [PATCH v2 2/5] KVM: VMX: Optimize VMX instruction error and fault handling Sean Christopherson
2019-07-19 20:41 ` [PATCH v2 3/5] KVM: VMX: Add error handling to VMREAD helper Sean Christopherson
2019-07-28 19:36 ` Josh Poimboeuf
2019-07-29 9:20 ` Paolo Bonzini [this message]
2019-07-19 20:41 ` [PATCH v2 4/5] KVM: x86: Drop ____kvm_handle_fault_on_reboot() Sean Christopherson
2019-07-19 20:41 ` [PATCH v2 5/5] KVM: x86: Don't check kvm_rebooting in __kvm_handle_fault_on_reboot() Sean Christopherson
2019-07-19 21:41 ` Paolo Bonzini
2019-09-24 21:03 ` [PATCH v2 0/5] KVM: VMX: Optimize VMX instrs error/fault handling Sean Christopherson
2019-09-25 13:30 ` Paolo Bonzini
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=abcf50fc-0037-446f-36a3-1bd00091ce4f@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.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;
as well as URLs for NNTP newsgroup(s).