Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Zakaria Belkadi <zakaria.belkadi@inria.fr>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kanchan Joshi <joshi.k@samsung.com>,
	Anuj Gupta <anuj20.g@samsung.com>,
	florence.schadle@ssi.gouv.fr, frederic.tronel@centralesupelec.fr,
	louis.rilling@irisa.fr, stable@vger.kernel.org,
	"Martin K. Petersen" <mkp@kernel.org>
Subject: Re: [PATCH RESEND] block: pin user PI pages for writing when ref tags are remapped
Date: Fri, 20 Nov 2026 11:37:17 -0700	[thread overview]
Message-ID: <awCTXQYhwCdqgnuY@kbusch-mbp> (raw)
In-Reply-To: <CADUfDZqNM2=KzsnpA+R5ygAbS-SiUzQczZvgM_NoYrhR7Qyj9w@mail.gmail.com>

On Fri, Nov 20, 2026 at 09:44:13AM -0800, Caleb Sander Mateos wrote:
> On Fri, Nov 20, 2026 at 9:23 AM Keith Busch <kbusch@kernel.org> wrote:
> >
> > On Fri, Nov 20, 2026 at 09:13:41AM -0800, Christoph Hellwig wrote:
> > > On Fri, Nov 20, 2026 at 09:58:32AM -0700, Keith Busch wrote:
> > > > > Agreed. I'll keep the PI iterator as ITER_SOURCE. In v2,
> > > > > bio_integrity_map_user() will bounce the user PI buffer for REQ_OP_WRITE
> > > > > when the integrity profile has BLK_INTEGRITY_REF_TAG. That way the
> > > > > block layer can remap the tags in its own copy.
> > > >
> > > > Can avoid bouncing? I think the remapping flags can be tied to the
> > > > user's reftag check request.
> > > >
> > > > If BIP_CHECK_REFTAG is set from the user setting IO_INTEGRITY_CHK_REFTAG
> > > > on a write, we can map the PI buffer for writing. The user explicitly
> > > > asked to have the ref tags checked by the device, and partitions require
> > > > remapping them, so they've told the kernel to write to their buffer.
> > >
> > > No, the user did not ask for violating the mapping direction.  The
> > > whole remapping thing very much is an internal implementation detail
> >
> > Okay, fine. But can we skip bouncing and remapping if the flag isn't
> > set?
> 
> Currently, the remapping happens regardless of BIP_CHECK_REFTAG. It
> depends only on whether the block device reports ref tag support via
> BLK_INTEGRITY_REF_TAG (i.e. Type 1 or Type 2 PI). I think it would be
> a UAPI behavior change to make the ref tag remapping conditional on
> BIP_CHECK_REFTAG.

Right, today remapping is checked when BLK_INTEGRITY_REF_TAG is set in
the profile flags. My proposal is to change that check to
BIP_CHECK_REFTAG in the bio integrity flags. That is indeed a user
visible change in behavior, so that really hurts the suggestion.
 
> I don't see a way to tell ahead of time whether remapping will be
> required without walking the metadata buffer an additional time in
> bio_integrity_map_iter() to check the current ref tags. 

The flag is set in the bip_flags, and you can't merge bio's that have
different bip_flags. So you only need to check the first one rather than
walk all of them.

But it's a moot point because of the user visible change. I suppose you
just shouldn't use a PI format if you don't want your metadata to have
that interpretation overlayed on it.

      reply	other threads:[~2026-11-20 18:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 15:40 [PATCH RESEND] block: pin user PI pages for writing when ref tags are remapped Zakaria Belkadi
2026-11-19 22:44 ` Caleb Sander Mateos
2026-11-20 15:28 ` Christoph Hellwig
2026-11-20 16:22   ` Zakaria Belkadi
2026-11-20 16:58     ` Keith Busch
2026-11-20 17:13       ` Christoph Hellwig
2026-11-20 17:23         ` Keith Busch
2026-11-20 17:30           ` Christoph Hellwig
2026-11-20 17:44           ` Caleb Sander Mateos
2026-11-20 18:37             ` Keith Busch [this message]

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=awCTXQYhwCdqgnuY@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=anuj20.g@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=florence.schadle@ssi.gouv.fr \
    --cc=frederic.tronel@centralesupelec.fr \
    --cc=hch@infradead.org \
    --cc=joshi.k@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.rilling@irisa.fr \
    --cc=mkp@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zakaria.belkadi@inria.fr \
    /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