[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <MW4PR11MB5911240C4556BAEE92867890BA772@MW4PR11MB5911.namprd11.prod.outlook.com>
Date: Sat, 20 Jan 2024 02:32:58 +0000
From: "Singh, Krishneil K" <krishneil.k.singh@...el.com>
To: "Linga, Pavan Kumar" <pavan.kumar.linga@...el.com>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "Kitszel, Przemyslaw"
<przemyslaw.kitszel@...el.com>, "pmenzel@...gen.mpg.de"
<pmenzel@...gen.mpg.de>, "Tantilov, Emil S" <emil.s.tantilov@...el.com>,
"horms@...nel.org" <horms@...nel.org>, "Linga, Pavan Kumar"
<pavan.kumar.linga@...el.com>, lkp <lkp@...el.com>
Subject: RE: [PATCH iwl-net v3] idpf: avoid compiler padding in
virtchnl2_ptype struct
> -----Original Message-----
> From: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
> Sent: Monday, January 8, 2024 5:32 PM
> To: intel-wired-lan@...ts.osuosl.org
> Cc: netdev@...r.kernel.org; Kitszel, Przemyslaw
> <przemyslaw.kitszel@...el.com>; pmenzel@...gen.mpg.de; Tantilov, Emil S
> <emil.s.tantilov@...el.com>; horms@...nel.org; Linga, Pavan Kumar
> <pavan.kumar.linga@...el.com>; lkp <lkp@...el.com>
> Subject: [PATCH iwl-net v3] idpf: avoid compiler padding in virtchnl2_ptype
> struct
>
> In the arm random config file, kconfig option 'CONFIG_AEABI' is
> disabled which results in adding the compiler flag '-mabi=apcs-gnu'.
> This causes the compiler to add padding in virtchnl2_ptype
> structure to align it to 8 bytes, resulting in the following
> size check failure:
>
> include/linux/build_bug.h:78:41: error: static assertion failed: "(6) ==
> sizeof(struct virtchnl2_ptype)"
> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> | ^~~~~~~~~~~~~~
> include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__,
> #expr)
> | ^~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/idpf/virtchnl2.h:26:9: note: in expansion of macro
> 'static_assert'
> 26 | static_assert((n) == sizeof(struct X))
> | ^~~~~~~~~~~~~
> drivers/net/ethernet/intel/idpf/virtchnl2.h:982:1: note: in expansion of
> macro 'VIRTCHNL2_CHECK_STRUCT_LEN'
> 982 | VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Avoid the compiler padding by using "__packed" structure
> attribute for the virtchnl2_ptype struct. Also align the
> structure by using "__aligned(2)" for better code optimization.
>
> Fixes: 0d7502a9b4a7 ("virtchnl: add virtchnl version 2 ops")
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202312220250.ufEm8doQ-
> lkp@...el.com
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> Reviewed-by: Paul Menzel <pmenzel@...gen.mpg.de>
> Reviewed-by: Simon Horman <horms@...nel.org>
> Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
>
> ---
> v3:
> - add "__aligned(2)" structure attribute for better code optimization
>
> v2:
> - add the kconfig option causing the compile failure to the commit message
> ---
> drivers/net/ethernet/intel/idpf/virtchnl2.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/virtchnl2.h
> b/drivers/net/ethernet/intel/idpf/virtchnl2.h
> index 8dc83788972..4a3c4454d25 100644
> --- a/drivers/net/ethernet/intel/idpf/virtchnl2.h
> +++ b/drivers/net/ethernet/intel/idpf/virtchnl2.h
Tested-by: Krishneil Singh <krishneil.k.singh@...el.com>
Powered by blists - more mailing lists