Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Nam Cao <namcao@linutronix.de>
Cc: sh_def@163.com, andy@kernel.org, gregkh@linuxfoundation.org,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	thomas.petazzoni@free-electrons.com, notro@tronnes.org
Subject: Re: [PATCH] staging: fbtft: make dirty_lock IRQ-safe
Date: Fri, 7 Aug 2026 16:08:26 +0300	[thread overview]
Message-ID: <anXYynas7E3oarx2@stanley.mountain> (raw)
In-Reply-To: <87pkzu852x.fsf@yellow.woof>

On Fri, Aug 07, 2026 at 02:53:26PM +0200, Nam Cao wrote:
> sh_def@163.com writes:
> > diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> > index ca0c38221c16..193643d0329d 100644
> > --- a/drivers/staging/fbtft/fbtft-core.c
> > +++ b/drivers/staging/fbtft/fbtft-core.c
> > @@ -298,14 +298,20 @@ static void fbtft_mkdirty(struct fb_info *info, int y, int height)
> >  {
> >  	struct fbtft_par *par = info->par;
> >  	struct fb_deferred_io *fbdefio = info->fbdefio;
> > +	unsigned long flags;
> >  
> >  	/* Mark display lines/area as dirty */
> > -	spin_lock(&par->dirty_lock);
> > +	/*
> > +	 * fbcon takes dirty_lock while holding console_owner. Disable local
> > +	 * interrupts here so a printk hardirq cannot acquire console_owner
> > +	 * while dirty_lock is held and create the inverse lock ordering.
> > +	 */
> 
> Beside that reason, we also need spin_lock_irqsave() because
> fbtft_mkdirty() can be called in both task context and hardirq
> context. And this reason alone suffices and usually is why
> spin_lock_irqsave() is used, so I think a comment is not necessary.
> 
> But I am fine with it either way.

AI always adds comments.  If we keep alowing obvious comments, the kernel
will turn into reading the Terms and Conditions which are impossible to
read in a single human life time.

regards,
dan carpenter


  reply	other threads:[~2026-08-07 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 17:37 [PATCH] staging: fbtft: make dirty_lock IRQ-safe sh_def
2026-08-07 12:53 ` Nam Cao
2026-08-07 13:08   ` Dan Carpenter [this message]
2026-08-07 14:37   ` Hui Su

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=anXYynas7E3oarx2@stanley.mountain \
    --to=error27@gmail.com \
    --cc=andy@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=namcao@linutronix.de \
    --cc=notro@tronnes.org \
    --cc=sh_def@163.com \
    --cc=thomas.petazzoni@free-electrons.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