From nobody Tue Jan 25 15:38:06 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 899C3198821D for ; Tue, 25 Jan 2022 15:38:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JjrbL2lgbz3PTH for ; Tue, 25 Jan 2022 15:38:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EA36470F for ; Tue, 25 Jan 2022 15:38:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 20PFc6wr015347 for ; Tue, 25 Jan 2022 15:38:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20PFc6nI015346 for bugs@FreeBSD.org; Tue, 25 Jan 2022 15:38:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261387] Should cam be calling callout drain for struct cam_sim and struct cam_ed? Date: Tue, 25 Jan 2022 15:38:06 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: markj@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: scsi@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc assigned_to Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643125086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/Lp9u6KgnpvKjkATmYNHKzSsb3DmMeq0QQKPkhAPYQY=; b=TT3MIDPC1CMFko9r0FVoat/adHn456dGOFYiGlGAl8WcsKS5B/XaQi9Z2gLBFRn+iwe+TS V9MjUzZYJBQN56MGkNg81xJXRWyl4G/SpaBagUviJYE6CP0Wz7yFy9PEo7arzjgmhE+ueP zopIK0uOLD9kRwIiYKTLesb/P5W3SWddnKJ+l/y06S8wDg98/tU8TbXhPvfvriMiuCpnF7 5M18OV9pDvMPtsZk3+vEzC4LiyYIuS7s1o/PvnUd0nLmxt7BkzU+X4zJ+niwdKmdV5BXCH 3kWa5IUjDxbU74yrNS/Lw0ZwmYG5QD3tmomKcIHc5Emq2wCj67VItoY+p/ywTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643125086; a=rsa-sha256; cv=none; b=XWuxwf9ojTERxmJd1XAEMenYVbOum4FIEbfSRx6R5hzBhVaYlFLeJYFSiyWKAFKZEcV6EN 3c9rwLQ0uXvTjVKXSah2nyLx1ymujdLmhsIFPeMfS84hUWciGzFvK+VJEYET1ipkJe8+rR B9dTBqLQsCn8Nh6RZX39T9YGybQTklgactLKDXDhVn1pqqNLA8vkIRVToQl3WBgwfGXqsF IjzPm0XhwHIGi0DSEeLySSNK4ioTqy5e2W6iDAo2TTTwRTeGq86ezCoDuHSvqK5CXOsM2i 3rzTEyP9q9b37O3G0YSAmTwFStks+w55W4/AyJU9H0s2k/L9p4iwmXAUMjD38g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261387 Mark Johnston changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Open CC| |markj@FreeBSD.org Assignee|bugs@FreeBSD.org |scsi@FreeBSD.org --- Comment #1 from Mark Johnston --- Looks like the cam_sim callout has been removed: https://cgit.freebsd.org/src/commit/?id=3D28027f28e607012b83ee9062eed3b8ed8= 2e819c1 I think you're right that it should have been drained, but it's somewhat mo= ot since it apparently wasn't used. The cam_ed callout is a bit more complicated: it's interlocked by the devic= e's SIM's devq lock, dev->sim->devq->send_mtx. So the callout handler, xpt_release_devq_timeout(), runs with send_mtx held, as does xpt_release_device() when it stops the callout. The interlock is mostly sufficient to ensure that the callout does not continue running. It's not completely sufficient, though, since xpt_release_devq_timeout() may drop the send_mtx lock to schedule I/O (presumably from a different device). During this window, xpt_release_device() may try to stop the callout, fail, and continue destroying the device, while the callout is still running. It's not very clear whether it's ok to free a callout while the handler is running. At that point the callout subsystem no longer references the call= out, and xpt_release_devq_timeout() presumably won't access a "doomed" device af= ter dropping the send lock, since it's shouldn't appear in the devq anymore. So I suspect that it's mostly a theoretical problem, though the callout documentation really doesn't make this clear. --=20 You are receiving this mail because: You are the assignee for the bug.=