mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
To: Johan Hovold <johan@kernel.org>
Cc: Maximilian Luz <luzmaximilian@gmail.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for sparse
Date: Mon, 16 Feb 2026 09:14:13 +0100	[thread overview]
Message-ID: <dfb72ee5-0576-4b9d-b109-e763273cf39f@oss.qualcomm.com> (raw)
In-Reply-To: <aZLOo3tMAWhXhdkR@hovoldconsulting.com>

On 16/02/2026 09:00, Johan Hovold wrote:
> On Sun, Feb 15, 2026 at 12:05:50PM +0100, Krzysztof Kozlowski wrote:
>> qcuefi_acquire() and qcuefi_release() end with mutex locked or unlocked
>> respectively, so annotate them so the lock usage will be tracked by
>> sparse.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>> ---
>>  drivers/firmware/qcom/qcom_qseecom_uefisecapp.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>> index 21be447374aa..befa68d1dcaf 100644
>> --- a/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>> +++ b/drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
>> @@ -710,6 +710,7 @@ static int qcuefi_set_reference(struct qcuefi_client *qcuefi)
>>  }
>>  
>>  static struct qcuefi_client *qcuefi_acquire(void)
>> +	__acquires(__qcuefi_lock)
>>  {
>>  	mutex_lock(&__qcuefi_lock);
>>  	if (!__qcuefi) {
>> @@ -720,6 +721,7 @@ static struct qcuefi_client *qcuefi_acquire(void)
>>  }
>>  
>>  static void qcuefi_release(void)
>> +	__releases(__qcuefi_lock)
>>  {
>>  	mutex_unlock(&__qcuefi_lock);
>>  }
> 
> The mutex implementation does not use sparse annotation so this actually
> introduces sparse warnings (unless something changed very recently).
> 
> See 
> 	
> 	https://lore.kernel.org/all/ZJ11H8btBhvCx9gD@hovoldconsulting.com/
> 
> for what his looks like for the code in question.
> 

I checked with sparse and there were no warnings. More importantly,
mutex uses __acquires, so this apparently changed:

https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mutex.h#n214

Also clang v22 has context tracking, which I should probably mention as
well, and it supports mutex:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/dev-tools/context-analysis.rst

(this I could not test, too old LLVM, I need to set up containerized builds)

Best regards,
Krzysztof

  reply	other threads:[~2026-02-16  8:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-15 11:05 [PATCH 1/3] firmware: qcom: uefisecapp: Simplify mutex with guard Krzysztof Kozlowski
2026-02-15 11:05 ` [PATCH 2/3] firmware: qcom: uefisecapp: Annotate acquiring locks for sparse Krzysztof Kozlowski
2026-02-16  8:00   ` Johan Hovold
2026-02-16  8:14     ` Krzysztof Kozlowski [this message]
2026-02-16  8:20       ` Johan Hovold
2026-02-16  8:27         ` Krzysztof Kozlowski
2026-02-15 11:05 ` [PATCH 3/3] firmware: qcom: scom: Simplify mutex with guard Krzysztof Kozlowski

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=dfb72ee5-0576-4b9d-b109-e763273cf39f@oss.qualcomm.com \
    --to=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=johan@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    /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®