Stop scheduler on panic

mdf at FreeBSD.org mdf at FreeBSD.org
Thu Nov 17 21:20:59 UTC 2011


On Thu, Nov 17, 2011 at 1:08 PM, Andriy Gapon <avg at freebsd.org> wrote:
> on 17/11/2011 23:02 mdf at FreeBSD.org said the following:
>> Another patch related to this area we have at $WORK:
>>
>>  #if defined(SMP)
>> -       /*
>> -        * Bind us to CPU 0 so that all shutdown code runs there.  Some
>> -        * systems don't shutdown properly (i.e., ACPI power off) if we
>> -        * run on another processor.
>> -        */
>> -       thread_lock(curthread);
>> -       sched_bind(curthread, 0);
>> -       thread_unlock(curthread);
>> -       KASSERT(PCPU_GET(cpuid) == 0, ("%s: not running on cpu 0", __func__));
>> +       /*
>> +        * sched_bind can't be done reliably inside of panic.  cpu_reset() will
>> +        * rebind us in any case, more reliably.
>> +        */
>> +       if (panicstr == NULL) {
>> +               /*
>> +                * Bind us to CPU 0 so that all shutdown code runs there.  Some
>> +                * systems don't shutdown properly (i.e., ACPI power off) if we
>> +                * run on another processor.
>> +                */
>> +               thread_lock(curthread);
>> +               sched_bind(curthread, 0);
>> +               thread_unlock(curthread);
>> +               KASSERT(PCPU_GET(cpuid) == 0, ("boot: not running on cpu 0"));
>> +       }
>>  #endif
>>         /* We're in the process of rebooting. */
>>         rebooting = 1;
>
> Yes, you have contributed this patch before and it is a part of the bigger
> stop-scheduler-on-panic patches.  Have you had a chance to review those? :)

It's been so long I don't remember what I've sent where.  I did look
over the patch but had no additional comments.

Cheers,
matthew


More information about the freebsd-current mailing list