All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yi Sun <yi.y.sun@linux.intel.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com
Subject: Re: [Xen-devel] [PATCH v2] psr: fix bug which may cause crash
Date: Fri, 29 Nov 2019 09:41:49 +0800	[thread overview]
Message-ID: <20191129014149.GU18465@yi.y.sun> (raw)
In-Reply-To: <fdb27512-4ebc-8f80-7ef2-36d83c369326@suse.com>

On 19-11-28 12:25:44, Jan Beulich wrote:
> On 28.11.2019 11:18, Yi Sun wrote:
> > --- a/xen/arch/x86/psr.c
> > +++ b/xen/arch/x86/psr.c
> > @@ -1271,7 +1271,8 @@ static void do_write_psr_msrs(void *data)
> >  
> >          for ( j = 0; j < cos_num; j++, index++ )
> >          {
> > -            if ( feat->cos_reg_val[cos * cos_num + j] != info->val[index] )
> > +            if ( cos <= feat->cos_max &&
> > +                 feat->cos_reg_val[cos * cos_num + j] != info->val[index] )
> 
> The description is indeed much better now, thanks. However,
> as indicated in reply to v1, this extra (and at the first glance
> unmotivated) bounds check wants to be accompanied by a brief but

I will add the comment.

> precise comment. Furthermore with the loop bounded by a local
> variable, why not
> 
>         cos_num = min(props->cos_num, feat->cos_max + 1);
> 
> a few lines up from here (again suitable commented)?
>
cos_num is a different thing with the number of COS registers. The
meaning of it is "COS registers number that feature uses for one COS
ID". E.g. MBA/CAT cos_num is always 1. But CDP cos_num is 2 because it
uses 2 COS registers for one COS ID.
 
> Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-11-29  1:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 10:18 [Xen-devel] [PATCH v2] psr: fix bug which may cause crash Yi Sun
2019-11-28 11:25 ` Jan Beulich
2019-11-29  1:41   ` Yi Sun [this message]
2019-11-29  8:48     ` 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=20191129014149.GU18465@yi.y.sun \
    --to=yi.y.sun@linux.intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.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.