From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D07AD3DA7FD for ; Mon, 13 Apr 2026 14:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776090018; cv=none; b=TlFJI8r2Gmnq7Z2gEoAU2OXAPAm00jRqXLfdCNszJBJzusJwtDxmIB0NYsDKKZtNRvsdLMjLbWC9qt/HDUJabMIB9lp9Ws+Aa5ZJpWiMAAAs6Gx9THSE76uy0g3HITCQzMgShNta3dy/2xACMhpEenwwVM0WrNlabDzUBW1/kCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776090018; c=relaxed/simple; bh=c0st7JybrwCZbZ8ZJ6QIDs3+mz+WSuu30vMH4RaKehk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PRhzwIQQ3FZJippuAjyILkiyf8rCQGA7koot5P/cSn0ZscX+IWDFsMMtvpLTTJSZsgcls+BzYdUQ44FX0IikCdpjt7QtP1SA2Pn8VyrqQzeYCeTIqHlsHwYiswtg8P3LLEgYf/3TIyZERclTaVTrOmtzkLo8HFk0/nY/Xi3td0g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=jRDdbwj0; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="jRDdbwj0" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 948D0359A; Mon, 13 Apr 2026 07:20:10 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BCE963F641; Mon, 13 Apr 2026 07:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1776090016; bh=c0st7JybrwCZbZ8ZJ6QIDs3+mz+WSuu30vMH4RaKehk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRDdbwj09g2nOAbY8vKdO6xBXiPxmAs6Q5gxqxJEv1cJ/hdJyYFz+OgDX2boLBlUx /ZtVO1XdH+fttfXeR1FNSWY+v+YxL7T2HggzQ141uCv2QBXGyI+xdMTZ5SlNAz2wcM tjBQc1eyuueY5+1icJ7QJ2Y9Kutji/uxtXxfJSNs= From: Yeoreum Yun To: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: suzuki.poulose@arm.com, mike.leach@arm.com, james.clark@linaro.org, alexander.shishkin@linux.intel.com, leo.yan@arm.com, jie.gan@oss.qualcomm.com, Yeoreum Yun Subject: [PATCH v4 5/9] coresight: etm4x: remove redundant call etm4_enable_hw() with hotplug Date: Mon, 13 Apr 2026 15:19:58 +0100 Message-Id: <20260413142003.3549310-6-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260413142003.3549310-1-yeoreum.yun@arm.com> References: <20260413142003.3549310-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The cpu_online_mask is set at the CPUHP_BRINGUP_CPU step. In other words, if etm4_enable_sysfs() is called between CPUHP_BRINGUP_CPU and CPUHP_AP_ARM_CORESIGHT_STARTING, etm4_enable_hw() may be invoked in etm4_enable_sysfs_smp_call() and then executed again in etm4_starting_cpu(). To remove this redundant call, take the hotplug lock before executing etm4_enable_sysfs_smp_call(). Signed-off-by: Yeoreum Yun --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 01099689525b..facd5a306228 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -959,8 +959,20 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa arg.config = drvdata->config; raw_spin_unlock(&drvdata->spinlock); + /* + * Take the hotplug lock to prevent redundant calls to etm4_enable_hw(). + * + * The cpu_online_mask is set at the CPUHP_BRINGUP_CPU step. + * In other words, if etm4_enable_sysfs() is called between + * CPUHP_BRINGUP_CPU and CPUHP_AP_ARM_CORESIGHT_STARTING, + * etm4_enable_hw() may be invoked in etm4_enable_sysfs_smp_call() + * and then executed again in etm4_starting_cpu(). + */ + cpus_read_lock(); ret = smp_call_function_single(drvdata->cpu, etm4_enable_sysfs_smp_call, &arg, 1); + cpus_read_unlock(); + if (!ret) ret = arg.rc; if (!ret) -- LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}