From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 3 of 6] xen/pat: After suspend re-write PAT if BIOS changed it Date: Mon, 2 Apr 2012 11:28:30 -0400 Message-ID: <20120402152830.GA30162@phenom.dumpdata.com> References: <75798a472b1a9121adda.1332610904@phenom.dumpdata.com> <4F7049E3020000780007AD63@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <4F7049E3020000780007AD63@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , tcgoetz@gmail.com Cc: xen-devel@lists.xensource.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com, keir.fraser@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, Mar 26, 2012 at 09:50:11AM +0100, Jan Beulich wrote: > >>> On 24.03.12 at 18:41, Konrad Rzeszutek Wilk wrote: > > # HG changeset patch > > # User Simon Graham > > # 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 > > Signed-off-by: Konrad Rzeszutek Wilk > > > > 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.