From 3d460ec444940d50f4d87d023a660df31d7963bc Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Mon, 9 Jun 2025 20:58:41 +0900 Subject: [PATCH 1/2] adding ci files --- .github/workflows/kernel_build.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/kernel_build.yml diff --git a/.github/workflows/kernel_build.yml b/.github/workflows/kernel_build.yml new file mode 100644 index 0000000000000..cd0f9d145429c --- /dev/null +++ b/.github/workflows/kernel_build.yml @@ -0,0 +1,28 @@ +name: blktests-ci + +on: + pull_request: + +jobs: + build-kernel: + runs-on: ubuntu-latest + steps: + - name: Configure git + run: | + git config --global --add safe.directory '*' + - name: Checkout git + run: | + sudo apt-get install -y libelf-dev + mkdir -p linux + cd linux + git init + git remote add origin https://github.com/${{ github.repository }} + git fetch origin --depth=5 ${{ github.event.pull_request.head.sha }} + git reset --hard ${{ github.event.pull_request.head.sha }} + git log -1 + - name: Build kernel + run: | + cd linux + make defconfig + make -j 8 + From be154d9e7513bd43beca7a29ff7ce7a3abba5041 Mon Sep 17 00:00:00 2001 From: Nilay Shroff Date: Tue, 3 Jun 2025 16:57:55 +0530 Subject: [PATCH 2/2] block: fix atomic write limits for stacked devices The current logic applies the bottom device's atomic write limits to the stacked (top) device only if the top device does not support chunk sectors. However, this approach is too restrictive. We should also propagate the bottom device's atomic write limits to the stacked device if atomic_write_hw_unit_{min,max} of the bottom device are aligned with the top device's chunk size (io_min). Failing to do so may unnecessarily reduce the stacked device's atomic write limits to values much smaller than what the hardware can actually support. For example, on an NVMe disk with the following controller capability: $ nvme id-ctrl /dev/nvme1 | grep awupf awupf : 63 Without the patch applied, The bottom device (nvme1c1n1) atomic queue limits: $ /sys/block/nvme1c1n1/queue/atomic_write_boundary_bytes:0 $ /sys/block/nvme1c1n1/queue/atomic_write_max_bytes:262144 $ /sys/block/nvme1c1n1/queue/atomic_write_unit_max_bytes:262144 $ /sys/block/nvme1c1n1/queue/atomic_write_unit_min_bytes:4096 The top device (nvme1n1) atomic queue limits: $ /sys/block/nvme1n1/queue/atomic_write_boundary_bytes:0 $ /sys/block/nvme1n1/queue/atomic_write_max_bytes:4096 $ /sys/block/nvme1n1/queue/atomic_write_unit_max_bytes:4096 $ /sys/block/nvme1n1/queue/atomic_write_unit_min_bytes:4096 With this patch applied, The top device (nvme1n1) atomic queue limits: /sys/block/nvme1n1/queue/atomic_write_boundary_bytes:0 /sys/block/nvme1n1/queue/atomic_write_max_bytes:262144 /sys/block/nvme1n1/queue/atomic_write_unit_max_bytes:262144 /sys/block/nvme1n1/queue/atomic_write_unit_min_bytes:4096 This change ensures that the stacked device retains optimal atomic write capability when alignment permits, improving overall performance and correctness. Reported-by: Ojaswin Mujoo Fixes: d7f36dc446e8 ("block: Support atomic writes limits for stacked devices") Signed-off-by: Nilay Shroff --- block/blk-settings.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index a000daafbfb48..35c1354dd5aeb 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -598,8 +598,14 @@ static bool blk_stack_atomic_writes_head(struct queue_limits *t, !blk_stack_atomic_writes_boundary_head(t, b)) return false; - if (t->io_min <= SECTOR_SIZE) { - /* No chunk sectors, so use bottom device values directly */ + if (t->io_min <= SECTOR_SIZE || + (!(t->atomic_write_hw_unit_max % t->io_min) && + !(t->atomic_write_hw_unit_min % t->io_min))) { + /* + * If there are no chunk sectors, or if b->atomic_write_hw_unit + * _{min, max} are aligned to the chunk size (t->io_min), then + * use the bottom device's values directly. + */ t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max; t->atomic_write_hw_unit_min = b->atomic_write_hw_unit_min; t->atomic_write_hw_max = b->atomic_write_hw_max;