From patchwork Wed Apr 27 18:46:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 12829335 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 9437DC433EF for ; Wed, 27 Apr 2022 18:48:35 +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:From:Subject:Mime-Version:Message-Id :Date:Reply-To: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=zNBXtPfz3f3oJYL0tzhQk/Qb1SEkiI3IKYrzAqCh35I=; b=CylMajpFcqdKjI heHuJYoECL0JQeza/b2/+QFrZlPH3bVUTph80/jGaNgKI8BKNkhIm62pDZTh3hvBtCYtBpmH+r8Vu t8ZFPakJoccm7WCEqrnMBOvpXsOjaCGg+Z13if7Rf19lfDJUGJr6wxuAvN0TvgoFMOhLtZ27K/MJz hRaeI4aRY+inYzjJ1Nrn6kbrXX7ACo+P+/mwaIgxJvAL2B85rgqn3UUCY2KIXtQ8xx/gxLkm0TD9c ka36p3cVRTNt71ck6F5PevbYLdclIiF0DcWNDL8qqvM0JoV+KOtd7mqo0+hruzNqztTo2kK7jJ1Sx +hPtns6mWot3DAu4e1tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njmhF-0037OA-AY; Wed, 27 Apr 2022 18:47:29 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njmhC-0037MR-Ci for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2022 18:47:27 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-2f7dbceab08so24206107b3.10 for ; Wed, 27 Apr 2022 11:47:23 -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:cc; bh=cjRVYKae2NiccbEodN7hWWhpE8I2abxiXPIpZLMEvCU=; b=QYrapOUYASQ9wPScJ0plESi+FWuJgR3FWaISnPDEs6022eaR3vV/BPqwUR64TdyM+l Wok4jTZejpYCOeFYt2K4Q7995CZTXK6AfZT5+erp8eD13WZ1cOtbQF+ub5TmTdkfE10f ejzEp4XbKTmkExH/AsNZ6U2v3rpV393XABjlNHOZgfwoYRebwFUnQxrYBDPQR2R4RNl4 7t9/68MkDJ/aZnHETqiwGR5Bq9aBcXVcIsMrkulvfgWJcVmPBdhyw9bnLzgDP78TQV1v j4+qZqHSOufl+3FNjWGD4rCP+FnNVxfgvqFg2GfS3GKX3eJ2UXeBNW6EL8bVS2ETLPsR XiAQ== 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:cc; bh=cjRVYKae2NiccbEodN7hWWhpE8I2abxiXPIpZLMEvCU=; b=OSj4KgF/VPEcnIuri/j15LBXTxCGiE6o0J1hPrNiSrATHXnrHkYWlko4XpOWerBlkW GJAcRrsAy9eTIZQe6SIBzJBMZCg/xQjroXHB7OuYBCb6OjlIGWMi8dzSXiPoNV4z/Jd1 cJIVvKPiL1CqICGJ5RCrIYVhjxDmNYQSFfg5jpcL4HfQrfxgDAbxdxxmljz1p3cFJwe6 u1st1bqce3d1LrGg93+RBFq9mr78DAzdwgTSxOfm7dG5LFkk2i8oUFRis3XkFu8KOL64 XcIfPiRWe8AfA/faLWO+Tz7N+TgPGWeh1XnWCTRsHFQtkERWAOaYbS8Ml/Uqju3yyHjk NBUQ== X-Gm-Message-State: AOAM531I/prgV0KUrVwItmjTr+bb2Ni8XnAdr4qvLgQsG5pUPYSsEWR6 hVtA8wTBeTiAfJXwd07De9qO8dWTwjkuUc8jNw== X-Google-Smtp-Source: ABdhPJxoGqPPyZOA0Xpsq9Ey5x+bCBFLO5TtbxyriEJN+TpNdW/YWUQEtF/V42SaDoZ/QV2QlLorCHfiJ3QQObW7wA== X-Received: from kaleshsingh.mtv.corp.google.com ([2620:15c:211:200:16ec:6da0:8cc5:5f24]) (user=kaleshsingh job=sendgmr) by 2002:a25:a148:0:b0:641:d14b:ddd3 with SMTP id z66-20020a25a148000000b00641d14bddd3mr28186851ybh.402.1651085243194; Wed, 27 Apr 2022 11:47:23 -0700 (PDT) Date: Wed, 27 Apr 2022 11:46:55 -0700 Message-Id: <20220427184716.1949239-1-kaleshsingh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog Subject: [PATCH 0/4] KVM nVHE Hypervisor stack unwinder From: Kalesh Singh Cc: mark.rutland@arm.com, will@kernel.org, maz@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, kernel-team@android.com, Kalesh Singh , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Mark Brown , Masami Hiramatsu , Peter Collingbourne , Alexei Starovoitov , "Madhavan T. Venkataraman" , Andrew Jones , Keir Fraser , Zenghui Yu , Kefeng Wang , 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-20220427_114726_451702_77EA01B6 X-CRM114-Status: GOOD ( 13.47 ) 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 series is based on arm64 for-next/core and is also dependent on the series at [1]. A previous version of hypervisor stack unwinding was included in the series at [2]. This new version of the unwinder splits the unwinding and dumping of the stack between the hypervisor and host: - The hyperviosr 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. [1] https://lore.kernel.org/r/20220420214317.3303360-1-kaleshsingh@google.com/ [2] https://lore.kernel.org/r/20220314200148.2695206-1-kaleshsingh@google.com/ Thanks, Kalesh Kalesh Singh (4): 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(-)