From nobody Fri Sep 25 16:50:58 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 48D63384CE9; Thu, 10 Sep 2026 11:00:13 +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=1789038014; cv=none; b=R7sVioyWYix/9JGPXSydc0TbH96CgwrHXuRPXaaJ+CDiv7UsGks9ArgxnkBJIQd2dROxJyf+Q/bJRwF4d2rNavHcZnHdDTI/AimrdnzQpXGfGLyPTQ41mq9pH1oHTFGCqX3d4q+/KDzYOc9O8swFqLJROi4xd9fpQ21NCsbzCdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038014; c=relaxed/simple; bh=oaUUL2Z6uTL/fsueJ+wmiwF3r3nbRoUwtNTlWdzZV88=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TLICo89rI3I3+Ox+NY81bG9f/q8tr2YE6gitwv49yZB6srMzqHGtmAFYDhS9Yxpf4uUQR7VGSbl8glp3oLvGX52n7MjfPtudSWm1nBvkZ0YmAcbjHK7Zsbyj6BZVA5ORyfs73FRptEayGt6bMnyjPml9IQ0h2nC5zSoMQtdrhco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QuGgLiln; 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="QuGgLiln" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 697F21F00898; Thu, 10 Sep 2026 11:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038013; bh=waNeuygMDtlm0C03ZytfUl73M0zkpwkt1aPQuPSWLWw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QuGgLilnXzAsGi5SDxvpW5ki3SPsVVpIH63og6dimK8fFfG5Fof8O+AehVN6a7xGE 7jIGwVc2binhpEGQ+4HlpTa8Y7KhifuwbFX7vDQTaESA5Weo5LtB2S05xGP/OKQ4za yzm9ERhN8E+FemafZpVQnLNoP83GbbG0R9RsP2BJhmcAOgTmpBgMgma+afzs5wpqfn rct+zvuMngEM5w7Q8MGmwLGtgtKdZyInNtRidwEZLW5vSFZqG5WKRMJ3QtilipDueW tVqCNnECnvPfwrCo7hDpTVt+O94fS4ZmZzifGWltGnNSEHvwALMM34mMiqhtdW83PT 4dyK4GUfJ986g== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:03 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-1-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 D630746F497; Thu, 10 Sep 2026 11:00:16 +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=1789038018; cv=none; b=D9pEO5h1VdAHoCuuYd886pwIlzPkj0M5ECmHPkdLSqZYfhHibE4J15MZqFEdK4dkSVz+pSUD985z44wvIKOPu0ejni6xjNRAJfkN/x/KvuelvkTtHCLdW9Qo8OIMRZ9EL1mog/Veh82uBVBHQrHQqTK8lntqWCVh2rkKl+9l1QI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038018; c=relaxed/simple; bh=tnPqOGWy+G/exKowrqrFWAt1LzC422b7ugtuCq4Q7iQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bjrxclIyi+hZpg0kTeQ8YV4oU+LkffGApMmABfBKa1hQBux3glVCMAwKo5ymMYaDUG1SP/0xH92yau6CCnp8xvD8Zo/aODpAJo8n270YaohDMJDh5keL2JfZ1xKRtfaKzl4MSrMSdvoX9JiJ9ol0BRtgcHLR0pu7NfHwXL3cFOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ACpqjS/n; 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="ACpqjS/n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEDB61F000FF; Thu, 10 Sep 2026 11:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038016; bh=BvSsEcfuxj9lC5YTGUuAUBtK1T4naFDW4wq12j/K7Zg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ACpqjS/n8i5Rs0K/trhMuPDITZaEeJ/fcxuD+p9zdAxP4W31/1XfwhlzCkzXJHkGG gzO0oUz75n7IE+L9bMVIrHzXtaBHmckwqlWsdZEWxsgMVvLTEWTuWdwxjEbXcPPS2t TtbO1dScBxocTHTkOfGoo5xfBf75f9UUT4/myO+Fcq1ZvssPeEoSr/XYDnHb954LTf +/MTUN+XqKUIFzLgV7PazYA4RtDklB2APxgfddYW2dtoiYUiVu8+sI+ZRy2ktSHEE3 FXkuwFw5LkR8z0RpvHIMVKHBUfaHtbQFnjvtjmiqslNylxMe4oDnWLEDKHb5bMzSLK oGWFhyhBT3hAQ== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:04 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-2-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 959D9470136; Thu, 10 Sep 2026 11:00:20 +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=1789038022; cv=none; b=eB9SS1iudThdLiE9+VYbTj42QHU9ARBQJmniZpmfyljH2zfQtGa0oKhEtBt04yaRF4T82gn9LavXckKenqE6CM84ot9lETPNHdzsL5I47dnBmuMLePbQjXqQbB3zwIhr9DOXpxot84G213cs9BRp+FSSEA9i2/lyo+yi0grRXgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038022; c=relaxed/simple; bh=27W7XaDI53ge61OsV1O82PMbVANHyRB3FsKg1gBZ+r0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K3sq+CeYEV+180Ks//j1FHKZ8ZjRUStD10EZPg61RP5vgyVeTqLSt8w2rVsQCR3sIdjjjEjfI2ktmQUioCLdEU7rZ6/uSfdlHEZDZfwA90v76noXVexRDoE4a5c+1wfw//5vtqWKcyycAd/brvn69eK+DnfTfuk8goxbsqB9Dr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B3lnb8PL; 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="B3lnb8PL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 020371F00893; Thu, 10 Sep 2026 11:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038019; bh=/CjaWpeoftE+Wn2hDoCKbw50T/OskJjYcBztwhRMRzs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=B3lnb8PL7M85f75exnh7h0hPNl1h1Lq61Zrk8Os+kTvDlTeUCAJYnm5mzVpXkjslJ uh3UkmdWeia6McU0ViR7mHavK4KMxc47giLOXDYZf2IBsFSdFLilDFAb0OAqV/reJ3 ODVtoHqN0wFeWIy8nm0QLQiWsii7m6fAS6QXeBnM1YKgLrz7bhlKNCcOiTdTcpjAWh SUaALEAixjO6ayZLkzj8ipS70ZI4aVMzPXjH9ykyx6zxvMbKV2J4/1KEy1KwBucqsI qfJkRDJIfxqUm7ejy51Yezli/J4O0/FteUL2Dkvz+16Z73GQajYeMIoiuL5W8tMjLq NDDVfoHVrX/Fg== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:05 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-3-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 711A347126A; Thu, 10 Sep 2026 11:00:23 +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=1789038025; cv=none; b=ql+fueCxIji6vasP4jTbbXmAx8iOchEJMZae3C38IHdtT78seIM8rTeN68Qj+P/lZzfixTsS/1+TYRqajNq346YN+qhE+R3wyOtLxqsK4jagOhEbErqiBf+VUc1KtLFFF71EtprSjRa9w9WZrmiyJfVQ0xFVxZvO88oKIDCQp9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038025; c=relaxed/simple; bh=CSUDFFdhmtCWeW8oSX88//X3I6uiPteZhW4Opf/GQyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qz7EUw/FeoJ/qGPOhM1VzBD0eGmqlHMrH4Dr0OnAWPWZM3ZiiHfmI6b1WFLY6Ss0v18GaACPqWU2lsLMXWkI/c+zSo2Sdph5V7XblDCy/rfYahoUZDBGuoGOPXJigHu+n4tTGhogcxUuPhnnGHonM5eu15UPYMd4MCLU5SnlM+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aij3lXrD; 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="aij3lXrD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 479C91F00898; Thu, 10 Sep 2026 11:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038023; bh=wH/HnScIECqzPez57vPSs9kJwAMAsBLZmPepnLoPjpM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=aij3lXrDhzEmq4euQgQGNWweCFCBcmv0Ru0IiJlQP6T/gGHCdTA5F2z8v2TOzbEaG r9EC/B87klCZ6vmju7+fOePhoDhM6PShCPX0Bk3998yr4qWk9WVmKKexXQTBSOdWA4 OUsqhnLJ5MWyxT3egO7/NOrzO25AboDvPj7FEDkkGnPOrKTdpUPUKAXHzTHRGbvkgm 6lDdW7QmQ18221krdqayeKawV9PKSfqQXNN6eLHBRKw9XImdCEIIRCEC6phN3offim T/vY/+sxFKJ6b9ozKhfOmBz/wEDM6Fp//r2VsYk/wJQYrwf8DfiTJ7NQRg/FUYPPvk eolO1XLedPSCA== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:06 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-4-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 BB4AB471CEA; Thu, 10 Sep 2026 11:00:26 +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=1789038028; cv=none; b=sDthBuyE7gp5nq2E1ChGFK+BdJPYMDmRHUWvfPuRvoyCCNz78wLr5Zdt6xXbh1DF99lXDEw/Jv6H73TXAud9tEDEcxvGEbSLHZC6q9CXqo4/ORxfkj5ZMUSj4Zi5j7LgktcGanAS2FcfMvGr9iaourWRSIpiaKzhVLz6IsPowM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038028; 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=RX0YN68KwWzlO0pduf/Z7Dbe9+PeyCBb7j6uUYICowIMFJWZc3ewVw9JmJ0A5ey8Kgkd6O4FxjatXijpdPkhon92xgfTZRkBA8O0kjgWLi70A3QYLQSm7jDpWxy7zLlxqZWb3zruWz2MtzZRZdjbBVEnr2wI6ryYK4sKjhW93gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hdl9BWx9; 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="Hdl9BWx9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D4831F00893; Thu, 10 Sep 2026 11:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038026; bh=NE/c7IMcBZdCzVyFsxXaIo3nYpN6KWCimcqlbKV3gw0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Hdl9BWx9RhV8TV6gLvkYRLFmDPO0Zs8tK3D5BFDdDdM8+3tehJbH5vh4fDmoNfyBG XVUlqsCfXwgRScwZLs9GHciRieQhKTmD6/0oKVT5FX6AYGH/pgB9ipXaCWpVktu6/T s1glLty3/szd0bMK+ufXwOjYcFUG2qYR/6py36MoOvxXkGvLcHN2uxDk9DmYHicqoO xpGuPbC9B6KRtwAPkNaZGkug3KM20oi+eBM7ltI8MWqReXm1SF8Ro1Gys0XC5WKnzX um1bWQ9ZxUFQgi8a0PUPthf7Xi5w+hxFu5nC88R3bDi7Un/olqIzi9/xy89nqe3wuV cecVbzkuEjMzA== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:07 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-5-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 1A3BC47126A; Thu, 10 Sep 2026 11:00: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=1789038031; cv=none; b=bu3SOjwZh/MkvKt9vqikbASKDGa6A1SfDv9jujAzYiuEmsokzahPmXg+s9G9ZmSyv2558K02eu2T4k3LKQ7nJhcp7J5oUcCDpVmSzxGwzchBLB/flsZ0fkRPlCj0V58db75DAoyomTAY0m/DnnsV+bY93luyOFGP01lFhTZu/ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038031; c=relaxed/simple; bh=/Q+UndceaLElGRuOMnjLND2Cqzr3OFYfCjs9ZisM8t4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g9L2JyNVdaSDgKAxbd6rI3DAR995JL/ug0icHsHuS5P0XGNCHV3Y0djGor09O6iExrAI9PWuT/k3olsRdpmtSpRY3yJvne3FqZj1gkcK31FpZgERlC40jZE6LNh0zIAEZ4YlWeLRmGvXCuyjyCKGyVU+0D2+XAJ8IE9zHJ8bicc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PUSLtGkW; 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="PUSLtGkW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E02D71F000FF; Thu, 10 Sep 2026 11:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038029; bh=kEZ6nz/JFEHq+6k02cM7QTBhs2+peJoyslzMnyOEfRs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=PUSLtGkWdQoW+cSKLEstDTvjtTeqxWgpfsBiiGWDFJ6/TgdE8RnkfKbvYkWH/mxQq iUD1GMaIaoNEzflLY2zAsXaOXhLynyxr7XCAvjSidp0vG+Vlvpv1umfrZBFuiD+q4J vMN83RdUZQ/KPVcNidMa0lqABo/fOw/x4yahPoo8IiglMd0D2/43P5RRDSNf/AiNOZ B0CVFCFz5ZgnHe0oSLZFnDjvOO/B2T/TzHSRHyKLeRjC+cwqEULVvkA8uN5R4I9TJ9 E5bjtHmqPaP86CNViLqsXoTbKl8X34Gxt08GmhG4jkmeu3a60XAy8Au3/CHJ58ob3a a0Hvww47S/I/w== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:08 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-6-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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) --- 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 16:50:58 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 41F36472072; Thu, 10 Sep 2026 11:00:33 +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=1789038034; cv=none; b=uZR+bbfdw3K4r5Tk/O4SKXBzw8Vi84yoMVOtwpGq0L2D/3vr934FM0MmvugJTvfWYCZTP9CE0HLGgpI13GPxktemr0m+v+xqxBnDCVTaeV9RvgLq4mGwxJARO2Xeom6IYduaVSPH0YlLRQZuXP2WtmCHjJsThz8/jbqH2lzJKSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038034; c=relaxed/simple; bh=rdcrVC0BA24TZWlwPcwV+Z6oi8PioFMGwbQn+fYuYnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=srxZ3a8KuprRh37IioPhW3xmHubgzGLOMaCxagwVhsdZzGXSvSfwPubg4o6KJ/9Xb3dC9r6iHzga+68pOlOD5/oGPVoY+uMSS3VFJVZTO7kIItXGtpbe0qAjShj7OkLaXx/qXqjnzS3Vd3r6tCxCnMg9K8V0kBPQqtKQO8iQlSw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QwJMnW0u; 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="QwJMnW0u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 369BA1F00893; Thu, 10 Sep 2026 11:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038033; bh=bAVP4y79lmB0kd35IBqs2N16e6jwAfNVV+NWInsx3B8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QwJMnW0uXEnOlhVjMZA3ChXQrzqwPzdD00tByvpMjpZhbWPYw2EJdfVvtch3h/gZS G8mh1fgKfpv7AA3MQn35gggwdWJqOOt2ofz18QG2rJT8R953CBCiPLjyEKF49uqLnV q+EQ8WmHBUuk8iQhRrfrGrGExi9FTJn+tmDTlhkm57GGQd9AruTdroDxlPuerbDl3C zdEQE9V5Q5uiApj3qDzkEd2l9IzAmVxfy8hwd1UtOad7tfAX7gF4+7ggrj70cCZZqF 8aGTdeEAocc03X2vN+/KbDM2SEyEEyymgz2CH1VaZpf7oHPgD6/ZQxzdUlPElKMchr VjgvEuvNpQnLg== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:09 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-7-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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) --- 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 16:50:58 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 A786F3D16E2; Thu, 10 Sep 2026 11:00: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=1789038037; cv=none; b=KKSTue1c2FVjZS6nXqBHUggbga3JtrXg49Za+6ebUogx/crsMJrB1VZ9rSTEZ0othhizuDGTSkozGvErhkCm/1/D+O5WLpIohxiecXPjf9Yijn3WHLwz9KyTLfaWCGsPKUvULe5RGo6UGkvQNyLoLL11eSGga739inE46T3gjsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038037; c=relaxed/simple; bh=CnXHp1JkDOfwDEmuFIt1o/K8zCbiqBSR3yDlzthGbnQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UKZUkP+E9I4p54tgOAGC0zZLhos6KK1wcmTZVH8G378Xn2Cl/bjhHsowHpqov9xGZHEjnt2QdrGawz5teNlzkEovjvhvqEx7kLJxeB/GFpEmwE5HT5+egUrQVcpM6/mUEG5Tuw+7J0xqEDVNl5sEuGR/A8G5p/kmG3BSg1NL6eg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dVsepamy; 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="dVsepamy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BF391F00898; Thu, 10 Sep 2026 11:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038036; bh=U1G72EbqUjI9oNziOv0XdCQMAxirZYF5Q2JcgCPI+0s=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=dVsepamyflN4CWrmX4M5jdM3tEOFYmVaGJYyPMgYyQGltoCu/UE269px5Np++ntkv /aZjvuCUE4Y91WOA9Stmag4LPGRYjgNTOCzTRYxGs7+08594wADyF2AAMrR/QyKEhB teZsGft7BlpW8tIJuTju3U5vUx1MUaskToroQvtiXq43rJKHRmPPRUjBvD8h1CyIsV J8NDJOsqVwu36YLRUbBFcMUQ2BXbS2xOpyRGKK/pg/BHBR/+J3pCXBjxgYnS5XsYkh 3Q1U+9JEMdFN26kZQwGgNYEgEsxWcjbky9eG/j4fe29P/C0I52z5XlZ0e4ORSIx8wg YecKXB7wpxmNg== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:10 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-8-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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) --- 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 16:50:58 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 053DB42903F; Thu, 10 Sep 2026 11:00:39 +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=1789038041; cv=none; b=gkGwuLYbtmn/7DoiUGIzUE8jv73sK4/oD/IMg6tTJ8XVOIUs2iR+5bc8QPNkubISeRW5wrRqPU4if66qymqK7WS17fUpv03sgoDedLqHglwbSPgj6gG5IEbAY4jLwEBgG9vwg4PKQvZyKK033AigP/30nGmUOWzYKkEyecbn+RU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038041; c=relaxed/simple; bh=4alY3z2W927Ms15LZYZMvwkRWVZRcuBdqTKjuIfVo1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PFdPfl3yKj8WeD7EoLS51D0LEqiNzAZpTHhZoopJqhwi8P2l853N3xvSVi2PZOWmygNHDnjEP0pJu4UgkbIQrA7x/HXvlA0aZ6nWLD+tpv9XWVQNLTGHVmnJdhMNLbnR/Gl+WSbJ6QL+KVi6GpL0IyUCUPr+ip4uDd3E6sIjvD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TMW3QUg9; 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="TMW3QUg9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C10D51F00893; Thu, 10 Sep 2026 11:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038039; bh=GAESRwUS4AoT8Fe9vxXzcjqr/ANwAvgo8C6M4V7pHvs=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=TMW3QUg9PZpNiF1fxPHU4S0WuRUIHr/mwgIsWnR5QBsdnMWHEzoSCrCf6E8mrxi+b n4+pJvgaO/qzIwH7pu7BlMUaHhjgLUuM7YMgV7QFahNrhpyNL9JPhMBXo5QNw4dtGu AQRS/01Cj/RtuvBS9+3PxtPG1lsedpKYIPmFZ7F1qEvoRjE8uXq1jVaVD+wfOgM3c2 cx2IlWoIbw2Con8kBeB6SBA/BAnEL3GmCPMi3Vuqca/QUalRlrngY+Q7j70q/co++p 3nhRyze3rCl64S4hedKp/stcOKNStRSSdJi936bh10aBnjJchvynINrU0i3XWb+wVJ pA7wWPwbOcdew== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:11 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-9-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 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 16:50:58 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 32FD3472543; Thu, 10 Sep 2026 11:00: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=1789038044; cv=none; b=prFPbDATX1W4ITSwK2DFlKAmiPGgugO0/j/68aKwAQJGfdYIlfmgrJYQ2ChqhhrX6121QNlUyPqzZ6vYBvlg0JKQJBwBdhUhv7Hbgo0CT9lfFqkEXPobiRCgzMmmTkZFOY60NrWtPrHrbbvrX2R46pQFp7WnNuX3FIjU1+AnFgM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038044; c=relaxed/simple; bh=py2j1Mb0iGfPkNln0c3I0yAAV0xNwtsE2Kq4knjbP0s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hddUnUHu5vkK7OewiNRJRI/bH4tTvwa9PMfp7jPSoHMRyt5jU8ad7V/ZXUc57ZRBNFy9xwSI5fgWJnqRydEEomk1f1nWrI6963i379oMu0UVxEC9uDQewCJNxfuhCH/w6xiZg+wpkfLNcRxQ+pxHq94gICtNvW4eWqSa4z9eVAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jpmwVDWP; 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="jpmwVDWP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 129041F000FF; Thu, 10 Sep 2026 11:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038042; bh=LB6kX+FFwnDBpk8VzIo69FZJtwl3A5eOSrIP15c/e4Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=jpmwVDWPGtwMq+bse73BBAXPLxdFo/PuhmwQ6g+42F7+Bm8HB6e3qf2i8rqPqHj7k 6Ep5rX6QaLg0XF02kXeSk92E9O+44smp4nzr77/ZGQKwHfX2qnDxpIh7qrxeTOwfkZ 6/btxiSo1yTZB5uGpw/MYUOltmW/1ch4vD7hKw1yvcy1Es88vnM6GuOBXsSixwcaFl QIW305pHBgAFWWa9cyp9WU2W+NpBS9c+fJbuHv6Cah/a8GV9z3Xj/EefE5h1B3GpGo Culqtq2TZbNWfSEc2uRF65xhFaNffRmjcFTRuXDmuO2CB6pW6F7ZZuVAf6g9lJsNSA XvCZ1citPFn/A== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:12 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-10-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 7128F46D542; Thu, 10 Sep 2026 11:00:46 +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=1789038047; cv=none; b=MSkds2CyqYLQArc6hmNrMtvJIghWsCOyzOLD9oA6jUMbTqZ9HUBRN46b5fYX5Z5/1TNpYoKES2L354bP4c55eXVX9tO2Azk3fsakmUaueoDdiiUSw46o/91B3yIHthfpYWiop7gpAZSTNDsyDZf2/kv/q72mSDMMGajjimFjQhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038047; c=relaxed/simple; bh=ExZRIfSZYWKiGLqVEza6Pma8epGogrkm5/O+l1yl1Ww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JH0wo8ekAELjfouV3tqj25TX4ZusRG/1/1wBozd+AsFRcSUieQTve9HUFPZCVQ5NOPLDGyS2dfPnIcdwLE2hldgYwtg5JHMZqsPhVva4WBPKa4Nt7jXbHVChwcMYiHExJtVl+WIEdDU9e4BfWz1GKhjQy4VJ3P7RtFqhDcGUs0g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WneeTd+w; 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="WneeTd+w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 585FC1F00893; Thu, 10 Sep 2026 11:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038046; bh=kjadfUkSzyOP1zHYpwk4bR2tv8NVDjjU5ZmwfJdW4t8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=WneeTd+wW5lN9tsU6scOlOCEQrhfC0vBt7gRnjduif9vvCU9to0xuPIZfTlS6Dj59 9XC6IKgQKVNJZxNAMVlJL5/ERAnBIGWIWQLC37i/RDN49rUr8/Bjdqj+/DD3AKfZiW WevV+s855628UX6OBQZyFFAMmebgteXfihb29qCMH1GxVEM695LBChQXVHRs+ZQYrE IsdiLWAEhvCKR9DFPeQwR7Z1QxdeC4lITBAxf7xnlhDpaeLMNxA/VAuXvicjw9Zt9x NK8nr7JQqAK4TExYaI4BsXOL0GXhUiwujWRMf79BMV50dNFH86x4xTeZ5OjxoZCi60 PMMwO8isMufXg== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:13 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-11-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 D7C8E472F8E; Thu, 10 Sep 2026 11:00:49 +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=1789038051; cv=none; b=NDSBI2zmpCZRldA/ffivMQ+YotC56PxQK7UNuPTkMpX+dFzGX0wb9aBpAJre3dfaL4MsPm0RFGJV9WYYtqhxSxw8OVk+KK1oqVeCyrS27sAc6qPsgjuWMs5oQEi0zAEmXz3B2sGNZMOHOOE12UzSHaLFTtQ8Fg8rV5hi29icCTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038051; c=relaxed/simple; bh=hgFVRlQObA6IRobzhqyVXdoXC8mayCY0Z2IgxlZSSuM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lNDEH7ulRaxR1h5aFCtNEkW2F959YM0jbYbXwIpQOh0TRLoTaQdBRaueO4/QeB4DCh40hfsXiTipOyx3765XTdDyOiA9vjG18XLnot4i0TULP1cgRdR3GnzXMDSdCg9jxNUKFVQ2aM+4rmj+GgiaHTigWBcBUqzw9K+ZAIW1mxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VqW3X5Jv; 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="VqW3X5Jv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D96D1F000FF; Thu, 10 Sep 2026 11:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038049; bh=owHwZKjYQNBsdmW9cxprXhtWaMjXxhcOEf9UsPq09Zc=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=VqW3X5Jv3ytuz7FUfg5yJqnTnWHxfa2f8uOh13f3L+szD9grS+b3XD6tZXP5GYz7i Rn8nqxn2FR17hX8vFXFoIhx78KAuzao+pXVvnHiAp1GulFNzIeMxX6VlSIhJdDr2ij PodkZYtf6VW+xOFO5I5EDQCidWQnHw+s21fK+KtDkOrKIf030lBYrf9ccB+mryU1A+ zuEN+4dny8qUUT2jzRbjpxFLYHY7DJbnf9sIkJztLzG7tixEHkxtIYQJab0SoE2Qkb NtsF7X5HbVomohr15bWvmHFVLS+vNpcSyTtJ3CJetjLekTxePYfkf8LuSbSJ+uyhEA L77q5T8Iyf3Og== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:14 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-12-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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 16:50:58 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 C1D894734D4; Thu, 10 Sep 2026 11:00:52 +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=1789038054; cv=none; b=FvQR6rHrh/qjzf/sxqjljwdA3bKUbGtOWoLetD6tAd0ImO5yeID6j3B8TLnPnZI+Ux60bnZUjZgtX5VvjDhfzB+legDcGYpfLUZYN4vcvqM/rkLg/2PsBWQ8S3pdeofpYiSH3YMWije+J6cszfFPbeL0AYQCT/pGb5m5O7IqvJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789038054; c=relaxed/simple; bh=msniaosZMR/qwh9gdvOXvUlhttFaDmHvFelXNEpOfZM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ut22XjAA8adklbcvCFvNzbn6HjD9FzqU7c/8Bz0vyK9zS+am2XmKMiBKQPiJarUBwPT0S7bjcjYEaGhcKyDoTb5UJzaK0GW1JYRjL3CuhnDfvqX6gIY95IdejpPQVgina9UeLrQwxbVTrvZa6a7jniIBleVZTP3XByP+JrkhlYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HRH9KEeX; 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="HRH9KEeX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2B7D1F00893; Thu, 10 Sep 2026 11:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789038052; bh=ZWoW41+x+7dy6umxK1i5p5XUicgKN/VyGWTHRTGB5Jk=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=HRH9KEeXmVngHNuUOWNn8xRQ7/eO7kzWYtRlf+g6+nsRcMThfVn9XAQD7WHChf76P FSxx9uAhqbsd7WTBRzgkgGXMKpvQm3hhb+2UXwcaflcaa+Xq/aBK0WH2zmQmQRbl6B 9jBegERP4F5Lw7JkfAPVn/8+S9jcWcFxYPObvewN0Cjon4pVFmcLF6YiI5VJmBZqaG NVyDFo/84Wz0EMbhl4ZudmUN0ZfhyXRjSERYm7cbU8UNzjHcE8dy0cLzEeXNTdZ+TD 0jU+f+UoD7kVR31vSAjE6ZloSuZhJHbQvO7kTLWD6A4ujSu36NzkNGkBu5gxrpj9Pk 1GxVloef6tfOA== From: "Mike Rapoport (Microsoft)" Date: Thu, 10 Sep 2026 14:00:15 +0300 Subject: [PATCH v2 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: <20260910-s390-cio-ready-v2-13-e931086fdde1@kernel.org> References: <20260910-s390-cio-ready-v2-0-e931086fdde1@kernel.org> In-Reply-To: <20260910-s390-cio-ready-v2-0-e931086fdde1@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