From: z <alfred.z.song@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "Ian Campbell" <ian.campbell@citrix.com>,
"Stefano Stabellini" <stefano.stabellini@eu.citrix.com>,
jinsong.liu@alibaba-inc.com, ian.jackson@eu.citrix.com,
"Zhuo Song" <songzhuo.sz@alibaba-inc.com>,
"马涛(伯瑜)" <boyu.mt@alibaba-inc.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH] xc_cpuid_x86.c: No need to mask NX twice
Date: Sat, 6 Sep 2014 00:35:08 +0800 [thread overview]
Message-ID: <CAEzNp8YtXj94MSYsMBwLoi96s3VN4F8WKpijrAzPtJLLRq5-rQ@mail.gmail.com> (raw)
In-Reply-To: <5409FC650200007800031931@mail.emea.novell.com>
[-- Attachment #1.1: Type: text/plain, Size: 2467 bytes --]
Got it. Thanks, Jan.
If so, I think we could remove the condition for masking NX in both vendor
specific functions, since the architectural logic has help cover it and the
judgement is unnecessary. For example:
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 61af3e6..6bd89b0 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -116,7 +116,7 @@ static void amd_xc_cpuid_policy(
bitmaskof(X86_FEATURE_TBM) |
bitmaskof(X86_FEATURE_DBEXT));
regs[3] &= (0x0183f3ff | /* features shared with 0x00000001:EDX */
- (is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
+ bitmaskof(X86_FEATURE_NX) |
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
bitmaskof(X86_FEATURE_SYSCALL) |
bitmaskof(X86_FEATURE_MP) |
@@ -201,7 +201,7 @@ static void intel_xc_cpuid_policy(
regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
bitmaskof(X86_FEATURE_3DNOWPREFETCH) |
bitmaskof(X86_FEATURE_ABM);
- regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
+ regs[3] &= (bitmaskof(X86_FEATURE_NX) |
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_RDTSCP) : 0));
Zhuo
On Sat, Sep 6, 2014 at 12:09 AM, Jan Beulich <JBeulich@suse.com> wrote:
> >>> On 05.09.14 at 17:45, <alfred.z.song@gmail.com> wrote:
> > Hi, Jan
> >
> > I am sorry for making you confused.
> >
> > What I mean is there seems to be some redundant work. For example, to
> leaf
> > 0x80000001, the generic work (masking NX and PSE36) has been overwritten
> by
> > the the vendor's functions (amd_xc_cpuid_policy and
> intel_xc_cpuid_policy)
> > , why couldn't we just drop them and leave the work to the vendor? Of
> > cause, another way is just like you said, keeping the generic ones, and
> > changing the logic in the vendor-based implementation.
> >
> > What I want to do is to simplify this if possible. :)
>
> Right, yet conceptually anything that is defined by the architecture
> would better be done in the generic routine. Anything that is truly
> vendor specific should be done in the vendor ones. And the
> dependency of NX on PAE is (nowadays) an architectural one.
>
> Jan
>
>
[-- Attachment #1.2: Type: text/html, Size: 3435 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-09-05 16:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 10:11 [PATCH] xc_cpuid_x86.c: No need to mask NX twice Zhuo Song
2014-09-05 10:32 ` Jan Beulich
2014-09-05 13:54 ` z
2014-09-05 14:10 ` Jan Beulich
2014-09-05 15:45 ` z
2014-09-05 16:09 ` Jan Beulich
2014-09-05 16:35 ` z [this message]
2014-09-08 6:59 ` Jan Beulich
2014-09-08 8:48 ` z
2014-09-08 9:09 ` Jan Beulich
2014-09-08 9:56 ` z
2014-09-08 10:54 ` Jan Beulich
2014-09-08 12:07 ` z
2014-09-08 14:43 ` z
2014-09-08 15:07 ` Jan Beulich
2014-09-09 4:48 ` z
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=CAEzNp8YtXj94MSYsMBwLoi96s3VN4F8WKpijrAzPtJLLRq5-rQ@mail.gmail.com \
--to=alfred.z.song@gmail.com \
--cc=JBeulich@suse.com \
--cc=boyu.mt@alibaba-inc.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jinsong.liu@alibaba-inc.com \
--cc=songzhuo.sz@alibaba-inc.com \
--cc=stefano.stabellini@eu.citrix.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 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).