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 5D513C433EF for ; Sat, 16 Apr 2022 11:30:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id AC05149F10; Sat, 16 Apr 2022 07:30:33 -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 CqJ7uEh6gh86; Sat, 16 Apr 2022 07:30:32 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 608B949F24; Sat, 16 Apr 2022 07:30:32 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DEFF949F1C for ; Sat, 16 Apr 2022 07:30:30 -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 RxkLyAFKGZST for ; Sat, 16 Apr 2022 07:30:29 -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 70BD249F10 for ; Sat, 16 Apr 2022 07:30:29 -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 1445CB82237; Sat, 16 Apr 2022 11:30:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF81DC385A3; Sat, 16 Apr 2022 11:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650108626; bh=qFp/jDmKbavYo5kvIAF6zOjufRczwtY9uV2Lo1n0R8Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=up8hV9wQ2DbdqxRluJXKd64E5tOUEEStn51OVv6TZp7Exy2vDMiR4gMcoo5l0BTbm KJONmHONbM9fKerrYE6R8i3Uxdc/IRcHLDURkI+Km+rCSQSq5pRlwUC0KGhzbRHAsk aAuJXuL/Rgs7YcTy07Wr/f34gLewLESaMchghHyrqYrEgevUDlpjvLyiDUfYCPzDv9 2qTXEAZ9T2JUJAXno9jibaKaxgijwjhflBntZmILcNL5poGU2CNDC5Pp8tw57r3HId GiIlIOyuI/56MslqOGAAKXbtKwlLHfAVhiP8fY8wTmka4knTpOuqTOQ2fQ+KFVYNfV u+sZW9OuBRi6g== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.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 1nfgdE-004joA-8S; Sat, 16 Apr 2022 12:30:25 +0100 Date: Sat, 16 Apr 2022 12:30:23 +0100 Message-ID: <871qxxb700.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Subject: Re: [RFC PATCH 05/17] KVM: arm64: Take an argument to indicate parallel walk In-Reply-To: <20220415215901.1737897-6-oupton@google.com> References: <20220415215901.1737897-1-oupton@google.com> <20220415215901.1737897-6-oupton@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.219.108.64 X-SA-Exim-Rcpt-To: oupton@google.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, pshier@google.com, ricarkol@google.com, reijiw@google.com, pbonzini@redhat.com, seanjc@google.com, bgardon@google.com, dmatlack@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kvm@vger.kernel.org, Peter Shier , Ben Gardon , David Matlack , Paolo Bonzini , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 Hi Oliver, On Fri, 15 Apr 2022 22:58:49 +0100, Oliver Upton wrote: > > It is desirable to reuse the same page walkers for serial and parallel > faults. Take an argument to kvm_pgtable_walk() (and throughout) to > indicate whether or not a walk might happen in parallel with another. > > No functional change intended. > > Signed-off-by: Oliver Upton > --- > arch/arm64/include/asm/kvm_pgtable.h | 5 +- > arch/arm64/kvm/hyp/nvhe/mem_protect.c | 4 +- > arch/arm64/kvm/hyp/nvhe/setup.c | 4 +- > arch/arm64/kvm/hyp/pgtable.c | 91 ++++++++++++++------------- > 4 files changed, 54 insertions(+), 50 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h > index ea818a5f7408..74955aba5918 100644 > --- a/arch/arm64/include/asm/kvm_pgtable.h > +++ b/arch/arm64/include/asm/kvm_pgtable.h > @@ -194,7 +194,7 @@ enum kvm_pgtable_walk_flags { > typedef int (*kvm_pgtable_visitor_fn_t)(u64 addr, u64 end, u32 level, > kvm_pte_t *ptep, kvm_pte_t *old, > enum kvm_pgtable_walk_flags flag, > - void * const arg); > + void * const arg, bool shared); Am I the only one who find this really ugly? Sprinkling this all over the shop makes the code rather unreadable. It seems to me that having some sort of more general context would make more sense. For example, I would fully expect the walk context to tell us whether this walker is willing to share its walk. Add a predicate to that, which would conveniently expand to 'false' for contexts where we don't have RCU (such as the pKVM HYP PT management, and you should get something that is more manageable. 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