Nitin A Kamble
2009-Aug-04 18:26 UTC
[Xen-devel] [Patch] cpu synchronization while doing MTRR register update
The current Xen code does not synchronize all the cpus while initializing MTRR registers when a cpu comes up. As per IA32 SDM vol 3: Section: 10.11.8 MTRR Considerations in MP Systems, all the processors should be synchronized while updating MTRRs. Processors starting with westmere are caching VMCS data for better VMX performance. These processors also has Hyper-threading support. With hyper-threading, when one thread''s cache is disabled, it also disables cache for the sibling threads. And MTRR register updating procedure involves cache disabling. So if cpus are not synchronized, updating MTRR registers on a thread, results in the VMCS data from sibling threads becoming inaccessible, and it causes system failure. With this patch while updating the MTRR registers, all the cpus are synchronized as per the IA32 SDM. Also at the boot time and resume time when multiple cpus are brought up, an optimization is added to delay the MTRR initialization until all the cpus are up, to avoid multiple times cpu synchronization. Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-Off-By: Suresh B Siddha <suresh.b.siddha@intel.com> Signed-Off-By: Asit K Mallick <asit.k.mallick@intel.com> Diffstat: arch/x86/acpi/suspend.c | 2 - arch/x86/cpu/common.c | 2 - arch/x86/cpu/mtrr/main.c | 57 +++++++++++++++++++++++++++++--------- arch/x86/smpboot.c | 6 ++++ include/asm-x86/mtrr.h | 4 +++ 5 files changed, 56 insertions(+), 15 deletions(-) Thanks & Regards, Nitin Linux Open Source Technology Center, Intel Corporation ----------------------------------------------------------------------- The Mind is like a parachute; it works much better when it''s open. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tim Deegan
2009-Aug-05 08:29 UTC
Re: [Xen-devel] [Patch] cpu synchronization while doing MTRR register update
Hi, At 19:26 +0100 on 04 Aug (1249413981), Nitin A Kamble wrote:> Processors starting with westmere are caching VMCS data for better VMX > performance. These processors also has Hyper-threading support. With > hyper-threading, when one thread''s cache is disabled, it also disables > cache for the sibling threads. And MTRR register updating procedure > involves cache disabling. So if cpus are not synchronized, updating MTRR > registers on a thread, results in the VMCS data from sibling threads > becoming inaccessible, and it causes system failure.What''s the observed failure here? Hang/crash on resume from S3? Or something more common? Cheers, Tim. -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Kamble, Nitin A
2009-Aug-05 17:42 UTC
RE: [Xen-devel] [Patch] cpu synchronization while doing MTRR register update
>-----Original Message----- >From: Tim Deegan [mailto:Tim.Deegan@citrix.com] >What''s the observed failure here? Hang/crash on resume from S3? Or >something more common? > >Cheers, > >Tim.Tim, The issue is observed at the cpu hotplug time. At the time of cpu hot add, the MTRR registers are initialized on that cpu, and that involves disabling cache. If there is an HVM guest up at that time, who is consuming sibling of the hotplug-ed cpu, then that sibling cpu will not able to access it''s vmcs and results in system crash. Thanks & Regards, Nitin Linux Open Source Technology Center, Intel Corporation --------------------------------------------------------------------------- The Mind is like a parachute; it works much better when it''s open. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel