From: Yi Sun <yi.y.sun@linux.intel.com>
To: "Roger Pau Monn�" <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, ian.jackson@eu.citrix.com,
wei.liu2@citrix.com, chao.p.peng@linux.intel.com
Subject: Re: [PATCH v3 13/15] tools: implement new generic get value interface and MBA get value command
Date: Wed, 20 Sep 2017 14:46:24 +0800 [thread overview]
Message-ID: <20170920064624.GO11006@yi.y.sun> (raw)
In-Reply-To: <20170919110208.ithjk5w2hy6xthdc@dhcp-3-128.uk.xensource.com>
On 17-09-19 12:02:08, Roger Pau Monn� wrote:
> On Tue, Sep 05, 2017 at 05:32:35PM +0800, Yi Sun wrote:
> > diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c
> > index c8d2921..78d5bc5 100644
> > --- a/tools/libxl/libxl_psr.c
> > +++ b/tools/libxl/libxl_psr.c
> > @@ -71,16 +71,30 @@ static void libxl__psr_cmt_log_err_msg(libxl__gc *gc, int err)
> > LOGE(ERROR, "%s", msg);
> > }
> >
> > -static void libxl__psr_cat_log_err_msg(libxl__gc *gc, int err)
> > +static void libxl__psr_alloc_log_err_msg(libxl__gc *gc,
> > + int err,
> > + libxl_psr_type type)
> > {
> > + /*
> > + * Index is 'libxl_psr_type' so we set two 'CDP' to correspond to
> > + * DATA and CODE.
> > + */
> > + const char * const feat_name[6] = {
>
> The explicit '6' is not needed.
>
> > + "UNKNOWN",
> > + "L3 CAT",
> > + "CDP",
> > + "CDP",
> > + "L2 CAT",
> > + "MBA",
>
> I'm not sure whether you want to use designated initializers here, in
> case someone decides to change the order of the xc_psr_type enum or
> the order here. ie:
>
> feat_name[]?= {
> [XC_PSR_CAT_L3_CBM] = "L3 CAT",
> [XC_PSR_CAT_L3_CBM_CODE..XC_PSR_CAT_L3_CBM_DATA] = "CDP",
> ...
> }
>
Got it. Thanks! One correction, the index is 'libxl_psr_type'.
> > + };
> > char *msg;
> >
> > switch (err) {
> > case ENODEV:
> > - msg = "CAT is not supported in this system";
> > + msg = "is not supported in this system";
> > break;
> > case ENOENT:
> > - msg = "CAT is not enabled on the socket";
> > + msg = "is not enabled on the socket";
> > break;
> > case EOVERFLOW:
> > msg = "no free COS available";
> > @@ -106,7 +120,7 @@ static void libxl__psr_cat_log_err_msg(libxl__gc *gc, int err)
> > return;
> > }
> >
> > - LOGE(ERROR, "%s", msg);
> > + LOGE(ERROR, "%s: %s", feat_name[type], msg);
>
> I don't think you should use LOGE here, but rather LOG. LOGE should be
> used when errno is set, which I don't think is the case here.
>
But two places to call libxl__psr_cat_log_err_msg all set errno in 'xc_'
functions.
> > @@ -347,18 +361,7 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
> > libxl_psr_cbm_type type, uint32_t target,
> > uint64_t *cbm_r)
> > {
> > - GC_INIT(ctx);
> > - int rc = 0;
> > - xc_psr_type xc_type = libxl__psr_cbm_type_to_libxc_psr_type(type);
> > -
> > - if (xc_psr_cat_get_domain_data(ctx->xch, domid, xc_type,
> > - target, cbm_r)) {
> > - libxl__psr_cat_log_err_msg(gc, errno);
> > - rc = ERROR_FAIL;
> > - }
> > -
> > - GC_FREE;
> > - return rc;
> > + return libxl_psr_get_val(ctx, domid, type, target, cbm_r);
> > }
>
> You could even move this to libxl.h as a static function IMHO.
>
Yes. But I prefer to keep it here with other interfaces together. Is that
acceptable to you?
> > diff --git a/tools/xl/xl_psr.c b/tools/xl/xl_psr.c
> > index 40269b4..46b7788 100644
> > --- a/tools/xl/xl_psr.c
> > +++ b/tools/xl/xl_psr.c
> > -static int psr_cat_print_socket(uint32_t domid, libxl_psr_cat_info *info,
> > - unsigned int lvl)
> > +static int psr_print_socket(uint32_t domid,
> > + libxl_psr_hw_info *info,
> > + libxl_psr_feat_type type,
> > + unsigned int lvl)
> > {
> > - int rc;
> > - uint32_t l3_cache_size;
> > -
> > printf("%-16s: %u\n", "Socket ID", info->id);
> >
> > - /* So far, CMT only supports L3 cache. */
> > - if (lvl == 3) {
> > - rc = libxl_psr_cmt_get_l3_cache_size(ctx, info->id, &l3_cache_size);
> > - if (rc) {
> > - fprintf(stderr, "Failed to get l3 cache size for socket:%d\n",
> > - info->id);
> > - return -1;
> > + switch (type) {
> > + case LIBXL_PSR_FEAT_TYPE_CAT:
> > + {
> > + int rc;
> > + uint32_t l3_cache_size;
> > +
> > + /* So far, CMT only supports L3 cache. */
> > + if (lvl == 3) {
>
> Shouldn't you print some kind of error message if lvl != 3? Or is it
> expected that this function will be called with lvl != 3 and it should
> be ignored?
>
We only get cache size for level 3 cache. So, if input is lvl=2, we print
nothing.
> Thanks, Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-20 6:47 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 9:32 [PATCH v3 00/15] Enable Memory Bandwidth Allocation in Xen Yi Sun
2017-09-05 9:32 ` [PATCH v3 01/15] docs: create Memory Bandwidth Allocation (MBA) feature document Yi Sun
2017-09-18 17:16 ` Roger Pau Monné
2017-09-19 6:07 ` Jan Beulich
2017-09-20 2:59 ` Yi Sun
2017-09-20 3:06 ` Yi Sun
2017-09-20 8:36 ` Roger Pau Monné
2017-09-20 9:08 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 02/15] Rename PSR sysctl/domctl interfaces and xsm policy to make them be general Yi Sun
2017-09-19 8:03 ` Roger Pau Monné
2017-09-20 3:12 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 03/15] x86: rename 'cbm_type' to 'psr_type' to make it general Yi Sun
2017-09-19 8:22 ` Roger Pau Monné
2017-09-05 9:32 ` [PATCH v3 04/15] x86: implement data structure and CPU init flow for MBA Yi Sun
2017-09-19 8:55 ` Roger Pau Monné
2017-09-20 3:22 ` Yi Sun
2017-09-20 7:11 ` Jan Beulich
2017-09-20 7:27 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 05/15] x86: implement get hw info " Yi Sun
2017-09-19 9:08 ` Roger Pau Monné
2017-09-20 5:05 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 06/15] x86: implement get value interface " Yi Sun
2017-09-19 9:15 ` Roger Pau Monné
2017-09-20 5:09 ` Yi Sun
2017-09-20 8:43 ` Roger Pau Monné
2017-09-20 9:22 ` Yi Sun
2017-09-20 16:02 ` Wei Liu
2017-09-05 9:32 ` [PATCH v3 07/15] x86: implement set value flow " Yi Sun
2017-09-19 9:57 ` Roger Pau Monné
2017-09-20 5:39 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 08/15] tools: create general interfaces to support psr allocation features Yi Sun
2017-09-19 10:04 ` Roger Pau Monné
2017-09-20 5:45 ` Yi Sun
2017-09-22 7:01 ` Chao Peng
2017-09-28 16:11 ` Wei Liu
2017-09-05 9:32 ` [PATCH v3 09/15] tools: implement the new libxc get hw info interface Yi Sun
2017-09-19 10:15 ` Roger Pau Monné
2017-09-20 6:13 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 10/15] tools: implement the new libxl " Yi Sun
2017-09-19 10:28 ` Roger Pau Monné
2017-09-20 6:20 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 11/15] tools: implement the new xl " Yi Sun
2017-09-19 10:32 ` Roger Pau Monné
2017-09-20 6:23 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 12/15] tools: rename 'xc_psr_cat_type' to 'xc_psr_type' Yi Sun
2017-09-19 10:34 ` Roger Pau Monné
2017-09-20 6:25 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 13/15] tools: implement new generic get value interface and MBA get value command Yi Sun
2017-09-19 11:02 ` Roger Pau Monné
2017-09-20 6:46 ` Yi Sun [this message]
2017-09-20 8:57 ` Roger Pau Monné
2017-09-20 9:11 ` Yi Sun
2017-09-05 9:32 ` [PATCH v3 14/15] tools: implement new generic set value interface and MBA set " Yi Sun
2017-09-19 11:30 ` Roger Pau Monné
2017-09-20 7:25 ` Yi Sun
2017-09-20 16:10 ` Wei Liu
2017-09-28 16:23 ` Dario Faggioli
2017-09-29 12:58 ` Wei Liu
2017-09-05 9:32 ` [PATCH v3 15/15] docs: add MBA description in docs Yi Sun
2017-09-19 11:37 ` Roger Pau Monné
2017-09-20 7:26 ` Yi Sun
2017-09-28 16:56 ` Dario Faggioli
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=20170920064624.GO11006@yi.y.sun \
--to=yi.y.sun@linux.intel.com \
--cc=chao.p.peng@linux.intel.com \
--cc=ian.jackson@eu.citrix.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.