mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <andrea.righi@canonical.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alexei Starovoitov <ast@kernel.org>,
	linux-kernel@vger.kernel.org,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH] kernfs: convert kernfs_idr_lock to an irq safe raw spinlock
Date: Tue, 9 Jan 2024 11:51:26 -1000	[thread overview]
Message-ID: <ZZ2_3n9rJnhcYmpk@slm.duckdns.org> (raw)
In-Reply-To: <ZZ2ZdoNyBhR7o83I@slm.duckdns.org>

On Tue, Jan 09, 2024 at 09:07:34AM -1000, Tejun Heo wrote:
> On Tue, Jan 09, 2024 at 06:05:09PM +0100, Andrea Righi wrote:
> > On Tue, Jan 09, 2024 at 05:35:36PM +0100, Geert Uytterhoeven wrote:
> > > Reverting commit c312828c37a72fe2 fixes that.
> > > I have seen this issue on several Renesas arm32 and arm64 platforms.
> > > 
> > > Also, I am wondering if the issue fixed by commit c312828c37a72fe2
> > > can still be reproduced on v6.7-rc5 or later?
> > 
> > Yep, I can still reproduce it (this is with v6.7):
> ...
> > I'm wondering if using a regular spinlock instead of a raw spinlock
> > could be a reasonable compromise.
> 
> I don't think that'd work on RT as we can end up nesting mutex inside a raw
> spinlock.
> 
> > We have a GFP_ATOMIC allocation in __kernfs_new_node():
> > 
> > 	raw_spin_lock_irqsave(&kernfs_idr_lock, irqflags);
> > 	ret = idr_alloc_cyclic(&root->ino_idr, kn, 1, 0, GFP_ATOMIC);
> > 	...
> >         raw_spin_unlock_irqrestore(&kernfs_idr_lock, irqflags);
> > 
> > That should become valid using a
> > spin_lock_irqsave/spin_unlock_irqrestore(), right?
> 
> Yeah, this part should be fine. I think the right thing to do here is making
> the idr RCU safe so that lookup path doesn't depend on the lock.
> 
> Greg, can you please revert c312828c37a72fe2 for now?

I sent out a patchset to revert the commit and implement a different fix.

  http://lkml.kernel.org/r/20240109214828.252092-1-tj@kernel.org

Thanks.

-- 
tejun

      reply	other threads:[~2024-01-09 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-29  7:49 Andrea Righi
2023-12-29  9:14 ` Tejun Heo
2024-01-09 16:35 ` Geert Uytterhoeven
2024-01-09 17:05   ` Andrea Righi
2024-01-09 19:07     ` Tejun Heo
2024-01-09 21:51       ` Tejun Heo [this message]

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=ZZ2_3n9rJnhcYmpk@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=andrea.righi@canonical.com \
    --cc=ast@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@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

all inboxes | Powered by JetHome®