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 4AAE93EC2E2 for ; Wed, 22 Apr 2026 13:22:37 +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=1776864159; cv=none; b=pyvCEu2ig/b6G1Hb9ihBz0YILqYBlB+TlG58QzJfVpbO7AugDEKxf/D1uRaZvIaVcBJFTlwpu4kApB5qsUBFS45QShY9cexI74bKmZApt4mUXtuRRoQ0bPz43f1m6hnAoy5qVii7fUfQ6b5qIKVAx5YHrle3tLX7PfG7m7e0Sk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776864159; c=relaxed/simple; bh=UKXdFxldnBDOvnnwJq1j2HA+gw2wAptUrDXrQFQYulM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tasakKWyChf2mRwRq9dFDxUZkVWcVoKqDguaZUgb0d95bqw0pnLMKcYCs6lM3QaFt9wPauDvvNClF9YpE27kP4g86/fTaK2UcniE3eNfXCW2k7RKEGSOvmIBwYjF06EU+affADW1SP7UZmAj9HcRsHDZ4wKlBde2TpE2Hyg7bpg= 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=mcKxXEsI; 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="mcKxXEsI" 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 235E02454; Wed, 22 Apr 2026 06:22:31 -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 D75C23FDBD; Wed, 22 Apr 2026 06:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1776864156; bh=UKXdFxldnBDOvnnwJq1j2HA+gw2wAptUrDXrQFQYulM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcKxXEsIlQV0jvEz8jx4hQtR+vV1dmzFMe6VPJCYhB4q6evsOa39zY6yLeX6zelE3 Z/xFaaVCNnkitJTe6KmvYOly4gxxH8usr9sCyjEwYYiX5rBC11g8L3P1ILV7MjPjrR LyKcHQCmfY8oia3h+MW+Yke7Ebg/6S50YGiuHfIw= 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 v6 13/13] coresight: etm3x: remove redundant call etm_enable_hw() with hotplug Date: Wed, 22 Apr 2026 14:22:03 +0100 Message-Id: <20260422132203.977549-14-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260422132203.977549-1-yeoreum.yun@arm.com> References: <20260422132203.977549-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, etm_enable_hw() may be invoked in etm_enable_sysfs_smp_call() and then executed again in etm_starting_cpu(). To remove this redundant call, take the hotplug lock before executing etm_enable_sysfs_smp_call(). Signed-off-by: Yeoreum Yun --- .../coresight/coresight-etm3x-core.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm3x-core.c b/drivers/hwtracing/coresight/coresight-etm3x-core.c index 85778e6349f4..72219bbbf616 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm3x-core.c @@ -521,25 +521,26 @@ static int etm_enable_sysfs(struct coresight_device *csdev, struct coresight_pat struct etm_enable_arg arg = { }; int ret; + arg.drvdata = drvdata; + arg.path = path; + + raw_spin_lock(&drvdata->spinlock); + arg.config = drvdata->config; + raw_spin_unlock(&drvdata->spinlock); + /* * Configure the ETM only if the CPU is online. If it isn't online * hw configuration will take place on the local CPU during bring up. */ - if (cpu_online(drvdata->cpu)) { - arg.drvdata = drvdata; - arg.path = path; - - raw_spin_lock(&drvdata->spinlock); - arg.config = drvdata->config; - raw_spin_unlock(&drvdata->spinlock); - - ret = smp_call_function_single(drvdata->cpu, - etm_enable_sysfs_smp_call, &arg, 1); - if (!ret) - ret = arg.rc; - } else { + cpus_read_lock(); + ret = smp_call_function_single(drvdata->cpu, + etm_enable_sysfs_smp_call, &arg, 1); + cpus_read_unlock(); + + if (!ret) + ret = arg.rc; + else ret = -ENODEV; - } if (!ret) dev_dbg(&csdev->dev, "ETM tracing enabled\n"); -- LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}