Skip to contentSkip to conversation

Question about tboot_wait_for_aps()

DISCUSSION Paul E. McKenney 1 participant 1 message Jul 24, 2012

lore
Share & tools
lore
#0 lore raw

Hello!

While taking another pass through the CPU_DYING notifiers, I came upon the following:

	static int tboot_wait_for_aps(int num_aps)
	{
		unsigned long timeout;

		timeout = AP_WAIT_TIMEOUT*HZ;
		while (atomic_read((atomic_t *)&tboot->num_in_wfs) != num_aps &&
		       timeout) {
			mdelay(1);
			timeout--;
		}

		if (timeout)
			pr_warning("tboot wait for APs timeout\n");

		return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
	}

Questions:

1. Why AP_WAIT_TIMEOUT*HZ? Given the mdelay(), shouldn't this
instead be AP_WAIT_TIMEOUT*1000? The definition of AP_WAIT_TIMEOUT indicates that it is in seconds.

2. Who changes ->num_in_wfs? Any other CPUs are in stop_machine(),
plus I don't see any assignments to this field. Does the boot firmware run again to make this change, sort of like SMIs?

I guess that the good news is that I don't seen anything that cares about stop_machine(). ;-)

Thanx, Paul