From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F2502F39C7; Wed, 16 Sep 2026 12:03:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560208; cv=none; b=snhqJBwoFEkrgzaGJu2FAqa677eWygN4RMcsIMHwKpVs8MCJk2gFqAnl/ljesdUmjCzwHJyQcDPvgmbvsTK4ITNHCNSBObFbdyvLXNUFov9Hy+sSsOsw4PR7TJsUoiCaNAXbjnkI8LDebAcS8zREMS0c4M5trydBuYnvmotO1wY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560208; c=relaxed/simple; bh=oaUUL2Z6uTL/fsueJ+wmiwF3r3nbRoUwtNTlWdzZV88=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cglZDzpkPEyQWVQqXPKqjJi2ZRNcvP0CRUuu9JINQ7LH7NKEvDEXCx/GJUyUBaDTp571C3SNrVc1+p8SufODS7yNAw6nCXD/QjCSAEmW8GVH3w6d9ELwA/274Ajg1rFjhMJ34dMCKGpvNV2Ppxu7g6mEQHPvICxef94PMmQC0ws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q0FdByJo; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q0FdByJo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21F901F000FF; Wed, 16 Sep 2026 12:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560200; bh=waNeuygMDtlm0C03ZytfUl73M0zkpwkt1aPQuPSWLWw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Q0FdByJo2zQubwwDanKYIzUBcXtvTMfCBp48qm27YmTgxRoSrMstqxCXZn3n7+Pnh P8XMlopALRmq8brgzuz4FAcRj2moZDa0LqfAbG79mV3jTtUXfv4vdc9jhr0hw73wTo 52/CDFK4hCado3mS52WJGzfIygnK84s1ZlEWQ3+ugodrQTObrzgiqOti0s6qzDHZRo tlEV3WM6VvQjmHIY7bIdGGf8DUN05ZodD9RR1JpT5RndszfIbav2A/M2NMdpeGm2Aa bJ8gq6x4hJMLIGe4kbp889e4uiTDAHZCC774BMAR8DI+a4djw/squiF8LHaJTw/eS/ HdAYo+u9zYdhQ== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:08 +0300 Subject: [PATCH v3 01/13] s390/chsc: Use kzalloc() for CUBs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-1-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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; =20 for (i =3D 0; i < CSS_NUM_CUB_PAGES; i++) { - css->cub[i] =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + css->cub[i] =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!css->cub[i]) return -ENOMEM; } for (i =3D 0; i < CSS_NUM_ECUB_PAGES; i++) { - css->ecub[i] =3D (void *)get_zeroed_page(GFP_KERNEL); + css->ecub[i] =3D 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; =20 for (i =3D 0; i < CSS_NUM_CUB_PAGES; i++) { - free_page((unsigned long)css->cub[i]); + kfree(css->cub[i]); css->cub[i] =3D NULL; } for (i =3D 0; i < CSS_NUM_ECUB_PAGES; i++) { - free_page((unsigned long)css->ecub[i]); + kfree(css->ecub[i]); css->ecub[i] =3D NULL; } } --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E335175A7F; Wed, 16 Sep 2026 12:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560213; cv=none; b=eBQXqDmHzCisX8cLS7lE+wuutIpLhg+7d6a6CvvNAI50KUhXnZ0tzwXJlbRQCnxAI0ErSv5EigZSYLqRiDPhgfif+UdqwTl4TDZ7o9mzrPUneGRnZTzoyu6qn8x40m41hYeHmy5ENeoFO45CApgYRWzhqhFd6CpprgIWxtujDhQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560213; c=relaxed/simple; bh=tnPqOGWy+G/exKowrqrFWAt1LzC422b7ugtuCq4Q7iQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SyctOpzZTHkDpxaRm+LiryWtjRH3b+MeM6BkhT4K+/1te0pprznpI72MzZjRGnT3th8Pr9MckiQvgucFilLOIbuYS4Il55at4/+NBvMd4JuuPexhSiyKNKxGLHfcUFJWf5Fv47brwT5Gzj32y2wXe2K9HzJ8r2QCV02smsfpRm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mn2bIJmY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mn2bIJmY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A49C01F00898; Wed, 16 Sep 2026 12:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560203; bh=BvSsEcfuxj9lC5YTGUuAUBtK1T4naFDW4wq12j/K7Zg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=mn2bIJmYb2iP6iTTQqcRf+V3ei9Y5yLFrakNHWf/D7voPbGhwR6ONRoyLaIQM2KAI JtNE9yoB1GAI2sszrO/4TdezQh5ZoOTscCnxAighHM7Ov7TdPCDrE3PV8GeL1vm5Uv G/HKnTHt5WvJyxt0Zy6h3+Blac/jnQj/8Rp3RapUnA0qUsYHeAp97D9Ac9qJKpH99L dfBENR4QV/Id02mK0tC4gOHtM0bYaso/fe9YO1xpV9QXHt/LOSQ32nIt9vGJwUwIOW j2AlQVN/MXbSQHT47PmZ8heCBfoaEVM6F1kmV1Sth8WyD1x7WCPboJvMTA8Imkrl0b wDOTPYFyPq/Tg== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:09 +0300 Subject: [PATCH v3 02/13] s390/chsc: Use kzalloc() for the SEI work area Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-2-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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; =20 - sei_page =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + sei_page =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); chsc_page =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); if (!sei_page || !chsc_page) { ret =3D -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; } =20 @@ -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); } =20 int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_c= ode) --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8CDA3438A8; Wed, 16 Sep 2026 12:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560219; cv=none; b=E8tH3aLj/cJ9qSbrgvEDP2R1eo0EjCgQVttNu800nPmwD1Pr+PPzFwsUm3QQ4j4ItBOoJFOdegzl3XAYRv+553wA3m13B7TU75QO606/TSW4vW11LKgxggQhPYBYf98zQ3ueFa4MRVGiinX3U9NVckICGXR6+lLYW/J3W25piGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560219; c=relaxed/simple; bh=27W7XaDI53ge61OsV1O82PMbVANHyRB3FsKg1gBZ+r0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oh3rvKO6dz4ljsDmYrq+NsABjRr3kCA6bbq7jgbFMRJm10GjZvbOxR0cUAuUBX0H9ZbL/q2/BfdwegqJ1nZmqhXuX/+zS43MF7+hjGhoFCKtMalugraD+PIRswakND789Yj1+Izv4X6HFum3ExWWwkNU3yjrwQk+/Go5M5P6YZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ahSvR4zm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ahSvR4zm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2FF41F00899; Wed, 16 Sep 2026 12:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560206; bh=/CjaWpeoftE+Wn2hDoCKbw50T/OskJjYcBztwhRMRzs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ahSvR4zmrj7MlMn11+aRMD7jMFHhkqn7OicU0oNfie1ohykF4eMiO/GZbA1eg+IiL gQb1me0lzuUfrSY8Ogl3inoXdAtcNgVH2IHfLrCZ2srfIR/tv7hwD2tPhMXuDFiojD KckhvxKtPszP5sKUZeWMntOw11BxZBhIMWgOt7pyrzupodB6cHiqdgWFKH+VMesBAM k++X0VduwxKPhrEpGl90pK1/vYk3Ea32IOj1sjAp5VdIpYk7Q9ECwKsGDMa/7wYRv4 e2uaINP294bJ5aj9C+pCaOHXyVESvZ1ZmEyCWCzHw3Nwd++SdfHu3bQcbnmMrk+bHx tka3wEO888xVg== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:10 +0300 Subject: [PATCH v3 03/13] s390/chsc_sch: Use kzalloc() for CHSC requests Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-3-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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 =3D (void *)get_zeroed_page(GFP_DMA | GFP_KERNEL); + chsc_area =3D kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL); if (!chsc_area) return -ENOMEM; request =3D 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; } =20 @@ -340,7 +340,7 @@ static int chsc_ioctl_on_close_set(void __user *user_ar= ea) ret =3D -ENOMEM; goto out_unlock; } - on_close_chsc_area =3D (void *)get_zeroed_page(GFP_DMA | GFP_KERNEL); + on_close_chsc_area =3D kzalloc(PAGE_SIZE, GFP_DMA | GFP_KERNEL); if (!on_close_chsc_area) { ret =3D -ENOMEM; goto out_free_request; @@ -353,7 +353,7 @@ static int chsc_ioctl_on_close_set(void __user *user_ar= ea) goto out_unlock; =20 out_free_chsc: - free_page((unsigned long)on_close_chsc_area); + kfree(on_close_chsc_area); on_close_chsc_area =3D NULL; out_free_request: kfree(on_close_request); @@ -375,7 +375,7 @@ static int chsc_ioctl_on_close_remove(void) ret =3D -ENOENT; goto out_unlock; } - free_page((unsigned long)on_close_chsc_area); + kfree(on_close_chsc_area); on_close_chsc_area =3D NULL; kfree(on_close_request); on_close_request =3D NULL; @@ -392,7 +392,7 @@ static int chsc_ioctl_start_sync(void __user *user_area) struct chsc_sync_area *chsc_area; int ret, ccode; =20 - chsc_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + chsc_area =3D 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 =3D 0; out_free: - free_page((unsigned long)chsc_area); + kfree(chsc_area); return ret; } =20 @@ -438,7 +438,7 @@ static int chsc_ioctl_info_channel_path(void __user *us= er_cd) u8 data[PAGE_SIZE - 20]; } __attribute__ ((packed)) *scpcd_area; =20 - scpcd_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + scpcd_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!scpcd_area) return -ENOMEM; cd =3D kzalloc_obj(*cd); @@ -476,7 +476,7 @@ static int chsc_ioctl_info_channel_path(void __user *us= er_cd) ret =3D 0; out_free: kfree(cd); - free_page((unsigned long)scpcd_area); + kfree(scpcd_area); return ret; } =20 @@ -500,7 +500,7 @@ static int chsc_ioctl_info_cu(void __user *user_cd) u8 data[PAGE_SIZE - 20]; } __attribute__ ((packed)) *scucd_area; =20 - scucd_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + scucd_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!scucd_area) return -ENOMEM; cd =3D kzalloc_obj(*cd); @@ -538,7 +538,7 @@ static int chsc_ioctl_info_cu(void __user *user_cd) ret =3D 0; out_free: kfree(cd); - free_page((unsigned long)scucd_area); + kfree(scucd_area); return ret; } =20 @@ -563,7 +563,7 @@ static int chsc_ioctl_info_sch_cu(void __user *user_cud) u8 data[PAGE_SIZE - 20]; } __attribute__ ((packed)) *sscud_area; =20 - sscud_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + sscud_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sscud_area) return -ENOMEM; cud =3D kzalloc_obj(*cud); @@ -602,7 +602,7 @@ static int chsc_ioctl_info_sch_cu(void __user *user_cud) ret =3D 0; out_free: kfree(cud); - free_page((unsigned long)sscud_area); + kfree(sscud_area); return ret; } =20 @@ -625,7 +625,7 @@ static int chsc_ioctl_conf_info(void __user *user_ci) u8 data[PAGE_SIZE - 20]; } __attribute__ ((packed)) *sci_area; =20 - sci_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + sci_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sci_area) return -ENOMEM; ci =3D kzalloc_obj(*ci); @@ -662,7 +662,7 @@ static int chsc_ioctl_conf_info(void __user *user_ci) ret =3D 0; out_free: kfree(ci); - free_page((unsigned long)sci_area); + kfree(sci_area); return ret; } =20 @@ -696,7 +696,7 @@ static int chsc_ioctl_conf_comp_list(void __user *user_= ccl) u32 res; } __attribute__ ((packed)) *cssids_parm; =20 - sccl_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + sccl_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sccl_area) return -ENOMEM; ccl =3D kzalloc_obj(*ccl); @@ -745,7 +745,7 @@ static int chsc_ioctl_conf_comp_list(void __user *user_= ccl) ret =3D 0; out_free: kfree(ccl); - free_page((unsigned long)sccl_area); + kfree(sccl_area); return ret; } =20 @@ -756,7 +756,7 @@ static int chsc_ioctl_chpd(void __user *user_chpd) int ret; =20 chpd =3D kzalloc_obj(*chpd); - scpd_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + scpd_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!scpd_area || !chpd) { ret =3D -ENOMEM; goto out_free; @@ -775,7 +775,7 @@ static int chsc_ioctl_chpd(void __user *user_chpd) ret =3D -EFAULT; out_free: kfree(chpd); - free_page((unsigned long)scpd_area); + kfree(scpd_area); return ret; } =20 @@ -796,7 +796,7 @@ static int chsc_ioctl_dcal(void __user *user_dcal) u8 data[PAGE_SIZE - 36]; } __attribute__ ((packed)) *sdcal_area; =20 - sdcal_area =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + sdcal_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sdcal_area) return -ENOMEM; dcal =3D kzalloc_obj(*dcal); @@ -834,7 +834,7 @@ static int chsc_ioctl_dcal(void __user *user_dcal) ret =3D 0; out_free: kfree(dcal); - free_page((unsigned long)sdcal_area); + kfree(sdcal_area); return ret; } =20 @@ -904,7 +904,7 @@ static int chsc_release(struct inode *inode, struct fil= e *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 =3D NULL; kfree(on_close_request); on_close_request =3D NULL; --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC02B3D7D64; Wed, 16 Sep 2026 12:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560224; cv=none; b=XAP+hafdbrV+DJK9aynQPSXrTG84nCF+uqlCEgfq/fd2eQcH1vh91ow8MCC79mqcjTlnNIYGKT49YKyt4fPIvk02tvrTSeAgM30fsBsl1IlAbXFevMUjicrSDIk1DCEEd7QhUzM1vSONeTKCNdPrnQzSNBbWQm3CswdXJ6AOC8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560224; c=relaxed/simple; bh=CSUDFFdhmtCWeW8oSX88//X3I6uiPteZhW4Opf/GQyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=acAxbcBvcp8OPZYOukF81SSCqZFbZJqA/vlhDWrh2yjAK2EPvNu/yoUoZfbS3HubEEJCjSLnJ0NjeHJT6U4LgqjwgulI1Ihpopd3glL2EYkzu/gDO69ZQ+Y1l+GwkawSh6Pbw5C/CyfxKQ7qXnbXpcjV8MoYNFZYUoOBOX8mSV0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bpV1JWpL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bpV1JWpL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E04531F00893; Wed, 16 Sep 2026 12:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560209; bh=wH/HnScIECqzPez57vPSs9kJwAMAsBLZmPepnLoPjpM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=bpV1JWpLM04RGbK5U4If2hI6Y4LcRDqVywq8G9ReCiaUs5k6T1WXMkizcMA2sGwrT fyxRR86ZRwACtE+NEeay1nJlFxlRQZz/xKLMPc5+G0lR9kOn9EzCTbrit+M5SY0Qbm WKNORYyiKnPyUikQfWoXOBJanlpL/617bbD+4jsT+AQf8PYpqjZLShaxlRgZ2yMKRD vXrxwbnSVTVAbA+ibbwAVCOA930bkYfjO706qwTCT5h62Xkp1lC8Sk+2Gmx1NKMBWo CLBLJIVOr0iQXie4vOUcd5eySMNYj5dxsGOWyYSLhnhy362ahS6tVZmaEcbX8YJ9S6 Huq6SnArIMgZA== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:11 +0300 Subject: [PATCH v3 04/13] s390/chsc_sch: Use __free(kfree) for synchronous CHSC requests Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-4-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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 #include #include +#include =20 #include #include @@ -389,39 +390,29 @@ static int chsc_ioctl_on_close_remove(void) =20 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) =3D NULL; + int ccode; =20 chsc_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!chsc_area) return -ENOMEM; - if (copy_from_user(chsc_area, user_area, PAGE_SIZE)) { - ret =3D -EFAULT; - goto out_free; - } - if (chsc_area->header.code & 0x4000) { - ret =3D -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 =3D chsc(chsc_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (copy_to_user(user_area, chsc_area, PAGE_SIZE)) - ret =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(chsc_area); - return ret; + return -EFAULT; + return 0; } =20 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) =3D 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) =3D NULL; =20 scpcd_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!scpcd_area) return -ENOMEM; cd =3D kzalloc_obj(*cd); - if (!cd) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(cd, user_cd, sizeof(*cd))) { - ret =3D -EFAULT; - goto out_free; - } + if (!cd) + return -ENOMEM; + if (copy_from_user(cd, user_cd, sizeof(*cd))) + return -EFAULT; scpcd_area->request.length =3D 0x0010; scpcd_area->request.code =3D 0x0028; scpcd_area->m =3D cd->m; @@ -459,31 +446,23 @@ static int chsc_ioctl_info_channel_path(void __user *= user_cd) scpcd_area->last_chpid =3D cd->chpid.id; =20 ccode =3D chsc(scpcd_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (scpcd_area->response.code !=3D 0x0001) { - ret =3D -EIO; CHSC_MSG(0, "scpcd: response code=3D%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 =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(cd); - kfree(scpcd_area); - return ret; + return -EFAULT; + return 0; } =20 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) =3D 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) =3D NULL; =20 scucd_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!scucd_area) return -ENOMEM; cd =3D kzalloc_obj(*cd); - if (!cd) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(cd, user_cd, sizeof(*cd))) { - ret =3D -EFAULT; - goto out_free; - } + if (!cd) + return -ENOMEM; + if (copy_from_user(cd, user_cd, sizeof(*cd))) + return -EFAULT; scucd_area->request.length =3D 0x0010; scucd_area->request.code =3D 0x0026; scucd_area->m =3D cd->m; @@ -521,31 +496,23 @@ static int chsc_ioctl_info_cu(void __user *user_cd) scucd_area->last_cun =3D cd->cun; =20 ccode =3D chsc(scucd_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (scucd_area->response.code !=3D 0x0001) { - ret =3D -EIO; CHSC_MSG(0, "scucd: response code=3D%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 =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(cd); - kfree(scucd_area); - return ret; + return -EFAULT; + return 0; } =20 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) =3D NULL; + int ccode; struct { struct chsc_header request; u32 : 2; @@ -561,20 +528,16 @@ static int chsc_ioctl_info_sch_cu(void __user *user_c= ud) u32 : 32; struct chsc_header response; u8 data[PAGE_SIZE - 20]; - } __attribute__ ((packed)) *sscud_area; + } __attribute__ ((packed)) *sscud_area __free(kfree) =3D NULL; =20 sscud_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sscud_area) return -ENOMEM; cud =3D kzalloc_obj(*cud); - if (!cud) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(cud, user_cud, sizeof(*cud))) { - ret =3D -EFAULT; - goto out_free; - } + if (!cud) + return -ENOMEM; + if (copy_from_user(cud, user_cud, sizeof(*cud))) + return -EFAULT; sscud_area->request.length =3D 0x0010; sscud_area->request.code =3D 0x0006; sscud_area->m =3D cud->schid.m; @@ -585,31 +548,23 @@ static int chsc_ioctl_info_sch_cu(void __user *user_c= ud) sscud_area->last_sch =3D cud->schid.sch_no; =20 ccode =3D chsc(sscud_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (sscud_area->response.code !=3D 0x0001) { - ret =3D -EIO; CHSC_MSG(0, "sscud: response code=3D%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 =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(cud); - kfree(sscud_area); - return ret; + return -EFAULT; + return 0; } =20 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) =3D 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) =3D NULL; =20 sci_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sci_area) return -ENOMEM; ci =3D kzalloc_obj(*ci); - if (!ci) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(ci, user_ci, sizeof(*ci))) { - ret =3D -EFAULT; - goto out_free; - } + if (!ci) + return -ENOMEM; + if (copy_from_user(ci, user_ci, sizeof(*ci))) + return -EFAULT; sci_area->request.length =3D 0x0010; sci_area->request.code =3D 0x0012; sci_area->m =3D ci->id.m; @@ -645,31 +596,23 @@ static int chsc_ioctl_conf_info(void __user *user_ci) sci_area->ssid =3D ci->id.ssid; =20 ccode =3D chsc(sci_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (sci_area->response.code !=3D 0x0001) { - ret =3D -EIO; CHSC_MSG(0, "sci: response code=3D%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 =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(ci); - kfree(sci_area); - return ret; + return -EFAULT; + return 0; } =20 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) =3D 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) =3D NULL; struct { u32 m : 1; u32 : 31; @@ -700,14 +643,10 @@ static int chsc_ioctl_conf_comp_list(void __user *use= r_ccl) if (!sccl_area) return -ENOMEM; ccl =3D kzalloc_obj(*ccl); - if (!ccl) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(ccl, user_ccl, sizeof(*ccl))) { - ret =3D -EFAULT; - goto out_free; - } + if (!ccl) + return -ENOMEM; + if (copy_from_user(ccl, user_ccl, sizeof(*ccl))) + return -EFAULT; sccl_area->request.length =3D 0x0020; sccl_area->request.code =3D 0x0030; sccl_area->fmt =3D ccl->req.fmt; @@ -728,61 +667,46 @@ static int chsc_ioctl_conf_comp_list(void __user *use= r_ccl) break; } ccode =3D chsc(sccl_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (sccl_area->response.code !=3D 0x0001) { - ret =3D -EIO; CHSC_MSG(0, "sccl: response code=3D%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 =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(ccl); - kfree(sccl_area); - return ret; + return -EFAULT; + return 0; } =20 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) =3D NULL; + struct chsc_cpd_info *chpd __free(kfree) =3D NULL; int ret; =20 chpd =3D kzalloc_obj(*chpd); scpd_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); - if (!scpd_area || !chpd) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(chpd, user_chpd, sizeof(*chpd))) { - ret =3D -EFAULT; - goto out_free; - } + if (!scpd_area || !chpd) + return -ENOMEM; + if (copy_from_user(chpd, user_chpd, sizeof(*chpd))) + return -EFAULT; ret =3D 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 =3D -EFAULT; -out_free: - kfree(chpd); - kfree(scpd_area); - return ret; + return -EFAULT; + return 0; } =20 static int chsc_ioctl_dcal(void __user *user_dcal) { - struct chsc_dcal *dcal; - int ret, ccode; + struct chsc_dcal *dcal __free(kfree) =3D 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) =3D NULL; =20 sdcal_area =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sdcal_area) return -ENOMEM; dcal =3D kzalloc_obj(*dcal); - if (!dcal) { - ret =3D -ENOMEM; - goto out_free; - } - if (copy_from_user(dcal, user_dcal, sizeof(*dcal))) { - ret =3D -EFAULT; - goto out_free; - } + if (!dcal) + return -ENOMEM; + if (copy_from_user(dcal, user_dcal, sizeof(*dcal))) + return -EFAULT; sdcal_area->request.length =3D 0x0020; sdcal_area->request.code =3D 0x0034; sdcal_area->atype =3D dcal->req.atype; @@ -816,26 +736,18 @@ static int chsc_ioctl_dcal(void __user *user_dcal) sizeof(sdcal_area->list_parm)); =20 ccode =3D chsc(sdcal_area); - if (ccode !=3D 0) { - ret =3D -EIO; - goto out_free; - } + if (ccode !=3D 0) + return -EIO; if (sdcal_area->response.code !=3D 0x0001) { - ret =3D -EIO; CHSC_MSG(0, "sdcal: response code=3D%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 =3D -EFAULT; - else - ret =3D 0; -out_free: - kfree(dcal); - kfree(sdcal_area); - return ret; + return -EFAULT; + return 0; } =20 static long chsc_ioctl(struct file *filp, unsigned int cmd, --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D3D385D69; Wed, 16 Sep 2026 12:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560226; cv=none; b=UbH+N1UIrYDZawl5251N/zN3tMMT1jkfT5LEkH9cHrEqvbpCC6sC0KjxnoC44/6umJU8T7RhSdD5yN1bkgvzIyvPN2QZODfyjMfVkEWnWhll6m1lADLVHBZYhJTskX2fGKYrzsz5a2XfplSgCiw3/IytzWIj07VH3ba0Q1QSXIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560226; c=relaxed/simple; bh=OPEjpdpHJ8HkCCzkXsbFMzy/C+tLBx1daKwtN+9ZOAo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tJrRcCF7ciQnuhDRg8XRMwGMcprsldk8/9dTfNpKkNLaLemaVT+mQpvlx65aKjXvzL3FBZrg5A1O73fuPOzFJN550fvOszWiZXltLVZDvjZNhk1QUwe3kyA2zvyC3ogKyFIBT82PtKU3wEvT0LUHXTDs8Io0+EdEraPW3/qobAA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hurb/eAm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hurb/eAm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C93F1F0089B; Wed, 16 Sep 2026 12:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560213; bh=NE/c7IMcBZdCzVyFsxXaIo3nYpN6KWCimcqlbKV3gw0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Hurb/eAmlQUwytzx60cR7oXIXwPA9vQ9j3r7mE5ESHPcxyZwpxAIKXedhTuem/7+4 k8VJcCj4MvctRgAIRQZzv9lPBK8r+oWCR9GlPv+9bM9PzG8AZKhenrd74PlzLwcoK/ C9iwWhoecv5nUoGvli8YQnAB6j2mMBVNl91ZnMatnQnoD06LhHPKeU/9ud6HpuHYbh ZHlKMVe+PMyggGdXJmXkv8WAvH8eeUe+/6MqH1OyusTwnPoDeOy7d81H2i7l8HY2RU kGMHU5sjGvBOZq8kV3KUP87V/yB7P28VA7MZuqJIeApCocYKcM5t5WgSUR6dVC5gXW 3G2leQwBMM50A== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:12 +0300 Subject: [PATCH v3 05/13] s390/cio: Use kzalloc() for CHSC work areas Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-5-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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; =20 sei_page =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); - chsc_page =3D (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); + chsc_page =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sei_page || !chsc_page) { ret =3D -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); } =20 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; =20 struct qdr *qdr; - unsigned long chsc_page; + void *chsc_page; =20 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) =20 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 =3D get_zeroed_page(GFP_KERNEL); + irq_ptr->chsc_page =3D kzalloc(PAGE_SIZE, GFP_KERNEL); if (!irq_ptr->chsc_page) goto err_chsc; =20 @@ -1006,7 +1006,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned i= nt 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 =3D (struct chsc_ssqd_area *)irq_ptr->chsc_page; + ssqd =3D irq_ptr->chsc_page; } =20 rc =3D chsc_ssqd(*schid, ssqd); diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinin= t.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 =3D { =20 static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset) { - struct chsc_scssc_area *scssc =3D (void *)irq_ptr->chsc_page; + struct chsc_scssc_area *scssc =3D irq_ptr->chsc_page; dma64_t summary_indicator_addr, subchannel_indicator_addr; int rc; =20 --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 875BC42668B; Wed, 16 Sep 2026 12:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560232; cv=none; b=i9PEY8t2ByxBhOZRP/nPMcy3Ng9uy4f7oULciogNW+VuFMgfzW/727QW1i/PGoyFZG+UYEvQabb64u29JjjF/XJywSYzFdxxoWbaHVfiRehpF7m/FelLYipYvLTbHQp3RACbIO1EkvzeKB+GWwc7XrFc9tSx5pTv4NWFYGEjzug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560232; c=relaxed/simple; bh=/Q+UndceaLElGRuOMnjLND2Cqzr3OFYfCjs9ZisM8t4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BZRMhYX9VV5hkFOO5lqeFCsA+Yv4gFYMV41Sq1X/3/Fb+bY9SKhjB5wd4exa+Fohb5mXfpCpIywRVaNZZFTMa7WKWrt+XQdTW4DkMai+NiBIkvHgatMCIpHc6ZTPIs1EimNwhb5gUyDEYv7ujdK2rRhctcI09juN7PhA7QWXPsg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=loxsFHy/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="loxsFHy/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89ECF1F0089A; Wed, 16 Sep 2026 12:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560216; bh=kEZ6nz/JFEHq+6k02cM7QTBhs2+peJoyslzMnyOEfRs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=loxsFHy/1eGz0qgPCeXN17uzD1ptVS/Qxc+rDq4qznAMqIVmpl8x1bPXVz5v78gGp E+G037KiAiF17UQYrBj1C+2W71dMxMfTyy3ALvNjsrgjwwAZVOz/P4Ro0Y+qG95ij7 itVTEszggQCYKVFrYbDdNc+Fn2YpsR2xhwG7rOxTFF5BJr6p8N/b6YBsqzobih9x4o ie1WGvsiiiF/P+/HmzjazSjiCv/4ZTAmi83l0qCDxHJTCh/15Ar6X704M3PAE8D6E6 0MEg+Pw6SzS2yKFpJWlhEqeuu1UG8qyjCVIquA4Dv3BgNvN5XgcddFG5N7Y2muRF7P iu+6kR7AqO/lw== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:13 +0300 Subject: [PATCH v3 06/13] s390/cmf: Use kmalloc() for the CMB area Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-6-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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; =20 + if (cmb_area.num_channels <=3D 0) + return -ENOMEM; + /* Allocate private cmb_data. */ cmb_data =3D 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)); =20 spin_unlock(&cmb_area.lock); - mem =3D (void *)__get_free_pages(GFP_KERNEL, get_order(size)); + mem =3D kmalloc(size, GFP_KERNEL); spin_lock(&cmb_area.lock); =20 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 =3D -ENOMEM; @@ -547,10 +550,8 @@ static void free_cmb(struct ccw_device *cdev) list_del_init(&priv->cmb_list); =20 if (list_empty(&cmb_area.list)) { - ssize_t size; - size =3D 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 =3D NULL; } spin_unlock_irq(cdev->ccwlock); --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2C1742A144; Wed, 16 Sep 2026 12:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560232; cv=none; b=t4c2kXYXKJ5MIQJ5XyqA4A/vCMNlPcZvEViLxdYQ/L/+ZWSKRBiHSb7rgOARBTF80Lal0VvtIDn/wrRIWiOeQDdCxVmacUzRv32RK6UpzMbd8QUMv/skWs8VAlhpQAuIgE0iITlwK6qv6ddq00fZ3UgwmtK5frXqZzNEDc8+rxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560232; c=relaxed/simple; bh=rdcrVC0BA24TZWlwPcwV+Z6oi8PioFMGwbQn+fYuYnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RbkQViBCL649eSdN813UNonss77vHON1d2MKkxwpeZCeqZc6PQJ3FDXG67cAieF7MlMS2pmAZWhtW1LpqkrCKQ7g4SeBYKUAGrIBydqgWZCSttEelZQ1u8gTS3aACyVOQk0kLdiwfPZKaLt45lH7ZZIXE0K/HTQzk+i9ljPHX90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VTt/GeWX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VTt/GeWX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16E9A1F00898; Wed, 16 Sep 2026 12:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560219; bh=bAVP4y79lmB0kd35IBqs2N16e6jwAfNVV+NWInsx3B8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=VTt/GeWXn4wGm+DCH9mXXJSp7QVqNTomDqScLoOI0DSnG/syZbREC6+JqLFScDMts w0tqRt3zKmQUkvgAzmklD+LuFal6jyosmohlkHuCLIIwGPHMto+6yiGEiM+wZ0d5Bs kS78RGjv9qNlb9LPWA9+YwO+sr76FakD9GmyE/nwWwMjbQYgWFCiZBIvKfdu31jWE0 cXw3euA/GWEZYYbqPM+T9khBqET69p5CTMzKFY+CaA77mzvqGH5CeAxAIP3CoeB6pi vgxPCE3YyPBxo0pZG+eg3tv8wr9u6wFz1JPGrlXWOEeWA5+Onijl07DWaSQwiWHwpE bpX9bmZ/1YlHA== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:14 +0300 Subject: [PATCH v3 07/13] s390/idals: Use kmalloc() for IDAL data buffers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-7-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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 #include #include +#include #include #include =20 @@ -147,9 +148,11 @@ static inline struct idal_buffer *idal_buffer_alloc(si= ze_t size, int page_order) ib->data[i] =3D dma64_add(ib->data[i - 1], IDA_BLOCK_SIZE); continue; } - vaddr =3D (void *)__get_free_pages(GFP_KERNEL, page_order); + vaddr =3D 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] =3D virt_to_dma64(vaddr); } return ib; @@ -157,7 +160,7 @@ static inline struct idal_buffer *idal_buffer_alloc(siz= e_t size, int page_order) while (i >=3D nr_chunks) { i -=3D nr_chunks; vaddr =3D 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 =3D (PAGE_SIZE << ib->page_order) >> IDA_SIZE_SHIFT; for (i =3D 0; i < nr_ptrs; i +=3D nr_chunks) { vaddr =3D dma64_to_virt(ib->data[i]); - free_pages((unsigned long)vaddr, ib->page_order); + kfree(vaddr); } kfree(ib); } --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1EAF4963D2; Wed, 16 Sep 2026 12:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560236; cv=none; b=AvzRkpsmuGKGLpSFt+bj0FvsExmG5RDGCWuLVsOP3jXePfRDfiO01L3b1d1LvJlZS7m+W+Vbo8TgdBUA9URocbLlmp+313FefvbyFZL+UJ2lCxaNLiAFDRuFPvQL/0//cyplBWD4XOa6xxhFcZd4G/gHiBjqL3Ko4qUGk6cDc94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560236; c=relaxed/simple; bh=CnXHp1JkDOfwDEmuFIt1o/K8zCbiqBSR3yDlzthGbnQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cIG20WuMYtIaRkJI4eWzrqNATgEAb6VswfxnkwjWr73iKzvhRfdCHi/9TnRnvFkpcPOKIpnc3nl8tksxugzJWchh/3mg48o+w/wAFc2thnAzqa6BTWXkJYyMJawV+OBEmxRAJWOtvS0IL4IiHErVg69FZZSnHlWYITYPXpgLXwY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fcm9fdtt; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fcm9fdtt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34DE01F000FF; Wed, 16 Sep 2026 12:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560222; bh=U1G72EbqUjI9oNziOv0XdCQMAxirZYF5Q2JcgCPI+0s=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=fcm9fdttTL0J5d54oDgnnaOXbfP4m62y8rhkTSL8Kso8AsVR22kr2n4xv6/XHwMSx dS3wVkbutXH8B2SFDVIsezpqRL0A4rLC3FwhgQfoVLQAYdk8UyeeDeD1UGNmh8ws7i RwE0f46pnD3le+Fbg4VsF2BERVktF0rEWHDize+t1pLKm5IenmrFkOPrvZc9ne+tr+ 7J/jHraIIr9WUyc2UsGY0Ld7qZa9Rvw8t97K5xNZc2eJ3GtMQ8tc5484KNZUUe8U8R G6eKu4er/FWQ+EerPBDSVJDjKuhU7qTM++2TSf1B654t2ZJrXj9fUQFWp9Qe484FU3 am52O0k6xVoHg== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:15 +0300 Subject: [PATCH v3 08/13] s390/qdio_main: Use kzalloc() for the IRQ structure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-8-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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 #include #include -#include #include #include #include #include +#include #include #include #include @@ -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; =20 - irq_ptr =3D (void *) get_zeroed_page(GFP_KERNEL); + irq_ptr =3D kzalloc(PAGE_SIZE, GFP_KERNEL); if (!irq_ptr) return -ENOMEM; =20 @@ -969,9 +969,6 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int= no_input_qs, if (!irq_ptr->ccw) goto err_ccw; =20 - /* kmemleak doesn't scan the page-allocated irq_ptr: */ - kmemleak_not_leak(irq_ptr->ccw); - irq_ptr->cdev =3D 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 i= nt 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); --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CBEB373BE7; Wed, 16 Sep 2026 12:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560237; cv=none; b=YHDLk5l5H0cop+5AkD0ONPBXMkmdkgJyPlJocBA0ASmVPEZDboqgd0foNEs0Tf9iXCXIM3eNBojQdTll0wWuTyLR8Gtt6Ir/7UnFedCuV/AN/mC1eF5ZKL/YH5aSSjUaAWGyBFqAt9dWjoQVio3Su8hOSmiIYUC9ei63cNmKXsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560237; c=relaxed/simple; bh=4alY3z2W927Ms15LZYZMvwkRWVZRcuBdqTKjuIfVo1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fFTTQ52jBmR1YZqU86xJFzT9N6KLb3lKK+kvPwZS9U7StS3W6hZCkV61xKwKkClSTQPH8/Xd84/tGyaueHdC0RdEa2+s1KtYgdA+Admnb4Kv/LqpsBzNmH86qpAwLqj+EWzpC70F1UzxinzjWVCoaO6gXp3nmUajX1q5qQHZiwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a6fFas1B; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a6fFas1B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5276F1F0089C; Wed, 16 Sep 2026 12:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560226; bh=GAESRwUS4AoT8Fe9vxXzcjqr/ANwAvgo8C6M4V7pHvs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=a6fFas1Bc27pKC1jQ/NkBXM0GYbCXSa82qImbsgbod4ilaTgi9SjJGRCtvOVYxpW/ qVcv9GI3uHMODJ7+tRRVAeuCE17oUOTATFrKBEAW3WmjjhF4G1pcXjCztOycunN0oM 279Eud8rdiIi3IZFrvyawyqJ8tqiGhG44Sr0xYOz7bG/lmqK2EPx2nXeYWxIG4W/b+ XV8Hi5hZn1Y2UrEMatxNrVPWUOflcK4YcrrjYkoEvVH2U6SXDf/HfhTMTifY5eP+AO MCIZKAvRNX1dRS3VCu8JVKs92sxX8UQPmFBoq/R8ZgI3uO+brqUJQ/25Dg7W6liu+B uwGV8ibY/dDLw== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:16 +0300 Subject: [PATCH v3 09/13] s390/qdio_main: Use kzalloc() for the QDR Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-9-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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); =20 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; =20 /* qdr is used in ccw1.cda which is u32 */ - irq_ptr->qdr =3D (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA); + irq_ptr->qdr =3D kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!irq_ptr->qdr) goto err_qdr; =20 @@ -1001,7 +1001,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned i= nt no_input_qs, return 0; =20 err_queues: - free_page((unsigned long) irq_ptr->qdr); + kfree(irq_ptr->qdr); err_qdr: kfree(irq_ptr->chsc_page); err_chsc: --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A11A4A92C7; Wed, 16 Sep 2026 12:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560238; cv=none; b=W4R6j6EmLfD8lC6T3luT24fH5rscDetlag6rXDFTLb8GHnrmk2ABRGWl0JNF1iJklyrSfN5Fi1MlBu+I6jiigvEoUfqVTa4rh5XAoWmPSJ+jpmfIki3ioCps9ks+3qyyiI9nPjag5EARWynbja7DLp2OhpMrFHeYvJArMMbMwbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560238; c=relaxed/simple; bh=py2j1Mb0iGfPkNln0c3I0yAAV0xNwtsE2Kq4knjbP0s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gdl380SE/idp/Tq5hxDi3Gv7mIK2k96R1sftQG+DNWyCwbo5S0Knyyb112Q6AptmUtcLdeorWEANyfC1CIhuGd2KnFWL6uNaIP+/qOGdIPPQt8MfmQAIYEU/OYgxQuRIcqi847q2zrEnL+ifx1u0dhCxp/L8H04/zxqj29bP1bM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ItwhD1Mq; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ItwhD1Mq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FB7D1F00893; Wed, 16 Sep 2026 12:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560229; bh=LB6kX+FFwnDBpk8VzIo69FZJtwl3A5eOSrIP15c/e4Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ItwhD1Mqn6yU8lPHx1IoQyozxF/eTvq0Qux1vlAAkedoiDk4wmAeOmF1QR5HiK+Bq 2XWTqo6e94n9BakGBma98xSY2SNzwlOrhv5TwZtacuWlT+dPmd1yZyaXyLtVCFlXP+ Ry9lHc31HrH4jv3M55dxPsnFIL48fv07CeiPA9MNMfM6cbZt7elvXntpbCuj06Eh68 Ih9s1GKDAJtsDZKWSroBoWB2CA7sVvwddJ+FaFZv/boIGtS1tlFGzjFgNhnSAb6rs1 WqtZOQaAkSIGKeHoUwv6I+mdIwJYkLwt2HCbzRTbwpugh3zYKQ0EicYcg4QzmZ6u46 9l912jw4GB6ig== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:17 +0300 Subject: [PATCH v3 10/13] s390/qdio_setup: Use kzalloc() for QDIO buffers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-10-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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; =20 for (pos =3D 0; pos < count; pos +=3D QBUFF_PER_PAGE) - free_page((unsigned long) buf[pos]); + kfree(buf[pos]); } EXPORT_SYMBOL_GPL(qdio_free_buffers); =20 @@ -49,7 +49,7 @@ int qdio_alloc_buffers(struct qdio_buffer **buf, unsigned= int count) int pos; =20 for (pos =3D 0; pos < count; pos +=3D QBUFF_PER_PAGE) { - buf[pos] =3D (void *) get_zeroed_page(GFP_KERNEL); + buf[pos] =3D kzalloc(PAGE_SIZE, GFP_KERNEL); if (!buf[pos]) { qdio_free_buffers(buf, count); return -ENOMEM; --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D955935AC1C; Wed, 16 Sep 2026 12:03:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560246; cv=none; b=UcF3q8XzmDdr72GBPjvFs4MyeTKfoqvZ7oIV+Mq5JRYDc8FL7/2L4vHQDvQ+wMVklG0bdtiBmVHPXgp+hK1+PpvML38kRppaWMOUiU30iO/JcufrxQ0fmNJZ2PpRl0VmcNCKV0yIFlrHOLaDleJdeKBYWt5XLH36xlbbpQBCCvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560246; c=relaxed/simple; bh=ILeEvtymUiyFn6FXjfwWf9BUERRvcE4G786kxLGajS4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CTqzOzStnIWVgrECadeESV2sZgLOmFtmQoSORRG+Ji7EwT7CgLi0ILXe+CfsNyGLreNii61fJApWbSkWR8k26Cuzb9jR5nl8qoAtDMpCpkR2rPP7XDG4Gx6PW59iabWzBnHohbxh5Li6sZhjP2qI4V3mEQwPzMYK8phy3aKfTQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ml42hJBd; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ml42hJBd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D1C71F00899; Wed, 16 Sep 2026 12:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560232; bh=JO8zvszsozs4GkpHmyopZ7vErLCjHtSqmQPyVsRODfA=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ml42hJBdAQr2V10Uh2pmfR0pjHqFBHJj6PovDXwc8vewjqQGxlDhnIsDti0bpmfWy qbcEynQD9O5UPH8qDpVSiyp7gR8W5fD10rfET67Dt1I/887weT9JoDXcW6ztZHOMEA ZnS1R2vaQy2Z28heQ7hU6pB0wdeEqqPFKA+36oh8IGv5aULa5t9GvmzW0BcXls50mf gHCOUdOBZkRK7++WyPFy2Gu0KrWQE2KlgRTn/hLip7vZ0s8+rwdaIHZa1np+GSIGud xPUIUvIaOq7dEUBXw/UbQtzvvTCmX64FMucBy98Id0Aj2ELEnBk1BjrIOtK/qJjvgq 32Fq2RNvXUMIg== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:18 +0300 Subject: [PATCH v3 11/13] s390/qdio_setup: Use kmalloc() for the storage list Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-11-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev __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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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, un= signed int count) =20 for (i =3D 0; i < count; i++) { q =3D 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_q= s, int nr_queues) return -ENOMEM; } =20 - q->sl_page =3D (void *)__get_free_page(GFP_KERNEL); + q->sl_page =3D kmalloc(PAGE_SIZE, GFP_KERNEL); if (!q->sl_page) { kmem_cache_free(qdio_q_cache, q); __qdio_free_queues(irq_ptr_qs, i); --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EAC34F054A; Wed, 16 Sep 2026 12:03:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560242; cv=none; b=B0uoiljGbQP2JnCdlshlDI5L8xi3LqIK+s7z0aUYyYUnyfu2wYF/t3WEkYsL0SHB1doZb5IAhfTVijQmrJiSKKSg0GADM1w14jSZR7cqXHlhfT7eupPkaZDXwfsCftVdSx/xC2PJsZdv2iXVSCJD8zTgf40D7+3DC41IG3xrJjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560242; c=relaxed/simple; bh=JkkuCK1AjeZA2D774owh92o+U22DOEgW8Bl1T+VvjGM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r9jmrLgq4zFRwUlbAJsUUnqQ4/Fjtshy075rWES1M3Cr+a0egRadMa+2sDYabU+ISDFJrQg+ILm8BkL9YcbgdGmvwZONrjZXQimuS5/PweaHaLoe6r4uMkanKe5186v2wjfpYR8QYrUvcBRWVRZGdJsU/63xGmt8Adth6u1b2A8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EAce1fhA; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EAce1fhA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF581F0089A; Wed, 16 Sep 2026 12:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560235; bh=DJHDp9vqJXqFSbKUnrSygcbO2/M2tpxb0Oj00wJTPho=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=EAce1fhAsPPC3kF2ylU6CATF9nCbEqSmOzx7qUVC9VhipchN28lkPYShtYDFpnw4j dG3GPyU88038isT2JPJkUb/bUoev57I/6LsEjI/rAZ11k37trd6BC27abxzYWYNOEP H8PiUdqA53Oec/qZ6dq9sCFnuf9pCE9N9V6/stGDpGbA0b7pbDXmhE5D1y/G0/VJ/J 2qiOpv27g4mGTl+QUnws374gEYEEUDzSEcJOnMyPN0s68mMUJiCBc8HwmmxIRnEYRl ZIefJntx8NH8HODnJHM5afimdQfkzB1S1+k2VPJAloypuVJusewfq99/PSFwFYZwes Q41c2eDiC3Ixg== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:19 +0300 Subject: [PATCH v3 12/13] s390/qdio_setup: Use kmalloc() for the SSQD request Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-12-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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, =20 DBF_EVENT("getssqd:%4x", schid->sch_no); if (!irq_ptr) { - ssqd =3D (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL); + ssqd =3D kmalloc(PAGE_SIZE, GFP_KERNEL); if (!ssqd) return -ENOMEM; } else { @@ -270,7 +270,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr, =20 out: if (!irq_ptr) - free_page((unsigned long)ssqd); + kfree(ssqd); =20 return rc; } --=20 2.53.0 From nobody Fri Sep 25 05:29:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E03B93F1078; Wed, 16 Sep 2026 12:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560252; cv=none; b=BymiEsDqJg+hAfPMA5CBrwMDvHU9Z3M2ac/MARvIFKvJ8DEnr2qdc3KkZh+t0FQeocrszrHDyNRCJ39+n0SzrD1drYRm0AaInDuA7pcPh6AvkdNV7ge60LFU39RgyZHO+l5OTuk2rYvTb1FipBcLC5jn9Ynn6yz8mYDusFPhWcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789560252; c=relaxed/simple; bh=msniaosZMR/qwh9gdvOXvUlhttFaDmHvFelXNEpOfZM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XKIcvfSDYxfoo5gXYF3ug1LhvKMk0xx94zyT0s3AP0i71EPDc/ailpkyfUUE5J0dUe03Ax86o1pPse01iOOOg2KzW5GuspAjjALjC2YdHFIeFedqrHIxHHTQ1NSw14mra5vtFLQPvL0ehzw2Il+nZnPboWmvtaDcnBtlIktNPX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QHxJnvzR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QHxJnvzR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38DE61F008A0; Wed, 16 Sep 2026 12:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789560238; bh=ZWoW41+x+7dy6umxK1i5p5XUicgKN/VyGWTHRTGB5Jk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QHxJnvzRpfUEd+n3mGVlS/irTae6iTFaTIK3hhK6DIJ2JzaT2Djq3MUb/dyJckJ5M 1vGt2k4d9JTLrmSPWbapaUQilliHh438VOXgxz19lR9UNhcjgu7pN/GfftJ0p+vLnW 3I4ky6B36QCn3r55dZPDkPST8k4t5TbUT0SaXJ8ZcgMjLBaZ0fe/KRbrfRlxYI5QTp 05c5klUSjM7Ph0ecsLfVDhbIxdb3PBhSV+la2Tl06Dw4jjalyuKVCx3YG713z/l7e8 BvsvxFhnJhT78sxA7W/ezHF4ApJvIomAMkAtbrCm4xUMNwn3frhYzueOgmw6if/l61 jOXc3qkGWMzEg== From: "Mike Rapoport (Microsoft)" Date: Wed, 16 Sep 2026 15:03:20 +0300 Subject: [PATCH v3 13/13] s390/scm: Use kmalloc() for SCM information Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260916-s390-cio-ready-v3-13-39e4894637d6@kernel.org> References: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> In-Reply-To: <20260916-s390-cio-ready-v3-0-39e4894637d6@kernel.org> To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Christian Borntraeger , Mike Rapoport , Peter Oberparleiter , Sven Schnelle , Vineeth Vijayan , Vlastimil Babka , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Mailer: b4 0.17-dev 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Reviewed-by: Peter Oberparleiter --- 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 #include #include +#include #include #include "chsc.h" =20 @@ -224,12 +225,12 @@ static int scm_add(struct chsc_scm_info *scm_info, si= ze_t num) =20 int scm_update_information(void) { - struct chsc_scm_info *scm_info; + struct chsc_scm_info *scm_info __free(kfree) =3D NULL; u64 token =3D 0; size_t num; int ret; =20 - scm_info =3D (void *)__get_free_page(GFP_KERNEL | GFP_DMA); + scm_info =3D kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!scm_info) return -ENOMEM; =20 @@ -250,8 +251,6 @@ int scm_update_information(void) token =3D scm_info->restok; } while (token); =20 - free_page((unsigned long)scm_info); - return ret; } =20 --=20 2.53.0