WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xen: msr safe cleanup

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] xen: msr safe cleanup
From: Christoph Egger <Christoph.Egger@xxxxxxx>
Date: Fri, 11 Jun 2010 17:48:27 +0200
Cc: Joerg Roedel <joro@xxxxxxxxxx>
Delivery-date: Fri, 11 Jun 2010 08:49:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100611122358.GB8302@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <201006111211.21822.Christoph.Egger@xxxxxxx> <20100611122358.GB8302@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.10
On Friday 11 June 2010 14:23:58 Joerg Roedel wrote:
> On Fri, Jun 11, 2010 at 12:11:21PM +0200, Christoph Egger wrote:
> > -   if ((rdmsr_safe(MSR_K8_ENABLE_C1E, lo, hi) == 0) &&
> > -       (lo & (3u << 27)) &&
> > -       (wrmsr_safe(MSR_K8_ENABLE_C1E, lo & ~(3u << 27), hi) != 0))
> > -           printk(KERN_ERR "Failed to disable C1E on CPU#%u (%08x)\n",
> > -                  smp_processor_id(), lo);
> > +   if ((rdmsr_safe(MSR_K8_ENABLE_C1E, msr_content) == 0) &&
> > +       (msr_content & (3u << 27)) &&
> > +       (wrmsr_safe(MSR_K8_ENABLE_C1E, msr_content & ~(3u << 27)) != 0))
> > +           printk(KERN_ERR "Failed to disable C1E on CPU#%u 
> > (%16"PRIx64")\n",
> > +                  smp_processor_id(), msr_content);
>
> Broken. Please use ull instead of just u in your masks, especially the
> last one.

Thanks for pointing this out. Attached patch fixes this.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>

>
> >  void mtrr_wrmsr(unsigned msr, unsigned a, unsigned b)
> >  {
> > -   if (wrmsr_safe(msr, a, b) < 0)
> > +   uint64_t msr_content;
> > +
> > +   msr_content = ((uint64_t)b << 32) | a;
> > +   if (wrmsr_safe(msr, msr_content) < 0)
> >             printk(KERN_ERR
> >                     "MTRR: CPU %u: Writing MSR %x to %x:%x failed\n",
> >                     smp_processor_id(), msr, a, b);
>
> Since you keep the two unsigned parameters of the function this change
> complicates the code more than it cleans up.

Fixed in c/s 21603.

Christoph



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

Attachment: xen_msrsafe_fix.diff
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>