From nobody Fri Sep 25 23:53:49 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 367FA45A29F; Mon, 7 Sep 2026 10:23: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=1788776637; cv=none; b=eItpbELZhd0+RO+IfoNlL7MegUcskHfBkbPy033ogQKFjcG9txoctFQ2CgGm/gndfVyMVmgcfjwcg2xbz05V834swG6kVzG9i0sMgi4pg+v01CWb22FwUdOPdkrc9moRKSvueco72pbTghgX9zE2cZuIy89NeDnbYBqdfAX0nlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776637; c=relaxed/simple; bh=oaUUL2Z6uTL/fsueJ+wmiwF3r3nbRoUwtNTlWdzZV88=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SCFZiXvnF5/zg9T6IaUoTue91MFtJEDS+SpfC+zGxmkdleHpz+fzXf2tlUB7Hf5PDgzT63MRHqNO4veg9EIJpuIL2GhYvooTVPAEgShvaoI3ljOv8bUxxX3RKG42WsTwss/GcCxRxwfirR4JKw0yh+nEhiR/37AZ6IrGGYE8jww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oY1Jyyl7; 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="oY1Jyyl7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 146981F00A3F; Mon, 7 Sep 2026 10:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776635; bh=waNeuygMDtlm0C03ZytfUl73M0zkpwkt1aPQuPSWLWw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=oY1Jyyl734MLI1IlG6XCXb4v/DmmBySm/AC8pfkMYVcXmqGkF/hjyTQcDBZD80YpJ 7uwhf5PYBWI28sW1JGHFu1y5Wk7Z1m56DS9JvQL6uy5HMyozhGkHivDmKGyskrTefs o8LOAeDkyU0s82i4urqcpPwBeo2KcxJ84nLsV5dTDXRA8+mK5tjZhjSCMKk9p9nbvE 6op/bj4RPPJ2wBogea0r4eyrZUG1sz5JKKHs9i2ULWFzRm3kAptGou79gjiq59UcGS 410iiaD2OL6Lk030dIYPUJ8kUb2n2z+J/7vL+mr/OEQYBIHp0VFAz4I8GIG5gkm2hi j5O4R0aXsVYIQ== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:42 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-1-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 23:53:49 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 8A2B84611CA; Mon, 7 Sep 2026 10:23:59 +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=1788776641; cv=none; b=Q9DtHLqgiMeIAxVe4LJMWdZTsL7QtsV5C42kKuS3CXQV3lsOTgUTuxkBuhExo5JWQujSKEZZ+/xPDdL1YR/95BSxuyH1YSSii5DPBoCX3Gl00SWKNweK7ZubikK6HAkqdngEsRqd/snPuieuG7G83xojQXkDeQUSWFZLjyYZvnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776641; c=relaxed/simple; bh=tnPqOGWy+G/exKowrqrFWAt1LzC422b7ugtuCq4Q7iQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eIE7eorSvg6Rk/n51d8cYSSRfZ1B2VlYFKRMGsF33IUv5IZCR7eZtqlTf9TwSQJ2GuPMFg6kWdftWBXiki46ZzOAiVQ6P1eS9gMX54UoMUjJy4r5ONRBXG+smt0s0BD33FDTv8E6z9YSzairzmeQUAcqDgy/dXVqDqEV4m9J88E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PMNiho05; 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="PMNiho05" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 606E91F00A3A; Mon, 7 Sep 2026 10:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776639; bh=BvSsEcfuxj9lC5YTGUuAUBtK1T4naFDW4wq12j/K7Zg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=PMNiho052IJwVfeivb9lDHuj7T0OqI+bZc5Z3AmRzn1GKy2BsOSQTw80aToZUydU3 Ziw7aYbHRvGwmC940vzWg8/AWKslCjf4QjowV8BsmtK/pdDw0ULZR5lV3OacR7WjNE 5F7BwNwd4rxubKftcgONyAyVQB3RnKX+dMkjAYcasV8SqBAP15gVKhQmylWhIDzoYZ V0GZ2gHFFTrbZX6n/NEzKUXZfTymd1lsWH+7uXdA9/3v51LE9eiI2jyTS0Yt+lYSuS caxlfC9QSCSzNCJMlrIULXTqxgLHBQRp79bp2kAo+5sbqX+rMQKmrVEWtgDIpdBmpd 7cIwvnB8HVNuQ== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:43 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-2-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 23:53:49 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 9BD6B45A2A8; Mon, 7 Sep 2026 10:24:02 +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=1788776643; cv=none; b=tQx24F5pSrsedBQKLczWUUhIBal3WW9RloIVPCLzVVhLTZMtegMvf2tBlUyiHpnBICLF9453B08piAjVoqyGO63EJFKRmzt1y3nUdIR0ZxBS/yBvFvtrdkeXELxW3n8h/J+/jJ7W2Cqcbx6MDrhYQw+2uKJIMh9dH2OJO73nARo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776643; c=relaxed/simple; bh=27W7XaDI53ge61OsV1O82PMbVANHyRB3FsKg1gBZ+r0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uqNSp8zbUIKo+at0ZzUSM/pKt5SQOwfEm8j2tZGa+431yQaGhlwLPexN1DR54dKFeF42y8HWk/zoi0qyFALdmL5J4ZC0rj0I2l7I0x21UnNnXYvM8Ip0W7DvCeSdDskTE+lzWUA39LMkzWf6cYXr7NkEQsJ1uiwdC51SRY/MDZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aHGV8ioI; 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="aHGV8ioI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC1811F00A3F; Mon, 7 Sep 2026 10:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776642; bh=/CjaWpeoftE+Wn2hDoCKbw50T/OskJjYcBztwhRMRzs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=aHGV8ioIOvddcAtewqb4hGh5f7g1CTeL0/3RgSjclKplWSCHhJxvVr+7LA9tUkY3W CyYjk3PnBbDhEzexWTulCBZ2q0p9mgr1MtrYcRHzay7W9H51gBEzLv/PGQ0wp10tgk yd5iIEEm9NaBTYzucXFmllfgzNo5pcFOMphosVdep+mfDYls9Z5PjAqYXZqIcSrxh8 5q1ML6kcDiyxJYE9RWXX16FRKv5nrnqR6/9u2iRLtey2zCJKbM2FanQpKrNvR+UAaZ xeJ6g/0xf7wKPRr2NNHdgMmEO6o9GgfW8JztKEKdT6sEmrto2y2YI7GGOgv8LwPo4u 1A9zeVlDpoGgw== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:44 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-3-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 23:53:49 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 EBD68466AE5; Mon, 7 Sep 2026 10:24:05 +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=1788776647; cv=none; b=CC9Vkp+EC1lMCMWzCT6/WKQb0LK6hkTnjfY6e4PTQx0wdQXM0Y8le7Eha1YfrdExfMqk7OO482ugLbEr27+XCBfbUD3RfpNsVOfonQH32U5U62FYcuPDAWlIy4leRqlIFCp2sys6tWh5IrYNqjXOYo6U7B135s/OXbrof8gUpZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776647; c=relaxed/simple; bh=CSUDFFdhmtCWeW8oSX88//X3I6uiPteZhW4Opf/GQyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WDm0sYK9ZcwZy/sWaWVecztRL+iVMYtDfyYguDb8CIigu1ue2hJfbHLEFDKVIcHvCol8GJ2hOZcicvzHGeJKAXoNwClgnLN4x+XzLDmN1M3oILuGh7xOryJDuVHrZSkqumhPrwvJZWrhaCg5scIuQemtSd1yJAGqlX6NRxdpGsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yp2vdYe0; 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="Yp2vdYe0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C641F00A3A; Mon, 7 Sep 2026 10:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776645; bh=wH/HnScIECqzPez57vPSs9kJwAMAsBLZmPepnLoPjpM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Yp2vdYe0EBlTRgdwmac/pJ3hAkSujfUcQEAJFpOrCOgr5N/eM4tEbhgEgPTf8S8wu zoXgYw8zwjLighf8HvN+bj8weVvwpiq+ji0szCLb9hjGv1unA2DgPRjZF8uB3mI0NY TRuTjnLPuUy2vlx7CXZy+EtgvH8VfWtJOaR0sjO+ebQk+Td1Qdj0eIK+vvrfeVWcXs V5CTdks+vosFoxB9bk1Sv86OBVoKiJVG8mrJ5Me78bnLwTAGcWMOAjsy+blWGwcUrw XAdPl8GQEZEsP4PF2QeEqFy+QDx9ixYZDw7P8kYYQS4jPNX76k6CyoSPqbZO8Kzzne y8TD11hol6yjw== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:45 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-4-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 23:53:49 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 7DF0845DF72; Mon, 7 Sep 2026 10:24:09 +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=1788776650; cv=none; b=n2Mhe/0ISyEtl8GXfAxQaC1roU4WI0FHSlxXa397CIU4XXVDo0eXZvDa4TP8FtnYinsSRqkILZDHlVjvl59FGo+kQGVNmQgOJvDvRyXob/3cESNVxDN/8JbfuoYvtFXdocoHM+3rhcE4YPuhRbvqCjmSAXtvRfzIMOJAjkVSD1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776650; 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=ITYBbyv1ZVWN63cpbMIwOeA92ZEfCpBA9bJVYUpNFZNLXyCtuqLpXjDPJz6Fii4D46EGZY86Icb2DDHYLMSfEnzwPLppD64XPT+SzmqDR8Uda0/AWcoIt4bRyqVOCiTrEH/Hjc2oWiHm0vqFqiYAXVlknov10/LyviyDlpvbjdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aoHeM4em; 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="aoHeM4em" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 521541F00A3D; Mon, 7 Sep 2026 10:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776649; bh=NE/c7IMcBZdCzVyFsxXaIo3nYpN6KWCimcqlbKV3gw0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=aoHeM4emORpWMhclCvywlqazbQ5frAqBkDcwKeVvznG5SaQO/7btyXum+zi11LO3V ferVo6XUuN8HzdP6oBkuuUDL47THLj5VO+aafzPuBgybQwn9IpGSQ62Y2VzOUCqlh3 R0K+Q8GEx9e9Bvepo9ngdYugleEuMlYQXreqUIt6ZSJdhEFVFrpb2B6B83LY3i4zc/ i9Y+juUJMqY2qopO1CDzCOFUD8cGwx6l3pJwi/V6ehTilgomSbTPUlX8Ewsx2gpAs8 tNYNXgSadOVAjGHXAKW5cUlXIp74SzeWA5YgzwFGoeZzJFBwHt93DDERYES5AHdc0B X/uTY83VzVKXA== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:46 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-5-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 23:53:49 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 D5C9A466B0B; Mon, 7 Sep 2026 10:24:12 +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=1788776654; cv=none; b=CgTfCII0Ei4/oQu7ZbpOH4hL5DKyLwPJ7+JAu58m/xB+MmcWQrbQSuIXPHthE3ZHFGmPIi1VCpv/KJT+WOqhI52AhSmUyYZDpGjR6WFIyleN/R+iNVtRmPe34cAKUDTgoJNj0Bk7V9wLmPlAu3Bf9D8o0bCu6uc+AhHHQB10yPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776654; c=relaxed/simple; bh=Wz9lw37vgc/zsfAcUFmqMX4aeUHgIcVMtzl7BxRqOx0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NQSWEH5+wi0s9kW3DYSI7dBpydxL/wBuO/yOITCr0EsTRxeOXt+CO1NGK0TXYBTU5epOXdMx2h6W63tBB1QqipICZsuCjyXshSqiiKXlDy54xdXaM+d63EiQQlHSQnzksFVTKSHYn1wZ0RatloA9rTEomax3+sXkl9c8FO6kvPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OEYhKzO9; 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="OEYhKzO9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D74F1F00A3A; Mon, 7 Sep 2026 10:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776652; bh=y/TW8KJTz/sa6Ud6LR0Wgj8IHB3N+btY5TCgJ/dBLmI=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=OEYhKzO9+sk1gMdKkphyEDFcX2mlBenng2D7KchSJuCA/ESqNbfTZvZN/KL3GBeZx c0XGEyzO8EI49L6GSX1No0XvyFgmdikTGEXiSn+GhrNNQRaZ4J9EU7WMFNovP09hDT zv/Lwe6IXGB1oaPx1EpALYwBuHk/Mt6HAKlxKPTGbHOPdu/PYqD8CWAx9O1vGQv38T 9g1T2RSM8Ani2MntBskgISidwlgl+vQkmFRCDMIfcJTxL0g1pnkZnY+1srZbM8W27Y Vt4G3iFCBa8mSAkFtiEkAxWB4dqHFuvCUmaQUzdXWb6y8TL2vAYlo03wj7UkvUmNCL ngXncbEY02Sww== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:47 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-6-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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 page aligned and kmalloc() guarantees that a power of two sized allocation is aligned to its size. 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) --- drivers/s390/cio/cmf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 92ab3d546fe47..6c46b0d0b3da4 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c @@ -501,12 +501,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(PAGE_SIZE << get_order(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 +547,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 23:53:49 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 288D346984A; Mon, 7 Sep 2026 10:24:15 +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=1788776657; cv=none; b=If4NwJiqyKmUflvdJomJRN1ZYvDdiCgd3+KixLwbqiSTL+owgF6IsI0M3CsOcIMW4c24Cy5wu1o7dUHXetgKr+H7IJjT4P94kCPVfWeMYmNRhOpYloo13WL/6oISLY5xFIKKyAEJHwuuyR90YQY9CAaX0xE+oSKYwwWHZRV5gxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776657; c=relaxed/simple; bh=YFe5aklWntOgT5nQimw/7kgNgaa9z7nEQspTYutJFVM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VcuZfmkujUn7N9o/nWWeORmdJA79Q/eo8VTbzf9BUYoH0WenV3MsP+GW6PxgC43Fu1/LZL5Q3sWLccGHfbV+Psh/aQArpJGK7ZEgYujeF2CsWo/OGxShX7L5WY/DUlIcv7bNtLHm+YP6WnkhSCrOxPludopy1G4OwzSk5pbFNOU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iQD1u0iZ; 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="iQD1u0iZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E90AD1F00A3D; Mon, 7 Sep 2026 10:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776655; bh=3tq+MmVWpxNrmq2a43GAPaqrd07nxrFSLnxvA2070ww=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=iQD1u0iZXJqJOENikM9GGerBxb8HEccexTEau4VGA63cDIw4BSsatuxl3gWwXTGHD SYXN6vXKEMpzfU0RJMP6W4FH2rhsJoTPQeTj7QHO8C0BWaxsMML3kCjlpb7QCoZKfQ HpVTv++GYxSCjuiwXe/BBHNmUp4QPXsHrsthDtPMM1Rxb0Y4cwd1aw2Kui8gZBVUYT Noc0z5jJcIPQCzNMgltOivv+y3/paJNswKpY+/UTwGIRQfEGN+JynsFmHrZUc0T5Qq XuRfX9zWEKCRG0RM6+4yvfkw1+XYcI3d+exQortSfRKNF49MWRXYLDSJQx9XLHPb1g +9syUsDnG4AWw== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:48 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-7-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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(). 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) --- arch/s390/include/asm/idals.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h index 06e1ec2afd5af..248829d461bce 100644 --- a/arch/s390/include/asm/idals.h +++ b/arch/s390/include/asm/idals.h @@ -147,7 +147,7 @@ static inline struct idal_buffer *idal_buffer_alloc(siz= e_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; ib->data[i] =3D virt_to_dma64(vaddr); @@ -157,7 +157,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 +175,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 23:53:49 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 BC87445FFD3; Mon, 7 Sep 2026 10:24:19 +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=1788776660; cv=none; b=f7AwKjQT3IVNYa/Vy/KD2tQoktPuVBY52vNWD4IWnGlUDZQmUaGZCLAlJuYV0b8U+6+bE4GKRucJ3wWcxIHeRACyHag2UtB1Lg4kJ0uh4iXipzqtnRJHaD32Tb7kZvuQDsB7oJMt4Y4OkutCRZYr9K2naF8mZkoa7DYfhLiXo+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776660; c=relaxed/simple; bh=3sAPPrYjjnm9HdvgPt5xKjpVN7wtPx7zbwR8Zj84ydw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ec9SnHqyLZqzWRwhLwnOXysBqF4nXXSLw0+RzB1eSa14XgA1k0gw+s6ErB9qDl5fxc8sesthQzbdaQtGaCvJ4PV9HBxrA14KWGxn114gPdHOvNClezA+OUMVSvRw1PpaZDJa6rP09VLGWmXyEYPPFTAUPQKtbBMJbCK6GDKEVKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gqniO50X; 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="gqniO50X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 406441F00A3A; Mon, 7 Sep 2026 10:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776659; bh=HdnExtof1dKOLJGTwa/OAp5uv9yMjbL/vk77sD1NPEs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=gqniO50Xnm5LZ6TI1YBZUE3boTXiiXtNpaUeMHZ1dhx2wnceBAZAlHathU9YU+5+h +6XIiGTfOwr6F5D/o+vgVHo3uJ0bU6MvJvnTDYNBdrCKd3n9YniIPnO4v3HIJGtFMM mnERPheRMSTGehIkkax0QzNZQXB8j9ZUw9vzWgzeeIYIYgtfYywhQG9KFvxWXRPlg+ E0PhUizv66lRAu5bMUZltm5s05v14CJm888V+ir6uhECVqNeWNp7j6hMi0D48l8ISx WE5NJAqD9mJYOL2ONticmCrz0bJhpWcaAVOqU6hdFPGfJZHXs8cBWL1idJg+hj2Mh3 xpnNdGOPz4xZA== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:49 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-8-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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(). 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) --- drivers/s390/cio/qdio_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index d137bf8c70664..6b9442bae7ffd 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -936,7 +937,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 +962,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 @@ -1011,7 +1012,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 23:53:49 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 7174D46C844; Mon, 7 Sep 2026 10:24: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=1788776663; cv=none; b=kTlr+7kSu4HQE84Ce3fk6Lcdm/DbD+rzLDqtoLD6Lsf+EYNZm2V3EeKxmFtOL8/aJ+QILSSU9rxRU5cvavHRLShXmx3Xf8TeIAtFpk6tzF04MYFGaYKVFCH5lhpq1PX9BliM2Yd5L0O5gCVefLSVV33OWSpBmDHdwQJU7Nr1fZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776663; c=relaxed/simple; bh=mtOtfyMdOqH0xfQ8bkfVoHr2KD00v8RMd2IJU/hSLno=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hDgGfPakMii11SgCpXvM3P1wHre1bVUttaQJvjBjvu+tA3mBAKSjM58TQDfVxZ2Cb/r0ZZZpPHQAzwLpY0rjm1uqkMPkm65ns/poPbZdaPo2nrhD5HX3RIxYYTolnrIQf5TdwfTLLoPazZdFkRiR80m3EYk+VPD0m5/xMI2jNRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CJI3p6NQ; 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="CJI3p6NQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BCCF1F00A3E; Mon, 7 Sep 2026 10:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776662; bh=IId503ozKlk3cLt2ZvHKfnW0uEA0aXfpIbl0Bze/AnQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=CJI3p6NQLSFnQpujvGnuTo3rRXUwQLT1SIbJL+qhR0l//VBMu7zVfI8MW9VVEHCD1 A5o8GtGZSuVUt8esWePoLVon2FWWNlFflXhI9T3ZbE+5/NZH8rfUDs+2qF/6AlcZDE swiluBjtOYD42LYLyt5+KUkfPzoR1fs1LPkr3+oiqakvqoRPBDO0aW67oWImCRGAJQ V7q1ry7sRho63rWNnkWZjzFKeEgnd5HH4v5VR5ZEkgU4T8RCisUntlkFgfktSOFLIv A2qXHUH9wUJKLUjp4XTZ+jZR7AHfq9iTRq1U/SUUe3a0WD3Qpgn+xvQypPPC8bj/rD 0STxseZ4bsSCw== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:50 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-9-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 6b9442bae7ffd..bebc1250ebebf 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) 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); @@ -992,7 +992,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 @@ -1005,7 +1005,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 23:53:49 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 BC68246C85F; Mon, 7 Sep 2026 10:24:25 +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=1788776666; cv=none; b=Y614Cr9s4mQZVeUdwyI+FA6r5kvcbkyN87ierRwa0J3gk4ZM8ASwA4YrkEp2ZllEzIS8k1HyHLw71QRPmqUEPjloTcfvYoor+UdiIvUFUn6WwSuY/w4OF+YGRhmGLHIjEbWf5O1LUUJVvm5JxWIm690LfMtWfndDCSMRIufNNAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776666; c=relaxed/simple; bh=py2j1Mb0iGfPkNln0c3I0yAAV0xNwtsE2Kq4knjbP0s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Xh+Zy4aQ6fUIoK68KrZZjk+wVd6KCCc83hKCKgMRIXXW5jstMbcq5webHz9YeEe0FiWbmKGImzKMm5WXVv9YZQ1/5e0PZbaaCJSNDfSlDxdRCy1QJFfA1h+yDFEUO810FpLz693D9IpoBdFH5OuBo1jG3H6LU6s2tIxnwpd2qic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VSFPOQga; 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="VSFPOQga" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D78DA1F00A3F; Mon, 7 Sep 2026 10:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776665; bh=LB6kX+FFwnDBpk8VzIo69FZJtwl3A5eOSrIP15c/e4Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=VSFPOQgagwllHZbFfsorGzw3WQyeZsCzeMxcCv9VTYDjLMnEXGhqpUlRUvk87Qhks 7lpd8Jl/A77vNADRXD/MUz8DTKrMt7qm+QiIQIi+U+AH7kUOBbP3fVlcaZS8yh6NAh EDe+BGYR3xUCfpG6/QpEJEObPiOlH2KJOTRy5tsiwbV5R6QrQ8vQ3DKn1bgmNLW1sd u0kuFe4xw51lECkKZutCbpfu/1MjuA4L8cYSs1+85ml30PZBTDzCs45C75L85Qi8BM /fsWIVGYFPg4P852DpOtyEdyRRvlHf/CA6jyz8C8UHuJeM1ersvekcvvBBBLqfXBCF SzIMe/ySFFK6Q== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:51 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-10-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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 23:53:49 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 6D97E46C844; Mon, 7 Sep 2026 10:24: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=1788776670; cv=none; b=PGL+D8KArmcq9fSicQkAgtyzX3VGCk6tTK1cJ9MhGpEhYH8UAKkruwAg54yP5lf4AIW+j57uIJvwRzt0CPSgrEFxjkit0/0/OO1zPgEJ5EW8WGE8OVFrMyuEjmCstF3OBDXaPtSwJJR01T6iEmE8/OOCAYtUZ43ifWMt8Pq9FIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776670; c=relaxed/simple; bh=ExZRIfSZYWKiGLqVEza6Pma8epGogrkm5/O+l1yl1Ww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gKoNSRb3wWTxVdFpXCWfMSKvRAc8r++oNwdv0Gvx1k90/GgGSxc6GhGFa/Igj0/kX2nHfTVTc4TmYNKGxdPP67sJtH88yhr3+NZkzw65bh9O7HgT6gURahbOl0qkVP+0gLehZ5hfFLqZl+FQ+X0xQEGNjrC1LNwCeYMU2JbqHHo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m9w2iL9K; 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="m9w2iL9K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F10A1F00A3A; Mon, 7 Sep 2026 10:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776669; bh=kjadfUkSzyOP1zHYpwk4bR2tv8NVDjjU5ZmwfJdW4t8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=m9w2iL9KmZjbnwrL0PHYradx8kYA+DJUJqja+5JXA3joouaWZ84qaThOVENwcCa0G ZX6bY8ySJ/fwUO2yJnCE3LA/A73yTEii5MJR8C0IMmDBImhkpY/xFuXWkSzO58yFdB FhyUiskZw/3HT9vOUJzibtohk4EtRNxoVdvw6KZwWjbqTMG2D3mdlAVlmp/Pz24EWh CeuaQAW42sS3OXwyQNx5fy21WGqhT3NHmNZeup5RvDNUqgWQaWny7K1VauWJCfFYfE kpqE+3wjwf8LAzcLP4fhwd6E0A6YOBWsHM68zaqFRDTVAMMuNgqiSF46JD/rzOky0q lb3eJyYGR2H2w== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:52 +0300 Subject: [PATCH 11/13] s390/qdio_setup: Use kzalloc() 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: <20260907-s390-cio-ready-v1-11-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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 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) --- 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..7ca8f61a2387b 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 kzalloc(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 23:53:49 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 5F7D546EC7B; Mon, 7 Sep 2026 10:24:32 +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=1788776673; cv=none; b=upjwkanOVXm3BLRrAI3VHmzt82Lx9kvj0GEFZqMroR2H3cVf5Pagk7JfeAyTXLuWCrOa+qduuMvcfwxPubz+poeQPyozOCbG+a8DGs7+FXKQbRJmcpFE2U05tDkA+eYjZEx99doh67hVwY81N1cOhGu67bh7/ytzpg+UC2Q1DQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776673; c=relaxed/simple; bh=hgFVRlQObA6IRobzhqyVXdoXC8mayCY0Z2IgxlZSSuM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g9lAoYgtD5dFjXAvwWZHZCCpThkBAKm+YmpuAQhV96jsRmr6k6jbTE1EBSip712D0i1gvJiHGjFQAa7/iKwFCf0z0ygDNLvjUwB6jiusptYIRTX8BnvS8w9DXSIq1TdS8jDpUpq6DkcIIDwVm2smtIEYdI0UEJArQB1G7hoIJ5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TL/JmbwP; 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="TL/JmbwP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B2721F00A3F; Mon, 7 Sep 2026 10:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776672; bh=owHwZKjYQNBsdmW9cxprXhtWaMjXxhcOEf9UsPq09Zc=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=TL/JmbwP1pZl9GSwEJwmvn24ao2aheHc7bJv5s2IshIbPh1MQB/NdU0L4gfFarRX2 lNXJmprvh/3VECTEXa1m1TvtgDks8/LJxqDhwz7fhgTeygbWLnD2PWJ5Iz6hQmv3IF IYc/0ddIHeu89RZTebsq1YkUcgQA/PH1tiQEmfuffLfXFeJxeD3rdc09oGtE7vJ8y3 1+bLY3jqAvOaEMObSG8ndYCTKMd+ER0wSeZ1MddZgQx2mIl7FOL9kBLAo+3hxeU92J HR0Enzt20v2LPipI6Gozf4Jo6exwgXtvcvmTGWL5WE7DXLer6R+B9OJmKi59mATpAb iWbc4mifNrExA== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:53 +0300 Subject: [PATCH 12/13] s390/qdio_setup: Use kzalloc() 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: <20260907-s390-cio-ready-v1-12-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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 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) --- 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 7ca8f61a2387b..c0215a7d29a81 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 kzalloc(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 23:53:49 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 2AC9046F49B; Mon, 7 Sep 2026 10:24:35 +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=1788776677; cv=none; b=qi8aPU+G4MLZfXehOCxXlz/jMer3S1xeIm3gEL1wdNYHDqcTSifhDnl4nPA+syaN0TUvbI4jxEeZpwITsU5ic6NGvljulMuI2Tk5cmNLfWkBgQC/+inRJ1K8Mmszv2TLBAR5LlAE3FHZ2lkcwzmznsz7/3I7X7NZzc3lC/JP6zk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788776677; c=relaxed/simple; bh=msniaosZMR/qwh9gdvOXvUlhttFaDmHvFelXNEpOfZM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hzm+YOcuqqyNxKTcNgREJ0v9J1b1M97nE/alLu66pVNE9EXUlZ0N926wNmrsVTnchiX6ZfYdzG0KnXtRwb4/wTTi+QeK2V4ogJ+KvxEXX1yc/PalHjd+kedZJEeZmakp3flmb54YAfPlObjWga/+cKdq19faOXIdARqJxz6RMkI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KS75OFvs; 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="KS75OFvs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C692D1F00A3D; Mon, 7 Sep 2026 10:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788776675; bh=ZWoW41+x+7dy6umxK1i5p5XUicgKN/VyGWTHRTGB5Jk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=KS75OFvsRCVf4saYIwM7a7NN1+hfRl9Js1UXnBdo4ejdc/JRfRr+x+8b7ByXevYcO rfWjqSA17UYgRcYKmT5++U7d420TnkfJlN6/yaQ6IiwBHHni3dULFPaSNEFlHOHw2c 75cU9o/cuKArq7AlxXxBp5t1+KSdEJZobfXlSXI2uXLoU0e9yPaKq/Sue4Hk34mHCU GofAygwswbGe7s9LY4eI5lfqP+V3h1dDpHLxgGGX/umcnKChtdrJCfoURD02QOU0Ak g8d9a8fEYO5ZLLJ0aRKUoWXKJXV3FNe6Jw4y//ye/5HU1yV6B4ky0fGRSPsq4P5B2g ddGOIKLVTV9eg== From: "Mike Rapoport (Microsoft)" Date: Mon, 07 Sep 2026 13:23:54 +0300 Subject: [PATCH 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: <20260907-s390-cio-ready-v1-13-ca7f39806234@kernel.org> References: <20260907-s390-cio-ready-v1-0-ca7f39806234@kernel.org> In-Reply-To: <20260907-s390-cio-ready-v1-0-ca7f39806234@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) --- 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