From nobody Mon Feb 14 15:08:03 2022 X-Original-To: virtualization@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 AD26319B5C58 for ; Mon, 14 Feb 2022 15:08:03 +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 4Jy6zQ6GX4z3F2t for ; Mon, 14 Feb 2022 15:08:02 +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 B575810EED for ; Mon, 14 Feb 2022 15:08:02 +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 21EF82xJ026726 for ; Mon, 14 Feb 2022 15:08:02 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 21EF82cx026725 for virtualization@FreeBSD.org; Mon, 14 Feb 2022 15:08:02 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 261198] bhyve host panics with: spin lock 0xffffffff81eac800 (callout) helpanic: spin lock held too long Date: Mon, 14 Feb 2022 15:08:03 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644851283; 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=vk7R6QYhy2I3SY2SagvloVEZ+lPW7C4lx1E7aWqFS4Y=; b=V81XKWaej+ACdsUkBwWaGNBlrnqvMZID+7OgBXp+krv27rrqbTXjXN/B+lwAG9YOd+2xcD xhr68SWpuqkUWyxYcCWRfs5mH8yCNHXqJnbAiBpqjwykATy1Oio0t67otjRKLYN9fCKZxs 6jwaMe3oSh/Uf4BqQSxOIY0p+IwcmU+umBlLfD+0aIG47FLRCEjrBnUxqM3DPOeVIpvXiE EMkyzuaUvV20VC9Z2q4Sc5AfefNrveM+43iL+fEJZaBkyEtj40KVc064ZSmBV4GokVksik QcBm6hHkKdDa6+VWOL2+2xxG5y4ixkOyBoqRz8hEH3EXwwtD2p9In0giAs1+xQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644851283; a=rsa-sha256; cv=none; b=ggekOkZzoKjibJ7DtJzEMLazTfjOH7vvrHVR6iG5fJPe3VsmPN1LkyznX10jRgc2RhrtOo DS47qRHzwFOQOt7wdNuRuRGuDdrYentUZ64nIE274Gse5jfyQfl0MCRfk4ZSuAKKgQK97E hUbx9HlneS+vaBPHQfu7pSX0y10WaIwz5AMZ6NMyRQs3j/2HB43lmOdGKL7WgFEPBJv0x9 ZJDRAskxwinvoIaiscDZAMby5BEGpws07YG3wMTEKSu0ps6cJsuoDnJJBtdeAuDu42XWWf 00KQAtYjGHprQ8iLlveiSP5t7kPc/9zBt4tzr8FCbtS4Xa9SrKbp/NzHq5Su5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261198 --- Comment #9 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D893be9d8ac161c4cc96e9f3f12f126035= 5dd123b commit 893be9d8ac161c4cc96e9f3f12f1260355dd123b Author: Mark Johnston AuthorDate: 2022-02-14 14:38:53 +0000 Commit: Mark Johnston CommitDate: 2022-02-14 15:06:47 +0000 sleepqueue: Address a lock order reversal After commit 74cf7cae4d22 ("softclock: Use dedicated ithreads for running callouts."), there is a lock order reversal between the per-CPU callout lock and the scheduler lock. softclock_thread() locks callout lock then the scheduler lock, when preparing to switch off-CPU, and sleepq_remove_thread() stops the timed sleep callout while potentially holding a scheduler lock. In the latter case, it's the thread itself that's locked, and if the thread is sleeping then its lock will be a sleepqueue lock, but if it's still in the process of going to sleep it'll be a scheduler lock. We could perhaps change softclock_thread() to try to acquire locks in the opposite order, but that'd require dropping and re-acquiring the callout lock, which seems expensive for an operation that will happen quite frequently. We can instead perhaps avoid stopping the td_slpcallout callout if the thread is still going to sleep, which is what this patch does. This will result in a spurious call to sleepq_timeout(), but some counters suggest that this is very rare. PR: 261198 Fixes: 74cf7cae4d22 ("softclock: Use dedicated ithreads for running callouts.") Reported and tested by: thj Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34204 sys/kern/subr_sleepqueue.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --=20 You are receiving this mail because: You are the assignee for the bug.=