Question about tboot_wait_for_aps()

From: Paul E. McKenney
Date: Tue Jul 24 2012 - 12:40:36 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/