From nobody Thu May 19 16:52:40 2022 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 271091ADE148; Thu, 19 May 2022 16:52:41 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L3wrn03NJz3JDr; Thu, 19 May 2022 16:52:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652979161; 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=DDiXIdB6gxRF6udwSE74KnoU8tV4EobmPb83Xbr3/vM=; b=yvHuCcP1B3RdFbpBUocXqKCjuuBK8+ByHeRIz0HEqYanBouRd98NAlFQ5qZ5PJ8pbw7nRB lM1KY21KIreysIJiXgP2KFV6mmE+3MekyyAu3oxqZEMflV2HxtXzS+WNiCWVPdi+lai2X3 3B41rynH++Mf0wlLtdP24iEEbR067Q5PzFRRE+X8DBqBsA/Q9PNP96wzBw52gCkbQq+Fjh gK3sG7LuB4JAlBA7YnVBatOEAeeABCLgaT/3rZ4hU7MvwleiKPgrYlelTwZYVrfVD+Suy5 m4yLhE6w0cI2Xt58z+whmgZXW3CiQBrpluN7bjuP7+AZYHBbp7LuG4FcA5BnLg== 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 CBF18217A5; Thu, 19 May 2022 16:52:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 24JGqeQs060214; Thu, 19 May 2022 16:52:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24JGqexn060213; Thu, 19 May 2022 16:52:40 GMT (envelope-from git) Date: Thu, 19 May 2022 16:52:40 GMT Message-Id: <202205191652.24JGqexn060213@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 2cd662064a0c - main - linux(4): Handle cas failure on ll/sc operations 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2cd662064a0cd8d179cbb5a06378fce0ec458747 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652979161; 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=DDiXIdB6gxRF6udwSE74KnoU8tV4EobmPb83Xbr3/vM=; b=v1eUO4NS5V42G87Cggl+XlUcuZqYK1+Ic2w1fHHFdhAPkq9daKt7qhB8jHPNGNB5dcGG8u sQqnP1viHlxe1TOhadbtcV+ezeysMn7+XFRnooWeJEj5/qKd07PqezHqIju8PrxSO+sfBC fCJYYb/HfX01/PckuUOQj1QEu/fZ6vvvp6MY69xofIrUCFjqi95SynD29CH8aa6BBqXnjf x32Xe4n32bU5M6kEk98vJSwNddgbWqUoqohJc1NMeB/+0oih0I9b4E6OwDWcMW1pY71is7 Kn+nxbigXzlhEIiX2Buac/e1nOVYIxUNaHrxnuI8qDgmZYP8dZCrk6tGiUz+kg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652979161; a=rsa-sha256; cv=none; b=ovLmt0FjHEClSL5SdQu6LTUU8A+5t2tbks9eXpAz65WW5q2/02kFjJVQyHbV99RLxsy74v 2HRGpuB+kOvnFjJwWd7zuw0NhoMZH1GNBUncRdVoe2yUpvASQwrziWA8NV7gkMWov//tnm z3o7Ye4tNv9GHvZPz06e+JdS5l4VEzbNebhcQTzoDw4i16FdMoAuuuuBv5JvMdQsn9RQRD j71vjNqwyUlE6AR7joyUMiZNGXXDMaC1BiL5nRyz8wVNE4rBep/CUbDFKs3jIyIjCHGLyk Nx5+VM54g6tFyY54hYQOTGDEVIh+4/sLDPPJlO5jpsZQ1rBn7IOmlsQ/M09bHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2cd662064a0cd8d179cbb5a06378fce0ec458747 commit 2cd662064a0cd8d179cbb5a06378fce0ec458747 Author: Dmitry Chagin AuthorDate: 2022-05-19 16:52:18 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-19 16:52:18 +0000 linux(4): Handle cas failure on ll/sc operations Follow the 11a6ecd4. Check and handle the case when the ll/sc casu fails even when the compare succeeds. For more details PR/263825, https://reviews.freebsd.org/D35150. Obtained from: Andrew@ MFC after: 2 weeks --- sys/compat/linux/linux_futex.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 6825d13e1aab..8bcdc378cf70 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -410,6 +410,17 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) break; } + /* + * Nobody owns it, but the acquire failed. This can happen + * with ll/sc atomic. + */ + if (owner == 0) { + error = thread_check_susp(td, true); + if (error != 0) + break; + continue; + } + /* * Avoid overwriting a possible error from sleep due * to the pending signal with suspension check result.