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 3F3C62D1931 for ; Thu, 16 Apr 2026 06:49:56 +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=1776322197; cv=none; b=mJNJB3UWN9a9XlmbBUk4asNJ7dnXRmWDq+TGRcL8/H70be6jZkxb6eBPtnY10YyYgYSXYYZ5gt8GdN33MrIkrPJCa0Ayw5pExr7azSBmLcEjqxxBe4+AMArL4sK/xtLWsgTdAbkLX93Zp7J1AmYzy4ck0JL5lnsa5xUnYSncMKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776322197; c=relaxed/simple; bh=WJqqPg+NgUXu080b4oFgLHWOe9dqYajMw9jaKFv6/FU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FzGuAjkciStA4DENerNH6Xx3Xc1ByTSOVdLaxbKJShYGyyYzI6yln2RDN7RcPrujBAXPzeZrOMR0FxkxntqFZVNDbxPyW6HkxUjWruVKlhI0AOmUHBH+0i3IqLoDuqimgovKuDctuzF1thGgy8fVBGBgiwpDig+pzW8MrUKK5jU= 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=RkxrBHdn; 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="RkxrBHdn" 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 EB56025E9; Wed, 15 Apr 2026 23:49:49 -0700 (PDT) Received: from e129823.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3791E3F7D8; Wed, 15 Apr 2026 23:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1776322195; bh=WJqqPg+NgUXu080b4oFgLHWOe9dqYajMw9jaKFv6/FU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RkxrBHdnhN86Y72V0m0mLjRWiTs8d7n5iptacW35T55rS1gTE4eGayrnmFCfVt3H/ w7G6aMhKDXJJGI3NRrl4Quc8WT912vpngf/weC36hQdzXhcHPNBaFXJw36PP8Mb0wl 1iVCh4HvPW/ie8OFeiNiKPlUr1ucK8HEXSskkdNg= Date: Thu, 16 Apr 2026 07:49:51 +0100 From: Yeoreum Yun To: Jie Gan Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, suzuki.poulose@arm.com, mike.leach@arm.com, james.clark@linaro.org, alexander.shishkin@linux.intel.com, leo.yan@arm.com Subject: Re: [PATCH v5 07/12] coresight: etm4x: fix inconsistencies with sysfs configuration Message-ID: References: <20260415165528.3369607-1-yeoreum.yun@arm.com> <20260415165528.3369607-8-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Jie, > > > On 4/16/2026 12:55 AM, Yeoreum Yun wrote: > > The current ETM4x configuration via sysfs can lead to > > several inconsistencies: > > > > - If the configuration is modified via sysfs while a perf session is > > active, the running configuration may differ before a sched-out and > > after a subsequent sched-in. > > > > - If a perf session and a sysfs session enable tracing concurrently, > > the configuration from configfs may become corrupted. > > > > - There is a risk of corrupting drvdata->config if a perf session enables > > tracing while cscfg_csdev_disable_active_config() is being handled in > > etm4_disable_sysfs(). > > > > To resolve these issues, separate the configuration into: > > > > - active_config: the configuration applied to the current session > > - config: the configuration set via sysfs > > > > Additionally: > > > > - Apply the configuration from configfs after taking the appropriate mode. > > > > - Since active_config and related fields are accessed only by the local CPU > > in etm4_enable/disable_sysfs_smp_call() (similar to perf enable/disable), > > remove the lock/unlock from the sysfs enable/disable path and > > startup/dying_cpu except when to access config fields. > > > > Signed-off-by: Yeoreum Yun > > --- > > <...> > > > @@ -618,23 +624,45 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) > > static void etm4_enable_sysfs_smp_call(void *info) > > { > > struct etm4_enable_arg *arg = info; > > + struct etmv4_drvdata *drvdata; > > struct coresight_device *csdev; > > if (WARN_ON(!arg)) > > return; > > - csdev = arg->drvdata->csdev; > > + drvdata = arg->drvdata; > > + csdev = drvdata->csdev; > > if (!coresight_take_mode(csdev, CS_MODE_SYSFS)) { > > /* Someone is already using the tracer */ > > arg->rc = -EBUSY; > > return; > > } > > - arg->rc = etm4_enable_hw(arg->drvdata); > > + drvdata->active_config = arg->config; > > - /* The tracer didn't start */ > > + if (arg->cfg_hash) { > > + arg->rc = cscfg_csdev_enable_active_config(csdev, > > + arg->cfg_hash, > > + arg->preset); > > + if (arg->rc) > > + goto err; > > + } > > + > > + drvdata->trcid = arg->trace_id; > > + > > + /* Tracer will never be paused in sysfs mode */ > > + drvdata->paused = false; > > + > > + arg->rc = etm4_enable_hw(drvdata); > > if (arg->rc) > > - coresight_set_mode(csdev, CS_MODE_DISABLED); > > needs disable the active config in error path: > cscfg_csdev_disable_active_config(drvdata->csdev); You're right. I missed it. Thanks! [...] -- Sincerely, Yeoreum Yun