[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220430143814.7184bd93@sal.lan>
Date: Sat, 30 Apr 2022 14:38:14 +0100
From: Mauro Carvalho Chehab <mchehab@...nel.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Luis Chamberlain <mcgrof@...nel.org>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Jaroslav Kysela <perex@...ex.cz>,
Kai Vehmanen <kai.vehmanen@...el.com>,
Lucas De Marchi <lucas.demarchi@...el.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...el.com>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, linux-modules@...r.kernel.org,
mauro.chehab@...ux.intel.com,
Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCH v2 1/2] module: update dependencies at try_module_get()
Em Sat, 30 Apr 2022 14:04:59 +0200
Greg KH <gregkh@...uxfoundation.org> escreveu:
> On Sat, Apr 30, 2022 at 11:30:58AM +0100, Mauro Carvalho Chehab wrote:
> Did you run checkpatch on this? Please do :)
>
> > +
> > + if (mod == this)
> > + return 0;
>
> How can this happen?
> When people mistakenly call try_module_get(THIS_MODULE)?
Yes. There are lots of place where this is happening:
$ git grep try_module_get\(THIS_MODULE|wc -l
82
> We should
> throw up a big warning when that happens anyway as that's always wrong.
>
> But that's a different issue from this change, sorry for the noise.
It sounds very weird to use try_module_get(THIS_MODULE).
We could add a WARN_ON() there - or something similar - but I would do it
on a separate patch.
>
> > +
> > + mutex_lock(&module_mutex);
> > +
> > + ret = ref_module(this, mod);
> > +
> > +#ifdef CONFIG_MODULE_UNLOAD
> > + if (ret)
> > + goto ret;
> > +
> > + ret = sysfs_create_link(mod->holders_dir,
> > + &this->mkobj.kobj, this->name);
>
> Meta comment, why do we only create links if we can unload things?
Good question. I don't know for certain. This is the already existing
pattern at add_usage_links() - see kernel/module/sysfs.c.
Also, lsmod uses sysfs links when showing dependencies.
Regards,
Mauro
Powered by blists - more mailing lists