From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Laight Subject: RE: [PATCH net-next 06/10] net/mlx4_core: Fix struct mlx4_vhcr_cmd to make implicit padding explicit Date: Tue, 27 Jan 2015 13:38:28 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CAD3D71@AcuExch.aculab.com> References: <1422351179-27284-1-git-send-email-amirv@mellanox.com> <1422351179-27284-7-git-send-email-amirv@mellanox.com> <063D6719AE5E284EB5DD2968C1650D6D1CAD3B01@AcuExch.aculab.com> <20150127150027.184ba5e8@jpm-OptiPlex-GX620> Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT Cc: 'Amir Vadai' , "David S. Miller" , "netdev@vger.kernel.org" , "Or Gerlitz" , Yevgeny Petrilin To: 'Jack Morgenstein' Return-path: Received: from smtp-out6.electric.net ([192.162.217.181]:53705 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755543AbbA0Nik convert rfc822-to-8bit (ORCPT ); Tue, 27 Jan 2015 08:38:40 -0500 In-Reply-To: <20150127150027.184ba5e8@jpm-OptiPlex-GX620> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: From: Jack Morgenstein > On Tue, 27 Jan 2015 09:43:27 +0000 > David Laight wrote: > > > From: Amir Vadai > > > From: Jack Morgenstein > > > > > > Struct mlx4_vhcr was implicitly padded by the gcc compiler. > > > This commit makes that padding explicit, to prevent issues with > > > changing compilers. Note that we added the padding dword (rather > > > than simply packing the structure) in order to maintain > > > compatibility with previous kernels. > > > > It isn't a 'compiler' option, but depends on the architecture. > > > > > Reported-by: Alexander Schmidt > > > Signed-off-by: Jack Morgenstein > > > Signed-off-by: Amir Vadai > > > --- > > > drivers/net/ethernet/mellanox/mlx4/mlx4.h | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h > > > b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index 096a81c..595e18a > > > 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h > > > +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h > > > @@ -196,13 +196,14 @@ struct mlx4_vhcr { > > > struct mlx4_vhcr_cmd { > > > __be64 in_param; > > > __be32 in_modifier; > > > + u32 reserved1; > > > > Adding a pad here changes the alignment on most 32bit architectures > > (eg i386) where 64bit integers are only aligned to 4 byte boundaries. > > So you are not 'maintaining compatibility with previous kernels'. > > You are correct. However, this structure is used ONLY for communication > between a Host and a Guest on that host. In the current code (before > this fix), it was not possible to run a 32-bit Guest over a 64-bit Host, > because of the implicit padding that occurred on the 64-bit Host > and did not occur on the 32-bit Guest. > > With this fix, a 32-bit Guest (with the fix) will be able to run over a > 64-bit Host (with or without the fix). Haven't you broken communication between an old and new 32bit Guests and 32bit hosts (assuming they exist)? David