* Re: [PATCH] zlib: define get_unaligned16() only when used
@ 2020-11-24 11:56 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2020-11-24 11:56 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jann Horn, Lukas Bulwahn, Andrew Morton, Arnd Bergmann, Tom Rix,
Nathan Chancellor, Nick Desaulniers, clang-built-linux,
kernel-janitors, kernel list
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.
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] zlib: define get_unaligned16() only when used
2020-11-24 11:56 ` Arnd Bergmann
@ 2020-11-24 12:00 ` Lukas Bulwahn
-1 siblings, 0 replies; 11+ messages in thread
From: Lukas Bulwahn @ 2020-11-24 12:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Christoph Hellwig, Jann Horn, Andrew Morton, Arnd Bergmann,
Tom Rix, Nathan Chancellor, Nick Desaulniers, clang-built-linux,
kernel-janitors, kernel list
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] zlib: define get_unaligned16() only when used
@ 2020-11-24 12:00 ` Lukas Bulwahn
0 siblings, 0 replies; 11+ messages in thread
From: Lukas Bulwahn @ 2020-11-24 12:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Christoph Hellwig, Jann Horn, Andrew Morton, Arnd Bergmann,
Tom Rix, Nathan Chancellor, Nick Desaulniers, clang-built-linux,
kernel-janitors, kernel list
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] zlib: define get_unaligned16() only when used
2020-11-24 11:56 ` Arnd Bergmann
@ 2020-11-24 13:31 ` David Laight
-1 siblings, 0 replies; 11+ messages in thread
From: David Laight @ 2020-11-24 13:31 UTC (permalink / raw)
To: 'Arnd Bergmann', Christoph Hellwig
Cc: Jann Horn, Lukas Bulwahn, Andrew Morton, Arnd Bergmann, Tom Rix,
Nathan Chancellor, Nick Desaulniers, clang-built-linux,
kernel-janitors, kernel list
From: Arnd Bergmann
> Sent: 24 November 2020 11:57
>
> 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.
Plausibly it could include a different header that defined the required
items for those builds.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH] zlib: define get_unaligned16() only when used
@ 2020-11-24 13:31 ` David Laight
0 siblings, 0 replies; 11+ messages in thread
From: David Laight @ 2020-11-24 13:31 UTC (permalink / raw)
To: 'Arnd Bergmann', Christoph Hellwig
Cc: Jann Horn, Lukas Bulwahn, Andrew Morton, Arnd Bergmann, Tom Rix,
Nathan Chancellor, Nick Desaulniers, clang-built-linux,
kernel-janitors, kernel list
RnJvbTogQXJuZCBCZXJnbWFubg0KPiBTZW50OiAyNCBOb3ZlbWJlciAyMDIwIDExOjU3DQo+IA0K
PiBPbiBUdWUsIE5vdiAyNCwgMjAyMCBhdCAxMjo1MSBQTSBDaHJpc3R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