linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/vfio: Fix an 8-byte alignment issue
@ 2018-10-17 18:18 Wenwen Wang
  2018-10-17 21:15 ` Konrad Rzeszutek Wilk
  2018-10-18 17:20 ` Joe Perches
  0 siblings, 2 replies; 4+ messages in thread
From: Wenwen Wang @ 2018-10-17 18:18 UTC (permalink / raw)
  To: Wenwen Wang; +Cc: Kangjie Lu, Alex Williamson, open list:VFIO DRIVER, open list

This patch adds a 4-byte reserved field in the structure
vfio_eeh_pe_op to make sure that the u64 fields in the structure
vfio_eeh_pe_err are 8-byte aligned.

Signed-off-by: Wenwen Wang <wang6495@umn.edu>
---
 include/uapi/linux/vfio.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 1aa7b82..3e71ded 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -729,6 +729,7 @@ struct vfio_eeh_pe_op {
 	__u32 argsz;
 	__u32 flags;
 	__u32 op;
+	__u32 __res;
 	union {
 		struct vfio_eeh_pe_err err;
 	};
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/vfio: Fix an 8-byte alignment issue
  2018-10-17 18:18 [PATCH] drivers/vfio: Fix an 8-byte alignment issue Wenwen Wang
@ 2018-10-17 21:15 ` Konrad Rzeszutek Wilk
  2018-10-17 22:03   ` Alex Williamson
  2018-10-18 17:20 ` Joe Perches
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-10-17 21:15 UTC (permalink / raw)
  To: Wenwen Wang, kvm, linux-kernel; +Cc: Kangjie Lu, Alex Williamson

On Wed, Oct 17, 2018 at 01:18:19PM -0500, Wenwen Wang wrote:
> This patch adds a 4-byte reserved field in the structure
> vfio_eeh_pe_op to make sure that the u64 fields in the structure
> vfio_eeh_pe_err are 8-byte aligned.

Won't this break 32-bit kernels? That is the size of the structure
will now be 4 bytes bigger..
> 
> Signed-off-by: Wenwen Wang <wang6495@umn.edu>
> ---
>  include/uapi/linux/vfio.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index 1aa7b82..3e71ded 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
> @@ -729,6 +729,7 @@ struct vfio_eeh_pe_op {
>  	__u32 argsz;
>  	__u32 flags;
>  	__u32 op;
> +	__u32 __res;
>  	union {
>  		struct vfio_eeh_pe_err err;
>  	};
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/vfio: Fix an 8-byte alignment issue
  2018-10-17 21:15 ` Konrad Rzeszutek Wilk
@ 2018-10-17 22:03   ` Alex Williamson
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2018-10-17 22:03 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Wenwen Wang, kvm, linux-kernel, Kangjie Lu

On Wed, 17 Oct 2018 17:15:33 -0400
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

> On Wed, Oct 17, 2018 at 01:18:19PM -0500, Wenwen Wang wrote:
> > This patch adds a 4-byte reserved field in the structure
> > vfio_eeh_pe_op to make sure that the u64 fields in the structure
> > vfio_eeh_pe_err are 8-byte aligned.  
> 
> Won't this break 32-bit kernels? That is the size of the structure
> will now be 4 bytes bigger..

Hi Konrad,

EEH support here depends on SPAPR_TCE_IOMMU which depends on either
PPC_POWERNV or PPC_PSERIES, both of which depend on PPC64.  So I don't
think 32-bit kernels are a concern here.  Thanks,

Alex
 
> > Signed-off-by: Wenwen Wang <wang6495@umn.edu>
> > ---
> >  include/uapi/linux/vfio.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> > index 1aa7b82..3e71ded 100644
> > --- a/include/uapi/linux/vfio.h
> > +++ b/include/uapi/linux/vfio.h
> > @@ -729,6 +729,7 @@ struct vfio_eeh_pe_op {
> >  	__u32 argsz;
> >  	__u32 flags;
> >  	__u32 op;
> > +	__u32 __res;
> >  	union {
> >  		struct vfio_eeh_pe_err err;
> >  	};
> > -- 
> > 2.7.4
> >   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/vfio: Fix an 8-byte alignment issue
  2018-10-17 18:18 [PATCH] drivers/vfio: Fix an 8-byte alignment issue Wenwen Wang
  2018-10-17 21:15 ` Konrad Rzeszutek Wilk
@ 2018-10-18 17:20 ` Joe Perches
  1 sibling, 0 replies; 4+ messages in thread
From: Joe Perches @ 2018-10-18 17:20 UTC (permalink / raw)
  To: Wenwen Wang; +Cc: Kangjie Lu, Alex Williamson, open list:VFIO DRIVER, open list

On Wed, 2018-10-17 at 13:18 -0500, Wenwen Wang wrote:
> This patch adds a 4-byte reserved field in the structure
> vfio_eeh_pe_op to make sure that the u64 fields in the structure
> vfio_eeh_pe_err are 8-byte aligned.
> 
> Signed-off-by: Wenwen Wang <wang6495@umn.edu>
> ---
>  include/uapi/linux/vfio.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> index 1aa7b82..3e71ded 100644
> --- a/include/uapi/linux/vfio.h
> +++ b/include/uapi/linux/vfio.h
> @@ -729,6 +729,7 @@ struct vfio_eeh_pe_op {
>  	__u32 argsz;
>  	__u32 flags;
>  	__u32 op;
> +	__u32 __res;
>  	union {
>  		struct vfio_eeh_pe_err err;
>  	};

Why use an anonymous union for a single element?
Why not make struct vfio_eeh_pe_err __aligned(8)?
Why not make the u64 structure elements of
struct ufio_eeh_pe_err __aligned_u64?



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-18 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17 18:18 [PATCH] drivers/vfio: Fix an 8-byte alignment issue Wenwen Wang
2018-10-17 21:15 ` Konrad Rzeszutek Wilk
2018-10-17 22:03   ` Alex Williamson
2018-10-18 17:20 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).