-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the handling of SVE state as part of threadsuspend #105059
Changes from all commits
4020d91
0a9be93
3470969
3b542af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1844,11 +1844,11 @@ typedef struct _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY { | |
#define CONTEXT_EXCEPTION_REQUEST 0x40000000L | ||
#define CONTEXT_EXCEPTION_REPORTING 0x80000000L | ||
|
||
#define CONTEXT_XSTATE (CONTEXT_ARM64 | 0x40L) | ||
#define CONTEXT_ARM64_XSTATE (CONTEXT_ARM64 | 0x20L) | ||
#define CONTEXT_XSTATE CONTEXT_ARM64_XSTATE | ||
|
||
#define XSTATE_SVE (0) | ||
|
||
#define XSTATE_MASK_SVE (UI64(1) << (XSTATE_SVE)) | ||
#define XSTATE_ARM64_SVE (2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there might need to be an additional set of changes in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That shouldn't be related to the Windows handling being added, however, so I've left it to a future PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how it could be incorrect when there is an assert that it matches the sizeof (T_CONTEXT) in the asmconstants.h. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The consideration is that SVE registers don’t have a fixed width and so the current logic asserting the size statically is already wrong (it’s assuming SVE registers are exactly 128-bits, when they can be up to 2048 bits) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's true, but the constant is to represent the size of the CONTEXT structure and that's fixed for now, so it is correct. I believe that when we'll be adding support for longer SVE registers, we should finally move to the Windows way of separate context and extended context, so the SIZEOF__CONTEXT would still be constant - and it will actually match Windows one after that. |
||
#define XSTATE_MASK_ARM64_SVE (UI64(1) << (XSTATE_ARM64_SVE)) | ||
|
||
// | ||
// This flag is set by the unwinder if it has unwound to a call | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,13 +18,14 @@ | |
|
||
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) | ||
|
||
#define CONTEXT_XSTATE_BIT (6) | ||
#define CONTEXT_XSTATE (1 << CONTEXT_XSTATE_BIT) | ||
#define CONTEXT_ARM64_XSTATE_BIT (5) | ||
#define CONTEXT_ARM64_XSTATE (1 << CONTEXT_XSTATE_BIT) | ||
|
||
#define XSTATE_SVE_BIT (0) | ||
|
||
#define XSTATE_MASK_SVE (UI64(1) << (XSTATE_SVE)) | ||
#define CONTEXT_XSTATE_BIT CONTEXT_ARM64_XSTATE_BIT | ||
#define CONTEXT_XSTATE CONTEXT_ARM64_XSTATE | ||
|
||
#define XSTATE_ARM64_SVE_BIT (2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The general The win32 naming convention here is then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So wrong bit was set for linux in #103801 as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. I don't think it would technically cause problems because we're just emulating the CONTEXT struct and it doesn't actually have to match the Win32 struct 1-to-1 (since its only going to be other pal APIs consuming it) But it's overall better/simpler to ensure they match so we don't end up with potential conflicts or other issues. The best option here would be to just consume the native There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In fact, it does not match the Win32 struct 1-to-1: #103801 (comment)
+1. The Windows CONTEXT structure is very entrenched throughout CoreCLR VM. |
||
#define XSTATE_MASK_ARM64_SVE (UI64(1) << (XSTATE_ARM64_SVE_BIT)) | ||
|
||
#define CONTEXT_ContextFlags 0 | ||
#define CONTEXT_Cpsr CONTEXT_ContextFlags+4 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows doesn't define
CONTEXT_XSTATE
for arm64, it only definesCONTEXT_ARM64_XSTATE
. So this is primarily to avoid a lot of other ifdefs elsewhere in the file.