Commit e0ffcf3f authored by Heiko Carstens's avatar Heiko Carstens

s390/stack: add union to reflect kvm stack slot usages

Add a union which describes how the empty stack slots are being used
by kvm and perf. This should help to avoid another bug like the one
which was fixed with commit c9bfb460 ("s390/perf: obtain sie_block
from the right address").
Reviewed-by: default avatarNico Boehr <nrb@linux.ibm.com>
Tested-by: default avatarNico Boehr <nrb@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent f037acb4
...@@ -39,7 +39,15 @@ static inline bool on_stack(struct stack_info *info, ...@@ -39,7 +39,15 @@ static inline bool on_stack(struct stack_info *info,
* Kernel uses the packed stack layout (-mpacked-stack). * Kernel uses the packed stack layout (-mpacked-stack).
*/ */
struct stack_frame { struct stack_frame {
unsigned long empty[9]; union {
unsigned long empty[9];
struct {
unsigned long sie_control_block;
unsigned long sie_savearea;
unsigned long sie_reason;
unsigned long sie_flags;
};
};
unsigned long gprs[10]; unsigned long gprs[10];
unsigned long back_chain; unsigned long back_chain;
}; };
......
...@@ -58,10 +58,10 @@ int main(void) ...@@ -58,10 +58,10 @@ int main(void)
OFFSET(__SF_BACKCHAIN, stack_frame, back_chain); OFFSET(__SF_BACKCHAIN, stack_frame, back_chain);
OFFSET(__SF_GPRS, stack_frame, gprs); OFFSET(__SF_GPRS, stack_frame, gprs);
OFFSET(__SF_EMPTY, stack_frame, empty[0]); OFFSET(__SF_EMPTY, stack_frame, empty[0]);
OFFSET(__SF_SIE_CONTROL, stack_frame, empty[1]); OFFSET(__SF_SIE_CONTROL, stack_frame, sie_control_block);
OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty[2]); OFFSET(__SF_SIE_SAVEAREA, stack_frame, sie_savearea);
OFFSET(__SF_SIE_REASON, stack_frame, empty[3]); OFFSET(__SF_SIE_REASON, stack_frame, sie_reason);
OFFSET(__SF_SIE_FLAGS, stack_frame, empty[4]); OFFSET(__SF_SIE_FLAGS, stack_frame, sie_flags);
DEFINE(STACK_FRAME_OVERHEAD, sizeof(struct stack_frame)); DEFINE(STACK_FRAME_OVERHEAD, sizeof(struct stack_frame));
BLANK(); BLANK();
/* idle data offsets */ /* idle data offsets */
......
...@@ -30,7 +30,7 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs) ...@@ -30,7 +30,7 @@ static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs)
if (!stack) if (!stack)
return NULL; return NULL;
return (struct kvm_s390_sie_block *)stack->empty[1]; return (struct kvm_s390_sie_block *)stack->sie_control_block;
} }
static bool is_in_guest(struct pt_regs *regs) static bool is_in_guest(struct pt_regs *regs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment