From: Andrew Cooper <andrew.cooper3@citrix.com>
To: He Chen <he.chen@linux.intel.com>, xen-devel@lists.xenproject.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com,
jbeulich@suse.com, chao.p.peng@linux.intel.com, keir@xen.org
Subject: Re: [PATCH v4 2/4] x86: add domctl cmd to set/get CDP code/data CBM
Date: Thu, 17 Sep 2015 11:25:54 +0100 [thread overview]
Message-ID: <55FA9532.9070908@citrix.com> (raw)
In-Reply-To: <1442482536-12024-3-git-send-email-he.chen@linux.intel.com>
On 17/09/15 10:35, He Chen wrote:
> @@ -375,10 +401,48 @@ static int write_l3_cbm(unsigned int socket, unsigned int cos,
> return 0;
> }
>
> -int psr_set_l3_cbm(struct domain *d, unsigned int socket, uint64_t cbm)
> +static int find_cos(struct psr_cat_cbm *map, int cos_max,
> + uint64_t cbm_code, uint64_t cbm_data, bool_t cdp_enabled)
> {
> - unsigned int old_cos, cos;
> - struct psr_cat_cbm *map, *found = NULL;
> + unsigned int cos;
> +
> + for ( cos = 0; cos <= cos_max; cos++ )
> + {
> + if( map[cos].ref &&
> + ((!cdp_enabled && map[cos].u.cbm == cbm_code) ||
> + (cdp_enabled && map[cos].u.code == cbm_code &&
Correct alignment here would have one extra space, as the ( should match
the inner ( of the line above.
> @@ -387,53 +451,80 @@ int psr_set_l3_cbm(struct domain *d, unsigned int socket, uint64_t cbm)
> if ( !psr_check_cbm(info->cbm_len, cbm) )
> return -EINVAL;
>
> + if ( !cdp_enabled && (type == PSR_CBM_TYPE_L3_CODE ||
> + type == PSR_CBM_TYPE_L3_DATA) )
> + return -EINVAL;
> +
> + cos_max = info->cos_max;
> old_cos = d->arch.psr_cos_ids[socket];
> map = info->cos_to_cbm;
>
> - spin_lock(&info->cbm_lock);
> -
> - for ( cos = 0; cos <= info->cos_max; cos++ )
> + switch( type )
> {
> - /* If still not found, then keep unused one. */
> - if ( !found && cos != 0 && map[cos].ref == 0 )
> - found = map + cos;
> - else if ( map[cos].u.cbm == cbm )
> - {
> - if ( unlikely(cos == old_cos) )
> - {
> - ASSERT(cos == 0 || map[cos].ref != 0);
> - spin_unlock(&info->cbm_lock);
> - return 0;
> - }
> - found = map + cos;
> - break;
> - }
> - }
> + case PSR_CBM_TYPE_L3:
> + cbm_code = cbm;
> + cbm_data = cbm;
> + break;
>
> - /* If old cos is referred only by the domain, then use it. */
> - if ( !found && map[old_cos].ref == 1 )
> - found = map + old_cos;
> + case PSR_CBM_TYPE_L3_CODE:
> + cbm_code = cbm;
> + cbm_data = map[old_cos].u.data;
> + break;
>
> - if ( !found )
> - {
> - spin_unlock(&info->cbm_lock);
> - return -EOVERFLOW;
> + case PSR_CBM_TYPE_L3_DATA:
> + cbm_code = map[old_cos].u.code;
> + cbm_data = cbm;
> + break;
> +
> + default:
> + ASSERT_UNREACHABLE();
Alignment here as well.
With these two alignment issues fixed, and the knock-on effect of
dropping .u from the previous patch, Reviewed-by: Andrew Cooper
<andrew.cooper3@citrix.com>
next prev parent reply other threads:[~2015-09-17 10:25 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 9:35 [PATCH v4 0/4] detect and initialize CDP (Code/Data Prioritization) feature He Chen
2015-09-17 9:35 ` [PATCH v4 1/4] x86: Support enable CDP by boot parameter and add get CDP status He Chen
2015-09-17 10:20 ` Andrew Cooper
2015-09-24 15:57 ` Jan Beulich
2015-09-17 9:35 ` [PATCH v4 2/4] x86: add domctl cmd to set/get CDP code/data CBM He Chen
2015-09-17 10:25 ` Andrew Cooper [this message]
2015-09-17 9:35 ` [PATCH v4 3/4] tools: add tools support for Intel CDP He Chen
2015-09-17 10:38 ` Andrew Cooper
2015-09-24 10:56 ` Ian Campbell
2015-09-24 10:57 ` Ian Campbell
2015-09-24 11:12 ` Andrew Cooper
2015-09-24 11:00 ` Ian Campbell
2015-09-24 11:50 ` Jan Beulich
2015-09-24 12:07 ` Ian Campbell
2015-09-24 12:20 ` Jan Beulich
2015-09-24 12:31 ` Ian Campbell
2015-09-24 11:07 ` Ian Campbell
2015-09-24 11:22 ` Ian Campbell
2015-09-25 9:04 ` He Chen
2015-09-25 9:19 ` Ian Campbell
2015-09-25 8:43 ` He Chen
2015-09-25 9:18 ` Ian Campbell
2015-09-25 9:53 ` He Chen
2015-09-25 10:30 ` Ian Campbell
2015-09-17 9:35 ` [PATCH v4 4/4] docs: add document to introduce CDP command He Chen
2015-09-24 11:22 ` Ian Campbell
2015-09-24 11:53 ` Jan Beulich
2015-09-25 9:29 ` He Chen
2015-09-25 9:58 ` Ian Campbell
2015-09-25 10:16 ` He Chen
2015-09-25 10:38 ` Ian Campbell
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=55FA9532.9070908@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=chao.p.peng@linux.intel.com \
--cc=he.chen@linux.intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=stefano.stabellini@eu.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.