* [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64
@ 2026-12-02 3:16 Eric Curtin
2026-12-02 3:16 ` [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport Eric Curtin
2026-12-03 3:17 ` [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 sashiko-bot
0 siblings, 2 replies; 4+ messages in thread
From: Eric Curtin @ 2026-12-02 3:16 UTC (permalink / raw)
To: linux-kernel
Cc: Eric Curtin, Ryan Roberts, cgroups, dm-devel, linux-arm-kernel,
linux-block, linux-fsdevel, linux-ide, linux-mm, linux-mtd,
nvdimm, v9fs, virtualization
From: Eric Curtin <eric.curtin@docker.com>
This series is part of the boot-time page size selection work for arm64,
posted as RFC [1]. With CONFIG_ARM64_BOOT_TIME_PAGE_SIZE=y, PAGE_SIZE,
PAGE_SHIFT and PAGE_MASK are variables chosen at boot with arm64.pagesize=,
so code that needs a compile-time constant (array sizes, struct layouts,
static initialisers, BUILD_BUG_ON(), case labels, #if) has to use the new
PAGE_SIZE_MIN/PAGE_SIZE_MAX limits or a run-time value instead. For fixed
page sizes both limits equal PAGE_SIZE, so behaviour should not change.
The patches here convert block, MD, NVMe, SCSI, ATA, MTD and MMC code. They apply on top of the core series
[1], whose patch 1 adds PAGE_SIZE_MIN/MAX, and are otherwise independent
of each other. Patches authored by Ryan Roberts come from his v1 [2],
updated for v7.4-rc5. The full tree is at:
https://github.com/ericcurtin/linux/tree/boot-time-page-size-v2
Testing: allmodconfig with the option enabled builds cleanly on arm64
with all of these applied, and the defconfig kernel boots to userspace
with 4K, 16K and 64K pages under QEMU/KVM (details in [1]). The code in
this series is not otherwise exercised on hardware.
Tool use: these conversions were prepared with an LLM coding assistant
(opencode with Claude Sonnet), driven by build errors and followed by an
automated review pass. I have not hand-audited every patch, so please
review with that in mind and tell me where you would prefer a different
approach for your subsystem.
[1] https://lore.kernel.org/all/20261201015240.1017259-1-ericcurtin17@gmail.com/
[2] https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/
Eric Curtin (8):
scsi: core: Add dma_boundary_page for page-size DMA boundaries
mtd: mtdswap: Initialise mtdswap_ops with a page size variable
mmc: mmc_test: Allocate the scratch buffer with the test buffer
md: Remove compile-time PAGE_SIZE use in md, dm and bcache
zram: Remove PAGE_SIZE use in preprocessor conditionals
xen/blkback: Size indirect_pages for the largest page size
null_blk: Size the nullb_page bitmap for PAGE_SIZE_MAX
drbd: Use PAGE_SHIFT_MIN in preprocessor checks
Ryan Roberts (5):
nvme: Check the DSM range buffer against PAGE_SIZE_MIN
dm: Initialise swap_bios from the runtime PAGE_SIZE
virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport
ata: sata_sil24: Use flexible arrays for the command block SGEs
mm: Use PAGE_SIZE_MIN/MAX where a compile-time constant is required
^ permalink raw reply [flat|nested] 4+ messages in thread
* [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport
2026-12-02 3:16 [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 Eric Curtin
@ 2026-12-02 3:16 ` Eric Curtin
2026-12-03 3:17 ` sashiko-bot
2026-12-03 3:17 ` [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 sashiko-bot
1 sibling, 1 reply; 4+ messages in thread
From: Eric Curtin @ 2026-12-02 3:16 UTC (permalink / raw)
To: linux-kernel
Cc: Ryan Roberts, Michael S. Tsirkin, Jason Wang, Eugenio Pérez,
Xuan Zhuo, Paolo Bonzini, Stefan Hajnoczi, Jens Axboe,
David Hildenbrand, Eric Van Hensbergen, Latchesar Ionkov,
Dominique Martinet, Christian Schoenebeck, virtualization,
linux-block, v9fs
From: Ryan Roberts <ryan.roberts@arm.com>
With boot-time page size selection PAGE_SIZE is not a compile-time
constant.
- virtio_blk: check the serial_show() buffer size against PAGE_SIZE_MIN.
- virtio_balloon: check PAGE_SHIFT_MIN in page_to_balloon_pfn(), and
compare the new VIRTIO_BALLOON_PAGES_PER_PAGE_MAX, based on
PAGE_SIZE_MAX, with VIRTIO_BALLOON_ARRAY_PFNS_MAX in set_page_pfns().
Select the free page reporting order of 5 with a run-time
PAGE_SIZE == SZ_64K test on arm64, instead of
CONFIG_ARM64_64K_PAGES.
- 9p: define p9_virtio_trans with DEFINE_GLOBAL_PAGE_SIZE_VAR() so that
it is initialised at boot.
No functional change for compile-time page sizes.
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
drivers/block/virtio_blk.c | 2 +-
drivers/virtio/virtio_balloon.c | 10 ++++++----
net/9p/trans_virtio.c | 4 ++--
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 2b462005cdb6..c1b26c60ccfb 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -904,7 +904,7 @@ static ssize_t serial_show(struct device *dev,
int err;
/* sysfs gives us a PAGE_SIZE buffer */
- BUILD_BUG_ON(PAGE_SIZE < VIRTIO_BLK_ID_BYTES);
+ BUILD_BUG_ON(PAGE_SIZE_MIN < VIRTIO_BLK_ID_BYTES);
buf[VIRTIO_BLK_ID_BYTES] = '\0';
err = virtblk_get_id(disk, buf);
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 8c1b47ec17a2..a2c9429586fb 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -26,6 +26,7 @@
* page units.
*/
#define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned int)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)
+#define VIRTIO_BALLOON_PAGES_PER_PAGE_MAX (unsigned int)(PAGE_SIZE_MAX >> VIRTIO_BALLOON_PFN_SHIFT)
#define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256
/* Maximum number of (4k) pages to deflate on OOM notifications. */
#define VIRTIO_BALLOON_OOM_NR_PAGES 256
@@ -139,7 +140,7 @@ static u32 page_to_balloon_pfn(struct page *page)
{
unsigned long pfn = page_to_pfn(page);
- BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT);
+ BUILD_BUG_ON(PAGE_SHIFT_MIN < VIRTIO_BALLOON_PFN_SHIFT);
/* Convert pfn from Linux page size to balloon page size. */
return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE;
}
@@ -231,7 +232,7 @@ static void set_page_pfns(struct virtio_balloon *vb,
{
unsigned int i;
- BUILD_BUG_ON(VIRTIO_BALLOON_PAGES_PER_PAGE > VIRTIO_BALLOON_ARRAY_PFNS_MAX);
+ BUILD_BUG_ON(VIRTIO_BALLOON_PAGES_PER_PAGE_MAX > VIRTIO_BALLOON_ARRAY_PFNS_MAX);
/*
* Set balloon pfns pointing at this page.
@@ -1040,8 +1041,9 @@ static int virtballoon_probe(struct virtio_device *vdev)
* host's base page size. However, it needs more work to report
* that value. The hard-coded order would be fine currently.
*/
-#if defined(CONFIG_ARM64) && defined(CONFIG_ARM64_64K_PAGES)
- vb->pr_dev_info.order = 5;
+#if defined(CONFIG_ARM64)
+ if (PAGE_SIZE == SZ_64K)
+ vb->pr_dev_info.order = 5;
#endif
vb->pr_dev_info.capacity = capacity;
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 9fa63e3ebf67..181ed87f703f 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -795,7 +795,7 @@ static struct virtio_driver p9_virtio_drv = {
.remove = p9_virtio_remove,
};
-static struct p9_trans_module p9_virtio_trans = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct p9_trans_module, p9_virtio_trans, {
.name = "virtio",
.create = p9_virtio_create,
.close = p9_virtio_close,
@@ -814,7 +814,7 @@ static struct p9_trans_module p9_virtio_trans = {
.def = true,
.supports_vmalloc = false,
.owner = THIS_MODULE,
-};
+});
/* The standard init function */
static int __init p9_virtio_init(void)
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport
2026-12-02 3:16 ` [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport Eric Curtin
@ 2026-12-03 3:17 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-12-03 3:17 UTC (permalink / raw)
To: Eric Curtin; +Cc: virtualization, v9fs, Michael S. Tsirkin, Eugenio Perez
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] virtio: build failure due to undeclared PAGE_SIZE_MIN/MAX and
helpers
--
commit 372e817e66d93ec892d37cb53402e748098f17ae
Author: Ryan Roberts <ryan.roberts@arm.com>
virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport
This commit updates virtio_blk, virtio_balloon, and the 9p virtio
transport to avoid assuming PAGE_SIZE and PAGE_SHIFT are compile-time
constants.
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 2b462005cdb68..c1b26c60ccfb2 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -904,7 +904,7 @@ static ssize_t serial_show(struct device *dev,
> int err;
>
> /* sysfs gives us a PAGE_SIZE buffer */
> - BUILD_BUG_ON(PAGE_SIZE < VIRTIO_BLK_ID_BYTES);
> + BUILD_BUG_ON(PAGE_SIZE_MIN < VIRTIO_BLK_ID_BYTES);
>
> buf[VIRTIO_BLK_ID_BYTES] = '\0';
> err = virtblk_get_id(disk, buf);
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 8c1b47ec17a29..a2c9429586fb0 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -26,6 +26,7 @@
> * page units.
> */
> #define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned int)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)
> +#define VIRTIO_BALLOON_PAGES_PER_PAGE_MAX (unsigned int)(PAGE_SIZE_MAX >> VIRTIO_BALLOON_PFN_SHIFT)
> #define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256
> /* Maximum number of (4k) pages to deflate on OOM notifications. */
> #define VIRTIO_BALLOON_OOM_NR_PAGES 256
> @@ -139,7 +140,7 @@ static u32 page_to_balloon_pfn(struct page *page)
> {
> unsigned long pfn = page_to_pfn(page);
>
> - BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT);
> + BUILD_BUG_ON(PAGE_SHIFT_MIN < VIRTIO_BALLOON_PFN_SHIFT);
> /* Convert pfn from Linux page size to balloon page size. */
> return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE;
> }
> @@ -231,7 +232,7 @@ static void set_page_pfns(struct virtio_balloon *vb,
> {
> unsigned int i;
>
> - BUILD_BUG_ON(VIRTIO_BALLOON_PAGES_PER_PAGE > VIRTIO_BALLOON_ARRAY_PFNS_MAX);
> + BUILD_BUG_ON(VIRTIO_BALLOON_PAGES_PER_PAGE_MAX > VIRTIO_BALLOON_ARRAY_PFNS_MAX);
>
> /*
> * Set balloon pfns pointing at this page.
[ ... ]
> diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
> index 9fa63e3ebf673..181ed87f703fc 100644
> --- a/net/9p/trans_virtio.c
> +++ b/net/9p/trans_virtio.c
> @@ -795,7 +795,7 @@ static struct virtio_driver p9_virtio_drv = {
> .remove = p9_virtio_remove,
> };
>
> -static struct p9_trans_module p9_virtio_trans = {
> +static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct p9_trans_module, p9_virtio_trans, {
> .name = "virtio",
> .create = p9_virtio_create,
> .close = p9_virtio_close,
> @@ -814,7 +814,7 @@ static struct p9_trans_module p9_virtio_trans = {
> .def = true,
> .supports_vmalloc = false,
> .owner = THIS_MODULE,
> -};
> +});
[Severity: High]
Are the prerequisite definitions for PAGE_SIZE_MIN, PAGE_SIZE_MAX,
PAGE_SHIFT_MIN, and DEFINE_GLOBAL_PAGE_SIZE_VAR() missing from the tree?
None of these macros are defined in the kernel headers, so building
virtio_blk, virtio_balloon, or 9p virtio transport fails with undeclared
identifier and syntax errors.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031647.1690622-1-ericcurtin17@gmail.com?part=11
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64
2026-12-02 3:16 [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:16 ` [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport Eric Curtin
@ 2026-12-03 3:17 ` sashiko-bot
1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-12-03 3:17 UTC (permalink / raw)
To: Eric Curtin; +Cc: v9fs, virtualization, Michael S. Tsirkin, Eugenio Perez
Sashiko has finished reviewing this 13-patch series:
- Patch 3: no issues found.
- Patch 1 ("scsi: core: Add dma_boundary_page for page-size DMA..."): 2
potential issues (1 High, 1 Medium)
- Patch 2 ("mtd: mtdswap: Initialise mtdswap_ops with a page siz..."): 1
potential issue (1 High)
- Patch 4 ("md: Remove compile-time PAGE_SIZE use in md, dm and..."): 1
potential issue (1 High)
- Patch 5 ("zram: Remove PAGE_SIZE use in preprocessor conditionals"): 1
potential issue (1 High)
- Patch 6 ("xen/blkback: Size indirect_pages for the largest pag..."): 1
potential issue (1 High)
- Patch 7 ("null_blk: Size the nullb_page bitmap for PAGE_SIZE_MAX"): 1
potential issue (1 High)
- Patch 8 ("drbd: Use PAGE_SHIFT_MIN in preprocessor checks"): 1
potential issue (1 High)
- Patch 9 ("nvme: Check the DSM range buffer against PAGE_SIZE_MIN"): 1
potential issue (1 High)
- Patch 10 ("dm: Initialise swap_bios from the runtime PAGE_SIZE"): 1
potential issue (1 High)
- Patch 11 ("virtio: Handle boot-time PAGE_SIZE in balloon, blk a..."):
1 potential issue (1 High)
- Patch 12 ("ata: sata_sil24: Use flexible arrays for the command..."):
1 potential issue (1 High)
- Patch 13 ("mm: Use PAGE_SIZE_MIN/MAX where a compile-time const..."):
4 potential issues (1 High, 3 Medium)
Detailed reviews have been sent as separate replies to patches 1, 2, and
4-13.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031647.1690622-1-ericcurtin17@gmail.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-03 3:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 3:16 [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:16 ` [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport Eric Curtin
2026-12-03 3:17 ` sashiko-bot
2026-12-03 3:17 ` [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox