Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp835733imi; Fri, 22 Jul 2022 10:27:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u/aWmBYj+kPQWHAfdqdOR8qkSfTtKiNUxTMjSMX+ZEtAePwmyrEtzDINCZ8lvsaAAhzWJ6 X-Received: by 2002:a05:6402:5513:b0:43a:b866:b9ab with SMTP id fi19-20020a056402551300b0043ab866b9abmr962428edb.290.1658510860510; Fri, 22 Jul 2022 10:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658510860; cv=none; d=google.com; s=arc-20160816; b=xtM7ZTc4lyLuaN0A7gvRSc5PdfoWPD56IYTraRFXAXV1kkAThmKN/lLxGgN/E5ShVw 3Dm2H7QoZEg+RrraBQkLw/pHzNxH0/vR9l/qSXQqpxdE/9zKTWWN+aTc/ISzdYPVj/LT tCgFSKMEV5zKJ8xRrTnFC5YH/pT9jZ8xViDrp2Izp9jNimi5qM8hNE8LYKktUuwl25qq ZX3z76VJ47R1sSZzhzAzoX1SG06+pKPCVY01qGXqaIZzpIr+Suzhlcqm5f5xi3VD9fSI OmYQuf8MZ6quC2ZUTN5gp1PEMB2lavCQLkicw7UPpVPE3DN3uwEUfbitRbIOb8xO0oTL m5jQ== 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=qo8WtVG4n0zTyMgzLgHF96/1qxYxV8ri3HK7ykqwnO8=; b=OAwtVvnqt5n0AQcRlHfSRJwGkMy1jnpDjrbbTObXum2lW5/xNJAItHcRK5aAqDSAno mPWxRqb1dggTIIfapRDPR3vNsyuOi1Syo2InLcCXllm8Gxs40pZ+8Nie9lWGsd+NcTDY e8bDrlqpvp5RrwEbM+ePfqS6d3T0EGMZH1gfxLr/XD2uymclI4iUy0+55XbMqEOrAHwP Jn5/1hNcjkzetrGaQveqqJAMjww2K9/8EoqrS3r8BM/Qsl3cU3vMCiySSTgWL2+oufFi kCL7h+UDbM3A9EOzG38Vkdl1FQOqIb6NY7VxLVvn/LFhDnzfsmOQgJBKo9SPe4bO9NAD 3wRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IK7V1IOi; 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 cw4-20020a056402228400b0043a6e52f68dsi485015edb.502.2022.07.22.10.27.15; Fri, 22 Jul 2022 10:27:40 -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=IK7V1IOi; 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 S234012AbiGVRZ2 (ORCPT + 99 others); Fri, 22 Jul 2022 13:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbiGVRZ1 (ORCPT ); Fri, 22 Jul 2022 13:25:27 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35DD9D56 for ; Fri, 22 Jul 2022 10:25:26 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id bv24so7404920wrb.3 for ; Fri, 22 Jul 2022 10:25:26 -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=qo8WtVG4n0zTyMgzLgHF96/1qxYxV8ri3HK7ykqwnO8=; b=IK7V1IOiUtkzMNlZe+LF+whif65Ho4BnHQgQT5ZqfEnJBdOdhx+lcnsEqWnONdEIj5 37zG5sDarPhLTl8WkWOedv9TArm8RDXVASNCbomlxOJZVtSYWcSdjX/2pK+YEaabocSO vHG5ODih6QIppMO3JhyTpBsN+rCbddhFRKimz/zgyqwR1EnLH1QxtEIvX5/kYonlKosk 2BxCBvjDosLoJIIRjCMzRvruT384mua/wXVI+I2tkETcS4K8ZUtaZ57+L+go0dpvv1Pp L0WZjgtsSjEI/qBKh8D7LLxMRKJLuLObV4Ml3SUEGNA59aYtWV92hmkMEOFDlWPgM0w5 34Iw== 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=qo8WtVG4n0zTyMgzLgHF96/1qxYxV8ri3HK7ykqwnO8=; b=t1KwXGhIq5IULvOAEKwQDYc7RW/+QSt6Iy7Y7jKVwW1LlmJhB4zlPpIqeS2BPSIUy+ JDPqwyNwMKFiwq0ifSp7BX/sZRnm/ZDuqwAo6bp1Ib+z4RDN6OFX3Gu7QKHDoeWt2qkI GPQqoUbPi7DhNxwThdww2x2b0OKQzNfxNAmXqJo/k8CCNaZdOBwgOpeqDRs4AWVO+dgp NgutJmPpvn1p0eYe3ynYtBrAGzS8ts3sdPeyEi9lf6x7zx9V+QGWI6XsS91ExGP9wXnn dcUWobh5P1W/TKQ+T7RZkjJS8e1n8MhXpXUF1MjiflwHXqW2biqT71j/dEDbcSPiH8W+ fAMw== X-Gm-Message-State: AJIora+5PWbrXUNgwnZ/JirYRRnZhrFpSthO1dNG3exFYv9r5pxf1EyS DIvb0Vi+YeueovdUWY65A4mWgTKmUJA/ZrEOZDxnFQ== X-Received: by 2002:a5d:6c65:0:b0:21d:b7c0:9930 with SMTP id r5-20020a5d6c65000000b0021db7c09930mr626692wrz.500.1658510724540; Fri, 22 Jul 2022 10:25:24 -0700 (PDT) MIME-Version: 1.0 References: <20220721055728.718573-1-kaleshsingh@google.com> <20220721055728.718573-17-kaleshsingh@google.com> In-Reply-To: From: Kalesh Singh Date: Fri, 22 Jul 2022 10:25:13 -0700 Message-ID: Subject: Re: [PATCH v5 16/17] KVM: arm64: Introduce pkvm_dump_backtrace() To: Oliver Upton Cc: Marc Zyngier , Mark Rutland , Mark Brown , "Madhavan T. Venkataraman" , Fuad Tabba , Will Deacon , Quentin Perret , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , andreyknvl@gmail.com, vincenzo.frascino@arm.com, Masami Hiramatsu , Alexei Starovoitov , Andrew Jones , Kefeng Wang , Marco Elver , Keir Fraser , Zenghui Yu , Ard Biesheuvel , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , kvmarm , LKML , android-mm@google.com, "Cc: Android Kernel" 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 On Fri, Jul 22, 2022 at 4:16 AM Oliver Upton wrote: > > Hi Kalesh, > > On Wed, Jul 20, 2022 at 10:57:27PM -0700, Kalesh Singh wrote: > > [...] > > > +/* > > + * pkvm_dump_backtrace - Dump the protected nVHE HYP backtrace. > > + * > > + * @hyp_offset: hypervisor offset, used for address translation. > > + * > > + * Dumping of the pKVM HYP backtrace is done by reading the > > + * stack addresses from the shared stacktrace buffer, since the > > + * host cannot direclty access hyperviosr memory in protected > > + * mode. > > + */ > > +static void pkvm_dump_backtrace(unsigned long hyp_offset) > > +{ > > + unsigned long *stacktrace_entry > > + = (unsigned long *)this_cpu_ptr_nvhe_sym(pkvm_stacktrace); > > + unsigned long va_mask, pc; > > + > > + va_mask = GENMASK_ULL(vabits_actual - 1, 0); > > + > > + kvm_err("Protected nVHE HYP call trace:\n"); > > This and the footer printks should be put in respective helpers to share > between pKVM and non-pKVM backtrace implementations. I imagine users > will invariably bake some pattern matching to scrape traces, and it > should be consistent between both flavors. Hi Oliver, Ok will split these out into helpers. > > > + /* The stack trace is terminated by a null entry */ > > + for (; *stacktrace_entry; stacktrace_entry++) { > > At the point we're dumping the backtrace we know that EL2 has already > soiled itself, so we shouldn't explicitly depend on it providing NULL > terminators. I believe this loop should have an explicit range && NULL > check. Good point, I'll add the additional checks in the next version, Thanks, Kalesh > > -- > Thanks, > Oliver