Skip to content

Commit efc64d7

Browse files
tw4452852wenlingz
authored andcommitted
hv: fix host call stack dump issue
As scheduler uses its own stack for now, there is no need to check stack validity, so wipe it out. Tracked-On: #2455 Signed-off-by: Tw <wei.tan@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 5214a60 commit efc64d7

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

hypervisor/arch/x86/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{ \
1414
asm volatile ("movq %0, %%rsp\n" \
1515
"pushq %1\n" \
16-
"call *%2\n" \
16+
"jmpq *%2\n" \
1717
: \
1818
: "r"(rsp), "rm"(SP_BOTTOM_MAGIC), "a"(to)); \
1919
}

hypervisor/debug/dump.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void dump_guest_context(uint16_t pcpu_id)
186186

187187
static void show_host_call_trace(uint64_t rsp, uint64_t rbp_arg, uint16_t pcpu_id)
188188
{
189-
uint64_t rbp = rbp_arg;
189+
uint64_t rbp = rbp_arg, return_address;
190190
uint32_t i = 0U;
191191
uint32_t cb_hierarchy = 0U;
192192
uint64_t *sp = (uint64_t *)rsp;
@@ -201,11 +201,6 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp_arg, uint16_t pcpu_i
201201
printf("\r\n");
202202

203203
printf("Host Call Trace:\r\n");
204-
if ((rsp >
205-
(uint64_t)&per_cpu(stack, pcpu_id)[CONFIG_STACK_SIZE - 1])
206-
|| (rsp < (uint64_t)&per_cpu(stack, pcpu_id)[0])) {
207-
return;
208-
}
209204

210205
/* if enable compiler option(no-omit-frame-pointer) the stack layout
211206
* should be like this when call a function for x86_64
@@ -220,16 +215,13 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp_arg, uint16_t pcpu_i
220215
*
221216
* if the address is invalid, it will cause hv page fault
222217
* then halt system */
223-
while ((rbp <=
224-
(uint64_t)&per_cpu(stack, pcpu_id)[CONFIG_STACK_SIZE - 1])
225-
&& (rbp >= (uint64_t)&per_cpu(stack, pcpu_id)[0])
226-
&& (cb_hierarchy < CALL_TRACE_HIERARCHY_MAX)) {
227-
printf("----> 0x%016llx\r\n",
228-
*(uint64_t *)(rbp + sizeof(uint64_t)));
229-
if (*(uint64_t *)(rbp + (2U*sizeof(uint64_t)))
230-
== SP_BOTTOM_MAGIC) {
218+
while (cb_hierarchy < CALL_TRACE_HIERARCHY_MAX) {
219+
return_address = *(uint64_t *)(rbp + sizeof(uint64_t));
220+
if (return_address == SP_BOTTOM_MAGIC) {
231221
break;
232222
}
223+
printf("----> 0x%016llx\r\n",
224+
*(uint64_t *)(rbp + sizeof(uint64_t)));
233225
rbp = *(uint64_t *)rbp;
234226
cb_hierarchy++;
235227
}

0 commit comments

Comments
 (0)