Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp572045rdb; Thu, 15 Feb 2024 08:36:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX60dBZRSNJ/yIg/Z9vtF1tMZm8cvRQfhPENP/CG4si8DIywhh4sha5Hs2lPjsPPr4iPEKRflLNl2/sghOwDNCHNHpzXII4o+CqQpRrnA== X-Google-Smtp-Source: AGHT+IEFtBcZyHPBNbHgza6BjSyg90VN1x63/rHvXgbnBbYXr1KG9ZfyxVM9QIDP7phaaWI1Q9VH X-Received: by 2002:aa7:d44c:0:b0:55f:4bd7:6a6f with SMTP id q12-20020aa7d44c000000b0055f4bd76a6fmr1727630edr.29.1708014959947; Thu, 15 Feb 2024 08:35:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708014959; cv=pass; d=google.com; s=arc-20160816; b=PWh1PJW380qFgCn5c/BBad2PxfJznhRmfzrhUmbx9YjHYi64Z5WFxyeKr6kdHlH+vZ 8XRmPLh7RDmgkQv3MLIYFDyxWCi5mWHd5GTNMIDAYcKShXKYy+R7iphJ47z+ZuYAo7eT 0Sbgo8ue4TUwpSnLM2xHPkmZ4D4+fPtRtWASvMDiOZcw1XTNniKuD1uheKrB0ia5N7Tm wRx5t39ZWgXR2/IP+Xh2d8t6OXDU5SMbzJoT42A1ixi1E90iUtWblB/N8xr+eOZNISst e0iu4MZ+uIiorG+crHsRtugeUQw06yrFpEeucZTQ1j98ig9GL+W4dGDntxY7SMTvwGhH lJZg== 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=2+vqOZSHMRdn7qWZ6K9Yjb9RZvwmKqJC6JhroaX4jE0=; fh=f4jzvOdPuXv+WRoE+HOAMiI2g6ldawVtwzqDV5ByRYk=; b=KWKVkNj1v0yOZbDB3tbmUDvg/5FhNLWoowHKouMqywismDezsYd94VwXStk29ZCrvi XHVsLZ10hojsaMNynfmJYwJDLFVUGeX1/f7gmGssWxSviCk3qcJanlSK61hDeHiYsNcz HZ9QjsCcCeM7jy56s4JKSNAgDi/Clx7xH4yfrf+VddBp+m9snRdU/JOt8mUWlq6NW046 +3bklge9p86LpMuIgs7kq/9LRgWa7MKoHZ7be8Wcfg/9Zl69YH+KmA8VaewWECq+Uz/a gTRS+yGPi/wnpcIQP5cxL9KLOrw1lBtT7UP9dudouoaaLVGUg/yIs+wuTjFSUyfZac2U w8+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tENlyL1U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-67315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67315-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. [147.75.80.249]) by mx.google.com with ESMTPS id t5-20020aa7d705000000b005617d72cad5si761957edq.492.2024.02.15.08.35.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:35:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67315-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tENlyL1U; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-67315-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67315-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 AAA731F2542D for ; Thu, 15 Feb 2024 16:35:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F19A7135A6B; Thu, 15 Feb 2024 16:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tENlyL1U" 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 21ADB1754B; Thu, 15 Feb 2024 16:35:51 +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=1708014952; cv=none; b=MjW30Qi63k/VH9UlJ5fmeguZZWtRwhSGoJ15fXz1YWSzEXr5iBiJyzZr0sRyyxlUeDdvT1OvhC1ysoaeb2em0KT5g1DvPmJ9YFRRacuzKIlDBbD0f2G8b0ZTKY3pXiAB8PTU0FG9wLKcg2nfWk/OC0E62oDiVE3zAV4peJmYcTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708014952; c=relaxed/simple; bh=+zLAj2dv1mxs8pQKcOIXqeYT4laZWT/mVwhK3HGd0EI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WuLL3ghJ3W/n6MApfcxI7nrNkdBMR4UtPORJ4/nOKdVlrYE1rXP0rRPRVQHI3Kv22DMKi7yPrgVEcoDPnThIhfd0Gn5BlVRZJH4XErpFHgeMtdH/hNKRsZwFkjKCHl3+JOP1QVFRSqGNPrYcGuMlNp182VsuEojTgdHyCHtpvOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tENlyL1U; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14BCFC433C7; Thu, 15 Feb 2024 16:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708014951; bh=+zLAj2dv1mxs8pQKcOIXqeYT4laZWT/mVwhK3HGd0EI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tENlyL1UhctC1ji35rmACH436KEsEf4wY7vf0fttSzkY8KreDcVR/jZml77spbPUH rgub6XHTDa0aqSrzK8aUSw4xUBinSCzAt4NlclazOXyL0V2PqC/+MiYDKxwr5H9bnt OEm6HW4sobAE76phqUDf7Pj2GXYUE07BiLTzEXozU9MkEYMilt4jW6ZZuW4p6toTud W7d98aimoio4WX+HHTuI4obLTqDf1T+46JUITse0X/YyCk+GBWaMy2+L9MhyJZ4X+f OPcIx3ZE6DyFSiE7a9CB64Ne5Z29MHA2w0FjcArhgyWeQB9KmbTCJImnIAgkgj0ZEe 8uL9RNKVccbqQ== Date: Thu, 15 Feb 2024 16:35:45 +0000 From: Will Deacon To: Nicolin Chen Cc: sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, kbusch@kernel.org, joro@8bytes.org, robin.murphy@arm.com, jgg@nvidia.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, murphyt7@tcd.ie, baolu.lu@linux.intel.com Subject: Re: [PATCH v1 0/2] nvme-pci: Fix dma-iommu mapping failures when PAGE_SIZE=64KB Message-ID: <20240215163544.GA821@willie-the-truck> References: <20240214164138.GA31927@willie-the-truck> <20240215142208.GA753@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: <20240215142208.GA753@willie-the-truck> User-Agent: Mutt/1.10.1 (2018-07-13) On Thu, Feb 15, 2024 at 02:22:09PM +0000, Will Deacon wrote: > On Wed, Feb 14, 2024 at 11:57:32AM -0800, Nicolin Chen wrote: > > On Wed, Feb 14, 2024 at 04:41:38PM +0000, Will Deacon wrote: > > > On Tue, Feb 13, 2024 at 01:53:55PM -0800, Nicolin Chen wrote: > > And it seems to get worse, as even a 64KB mapping is failing: > > [ 0.239821] nvme 0000:00:01.0: swiotlb buffer is full (sz: 65536 bytes), total 32768 (slots), used 0 (slots) > > > > With a printk, I found the iotlb_align_mask isn't correct: > > swiotlb_area_find_slots:alloc_align_mask 0xffff, iotlb_align_mask 0x800 > > > > But fixing the iotlb_align_mask to 0x7ff still fails the 64KB > > mapping.. > > Hmm. A mask of 0x7ff doesn't make a lot of sense given that the slabs > are 2KiB aligned. I'll try plugging in some of the constants you have > here, as something definitely isn't right... Sorry, another ask: please can you print 'orig_addr' in the case of the failing allocation? Thanks! Will