Re: [PATCH net-next v3 11/11] wireguard: netlink: generate netlink code
"Jason A. Donenfeld" <[email protected]> Thu, 20 Nov 2025 03:46:39 +0100
| Newsgroups | com.zx2c4.lists.wireguard,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CAHmME9oO0sGnHrZUeETmL+CCj1UZ+aQx_CPArXKpFuBhE9UYbw@mail.gmail.com> |
On Thu, Nov 20, 2025 at 3:44 AM Jakub Kicinski <[email protected]> wrote: > > On Thu, 20 Nov 2025 01:54:47 +0100 Jason A. Donenfeld wrote: > > On Tue, Nov 18, 2025 at 05:00:45PM -0800, Jakub Kicinski wrote: > > > On Tue, 18 Nov 2025 23:51:37 +0100 Jason A. Donenfeld wrote: > > > > I mean, there is *tons* of generated code in the kernel. This is how it > > > > works. And you *want the output to change when the tool changes*. That's > > > > literally the point. It would be like if you wanted to check in all the > > > > .o files, in case the compiler started generating different output, or > > > > if you wanted the objtool output or anything else to be checked in. And > > > > sheerly from a git perspective, it seems outrageous to touch a zillion > > > > files every time the ynl code changes. Rather, the fact that it's > > > > generated on the fly ensures that the ynl generator stays correctly > > > > implemented. It's the best way to keep that code from rotting. > > > > > > CI checks validate that the files are up to date. > > > There has been no churn to the kernel side of the generated code. > > > Let's be practical. > > > > Okay, it sounds like neither of you want to do this. Darn. I really hate > > having generated artifacts laying around that can be created efficiently > > at compile time. But okay, so it goes. I guess we'll do that. > > > > I would like to ask two things, then, which may or may not be possible: > > > > 1) Can we put this in drivers/net/wireguard/generated/netlink.{c.h} > > And then in the Makefile, do `wireguard-y += netlink.o generated/netlink.o` > > on one line like that. I prefer this to keeping it in the same > > directory with the awkward -gen suffix. > > That should work, I think. > > > 2) In the header of each generated file, automatically write out the > > command that was used to generate it. Here's an example of this good > > habit from Go: https://github.com/golang/go/blob/master/src/syscall/zsyscall_linux_amd64.go > > You don't like the runes? :) > > /* Do not edit directly, auto-generated from: */ > /* $YAML-path */ > /* YNL-GEN [kernel|user|uapi] [source|header] */ > /* YNL-ARG $extra-args */ > > Do you care about the exact cmdline of the python tool, or can we just > append: > > /* To regenerate run: tools/net/ynl/ynl-regen.sh */ The args are non-trivial, right? The idea is so that these files can be regenerated in a few years when the ynl project has widely succeeded and we've all paged this out of our minds and forgotten how it all worked.