mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Leo Yan <leo.yan@linux.dev>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Mike Leach <mike.leach@linaro.org>,
	James Clark <james.clark@linaro.org>,
	Junhao He <hejunhao3@huawei.com>,
	coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] coresight: fix building with CONFIG_CPUMASK_OFFSTACK
Date: Fri, 20 Jun 2025 13:09:28 +0200	[thread overview]
Message-ID: <20250620110933.3364359-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

Building with a ridiculous CONFIG_NR_CPUS shows that this function
fails to build because of incorrectly moving the mask offstack:

drivers/hwtracing/coresight/coresight-cpu-debug.c: In function ‘debug_enable_func’:
drivers/hwtracing/coresight/coresight-cpu-debug.c:452:1: error: the frame size of 8528 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]

Use the recommended interface instead.

Fixes: 2227b7c74634 ("coresight: add support for CPU debug module")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index a871d997330b..6ecd8e755ef3 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -416,13 +416,16 @@ static int debug_enable_func(void)
 {
 	struct debug_drvdata *drvdata;
 	int cpu, ret = 0;
-	cpumask_t mask;
+	cpumask_var_t mask;
+
+	if (!alloc_cpumask_var(&mask, GFP_KERNEL))
+		return -ENOMEM;
 
 	/*
 	 * Use cpumask to track which debug power domains have
 	 * been powered on and use it to handle failure case.
 	 */
-	cpumask_clear(&mask);
+	cpumask_clear(mask);
 
 	for_each_possible_cpu(cpu) {
 		drvdata = per_cpu(debug_drvdata, cpu);
@@ -433,9 +436,10 @@ static int debug_enable_func(void)
 		if (ret < 0)
 			goto err;
 		else
-			cpumask_set_cpu(cpu, &mask);
+			cpumask_set_cpu(cpu, mask);
 	}
 
+	free_cpumask_var(mask);
 	return 0;
 
 err:
@@ -443,11 +447,12 @@ static int debug_enable_func(void)
 	 * If pm_runtime_get_sync() has failed, need rollback on
 	 * all the other CPUs that have been enabled before that.
 	 */
-	for_each_cpu(cpu, &mask) {
+	for_each_cpu(cpu, mask) {
 		drvdata = per_cpu(debug_drvdata, cpu);
 		pm_runtime_put_noidle(drvdata->dev);
 	}
 
+	free_cpumask_var(mask);
 	return ret;
 }
 
-- 
2.39.5


                 reply	other threads:[~2025-06-20 11:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250620110933.3364359-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hejunhao3@huawei.com \
    --cc=james.clark@linaro.org \
    --cc=leo.yan@linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®