Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Support for Multiple Atomicity Mode
@ 2026-12-03 18:56 Daniel Gomez
  2026-12-03 18:56 ` [PATCH 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI Daniel Gomez
  2026-12-03 18:56 ` [PATCH 2/2] nvme: enable multiple atomicity mode Daniel Gomez
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Gomez @ 2026-12-03 18:56 UTC (permalink / raw)
  To: Jens Axboe, Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: linux-block, linux-kernel, linux-nvme, Andres Freund,
	Pankaj Raghav, Arthur Simchaev, Daniel Gomez, GOST, Daniel Gomez

NVMe has 2 atomic modes: Single Atomicity Mode (SAM) and Multiple
Atomicity Mode (MAM). In SAM mode, as per spec, commands that cross
the atomic boundaries may or may not be guaranteed to be atomic. In MAM
mode, commands that cross the atomic boundaries will be guaranteed to
be atomic at the LBA subrange atomic boundaries, resulting in multiple
atomic operations.

This series adds a new block layer feature BLK_FEAT_ATOMIC_WRITE_MULTI
that gets enabled when an NVMe controller exposes MAM guarantees. In
this case, and when the block IO requests are SAM compliant, allow
the block layer to merge atomic command requests that are contiguous
in the LBA ranges, leveraging block plug-merge infra, and effectively
increasing the size of the command up to the maximum hardware
capabilities. The merged command is not atomic as a whole, so it becomes
a carrier of multiple atomic commands. This is possible because the
RWF_ATOMIC that the user has requested is honored at the LBA subrange
later at the controller side when the carrier command is split at the
atomic boundaries.

MAM QEMU NVMe series [1] covers emulation functionality for testing.

How to expose MAM to users is left as follow-up. Early suggestions can
be found in the RFC [2].

I've also tested on hardware with MAM support, with fio sequential
atomic writes of 16 KiB through io_uring:

fio --name=atomic-write-max --filename=/dev/nvme0n1 \
  --rw=write --bs=16k \
  --ioengine=io_uring \
  --iodepth=$((16 * D)) --iodepth_batch_submit=16 \
  --iodepth_batch_complete_min=16 \
  --atomic=1 --direct=1 \
  --time_based --ramp_time=10 --runtime=120 \
  --numjobs=N

* Merged atomics have now parity with plain writes: throughput, latency
and command count.
* Fewer commands for the same amount of data. E.g. 16x with 256 KiB
commands.
* +1.6% throughput when the link is not saturated (1 job, 2 CPUs).
* Up to +0.6% throughput when the link is saturated (48 jobs).
* p99 latency at least 2.3x lower at queue depth 4 and up.
* 36% less CPU time at queue depth 16, mostly from interrupt handling.
* No change for plain writes, or for atomic writes that do not merge.

Command line logs covering functionality with nvme-cli, fio and
blktrace:

nvme id-ns -H /dev/nvme0n1
NVME Identify Namespace 1:
{..}
nsfeat  : 0x76
  [7:7] : 0     NPRG, NPRA and NORS are Not Supported
  [6:6] : 0x1   Multiple Atomicity Mode applies to write operations
  [5:4] : 0x3   NPWG, NPWA, NPDG, NPDGL, NPDA, and NOWS are Supported
{..}

Sequential atomic write workflows can benefit from the block layer
plug-merge as the following fio atomic write workload:

fio --name=atomic-merge --filename=/dev/nvme0n1 \
  --rw=write --bs=16k --size=64k \
  --ioengine=io_uring \
  --iodepth=4 --iodepth_batch_submit=4 \
  --atomic=1 --direct=1

The output below from btrace confirms the merging results into one
single command:

btrace /dev/nvme0n1
259,2    3        1     0.000000000  2725  Q  WS 0 + 32 [fio]
259,2    3        2     0.000003450  2725  G  WS 0 + 32 [fio]
259,2    3        3     0.000004250  2725  P   N [fio]
259,2    3        4     0.000005440  2725  Q  WS 32 + 32 [fio]
259,2    3        5     0.000006400  2725  M  WS 32 + 32 [fio]
259,2    3        6     0.000007360  2725  Q  WS 64 + 32 [fio]
259,2    3        7     0.000007490  2725  M  WS 64 + 32 [fio]
259,2    3        8     0.000008340  2725  Q  WS 96 + 32 [fio]
259,2    3        9     0.000008460  2725  M  WS 96 + 32 [fio]
259,2    3       10     0.000009270  2725  U   N [fio] 1
259,2    3       11     0.000013460  2725  D  WS 0 + 128 [fio]
259,2    3       12     0.000239642     0  C  WS 0 + 128 [0]

Also tested with QEMU [1], with and without multipath. Under multipath,
the four writes of the fio atomic-merge job above reach one path as a
single command, as on a single-path namespace:

  /sys/block/nvme2c2n1/stat writes=1 merges=3

Link: https://lore.kernel.org/all/20260825-nvme-mam-v1-0-afc38ac713ef@samsung.com/ [1]

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Changes in v1:
- Drop RFC and update cover letter as well as commit messages.
- block: say what REQ_ATOMIC means on a merged request (Arthur).
- block: add queue/atomic_write_multi (Arthur).
- nvme: set the flag on the multipath head.
- nvme: validate each bio of a merged request (Arthur).
- nvme: require NABSN, NAWUN, NABSPF and NAWUPF alike (Arthur).
- nvme: warn for each namespace, with the four values (Arthur).
- Link to RFC: https://patch.msgid.link/20260929-nvme-mam-v1-0-48dcbe79cece@samsung.com [2]

---
Daniel Gomez (2):
      block: add BLK_FEAT_ATOMIC_WRITE_MULTI
      nvme: enable multiple atomicity mode

 Documentation/ABI/stable/sysfs-block | 13 ++++++-
 block/blk-merge.c                    |  9 ++++-
 block/blk-settings.c                 |  5 +++
 block/blk-sysfs.c                    |  3 ++
 block/blk.h                          |  6 ++-
 drivers/nvme/host/core.c             | 74 ++++++++++++++++++++++++++++++------
 include/linux/blk_types.h            |  2 +-
 include/linux/blkdev.h               |  7 ++++
 include/linux/nvme.h                 |  1 +
 9 files changed, 104 insertions(+), 16 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20260929-nvme-mam-073f2ed13bdc

Best regards,
--  
Daniel Gomez <da.gomez@samsung.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI
  2026-12-03 18:56 [PATCH 0/2] Support for Multiple Atomicity Mode Daniel Gomez
@ 2026-12-03 18:56 ` Daniel Gomez
  2026-12-03 19:19   ` sashiko-bot
  2026-12-03 18:56 ` [PATCH 2/2] nvme: enable multiple atomicity mode Daniel Gomez
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Gomez @ 2026-12-03 18:56 UTC (permalink / raw)
  To: Jens Axboe, Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: linux-block, linux-kernel, linux-nvme, Andres Freund,
	Pankaj Raghav, Arthur Simchaev, Daniel Gomez, GOST, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Add a feature flag that allows the block layer to merge atomic write
commands into larger ones that are not atomic as a whole but are later
divided by the device at the atomic write boundaries, with each subrange
treated as atomic. NVMe calls this Multiple Atomicity Mode (MAM).

When the flag is set, stop limiting merged atomic writes at
the atomic write boundary and cap them at max(max_sectors,
atomic_write_max_sectors). Each individual atomic write still fits one
boundary window and every window is written atomically by the device, so
each merged write stays untorn.

The feature flag can only be enabled when an atomic write boundary
is set.

Show it as queue/atomic_write_multi, so users can tell whether atomic
writes merge across the boundary.

No consumer yet, so no behavior changes.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 Documentation/ABI/stable/sysfs-block | 13 ++++++++++++-
 block/blk-merge.c                    |  9 ++++++++-
 block/blk-settings.c                 |  5 +++++
 block/blk-sysfs.c                    |  3 +++
 block/blk.h                          |  6 +++++-
 include/linux/blk_types.h            |  2 +-
 include/linux/blkdev.h               |  7 +++++++
 7 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block
index 900b3fc4c72d0..19d9c250371f2 100644
--- a/Documentation/ABI/stable/sysfs-block
+++ b/Documentation/ABI/stable/sysfs-block
@@ -72,7 +72,18 @@ Description:
 		power-of-two and at least the size as in
 		atomic_write_unit_max_bytes.
 		Any attempt to merge atomic write I/Os must not result in a
-		merged I/O which crosses this boundary (if any).
+		merged I/O which crosses this boundary (if any), unless
+		atomic_write_multi is 1.
+
+
+What:		/sys/block/<disk>/queue/atomic_write_multi
+Date:		November 2026
+Contact:	Daniel Gomez <da.gomez@samsung.com>
+Description:
+		[RO] 1 if the device writes each atomic write boundary window
+		of an I/O atomically. Contiguous atomic writes may then be
+		merged across atomic_write_boundary_bytes. Each write remains
+		atomic, but the merged I/O as a whole does not. 0 otherwise.
 
 
 What:		/sys/block/<disk>/diskseq
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 501ddc01c4499..30c5845dbe558 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -575,7 +575,14 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
 	struct request_queue *q = rq->q;
 	struct queue_limits *lim = &q->limits;
 	unsigned int max_sectors, boundary_sectors;
-	bool is_atomic = rq->cmd_flags & REQ_ATOMIC;
+	/*
+	 * The merged command is itself one atomic write and must not cross the
+	 * atomic write boundary. But in the BLK_FEAT_ATOMIC_WRITE_MULTI case,
+	 * the device writes each boundary window atomically, so its merged
+	 * commands are not atomic as a whole and may cross the boundary.
+	 */
+	bool is_atomic = (rq->cmd_flags & REQ_ATOMIC) &&
+			 !(lim->features & BLK_FEAT_ATOMIC_WRITE_MULTI);
 
 	if (blk_rq_is_passthrough(rq))
 		return q->limits.max_hw_sectors;
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 1f5ee2453269f..f0488dedb0b80 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -309,6 +309,10 @@ static void blk_validate_atomic_write_limits(struct queue_limits *lim)
 
 	boundary_sectors = lim->atomic_write_hw_boundary >> SECTOR_SHIFT;
 
+	if (WARN_ON_ONCE((lim->features & BLK_FEAT_ATOMIC_WRITE_MULTI) &&
+			 !boundary_sectors))
+		lim->features &= ~BLK_FEAT_ATOMIC_WRITE_MULTI;
+
 	if (boundary_sectors) {
 		if (WARN_ON_ONCE(lim->atomic_write_hw_max >
 				 lim->atomic_write_hw_boundary))
@@ -333,6 +337,7 @@ static void blk_validate_atomic_write_limits(struct queue_limits *lim)
 	return;
 
 unsupported:
+	lim->features &= ~BLK_FEAT_ATOMIC_WRITE_MULTI;
 	lim->atomic_write_max_sectors = 0;
 	lim->atomic_write_boundary_sectors = 0;
 	lim->atomic_write_unit_min = 0;
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 520972676ab46..f92de9ad86ec5 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -369,6 +369,7 @@ static ssize_t queue_##_name##_show(struct gendisk *disk, char *page)	\
 
 QUEUE_SYSFS_FEATURE_SHOW(fua, BLK_FEAT_FUA);
 QUEUE_SYSFS_FEATURE_SHOW(dax, BLK_FEAT_DAX);
+QUEUE_SYSFS_FEATURE_SHOW(atomic_write_multi, BLK_FEAT_ATOMIC_WRITE_MULTI);
 
 static ssize_t queue_poll_show(struct gendisk *disk, char *page)
 {
@@ -637,6 +638,7 @@ QUEUE_LIM_RO_ENTRY(queue_atomic_write_boundary_sectors,
 		"atomic_write_boundary_bytes");
 QUEUE_LIM_RO_ENTRY(queue_atomic_write_unit_max, "atomic_write_unit_max_bytes");
 QUEUE_LIM_RO_ENTRY(queue_atomic_write_unit_min, "atomic_write_unit_min_bytes");
+QUEUE_LIM_RO_ENTRY(queue_atomic_write_multi, "atomic_write_multi");
 
 QUEUE_RO_ENTRY(queue_write_same_max, "write_same_max_bytes");
 QUEUE_LIM_RO_ENTRY(queue_max_write_zeroes_sectors, "write_zeroes_max_bytes");
@@ -757,6 +759,7 @@ static const struct attribute *const queue_attrs[] = {
 	&queue_atomic_write_boundary_sectors_entry.attr,
 	&queue_atomic_write_unit_min_entry.attr,
 	&queue_atomic_write_unit_max_entry.attr,
+	&queue_atomic_write_multi_entry.attr,
 	&queue_max_write_zeroes_sectors_entry.attr,
 	&queue_max_hw_wzeroes_unmap_sectors_entry.attr,
 	&queue_max_wzeroes_unmap_sectors_entry.attr,
diff --git a/block/blk.h b/block/blk.h
index 105fff157bfbd..61e3f918114e8 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -241,8 +241,12 @@ static inline unsigned int blk_queue_get_max_sectors(struct request *rq)
 	if (unlikely(op == REQ_OP_WRITE_ZEROES))
 		return q->limits.max_write_zeroes_sectors;
 
-	if (rq->cmd_flags & REQ_ATOMIC)
+	if (rq->cmd_flags & REQ_ATOMIC) {
+		if (q->limits.features & BLK_FEAT_ATOMIC_WRITE_MULTI)
+			return max(q->limits.max_sectors,
+				   q->limits.atomic_write_max_sectors);
 		return q->limits.atomic_write_max_sectors;
+	}
 
 	return q->limits.max_sectors;
 }
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 1a5812fa40529..2a006f759dd3b 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -407,7 +407,7 @@ enum req_flag_bits {
 	__REQ_SWAP,		/* swap I/O */
 	__REQ_DRV,		/* for driver use */
 	__REQ_FS_PRIVATE,	/* for file system (submitter) use */
-	__REQ_ATOMIC,		/* for atomic write operations */
+	__REQ_ATOMIC,		/* for atomic write operations or carriers */
 	__REQ_DMABUF,		/* Using premmaped dma buffers */
 	/*
 	 * Command specific flags, keep last:
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 215753171cef0..6c6b445bfa381 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -360,6 +360,13 @@ typedef unsigned int __bitwise blk_features_t;
 #define BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE \
 	((__force blk_features_t)(1u << 15))
 
+/*
+ * Device writes each atomic write boundary window of a command atomically. A
+ * merged REQ_ATOMIC request is then an atomic carrier command: one atomic write
+ * per bio, not atomic as a whole. Needs a non-zero atomic_write_hw_boundary.
+ */
+#define BLK_FEAT_ATOMIC_WRITE_MULTI	((__force blk_features_t)(1u << 16))
+
 /*
  * Flags automatically inherited when stacking limits.
  */

-- 
2.56.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] nvme: enable multiple atomicity mode
  2026-12-03 18:56 [PATCH 0/2] Support for Multiple Atomicity Mode Daniel Gomez
  2026-12-03 18:56 ` [PATCH 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI Daniel Gomez
@ 2026-12-03 18:56 ` Daniel Gomez
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Gomez @ 2026-12-03 18:56 UTC (permalink / raw)
  To: Jens Axboe, Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: linux-block, linux-kernel, linux-nvme, Andres Freund,
	Pankaj Raghav, Arthur Simchaev, Daniel Gomez, GOST, Daniel Gomez

From: Daniel Gomez <da.gomez@samsung.com>

Add support for Multiple Atomicity Mode (MAM), a superset of Single
Atomicity Mode (SAM) where the controller divides a write command that
crosses the atomic boundaries into per-window atomic writes. Honoring
the mode lets contiguous atomic writes merge past the atomic unit
limits.

Set BLK_FEAT_ATOMIC_WRITE_MULTI when the namespace reports MAM (bit 6 of
NSFEAT) and its atomic parameters are compliant (as per NVM Command Set
specification since revision 1.1, section 2.1.4.5); otherwise warn and
fall back to SAM. Derive the flag again on every scan.

Set it on the multipath head too. Requests merge on a path's queue, but
the head is the disk users see, and stacking the limits does not carry
the flag.

A merged request may exceed the atomic unit and cross boundaries, so
validate each of its bios and not the request as a whole.

While here, rewrite the comment of nvme_valid_atomic_write() to cover
both modes, and correct the SAM description.

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
 drivers/nvme/host/core.c | 74 ++++++++++++++++++++++++++++++++++++++++--------
 include/linux/nvme.h     |  1 +
 2 files changed, 63 insertions(+), 12 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f43582e5f6c4a..89e3e2dcc29f6 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -983,27 +983,21 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
 	return BLK_STS_OK;
 }
 
-/*
- * NVMe does not support a dedicated command to issue an atomic write. A write
- * which does adhere to the device atomic limits will silently be executed
- * non-atomically. The request issuer should ensure that the write is within
- * the queue atomic writes limits, but just validate this in case it is not.
- */
-static bool nvme_valid_atomic_write(struct request *req)
+static bool nvme_atomic_write_fits(struct request_queue *q, sector_t sector,
+				   unsigned int bytes)
 {
-	struct request_queue *q = req->q;
 	u32 boundary_bytes = queue_atomic_write_boundary_bytes(q);
 
-	if (blk_rq_bytes(req) > queue_atomic_write_unit_max_bytes(q))
+	if (bytes > queue_atomic_write_unit_max_bytes(q))
 		return false;
 
 	if (boundary_bytes) {
 		u64 mask = boundary_bytes - 1, imask = ~mask;
-		u64 start = blk_rq_pos(req) << SECTOR_SHIFT;
-		u64 end = start + blk_rq_bytes(req) - 1;
+		u64 start = sector << SECTOR_SHIFT;
+		u64 end = start + bytes - 1;
 
 		/* If greater then must be crossing a boundary */
-		if (blk_rq_bytes(req) > boundary_bytes)
+		if (bytes > boundary_bytes)
 			return false;
 
 		if ((start & imask) != (end & imask))
@@ -1013,6 +1007,36 @@ static bool nvme_valid_atomic_write(struct request *req)
 	return true;
 }
 
+/*
+ * NVMe has two atomicity modes, Single (SAM) and Multiple (MAM), and neither
+ * has a dedicated command to issue an atomic write. In SAM, a write which does
+ * not adhere to the device atomic limits will silently be executed
+ * non-atomically. In MAM, such a write is executed atomically within each
+ * atomic boundary window, but not as a whole. The request issuer should ensure
+ * that the write is within the queue atomic writes limits, but just validate
+ * this in case it is not.
+ *
+ * In MAM a request may carry several merged atomic writes, one per bio. Such
+ * a request may exceed the limits as a whole, so validate each bio instead.
+ */
+static bool nvme_valid_atomic_write(struct request *req)
+{
+	struct request_queue *q = req->q;
+	struct bio *bio;
+
+	if (!(q->limits.features & BLK_FEAT_ATOMIC_WRITE_MULTI))
+		return nvme_atomic_write_fits(q, blk_rq_pos(req),
+					      blk_rq_bytes(req));
+
+	__rq_for_each_bio(bio, req) {
+		if (!nvme_atomic_write_fits(q, bio->bi_iter.bi_sector,
+					    bio->bi_iter.bi_size))
+			return false;
+	}
+
+	return true;
+}
+
 static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
 		struct request *req, struct nvme_command *cmnd,
 		enum nvme_opcode op)
@@ -2039,12 +2063,24 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
 	}
 }
 
+/*
+ * NVM Command Set specification, section 2.1.4.5, since revision 1.1: a
+ * namespace in Multiple Atomicity Mode that reports its own atomic parameters
+ * set these four alike.
+ */
+static bool nvme_mam_compliant(struct nvme_id_ns *id)
+{
+	return id->nabsn == id->nawun && id->nawun == id->nabspf &&
+	       id->nabspf == id->nawupf;
+}
 
 static u32 nvme_configure_atomic_write(struct nvme_ns *ns,
 		struct nvme_id_ns *id, struct queue_limits *lim, u32 bs)
 {
 	u32 atomic_bs, boundary = 0;
 
+	lim->features &= ~BLK_FEAT_ATOMIC_WRITE_MULTI;
+
 	/*
 	 * We do not support an offset for the atomic boundaries.
 	 */
@@ -2058,6 +2094,18 @@ static u32 nvme_configure_atomic_write(struct nvme_ns *ns,
 		atomic_bs = (1 + le16_to_cpu(id->nawupf)) * bs;
 		if (id->nabspf)
 			boundary = (le16_to_cpu(id->nabspf) + 1) * bs;
+
+		if (id->nsfeat & NVME_NS_FEAT_MAM) {
+			if (nvme_mam_compliant(id))
+				lim->features |= BLK_FEAT_ATOMIC_WRITE_MULTI;
+			else
+				dev_warn(ns->ctrl->device,
+					 "nsid %u: inconsistent MAM parameters, ignoring (NABSN %u NAWUN %u NABSPF %u NAWUPF %u)\n",
+					 ns->head->ns_id, le16_to_cpu(id->nabsn),
+					 le16_to_cpu(id->nawun),
+					 le16_to_cpu(id->nabspf),
+					 le16_to_cpu(id->nawupf));
+		}
 	} else {
 		if (ns->ctrl->awupf)
 			dev_info_once(ns->ctrl->device,
@@ -2607,6 +2655,8 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info)
 		lim.physical_block_size = ns_lim->physical_block_size;
 		lim.io_min = ns_lim->io_min;
 		lim.io_opt = ns_lim->io_opt;
+		lim.features &= ~BLK_FEAT_ATOMIC_WRITE_MULTI;
+		lim.features |= ns_lim->features & BLK_FEAT_ATOMIC_WRITE_MULTI;
 		queue_limits_stack_bdev(&lim, ns->disk->part0, 0,
 					ns->head->disk->disk_name);
 		if (lim.features & BLK_FEAT_ZONED)
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 6248711784b37..9be049d3d6100 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -602,6 +602,7 @@ enum {
 	NVME_NS_FEAT_OPTPERF_MASK = 0x1,
 	/* Since version 2.1, OPTPERF is bits 4 and 5 of NSFEAT */
 	NVME_NS_FEAT_OPTPERF_MASK_2_1 = 0x3,
+	NVME_NS_FEAT_MAM	= 1 << 6,
 	NVME_NS_ATTR_RO		= 1 << 0,
 	NVME_NS_FLBAS_LBA_MASK	= 0xf,
 	NVME_NS_FLBAS_LBA_UMASK	= 0x60,

-- 
2.56.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI
  2026-12-03 18:56 ` [PATCH 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI Daniel Gomez
@ 2026-12-03 19:19   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-12-03 19:19 UTC (permalink / raw)
  To: Daniel Gomez; +Cc: linux-nvme

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] block: sysfs-block ABI doc for atomic_write_max_bytes misses
  multi mode
--

commit 933475a4987a9fdd84696702ee1bb3f36b7c3022
Author: Daniel Gomez <da.gomez@samsung.com>

block: add BLK_FEAT_ATOMIC_WRITE_MULTI

This commit adds the BLK_FEAT_ATOMIC_WRITE_MULTI queue feature flag and
exposes it via queue/atomic_write_multi in sysfs. When enabled, merged
REQ_ATOMIC requests are no longer limited at atomic_write_boundary_sectors
and may grow up to max(max_sectors, atomic_write_max_sectors).

> diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block
> index 900b3fc4c72d0..19d9c250371f2 100644
> --- a/Documentation/ABI/stable/sysfs-block
> +++ b/Documentation/ABI/stable/sysfs-block
> @@ -72,7 +72,18 @@ Description:
>  		power-of-two and at least the size as in
>  		atomic_write_unit_max_bytes.
>  		Any attempt to merge atomic write I/Os must not result in a
> -		merged I/O which crosses this boundary (if any).
> +		merged I/O which crosses this boundary (if any), unless
> +		atomic_write_multi is 1.
> +
> +
> +What:		/sys/block/<disk>/queue/atomic_write_multi
> +Date:		November 2026
> +Contact:	Daniel Gomez <da.gomez@samsung.com>
> +Description:
> +		[RO] 1 if the device writes each atomic write boundary window
> +		of an I/O atomically. Contiguous atomic writes may then be
> +		merged across atomic_write_boundary_bytes. Each write remains
> +		atomic, but the merged I/O as a whole does not. 0 otherwise.

[Severity: Low]
Should the atomic_write_max_bytes entry earlier in
Documentation/ABI/stable/sysfs-block also be updated for
atomic_write_multi?

That entry still states unconditionally that "a merged atomic write
operation must not exceed this number of bytes", whereas
blk_queue_get_max_sectors() in block/blk.h now allows merged REQ_ATOMIC
requests up to max(max_sectors, atomic_write_max_sectors) when
BLK_FEAT_ATOMIC_WRITE_MULTI is set.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-nvme-mam-v1-0-edad0281b1f7@samsung.com?part=1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-03 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 18:56 [PATCH 0/2] Support for Multiple Atomicity Mode Daniel Gomez
2026-12-03 18:56 ` [PATCH 1/2] block: add BLK_FEAT_ATOMIC_WRITE_MULTI Daniel Gomez
2026-12-03 19:19   ` sashiko-bot
2026-12-03 18:56 ` [PATCH 2/2] nvme: enable multiple atomicity mode Daniel Gomez

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