From: Paolo Bonzini <pbonzini@redhat.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Borislav Petkov <bp@suse.de>,
Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Nathan Chancellor <nathan@kernel.org>, x86-ml <x86@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
KVM list <kvm@vger.kernel.org>
Subject: Re: [GIT PULL] objtool/urgent for v5.15-rc4
Date: Mon, 4 Oct 2021 09:28:08 +0200 [thread overview]
Message-ID: <a1a283ab-bede-412d-6552-21a2814b39cb@redhat.com> (raw)
In-Reply-To: <20211003230206.hhrrhna52dnhumji@treble>
On 04/10/21 01:02, Josh Poimboeuf wrote:
> That said, I have no idea what's going in that code or why
> kvm_fastop_exception() is clearing %esi.
It's handled here (which definitely qualifies as "funky sh*t"):
asm("push %[flags]; popf; " CALL_NOSPEC " ; pushf; pop %[flags]\n"
: "+a"(ctxt->dst.val), "+d"(ctxt->src.val), [flags]"+D"(flags),
[thunk_target]"+S"(fop), ASM_CALL_CONSTRAINT
: "c"(ctxt->src2.val));
ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);
if (!fop) /* exception is returned in fop variable */
return emulate_de(ctxt);
and documented here:
/*
* fastop functions have a special calling convention:
*
* dst: rax (in/out)
* src: rdx (in/out)
* src2: rcx (in)
* flags: rflags (in/out)
* ex: rsi (in:fastop pointer, out:zero if exception)
*
* Moreover, they are all exactly FASTOP_SIZE bytes long, so functions for
* different operand sizes can be reached by calculation, rather than a jump
* table (which would be bigger than the code).
*/
The fastop stuff saves quite a few clock cycles and lines of code, by
avoiding complicated emulation of x86 flags. I'll check out the .global
annotations, since they are indeed unnecessary.
Paolo
prev parent reply other threads:[~2021-10-04 7:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-03 9:43 Borislav Petkov
2021-10-03 18:20 ` pr-tracker-bot
2021-10-03 18:38 ` Linus Torvalds
2021-10-03 19:02 ` Linus Torvalds
2021-10-03 19:10 ` Linus Torvalds
2021-10-03 23:02 ` Josh Poimboeuf
2021-10-04 7:28 ` Paolo Bonzini [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=a1a283ab-bede-412d-6552-21a2814b39cb@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@suse.de \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=jpoimboe@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=peterz@infradead.org \
--cc=seanjc@google.com \
--cc=torvalds@linux-foundation.org \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--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
all inboxes | Powered by JetHome®