From owner-svn-src-head@freebsd.org Mon Dec 18 15:28:36 2017 Return-Path: Delivered-To: svn-src-head@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 BE1A4E935B6 for ; Mon, 18 Dec 2017 15:28:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (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 7F1B37F8FF for ; Mon, 18 Dec 2017 15:28:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x233.google.com with SMTP id v186so10184033iod.7 for ; Mon, 18 Dec 2017 07:28:36 -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=IK8agE4EyaEMd4e4F0/ClbfELGNJs7cnrIhCD/Jm1P8=; b=0ECvX1WgnwyjAmddkG2MkXnHP3ITSXyDUdDynX4+AtpV2p6YxOSOwaUnOqH3o3rqI4 FoXpEEyFt0p/rFtMxCKN5wymXGd1SacUc+E/xJRrDdWupbQHva7TUzFVpxVfDGaGvtjb 7MVtxfDmTGyjgmLTx2NJhkixIYLe9A1OrH3km98149V6tWVeP3+h1XkWTYzJFBMMvEjj wMSjOqhInHXV/FUr/QAAlAXhAlhghl/2XUMjo1skoHMbCbCSPT5XrXc49LeAKKX8Qz54 dSPHESilBBPdPQaumCLzoa7LOnLuAoRiEA0zqKyqMT9Evti/jbt1lkwH+URhF1fc/oLs YmgQ== 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=IK8agE4EyaEMd4e4F0/ClbfELGNJs7cnrIhCD/Jm1P8=; b=aSiS0S8ox4Ed1kLD+OYSU/B8sKLMbvn+L+4yQYXU/LnRhAzD2ndThMhPjzG5mzYO1w SZizZ8f5xiRz8mXXTcF1015sTmi8JJVX+8Uj2L/PlwdAzF0VsT4gauuDH2EacOkA/z60 H+5IdMvwWNWX3xfKdySYNHOV7sKOwx4QcO4Ygmzklh/chrUlJ1VUiJeoDOv+TXkPwkTd b+ogXMTNL+WYxOXw6YsizjH/NRcoPJ5aH3haviLSbqfLDrhBO5/CsFbQK1xEZ7J90AX8 dRQkpme+JXUQWwq+h29M7A+6wLQASTRSXm8yZMRvLxX4UD6kaGCnNDiVUHbTbfjg4XF0 iaog== X-Gm-Message-State: AKGB3mL4SyaiL3r4BW6t7srzc824QGs6m6MCODk6JKxivWghuuDTnWuE klfOMXkHbGzk5WU8/bc3ygmT8WR6I9A6xVYLLRdfnA== X-Google-Smtp-Source: ACJfBosfX+8zM7KWHhxoMpDQRJJKSsl55ygCIvHNzKDHeASuq3bPvfHV2vY2sOYDk72B2uESr/cnHpqXfS2eKlHUEnY= X-Received: by 10.107.48.197 with SMTP id w188mr94849iow.301.1513610915404; Mon, 18 Dec 2017 07:28:35 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.108.204 with HTTP; Mon, 18 Dec 2017 07:28:34 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <201712062305.vB6N57XP065402@repo.freebsd.org> <20171218145914.GD4235@raichu> From: Warner Losh Date: Mon, 18 Dec 2017 08:28:34 -0700 X-Google-Sender-Auth: DwznuAmEJgFz71wT4J5Lr9KMJJk Message-ID: Subject: Re: svn commit: r326643 - head/sys/cam To: Mark Johnston Cc: Warner Losh , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Peter Holm Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Dec 2017 15:28:36 -0000 Sorry for the top post, but https://reviews.freebsd.org/D13531 should have a fix. Warner On Mon, Dec 18, 2017 at 8:03 AM, Warner Losh wrote: > > > On Mon, Dec 18, 2017 at 7:59 AM, Mark Johnston wrote: > >> 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()? >> > > I debated between a number of different alternatives, but didn't have a > use case for when SCHEDUELR_STOPPED() would be wrong. Now I do. I think > that you are right. I'll make that change. Sorry for the hassle this may > have caused. I'll submit a review and add you as a reviewer today. > > Warner >