All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH] scsi: ufs: core: Avoid sleeping in hard interrupt context when PREEMP_RT is enabled.
Date: Tue, 30 Jun 2026 12:28:21 +0200	[thread overview]
Message-ID: <878q7wb9ve.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <20260630102343.728131F000E9@smtp.kernel.org>

Hello,

> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] The static function `ufshcd_intr` becomes unused when `CONFIG_PREEMPT_RT` is enabled, causing a compiler warning.
> - [Low] Typo in the newly added source code comment.

Both of Sachiko's comments are valid. I am addressing these issues in
the next version.

Gregory

> --
>
> commit 6afdc0b243918ce89eb55cea6349f608516d9d03
> Author: Gregory CLEMENT <gregory.clement@bootlin.com>
>
> scsi: ufs: core: Avoid sleeping in hard interrupt context when PREEMP_RT is enabled.
>
> This commit addresses a sleeping-in-hard-irq context bug under PREEMPT_RT. 
> It mitigates the issue by bypassing the hard IRQ handler and directly 
> registering the threaded interrupt handler when PREEMPT_RT is enabled.
>
>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>> index d3044a3089b53..6d82658a1a66b 100644
>> --- a/drivers/ufs/core/ufshcd.c
>> +++ b/drivers/ufs/core/ufshcd.c
>> @@ -11235,9 +11235,17 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
>>  	 */
>>  	ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
>>  
>> -	/* IRQ registration */
>> +	/* IRQ registration
>> +	 * In the case of PREMMP_RT, directly use the threaded
>
> [Severity: Low]
> This isn't a bug, but there is a typo in this comment ("PREMMP_RT" instead
> of "PREEMPT_RT"). The commit subject also has a small typo ("PREEMP_RT").
>
>> +	 * interrupt to avoid using a spinlock (which could sleep)
>> +	 * in the hard IRQ handler.
>> +	 */
>> +#ifdef CONFIG_PREEMPT_RT
>> +	err = devm_request_irq(dev, irq, ufshcd_threaded_intr, IRQF_SHARED, UFSHCD, hba);
>> +#else
>>  	err = devm_request_threaded_irq(dev, irq, ufshcd_intr, ufshcd_threaded_intr,
>>  					IRQF_ONESHOT | IRQF_SHARED, UFSHCD, hba);
>> +#endif
>
> [Severity: Low]
> Will this cause a compiler warning for an unused function when building with
> CONFIG_PREEMPT_RT=y? 
>
> Because the reference to ufshcd_intr() is compiled out in the #else block, 
> but its static definition remains unconditionally compiled earlier in the 
> file:
>
> static irqreturn_t ufshcd_intr(int irq, void *__hba)
> {
>     ...
> }
>
> Could this break builds that have CONFIG_WERROR=y enabled due to the 
> -Wunused-function warning?
>
>>  	if (err) {
>>  		dev_err(hba->dev, "request irq failed\n");
>>  		goto out_disable;
>
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260630-ufshcd-spinlock-sleep-fix-v1-1-339b05a1c6f4@bootlin.com?part=1

-- 
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2026-06-30 10:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  9:55 [PATCH] scsi: ufs: core: Avoid sleeping in hard interrupt context when PREEMP_RT is enabled Gregory CLEMENT
2026-06-30 10:23 ` sashiko-bot
2026-06-30 10:28   ` Gregory CLEMENT [this message]
2026-06-30 14:15 ` Sebastian Andrzej Siewior
2026-07-06 14:30   ` Bart Van Assche
2026-07-06 15:20     ` Sebastian Andrzej Siewior

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=878q7wb9ve.fsf@BLaptop.bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.