xen/public: arch-arm: Restrict the visibility of struct vcpu_guest_core_regs
PATCH 1/1 xen/public: arch-arm: Restrict the visibility of struct vcpu_guest_core_regs
Currently, the structure vcpu_guest_core_regs is part of the public API. This implies that any change in the structure should be backward compatible.
However, the structure is only needed by the tools and Xen. It is also not expected to be ever used outside of that context. So we could save us some headache by only declaring the structure for Xen and tools.
---
This is a follow-up of the discussion [1].
As this is now Xen and tools only, I am wondering whether the check on GNU_C is still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.
[1] <[email protected]>
--- xen/include/public/arch-arm.h | 3 +++ 1 file changed, 3 insertions(+)
xen/include/public/arch-arm.h +3 -0
@@ -197,6 +197,7 @@ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val) +#if defined(__XEN__) || defined(__XEN_TOOLS__)#if defined(__GNUC__) && !defined(__STRICT_ANSI__)/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ # define __DECL_REG (n64, n32) union { \
@@ -272,6 +273,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);#undef __DECL_REG +#endif +typedef uint64_t xen_pfn_t ;#define PRI_xen_pfn PRIx64#define PRIu_xen_pfn PRIu64
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.
I think this should be dropped if it can be without breaking any part of the build.
Quoted 11 lines
xen/include/public/arch-arm.h +1
-0@@ -197,6 +197,7 @@ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val) +#if defined(__XEN__) || defined(__XEN_TOOLS__)#if defined(__GNUC__) && !defined(__STRICT_ANSI__)/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ # define __DECL_REG (n64, n32) union { \
xen/include/public/arch-arm.h DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); · line 276
Quoted 4 lines
xen/include/public/arch-arm.h +1
-0@@ -272,6 +273,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);#undef __DECL_REG +#endif
If I was the maintainer of this code, I'd ask for the struct declaration to be moved (into the existing #if) rather than adding a 2nd #if.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Jan,
Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Quoted 12 lines
Quoted 12 lines
xen/include/public/arch-arm.h +1
-0@@ -197,6 +197,7 @@ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val) +#if defined(__XEN__) || defined(__XEN_TOOLS__)#if defined(__GNUC__) && !defined(__STRICT_ANSI__)/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ # define __DECL_REG (n64, n32) union { \@@ -272,6 +273,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);
Quoted 6 lines
xen/include/public/arch-arm.h DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); · line 276
Quoted 3 lines
xen/include/public/arch-arm.h +1
-0#undef __DECL_REG +#endif If I was the maintainer of this code, I'd ask for the struct declaration to be moved (into the existing #if) rather than adding a 2nd #if.
s/2nd/3rd/ ;)
The reason I haven't done that is git will generate a completely unrelated diff. So it makes quite difficult to understand the purpose of the patch.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 21.05.19 at 11:35, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define __XEN_TOOLS__, or if anyone does, they're on their own.
Quoted 19 lines
Quoted 12 lines
Quoted 12 lines
xen/include/public/arch-arm.h +1
-0@@ -197,6 +197,7 @@ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val) +#if defined(__XEN__) || defined(__XEN_TOOLS__)#if defined(__GNUC__) && !defined(__STRICT_ANSI__)/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ # define __DECL_REG (n64, n32) union { \@@ -272,6 +273,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);Quoted 6 lines
xen/include/public/arch-arm.h DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); · line 276
Quoted 3 lines
xen/include/public/arch-arm.h +1
-0#undef __DECL_REG +#endif If I was the maintainer of this code, I'd ask for the struct declaration to be moved (into the existing #if) rather than adding a 2nd #if.
Quoted 5 lines
s/2nd/3rd/ ;)
The reason I haven't done that is git will generate a completely unrelated diff. So it makes quite difficult to understand the purpose of the patch.
Well, as said - you're the maintainer. I wouldn't be bothered overly much by a strange diff that might result.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Jan,
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.05.19 at 11:35, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.
Thanks for the information. I will do a full build check.
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 12 lines
xen/include/public/arch-arm.h +1
-0@@ -197,6 +197,7 @@ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val) +#if defined(__XEN__) || defined(__XEN_TOOLS__)#if defined(__GNUC__) && !defined(__STRICT_ANSI__)/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ # define __DECL_REG (n64, n32) union { \xen/include/public/arch-arm.h DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); · line 276
Quoted 4 lines
xen/include/public/arch-arm.h +1
-0@@ -272,6 +273,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);#undef __DECL_REG +#endif If I was the maintainer of this code, I'd ask for the struct declaration to be moved (into the existing #if) rather than adding a 2nd #if.
Quoted 8 lines
Quoted 5 lines
s/2nd/3rd/ ;)
The reason I haven't done that is git will generate a completely unrelated diff. So it makes quite difficult to understand the purpose of the patch.
Well, as said - you're the maintainer. I wouldn't be bothered overly much by a strange diff that might result.
I will wait on Stefano's input.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 42 lines · Julien Grall
Hi Jan,
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 21.05.19 at 11:35, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the
check on
GNU_Cis still necessary. I am happy to send a follow-up patch
(or fold
in this one) if it can be removed.Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.Thanks for the information. I will do a full build check.
Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
Quoted 10 lines
xen/include/public/arch-arm.h +0
-0@@ -197,6 +197,7 @@ } while ( 0 )#define set_xen_guest_handle (hnd, val) set_xen_guest_handle_raw(hnd, val) +#if defined(__XEN__) || defined(__XEN_TOOLS__)#if defined(__GNUC__) && !defined(__STRICT_ANSI__)/* Anonymous union includes both 32- and 64-bit names (e.g., Quoted 8 lines
xen/include/public/arch-arm.h DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t); · line 274
Quoted 5 lines
r0/x0). */
# define __DECL_REG(n64, n32) union { \xen/include/public/arch-arm.h +0
-0@@ -272,6 +273,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);#undef __DECL_REG +#endifIf I was the maintainer of this code, I'd ask for the struct declaration to be moved (into the existing #if) rather than adding a 2nd #if.
s/2nd/3rd/ ;)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The reason I haven't done that is git will generate a completely unrelated diff. So it makes quite difficult to understand the purpose of the patch.
Well, as said - you're the maintainer. I wouldn't be bothered overly much by a strange diff that might result.
I will wait on Stefano's input.
Yes, please follow Jan's advice, thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Julien Grall
Hi Jan,
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.05.19 at 11:35, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.Thanks for the information. I will do a full build check.
I thought about this again, long term there are an attempt to build xen with other compiler not necessarily supporting GNU C extension.
While this would probably not be the only place that need to be reworked, we would have to revert part of this change. So I will not drop the #ifdef here.
I will resend the patch next week to give some time for more feedback.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 14:20, <[email protected]> wrote:
Quoted 17 lines · Julien Grall
Hi Jan,
Quoted 13 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 21.05.19 at 11:35, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.
Quoted 6 lines
Quoted 1 line
Thanks for the information. I will do a full build check.
I thought about this again, long term there are an attempt to build xen with other compiler not necessarily supporting GNU C extension.
While this would probably not be the only place that need to be reworked, we would have to revert part of this change. So I will not drop the #ifdef here.
Well, I don't know how it is for Arm, but on x86 we actually use the "extended" naming quite extensively, so building with a compiler that doesn't support this extension is not really an option there.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
(+Artem)
Hi Jan,
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 22.05.19 at 14:20, <[email protected]> wrote:
Quoted 18 lines · Julien Grall
Hi Jan,
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.05.19 at 11:35, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 20.05.19 at 20:12, <[email protected]> wrote:
As this is now Xen and tools only, I am wondering whether the check on
GNU_Cis still necessary. I am happy to send a follow-up patch (or fold in this one) if it can be removed.Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
I think this should be dropped if it can be without breaking any part of the build.
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.Thanks for the information. I will do a full build check.
Quoted 8 lines
Quoted 4 lines
I thought about this again, long term there are an attempt to build xen with other compiler not necessarily supporting GNU C extension.
While this would probably not be the only place that need to be reworked, we would have to revert part of this change. So I will not drop the #ifdef here.Well, I don't know how it is for Arm, but on x86 we actually use the "extended" naming quite extensively, so building with a compiler that doesn't support this extension is not really an option there.
For the Arm, I think only cpu_user_regs is using "extended" naming. It should be possible to remove it without too much trouble here.
@Artem, is there any restriction to use anonymous union in functional safety?
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello Julien, Jan
Quoted 51 lines · Julien Grall
(+Artem)
Hi Jan,
Quoted 41 lines · Jan Beulich
Quoted 33 lines
Quoted 3 lines
Quoted 3 lines
On 22.05.19 at 14:20, <
[email protected]Quoted 1 line
wrote:
Quoted 22 lines · Julien Grall
Hi Jan,
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 3 lines
Quoted 3 lines
On 21.05.19 at 11:35, <
[email protected]Quoted 1 line
wrote:
Quoted 13 lines · Jan Beulich
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
On 20.05.19 at 20:12, <
[email protected]Quoted 1 line
wrote:
As this is now Xen and tools only, I am
wondering whether the check on
GNU_Cis still necessary. I am happy to send a
follow-up patch (or fold
in this one) if it can be removed.I think this should be dropped if it can be without breaking any
part of the build.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.Thanks for the information. I will do a full build check.
Quoted 7 lines
I thought about this again, long term there are an attempt to build xen with
other compiler not necessarily supporting GNU C extension. While this would probably not be the only place that need to be reworked, we
would have to revert part of this change. So I will not drop the #ifdef here.Quoted 4 lines
Well, I don't know how it is for Arm, but on x86 we actually use the
"extended" naming quite extensively, so building with a compiler that doesn't support this extension is not really an option there.
Quoted 7 lines
For the Arm, I think only
cpu_user_regsis using "extended" naming. It should be
possible to remove it without too much trouble here.@Artem, is there any restriction to use anonymous union in functional safety?
In general, unions are not allowed in safety regulated programming, they always require a "deviation" - e.g. unions use for data packing is usually accepted disregarding anonymous or not.
Couple of other things I wanted to mention:
1. all protective programming standards e.g. MISRA recommend reducing visibility of functions and variables to reduce API surface ans thus need for test coverage and systematic fault probability.
2. current implementation xen tools are very hard to use in safety for many reasons, I hope to follow up on this soon...
-- Artem
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Artem,
Quoted 52 lines · Artem Mygaiev
Quoted 51 lines · Julien Grall
Quoted 41 lines · Jan Beulich
Quoted 33 lines
Quoted 3 lines
Quoted 3 lines
On 22.05.19 at 14:20, <
[email protected]Quoted 1 line
wrote:
Quoted 22 lines · Julien Grall
Hi Jan,
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 3 lines
Quoted 3 lines
On 21.05.19 at 11:35, <
[email protected]Quoted 1 line
wrote:
Quoted 13 lines · Jan Beulich
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
On 20.05.19 at 20:12, <
[email protected]Quoted 1 line
wrote:
As this is now Xen and tools only, I am
wondering whether the check on
GNU_Cis still necessary. I am happy to send a
follow-up patch (or fold
in this one) if it can be removed.I think this should be dropped if it can be without breaking any
part of the buildQuoted 6 lines
Quoted 4 lines
Quoted 1 line
This is because all the tools are part of xen.git, right?
Right - no-one else is supposed to define
__XEN_TOOLS__, or if anyone does, they're on their own.Thanks for the information. I will do a full build check.
Quoted 7 lines
I thought about this again, long term there are an attempt to build xen with
other compiler not necessarily supporting GNU C extension. While this would probably not be the only place that need to be reworked, we
would have to revert part of this change. So I will not drop the #ifdef here.Quoted 4 lines
Well, I don't know how it is for Arm, but on x86 we actually use the
"extended" naming quite extensively, so building with a compiler that doesn't support this extension is not really an option there.For the Arm, I think only
cpu_user_regsis using "extended" naming. It should be
possible to remove it without too much trouble here.
Quoted 7 lines
Quoted 3 lines
@Artem, is there any restriction to use anonymous union in functional safety?
In general, unions are not allowed in safety regulated programming, they always require a "deviation" - e.g. unions use for data packing is usually accepted disregarding anonymous or not.
That's good to know. I am going to keep for now the two definitions of __DECL_REG. We can remove them later on if it is not necessary.
Quoted 5 lines
Couple of other things I wanted to mention:
1. all protective programming standards e.g. MISRA recommend reducing visibility of functions and variables to reduce API surface ans thus need for test coverage and systematic fault probability.
In general, we want to limit the API exposed to guest as this is stable.
Let us know if you see other places where we could potentially reduce the API without impacting existing guest.
Quoted 2 lines
2. current implementation xen tools are very hard to use in safety for many reasons, I hope to follow up on this soon...
Thank you for the feedback!
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel