Some evidence about the PowerMac G5 multiprocessor boot hang ups with the modern VM_MAX_KERNEL_ADDRESS value

Mark Millard marklmi at yahoo.com
Thu Feb 14 23:27:07 UTC 2019



On 2019-Feb-14, at 12:56, Dennis Clarke <dclarke at blastwave.org> wrote:

> On 2/13/19 10:35 PM, Mark Millard via freebsd-ppc wrote:
>> I added some bootverbose messages to:
> 
> I clearly need to apply your "HACK" verbosity because I am seeing odd
> behavior where I now need to set kern.smp.disabled=1 to get a boot AND
> then I get all four cores online.
> 
> Here is the /var/run/dmesg.boot with some 'malloc' lines snipped out.
> 
> Everything comes to a screetching halt at vt_upgrade(&vt_consdev) unless I set kern.smp.disabled=1 and then I get a normal boot.
> 
> . . .


Even without my additions, using boot -v at the
loader prompt would echo more information,
including during:

subsystem f000000
  cpu_mp_unleash(0)... done.

(where I get a hangup much of the time). boot -v is
independent of debug.verbose_sysinit=1 : they can be
together or separately.

Looks like I did not include the svnlite diff output
as of my adding the address information and such. But
I only added to the cpu_mp_unleash related activity
overall.

My updates svnlite diff is as follows:

# svnlite diff /usr/src/sys/powerpc/powermac/platform_powermac.c /usr/src/sys/powerpc/powerpc/mp_machdep.c                                                                                      Index: /usr/src/sys/powerpc/powermac/platform_powermac.c
===================================================================
--- /usr/src/sys/powerpc/powermac/platform_powermac.c	(revision 344018)
+++ /usr/src/sys/powerpc/powermac/platform_powermac.c	(working copy)
@@ -344,6 +344,10 @@
 
 	cpu = pc->pc_hwref;
 	res = OF_getprop(cpu, "soft-reset", &reset, sizeof(reset));
+        if (bootverbose) // HACK!!!
+                printf("powermac_smp_start_cpu 's OF_getprop for CPU %d, hwref=%jx, awake=%x: res=%d, reset=%x\n",
+                    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+                    pc->pc_awake, res, reset);
 	if (res < 0) {
 		reset = 0x58;
 
@@ -363,14 +367,33 @@
 		default:
 			return (ENXIO);
 		}
+		if (bootverbose) // HACK!!!
+			printf("powermac_smp_start_cpu for res<0 for CPU %d, hwref=%jx, awake=%x: res=%d, reset=%x\n",
+			    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+			    pc->pc_awake, res, reset);
 	}
 
 	ap_pcpu = pc;
 
 	if (rstvec_virtbase == NULL)
+	{ // HACK!!!
 		rstvec_virtbase = pmap_mapdev(0x80000000, PAGE_SIZE);
+		if (bootverbose) // HACK!!!
+			printf("powermac_smp_start_cpu for CPU %d, hwref=%jx, awake=%x: rstvec_virtbase=%p\n",
+			    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+			    pc->pc_awake, rstvec_virtbase);
+	} // HACK!!!
 
 	rstvec = rstvec_virtbase + reset;
+	if (bootverbose) // HACK!!!
+		printf("powermac_smp_start_cpu for CPU %d, hwref=%jx, awake=%x: rstvec=%p\n",
+		    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+		    pc->pc_awake, rstvec);
+ 
+        if (bootverbose) // HACK!!!
+                printf("Before reset 4&0 for CPU %d, hwref=%jx, awake=%x\n",
+                    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+                    pc->pc_awake);
 
 	*rstvec = 4;
 	powerpc_sync();
@@ -382,10 +405,20 @@
 	(void)(*rstvec);
 	powerpc_sync();
 
+        if (bootverbose) // HACK!!!
+                printf("After reset 4&0 for CPU %d, hwref=%jx, awake=%x\n",
+                    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+                    pc->pc_awake);
+
 	timeout = 10000;
 	while (!pc->pc_awake && timeout--)
 		DELAY(100);
 
+        if (bootverbose) // HACK!!!
+                printf("After attempted wait for awake CPU %d, hwref=%jx, awake=%x\n",
+                    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+                    pc->pc_awake);
+
 	return ((pc->pc_awake) ? 0 : EBUSY);
 #else
 	/* No SMP support */
Index: /usr/src/sys/powerpc/powerpc/mp_machdep.c
===================================================================
--- /usr/src/sys/powerpc/powerpc/mp_machdep.c	(revision 344018)
+++ /usr/src/sys/powerpc/powerpc/mp_machdep.c	(working copy)
@@ -97,6 +97,9 @@
 	/* Initialize decrementer */
 	decr_ap_init();
 
+        if (bootverbose) // HACK!!!
+                printf("machdep_ap_bootstrap before ap_boot_mtx lock: AP CPU #%d launched\n", PCPU_GET(cpuid));
+
 	/* Serialize console output and AP count increment */
 	mtx_lock_spin(&ap_boot_mtx);
 	ap_awake++;
@@ -109,6 +112,8 @@
 
 	while(smp_started == 0)
 		;
+        if (bootverbose) // HACK!!!
+                printf("machdep_ap_bootstrap after smp_started!=0: AP CPU #%d launched\n", PCPU_GET(cpuid));
 
 	/* Start per-CPU event timers. */
 	cpu_initclocks_ap();
@@ -238,10 +243,19 @@
 
 			ret = platform_smp_start_cpu(pc);
 			if (ret == 0) {
+                                if (bootverbose) // HACK!!!
+                                        printf("cpu_mp_unleash attempting to wait for pc_awake: CPU %d, hwref=%jx, awake=%x\n",
+                                            pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+                                            pc->pc_awake);
+
 				timeout = 2000;	/* wait 2sec for the AP */
 				while (!pc->pc_awake && --timeout > 0)
 					DELAY(1000);
 			}
+                        if (bootverbose) // HACK!!!
+                                printf("cpu_mp_unleash after platform_smp_start_cpu and waiting: CPU %d, hwref=%jx, awake=%x\n",
+                                    pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+                                    pc->pc_awake);
 		} else {
 			pc->pc_awake = 1;
 		}
@@ -252,7 +266,13 @@
 				    pc->pc_awake);
 			smp_cpus++;
 		} else
+                { // HACK!!!
+                        if (bootverbose) // HACK!!!
+                                printf("cpu_mp_unleash adding pc_cpuid to stopped_cpus: CPU %d (dev=%x)\n",
+                                    pc->pc_cpuid, (int)pc->pc_hwref);
 			CPU_SET(pc->pc_cpuid, &stopped_cpus);
+                } // HACK!!!
+
 	}
 
 	ap_awake = 1;

(The above may not preserve all whitespace detail.)

I'll note that I did some experimenting with a system-clang
based kernel build, used with devel/powerpc64-binutils ,
avoiding loading kernel modules dynamically. I did not have
any boot problems but I'd not done enough activity to
infer too much. My normal builds are based on
devel/powerpc64-xoolchain-gcc related tools, including
devel/powerpc64-gcc .


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-ppc mailing list