public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Naman Jain <namjain@linux.microsoft.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Logan Gunthorpe <logang@deltatee.com>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	Saurabh Sengar <ssengar@linux.microsoft.com>,
	Long Li <longli@microsoft.com>,
	Michael Kelley <mhklinux@outlook.com>
Subject: Re: [PATCH 2/2] block: allow different-pgmap pages as separate bvecs in bio_add_page
Date: Thu, 2 Apr 2026 07:30:57 +0200	[thread overview]
Message-ID: <20260402053057.GA11783@lst.de> (raw)
In-Reply-To: <70c82c3a-d135-4877-ab46-c15d329815f5@linux.microsoft.com>

On Thu, Apr 02, 2026 at 10:51:05AM +0530, Naman Jain wrote:
> When a direct I/O request spans pages from different chunks (different 
> pgmaps), the current code rejected the second page entirely:
>
>     if (!zone_device_pages_have_same_pgmap(bv->bv_page, page))
>         return 0;  // Rejection - forces bio split or I/O error
>
> Both chunks are regular RAM from the DMA perspective 
> (MEMORY_DEVICE_GENERIC, not P2PDMA). The only requirement is that they not 
> be merged into the same bvec segment, which patch 1/2 enforces by adding 
> the pgmap check to biovec_phys_mergeable().
>
> This patch allows pages from different pgmaps to be added as separate bvec 
> entries in the same bio, eliminating bio splits and I/O failures
> when buffers span pgmap boundaries.

Which as I said we can't do in general, as different pgmaps cna have
different DMA mapping requirements.  We might be able to relax this
if we know multiple pgmaps can be mapped in the same way.  I.e.
replace zone_device_pages_have_same_pgmap with
zone_device_pages_compatible and add additional conditions to it.

> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -231,6 +231,9 @@ int bio_integrity_add_page(struct bio *bio, struct page 
> *page,
>         if (bip->bip_vcnt > 0) {
>                 struct bio_vec *bv = &bip->bip_vec[bip->bip_vcnt - 1];
>
> +               if (is_pci_p2pdma_page(bv->bv_page) !=
> +                   is_pci_p2pdma_page(page))
> +                       return 0;
>                 if (zone_device_pages_have_same_pgmap(bv->bv_page, page) &&

The above is implied by not having the same pgmap.


  reply	other threads:[~2026-04-02  5:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01  8:23 [PATCH 0/2] block: fix pgmap handling for zone device pages in bio merge paths Naman Jain
2026-04-01  8:23 ` [PATCH 1/2] block: add pgmap check to biovec_phys_mergeable Naman Jain
2026-04-01 14:07   ` Christoph Hellwig
2026-04-01  8:23 ` [PATCH 2/2] block: allow different-pgmap pages as separate bvecs in bio_add_page Naman Jain
2026-04-01 14:08   ` Christoph Hellwig
2026-04-02  5:21     ` Naman Jain
2026-04-02  5:30       ` Christoph Hellwig [this message]
2026-04-02  8:55         ` Naman Jain
2026-04-07  5:52           ` Christoph Hellwig
2026-04-07  7:08             ` Naman Jain

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=20260402053057.GA11783@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=jhubbard@nvidia.com \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=longli@microsoft.com \
    --cc=mhklinux@outlook.com \
    --cc=namjain@linux.microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    /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