linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	stable@kernel.org
Subject: Re: [PATCH] kbuild: give SUBLEVEL more room in KERNEL_VERSION
Date: Mon, 18 Jan 2021 11:32:29 +0100	[thread overview]
Message-ID: <YAVjvf67ckxwIppN@kroah.com> (raw)
In-Reply-To: <CAK7LNAStfNj0hvotctFonezQKQSbJfxU1HrwzWmyDc0+68fQ4Q@mail.gmail.com>

On Mon, Jan 18, 2021 at 07:27:51PM +0900, Masahiro Yamada wrote:
> On Mon, Jan 18, 2021 at 6:21 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Sun, Jan 17, 2021 at 08:49:51PM -0500, Sasha Levin wrote:
> > > SUBLEVEL only has 8 bits of space, which means that we'll overflow it
> > > once it reaches 256.
> > >
> > > Few of the stable branches will imminently overflow SUBLEVEL while
> > > there's no risk of overflowing VERSION.
> > >
> > > Thus, give SUBLEVEL 8 more bits which will be stolen from VERSION, this
> > > should create a better balance between the different version numbers we
> > > use.
> > >
> > > The downside here is that Linus will have 8 bits less to play with, but
> > > given our current release cadence (~10 weeks), the number of Linus's
> > > fingers & toes (20), and the current VERSION (5) we can calculate that
> > > VERSION will overflow in just over 1,000 years, so I'm kicking this can
> > > down the road.
> > >
> > > Cc: stable@kernel.org
> > > Signed-off-by: Sasha Levin <sashal@kernel.org>
> > > ---
> > >  Makefile | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 9e73f82e0d863..dc2bad7a440d8 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -1252,8 +1252,8 @@ endef
> > >
> > >  define filechk_version.h
> > >       echo \#define LINUX_VERSION_CODE $(shell                         \
> > > -     expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
> > > -     echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'
> > > +     expr $(VERSION) \* 16777216 + 0$(PATCHLEVEL) \* 65536 + 0$(SUBLEVEL)); \
> > > +     echo '#define KERNEL_VERSION(a,b,c) (((a) << 24) + ((b) << 16) + (c))'
> >
> > As much as I agree, this will break in-tree users of LINUX_VERSION_CODE
> > that try to suck out the version/patchlevel number of the kernel release
> > into their own fields.  Things like USB host controller strings, v4l
> > ioctl reports, scsi driver ioctls, and other places do fun bit-movements
> > to try to unreverse this bit packing.
> 
> 
> I can see a checkpatch warning about LINUX_VERSION_CODE.
> 
> See line 4528 of scripts/checkpatch.pl
> 
> 
>   WARN("LINUX_VERSION_CODE",
>        "LINUX_VERSION_CODE should be avoided, code should be for the
> version to which it is merged\n" . $herecurr);
> 
> 
> 
> It helps external modules to be compiled for multiple kernel versions.
> 
> #if KERNEL_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
>     code for the kernel versions older than 5.4.0
> #endif
> 
> 
> The upstream code does not do this.
> But, LINUX_VERSION_CODE is actually used in many places...

Yes, it is used in a number of user/kernel apis for various reasons.

And the above patch will break them :(

thanks,

greg k-h

  reply	other threads:[~2021-01-18 10:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18  1:49 [PATCH] kbuild: give SUBLEVEL more room in KERNEL_VERSION Sasha Levin
2021-01-18  9:21 ` Greg KH
2021-01-18  9:24   ` Greg KH
2021-01-18 13:39     ` Sasha Levin
2021-01-18 13:52       ` Greg KH
2021-01-18 15:31         ` Sasha Levin
2021-01-18 16:39           ` Greg KH
2021-01-18 10:27   ` Masahiro Yamada
2021-01-18 10:32     ` Greg KH [this message]
2021-01-18 22:54     ` David Laight
2021-01-18 13:38   ` Sasha Levin

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=YAVjvf67ckxwIppN@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=sashal@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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).