Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1047505rdb; Tue, 30 Jan 2024 06:35:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqIf8lact8nouGa7SyoI6YXDC36bEOH+hfLlg52Girs9KYnecF9DCMCS2ggAqR3r4sf0xr X-Received: by 2002:a17:902:7405:b0:1d7:7277:8adf with SMTP id g5-20020a170902740500b001d772778adfmr1758773pll.22.1706625301594; Tue, 30 Jan 2024 06:35:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706625301; cv=pass; d=google.com; s=arc-20160816; b=VbhmkJCI8Tk3mQtu5QhCkWmsBQdha7kRn0OZCxcW6Y+dcaQaCdiL4C40veA/6ri2mF J/LR9jq8HO503pK6yfAk1ZOaavuqGaMpdev0Wfa5ifLFlNx9P6gj2QWhuUlwjxVFCT7t +AxPxGe7q+R8SB8LnUfjfzQg3qVhGZBc9MSg9Ur24+pN0CGsT1+rglVCm5fTMbup4HCP cdoOboW85f1hbrKkjBCt72oi63wRnOIS71aj+PkngjiILl4INA2VV8GQy/P1X++l6ZFW G6dUEGQgI19iPWt/F2+iZqxFF/d2TI1eSL/NreRv2D/+QfnBPznvf5y3mTvxZ+weMS7W JBCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=5yyDQjv9dwW2jsdgFbFvZq5hUUEEkNHK53+/jAmranY=; fh=z0eU98lebYSQbnFvsTaKywImC7RroAvZyIOM9L29+kE=; b=Ovm5mkzYTL7uAKqBi/6XkNKhW0Q6239ZMOiH6xgRL245bUjoqqSaldRyLu2DK2AenT RVavKIsvsC/eam2YiETnlN94ygYwGJJ3T1hdpi9/1+Ws6Z2iy2W5KE3fxpF+ll+Sx1L2 fn8LQAWtedHEC2GrCnHZjmHJxuTLeHQJ6rWcBKp5D0G/+BZ0M2v/jYhvbvFgWYO18xQ/ lE2CMPDjRdRSS86FLzRjqjBDJ5e7qGhxy1STVpSdE4vlqVXPiCEuFLVLPMbGR5dAF0Nu eynuoE5XlLSLntaqXSjNmpBTYDRy0rLGUcY6/XXtSSa/lLERIH7AYBLf0NR4p3Q1Jwqw QznQ== 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-44758-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44758-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p17-20020a170902e75100b001d5b6eee7ebsi2992909plf.152.2024.01.30.06.35.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:35:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44758-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-44758-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44758-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 616EB288B37 for ; Tue, 30 Jan 2024 14:34:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23EA57C08A; Tue, 30 Jan 2024 14:34:44 +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 5E0C781AB6 for ; Tue, 30 Jan 2024 14:34:42 +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=1706625283; cv=none; b=c13O1thlJyCf6BzKNh0f60w3/sb/JcO3eXWBtiTyVAcxvjln9tulnAVmE9MXgjAJGV8S04AseRPyX5C+8CF9d5TjTC37LgKRHbaNLEGg1ToSPQXjZSVuh5UXTIYRc1oJOpv+qtj/XJjGvt8RnWPm6gm9vUqcldY6h8lsHtFD8SE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706625283; c=relaxed/simple; bh=qKasyX1rHGUCXJ32d52gf77E7ACV42WbmmJTZqKxtu4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vfl9CcHpuyr4KezvgkddTVUI4o1qT9iMoncUP3ymrKU0Bh7OYloF/8K2imu3ndx4YDhXmWrBxKPChU2Fqzt8E0UFhuIbQfrIMFkLOuoKorBcfxZkZ/QSh3LVGAJ6XuHLaFPNY2Gkvdn/XG9G1u6LKXQUivtmmId7lHCgLg37zIE= 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 266AE68B05; Tue, 30 Jan 2024 15:34:38 +0100 (CET) Date: Tue, 30 Jan 2024 15:34:37 +0100 From: Christoph Hellwig To: Will Deacon Cc: Christoph Hellwig , 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: <20240130143437.GA31991@lst.de> References: <20240126151956.10014-1-will@kernel.org> <20240126151956.10014-3-will@kernel.org> <20240129060853.GB19258@lst.de> <20240129194939.GE12631@willie-the-truck> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240129194939.GE12631@willie-the-truck> User-Agent: Mutt/1.5.17 (2007-11-01) On Mon, Jan 29, 2024 at 07:49:40PM +0000, Will Deacon wrote: > > > return pfn_to_page(PFN_DOWN(tlb_addr)); > > > > So PFN_DOWN aligns the address and thus per se converting the unaligned > > address isn't a problem. > > Hmm, I'm not sure I follow why it isn't a problem. If the first 2KiB slot > of the 4KiB page has already been allocated to somebody else, isn't it a > big problem to align down like that? Maybe I should word the warning > message a bit better -- how about: But the problem is that it's used, not that we can't create a page from a non-aligned address. > > "Cannot allocate pages from non page-aligned swiotlb addr 0x%pa.\n" That sounds better.