Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3039320imw; Mon, 18 Jul 2022 00:22:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vNp8eDBnhiIAMgKpW73Kfo9uyCOyNqmeaRVsi8hKK4JjBjtHkjbhD+6A0vj9mlKGioysal X-Received: by 2002:a17:907:9693:b0:72f:9cc:63d7 with SMTP id hd19-20020a170907969300b0072f09cc63d7mr11075799ejc.661.1658128927440; Mon, 18 Jul 2022 00:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658128927; cv=none; d=google.com; s=arc-20160816; b=KyShxL2lNT56Y8uoGUIQXZLm1jCsQSMOA6Vg2APcDiFdU+cF63+W3ZUMBuXegFUVBM DJsXpFxmdV0xdPTmn+AB92sQby32toD8MJYyO+iovUhhHsJsN7GvKMHafnSh+ty0qnaY Sv1i03+Cqv3m+nkraYJ2kKi5tTtw+U8+RXoYgEpe26q+2onnKGkSIU1EnrEaGIH0dexd DybZ/4PFwyWsUxptkhTkNY/TCFWz7bXtecwDeoKNqTF1rtXo4jurFojqeSEj7QR7zmU+ RZWQ7s0gNwGaODdbjEElHu2zi5RqQo/f9VRrAGWD3vRjTWNO8mbFCN3WNEjb4Ej+VYVA Zxcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=bFT32cP697OKE4ifC4sYgB5VGBm+wI3dUw02qYBud9Y=; b=lQRC5+YSjS8Qt/mLWj7KBNYbR5sG1noKhCvSgbBmnqDvhvTX0TyLXkxu2YFlhIaDuH CRxm+LqLAlb778IBhG/br5+1DReTwBw7V72fs5pkK8CI6J2s4T07AY+ZCi/tgHDiI8KP do6022hKVLU66xiUJnTo7ok4hHpsJ5cbncnZnEv/IJWAqlitnSBpNONmxs8Q4DlUYXU+ 2BqkLpEYn4zorXQCUvxtyELy+wZbK2C8EnB7IyIGQOWzPWkMLQW7wtIFY8K7IcxNLwKc PdfC+ISWCYdynmQ/20nNRPtQI/CXvY/D4M44vPOYBEzMzwv+Yo/rcVxBKmbs5K+oZ8uG XSEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C0f6yg4a; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp23-20020a1709073e1700b0072b3b8d31f8si16963463ejc.63.2022.07.18.00.21.42; Mon, 18 Jul 2022 00:22:07 -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=@kernel.org header.s=k20201202 header.b=C0f6yg4a; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbiGRHUf (ORCPT + 99 others); Mon, 18 Jul 2022 03:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233288AbiGRHUd (ORCPT ); Mon, 18 Jul 2022 03:20:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDEF4633A for ; Mon, 18 Jul 2022 00:20:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5AA4061349 for ; Mon, 18 Jul 2022 07:20:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3DCC341C0; Mon, 18 Jul 2022 07:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658128830; bh=HwCVC7i31nzH7rBtvRQvL24rveJVApXsIarHWo0LXKw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=C0f6yg4a7U739G9TpadFTCWNpT/AFi47x5NE1OZ1Xh5qyS2rvsRi5qnSO1gqi+4Nq hODk+7bnZRZ60Z2JFzrCNRhXbD1wZfTOXHLd/GXZ3LUfMKfnF/zTgpLKzucL7A3hEI DudYCvR94GNcGK47MfHYNXvKWsFHVxlV/ZmENACqdvehxUXGWrYYLTajhvVe+cQwAu DykEWIsW9uftrctS82Ixh9KkmB7j2ekDSSXSRUhRmjRiy1HiKi1hglY3uu3YhhV8vg MgMKW48UFAFH52rfsRAVYrKm42DaxPsG2tPyXSy28Y99odfvzBkVMng41nwMyJz6Hc ohoHK/q1TksSQ== Received: from 82-132-227-210.dab.02.net ([82.132.227.210] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oDL3M-0088Uj-Oz; Mon, 18 Jul 2022 08:20:28 +0100 Date: Mon, 18 Jul 2022 08:20:18 +0100 Message-ID: <87a69651l9.wl-maz@kernel.org> From: Marc Zyngier To: Kalesh Singh Cc: mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, will@kernel.org, qperret@google.com, tabba@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, russell.king@oracle.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, drjones@redhat.com, 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, android-mm@google.com, kernel-team@android.com Subject: Re: [PATCH v4 10/18] KVM: arm64: Stub implementation of pKVM HYP stack unwinder In-Reply-To: <20220715061027.1612149-11-kaleshsingh@google.com> References: <20220715061027.1612149-1-kaleshsingh@google.com> <20220715061027.1612149-11-kaleshsingh@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 82.132.227.210 X-SA-Exim-Rcpt-To: kaleshsingh@google.com, mark.rutland@arm.com, broonie@kernel.org, madvenka@linux.microsoft.com, will@kernel.org, qperret@google.com, tabba@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, andreyknvl@gmail.com, russell.king@oracle.com, vincenzo.frascino@arm.com, mhiramat@kernel.org, ast@kernel.org, drjones@redhat.com, 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, android-mm@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Fri, 15 Jul 2022 07:10:19 +0100, 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 > --- > arch/arm64/include/asm/stacktrace/nvhe.h | 57 ++++++++++++++++++++++++ > arch/arm64/kvm/hyp/nvhe/stacktrace.c | 3 +- > 2 files changed, 58 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..1eac4e57f2ae > --- /dev/null > +++ b/arch/arm64/include/asm/stacktrace/nvhe.h > @@ -0,0 +1,57 @@ > +/* 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; > +} > + > +/* > + * Protected nVHE HYP stack unwinder > + */ > +#ifdef __KVM_NVHE_HYPERVISOR__ > + > +#ifdef CONFIG_PROTECTED_NVHE_STACKTRACE > +static inline bool on_overflow_stack(unsigned long sp, unsigned long size, > + struct stack_info *info) > +{ > + return false; > +} > + > +static int notrace unwind_next(struct unwind_state *state) > +{ > + return 0; > +} > +NOKPROBE_SYMBOL(unwind_next); I find this rather dodgy. It means that every compilation unit that (indirectly) drags this include file may end-up with an 'unwind_next' function. At best this will be eliminated at compilation time, but it may also generate a warning. Why can't this me made an 'inline' function? At the very least, it should have a __maybe_unused attribute. > +#else /* !CONFIG_PROTECTED_NVHE_STACKTRACE */ > +static inline bool on_overflow_stack(unsigned long sp, unsigned long size, > + struct stack_info *info) > +{ > + return false; > +} > + > +static int notrace unwind_next(struct unwind_state *state) > +{ > + return 0; > +} > +NOKPROBE_SYMBOL(unwind_next); Same thing here. Thanks, M. -- Without deviation from the norm, progress is not possible.