Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2404381lqp; Sun, 24 Mar 2024 18:06:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGYdB3/B/hOwv0+uBD+hXvBEN0lQEo9utjpQmS4RW1w98w31MATb3VY6iaRSYfy+9QLPA0nhvij2mVnYIpbP8AdEE8lLPyPHtYEgomWQ== X-Google-Smtp-Source: AGHT+IGaaQW+rhOVWwtXHklCL0o0RFO7lXed7QNDbRMbM/S8nFBxgSWOEU64/v6vkQooEvnxFyLw X-Received: by 2002:a50:d602:0:b0:56b:6ec6:af2f with SMTP id x2-20020a50d602000000b0056b6ec6af2fmr3880162edi.6.1711328818283; Sun, 24 Mar 2024 18:06:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328818; cv=pass; d=google.com; s=arc-20160816; b=UWQumOjxkJHpxs1h2T0/+WtKsl4O6nPLqOUXPGgDW2/Yg4hvEHjwqnZEqlgvqA55h5 TmIyGsLCxhqhO38wd5vW9+yaU5uHI1f606zUQiPK6DRij6kfsuDuTh6cqVW62WFaQQy1 ifrZhSn2rW9NQx+eKhi2FXNLTdIhRWybq0wkgA0p1KR+FPoST1ZL6elk0m8Y0T+0Tq9i /xG0/C3zldXxekyHyh50MpEyLyP0WgiTAgik3AEnR09EG7s20fsFq8+7kkzvMHU4gGxh +zMgHVqTkPxi952ZX/Zd8HZVFJjjB8ESvAFfunWjbGvOraVokJnjptplRWl8IPLGZX99 ajjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BkJebE8AF7J3fjayDyEtIExumqhhFDKDQ7WYlFyDerM=; fh=GjsRmalv6buAprjr+odoa+Mr3tHk6G7oBZhCNYtOYm4=; b=G7LJe4rbW9RexCAW9NfT0QC+9vnG4Zb44EJ3fRDYWjCgiBUPdhOVSWm++eA+H6zRdd C9p05ZKV5O2f80jIIPxZ8uT+eCCydHQdFdzQZDutXTZ81jTvhI0CvepksJR0IDSIfJPV r80lTzVQF0xFHxmyR/IOKlvidmPybLD14cj+lsed5z93ZtOqWBC8qSiPI7J1rXunuZh3 qLk0YMT5Lv6tRMhNJoPcJ0GtIRQh2T0HQSTkJAF3Rb9Zq+Yd7sztItsNw6/VzMt/CABS JTU7vnlo8C9gQumBCTB0L3qddtIUTCLoJ5s3fSfxsiTzKN4JFOfU762GILJdO2f1t1q3 rkXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTifkS2l; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d28-20020a50f69c000000b0056bf2d148aesi2024197edn.653.2024.03.24.18.06.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BTifkS2l; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B48221F23AEB for ; Mon, 25 Mar 2024 01:06:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5550F74C19; Sun, 24 Mar 2024 22:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BTifkS2l" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 660631C882D; Sun, 24 Mar 2024 22:46:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320377; cv=none; b=XoBZ/bkq6+qNxGvJJYhk4jqOGbsQCsQwqJQ5xF8xTmiAtCNjNpL+Bd9QvVpQEe2mcgr9uGPepTmibM0tDH5F9HKYLetVvKN0nJPjgATG6bMOjR06oIj6mvdLmDNYm/HysohMXXBw8yXbImUaaijMoAcnUiuq4b3NvzTrU+ksopQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320377; c=relaxed/simple; bh=BjRnn2uAci+SuwZsSH8Z6eRxLJRWal9cId1CxlbJEoA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LWcLtilwOMHuJjOwsTEoDV7Ya8Y77YIeA72BPn5RKbPcmRuf3K6aGCNcdf8ow6O2GlMxs8cyfyfFUTQH8pxcgDAR0+2GHX53vYuDXZx6J7BtcDhT1geCxQ8OIwscZPaxdfkmFlTWVp7kcng71IGYUWVF78eqVNJNNShRBlhkT8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BTifkS2l; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EBC9C433C7; Sun, 24 Mar 2024 22:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320377; bh=BjRnn2uAci+SuwZsSH8Z6eRxLJRWal9cId1CxlbJEoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTifkS2lkcE1I+4LThq9kKKqqzDtZFPeQvt/zj3VuneeWylGJhbvHPQcTIAEWN4ZL E0nFE86NgfquASokWFoLdbL2MqGxoePqc5o0CqhoZW+t3bya3O0XzhJ2W1rK+wvzbZ hFLKzcsdnpWhM3soUqb0gur/hx8/3109Be+mJ+nKKcBCmD61gL8vD8eGyjRcuWGYev nZxMsJmMAQchugFozC6FEmSNGm2IuA9pAeGc9AvBnc6+io6quhAu69cDwfeoWJS0Gr CvGEXOSZjpPheBA19kG0ey3l0YblA3p8FFOGB5RIjASeplb8MTQ0mfuTPL06UyQIll +u6qBbdnHU5xg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yewon Choi , Michal Kubiak , Paolo Abeni , Sasha Levin Subject: [PATCH 6.8 683/715] rds: introduce acquire/release ordering in acquire/release_in_xmit() Date: Sun, 24 Mar 2024 18:34:22 -0400 Message-ID: <20240324223455.1342824-684-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Yewon Choi [ Upstream commit 1422f28826d2a0c11e5240b3e951c9e214d8656e ] acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()). Instead, we use clear_bit_unlock/test_and_set_bit_lock() here. Fixes: 0f4b1c7e89e6 ("rds: fix rds_send_xmit() serialization") Fixes: 1f9ecd7eacfd ("RDS: Pass rds_conn_path to rds_send_xmit()") Signed-off-by: Yewon Choi Reviewed-by: Michal Kubiak Link: https://lore.kernel.org/r/ZfQUxnNTO9AJmzwc@libra05 Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/rds/send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/rds/send.c b/net/rds/send.c index 2899def23865f..09a2801106549 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset); static int acquire_in_xmit(struct rds_conn_path *cp) { - return test_and_set_bit(RDS_IN_XMIT, &cp->cp_flags) == 0; + return test_and_set_bit_lock(RDS_IN_XMIT, &cp->cp_flags) == 0; } static void release_in_xmit(struct rds_conn_path *cp) { - clear_bit(RDS_IN_XMIT, &cp->cp_flags); - smp_mb__after_atomic(); + clear_bit_unlock(RDS_IN_XMIT, &cp->cp_flags); /* * We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk -- 2.43.0