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 D7E70216E3C for ; Thu, 9 Jan 2025 11:46:47 +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=1736423210; cv=none; b=ALp3WHO3ybECmbpPvrXwxmLIIdcI7AwG1dusKFGyjHw9RODu7Q02SR8xd3CFEeZKg0bib7KrHPdMQo8/zmbXIgz3Sr6KOiE3Z5l4/WP2/8jxxrU7KM0FUYlmW90BfMPOnIUIouqgJyWQd9TQ0ltLmNxuSPFSiP9RImkmGyLJ5gk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736423210; c=relaxed/simple; bh=2PFqINCZ9nIKqar/W+k3X2/Q6TNGYOAipGg+upiM1B4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YL/9M3WAB7EEw0fcnsrfCfz8nPdLnJfqvw1PRKfGKIXd3Z9TvMRivV2d4OtOyApyqxj13qd1SspURZmlYaCRqz5oa42rMXzYt3xiWuD7eRxEoNYfX2vnj99wU+ATi7nNT4amPlqJ33E2iwUTiBXjKPVIP9QDtCPDaj5/nq8niAU= 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; 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 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 593671516; Thu, 9 Jan 2025 03:47:15 -0800 (PST) Received: from [10.57.32.219] (unknown [10.57.32.219]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F1D683F673; Thu, 9 Jan 2025 03:46:45 -0800 (PST) Message-ID: <6bbc9b64-3ecb-46c3-8c4e-55dba6301ef3@arm.com> Date: Thu, 9 Jan 2025 11:46:45 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] coresight/etm4x: disallow altering config via sysfs while enabled Content-Language: en-GB To: Yeoreum Yun , mike.leach@linaro.org, james.clark@linaro.org, alexander.shishkin@linux.intel.com Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20241221165934.1161856-1-yeoreum.yun@arm.com> <20241221165934.1161856-2-yeoreum.yun@arm.com> From: Suzuki K Poulose In-Reply-To: <20241221165934.1161856-2-yeoreum.yun@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Levi, On 21/12/2024 16:59, Yeoreum Yun wrote: > When etm4x configuration is modified via sysfs while etm4x is being > enabled via perf, enabled etm4x could run with different configuration > from perf_event. > > To address this, disallow altering config via sysfs while csdev is enabled. > > Signed-off-by: Yeoreum Yun > --- > .../coresight/coresight-etm4x-sysfs.c | 132 +++++++++++++++++- > 1 file changed, 128 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c > index 11e865b8e824..cc1f112921d7 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c > @@ -174,6 +174,9 @@ static ssize_t reset_store(struct device *dev, > if (kstrtoul(buf, 16, &val)) > return -EINVAL; > > + if (coresight_get_mode(drvdata->csdev)) > + return -EBUSY; > + Is it not better to have separate "configs" for perf and sysfs ? And etmX driver can populate the "running" config, based on the mode specific config. That way, the configs can be updated independently without affecting the running config or the perf one. Suzuki