Skip to contentSkip to conversation

PPC: Don't sync timebase when inside VM

PATCH In review Alexander Graf 3 participants 10 messages Mar 2, 2012 – Jul 22, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: Don't sync timebase when inside VM

When running inside a virtual machine, we can not modify timebase, so let's just not call the functions for it then.

This resolves hangs when booting e500 SMP guests on overcommitted hosts.

---
 arch/powerpc/platforms/85xx/smp.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/smp.c +7 -0
index ff42490..d4b6c1f 100644
@@ -249,6 +249,13 @@ void __init mpc85xx_smp_init(void)
 		smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
 	}
 
+	/* When running under a hypervisor, we can not modify tb */
+	np = of_find_node_by_path("/hypervisor");
+	if (np) {
+		smp_85xx_ops.give_timebase = NULL;
+		smp_85xx_ops.take_timebase = NULL;
+	}
+
 	smp_ops = &smp_85xx_ops;
 
 #ifdef CONFIG_KEXEC
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 17 lines · Alexander Graf

When running inside a virtual machine, we can not modify timebase, so let's just not call the functions for it then.

This resolves hangs when booting e500 SMP guests on overcommitted hosts.

---
 arch/powerpc/platforms/85xx/smp.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/smp.c +0 -0
index ff42490..d4b6c1f 100644
@@ -249,6 +249,13 @@ void __init mpc85xx_smp_init(void)
 		smp_85xx_ops.cause_ipi = doorbell_cause_ipi;

arch/powerpc/platforms/85xx/smp.c void __init mpc85xx_smp_init(void) · line 259

Quoted 10 lines
arch/powerpc/platforms/85xx/smp.c +7 -0
 	}
 
+	/* When running under a hypervisor, we can not modify tb */
+	np = of_find_node_by_path("/hypervisor");
+	if (np) {
+		smp_85xx_ops.give_timebase = NULL;
+		smp_85xx_ops.take_timebase = NULL;
+	}
+
 	smp_ops = &smp_85xx_ops;

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

-Scott

#2 lore raw
Quoted 20 lines · Scott Wood
Quoted 19 lines · Alexander Graf

When running inside a virtual machine, we can not modify timebase, so let's just not call the functions for it then.

This resolves hangs when booting e500 SMP guests on overcommitted hosts.

---
arch/powerpc/platforms/85xx/smp.c | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/smp.c +0 -0
index ff42490..d4b6c1f 100644
@@ -249,6 +249,13 @@ void __init mpc85xx_smp_init(void)
 		smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
 	}
 
Quoted 11 lines

arch/powerpc/platforms/85xx/smp.c void __init mpc85xx_smp_init(void) · line 259

Quoted 8 lines
arch/powerpc/platforms/85xx/smp.c +7 -0
+	/* When running under a hypervisor, we can not modify tb */
+	np = of_find_node_by_path("/hypervisor");
+	if (np) {
+		smp_85xx_ops.give_timebase = NULL;
+		smp_85xx_ops.take_timebase = NULL;
+	}
+
 	smp_ops = &smp_85xx_ops;

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Git blame points to the following commit:

commit f933a41e419a954ef90605224e02c3ded78f3372

Author: Matthew McClintock <[email protected]>
Date:   Wed Jul 21 16:14:53 2010 -0500

powerpc/85xx: kexec for SMP 85xx BookE systems

Adds support for kexec on 85xx machines for the BookE platform. Including support for SMP machines

Based off work from Maxim Uvarov <[email protected]>

Alex

#3 lore raw
Quoted 35 lines · Alexander Graf
Quoted 20 lines · Scott Wood
Quoted 19 lines · Alexander Graf

When running inside a virtual machine, we can not modify timebase, so let's just not call the functions for it then.

This resolves hangs when booting e500 SMP guests on overcommitted hosts.

---
arch/powerpc/platforms/85xx/smp.c | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/smp.c +0 -0
index ff42490..d4b6c1f 100644
@@ -249,6 +249,13 @@ void __init mpc85xx_smp_init(void)
 		smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
 	}
 
Quoted 11 lines

arch/powerpc/platforms/85xx/smp.c void __init mpc85xx_smp_init(void) · line 259

Quoted 8 lines
arch/powerpc/platforms/85xx/smp.c +7 -0
+	/* When running under a hypervisor, we can not modify tb */
+	np = of_find_node_by_path("/hypervisor");
+	if (np) {
+		smp_85xx_ops.give_timebase = NULL;
+		smp_85xx_ops.take_timebase = NULL;
+	}
+
 	smp_ops = &smp_85xx_ops;

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

Quoted 1 line

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Sigh. I forgot about that. It's because instead of doing kexec the simple way, we actually physically reset the core. We really shouldn't do that. And we *really* shouldn't do it just because CONFIG_KEXEC is defined, regardless of whether we're actually booting from kexec.

-Scott

#4 lore raw
Quoted 36 lines · Scott Wood
Quoted 35 lines · Alexander Graf
Quoted 31 lines · Scott Wood
Quoted 17 lines · Alexander Graf

When running inside a virtual machine, we can not modify timebase, so let's just not call the functions for it then.

This resolves hangs when booting e500 SMP guests on overcommitted hosts.

---
arch/powerpc/platforms/85xx/smp.c |    7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/smp.c +0 -0
index ff42490..d4b6c1f 100644
@@ -249,6 +249,13 @@ void __init mpc85xx_smp_init(void)
             smp_85xx_ops.cause_ipi = doorbell_cause_ipi;

arch/powerpc/platforms/85xx/smp.c void __init mpc85xx_smp_init(void) · line 259

Quoted 10 lines
arch/powerpc/platforms/85xx/smp.c +7 -0
     }
 
+   /* When running under a hypervisor, we can not modify tb */
+   np = of_find_node_by_path("/hypervisor");
+   if (np) {
+           smp_85xx_ops.give_timebase = NULL;
+           smp_85xx_ops.take_timebase = NULL;
+   }
+
     smp_ops = &smp_85xx_ops;

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

Quoted 6 lines
Quoted 1 line

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Sigh.  I forgot about that.  It's because instead of doing kexec the simple way, we actually physically reset the core.  We really shouldn't do that.  And we *really* shouldn't do it just because CONFIG_KEXEC is defined, regardless of whether we're actually booting from kexec.

How would one rocver a core that's off in the weeds? We need to at least stop it somehow before we restart into the kdump kernel. kexec seems feasible since we have all the cores in a known state...

-M

#5 lore raw
Quoted 7 lines · On 03/08/2012 11:31 AM, McClintock Matthew-B29882 wrote:
Quoted 6 lines · Scott Wood
Quoted 5 lines · Alexander Graf
Quoted 2 lines · Scott Wood

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Sigh. I forgot about that. It's because instead of doing kexec the simple way, we actually physically reset the core. We really shouldn't do that. And we *really* shouldn't do it just because CONFIG_KEXEC is defined, regardless of whether we're actually booting from kexec.

How would one rocver a core that's off in the weeds?

System reset?

I thought kexec was for upgrading your kernel, not recovering from crashes.

Quoted 2 lines

We need to at least stop it somehow before we restart into the kdump kernel. kexec seems feasible since we have all the cores in a known state...

Stop, yes. Reset, no.

-Scott

#6 lore raw
Quoted 10 lines · Scott Wood
Quoted 9 lines · On 03/08/2012 11:31 AM, McClintock Matthew-B29882 wrote:
Quoted 8 lines · Scott Wood
Quoted 6 lines · Alexander Graf
Quoted 2 lines · Scott Wood

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Sigh.  I forgot about that.  It's because instead of doing kexec the simple way, we actually physically reset the core.  We really shouldn't do that.  And we *really* shouldn't do it just because CONFIG_KEXEC is defined, regardless of whether we're actually booting from kexec.

How would one rocver a core that's off in the weeds?

System reset?

kdump restarts a kernel using a reserved memory region to inspect the memory of the crashed kernel. Wouldn't system reset cause issues here?

Quoted 6 lines

I thought kexec was for upgrading your kernel, not recovering from crashes.

Quoted 2 lines

We need to at least stop it somehow before we restart into the kdump kernel. kexec seems feasible since we have all the cores in a known state...

Stop, yes.  Reset, no.

How would we stop the remaining cores assuming they could be in any state?

-M

#7 lore raw
Quoted 16 lines · On 03/08/2012 12:24 PM, McClintock Matthew-B29882 wrote:
Quoted 15 lines · Scott Wood
Quoted 14 lines · On 03/08/2012 11:31 AM, McClintock Matthew-B29882 wrote:
Quoted 12 lines · Scott Wood
Quoted 6 lines · Alexander Graf
Quoted 2 lines · Scott Wood

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Sigh. I forgot about that. It's because instead of doing kexec the simple way, we actually physically reset the core. We really shouldn't do that. And we *really* shouldn't do it just because CONFIG_KEXEC is defined, regardless of whether we're actually booting from kexec.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

How would one rocver a core that's off in the weeds?

System reset?

kdump restarts a kernel using a reserved memory region to inspect the memory of the crashed kernel. Wouldn't system reset cause issues here?

Oh, kdump.

Maybe in that case, go ahead and reset the other cores (or halt them via some other means), but don't do anything with them. Just boot a single core in the dump kernel, do the dumping, then reset the system?

Or if you must sync the timebase in Linux, do it the way U-Boot does (and skip it if you don't have access to the relevant CCSR bits).

Are I/O devices a problem with kdump and not resetting the system, especially on some of our chips where certain I/O devices are difficult to reset?

-Scott

#8 lore raw
Quoted 21 lines · Scott Wood
Quoted 20 lines · On 03/08/2012 12:24 PM, McClintock Matthew-B29882 wrote:
Quoted 18 lines · Scott Wood
Quoted 7 lines · On 03/08/2012 11:31 AM, McClintock Matthew-B29882 wrote:
Quoted 6 lines · Scott Wood
Quoted 5 lines · Alexander Graf
Quoted 2 lines · Scott Wood

Again, for 85xx we should *never* sync the timebase in the kernel, hypervisor or no.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

The code says "if the kexec config option is enabled, do the sync". I'm fairly sure it's there for a reason.

Sigh.  I forgot about that.  It's because instead of doing kexec the simple way, we actually physically reset the core.  We really shouldn't do that.  And we *really* shouldn't do it just because CONFIG_KEXEC is defined, regardless of whether we're actually booting from kexec.

How would one rocver a core that's off in the weeds?

System reset?

Quoted 8 lines
Quoted 2 lines

kdump restarts a kernel using a reserved memory region to inspect the memory of the crashed kernel. Wouldn't system reset cause issues here?

Oh, kdump.

Maybe in that case, go ahead and reset the other cores (or halt them via some other means), but don't do anything with them.  Just boot a single core in the dump kernel, do the dumping, then reset the system?

Yes, we could do one core here... but is it worthwhile to do kexec and kdump differently?

Quoted 2 lines

Or if you must sync the timebase in Linux, do it the way U-Boot does (and skip it if you don't have access to the relevant CCSR bits).

Ok - I've never even looked at how the timebase sync was done in Linux or u-boot. Just enabled the timebase sync

Quoted 3 lines

Are I/O devices a problem with kdump and not resetting the system, especially on some of our chips where certain I/O devices are difficult to reset?

Anything still occurring will be problematic and *possibly* prevent us from determining what caused the actual crash.

-M

#9 lore raw
In reply to Alexander Graf
Quoted 17 lines · Alexander Graf

When running inside a virtual machine, we can not modify timebase, so let's just not call the functions for it then.

This resolves hangs when booting e500 SMP guests on overcommitted hosts.

---
arch/powerpc/platforms/85xx/smp.c | 7 +++++++

 1 files changed, 7 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/smp.c +0 -0
index ff42490..d4b6c1f 100644

arch/powerpc/platforms/85xx/smp.c void __init mpc85xx_smp_init(void) · line 257

Quoted 9 lines
arch/powerpc/platforms/85xx/smp.c +6 -0
@@ -249,6 +249,13 @@ void __init mpc85xx_smp_init(void)
 		smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
 	}
 
+	/* When running under a hypervisor, we can not modify tb */
+	np = of_find_node_by_path("/hypervisor");
+	if (np) {
+		smp_85xx_ops.give_timebase = NULL;
+		smp_85xx_ops.take_timebase = NULL;
+	}

I'm marking this superseded as we now only set give/take_timebase if a guts node is present that corresponds to an SMP SoC. QEMU currently advertises an mpc8544 guts (which is not SMP) and will eventually move to a paravirt device with no guts at all.

-Scott