From: Mikael Pettersson <mikpe@csd.uu.se>
To: alan@lxorguk.ukuu.org.uk, marcelo@conectiva.com.br,
torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] boot_cpu_data corruption on SMP x86
Date: Thu, 14 Mar 2002 18:24:44 +0100 (MET) [thread overview]
Message-ID: <200203141724.SAA05707@harpo.it.uu.se> (raw)
The patch below eliminates a case of boot_cpu_data corruption
on SMP x86 machines. This was first observed on SMP Athlons,
but it also affects SMP Intel boxes in a less serious way.
When the secondary processors boot and execute head.S:checkCPUtype,
the code performs a 32-bit write of a small constant to the
byte-sized variable boot_cpu_data.x86 (X86 in head.S). Since the
write is 32-bit, it also writes zeros to the following 3 bytes,
which clobbers the x86_vendor, x86_model, and x86_mask fields
previously set up by check_bugs()'s call to identify_cpu().
Thus, after smp_init(), boot_cpu_data will _always_ identify
the CPU as an Intel (X86_VENDOR_INTEL == 0 in processor.h) with
model 0 and stepping 0.
The effect in standard kernels is not catastrophic, since:
(a) most SMP x86 boxes are Intel
(b) most uses of x86_vendor occur before smp_init() or reference
the SMP cpu_data[] array
(c) most post-boot references to boot_cpu_data occur in the
cpu_has_XXX macros which only read the x86_capability[] array
However, third-party extensions (like my x86 performance-monitoring
conters driver) can get seriously confused by this mis-identification.
The patch is for 2.4.19-pre3, but it also applies to 2.5.6 and
2.2.21rc1. Please apply.
/Mikael
--- linux-2.4.19-pre3/arch/i386/kernel/head.S.~1~ Tue Feb 26 13:26:56 2002
+++ linux-2.4.19-pre3/arch/i386/kernel/head.S Thu Mar 14 16:20:57 2002
@@ -178,7 +178,7 @@
* we don't need to preserve eflags.
*/
- movl $3,X86 # at least 386
+ movb $3,X86 # at least 386
pushfl # push EFLAGS
popl %eax # get EFLAGS
movl %eax,%ecx # save original EFLAGS
@@ -191,7 +191,7 @@
andl $0x40000,%eax # check if AC bit changed
je is386
- movl $4,X86 # at least 486
+ movb $4,X86 # at least 486
movl %ecx,%eax
xorl $0x200000,%eax # check ID flag
pushl %eax
next reply other threads:[~2002-03-14 17:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-14 17:24 Mikael Pettersson [this message]
2002-03-21 20:01 ` Maciej W. Rozycki
2002-03-21 21:17 Mikael Pettersson
2002-03-21 23:36 ` Maciej W. Rozycki
2002-03-22 7:58 ` Dave Jones
2002-03-22 14:23 ` Maciej W. Rozycki
2002-03-22 14:42 ` Richard B. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200203141724.SAA05707@harpo.it.uu.se \
--to=mikpe@csd.uu.se \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®