From patchwork Tue Jun 7 16:50:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 12872139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0523DC43334 for ; Tue, 7 Jun 2022 16:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=9c2WnyknyZpI0sIMgY4t7rP6a06fbu4hPiA9fVH9E00=; b=AHV UydptsbcXXwjJ3I8ZKuOFDOf/IqFYfLtmz6Jw6MCD90fpOSxo2g9PrvSwbHxPBMk9xNWTPat69D9y b9uyQHh+ZbKiHMRPLLrp64HtXhsjixgtoHKAyW7Ka+qpyNgZqDLWlW97/qQ3aOja/N74whIXr9iJD 0kx3iE7fVf50cIqw7HajzDy/FIq3nOikkopIWqXPa/83y+1VSMO4UrVBfdN7GRLEszX97PJVFnhSi B4e8NXO+c/Km9wgXHodgh3+ynZR46EOPbq14rnRsgf1efW7byXJkyucl4RXO25N13dbR3xce4XDLc ajzKlsKtw78rF0d2Zo9iMioNbejJ3vw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nycQP-008Tii-DD; Tue, 07 Jun 2022 16:51:25 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nycQL-008TgS-PF for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2022 16:51:23 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-2f7dbceab08so151799387b3.10 for ; Tue, 07 Jun 2022 09:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=o0iZsHQ0w1pzGlhdlimhaec4r2w9hzpwWG2GpMn3EMQ=; b=OmbO1I14NanBrKt0FdpC2NTCDJpwz34ZNg+udo7ufulw4wzH8+6qdwXmzYiRud8dgl H4fGd9ztV7KGrTzVhGt0BfeRhSMqmrEzAXKdjHlXNA8QMGX11NdyFs69PTFZuos98kzq UuMzL9aKp3DDEeBnd6ry89HY9wlen6rOWsSYi6ecHKyigI+ITpBGik/BsMoJ4zA2uH2Q ZWvpcg89RtVbZ//Dr6NHFj6hkIkOkYWGgZQHoVsMXwslo48H2dhOd6ACZD+Z5TwKkWUh fPKaPVoeSC5DDDBZAFB2wHobe264YygSL7/nPsaMEx50lZwXm9Ab0CyQLzyMVVSSqC+7 sHFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=o0iZsHQ0w1pzGlhdlimhaec4r2w9hzpwWG2GpMn3EMQ=; b=rJKbUlea7pYWTGIt6hYS7UwWATlYja1Y7L6F91qzt02H6OOfBEIB0SCHGbK9k/BgGY PQDtKNtJvt5QkFtKNLvzVzVwBnZx553ZxCqdAUnB4zYSw2hbx6mWj39liI+EkaMRNG1z VUUHhKoNsNVt4NjS0NcG3zBiF2rAeWPcdbC6pvmHFVQpTdFqILdkyp4P2WF8MboD3G2T nMOVxsWNmqqKJ7Y0TZwCjeNacBI/wb5EwopMAKdKMWSZygEDdb+G5SLlaHfWCwls4EjI uCZo/YMmSRlBh6Pg3KmDQYAifFPI+p2rBXGHmN6s6c01Mi0omkh2x+xgc8CMVyWBRrbu 6VcQ== X-Gm-Message-State: AOAM531AvR2nk4476smwWSNqxIEr/el1+oT1SIUwPX13raCbto1pjYTr n1Pf5kOruo1vH96nHXM8dX9LcpTvzoprDKsWyA== X-Google-Smtp-Source: ABdhPJysQZgWCIBcQcZgbAPodFjVXMmm6FLeZKxkdgidkgdm9q/dWOw/xW0kfcLA9ACqPsqnVIIHO6siNslKHvzWdA== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:7091:8518:ec1e:93dc]) (user=kaleshsingh job=sendgmr) by 2002:a81:1615:0:b0:30c:245e:71ff with SMTP id 21-20020a811615000000b0030c245e71ffmr33123428yww.406.1654620676147; Tue, 07 Jun 2022 09:51:16 -0700 (PDT) Date: Tue, 7 Jun 2022 09:50:42 -0700 Message-Id: <20220607165105.639716-1-kaleshsingh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog Subject: [PATCH v3 0/5] KVM nVHE Hypervisor stack unwinder From: Kalesh Singh To: mark.rutland@arm.com, broonie@kernel.org, maz@kernel.org Cc: will@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, tjmercier@google.com, kernel-team@android.com, Kalesh Singh , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Masami Hiramatsu , Alexei Starovoitov , "Madhavan T. Venkataraman" , Peter Zijlstra , Andrew Jones , Kefeng Wang , Keir Fraser , Zenghui Yu , Ard Biesheuvel , Oliver Upton , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220607_095121_858775_12DFE372 X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, This v3 of the nVHE hypervisor stack unwinder. The previous versions were posted at: v2: https://lore.kernel.org/r/20220502191222.4192768-1-kaleshsingh@google.com/ v1: https://lore.kernel.org/r/20220427184716.1949239-1-kaleshsingh@google.com/ The version is rebased on 5.19-rc1 which resolves the previously unmerged dependencies, and adds some reviewed tags from Mark Brown. The cover letter are copied below for convenience. Thanks, Kalesh ------- This new version of the unwinder splits the unwinding and dumping of the stack between the hypervisor and host: - The hypervisor unwinds its stack and dumps the address entries into a page shared with the host. - The host then symnolizes and prints the hyp stacktrace from the shared page. The new approach doesn't depend on CONFIG_NVHE_EL2_DEBUG, and allows dumping hyp stacktraces in prodcution environments (!CONFIG_NVHE_EL2_DEBUG). arm64/kernel/stacktrace.c is compiled twice: stacktrace.o for the host kernel and stacktrace.nvhe.o for the hypervisor. This allows reusing most of the host unwinding logic in the nVHE hypervisor. Kalesh Singh (5): KVM: arm64: Factor out common stack unwinding logic KVM: arm64: Compile stacktrace.nvhe.o KVM: arm64: Add hypervisor overflow stack KVM: arm64: Allocate shared stacktrace pages KVM: arm64: Unwind and dump nVHE hypervisor stacktrace arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/stacktrace.h | 58 +++++++++-- arch/arm64/kernel/stacktrace.c | 151 +++++++++++++++++++++++----- arch/arm64/kvm/arm.c | 34 +++++++ arch/arm64/kvm/handle_exit.c | 4 + arch/arm64/kvm/hyp/nvhe/Makefile | 3 +- arch/arm64/kvm/hyp/nvhe/host.S | 9 +- arch/arm64/kvm/hyp/nvhe/setup.c | 11 ++ arch/arm64/kvm/hyp/nvhe/switch.c | 4 + 9 files changed, 231 insertions(+), 44 deletions(-) base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56