Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp398405imi; Thu, 21 Jul 2022 03:21:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNZycQWRoKXc0Tkmd6fpSJEJiZ24jwCw7Z4BqLIrs+s0X8bctM5NYfh2s2gqZ0GRDbZW7F X-Received: by 2002:a05:6830:1e98:b0:61c:8438:5aaa with SMTP id n24-20020a0568301e9800b0061c84385aaamr12844382otr.1.1658398878453; Thu, 21 Jul 2022 03:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658398878; cv=none; d=google.com; s=arc-20160816; b=wnSkxX1aG7wM/8k6RUphw/EETjrB1XdJCnHVWFkHiP71u2TMS7kbFnE0eoU4wf7XSl Rqlhst/neSAxJiuAFleoAXwP584HgLSJ46JOeCNNE5D5ijNhhQLS4fc0ZpXSB/j0gAcU IVKIM0fdaaNOlGt6sWOd4vSCidn3FrVlgSnbBDu50rQ/dXHB3hjek+msT1dgm+WR+WlH ppPlxs+r9GaK0ji0rw+3occG3pGakqkI20qioaxzSsMxzv1d0MrbL5G1lYaGO6s6GCBs 1oi/5eYbjswPQSkCVmFMZUMf/OPbixZ7u9/D6gR+LwmteBBFDC6Eb/epyGGvpCdTw5rR V4vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AERHviI4+0lw5BuAPlcVYCLTAkZUrRuqNMfCTEsNzwA=; b=TQcAmOtN36ATrx66foc9PAuefqXGP1K4zaBuhrDYl4ycbzn7TV0O+O7tjA30Xjaqcx /ypGqkWWvgBq+8f6BlqL7pLLQWkwfPOCdrJE747jVI5m/Rk80SsyBLR8RZn0eo7UDwNp 9MRW8L/BPNXp9B72+bI3gaYZv/Tuic+COQjh2UogUNNk+LslgunXGZQMRtc/JvYDPLy1 UOJGODB4dgVKu96ul3CXBz2rhsSc4gCRV1yYGwsxWV2IocBoGkvl5+vYoi3oQbNWNu7R WFB3MpKHJW8wY4/X9TNEwDsu1LR4n0qbe5ZrklqNqx0XHMkpBY6JwMtFE4918f3FCn6O AQQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IR6NulFx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q3-20020a056870328300b00101cb06bbb2si1141331oac.20.2022.07.21.03.21.05; Thu, 21 Jul 2022 03:21:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IR6NulFx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232938AbiGUJ6t (ORCPT + 99 others); Thu, 21 Jul 2022 05:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232917AbiGUJ6q (ORCPT ); Thu, 21 Jul 2022 05:58:46 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A2E681B1E for ; Thu, 21 Jul 2022 02:58:45 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id y8so1503337eda.3 for ; Thu, 21 Jul 2022 02:58:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AERHviI4+0lw5BuAPlcVYCLTAkZUrRuqNMfCTEsNzwA=; b=IR6NulFxPs9l1r3DCpl0GsssXvQTjDkW96EKXvU5yfQ1DuHCOFid3C9fRUblWfinVN jkvwy1uGlqg3qi1PwdrEdMPqIL3ytQH2v0fHrO5119cVr6AboHr/9ipOsvIIy0ywQHCV cGfTR/4mknReSjL2XtzUhWNhs/5mBjOHIP41w6fFXI5HJ+HkL3kaFjoIEBDQOoR+pRAi dw9YmlE8NGbcSxgBt3tpMHWpqOm0PxJBC2m0cuKVU5YYdeUYcz2k0ibc2APu9p092jI6 q282U60M68ovgG6MLOJkrDogSHMg7/8e9leob//39z5sF9nva4vx2dWLM7ldCfXqQNVv ZdyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AERHviI4+0lw5BuAPlcVYCLTAkZUrRuqNMfCTEsNzwA=; b=peeo/QmcqNYfv6fTfecn7T9q9nVy7EHaKk2zN2V2Dsh8MxD8SlcdIwg9l4xieaNVrG 85zia+QO7yLSqi8SuXGjvwvGURlMwdZzb8ZOzrg8Dsx+rXrW85NT7Oz3U2Q+yqxl0OHT PwpUOEGO6Z83J32BRRAd5SkOfyfVlOMEoF7fx9hTO6gfUFpk67vrNQTNvdvrYG4N5dBk nlmjiZiUwKa2/qL8JZi6YJ0Ec8JlBePdI5PuEjbNkNmby2N5hOBFF8VdwQTiS+2VKvSu UBtN2AZC2JfVfQJdtVOLuLwf/NpBk/oM3f4I5pCRgiEU/5E0VAUvEe9/xNGggifntF+e HlLw== X-Gm-Message-State: AJIora8ai2E7T3FK3z+f62o3tFbGN054kHOn0BtPeHw0Zx5i8l996p/y xNFhb9q5btwObvZbpG4INamUX8H0JIQNgmVNLG8YJw== X-Received: by 2002:aa7:cd86:0:b0:43a:26e3:d333 with SMTP id x6-20020aa7cd86000000b0043a26e3d333mr56365170edv.178.1658397523919; Thu, 21 Jul 2022 02:58:43 -0700 (PDT) MIME-Version: 1.0 References: <20220721055728.718573-1-kaleshsingh@google.com> <20220721055728.718573-11-kaleshsingh@google.com> In-Reply-To: <20220721055728.718573-11-kaleshsingh@google.com> From: Fuad Tabba Date: Thu, 21 Jul 2022 10:58:04 +0100 Message-ID: Subject: Re: [PATCH v5 10/17] KVM: arm64: Stub implementation of pKVM HYP stack unwinder To: Kalesh Singh Cc: maz@kernel.org, mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, will@kernel.org, qperret@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, wangkefeng.wang@huawei.com, elver@google.com, keirf@google.com, yuzenghui@huawei.com, ardb@kernel.org, oupton@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kalesh, On Thu, Jul 21, 2022 at 6:57 AM Kalesh Singh wrote: > > Add some stub implementations of protected nVHE stack unwinder, for > building. These are implemented later in this series. > > Signed-off-by: Kalesh Singh > --- Reviewed-by: Fuad Tabba Cheers, /fuad > > Changes in v5: > - Mark unwind_next() as inline, per Marc > > arch/arm64/include/asm/stacktrace/nvhe.h | 59 ++++++++++++++++++++++++ > arch/arm64/kvm/hyp/nvhe/stacktrace.c | 3 +- > 2 files changed, 60 insertions(+), 2 deletions(-) > create mode 100644 arch/arm64/include/asm/stacktrace/nvhe.h > > diff --git a/arch/arm64/include/asm/stacktrace/nvhe.h b/arch/arm64/include/asm/stacktrace/nvhe.h > new file mode 100644 > index 000000000000..80d71932afff > --- /dev/null > +++ b/arch/arm64/include/asm/stacktrace/nvhe.h > @@ -0,0 +1,59 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * KVM nVHE hypervisor stack tracing support. > + * > + * The unwinder implementation depends on the nVHE mode: > + * > + * 1) pKVM (protected nVHE) mode - the host cannot directly access > + * the HYP memory. The stack is unwinded in EL2 and dumped to a shared > + * buffer where the host can read and print the stacktrace. > + * > + * Copyright (C) 2022 Google LLC > + */ > +#ifndef __ASM_STACKTRACE_NVHE_H > +#define __ASM_STACKTRACE_NVHE_H > + > +#include > + > +static inline bool on_accessible_stack(const struct task_struct *tsk, > + unsigned long sp, unsigned long size, > + struct stack_info *info) > +{ > + return false; > +} > + > +#ifdef __KVM_NVHE_HYPERVISOR__ > +/* > + * Protected nVHE HYP stack unwinder > + * > + * In protected mode, the unwinding is done by the hypervisor in EL2. > + */ > + > +#ifdef CONFIG_PROTECTED_NVHE_STACKTRACE > +static inline bool on_overflow_stack(unsigned long sp, unsigned long size, > + struct stack_info *info) > +{ > + return false; > +} > + > +static inline int notrace unwind_next(struct unwind_state *state) > +{ > + return 0; > +} > +NOKPROBE_SYMBOL(unwind_next); > +#else /* !CONFIG_PROTECTED_NVHE_STACKTRACE */ > +static inline bool on_overflow_stack(unsigned long sp, unsigned long size, > + struct stack_info *info) > +{ > + return false; > +} > + > +static inline int notrace unwind_next(struct unwind_state *state) > +{ > + return 0; > +} > +NOKPROBE_SYMBOL(unwind_next); > +#endif /* CONFIG_PROTECTED_NVHE_STACKTRACE */ > + > +#endif /* __KVM_NVHE_HYPERVISOR__ */ > +#endif /* __ASM_STACKTRACE_NVHE_H */ > diff --git a/arch/arm64/kvm/hyp/nvhe/stacktrace.c b/arch/arm64/kvm/hyp/nvhe/stacktrace.c > index 69e65b457f1c..96c8b93320eb 100644 > --- a/arch/arm64/kvm/hyp/nvhe/stacktrace.c > +++ b/arch/arm64/kvm/hyp/nvhe/stacktrace.c > @@ -4,8 +4,7 @@ > * > * Copyright (C) 2022 Google LLC > */ > -#include > -#include > +#include > > DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack) > __aligned(16); > -- > 2.37.0.170.g444d1eabd0-goog >