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 79C5D126C17 for ; Mon, 3 Aug 2026 05:03:07 +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=1785733389; cv=none; b=d4i/tKqNO7c2M2ac8zpp+Vh+YehbafiFPurtjfz31OCWZ+KOpVDJTxLZv9DzXGhMQQYAhLnn7hmM/D62I2hp3SwG4rMiJ3QI/pJULtfuqL65EQy9mBaTzDia85gelXUnzIUOEWaAAMUZ1eZDeFj1Bq4+zdpMgIFU2yFbF3AGmiU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785733389; c=relaxed/simple; bh=EH7byNKzgNBankd/CewcyJGIj4zEnYsFXr8Nka0IbeI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SVcoTGpzaFqcY67wkNvB5zEHmwToz01wGW3Q+aSgNt1tYvghKlx3Ol6KulaXi8U3zFMXU6BDvHTBR8t7EfNFxu9LFXRELEdZJQ2HtwYR4EZinEWeLePqUgS9gaNHP/WxNZBTsY/EJQ9YcjG5ELvrBmvS0e7TqILocEAiTIKx7iQ= 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=twtQtWHk; 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="twtQtWHk" 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 468F4143D; Sun, 2 Aug 2026 22:03:02 -0700 (PDT) Received: from [10.163.134.188] (unknown [10.163.134.188]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8A1503F66F; Sun, 2 Aug 2026 22:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785733386; bh=EH7byNKzgNBankd/CewcyJGIj4zEnYsFXr8Nka0IbeI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=twtQtWHkyIAyjW2PstTWuwZ5OxyKqsu+1MQ0QjDPYrN+xFERrSiwJ2sZFJeJf1qbI eK98edooVdunBSnHByK8KElgW3X7MzSV7Btj9ZiBqPQbGlH+k1a2C5cY79vy6HPODf l1r9mJrJZTKBqgnh0x6jZ1wZge+OvlCFVuZ9ddew= Message-ID: <43e0e681-dbd6-4f1a-9fe1-520dba58ffd9@arm.com> Date: Mon, 3 Aug 2026 10:32:59 +0530 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 v1] coresight: Check runtime PM resume result To: Yuho Choi , suzuki.poulose@arm.com Cc: mike.leach@arm.com, james.clark@linaro.org, leo.yan@arm.com, alexander.shishkin@linux.intel.com, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260802232552.593435-1-dbgh9129@gmail.com> Content-Language: en-US From: Anshuman Khandual In-Reply-To: <20260802232552.593435-1-dbgh9129@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 03/08/26 4:55 AM, Yuho Choi wrote: > coresight_get_ref() ignores the return value of pm_runtime_get_sync() > and reports success even when runtime resume fails. A path is then built > and the CoreSight device may be accessed while it remains powered off. > > Use pm_runtime_resume_and_get() so a failed resume is reported and its > runtime PM usage reference is rolled back. Drop the module and device > references acquired before the resume attempt when it fails. > > Fixes: 5da5325fa856 ("coresight: moving PM runtime operations to core framework") > Signed-off-by: Yuho Choi > --- Should 'Fixes:' be tagging the following commit - which had introduced coresight_get_ref() unconditionally calling pm_runtime_get_sync() ? 32b0707a4182 ("coresight: Add try_get_module() in coresight_grab_device()") > drivers/hwtracing/coresight/coresight-core.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c > index 6d65c43d574f..77d05b360484 100644 > --- a/drivers/hwtracing/coresight/coresight-core.c > +++ b/drivers/hwtracing/coresight/coresight-core.c > @@ -843,7 +843,11 @@ static bool coresight_get_ref(struct coresight_device *csdev) > goto err_module; > > /* Make sure the device is powered on */ > - pm_runtime_get_sync(parent); > + if (pm_runtime_resume_and_get(parent) < 0) { > + module_put(drv->owner); > + goto err_module; > + } > + > return true; > > err_module: