All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,jim.cromie@gmail.com,jbaron@akamai.com,yuntao.wang@linux.dev,akpm@linux-foundation.org
Subject: + dyndbg-fix-incorrect-mod_ct-value-in-dynamic_debug_init.patch added to mm-nonmm-unstable branch
Date: Mon, 31 Aug 2026 20:47:48 -0700	[thread overview]
Message-ID: <20260901034749.5E00E1F000E9@smtp.kernel.org> (raw)


The patch titled
     Subject: dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     dyndbg-fix-incorrect-mod_ct-value-in-dynamic_debug_init.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/dyndbg-fix-incorrect-mod_ct-value-in-dynamic_debug_init.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Yuntao Wang <yuntao.wang@linux.dev>
Subject: dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
Date: Tue, 11 Aug 2026 20:18:30 +0800

Patch series "dyndbg: fix incorrect mod_ct value in dynamic_debug_init()".

Fix and clean up dynamic_debug_init().


This patch (of 2):

Suppose all `struct _ddebug` instances belong to the same module, mod_ct
should be 1, but it is currently 0.

mod_ct is incremented only when iter->modname changes, i.e.  when the loop
encounters the first _ddebug entry of a new module:

if (strcmp(modname, iter->modname)) {
	mod_ct++;
	...
}

If all _ddebug entries belong to the same module, strcmp() never returns
nonzero, so mod_ct remains 0.

However, the last (and in this case only) module is added after the loop:

di.num_descs = mod_sites;
di.descs = iter_mod_start;
ret = ddebug_add_module(&di, modname);

Thus, mod_ct should be incremented before adding this final module.

The bug only affects the diagnostic message printed by vpr_info():

"%d prdebugs in %d modules, ..."

It reports one fewer module than the actual number of modules.  There is
no userspace-visible runtime effect; the dynamic debug tables themselves
are initialized correctly.

Fix it.
		
Link: https://lore.kernel.org/20260811121831.577848-1-yuntao.wang@linux.dev
Link: https://lore.kernel.org/20260811121831.577848-2-yuntao.wang@linux.dev
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/dynamic_debug.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/lib/dynamic_debug.c~dyndbg-fix-incorrect-mod_ct-value-in-dynamic_debug_init
+++ a/lib/dynamic_debug.c
@@ -1456,6 +1456,8 @@ static int __init dynamic_debug_init(voi
 			iter_mod_start = iter;
 		}
 	}
+
+	mod_ct++;
 	di.num_descs = mod_sites;
 	di.descs = iter_mod_start;
 	ret = ddebug_add_module(&di, modname);
_

Patches currently in -mm which might be from yuntao.wang@linux.dev are

dyndbg-fix-incorrect-mod_ct-value-in-dynamic_debug_init.patch
dyndbg-clean-up-dynamic_debug_init-to-improve-readability.patch


                 reply	other threads:[~2026-09-01  3:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260901034749.5E00E1F000E9@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=jbaron@akamai.com \
    --cc=jim.cromie@gmail.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=yuntao.wang@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.