Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc()
@ 2026-09-16 12:03 Mike Rapoport (Microsoft)
  2026-09-16 12:03 ` [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs Mike Rapoport (Microsoft)
                   ` (13 more replies)
  0 siblings, 14 replies; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

The saga continues :)

This series covers CIO, QDIO, SCM and IDAL buffer allocations.

This is a (small) part of larger work of replacing page allocator calls
with kmalloc.

My initial intention a few month ago was to remove ugly casts [1], but then
willy pointed out that Linus objected to something like this [2] and it
looks like more than a decade old technical debt.

Largely, anything that doesn't need struct page (or a memdesc in the
future) should just use kmalloc() or kvmalloc() to allocate memory.
kmalloc() guarantees alignment, physical contiguity and working
virt_to_phys() and beside nicer API that returns void * on alloc and
doesn't require to know the allocation size on free, kmalloc() provides
better debugging capabilities than page allocator.

Another thing is that touching these allocation sites gives the reviewers
opportunity to see if a PAGE_SIZE buffer is actually needed or maybe
another size is appropriate.

For larger allocations that don't need physically contiguous memory
kvmalloc() can be a better option that __get_free_pages() because under
memory pressure it's is easier to allocate several order-0 pages than a
physically contiguous chunk with the same number of pages.

And last, but not least, removing needless calls to page allocator should
help with memdesc (aka project folio) conversion. There will be way less
places to audit to see if the user was actually using struct page.

The patches are grouped by buffer usage and ordered by file or
subsystem. Related CHSC work areas and requests are kept together.

While on it, use __free(kfree) for the SCM information buffer and local
buffers in synchronous CHSC ioctl handlers. The CHSC cleanup is kept in
a separate patch.

Also in git:
https://git.kernel.org/pub/scm/linux/kernel/git/rppt/linux.git gfp-to-kmalloc/s390-cio

[1] https://lore.kernel.org/all/20251018093002.3660549-1-rppt@kernel.org/
[2] https://lore.kernel.org/all/CA+55aFwp4iy4rtX2gE2WjBGFL=NxMVnoFeHqYa2j1dYOMMGqxg@mail.gmail.com/

---
v3 changes:
* fix accidental flips from non-zeroing allocations to zeroing ones.

v2: https://patch.msgid.link/20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org
Address sashiko comments:
* Allocate the exact CMB area size and reject invalid channel counts.
  Correct the alignment requirement to 32 bytes.
* Tell kmemleak to ignore IDAL data buffers as only DMA addresses are kept.
* Drop the obsolete kmemleak exemption for the QDIO CCW.

v1: https://patch.msgid.link/20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org

---
Mike Rapoport (Microsoft) (13):
      s390/chsc: Use kzalloc() for CUBs
      s390/chsc: Use kzalloc() for the SEI work area
      s390/chsc_sch: Use kzalloc() for CHSC requests
      s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests
      s390/cio: Use kzalloc() for CHSC work areas
      s390/cmf: Use kmalloc() for the CMB area
      s390/idals: Use kmalloc() for IDAL data buffers
      s390/qdio_main: Use kzalloc() for the IRQ structure
      s390/qdio_main: Use kzalloc() for the QDR
      s390/qdio_setup: Use kzalloc() for QDIO buffers
      s390/qdio_setup: Use kmalloc() for the storage list
      s390/qdio_setup: Use kmalloc() for the SSQD request
      s390/scm: Use kmalloc() for SCM information

 arch/s390/include/asm/idals.h   |   9 +-
 drivers/s390/cio/chsc.c         |  20 +--
 drivers/s390/cio/chsc_sch.c     | 300 ++++++++++++++--------------------------
 drivers/s390/cio/cmf.c          |  11 +-
 drivers/s390/cio/qdio.h         |   2 +-
 drivers/s390/cio/qdio_main.c    |  23 ++-
 drivers/s390/cio/qdio_setup.c   |  14 +-
 drivers/s390/cio/qdio_thinint.c |   2 +-
 drivers/s390/cio/scm.c          |   7 +-
 9 files changed, 150 insertions(+), 238 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260907-s390-cio-ready-18e73ff8642f

--
Sincerely yours,
Mike.


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

* [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:15   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area Mike Rapoport (Microsoft)
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

cub_alloc() allocates the channel measurement unit blocks and their
extended counterparts.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/chsc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 9689f722c863c..60a4a7e6086ce 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -931,12 +931,12 @@ static int cub_alloc(struct channel_subsystem *css)
 	int i;
 
 	for (i = 0; i < CSS_NUM_CUB_PAGES; i++) {
-		css->cub[i] = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+		css->cub[i] = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 		if (!css->cub[i])
 			return -ENOMEM;
 	}
 	for (i = 0; i < CSS_NUM_ECUB_PAGES; i++) {
-		css->ecub[i] = (void *)get_zeroed_page(GFP_KERNEL);
+		css->ecub[i] = kzalloc(PAGE_SIZE, GFP_KERNEL);
 		if (!css->ecub[i])
 			return -ENOMEM;
 	}
@@ -949,11 +949,11 @@ static void cub_free(struct channel_subsystem *css)
 	int i;
 
 	for (i = 0; i < CSS_NUM_CUB_PAGES; i++) {
-		free_page((unsigned long)css->cub[i]);
+		kfree(css->cub[i]);
 		css->cub[i] = NULL;
 	}
 	for (i = 0; i < CSS_NUM_ECUB_PAGES; i++) {
-		free_page((unsigned long)css->ecub[i]);
+		kfree(css->ecub[i]);
 		css->ecub[i] = NULL;
 	}
 }

-- 
2.53.0


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

* [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
  2026-09-16 12:03 ` [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:15   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests Mike Rapoport (Microsoft)
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

chsc_init() allocates the work area for store event information data.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/chsc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 60a4a7e6086ce..c3186c0a372b4 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -1142,7 +1142,7 @@ int __init chsc_init(void)
 {
 	int ret;
 
-	sei_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	sei_page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	chsc_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
 	if (!sei_page || !chsc_page) {
 		ret = -ENOMEM;
@@ -1154,7 +1154,7 @@ int __init chsc_init(void)
 	return ret;
 out_err:
 	free_page((unsigned long)chsc_page);
-	free_page((unsigned long)sei_page);
+	kfree(sei_page);
 	return ret;
 }
 
@@ -1162,7 +1162,7 @@ void __init chsc_init_cleanup(void)
 {
 	crw_unregister_handler(CRW_RSC_CSS);
 	free_page((unsigned long)chsc_page);
-	free_page((unsigned long)sei_page);
+	kfree(sei_page);
 }
 
 int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code)

-- 
2.53.0


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

* [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
  2026-09-16 12:03 ` [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs Mike Rapoport (Microsoft)
  2026-09-16 12:03 ` [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:14   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous " Mike Rapoport (Microsoft)
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

The CHSC ioctl handlers allocate request and response areas for
CHSC commands issued on behalf of userspace.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/chsc_sch.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index b6cb8bb8bcc4b..c8d6871d1841e 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -292,7 +292,7 @@ static int chsc_ioctl_start(void __user *user_area)
 	if (!css_general_characteristics.dynio)
 		/* It makes no sense to try. */
 		return -EOPNOTSUPP;
-	chsc_area = (void *)get_zeroed_page(GFP_DMA | GFP_KERNEL);
+	chsc_area = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);
 	if (!chsc_area)
 		return -ENOMEM;
 	request = kzalloc_obj(*request);
@@ -321,7 +321,7 @@ static int chsc_ioctl_start(void __user *user_area)
 	snprintf(dbf, sizeof(dbf), "ret:%d", ret);
 	CHSC_LOG(0, dbf);
 	kfree(request);
-	free_page((unsigned long)chsc_area);
+	kfree(chsc_area);
 	return ret;
 }
 
@@ -340,7 +340,7 @@ static int chsc_ioctl_on_close_set(void __user *user_area)
 		ret = -ENOMEM;
 		goto out_unlock;
 	}
-	on_close_chsc_area = (void *)get_zeroed_page(GFP_DMA | GFP_KERNEL);
+	on_close_chsc_area = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);
 	if (!on_close_chsc_area) {
 		ret = -ENOMEM;
 		goto out_free_request;
@@ -353,7 +353,7 @@ static int chsc_ioctl_on_close_set(void __user *user_area)
 	goto out_unlock;
 
 out_free_chsc:
-	free_page((unsigned long)on_close_chsc_area);
+	kfree(on_close_chsc_area);
 	on_close_chsc_area = NULL;
 out_free_request:
 	kfree(on_close_request);
@@ -375,7 +375,7 @@ static int chsc_ioctl_on_close_remove(void)
 		ret = -ENOENT;
 		goto out_unlock;
 	}
-	free_page((unsigned long)on_close_chsc_area);
+	kfree(on_close_chsc_area);
 	on_close_chsc_area = NULL;
 	kfree(on_close_request);
 	on_close_request = NULL;
@@ -392,7 +392,7 @@ static int chsc_ioctl_start_sync(void __user *user_area)
 	struct chsc_sync_area *chsc_area;
 	int ret, ccode;
 
-	chsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	chsc_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!chsc_area)
 		return -ENOMEM;
 	if (copy_from_user(chsc_area, user_area, PAGE_SIZE)) {
@@ -414,7 +414,7 @@ static int chsc_ioctl_start_sync(void __user *user_area)
 	else
 		ret = 0;
 out_free:
-	free_page((unsigned long)chsc_area);
+	kfree(chsc_area);
 	return ret;
 }
 
@@ -438,7 +438,7 @@ static int chsc_ioctl_info_channel_path(void __user *user_cd)
 		u8 data[PAGE_SIZE - 20];
 	} __attribute__ ((packed)) *scpcd_area;
 
-	scpcd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	scpcd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!scpcd_area)
 		return -ENOMEM;
 	cd = kzalloc_obj(*cd);
@@ -476,7 +476,7 @@ static int chsc_ioctl_info_channel_path(void __user *user_cd)
 		ret = 0;
 out_free:
 	kfree(cd);
-	free_page((unsigned long)scpcd_area);
+	kfree(scpcd_area);
 	return ret;
 }
 
@@ -500,7 +500,7 @@ static int chsc_ioctl_info_cu(void __user *user_cd)
 		u8 data[PAGE_SIZE - 20];
 	} __attribute__ ((packed)) *scucd_area;
 
-	scucd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	scucd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!scucd_area)
 		return -ENOMEM;
 	cd = kzalloc_obj(*cd);
@@ -538,7 +538,7 @@ static int chsc_ioctl_info_cu(void __user *user_cd)
 		ret = 0;
 out_free:
 	kfree(cd);
-	free_page((unsigned long)scucd_area);
+	kfree(scucd_area);
 	return ret;
 }
 
@@ -563,7 +563,7 @@ static int chsc_ioctl_info_sch_cu(void __user *user_cud)
 		u8 data[PAGE_SIZE - 20];
 	} __attribute__ ((packed)) *sscud_area;
 
-	sscud_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	sscud_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sscud_area)
 		return -ENOMEM;
 	cud = kzalloc_obj(*cud);
@@ -602,7 +602,7 @@ static int chsc_ioctl_info_sch_cu(void __user *user_cud)
 		ret = 0;
 out_free:
 	kfree(cud);
-	free_page((unsigned long)sscud_area);
+	kfree(sscud_area);
 	return ret;
 }
 
@@ -625,7 +625,7 @@ static int chsc_ioctl_conf_info(void __user *user_ci)
 		u8 data[PAGE_SIZE - 20];
 	} __attribute__ ((packed)) *sci_area;
 
-	sci_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	sci_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sci_area)
 		return -ENOMEM;
 	ci = kzalloc_obj(*ci);
@@ -662,7 +662,7 @@ static int chsc_ioctl_conf_info(void __user *user_ci)
 		ret = 0;
 out_free:
 	kfree(ci);
-	free_page((unsigned long)sci_area);
+	kfree(sci_area);
 	return ret;
 }
 
@@ -696,7 +696,7 @@ static int chsc_ioctl_conf_comp_list(void __user *user_ccl)
 		u32 res;
 	} __attribute__ ((packed)) *cssids_parm;
 
-	sccl_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	sccl_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sccl_area)
 		return -ENOMEM;
 	ccl = kzalloc_obj(*ccl);
@@ -745,7 +745,7 @@ static int chsc_ioctl_conf_comp_list(void __user *user_ccl)
 		ret = 0;
 out_free:
 	kfree(ccl);
-	free_page((unsigned long)sccl_area);
+	kfree(sccl_area);
 	return ret;
 }
 
@@ -756,7 +756,7 @@ static int chsc_ioctl_chpd(void __user *user_chpd)
 	int ret;
 
 	chpd = kzalloc_obj(*chpd);
-	scpd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	scpd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!scpd_area || !chpd) {
 		ret = -ENOMEM;
 		goto out_free;
@@ -775,7 +775,7 @@ static int chsc_ioctl_chpd(void __user *user_chpd)
 		ret = -EFAULT;
 out_free:
 	kfree(chpd);
-	free_page((unsigned long)scpd_area);
+	kfree(scpd_area);
 	return ret;
 }
 
@@ -796,7 +796,7 @@ static int chsc_ioctl_dcal(void __user *user_dcal)
 		u8 data[PAGE_SIZE - 36];
 	} __attribute__ ((packed)) *sdcal_area;
 
-	sdcal_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	sdcal_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sdcal_area)
 		return -ENOMEM;
 	dcal = kzalloc_obj(*dcal);
@@ -834,7 +834,7 @@ static int chsc_ioctl_dcal(void __user *user_dcal)
 		ret = 0;
 out_free:
 	kfree(dcal);
-	free_page((unsigned long)sdcal_area);
+	kfree(sdcal_area);
 	return ret;
 }
 
@@ -904,7 +904,7 @@ static int chsc_release(struct inode *inode, struct file *filp)
 	}
 	snprintf(dbf, sizeof(dbf), "relret:%d", ret);
 	CHSC_LOG(0, dbf);
-	free_page((unsigned long)on_close_chsc_area);
+	kfree(on_close_chsc_area);
 	on_close_chsc_area = NULL;
 	kfree(on_close_request);
 	on_close_request = NULL;

-- 
2.53.0


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

* [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (2 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:10   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas Mike Rapoport (Microsoft)
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

Use __free(kfree) for local buffers in the synchronous CHSC ioctl
handlers and replace their cleanup labels with early returns.

Keep the asynchronous and on-close handlers unchanged.

Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/chsc_sch.c | 272 +++++++++++++++-----------------------------
 1 file changed, 92 insertions(+), 180 deletions(-)

diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index c8d6871d1841e..225aaac7dd309 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -15,6 +15,7 @@
 #include <linux/uaccess.h>
 #include <linux/miscdevice.h>
 #include <linux/kernel_stat.h>
+#include <linux/cleanup.h>
 
 #include <asm/cio.h>
 #include <asm/chsc.h>
@@ -389,39 +390,29 @@ static int chsc_ioctl_on_close_remove(void)
 
 static int chsc_ioctl_start_sync(void __user *user_area)
 {
-	struct chsc_sync_area *chsc_area;
-	int ret, ccode;
+	struct chsc_sync_area *chsc_area __free(kfree) = NULL;
+	int ccode;
 
 	chsc_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!chsc_area)
 		return -ENOMEM;
-	if (copy_from_user(chsc_area, user_area, PAGE_SIZE)) {
-		ret = -EFAULT;
-		goto out_free;
-	}
-	if (chsc_area->header.code & 0x4000) {
-		ret = -EINVAL;
-		goto out_free;
-	}
+	if (copy_from_user(chsc_area, user_area, PAGE_SIZE))
+		return -EFAULT;
+	if (chsc_area->header.code & 0x4000)
+		return -EINVAL;
 	chsc_log_command(chsc_area);
 	ccode = chsc(chsc_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (copy_to_user(user_area, chsc_area, PAGE_SIZE))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(chsc_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_info_channel_path(void __user *user_cd)
 {
-	struct chsc_chp_cd *cd;
-	int ret, ccode;
+	struct chsc_chp_cd *cd __free(kfree) = NULL;
+	int ccode;
 	struct {
 		struct chsc_header request;
 		u32 : 2;
@@ -436,20 +427,16 @@ static int chsc_ioctl_info_channel_path(void __user *user_cd)
 		u32 : 32;
 		struct chsc_header response;
 		u8 data[PAGE_SIZE - 20];
-	} __attribute__ ((packed)) *scpcd_area;
+	} __attribute__ ((packed)) *scpcd_area __free(kfree) = NULL;
 
 	scpcd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!scpcd_area)
 		return -ENOMEM;
 	cd = kzalloc_obj(*cd);
-	if (!cd) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(cd, user_cd, sizeof(*cd))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!cd)
+		return -ENOMEM;
+	if (copy_from_user(cd, user_cd, sizeof(*cd)))
+		return -EFAULT;
 	scpcd_area->request.length = 0x0010;
 	scpcd_area->request.code = 0x0028;
 	scpcd_area->m = cd->m;
@@ -459,31 +446,23 @@ static int chsc_ioctl_info_channel_path(void __user *user_cd)
 	scpcd_area->last_chpid = cd->chpid.id;
 
 	ccode = chsc(scpcd_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (scpcd_area->response.code != 0x0001) {
-		ret = -EIO;
 		CHSC_MSG(0, "scpcd: response code=%x\n",
 			 scpcd_area->response.code);
-		goto out_free;
+		return -EIO;
 	}
 	memcpy(&cd->cpcb, &scpcd_area->response, scpcd_area->response.length);
 	if (copy_to_user(user_cd, cd, sizeof(*cd)))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(cd);
-	kfree(scpcd_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_info_cu(void __user *user_cd)
 {
-	struct chsc_cu_cd *cd;
-	int ret, ccode;
+	struct chsc_cu_cd *cd __free(kfree) = NULL;
+	int ccode;
 	struct {
 		struct chsc_header request;
 		u32 : 2;
@@ -498,20 +477,16 @@ static int chsc_ioctl_info_cu(void __user *user_cd)
 		u32 : 32;
 		struct chsc_header response;
 		u8 data[PAGE_SIZE - 20];
-	} __attribute__ ((packed)) *scucd_area;
+	} __attribute__ ((packed)) *scucd_area __free(kfree) = NULL;
 
 	scucd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!scucd_area)
 		return -ENOMEM;
 	cd = kzalloc_obj(*cd);
-	if (!cd) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(cd, user_cd, sizeof(*cd))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!cd)
+		return -ENOMEM;
+	if (copy_from_user(cd, user_cd, sizeof(*cd)))
+		return -EFAULT;
 	scucd_area->request.length = 0x0010;
 	scucd_area->request.code = 0x0026;
 	scucd_area->m = cd->m;
@@ -521,31 +496,23 @@ static int chsc_ioctl_info_cu(void __user *user_cd)
 	scucd_area->last_cun = cd->cun;
 
 	ccode = chsc(scucd_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (scucd_area->response.code != 0x0001) {
-		ret = -EIO;
 		CHSC_MSG(0, "scucd: response code=%x\n",
 			 scucd_area->response.code);
-		goto out_free;
+		return -EIO;
 	}
 	memcpy(&cd->cucb, &scucd_area->response, scucd_area->response.length);
 	if (copy_to_user(user_cd, cd, sizeof(*cd)))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(cd);
-	kfree(scucd_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_info_sch_cu(void __user *user_cud)
 {
-	struct chsc_sch_cud *cud;
-	int ret, ccode;
+	struct chsc_sch_cud *cud __free(kfree) = NULL;
+	int ccode;
 	struct {
 		struct chsc_header request;
 		u32 : 2;
@@ -561,20 +528,16 @@ static int chsc_ioctl_info_sch_cu(void __user *user_cud)
 		u32 : 32;
 		struct chsc_header response;
 		u8 data[PAGE_SIZE - 20];
-	} __attribute__ ((packed)) *sscud_area;
+	} __attribute__ ((packed)) *sscud_area __free(kfree) = NULL;
 
 	sscud_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sscud_area)
 		return -ENOMEM;
 	cud = kzalloc_obj(*cud);
-	if (!cud) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(cud, user_cud, sizeof(*cud))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!cud)
+		return -ENOMEM;
+	if (copy_from_user(cud, user_cud, sizeof(*cud)))
+		return -EFAULT;
 	sscud_area->request.length = 0x0010;
 	sscud_area->request.code = 0x0006;
 	sscud_area->m = cud->schid.m;
@@ -585,31 +548,23 @@ static int chsc_ioctl_info_sch_cu(void __user *user_cud)
 	sscud_area->last_sch = cud->schid.sch_no;
 
 	ccode = chsc(sscud_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (sscud_area->response.code != 0x0001) {
-		ret = -EIO;
 		CHSC_MSG(0, "sscud: response code=%x\n",
 			 sscud_area->response.code);
-		goto out_free;
+		return -EIO;
 	}
 	memcpy(&cud->scub, &sscud_area->response, sscud_area->response.length);
 	if (copy_to_user(user_cud, cud, sizeof(*cud)))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(cud);
-	kfree(sscud_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_conf_info(void __user *user_ci)
 {
-	struct chsc_conf_info *ci;
-	int ret, ccode;
+	struct chsc_conf_info *ci __free(kfree) = NULL;
+	int ccode;
 	struct {
 		struct chsc_header request;
 		u32 : 2;
@@ -623,20 +578,16 @@ static int chsc_ioctl_conf_info(void __user *user_ci)
 		u64 : 64;
 		struct chsc_header response;
 		u8 data[PAGE_SIZE - 20];
-	} __attribute__ ((packed)) *sci_area;
+	} __attribute__ ((packed)) *sci_area __free(kfree) = NULL;
 
 	sci_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sci_area)
 		return -ENOMEM;
 	ci = kzalloc_obj(*ci);
-	if (!ci) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(ci, user_ci, sizeof(*ci))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!ci)
+		return -ENOMEM;
+	if (copy_from_user(ci, user_ci, sizeof(*ci)))
+		return -EFAULT;
 	sci_area->request.length = 0x0010;
 	sci_area->request.code = 0x0012;
 	sci_area->m = ci->id.m;
@@ -645,31 +596,23 @@ static int chsc_ioctl_conf_info(void __user *user_ci)
 	sci_area->ssid = ci->id.ssid;
 
 	ccode = chsc(sci_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (sci_area->response.code != 0x0001) {
-		ret = -EIO;
 		CHSC_MSG(0, "sci: response code=%x\n",
 			 sci_area->response.code);
-		goto out_free;
+		return -EIO;
 	}
 	memcpy(&ci->scid, &sci_area->response, sci_area->response.length);
 	if (copy_to_user(user_ci, ci, sizeof(*ci)))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(ci);
-	kfree(sci_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_conf_comp_list(void __user *user_ccl)
 {
-	struct chsc_comp_list *ccl;
-	int ret, ccode;
+	struct chsc_comp_list *ccl __free(kfree) = NULL;
+	int ccode;
 	struct {
 		struct chsc_header request;
 		u32 ctype : 8;
@@ -681,7 +624,7 @@ static int chsc_ioctl_conf_comp_list(void __user *user_ccl)
 		u64 : 64;
 		struct chsc_header response;
 		u8 data[PAGE_SIZE - 36];
-	} __attribute__ ((packed)) *sccl_area;
+	} __attribute__ ((packed)) *sccl_area __free(kfree) = NULL;
 	struct {
 		u32 m : 1;
 		u32 : 31;
@@ -700,14 +643,10 @@ static int chsc_ioctl_conf_comp_list(void __user *user_ccl)
 	if (!sccl_area)
 		return -ENOMEM;
 	ccl = kzalloc_obj(*ccl);
-	if (!ccl) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(ccl, user_ccl, sizeof(*ccl))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!ccl)
+		return -ENOMEM;
+	if (copy_from_user(ccl, user_ccl, sizeof(*ccl)))
+		return -EFAULT;
 	sccl_area->request.length = 0x0020;
 	sccl_area->request.code = 0x0030;
 	sccl_area->fmt = ccl->req.fmt;
@@ -728,61 +667,46 @@ static int chsc_ioctl_conf_comp_list(void __user *user_ccl)
 		break;
 	}
 	ccode = chsc(sccl_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (sccl_area->response.code != 0x0001) {
-		ret = -EIO;
 		CHSC_MSG(0, "sccl: response code=%x\n",
 			 sccl_area->response.code);
-		goto out_free;
+		return -EIO;
 	}
 	memcpy(&ccl->sccl, &sccl_area->response, sccl_area->response.length);
 	if (copy_to_user(user_ccl, ccl, sizeof(*ccl)))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(ccl);
-	kfree(sccl_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_chpd(void __user *user_chpd)
 {
-	struct chsc_scpd *scpd_area;
-	struct chsc_cpd_info *chpd;
+	struct chsc_scpd *scpd_area __free(kfree) = NULL;
+	struct chsc_cpd_info *chpd __free(kfree) = NULL;
 	int ret;
 
 	chpd = kzalloc_obj(*chpd);
 	scpd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
-	if (!scpd_area || !chpd) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(chpd, user_chpd, sizeof(*chpd))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!scpd_area || !chpd)
+		return -ENOMEM;
+	if (copy_from_user(chpd, user_chpd, sizeof(*chpd)))
+		return -EFAULT;
 	ret = chsc_determine_channel_path_desc(chpd->chpid, chpd->fmt,
 					       chpd->rfmt, chpd->c, chpd->m,
 					       scpd_area);
 	if (ret)
-		goto out_free;
+		return ret;
 	memcpy(&chpd->chpdb, &scpd_area->response, scpd_area->response.length);
 	if (copy_to_user(user_chpd, chpd, sizeof(*chpd)))
-		ret = -EFAULT;
-out_free:
-	kfree(chpd);
-	kfree(scpd_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static int chsc_ioctl_dcal(void __user *user_dcal)
 {
-	struct chsc_dcal *dcal;
-	int ret, ccode;
+	struct chsc_dcal *dcal __free(kfree) = NULL;
+	int ccode;
 	struct {
 		struct chsc_header request;
 		u32 atype : 8;
@@ -794,20 +718,16 @@ static int chsc_ioctl_dcal(void __user *user_dcal)
 		u32 res1[2];
 		struct chsc_header response;
 		u8 data[PAGE_SIZE - 36];
-	} __attribute__ ((packed)) *sdcal_area;
+	} __attribute__ ((packed)) *sdcal_area __free(kfree) = NULL;
 
 	sdcal_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sdcal_area)
 		return -ENOMEM;
 	dcal = kzalloc_obj(*dcal);
-	if (!dcal) {
-		ret = -ENOMEM;
-		goto out_free;
-	}
-	if (copy_from_user(dcal, user_dcal, sizeof(*dcal))) {
-		ret = -EFAULT;
-		goto out_free;
-	}
+	if (!dcal)
+		return -ENOMEM;
+	if (copy_from_user(dcal, user_dcal, sizeof(*dcal)))
+		return -EFAULT;
 	sdcal_area->request.length = 0x0020;
 	sdcal_area->request.code = 0x0034;
 	sdcal_area->atype = dcal->req.atype;
@@ -816,26 +736,18 @@ static int chsc_ioctl_dcal(void __user *user_dcal)
 	       sizeof(sdcal_area->list_parm));
 
 	ccode = chsc(sdcal_area);
-	if (ccode != 0) {
-		ret = -EIO;
-		goto out_free;
-	}
+	if (ccode != 0)
+		return -EIO;
 	if (sdcal_area->response.code != 0x0001) {
-		ret = -EIO;
 		CHSC_MSG(0, "sdcal: response code=%x\n",
 			 sdcal_area->response.code);
-		goto out_free;
+		return -EIO;
 	}
 	memcpy(&dcal->sdcal, &sdcal_area->response,
 	       sdcal_area->response.length);
 	if (copy_to_user(user_dcal, dcal, sizeof(*dcal)))
-		ret = -EFAULT;
-	else
-		ret = 0;
-out_free:
-	kfree(dcal);
-	kfree(sdcal_area);
-	return ret;
+		return -EFAULT;
+	return 0;
 }
 
 static long chsc_ioctl(struct file *filp, unsigned int cmd,

-- 
2.53.0


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

* [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (3 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous " Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:12   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area Mike Rapoport (Microsoft)
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

chsc_init() allocates the work area for CHSC commands and
qdio_allocate() allocates one for CHSC calls during qdio_establish().

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

While on it, change qdio_irq.chsc_page to void * to get rid of the casts.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/chsc.c         | 6 +++---
 drivers/s390/cio/qdio.h         | 2 +-
 drivers/s390/cio/qdio_main.c    | 6 +++---
 drivers/s390/cio/qdio_setup.c   | 2 +-
 drivers/s390/cio/qdio_thinint.c | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index c3186c0a372b4..d98f629e89295 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -1143,7 +1143,7 @@ int __init chsc_init(void)
 	int ret;
 
 	sei_page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
-	chsc_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	chsc_page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!sei_page || !chsc_page) {
 		ret = -ENOMEM;
 		goto out_err;
@@ -1153,7 +1153,7 @@ int __init chsc_init(void)
 		goto out_err;
 	return ret;
 out_err:
-	free_page((unsigned long)chsc_page);
+	kfree(chsc_page);
 	kfree(sei_page);
 	return ret;
 }
@@ -1161,7 +1161,7 @@ int __init chsc_init(void)
 void __init chsc_init_cleanup(void)
 {
 	crw_unregister_handler(CRW_RSC_CSS);
-	free_page((unsigned long)chsc_page);
+	kfree(chsc_page);
 	kfree(sei_page);
 }
 
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 4bd4c00c9c0ca..dff5f53a8795d 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -244,7 +244,7 @@ struct qdio_irq {
 	int perf_stat_enabled;
 
 	struct qdr *qdr;
-	unsigned long chsc_page;
+	void *chsc_page;
 
 	struct qdio_q *input_qs[QDIO_MAX_QUEUES_PER_IRQ];
 	struct qdio_q *output_qs[QDIO_MAX_QUEUES_PER_IRQ];
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index c1e09fa34e774..d137bf8c70664 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -934,7 +934,7 @@ int qdio_free(struct ccw_device *cdev)
 
 	qdio_free_queues(irq_ptr);
 	free_page((unsigned long) irq_ptr->qdr);
-	free_page(irq_ptr->chsc_page);
+	kfree(irq_ptr->chsc_page);
 	kfree(irq_ptr->ccw);
 	free_page((unsigned long) irq_ptr);
 	return 0;
@@ -986,7 +986,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 	 * qdio_establish. In case of low memory and swap on a zfcp disk
 	 * we may not be able to allocate memory otherwise.
 	 */
-	irq_ptr->chsc_page = get_zeroed_page(GFP_KERNEL);
+	irq_ptr->chsc_page = kzalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!irq_ptr->chsc_page)
 		goto err_chsc;
 
@@ -1006,7 +1006,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 err_queues:
 	free_page((unsigned long) irq_ptr->qdr);
 err_qdr:
-	free_page(irq_ptr->chsc_page);
+	kfree(irq_ptr->chsc_page);
 err_chsc:
 err_dbf:
 	kfree(irq_ptr->ccw);
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index ea09aadaae4ec..bd80703c174c7 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -253,7 +253,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
 		if (!ssqd)
 			return -ENOMEM;
 	} else {
-		ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page;
+		ssqd = irq_ptr->chsc_page;
 	}
 
 	rc = chsc_ssqd(*schid, ssqd);
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index e167aa75c3dff..a2ff51887537f 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -136,7 +136,7 @@ static struct airq_struct tiqdio_airq = {
 
 static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset)
 {
-	struct chsc_scssc_area *scssc = (void *)irq_ptr->chsc_page;
+	struct chsc_scssc_area *scssc = irq_ptr->chsc_page;
 	dma64_t summary_indicator_addr, subchannel_indicator_addr;
 	int rc;
 

-- 
2.53.0


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

* [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (4 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:18   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers Mike Rapoport (Microsoft)
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

alloc_cmb() allocates the channel measurement block area shared by
devices using the basic channel measurement format.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

The measurement block origin must be 32-byte aligned. Each CMB is
32 bytes, so kmalloc() provides the required alignment without rounding
the allocation to a power-of-two number of pages. Reject an empty area
before allocating it.

Replace use of __get_free_pages() with kmalloc() and free_pages() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/cmf.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 92ab3d546fe47..8fd41a7dfc20b 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -482,6 +482,9 @@ static int alloc_cmb(struct ccw_device *cdev)
 	ssize_t size;
 	struct cmb_data *cmb_data;
 
+	if (cmb_area.num_channels <= 0)
+		return -ENOMEM;
+
 	/* Allocate private cmb_data. */
 	cmb_data = kzalloc_obj(struct cmb_data);
 	if (!cmb_data)
@@ -501,12 +504,12 @@ static int alloc_cmb(struct ccw_device *cdev)
 		WARN_ON(!list_empty(&cmb_area.list));
 
 		spin_unlock(&cmb_area.lock);
-		mem = (void *)__get_free_pages(GFP_KERNEL, get_order(size));
+		mem = kmalloc(size, GFP_KERNEL);
 		spin_lock(&cmb_area.lock);
 
 		if (cmb_area.mem) {
 			/* ok, another thread was faster */
-			free_pages((unsigned long)mem, get_order(size));
+			kfree(mem);
 		} else if (!mem) {
 			/* no luck */
 			ret = -ENOMEM;
@@ -547,10 +550,8 @@ static void free_cmb(struct ccw_device *cdev)
 	list_del_init(&priv->cmb_list);
 
 	if (list_empty(&cmb_area.list)) {
-		ssize_t size;
-		size = sizeof(struct cmb) * cmb_area.num_channels;
 		cmf_activate(NULL, CMF_OFF);
-		free_pages((unsigned long)cmb_area.mem, get_order(size));
+		kfree(cmb_area.mem);
 		cmb_area.mem = NULL;
 	}
 	spin_unlock_irq(cdev->ccwlock);

-- 
2.53.0


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

* [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (5 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:16   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure Mike Rapoport (Microsoft)
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

idal_buffer_alloc() allocates the data chunks of an IDAL buffer that is
used for channel I/O.

These buffers can be allocated with kmalloc() as there's nothing special
about them to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of __get_free_pages() with kmalloc() and free_pages() with
kfree().

While on it, tell kmemleak to ignore the data chunks as only their DMA
addresses are retained in the IDAL buffer.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 arch/s390/include/asm/idals.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h
index 06e1ec2afd5af..213f430a8d33a 100644
--- a/arch/s390/include/asm/idals.h
+++ b/arch/s390/include/asm/idals.h
@@ -18,6 +18,7 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/kmemleak.h>
 #include <asm/dma-types.h>
 #include <asm/cio.h>
 
@@ -147,9 +148,11 @@ static inline struct idal_buffer *idal_buffer_alloc(size_t size, int page_order)
 			ib->data[i] = dma64_add(ib->data[i - 1], IDA_BLOCK_SIZE);
 			continue;
 		}
-		vaddr = (void *)__get_free_pages(GFP_KERNEL, page_order);
+		vaddr = kmalloc(PAGE_SIZE << page_order, GFP_KERNEL);
 		if (!vaddr)
 			goto error;
+		/* Only DMA addresses are retained in ib->data. */
+		kmemleak_ignore(vaddr);
 		ib->data[i] = virt_to_dma64(vaddr);
 	}
 	return ib;
@@ -157,7 +160,7 @@ static inline struct idal_buffer *idal_buffer_alloc(size_t size, int page_order)
 	while (i >= nr_chunks) {
 		i -= nr_chunks;
 		vaddr = dma64_to_virt(ib->data[i]);
-		free_pages((unsigned long)vaddr, ib->page_order);
+		kfree(vaddr);
 	}
 	kfree(ib);
 	return ERR_PTR(-ENOMEM);
@@ -175,7 +178,7 @@ static inline void idal_buffer_free(struct idal_buffer *ib)
 	nr_chunks = (PAGE_SIZE << ib->page_order) >> IDA_SIZE_SHIFT;
 	for (i = 0; i < nr_ptrs; i += nr_chunks) {
 		vaddr = dma64_to_virt(ib->data[i]);
-		free_pages((unsigned long)vaddr, ib->page_order);
+		kfree(vaddr);
 	}
 	kfree(ib);
 }

-- 
2.53.0


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

* [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (6 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:17   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR Mike Rapoport (Microsoft)
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

qdio_allocate() allocates the QDIO irq structure.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

While on it, drop the kmemleak exemption for the CCW. The IRQ structure
is now tracked, so kmemleak can find its pointer to the CCW.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/qdio_main.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index d137bf8c70664..28eb8602ca97e 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -12,11 +12,11 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/kmemleak.h>
 #include <linux/delay.h>
 #include <linux/gfp.h>
 #include <linux/io.h>
 #include <linux/atomic.h>
+#include <linux/slab.h>
 #include <asm/debug.h>
 #include <asm/qdio.h>
 #include <asm/asm.h>
@@ -936,7 +936,7 @@ int qdio_free(struct ccw_device *cdev)
 	free_page((unsigned long) irq_ptr->qdr);
 	kfree(irq_ptr->chsc_page);
 	kfree(irq_ptr->ccw);
-	free_page((unsigned long) irq_ptr);
+	kfree(irq_ptr);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(qdio_free);
@@ -961,7 +961,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 	    no_output_qs > QDIO_MAX_QUEUES_PER_IRQ)
 		return -EINVAL;
 
-	irq_ptr = (void *) get_zeroed_page(GFP_KERNEL);
+	irq_ptr = kzalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!irq_ptr)
 		return -ENOMEM;
 
@@ -969,9 +969,6 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 	if (!irq_ptr->ccw)
 		goto err_ccw;
 
-	/* kmemleak doesn't scan the page-allocated irq_ptr: */
-	kmemleak_not_leak(irq_ptr->ccw);
-
 	irq_ptr->cdev = cdev;
 	mutex_init(&irq_ptr->setup_mutex);
 	if (qdio_allocate_dbf(irq_ptr))
@@ -1011,7 +1008,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 err_dbf:
 	kfree(irq_ptr->ccw);
 err_ccw:
-	free_page((unsigned long) irq_ptr);
+	kfree(irq_ptr);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(qdio_allocate);

-- 
2.53.0


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

* [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (7 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:16   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers Mike Rapoport (Microsoft)
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

qdio_allocate() allocates the queue description record (QDR).

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/qdio_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 28eb8602ca97e..889f63f94a4a7 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -933,7 +933,7 @@ int qdio_free(struct ccw_device *cdev)
 	mutex_unlock(&irq_ptr->setup_mutex);
 
 	qdio_free_queues(irq_ptr);
-	free_page((unsigned long) irq_ptr->qdr);
+	kfree(irq_ptr->qdr);
 	kfree(irq_ptr->chsc_page);
 	kfree(irq_ptr->ccw);
 	kfree(irq_ptr);
@@ -988,7 +988,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 		goto err_chsc;
 
 	/* qdr is used in ccw1.cda which is u32 */
-	irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	irq_ptr->qdr = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!irq_ptr->qdr)
 		goto err_qdr;
 
@@ -1001,7 +1001,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
 	return 0;
 
 err_queues:
-	free_page((unsigned long) irq_ptr->qdr);
+	kfree(irq_ptr->qdr);
 err_qdr:
 	kfree(irq_ptr->chsc_page);
 err_chsc:

-- 
2.53.0


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

* [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (8 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:21   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list Mike Rapoport (Microsoft)
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

qdio_alloc_buffers() allocates the QDIO buffers.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/qdio_setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index bd80703c174c7..b6f2ff202fe64 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -35,7 +35,7 @@ void qdio_free_buffers(struct qdio_buffer **buf, unsigned int count)
 	int pos;
 
 	for (pos = 0; pos < count; pos += QBUFF_PER_PAGE)
-		free_page((unsigned long) buf[pos]);
+		kfree(buf[pos]);
 }
 EXPORT_SYMBOL_GPL(qdio_free_buffers);
 
@@ -49,7 +49,7 @@ int qdio_alloc_buffers(struct qdio_buffer **buf, unsigned int count)
 	int pos;
 
 	for (pos = 0; pos < count; pos += QBUFF_PER_PAGE) {
-		buf[pos] = (void *) get_zeroed_page(GFP_KERNEL);
+		buf[pos] = kzalloc(PAGE_SIZE, GFP_KERNEL);
 		if (!buf[pos]) {
 			qdio_free_buffers(buf, count);
 			return -ENOMEM;

-- 
2.53.0


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

* [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (9 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:23   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request Mike Rapoport (Microsoft)
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

__qdio_allocate_qs() allocates the storage list information block of a
queue.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/qdio_setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index b6f2ff202fe64..d8e9c0872d15d 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -83,7 +83,7 @@ static void __qdio_free_queues(struct qdio_q **queues, unsigned int count)
 
 	for (i = 0; i < count; i++) {
 		q = queues[i];
-		free_page((unsigned long)q->sl_page);
+		kfree(q->sl_page);
 		kmem_cache_free(qdio_q_cache, q);
 	}
 }
@@ -109,7 +109,7 @@ static int __qdio_allocate_qs(struct qdio_q **irq_ptr_qs, int nr_queues)
 			return -ENOMEM;
 		}
 
-		q->sl_page = (void *)__get_free_page(GFP_KERNEL);
+		q->sl_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
 		if (!q->sl_page) {
 			kmem_cache_free(qdio_q_cache, q);
 			__qdio_free_queues(irq_ptr_qs, i);

-- 
2.53.0


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

* [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (10 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:23   ` sashiko-bot
  2026-09-16 12:03 ` [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information Mike Rapoport (Microsoft)
  2026-09-16 13:06 ` [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Heiko Carstens
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

qdio_setup_get_ssqd() allocates the request block for the Store
Subchannel QDIO Data (SSQD) CHSC command.

This memory can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/qdio_setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index d8e9c0872d15d..e1c5c6a8b3b27 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -249,7 +249,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
 
 	DBF_EVENT("getssqd:%4x", schid->sch_no);
 	if (!irq_ptr) {
-		ssqd = (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL);
+		ssqd = kmalloc(PAGE_SIZE, GFP_KERNEL);
 		if (!ssqd)
 			return -ENOMEM;
 	} else {
@@ -270,7 +270,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
 
 out:
 	if (!irq_ptr)
-		free_page((unsigned long)ssqd);
+		kfree(ssqd);
 
 	return rc;
 }

-- 
2.53.0


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

* [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (11 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request Mike Rapoport (Microsoft)
@ 2026-09-16 12:03 ` Mike Rapoport (Microsoft)
  2026-09-16 12:23   ` sashiko-bot
  2026-09-16 13:06 ` [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Heiko Carstens
  13 siblings, 1 reply; 30+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-09-16 12:03 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
  Cc: Christian Borntraeger, Mike Rapoport, Peter Oberparleiter,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

scm_update_information() allocates the response buffer for the CHSC
Store SCM Information command.

This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of __get_free_page() with kmalloc() and free_page() with
kfree().

While on it, use __free(kfree) for the local response buffer.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
 drivers/s390/cio/scm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c
index 171212a6d2d9c..b79fe023ab8d1 100644
--- a/drivers/s390/cio/scm.c
+++ b/drivers/s390/cio/scm.c
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/err.h>
+#include <linux/cleanup.h>
 #include <asm/eadm.h>
 #include "chsc.h"
 
@@ -224,12 +225,12 @@ static int scm_add(struct chsc_scm_info *scm_info, size_t num)
 
 int scm_update_information(void)
 {
-	struct chsc_scm_info *scm_info;
+	struct chsc_scm_info *scm_info __free(kfree) = NULL;
 	u64 token = 0;
 	size_t num;
 	int ret;
 
-	scm_info = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+	scm_info = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!scm_info)
 		return -ENOMEM;
 
@@ -250,8 +251,6 @@ int scm_update_information(void)
 		token = scm_info->restok;
 	} while (token);
 
-	free_page((unsigned long)scm_info);
-
 	return ret;
 }
 

-- 
2.53.0


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

* Re: [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests
  2026-09-16 12:03 ` [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous " Mike Rapoport (Microsoft)
@ 2026-09-16 12:10   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:10 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, Alexander Gordeev, linux-s390, Heiko Carstens,
	Christian Borntraeger

> Use __free(kfree) for local buffers in the synchronous CHSC ioctl
> handlers and replace their cleanup labels with early returns.
> 
> Keep the asynchronous and on-close handlers unchanged.
> 
> Assisted-by: copilot:claude-opus
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=4


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

* Re: [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas
  2026-09-16 12:03 ` [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas Mike Rapoport (Microsoft)
@ 2026-09-16 12:12   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:12 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Heiko Carstens, linux-s390, Alexander Gordeev,
	Christian Borntraeger, Vasily Gorbik

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/cio: kzalloc() breaks CHSC hardware 4K alignment requirement
--

commit a66087fda8920c920a2e60507dcf682684ee9966
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

    s390/cio: Use kzalloc() for CHSC work areas
    
    chsc_init() allocates the work area for CHSC commands and
    qdio_allocate() allocates one for CHSC calls during qdio_establish().
    
    This memory can be allocated with kmalloc() as there's nothing special
    about it to go directly to the page allocator.

    Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
> index c3186c0a372b4..d98f629e89295 100644
> --- a/drivers/s390/cio/chsc.c
> +++ b/drivers/s390/cio/chsc.c
> @@ -1143,7 +1143,7 @@ int __init chsc_init(void)
>  	int ret;
>  
>  	sei_page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
                   ^^^^^^^

[Severity: High]
Can this kzalloc() allocation for sei_page in chsc_init() cause a hardware
specification exception?

The s390 CHSC (Channel Subsystem Call) instruction requires its command-request
block operands to be strictly aligned on a 4K page boundary. Under kernel debug
configurations like CONFIG_SLUB_DEBUG or KASAN, kmalloc caches append redzones
and metadata, which shifts the payload offset within higher-order pages and
breaks the natural page alignment.

Since sei_page is passed to the CHSC instruction, an unaligned operand could
result in a kernel crash.

> -	chsc_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
> +	chsc_page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
                    ^^^^^^^

[Severity: High]
Does replacing get_zeroed_page() with kzalloc() here similarly break the 4K
page alignment guarantee for chsc_page?

Like sei_page, the global chsc_page in drivers/s390/cio/chsc.c is used directly
as a CHSC command block and will fault if it is unaligned. By moving from
get_zeroed_page() to kzalloc(), the strict page alignment guarantee is lost on
debug kernels.

[ ... ]

> diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> index c1e09fa34e774..d137bf8c70664 100644
> --- a/drivers/s390/cio/qdio_main.c
> +++ b/drivers/s390/cio/qdio_main.c
[ ... ]
> @@ -986,7 +986,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
>  	 * qdio_establish. In case of low memory and swap on a zfcp disk
>  	 * we may not be able to allocate memory otherwise.
>  	 */
> -	irq_ptr->chsc_page = get_zeroed_page(GFP_KERNEL);
> +	irq_ptr->chsc_page = kzalloc(PAGE_SIZE, GFP_KERNEL);
                             ^^^^^^^

[Severity: High]
Does using kzalloc() here in qdio_allocate() break the 4K alignment
requirement for the per-irq chsc_page?

This per-irq chsc_page in drivers/s390/cio/qdio_main.c is passed to hardware
in qdio_setup_get_ssqd() and set_subchannel_ind(). If CONFIG_SLUB_DEBUG or
KASAN is enabled, the kzalloc payload may not be 4K-aligned, causing a hardware
specification exception during device setup.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=5

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

* Re: [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests
  2026-09-16 12:03 ` [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests Mike Rapoport (Microsoft)
@ 2026-09-16 12:14   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:14 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, linux-s390, Alexander Gordeev, Heiko Carstens,
	Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/cio: kzalloc() breaks 4KB hardware alignment required by chsc instruction
--

commit 54194635e9207f1ada1f8c978b8a14c7a6ba3fc7
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>
s390/chsc_sch: Use kzalloc() for CHSC requests

This commit replaces the use of get_zeroed_page() with kzalloc() and 
free_page() with kfree() for allocating and freeing CHSC request and 
response areas across several ioctl handlers.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
> index b6cb8bb8bcc4b..c8d6871d1841e 100644
> --- a/drivers/s390/cio/chsc_sch.c
> +++ b/drivers/s390/cio/chsc_sch.c
> @@ -292,7 +292,7 @@ static int chsc_ioctl_start(void __user *user_area)
>  	if (!css_general_characteristics.dynio)
>  		/* It makes no sense to try. */
>  		return -EOPNOTSUPP;
> -	chsc_area = (void *)get_zeroed_page(GFP_DMA | GFP_KERNEL);
> +	chsc_area = kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL);

[Severity: High]
Does changing this allocation to kzalloc() break the 4KB hardware page
alignment required by the chsc instruction?

When debugging options like slub debug redzones or kasan are enabled, using
kzalloc() for a page-sized allocation does not guarantee that the returned
pointer is page-aligned. Since the chsc hardware instruction requires the 
command block operand to reside strictly on a 4KB boundary, passing an 
unaligned pointer can result in a specification exception 
(Program Interrupt 0x06) and an immediate kernel panic.

[ ... ]

> @@ -392,7 +392,7 @@ static int chsc_ioctl_start_sync(void __user *user_area)
>  	struct chsc_sync_area *chsc_area;
>  	int ret, ccode;
>  
> -	chsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
> +	chsc_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);

[Severity: High]
This appears to be another instance where dynamically allocated memory might
not be page-aligned. Could this unaligned pointer also be passed directly to
the chsc() hardware instruction later in this function, triggering the same
specification exception?

[ ... ]

> @@ -438,7 +438,7 @@ static int chsc_ioctl_info_channel_path(void __user *user_cd)
>  		u8 data[PAGE_SIZE - 20];
>  	} __attribute__ ((packed)) *scpcd_area;
>  
> -	scpcd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
> +	scpcd_area = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);

[Severity: High]
This looks like it matches the same allocation pattern for the channel path
description command block. Will this also lead to an unaligned pointer
being passed to chsc()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=3

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

* Re: [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs
  2026-09-16 12:03 ` [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs Mike Rapoport (Microsoft)
@ 2026-09-16 12:15   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:15 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Alexander Gordeev, Christian Borntraeger, linux-s390,
	Vasily Gorbik, Heiko Carstens

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/cio: kzalloc() breaks strict 4K page-alignment for CUB/ECUB DMA
--

commit 6b733741b98fcfa57ed4ac8655c793a212c8f4aa
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>
s390/chsc: Use kzalloc() for CUBs

This commit replaces the use of get_zeroed_page() with kzalloc() and
free_page() with kfree() for allocating and freeing channel measurement unit
blocks (CUBs) and extended CUBs.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
> index 9689f722c863c..60a4a7e6086ce 100644
> --- a/drivers/s390/cio/chsc.c
> +++ b/drivers/s390/cio/chsc.c
> @@ -931,12 +931,12 @@ static int cub_alloc(struct channel_subsystem *css)
>  	int i;
>  
>  	for (i = 0; i < CSS_NUM_CUB_PAGES; i++) {
> -		css->cub[i] = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
> +		css->cub[i] = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);

[Severity: High]
Is it safe to use kzalloc() here when the s390 hardware strictly expects
4K-aligned page addresses for Channel Measurement Blocks?

When SLUB debugging or KASAN is enabled, kzalloc() can return a pointer that
is shifted away from the 4K page boundary due to padding and redzones. Since
__chsc_do_secm() passes these pointers to hardware which truncates the lower
12 bits:

drivers/s390/cio/chsc.c:__chsc_do_secm() {
    ...
    secm_area->cub[i] = (__force dma64_t)virt_to_dma32(css->cub[i]);
    ...
}

Would this cause the hardware to DMA write to the start of the slab page,
potentially overwriting SLUB metadata or adjacent objects when channel
measurement is enabled?

>  		if (!css->cub[i])
>  			return -ENOMEM;
>  	}
>  	for (i = 0; i < CSS_NUM_ECUB_PAGES; i++) {
> -		css->ecub[i] = (void *)get_zeroed_page(GFP_KERNEL);
> +		css->ecub[i] = kzalloc(PAGE_SIZE, GFP_KERNEL);

[Severity: High]
Does this allocation have the same 4K alignment requirement as CUB pages
above, and could it cause the same DMA memory corruption if the pointer is
not page-aligned?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=1

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

* Re: [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area
  2026-09-16 12:03 ` [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area Mike Rapoport (Microsoft)
@ 2026-09-16 12:15   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:15 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger

> chsc_init() allocates the work area for store event information data.
> 
> This memory can be allocated with kmalloc() as there's nothing special
> about it to go directly to the page allocator.
> 
> kmalloc() provides a better API that does not require ugly casts and
> kfree() does not need to know the size of the freed object.
> 
> Performance difference between kmalloc() and __get_free_pages() is not
> measurable as both allocators take an object/page from a per-CPU list for
> fast path allocations.
> 
> For the slow path the performance is anyway determined by the amount of
> reclaim involved rather than by what allocator is used.
> 
> Replace use of get_zeroed_page() with kzalloc() and free_page() with
> kfree().
> 
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Assisted-by: copilot:claude-opus
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=2


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

* Re: [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers
  2026-09-16 12:03 ` [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers Mike Rapoport (Microsoft)
@ 2026-09-16 12:16   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:16 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, Alexander Gordeev, Heiko Carstens, linux-s390,
	Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] s390/idals: hardware alignment violation in IDAL buffers due to kmalloc()
--

commit d18db8674582ba776adea76af1cc752b0a5fcd3a
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

s390/idals: Use kmalloc() for IDAL data buffers

idal_buffer_alloc() allocates the data chunks of an IDAL buffer that is
used for channel I/O. Replace use of __get_free_pages() with kmalloc()
and free_pages() with kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h
> index 06e1ec2afd5af..213f430a8d33a 100644
> --- a/arch/s390/include/asm/idals.h
> +++ b/arch/s390/include/asm/idals.h

[ ... ]

> @@ -135,21 +136,23 @@ struct idal_buffer {
>   * Allocate an idal buffer
>   */
>  static inline struct idal_buffer *idal_buffer_alloc(size_t size, int page_order)
>  {
>  	int nr_chunks, nr_ptrs, i;
>  	struct idal_buffer *ib;
>  	void *vaddr;
>  
>  	nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_SHIFT;
>  	nr_chunks = (PAGE_SIZE << page_order) >> IDA_SIZE_SHIFT;
>  	ib = kmalloc_flex(*ib, data, nr_ptrs, GFP_DMA | GFP_KERNEL);
>  	if (!ib)
>  		return ERR_PTR(-ENOMEM);
>  	ib->size = size;
>  	ib->page_order = page_order;
>  	for (i = 0; i < nr_ptrs; i++) {
>  		if (i & (nr_chunks - 1)) {
>  			ib->data[i] = dma64_add(ib->data[i - 1], IDA_BLOCK_SIZE);
>  			continue;
>  		}
> -		vaddr = (void *)__get_free_pages(GFP_KERNEL, page_order);
> +		vaddr = kmalloc(PAGE_SIZE << page_order, GFP_KERNEL);

[Severity: Critical]
Does using kmalloc() here drop the hardware alignment guarantees required for
IDAL data buffers?

The s390 Channel Subsystem strictly requires all Indirect Data Address Words
(IDAWs), except the first, to be aligned to absolute 2K or 4K boundaries.

kmalloc() does not guarantee page alignment, especially when debugging options
like SLAB_RED_ZONE or KFENCE are enabled.

If an unaligned address is returned and passed to the channel subsystem, it
will generate a program check (I/O error).

Also, subsequent IDAW addresses are computed from the base pointer slightly
earlier in this loop:

	ib->data[i] = dma64_add(ib->data[i - 1], IDA_BLOCK_SIZE);

If the base pointer from kmalloc() is unaligned, does this corrupt all
subsequent IDAWs and violate the hardware alignment rules?

Furthermore, if the first IDAW is unaligned, the hardware transfers data only
up to the next 4K boundary (fewer than 4096 bytes).

The software size calculation earlier in idal_buffer_alloc() assumes exactly
4096 bytes are transferred per IDAW:

	nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_SHIFT;

To satisfy the total transfer count, will the hardware attempt to fetch more
IDAWs than were allocated in the ib->data array?

This could lead to an out-of-bounds read where the hardware interprets random
data past the array bounds as a physical address, causing silent memory
corruption during DMA I/O.

>  		if (!vaddr)
>  			goto error;
> +		/* Only DMA addresses are retained in ib->data. */
> +		kmemleak_ignore(vaddr);
>  		ib->data[i] = virt_to_dma64(vaddr);
>  	}
>  	return ib;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=7

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

* Re: [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR
  2026-09-16 12:03 ` [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR Mike Rapoport (Microsoft)
@ 2026-09-16 12:16   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:16 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: linux-s390, Vasily Gorbik, Alexander Gordeev, Heiko Carstens,
	Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/qdio: kzalloc loses required hardware page alignment for QDR and CHSC
--

commit c802b7f29143c62b6663a20acaa96b4a8ed1cfb1
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

s390/qdio_main: Use kzalloc() for the QDR

This commit changes the allocation of the Queue Description Record (QDR) from
the page allocator to kzalloc(). The intent is to use a better API and avoid
tracking the size of the freed object, as both allocators use per-CPU lists
for the fast path.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> index 28eb8602ca97e..889f63f94a4a7 100644
> --- a/drivers/s390/cio/qdio_main.c
> +++ b/drivers/s390/cio/qdio_main.c

[ ... ]

> @@ -988,7 +988,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
>  		goto err_chsc;
>  
>  	/* qdr is used in ccw1.cda which is u32 */
> -	irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
> +	irq_ptr->qdr = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);

[Severity: High]
Will replacing the page allocator with kzalloc() break the 4K page-alignment
guarantee necessary for QDR hardware interactions?

When CONFIG_SLUB_DEBUG (redzoning) or KASAN is enabled, SLUB prepends metadata
to the object, shifting it away from the page boundary. If an unaligned
physical address is passed to the s390 channel subsystem hardware, it either
truncates the lower bits (causing silent DMA corruption by accessing adjacent
slab metadata) or raises a specification exception, leading to I/O device
failure. This could affect QDIO device initialization (e.g., zfcp, qeth) on
debug kernels.

Are there similar alignment issues with irq_ptr->chsc_page and irq_ptr
allocated earlier in qdio_allocate()? CHSC command blocks require strict 4K
page alignment, and struct qib (embedded in struct qdio_irq) requires 256-byte
hardware alignment. It appears kzalloc() will lose these guarantees under SLUB
debugging as well.

>  	if (!irq_ptr->qdr)
>  		goto err_qdr;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=9

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

* Re: [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure
  2026-09-16 12:03 ` [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure Mike Rapoport (Microsoft)
@ 2026-09-16 12:17   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:17 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, Alexander Gordeev, linux-s390, Heiko Carstens,
	Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/qdio: kzalloc() breaks strict hardware alignment for qib and chsc_page
--

commit 9f2f47b6eeaa2161812dfa4d13374862da2270d0
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>
s390/qdio_main: Use kzalloc() for the IRQ structure

This commit modifies the memory allocation for the QDIO IRQ structure, 
switching from the page allocator to the slab allocator. It replaces 
get_zeroed_page() with kzalloc() and updates the free paths to use kfree(). 
It also removes a related kmemleak exemption.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> index d137bf8c70664..28eb8602ca97e 100644
> --- a/drivers/s390/cio/qdio_main.c
> +++ b/drivers/s390/cio/qdio_main.c

[ ... ]

> @@ -961,7 +961,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
>  	    no_output_qs > QDIO_MAX_QUEUES_PER_IRQ)
>  		return -EINVAL;
>  
> -	irq_ptr = (void *) get_zeroed_page(GFP_KERNEL);
> +	irq_ptr = kzalloc(PAGE_SIZE, GFP_KERNEL);

[Severity: High]
Does this kzalloc() replacement break the architectural alignment guarantees 
for the QDIO irq structure?

The irq_ptr contains a struct qib which has a strict 256-byte architectural
alignment requirement. Additionally, the irq_ptr->chsc_page allocated later
in qdio_allocate() (which was also converted to kzalloc in an earlier patch)
is passed to the CHSC instruction, which strictly mandates 4096-byte (page)
alignment.

When memory debugging features like CONFIG_SLUB_DEBUG (redzoning) or KASAN
are enabled, kzalloc() can return a pointer offset by the redzone size, 
breaking these 256-byte and 4096-byte structural alignment guarantees.

Could passing this unaligned memory to the CHSC hardware instruction 
trigger a hardware specification exception during device initialization?

>  	if (!irq_ptr)
>  		return -ENOMEM;
>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=8

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

* Re: [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area
  2026-09-16 12:03 ` [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area Mike Rapoport (Microsoft)
@ 2026-09-16 12:18   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:18 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/cio: hardware alignment violation in alloc_cmb() due to kmalloc()
--

commit 8f39fa3622bcd7032d06a1645dbaec85cdb07a1f
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

s390/cmf: Use kmalloc() for the CMB area

alloc_cmb() allocates the channel measurement block area shared by
devices using the basic channel measurement format. This commit replaces
__get_free_pages() with kmalloc() and free_pages() with kfree().

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
> index 92ab3d546fe47..8fd41a7dfc20b 100644
> --- a/drivers/s390/cio/cmf.c
> +++ b/drivers/s390/cio/cmf.c
[ ... ]
> @@ -501,12 +504,12 @@ static int alloc_cmb(struct ccw_device *cdev)
>  		WARN_ON(!list_empty(&cmb_area.list));
>  
>  		spin_unlock(&cmb_area.lock);
> -		mem = (void *)__get_free_pages(GFP_KERNEL, get_order(size));
> +		mem = kmalloc(size, GFP_KERNEL);

[Severity: High]
Does this allocation still guarantee the 32-byte alignment required by the
hardware for the measurement block origin (MBO)?

While kmalloc() naturally aligns power-of-two multiples in default
configurations, if memory debugging options like CONFIG_SLUB_DEBUG
(redzoning) or CONFIG_KASAN are enabled, SLUB can insert metadata padding
before the object payload.

This padding shifts the returned physical address so it is only guaranteed
to be aligned to ARCH_KMALLOC_MINALIGN (8 bytes on s390), potentially
breaking the 32-byte alignment requirement.

If the unaligned address is then used in cmf_activate():

drivers/s390/cio/cmf.c:cmf_activate() {
    ...
	asm volatile(
		"	lgr	1,%[r1]\n"
		"	lgr	2,%[mbo]\n"
		"	schm"
		:
		: [r1] "d" ((unsigned long)onoff),
		  [mbo] "d" (virt_to_phys(area))
		: "1", "2");
    ...
}

could this trigger a specification exception and crash the kernel when the
schm instruction executes?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=6

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

* Re: [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers
  2026-09-16 12:03 ` [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers Mike Rapoport (Microsoft)
@ 2026-09-16 12:21   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:21 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: linux-s390, Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Alexander Gordeev

> qdio_alloc_buffers() allocates the QDIO buffers.
> 
> This memory can be allocated with kmalloc() as there's nothing special
> about it to go directly to the page allocator.
> 
> kmalloc() provides a better API that does not require ugly casts and
> kfree() does not need to know the size of the freed object.
> 
> Performance difference between kmalloc() and __get_free_pages() is not
> measurable as both allocators take an object/page from a per-CPU list for
> fast path allocations.
> 
> For the slow path the performance is anyway determined by the amount of
> reclaim involved rather than by what allocator is used.
> 
> Replace use of get_zeroed_page() with kzalloc() and free_page() with
> kfree().
> 
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Assisted-by: copilot:claude-opus
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=10


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

* Re: [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list
  2026-09-16 12:03 ` [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list Mike Rapoport (Microsoft)
@ 2026-09-16 12:23   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:23 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Heiko Carstens, Christian Borntraeger, linux-s390,
	Alexander Gordeev, Vasily Gorbik

> __qdio_allocate_qs() allocates the storage list information block of a
> queue.
> 
> This memory can be allocated with kmalloc() as there's nothing special
> about it to go directly to the page allocator.
> 
> kmalloc() provides a better API that does not require ugly casts and
> kfree() does not need to know the size of the freed object.
> 
> Performance difference between kmalloc() and __get_free_pages() is not
> measurable as both allocators take an object/page from a per-CPU list for
> fast path allocations.
> 
> For the slow path the performance is anyway determined by the amount of
> reclaim involved rather than by what allocator is used.
> 
> Replace use of __get_free_page() with kmalloc() and free_page() with
> kfree().
> 
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Assisted-by: copilot:claude-opus
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=11


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

* Re: [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information
  2026-09-16 12:03 ` [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information Mike Rapoport (Microsoft)
@ 2026-09-16 12:23   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:23 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: linux-s390, Vasily Gorbik, Christian Borntraeger, Heiko Carstens,
	Alexander Gordeev

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/cio: kmalloc breaks 4K alignment requirement for CHSC blocks
--

commit 9d079c715a16b3a1d4f369edca3a1cd7d672af83
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

s390/scm: Use kmalloc() for SCM information

This commit replaces __get_free_page() with kmalloc() and free_page() with
kfree() for allocating the SCM information response buffer. It also adopts
__free(kfree) for scoped cleanup of the buffer.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c
> index 171212a6d2d9c..b79fe023ab8d1 100644
> --- a/drivers/s390/cio/scm.c
> +++ b/drivers/s390/cio/scm.c
[ ... ]
> @@ -224,12 +225,12 @@ static int scm_add(struct chsc_scm_info *scm_info, size_t num)
>  
>  int scm_update_information(void)
>  {
> -	struct chsc_scm_info *scm_info;
> +	struct chsc_scm_info *scm_info __free(kfree) = NULL;
>  	u64 token = 0;
>  	size_t num;
>  	int ret;
>  
> -	scm_info = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
> +	scm_info = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);

[Severity: High]
Does using kmalloc() here break the 4K page-alignment requirement for CHSC
command blocks?

The S390 architecture specifies that CHSC command blocks must reside on a
strictly 4K-byte boundary.

The hardware instruction executed in chsc() enforces this alignment
requirement and raises a specification exception if violated.

While __get_free_page() intrinsically returns a page-aligned address,
kmalloc(PAGE_SIZE) does not guarantee page alignment.

For example, when CONFIG_SLUB_DEBUG is enabled, the returned pointer is
shifted away from the page boundary by redzones and metadata.

Could passing this misaligned pointer to the hardware instruction break the
architecture contract and cause command failures?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=13

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

* Re: [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request
  2026-09-16 12:03 ` [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request Mike Rapoport (Microsoft)
@ 2026-09-16 12:23   ` sashiko-bot
  0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-09-16 12:23 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, Heiko Carstens, linux-s390, Alexander Gordeev,
	Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/cio: CHSC command block alignment broken by kmalloc()
--

commit 81f70c4032ffb64f5a06eb9ca6de3a70bfe61e77
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

s390/qdio_setup: Use kmalloc() for the SSQD request

This commit replaces the use of __get_free_page() with kmalloc() and
free_page() with kfree() for the SSQD request block allocation. It assumes
there is no special requirement for the memory to come directly from the
page allocator.

Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com

> diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
> index d8e9c0872d15d..e1c5c6a8b3b27 100644
> --- a/drivers/s390/cio/qdio_setup.c
> +++ b/drivers/s390/cio/qdio_setup.c
[ ... ]
> @@ -249,7 +249,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
>  
>  	DBF_EVENT("getssqd:%4x", schid->sch_no);
>  	if (!irq_ptr) {
> -		ssqd = (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL);
> +		ssqd = kmalloc(PAGE_SIZE, GFP_KERNEL);

[Severity: High]
Does this kmalloc() call break the strict 4K-byte physical page alignment
required for the CHSC command block?

While __get_free_page() guarantees page alignment, kmalloc(PAGE_SIZE) does
not. When memory debugging features like KASAN or SLAB_RED_ZONE are enabled,
metadata is inserted before the object, shifting the payload pointer away
from the page boundary.

Could passing this unaligned pointer to the hardware via chsc_ssqd() trigger
a hardware specification exception (PGM_SPECIFICATION) and kernel crash
during device initialization? 

It is also worth noting that this same pattern seems to be repeated in 
follow-up patches in the series, such as the changes in scm.c.

>  		if (!ssqd)
>  			return -ENOMEM;
>  	} else {
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org?part=12

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

* Re: [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc()
  2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
                   ` (12 preceding siblings ...)
  2026-09-16 12:03 ` [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information Mike Rapoport (Microsoft)
@ 2026-09-16 13:06 ` Heiko Carstens
  2026-09-18 16:23   ` Peter Oberparleiter
  13 siblings, 1 reply; 30+ messages in thread
From: Heiko Carstens @ 2026-09-16 13:06 UTC (permalink / raw)
  To: Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Peter Oberparleiter, Sven Schnelle, Vineeth Vijayan,
	Vlastimil Babka, linux-s390, linux-kernel, linux-mm

On Wed, Sep 16, 2026 at 03:03:07PM +0300, Mike Rapoport (Microsoft) wrote:
> The saga continues :)
> 
> This series covers CIO, QDIO, SCM and IDAL buffer allocations.

...

> Mike Rapoport (Microsoft) (13):
>       s390/chsc: Use kzalloc() for CUBs
>       s390/chsc: Use kzalloc() for the SEI work area
>       s390/chsc_sch: Use kzalloc() for CHSC requests
>       s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests
>       s390/cio: Use kzalloc() for CHSC work areas
>       s390/cmf: Use kmalloc() for the CMB area
>       s390/idals: Use kmalloc() for IDAL data buffers
>       s390/qdio_main: Use kzalloc() for the IRQ structure
>       s390/qdio_main: Use kzalloc() for the QDR
>       s390/qdio_setup: Use kzalloc() for QDIO buffers
>       s390/qdio_setup: Use kmalloc() for the storage list
>       s390/qdio_setup: Use kmalloc() for the SSQD request
>       s390/scm: Use kmalloc() for SCM information
> 
>  arch/s390/include/asm/idals.h   |   9 +-
>  drivers/s390/cio/chsc.c         |  20 +--
>  drivers/s390/cio/chsc_sch.c     | 300 ++++++++++++++--------------------------
>  drivers/s390/cio/cmf.c          |  11 +-
>  drivers/s390/cio/qdio.h         |   2 +-
>  drivers/s390/cio/qdio_main.c    |  23 ++-
>  drivers/s390/cio/qdio_setup.c   |  14 +-
>  drivers/s390/cio/qdio_thinint.c |   2 +-
>  drivers/s390/cio/scm.c          |   7 +-
>  9 files changed, 150 insertions(+), 238 deletions(-)

As far as I am concerned:
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>

Waiting for IO folks before applying. Thanks!

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

* Re: [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc()
  2026-09-16 13:06 ` [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Heiko Carstens
@ 2026-09-18 16:23   ` Peter Oberparleiter
  2026-09-20 18:20     ` Heiko Carstens
  0 siblings, 1 reply; 30+ messages in thread
From: Peter Oberparleiter @ 2026-09-18 16:23 UTC (permalink / raw)
  To: Heiko Carstens, Mike Rapoport (Microsoft)
  Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, Vineeth Vijayan, Vlastimil Babka, linux-s390,
	linux-kernel, linux-mm

On 16.09.2026 15:06, Heiko Carstens wrote:
> On Wed, Sep 16, 2026 at 03:03:07PM +0300, Mike Rapoport (Microsoft) wrote:
>> The saga continues :)
>>
>> This series covers CIO, QDIO, SCM and IDAL buffer allocations.
> 
> ...
> 
>> Mike Rapoport (Microsoft) (13):
>>       s390/chsc: Use kzalloc() for CUBs
>>       s390/chsc: Use kzalloc() for the SEI work area
>>       s390/chsc_sch: Use kzalloc() for CHSC requests
>>       s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests
>>       s390/cio: Use kzalloc() for CHSC work areas
>>       s390/cmf: Use kmalloc() for the CMB area
>>       s390/idals: Use kmalloc() for IDAL data buffers
>>       s390/qdio_main: Use kzalloc() for the IRQ structure
>>       s390/qdio_main: Use kzalloc() for the QDR
>>       s390/qdio_setup: Use kzalloc() for QDIO buffers
>>       s390/qdio_setup: Use kmalloc() for the storage list
>>       s390/qdio_setup: Use kmalloc() for the SSQD request
>>       s390/scm: Use kmalloc() for SCM information
>>
>>  arch/s390/include/asm/idals.h   |   9 +-
>>  drivers/s390/cio/chsc.c         |  20 +--
>>  drivers/s390/cio/chsc_sch.c     | 300 ++++++++++++++--------------------------
>>  drivers/s390/cio/cmf.c          |  11 +-
>>  drivers/s390/cio/qdio.h         |   2 +-
>>  drivers/s390/cio/qdio_main.c    |  23 ++-
>>  drivers/s390/cio/qdio_setup.c   |  14 +-
>>  drivers/s390/cio/qdio_thinint.c |   2 +-
>>  drivers/s390/cio/scm.c          |   7 +-
>>  9 files changed, 150 insertions(+), 238 deletions(-)
> 
> As far as I am concerned:
> Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
> 
> Waiting for IO folks before applying. Thanks!

Looks good to me! For the full series:

Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>


-- 
Peter Oberparleiter
Linux on IBM Z Development - IBM Germany R&D

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

* Re: [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc()
  2026-09-18 16:23   ` Peter Oberparleiter
@ 2026-09-20 18:20     ` Heiko Carstens
  0 siblings, 0 replies; 30+ messages in thread
From: Heiko Carstens @ 2026-09-20 18:20 UTC (permalink / raw)
  To: Peter Oberparleiter
  Cc: Mike Rapoport (Microsoft), Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Vineeth Vijayan,
	Vlastimil Babka, linux-s390, linux-kernel, linux-mm

On Fri, Sep 18, 2026 at 06:23:00PM +0200, Peter Oberparleiter wrote:
> On 16.09.2026 15:06, Heiko Carstens wrote:
> > On Wed, Sep 16, 2026 at 03:03:07PM +0300, Mike Rapoport (Microsoft) wrote:
> >> Mike Rapoport (Microsoft) (13):
> >>       s390/chsc: Use kzalloc() for CUBs
> >>       s390/chsc: Use kzalloc() for the SEI work area
> >>       s390/chsc_sch: Use kzalloc() for CHSC requests
> >>       s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests
> >>       s390/cio: Use kzalloc() for CHSC work areas
> >>       s390/cmf: Use kmalloc() for the CMB area
> >>       s390/idals: Use kmalloc() for IDAL data buffers
> >>       s390/qdio_main: Use kzalloc() for the IRQ structure
> >>       s390/qdio_main: Use kzalloc() for the QDR
> >>       s390/qdio_setup: Use kzalloc() for QDIO buffers
> >>       s390/qdio_setup: Use kmalloc() for the storage list
> >>       s390/qdio_setup: Use kmalloc() for the SSQD request
> >>       s390/scm: Use kmalloc() for SCM information
> >>
> >>  arch/s390/include/asm/idals.h   |   9 +-
> >>  drivers/s390/cio/chsc.c         |  20 +--
> >>  drivers/s390/cio/chsc_sch.c     | 300 ++++++++++++++--------------------------
> >>  drivers/s390/cio/cmf.c          |  11 +-
> >>  drivers/s390/cio/qdio.h         |   2 +-
> >>  drivers/s390/cio/qdio_main.c    |  23 ++-
> >>  drivers/s390/cio/qdio_setup.c   |  14 +-
> >>  drivers/s390/cio/qdio_thinint.c |   2 +-
> >>  drivers/s390/cio/scm.c          |   7 +-
> >>  9 files changed, 150 insertions(+), 238 deletions(-)
> > 
> > As far as I am concerned:
> > Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
> > 
> > Waiting for IO folks before applying. Thanks!
> 
> Looks good to me! For the full series:
> 
> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>

Series applied, thanks!

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

end of thread, other threads:[~2026-09-20 18:20 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-16 12:03 [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
2026-09-16 12:03 ` [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs Mike Rapoport (Microsoft)
2026-09-16 12:15   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area Mike Rapoport (Microsoft)
2026-09-16 12:15   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests Mike Rapoport (Microsoft)
2026-09-16 12:14   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous " Mike Rapoport (Microsoft)
2026-09-16 12:10   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas Mike Rapoport (Microsoft)
2026-09-16 12:12   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area Mike Rapoport (Microsoft)
2026-09-16 12:18   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers Mike Rapoport (Microsoft)
2026-09-16 12:16   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure Mike Rapoport (Microsoft)
2026-09-16 12:17   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR Mike Rapoport (Microsoft)
2026-09-16 12:16   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers Mike Rapoport (Microsoft)
2026-09-16 12:21   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list Mike Rapoport (Microsoft)
2026-09-16 12:23   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request Mike Rapoport (Microsoft)
2026-09-16 12:23   ` sashiko-bot
2026-09-16 12:03 ` [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information Mike Rapoport (Microsoft)
2026-09-16 12:23   ` sashiko-bot
2026-09-16 13:06 ` [PATCH v3 00/13] s390/cio: replace page allocator calls with k[mz]alloc() Heiko Carstens
2026-09-18 16:23   ` Peter Oberparleiter
2026-09-20 18:20     ` Heiko Carstens

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