svn commit: r326964 - head/sys/cam

Warner Losh imp at bsdimp.com
Wed Jan 10 23:15:56 UTC 2018


On Wed, Jan 10, 2018 at 1:38 PM, Warner Losh <imp at bsdimp.com> wrote:

>
>
> On Wed, Jan 10, 2018 at 1:35 PM, Mark Johnston <markj at freebsd.org> wrote:
>
>> On Wed, Jan 10, 2018 at 01:32:29PM -0700, Warner Losh wrote:
>> > On Wed, Jan 10, 2018 at 1:24 PM, Mark Johnston <markj at freebsd.org>
>> wrote:
>> >
>> > > On Tue, Dec 19, 2017 at 04:13:22AM +0000, Warner Losh wrote:
>> > > > Author: imp
>> > > > Date: Tue Dec 19 04:13:22 2017
>> > > > New Revision: 326964
>> > > > URL: https://svnweb.freebsd.org/changeset/base/326964
>> > > >
>> > > > Log:
>> > > >   When doing a dump, the scheduler is normally not running, so this
>> > > >   changed worked to capture dumps for me. However, the test for
>> > > >   SCHEDULER_STOPPED() isn't right. We can also call the dump routine
>> > > >   from ddb, in which case the scheduler is still running. This
>> leads to
>> > > >   an assertion panic that we're sleeping when we shouldn't.
>> Instead, use
>> > > >   the proper test for dumping or not. This brings us in line with
>> other
>> > > >   places that do special things while we're doing polled I/O like
>> this.
>> > > >
>> > > >   Noticed by: pho@
>> > > >   Differential Revision: https://reviews.freebsd.org/D13531
>> > > >
>> > > > Modified:
>> > > >   head/sys/cam/cam_periph.c
>> > > >
>> > > > Modified: head/sys/cam/cam_periph.c
>> > > > ============================================================
>> > > ==================
>> > > > --- head/sys/cam/cam_periph.c Tue Dec 19 04:06:07 2017
>> (r326963)
>> > > > +++ head/sys/cam/cam_periph.c Tue Dec 19 04:13:22 2017
>> (r326964)
>> > > > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
>> > > >  #include <sys/malloc.h>
>> > > >  #include <sys/kernel.h>
>> > > >  #include <sys/bio.h>
>> > > > +#include <sys/conf.h>
>> > > >  #include <sys/lock.h>
>> > > >  #include <sys/mutex.h>
>> > > >  #include <sys/buf.h>
>> > > > @@ -1158,7 +1159,7 @@ cam_periph_runccb(union ccb *ccb,
>> > > >       struct bintime *starttime;
>> > > >       struct bintime ltime;
>> > > >       int error;
>> > > > -     bool sched_stopped;
>> > > > +     bool must_poll;
>> > > >       struct mtx *periph_mtx;
>> > > >       struct cam_periph *periph;
>> > > >       uint32_t timeout = 1;
>> > > > @@ -1182,7 +1183,13 @@ cam_periph_runccb(union ccb *ccb,
>> > > >               devstat_start_transaction(ds, starttime);
>> > > >       }
>> > > >
>> > > > -     sched_stopped = SCHEDULER_STOPPED();
>> > > > +     /*
>> > > > +      * We must poll the I/O while we're dumping. The scheduler is
>> > > normally
>> > > > +      * stopped for dumping, except when we call doadump from ddb.
>> > > While the
>> > > > +      * scheduler is running in this case, we still need to poll
>> the
>> > > I/O to
>> > > > +      * avoid sleeping waiting for the ccb to complete.
>> > > > +      */
>> > > > +     must_poll = dumping;
>> > >
>> > > Hmm, unfortunately this introduces a new problem: after a panic we
>> call
>> > > adashutdown() as part of the shutdown_post_sync event. This occurs
>> > > before we call doadump(), so dumping == 0 and we don't poll for the
>> > > spindown command's completion. But since we've panicked, the scheduler
>> > > is stopped, and so we just hang.
>> > >
>> >
>> > So "dumping || SCHEDULER_STOPPED()" then is needed?
>>
>> It seems so, unfortunately.
>>
>
> OK. Sounds good. I'll make the change today.
>

https://reviews.freebsd.org/D13845 is up, if anybody wants to take a look.

Warner


More information about the svn-src-all mailing list