From patchwork Thu Feb 8 18:49:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383058dyd; Thu, 8 Feb 2024 10:56:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUT6M/8Mzw1AwxYxeO57cEtakHmiJ1wnJQJQvumBkQ0SsHD69FJIo1BRZXftuoCr9G88wKuFc/LGKkiVhEQ3TLobxibcQ== X-Google-Smtp-Source: AGHT+IHu8AeZYDxvyz5/TrA6ThirviKjXIR1rMlWtnhqImYfwsi2uW9IGQargKT+nupH6K5QALjc X-Received: by 2002:a05:622a:1196:b0:42a:5f8f:adbe with SMTP id m22-20020a05622a119600b0042a5f8fadbemr76007qtk.44.1707418612856; Thu, 08 Feb 2024 10:56:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418612; cv=pass; d=google.com; s=arc-20160816; b=pN86G3cvls7jf7vOQBOXl0tOE7h4Epc+BcItfKB8ky2PjFfUoOkq3X0++YsaTwe0K2 CzhNDtIPedegRaHiFXlznHIK1K9Icv/2Z/0HNQ+Jw1dtKCTXdZBM40OnvmsODx3IhtGQ OafmwUE6iz+2lzw0hB1R08Eti/qKuiAk+oHh23svIkQRnEsNIsIQ3CVd4LAfnl1BH+i2 1UPcw1ARoDIu/2DqQB2yN43/WIkvAX6Iv7RA/SWMnUymBWIjrkaWIlJy15b4ixsiMs4a MtIOKskBkLb8oS+LSLYGmZXVaoB4BJVX9cdvT1M0+cwrm49eJy/Xn3XJUY7XXw8zXrEp VCMw== 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=TzzyzryuMk/YFmmwdL7/ClcZNi7RCUPErKB9A3hzeXw=; fh=doULYj4Zox+f8UzJKsdN1cQY2GYETHKvubywOhFJRlQ=; b=a2Rzc0riDcMOM5gp4YEN3MRi7gj93RZU4HkOb1vdecwx3Mk/SEqK2DG8DyFayJIu8x ziW48MDGrAgbRTK7MVopiSscju3QyRC4lxZ9EffsKHwRueDWh0PA0Mo5yVedDYWW2ABZ dCnZg8E36EM/0fhMXkDe4PnE3Os+Sq0Y3ooL+fCSbJfCrssCl8zwb46J+I2XdyMZUOhW ryO+UFKrQdSVHN5w6aZCCWzqCe4yX8YE0mUsMexWKDFMNHtuMGLKyA4a4o/vrJsm9TLj Zwser9hKhZ8CHnf9hoF29JMATmWKMVOX0VKwRqq5WZgu7z9NbMM1Ds1xyP/UFPvsel0j hyqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=p981bkJM; 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-58566-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58566-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCXNkWV8TZymNxS6M+xNXHrSA9HuZpfjPLJEAuuFdY5Sw6tzWJ1h5elHfJT6zAJjKWkEIDVvd6V6H5HWImeb5qxU4PnEog== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f19-20020a05622a1a1300b0042c4842076dsi93306qtb.76.2024.02.08.10.56.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:56:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58566-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=p981bkJM; 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-58566-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58566-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DB47B1C297A8 for ; Thu, 8 Feb 2024 18:55:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7508F381AC; Thu, 8 Feb 2024 18:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="p981bkJM" 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 B973328DA5; Thu, 8 Feb 2024 18:49:29 +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=1707418172; cv=none; b=KO4omEneIPdvFIJOt/SVrXvHXvKgEQ2VQmuLHrEFfGv0+MkqozkIgcH6FC63Jzzy3AtEz7IKUnIBgVsmACUnx26Fvy+jY4gwkmGzsS0gInJ3A4tELL+cXDPJ1aLTZiumlbFNyqjxAU7d72qJnEpbavEhNHOFz9TGPlV2dZgsRfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418172; c=relaxed/simple; bh=C9trdHKUBo0wvYK5DBzsNfOU9QCkPyPGO5T7CJRyOKU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HGkDwYtwHHN0B91VZnZX8G4iGfX+kwQ0DU20XQNOtnS32p36VKtfdUJS5IdzaLwidYhu+uBmV4gDjN0/vnM29s673Vqm1ILUdGdkOEfCn1hHSqWbZm5UrVau1y3YPC12DbRsyM4C1RCHNYua9Pz5v9fkAXn8g/SJ9ac6KsdczWA= 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=p981bkJM; 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=1707418163; bh=C9trdHKUBo0wvYK5DBzsNfOU9QCkPyPGO5T7CJRyOKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p981bkJMDqSSou5rOlzOfJadbQ5Y29NotpQj8i1nf+2MvVgxD1FBmL+l4Xm7YmzdU pVOSVM/g3dAlLka98d2D7RwQsxmwG0ztt/y7tiwbLnCbBg1xIMfMZO94OwRGQcJSPb oCvXA7vGn5txoQucNNDP9tTcibZl6yUWk91V3wI4h34U+qdeKKwoaP4EMRaCV9XKgF S42nnYMRLuRYjp1ifApVRqANDFYDEM92NpD/EJeqN1d+yPvkJOrTEc6AotGzGZx2U+ 6+NLjtZJNGG8sAZom+Btw0vTtF6/O0vjyrrF0zmTTKf6S58kysA1oIjzBQgjHVR/w7 0MBHTWE0Z4ToQ== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cf5cnczXwf; Thu, 8 Feb 2024 13:49:22 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 01/12] nvdimm/pmem: Fix leak on dax_add_host() failure Date: Thu, 8 Feb 2024 13:49:02 -0500 Message-Id: <20240208184913.484340-2-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358179656062309 X-GMAIL-MSGID: 1790358179656062309 Fix a leak on dax_add_host() error, where "goto out_cleanup_dax" is done before setting pmem->dax_dev, which therefore issues the two following calls on NULL pointers: out_cleanup_dax: kill_dax(pmem->dax_dev); put_dax(pmem->dax_dev); 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 Reviewed-by: Dan Williams --- drivers/nvdimm/pmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 4e8fdcb3f1c8..9fe358090720 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -566,12 +566,11 @@ static int pmem_attach_disk(struct device *dev, set_dax_nomc(dax_dev); if (is_nvdimm_sync(nd_region)) set_dax_synchronous(dax_dev); + pmem->dax_dev = dax_dev; rc = dax_add_host(dax_dev, disk); if (rc) goto out_cleanup_dax; dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); - pmem->dax_dev = dax_dev; - rc = device_add_disk(dev, disk, pmem_attribute_groups); if (rc) goto out_remove_host; From patchwork Thu Feb 8 18:49:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp381883dyd; Thu, 8 Feb 2024 10:54:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHcftY7nN6oGC3Z06u/zcDuswxyk97j8gfCeJqjKez1KzhzpriOgD/r6dF4qdaAc4fsA+cR80ZEuzQ1Q+6TwCW99OkiA== X-Google-Smtp-Source: AGHT+IFF1UOeZ5UsawniqzgSUZjeXdtaQYjASryjQmUgE+RDBJM4Uk+E/dcht4RoJil1JEJZnNTO X-Received: by 2002:a17:906:b7cc:b0:a38:4dc0:22f9 with SMTP id fy12-20020a170906b7cc00b00a384dc022f9mr3519361ejb.4.1707418471012; Thu, 08 Feb 2024 10:54:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418471; cv=pass; d=google.com; s=arc-20160816; b=m1Q68mPiRB5orQST35eiIkeOzTKFLec4OZ15BpFYr+TkJy3nSA6DP9R43JnMjDjj9g y7WORDJzzceRL4CQFAykrLgMzyIF3jGNeyGt6h/muq+9C5hFLhzx/ok8uE6msnKx/z50 YhVk8RLxXPsJRRHDnJZadt4B664J4w9eehuabtZApKjA5IHfj4W12D55XxqgxSgM1fni jvGD8ju+NpfgxJN/0dkH+byG382YvJ3NuArwjTAXp+mFWsPrrHKTYJ6b5Qus1rl25CTX jtP36rwjyZ43QeFMrmCbPrHHtZPeB0j5IKMhGcY3DDyIJHxlvanDr+PR4l8YpqL/b3Yf hlOA== 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=980dRtjhZ1sqASItbAJHswL4sSjsBCZ26JEnu08+RSE=; fh=DI9Qi/74wWLnf1HZySXasQrRy1Pqoj4NbvnN4BTovw8=; b=dzzlAHdPpLh1H12eZLgq1VwlGxGeDnrG0Lwp2VOWfPsqm+tPBo/n1/jRZUQOjC02fU FNxEoOzo0hKYoBkYnyTw3hr9yZQkcGFLIt67MN8DcC1WPnpbfLaq++TWJyUtGlXjqIdp 0EVjbDrh8vvCAuo1wBgMBRQErzmk1XvVTRAFUuSeVNrTNKM6zIrUagwpU9iz5jRXsfa0 vPX+sOoNQXcfIcPB5ODv3tQ/cN1aObUnJkZOItdURO5TQEGrX6emWqxZETZYD2e9n1E9 9hsb36plqIPTP8KiagAK1hrOQvq28knVmCEZECQS3TI5pZRf7XLRKOAPDnjJIgSIauyn 4Ajw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=BHv82fq4; 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-58565-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58565-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCV+eCf8fp/af31WpcWRPfApyMGiO7JVnUWWnbjdx15PnaQCZ6u+QNGc1niMv7/C8iVWxDVOad53eytNqxPxgMWkKULhUg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qq23-20020a17090720d700b00a384794ccb2si297861ejb.24.2024.02.08.10.54.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58565-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=BHv82fq4; 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-58565-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58565-ouuuleilei=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 5BD731F2CE35 for ; Thu, 8 Feb 2024 18:54:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85C813F9E8; Thu, 8 Feb 2024 18:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="BHv82fq4" 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 B9DAF28DA6; Thu, 8 Feb 2024 18:49:29 +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=1707418171; cv=none; b=mCH0TpSlR2b/YxkzZm8gDqfgYGhpMSLqVn5WQB945hgzj1x//GatZ7RlS8lFLrbTq0Qt9PQwoy/ECTTpc+vDc6Ay40KKWwPc6m0vYWSAfkmX93CTJJ2B3Is/r+831aptMmmdrHfWjoSjMOM9KJDBAnWYL+YhuXWkd78QrfQFKQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418171; c=relaxed/simple; bh=NdQ4OmFkV2+G2H8B4VkXTCxDeM+TIHeVIiPEQVlM7R8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dZmE4m25CT0W9UMGSw64YHJX/3T2qVIcCBlNeuWjiGhPGms3traG20FFh+PL0LQ+NxApw6iU2rpKyf2AGf9d5vL4CokvlXkhI7FUSMzjRUNZipf2LaWHf7Qm/bE2A5KeC2ZplE7ya/1HFHWJYP3I6PtjHRCAq/6l0qZKbxM8VJM= 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=BHv82fq4; 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=1707418163; bh=NdQ4OmFkV2+G2H8B4VkXTCxDeM+TIHeVIiPEQVlM7R8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BHv82fq4hO859vusQup+/Ew3E/xkDIrfZ5htPvlriwUnHkvNeARgnnZMiSWHzApqW mBUnp7NhYcFC4sHncmcbqwbZiLufbXuPZ1mmrcc2XRx2OacMg8w1iMcNtrBwOoQ7t8 tlegoMFq/Kcq54d6KDuhbA+a5CHjBM14TYr6oFPdFcRGkfXiGVluKpmPuYTt++FmPu urOv+1cJgX+X7s/GbAlJpQacEjTwJqNEmsDVAUYaXnkKjRNrV7bXs2jN1Ij2VQhEwb /6iWsYm8EPA5tPa8SlmPXLVR3oPElZBuasrhf6GDfTwyLf9CcfdtgsPjHjkxUKokLX dtG+zbC42rI5A== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cg1khXzY5L; Thu, 8 Feb 2024 13:49:23 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 02/12] nvdimm/pmem: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 8 Feb 2024 13:49:03 -0500 Message-Id: <20240208184913.484340-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358031091807852 X-GMAIL-MSGID: 1790358031091807852 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)) { + rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; + if (rc != -EOPNOTSUPP) + goto out; + } else { + set_dax_nocache(dax_dev); + set_dax_nomc(dax_dev); + if (is_nvdimm_sync(nd_region)) + set_dax_synchronous(dax_dev); + pmem->dax_dev = dax_dev; + rc = dax_add_host(dax_dev, disk); + if (rc) + goto out_cleanup_dax; + dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); } - set_dax_nocache(dax_dev); - set_dax_nomc(dax_dev); - if (is_nvdimm_sync(nd_region)) - set_dax_synchronous(dax_dev); - pmem->dax_dev = dax_dev; - rc = dax_add_host(dax_dev, disk); - if (rc) - goto out_cleanup_dax; - dax_write_cache(dax_dev, nvdimm_has_cache(nd_region)); rc = device_add_disk(dev, disk, pmem_attribute_groups); if (rc) goto out_remove_host; From patchwork Thu Feb 8 18:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383071dyd; Thu, 8 Feb 2024 10:56:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWFGIha/zIrMERqm0Hi+dNnnlYd5lAL7cqE5ZvQu6wMjHT/je3CCTyo3T1ag98sQGquDH7enuyEP8kD3GjjUC7TsE8Vrg== X-Google-Smtp-Source: AGHT+IHPTajfzutYIfzkeLxRArH7fGq12O7iNlTengaln8Cd8OvTfaYz0zh2b2NOMherE81iEklF X-Received: by 2002:a25:aa84:0:b0:dc2:5274:fd3a with SMTP id t4-20020a25aa84000000b00dc25274fd3amr412045ybi.23.1707418613960; Thu, 08 Feb 2024 10:56:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418613; cv=pass; d=google.com; s=arc-20160816; b=q755YZOfJ07W2qUqDPg/Lkkb8EB8ibkvCtzPI+xAmEX+y7OxCn2V3HqTuJkLbFQr+v 90+T7PywitmeTcaqbZgLQ5SqfT0Wmz+XnxVI2C+Zk+cdgKuhVHm4NerjoW2kc6YCXxbT gP/bgxN531a6UmuaCkWvnNRH2jZTYlY+E5x3dfKBy20zuiXjCZDm3iqgnzMGdGARWodK oCaB/B16+caRWOtNDj+4QRQH9hmgNdkM96RQVOvSp6OQoVL6cPmXiGtKFgPCafd2YGpx oeRaVXYKNaK7poCqMwBYnNfvGsWIIwQBzPTjxauZmWZPHFYtF/k3eXGA+FIbmcR3lZg1 mOgg== 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=xK83i6t7USeocITc70y4DYr6De00Kwc5YNFwgYpfZGM=; fh=0iAhiuMJia2WHjoOWpniD5VbHjrc87WOmaKwGggWkh0=; b=VES9PNB7SgPuEHYP08O8lRPi6yNaFywyLVCuHONPWmbkBp+ipGPOPiUW3SxUdNlwtB jfJEKLdtoIHa3OvaBw1I7JTjeZl15wQg0NNU0GHZJkT9x48txaYtWrpG21nQm3DQiyOA vCBxu2KPXCIpJEQjO21n/w+kNqiWclUGZLVfdvTtmPW2sLIxOj0CMZYA4sLR9e4gLJQA Oyq5LdQWa308juNkVpFhaFKmhA3FaWXmBSYmNgxrDzrvbSPZ1QU+lPPf59RxTo9h/nwE GQxPA81c1aGdB938+AZBLHCVv06BWVFmJ1mM71z9pom7d/HI61pIi/ARjcJano4aeiY1 CiwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=UblpDhvf; 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-58568-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58568-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCW6D/YSIcqUYFi6DwhvMuePXsakZ2PBvRsMiVgQApvvRLP8MINQZyyaCMv74jyBuGff5FQkrAbrMijQ9onkW6izCwIigw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q1-20020ad45ca1000000b0068c9315e811si172500qvh.90.2024.02.08.10.56.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:56:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58568-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=UblpDhvf; 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-58568-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58568-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 64BD11C29757 for ; Thu, 8 Feb 2024 18:55:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 747562562A; Thu, 8 Feb 2024 18:49:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="UblpDhvf" 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 C03C128DDC; Thu, 8 Feb 2024 18:49:30 +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=1707418173; cv=none; b=L3eNWTaiifm2oAMIUDov/GMe+1Q4X7cKD0n+5Xn2zsvZ21TGt4F+YmtvTEkiDxkn5j09LbOxXiwlF+3mu6DM6USXLqDa+I6HzLiQe1WyXbnKjW7YuBdOApsVihHtj7KUZRCVWTkLbRy1KUoU0akKj/8mUHlFZP6PGl6yFkFhP5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418173; c=relaxed/simple; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ajnIP2axxyb7WQ2hVq+IqlbPRcotQ3GxoTtI9+KjvXTkQ64kuHxmlmMmTimQgYWZ3z44/CwG7kiaE0L7f1S8nO8fa+iYv/9qZR7BntBbi9Lmk5DZOcelmLPJ8nzBFdQp/VwoUIC97tI+bitm6oQHEpNYEuD0RT97SGIh+517BHU= 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=UblpDhvf; 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=1707418164; bh=Cw819/KonN7FOZNMfLR1Ivonx2xW8T4iDPwkWkOj91U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UblpDhvfHANKqJFQHeaHwkIpXUAIYpC9oPLq0TvfWfeRXeTXyN+gn3/3ZipKcpRL4 eL3OcfWoFDAmV1IC2qHFKtps99Jv9WaIB34f3niYgPevHxifDv2iVq2oe1H8HJ7VY+ OXS0FYiaAgd+LT/r4tnoX+2TAAL0JEi+bOVAMyUtknBxHB/5sMW6AKhnI7xTUrvyRe 1esVYyBFR2R+W7fxyIfhFzUjx358IVx4OTM22EMYEIi6AWNv92bRBLshKWZ2Uhecrn LmOjnmnM7mNgo8jd3iGTu7S7JpDScrW0M2MFW/F0ToU0paCORuAOPQK8zLKt+kMQa0 nRRCOKzwzHRQw== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cg4y4VzY5M; Thu, 8 Feb 2024 13:49:23 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 03/12] dm: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 8 Feb 2024 13:49:04 -0500 Message-Id: <20240208184913.484340-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358180395012553 X-GMAIL-MSGID: 1790358180395012553 In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of dm alloc_dev() 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") Suggested-by: Dan Williams 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/md/dm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 23c32cd1f1d8..2fc22cae9089 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2054,6 +2054,7 @@ static void cleanup_mapped_device(struct mapped_device *md) static struct mapped_device *alloc_dev(int minor) { int r, numa_node_id = dm_get_numa_node(); + struct dax_device *dax_dev; struct mapped_device *md; void *old_md; @@ -2122,15 +2123,15 @@ static struct mapped_device *alloc_dev(int minor) md->disk->private_data = md; sprintf(md->disk->disk_name, "dm-%d", minor); - if (IS_ENABLED(CONFIG_FS_DAX)) { - md->dax_dev = alloc_dax(md, &dm_dax_ops); - if (IS_ERR(md->dax_dev)) { - md->dax_dev = NULL; + dax_dev = alloc_dax(md, &dm_dax_ops); + if (IS_ERR_OR_NULL(dax_dev)) { + if (IS_ERR(dax_dev) && PTR_ERR(dax_dev) != -EOPNOTSUPP) goto bad; - } - set_dax_nocache(md->dax_dev); - set_dax_nomc(md->dax_dev); - if (dax_add_host(md->dax_dev, md->disk)) + } else { + set_dax_nocache(dax_dev); + set_dax_nomc(dax_dev); + md->dax_dev = dax_dev; + if (dax_add_host(dax_dev, md->disk)) goto bad; } From patchwork Thu Feb 8 18:49:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383227dyd; Thu, 8 Feb 2024 10:57:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7NQrwsI6lzoCGV3eyq/XNvTIFLfpxsMJDRhjeyuS7ScBFkHkjrdAYEEGYoOUX22Aq0y0l X-Received: by 2002:a05:622a:1014:b0:42a:b2d6:f737 with SMTP id d20-20020a05622a101400b0042ab2d6f737mr90895qte.20.1707418631433; Thu, 08 Feb 2024 10:57:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418631; cv=pass; d=google.com; s=arc-20160816; b=dap+mDW/jV6XCECuHXRFP3t5w4oYSuv+ABXZzjM4DfvElamDgwWFfoy02tF4Y6VzFI mMmSuB9udfvdHSgnnWn4SKveBjySuGbZtoTS/Yt6xGdiRxaI3vlBlepj88S50N+nTl5s iUhgKfba7adifbVNzK1iQfZ63InGB+wYG0US9KQuOJWfjzzQ7oD42/O02l+kEVQ2ayPH jLrEsJ2YuUrx6/cTRveDPbI5C8BFPT7Z2XL6LoL/It8qHyps8tPhMri1OGUdhTn5qmi+ mY/NJ3NmPmkLg6YL3B9xSsDhnEK5fURz4TGilpFL4uZGP1Q9idQsdZSuIho1jnBhoO5D jTGQ== 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=qoFC8C6ZSnf/nETi8dojk/VMfXsfmFrumNn7+RHaPbE=; fh=1CljmrJMHj0PZFDdahWMqTinYgIIbnavnc81wHz0kEQ=; b=rQlDO+bC+8MQbPZqHHULQAnz7tQn2sHsExiJUkUwLM3N7Ms8wHkSghTMRgUXZHPmaZ PMiU9e4flUK22hgIDZvZss87pW1mgn+fZ2rXjHlQO3ODortez6Tdr21/e6B1QlUoRoYa pFRhQI1Pp2tPsk4duWZbEcjF8B6EVZiv1Uf9eZDx/HWaFLEsqlFnseI7pbeJlo9soPwV s7c/ALOyxRbGZo5k7T0fGO38so0I2GZ8UsCfQaxksoAskFxNll+5P9k3sagIvA3dAb9m 2toHbiSmx9uruiYrHWj0ayiAsnylFwI1OShj/7BRvzlqOY30jNXjhtdZziPqAkL7TUaX mpdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rGs7b1kF; 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-58570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58570-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCXHDttV7lj2rC/n4wF0u+7/o8JOwDbK2QIbtNajqHf8DcqLpBquKXuRf8Cp2VxqRT1PKuvJigODqclC38bUuZJ9htRxlQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s6-20020ac85cc6000000b0042c32e1a6fesi57834qta.661.2024.02.08.10.57.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:57:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rGs7b1kF; 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-58570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58570-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 48BEF1C29E4E for ; Thu, 8 Feb 2024 18:55:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A0A44CB50; Thu, 8 Feb 2024 18:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="rGs7b1kF" 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 C1EA728DDF; Thu, 8 Feb 2024 18:49:30 +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=1707418173; cv=none; b=ZvE0PM4M2pmKz/Xmm3QcPIZeLutp+0Mqy/eiBbuLtNwl8+X70Vi+0/9VZsDFS1Gl3d3ebH5cEPK4Hi+iYIuVUrRUzFBnrvEMfm+JI5gzIJDSAfTcAkxYpBYNPF5wlJ/2Hfnsf6J6xtmsiwwHSKYklAoRNwHe76vKj9nrZwzCQD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418173; c=relaxed/simple; bh=NIplNKYnPiSxsRcYozD6/Em7BpOZVdeSTtUJ6fu0NbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VAxCvZ38JipAksLPYMWZ5tqRiu+CW4AEk559GcG+n1Bg6OtCowUkRbWwinEUAFqgZlZcp4ngMBzQyFnhv6vUo4I2/30WVowyba8R1H4PiWUh3heoxVYDaYr0CTGJsDvn2TkF5+wRsEDiAHzMR0cKoGbMsoQwmrauvhO6U5V7C2g= 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=rGs7b1kF; 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=1707418164; bh=NIplNKYnPiSxsRcYozD6/Em7BpOZVdeSTtUJ6fu0NbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGs7b1kFhgfAs3N/uvEWI1LxOdWWwOf5Idgjm+vAqNckZQpPBHfp3mnqwBxXijrHv 5KiC01SlkwbHwbvsekSqj9SSiIfc95BaqD1nYMoY7nP0Mk3CxY2cdTsE6XvAKevwPP vnyZOaqMa+GfTPHHNezRYLo+7hkjmHDL8EOr/Q6EPiSPZ5iRUshHstOAdlIBni2RMp XgXFTCjlqGhkB6UpGo5vnJh10r7UGM3RRHCVc84K8RQBgvZ89az4CSg9N71n0g7y8o mYRgyniqWFk6i7vnViayymIyI1PE+SlxBZ1BUkhtw3NPOY38OlCnjyRF2bYF4Asfiy Y7nc3TPTaQzkA== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5ch0pC3zY9Z; Thu, 8 Feb 2024 13:49:24 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 04/12] dcssblk: Handle alloc_dax() -EOPNOTSUPP failure Date: Thu, 8 Feb 2024 13:49:05 -0500 Message-Id: <20240208184913.484340-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358198880305159 X-GMAIL-MSGID: 1790358198880305159 In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of dcssblk dcssblk_add_store() to handle alloc_dax() -EOPNOTSUPP failures. Considering that s390 is not a data cache aliasing architecture, and considering that DCSSBLK selects DAX, a return value of -EOPNOTSUPP from alloc_dax() should make dcssblk_add_store() fail. 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 Cc: linux-s390@vger.kernel.org --- drivers/s390/block/dcssblk.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 4b7ecd4fd431..a3010849bfed 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -549,6 +549,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char int rc, i, j, num_of_segments; struct dcssblk_dev_info *dev_info; struct segment_info *seg_info, *temp; + struct dax_device *dax_dev; char *local_buf; unsigned long seg_byte_size; @@ -677,13 +678,13 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char if (rc) goto put_dev; - dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); - if (IS_ERR(dev_info->dax_dev)) { - rc = PTR_ERR(dev_info->dax_dev); - dev_info->dax_dev = NULL; + dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); + if (IS_ERR_OR_NULL(dax_dev)) { + rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; goto put_dev; } - set_dax_synchronous(dev_info->dax_dev); + set_dax_synchronous(dax_dev); + dev_info->dax_dev = dax_dev; rc = dax_add_host(dev_info->dax_dev, dev_info->gd); if (rc) goto out_dax; From patchwork Thu Feb 8 18:49:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383779dyd; Thu, 8 Feb 2024 10:58:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVR1Yj1VzMPDl8l/zZvc3uVBxHm84QZmRyTifOlr7cevDadkWKjKp41d9RQUZr7W6Osmf3Umz1WB8PQcz9ed/PP2g0JXQ== X-Google-Smtp-Source: AGHT+IF7r+91L3c1BckP4P9WHktND8z7hvu66rQJ4lFiyAa6i0B6I8Ky9I58Yu/6e9EQCBBICxTt X-Received: by 2002:a05:6214:5287:b0:68c:4ab9:4620 with SMTP id kj7-20020a056214528700b0068c4ab94620mr151125qvb.42.1707418704560; Thu, 08 Feb 2024 10:58:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418704; cv=pass; d=google.com; s=arc-20160816; b=clt7MAwIc6QRzVxZgI1DihVzvXix9mWffCXHMUCuSfEgVzyllwZZhj4Bx2OvTrlN4x /RKzRMzim2AiTq0mtDtFWrMex761YDkqRW1IVTu/rDLbbE1IIHcR4lSVaSMhtLgkEjtg 1m008aQ5SCwGn8TKcAlOVEHiOZsPR0vEmbo2jzkawgM4uTTbIx0w5BEwPAWyFUMMF9In +IQ61+5aymWowge3+b4zAKmFEC/5r5HrQBvnm3ihm0ArkHRPtbLbNDIi0V5urCfZG9cR Y/3+XPkq4rHmP46wdFJHHt1wPSTTcUUOOYvhjQGbh3w4REoqyuc1bSN3pWhZAJ1tW4an nJgw== 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=p09K36qcF8CV8GY17NNSA6slg2+YUMG1wkffTYeeubM=; fh=dtsI76u2uIuJZ0ovK384t6q5DPUoL+VBt/mgCBM1KvY=; b=UyeNFrXhuKLvusSzn9lNWKZarSb3C6aopvJVqKTjyfNN4oXWdOgFdMTF5jIIlaYlS2 RKFMim0x4r633iXUm63znog32WP2zuB9qbokiAXOEloc3lwievsufUEQyv2B2EolETeH VOjkC6+asHTXAM4/HMF4DhDSsMzQksFA1mHPQWGjL1nszfa1i50q456VnQAWQO6LlDwB ek2FYQzutMGiGxUxu8Q/ffkxqV0cXeOzv/moviAHcN4Xbw1GRHLo8PFN+MvpSXh3dNFE 98B06Q6asNsCZ9puJ2tOibkOcmKJt+mJNoFgJtjd44Lhev79GDcUjSch1hgsmdCZVqFs bF4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=G1otBWj1; 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-58575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58575-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCWxjxneEHaaNk+4/zAO8z9+30p6psiCNezTWPguYuhxvdTYaCDwN9eyJl6sjaSF9BCLkyP3sPsufbARWOjLeHJPbFHQsA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u3-20020ad45aa3000000b0068cb1b74b56si143171qvg.596.2024.02.08.10.58.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=G1otBWj1; 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-58575-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58575-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F0A51C2A013 for ; Thu, 8 Feb 2024 18:57:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3858D4F61E; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="G1otBWj1" 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 BF2ED33CE2; Thu, 8 Feb 2024 18:49:32 +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=1707418177; cv=none; b=lZs1+GU+9RR3Zp4ow/aGk89VleBJMwWwNMPw9DnEaJZSJAnFy9TLXkrdDkcX3we5Pk5vZPfrvwxR+tHGv8dea4yGlt+Oma/iNqG3A2PSn8b+eU/OocZvcql+BFUtuHmAvxgJZtB06iEIEKbwGQJAxdWoTO9eB/GgDIUFLxdJi+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418177; c=relaxed/simple; bh=6kaHeiBxh7tXa+wyC1kCcD7MhkDErN5w3UH4NjBdGts=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AqZYheoC5AmwnWlRO6bn35p1sdLWmCsiBSFneJRbZpEyN27OEBvIOgirL2UwemqsYITZ220JoCEotMpYUu+FLSX0aT9XcxuXGCdmPH4em9QOYSSzX42t8wV+NChMh7VmiZ1E6D4dIBWQ1SmreKXaCSzeMYwe3LJ5HQScXqGP4/8= 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=G1otBWj1; 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=1707418164; bh=6kaHeiBxh7tXa+wyC1kCcD7MhkDErN5w3UH4NjBdGts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1otBWj15OtcJQ7enAUe6jy4+Hmw1j+1RwF/HjVZzbrmTo0Xq8YXGs0hrk2qusl1d eijVgRfCPmEmMkGdLStUirsrDOsQmxW/Vfu7q9zBCAFzVJhw85FoIlYd4T1LBmOIGy AJ7zW/g2Rt4d1ND4RQ50x/gK+b6zeCeinDap1WQDbFiItLb5CYncWggvKtcuuQp4fM LLzxPROqJhaQezmxcMN5SI6J2fdnGw88vf+f/UxShR7g5ODOvE8FjXmQHReKIcaIMH 8L15rahH+uIOjMvUoX/ApTNmMuln8Ju+P7uQzH2v/mh1UushfEwCFZqtPgbFAqH9ST vz4YFgZmmOK/A== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5ch438gzY5N; Thu, 8 Feb 2024 13:49:24 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 05/12] virtio: Treat alloc_dax() -EOPNOTSUPP failure as non-fatal Date: Thu, 8 Feb 2024 13:49:06 -0500 Message-Id: <20240208184913.484340-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358275838063637 X-GMAIL-MSGID: 1790358275838063637 In preparation for checking whether the architecture has data cache aliasing within alloc_dax(), modify the error handling of virtio virtio_fs_setup_dax() to treat alloc_dax() -EOPNOTSUPP failure as non-fatal. For the transition, consider that alloc_dax() returning NULL is the same as returning -EOPNOTSUPP. Co-developed-by: Dan Williams Signed-off-by: Dan Williams 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 --- fs/fuse/virtio_fs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 5f1be1da92ce..621b1bca2d55 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "fuse_i.h" @@ -795,8 +796,11 @@ static void virtio_fs_cleanup_dax(void *data) put_dax(dax_dev); } +DEFINE_FREE(cleanup_dax, struct dax_dev *, if (!IS_ERR_OR_NULL(_T)) virtio_fs_cleanup_dax(_T)) + static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) { + struct dax_device *dax_dev __free(cleanup_dax) = NULL; struct virtio_shm_region cache_reg; struct dev_pagemap *pgmap; bool have_cache; @@ -804,6 +808,12 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) if (!IS_ENABLED(CONFIG_FUSE_DAX)) return 0; + dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); + if (IS_ERR_OR_NULL(dax_dev)) { + int rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; + return rc == -EOPNOTSUPP ? 0 : rc; + } + /* Get cache region */ have_cache = virtio_get_shm_region(vdev, &cache_reg, (u8)VIRTIO_FS_SHMCAP_ID_CACHE); @@ -849,10 +859,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len 0x%llx\n", __func__, fs->window_kaddr, cache_reg.addr, cache_reg.len); - fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); - if (IS_ERR(fs->dax_dev)) - return PTR_ERR(fs->dax_dev); - + fs->dax_dev = no_free_ptr(dax_dev); return devm_add_action_or_reset(&vdev->dev, virtio_fs_cleanup_dax, fs->dax_dev); } From patchwork Thu Feb 8 18:49:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp390504dyd; Thu, 8 Feb 2024 11:07:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsRCsAZAVd9fy3lBeR7pHnVirBpI8Cx5vnFzrIMaQ4fbNxa3dNsw4zZiX/nP90t3W5Qy6S X-Received: by 2002:a05:6a20:258e:b0:19c:a96e:a7c0 with SMTP id k14-20020a056a20258e00b0019ca96ea7c0mr712358pzd.9.1707419236508; Thu, 08 Feb 2024 11:07:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707419236; cv=pass; d=google.com; s=arc-20160816; b=tcFUEiTNoUs3ZaoLsw+VhVXvOkBxb8+i/7f8cxCmT7TRa4BhRR4v17iMBuVtRl3nTC e6LS9QC3en8fmIFF5R8e7ZAAIBDnM/DdsRS7Pz58ev1WYqg2+M15F3KFH02MqnGp6vpt anP+ZT1w4vHc+IxBTAkgbnTHhbjqhL2xjyt7gIeh9fQUGwVoPQwliFhJaGHsFFH9yBUF hw2dOV2qkPHpT41bx358kscvl8xCZ1Ls+JDM1bSVoT/T7pgmeImyT1yr870msmmnEvL6 ulw7OvqLUp00oTtWGiWQ4cE36JPkjKhdLtS64nlJTFmn/Xc9O44YONwjAHXVmpIl2Zjw Tl9w== 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=Kwly0G1hIyigNj4R8I+M8crQH2nJcdxecRBcCdsJ/MQ=; fh=wRe1dqrRPQrEJW15xzxKovtsJ/1QwAy1BC0MT8hQTX8=; b=WfShQCZRxPeSTdi5Il3+QIz/6wCJtOAh3nMIjdqVv38ZWmz38Ch0DMcvkGoncRBkjj tTWMNnTbaotLXqcGdIlgS4JorZbIm5eaB8wYdsS49ts/RF6qnNHTuEolKmMmpBXQnrRK buQvio4F27Rmf6O4OCkZzhTlAd1kuRQ3or4y0c/1eOxBHpFAYeFI0h4qL076MvIqUtYy qgEX8t6naY0EwzxOFyDqNTODv3jpQtT8Sh+0MjSsyZHgNus3E54ovE2Dah/9kvHY0Sm6 OfWjbBxu1ZjioPBiQH3vA6NisKH4VKSlvwvIZ3d+xmCEHJM1s6xPlIeHslypCk8KoEik Y5Gw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rs1nJ6zN; 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-58572-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58572-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCWSowu5AfvAMKxhrqSjB6TFM8pq49aZbq3ELZYqiz4L1ousX7s9bNUMm4m2Dz+k9XzcGZV2ev/v4tijLOc7OVRfMsrWXQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id it21-20020a056a00459500b006de169e5800si104418pfb.373.2024.02.08.11.07.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:07:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58572-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rs1nJ6zN; 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-58572-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58572-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E5D08293C91 for ; Thu, 8 Feb 2024 18:56:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5BAE4EB2E; Thu, 8 Feb 2024 18:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="rs1nJ6zN" 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 A8C5233CC2; Thu, 8 Feb 2024 18:49:32 +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=1707418175; cv=none; b=i5fQ0M/z51UKwK0R80E1dUd0KloTJeL8o891GCnqY4JqbOSk5qP/eGXfE7hEacYqeEsILI30OLhLjsW+r/C8j1LX9cSgcXvJQ+NQRUPyc/UCnMg6LHxH9gFx1QcMRLVRcT/tbqGDmOhHyU/CD7qUk69REV13CVhef941gm2wVCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418175; c=relaxed/simple; bh=hDhYMA3F+4l5mMIlcEOrH62nfylV2E9jEwkIfVNtigI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mlnFdM3kWDyYCq51oPNW1tXsOdPALeWSd7zOLIc0NKu57eoWVTiSgLmv0SEfiUQMRjZyp4s+kkHErrJP9+UE6i48/Isi8MEUll6/0uM0b46XiK2SVrXm40agYTRtf3Pc/VTbyRwkWgJeb4Mhs16e8yn45bhyiBhNXFKlrbZRTck= 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=rs1nJ6zN; 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=1707418165; bh=hDhYMA3F+4l5mMIlcEOrH62nfylV2E9jEwkIfVNtigI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rs1nJ6zN3i3/ZnxcqWVfIObvfKgetmRzKD9Xtjm7nBjU1gQXyq40Hbl0vGdpuDu3o 1ChqvqCpB68GsWf1rfPiXH2WI1izSe5AxZNgR4KA6MzUetBSQbo/tVCeXzBSfElY9X xc3j36GRCDUwpBwdU5OlD7I27mG/61ybZ+kJ7jSB1oIBSVNjk4niWIo1iYGy65l9dC Lvj2QNC53f0foG786M7CcQfXzWJiDcvHhZXtuINhQEsbaXYHm9nS5GhJjOkOW+XhzB TjMlasE8RpSnU8253RGAaFCEwDFmIZdtCUrzC2IzCiPp0guGxx7e15ixCGWwaFEOO9 2aK4Mi+ky1GfA== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cj03Z3zY5P; Thu, 8 Feb 2024 13:49:24 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 06/12] dax: Check for data cache aliasing at runtime Date: Thu, 8 Feb 2024 13:49:07 -0500 Message-Id: <20240208184913.484340-7-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358833642556730 X-GMAIL-MSGID: 1790358833642556730 Replace the following fs/Kconfig:FS_DAX dependency: depends on !(ARM || MIPS || SPARC) By a runtime check within alloc_dax(). This runtime check returns ERR_PTR(-EOPNOTSUPP) if the @ops parameter is non-NULL (which means the kernel is using an aliased mapping) on an architecture which has data cache aliasing. Change the return value from NULL to PTR_ERR(-EOPNOTSUPP) for CONFIG_DAX=n for consistency. This is done in preparation for using cpu_dcache_is_aliasing() in a following change which will properly support architectures which detect data cache aliasing at runtime. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers 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 Reviewed-by: Dan Williams --- drivers/dax/super.c | 15 +++++++++++++++ fs/Kconfig | 1 - include/linux/dax.h | 6 +----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 0da9232ea175..ce5bffa86bba 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -319,6 +319,11 @@ EXPORT_SYMBOL_GPL(dax_alive); * that any fault handlers or operations that might have seen * dax_alive(), have completed. Any operations that start after * synchronize_srcu() has run will abort upon seeing !dax_alive(). + * + * Note, because alloc_dax() returns an ERR_PTR() on error, callers + * typically store its result into a local variable in order to check + * the result. Therefore, care must be taken to populate the struct + * device dax_dev field make sure the dax_dev is not leaked. */ void kill_dax(struct dax_device *dax_dev) { @@ -445,6 +450,16 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) dev_t devt; int minor; + /* + * Unavailable on architectures with virtually aliased data caches, + * except for device-dax (NULL operations pointer), which does + * not use aliased mappings from the kernel. + */ + if (ops && (IS_ENABLED(CONFIG_ARM) || + IS_ENABLED(CONFIG_MIPS) || + IS_ENABLED(CONFIG_SPARC))) + return ERR_PTR(-EOPNOTSUPP); + if (WARN_ON_ONCE(ops && !ops->zero_page_range)) return ERR_PTR(-EINVAL); diff --git a/fs/Kconfig b/fs/Kconfig index 42837617a55b..e5efdb3b276b 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -56,7 +56,6 @@ endif # BLOCK config FS_DAX bool "File system based Direct Access (DAX) support" depends on MMU - depends on !(ARM || MIPS || SPARC) depends on ZONE_DEVICE || FS_DAX_LIMITED select FS_IOMAP select DAX 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) { From patchwork Thu Feb 8 18:49:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp391915dyd; Thu, 8 Feb 2024 11:09:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXBHs4X9Gc2OpCdtgzB7XGmkwWbP/6mC1gshw7LvhBYQPkjR+DGoqlEFKP56TyVB14d454tExNECUeEieK+5RW9APy3bQ== X-Google-Smtp-Source: AGHT+IGcpsa5UW/noYUkwiNpLHptBZw5kEKTrIZy3Bk01oGlKfv5+W9gGkqgmh6H89u2wU6DpVKQ X-Received: by 2002:a92:c081:0:b0:363:b14f:a040 with SMTP id h1-20020a92c081000000b00363b14fa040mr519477ile.1.1707419361633; Thu, 08 Feb 2024 11:09:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707419361; cv=pass; d=google.com; s=arc-20160816; b=i/bXxFugV6cTkmQPKoad5onslLLy8E6E7kO6cQ6ufRY6VgQSlSzPeaMPdNDCK3nHaF Tdn6zUuoDhdIKAt2Xd/b7OH/8goTTerZCfRa8qcTbCcIM7mg1xQqwuh+S4tB+goV7hf3 RbJjt/IMyj80SIG264kiL4IxlFOjUvfQDVtnBePGx+v6sVvEupXDHLl/GrqoiDkNsLca xVgqyhZcTuRWzXgFs9MlrlZ7x/cwtWTXnDUgA4cwbGuxVV+M7GUiPfsKa3JqLmei6E7f i6j6MfaWZyH0uhaWz4YpxgVB057clYw+hZUl4jX3RQYigFfnvUVENOJaw0EVm1cn2XQu UNbg== 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=b3aliyJPOObhqkmOR4T6hnfMq2lmmTNJLVfgfu2Sl68=; fh=GowWqAOP9CZzZfooqcSh08LRmOWe/PiMCQ90CQDohcI=; b=e9MiMjr93o0mEB1mjuf5PRAsdSnokJVJD3YEC7DCKw9GB/f/lPuCKcQwqj+JUk99Fv seQ88qYhcsSiho8tkQX4Em++mvx8EZauc34T/JKOUpqg7+g8coxBKGApU/SF1pBhcTTK SUNes4rYoG1cWmbK+7nNn+RgA5UjmsOZiEeDinPnpqWy2l0gMriuKCP+nC60E4XE78wO j+eTw5d0Ua6C+Dyz3F/0SG8ejYMg7m5yVzJdDuT+pu+q4DnYLs/ZlX8xQX+/XAaddSwy XBcC5NEQWkIDbUEgtk8ipUqVGBlKoCC6F76daBLV5+KZXADK9T3BCGpbNWrbpAQR1tqr CflA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="jkdm/qR9"; 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-58573-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58573-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCXpIKjg29ikkoCRGhA03tnEOZ/AdZjGBJgpnE7VsailkDoSV6h8rdjXBlojQfNbo97Ch8sdk0qCdxHpIZIFk1PQ98RRZg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s20-20020a656914000000b005d8bce9b04dsi237849pgq.681.2024.02.08.11.09.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:09:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58573-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="jkdm/qR9"; 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-58573-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58573-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1A320284445 for ; Thu, 8 Feb 2024 18:58:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A92E250A99; Thu, 8 Feb 2024 18:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="jkdm/qR9" 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 0DF0525618; Thu, 8 Feb 2024 18:49:32 +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=1707418177; cv=none; b=rZcMtl6QodM+DY4Lc2W5Onws2U7WDgW+xlHSOHNEo/yz3injIrGzR21SO3j3eLnCyUr6GH99rVFl75IqUsCG2KqejWG1EuXVfoA/Fr1auL8zVTRkkIM6NhMrZ/Oto4MKJggLVAzy2Ab/hjMDR/RCD6dYlO2NeYAS9F37rhXZRbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418177; c=relaxed/simple; bh=yhcYPD4d/Sk8n4rn3QR3NdUtoL+Ae4/2ZbOPQLO15Yg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b6ZoxaUhhr9HT84Tc4Pj8LUQ7fgKq3vSpGUkjltcFJqhvEZQj1/aJDFZknSabH+pfLOuXO83MGdVn9BF4Sbke9V0AWYDl6QEH47OPzSrwmJccwRwSC51upRaFx2t92EBONquOjCUN4szZRsUuPFPRGVnIkZEfk4yQFvfHS/3Qnk= 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=jkdm/qR9; 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=1707418165; bh=yhcYPD4d/Sk8n4rn3QR3NdUtoL+Ae4/2ZbOPQLO15Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jkdm/qR9tPdloQMWsKy+5Z1d0aYHQtoBROVG4bGJmEkyZwYf6dkYO0DcGytMHFuip pMvcaT7M+g6JrZiEyz8lHuNZahF+nsZBUiNCmSvL0uhIqgO1QA0xibp+L8m+eAWiil UjmGp3s/WGGRlMHXDGSHyIDGaiB0e3LGeN9xdY159AmBp8P9lw8F1k2qbJt2Mjd96V rv8mHvj2INaIQKmuVhHbcxF1NMiir4TkGQlSDi49xLk+DNsiGNrcwkrefXwNsusmeW DIu2kttVxsDGoG0iiK4arY46DGoHW0ZGVNfKztcv/LyM5l/Wh7LncTwO4egX7FpruL 9PULzxXL9ej7w== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cj3Dp1zY5Q; Thu, 8 Feb 2024 13:49:25 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 07/12] Introduce cpu_dcache_is_aliasing() across all architectures Date: Thu, 8 Feb 2024 13:49:08 -0500 Message-Id: <20240208184913.484340-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358964258427526 X-GMAIL-MSGID: 1790358964258427526 Introduce a generic way to query whether the data cache is virtually aliased on all architectures. Its purpose is to ensure that subsystems which are incompatible with virtually aliased data caches (e.g. FS_DAX) can reliably query this. For data cache aliasing, there are three scenarios dependending on the architecture. Here is a breakdown based on my understanding: A) The data cache is always aliasing: * arc * csky * m68k (note: shared memory mappings are incoherent ? SHMLBA is missing there.) * sh * parisc B) The data cache aliasing is statically known or depends on querying CPU state at runtime: * arm (cache_is_vivt() || cache_is_vipt_aliasing()) * mips (cpu_has_dc_aliases) * nios2 (NIOS2_DCACHE_SIZE > PAGE_SIZE) * sparc32 (vac_cache_size > PAGE_SIZE) * sparc64 (L1DCACHE_SIZE > PAGE_SIZE) * xtensa (DCACHE_WAY_SIZE > PAGE_SIZE) C) The data cache is never aliasing: * alpha * arm64 (aarch64) * hexagon * loongarch (but with incoherent write buffers, which are disabled since commit d23b7795 ("LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE")) * microblaze * openrisc * powerpc * riscv * s390 * um * x86 Require architectures in A) and B) to select ARCH_HAS_CPU_CACHE_ALIASING and implement "cpu_dcache_is_aliasing()". Architectures in C) don't select ARCH_HAS_CPU_CACHE_ALIASING, and thus cpu_dcache_is_aliasing() simply evaluates to "false". Note that this leaves "cpu_icache_is_aliasing()" to be implemented as future work. This would be useful to gate features like XIP on architectures which have aliasing CPU dcache-icache but not CPU dcache-dcache. Use "cpu_dcache" and "cpu_cache" rather than just "dcache" and "cache" to clarify that we really mean "CPU data cache" and "CPU cache" to eliminate any possible confusion with VFS "dentry cache" and "page cache". Link: https://lore.kernel.org/lkml/20030910210416.GA24258@mail.jlokier.co.uk/ Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers 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 --- arch/arc/Kconfig | 1 + arch/arc/include/asm/cachetype.h | 9 +++++++++ arch/arm/Kconfig | 1 + arch/arm/include/asm/cachetype.h | 2 ++ arch/csky/Kconfig | 1 + arch/csky/include/asm/cachetype.h | 9 +++++++++ arch/m68k/Kconfig | 1 + arch/m68k/include/asm/cachetype.h | 9 +++++++++ arch/mips/Kconfig | 1 + arch/mips/include/asm/cachetype.h | 9 +++++++++ arch/nios2/Kconfig | 1 + arch/nios2/include/asm/cachetype.h | 10 ++++++++++ arch/parisc/Kconfig | 1 + arch/parisc/include/asm/cachetype.h | 9 +++++++++ arch/sh/Kconfig | 1 + arch/sh/include/asm/cachetype.h | 9 +++++++++ arch/sparc/Kconfig | 1 + arch/sparc/include/asm/cachetype.h | 14 ++++++++++++++ arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/cachetype.h | 10 ++++++++++ include/linux/cacheinfo.h | 6 ++++++ mm/Kconfig | 6 ++++++ 22 files changed, 112 insertions(+) create mode 100644 arch/arc/include/asm/cachetype.h create mode 100644 arch/csky/include/asm/cachetype.h create mode 100644 arch/m68k/include/asm/cachetype.h create mode 100644 arch/mips/include/asm/cachetype.h create mode 100644 arch/nios2/include/asm/cachetype.h create mode 100644 arch/parisc/include/asm/cachetype.h create mode 100644 arch/sh/include/asm/cachetype.h create mode 100644 arch/sparc/include/asm/cachetype.h create mode 100644 arch/xtensa/include/asm/cachetype.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 1b0483c51cc1..7d294a3242a4 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -6,6 +6,7 @@ config ARC def_bool y select ARC_TIMERS + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DMA_PREP_COHERENT diff --git a/arch/arc/include/asm/cachetype.h b/arch/arc/include/asm/cachetype.h new file mode 100644 index 000000000000..05fc7ed59712 --- /dev/null +++ b/arch/arc/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_ARC_CACHETYPE_H +#define __ASM_ARC_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f8567e95f98b..cd13b1788973 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -5,6 +5,7 @@ config ARM select ARCH_32BIT_OFF_T select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU diff --git a/arch/arm/include/asm/cachetype.h b/arch/arm/include/asm/cachetype.h index e8c30430be33..b9dbe1d4c8fe 100644 --- a/arch/arm/include/asm/cachetype.h +++ b/arch/arm/include/asm/cachetype.h @@ -20,6 +20,8 @@ extern unsigned int cacheid; #define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING) #define icache_is_pipt() cacheid_is(CACHEID_PIPT) +#define cpu_dcache_is_aliasing() (cache_is_vivt() || cache_is_vipt_aliasing()) + /* * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture * Mask out support which will never be present on newer CPUs. diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index cf2a6fd7dff8..8a91eccf76dc 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -2,6 +2,7 @@ config CSKY def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU diff --git a/arch/csky/include/asm/cachetype.h b/arch/csky/include/asm/cachetype.h new file mode 100644 index 000000000000..98cbe3af662f --- /dev/null +++ b/arch/csky/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_CSKY_CACHETYPE_H +#define __ASM_CSKY_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 4b3e93cac723..a9c3e3de0c6d 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -3,6 +3,7 @@ config M68K bool default y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER diff --git a/arch/m68k/include/asm/cachetype.h b/arch/m68k/include/asm/cachetype.h new file mode 100644 index 000000000000..7fad5d9ab8fe --- /dev/null +++ b/arch/m68k/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_M68K_CACHETYPE_H +#define __ASM_M68K_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 797ae590ebdb..ab1c8bd96666 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -4,6 +4,7 @@ config MIPS default y select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000 select ARCH_HAS_DEBUG_VIRTUAL if !64BIT diff --git a/arch/mips/include/asm/cachetype.h b/arch/mips/include/asm/cachetype.h new file mode 100644 index 000000000000..9f4ba2fe1155 --- /dev/null +++ b/arch/mips/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MIPS_CACHETYPE_H +#define __ASM_MIPS_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() cpu_has_dc_aliases + +#endif diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index d54464021a61..760fb541ecd2 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -2,6 +2,7 @@ config NIOS2 def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE diff --git a/arch/nios2/include/asm/cachetype.h b/arch/nios2/include/asm/cachetype.h new file mode 100644 index 000000000000..eb9c416b8a1c --- /dev/null +++ b/arch/nios2/include/asm/cachetype.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_NIOS2_CACHETYPE_H +#define __ASM_NIOS2_CACHETYPE_H + +#include +#include + +#define cpu_dcache_is_aliasing() (NIOS2_DCACHE_SIZE > PAGE_SIZE) + +#endif diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index d14ccc948a29..0f25c227f74b 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -8,6 +8,7 @@ config PARISC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_SYSCALL_TRACEPOINTS select ARCH_WANT_FRAME_POINTERS + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_ALLOC if PA11 select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_STRICT_KERNEL_RWX diff --git a/arch/parisc/include/asm/cachetype.h b/arch/parisc/include/asm/cachetype.h new file mode 100644 index 000000000000..e0868a1d3c47 --- /dev/null +++ b/arch/parisc/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_PARISC_CACHETYPE_H +#define __ASM_PARISC_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 7500521b2b98..2ad3e29f0ebe 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -2,6 +2,7 @@ config SUPERH def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM && MMU select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) diff --git a/arch/sh/include/asm/cachetype.h b/arch/sh/include/asm/cachetype.h new file mode 100644 index 000000000000..a5fffe536068 --- /dev/null +++ b/arch/sh/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SH_CACHETYPE_H +#define __ASM_SH_CACHETYPE_H + +#include + +#define cpu_dcache_is_aliasing() true + +#endif diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 49849790e66d..5ba627da15d7 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -13,6 +13,7 @@ config 64BIT config SPARC bool default y + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI select ARCH_MIGHT_HAVE_PC_SERIO select DMA_OPS diff --git a/arch/sparc/include/asm/cachetype.h b/arch/sparc/include/asm/cachetype.h new file mode 100644 index 000000000000..caf1c0045892 --- /dev/null +++ b/arch/sparc/include/asm/cachetype.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SPARC_CACHETYPE_H +#define __ASM_SPARC_CACHETYPE_H + +#include + +#ifdef CONFIG_SPARC32 +extern int vac_cache_size; +#define cpu_dcache_is_aliasing() (vac_cache_size > PAGE_SIZE) +#else +#define cpu_dcache_is_aliasing() (L1DCACHE_SIZE > PAGE_SIZE) +#endif + +#endif diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 7d792077e5fd..2dfde54d1a84 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -2,6 +2,7 @@ config XTENSA def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_BINFMT_FLAT if !MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VM_PGTABLE diff --git a/arch/xtensa/include/asm/cachetype.h b/arch/xtensa/include/asm/cachetype.h new file mode 100644 index 000000000000..51bd49e2a1c5 --- /dev/null +++ b/arch/xtensa/include/asm/cachetype.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_XTENSA_CACHETYPE_H +#define __ASM_XTENSA_CACHETYPE_H + +#include +#include + +#define cpu_dcache_is_aliasing() (DCACHE_WAY_SIZE > PAGE_SIZE) + +#endif diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index d504eb4b49ab..2cb15fe4fe12 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -138,4 +138,10 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level) #define use_arch_cache_info() (false) #endif +#ifndef CONFIG_ARCH_HAS_CPU_CACHE_ALIASING +#define cpu_dcache_is_aliasing() false +#else +#include +#endif + #endif /* _LINUX_CACHEINFO_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 57cd378c73d6..db09c9ad15c9 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1016,6 +1016,12 @@ config IDLE_PAGE_TRACKING See Documentation/admin-guide/mm/idle_page_tracking.rst for more details. +# Architectures which implement cpu_dcache_is_aliasing() to query +# whether the data caches are aliased (VIVT or VIPT with dcache +# aliasing) need to select this. +config ARCH_HAS_CPU_CACHE_ALIASING + bool + config ARCH_HAS_CACHE_LINE_SIZE bool From patchwork Thu Feb 8 18:49:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383904dyd; Thu, 8 Feb 2024 10:58:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuIzcHlmHGwBFAZSIW9OQdkrok74tYWncGvnjJdhNIRKjC1cSOuFQNLVGPMmMlAmdyjxuQ X-Received: by 2002:a05:620a:444f:b0:785:469c:3fd7 with SMTP id w15-20020a05620a444f00b00785469c3fd7mr668308qkp.28.1707418719517; Thu, 08 Feb 2024 10:58:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418719; cv=pass; d=google.com; s=arc-20160816; b=Z9inRCMrnu9xoUbTSaofRzM4g8gX0FojJhi/w8pMJSRJXS2/FTG111ck6gI8I6bkge nVJdiUXyxC2nrtR2zatX05T38ycoMs0cRz0CYAO8G8qTPA+4NE3lRzLbX9c/sd7uuP0g //VoTDz8HF2WV98pSLNnSiNPGE0oIgS64EzmPeWn3vus/xQVd85rje+Y2vqeTMOSxuIG 1Efi9CbkNUQQB6EtvSFG3+9GDMphLxVNUMyNsgZ91jXXq/L8m2jgJ/6NjqmbxCsTHzny vTA6TKXCgKYtW1Q3H1lNcszIv0KwuIgkq7qV2lkV/NU6P3GI2lU8E1RDLlmE9Vrd8/2X yrYg== 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=8wpHKT9Hi7IbUfkZ2WanEEBa5TZxfFZsQCKHq9VYM5A=; fh=0mhm6Npy36iqc/lBwHk9HfqjvNpKtgBWPgvGQFPJSGA=; b=bfHytIF8l0R0GckFK0A2v/3XXKHygDQmxSDaEoqzQvFt9ukFPy409rf9MWnfPPXJEc pCfzQxxIrk/HDilGheg9lX9REwFAvURewYhUj9RSS9twR0kFil+y4rBeEZ1f4O4aOgF/ 6kBi6pIi18fCyng+Sc2JoF2FOOHtN7VOcw5YUIDvFHqunGgDavQru17iUj6jGlV+dpBt IAjtkvFeSlnGT6ZSOBgYeSSO+viuAqxMyXhUGui25EnWerG6OevpP3cd9tKAjPUHgKh9 i08BnjoCw77zF4gQlnQYqk37OF/81WblLjc11l3KBodLu+nQZKRWN2IR85P0hYWu9WEx BxSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=G+MCYgcI; 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-58580-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58580-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCUBAk0EsUinHE4sUCOa2AJd7HrQSEbkQFATq4W8/J8iQhRrq1Bd7hzFasDAdKCKgS89nD5a7KC0uY80vT+lvT8I3jZIUA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x3-20020a05620a0ec300b00785af73612fsi207181qkm.177.2024.02.08.10.58.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:58:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58580-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=G+MCYgcI; 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-58580-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58580-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0AE711C2A361 for ; Thu, 8 Feb 2024 18:57:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C334650246; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="G+MCYgcI" 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 0F50C33CE9; Thu, 8 Feb 2024 18:49:32 +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=1707418179; cv=none; b=SwbhNGyxxob/ADKUEBQnGsdXipgXoGdUhZdjlI7qNy9D01pCA6zkS0j+gCqGfSxCMuPgKxYqF9IRVmOyw4Z/IcZIlCst3owSvrPXU7IcL2+zdGY7QdMKopkYLfFc3iQT3OUWi1zC5mOKwcWXyDkzFJ7edyKVsb4Gi8/PiAbNBpQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418179; c=relaxed/simple; bh=MgteUY0CjaNYCNu4ZJjdjfbOYQwaLS6hDEa6C2rXhOI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jCrT4niRoU+qDFCXIo42C1QZUNfB4boAaInk6EZZ+3Kd+LTLGs9stTK37nZvG7s8YWxtD3CeLhqPU7b/wOZvRoSLDeyK1mQ8LQgg85paCFTGou99+jK5HIqgCQX9bOz7jf98eVKcuAxQAi5n4xIA/SKjWc6mAtCNNUdta5YvcIY= 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=G+MCYgcI; 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=1707418166; bh=MgteUY0CjaNYCNu4ZJjdjfbOYQwaLS6hDEa6C2rXhOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+MCYgcI7iOhUtOG80uDYEEj9WDUFtjZj9v5kigEOVyg1Gl0p5tefCTOJimzq7BIl Bntq03Tcm/N+e6ObNbaOTegq2ADAQ6pQAwKRVSja1uTLw5yeNuWK/hvvwPRF7XXbX/ M6nZvFFxMKHg5SQuBdBtw17hxlxVb8oD+kSkJNaegeMMMlHzHo5f/VuV5nAyz64Pyw A0gPrGc0Vnc/Vms7OHuOkBj+zaxkVYidiXOcY2aohU+UyZ2+NFyxkSnkI7UeA2jGpn EkUAuevUw1ZVowe9kZH+93MAkvXFLN/9+SJBI+P9oBDLUkZMEhunrIKZMVOfThz2S7 T2GUX150wzk3A== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cj6MmwzY5R; Thu, 8 Feb 2024 13:49:25 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 08/12] dax: Fix incorrect list of data cache aliasing architectures Date: Thu, 8 Feb 2024 13:49:09 -0500 Message-Id: <20240208184913.484340-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358291287621337 X-GMAIL-MSGID: 1790358291287621337 commit d92576f1167c ("dax: does not work correctly with virtual aliasing caches") prevents DAX from building on architectures with virtually aliased dcache with: depends on !(ARM || MIPS || SPARC) This check is too broad (e.g. recent ARMv7 don't have virtually aliased dcaches), and also misses many other architectures with virtually aliased data cache. This is a regression introduced in the v4.0 Linux kernel where the dax mount option is removed for 32-bit ARMv7 boards which have no data cache aliasing, and therefore should work fine with FS_DAX. This was turned into the following check in alloc_dax() by a preparatory change: if (ops && (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_MIPS) || IS_ENABLED(CONFIG_SPARC))) return NULL; Use cpu_dcache_is_aliasing() instead to figure out whether the environment has aliasing data caches. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers 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 Reviewed-by: Dan Williams --- drivers/dax/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index ce5bffa86bba..a21a7c262382 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "dax-private.h" /** @@ -455,9 +456,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) * except for device-dax (NULL operations pointer), which does * not use aliased mappings from the kernel. */ - if (ops && (IS_ENABLED(CONFIG_ARM) || - IS_ENABLED(CONFIG_MIPS) || - IS_ENABLED(CONFIG_SPARC))) + if (ops && cpu_dcache_is_aliasing()) return ERR_PTR(-EOPNOTSUPP); if (WARN_ON_ONCE(ops && !ops->zero_page_range)) From patchwork Thu Feb 8 18:49:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp391379dyd; Thu, 8 Feb 2024 11:08:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVDQdrQqOFvnNjqvJtn0aRQfffn5xQXEMil+ONHZnJ000V/+PsUgIcz9cf/uLBVf90kDofSVHvlS1riqtxFdJ0unmKKaQ== X-Google-Smtp-Source: AGHT+IESFk+5wRTFwYoAl7UvnT88JV2iZd+5kcbPPTDWmKkLa0pMS7skF7IW+kWRR1FFPBzBII72 X-Received: by 2002:a92:db4f:0:b0:363:bc92:e4f with SMTP id w15-20020a92db4f000000b00363bc920e4fmr599007ilq.23.1707419316409; Thu, 08 Feb 2024 11:08:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707419316; cv=pass; d=google.com; s=arc-20160816; b=LggLRse4vdwwOab5VAbYrViSRzEFAuEVR/9odWriP/2Ha1MZJpK98JbAtX6ABx0A0m ruXCoiTk1R1xDf1cJLYnEJHQXUJ4o/p0xPtSs2vYrqWdTbylFGZ7Fmkjlm2wTUHd/99K BnJXlFF5tWxP6WDteYs9/L7HeRyb9HzRRMZRthxZqJy4s/EBfqiGgSt6+zfz3+iMczJm Q0gw0phKz6XLEzG0fY2I1CJJsdTEb8zyF0MBjlwcjMvN4GRVnEmdu84XUPwc+MtHKk7O SY3saFrOfiRCaHuwU8x/DOqTH3+wUcGeRUYcx7l+96NS0tBgV0wrQDHp48D85Eow/pdz BNRA== 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=l2wRmrDvqQckE3o82F7VoUp3GeHgriJVil7x/mcQt2I=; fh=74omjQE4L9culWlI1CoKTUZ5x+EdSe1Do7SZBuQubzY=; b=WmxbEkx5SMwr4bUzez79aXvCkcSn6jBl0gC9dJOpoHZn3q0K+KZwtJhZTliVWNAPmz P9trmJvo5LtQBK4hAWWAI7gL6OODN6K65gfBctdcCjnHvI7FyOuhQVXSTeWlG9WiDusb Gf7lxVyeRuhgvyBViLrcN6mpvKXf8id7V+YMfLrqLWui8as8iGgmqk84laDQnt1HCSsu YcP/PgFsE/vW1y9fDUV+SCZZny966x0CvjP1NpvOVyWLd1suP2JGlWFw+MIyjfaCxhxD SxdwPrEwgPfVQ1yZJ2WBVz7X34pE1YMZqxGhAhqLn6dIIa0krSLp3rkoNzziKRP4CTsX swoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="vtjc7/2f"; 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-58576-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58576-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCXQl88PEEaUn/XhXHg/2x54d3Zu0Zzmp5GBIkprsgKgxDR4+oQRCPQvSis+dLidF4kNpr2YHtRkXTqjzfMaqqQzHiZhaw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k63-20020a638442000000b005d92a3f1196si217650pgd.592.2024.02.08.11.08.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:08:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58576-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="vtjc7/2f"; 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-58576-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58576-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1365C2946D5 for ; Thu, 8 Feb 2024 18:57:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 981D94F8BA; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="vtjc7/2f" 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 982E12D05C; Thu, 8 Feb 2024 18:49:34 +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=1707418178; cv=none; b=QGtleAqVWcg0gAbLqcPq+4T9SRccImk359ZvZML/R0Q2KBoze2CtzahaVSEDLag2bwnaeriEB8mo9lXdRZp7H8DxlDEMWLxl+ydeUdEfjjpV4mT18KxmUFuPS+3LRZ3jbHa0oySeHX6MIyxM+b12Jhaxgo9CBr2FnG6ARC33Dsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418178; c=relaxed/simple; bh=Iy1T66BEIuPj6bTS95Nd9D5h8aE2OAfCM3Sw4sgOgjA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X1HpXTUmKAo2jjd9LTR5UF3bnMKZNEzQ0Dz4i6nFJGdgF5wj39sXESUmG6zL4pc5JhWr1twe6jjSCHZtO8nojMENTVmUC3e39JyYPo8+byqMMGFopxs5aARsqf4Uc5+PL4XQLz9Q8udqFqzwsQfTwc/1lUO7oDUQa/JmdTnGWSE= 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=vtjc7/2f; 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=1707418166; bh=Iy1T66BEIuPj6bTS95Nd9D5h8aE2OAfCM3Sw4sgOgjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vtjc7/2fYgtbG9L3HmHuiZ0hGJa5dwKDXt/n16lAht+M2tw/jI1e25yKjrmZukvCz /CX1mCneF7UyCbUOI4h3G4fdzzSb+li471Gx6ba8eevnycoFnHMSk9/h7wbWMnbYvz 6nZtKBy7/E8bqAxj2lbFepGPrzFubBQ+wr2SChDD6HS2Wn+qRldp0qwKKSKFtnBJIU OLFpBjTdvJMQftoRrtnmWegJrS0zZtCdd9sUdS3eoFkCZdZGdSYOE7mkXPbWW5GCXd tkUbHVYezf/E/8BNNB/B1FE4KQJPivjjt8+FxxLo9L9C6/i/PG/zlxN+sluj3adEJD E0pl1Ko8zJjwg== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5ck2DcczY2L; Thu, 8 Feb 2024 13:49:26 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 09/12] nvdimm/pmem: Cleanup alloc_dax() error handling Date: Thu, 8 Feb 2024 13:49:10 -0500 Message-Id: <20240208184913.484340-10-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358916932607447 X-GMAIL-MSGID: 1790358916932607447 Now that alloc_dax() returns ERR_PTR(-EOPNOTSUPP) rather than NULL, the callers do not have to handle NULL return values anymore. 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index f1d9f5c6dbac..e9898457a7bd 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -558,8 +558,8 @@ static int pmem_attach_disk(struct device *dev, disk->bb = &pmem->bb; dax_dev = alloc_dax(pmem, &pmem_dax_ops); - if (IS_ERR_OR_NULL(dax_dev)) { - rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; + if (IS_ERR(dax_dev)) { + rc = PTR_ERR(dax_dev); if (rc != -EOPNOTSUPP) goto out; } else { From patchwork Thu Feb 8 18:49:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383912dyd; Thu, 8 Feb 2024 10:58:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUv31DCvaSorbdTjC0YMM4PCcIXlHemYkp32fuiBZC6/oRcyTYtyC+DTVYz453zvTGvTigAC86HCtd8mG4gyjjiJZOGcg== X-Google-Smtp-Source: AGHT+IGFypVrk/cj8GySpp46lq0zVEKCC1NPpZRopzfY8FRIm1LW0fPO745n4fMbSXyCJA/BLXXM X-Received: by 2002:a25:bfc5:0:b0:dc6:83c:dce7 with SMTP id q5-20020a25bfc5000000b00dc6083cdce7mr364404ybm.38.1707418719919; Thu, 08 Feb 2024 10:58:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418719; cv=pass; d=google.com; s=arc-20160816; b=k/xuRAk2NU8SbES1Ewnk9qB9T5+gzKR1dgSESZ6Qzbs+pXAfFlcRsA2N1gUAXRERUm tyCrHSWvLjvZGbGWuvP0YQ+0dhKCLGCMs46PpPcSmqwUtg4JJejLkt9BqwILDyF8qy9A p2VeBYe5h7w5s+u4BAR/KCTgQwElSQ67BkGgNx59doSKCMzDWGsBS3mhCFrxwWjezS8M c38GiW7hXFfGyxn8Fem4f4xOwO/jYOxX6RF25cGdvy4zQk5Kpsz7Udt2mf0IcJcqcrQJ +1jK0OvsGF1Mk0Q9o5hl/mpYLrCg81BauzmvuzQcuwg3S2rXFiS6ogUHs4kRjyQSuCwz EzOw== 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=M/l3w5J0gRKX2dpYvmIz6vr4xoT8EtwTyWYFokXaqsQ=; fh=h6XsCQQzXdMo+Ne3qiMK5fLDFsLt3USFXs5HLXwTxYM=; b=vL6wNoM8OemA9+qL0QD7q7MTkvGxcCHp1YleWZoTCgiZxUfByEGJCHB71gWGTITYWo 3CuQW05bbRL10AJXIRGEngTfhq+G97COz2FefQjeJTtK22MTwhmNTj8dUavg5CmpERpV H6idNcTgn12S/PmJt9a96CkbiUsNMD1yRveKPgfQQrvF0eSvzXrkx/sGnLhIWQ1GLep1 gwqAYK4RvFMRv77/BcJeZ+uJavICNtLf/SxYrXPc7lHbQIRWYS8qkA63qB5NN6AVbxan PCWbN+upVOSIUCBmXK1FS732XzOPfgLM3liqbNwU/sZQfjfHezg40TtmMFPw2wnh4C6p HH9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=TAhR2aeh; 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-58579-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58579-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCUJp+45bkUMxgXpweo/3wjY7lnrkCIuPEX3dMQOYr9ukqfz3tyAHoDoWp81zKDZ9A1/80Xmogr3/yxqaTto1VbwVuY+CA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p21-20020a05620a113500b007831ed5564fsi205177qkk.321.2024.02.08.10.58.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:58:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58579-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=TAhR2aeh; 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-58579-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58579-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 78A551C2A379 for ; Thu, 8 Feb 2024 18:57:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2DAD4F8BE; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="TAhR2aeh" 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 9829625634; Thu, 8 Feb 2024 18:49:34 +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=1707418178; cv=none; b=Ek5xibD5ebuoaITrFAhKuU1azeoOi5TEcx6IlytFjXMbgofs5IkklisuPA6UJR25utJ2LFHKM539yvKZrrgELWQ1OAd6mhWyb+1n7NXZqhJeLLQyOkMvt6ALCn80Po4W/aEe8cuDqmFi/xvO0etuEYA6L/4mgjMjraC391mdoGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418178; c=relaxed/simple; bh=3qwtk0TzM3yqkpdWTkMn8G1D7Yvm6JJDP82nQNcfpzk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EdHb3WzvT7aVq+5nmlb7miLkhblJvZib0QY1ssaDyvLWy7WeQD+RvH1oaVR1hONV57+QXNP3P0+6S9vRcg4f6J7+Rrzc4geuprWleqWo27mmw9s0IpP2sg85QI0jM+LIN6F6Bpd8roO2j7jhHTwXMWZTvzaKm8CUvRYkC6/skT4= 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=TAhR2aeh; 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=1707418167; bh=3qwtk0TzM3yqkpdWTkMn8G1D7Yvm6JJDP82nQNcfpzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TAhR2aehSVIy+7kxOHR6NVnmGYlp9kd5ycnTSBAI6hceetyhQOWUUfcm/nFiep+a1 kEkco0j8ZB4aI7AGUsK7I6wOE9xdzR/fBQB/pGe+tbFE1K6mzmAeXB5d7S7zA0bRWj ip3Ju2dZR0HVfK7H2Y2FckrBH/MiPVeZX1zh4NiDcc1BLONE3/lFUOu67rYwA1XBw6 zqyIy2GXXYMOivh7iSp4mwMGUu1002g4dcG4icNksUO16LHayffi2x7O5HtglehPmp B5lutv1FF5uLG4qLTgKWQTdXfMpywAxesrzwZXGsCyTz/972b+6tAcEMA0N6RREPQK fjRsnlrFyE3ww== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5ck5SmGzY2M; Thu, 8 Feb 2024 13:49:26 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 10/12] dm: Cleanup alloc_dax() error handling Date: Thu, 8 Feb 2024 13:49:11 -0500 Message-Id: <20240208184913.484340-11-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358291573630160 X-GMAIL-MSGID: 1790358291573630160 Now that alloc_dax() returns ERR_PTR(-EOPNOTSUPP) rather than NULL, the callers do not have to handle NULL return values anymore. 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/md/dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 2fc22cae9089..acdc00bc05be 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2124,8 +2124,8 @@ static struct mapped_device *alloc_dev(int minor) sprintf(md->disk->disk_name, "dm-%d", minor); dax_dev = alloc_dax(md, &dm_dax_ops); - if (IS_ERR_OR_NULL(dax_dev)) { - if (IS_ERR(dax_dev) && PTR_ERR(dax_dev) != -EOPNOTSUPP) + if (IS_ERR(dax_dev)) { + if (PTR_ERR(dax_dev) != -EOPNOTSUPP) goto bad; } else { set_dax_nocache(dax_dev); From patchwork Thu Feb 8 18:49:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383921dyd; Thu, 8 Feb 2024 10:58:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGYaVuhpd2X8s9zHNshEfBtrbxSwPhKDZaG6rRW+K7VbG6Rl1idkbg9m6Mah7CnfO2IbS7 X-Received: by 2002:ac8:70da:0:b0:42a:4889:b12 with SMTP id g26-20020ac870da000000b0042a48890b12mr57213qtp.33.1707418720558; Thu, 08 Feb 2024 10:58:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418720; cv=pass; d=google.com; s=arc-20160816; b=ZYp+5J4tcZUIedpSdw4m6aio2SBAldYjDtTG6URtfjeryl6ZG/Wb5MDs6zleUwj23C rVMuLOHnRhx8/bwlHAzH5uiVQxKOi4nFUlo015lu2GEG3zP/QNwRxLjCTzy4n1qDtGs3 vZlNfJ954JUXx4YTPUr5++AfHAmFTpSfKEpCEL8GmigabZXjddmA2MfgG1ULxhz0t8J8 e7RSYT0JgTPvQF2vTDEItYytVtyVaZuqaz7wGe359nVGgGQXRq/cn0l3JBlHUglvsZzn 4U5RYvIUbmzc12H8iVwFIb+w/poaircHgWBdPlJeHlgJvEY1bWGWfLQojenI8OS6RtDF J9ow== 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=86cxj+xCR2VKZSzMElfFRPicz5DfDFyVUExhe2tu2h0=; fh=T9vw4zfB+b/B9CphNZuEFWCyAru8Jf1u4sPJRg7knK0=; b=C2Mg+4mFz2SgMInRLX4qjNHpUQTySgX/18PPkvOHHwZfR7ZT7t40y1f5Rspcn3266I Z/4CuDTZJ6Y8kwuyR1xneMLa+DS+cYYJ1FZPVGS2UAdy26RbDxC7W9vGqwz2Z3wCSPrE ozkVN6Ejjt09YO788fbSaFRp+Wi6PiC2p1Hf3g5mgvhilbBYH2VzzefjMydRZsEw+gOJ mph5edTYcBsjMl+KjGjokuNyn/PYopXjlnbcXw4sGjv4tqNGk9vHkc135m40hGct6rOp JIcn3i+RWqHyq6vYSrl8D9KFYjWjVgX7UaFreDLVJucHndMczrJ+qA0wk6hDBuPDkO4r v8cA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="bRoE/7ia"; 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-58581-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58581-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCWt2900zQCtbieNkiSoeFh7r8tDje5MreGPZLhkZ4nNqdKhC92BwSSQvmGsA5fWHF3mowSlmx2+M96rwUJa4r+0ScwTxA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o6-20020a05622a138600b0042c44be9c20si65709qtk.507.2024.02.08.10.58.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:58:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58581-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b="bRoE/7ia"; 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-58581-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58581-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 84EA51C2A2F4 for ; Thu, 8 Feb 2024 18:57:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2F4450241; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="bRoE/7ia" 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 42D6336B0A; Thu, 8 Feb 2024 18:49:34 +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=1707418179; cv=none; b=Rx0pjoEThpJF9C3ol0VEaIuKnk7thMVjiNGYB8tVB/wrVYiPa54LLB4/rQYnCfsVR+Q75tMOQuAbDXCkx+fRrZC7am5HN2r4mzWvfsmc+RhDJstmjGGOkHi4l0slMY0Ew8hFizlyJLba5yKzGZqPDSfmLzI0DL5s7DyUnkR7Oqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418179; c=relaxed/simple; bh=oenQ3E1qB1jTPZO/gOZI9CMarWIZCEOT7s/3o23TNGM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o7Te099srwSFaYnuKlr8GIxKIgiyz7gSd8xlk8c9+KHuygobh4nZSscOrMaXAU+RV2w42x73tpJE9wPub3pEP+mLvOjHXnCg5xfippvz2jquYXVNSAx9JKKCIr7vM9AveVy1b6yf9yy3Z6rNzNxOOwpZHwwXd1QJp1ZWVm61Kxk= 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=bRoE/7ia; 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=1707418167; bh=oenQ3E1qB1jTPZO/gOZI9CMarWIZCEOT7s/3o23TNGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bRoE/7ia1+B9bPI5yF1PR2T1XA93zIRBnTcH0eC3l0F5DKqYSeR5Nk0tY93pHHcMe SB173/Unk3i9YjDHq2INIyynyUJBpjhZxr/0L5wI/UAMDPahLp/TVB7Y5vIH5N5AE5 crMulQ2zXJos7wtuG6cN1nQG0cu1edkRYscl6pnAbz3KIhoZ8H50j2WoCr0/ks/Omt UUlXIcysLpTzkhjiT5Iptlazn5vqIFc3f+yfGuUzmScLfFjYAiJ1vOAPY4DDm2eyWC 3cTHV3qAZzEPVR6WjB/op0ynHNQPoZFIweA7jAiVScoeq13l0Lfy00tVuzsdsZm7a2 9S+WBZwfWHPmQ== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cl1F3pzY5T; Thu, 8 Feb 2024 13:49:27 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 11/12] dcssblk: Cleanup alloc_dax() error handling Date: Thu, 8 Feb 2024 13:49:12 -0500 Message-Id: <20240208184913.484340-12-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358292381565600 X-GMAIL-MSGID: 1790358292381565600 Now that alloc_dax() returns ERR_PTR(-EOPNOTSUPP) rather than NULL, the callers do not have to handle NULL return values anymore. 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 Cc: linux-s390@vger.kernel.org --- drivers/s390/block/dcssblk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index a3010849bfed..f363c1d51d9a 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -679,8 +679,8 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char goto put_dev; dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops); - if (IS_ERR_OR_NULL(dax_dev)) { - rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; + if (IS_ERR(dax_dev)) { + rc = PTR_ERR(dax_dev); goto put_dev; } set_dax_synchronous(dax_dev); From patchwork Thu Feb 8 18:49:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 198534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp383859dyd; Thu, 8 Feb 2024 10:58:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXyHUgEiWyozpS/aglo4t/hj5mj37WtEFSxaFDCL5cruqeFN4xKcvNjiL+otBiOOklBAa9WhAEMPPeAmwdGUtWLnf6AQg== X-Google-Smtp-Source: AGHT+IFRGLjxwwDRnT/pG/fAXj8Dg/IVeRaluM8D4g7CTsMczpheqKWhxPGi2bAJ5hjaZ1urFopC X-Received: by 2002:a05:620a:22a3:b0:785:b064:ba39 with SMTP id p3-20020a05620a22a300b00785b064ba39mr348441qkh.27.1707418714094; Thu, 08 Feb 2024 10:58:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707418714; cv=pass; d=google.com; s=arc-20160816; b=p3cHsvI2jjwI3fN8/DuyDv5GfgJqjb+MuxcKiO+vE1hD99NIVOhGX/HXCtPti2acHx 37pxnAd1SVv3YxQzD83gw/Zveq9SjtSHXZtEkOoD/rOayZxBV5uz8ZYpCQhjO0bKZDdv vYT5yA2+1GoYhqNqRB7883QGqGTzyLVG6oo77DLNrtKIzv1xj2zoDxDDcSXj3eL1X4+O YgWVfGWKfyz0TLlGsDSsTyUvwB+7sCpBIsV4X3OW671fpjuyF9nsikescOScFs6xaLJf NN2PLMsOl5cauFpILZg3SBbFSzorK43/LW6BiLEG5NOyJ4i3meKXjIiMOYIDCx/AxZgQ WEJQ== 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=5aeSBiqeQsH8ed+NrPkel0B0yoku1i9OKo7qCr10U1g=; fh=wREPbk3x+f0bTcF2irdUNdZBGai6KueLTpPzwLSTLOw=; b=T/z9DGz6E2oXezibuKm04YYEotcjEMCUHQBG1WDJ7kJ35306AGFsBoEUPbRlMBdUR5 aed5l+j4369hT1Jcd5FQYcIXHPL4frMaCZUNxkwtFwRhchJyWhGykSh0Jj5quXIvMJut Or1QVVTffAma5XYmzU8kPjcdHZ8BSvRFx86wPiAUnG/jenMNs99PGuZVTRWsNzrAWS0v f/Oji8H41ga8vGGrKYeXqXWvVoP4Y6Mi/rVvigk8Jne9M1B6CSHWT9zWcFb/JmxvlkfQ 4B9ENVTxRa5iBxZn48Bo+BIgqUxNV1yemZOcSUf2eob6a4PWmIW7IhTyLTsQoihPdesf SoWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=FUBQbuoc; 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-58578-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58578-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCVfY3kUSirq5IGs6ys2z+JEN8g8ugj3N0wGk/o/gC83an+VYJfjzeSgeJrN3kXp3RZSX+qYrrUirLLwPGyGt1jBMYXmOQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pe16-20020a05620a851000b007859699241asi190661qkn.539.2024.02.08.10.58.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58578-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=FUBQbuoc; 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-58578-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58578-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5A74C1C2A201 for ; Thu, 8 Feb 2024 18:57:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 930824F8A9; Thu, 8 Feb 2024 18:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="FUBQbuoc" 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 42D1533CDF; Thu, 8 Feb 2024 18:49:34 +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=1707418178; cv=none; b=GRIk/fPvkruPvib2YK+z8d5MhcwdKBq0PgU5a9bAmL6njZCEpzEEyrf9Cvs8MQpN2sNtF/WZt8QcsZtGpAlNRh0kyS2gA+5oVfv9bfxyXes/7Iwv12TzXHBHZnvurHFmnsKVyf0UKBTGfDjK+wkqefic3j4BlmVnUQ7CR2eB4j8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707418178; c=relaxed/simple; bh=umcqlnyoni1L+YV9DQVqbsmdwpCSWY7IqX3VvZk7A10=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MgNU/V++rIxWK+csXzV6vbHuyLoIWyV5dmbOy/8R+SMBUFkZzigCwVBEqaPHcV7gZpYC4zH+3Urbr6AP7oFG88RAPc8NfiJHx3nbyq1SmnHpMofK/kFCSEK2VSXsTmWXm72XpatAf4jZEvimw/CJ/Gb5OLmHCee7XLry5YSSLVI= 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=FUBQbuoc; 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=1707418167; bh=umcqlnyoni1L+YV9DQVqbsmdwpCSWY7IqX3VvZk7A10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUBQbuoczWUo8k5+ANycG5EnwK2AZwZz+GM2Uz2zImOXhkBzFtGTdwBZAYCenP6fC DgLffSigWmSC0rW6EM/A/gCcDBjQqYAWbEiusKZCP/jz+pOnSPLQWkJpy21cC8SmOh 7iFVQnDrBxgXCvAMOSe7hVjYTOmI/BykW8ePB+qiKPACpJtReCrtD81c1ldvkSSgXY 169iBhHYQPa5LIPJ3/XYMbbPDKLgg7sPaH9XXE5MMG0A2HDed+b0Hbw+qnFFAYipQh Ks5Sbzoa+ogU/4NEMlev5PchVfLYxH7lv49QChUb5wmbf1476V86H9j9CkdWhoRXIX FqmNBGS/mqM+w== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TW5cl4DQpzXwg; Thu, 8 Feb 2024 13:49:27 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , 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 Subject: [PATCH v4 12/12] virtio: Cleanup alloc_dax() error handling Date: Thu, 8 Feb 2024 13:49:13 -0500 Message-Id: <20240208184913.484340-13-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> References: <20240208184913.484340-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790358285544965993 X-GMAIL-MSGID: 1790358285544965993 Now that alloc_dax() returns ERR_PTR(-EOPNOTSUPP) rather than NULL, the callers do not have to handle NULL return values anymore. 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 Cc: linux-s390@vger.kernel.org --- fs/fuse/virtio_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 621b1bca2d55..a28466c2da71 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -809,8 +809,8 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) return 0; dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); - if (IS_ERR_OR_NULL(dax_dev)) { - int rc = IS_ERR(dax_dev) ? PTR_ERR(dax_dev) : -EOPNOTSUPP; + if (IS_ERR(dax_dev)) { + int rc = PTR_ERR(dax_dev); return rc == -EOPNOTSUPP ? 0 : rc; }