* [PATCH blktests] Fix _get_page_size()
@ 2026-06-18 14:41 Jeff Moyer
2026-06-20 1:26 ` Shin'ichiro Kawasaki
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Moyer @ 2026-06-18 14:41 UTC (permalink / raw)
To: linux-block, shinichiro.kawasaki
There is no CONFIG_PAGE_SHIFT stored in /boot/config-`uname -r` on RHEL
systems (maybe all systems?). As a result, tests that make use of
_get_page_size() were doing the wrong thing. For example, throtl/002
used it to calculate I/O sizes for direct IO. Those sizes ended up not
being a multiple of the logical block size, and hence throtl/002 was
failing.
Fixes: 8eca9fa ("common/rc, scsi/011, zbd/010: introduce _page_size_equals() helper")
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/common/rc b/common/rc
index 20f7c7a..d60a125 100644
--- a/common/rc
+++ b/common/rc
@@ -562,13 +562,8 @@ _have_systemctl_unit() {
return 0
}
-# Get system page size from kernel conguration
_get_page_size() {
- local page_shift
-
- page_shift=$(_get_kernel_option PAGE_SHIFT)
-
- echo $((1<< page_shift))
+ getconf PAGE_SIZE
}
# Check if the system page size matches the required size (in bytes).
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH blktests] Fix _get_page_size() 2026-06-18 14:41 [PATCH blktests] Fix _get_page_size() Jeff Moyer @ 2026-06-20 1:26 ` Shin'ichiro Kawasaki 2026-06-20 3:55 ` Bart Van Assche 0 siblings, 1 reply; 5+ messages in thread From: Shin'ichiro Kawasaki @ 2026-06-20 1:26 UTC (permalink / raw) To: Jeff Moyer; +Cc: linux-block, osandov, kch CC+: Omar, Chaitanya, On Jun 18, 2026 / 10:41, Jeff Moyer wrote: > There is no CONFIG_PAGE_SHIFT stored in /boot/config-`uname -r` on RHEL > systems (maybe all systems?). As a result, tests that make use of > _get_page_size() were doing the wrong thing. For example, throtl/002 > used it to calculate I/O sizes for direct IO. Those sizes ended up not > being a multiple of the logical block size, and hence throtl/002 was > failing. > > Fixes: 8eca9fa ("common/rc, scsi/011, zbd/010: introduce _page_size_equals() helper") > Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Thanks for finding this out. When I applied the commit in the Fixes tag, I had checked my Fedora system's /boot/config-* files and had found CONFIG_PAGE_SHIFT defined. I wanted to avoid the dependency to getconf, and chose the way to rely on CONFIG_PAGE_SHIFT. But that is not an option for other distros. Today I checked my Debian system, and CONFIG_PAGE_SHIFT was not defined either. Now I see that we should not use CONFIG_PAGE_SHIFT. > > diff --git a/common/rc b/common/rc > index 20f7c7a..d60a125 100644 > --- a/common/rc > +++ b/common/rc > @@ -562,13 +562,8 @@ _have_systemctl_unit() { > return 0 > } > > -# Get system page size from kernel conguration > _get_page_size() { > - local page_shift > - > - page_shift=$(_get_kernel_option PAGE_SHIFT) > - > - echo $((1<< page_shift)) > + getconf PAGE_SIZE > } > > # Check if the system page size matches the required size (in bytes). > The patch above should work, but it creates a new dependeny on the tool getconf. There are 6 test cases that require page size and getconf. Then, we need to check that getconf command is available for the test cases. $ git grep _page_size common/rc:_get_page_size() { common/rc:# Example: _page_size_equals 4096 common/rc:_page_size_equals() { common/rc: current_size=$(_get_page_size) tests/scsi/011: _page_size_equals 4096 tests/throtl/002: page_size=$(_get_page_size) tests/throtl/003: page_size=$(_get_page_size) tests/throtl/007: page_size=$(_get_page_size) tests/zbd/010: _page_size_equals 4096 tests/zbd/014: page_size=$(_get_page_size) Havind said that, I think now Linux eco-system is in the phase to add variety of page sizes, and I expect more test cases that depend on page sizes will be added in near future. So, this could be the good timing to add getconf to the blktests minimal requirement list described in README.md. This means that blktests users will need to install glibc-common package for Fedora, or libc-bin package for Debian. This is a rather fundamental change, so I would like to ask opinions from other blktests users, especially Omar and Chaitanya. What do you think about the idea to add getconf to the requirement list? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH blktests] Fix _get_page_size() 2026-06-20 1:26 ` Shin'ichiro Kawasaki @ 2026-06-20 3:55 ` Bart Van Assche 2026-06-20 4:51 ` Shin'ichiro Kawasaki 0 siblings, 1 reply; 5+ messages in thread From: Bart Van Assche @ 2026-06-20 3:55 UTC (permalink / raw) To: Shin'ichiro Kawasaki, Jeff Moyer; +Cc: linux-block, osandov, kch On 6/20/26 3:26 AM, Shin'ichiro Kawasaki wrote: > This is a rather fundamental change, so I would like to ask opinions from > other blktests users, especially Omar and Chaitanya. What do you think about > the idea to add getconf to the requirement list? CONFIG_PAGE_SHIFT was introduced in the Linux kernel in February 2024 (commit ba89f9c8ccba ("arch: consolidate existing CONFIG_PAGE_SIZE_*KB definitions")). Older kernels had CONFIG_PAGE_SIZE_4KB, CONFIG_PAGE_SIZE_16KB, etc. This means that it is possible to derive the kernel page size from the kernel configuration file for all upstream and distro kernels, isn't it? Thanks, Bart. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH blktests] Fix _get_page_size() 2026-06-20 3:55 ` Bart Van Assche @ 2026-06-20 4:51 ` Shin'ichiro Kawasaki 2026-06-20 7:11 ` Bart Van Assche 0 siblings, 1 reply; 5+ messages in thread From: Shin'ichiro Kawasaki @ 2026-06-20 4:51 UTC (permalink / raw) To: Bart Van Assche; +Cc: Jeff Moyer, linux-block, osandov, kch On Jun 20, 2026 / 05:55, Bart Van Assche wrote: > On 6/20/26 3:26 AM, Shin'ichiro Kawasaki wrote: > > This is a rather fundamental change, so I would like to ask opinions from > > other blktests users, especially Omar and Chaitanya. What do you think about > > the idea to add getconf to the requirement list? > > CONFIG_PAGE_SHIFT was introduced in the Linux kernel in February 2024 > (commit ba89f9c8ccba ("arch: consolidate existing CONFIG_PAGE_SIZE_*KB > definitions")). Older kernels had CONFIG_PAGE_SIZE_4KB, > CONFIG_PAGE_SIZE_16KB, etc. This means that it is possible to derive the > kernel page size from the kernel configuration file for all upstream and > distro kernels, isn't it? I checked the commit is in the tag v6.9. My Debian bookworm system has kernel v6.1, then the config file at /boot does not have CONFIG_PAGE_SHIFT as expected. But it does not have CONFIG_PAGE_SIZE_* either... I'm still afraid that kernel config file approach is not reliable. $ uname -a Linux testnode3 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 GNU/Linux $ grep PAGE_S /boot/config-6.1.0-49-amd64 CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH blktests] Fix _get_page_size() 2026-06-20 4:51 ` Shin'ichiro Kawasaki @ 2026-06-20 7:11 ` Bart Van Assche 0 siblings, 0 replies; 5+ messages in thread From: Bart Van Assche @ 2026-06-20 7:11 UTC (permalink / raw) To: Shin'ichiro Kawasaki; +Cc: Jeff Moyer, linux-block, osandov, kch On 6/20/26 6:51 AM, Shin'ichiro Kawasaki wrote: > On Jun 20, 2026 / 05:55, Bart Van Assche wrote: >> On 6/20/26 3:26 AM, Shin'ichiro Kawasaki wrote: >>> This is a rather fundamental change, so I would like to ask opinions from >>> other blktests users, especially Omar and Chaitanya. What do you think about >>> the idea to add getconf to the requirement list? >> >> CONFIG_PAGE_SHIFT was introduced in the Linux kernel in February 2024 >> (commit ba89f9c8ccba ("arch: consolidate existing CONFIG_PAGE_SIZE_*KB >> definitions")). Older kernels had CONFIG_PAGE_SIZE_4KB, >> CONFIG_PAGE_SIZE_16KB, etc. This means that it is possible to derive the >> kernel page size from the kernel configuration file for all upstream and >> distro kernels, isn't it? > > I checked the commit is in the tag v6.9. My Debian bookworm system has kernel > v6.1, then the config file at /boot does not have CONFIG_PAGE_SHIFT as expected. > But it does not have CONFIG_PAGE_SIZE_* either... I'm still afraid that kernel > config file approach is not reliable. Right, for older kernels CONFIG_PAGE_SIZE_*KB is only available for some but not for all supported architectures. It is not clear to me where the desire to avoid the dependency on getconf comes from? As far as I know it is available on all Linux distro's. Since it is typically included in the C library package it should not introduce a new dependency. Thanks, Bart. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-20 7:11 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-18 14:41 [PATCH blktests] Fix _get_page_size() Jeff Moyer 2026-06-20 1:26 ` Shin'ichiro Kawasaki 2026-06-20 3:55 ` Bart Van Assche 2026-06-20 4:51 ` Shin'ichiro Kawasaki 2026-06-20 7:11 ` Bart Van Assche
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox