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 7E9403D6CD9 for ; Tue, 21 Apr 2026 14:02:18 +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=1776780141; cv=none; b=iZg2y9ExKx1L4xI4s30F1gfYcep/MXMaxAhpQvdeP2FIX5Qkq6SJXWtWRrdRVVoRHv8aK2ShAEEG3c547TBUPSvw5Ml+nnv7KkhJipzmivMJuACflG/n7z2Xf9UxQHcQc/CZjbWJ7qPDxI1RsKUryRKxo9KFPm7E7ctlmfZKsEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776780141; c=relaxed/simple; bh=UxOuyvqjssBcp1emTpPrTkHhq/tnIYeB21ckVfqA9hY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ASLO8ssVjhU70Yfqy7jYWAi2ntMr07t6wTligBnK471Oeenlm1JMHh0JmbezQEG4Ab3z+ACSyU2ea/1ugEHGNwBoCMqYiu8VaL7ITQSUqCY+2UxbWUvpDaOT4/HnLTy2RhgafE4Q+y0PgDRtK5WrX/kV9cIDkqQf9wdWNdvqJlI= 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=gv7m+V87; 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="gv7m+V87" 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 0E4A22573; Tue, 21 Apr 2026 07:02:12 -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 758C73F7B4; Tue, 21 Apr 2026 07:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1776780137; bh=UxOuyvqjssBcp1emTpPrTkHhq/tnIYeB21ckVfqA9hY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gv7m+V87Vw0axaDcNsT9EZElZp2PBUxga27N8/nnNqzlCNW4IZK9QEz2a29vFu7ou xsZQMCUxflZ0lvKvNzncI1yPY7NWujZL8/rB4pZsLnQbHwhSB/E40KsBZRoYaDAVlu 0JCwe9MNpUyz0IIl07CzuHfVM+Zdkw+sekHM6a9A= Date: Tue, 21 Apr 2026 15:02:14 +0100 From: Yeoreum Yun To: Leo Yan 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, jie.gan@oss.qualcomm.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> <20260421104601.GB929984@e132581.arm.com> <20260421132842.GC929984@e132581.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: <20260421132842.GC929984@e132581.arm.com> Hi Leo, > On Tue, Apr 21, 2026 at 12:14:20PM +0100, Yeoreum Yun wrote: > > [...] > > > > > - 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(). > > > > > > Similiar to above, cscfg_csdev_disable_active_config() is not > > > protected in etm4_disable_sysfs(). > > > > This is not true. > > at the time of etm4_disable_sysfs() "mode" is already taken > > (whether sysfs or perf). In this situation, it's enough to > > call cscfg_csdev_disable_active_config() before chaning > > mode to DISABLED. > > To be clear, I am trying to understand issue _before_ your patch. > Without this patch, cscfg_csdev_disable_active_config() is not > protected by the mode. Right. [...] > > > > @@ -1386,6 +1401,7 @@ static void etm4_init_arch_data(void *info) > > > > drvdata = dev_get_drvdata(init_arg->dev); > > > > caps = &drvdata->caps; > > > > csa = init_arg->csa; > > > > + config = &drvdata->active_config; > > > > > > Should we init drvdata->config instead so make it has sane values ? > > > > > > In other words, drvdata->active_config are always set at the runtime, > > > so don't need to init it at all, right? > > > > No. at least when the initialise, I think we should fill the its > > contesnt with the "etm4_set_default()". > > > > That's why the consequence call etm4_set_default() called with > > active_config and config is coped with the default configutation. > > I'm concerned that some config fields may be reused across sessions. > For example, a sysfs session copies drvdata->config into > drvdata->active_config, and later a perf session may reuse stale > values. The same issue can happen in the reverse direction. > > A clean approach would be to treat drvdata->active_config as > per-session state: > > 1) clear drvdata->active_config at session start > 2) apply the session-specific config > 2.1) sysfs: use drvdata->config > 2.2) perf: use event config > 3) then apply configfs configuration This is not true. In case of "perf", it always clear the "active_config" with 0x00 before enable. so it wouldn't. In case of sysfs we don't need to worries about since "config" field saves everything and this is applied into active_config. So, your issue doesn't exist in this case. -- Sincerely, Yeoreum Yun