From patchwork Tue Apr 16 21:46:19 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: 13632640 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 8515CC4345F for ; Tue, 16 Apr 2024 21:47:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5477B6B0092; Tue, 16 Apr 2024 17:47:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D3946B0093; Tue, 16 Apr 2024 17:47:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34AE16B0095; Tue, 16 Apr 2024 17:47:05 -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 141C16B0092 for ; Tue, 16 Apr 2024 17:47:05 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CFB2AC0BC9 for ; Tue, 16 Apr 2024 21:47:04 +0000 (UTC) X-FDA: 82016730768.22.74B7B9E Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by imf05.hostedemail.com (Postfix) with ESMTP id A03A4100014 for ; Tue, 16 Apr 2024 21:47:02 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lx2b5sxJ; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf05.hostedemail.com: domain of vishal.l.verma@intel.com designates 192.198.163.12 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=1713304022; 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=oUXoh00F3prGsPL55kVpznt7G2PietYpg7kG2hb4B/w=; b=Fss/UawzDNkisMa/6zpE0i83lzT/gLhWgo7RkbuPxWgDPhzJ4RFovIlw2ky8XfSv+T/4f8 Omek9RVksz4qfNLr+fD/MsUESZ8jBmUhDA4xj6CdlRUPYmnCvxO3N/BV++1f3KGJGGq9sg qnDj6+nMt8bZL+fNk/LU6sWuuVsjwuo= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lx2b5sxJ; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf05.hostedemail.com: domain of vishal.l.verma@intel.com designates 192.198.163.12 as permitted sender) smtp.mailfrom=vishal.l.verma@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713304022; a=rsa-sha256; cv=none; b=tcqo/aMCNjwW1vp8/AxGEFZngXFN0MdPeGCC40iHPpfrPYdSAz2n1pj79/0TwbUHdEjaj9 TzTUxQZ/6fQJgQCKd8s/9rNfF3WVAGej/ArqmbPnmhCbtkfJGKV35GATTkiORafDSxoVwy aE+0OzdTlMT/YqImHNgqiYObFCFaoUg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713304023; x=1744840023; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=psiSCf8lZOYgQBeohr4J/sdl0OC+/xsZnCHQ3I57Cyc=; b=lx2b5sxJiVAi0FtUF1rMC5qy2AKsntQGWz/gpQduNu56+fq2dh8GsnvD zzu+xmPLnlQevxw1MJr8r/KYl/I1+eTRsH/GgzIkFX2go4vk6DsL2WvVE 6dmj5UFozHVbIaiOrpLxgzZxBgLlU0T4bIZqjCfn6NZ7zvGxZhMTvrhV+ CMK7ClXuTqXTAYtRYSz5SlMpevx2VbbI73IUQuetYu72jpi5iB61v7UPl 0A4AslwzibEIn1DNwtIrCk/9MRA9AnHvgyuIGidix7Gqg6J0GirHpghJ0 lY5/IpI67yt5nkf4M4u9QEbBLrVf2nVkz5P0IATQRNy3e3vIXOjh1LWCR g==; X-CSE-ConnectionGUID: aMsHdPzrRMCAR5oqZpd2iA== X-CSE-MsgGUID: 2f2JB9knR4+PuWlVIDwpDw== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="12553106" X-IronPort-AV: E=Sophos;i="6.07,207,1708416000"; d="scan'208";a="12553106" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 14:46:42 -0700 X-CSE-ConnectionGUID: 07RsA2yoRfu9UMmVybWr+A== X-CSE-MsgGUID: YivqiNc6SxGhJL2ATRp77A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,207,1708416000"; d="scan'208";a="22464263" Received: from vverma7-desk1.amr.corp.intel.com (HELO [192.168.1.200]) ([10.212.14.216]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 14:46:42 -0700 From: Vishal Verma Date: Tue, 16 Apr 2024 15:46:19 -0600 Subject: [PATCH v2 4/4] dax/bus.c: Use the right locking mode (read vs write) in size_show MIME-Version: 1.0 Message-Id: <20240416-vv-dax_abi_fixes-v2-4-d5f0c8ec162e@intel.com> References: <20240416-vv-dax_abi_fixes-v2-0-d5f0c8ec162e@intel.com> In-Reply-To: <20240416-vv-dax_abi_fixes-v2-0-d5f0c8ec162e@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=980; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=psiSCf8lZOYgQBeohr4J/sdl0OC+/xsZnCHQ3I57Cyc=; b=owGbwMvMwCXGf25diOft7jLG02pJDGlyH/cz7pX0cJ375bC3otT2ot7lH8M3hFf7VJ0Qrb998 9M9TcEDHaUsDGJcDLJiiix/93xkPCa3PZ8nMMERZg4rE8gQBi5OAZiI/DuGP3zLNh9X/5/4Jm55 1eN3wkqiEVnBof/1RB6m3fG4t2fZKhuG/wlvHFblPBLLiJ75/QdXs/WBmVsZJzb/j1u505jhodO NTF4A X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A03A4100014 X-Rspam-User: X-Stat-Signature: iidfbfjwzyyn4uxxdji1fft77bjhjdk5 X-HE-Tag: 1713304022-857814 X-HE-Meta: U2FsdGVkX19/qnBw3HyjV1OgiNnqx6f8/LaKg1LN0faEw4+M3KTSImpKnylyOzk11bp30ENrlAk6QFVgvA+LQaMVuRuXWLvaqjwPVypttDfVqiVR/4g0eU9JtbPsqcHBj2/b0H8CPf/UNJjn7Pza94ojtsnxCtomsAYwYphxlueDoZl1LsEVAhShBek1q/Zgd6swpWZAsKV7tuDTBRdIxA/I903tm+kyqLG6RAaXsjKdS4A0lYzY+gHUOpmPpqTWHCBLKKPtWMWI79O01qB2r7mgnHpbN6eu5KXn6Vfw52wO+s1n67kNZajzZLVYo/ZWxBStqNQfs0mpYxdvb890k+XRJubVk0moFetzAoUBhiyaaD+thnILskpQu6rOn914pIIvPcoMNALhMjvtq4NtsKnDDl+RBHRMIN1pyUB+YzdaNRCnbsfodNXRogTVo6KSOpqxJzP+32MTEqLqKPuTBO6DtQddlLQZvLZg0byBqCsH660aT0pOdiXAs5pxNfik1e9mtbawoz1/JFewBnRb2M1K6T5pCLJjeIiiw9xzW0HRH+v/Scv46LEEQi5uSs2uDJ+NaRWrQbtr5ZEMoCqR5EXybFTXViLqrRU6j5zPs4nzyq4DlxHL29qQhniO1yQIeTCCS55dUyfxK52IOFa2SS6KebFZZ6/kHNW/2BbONvR1EiMhstJLsOHtOIWDoNzoUuBKlEp70egoOH3p4WRy9Gzkp6iX7Y23/tc43mXXiL8RxtZ7Rr7zx3xIyY89NjzloExHxfGyiEfmNWZNtGUixbymn2i7IzopB/VZzsaHTYluHRmpdmRnnRWr/s+cltVoTo7FhXdghgLVYT/r8cDUmONPg/xarzboRhYPCwOtRw6HKXFPG5df+ZOQcv3Aq33lHlxI8FyHoUs= 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. Cc: Dan Williams Fixes: c05ae9d85b47 ("dax/bus.c: replace driver-core lock usage by a local rwsem") Signed-off-by: Vishal Verma Reviewed-by: Dan Williams --- 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 db183eb5ce3a..66095e60a279 100644 --- a/drivers/dax/bus.c +++ b/drivers/dax/bus.c @@ -939,11 +939,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); }