lkml.org 
[lkml]   [2008]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] change init_gdt to update the gdt via write_gdt, rather than a direct write.
From: Alex Nixon <alex.nixon@citrix.com>
Date: Fri, 15 Aug 2008 11:21:56 +0100
Subject: [PATCH] change init_gdt to update the gdt via write_gdt, rather than a direct write.

By writing directly, a memory access violation can occur whilst hotplugging a CPU if the entry was previously marked read-only.

Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
---
arch/x86/kernel/smpcommon.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/smpcommon.c b/arch/x86/kernel/smpcommon.c
index 99941b3..29f8bf0 100644
--- a/arch/x86/kernel/smpcommon.c
+++ b/arch/x86/kernel/smpcommon.c
@@ -13,13 +13,13 @@ EXPORT_PER_CPU_SYMBOL(this_cpu_off);
secondary which will soon come up. */
__cpuinit void init_gdt(int cpu)
{
- struct desc_struct *gdt = get_cpu_gdt_table(cpu);
+ struct desc_struct gdt;

- pack_descriptor(&gdt[GDT_ENTRY_PERCPU],
- __per_cpu_offset[cpu], 0xFFFFF,
+ pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF,
0x2 | DESCTYPE_S, 0x8);
+ gdt.s = 1;

- gdt[GDT_ENTRY_PERCPU].s = 1;
+ write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);

per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu];
per_cpu(cpu_number, cpu) = cpu;
--
1.5.4.3


\
 
 \ /
  Last update: 2008-08-15 18:23    [W:0.041 / U:1.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site