From: "Jan Beulich" <JBeulich@suse.com>
To: Feng Wu <feng.wu@intel.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
"keir.xen@gmail.com" <keir.xen@gmail.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/3] x86: Port the basic alternative mechanism from Linux to Xen
Date: Tue, 27 May 2014 10:30:48 +0100 [thread overview]
Message-ID: <538477680200007800015EDB@mail.emea.novell.com> (raw)
In-Reply-To: <E959C4978C3B6342920538CF579893F001FC552A@SHSMSX104.ccr.corp.intel.com>
>>> On 27.05.14 at 08:13, <feng.wu@intel.com> wrote:
>> From: Andrew Cooper [mailto:amc96@hermes.cam.ac.uk] On Behalf Of
>> On 26/05/2014 08:27, Feng Wu wrote:
>> > +void __init arch_init_ideal_nops(void)
>> > +{
>> > + switch (boot_cpu_data.x86_vendor)
>> > + {
>> > + case X86_VENDOR_INTEL:
>> > + /*
>> > + * Due to a decoder implementation quirk, some
>> > + * specific Intel CPUs actually perform better with
>> > + * the "k8_nops" than with the SDM-recommended NOPs.
>> > + */
>> > + if ( boot_cpu_data.x86 == 6 &&
>> > + boot_cpu_data.x86_model >= 0x0f &&
>> > + boot_cpu_data.x86_model != 0x1c &&
>> > + boot_cpu_data.x86_model != 0x26 &&
>> > + boot_cpu_data.x86_model != 0x27 &&
>> > + boot_cpu_data.x86_model < 0x30 )
>> > + ideal_nops = k8_nops;
>> > + else
>> > + ideal_nops = p6_nops;
>> > + break;
>> > + default:
>> > + ideal_nops = k8_nops;
>> > + }
>> > +}
>>
>> Surely given the statement in the middle, the better default for
>> ideal_nops() would be the k8_nops, and a simple if in
>> arch_init_ideal_ops(). Also, it could quite easily be static and called
>> from "alternative_instructions()", allowing it not to be exported, and
>> for ideal_nops to also be static and __init.
>
> Why do you think the default value should be "k8_nops"?
Just look at your code above: It could become shorter, and hence
easier to read, understand, and maintain if you set ideal_nops to
k8_nops up front, and modified it to p6_nops only on suitable
Intel CPU models.
Jan
next prev parent reply other threads:[~2014-05-27 9:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 7:27 [PATCH 0/3] x86: Use alternative mechanism to define CLAC/STAC Feng Wu
2014-05-26 7:27 ` [PATCH 1/3] x86: Add definitions for NOP operation Feng Wu
2014-05-26 15:04 ` Andrew Cooper
2014-05-26 7:27 ` [PATCH 2/3] x86: Port the basic alternative mechanism from Linux to Xen Feng Wu
2014-05-26 15:40 ` Andrew Cooper
2014-05-26 16:16 ` Jan Beulich
2014-05-27 6:13 ` Wu, Feng
2014-05-27 9:30 ` Jan Beulich [this message]
2014-05-27 15:35 ` Jan Beulich
2014-05-26 7:27 ` [PATCH 3/3] x86: Use alternative mechanism to define CLAC/STAC Feng Wu
2014-05-26 15:49 ` Andrew Cooper
2014-05-26 16:18 ` Jan Beulich
2014-05-26 16:22 ` Andrew Cooper
2014-05-27 6:24 ` Wu, Feng
2014-05-27 15:42 ` 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=538477680200007800015EDB@mail.emea.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=feng.wu@intel.com \
--cc=keir.xen@gmail.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).