Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2296092iof; Wed, 8 Jun 2022 01:44:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWFcEquxch1KatL3Ff8/thDw88unbQ0tNR2/kZfQNs7yjm86luxRrk5u+3IbIFFRBti2AP X-Received: by 2002:a17:903:22c6:b0:167:5991:fb63 with SMTP id y6-20020a17090322c600b001675991fb63mr22828392plg.37.1654677876037; Wed, 08 Jun 2022 01:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654677876; cv=none; d=google.com; s=arc-20160816; b=EoaYI8tWR7AaWAiX2t0vbgf829WJe3O/FQXEAhvvuSTx77lCv6/0C4oCoXGPQml9c4 KKZ/1dS73GlhMfiZ2orA23B0hY94yaoy+mj4fFxAi6gR4fT0YT+ZdpcvUmhUPhYJa6Q6 lx+amYu5AiNMR2mLxSi1x8j8ANmNCk1mD83RVr8571n5GBrl/YRyVnoCGNhShiQ39Op2 MkoQtkXEGdKlbhVEFXtm4q5vVECgjuz1oyFisQHmfOvU5r1azmnzkHvnB1xhQbRFNqp4 Bw3RtNhUPrAafqSgUiO/xIK99R6YGZTwBiMRloVRrEb1Jri8PF6AegOhLG/191lId5GD eMWg== 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=HWywovEhee9VVElZj8XGIQtdebj0v8Sxu/FOhxKtYio=; b=V0riGyvzK4XCfb2iF6Qyr4Gr1fsFMRr3OLqfiB9/wacceWd0klpFeVvUT08KbBrDKd kJ4gl/JPYu9ys3YokmwPyxelMSiJfu9McRoCoAZawZR/SwWTqf93QmdjMqFRKKDPb+r6 s7SAGSryf+NaNO70gMi4iTKQ7SuM1RD70efPakj4SDq3FvxDUM71FtRmLfoQhdmpT8i3 s9JeVWJKnaw+iErgSlAfZPiTkzfND2SWBqEkaGrD6bIhZ1v5/e4dcoxdylqZepJ+ZCKX j/97zGbgTb5itAaF5QiiU9E8MsvzVTAfuFGXJIUNV5dl0R3Qx+ANGmEADi2ZrpvZeR0a fP0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gORTG5OK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u185-20020a6385c2000000b003fd1b9e2d1csi20790373pgd.91.2022.06.08.01.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:44:36 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gORTG5OK; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 801082449CB; Wed, 8 Jun 2022 01:08:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbiFHICZ (ORCPT + 99 others); Wed, 8 Jun 2022 04:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232749AbiFHIBi (ORCPT ); Wed, 8 Jun 2022 04:01:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897C322913B for ; Wed, 8 Jun 2022 00:34:23 -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 4126561503 for ; Wed, 8 Jun 2022 07:33:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 952D2C34116; Wed, 8 Jun 2022 07:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654673631; bh=J4u1yJKMyuDvUOZQJg3dz2dfNFmf477VCvetOrL2LHc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gORTG5OKjK2s04Q1X7zTZoohTimLRFViQ6Y5faIddZ2lyYxdIUhZub16F4hhMu4NJ A8LXy59C+kn2gIF2jHJScRlGiuKIpfdFDVSbsWzdGKZPMJmC+Fuc+UaTUzeU7umHcJ bhwl4DWmlvlaLs5ORUw6vrcqL1FKs8i4PVl1yUj4fKGs/vd5anNbF+0SbndVkvnBAH PRSZLQgw++Lul1VI2KrwuFqt/HQLwj3wyt5U9eAHvQGHtWi8IocnwAWq6mWaB42XSB 6WHjQPzxwpsXMctwKSkmi0c2iCbQjJB0NzRmZdY25iMYbbMvY1rPGnZ37V1sHIVZEJ MIxb3vIB0YgtQ== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] 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.94.2) (envelope-from ) id 1nyqCL-00GWck-45; Wed, 08 Jun 2022 08:33:49 +0100 Date: Wed, 08 Jun 2022 08:33:46 +0100 Message-ID: <87leu7zk11.wl-maz@kernel.org> From: Marc Zyngier To: Kalesh Singh Cc: mark.rutland@arm.com, broonie@kernel.org, will@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, tjmercier@google.com, kernel-team@android.com, James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Masami Hiramatsu , Alexei Starovoitov , "Madhavan T. Venkataraman" , Andrew Jones , Kefeng Wang , Zenghui Yu , Keir Fraser , Ard Biesheuvel , Oliver Upton , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/5] KVM: arm64: Compile stacktrace.nvhe.o In-Reply-To: <20220607165105.639716-3-kaleshsingh@google.com> References: <20220607165105.639716-1-kaleshsingh@google.com> <20220607165105.639716-3-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: 185.104.136.29 X-SA-Exim-Rcpt-To: kaleshsingh@google.com, mark.rutland@arm.com, broonie@kernel.org, will@kernel.org, qperret@google.com, tabba@google.com, surenb@google.com, tjmercier@google.com, kernel-team@android.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, mhiramat@kernel.org, ast@kernel.org, madvenka@linux.microsoft.com, drjones@redhat.com, wangkefeng.wang@huawei.com, yuzenghui@huawei.com, keirf@google.com, ardb@kernel.org, oupton@google.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org 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=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Tue, 07 Jun 2022 17:50:44 +0100, Kalesh Singh wrote: > > Recompile stack unwinding code for use with the nVHE hypervisor. This is > a preparatory patch that will allow reusing most of the kernel unwinding > logic in the nVHE hypervisor. > > Suggested-by: Mark Rutland > Signed-off-by: Kalesh Singh > Reviewed-by: Mark Brown > --- > > Changes in v3: > - Add Mark's Reviewed-by tag > > Changes in v2: > - Split out refactoring of common unwinding logic into a separate patch, > per Mark Brown > > arch/arm64/include/asm/stacktrace.h | 18 +++++++++----- > arch/arm64/kernel/stacktrace.c | 37 ++++++++++++++++------------- > arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++- > 3 files changed, 35 insertions(+), 23 deletions(-) > > diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h > index aec9315bf156..f5af9a94c5a6 100644 > --- a/arch/arm64/include/asm/stacktrace.h > +++ b/arch/arm64/include/asm/stacktrace.h > @@ -16,12 +16,14 @@ > #include > > enum stack_type { > - STACK_TYPE_UNKNOWN, > +#ifndef __KVM_NVHE_HYPERVISOR__ > STACK_TYPE_TASK, > STACK_TYPE_IRQ, > STACK_TYPE_OVERFLOW, > STACK_TYPE_SDEI_NORMAL, > STACK_TYPE_SDEI_CRITICAL, > +#endif /* !__KVM_NVHE_HYPERVISOR__ */ > + STACK_TYPE_UNKNOWN, What is the reason for this reordering? I have the sinking feeling that this could play badly with the logic that assumes that it is legal to switch from a lesser stack type to a higher one, and could allow switching to a duff stack. I would at least like to see a justification of why this isn't less safe than the current code. [...] > index f9fe4dc21b1f..c0ff0d6fc403 100644 > --- a/arch/arm64/kvm/hyp/nvhe/Makefile > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile > @@ -14,7 +14,8 @@ lib-objs := $(addprefix ../../../lib/, $(lib-objs)) > > obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o \ > hyp-main.o hyp-smp.o psci-relay.o early_alloc.o page_alloc.o \ > - cache.o setup.o mm.o mem_protect.o sys_regs.o pkvm.o > + cache.o setup.o mm.o mem_protect.o sys_regs.o pkvm.o \ > + ../../../kernel/stacktrace.o This, I positively hate. It is only a marginally better than the cross-arch references we used to have with arch/arm/kvm. I'd be much more happy with an include file containing the shared code. It would also allow the removal of some of the #ifdeferry. Note that this is the approach that we ended up adopting for the VHE/nVHE split. Thanks, M. -- Without deviation from the norm, progress is not possible.