From: Michal Hocko <mhocko@suse.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] module: print module name on refcount error
Date: Wed, 28 Jun 2023 12:30:35 +0200 [thread overview]
Message-ID: <ZJwLy5anSgFzbTUP@dhcp22.suse.cz> (raw)
In-Reply-To: <20230626123252.73dbc139@endymion.delvare>
On Mon 26-06-23 12:32:52, Jean Delvare wrote:
> If module_put() triggers a refcount error, include the culprit
> module name in the warning message, to easy further investigation of
> the issue.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Suggested-by: Michal Hocko <mhocko@suse.com>
> Cc: Luis Chamberlain <mcgrof@kernel.org>
> ---
> kernel/module/main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> --- linux-6.3.orig/kernel/module/main.c
> +++ linux-6.3/kernel/module/main.c
> @@ -850,7 +850,9 @@ void module_put(struct module *module)
> if (module) {
> preempt_disable();
> ret = atomic_dec_if_positive(&module->refcnt);
> - WARN_ON(ret < 0); /* Failed to put refcount */
> + WARN(ret < 0,
> + KERN_WARNING "Failed to put refcount for module %s\n",
> + module->name);
Would it make sense to also print the refcnt here? In our internal bug
report it has turned out that this was an overflow (put missing) rather
than an underflow (too many put calls). Seeing the value could give a
clue about that. We had to configure panic_on_warn to capture a dump to
learn more which is rather impractical.
Other than that the module information on its own is an improvement
because one knows where to start looking or to reduce the tracing data
collected.
In any case
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
> trace_module_put(module, _RET_IP_);
> preempt_enable();
> }
>
>
> --
> Jean Delvare
> SUSE L3 Support
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2023-06-28 10:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 10:32 [PATCH] module: print module name on refcount error Jean Delvare
2023-06-28 10:30 ` Michal Hocko [this message]
2023-07-04 12:43 ` Jean Delvare
2023-07-04 13:05 ` Michal Hocko
2023-07-04 14:35 ` Jean Delvare
2023-06-30 23:05 ` Luis Chamberlain
2023-07-01 15:57 ` Jean Delvare
2023-07-03 10:45 ` Jean Delvare
2023-07-03 13:47 ` Michal Hocko
2023-07-07 18:56 ` Luis Chamberlain
2023-07-10 5:43 ` Michal Hocko
2023-07-26 20:59 ` Luis Chamberlain
2023-08-28 12:18 ` Jean Delvare
2023-09-14 19:39 ` Michal Hocko
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=ZJwLy5anSgFzbTUP@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@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;
as well as URLs for NNTP newsgroup(s).