From patchwork Tue Apr 30 17:44:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 13649812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5BC6C4345F for ; Tue, 30 Apr 2024 17:44:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 751816B00C1; Tue, 30 Apr 2024 13:44:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 701EF6B00C2; Tue, 30 Apr 2024 13:44:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A2806B00C3; Tue, 30 Apr 2024 13:44:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 334936B00C1 for ; Tue, 30 Apr 2024 13:44:49 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E111E1209A0 for ; Tue, 30 Apr 2024 17:44:48 +0000 (UTC) X-FDA: 82066923456.26.CA5E267 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by imf01.hostedemail.com (Postfix) with ESMTP id 9363B40011 for ; Tue, 30 Apr 2024 17:44:46 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WOYYwrIp; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf01.hostedemail.com: domain of vishal.l.verma@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714499086; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Y0ZOqA6la1t+7xiNXsenBQ+ezkmiJ5QEwJBTD6ZXZGQ=; b=PPVm1zfRyoc8YK2rUy0RNlGKql1ADj2EqymRMYMbNvL5Nn5JE+FFLF8joz/xUuL957sGEc SRXHojBAKLvWvRScFo7rNWOmrxx02Is/TcRnCEsBuk6LJCNHemqPqPz9P5giZylx9bSkgk 6bNMXxkRtWaF8sV5ZeV7/zguw1/lAno= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WOYYwrIp; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf01.hostedemail.com: domain of vishal.l.verma@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714499086; a=rsa-sha256; cv=none; b=meFeBxjUyeDStR97abNL41PY3e78VYc7b9lPtHA/jpWjpDgJEPCfXMmVsCaeco4vLCkZLa mzAgfOKjHjLgXoWpZ4NBw/1SbiYbZg9Bty2isHf+Ox/EQWjtBDyEdO/hfKKLj34lYnsZ5W fSVvWlCpbtx0ef06g2ppxb/XozUhRWI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714499086; x=1746035086; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=IuUcxmSQ8rmcL+XwprIf4jy7ccGbldFrluNcXl4Pl6A=; b=WOYYwrIpfLPRWs7bgLXxxUVj3CG0prUEQAY4H/OUi0iWV7ruJ6ui8G/+ GgHDyOyYAD1+6Vz30gSi1XTlZy0ELs6WEeQhUoh7pXQLfNCxOwwdBgh5l Aw9V6a4lG6X/cEoZmHt+5KC46JgFrDEr7vFvcL+M3cV/7d5UqIXQpBRTU FG6SGgpH7UI/U/Kx6OeheeRIPmYYQjVAU+WtDoo6M4sSkggwjyFiyxhjy 7Tot/iPYu+TvYFR8v0Pg0bQ2UZQqj/+3hxhwqn/HUtE7u4ggZcLtq4/xp qTLA9ji1lgu0FXnO3EQMwBZfwgAoeGCeI1gscK8dGw+60WhwplXpKgKCm A==; X-CSE-ConnectionGUID: 2WQZyp4FQFqsTb2vYwsQDQ== X-CSE-MsgGUID: R5x/1K3UT1yeHR5Yp/arzg== X-IronPort-AV: E=McAfee;i="6600,9927,11060"; a="27669845" X-IronPort-AV: E=Sophos;i="6.07,242,1708416000"; d="scan'208";a="27669845" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2024 10:44:42 -0700 X-CSE-ConnectionGUID: e1jOA7NYSFqVX4GdYq4k9g== X-CSE-MsgGUID: HKBzb4dvRh+9ecG232yJLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,242,1708416000"; d="scan'208";a="26534783" Received: from vverma7-desk1.amr.corp.intel.com (HELO [192.168.1.200]) ([10.212.82.45]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2024 10:44:42 -0700 From: Vishal Verma Date: Tue, 30 Apr 2024 11:44:26 -0600 Subject: [PATCH v3 4/4] dax/bus.c: Use the right locking mode (read vs write) in size_show MIME-Version: 1.0 Message-Id: <20240430-vv-dax_abi_fixes-v3-4-e3dcd755774c@intel.com> References: <20240430-vv-dax_abi_fixes-v3-0-e3dcd755774c@intel.com> In-Reply-To: <20240430-vv-dax_abi_fixes-v3-0-e3dcd755774c@intel.com> To: Dan Williams , Dave Jiang , Alison Schofield , Andrew Morton Cc: linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Vishal Verma X-Mailer: b4 0.14-dev-5ce50 X-Developer-Signature: v=1; a=openpgp-sha256; l=1034; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=IuUcxmSQ8rmcL+XwprIf4jy7ccGbldFrluNcXl4Pl6A=; b=owGbwMvMwCXGf25diOft7jLG02pJDGmGehzPLNirDG5tiC/7LZaetnFTELtN95cHBgw7/ryc9 GKpxIVfHaUsDGJcDLJiiix/93xkPCa3PZ8nMMERZg4rE8gQBi5OAZhI6GVGhmnLw5Inqtjdb654 fGP3vZdb37fY1maErJRK39AY7XEkwZDhN/vmEtsfceebpW6dcHSsXrDYbv+EV9fymARvlE+rM5b 9zAUA X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Stat-Signature: gz7z796bi81qm6gibnin5uedaqt1umr8 X-Rspamd-Queue-Id: 9363B40011 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1714499086-860388 X-HE-Meta: U2FsdGVkX18PAq87s5oJ0VQ7WqN+kNlT1zellXkcupjERFv8jAW7+eKEDPjOGfNfEfSwijj2grf5nNIy2N7oxIapfN4eHLf8h81UDAfmTVP/lJyIJ8vGrz5o/b0B+n3LrqtA3XIHSQ98ZFcMGBiuXiO24Rxyd3W9pEAsIG+1lqgu/YtnZb424mXKkdKz3n3ut9dxSq6b1tFdtojOji1jcvQENAdMT0oRKejTcrbStumRq3UW1fL43ydY2/CRbBSScvVfQd9M1ylQcOLvU89xw9iJTqemPfeyUMJf7qvgkcYBkOcHcHW5Y+RYZBxKR29Brra4sTaXshD4UZpCtzpZWChyCdG66qkLFjz3RSkAmjDscZXQtral6QDb1hQYSz9X3aj69aNBsoaz2uOJNxopnRtb4lpVlFnAB3aPQFG1vvYh9yoczZbQf4F62VYscGIiVoCd8cdA2VwQ27/RHxHFRizPE4Gz2XHlNI1+wcyDTDhTPCRD8DDXQ+AnLKrS3IgYwzvehKnGtHa0pgygPDuuSO9J0fnHV5AKG53jt2XXgT4LagTobBnzU+82UVimcsl4cAsPRil4XPievrQnNSwvq/vdZGZI+xfu8N/p8etKfPfwPuSZaLK2AhcrupiizN4dyhIAFEJKSy9sxgraiqUYMadIVIgbpOtlZ6oiYqNwDKd3bjApl+nn0D7h7w9GYbLbhIdH+RSyNTwkq1O0d8YuxYUcpBCvXtqATljAjhr5/G56vPcN/P5dB2tthmeVHoEne/3R7Jfibgfi9IotY+hCvGnQybIZ3TARwDF0vXQcqYwtRrRKc3fGEdN5W05yiN9QrX3lxXv7FsrVooUPYt32/DSZ7xY8Gx8+k0z0siW76AvHxvQBefamFyf4MoovggZN0yzYMXwM3lvoBSxleg+LeWI2fOxvzE0FO1zldrEXbDNILmkjYJhtGa/2ceyeeQeyAQ2jGrrFvB0hSNK5M51 vo6Z3Ogv HW/vKLIclY0OKHjoGiPGP6v62fihYE/r5efuxfCIB9g1xw8yQYmoUzEJNEBvQZ9eUPn7F8KtEUH2pORLeN/5CXqMogpb7BjBun/+VhZx3yOLm0O7xfv86Ts7rOm1bcc34oTtMggBAjQMMmi5O/xvBXoen1XD7MC8JwScIMibxKZw6m9OAl9pRMoNCJz4/1WNUEPzWJznGNZN/wW0lgf5XdY5zH4bl4zaR8To66C08dDVj+7jZQ79RR9XovDf/3LLJN0knGqj2ZWyfPn06XiH5lFZyBQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In size_show(), the dax_dev_rwsem only needs a read lock, but was acquiring a write lock. Change it to down_read_interruptible() so it doesn't unnecessarily hold a write lock. Fixes: c05ae9d85b47 ("dax/bus.c: replace driver-core lock usage by a local rwsem") Cc: Dan Williams Reviewed-by: Dan Williams Signed-off-by: Vishal Verma --- drivers/dax/bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c index 0011a6e6a8f2..f24b67c64d5e 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -937,11 +937,11 @@ static ssize_t size_show(struct device *dev, unsigned long long size; int rc; - rc = down_write_killable(&dax_dev_rwsem); + rc = down_read_interruptible(&dax_dev_rwsem); if (rc) return rc; size = dev_dax_size(dev_dax); - up_write(&dax_dev_rwsem); + up_read(&dax_dev_rwsem); return sysfs_emit(buf, "%llu\n", size); }