From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2020-07-30 12:54:51
There are two __packed attributes in qman.h that are both unnecessary
and causing compiler warnings because they're conflicting with
explicit alignment requirements set on members within the structure.
This patch removes them both.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2020-09-01 00:35:34
On Thu, Jul 30, 2020 at 10:52:59PM +1000, Herbert Xu wrote:
There are two __packed attributes in qman.h that are both unnecessary
and causing compiler warnings because they're conflicting with
explicit alignment requirements set on members within the structure.
This patch removes them both.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-----Original Message-----
From: Herbert Xu <herbert@gondor.apana.org.au>
Sent: Thursday, July 30, 2020 7:53 AM
To: Leo Li <redacted>; linuxppc-dev@lists.ozlabs.org; linux-arm-
kernel@lists.infradead.org
Subject: [PATCH] soc: fsl: Remove bogus packed attributes from qman.h
There are two __packed attributes in qman.h that are both unnecessary
and causing compiler warnings because they're conflicting with
explicit alignment requirements set on members within the structure.
Sorry for the late response. I missed this email previously.
These structures are descriptors used by hardware, we cannot have _ANY_ padding from the compiler. The compiled result might be the same with or without the __packed attribute for now, but I think keep it there probably is safer for dealing with unexpected alignment requirements from the compiler in the future.
Having conflicting alignment requirements warning might means something is wrong with the structure in certain scenario. I just tried a ARM64 build but didn't see the warnings. Could you share the warning you got and the build setup? Thanks.
Regards,
Leo
quoted hunk
This patch removes them both.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2020-09-01 01:56:44
On Tue, Sep 01, 2020 at 01:50:38AM +0000, Leo Li wrote:
Sorry for the late response. I missed this email previously.
These structures are descriptors used by hardware, we cannot have _ANY_ padding from the compiler. The compiled result might be the same with or without the __packed attribute for now, but I think keep it there probably is safer for dealing with unexpected alignment requirements from the compiler in the future.
Having conflicting alignment requirements warning might means something is wrong with the structure in certain scenario. I just tried a ARM64 build but didn't see the warnings. Could you share the warning you got and the build setup? Thanks.
Just do a COMPILE_TEST build on x86-64:
In file included from ../drivers/crypto/caam/qi.c:12:
../include/soc/fsl/qman.h:259:1: warning: alignment 1 of ‘struct qm_dqrr_entry’ is less than 8 [-Wpacked-not-aligned]
} __packed;
^
../include/soc/fsl/qman.h:292:2: warning: alignment 1 of ‘struct <anonymous>’ is less than 8 [-Wpacked-not-aligned]
} __packed ern;
^
In any case, those packed markers are completely unnecessary because
those structs contain no holes.
Cheers,
--
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
On Mon, Aug 31, 2020 at 8:57 PM Herbert Xu [off-list ref] wrote:
On Tue, Sep 01, 2020 at 01:50:38AM +0000, Leo Li wrote:
quoted
Sorry for the late response. I missed this email previously.
These structures are descriptors used by hardware, we cannot have _ANY_ padding from the compiler. The compiled result might be the same with or without the __packed attribute for now, but I think keep it there probably is safer for dealing with unexpected alignment requirements from the compiler in the future.
Having conflicting alignment requirements warning might means something is wrong with the structure in certain scenario. I just tried a ARM64 build but didn't see the warnings. Could you share the warning you got and the build setup? Thanks.
Just do a COMPILE_TEST build on x86-64:
In file included from ../drivers/crypto/caam/qi.c:12:
Looks like the CAAM driver and dependent QBMAN driver doesn't support
COMPILE_TEST yet. Are you trying to add the support for it?
I changed the Kconfig to enable the COMPILE_TEST anyway and updated my
toolchain to gcc-10 trying to duplicate the issue. The issues can
only be reproduced with "W=1".
../include/soc/fsl/qman.h:259:1: warning: alignment 1 of ‘struct qm_dqrr_entry’ is less than 8 [-Wpacked-not-aligned]
} __packed;
^
../include/soc/fsl/qman.h:292:2: warning: alignment 1 of ‘struct <anonymous>’ is less than 8 [-Wpacked-not-aligned]
} __packed ern;
^
I think this is a valid concern that if the parent structure doesn't
meet certain alignment requirements, the alignment for the
sub-structure cannot be guaranteed. If we just remove the __packed
attribute from the parent structure, the compiler could try to add
padding in the parent structure to fulfill the alignment requirements
of the sub structure which is not good. I think the following changes
are a better fix for the warnings:
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2020-09-02 01:34:25
On Tue, Sep 01, 2020 at 04:40:16PM -0500, Li Yang wrote:
Looks like the CAAM driver and dependent QBMAN driver doesn't support
COMPILE_TEST yet. Are you trying to add the support for it?
Yes.
I think this is a valid concern that if the parent structure doesn't
meet certain alignment requirements, the alignment for the
sub-structure cannot be guaranteed. If we just remove the __packed
attribute from the parent structure, the compiler could try to add
padding in the parent structure to fulfill the alignment requirements
of the sub structure which is not good. I think the following changes
are a better fix for the warnings: