From: Heiko Carstens <hca@linux.ibm.com>
To: Thomas Richter <tmricht@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, stable@vger.kernel.org,
Jan Polensky <japo@linux.ibm.com>
Subject: Re: [PATCH 3/3 v8] s390/pai: Support CPU hotplug for PMU PAI
Date: Tue, 1 Sep 2026 13:19:18 +0200 [thread overview]
Message-ID: <20260901111918.14482C40-hca@linux.ibm.com> (raw)
In-Reply-To: <20260901085448.2260658-4-tmricht@linux.ibm.com>
On Tue, Sep 01, 2026 at 10:54:48AM +0200, Thomas Richter wrote:
> +static int pai_online_cpu(unsigned int cpu)
> +{
> + int rc;
> +
> + mutex_lock(&pai_reserve_mutex);
> + rc = pai_alloc_cpu(PAI_PMU_CRYPTO, cpu, true);
> + if (!rc) {
> + rc = pai_alloc_cpu(PAI_PMU_EXT, cpu, true);
> + if (rc)
> + pai_event_destroy_cpu(PAI_PMU_CRYPTO, cpu, true);
> + }
> + mutex_unlock(&pai_reserve_mutex);
> + return rc;
> +}
This unusual coding style. Please change to something like:
mutex_lock(&pai_reserve_mutex);
rc = pai_alloc_cpu(PAI_PMU_CRYPTO, cpu, true);
if (rc)
goto out;
rc = pai_alloc_cpu(PAI_PMU_EXT, cpu, true);
if (rc)
pai_event_destroy_cpu(PAI_PMU_CRYPTO, cpu, true);
out:
mutex_unlock(&pai_reserve_mutex);
> + /* CPUHP_BP_PREPARE_DYN --> before CPU is brought online */
> + rc = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "perf/pai:prepare",
> + pai_online_cpu, pai_offline_cpu);
> + if (rc < 0) {
> + debug_unregister_view(paidbg, &debug_sprintf_view);
> + debug_unregister(paidbg);
> + return rc;
> + }
> +
> if (!paipmu_setup()) {
> + cpuhp_remove_state(rc);
> /* No PMU registration, no need for debug buffer */
> debug_unregister_view(paidbg, &debug_sprintf_view);
> debug_unregister(paidbg);
Code duplication. Can't we have _something_ like:
diff --git a/arch/s390/kernel/perf_pai.c b/arch/s390/kernel/perf_pai.c
index 72023b35e70f..e1134e50f3e9 100644
--- a/arch/s390/kernel/perf_pai.c
+++ b/arch/s390/kernel/perf_pai.c
@@ -1316,20 +1316,19 @@ static int __init pai_init(void)
/* CPUHP_BP_PREPARE_DYN --> before CPU is brought online */
rc = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "perf/pai:prepare",
pai_online_cpu, pai_offline_cpu);
- if (rc < 0) {
- debug_unregister_view(paidbg, &debug_sprintf_view);
- debug_unregister(paidbg);
- return rc;
- }
-
- if (!paipmu_setup()) {
- cpuhp_remove_state(rc);
- /* No PMU registration, no need for debug buffer */
- debug_unregister_view(paidbg, &debug_sprintf_view);
- debug_unregister(paidbg);
- return -ENODEV;
- }
+ if (rc < 0)
+ goto out_debug;
+ rc = -ENODEV;
+ if (!paipmu_setup())
+ goto out_cpuhp;
return 0;
+
+out_cpuhp:
+ cpuhp_remove_state(rc);
+out_debug:
+ debug_unregister_view(paidbg, &debug_sprintf_view);
+ debug_unregister(paidbg);
+ return rc;
}
device_initcall(pai_init);
next prev parent reply other threads:[~2026-09-01 11:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 8:54 [PATCH 0/3 v8] Add CPU hotplug support for PAI PMU Thomas Richter
2026-09-01 8:54 ` [PATCH 1/3 v8] s390/pai: Use PAI PMU index as parameter replacing event Thomas Richter
2026-09-01 9:12 ` sashiko-bot
2026-09-01 9:56 ` Thomas Richter
2026-09-01 8:54 ` [PATCH 2/3 v8] s390/pai: Move locking to event init and delete Thomas Richter
2026-09-01 9:12 ` sashiko-bot
2026-09-01 8:54 ` [PATCH 3/3 v8] s390/pai: Support CPU hotplug for PMU PAI Thomas Richter
2026-09-01 9:03 ` sashiko-bot
2026-09-01 11:19 ` Heiko Carstens [this message]
2026-09-01 14:20 ` [PATCH 0/3 v8] Add CPU hotplug support for PAI PMU Heiko Carstens
2026-09-01 14:22 ` Heiko Carstens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901111918.14482C40-hca@linux.ibm.com \
--to=hca@linux.ibm.com \
--cc=japo@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tmricht@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.