mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH] scripts/kernel-doc: drop "_noprof" on function prototypes
Date: Thu, 5 Jun 2025 20:07:40 +0100	[thread overview]
Message-ID: <aEHq_Jy3hPQIzaO-@casper.infradead.org> (raw)
In-Reply-To: <20240326054149.2121-1-rdunlap@infradead.org>

On Mon, Mar 25, 2024 at 10:41:49PM -0700, Randy Dunlap wrote:
> Memory profiling introduces macros as hooks for function-level
> allocation profiling[1]. Memory allocation functions that are profiled
> are named like xyz_alloc() for API access to the function. xyz_alloc()
> then calls xyz_alloc_noprof() to do the allocation work.
> 
> The kernel-doc comments for the memory allocation functions are
> introduced with the xyz_alloc() function names but the function
> implementations are the xyz_alloc_noprof() names.
> This causes kernel-doc warnings for mismatched documentation and
> function prototype names.
> By dropping the "_noprof" part of the function name, the kernel-doc
> function name matches the function prototype name, so the warnings
> are resolved.

This turns out not to be enough.  For example, krealloc() is
currently undocumented.  This is because we match the function name
in EXPORT_SYMBOL() against the function name in the comment, and they
don't match.  This patch restores the documentation, although only
for the python version of kernel-doc, and I'm pretty sure there's a
better way to do it (eg building it into the export_symbol* regexes).
I can turn this into a proper patch if this is the way to go, but for
now it's just to illustrate the problem.

diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index 062453eefc7a..bdfa698d5570 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -1176,11 +1176,15 @@ class KernelDoc:

         if export_symbol.search(line):
             symbol = export_symbol.group(2)
+            # See alloc_tags.h
+            symbol = symbol.removesuffix('_noprof')
             function_set.add(symbol)
             return

         if export_symbol_ns.search(line):
             symbol = export_symbol_ns.group(2)
+            # See alloc_tags.h
+            symbol = symbol.removesuffix('_noprof')
             function_set.add(symbol)

     def process_normal(self, ln, line):


  parent reply	other threads:[~2025-06-05 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  5:41 Randy Dunlap
2024-03-26 20:35 ` Suren Baghdasaryan
2025-06-05 19:07 ` Matthew Wilcox [this message]
2025-06-05 19:18   ` Jonathan Corbet
2025-06-05 19:31     ` Matthew Wilcox
2025-06-05 19:52       ` Jonathan Corbet
2025-06-05 22:50       ` Mauro Carvalho Chehab
2025-06-05 23:28     ` Mauro Carvalho Chehab

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=aEHq_Jy3hPQIzaO-@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=surenb@google.com \
    /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®