mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Marc Zyngier <maz@kernel.org>,
	linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: Re: [PATCH] irqdomain: remove debugfs_file from struct irq_domain
Date: Thu, 18 Feb 2021 09:27:09 +0100	[thread overview]
Message-ID: <8b4de9eae773a43b38f42c8ab6d9d23c@walle.cc> (raw)
In-Reply-To: <YC4X4iLMCK3tNVsF@kroah.com>

Am 2021-02-18 08:31, schrieb Greg KH:
> On Wed, Feb 17, 2021 at 09:50:38PM +0000, Marc Zyngier wrote:
>> On Wed, 17 Feb 2021 20:10:50 +0000,
>> Michael Walle <michael@walle.cc> wrote:
>> >
>> > Am 2021-02-17 21:02, schrieb Marc Zyngier:
>> > > On 2021-02-17 19:57, Michael Walle wrote:
>> > >> Hi Greg,
>> > >>
>> > >>> There's no need to keep around a dentry pointer to a simple file that
>> > >>> debugfs itself can look up when we need to remove it from the system.
>> > >>> So simplify the code by deleting the variable and cleaning up the
>> > >>> logic
>> > >>> around the debugfs file.
>> > >>
>> > >> This will generate the following oops on my board (arm64,
>> > >> freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts). In debugfs_lookup()
>> > >> debugfs_mount is NULL.
>> > >
>> > > That's odd. I gave it a go yesterday, and nothing blew up.
>> > > Which makes me wonder whether I had the debug stuff enabled
>> > > the first place...
>> > >
>> > > I've dropped the patch from -next for now until I figure it out
>> > > (probably tomorrow).
>> >
>> > Mh, maybe its my .config, I've attached it. I also noticed that
>> > the board boots just fine in our kernel-ci [1].
>> 
>> I reproduced here. I had disabled GENERIC_IRQ_DEBUGFS for obscure
>> reasons, and it caught fire as I re-enabled it.
>> 
>> Adding this fixes it for me:
>> 
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
>> index 367ff1c35f75..d8a14cf1a7b6 100644
>> --- a/kernel/irq/irqdomain.c
>> +++ b/kernel/irq/irqdomain.c
>> @@ -1904,7 +1904,8 @@ static void debugfs_add_domain_dir(struct 
>> irq_domain *d)
>> 
>>  static void debugfs_remove_domain_dir(struct irq_domain *d)
>>  {
>> -	debugfs_remove(debugfs_lookup(d->name, domain_dir));
>> +	if (domain_dir)
>> +		debugfs_remove(debugfs_lookup(d->name, domain_dir));
>>  }
>> 
>>  void __init irq_domain_debugfs_init(struct dentry *root)
>> 
>> 
>> Could you please check whether it works for you?
> 
> Can you try this debugfs core change instead?  Callers to debugfs 
> should
> not have to do the above type of checking as debugfs should be much 
> more
> robust than that.
> 
> thanks,
> 
> greg k-h
> 
> 
> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> index 2fcf66473436..5aa798f52b6e 100644
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -297,7 +297,7 @@ struct dentry *debugfs_lookup(const char *name,
> struct dentry *parent)
>  {
>  	struct dentry *dentry;
> 
> -	if (IS_ERR(parent))
> +	if (IS_ERR_OR_NULL(name) || IS_ERR(parent))
>  		return NULL;
> 
>  	if (!parent)

This doesn't work. name is not NULL when it is called.

What has to happen before debugfs_lookup() can be called? Looks like
someone has to initialize the static debugfs_mount, first.

-michael

  reply	other threads:[~2021-02-18  9:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 14:36 Greg Kroah-Hartman
2021-02-16 15:36 ` [irqchip: irq/irqchip-next] irqdomain: Remove " irqchip-bot for Greg Kroah-Hartman
2021-02-17 19:57 ` [PATCH] irqdomain: remove " Michael Walle
2021-02-17 20:02   ` Marc Zyngier
2021-02-17 20:10     ` Michael Walle
2021-02-17 21:50       ` Marc Zyngier
2021-02-17 22:21         ` Michael Walle
2021-02-18  7:16           ` Greg KH
2021-02-18  7:31         ` Greg KH
2021-02-18  8:27           ` Michael Walle [this message]
2021-02-18  8:38             ` Greg KH
2021-02-18  8:47               ` Marc Zyngier
2021-02-18  8:54                 ` Greg KH
2021-02-18  9:04                   ` Marc Zyngier
2021-02-18  9:38                     ` Greg KH
2021-02-18 10:39                       ` Marc Zyngier
2021-02-18  8:52             ` Greg KH
2021-02-18  9:04               ` Michael Walle
2021-02-18  9:08               ` Marc Zyngier
2021-02-18  8:40   ` Greg KH
2021-02-18  8:46     ` Michael Walle
2021-02-18 11:43 ` [irqchip: irq/irqchip-next] irqdomain: Remove " irqchip-bot for Greg Kroah-Hartman
2021-03-08 20:25 ` irqchip-bot for Greg Kroah-Hartman

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=8b4de9eae773a43b38f42c8ab6d9d23c@walle.cc \
    --to=michael@walle.cc \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    /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®