Skip to contentSkip to conversation

mtrr failure, 3.1-rc1

PATCH In review Anders Eriksson 6 participants 11 messages Aug 25, 2011 x86

lore
Share & tools
lore
#0 lore raw

My old P-II has 640MB ram, but the bios only sets up WC for the first 512, so i add this early in the boot process:
echo "base=0x20000000 size=0x8000000 type=write-back" > /proc/mtrr

For reasons I have forgot I also have to add 'disable_mtrr_check' to the command line. Works great.

As of merge dc43d9fa73d82083656fb9c02f4823bcdcfb9f91 This no longer works. Adding that line to /proc/mtrr no longer has any effect (cat /proc/mtrr shows only the reg00 entry).

Reverting that merge on top of rc3 brings things back to normal and /proc/mtrr shows:
reg00: base=0x000000000 ( 0MB), size= 512MB, count=1: write-back
reg01: base=0x048000000 ( 1152MB), size= 128MB, count=1: write-combining
reg02: base=0x020000000 ( 512MB), size= 128MB, count=2: write-back

Any ideas how to track this down futher? Would be good to get it fixed for 3.1

-Anders

#1 lore raw

Hmm. Some of those commits are marked for stable too.

I'm adding appropriate parties to the discussion (authors and sign-offs from the five commits that that merge brings in), but it would also be great if you could bisect exactly which commit broke for you. You can make it quick by just doing

git bisect start
git bisect bad dc43d9fa73d82083656fb9c02f4823bcdcfb9f91 git bisect good dc43d9fa73d82083656fb9c02f4823bcdcfb9f91^

and it should take just a couple of tests. I *assume* it's the stop_machine changes by Tejun &co, but who knows..

Anders, is this a single-CPU system?

Linus

Quoted 24 lines · Anders Eriksson

My old P-II has 640MB ram, but the bios only sets up WC for the first 512, so i add this early in the boot process:
echo "base=0x20000000 size=0x8000000 type=write-back" > /proc/mtrr

For reasons I have forgot I also have to add 'disable_mtrr_check' to the command line. Works great.

As of merge dc43d9fa73d82083656fb9c02f4823bcdcfb9f91 This no longer works. Adding that line to /proc/mtrr no longer has any effect (cat /proc/mtrr shows only the reg00 entry).

Reverting that merge on top of rc3 brings things back to normal and /proc/mtrr shows:
reg00: base=0x000000000 (    0MB), size=  512MB, count=1: write-back
reg01: base=0x048000000 ( 1152MB), size=  128MB, count=1: write-combining
reg02: base=0x020000000 (  512MB), size=  128MB, count=2: write-back

Any ideas how to track this down futher? Would be good to get it fixed for 3.1

-Anders

#2 lore raw

Hello,

Quoted 7 lines · Linus Torvalds

Hmm. Some of those commits are marked for stable too.

I'm adding appropriate parties to the discussion (authors and sign-offs from the five commits that that merge brings in), but it would also be great if you could bisect exactly which commit broke for you. You can make it quick by just doing

Quoted 8 lines

git bisect start
git bisect bad dc43d9fa73d82083656fb9c02f4823bcdcfb9f91 git bisect good dc43d9fa73d82083656fb9c02f4823bcdcfb9f91^

and it should take just a couple of tests. I *assume* it's the stop_machine changes by Tejun &co, but who knows..

Anders, is this a single-CPU system?

Indeed, while removing custom rendezvous code and switching to stop_machine, commit 192d8857427d "x86, mtrr: use stop_machine APIs for doing MTRR rendezvous" completely dropped mtrr setting code on !CONFIG_SMP.

Anders, if your kernel didn't have SMP turned on, can you please verify the following patch fixes the problem?

Thanks.

arch/x86/kernel/cpu/mtrr/main.c +0 -2
index 08119a3..6b96110 100644
@@ -149,7 +149,6 @@ struct set_mtrr_data {
  */
 static int mtrr_rendezvous_handler(void *info)
 {
-#ifdef CONFIG_SMP
 	struct set_mtrr_data *data = info;
 
 	/*
@@ -171,7 +170,6 @@ static int mtrr_rendezvous_handler(void *info)
 	} else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
 		mtrr_if->set_all();
 	}
-#endif
 	return 0;
 }
 
#3 lore raw
Quoted 7 lines · Tejun Heo

Indeed, while removing custom rendezvous code and switching to stop_machine, commit 192d8857427d "x86, mtrr: use stop_machine APIs for doing MTRR rendezvous" completely dropped mtrr setting code on !CONFIG_SMP.

Anders, if your kernel didn't have SMP turned on, can you please verify the following patch fixes the problem?

Yes. It's single CPU compiled with !CONFIG_SMP. I'm compiling w/ this patch right now. Takes a while on vintage equipment... ;-)

Acked-by
#4 lore raw
In reply to Tejun Heo
Quoted 17 lines · Tejun Heo

Hello,

Quoted 14 lines · Linus Torvalds

Hmm. Some of those commits are marked for stable too.

I'm adding appropriate parties to the discussion (authors and sign-offs from the five commits that that merge brings in), but it would also be great if you could bisect exactly which commit broke for you. You can make it quick by just doing

git bisect start
git bisect bad dc43d9fa73d82083656fb9c02f4823bcdcfb9f91 git bisect good dc43d9fa73d82083656fb9c02f4823bcdcfb9f91^

and it should take just a couple of tests. I *assume* it's the stop_machine changes by Tejun &co, but who knows..

Quoted 6 lines
Quoted 1 line

Anders, is this a single-CPU system?

Indeed, while removing custom rendezvous code and switching to stop_machine, commit 192d8857427d "x86, mtrr: use stop_machine APIs for doing MTRR rendezvous" completely dropped mtrr setting code on !CONFIG_SMP.

oops. My bad. Linus, Bad commit is not marked for stable.

I was able to reproduce the issue and tested the below patch. It looks good.

Thanks.

Quoted 26 lines

Anders, if your kernel didn't have SMP turned on, can you please verify the following patch fixes the problem?

Thanks.

arch/x86/kernel/cpu/mtrr/main.c +0 -2
index 08119a3..6b96110 100644
@@ -149,7 +149,6 @@ struct set_mtrr_data {
  */
 static int mtrr_rendezvous_handler(void *info)
 {
-#ifdef CONFIG_SMP
 	struct set_mtrr_data *data = info;
 
 	/*
@@ -171,7 +170,6 @@ static int mtrr_rendezvous_handler(void *info)
 	} else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
 		mtrr_if->set_all();
 	}
-#endif
 	return 0;
 }
 
#6 lore raw

PATCH 1/1 mtrr: fix UP breakage caused during switch to stop_machine

While removing custom rendezvous code and switching to stop_machine, commit 192d8857427d "x86, mtrr: use stop_machine APIs for doing MTRR rendezvous" completely dropped mtrr setting code on !CONFIG_SMP breaking MTRR settting on UP. Fix it by removing the incorrect CONFIG_SMP.

---
 arch/x86/kernel/cpu/mtrr/main.c |    2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/cpu/mtrr/main.c +0 -2
index 08119a3..6b96110 100644
@@ -149,7 +149,6 @@ struct set_mtrr_data {
  */
 static int mtrr_rendezvous_handler(void *info)
 {
-#ifdef CONFIG_SMP
 	struct set_mtrr_data *data = info;
 
 	/*
@@ -171,7 +170,6 @@ static int mtrr_rendezvous_handler(void *info)
 	} else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
 		mtrr_if->set_all();
 	}
-#endif
 	return 0;
 }
 
reviewer Acked-by on v1 1/1
#7 lore raw

Re: [PATCH] mtrr: fix UP breakage caused during switch to stop_machine

Quoted 10 lines · Tejun Heo

While removing custom rendezvous code and switching to stop_machine, commit 192d8857427d "x86, mtrr: use stop_machine APIs for doing MTRR rendezvous" completely dropped mtrr setting code on !CONFIG_SMP breaking MTRR settting on UP. Fix it by removing the incorrect CONFIG_SMP.

Linus, are you picking this up from email or should I put it in x86/urgent?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#8 lore raw

Re: [PATCH] mtrr: fix UP breakage caused during switch to stop_machine

Quoted 2 lines · H. Peter Anvin

Linus, are you picking this up from email or should I put it in x86/urgent?

I took it directly,

Linus

#9 lore raw
In reply to Tejun Heo
Quoted 18 lines · Tejun Heo

Anders, if your kernel didn't have SMP turned on, can you please verify the following patch fixes the problem?

Thanks.

arch/x86/kernel/cpu/mtrr/main.c +0 -1
index 08119a3..6b96110 100644
@@ -149,7 +149,6 @@ struct set_mtrr_data {
   */
  static int mtrr_rendezvous_handler(void *info)
  {
-#ifdef CONFIG_SMP
  	struct set_mtrr_data *data = info;
 
  	/*

arch/x86/kernel/cpu/mtrr/main.c static int mtrr_rendezvous_handler(void *info) · line 175

Quoted 7 lines
arch/x86/kernel/cpu/mtrr/main.c +0 -1
@@ -171,7 +170,6 @@ static int mtrr_rendezvous_handler(void *info)
  	} else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
  		mtrr_if->set_all();
  	}
-#endif
  	return 0;
  }
 

Tested. Works as expected. Thanks!

-A

#10 lore raw
In reply to Anders Eriksson
Quoted 1 line · Anders Eriksson

(mtrr issues)

Similar MTRR issue here with a K6-III/450, which I noticed when the X11 server was no longer able to allocate/configure a MTRR. "cat /proc/mtrr" shows nothing configured regardless of whether the X11 server is running. I only see a diagnostic message to the effect of the MTRR not existing when X11 exits.

Possibly significant: prior 3.X kernel versions would cause the X11 server to exit with a corrupted display after about 3-5 invocations. Machine was otherwise usable, but had to reboot remotely to recover the console display. The "no MTRR" issue in 3.1-rc1 has thus far meant no display corruption on X11 server exit: have run "startx" at least 10 times since booting 3.1-rc1.

Signature · 5 lines
------------------------------------------------------------------------
Bob Tracy          |  "Every normal man must be tempted at times to spit
[email protected]       |   upon his hands, hoist the black flag, and begin
                   |   slitting throats."	-- H.L. Mencken
------------------------------------------------------------------------