Re: 3.2-rc2 freezes on boot for AMD K6 - bisected to commit bcb80e53877c2045d9e52f4a71372c3fe6501f6f

From: Linus Torvalds
Date: Sat Dec 03 2011 - 18:25:01 EST


On Sat, Dec 3, 2011 at 12:43 PM, Larry Finger <Larry.Finger@xxxxxxxxxxxx> wrote:
> On 11/30/2011 01:09 AM, Larry Finger wrote:
>> On 11/29/2011 11:59 PM, Srivatsa S. Bhat wrote:
>>>
>>> Can you please try out the patch posted in
>>> https://lkml.org/lkml/2011/11/28/178 ?

Ugh. I hate that patch.

It's completely stupid. If "rdmsr_safe()" doesn't work at that point
in the boot, then it's pointless to call it.

So this change is pure and utter crap:

- rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
+ if (c->x86 >= 0xf)
+ rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);

because it is misleading as hell: that rdmsr isn't *safe* at all, so
why are we calling "rdmsr_safe()"?

It's wrong.

The right patch would either just remove the "safe" part (and just say
that the register has to be supported if c->x86 >= 0xf), but quite
honestly, I don't see why we do that thing in early_init_amd() AT ALL.
Afaik, the microcode version field isn't really *needed* by the
kernelin the first place, much less is it needed by the *early* boot,
so why isn't this in 'init_amd()' a bit later when the "safe" version
actually *works*?

IOW, I think the patch should be something like the attached (TOTALLY
UNTESTED) patch. Larry, does this work for you? It just moves the
rdmsr_safe() to the later function.

Borislav?

> I just updated mainline to 3.2-rc4, and that patch is not included. Please
> check with Ingo to see why it was not available. It is a real show stopper
> for old AMD CPUs.

Ingo seems to have fallen off the earth for the last two weeks.
There's *one* email form him about 12 hours ago, before that the last
one I see is from early November.

Ingo, everything ok?

Linus
arch/x86/kernel/cpu/amd.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index c7e46cb35327..0bab2b18bb20 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -442,8 +442,6 @@ static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c)

static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
{
- u32 dummy;
-
early_init_amd_mc(c);

/*
@@ -473,12 +471,12 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
}
#endif
-
- rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
}

static void __cpuinit init_amd(struct cpuinfo_x86 *c)
{
+ u32 dummy;
+
#ifdef CONFIG_SMP
unsigned long long value;

@@ -657,6 +655,8 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
checking_wrmsrl(MSR_AMD64_MCx_MASK(4), mask);
}
}
+
+ rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
}

#ifdef CONFIG_X86_32