From: Kalesh Singh <kaleshsingh@google.com>
Cc: mark.rutland@arm.com, broonie@kernel.org, will@kernel.org,
maz@kernel.org, qperret@google.com, tabba@google.com,
surenb@google.com, kernel-team@android.com,
Kalesh Singh <kaleshsingh@google.com>,
James Morse <james.morse@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Peter Collingbourne <pcc@google.com>,
Alexei Starovoitov <ast@kernel.org>,
"Madhavan T. Venkataraman" <madvenka@linux.microsoft.com>,
Andrew Jones <drjones@redhat.com>,
Marco Elver <elver@google.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Keir Fraser <keirf@google.com>,
Zenghui Yu <yuzenghui@huawei.com>,
linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/5] KVM: arm64: Add hypervisor overflow stack
Date: Mon, 2 May 2022 12:12:03 -0700 [thread overview]
Message-ID: <20220502191222.4192768-4-kaleshsingh@google.com> (raw)
In-Reply-To: <20220502191222.4192768-1-kaleshsingh@google.com>
Allocate and switch to 16-byte aligned secondary stack on overflow. This
provides us stack space to better handle overflows; and is used in
a subsequent patch to dump the hypervisor stacktrace.
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
---
arch/arm64/kernel/stacktrace.c | 3 +++
arch/arm64/kvm/hyp/nvhe/host.S | 9 ++-------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index a84e38d41d38..f346b4c66f1c 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -242,4 +242,7 @@ noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry,
unwind(task, &state, consume_entry, cookie);
}
+#else /* __KVM_NVHE_HYPERVISOR__ */
+DEFINE_PER_CPU(unsigned long [PAGE_SIZE/sizeof(long)], overflow_stack)
+ __aligned(16);
#endif /* !__KVM_NVHE_HYPERVISOR__ */
diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
index 09b5254fb497..1cd2de4f039e 100644
--- a/arch/arm64/kvm/hyp/nvhe/host.S
+++ b/arch/arm64/kvm/hyp/nvhe/host.S
@@ -179,13 +179,8 @@ SYM_FUNC_END(__host_hvc)
b hyp_panic
.L__hyp_sp_overflow\@:
- /*
- * Reset SP to the top of the stack, to allow handling the hyp_panic.
- * This corrupts the stack but is ok, since we won't be attempting
- * any unwinding here.
- */
- ldr_this_cpu x0, kvm_init_params + NVHE_INIT_STACK_HYP_VA, x1
- mov sp, x0
+ /* Switch to the overflow stack */
+ adr_this_cpu sp, overflow_stack + PAGE_SIZE, x0
b hyp_panic_bad_stack
ASM_BUG()
--
2.36.0.464.gb9c8b46e94-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-05-02 19:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 19:12 [PATCH v2 0/5] KVM nVHE Hypervisor stack unwinder Kalesh Singh
2022-05-02 19:12 ` [PATCH v2 1/5] KVM: arm64: Factor out common stack unwinding logic Kalesh Singh
2022-05-04 13:41 ` Mark Brown
2022-05-02 19:12 ` [PATCH v2 2/5] KVM: arm64: Compile stacktrace.nvhe.o Kalesh Singh
2022-05-04 14:16 ` Mark Brown
2022-05-04 16:02 ` Kalesh Singh
2022-05-02 19:12 ` Kalesh Singh [this message]
2022-05-02 19:12 ` [PATCH v2 4/5] KVM: arm64: Allocate shared stacktrace pages Kalesh Singh
2022-05-02 19:12 ` [PATCH v2 5/5] KVM: arm64: Unwind and dump nVHE hypervisor stacktrace Kalesh Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220502191222.4192768-4-kaleshsingh@google.com \
--to=kaleshsingh@google.com \
--cc=alexandru.elisei@arm.com \
--cc=ast@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=drjones@redhat.com \
--cc=elver@google.com \
--cc=james.morse@arm.com \
--cc=keirf@google.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madvenka@linux.microsoft.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mhiramat@kernel.org \
--cc=pcc@google.com \
--cc=qperret@google.com \
--cc=surenb@google.com \
--cc=suzuki.poulose@arm.com \
--cc=tabba@google.com \
--cc=wangkefeng.wang@huawei.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).