Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1915924lqg; Mon, 4 Mar 2024 07:34:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXKQDn4SjGBVxM+g8n7L+ZlK9UEE5h9/2ovvIlEE9o1Mdrk8xLinU82xZG2EVzodMYgnY4unN9mTaH5YdsL4HmkVVnEKNXw6/tKswrSzg== X-Google-Smtp-Source: AGHT+IGYNYqMIg6X7hrZaxHUnD6UFDxLZM3JQWvDAmsVyEIZYfB/98d10YhLY1anxrY5fCI8lvxV X-Received: by 2002:a17:906:3c13:b0:a44:b96:2809 with SMTP id h19-20020a1709063c1300b00a440b962809mr8317516ejg.24.1709566454845; Mon, 04 Mar 2024 07:34:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709566454; cv=pass; d=google.com; s=arc-20160816; b=071Oh1afemeotZGzmhjcK2uWWK5xnyOLJuGLVTWiL9xQaMoHlHOCticzaiICdycAzS A9QAbGsg0cNWe2OqrRaH5BLxoXjGW7+lc0eQnma9mUFb0g2/OLTnW30xY61PyUXNOpxI OkgJ8YSgkfTH/Vv4Jb+girVUnkx1H9iqJQUJ2WthTB0pRlv3kUN7ESOk7g/0IRC4s2kP h4iq/lCRikablHrSWTISS1rCwP7c6UBW8YwhLqhuoZqzuMKfTOZCyRSp/25ZY7fMZ/Te O+QOOekXwtARR/MyXN4Jzq87TKDJykmn81sUJcuHyQa3U3svfRuu0QM+1c/YhPEPBeiU aqDg== 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:dkim-signature; bh=wUPllntNzAoEZoYaB5NWtpBFjJW5E9DKhqt4JZIVOAQ=; fh=jci9tbOvYldztRAV2Z3Qy9vi8lVMup6exfI7Xd4TR0A=; b=CwCdYwTaB5GmLQ8feBe954XgglKkyePGhRypBOPMc5uotF86D7y8AjlHNLR3Qku3sm m6jBFhw+dhRVjSBsi51vF9xbo+zojgoONVuOlyBYwCHPh1M0Uh/gVKFpldYVMKAwTZ6/ Pbn82JPAXgp4Rh7yzFtIBSFD68QwiOx1kNS0Kh4lmAMaxGSv7wmDjcnavC+62iCjqWz4 Zyg2DW10zM7cocgorT8Xadspr0uBTu7W2okb3sDk5hBMAB6RjRJTzIJiMH4ttEhnwi2M U122i/00TZUfowXJpFuh7Nbu96aNDOsRYb4lOQXnIshOIWnfFWMgBE3b7r2iE9yBtOvy 6uXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O7umev13; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j15-20020a50ed0f000000b0056484c0eab5si4015857eds.379.2024.03.04.07.34.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 07:34:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O7umev13; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 9270B1F25DC2 for ; Mon, 4 Mar 2024 15:34:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A25E4C61B; Mon, 4 Mar 2024 15:32:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O7umev13" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 451613B29A; Mon, 4 Mar 2024 15:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566329; cv=none; b=PhPSgsAnDG22kFGmUP7TaDnNMQmv/8N9vOP0K5O4IZKilJG3GtvHKZY0e3P9Fx06Kxi9oCW+udziep4s5Fkyv/t/7dKfWvdRPvgPu1sqAexcInPgrQr4a3ovzobZlJ4YNg3WzJq8Ca7t0kbjVyR/VMhG6Y7UoStO0d10Z524m2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566329; c=relaxed/simple; bh=IdRitC6F7nifQvPVz5e9YSZwKUHZjAx+E0QvkQGFJaM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iLxcIN8kZOzR4BlVZN40eXPG/w7ahMKexN3iupLSiUIz9Xd6mosKrvqg5aya96R34fvjhQISwidRlTr0RJ4ZP4Ug/FxHAvKb3C66bOdPkUHkbWzDMYgcniNQQQX6Cwx86FWCn79Cs54AvT7tGbZrKjaAPd+WstMI+n9/QcxTCRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O7umev13; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C34AAC43390; Mon, 4 Mar 2024 15:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709566328; bh=IdRitC6F7nifQvPVz5e9YSZwKUHZjAx+E0QvkQGFJaM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=O7umev13qkbaai4cI8CRvb/qV3QLoTKH+zy4IscyXT/F91ectlFLWyI1B33Cav6n3 HZqvF4Z/y5Mz5dOGO43+SMYEQYwIh2nHQ9HGI8TDh1LwJxcJUIcCm3xndrNCyvFCZl Wig4zzr1uS7FVoyOsxLe9kGYOG5pz9nrU3pZ/jZ7Yhv/a2CQvfc5r8lORHvhVfS+Ic pOc8RKHtRmMM6yF5173HVFihMy5GDEX0RGLEbFXsAOHxG8hgbQLNMqITfcsEeQh8i5 6g/scjJUrG4WJUt/63UxFehNiD5fewpY5V3et7YorgnwGSIQtXHY7mNF87EGC4CsWk dEoDBPY4kV/jA== Date: Mon, 4 Mar 2024 15:32:03 +0000 From: Will Deacon To: Michael Kelley Cc: "linux-kernel@vger.kernel.org" , "kernel-team@android.com" , "iommu@lists.linux.dev" , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Petr Tesarik , Dexuan Cui , Nicolin Chen Subject: Re: [PATCH v5 6/6] swiotlb: Remove pointless stride adjustment for allocations >= PAGE_SIZE Message-ID: <20240304153203.GA21077@willie-the-truck> References: <20240228133930.15400-1-will@kernel.org> <20240228133930.15400-7-will@kernel.org> 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: User-Agent: Mutt/1.10.1 (2018-07-13) On Thu, Feb 29, 2024 at 06:07:32AM +0000, Michael Kelley wrote: > From: Will Deacon Sent: Wednesday, February 28, 2024 5:40 AM > > > > For swiotlb allocations >= PAGE_SIZE, the slab search historically > > adjusted the stride to avoid checking unaligned slots. However, this is > > no longer needed now that the code around it has evolved and the > > stride is calculated from the required alignment. > > > > Either 'alloc_align_mask' is used to specify the allocation alignment or > > the DMA 'min_align_mask' is used to align the allocation with 'orig_addr'. > > At least one of these masks is always non-zero. > > I think the patch is correct, but this justification is not. alloc_align_mask > and the DMA min_align_mask are often both zero. While the NVMe > PCI driver sets min_align_mask, SCSI disk drivers do not (except for the > Hyper-V synthetic SCSI driver). When both are zero, presumably > there are no alignment requirements, so a stride of 1 is appropriate. Sorry, yes, I messed up the commit message here as I was trying to reason through the allocation case separately from the mapping case. However, I need to digest the rest of this thread before doing the obvious fix... Will