From owner-freebsd-current@freebsd.org Mon Nov 14 09:58:11 2016 Return-Path: Delivered-To: freebsd-current@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 D44E5C3DC0D; Mon, 14 Nov 2016 09:58:11 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 689BA7F4; Mon, 14 Nov 2016 09:58:11 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id m203so13713080wma.3; Mon, 14 Nov 2016 01:58:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Anh1iHKgL5LhAQVaMituc9q/DaDazAE/YPLQQyFS/xc=; b=WjvswxAE5HFlCtW1U37ufER3lscea33Zj+f7t9HaQjobGvzb5Z1MjU+aj73V0x70+h rL1sKrliUe4kSYZidiJdgxqC3mMSqJpzBQYBVUTts9iXrAgImwQ6eNax8LUQJ73Kf+4m eWc3ASodYY6U0XfbHcBsgkWY6aAK7bLDNsC/c7hBF1xJbfjBn+Elu0NGK5IbUfPF4yGD RhpEwFeV+g76M5k5WX81/IaMkgjnn0shXuotuu69lviMK1dB+zdle3n1nkA7Jd5qrumd GogEU6PwkiOMbhVceYGRd5jyY/eZs938+0njYHavKqBty5vALVP8tUja9HGdqHu+qXtL Tv0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=Anh1iHKgL5LhAQVaMituc9q/DaDazAE/YPLQQyFS/xc=; b=XHTJqv6sZBaBq6A1YQLUaJ/nXrCrBIunBBuZ0Qf3FNH/oXnVmytobO3Mfo40gHUxKe bvUEblxWXXZlnIOP2troZ1k+GQGVZM7CoZ1bsCXtxM/mTbbnyjSIE3uwSuvxJABEWFI9 eXw4QIZJiA+twI9TGrb7DuzMojNhHN8Aq/vi/QmJTVjX5Rj4EUy+EZoD5rGZlxxQz1EB iZrODBxEbAParHePDM2bEOgmKLROIu8O9hEK6eTWIcV0HBPHUgIIlWp7grunvBffOLgM XO9rkB2T9L98zayoREpP0dHNcXcmShhb2Q1xnksshp4e26MAdS5N84/BTyRkqkJwUWvL xuzQ== X-Gm-Message-State: ABUngve7R1k6uh8CHpgoVVxIgc7n8cSHhSFX+4l2etClLKWD4FLfwP1xnpBGTuQJyTqNog== X-Received: by 10.28.216.9 with SMTP id p9mr8824267wmg.11.1479117489683; Mon, 14 Nov 2016 01:58:09 -0800 (PST) Received: from ernst.home (p578E1FD9.dip0.t-ipconnect.de. [87.142.31.217]) by smtp.gmail.com with ESMTPSA id k2sm27730285wjv.11.2016.11.14.01.58.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Nov 2016 01:58:08 -0800 (PST) Date: Mon, 14 Nov 2016 10:58:07 +0100 From: Gary Jennejohn To: Andriy Gapon Cc: FreeBSD Current , FreeBSD Hackers Subject: Re: firewire panic Message-ID: <20161114105807.02dfbe66@ernst.home> In-Reply-To: References: <91a1440d-14c7-2cc6-6cbb-2b62bfd2c27d@FreeBSD.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2016 09:58:11 -0000 On Sun, 13 Nov 2016 23:56:09 +0200 Andriy Gapon wrote: > On 11/11/2016 14:25, Andriy Gapon wrote: > > panic: mutex sbp not owned at /usr/src/sys/dev/firewire/sbp.c:967 > > cpuid = 2 > > curthread: 0xfffff8000ada5000 > > stack: 0xfffffe0504ded000 - 0xfffffe0504df1000 > > stack pointer: 0xfffffe0504df0a00 > > KDB: stack backtrace: > > db_trace_self_wrapper() at 0xffffffff80420bbb = db_trace_self_wrapper+0x2b/frame > > 0xfffffe0504df0930 > > kdb_backtrace() at 0xffffffff80670359 = kdb_backtrace+0x39/frame 0xfffffe0504df09e0 > > vpanic() at 0xffffffff8063986c = vpanic+0x14c/frame 0xfffffe0504df0a20 > > panic() at 0xffffffff806395b3 = panic+0x43/frame 0xfffffe0504df0a80 > > __mtx_assert() at 0xffffffff8061c40d = __mtx_assert+0xed/frame 0xfffffe0504df0ac0 > > sbp_cam_scan_lun() at 0xffffffff80474667 = sbp_cam_scan_lun+0x37/frame > > 0xfffffe0504df0af0 > > xpt_done_process() at 0xffffffff802aacfa = xpt_done_process+0x2da/frame > > 0xfffffe0504df0b30 > > xpt_done_td() at 0xffffffff802ac2e5 = xpt_done_td+0xd5/frame 0xfffffe0504df0b80 > > So, it's pretty obvious that the sbp mutex can not be held when > sbp_cam_scan_lun() is called. > The code seems to assume that the scan_callout callout is still holding the mutex when sbp_cam_scan_lun() is entered. Seems reasonable, since the man page claims that the callout routine keeps the mutex locked until the callout function, in this case that's sbp_cam_scan_target(), returns. Since sbp_cam_scan_target() invokes xpt_action() with sbp_cam_scan_lun() as its callback, it seems like the assumption should be true. Pehaps there's some asynchronous action happening with the firewire code which is releasing the mutex prematurely. Or maybe the sbp used in sbp_cam_scan_lun() is wrong? Dunno. -- Gary Jennejohn