Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp872336rwb; Fri, 18 Nov 2022 09:19:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4vYybekWEV75+IqSPcApofZYROvjgYX0rMXT09gv/IQU8BjAa4hYuD6S4HnwmyH+O0iEFy X-Received: by 2002:a17:907:2997:b0:7ad:b791:1390 with SMTP id eu23-20020a170907299700b007adb7911390mr6678460ejc.279.1668791967479; Fri, 18 Nov 2022 09:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668791967; cv=none; d=google.com; s=arc-20160816; b=amMlIZPU4z7ES69In0XuHmgMMfCL/Irzy6i/F7woZke2ariWdRdCoxEBD0+pQjcStX /IoyTCoM3CKaQngNBZu/hTB/B18IFBZg8ZtXxkpcOt57hle63avPQuIL2oijzjO4kpBc mkPcdqRnSfEf/MC9ohDXRqKrNYaGg6dbLKZz6AqFEH9TyP7wwRilP5MGVZj8q67mTL8C 9w6LMWddiAoF9ai7hLUWZGasRUheK3EkrwDbzMW6RSEckl371dN7hKfNjcay1XCW0/Ka X/E5o7VzoKnKZGqg+B1Gejp13KpLwOC5xpyazjN7+oQOoXgjt4nQwyhB1S+efzf1JMKM AKgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=SZClopAzQZuqTFUhQclgWoQ7jvZ2RLe6Z0cHJygex2I=; b=SPl/s8JMCpKKswLNXWAUVD6ekBwxTldtSWvlrWMI9pKtxQCoOU19rKB2DVsGAEgh04 GnbSS4AdjknZ8hEmrkSF776YlXZx3zsjhR0RiQ8eYu3GSpxSVaS96a9IOeOW4mErgoeT mVrXWX29DvhgVvNp0Mk3ejaSrtHxbPSwrrqcp6thJnpgtTzNOa0q0Fc8rVRBjFSrFV/W hAfL6FhKS5lFq3qvb4FQ0jb/A+B5iX7U/xvgEaga0Cih7HWLTI0KZ62g3g3kjRjGSacn yehK8C7U7T7aEUCx7TLSQ2z5wojdV0EYwSX/r9wVYqPFpL7Jccyg1PhTErKZwilfLLTo BXLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="pg/shj4Q"; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh13-20020a170906da8d00b0078c37681f89si3363214ejb.650.2022.11.18.09.19.03; Fri, 18 Nov 2022 09:19:27 -0800 (PST) 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=@linux.dev header.s=key1 header.b="pg/shj4Q"; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242495AbiKRRNF (ORCPT + 90 others); Fri, 18 Nov 2022 12:13:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242486AbiKRRM4 (ORCPT ); Fri, 18 Nov 2022 12:12:56 -0500 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01BD68CF10; Fri, 18 Nov 2022 09:12:54 -0800 (PST) Date: Fri, 18 Nov 2022 17:12:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1668791573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SZClopAzQZuqTFUhQclgWoQ7jvZ2RLe6Z0cHJygex2I=; b=pg/shj4QLtOPw9mnu1T7TalbMSXwxOcCnj7v/lwgEdv806cCTaPHYBQp6Opzx3ysZ426ld DVpCO70x+BsZLC91lzrJs3+nwF6okrCjLrt/kHK5dZrd1YXpLoqguwoaUTXwDJxJRY2BTa 8h35XCtgTiFFx+RnZHLmSg2kD79h+lM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Will Deacon Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, Marek Szyprowski , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] KVM: arm64: Don't acquire RCU read lock for exclusive table walks Message-ID: References: <20221116165655.2649475-1-oliver.upton@linux.dev> <20221116165655.2649475-3-oliver.upton@linux.dev> <20221117174951.GA2916@willie-the-truck> <20221118121949.GA3697@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221118121949.GA3697@willie-the-truck> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS 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, Nov 18, 2022 at 12:19:50PM +0000, Will Deacon wrote: > On Thu, Nov 17, 2022 at 06:23:23PM +0000, Oliver Upton wrote: > > On Thu, Nov 17, 2022 at 05:49:52PM +0000, Will Deacon wrote: > > > On Wed, Nov 16, 2022 at 04:56:55PM +0000, Oliver Upton wrote: > > > > [...] > > > > > > -static inline void kvm_pgtable_walk_begin(void) {} > > > > -static inline void kvm_pgtable_walk_end(void) {} > > > > +static inline void kvm_pgtable_walk_begin(struct kvm_pgtable_walker *walker) > > > > +{ > > > > + /* > > > > + * Due to the lack of RCU (or a similar protection scheme), only > > > > + * non-shared table walkers are allowed in the hypervisor. > > > > + */ > > > > + WARN_ON(walker->flags & KVM_PGTABLE_WALK_SHARED); > > > > +} > > > > > > I think it would be better to propagate the error to the caller rather > > > than WARN here. > > > > I'd really like to warn somewhere though since we're rather fscked at > > this point. Keeping that WARN close to the exceptional condition would > > help w/ debugging. > > > > Were you envisioning bubbling the error all the way back up (i.e. early > > return from kvm_pgtable_walk())? > > Yes, that's what I had in mind. WARN is fatal at EL2, so I think it's > better to fail the pgtable operation rather than bring down the entire > machine by default. Duh, I forgot WARNs really do go boom at EL2. Yeah, in that case it'd be best to let the caller clean up the mess. > > If having this is a strong motivator I can do a v4. > > It's a really minor point, so I'll leave it up to you guys. Sold (sorry I wasn't following before). v4 on the way. -- Thanks, Oliver