Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp250823lqb; Tue, 16 Apr 2024 14:47:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUaFqGyqlGXZM92WFVC4jDWeHof0zsDA4DgAlaeE9xGSwUrgykod04umw/yAjty4eG5wb/F5PLabrp8At3elGOwumibwMhzDyPJHuK4AQ== X-Google-Smtp-Source: AGHT+IFA5l9mUK6xoAc1gJAUgIMHkQqYQS0Hq4Yd+w8NTy0YlpPv1VVpZjpdQoRqbqpLVXnK89e4 X-Received: by 2002:a19:8c50:0:b0:516:d0c2:3ff9 with SMTP id i16-20020a198c50000000b00516d0c23ff9mr9581056lfj.67.1713304063261; Tue, 16 Apr 2024 14:47:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713304063; cv=pass; d=google.com; s=arc-20160816; b=gb+y8cXz+Mzz5+mOepa3XMlYkA0Hld2hjjejxTUJjIy+phkE7XLUcu1icjDduCbGSl 5m2scZwVM66Z2MtdFa8uf9B2EG0AmGfEeoNePPPHvYBLzzHPZvigj/dzND0M9wEv04pP x5smRkEXyxGCo/MH6e7Enf8PFamhhG/UFMIxOB9xvK2nhTmDbNjLTH2IdiYi8riUmcxg 8dFcrH7WqEpZI8TVEyzKgc2HJR2Up02tvRWvBJWwcbVa6E9KR5E/y/sdUq5mruCtpEYO tYZ4mDcDDdI+dOQ4SRrTqNPSu2Kzo8QihX54To1moUR5jHlcEzWjpp6Ys9QbfYg/X2Rf Bgog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=oUXoh00F3prGsPL55kVpznt7G2PietYpg7kG2hb4B/w=; fh=ZUwGF2Xiq/7+seiEO5Dgh1kzjZ4PK63EuEROupdVH1s=; b=rdYHBiVf0Iq8/WDTEF66QYXZpfGEOrdyNKp8m8Bh9iYDy7VRytdUqOrjtdgAZ8plRW f+i8mNTbjAtR2PKL8UPytqBpCtyr1eucZTa21mt1yiPkhmgpSV7ybvo0WvtA1Xawq4EE X6hdKJAm0514QCZ0KzZVr/lu/RZmEvAnO5HshmG07vM55mQbTdWK5Je7fOOGjhxx70qO yokjgpAGtj5rO15ih4Yig/D7K863/dfhRnyF5cPU5h3EYisBU2NOpeqaxPAd67A9cctX KEFvIsYrj7e/q2bA4HBtZHKskF5PPvPTnkcyaX5WQJbhKh49ujOXsL6FYxgWei5rXD86 TRHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=k47p6TEH; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-147659-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147659-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qk41-20020a1709077fa900b00a5225bb519fsi6193867ejc.873.2024.04.16.14.47.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 14:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147659-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=@intel.com header.s=Intel header.b=k47p6TEH; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-147659-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147659-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 F2D911F21A6D for ; Tue, 16 Apr 2024 21:47:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BD2A137929; Tue, 16 Apr 2024 21:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k47p6TEH" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 5C8D26EB65; Tue, 16 Apr 2024 21:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713304021; cv=none; b=r0oVheOWAGjwbUIXFM+s1rC+dVUTHW6PUYkwjfHksEYomVuoOI8FIx1DuuhSswhNqpPv6zGMa1NXMNfolBcWQzWdm7QMPKbWBa2RT1aoSX24EikvxQAu5f6ApiNrsjTSPUHk1654FVvZxc4KvaEp2iXcm5FGOEHw/icFJ4SR6G4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713304021; c=relaxed/simple; bh=psiSCf8lZOYgQBeohr4J/sdl0OC+/xsZnCHQ3I57Cyc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qaxA3piF1QW7HB/kM+2XPKImrNB1CBhdq1NrUr8ltljQBMq787be82FBJAgW8PfNMlXLupXE3+zz+svF13wgDgX7KgfncEHXgU7aYJ7DSvQF6DD4Gqacr3ZYOYFfAeJpSCPLSU3CTf+A5jH6StgfxxFDQlFZNg0Qw9tdSvWRORk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=k47p6TEH; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713304021; x=1744840021; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=psiSCf8lZOYgQBeohr4J/sdl0OC+/xsZnCHQ3I57Cyc=; b=k47p6TEHqzWNHO62ye5ZPFga78F/hF3GEZXclYwgMc+fsmMFVzu3Eoe1 0/LUayTv5agz9CzIy8lAaOin/Ki0o/Lw2SkCSx0yitTIKH5pDtjMHPsCn NoTXZi8vq71k3V443+4NvFArK6sztESXpyDNbOeRpmmZgf0T7l6JGUjpE OlvynHFpnzU9IzzjkFQcGw+2hskglvuo+pGIOQntTNas83RT2eXj9ckab irs9xt+b6kf/jbRC894tVoahbDQHlY1X7wz6+ETYARyc3fvRnCyIsybzm rYeJY/3UKC0HK6b9hrEDvmbtfOk7+CQ9GZxK19aBWGIQbXtf7hwpIhTFS Q==; X-CSE-ConnectionGUID: 8G34HNdcR4+IS5eyMlUafw== X-CSE-MsgGUID: JSsMBVkfRlWJkkn5jHpoyA== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="12553103" X-IronPort-AV: E=Sophos;i="6.07,207,1708416000"; d="scan'208";a="12553103" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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 --- 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); } -- 2.44.0