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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31815C43334 for ; Wed, 8 Jun 2022 07:33:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 8B4E64B31A; Wed, 8 Jun 2022 03:33:58 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bzwkJ9zB6uJW; Wed, 8 Jun 2022 03:33:57 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 60B834B300; Wed, 8 Jun 2022 03:33:57 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9C9AA4B2F5 for ; Wed, 8 Jun 2022 03:33:55 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OYjCQ1jgtPcj for ; Wed, 8 Jun 2022 03:33:54 -0400 (EDT) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 4D4174B2D7 for ; Wed, 8 Jun 2022 03:33:54 -0400 (EDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id D74A7B823ED; 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 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") 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 Cc: Kefeng Wang , Catalin Marinas , Alexei Starovoitov , will@kernel.org, surenb@google.com, kvmarm@lists.cs.columbia.edu, "Madhavan T. Venkataraman" , linux-arm-kernel@lists.infradead.org, kernel-team@android.com, broonie@kernel.org, tjmercier@google.com, linux-kernel@vger.kernel.org, Masami Hiramatsu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 C96E7C433EF for ; Wed, 8 Jun 2022 07:35:00 +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=8jeTyYbeT6fSaFJwX8Xb6+DizQCVb0J0Kk2EV6xy6f4=; b=VQxi17Kbr+rIa5 Ii1/W6tA6HtwoWg695x6+VzSs2hg7j8rLs+AtzoSzGzagSs7m6m0Dcvix0lud8KghukpRKDpO7PbB /tW7/jcWX/vwwr3Tyufzey85FpB3wHhodAkW2bjwcdECCQF3vK3zbFQ/JswOvm/K6MDJYP1n1lxmQ fKCQitjm0wJDp3dxyH9GcF2XvT0uDFxZjE+N5Ft5BogjqgDQjfYhxWW6mFXQXcmjhDEcJqAXeK0sj sfSPZ3fIi6d2Db9oxr6LTGCzU6Q4rpNF1ynceYmqT/bztpb0Oke4v+NZxUjPlE6lwZhzBAI+TD7zS zUiULnDQwu4/1WPgT+VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyqCU-00Bcys-4q; Wed, 08 Jun 2022 07:33:58 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyqCQ-00Bcxr-C4 for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2022 07:33:56 +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 ams.source.kernel.org (Postfix) with ESMTPS id D74A7B823ED; 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") 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220608_003354_735862_5C6CAE7F X-CRM114-Status: GOOD ( 27.49 ) 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 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FA10C433EF for ; Wed, 8 Jun 2022 08:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232979AbiFHIC1 (ORCPT ); Wed, 8 Jun 2022 04:02:27 -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 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.