[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 for-4.14 2/2] pvcalls: Document correctly and explicitely the padding for all arches



On Sat, 27 Jun 2020, Julien Grall wrote:
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> The specification of pvcalls suggests there is padding for 32-bit x86
> at the end of most the structure. However, they are not described in
> in the public header.
> 
> Because of that all the structures would be 32-bit aligned and not
> 64-bit aligned for 32-bit x86.
> 
> For all the other architectures supported (Arm and 64-bit x86), the
> structure are aligned to 64-bit because they contain uint64_t field.
> Therefore all the structures contain implicit padding.
> 
> Given the specification is authoriitative, the padding will the same for
> the all architectures. The potential breakage of compatibility is ought
> to be fine as pvcalls is still a tech preview.
> 
> As an aside, the padding sadly cannot be mandated to be 0 as they are
> already present. So it is not going to be possible to use the padding
> for extending a command in the future.
> 
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

Aside from typos other mentioned:

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
>     This wants to be included in Xen 4.14 to avoid more users to rely on
>     wrong public headers.
> 
>     Changes in v4:
>         - Revert back to v1 for the patch and expand the commit message
> 
>     Changes in v3:
>         - Use __i386__ rather than CONFIG_X86_32
> 
>     Changes in v2:
>         - It is not possible to use the same padding for 32-bit x86 and
>         all the other supported architectures.
> ---
>  docs/misc/pvcalls.pandoc        | 8 --------
>  xen/include/public/io/pvcalls.h | 4 ++++
>  2 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/docs/misc/pvcalls.pandoc b/docs/misc/pvcalls.pandoc
> index 665dad556c39..971cd8f4b122 100644
> --- a/docs/misc/pvcalls.pandoc
> +++ b/docs/misc/pvcalls.pandoc
> @@ -246,9 +246,7 @@ The format is defined as follows:
>                       uint32_t domain;
>                       uint32_t type;
>                       uint32_t protocol;
> -                     #ifdef CONFIG_X86_32
>                       uint8_t pad[4];
> -                     #endif
>               } socket;
>               struct xen_pvcalls_connect {
>                       uint64_t id;
> @@ -257,16 +255,12 @@ The format is defined as follows:
>                       uint32_t flags;
>                       grant_ref_t ref;
>                       uint32_t evtchn;
> -                     #ifdef CONFIG_X86_32
>                       uint8_t pad[4];
> -                     #endif
>               } connect;
>               struct xen_pvcalls_release {
>                       uint64_t id;
>                       uint8_t reuse;
> -                     #ifdef CONFIG_X86_32
>                       uint8_t pad[7];
> -                     #endif
>               } release;
>               struct xen_pvcalls_bind {
>                       uint64_t id;
> @@ -276,9 +270,7 @@ The format is defined as follows:
>               struct xen_pvcalls_listen {
>                       uint64_t id;
>                       uint32_t backlog;
> -                     #ifdef CONFIG_X86_32
>                       uint8_t pad[4];
> -                     #endif
>               } listen;
>               struct xen_pvcalls_accept {
>                       uint64_t id;
> diff --git a/xen/include/public/io/pvcalls.h b/xen/include/public/io/pvcalls.h
> index 905880735dda..6da6b5533a10 100644
> --- a/xen/include/public/io/pvcalls.h
> +++ b/xen/include/public/io/pvcalls.h
> @@ -68,6 +68,7 @@ struct xen_pvcalls_request {
>              uint32_t domain;
>              uint32_t type;
>              uint32_t protocol;
> +            uint8_t pad[4];
>          } socket;
>          struct xen_pvcalls_connect {
>              uint64_t id;
> @@ -76,10 +77,12 @@ struct xen_pvcalls_request {
>              uint32_t flags;
>              grant_ref_t ref;
>              uint32_t evtchn;
> +            uint8_t pad[4];
>          } connect;
>          struct xen_pvcalls_release {
>              uint64_t id;
>              uint8_t reuse;
> +            uint8_t pad[7];
>          } release;
>          struct xen_pvcalls_bind {
>              uint64_t id;
> @@ -89,6 +92,7 @@ struct xen_pvcalls_request {
>          struct xen_pvcalls_listen {
>              uint64_t id;
>              uint32_t backlog;
> +            uint8_t pad[4];
>          } listen;
>          struct xen_pvcalls_accept {
>              uint64_t id;
> -- 
> 2.17.1
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.