From: Krzysztof Kozlowski <krzk@kernel.org>
To: Abel Vesa <abel.vesa@linaro.org>, Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konradybcio@kernel.org>,
Caleb Connolly <caleb.connolly@linaro.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Johan Hovold <johan@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH RFC] soc: qcom: pmic_glink: Fix device access from worker during suspend
Date: Thu, 30 Jan 2025 16:53:36 +0100 [thread overview]
Message-ID: <59cbde54-e1df-4e92-9291-5546118dd2ca@kernel.org> (raw)
In-Reply-To: <Z5nq3Y7YOyxwqcmg@linaro.org>
On 29/01/2025 09:46, Abel Vesa wrote:
>>
>>> 1. Maybe the driver just lacks proper suspend/resume handling?
>>> I assume all this happens during system suspend, so what certainty you
>>> have that your second work - pmic_glink_altmode_pdr_notify() - is not
>>> executed as well?
>>>
>>> 2. Follow up: all other drivers and all other future use cases will be
>>> affected as well. Basically what this patch is admitting is that driver
>>> can be executed anytime, even during suspend, so each call of
>>> pmic_glink_send() has to be audited. Now and in the future, because what
>>> stops some developer of adding one more path calling pmic_glink_send(),
>>> which also turns out to be executed during suspend?
>>>
>>> 3. So qcom_battmgr.c is buggy as well?
>>>
>>> 4. ucsi_glink.c? I don't see handling suspend, either...
>>>
>>> Maybe the entire problem is how pmic glink was designed: not as proper
>>> bus driver which handles both child-parent relationship and system suspend.
>>
>> The underlying problem is that GLINK register its interrupt as
>> IRQF_NO_SUSPEND (for historical reasons) and as such incoming messages
>> will be delivered in late suspend and early resume. In this specific
>> case, a specific message is handled by pmic_glink_altmode_callback(), by
>> invoking schedule_work() which in this case happens to schedule
>> pmic_glink_altmode_worker before we've resumed the I2C controller.
>>
>> I presume with your suggestion about a pmic_glink bus driver we'd come
>> up with some mechanism for pmic_glink to defer these messages until
>> resume has happened?
>
> So is the suggestion here to rework the entire pmic_glink into a bus
> driver? (I like the sound of that)
>
> I'd assume the new bus driver will have to queue the messages until it
> has resumed, which is fine.
Queue or just disable interrupts/notifications to clients.
>
> But still doesn't solve the fact that we can't filter out when to
> wake-up or not. What am I missing here?
I think this was not the concern in my email. I was only wondering about
the design flaw that we allow pmic glink to send notifications to
children anytime. And that's not how the bus-like driver should be written.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-01-30 15:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 15:29 [PATCH RFC] soc: qcom: pmic_glink: Fix device access from worker during suspend Abel Vesa
2025-01-10 16:11 ` Caleb Connolly
2025-01-11 15:35 ` Krzysztof Kozlowski
2025-01-11 19:22 ` Bjorn Andersson
2025-01-12 18:19 ` Krzysztof Kozlowski
2025-01-29 8:46 ` Abel Vesa
2025-01-30 15:53 ` Krzysztof Kozlowski [this message]
2025-02-07 14:28 ` Caleb Connolly
2025-01-13 12:16 ` Johan Hovold
2025-01-29 8:29 ` Abel Vesa
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=59cbde54-e1df-4e92-9291-5546118dd2ca@kernel.org \
--to=krzk@kernel.org \
--cc=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=johan@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=stable@vger.kernel.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