From owner-svn-src-all@freebsd.org Wed Jan 10 23:15:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80D16E7D00B for ; Wed, 10 Jan 2018 23:15:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F49A72451 for ; Wed, 10 Jan 2018 23:15:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-wm0-x234.google.com with SMTP id r78so2052307wme.0 for ; Wed, 10 Jan 2018 15:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FIAMWdC0wvtcQyMSQ61FebtVcC32SrYSLEVK7fbhgIc=; b=T+ivfSG3ICxVilXqT/KdWSObmKD+UgZFGK8rDilZ7qV5FPFpOKQqwp9M29HxG7Ja63 bi7q51ty9U9F2rKT3lUMy6epYvrszjFjoz/N5Uj3AUY1AyD79ehf3UkjaNmpsCjg77EM XAzCgFT7Yh6sByg3lDBEAhKetcGRNd20zdz4y5z6ZCSm3Qw57L0+QE8+ATBJEIqfNrrW BVd1fhMDIR4judznXuLSiLmkxlq6h//nMSb8oVS1zDuPnqavFs0OdkX5msCAiju2+dMS yZ3S420jFEbz6+s+XDRAAwkW3qZ2b6khzyysSRJcYfcCAZss4eoezJ5iRzhhUh5oiBnZ J4UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=FIAMWdC0wvtcQyMSQ61FebtVcC32SrYSLEVK7fbhgIc=; b=qD8zE2ZItG/hcS4iKqn+HPV6/4TmMbnCltZHwLKK7qc8TzM5ER6ss25VPgmoHjGPuF CT4OKfovB66SkHJp9zJ01oqw9ycJUHoEpSQt4CJTN5pY+i6PKhcj2A83hmkRVPU6M+zs MAQbI5Gyj/q/CC6Q4V4kq0Ejkz/DPy/lp1pSNFEYI3ZcCIZIkvAcVunaPDQcgek68tyF Z38iuNGemVGxcZiMuibLE/TDWaNlJqzgYHtY7fGTukEXCwJyy4+fP95aEDaB2qZc0OhD 6XpAnIlNiCgE9boi6HAWQC4Y0lScApbwc65dT2Y/s0Sfnz0HByNxSZ5YFelkaqPHg2zG 6JPg== X-Gm-Message-State: AKGB3mJ+yyBCYGgIPBSRhClWPd2Jld3usD5rXBKBD8E18FeOfccKO/cI WG0XsCiml92Bh1A3V5dEXQZi0yWdg2r8+xbFACEm5g== X-Google-Smtp-Source: ACJfBosyhcgLYqHxhhbVvUXLe7+sYC+R4drfecDC+s6lbDEmgLSo8/IA8Qo3soTGH4FMliLAV4jEYF9lw0zT+1sFuTk= X-Received: by 10.80.171.225 with SMTP id u88mr27582522edc.167.1515626153915; Wed, 10 Jan 2018 15:15:53 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.80.195.88 with HTTP; Wed, 10 Jan 2018 15:15:53 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201712190413.vBJ4DMY9090982@repo.freebsd.org> <20180110202442.GC78524@raichu> <20180110203515.GD78524@raichu> From: Warner Losh Date: Wed, 10 Jan 2018 16:15:53 -0700 X-Google-Sender-Auth: IBU_qxRbBjGJD-dLuEq6ASY_XL8 Message-ID: Subject: Re: svn commit: r326964 - head/sys/cam To: Mark Johnston Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 23:15:56 -0000 On Wed, Jan 10, 2018 at 1:38 PM, Warner Losh wrote: > > > On Wed, Jan 10, 2018 at 1:35 PM, Mark Johnston 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 >> 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 >> > > > #include >> > > > #include >> > > > +#include >> > > > #include >> > > > #include >> > > > #include >> > > > @@ -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