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 435903AF64F for ; Mon, 6 Jul 2026 17:22:02 +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=1783358525; cv=none; b=RudL2Vfw4yQbLV2ssL9P4ZYx9AxlTflJVaCHHXeOo8V6MQEjYop0H/VuKy8UJXiy2VgrtXwwgb8e0ha/0tuu2+fBfqTUdiJ82EBZHHvbujDS1PWtaw1N9pBUFvqhuu+BzMjxBSrG9eUxmUn1n5PS00xNJ93kQ3bG7wJAsZVa+zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783358525; c=relaxed/simple; bh=nyXnpvP+SrFs+sXW8UI4Gim+ItFWKgXrvSGiRoFfJI8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oNps+QFf1xPJtbFg3UmnVeH9uFYJp+dnaRtTNLQDs+xAFbO+gBcDXvMIbvciutxNhXVslMa53Z2gHzdUFFDjNUArB0LVdB043aRjMNAMl0tJDjyuO2nLrrEf7fUEOxQ9ZTjnKpQgudpVmr8dLhTcmRHwF6VJlkeTxWWNjjF1UuM= 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=XANEA5IP; 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="XANEA5IP" 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 06E25202C; Mon, 6 Jul 2026 10:21:58 -0700 (PDT) Received: from localhost (unknown [10.2.196.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E69B33F7B4; Mon, 6 Jul 2026 10:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783358522; bh=nyXnpvP+SrFs+sXW8UI4Gim+ItFWKgXrvSGiRoFfJI8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XANEA5IPRVjLaDVcD1WSSxBvlGsiecrmqiQDqh+hiHHQjqy9QEZYkHMIgxKXYIeCV WgzbvUFNRxo9SaaZWIoVE26rJZzefTc7S1/q808i42nGkw9yM0+qsIqx0qQXDRJAMG NShlEomXFYzkpYk6u99FVSZsP2we0UH7ywNfwqhU= Date: Mon, 6 Jul 2026 18:21:59 +0100 From: Leo Yan To: Yeoreum Yun 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 v8 08/13] coresight: etm4x: fix inconsistencies with sysfs configuration Message-ID: <20260706172159.GA1024232@e132581.arm.com> References: <20260629090007.1718746-1-yeoreum.yun@arm.com> <20260629090007.1718746-9-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: <20260629090007.1718746-9-yeoreum.yun@arm.com> On Mon, Jun 29, 2026 at 10:00:01AM +0100, Yeoreum Yun wrote: [...] > @@ -619,27 +622,52 @@ 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; > + unsigned long cfg_hash; > + int preset; > > 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 */ > + /* enable any config activated by configfs */ > + cscfg_config_sysfs_get_active_cfg(&cfg_hash, &preset); > + if (cfg_hash) { > + arg->rc = cscfg_csdev_enable_active_config(csdev, > + cfg_hash, > + preset); > + if (arg->rc) > + goto err; > + } I try best to not paste any non-sense AI reviews, record one from Sashiko [1]: | If a user writes to a sysfs attribute like pe_sel_store(), it acquires | drvdata->spinlock without disabling interrupts. If an IPI is then handled | on the same CPU, etm4_enable_sysfs_smp_call() will call | cscfg_csdev_enable_active_config() which attempts to acquire the exact | same spinlock, hanging the CPU." The flow for acquiring drvdata->spinlock in SMP call is: etm4_enable_sysfs_smp_call() `> cscfg_csdev_enable_active_config() `> cscfg_csdev_enable_config() `> cscfg_prog_config() `> cscfg_set_on_enable() `> raw_spin_lock_irqsave(feat_csdev->drv_spinlock, flags); We might expect the complaint from LOCKDEP with this patch. To be clear, I am not object to this patch, just record in case we will handle it later. [1] https://sashiko.dev/#/patchset/20260629090007.1718746-1-yeoreum.yun%40arm.com