Re: [PATCH] Hotplug CPU prep V: x86 non-linear CPU numbers

Rusty Russell (rusty@rustcorp.com.au)
Thu, 16 May 2002 09:14:47 +1000


In message <20020515101314.GA1152@elf.ucw.cz> you write:
> > @@ -1585,7 +1581,7 @@
> >
> > p = buf;
> >
> > - if ((smp_num_cpus == 1) &&
> > + if ((num_online_cpus() == 1) &&
> > !(error = apm_get_power_status(&bx, &cx, &dx))) {
> > ac_line_status = (bx >> 8) & 0xff;
> > battery_status = bx & 0xff;
>
> Are you sure? What if you add another CPU just after the test?

APM is special: what it *really* wants to know is if only CPU 0 is
online (this test will almost certainly fail miserably if the single
online CPU is CPU 1, which previously wasn't possible).

I'll check with the APM maintainer what guarantees he needs: we may
actually need to grab to cpu control lock here. Anyway apparently I
broke something else in APM.

(BTW, in general, we use magic to avoid locks around num_online_cpus()
et al: we make changes then wait for everyone to voluntarily schedule
before exposing it).

Cheers,
Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/