cvs commit: src/sys/geom/eli g_eli.c
Nate Lawson
nate at root.org
Mon Jan 29 18:07:34 UTC 2007
Pawel Jakub Dawidek wrote:
> On Sun, Jan 28, 2007 at 09:14:58PM -0800, Nate Lawson wrote:
>> Pawel Jakub Dawidek wrote:
>>> pjd 2007-01-28 20:29:12 UTC
>>> FreeBSD src repository
>>> Modified files:
>>> sys/geom/eli g_eli.c Log:
>>> It is possible that GEOM taste provider before SMP is started.
>>> We can't bind to a CPU which is not yet on-line, so add code that wait for
>>> CPUs to go on-line before binding to them.
>>> Reported by: Alin-Adrian Anton <aanton at spintech.ro>
>>> MFC after: 2 weeks
>>> Revision Changes Path
>>> 1.34 +7 -0 src/sys/geom/eli/g_eli.c
>>> Index: src/sys/geom/eli/g_eli.c
>>> diff -u src/sys/geom/eli/g_eli.c:1.33 src/sys/geom/eli/g_eli.c:1.34
>>> --- src/sys/geom/eli/g_eli.c:1.33 Thu Nov 2 09:01:34 2006
>>> +++ src/sys/geom/eli/g_eli.c Sun Jan 28 20:29:12 2007
>>> @@ -324,6 +324,13 @@
>>> wr = arg;
>>> sc = wr->w_softc;
>>> +#ifdef SMP
>>> + /* Before sched_bind() to a CPU, wait for all CPUs to go on-line. */
>>> + if (sc->sc_crypto == G_ELI_CRYPTO_SW && g_eli_threads == 0) {
>>> + while (!smp_started)
>>> + tsleep(wr, 0, "geli:smp", hz / 4);
>>> + }
>>> +#endif
>>> mtx_lock_spin(&sched_lock);
>>> sched_prio(curthread, PRIBIO);
>>> if (sc->sc_crypto == G_ELI_CRYPTO_SW && g_eli_threads == 0)
>> I thought tsleep() didn't work right before !cold. Is that old knowledge?
>
> Hmm, I thought that cold is zeroed before smp_started is set?
>
I don't think that's guaranteed. Besides, there's an easier way to fix
your problem. Instead of calling kthread_create() from your geom create
routine directly, queue a stub request on the thread taskqueue to call
kthread_create().
For example, see sys/dev/acpica/acpi_acad.c. We call this from attach()
and then the system thread only runs and then calls acpi_acad_init()
once all CPUs are initialized. See sys/sys/taskqueue.h for how to add a
task to the system thread taskqueue:
taskqueue_enqueue(taskqueue_thread, &task);
--
Nate
More information about the cvs-src
mailing list