From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Feng Wu <feng.wu@intel.com>,
"ian.campbell@citrix.com" <ian.campbell@citrix.com>,
Eddie Dong <eddie.dong@intel.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Jun Nakajima <jun.nakajima@intel.com>
Subject: Re: [PATCH v2 1/7] x86: Add support for STAC/CLAC instructions
Date: Wed, 23 Apr 2014 14:04:33 +0100 [thread overview]
Message-ID: <5357BA61.2010801@citrix.com> (raw)
In-Reply-To: <5357D4A3020000780000B84F@nat28.tlf.novell.com>
On 23/04/14 13:56, Jan Beulich wrote:
>>>> On 23.04.14 at 14:50, <andrew.cooper3@citrix.com> wrote:
>> On 23/04/14 13:42, Jan Beulich wrote:
>>>>>> On 23.04.14 at 14:11, <feng.wu@intel.com> wrote:
>>>>>> +#define ASM_AC(op) \
>>>>>> + pushq %rax; \
>>>>>> + leaq boot_cpu_data(%rip), %rax; \
>>>>>> + btl $X86_FEATURE_SMAP-7*32, CPUINFO86_leaf7_features(%rax); \
>>>>>> + jnc 881f; \
>>>>>> + op; \
>>>>>> +881: popq %rax
>>>>> While it is unlikely to change going forwards, $(X86_FEATURE_SMAP & 31)
>>>>> looks more obviously correct.
>>>> Okay.
>>>>> Also, given that boot_cpu_data(%rip) is an assembler know constant
>>>>> value, and CPUINFO86_leaf7_features is a constant offset from that, is
>>>>> there any way of persuading the assembler to conjoin the two and forgo
>>>>> the push, lea and pop. (I have had a go, but lack sufficient caffeine
>>>>> this early in the day)
>>>>>
>>>>> ~Andrew
>>>> I thought about this idea before posting this version, but I didn't get a
>>>> good
>>>> solution. I will continue to find a better way to handle this.
>>> btl $X86_FEATURE_SMAP & 31, ((X86_FEATURE_SMAP >> 3) &
>> ~3)+CPUINFO86_features+boot_cpu_data(%rip)
>>> (at once replacing CPUINFO86_ext_features with CPUINFO86_features,
>>> perhaps also changing the [inconsistent] name prefix; likely a suitable
>>> macro could be created usable both here and wherever
>>> CPUINFO86_ext_features is being used currently)
>> This needs careful synchronising with the "no-smap" command line
>> parameter which can shoot that bit out of boot features some time after
>> it being set.
>>
>> It might be easier just to have bool_t __read_mostly smap_in_use;
> For one I can't see how this relates to the coding suggestion - from
> a functional pov the code above does nothing else than what Feng's
> original code did.
My appologies - it was not in reference to the coding suggestion persay,
but a thought that occurred to me while reading the thread.
>
> And then, as long as the SMAP feature bit was ever set in the feature
> mask (i.e. even if it gets cleared later), executing an extra stac or
> clac will be harmless - we don't care whether we run with EFLAGS.AC
> set or clear when CR4.SMAP is zero.
>
> Jan
>
However, this being true means that it should be fine as-was.
~Andrew
next prev parent reply other threads:[~2014-04-23 13:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 14:34 [PATCH v2 1/7] x86: Add support for STAC/CLAC instructions Feng Wu
2014-04-23 10:06 ` Andrew Cooper
2014-04-23 12:11 ` Wu, Feng
2014-04-23 12:42 ` Jan Beulich
2014-04-23 12:50 ` Andrew Cooper
2014-04-23 12:56 ` Jan Beulich
2014-04-23 13:04 ` Andrew Cooper [this message]
2014-04-23 10:16 ` Jan Beulich
2014-04-23 12:32 ` Wu, Feng
2014-04-23 12:45 ` Jan Beulich
2014-04-25 8:51 ` Wu, Feng
2014-04-25 10:02 ` Andrew Cooper
2014-04-25 10:16 ` Jan Beulich
2014-04-25 10:38 ` Jan Beulich
2014-04-28 1:46 ` Wu, Feng
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=5357BA61.2010801@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=eddie.dong@intel.com \
--cc=feng.wu@intel.com \
--cc=ian.campbell@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.