Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp236304rdb; Sun, 28 Jan 2024 23:50:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuTu4bOnsfwbHph1QLrX/Hoq+u59cG9QIi2vWVMnQS8z614uKllFR/i0f8XGeN96dT5lU8 X-Received: by 2002:aa7:d348:0:b0:55e:f0f4:1b8c with SMTP id m8-20020aa7d348000000b0055ef0f41b8cmr1667984edr.17.1706514658454; Sun, 28 Jan 2024 23:50:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706514658; cv=pass; d=google.com; s=arc-20160816; b=js1iXjuEYFmjPHw9I6v2WXp5km1L5+ywCXdSNyJiKUn0WH/pa+pr3Q28H+1OYhTjQF JBAYtI/UQYFh3QqzGs5XM7eF7xw/SiO9I1q5C7w3Prs+CFwfBgcPAObc7L7maCDl36xS lMntffp57r7HMjIjY92sPTAsU49B9laj88zbNVgR/z69h1iDznZFlM4geJIJpQGEO1ki qK4FGGNjXbsA92nnNATAJebMVRRxudRzK09D+f/lI1koTsenrkmx29fisYxgvFSp+MaM bajJpvA+WW5upM0eakoioo1UQ9EYyz8/zvzgqZMtQ1Z+paNsVfWf/cC16qsl2hTcs4bE NFzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=cFAjckZUQa2hCVVJn5FQgi4K+x+kmLkv6E6ltoTSRc0=; fh=ie+qeXC4c/mRu4RhsE9OPsqgWeNO3XDU+Oz5lzKRmQ4=; b=t/n0TEEHBon5RyczrDkp7M9fFWX6hqX2fEfMg98QBS1zVe/W8feg79VvGTxdHKvh60 Oc3wnkU1aZMfVeBEO0DF6Cs9qA60uG9HBrJLqprcVf2RAH34IquvbIHU9kDYWQenAybH Qiz/8CxJxSq1+xR23/1CVHXCMlyreywe6HhlwBCfliVmCdxmymdFDYCXBJhb3JAfHfoz dmxrjZKB1o+2NDTyakWP4bu5nP728lidWG1HT7kQAT7Uea8ta1QVpBbI924ubfXPWct6 Z/EmaswH8UxP9cuh+0weWy4bO9sqbhmQ1HrzHYcFpPyISzhWZcgEpLJh/r8+WS2enf3F Y6GQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-42297-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42297-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m25-20020a509999000000b0055efe9d3fb7si681197edb.364.2024.01.28.23.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 23:50:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42297-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-42297-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42297-linux.lists.archive=gmail.com@vger.kernel.org" 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 0874C1F247EF for ; Mon, 29 Jan 2024 07:50:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90B3D4EB53; Mon, 29 Jan 2024 07:50:53 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 5483851031 for ; Mon, 29 Jan 2024 07:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706514653; cv=none; b=RGEsgS/JrUqS1j79WXTIG3C6K3WCpEJslUM9Shs3foWsDe8vTXoiWAgJlKFX/ttozSBjKyPjycbBNpNUUmqCNjRX4IHr9ffWcr7z0dkhbo0ZkFGN9M81mmVLUqA5I5/c7qp72njo6Adnf6I9ndkspCgJc5iflwRRAfDRqmnYBJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706514653; c=relaxed/simple; bh=QJqzApANPWi1c/IKma69Rh0xMu+xAafFAo/2J2QZVgY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QCadzUzffPh1OlMVynIOQfM3FsYAZFoHWPs71p/BsCjHIuA2B13Mr+WaL3FMcOqzcae1oeh2TYRx/0QkcoYluVCxipFXKgk89oUb7QRcubq6L8ziipXjrLxBaKka7ULXv+TU/r3mtl3ZBPmLHzHy3/BXfqHT1k4H3A6uG9mDW/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id E9D1468CFE; Mon, 29 Jan 2024 08:50:44 +0100 (CET) Date: Mon, 29 Jan 2024 08:50:43 +0100 From: Christoph Hellwig To: Petr =?utf-8?B?VGVzYcWZw61r?= Cc: Christoph Hellwig , Will Deacon , linux-kernel@vger.kernel.org, kernel-team@android.com, iommu@lists.linux.dev, Marek Szyprowski , Robin Murphy , Petr Tesarik , Dexuan Cui Subject: Re: [PATCH 2/2] swiotlb: Enforce page alignment in swiotlb_alloc() Message-ID: <20240129075043.GA22019@lst.de> References: <20240126151956.10014-1-will@kernel.org> <20240126151956.10014-3-will@kernel.org> <20240129060853.GB19258@lst.de> <20240129084326.4667af6a@meshulam.tesarici.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240129084326.4667af6a@meshulam.tesarici.cz> User-Agent: Mutt/1.5.17 (2007-11-01) On Mon, Jan 29, 2024 at 08:43:26AM +0100, Petr Tesařík wrote: > > So PFN_DOWN aligns the address and thus per se converting the unaligned > > address isn't a problem. That being said swiotlb obviously should never > > allocate unaligned addresses, but the placement of this check feels > > odd to me. Also because it only catches swiotlb_alloc and not the > > map side. > > We may have to rethink how alignment constraints are interpreted. See > also my reply to PATCH 1/2. > > > Maybe just throw a WARN_ON_ONCE into slot_addr() ? > > Yes. > > Or, what if I write a KUnit test suite for swiotlb to combat this > constant stream of various regressions? Both sounds good to me.