From: Yi Sun <yi.y.sun@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org, "Wei Liu" <wei.liu2@citrix.com>,
"Chao Peng" <chao.p.peng@linux.intel.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v7 08/16] x86: implement set value flow for MBA
Date: Mon, 16 Oct 2017 09:44:49 +0800 [thread overview]
Message-ID: <20171016014449.GS11006@yi.y.sun> (raw)
In-Reply-To: <59E0FE3E02000078001864AF@prv-mh.provo.novell.com>
On 17-10-13 09:56:14, Jan Beulich wrote:
> >>> On 13.10.17 at 10:41, <yi.y.sun@linux.intel.com> wrote:
> > @@ -274,16 +280,18 @@ static enum psr_feat_type psr_type_to_feat_type(enum psr_type type)
> > return feat_type;
> > }
> >
> > -static bool psr_check_cbm(unsigned int cbm_len, unsigned long cbm)
> > +/* Implementation of allocation features' functions. */
> > +static bool cat_check_cbm(const struct feat_node *feat, uint32_t *val)
> > {
> > unsigned int first_bit, zero_bit;
> > + unsigned int cbm_len = feat->cat.cbm_len;
> > + unsigned long cbm = *val;
>
> These are necessary changes.
>
> > - /* Set bits should only in the range of [0, cbm_len]. */
> > - if ( cbm & (~0ul << cbm_len) )
> > - return false;
> > -
> > - /* At least one bit need to be set. */
> > - if ( cbm == 0 )
> > + /*
> > + * Set bits should be only in the range of [0, cbm_len).
> > + * And, at least one bit need to be set.
> > + */
> > + if ( (cbm & (~0ul << cbm_len)) || !cbm )
>
> But all of this doesn't really belong here. I don't outright object to
> you leaving it the way it is, but I'd prefer if you dropped these
> changes, or moved them to a separate patch if you think this is
> worthwhile.
>
Then, I would prefer to drop these changes.
> > @@ -501,6 +511,35 @@ static bool mba_get_feat_info(const struct feat_node *feat,
> > static void mba_write_msr(unsigned int cos, uint32_t val,
> > enum psr_type type)
> > {
> > + wrmsrl(MSR_IA32_PSR_MBA_MASK(cos), val);
> > +}
> > +
> > +static bool mba_sanitize_thrtl(const struct feat_node *feat, uint32_t *thrtl)
> > +{
> > + if ( *thrtl > feat->mba.thrtl_max )
> > + return false;
> > +
> > + /*
> > + * Per SDM (chapter "Memory Bandwidth Allocation Configuration"):
> > + * 1. Linear mode: In the linear mode the input precision is defined
> > + * as 100-(MBA_MAX). For instance, if the MBA_MAX value is 90, the
> > + * input precision is 10%. Values not an even multiple of the
> > + * precision (e.g., 12%) will be rounded down (e.g., to 10% delay
> > + * applied).
> > + * 2. Non-linear mode: Input delay values are powers-of-two from zero
> > + * to the MBA_MAX value from CPUID. In this case any values not a
> > + * power of two will be rounded down the next nearest power of two.
> > + */
> > + if ( feat->mba.linear )
> > + *thrtl -= *thrtl % (100 - feat->mba.thrtl_max);
> > + else
> > + {
> > + /* Not power of 2. */
> > + if ( *thrtl & (*thrtl - 1) )
> > + *thrtl &= 1 << (flsl(*thrtl) - 1);
>
> fls() will do now that the parameter type is uint32_t.
>
Yes, you are right. Sorry for missing it.
> Also why do you think &= is better than plain = here?
Not better. Will change it to '='.
>
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-10-16 1:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 8:40 [PATCH v7 00/16] Enable Memory Bandwidth Allocation in Xen Yi Sun
2017-10-13 8:40 ` [PATCH v7 01/16] docs: create Memory Bandwidth Allocation (MBA) feature document Yi Sun
2017-10-13 8:40 ` [PATCH v7 02/16] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general Yi Sun
2017-10-13 14:08 ` Daniel De Graaf
2017-10-13 8:40 ` [PATCH v7 03/16] x86: rename 'cbm_type' to 'psr_type' to make it general Yi Sun
2017-10-13 8:40 ` [PATCH v7 04/16] x86: a few optimizations to psr codes Yi Sun
2017-10-13 8:40 ` [PATCH v7 05/16] x86: implement data structure and CPU init flow for MBA Yi Sun
2017-10-13 10:40 ` Jan Beulich
2017-10-13 8:40 ` [PATCH v7 06/16] x86: implement get hw info " Yi Sun
2017-10-13 8:40 ` [PATCH v7 07/16] x86: implement get value interface " Yi Sun
2017-10-13 8:41 ` [PATCH v7 08/16] x86: implement set value flow " Yi Sun
2017-10-13 15:56 ` Jan Beulich
2017-10-16 1:44 ` Yi Sun [this message]
2017-10-13 8:41 ` [PATCH v7 09/16] tools: create general interfaces to support psr allocation features Yi Sun
2017-10-13 8:41 ` [PATCH v7 10/16] tools: implement the new libxc get hw info interface Yi Sun
2017-10-13 8:41 ` [PATCH v7 11/16] tools: implement the new libxl " Yi Sun
2017-10-13 8:41 ` [PATCH v7 12/16] tools: implement the new xl " Yi Sun
2017-10-13 8:41 ` [PATCH v7 13/16] tools: rename 'xc_psr_cat_type' to 'xc_psr_type' Yi Sun
2017-10-13 8:41 ` [PATCH v7 14/16] tools: implement new generic get value interface and MBA get value command Yi Sun
2017-10-13 8:41 ` [PATCH v7 15/16] tools: implement new generic set value interface and MBA set " Yi Sun
2017-10-13 8:41 ` [PATCH v7 16/16] docs: add MBA description in docs Yi Sun
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=20171016014449.GS11006@yi.y.sun \
--to=yi.y.sun@linux.intel.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=chao.p.peng@linux.intel.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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.