* [PATCH-RESEND] Disable MCE if MCE banks are not present
@ 2013-05-31 21:46 Aravindh Puthiyaparambil (aravindp)
2013-05-31 23:04 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Aravindh Puthiyaparambil (aravindp) @ 2013-05-31 21:46 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]
(My previous email had extra line breaks. Hopefully this one does not. I have also included the patch as an attachement.)
Do not continue with machine check setup if MCE banks are not present. This fixes Xen boot on VMware hypervisors.
When booting Xen on VMware ESX 5.1 and Workstation 9, you hit a GPF during MCE initialization. The culprit is line 631 in set_poll_bankmask():
bitmap_copy(mb->bank_map, mca_allbanks->bank_map, nr_mce_banks);
What is happening is that in mca_cap_init(), nr_mce_banks is being set to 0. This causes the allocation of bank_map to be set to ZERO_BLOCK_PTR which is the return value for zero-size allocation by xzalloc_array()/_xmalloc(). This results in the bitmap_copy() to fail disastrously. The following patch fixes this issue.
Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 6712db1..9cbd4aa 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -652,7 +652,14 @@ int mca_cap_init(void)
}
nr_mce_banks = msr_content & MCG_CAP_COUNT;
- /* mcabanks_alloc depends on nr_mcebanks */
+ if (!nr_mce_banks)
+ {
+ printk(XENLOG_INFO "CPU%i: No MCE banks present. "
+ "Machine check support disabled\n", smp_processor_id());
+ return -ENODEV;
+ }
+
+ /* mcabanks_alloc depends on nr_mce_banks */
if (!mca_allbanks)
{
int i;
[-- Attachment #2: mce_nobanks_disable.patch --]
[-- Type: application/octet-stream, Size: 1346 bytes --]
Do not continue with machine check setup if MCE banks are not present. This fixes Xen boot on VMware hypervisors.
When booting Xen on VMware ESX 5.1 and Workstation 9, you hit a GPF during MCE initialization. The culprit is line 631 in set_poll_bankmask():
bitmap_copy(mb->bank_map, mca_allbanks->bank_map, nr_mce_banks);
What is happening is that in mca_cap_init(), nr_mce_banks is being set to 0. This causes the allocation of bank_map to be set to ZERO_BLOCK_PTR which is the return value for zero-size allocation by xzalloc_array()/_xmalloc(). This results in the bitmap_copy() to fail disastrously. The following patch fixes this issue.
Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 6712db1..9cbd4aa 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -652,7 +652,14 @@ int mca_cap_init(void)
}
nr_mce_banks = msr_content & MCG_CAP_COUNT;
- /* mcabanks_alloc depends on nr_mcebanks */
+ if (!nr_mce_banks)
+ {
+ printk(XENLOG_INFO "CPU%i: No MCE banks present. "
+ "Machine check support disabled\n", smp_processor_id());
+ return -ENODEV;
+ }
+
+ /* mcabanks_alloc depends on nr_mce_banks */
if (!mca_allbanks)
{
int i;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH-RESEND] Disable MCE if MCE banks are not present
2013-05-31 21:46 [PATCH-RESEND] Disable MCE if MCE banks are not present Aravindh Puthiyaparambil (aravindp)
@ 2013-05-31 23:04 ` Andrew Cooper
2013-06-03 10:14 ` Christoph Egger
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2013-05-31 23:04 UTC (permalink / raw)
To: Aravindh Puthiyaparambil (aravindp); +Cc: xen-devel@lists.xensource.com
On 31/05/2013 22:46, Aravindh Puthiyaparambil (aravindp) wrote:
> (My previous email had extra line breaks. Hopefully this one does not. I have also included the patch as an attachement.)
> Do not continue with machine check setup if MCE banks are not present. This fixes Xen boot on VMware hypervisors.
>
> When booting Xen on VMware ESX 5.1 and Workstation 9, you hit a GPF during MCE initialization. The culprit is line 631 in set_poll_bankmask():
> bitmap_copy(mb->bank_map, mca_allbanks->bank_map, nr_mce_banks);
>
> What is happening is that in mca_cap_init(), nr_mce_banks is being set to 0. This causes the allocation of bank_map to be set to ZERO_BLOCK_PTR which is the return value for zero-size allocation by xzalloc_array()/_xmalloc(). This results in the bitmap_copy() to fail disastrously. The following patch fixes this issue.
>
> Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
> index 6712db1..9cbd4aa 100644
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -652,7 +652,14 @@ int mca_cap_init(void)
> }
> nr_mce_banks = msr_content & MCG_CAP_COUNT;
>
> - /* mcabanks_alloc depends on nr_mcebanks */
> + if (!nr_mce_banks)
> + {
> + printk(XENLOG_INFO "CPU%i: No MCE banks present. "
> + "Machine check support disabled\n", smp_processor_id());
> + return -ENODEV;
> + }
> +
> + /* mcabanks_alloc depends on nr_mce_banks */
> if (!mca_allbanks)
> {
> int i;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH-RESEND] Disable MCE if MCE banks are not present
2013-05-31 23:04 ` Andrew Cooper
@ 2013-06-03 10:14 ` Christoph Egger
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Egger @ 2013-06-03 10:14 UTC (permalink / raw)
To: Andrew Cooper
Cc: xen-devel@lists.xensource.com,
Aravindh Puthiyaparambil (aravindp)
On 01.06.13 01:04, Andrew Cooper wrote:
> On 31/05/2013 22:46, Aravindh Puthiyaparambil (aravindp) wrote:
>> (My previous email had extra line breaks. Hopefully this one does not. I have also included the patch as an attachement.)
Yep. That's better.
>> Do not continue with machine check setup if MCE banks are not present. This fixes Xen boot on VMware hypervisors.
>>
>> When booting Xen on VMware ESX 5.1 and Workstation 9, you hit a GPF during MCE initialization. The culprit is line 631 in set_poll_bankmask():
>> bitmap_copy(mb->bank_map, mca_allbanks->bank_map, nr_mce_banks);
>>
>> What is happening is that in mca_cap_init(), nr_mce_banks is being set to 0. This causes the allocation of bank_map to be set to ZERO_BLOCK_PTR which is the return value for zero-size allocation by xzalloc_array()/_xmalloc(). This results in the bitmap_copy() to fail disastrously. The following patch fixes this issue.
>>
>> Signed-off-by: Aravindh Puthiyaparambil <aravindp@cisco.com>
>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
>
>>
>> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
>> index 6712db1..9cbd4aa 100644
>> --- a/xen/arch/x86/cpu/mcheck/mce.c
>> +++ b/xen/arch/x86/cpu/mcheck/mce.c
>> @@ -652,7 +652,14 @@ int mca_cap_init(void)
>> }
>> nr_mce_banks = msr_content & MCG_CAP_COUNT;
>>
>> - /* mcabanks_alloc depends on nr_mcebanks */
>> + if (!nr_mce_banks)
>> + {
>> + printk(XENLOG_INFO "CPU%i: No MCE banks present. "
>> + "Machine check support disabled\n", smp_processor_id());
>> + return -ENODEV;
>> + }
>> +
>> + /* mcabanks_alloc depends on nr_mce_banks */
>> if (!mca_allbanks)
>> {
>> int i;
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-03 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 21:46 [PATCH-RESEND] Disable MCE if MCE banks are not present Aravindh Puthiyaparambil (aravindp)
2013-05-31 23:04 ` Andrew Cooper
2013-06-03 10:14 ` Christoph Egger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).