From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: "Jan Beulich" <JBeulich@suse.com>
Cc: "xen-devel" <xen-devel@lists.xen.org>, <konrad.wilk@oracle.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH] PVH: vcpu info placement, load selectors, and remove debug printk.
Date: Wed, 5 Jun 2013 12:17:06 -0700 [thread overview]
Message-ID: <20130605121706.3a8211d6@mantra.us.oracle.com> (raw)
In-Reply-To: <51AEFED002000078000DB542@nat28.tlf.novell.com>
On Wed, 05 Jun 2013 08:03:12 +0100
"Jan Beulich" <JBeulich@suse.com> wrote:
> >>> On 04.06.13 at 23:53, Mukesh Rathor <mukesh.rathor@oracle.com>
> >>> wrote:
> > Following OK? :
> >
> > if (xen_feature(XENFEAT_auto_translated_physmap)) {
> > switch_to_new_gdt(0);
> >
> > asm volatile (
> > "pushq %%rax\n"
> > "leaq 1f(%%rip),%%rax\n"
> > "pushq %%rax\n"
> > "lretq\n"
> > "1:\n"
> > : : "a" (__KERNEL_CS) : "memory");
> >
> > return;
> > }
>
> While generally the choice of using %%rax instead of %0 here is
> a matter of taste to some degree, I still don't see why you can't
> use "r" as the constraint here in the first place.
The compiler mostly picks eax anyways, but good suggestion.
> Furthermore, assuming this sits in a function guaranteed to not be
> inlined, this has a latent bug (and if the assumption isn't right, the
> bug is real) in that the asm() modifies %rax without telling the
> compiler.
According to one of the unofficial asm tutorials i've here, the compiler
knows since it's input and doesn't need to be told. In fact
it'll barf if added to clobber list.
> This is how I would have done it:
>
> unsigned long dummy;
>
> asm volatile ("pushq %0\n"
> "leaq 1f(%%rip),%0\n"
> "pushq %0\n"
> "lretq\n"
> "1:\n"
> : "=&r" (dummy) : "0" (__KERNEL_CS));
>
Looks good. Thanks,
Mukesh
next prev parent reply other threads:[~2013-06-05 19:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 0:43 Mukesh Rathor
2013-06-04 8:27 ` [Xen-devel] " Jan Beulich
2013-06-04 21:53 ` Mukesh Rathor
2013-06-05 7:03 ` Jan Beulich
2013-06-05 19:17 ` Mukesh Rathor [this message]
2013-06-06 6:35 ` Jan Beulich
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=20130605121706.3a8211d6@mantra.us.oracle.com \
--to=mukesh.rathor@oracle.com \
--cc=JBeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xen.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®