public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: "Petr Tesařík" <petr@tesarici.cz>,
	"Michael Kelley" <mhklinux@outlook.com>
Cc: Will Deacon <will@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-team@android.com" <kernel-team@android.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Petr Tesarik <petr.tesarik1@huawei-partners.com>,
	Dexuan Cui <decui@microsoft.com>
Subject: Re: [PATCH v6 4/6] swiotlb: Fix alignment checks when both allocation and DMA masks are present
Date: Mon, 11 Mar 2024 17:52:31 -0700	[thread overview]
Message-ID: <Ze+nT+4Radnd/iyw@Asurada-Nvidia> (raw)
In-Reply-To: <SN6PR02MB41576E58DDF5A56FC6FC1EB6D4242@SN6PR02MB4157.namprd02.prod.outlook.com>

On Mon, Mar 11, 2024 at 09:36:10PM +0000, Michael Kelley wrote:
> From: Petr Tesařík <petr@tesarici.cz>
> > I find it somewhat surprising that NVMe does not
> > in fact require that the NVME_CTRL_PAGE_SHIFT low bits are preserved,
> > as suggested by Nicolin's successful testing.
> >
> > Why is that?
> 
> I saw only one stack trace from Nicolin, and it was file system buffer
> flushing code that initiated the I/O.  In such cases, it's very likely that the
> original address is at least 4K aligned.  Hence the offset is zero and
> the low bits will typically be correct.

Though I didn't dig any deeper here, I do see some unaligned
original addresses passed in at the top level:
       fsck.ext4-286     [004] .....     2.594190: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be750600
       fsck.ext4-286     [004] .....     2.613032: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be780400
       fsck.ext4-286     [004] .....     2.614096: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be7c0600
       fsck.ext4-286     [004] .....     2.614103: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be7e0400
           mount-288     [005] .....     2.615157: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be800400
      multipathd-405     [003] .....     3.062878: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: bda40218
      multipathd-502     [002] .....     3.231721: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: bd3107b8
           mount-525     [002] .....     3.250281: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: bd340200
      multipathd-529     [004] .....     3.259053: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be620478
      multipathd-571     [005] .....     3.292893: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be900328
      multipathd-580     [005] .....     3.318832: iommu_dma_map_page: calling swiotlb_tbl_map_single with phys: be9207c8

Or is that a different "original address"?

Thanks
Nicolin

  parent reply	other threads:[~2024-03-12  0:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 15:28 [PATCH v6 0/6] Fix double allocation in swiotlb_alloc() Will Deacon
2024-03-08 15:28 ` [PATCH v6 1/6] swiotlb: Fix double-allocation of slots due to broken alignment handling Will Deacon
2024-03-18  3:39   ` Michael Kelley
2024-03-18 12:36     ` Petr Tesařík
2024-03-08 15:28 ` [PATCH v6 2/6] swiotlb: Enforce page alignment in swiotlb_alloc() Will Deacon
2024-03-08 15:28 ` [PATCH v6 3/6] swiotlb: Honour dma_alloc_coherent() " Will Deacon
2024-03-08 15:28 ` [PATCH v6 4/6] swiotlb: Fix alignment checks when both allocation and DMA masks are present Will Deacon
2024-03-11 20:05   ` Petr Tesařík
2024-03-11 21:36     ` Michael Kelley
2024-03-11 22:49       ` Will Deacon
2024-03-12  8:52         ` Petr Tesařík
2024-03-12  9:38           ` Robin Murphy
2024-03-12  9:51             ` Petr Tesařík
2024-03-12 12:57               ` Robin Murphy
2024-03-12  0:52       ` Nicolin Chen [this message]
2024-03-12 10:44         ` Petr Tesařík
2024-03-08 15:28 ` [PATCH v6 5/6] iommu/dma: Force swiotlb_max_mapping_size on an untrusted device Will Deacon
2024-03-08 15:28 ` [PATCH v6 6/6] swiotlb: Reinstate page-alignment for mappings >= PAGE_SIZE Will Deacon
2024-03-08 16:08   ` Robin Murphy
2024-03-08 16:38     ` Petr Tesařík
2024-03-08 16:50       ` Christoph Hellwig
2024-03-08 17:22         ` Petr Tesařík
2024-03-08 17:17       ` Robin Murphy
2024-03-08 18:08         ` Petr Tesařík
2024-03-08 17:28   ` Petr Tesařík
2024-03-08 19:02   ` Michael Kelley
2024-03-08 19:21 ` [PATCH v6 0/6] Fix double allocation in swiotlb_alloc() Michael Kelley
2024-03-11 13:36 ` Christoph Hellwig
2024-03-11 23:19   ` Will Deacon
2024-03-11 22:55 ` Nicolin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ze+nT+4Radnd/iyw@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=decui@microsoft.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mhklinux@outlook.com \
    --cc=petr.tesarik1@huawei-partners.com \
    --cc=petr@tesarici.cz \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox