[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 for-4.14] pvcalls: Document correctly and explicitely the padding for all arches
 
- To: Jan Beulich <jbeulich@xxxxxxxx>
 
- From: Julien Grall <julien@xxxxxxx>
 
- Date: Tue, 16 Jun 2020 10:19:11 +0100
 
- Cc: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, paul@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
 
- Delivery-date: Tue, 16 Jun 2020 09:19:19 +0000
 
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
 
 
 
On 16/06/2020 09:26, Jan Beulich wrote:
 
On 13.06.2020 20:41, Julien Grall wrote:
 
@@ -73,10 +76,18 @@ struct xen_pvcalls_request {
              uint32_t flags;
              grant_ref_t ref;
              uint32_t evtchn;
+#ifndef __i386__
+            uint8_t pad[4];
+#endif
 
Where possible I think uint32_t would be slightly better to use.
 
 
OOI, why?
 
 
          } connect;
          struct xen_pvcalls_release {
              uint64_t id;
              uint8_t reuse;
+#ifndef __i386__
+            uint8_t pad[7];
+#else
+            uint8_t pad[3];
+#endif
 
For this I'd recommend uniform "uint8_t pad[3];" (i.e. outside
of any #ifdef) followed by a uint32_t again inside the #ifdef.
 
 
Same question here. The more the padding cannot be re-used.
 
Expressing everything through e.g. alignof() would seem even
better, but I can't currently think of a way to do so cleanly.
 
 
 I am afraid I don't have time to look at how alignof() can work nicely. 
Feel free to send a follow-up or pick-up the patch is you really want 
alignof().
Cheers,
--
Julien Grall
 
 
    
     |