From mboxrd@z Thu Jan 1 00:00:00 1970 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 B4BADC433EF for ; Mon, 18 Jul 2022 07:21:36 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aAHnfogKbsmxj2Ja0FufnU2/sALGlnPpPt6kwOuYICk=; b=DLKlKGQXQC6Mr5 cOPuoVUaYMDffTH+r4zpwJuQbwp8GY2EqRRxRN31RdJIk3ZSWZQnvYq9bDf2XmaP3QmNaEgd40yw2 aL4jsRu2BQdv5ONgt4I2iCNWI5uYYQAGQWTSRY9cDkt81oukEdf0bsASKObDl4mEAggTPSCthvmx1 WfcnPKSo11rY8/LEskohwLctpZ662oI4wFw8qW0hvZoX8mni71GtCwlR2FD1fQI54Lsji/Hk44nzb cOUkdZgHOfgfRl6ftOVgjNpmT49gDn1+ZGPMWfEt8piR7DHfLg3Mmzp+IN8wuE7itSVqA0hNEgNpN rpaFfo0sCNCzt90O0bnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDL3T-00BRhp-ER; Mon, 18 Jul 2022 07:20:35 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDL3Q-00BRgP-C3 for linux-arm-kernel@lists.infradead.org; Mon, 18 Jul 2022 07:20:33 +0000 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 5AA6861358; 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") 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220718_002032_509502_F1CA268B X-CRM114-Status: GOOD ( 27.54 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel