[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3 of 6] xen/pat: After suspend re-write PAT if BIOS changed it



On Mon, Mar 26, 2012 at 09:50:11AM +0100, Jan Beulich wrote:
> >>> On 24.03.12 at 18:41, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> 
> >>> wrote:
> > # HG changeset patch
> > # User Simon Graham <simon.graham@xxxxxxxxxxxxxxxxxxx>
> > # Date 1332610898 14400
> > # Node ID 75798a472b1a9121adda166b6fd05ba8473a44f0
> > # Parent  d097c3ba42f601af65b53a0c84973855aab64aa9
> > xen/pat: After suspend re-write PAT if BIOS changed it.
> > 
> > Certain AMD machines (this was a MSI or GigaBYTE BIOS) after resume
> > would reset the PAT MSR causing rather weird issues - where
> > the pages would (say they would be set to WC) would end up with the
> > wrong type (as they would use the BIOS PAT instead of the one set by
> > the hypervisor).
> 
> There's a write of the PAT MSR already at the end of
> restore_rest_processor_state() - are you saying this doesn't do
> what is needed? Also note that this is properly gated by a check
> of cpu_has_pat (other than the patch here does).

Let me double-check with folks at VirtualComputer - but they had
experienced this with Xen 4.0 (I think) and the c/s 19167 certainly
was in there.

> 
> > Signed-off-by: Simon Graham <simon.graham@xxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> > 
> > diff -r d097c3ba42f6 -r 75798a472b1a xen/arch/x86/acpi/power.c
> > --- a/xen/arch/x86/acpi/power.c     Sat Mar 24 12:54:12 2012 -0400
> > +++ b/xen/arch/x86/acpi/power.c     Sat Mar 24 13:41:38 2012 -0400
> > @@ -41,8 +41,25 @@ static DEFINE_SPINLOCK(pm_lock);
> >  
> >  struct acpi_sleep_info acpi_sinfo;
> >  
> > +static void pat_resume(void);
> >  void do_suspend_lowlevel(void);
> >  
> > +static void
> > +pat_resume()
> > +{
> > +    u64 pat;
> > +
> > +    rdmsrl(MSR_IA32_CR_PAT, pat);
> > +    if (pat != host_pat) {
> > +   printk(KERN_INFO PREFIX "Found PAT MSR: 0x%lx\n", pat);
> > +   printk(KERN_INFO PREFIX "reseting to 0x%lx\n", host_pat);
> > +   wrmsrl(MSR_IA32_CR_PAT, host_pat);
> > +   rdmsrl(MSR_IA32_CR_PAT, pat);
> > +   if (pat != host_pat)
> > +       printk(KERN_WARNING PREFIX "PAT MSR stuck on: 0x%lx\n", pat);
> 
> All the %lx format specifiers here would break the 32-bit build afaict.
> Further (if this code really is needed at all), please use %# instead
> of 0x%.

Right.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.