Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2620159lqp; Mon, 25 Mar 2024 04:48:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVaPb4ugUYcitq9lzNEtM2QjCNtu/7xIKdyEFN3Ahs1xfgb58eUNUNh1MqyrDujrwuxV/hDfs3ec9MpdqreoL4gUrmtDq+NMy3cBlit/g== X-Google-Smtp-Source: AGHT+IEcMGnGpzrkE9j3s2v4zNi+sBS2C/QxJISgLTg2UxYxWB8fMlO8cUJSs1YZSnl9EKP7PBM2 X-Received: by 2002:a17:907:704:b0:a47:8767:671a with SMTP id xb4-20020a170907070400b00a478767671amr2790935ejb.21.1711367336603; Mon, 25 Mar 2024 04:48:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367336; cv=pass; d=google.com; s=arc-20160816; b=tU90fjVqk6tzKm2ZNWcsIdSJUS36duPWH+xdf9rX38Er+fLjiQyeWC+ki13SQOg+d/ /yDXE1M9Dyc9oHprtC6REMxEJqa+K9r6EeOA4V0D/DMDj7vVyiFaJ0kzQUlaJ/4+t68I tLESKvwbp6e09Ba1SP6FVbBXZzpeCCdJW/S0h1wKtFpbUSXs8sYyo52jzTFfSQstbtfy OHqHYcqWkaZamBzlP5bITqtjxhEGL7pQVO3Tauo8Kbh+ybaFSwNC53amBlCOZNop7b7G +h4lLmX1G9ZhW3O7C5HkUQtAaQ/qpnZBL+PrlenmgU5Ry8art1L4igfOIk06EqZLmRar 5PRA== 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=0jpEEF4bPYEw/Srpv3gRMQFnl5yPjoYhlvdwj8Ejl8M=; fh=GjsRmalv6buAprjr+odoa+Mr3tHk6G7oBZhCNYtOYm4=; b=VPSceXCpsUUjCHBhMHiYHUiSzBs+DsRQGp95kR/Vceses6g59g/QgFWQBjwvDxh+ty H4izCfPiQxak0dphPkem8rC3rTZ7HAS2ICJJJ1lZymLs0B6qDyX4SNEE0whCMvvrToV/ Hi/uCH8MXEky70jj8R2QdRmdKwm32gk4KxusMszb1oLGUzFPrbdaIH4g5XlA0508VgLN gtY6xHOj1GmQeRVDhFzbnVjt6zeuGzl0+I1mPokaRQaXvTs2Q9tI4o9kmBe8AG3wVM67 rVbWgGxg7PxZaFQTXTjx2MzQsqs49eehu754+5fm9FSc0fuhCZfAZtSvnVnj6ALKfuq+ jadw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BYBylxH6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116219-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 qk15-20020a1709077f8f00b00a4750a71d49si1512084ejc.931.2024.03.25.04.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116219-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=BYBylxH6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116219-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 567411F36881 for ; Mon, 25 Mar 2024 11:48:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44BCF3BFFA9; Mon, 25 Mar 2024 03:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BYBylxH6" 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 A604517DC34; Sun, 24 Mar 2024 23:44:08 +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=1711323848; cv=none; b=RMwnF8dGbjEtkj7UGyeNI8VpWNsCSFF+fJ/L+OUqHMEBl3eYPB3XFx8BXWRjkWq67rj83zs6fDKQJX/b87t0LIQys/yRxj+3kMJI4mrjXHpKxQZ3pIwEHgvGAtAKPSOeHAa+2MIE4KmR2aogCPGBxF4xlVCWBKnLkJc4Zgc3kdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323848; c=relaxed/simple; bh=bEmazheCTz8C4a9wAgoygLh8+bNOTAl6eMCuva6xg2c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BZScaJ4CcQQ34/L4y44y9tjswQQozoTs1NR5v22NfqVLSIQyfnMyqC27SxbahSm4oVzq65KCpH57DnBKnIEsIcJZRnz2cKg+UDRDj4y6KMoH2AlxwNvxBy5yIGztU5NKluL28VSYjKK1wVAobfTv55s9QGwkv1Y5JXGRiZeaD3s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BYBylxH6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB128C433F1; Sun, 24 Mar 2024 23:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323848; bh=bEmazheCTz8C4a9wAgoygLh8+bNOTAl6eMCuva6xg2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYBylxH68grao0Wbuq324fokRgsEymM9I47MnMQHUVuKO6bvgKD3Omv3iPlWB3aee F+7Rdatw+izeqASdi+t5HbFfRhJgAYR13EMNJ3bQBdWM0YCBjxb0hfNXX4KyvYMsWz peZ5wQOsTp8hTkWtREptQuVlTIagQvyy8XBaCB9NSmt715p8rEavJJ1GaU06Rqn94T /UWz+S5cZ8HevKIWIAKq7KqRpplgNUhBo6pK1spZv/UxnY/DvJAU6sVjw4JV07zc+Z Wdyo3cChY2AFzo5vLthlYbFkP3wtC2kYHVIbWEXWdQtZhB2QdGv5WUFHAeBS1uOY+2 13t7p0Go/N5oA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yewon Choi , Michal Kubiak , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 226/238] rds: introduce acquire/release ordering in acquire/release_in_xmit() Date: Sun, 24 Mar 2024 19:40:14 -0400 Message-ID: <20240324234027.1354210-227-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 65eeb82cb5de5..1923eaa91e939 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