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 62AE130E82D for ; Wed, 15 Apr 2026 07:29:36 +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=1776238179; cv=none; b=jb5IYwdzxNzn6Xl2MLDCyo7hihion2cdnfGqfV7y43B/svZiDF+RppnyPD/J1IqLDkxlpcw/F6WRMjbya6AAcTqKO3aO5nrwAuLT/SFCr2EikY754TgZM1TDPqgjV75IWWP2EtqueTqVmIG5cToVDUcp7Ftb5qZjbKfM5a2ibjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776238179; c=relaxed/simple; bh=/31K8foPrl7GUrN8NgKXk6NjRxdK25IVX3atfBtVP0o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nweHel4SSIFKPSsPhplGLE8PcKcU5vAHlf0UnW/8mcJjvzmfnwrkfup641sHspbTT1nNIFWPNLL+tp/St89Stnb5hB/ggnjsFKnB01qYDlBFIKbz44fjx9ZCzBZgSPf1XwweaqXhNorCnGamHCR+oG1pqqj/XLeUOX6SOlV+RHg= 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=oshJfZRg; 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="oshJfZRg" 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 AE34049BF; Wed, 15 Apr 2026 00:29:29 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ED9E33F641; Wed, 15 Apr 2026 00:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1776238175; bh=/31K8foPrl7GUrN8NgKXk6NjRxdK25IVX3atfBtVP0o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oshJfZRgOXDeIzS6DFBD9S9fhQ2SZ6ghoH+F46oxZHHYLJytvMcRVsNYRaCSXKtEe BV5NPsEVsqGCtW7gwpDPCH4hot31UgVdnj7t+n/5JR95EAxFKPjODamGDxf48nKi3J NZb2dckTU43ASUuDmFuvk2LZBGNuXqv/PJf+yi9g= Date: Wed, 15 Apr 2026 08:29:33 +0100 From: Leo Yan To: Jie Gan Cc: Yeoreum Yun , 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 Subject: Re: [PATCH v4 3/9] coresight: etm4x: fix leaked trace id Message-ID: <20260415072933.GH356832@e132581.arm.com> References: <20260413142003.3549310-1-yeoreum.yun@arm.com> <20260413142003.3549310-4-yeoreum.yun@arm.com> <20260414163221.GG356832@e132581.arm.com> <81fdef8a-a60e-4d29-948d-c4a07e23dad9@oss.qualcomm.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: <81fdef8a-a60e-4d29-948d-c4a07e23dad9@oss.qualcomm.com> On Wed, Apr 15, 2026 at 09:21:21AM +0800, Jie Gan wrote: [...] > > > > @@ -918,8 +918,10 @@ static int etm4_enable_sysfs(struct coresight_device *csdev, struct coresight_pa > > > > cscfg_config_sysfs_get_active_cfg(&cfg_hash, &preset); > > > > if (cfg_hash) { > > > > ret = cscfg_csdev_enable_active_config(csdev, cfg_hash, preset); > > > > - if (ret) > > > > + if (ret) { > > > > + etm4_release_trace_id(drvdata); > > > > > > If so, even an ID is reserved for failures, and the ID map is big enough > > > for each CPU, we don't need to worry memory leak or ID used out issue ? > > > > However, in theory, this could lead to an ID leak, > > so it would be better to release it in error cases. > > What I am thinking is as SoCs continue to grow more complex with an > increasing number of subsystems, trace IDs may be exhausted in the near > future. (that's why we have dynamic trace ID allocation/release). Thanks for the input. I am wandering if we can use "dev->devt" as the trace ID. A device's major/minor number is unique in kernel and dev_t is defined as u32: typedef u32 __kernel_dev_t; And we can consolidate this for both SYSFS and PERF modes. Thanks, Leo