mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sibi Sankar <quic_sibis@quicinc.com>
To: Bjorn Andersson <andersson@kernel.org>
Cc: <konrad.dybcio@linaro.org>, <djakov@kernel.org>,
	<robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<srinivas.kandagatla@linaro.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <quic_rgottimu@quicinc.com>,
	<quic_kshivnan@quicinc.com>, <conor+dt@kernel.org>,
	<dmitry.baryshkov@linaro.org>, <abel.vesa@linaro.org>
Subject: Re: [PATCH V2 2/3] soc: qcom: icc-bwmon: Allow for interrupts to be shared across instances
Date: Mon, 24 Jun 2024 14:26:52 +0530	[thread overview]
Message-ID: <75ed1065-d123-9193-7017-cce12889130b@quicinc.com> (raw)
In-Reply-To: <vjes4lm3um44f6oguvrq3gozemquzmmmicj47ieczwfuqkmaqp@aby3dj6ttdig>



On 6/21/24 11:15, Bjorn Andersson wrote:
> On Tue, Jun 18, 2024 at 09:13:05PM GMT, Sibi Sankar wrote:
>> The multiple BWMONv4 instances available on the X1E80100 SoC use the
>> same interrupt number. Mark them are shared to allow for re-use across
>> instances. Handle the ensuing race introduced by relying on bwmon_disable
> 
> In an effort to educate the reader, could you please describe what the
> race condition is here.
> 
> It would also make sense to break this ("Handle...") into a separate
> paragraph.

Ack, will make the changes in the next re-spin.

-Sibi

> 
> Regards,
> Bjorn
> 
>> to disable the interrupt and coupled with explicit request/free irqs.
>>
>> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
>> ---
>>
>> v2:
>> * Use explicit request/free irq and add comments regarding the race
>>    introduced when adding the IRQF_SHARED flag. [Krzysztof/Dmitry]
>>
>>   drivers/soc/qcom/icc-bwmon.c | 14 +++++++++++---
>>   1 file changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
>> index fb323b3364db..4a4e28b41509 100644
>> --- a/drivers/soc/qcom/icc-bwmon.c
>> +++ b/drivers/soc/qcom/icc-bwmon.c
>> @@ -781,9 +781,10 @@ static int bwmon_probe(struct platform_device *pdev)
>>   	bwmon->dev = dev;
>>   
>>   	bwmon_disable(bwmon);
>> -	ret = devm_request_threaded_irq(dev, bwmon->irq, bwmon_intr,
>> -					bwmon_intr_thread,
>> -					IRQF_ONESHOT, dev_name(dev), bwmon);
>> +
>> +	/* SoCs with multiple cpu-bwmon instances can end up using a shared interrupt line */
>> +	ret = request_threaded_irq(bwmon->irq, bwmon_intr, bwmon_intr_thread,
>> +				   IRQF_ONESHOT | IRQF_SHARED, dev_name(dev), bwmon);
>>   	if (ret)
>>   		return dev_err_probe(dev, ret, "failed to request IRQ\n");
>>   
>> @@ -798,6 +799,13 @@ static void bwmon_remove(struct platform_device *pdev)
>>   	struct icc_bwmon *bwmon = platform_get_drvdata(pdev);
>>   
>>   	bwmon_disable(bwmon);
>> +
>> +	/*
>> +	 * Handle the race introduced, when dealing with multiple bwmon instances
>> +	 * using a shared interrupt line, by relying on bwmon_disable to disable
>> +	 * the interrupt and followed by an explicit free.
>> +	 */
>> +	free_irq(bwmon->irq, bwmon);
>>   }
>>   
>>   static const struct icc_bwmon_data msm8998_bwmon_data = {
>> -- 
>> 2.34.1
>>

  reply	other threads:[~2024-06-24  8:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 15:43 [PATCH V2 0/3] arm64: dts: qcom: x1e80100: Enable bwmon support Sibi Sankar
2024-06-18 15:43 ` [PATCH V2 1/3] dt-bindings: interconnect: qcom,msm8998-bwmon: Add X1E80100 BWMON instances Sibi Sankar
2024-06-18 16:02   ` Konrad Dybcio
2024-06-21  6:44     ` Krzysztof Kozlowski
2024-06-24  8:58       ` Sibi Sankar
2024-06-18 15:43 ` [PATCH V2 2/3] soc: qcom: icc-bwmon: Allow for interrupts to be shared across instances Sibi Sankar
2024-06-18 18:55   ` Dmitry Baryshkov
2024-06-24  8:58     ` Sibi Sankar
2024-06-21  5:45   ` Bjorn Andersson
2024-06-24  8:56     ` Sibi Sankar [this message]
2024-06-18 15:43 ` [PATCH V2 3/3] arm64: dts: qcom: x1e80100: Add BWMONs Sibi Sankar
2024-06-18 19:33   ` Konrad Dybcio
2024-06-24  8:55     ` Sibi Sankar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75ed1065-d123-9193-7017-cce12889130b@quicinc.com \
    --to=quic_sibis@quicinc.com \
    --cc=abel.vesa@linaro.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djakov@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=quic_kshivnan@quicinc.com \
    --cc=quic_rgottimu@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®