From owner-svn-src-head@freebsd.org Mon Dec 18 15:03:10 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 49597E91834 for ; Mon, 18 Dec 2017 15:03:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (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 086617E91A for ; Mon, 18 Dec 2017 15:03:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22b.google.com with SMTP id x129so10098471iod.13 for ; Mon, 18 Dec 2017 07:03:10 -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=9FlPa3LjDxUxFBG7HN9/aEWW6Sg8RIm9ZQc6VflXRTA=; b=mOHCUNyZfy1jvFlMChfcu8e29sbARbG5sNTJpAmyMGIeodexqb4F+WG6S8y2ftA7bw xNcNrrnIOYJiROWVCsFrq8jjhoSP60+IT1vcjuT/a4ILOZXNsWlPO6DB2oujN9w268zS uo0GpFtgK9ZuOwuLEcdv6gli61nD4xZ06dOB1cah8MsOlId9e7fncV5Gmpeza/zSDGKJ 35vWJL1pZapE3CXvlpvA9pr+148qWtwZuxYEPA3iRmeeWF9FK7JsEt1PbGYeKqrkN4uq d1R6ecX6enj9cZ7urU015TLdR+Chgx/pxCQtNRuBY9WbkTIrC4M8buQsHfVKH0UtKmQL wEzw== 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=9FlPa3LjDxUxFBG7HN9/aEWW6Sg8RIm9ZQc6VflXRTA=; b=tM6u0xGmp8Q1qHIUkZakhvK1JB8JZaeD19JTwmqGg+wPGs9K9ZhacV51+5ANo9+aoj cKD3AAWZDEad3SEJsXmESI+BhoG0UriuF9JjAVEbKsVWb+pmvxx5FfyJuXrv3zvj/Tim ICogL18eJ6DWfskFASK5HZ0VJkUKvG7+2h7aGHbfgfczoO0XDeTPU0Gz9hXNpbQDrR+8 fBelv81zVhb8Hi5h0jArKx3hWgZTrt0rPg+UzIH10+veIracVQy8mU9ptIoUQNvqs79V v8XFPjRqL+zUHU7kdAHMInW9Qhr/UzanVHa9mfjEtWJhPz66LiP46QsQeweojVl5eYLW URrw== X-Gm-Message-State: AKGB3mLQ/p5C6rJiM01mYPIiWVFk5jpW2ODrm30x9yhKwbgTuPjZKXUS rj1EZHfnsf3eiBypZkf6dFsr9WppiOfjSfeBvlYNkw== X-Google-Smtp-Source: ACJfBosFX16G73I1DDuI16qKqWHoHEU8ZNm06XCfg3SU5eeJ6J4oiC5wF64J82ypvXaTYgxFpnbA1GEHTkmrUozy3gA= X-Received: by 10.107.30.81 with SMTP id e78mr45564ioe.130.1513609389010; Mon, 18 Dec 2017 07:03:09 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.108.204 with HTTP; Mon, 18 Dec 2017 07:03:08 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20171218145914.GD4235@raichu> References: <201712062305.vB6N57XP065402@repo.freebsd.org> <20171218145914.GD4235@raichu> From: Warner Losh Date: Mon, 18 Dec 2017 08:03:08 -0700 X-Google-Sender-Auth: OPVAhSegMcEcjpMsND3u7--yKng 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:03:10 -0000 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