From nobody Fri Nov 22 04:53:56 2024 X-Original-To: dev-commits-src-all@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 4XvjRm740zz5dM8b; Fri, 22 Nov 2024 04:53:56 +0000 (UTC) (envelope-from git@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XvjRm4KwXz4vSx; Fri, 22 Nov 2024 04:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732251236; 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; bh=DqqUxqhXhfr+qFH3VruGzHIrWHTRZ6AdWsYUKlLXQ4w=; b=cbA5sFE7MQyqqrA6lX8hV8mZG9dgX3VMHqxzl2fKsmf8+FftdmCdPglL74Sv42aDVD/4oJ nQuUni3Wn5MrjYJk7b8WzuVs/vvolIKJSKvqxqWjutuz5BBvKThMLBnLmhX7VQX/XMFBgM w0fDK7eFpeXpIju6cG0KEmy1aLKqqXtwCq+8NFWaSGaSEc/QFdiEb+2cuTCcCzq9u7aS+H qW/lA2Dg+5AYELnuDd2QpbY1oTwp8g1eit9SHyVuWWL0eVR4YZ8BWA9CNobRVl4A6maboY rFZPECcZErfvNgLQv20AoxNT7EMvTWmf60mwJ0VyLblf78nTQEtAhAB5mBiJog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732251236; 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; bh=DqqUxqhXhfr+qFH3VruGzHIrWHTRZ6AdWsYUKlLXQ4w=; b=DG7ozNOytCE+0NLcrXKbI7newTbVP9sgkApnMuSiVM2zYrAn5xdb0wxgK31RtFR6Txs4om xUhSF8dOrK2MoWtyb026f3RyXk2LIbipEH7TvXIQ8TAtXvHGYaPhdczF7bcpQbD3qhNra7 8R1Fbr2DgoOozDz0C08tXJ6JTrV5lR/0XDm6FINajfsf1v/AMrmtG8ekXqMZ7DXLLCREm+ kDO8HWMvUqRYfS/qM9l1kKHNoDSNwksYwne61+qp6UNFWcA/8SqVjWUdxF62/17A4qbeVP CUI788JbjUUJfosYUtH19Y9wmts52TMTeB6AN7YJEWQHgp64oKE1OYaksRWJ2Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732251236; a=rsa-sha256; cv=none; b=l30sjRPHfwBR2qJs3jCybP/9MF+idn3M2Kif/eC71sKtA3o3E0J+o/aE9tCHR1oP7p1S8J 6oaowlt7sWnrzM2R4dgsJBtYcQe26iI5vF2BoQzNIq6sLXyGyIj8MFIyTbF14Gx43bZ2XL ia4hMVQO5/LdkLscdijbXxj4f/qwgH1Vn74Wy+U5utLayft0yliAZs+aHwDljO4i0bg39T DuEBu7hWBNWtqIE5BAFuD3EpHXAGh6KO0g9g8tw9rxTkz4tiXgLUACQmzjLKfc8jR5mKwL Yqfd2UH3Ztd2+8AVe4oWvj1NVwMo2UOfsR65mY11kF7oGtprU6xzeLiNcmVmFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4XvjRm3KMyz193j; Fri, 22 Nov 2024 04:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AM4ruJx035165; Fri, 22 Nov 2024 04:53:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AM4rurP035162; Fri, 22 Nov 2024 04:53:56 GMT (envelope-from git) Date: Fri, 22 Nov 2024 04:53:56 GMT Message-Id: <202411220453.4AM4rurP035162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 7951b4f4f99c - stable/13 - _utmx_op: don't recurse on chain busy List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7951b4f4f99cc6e2cbd51c516dc083e031c3babf Auto-Submitted: auto-generated The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7951b4f4f99cc6e2cbd51c516dc083e031c3babf commit 7951b4f4f99cc6e2cbd51c516dc083e031c3babf Author: Kyle Evans AuthorDate: 2024-11-13 22:18:40 +0000 Commit: Kyle Evans CommitDate: 2024-11-22 04:53:44 +0000 _utmx_op: don't recurse on chain busy In handling a PP mutex, we'll busy it as soon as we enter the loop and unbusy it either prior to sleeping or at exit time. In this particular case, if we fail to transition the mutex from OWNERDEAD -> owned because of casueword(9) failure and the suspend check fails, we'll start over and attempt to busy an already-busied chain and irrecoverably lock up both this thread and anything else that tries to busy the chain. Unbusy the chain prior to restarting because I couldn't decide if that was a better or worse idea than just keeping track of whether we dirtied it in do_lock_pp() and avoiding re-dirty. This is marginally easier to reason about as it returns us to expected state on entry to the loop. While we're here, simplify the code a bit as `error` will be clobbered right after the branch anyways. Reviewed by: kib, olce (both earlier version) (cherry picked from commit f660777865fcc28e147b51362412e0286e7df78e) --- sys/kern/kern_umtx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 23087cf4269e..61b86d0b62b1 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -2605,11 +2605,9 @@ do_lock_pp(struct thread *td, struct umutex *m, uint32_t flags, */ if (error == 0) { error = thread_check_susp(td, false); - if (error == 0) { - if (try != 0) - error = EBUSY; - else - continue; + if (error == 0 && try == 0) { + umtxq_unbusy_unlocked(&uq->uq_key); + continue; } error = 0; }