Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7277621rwb; Tue, 15 Nov 2022 09:54:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+tbF9dcCAFTwL2juo16spRNwwfGGJvUQ1USOb5y4uPr3pV6DekvSc1ytkoLqrTYA4LlRO X-Received: by 2002:a17:906:e11:b0:7ad:9629:fb96 with SMTP id l17-20020a1709060e1100b007ad9629fb96mr14636203eji.751.1668534863224; Tue, 15 Nov 2022 09:54:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668534863; cv=none; d=google.com; s=arc-20160816; b=WiOMt6Wr7yVdqop36RfqBwMn8BK+/fsFatRg5VMa0tlPLZLlHAT1wzLA2KoQeVzIGu 6FGjhQtfiMHuwlQSqxc0gkzepaW75EXs4oVQB+k6uBFgftHBKqjYJ3eALF0xLDjuyjbC QwZVTgoZ+WB5Q5ZytPgVPbho9cMNNg2ye8YIWuMDw/bzQIsKEXK1AJklrV1w3pGJlwwA VQKnEsMuJUbrKZNg+Cu2xavdRAPUVWVImWlmh8PvyVnFCdhptXtuk9KA9UyTkmGRO+lA grhcA8CtJ6Rhz5o7t4OjTy0/QSHhtyVAwsIkLfQuLKykSKo5h2o8isZ3+19AdczSBaPU zkeg== 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=epDwsDiYoNZ6uhKBqwMbJzXJpjRcm2DVB2PP1BGcjP8=; b=IzJs/Pg3C3x2jzKqfE8IxmL3foUjcy84lodwyjjnOGZWN8aHRoFvJ7mS74XMRqPbVy r+/q41I6OafpkbEqnhoFczygMvLFFTsfdyZ3UqM1QfQcg4U45MCDeltmhtVxY7jW+mU/ 8BnzmZKRK/26YW/hQZA3nWfZAc84d/Xm82vs/mwkTuRGvh41il1jgaU2bJAmher2P3TX BdktB2yhytAOZhOv1QR61ece97rFo1ix+xNDHLYJBKcgFuOC0kLvkBKg/cpw5RzFiaAS GEAvETjBG6z63iNNOBwqtiYTZIg9/zfTdlq9ALdz+mx4542CsJ9v99Uml0XfY434h7eF LMbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LMKySPNF; 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 i37-20020a0564020f2500b004589ea2d983si11948849eda.287.2022.11.15.09.54.00; Tue, 15 Nov 2022 09:54:23 -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=LMKySPNF; 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 S231447AbiKORYA (ORCPT + 91 others); Tue, 15 Nov 2022 12:24:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbiKORX7 (ORCPT ); Tue, 15 Nov 2022 12:23:59 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 418E1AE57; Tue, 15 Nov 2022 09:23:57 -0800 (PST) Date: Tue, 15 Nov 2022 17:23:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1668533035; 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=epDwsDiYoNZ6uhKBqwMbJzXJpjRcm2DVB2PP1BGcjP8=; b=LMKySPNF2K08tEU8/pacucf93qxXUOua+1KWhnakFetm4VAYbi1ofKjDaiEZ/IDYEaYhj6 E7ssklZu9Y1+ZIf9KUl4UgiMCAQQp1LHUO0YfCVLJh7TB2gsxpFsg3cKGGkiXQTlKgdwTV BR8S7QBQCXemVNgYdPzwfxfjQlgLYOE= 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, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] KVM: arm64: Use a separate function for hyp stage-1 walks Message-ID: References: <20221114201127.1814794-1-oliver.upton@linux.dev> <20221114201127.1814794-2-oliver.upton@linux.dev> <20221115132532.GA524@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115132532.GA524@willie-the-truck> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Hey Will, On Tue, Nov 15, 2022 at 01:25:34PM +0000, Will Deacon wrote: [...] > On Mon, Nov 14, 2022 at 08:11:27PM +0000, Oliver Upton wrote: > > +int kvm_pgtable_hyp_walk(struct kvm_pgtable *pgt, u64 addr, u64 size, > > + struct kvm_pgtable_walker *walker); > > Hmm, this feels like slightly the wrong abstraction to me -- there's nothing > hyp-specific about the problem being solved, it's just that the only user > is for hyp walks. > > Could we instead rework 'struct kvm_pgtable' slightly so that the existing > 'flags' field is no-longer stage-2 specific and includes a KVM_PGTABLE_LOCKED > flag which could be set by kvm_pgtable_hyp_init()? > > That way the top-level API remains unchanged and the existing callers will > continue to work. Thanks for the suggestion! Yeah, this should be described by the flags instead. We already have KVM_PGTABLE_WALK_SHARED, I could actually condition the RCU lock/unlock on that one. That would make it an explicit opt-in instead of requiring an opt out with callers passing KVM_PGTABLE_LOCKED. Thoughts? -- Thanks, Oliver