From owner-svn-src-all@freebsd.org Mon Dec 18 14:59:19 2017 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 E61EFE912E7; Mon, 18 Dec 2017 14:59:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pl0-x236.google.com (mail-pl0-x236.google.com [IPv6:2607:f8b0:400e:c01::236]) (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 BB8097E38A; Mon, 18 Dec 2017 14:59:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pl0-x236.google.com with SMTP id s10so4954131plj.5; Mon, 18 Dec 2017 06:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SLU3rlJry0DCRHqIckYLYi/W7ICmfZgKLhM6T7nfpb8=; b=QJWO1Nw6u+9//cuX7sNqXAtW1KRLvQutfsKlBf47dHn3UTymPQuL9IlA6KjfNITWHP SQpmILnpj/RXx3wdpGtugvbUzdI6ARfPTkfVPb5N12afcvG/zdbQRSYzgXsNGbkYdtGG XmaPUbyLY0Zx38K/oeP//XOaGuINrIFdyN37e9fvcyrU68Y1GuPeGIxNO+9KRc9eCmni Ne+sOXk6JxE/Yvo8aZllmMhXx3GWQooei4/1uDd6dbUqybUirznUNnD5DVW14TFesOHZ c7g8C5TwdoNTqdeFN3RQb3sE0r7Y92gqccdiYFgfRBxbzXYOEpjjfaWFvZc3uZAvZ3e1 +lAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=SLU3rlJry0DCRHqIckYLYi/W7ICmfZgKLhM6T7nfpb8=; b=ieFDxP8XcWxb5/UqWr3pSNcsx4RQ9xvj9hU6gscmEDhb2nRR0AuniT89Qpn2LV8gGf LlXJ+ckV4zP4KhJNnn3umAHVtRXFJd4/iamA4rybQKPY4Wckyte3b1EGCSxcn9aqTgyu gwLfnOzIrIBCv5iSn4F2GwrJYTgvnfYL082fNZ/tixhUBIQck211/O8usa36ilWrqdgY L39Mk1mhtlaLD2KxTgwOB1jJR04DD0a9Xiseoj7c4xRBKo21Jc5r/5JEkUl1pvbkjX+w jRHn51Gi53Cv3iLzVbzGZpIauLAovPqV0apvoBT9+tFzvYgWvThZmUq3yXrjR+fEAz4D Toew== X-Gm-Message-State: AKGB3mIoQhVPqAotNYGCzOZwVRCURjHM9qpw//s19Xz05oVqL8NrOSdt uWn1dmotaSHFkoO+lCNwwF+gjg== X-Google-Smtp-Source: ACJfBov5o3Vum7aFskMg+5ghA98n8SM2B+4LFP7/vQ6xFuFZRGtxN8Oi//XnJ0xiH3cPANmZPeazFQ== X-Received: by 10.159.197.65 with SMTP id d1mr25102plo.58.1513609158489; Mon, 18 Dec 2017 06:59:18 -0800 (PST) Received: from raichu (toroon0560w-lp140-01-69-159-38-22.dsl.bell.ca. [69.159.38.22]) by smtp.gmail.com with ESMTPSA id b78sm27959816pfc.21.2017.12.18.06.59.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 06:59:17 -0800 (PST) Sender: Mark Johnston Date: Mon, 18 Dec 2017 09:59:14 -0500 From: Mark Johnston To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, pho@FreeBSD.org Subject: Re: svn commit: r326643 - head/sys/cam Message-ID: <20171218145914.GD4235@raichu> References: <201712062305.vB6N57XP065402@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201712062305.vB6N57XP065402@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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: Mon, 18 Dec 2017 14:59:20 -0000 On Wed, Dec 06, 2017 at 11:05:07PM +0000, Warner Losh wrote: > Author: imp > Date: Wed Dec 6 23:05:07 2017 > New Revision: 326643 > URL: https://svnweb.freebsd.org/changeset/base/326643 > > Log: > Make cam_periph_runccb be safe to call when we can only do polling. > > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D13388 > > Modified: > head/sys/cam/cam_periph.c > head/sys/cam/cam_xpt.c > head/sys/cam/cam_xpt.h > > Modified: head/sys/cam/cam_periph.c > ============================================================================== > --- head/sys/cam/cam_periph.c Wed Dec 6 23:03:34 2017 (r326642) > +++ head/sys/cam/cam_periph.c Wed Dec 6 23:05:07 2017 (r326643) > @@ -1160,7 +1160,11 @@ cam_periph_runccb(union ccb *ccb, > struct bintime *starttime; > struct bintime ltime; > int error; > - > + bool sched_stopped; > + struct mtx *periph_mtx; > + struct cam_periph *periph; > + uint32_t timeout = 1; > + > starttime = NULL; > xpt_path_assert(ccb->ccb_h.path, MA_OWNED); > KASSERT((ccb->ccb_h.flags & CAM_UNLOCKED) == 0, > @@ -1180,21 +1184,47 @@ cam_periph_runccb(union ccb *ccb, > devstat_start_transaction(ds, starttime); > } > > + sched_stopped = SCHEDULER_STOPPED(); It looks like this regresses DDB's "dump" command: while SCHEDULER_STOPPED() will be true after a panic, it is not true after breaking into DDB from the console. pho@ reported the following issue: db:0:allt> call doadump Dumping 2234 out of 65426 MB:panic: sleepq_add: td 0xfffff80003a48000 to sleep on wchan 0xfffffe0000b36ce8 with sleeping prohibited cpuid = 18 time = 1513582125 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0000b36940 vpanic() at vpanic+0x19c/frame 0xfffffe0000b369c0 kassert_panic() at kassert_panic+0x126/frame 0xfffffe0000b36a30 sleepq_add() at sleepq_add+0x34d/frame 0xfffffe0000b36a80 _sleep() at _sleep+0x26c/frame 0xfffffe0000b36b20 cam_periph_runccb() at cam_periph_runccb+0x17d/frame 0xfffffe0000b36c80 dadump() at dadump+0x12a/frame 0xfffffe0000b36ef0 dump_append() at dump_append+0xa5/frame 0xfffffe0000b36f10 blk_write() at blk_write+0x28b/frame 0xfffffe0000b36f50 minidumpsys() at minidumpsys+0x959/frame 0xfffffe0000b37010 ... Wouldn't it be more correct to predicate on "dumping" rather than SCHEDULER_STOPPED()?