public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Hahn <phahn-oss@avm.de>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Nicolas Schier <nicolas.schier@linux.dev>,
	linux-kernel@vger.kernel.org
Subject: Re: genksyms vs. opaque struct *
Date: Mon, 19 Jan 2026 14:48:21 +0100	[thread overview]
Message-ID: <aW42JVMOkT_2maZ7@mail-auth.avm.de> (raw)
In-Reply-To: <aRZCKwLVdpE_XjtA@mail-auth.avm.de>

Hello,

to answer my own question from last year:

Am Thu, Nov 13, 2025 at 09:40:15PM +0100 schrieb Philipp Hahn:
> while building a Linux kernel module I stumbled over an issue with 'genksyms': Basically my modules uses an "opaque struct" and only gets a pointer to such an object. The header file declaring that struct did *not* #include all needed header files recursively, so some types remained unresolved.
> For compiling the module this was not an issue as the compiler only needs to allocate space for an pointer to that nested struct and does not need more details.
> Another module exists which uses that symbol and recorded the calculated CRC.
>
> Then I changed my module and added some more #includes, which resulted into `genksyms` getting *more* details on the next run while the implementation actually did not change.
...
> I wonder, why that option is not enabled by default or if there is another solution to prevent such breaking changed by including more/less #includes? Are there any good/recommended practices?

That problem is and can mostly be ignored:
- The CRC only tries to capture the ABI, but it is not perfect. You
  could also use a number and ask the developer to increment that
  manually each time the relevant ABI changes; just like it is done with
  the version number of shared libraries.
- You as the developer decide, how much of the ABI shoule be tracked:
  - if you include more header files, you get a deeper dependency tree
    and will detect more breaking changes - wanted or unwanted
  - if you include less header files, you will detect fewer changes.
- The CRC is only calculated when the experting module is "modpost"ed:
  The CRC is simply recorded then and any other module using it will
  just use that CRC. Including more or less headers at those using
  modules will not change anything as the CRC only depends on what was
  back than.

In summary you might change the CRC is you include more or less headers
when you re-compile the exporting module, but that is expected as the
detail level changes. Consider that part of the ABI.
If you do that you then have to just re-compile/link/modpost all
downstream modules so they can pick up the new CRC.

Philipp Hahn

      parent reply	other threads:[~2026-01-19 13:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 20:40 genksyms vs. opaque struct * Philipp Hahn
2025-11-26 15:22 ` Nicolas Schier
2026-01-19 13:48 ` Philipp Hahn [this message]

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=aW42JVMOkT_2maZ7@mail-auth.avm.de \
    --to=phahn-oss@avm.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nicolas.schier@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox