Linux block layer
 help / color / mirror / Atom feed
* Re: [RFC PATCH v2] virtio_blk: add fua write support
From: Stefan Hajnoczi @ 2026-05-14 18:22 UTC (permalink / raw)
  To: Sana Sharma; +Cc: afaria, linux-block
In-Reply-To: <20260512191808.45334-2-sansshar@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

On Tue, May 12, 2026 at 03:18:09PM -0400, Sana Sharma wrote:
> Continuing the work of Alberto Faria <afaria@redhat.com>
> this patch addresses the remaining feedback regarding removing
> VIRTIO_BLK_F_OUT_FUA from features_legacy[]
> 
> Link: https://lore.kernel.org/linux-block/20250508001951.421467-1-afaria@redhat.com/
> Originally-by: Alberto Faria <afaria@redhat.com>
> Signed-off-by: Alberto Faria <afaria@redhat.com>
> Signed-off-by: Sana Sharma <sansshar@redhat.com>
> 
> 
> ---
>  drivers/block/virtio_blk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, Sana!

Please squash your change into Alberto's commit, rebase against the
latest linux.git/master, test against a patched QEMU, and resend the
entire series once the VIRTIO spec change has been merged (the vote is
currently ongoing).

> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 5a6aa3dfb18a..aee2d503d6ef 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -1665,7 +1665,7 @@ static unsigned int features_legacy[] = {
>  	VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
>  	VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE,
>  	VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_WRITE_ZEROES,
> -	VIRTIO_BLK_F_SECURE_ERASE, VIRTIO_BLK_F_OUT_FUA,
> +	VIRTIO_BLK_F_SECURE_ERASE,
>  }
>  ;
>  static unsigned int features[] = {
> -- 
> 2.54.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: [PATCH blktests 1/3] check: add --cmd-trace option
From: Bart Van Assche @ 2026-05-14 16:12 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block, Daniel Wagner, John Meneghini
In-Reply-To: <agWWgSBS2v0sSlUl@shinmob>

On 5/14/26 2:36 AM, Shin'ichiro Kawasaki wrote:
> On May 13, 2026 / 10:08, Bart Van Assche wrote:
>> On 5/13/26 4:23 AM, Shin'ichiro Kawasaki wrote:
>>> diff --git a/check b/check
>>> index c166fae..a68049b 100755
>>> --- a/check
>>> +++ b/check
>>> @@ -458,7 +458,17 @@ _call_test() {
>>>    		TIMEFORMAT="%Rs"
>>>    		pushd . >/dev/null || return
>>> +		if ((CMD_TRACE)); then
>>> +			exec 8>"${seqres}.cmdtrace"
>>> +			export BASH_XTRACEFD=8
>>> +			set -x
>>> +		fi
>>
>> Hmm ... my experience is that set -x breaks most tests.
> 
> I ran whole blktests in my test environment with this series and the --cmd-trace
> option, and observed no new failure. If the bash xtrace feature does not work in
> any environment, I would like to understand the condition.

I should have added in my email "without setting BASH_XTRACEFD". If
BASH_XTRACEFD I think that "set -x" should be fine.

Thanks,

Bart.



^ permalink raw reply

* Re: [PATCH blktests 2/3] common/rc: add _echo() function to trace sysfs attribute writes
From: Bart Van Assche @ 2026-05-14 15:58 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block, Daniel Wagner, John Meneghini
In-Reply-To: <agWZZkwOhiSoAvh6@shinmob>

On 5/14/26 2:45 AM, Shin'ichiro Kawasaki wrote:
> On May 13, 2026 / 10:17, Bart Van Assche wrote:
>> Should "echo" or "echo -n" be used in the above shell function?
> 
> I couldn't catch the comment above. The current patch uses "echo", and it's
> working.

We will have to switch to "echo -n" if any code is ever added to
blktests that writes into binary sysfs/debugfs/configfs attributes.

Thanks,

Bart.

^ permalink raw reply

* Re: [PATCH 09/12] swap: push down setting sis->bdev into ->swap_activate
From: Darrick J. Wong @ 2026-05-14 14:37 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Christoph Hellwig, Andrew Morton, Chris Li, Kairui Song,
	Christian Brauner, Jens Axboe, David Sterba, Theodore Ts'o,
	Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Namjae Jeon, Hyunchul Lee, Steve French, Paulo Alcantara,
	Carlos Maiolino, Naohiro Aota, linux-xfs, linux-fsdevel,
	linux-doc, linux-mm, linux-block, linux-btrfs, linux-ext4,
	linux-f2fs-devel, linux-nfs, linux-cifs
In-Reply-To: <b37ca8a7-289e-45a0-8cbd-eb14d7453b97@kernel.org>

On Wed, May 13, 2026 at 04:58:37PM +0900, Damien Le Moal wrote:
> On 5/13/26 16:46, Christoph Hellwig wrote:
> > On Wed, May 13, 2026 at 04:44:53PM +0900, Damien Le Moal wrote:
> >> Hmmm... With zonefs, swap files can be created on top of conventional zone
> >> files. So enforcing "no swap on zoned device" here would break that.
> > 
> > We can check that none of the extents fall onto sequential zones instead
> > of just devices.
> > 
> > I still wonder why you bother with swap to zonefs at all, though.
> 
> Yeah. I do not think anyone actually use that... But since it is there from the
> start, kind of stuck with it now.

Ahh, right, I forgot that zoned devices can have conventional zones
where swap would actually work.  Question withdrawn.

--D

^ permalink raw reply

* Re: [PATCH v13 5/8] blk-mq: use hk cpus only when isolcpus=io_queue is enabled
From: Daniel Wagner @ 2026-05-14 10:42 UTC (permalink / raw)
  To: Aaron Tomlin
  Cc: Daniel Wagner, axboe, kbusch, hch, sagi, mst, aacraid,
	James.Bottomley, martin.petersen, liyihang9, kashyap.desai,
	sumit.saxena, shivasharan.srikanteshwara, chandrakanth.patil,
	sathya.prakash, sreekanth.reddy, suganath-prabu.subramani,
	ranjan.kumar, jinpu.wang, tglx, mingo, peterz, juri.lelli,
	vincent.guittot, akpm, maz, ruanjinjie, bigeasy, yphbchou0911,
	wagi, frederic, longman, chenridong, hare, kch, ming.lei,
	tom.leiming, steve, sean, chjohnst, neelx, mproche, nick.lange,
	marco.crivellari, rishil1999, linux-block, linux-kernel
In-Reply-To: <bovevvg2n77nzdrvjkayca2piibjl4noykv24wthex7em4u5lo@beqyhu2xertk>

On Wed, May 13, 2026 at 07:30:44PM -0400, Aaron Tomlin wrote:
> > I think this should also check if the CPU is online. The fallback should
> > ensure the system will boot.
> 
> While I completely agree with the goal of ensuring a safe boot, I suspect
> that we actually must iterate over for_each_possible_cpu(cpu) here to
> prevent map boundary violations during CPU hotplug events.

I have to check this version of the patch what is happening in detail.
Originally the idea was that the fallback should only be taken if it's
not possible to create a valid mapping due to $reason. In this case the
system should still boot and issue a warning. This is also what the
comments says in the function, pick one online CPU and map all hctx to
it. Don't bother to be smart.

^ permalink raw reply

* Re: [PATCH blktests 2/3] common/rc: add _echo() function to trace sysfs attribute writes
From: Daniel Wagner @ 2026-05-14 10:36 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki
  Cc: Bart Van Assche, linux-block, Daniel Wagner, John Meneghini
In-Reply-To: <agWXr9Yntf4OiQ9e@shinmob>

On Thu, May 14, 2026 at 06:41:39PM +0900, Shin'ichiro Kawasaki wrote:
> Said that, this will not work when printf is used to write to
> sysfs/debugfs/configfs attributes. So, I'm tempted to Bart's idea to
> rename _echo() to _set_attr().

Indeed, my idea was to avoid prefixing all the echo with a _. Since this
doesn't work, Bart's idea to introduce explicit setters sounds like the
way to go. 

^ permalink raw reply

* [PATCH v3] block/blk-iolatency: Add the processing flow of the chained bio in the QoS and define the related types to solve the problem of incorrect inflight processing in the QoS. The usage of the done_split_bio abstract function in the blk-iolatency project.
From: Li kunyu @ 2026-05-14  9:59 UTC (permalink / raw)
  To: axboe, tj, josef; +Cc: linux-block, linux-kernel, Li kunyu
In-Reply-To: <20260506024244.2741-1-likunyu10@163.com>

Signed-off-by: Li kunyu <likunyu10@163.com>
---
v2: Fix the use of 'split' in the 'bio_set_flag' function to 'bio'
v3: Fix the missing implementation of the '__rq_qos_done_split_bio' function

 block/bio.c               |  2 ++
 block/blk-iolatency.c     | 34 ++++++++++++++++++++++++++++++++++
 block/blk-merge.c         |  7 ++++++-
 block/blk-rq-qos.c        |  9 +++++++++
 block/blk-rq-qos.h        | 11 +++++++++++
 include/linux/blk_types.h |  2 ++
 6 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/block/bio.c b/block/bio.c
index b8972dba68a0..7740701afc7f 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1733,6 +1733,8 @@ static inline bool bio_remaining_done(struct bio *bio)
 		return true;
 	}
 
+	rq_qos_done_split_bio(bio);
+
 	return false;
 }
 
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 53e8dd2dfa8a..ba5870bf14c5 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -632,6 +632,39 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio)
 	}
 }
 
+static void blkcg_iolatency_done_split_bio(struct rq_qos *rqos, struct bio *bio)
+{
+	struct blkcg_gq *blkg;
+	struct rq_wait *rqw;
+	struct iolatency_grp *iolat;
+	int inflight = 0;
+
+	blkg = bio->bi_blkg;
+	if (!blkg || !bio_flagged(bio, BIO_QOS_CHAIN_CHILD))
+		return;
+
+	iolat = blkg_to_lat(bio->bi_blkg);
+	if (!iolat)
+		return;
+
+	if (!iolat->blkiolat->enabled)
+		return;
+
+	while (blkg && blkg->parent) {
+		iolat = blkg_to_lat(blkg);
+		if (!iolat) {
+			blkg = blkg->parent;
+			continue;
+		}
+		rqw = &iolat->rq_wait;
+
+		inflight = atomic_dec_return(&rqw->inflight);
+		WARN_ON_ONCE(inflight < 0);
+
+		blkg = blkg->parent;
+	}
+}
+
 static void blkcg_iolatency_exit(struct rq_qos *rqos)
 {
 	struct blk_iolatency *blkiolat = BLKIOLATENCY(rqos);
@@ -645,6 +678,7 @@ static void blkcg_iolatency_exit(struct rq_qos *rqos)
 static const struct rq_qos_ops blkcg_iolatency_ops = {
 	.throttle = blkcg_iolatency_throttle,
 	.done_bio = blkcg_iolatency_done_bio,
+	.done_split_bio = blkcg_iolatency_done_split_bio,
 	.exit = blkcg_iolatency_exit,
 };
 
diff --git a/block/blk-merge.c b/block/blk-merge.c
index fcf09325b22e..84373e3e1bbe 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -151,8 +151,13 @@ static struct bio *bio_submit_split(struct bio *bio, int split_sectors)
 	if (split_sectors) {
 		bio = bio_submit_split_bioset(bio, split_sectors,
 				&bio->bi_bdev->bd_disk->bio_split);
-		if (bio)
+		if (bio) {
 			bio->bi_opf |= REQ_NOMERGE;
+			/* Fix the issue where the inflight statistics
+			 * of the chained bio in the QoS are incorrect.
+			 */
+			bio_set_flag(bio, BIO_QOS_CHAIN_CHILD);
+		}
 	}
 
 	return bio;
diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index 85cf74402a09..41ee04defca7 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -95,6 +95,15 @@ void __rq_qos_done_bio(struct rq_qos *rqos, struct bio *bio)
 	} while (rqos);
 }
 
+void __rq_qos_done_split_bio(struct rq_qos *rqos, struct bio *bio)
+{
+	do {
+		if (rqos->ops->done_split_bio)
+			rqos->ops->done_split_bio(rqos, bio);
+		rqos = rqos->next;
+	} while (rqos);
+}
+
 void __rq_qos_queue_depth_changed(struct rq_qos *rqos)
 {
 	do {
diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h
index a747a504fe42..496a27b9d412 100644
--- a/block/blk-rq-qos.h
+++ b/block/blk-rq-qos.h
@@ -45,6 +45,7 @@ struct rq_qos_ops {
 	void (*cleanup)(struct rq_qos *, struct bio *);
 	void (*queue_depth_changed)(struct rq_qos *);
 	void (*exit)(struct rq_qos *);
+	void (*done_split_bio)(struct rq_qos *, struct bio *);
 	const struct blk_mq_debugfs_attr *debugfs_attrs;
 };
 
@@ -108,6 +109,7 @@ void __rq_qos_throttle(struct rq_qos *rqos, struct bio *bio);
 void __rq_qos_track(struct rq_qos *rqos, struct request *rq, struct bio *bio);
 void __rq_qos_merge(struct rq_qos *rqos, struct request *rq, struct bio *bio);
 void __rq_qos_done_bio(struct rq_qos *rqos, struct bio *bio);
+void __rq_qos_done_split_bio(struct rq_qos *rqos, struct bio *bio);
 void __rq_qos_queue_depth_changed(struct rq_qos *rqos);
 
 static inline void rq_qos_cleanup(struct request_queue *q, struct bio *bio)
@@ -157,6 +159,15 @@ static inline void rq_qos_done_bio(struct bio *bio)
 		__rq_qos_done_bio(q->rq_qos, bio);
 }
 
+static inline void rq_qos_done_split_bio(struct bio *bio)
+{
+	if (bio->bi_bdev && bio_flagged(bio, BIO_QOS_CHAIN_CHILD)) {
+		struct request_queue *q = bdev_get_queue(bio->bi_bdev);
+		if (q->rq_qos)
+			__rq_qos_done_split_bio(q->rq_qos, bio);
+	}
+}
+
 static inline void rq_qos_throttle(struct request_queue *q, struct bio *bio)
 {
 	if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) {
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 8808ee76e73c..63fee89ecc14 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -322,6 +322,8 @@ enum {
 	BIO_REMAPPED,
 	BIO_ZONE_WRITE_PLUGGING, /* bio handled through zone write plugging */
 	BIO_EMULATES_ZONE_APPEND, /* bio emulates a zone append operation */
+	BIO_QOS_CHAIN_CHILD,    /* chained bio child, used for segmenting out
+				* the bio */
 	BIO_FLAG_LAST
 };
 
-- 
2.47.3


^ permalink raw reply related

* Re: [PATCH blktests 2/3] common/rc: add _echo() function to trace sysfs attribute writes
From: Shin'ichiro Kawasaki @ 2026-05-14  9:45 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-block, Daniel Wagner, John Meneghini
In-Reply-To: <472b55a1-cef3-4473-b8b2-08b501efcd77@acm.org>

On May 13, 2026 / 10:17, Bart Van Assche wrote:
> On 5/13/26 4:23 AM, Shin'ichiro Kawasaki wrote:
> > +# Echo a value to a file. This wrapper is used to trace sysfs attribute writes
> 
> Echo -> Write
> file -> sysfs/debugfs/configfs attribute
> sysfs -> sysfs/debugfs/configfs

Thanks, these descriptions are more accurate.

> > +# when the --cmd-trace option is enabled.
> > +_echo() {
> > +	echo "$1" > "$2"
> > +}
> 
> If this is only used to write into sysfs/debugfs/configfs, there are
> probably better names for this function than _echo, e.g. _set_attr(),
> _write_attr() or _write_sys_attr().

Agreed, _set_attr() sounds good to me.

> 
> Should "echo" or "echo -n" be used in the above shell function?

I couldn't catch the comment above. The current patch uses "echo", and it's
working.


^ permalink raw reply

* Re: [PATCH blktests 2/3] common/rc: add _echo() function to trace sysfs attribute writes
From: Shin'ichiro Kawasaki @ 2026-05-14  9:41 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Daniel Wagner, linux-block, Daniel Wagner, John Meneghini
In-Reply-To: <3ef4e2a4-c0ec-4040-a4c7-3687ed7e2d93@acm.org>

On May 13, 2026 / 10:07, Bart Van Assche wrote:
> On 5/13/26 7:05 AM, Daniel Wagner wrote:
> > On Wed, May 13, 2026 at 08:23:25PM +0900, Shin'ichiro Kawasaki wrote:
> > > +# Echo a value to a file. This wrapper is used to trace sysfs attribute writes
> > > +# when the --cmd-trace option is enabled.
> > > +_echo() {
> > > +	echo "$1" > "$2"
> > > +}
> > 
> > Stupid question, can't we override the echo function, something like this:
> > 
> > echo() {
> >      builtin echo "$@"
> >      builtin echo "$@" >> "/tmp/debug_log.txt"
> > }
> 
> How can this work since the sysfs/debugfs/configfs attribute is not an
> argument of the echo command?

I guess Daniel's idea was to do as follows:

echo() {
     builtin echo "$@"
     builtin echo "$@" >> "${seqres}.cmdtrace"
}

This can capture both the value and the filename in the .cmdtrace file.

Said that, this will not work when printf is used to write to
sysfs/debugfs/configfs attributes. So, I'm tempted to Bart's idea to
rename _echo() to _set_attr().


^ permalink raw reply

* Re: [PATCH 7.2 2/2] ublk: optimize ublk_rq_has_data()
From: Ming Lei @ 2026-05-14  9:36 UTC (permalink / raw)
  To: Caleb Sander Mateos; +Cc: Jens Axboe, linux-block, linux-kernel
In-Reply-To: <20260513211846.1956810-3-csander@purestorage.com>

On Wed, May 13, 2026 at 03:18:46PM -0600, Caleb Sander Mateos wrote:
> ublk_rq_has_data() currently uses bio_has_data(), which involves 2
> indirections and several branches. Use blk_rq_has_data() instead to save
> an indirection and NULL check.
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>

Reviewed-by: Ming Lei <tom.leiming@gmail.com>


Thanks,
Ming

^ permalink raw reply

* Re: [PATCH blktests 1/3] check: add --cmd-trace option
From: Shin'ichiro Kawasaki @ 2026-05-14  9:36 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-block, Daniel Wagner, John Meneghini
In-Reply-To: <10bc69b1-762f-40a1-94b0-9ce6580b17e1@acm.org>

On May 13, 2026 / 10:08, Bart Van Assche wrote:
> On 5/13/26 4:23 AM, Shin'ichiro Kawasaki wrote:
> > diff --git a/check b/check
> > index c166fae..a68049b 100755
> > --- a/check
> > +++ b/check
> > @@ -458,7 +458,17 @@ _call_test() {
> >   		TIMEFORMAT="%Rs"
> >   		pushd . >/dev/null || return
> > +		if ((CMD_TRACE)); then
> > +			exec 8>"${seqres}.cmdtrace"
> > +			export BASH_XTRACEFD=8
> > +			set -x
> > +		fi
> 
> Hmm ... my experience is that set -x breaks most tests.

I ran whole blktests in my test environment with this series and the --cmd-trace
option, and observed no new failure. If the bash xtrace feature does not work in
any environment, I would like to understand the condition.


^ permalink raw reply

* Re: [PATCH 7.2 1/2] blk-mq: introduce blk_rq_has_data()
From: Ming Lei @ 2026-05-14  9:35 UTC (permalink / raw)
  To: Caleb Sander Mateos; +Cc: Jens Axboe, linux-block, linux-kernel
In-Reply-To: <20260513211846.1956810-2-csander@purestorage.com>

On Wed, May 13, 2026 at 03:18:45PM -0600, Caleb Sander Mateos wrote:
> Add blk_rq_has_data(), an analogue of bio_has_data() for struct request.
> This skips one dereference relative to bio_has_data(rq->bio).
> 
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>

Reviewed-by: Ming Lei <tom.leiming@gmail.com>

Thanks,
Ming

^ permalink raw reply

* Re: [PATCH v4 02/12] block/bdev: Annotate the blk_holder_ops callback functions
From: Bart Van Assche @ 2026-05-14  0:31 UTC (permalink / raw)
  To: Marco Elver
  Cc: Nathan Chancellor, Peter Zijlstra, Jens Axboe, linux-block,
	Christoph Hellwig
In-Reply-To: <CANpmjNP7JQq5X6bheX58bi2A5XaChkGSXs6+uQK2kiwQeXBvdg@mail.gmail.com>

On 5/13/26 4:06 PM, Marco Elver wrote:
> My patch which is more complete is still floating around:
> https://lore.kernel.org/all/acqELlVC6vEeEF-W@elver.google.com/
> 
> Peter is probably still waiting for Debian to upgrade the clang dev version.

How about reposting that patch? I hope that Peter won't wait with
queuing that patch until Debian has upgraded Clang.

Thanks,

Bart.

^ permalink raw reply

* Re: [PATCH v13 5/8] blk-mq: use hk cpus only when isolcpus=io_queue is enabled
From: Aaron Tomlin @ 2026-05-13 23:30 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: axboe, kbusch, hch, sagi, mst, aacraid, James.Bottomley,
	martin.petersen, liyihang9, kashyap.desai, sumit.saxena,
	shivasharan.srikanteshwara, chandrakanth.patil, sathya.prakash,
	sreekanth.reddy, suganath-prabu.subramani, ranjan.kumar,
	jinpu.wang, tglx, mingo, peterz, juri.lelli, vincent.guittot,
	akpm, maz, ruanjinjie, bigeasy, yphbchou0911, wagi, frederic,
	longman, chenridong, hare, kch, ming.lei, tom.leiming, steve,
	sean, chjohnst, neelx, mproche, nick.lange, marco.crivellari,
	rishil1999, linux-block, linux-kernel
In-Reply-To: <3af2cd18-1221-4ff6-aa7f-6dab74460eab@nitrogen.local>

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

On Wed, May 13, 2026 at 11:42:46AM +0200, Daniel Wagner wrote:
> On Tue, May 12, 2026 at 08:55:06PM -0400, Aaron Tomlin wrote:
> > +static void blk_mq_map_fallback(struct blk_mq_queue_map *qmap)
> > +{
> > +	unsigned int cpu;
> > +
> > +	/*
> > +	 * Map all CPUs to the first hctx of this specific map to ensure
> > +	 * at least one online CPU is serving it, respecting the map's
> > +	 * boundaries so secondary maps do not route into the default map.
> > +	 */
> > +	for_each_possible_cpu(cpu)
> > +		qmap->mq_map[cpu] = qmap->queue_offset;
> > +}
> 
> I think this should also check if the CPU is online. The fallback should
> ensure the system will boot.

Thanks for the review Daniel.

While I completely agree with the goal of ensuring a safe boot, I suspect
that we actually must iterate over for_each_possible_cpu(cpu) here to
prevent map boundary violations during CPU hotplug events.

If we restrict this loop to for_each_online_cpu(), any currently offline
CPU would be left with a default array value of 0 in qmap->mq_map[cpu].

For secondary queue maps (e.g., read or poll queues where
qmap->queue_offset > 0), leaving an offline CPU mapped to 0 is highly
dangerous. If that CPU comes online, it could silently route its I/O into
the primary/default hardware queue map before the hotplug state machine has
a chance to recalculate the mappings, no?

By mapping all possible CPUs to qmap->queue_offset, we guarantee that
unassigned or temporarily offline CPUs remain safely fenced within the
correct map boundaries, which I believe perfectly mirrors the safety
guarantee of the original fallback logic.


Kind regards,
-- 
Aaron Tomlin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH v4 02/12] block/bdev: Annotate the blk_holder_ops callback functions
From: Marco Elver @ 2026-05-13 23:06 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Nathan Chancellor, Peter Zijlstra, Jens Axboe, linux-block,
	Christoph Hellwig
In-Reply-To: <e6dbe36b-7bd3-4848-91e1-9c84d421e1ee@acm.org>

On Thu, 14 May 2026 at 00:14, Bart Van Assche <bvanassche@acm.org> wrote:
>
> On 5/13/26 6:36 AM, Nathan Chancellor wrote:
> > While doing a dynamic check is more expensive than a version check, I
> > would not worry much about that overhead if the check is worthwhile or
> > valuable. In this case, I tend to agree with you that it would just be
> > better to bump the minimum version of Clang required for context
> > analysis because of the improvements (other than the function pointer
> > support) that you have landed in main since release/22.x. While I am
> > always sad to see support for older compilers dropped, I don't think
> > clang-22 is widespread enough for that to really matter. On the other
> > hand, I do worry that if we do not have a wide enough window of
> > supported compilers for developers / maintainers to use, we won't be
> > able to uncover potential problems to address in the compiler (I feel
> > like getting __counted_by deployed was particular painful for this
> > reason), if that makes sense.
>
> It seems to me that increasing the required Clang version is the least
> controversial approach. If nobody objects I will start testing the patch
> below.

My patch which is more complete is still floating around:
https://lore.kernel.org/all/acqELlVC6vEeEF-W@elver.google.com/

Peter is probably still waiting for Debian to upgrade the clang dev version.

Thanks,
-- Marco

^ permalink raw reply

* Re: [PATCH v2 1/8] dt-bindings: mmc: Document support for nvmem-layout
From: Rob Herring @ 2026-05-13 22:42 UTC (permalink / raw)
  To: Loic Poulain
  Cc: Ulf Hansson, Krzysztof Kozlowski, Conor Dooley, Bjorn Andersson,
	Konrad Dybcio, Jens Axboe, Johannes Berg, Jeff Johnson,
	Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
	Balakrishna Godavarthi, Rocky Liao, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Srinivas Kandagatla,
	Andrew Lunn, Heiner Kallweit, Russell King, Saravana Kannan,
	linux-mmc, devicetree, linux-kernel, linux-arm-msm, linux-block,
	linux-wireless, ath10k, linux-bluetooth, netdev, daniel
In-Reply-To: <20260507-block-as-nvmem-v2-1-bf17edd5134e@oss.qualcomm.com>

On Thu, May 07, 2026 at 05:24:36PM +0200, Loic Poulain wrote:
> Add support for an nvmem-layout subnode under an eMMC hardware
> partition. This allows the partition to be exposed as an NVMEM
> provider and its internal layout to be described. For example,
> an eMMC boot partition can be used to store device-specific
> information such as a WiFi MAC address.
> 
> Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
> ---
>  .../devicetree/bindings/mmc/mmc-card.yaml          | 24 ++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.yaml b/Documentation/devicetree/bindings/mmc/mmc-card.yaml
> index a61d6c96df759102f9c1fbfd548b026a77921cae..b21426a49cf1d9aae5b4e8e447b5be11b08c96bf 100644
> --- a/Documentation/devicetree/bindings/mmc/mmc-card.yaml
> +++ b/Documentation/devicetree/bindings/mmc/mmc-card.yaml
> @@ -40,6 +40,9 @@ patternProperties:
>          contains:
>            const: fixed-partitions
>  
> +      nvmem-layout:
> +        $ref: /schemas/nvmem/layouts/nvmem-layout.yaml
> +
>  required:
>    - compatible
>    - reg
> @@ -86,6 +89,27 @@ examples:
>                      read-only;
>                  };
>              };
> +
> +            partitions-boot2 {

Shouldn't this have a 'fixed-partitions' compatible? I'm not sure if 
it's an oversight in the schema that 'compatible' is not required here. 
It would be odd that compatible is optional, but if it is present, it 
must contain 'fixed-partitions' compatible. A follow-up to fix that 
would be great.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>

Rob

^ permalink raw reply

* Re: [PATCH v4 02/12] block/bdev: Annotate the blk_holder_ops callback functions
From: Bart Van Assche @ 2026-05-13 22:13 UTC (permalink / raw)
  To: Nathan Chancellor, Marco Elver
  Cc: Peter Zijlstra, Jens Axboe, linux-block, Christoph Hellwig
In-Reply-To: <20260513133614.GA703152@ax162>

On 5/13/26 6:36 AM, Nathan Chancellor wrote:
> While doing a dynamic check is more expensive than a version check, I
> would not worry much about that overhead if the check is worthwhile or
> valuable. In this case, I tend to agree with you that it would just be
> better to bump the minimum version of Clang required for context
> analysis because of the improvements (other than the function pointer
> support) that you have landed in main since release/22.x. While I am
> always sad to see support for older compilers dropped, I don't think
> clang-22 is widespread enough for that to really matter. On the other
> hand, I do worry that if we do not have a wide enough window of
> supported compilers for developers / maintainers to use, we won't be
> able to uncover potential problems to address in the compiler (I feel
> like getting __counted_by deployed was particular painful for this
> reason), if that makes sense.

It seems to me that increasing the required Clang version is the least
controversial approach. If nobody objects I will start testing the patch
below.

Thanks,

Bart.

Subject: [PATCH] lib/Kconfig.debug: Require Clang 23 for context analysis

Context annotations for function pointers will be supported by Clang 23
but are not supported by Clang 22. Bump the minimum required Clang
version in preparation of annotating the blk_holder_ops function pointer
members.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
  lib/Kconfig.debug | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 8ff5adcfe1e0..5b5d1d183618 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -630,7 +630,7 @@ config DEBUG_FORCE_WEAK_PER_CPU

  config WARN_CONTEXT_ANALYSIS
  	bool "Compiler context-analysis warnings"
-	depends on CC_IS_CLANG && CLANG_VERSION >= 220100
+	depends on CC_IS_CLANG && CLANG_VERSION >= 230000
  	# Branch profiling re-defines "if", which messes with the compiler's
  	# ability to analyze __cond_acquires(..), resulting in false positives.
  	depends on !TRACE_BRANCH_PROFILING
@@ -641,7 +641,7 @@ config WARN_CONTEXT_ANALYSIS
  	  and releasing user-definable "context locks".

  	  Clang's name of the feature is "Thread Safety Analysis". Requires
-	  Clang 22.1.0 or later.
+	  Clang 23.0 or later.

  	  Produces warnings by default. Select CONFIG_WERROR if you wish to
  	  turn these warnings into errors.




^ permalink raw reply related

* [PATCH 7.2 1/2] blk-mq: introduce blk_rq_has_data()
From: Caleb Sander Mateos @ 2026-05-13 21:18 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe; +Cc: linux-block, linux-kernel, Caleb Sander Mateos
In-Reply-To: <20260513211846.1956810-1-csander@purestorage.com>

Add blk_rq_has_data(), an analogue of bio_has_data() for struct request.
This skips one dereference relative to bio_has_data(rq->bio).

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 include/linux/blk-mq.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 18a2388ba581..4349aefdbc87 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -1102,10 +1102,11 @@ struct req_iterator {
 		 bio_iter_last(bvec, _iter.iter))
 
 /*
  * blk_rq_pos()			: the current sector
  * blk_rq_bytes()		: bytes left in the entire request
+ * blk_rq_has_data()		: whether the request carries data
  * blk_rq_cur_bytes()		: bytes left in the current segment
  * blk_rq_sectors()		: sectors left in the entire request
  * blk_rq_cur_sectors()		: sectors left in the current segment
  * blk_rq_stats_sectors()	: sectors of the entire request used for stats
  */
@@ -1117,10 +1118,18 @@ static inline sector_t blk_rq_pos(const struct request *rq)
 static inline unsigned int blk_rq_bytes(const struct request *rq)
 {
 	return rq->__data_len;
 }
 
+static inline bool blk_rq_has_data(const struct request *rq)
+{
+	return blk_rq_bytes(rq) &&
+	       req_op(rq) != REQ_OP_DISCARD &&
+	       req_op(rq) != REQ_OP_SECURE_ERASE &&
+	       req_op(rq) != REQ_OP_WRITE_ZEROES;
+}
+
 static inline int blk_rq_cur_bytes(const struct request *rq)
 {
 	if (!rq->bio)
 		return 0;
 	if (!bio_has_data(rq->bio))	/* dataless requests such as discard */
-- 
2.54.0


^ permalink raw reply related

* [PATCH 7.2 2/2] ublk: optimize ublk_rq_has_data()
From: Caleb Sander Mateos @ 2026-05-13 21:18 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe; +Cc: linux-block, linux-kernel, Caleb Sander Mateos
In-Reply-To: <20260513211846.1956810-1-csander@purestorage.com>

ublk_rq_has_data() currently uses bio_has_data(), which involves 2
indirections and several branches. Use blk_rq_has_data() instead to save
an indirection and NULL check.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 drivers/block/ublk_drv.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 8e5f3738c203..4d7efc12247c 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1170,15 +1170,10 @@ static inline struct ublk_queue *ublk_get_queue(struct ublk_device *dev,
 		int qid)
 {
 	return dev->queues[qid];
 }
 
-static inline bool ublk_rq_has_data(const struct request *rq)
-{
-	return bio_has_data(rq->bio);
-}
-
 static inline struct ublksrv_io_desc *
 ublk_queue_cmd_buf(struct ublk_device *ub, int q_id)
 {
 	return ublk_get_queue(ub, q_id)->io_cmd_buf;
 }
@@ -1387,16 +1382,16 @@ static size_t ublk_copy_user_integrity(const struct request *req,
 }
 #endif /* #ifdef CONFIG_BLK_DEV_INTEGRITY */
 
 static inline bool ublk_need_map_req(const struct request *req)
 {
-	return ublk_rq_has_data(req) && req_op(req) == REQ_OP_WRITE;
+	return blk_rq_has_data(req) && req_op(req) == REQ_OP_WRITE;
 }
 
 static inline bool ublk_need_unmap_req(const struct request *req)
 {
-	return ublk_rq_has_data(req) &&
+	return blk_rq_has_data(req) &&
 	       (req_op(req) == REQ_OP_READ || req_op(req) == REQ_OP_DRV_IN);
 }
 
 static unsigned int ublk_map_io(const struct ublk_queue *ubq,
 				const struct request *req,
@@ -1506,11 +1501,11 @@ static blk_status_t ublk_setup_iod(struct ublk_queue *ubq, struct request *req)
 	iod->op_flags = ublk_op | ublk_req_build_flags(req);
 	iod->nr_sectors = blk_rq_sectors(req);
 	iod->start_sector = blk_rq_pos(req);
 
 	/* Try shmem zero-copy match before setting addr */
-	if (ublk_support_shmem_zc(ubq) && ublk_rq_has_data(req)) {
+	if (ublk_support_shmem_zc(ubq) && blk_rq_has_data(req)) {
 		u32 buf_idx, buf_off;
 
 		if (ublk_try_buf_match(ubq->dev, req,
 					  &buf_idx, &buf_off)) {
 			iod->op_flags |= UBLK_IO_F_SHMEM_ZC;
@@ -1796,11 +1791,11 @@ static void ublk_dispatch_req(struct ublk_queue *ubq, struct request *req)
 	}
 
 	if (!ublk_start_io(ubq, req, io))
 		return;
 
-	if (ublk_support_auto_buf_reg(ubq) && ublk_rq_has_data(req)) {
+	if (ublk_support_auto_buf_reg(ubq) && blk_rq_has_data(req)) {
 		ublk_auto_buf_dispatch(ubq, req, io, io->cmd, issue_flags);
 	} else {
 		ublk_init_req_ref(ubq, io);
 		ublk_complete_io_cmd(io, req, UBLK_IO_RES_OK, issue_flags);
 	}
@@ -1817,11 +1812,11 @@ static bool __ublk_batch_prep_dispatch(struct ublk_queue *ubq,
 	struct io_uring_cmd *cmd = data->cmd;
 
 	if (!ublk_start_io(ubq, req, io))
 		return false;
 
-	if (ublk_support_auto_buf_reg(ubq) && ublk_rq_has_data(req)) {
+	if (ublk_support_auto_buf_reg(ubq) && blk_rq_has_data(req)) {
 		res = ublk_auto_buf_register(ubq, req, io, cmd,
 				data->issue_flags);
 
 		if (res == AUTO_BUF_REG_FAIL)
 			return false;
@@ -3198,11 +3193,11 @@ ublk_daemon_register_io_buf(struct io_uring_cmd *cmd,
 	new_registered_buffers = io->task_registered_buffers + 1;
 	if (unlikely(new_registered_buffers >= UBLK_REFCOUNT_INIT))
 		return ublk_register_io_buf(cmd, ub, q_id, tag, io, index,
 					    issue_flags);
 
-	if (!ublk_dev_support_zero_copy(ub) || !ublk_rq_has_data(req))
+	if (!ublk_dev_support_zero_copy(ub) || !blk_rq_has_data(req))
 		return -EINVAL;
 
 	ret = io_buffer_register_bvec(cmd, req, ublk_io_release, index,
 				      issue_flags);
 	if (ret)
@@ -3481,11 +3476,11 @@ static inline struct request *__ublk_check_and_get_req(struct ublk_device *ub,
 		return NULL;
 
 	if (unlikely(!blk_mq_request_started(req) || req->tag != tag))
 		goto fail_put;
 
-	if (!ublk_rq_has_data(req))
+	if (!blk_rq_has_data(req))
 		goto fail_put;
 
 	return req;
 fail_put:
 	ublk_put_req_ref(io, req);
@@ -4054,11 +4049,11 @@ ublk_user_copy(struct kiocb *iocb, struct iov_iter *iter, int dir)
 		/* On daemon, io can't be completed concurrently, so skip ref */
 		if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV))
 			return -EINVAL;
 
 		req = io->req;
-		if (!ublk_rq_has_data(req))
+		if (!blk_rq_has_data(req))
 			return -EINVAL;
 	} else {
 		req = __ublk_check_and_get_req(ub, q_id, tag, io);
 		if (!req)
 			return -EINVAL;
-- 
2.54.0


^ permalink raw reply related

* [PATCH 7.2 0/2] ublk: optimize ublk_rq_has_data()
From: Caleb Sander Mateos @ 2026-05-13 21:18 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe; +Cc: linux-block, linux-kernel, Caleb Sander Mateos

ublk_rq_has_data() currently uses bio_has_data(), which involves 2
indirections and several branches. Introduce a blk_rq_has_data()
analogue for struct request and use it instead to save an indirection
and NULL check.

Caleb Sander Mateos (2):
  blk-mq: introduce blk_rq_has_data()
  ublk: optimize ublk_rq_has_data()

 drivers/block/ublk_drv.c | 21 ++++++++-------------
 include/linux/blk-mq.h   |  9 +++++++++
 2 files changed, 17 insertions(+), 13 deletions(-)

-- 
2.54.0


^ permalink raw reply

* Re: improve the swap_activate interface
From: Steve French @ 2026-05-13 20:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Andrew Morton, Chris Li, Kairui Song, Christian Brauner,
	Darrick J . Wong, Jens Axboe, David Sterba, Theodore Ts'o,
	Jaegeuk Kim, Chao Yu, Trond Myklebust, Anna Schumaker,
	Namjae Jeon, Hyunchul Lee, Steve French, Paulo Alcantara,
	Carlos Maiolino, Damien Le Moal, Naohiro Aota, linux-xfs,
	linux-fsdevel, linux-doc, linux-mm, linux-block, linux-btrfs,
	linux-ext4, linux-f2fs-devel, linux-nfs, linux-cifs
In-Reply-To: <20260512053625.2950900-1-hch@lst.de>

I just tried this on 7.1-rc3 with the swap patches (full kernel build,
on Ubuntu 25,10) and boot failed with out of memory which I had never
seen before.  Any idea how to workaround this with the swap patch
series, or is there a fix for this in the swap series already?

On Tue, May 12, 2026 at 12:41 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Hi all,
>
> Darrick recently posted iomap support for fuse-iomap, which was trivial
> but a bit ugly, which triggered me into looking how this could be done
> in a cleaner way.  The result of that is this fairly big series that
> reworks how the MM code calls into the file system to activate swap
> files to make it much cleaner and easier to use.
>
> I've tested this with swap devices manually, and using the swap tests
> in xfstests on btrfs, ext3, ext4, f2fs and xfs to exercise the different
> implementation.  Out of those all passed, but f2fs actually notruns all
> tests even in the baseline as it requires special preparation for
> swapfiles which never got wired up in xfstests.
>
> Diffstat:
>  Documentation/filesystems/iomap/operations.rst |    3
>  Documentation/filesystems/locking.rst          |   35 +--
>  Documentation/filesystems/vfs.rst              |   40 ++--
>  block/fops.c                                   |   15 +
>  fs/btrfs/btrfs_inode.h                         |    3
>  fs/btrfs/file.c                                |    4
>  fs/btrfs/inode.c                               |   72 -------
>  fs/ext4/file.c                                 |    6
>  fs/ext4/inode.c                                |   11 -
>  fs/f2fs/data.c                                 |   50 -----
>  fs/f2fs/f2fs.h                                 |    2
>  fs/f2fs/file.c                                 |    4
>  fs/iomap/swapfile.c                            |  165 +++---------------
>  fs/nfs/direct.c                                |    1
>  fs/nfs/file.c                                  |   21 --
>  fs/nfs/nfs4file.c                              |    3
>  fs/ntfs/aops.c                                 |    8
>  fs/ntfs/file.c                                 |    6
>  fs/smb/client/cifsfs.c                         |   18 +
>  fs/smb/client/cifsfs.h                         |    3
>  fs/smb/client/file.c                           |   16 -
>  fs/xfs/xfs_aops.c                              |   48 -----
>  fs/xfs/xfs_file.c                              |   39 ++++
>  fs/zonefs/file.c                               |   30 +--
>  include/linux/fs.h                             |   11 -
>  include/linux/iomap.h                          |    5
>  include/linux/nfs_fs.h                         |    3
>  include/linux/swap.h                           |  129 +-------------
>  mm/page_io.c                                   |   45 ----
>  mm/swap.h                                      |   92 ++++++++++
>  mm/swapfile.c                                  |  227 ++++++++++++++-----------
>  31 files changed, 471 insertions(+), 644 deletions(-)
>


-- 
Thanks,

Steve

^ permalink raw reply

* Re: fix block layer bounce buffering for block size > PAGE_SIZE v2
From: Jens Axboe @ 2026-05-13 19:56 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Christian Brauner, Darrick J. Wong, Pankaj Raghav, linux-block,
	linux-xfs, linux-fsdevel
In-Reply-To: <683792db-32fc-4765-9ba6-3712af01676c@kernel.dk>

On 5/13/26 11:15 AM, Jens Axboe wrote:
> On 5/6/26 11:01 PM, Christoph Hellwig wrote:
>> Hi all,
>>
>> this series has two fixes that make the new block layer bounce
>> buffering code work for the block size > PAGE_SIZE case.
>>
>> Changes since v1:
>>  - update a commit log to better describe the applicability
> 
> Can we get some Fixes tags on these, please?

Looked myself to not delay this any further, both marked with:

Fixes: 8dd5e7c75d7b ("block: add helpers to bounce buffer an iov_iter into bios")

-- 
Jens Axboe

^ permalink raw reply

* Re: fix block layer bounce buffering for block size > PAGE_SIZE v2
From: Jens Axboe @ 2026-05-13 19:55 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Christian Brauner, Darrick J. Wong, Pankaj Raghav, linux-block,
	linux-xfs, linux-fsdevel
In-Reply-To: <20260507050153.1298375-1-hch@lst.de>


On Thu, 07 May 2026 07:01:46 +0200, Christoph Hellwig wrote:
> this series has two fixes that make the new block layer bounce
> buffering code work for the block size > PAGE_SIZE case.
> 
> Changes since v1:
>  - update a commit log to better describe the applicability
> 
> Diffstat:
>  block/bio.c          |   27 +++++++++++++++------------
>  fs/iomap/direct-io.c |    2 +-
>  include/linux/bio.h  |    3 ++-
>  3 files changed, 18 insertions(+), 14 deletions(-)
> 
> [...]

Applied, thanks!

[1/2] block: pass a minsize argument to bio_iov_iter_bounce
      commit: 32d5019ed3b6ff4439cb075fb275f655c8a2059c
[2/2] block: align down bounces bios
      commit: e7b8b3c5b2a65595d506ffedafac66f0a11fbdc2

Best regards,
-- 
Jens Axboe




^ permalink raw reply

* [PATCH V4 3/3] nvme-multipath: enable PCI P2PDMA for multipath devices
From: Chaitanya Kulkarni @ 2026-05-13 18:51 UTC (permalink / raw)
  To: song, yukuai, linan122, kbusch, axboe, hch, sagi
  Cc: linux-block, linux-raid, linux-nvme, kmodukuri,
	Pranjal Shrivastava, Nitesh Shetty, Chaitanya Kulkarni
In-Reply-To: <20260513185153.95552-1-kch@nvidia.com>

From: Kiran Kumar Modukuri <kmodukuri@nvidia.com>

NVMe multipath does not expose BLK_FEAT_PCI_P2PDMA on the head disk
even when all underlying controllers support it.

Set BLK_FEAT_PCI_P2PDMA unconditionally in nvme_mpath_alloc_disk()
alongside the other features.  nvme_update_ns_info_block() already
calls queue_limits_stack_bdev() to stack each path's limits onto the
head disk, which routes through blk_stack_limits().  The core now
clears BLK_FEAT_PCI_P2PDMA automatically if any path (e.g., FC) does
not support it, consistent with how BLK_FEAT_NOWAIT and BLK_FEAT_POLL
are handled.

Tested-by: Pranjal Shrivastava<praan@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com>
Signed-off-by: Kiran Kumar Modukuri <kmodukuri@nvidia.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/nvme/host/multipath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 263161cb8ac0..ff442bbf2937 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -730,7 +730,7 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
 	blk_set_stacking_limits(&lim);
 	lim.dma_alignment = 3;
 	lim.features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT |
-		BLK_FEAT_POLL | BLK_FEAT_ATOMIC_WRITES;
+		BLK_FEAT_POLL | BLK_FEAT_ATOMIC_WRITES | BLK_FEAT_PCI_P2PDMA;
 	if (head->ids.csi == NVME_CSI_ZNS)
 		lim.features |= BLK_FEAT_ZONED;
 
-- 
2.39.5


^ permalink raw reply related

* [PATCH V4 2/3] md: propagate BLK_FEAT_PCI_P2PDMA from member devices to RAID device
From: Chaitanya Kulkarni @ 2026-05-13 18:51 UTC (permalink / raw)
  To: song, yukuai, linan122, kbusch, axboe, hch, sagi
  Cc: linux-block, linux-raid, linux-nvme, kmodukuri,
	Pranjal Shrivastava, Xiao Ni, Chaitanya Kulkarni
In-Reply-To: <20260513185153.95552-1-kch@nvidia.com>

From: Kiran Kumar Modukuri <kmodukuri@nvidia.com>

MD RAID does not propagate BLK_FEAT_PCI_P2PDMA from member devices to
the RAID device, preventing peer-to-peer DMA through the RAID layer even
when all underlying devices support it.

Enable BLK_FEAT_PCI_P2PDMA unconditionally in raid0, raid1 and raid10
personalities during queue limits setup.  blk_stack_limits() clears it
automatically if any member device lacks support, consistent with how
BLK_FEAT_NOWAIT and BLK_FEAT_POLL are handled in the block core.

Parity RAID personalities (raid4/5/6) are excluded because they require
CPU access to data pages for parity computation, which is incompatible
with P2P mappings.

Tested with RAID0/1/10 arrays containing multiple NVMe devices with
P2PDMA support, confirming that peer-to-peer transfers work correctly
through the RAID layer.

Tested-by: Pranjal Shrivastava<praan@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Kiran Kumar Modukuri <kmodukuri@nvidia.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/md/raid0.c  | 1 +
 drivers/md/raid1.c  | 1 +
 drivers/md/raid10.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 5e38a51e349a..2cdaf7495d92 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -392,6 +392,7 @@ static int raid0_set_limits(struct mddev *mddev)
 	lim.io_opt = lim.io_min * mddev->raid_disks;
 	lim.chunk_sectors = mddev->chunk_sectors;
 	lim.features |= BLK_FEAT_ATOMIC_WRITES;
+	lim.features |= BLK_FEAT_PCI_P2PDMA;
 	err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY);
 	if (err)
 		return err;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 64d970e2ef50..cc628a1be52c 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -3208,6 +3208,7 @@ static int raid1_set_limits(struct mddev *mddev)
 	lim.max_hw_wzeroes_unmap_sectors = 0;
 	lim.logical_block_size = mddev->logical_block_size;
 	lim.features |= BLK_FEAT_ATOMIC_WRITES;
+	lim.features |= BLK_FEAT_PCI_P2PDMA;
 	err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY);
 	if (err)
 		return err;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 39085e7dd6d2..f905dc391b74 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3941,6 +3941,7 @@ static int raid10_set_queue_limits(struct mddev *mddev)
 	lim.chunk_sectors = mddev->chunk_sectors;
 	lim.io_opt = lim.io_min * raid10_nr_stripes(conf);
 	lim.features |= BLK_FEAT_ATOMIC_WRITES;
+	lim.features |= BLK_FEAT_PCI_P2PDMA;
 	err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY);
 	if (err)
 		return err;
-- 
2.39.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox