Skip to contentSkip to conversation

Arm: constrain {,u}int64_aligned_t in public header

PATCH Superseded Jan Beulich 3 participants 8 messages Sep 1, 2023 – Sep 5, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Arm: constrain {,u}int64_aligned_t in public header

This using a GNU extension, it may not be exposed in general, just like is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

xen/include/public/arch-arm.h +4 -2
@@ -152,8 +152,10 @@
 
 #define XEN_HYPERCALL_TAG   0XEA1
 
-#define  int64_aligned_t  int64_t __attribute__((aligned(8)))
-#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#define  int64_aligned_t  int64_t __attribute__((__aligned__(8)))
+#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
+#endif
 
 #ifndef __ASSEMBLY__
 #define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
Reviewed-by on v1 1/1
#1 lore raw

Hi Jan,

Quoted 3 lines · Jan Beulich

This using a GNU extension, it may not be exposed in general, just like

Nit: Missing "is"

Quoted 8 lines

is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

With the Nit fixed (can be done on commit):

Cheers
Bertrand

Quoted 16 lines
xen/include/public/arch-arm.h +4 -2
@@ -152,8 +152,10 @@
 
 #define XEN_HYPERCALL_TAG   0XEA1
 
-#define  int64_aligned_t  int64_t __attribute__((aligned(8)))
-#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#define  int64_aligned_t  int64_t __attribute__((__aligned__(8)))
+#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
+#endif
 
 #ifndef __ASSEMBLY__
 #define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
#2 lore raw
Quoted 5 lines · Bertrand Marquis
Quoted 3 lines · Jan Beulich

This using a GNU extension, it may not be exposed in general, just like

Nit: Missing "is"

I would guess you would want it added as the 2nd word of the sentence. If not, please clarify where you think it is missing. If so, then I'm afraid I can't parse the sentence anymore with it added (i.e. there would need to be further modifications, e.g. at the very least "so" after the first comma).

Quoted 5 lines
Quoted 5 lines

is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

Quoted 7 lines
Quoted 3 lines

While there also add underscores around "aligned".

With the Nit fixed (can be done on commit):

Thanks, but I'm afraid I can't take it before the above is clarified.

Jan

#3 lore raw

Hi Jan,

Quoted 7 lines · Jan Beulich
Quoted 4 lines · Bertrand Marquis
Quoted 3 lines · Jan Beulich

This using a GNU extension, it may not be exposed in general, just like

Quoted 7 lines
Quoted 1 line

Nit: Missing "is"

I would guess you would want it added as the 2nd word of the sentence. If not, please clarify where you think it is missing. If so, then I'm afraid I can't parse the sentence anymore with it added (i.e. there would need to be further modifications, e.g. at the very least "so" after the first comma).

Sorry yes, it should be "This is using a GNU".

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

With the Nit fixed (can be done on commit):

Thanks, but I'm afraid I can't take it before the above is clarified.

Please see above.

Bertrand

Quoted 2 lines

Jan

#4 lore raw
Quoted 9 lines · Bertrand Marquis
Quoted 9 lines · Jan Beulich
Quoted 5 lines · Bertrand Marquis
Quoted 3 lines · Jan Beulich

This using a GNU extension, it may not be exposed in general, just like

Nit: Missing "is"

Quoted 7 lines
Quoted 5 lines

I would guess you would want it added as the 2nd word of the sentence. If not, please clarify where you think it is missing. If so, then I'm afraid I can't parse the sentence anymore with it added (i.e. there would need to be further modifications, e.g. at the very least "so" after the first comma).

Sorry yes, it should be "This is using a GNU".

So as I inferred, yet as said - according to my reading the sentence then ends up broken. If you continue to think the sentence is wrong as is, would it help if I replaced "This" by "For"?

Jan

Quoted 22 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

With the Nit fixed (can be done on commit):

Thanks, but I'm afraid I can't take it before the above is clarified.

Please see above.

Bertrand

Quoted 2 lines

Jan

#5 lore raw

Hi Jan,

Quoted 18 lines · Jan Beulich
Quoted 15 lines · Bertrand Marquis
Quoted 14 lines · Jan Beulich
Quoted 5 lines · Bertrand Marquis
Quoted 3 lines · Jan Beulich

This using a GNU extension, it may not be exposed in general, just like

Nit: Missing "is"

I would guess you would want it added as the 2nd word of the sentence. If not, please clarify where you think it is missing. If so, then I'm afraid I can't parse the sentence anymore with it added (i.e. there would need to be further modifications, e.g. at the very least "so" after the first comma).

Quoted 5 lines
Quoted 1 line

Sorry yes, it should be "This is using a GNU".

So as I inferred, yet as said - according to my reading the sentence then ends up broken. If you continue to think the sentence is wrong as is, would it help if I replaced "This" by "For"?

The sentence looks a bit weird to me but I am not a native english speaker. Any reformulation coming from me will probably not be good english anyway. I understand that one as "we don't want to expose this in general because it is a using a GNU extension and x86 is already not", the sentence here is just asking me a bit more thinking that is it.

As this was a Nit, feel free to ignore and you can keep my R-b.

Cheers
Bertrand

Quoted 24 lines

Jan

Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

With the Nit fixed (can be done on commit):

Thanks, but I'm afraid I can't take it before the above is clarified.

Please see above.

Bertrand

Quoted 2 lines

Jan

#6 lore raw
In reply to Jan Beulich

Hi Jan,

Quoted 15 lines · Jan Beulich

This using a GNU extension, it may not be exposed in general, just like is done on x86. External consumers need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

xen/include/public/arch-arm.h line 158

Quoted 9 lines
xen/include/public/arch-arm.h +4 -2
@@ -152,8 +152,10 @@
 
 #define XEN_HYPERCALL_TAG   0XEA1
 
-#define  int64_aligned_t  int64_t __attribute__((aligned(8)))
-#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#define  int64_aligned_t  int64_t __attribute__((__aligned__(8)))
+#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
+#endif

Today I tested this patch by our CI (on top of today’s staging), and it looks like below error will happen for both arm32 and arm64 Yocto build:

The arm32 failure:
https://pastebin.com/raw/S7ZqmG6z

The arm64 failure:
https://pastebin.com/raw/HMFh5tuS

Kind regards,
Henry

Quoted 4 lines
xen/include/public/arch-arm.h +0 -0
 #ifndef __ASSEMBLY__
 #define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
 
#7 lore raw
Quoted 17 lines · Henry Wang

xen/include/public/arch-arm.h line 158

Quoted 13 lines · Jan Beulich
xen/include/public/arch-arm.h +4 -2
@@ -152,8 +152,10 @@
 
 #define XEN_HYPERCALL_TAG   0XEA1
 
-#define  int64_aligned_t  int64_t __attribute__((aligned(8)))
-#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#define  int64_aligned_t  int64_t __attribute__((__aligned__(8)))
+#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
+#endif

Today I tested this patch by our CI (on top of today’s staging), and it looks like below error will happen for both arm32 and arm64 Yocto build:

Quoted 5 lines

The arm32 failure:
https://pastebin.com/raw/S7ZqmG6z

The arm64 failure:
https://pastebin.com/raw/HMFh5tuS

Thanks for pointing this out. Turns out that not even all libraries get __XEN_TOOLS__ defined (see tools/Rules.mk). In the case of toolcore, the public xen.h is included solely to get a definition of domid_t. None of the handles are actually needed. I wonder if such a dependency couldn't be avoided. Yet doing so would help only a little:
Other libraries (evtchn or gnttab for example) likely need more, yet don't depend on libxc either.

For the time being I'll extend the #if to also check for __GNUC__, but I'm not convinced this is a good way of dealing with the issue.

Jan