From: Bill Wendling <morbo@google.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: kvm list <kvm@vger.kernel.org>
Subject: Re: [kvm-unit-tests PATCH] x86: remove memory constraint from "mov" instruction
Date: Wed, 11 Sep 2019 17:35:09 -0500 [thread overview]
Message-ID: <CAGG=3QXxGVs-s0H2Emw1tYMtcGtQsEHrYnmHztL=vOFanZegMw@mail.gmail.com> (raw)
In-Reply-To: <20190911190840.GG1045@linux.intel.com>
On Wed, Sep 11, 2019 at 2:08 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> On Mon, Sep 09, 2019 at 02:19:20PM -0700, Bill Wendling wrote:
> > The "mov" instruction to get the error code shouldn't move into a memory
> > location. Don't allow the compiler to make this decision. Instead
> > specify that only a register is appropriate here.
>
> I'd prefer the changelog to say something like:
>
> Remove a bogus memory contraint as x86 does not have a generic
> memory-to-memory "mov" instruction.
>
> Saying "shouldn't move into a memory location" makes it sound like there's
> an unwanted side effect when the compiler selects memory, though I suppose
> you could argue that a build error is an unwanted side effect :-).
>
No prob. :-) I'm not familiar with sending these patches via email. Do
I need to regenerate the patch and send via "send-email"? (Similar
question for the "Reviewed-By" comments.)
> Out of curiosity, do any compilers actually generate errors because of
> this, or is it simply dead code?
>
Yeah, clang uses a memory location, probably due to inlining causing
register pressure (that's a guess, I didn't explore it too deeply).
-bw
> > Signed-off-by: Bill Wendling <morbo@google.com>
> > ---
> > lib/x86/desc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/x86/desc.c b/lib/x86/desc.c
> > index 5f37cef..451f504 100644
> > --- a/lib/x86/desc.c
> > +++ b/lib/x86/desc.c
> > @@ -263,7 +263,7 @@ unsigned exception_error_code(void)
> > {
> > unsigned short error_code;
> >
> > - asm("mov %%gs:6, %0" : "=rm"(error_code));
> > + asm("mov %%gs:6, %0" : "=r"(error_code));
> > return error_code;
> > }
next prev parent reply other threads:[~2019-09-11 22:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 21:19 [kvm-unit-tests PATCH] x86: remove memory constraint from "mov" instruction Bill Wendling
2019-09-10 16:44 ` Jim Mattson
2019-09-11 19:08 ` Sean Christopherson
2019-09-11 22:35 ` Bill Wendling [this message]
2019-09-12 20:59 ` [PATCH] " Bill Wendling
2019-09-19 21:44 ` Sean Christopherson
2019-09-24 14:02 ` [kvm-unit-tests PATCH] " 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='CAGG=3QXxGVs-s0H2Emw1tYMtcGtQsEHrYnmHztL=vOFanZegMw@mail.gmail.com' \
--to=morbo@google.com \
--cc=kvm@vger.kernel.org \
--cc=sean.j.christopherson@intel.com \
/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).