2010-11-16 21:32:50

by Suresh Siddha

[permalink] [raw]
Subject: [patch 2/2] xsave: use alloc_bootmem_align() instead of alloc_bootmem()

Alignment of alloc_bootmem() depends on the value of L1_CACHE_SHIFT. What
we need here is 64byte alignment. Use alloc_bootmem_align() instead.

This fixes a kernel boot crash reported by Jody when the cpu in .config
is set to MPENTIUMII

Reported-by: Jody Bruchon <[email protected]>
Signed-off-by: Suresh Siddha <[email protected]>
Acked-by: H. Peter Anvin <[email protected]>
---
arch/x86/kernel/xsave.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Index: tree/arch/x86/kernel/xsave.c
===================================================================
--- tree.orig/arch/x86/kernel/xsave.c
+++ tree/arch/x86/kernel/xsave.c
@@ -394,7 +394,8 @@ static void __init setup_xstate_init(voi
* Setup init_xstate_buf to represent the init state of
* all the features managed by the xsave
*/
- init_xstate_buf = alloc_bootmem(xstate_size);
+ init_xstate_buf = alloc_bootmem_align(xstate_size,
+ __alignof__(struct xsave_struct));
init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT;

clts();


2010-12-14 00:49:37

by Suresh Siddha

[permalink] [raw]
Subject: [tip:x86/urgent] x86, xsave: Use alloc_bootmem_align() instead of alloc_bootmem()

Commit-ID: 10340ae130fb70352eae1ae8a00b7906d91bf166
Gitweb: http://git.kernel.org/tip/10340ae130fb70352eae1ae8a00b7906d91bf166
Author: Suresh Siddha <[email protected]>
AuthorDate: Tue, 16 Nov 2010 13:23:51 -0800
Committer: H. Peter Anvin <[email protected]>
CommitDate: Mon, 13 Dec 2010 16:13:11 -0800

x86, xsave: Use alloc_bootmem_align() instead of alloc_bootmem()

Alignment of alloc_bootmem() depends on the value of
L1_CACHE_SHIFT. What we need here, however, is 64 byte alignment. Use
alloc_bootmem_align() and explicitly specify the alignment instead.

This fixes a kernel boot crash reported by Jody when the cpu in .config
is set to MPENTIUMII but the kernel is booted on a xsave-capable CPU.

Reported-by: Jody Bruchon <[email protected]>
Signed-off-by: Suresh Siddha <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
Cc: <[email protected]>
---
arch/x86/kernel/xsave.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 9c253bd..5471285 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -394,7 +394,8 @@ static void __init setup_xstate_init(void)
* Setup init_xstate_buf to represent the init state of
* all the features managed by the xsave
*/
- init_xstate_buf = alloc_bootmem(xstate_size);
+ init_xstate_buf = alloc_bootmem_align(xstate_size,
+ __alignof__(struct xsave_struct));
init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT;

clts();