Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp562928rdb; Thu, 8 Feb 2024 14:07:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUz8OQRM/ks1OVwX29EfgdfR381PV0BJVALUF5ur2tbmZxKKD25/DajUveSGroccjE6KtlnCbcmMz88kVOoT8IkVPU5oFisnHhZ1FtHwA== X-Google-Smtp-Source: AGHT+IHQ4tb3aeUV0h6APhtKo5DKx7Jcf+FcyW5D4k2NCPdMmZS3PJ1ZEdqyHKRbrgLVoSt5aYfi X-Received: by 2002:a17:906:2dc5:b0:a38:7ed0:3804 with SMTP id h5-20020a1709062dc500b00a387ed03804mr456511eji.13.1707430047956; Thu, 08 Feb 2024 14:07:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707430047; cv=pass; d=google.com; s=arc-20160816; b=ipXBR9jHz2KU9ZsoQnydQSU5qMezji//dBRu2f2hhU1Ld67LWx1aLIV++Vs46IFRn6 D+wluxzeHR9fqTUUu8nm/NCB+pWPSKe/MsSqzu7GgzSWTscZVT24Wd0QsCmd7I8fn/Ya uxb5abwmTMFvZKb1rtc35Lp3ZQ2TyS9a1dfhhiWj0AjfXMZf210Gqq3QDZX5f60wxW7R gTMoUXc8LUbUZzN40jX7oUc92rDkPsNWMh+11XGiSa6foiT5TR2iH32KM8acKbLd2FX0 UL79gUfO/dwEfF4gPDrYUI1zfj+wQufHJYqKnZbwEHrw9bd1+KnXHwHpkObf9IGem3J3 RJMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=mphb3yOLSSHPwyMYzg23LxuKXYukhEfBuc4PwgY85mw=; fh=kGArS4GeJqsbTGnM/eh37hHtHm3MJTDRNBNK37XC/S4=; b=ASAR2VrQc2PAOt40XzimLWBbVwH1TJiBjdZz+VQRbf2q7i4ZTpy0CWku9Kj7LBMZd+ TO5v/B5+4SnSexa+mLTe5decKtnPnfCjOwpIikfk1f3krwykMirbbKwYToSL4Z+zXKAh dLMrzIuGTMLMkncsENoxWShmMPAsP4971ZNJGXwzO2gJlxTCdXAFHcMrgfQ8xJXh3Yfs 5b0YRwNaA7J6xa/IkKVh4tNuPI0KJFfTc1n/2W1LIjFD+Sf7Yhl3Dz7CPsyBBPRYrUbR 75KozGwlNflEbfVD+Wz7guGiH0+Zj9mt8cdgocAncXAs5tm+5fBZwZRcgA5Z+ZTIOCgk noAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=XSCnIsVi; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-58758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCVQxk2diqxeLLd8NOy14UZSbxUwPo44FrbZ9x1WOnsPiP3Xy2aXRgd99p08Ac137e963z9EKPGiK0J2iSlE3ZbofiNKHYTu38OH8X86JA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dt17-20020a170907729100b00a3bc0abf543si101440ejc.457.2024.02.08.14.07.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 14:07:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58758-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=@efficios.com header.s=smtpout1 header.b=XSCnIsVi; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-58758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.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 A8DEA1F21E30 for ; Thu, 8 Feb 2024 22:07:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B52B4F898; Thu, 8 Feb 2024 22:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="XSCnIsVi" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (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 7A0F54F5EA; Thu, 8 Feb 2024 22:07:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707430032; cv=none; b=hEAdrRDA4SaadUpFVRqU4DDVgbvgxA4pm3g9TNd9t05Wdx65Fm3WV+Tjc38HWAjJunwEG10xYUodmleUrhc2dJjvXD33Mxw5nLzZ8WJHmqwUvO1rrXL84UnDnPbhmydsd+wZw7VBk4oDcsQiusW3+o9pFKAGfkVxCudkrjoqgkE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707430032; c=relaxed/simple; bh=92zdymWBorEcREsjLvytVG2j1+C/vMQZspD2t9Fgjek=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uYuA3pnHtoAztCT2V6bjnhk2eeCuPfbZoGkol7jw3MET/0fEHLvcFXahpD/ihA5Qse8A54n9vbv1jOBsNa1RALCmmakh835eLespf6HVYLZUjKsegZbKuT8R4sNkkpqiCMK7p1Jzezwkx6oSXg7SEoK/esCqGtxqNLOLuHFpqxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=XSCnIsVi; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1707430029; bh=92zdymWBorEcREsjLvytVG2j1+C/vMQZspD2t9Fgjek=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=XSCnIsViF75EWel0lnYbPeaM//N+aw2inHEoC0Gvjx+GA2rcjy1oIRP4XYCUGzWFC +Wfoz/nrUqlXI5gpo4mbukfNJ7C1NZMmt4vVtSlOQ1/5bNmwsHmDuMaKHFF0LCCloU oGxSETGFpggEmINJcnxVxV8tv6KcbXa6RsWUsr22BAvXZASnBA+2fHxz2lu392ilc0 cwLFqsYtT/E5g7HHZ0+VCgDDH5SgevkM1WIjiPNeikO/GsbYH0Hr053lTs+Xs8aQQK Oze/+mF0fwhHTJcab6rQ4x9Tt56F2q9G0H+uVqMGLQGIVgNb3G2I4tkNRVTdqblEao WSJHJVjET15dw== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TWB0s1w3hzXtJ; Thu, 8 Feb 2024 17:07:09 -0500 (EST) Message-ID: <0159001c-6d4a-4aab-a46a-d160673c21e4@efficios.com> Date: Thu, 8 Feb 2024 17:07:15 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 02/12] nvdimm/pmem: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Content-Language: en-US To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Andrew Morton , Linus Torvalds , Vishal Verma , Dave Jiang , Matthew Wilcox , Russell King , linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, dm-devel@lists.linux.dev, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Mikulas Patocka References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> <20240208184913.484340-3-mathieu.desnoyers@efficios.com> <65c5487174fbd_afa4294e7@dwillia2-xfh.jf.intel.com.notmuch> From: Mathieu Desnoyers In-Reply-To: <65c5487174fbd_afa4294e7@dwillia2-xfh.jf.intel.com.notmuch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-02-08 16:32, Dan Williams wrote: > Mathieu Desnoyers wrote: >> In preparation for checking whether the architecture has data cache >> aliasing within alloc_dax(), modify the error handling of nvdimm/pmem >> pmem_attach_disk() to treat alloc_dax() -EOPNOTSUPP failure as non-fatal. >> >> For the transition, consider that alloc_dax() returning NULL is the >> same as returning -EOPNOTSUPP. >> >> Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") >> Signed-off-by: Mathieu Desnoyers >> Cc: Alasdair Kergon >> Cc: Mike Snitzer >> Cc: Mikulas Patocka >> Cc: Andrew Morton >> Cc: Linus Torvalds >> Cc: Dan Williams >> Cc: Vishal Verma >> Cc: Dave Jiang >> Cc: Matthew Wilcox >> Cc: Arnd Bergmann >> Cc: Russell King >> Cc: linux-arch@vger.kernel.org >> Cc: linux-cxl@vger.kernel.org >> Cc: linux-fsdevel@vger.kernel.org >> Cc: linux-mm@kvack.org >> Cc: linux-xfs@vger.kernel.org >> Cc: dm-devel@lists.linux.dev >> Cc: nvdimm@lists.linux.dev >> --- >> drivers/nvdimm/pmem.c | 26 ++++++++++++++------------ >> 1 file changed, 14 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c >> index 9fe358090720..f1d9f5c6dbac 100644 >> --- a/drivers/nvdimm/pmem.c >> +++ b/drivers/nvdimm/pmem.c >> @@ -558,19 +558,21 @@ static int pmem_attach_disk(struct device *dev, >> disk->bb = &pmem->bb; >> >> dax_dev = alloc_dax(pmem, &pmem_dax_ops); >> - if (IS_ERR(dax_dev)) { >> - rc = PTR_ERR(dax_dev); >> - goto out; >> + if (IS_ERR_OR_NULL(dax_dev)) { > > alloc_dax() should never return NULL. I.e. the lead in before this patch > should fix this misunderstanding: > > diff --git a/include/linux/dax.h b/include/linux/dax.h > index b463502b16e1..df2d52b8a245 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -86,11 +86,7 @@ static inline void *dax_holder(struct dax_device *dax_dev) > static inline struct dax_device *alloc_dax(void *private, > const struct dax_operations *ops) > { > - /* > - * Callers should check IS_ENABLED(CONFIG_DAX) to know if this > - * NULL is an error or expected. > - */ > - return NULL; > + return ERR_PTR(-EOPNOTSUPP); > } > static inline void put_dax(struct dax_device *dax_dev) > { > >> + rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; > > Then this ternary can be replaced with just a check of which PTR_ERR() > value is being returned. As you noted, I've introduced this as cleanups in later patches. I don't mind folding these into their respective per-driver commits and moving the alloc_dax() hunk earlier in the series. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com