All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jann Horn <jannh@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Tom Rix <trix@redhat.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	kernel-janitors@vger.kernel.org,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] zlib: define get_unaligned16() only when used
Date: Tue, 24 Nov 2020 13:00:30 +0100	[thread overview]
Message-ID: <CAKXUXMxfPqn4hG-QCtQM1qrK7Vck2hHRycb5VZBYHf4-ezkiGA@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a2rVKQ5UHzcycu=0QpjtSQ3Nne4Xre-7+V27vmCe9yfKg@mail.gmail.com>

On Tue, Nov 24, 2020 at 12:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> On Tue, Nov 24, 2020 at 12:51 PM Christoph Hellwig <hch@infradead.org> wrote:
> > On Tue, Nov 24, 2020 at 12:08:40PM +0100, Jann Horn wrote:
> > > > Since commit acaab7335bd6 ("lib/zlib: remove outdated and incorrect
> > > > pre-increment optimization"), get_unaligned16() is only used when
> > > > !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
> > > >
> > > > Hence, make CC=clang W=1 warns:
> > > >
> > > >   lib/zlib_inflate/inffast.c:20:1:
> > > >     warning: unused function 'get_unaligned16' [-Wunused-function]
> > > >
> > > > Define get_unaligned16() only when it is actually used.
> > > >
> > > > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > >
> > > AFAICS a nicer option would be to "#include <asm/unaligned.h>" and
> > > then use "get_unaligned", which should automatically do the right
> > > thing everywhere and remove the need for defining get_unaligned16()
> > > and checking CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS entirely?
> >
> > Yes, that is the right thing to do.
>
> It's possible that this didn't work when the code was originally added:
> The decompressor functions are called from the compressed boot path,
> which is a bit limited regarding which headers it can include, at least
> on some architectures.
>
> I would recommend test-building this for all architectures that include
> ../../../../lib/decompress_inflate.c from their boot code.
>

Jann, Christoph, Arnd, thanks for the advice. I will start to look
into this immediately.

Lukas

WARNING: multiple messages have this Message-ID (diff)
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jann Horn <jannh@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>, Tom Rix <trix@redhat.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	kernel-janitors@vger.kernel.org,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] zlib: define get_unaligned16() only when used
Date: Tue, 24 Nov 2020 12:00:30 +0000	[thread overview]
Message-ID: <CAKXUXMxfPqn4hG-QCtQM1qrK7Vck2hHRycb5VZBYHf4-ezkiGA@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a2rVKQ5UHzcycu=0QpjtSQ3Nne4Xre-7+V27vmCe9yfKg@mail.gmail.com>

On Tue, Nov 24, 2020 at 12:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> On Tue, Nov 24, 2020 at 12:51 PM Christoph Hellwig <hch@infradead.org> wrote:
> > On Tue, Nov 24, 2020 at 12:08:40PM +0100, Jann Horn wrote:
> > > > Since commit acaab7335bd6 ("lib/zlib: remove outdated and incorrect
> > > > pre-increment optimization"), get_unaligned16() is only used when
> > > > !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
> > > >
> > > > Hence, make CC=clang W=1 warns:
> > > >
> > > >   lib/zlib_inflate/inffast.c:20:1:
> > > >     warning: unused function 'get_unaligned16' [-Wunused-function]
> > > >
> > > > Define get_unaligned16() only when it is actually used.
> > > >
> > > > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > >
> > > AFAICS a nicer option would be to "#include <asm/unaligned.h>" and
> > > then use "get_unaligned", which should automatically do the right
> > > thing everywhere and remove the need for defining get_unaligned16()
> > > and checking CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS entirely?
> >
> > Yes, that is the right thing to do.
>
> It's possible that this didn't work when the code was originally added:
> The decompressor functions are called from the compressed boot path,
> which is a bit limited regarding which headers it can include, at least
> on some architectures.
>
> I would recommend test-building this for all architectures that include
> ../../../../lib/decompress_inflate.c from their boot code.
>

Jann, Christoph, Arnd, thanks for the advice. I will start to look
into this immediately.

Lukas

  reply	other threads:[~2020-11-24 12:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 10:40 [PATCH] zlib: define get_unaligned16() only when used Lukas Bulwahn
2020-11-24 10:40 ` Lukas Bulwahn
2020-11-24 11:08 ` Jann Horn
2020-11-24 11:08   ` Jann Horn
2020-11-24 11:50   ` Christoph Hellwig
2020-11-24 11:56     ` Arnd Bergmann
2020-11-24 11:56       ` Arnd Bergmann
2020-11-24 12:00       ` Lukas Bulwahn [this message]
2020-11-24 12:00         ` Lukas Bulwahn
2020-11-24 13:31       ` David Laight
2020-11-24 13:31         ` David Laight

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=CAKXUXMxfPqn4hG-QCtQM1qrK7Vck2hHRycb5VZBYHf4-ezkiGA@mail.gmail.com \
    --to=lukas.bulwahn@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hch@infradead.org \
    --cc=jannh@google.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=trix@redhat.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 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.