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 D2B49C4332F for ; Wed, 9 Nov 2022 23:01:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232159AbiKIXBZ (ORCPT ); Wed, 9 Nov 2022 18:01:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232166AbiKIXA6 (ORCPT ); Wed, 9 Nov 2022 18:00:58 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82B831DF4 for ; Wed, 9 Nov 2022 15:00:51 -0800 (PST) Date: Wed, 9 Nov 2022 23:00:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1668034845; 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=OAL3R3TEKZCss1R/iPyj1G2fURtMnDVaBxLRl/VPrsA=; b=vhUPHWUBXtfmpqLpsM84/OLlBTCq9M8Uf/LpS1LM+w+HDLUEHKKf+Cgmc8whr/XLEJ77qV OWYRu6RjKo1hKaOnTiT9M5Jj+L412Cz5b0pi1zQSzL2BC85JmGgitQo9fXiyjEoJ1EYAV0 M45hAyalGoHztvrdpdPiMXbwvkA6N9Q= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Ben Gardon Cc: Marc Zyngier , James Morse , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Reiji Watanabe , Ricardo Koller , David Matlack , Quentin Perret , Gavin Shan , Peter Xu , Will Deacon , Sean Christopherson , kvmarm@lists.linux.dev Subject: Re: [PATCH v5 10/14] KVM: arm64: Split init and set for table PTE Message-ID: References: <20221107215644.1895162-1-oliver.upton@linux.dev> <20221107215644.1895162-11-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Nov 09, 2022 at 02:26:26PM -0800, Ben Gardon wrote: > On Mon, Nov 7, 2022 at 1:58 PM Oliver Upton wrote: > > > > Create a helper to initialize a table and directly call > > smp_store_release() to install it (for now). Prepare for a subsequent > > change that generalizes PTE writes with a helper. > > > > Signed-off-by: Oliver Upton > > --- > > arch/arm64/kvm/hyp/pgtable.c | 20 ++++++++++---------- > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index a34e2050f931..f4dd77c6c97d 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -136,16 +136,13 @@ static void kvm_clear_pte(kvm_pte_t *ptep) > > WRITE_ONCE(*ptep, 0); > > } > > > > -static void kvm_set_table_pte(kvm_pte_t *ptep, kvm_pte_t *childp, > > - struct kvm_pgtable_mm_ops *mm_ops) > > +static kvm_pte_t kvm_init_table_pte(kvm_pte_t *childp, struct kvm_pgtable_mm_ops *mm_ops) > > { > > - kvm_pte_t old = *ptep, pte = kvm_phys_to_pte(mm_ops->virt_to_phys(childp)); > > + kvm_pte_t pte = kvm_phys_to_pte(mm_ops->virt_to_phys(childp)); > > > > pte |= FIELD_PREP(KVM_PTE_TYPE, KVM_PTE_TYPE_TABLE); > > pte |= KVM_PTE_VALID; > > - > > - WARN_ON(kvm_pte_valid(old)); > > Is there any reason to drop this warning? It is (eventually) superseded by a WARN() when a PTE isn't locked in stage2_make_pte(), but that isn't obvious in this patch alone. -- Thanks, Oliver 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 83209C433FE for ; Wed, 9 Nov 2022 23:00:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 112B94BA22; Wed, 9 Nov 2022 18:00:59 -0500 (EST) 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=@linux.dev 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 iRypYpT1uI40; Wed, 9 Nov 2022 18:00:57 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9411D4BA2B; Wed, 9 Nov 2022 18:00:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id EFB314BA22 for ; Wed, 9 Nov 2022 18:00:55 -0500 (EST) 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 5llxUeyfg7yc for ; Wed, 9 Nov 2022 18:00:50 -0500 (EST) Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 65B5F4BA1C for ; Wed, 9 Nov 2022 18:00:50 -0500 (EST) Date: Wed, 9 Nov 2022 23:00:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1668034845; 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=OAL3R3TEKZCss1R/iPyj1G2fURtMnDVaBxLRl/VPrsA=; b=vhUPHWUBXtfmpqLpsM84/OLlBTCq9M8Uf/LpS1LM+w+HDLUEHKKf+Cgmc8whr/XLEJ77qV OWYRu6RjKo1hKaOnTiT9M5Jj+L412Cz5b0pi1zQSzL2BC85JmGgitQo9fXiyjEoJ1EYAV0 M45hAyalGoHztvrdpdPiMXbwvkA6N9Q= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Ben Gardon Subject: Re: [PATCH v5 10/14] KVM: arm64: Split init and set for table PTE Message-ID: References: <20221107215644.1895162-1-oliver.upton@linux.dev> <20221107215644.1895162-11-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT Cc: kvm@vger.kernel.org, Marc Zyngier , Will Deacon , kvmarm@lists.linux.dev, David Matlack , 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 On Wed, Nov 09, 2022 at 02:26:26PM -0800, Ben Gardon wrote: > On Mon, Nov 7, 2022 at 1:58 PM Oliver Upton wrote: > > > > Create a helper to initialize a table and directly call > > smp_store_release() to install it (for now). Prepare for a subsequent > > change that generalizes PTE writes with a helper. > > > > Signed-off-by: Oliver Upton > > --- > > arch/arm64/kvm/hyp/pgtable.c | 20 ++++++++++---------- > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index a34e2050f931..f4dd77c6c97d 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -136,16 +136,13 @@ static void kvm_clear_pte(kvm_pte_t *ptep) > > WRITE_ONCE(*ptep, 0); > > } > > > > -static void kvm_set_table_pte(kvm_pte_t *ptep, kvm_pte_t *childp, > > - struct kvm_pgtable_mm_ops *mm_ops) > > +static kvm_pte_t kvm_init_table_pte(kvm_pte_t *childp, struct kvm_pgtable_mm_ops *mm_ops) > > { > > - kvm_pte_t old = *ptep, pte = kvm_phys_to_pte(mm_ops->virt_to_phys(childp)); > > + kvm_pte_t pte = kvm_phys_to_pte(mm_ops->virt_to_phys(childp)); > > > > pte |= FIELD_PREP(KVM_PTE_TYPE, KVM_PTE_TYPE_TABLE); > > pte |= KVM_PTE_VALID; > > - > > - WARN_ON(kvm_pte_valid(old)); > > Is there any reason to drop this warning? It is (eventually) superseded by a WARN() when a PTE isn't locked in stage2_make_pte(), but that isn't obvious in this patch alone. -- Thanks, Oliver _______________________________________________ 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 69F67C433FE for ; Wed, 9 Nov 2022 23:02:13 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x4TuhSIYiVb44iOoBWs4HsQiUpQWBXOkpEVfNvM2GGQ=; b=K0f7qteuP1yfZk 01FQGeGMkQrcreBIeXgpkcKCfMNGuRfdLdIxwgvw8Z+ipoGMhzzb/6g9Of0nFgJ44AY/uvySZJ94n WX0olm663fiwOOevw2IkSDJEQ9rkXkW9K8P4IGK/FkUlIjqmS1zkzdSJhD8T7dSnSC08YDt/1CJzl uPzBY3QgiiIBjKuEuyHi5mZCkDjngcmGgqWcCKWPCwdlOmmEncnFbps6njQLYS//s6upi//hgZmtx cX0Yx8AlMjWFiHdYFaR4nPNskJyM9EBZaDrsBqkdbQkUwdxvDwKyk4Jb2Uo5RwjVvcrdn1R8iirDc FFVoQoHxRUgmtB+1v6Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1osu4G-000Uly-Ty; Wed, 09 Nov 2022 23:01:13 +0000 Received: from out2.migadu.com ([188.165.223.204]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1osu3y-000UVh-VK for linux-arm-kernel@lists.infradead.org; Wed, 09 Nov 2022 23:00:56 +0000 Date: Wed, 9 Nov 2022 23:00:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1668034845; 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=OAL3R3TEKZCss1R/iPyj1G2fURtMnDVaBxLRl/VPrsA=; b=vhUPHWUBXtfmpqLpsM84/OLlBTCq9M8Uf/LpS1LM+w+HDLUEHKKf+Cgmc8whr/XLEJ77qV OWYRu6RjKo1hKaOnTiT9M5Jj+L412Cz5b0pi1zQSzL2BC85JmGgitQo9fXiyjEoJ1EYAV0 M45hAyalGoHztvrdpdPiMXbwvkA6N9Q= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Ben Gardon Cc: Marc Zyngier , James Morse , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Reiji Watanabe , Ricardo Koller , David Matlack , Quentin Perret , Gavin Shan , Peter Xu , Will Deacon , Sean Christopherson , kvmarm@lists.linux.dev Subject: Re: [PATCH v5 10/14] KVM: arm64: Split init and set for table PTE Message-ID: References: <20221107215644.1895162-1-oliver.upton@linux.dev> <20221107215644.1895162-11-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221109_150055_459822_26A2A8A5 X-CRM114-Status: GOOD ( 17.16 ) 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 Wed, Nov 09, 2022 at 02:26:26PM -0800, Ben Gardon wrote: > On Mon, Nov 7, 2022 at 1:58 PM Oliver Upton wrote: > > > > Create a helper to initialize a table and directly call > > smp_store_release() to install it (for now). Prepare for a subsequent > > change that generalizes PTE writes with a helper. > > > > Signed-off-by: Oliver Upton > > --- > > arch/arm64/kvm/hyp/pgtable.c | 20 ++++++++++---------- > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index a34e2050f931..f4dd77c6c97d 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -136,16 +136,13 @@ static void kvm_clear_pte(kvm_pte_t *ptep) > > WRITE_ONCE(*ptep, 0); > > } > > > > -static void kvm_set_table_pte(kvm_pte_t *ptep, kvm_pte_t *childp, > > - struct kvm_pgtable_mm_ops *mm_ops) > > +static kvm_pte_t kvm_init_table_pte(kvm_pte_t *childp, struct kvm_pgtable_mm_ops *mm_ops) > > { > > - kvm_pte_t old = *ptep, pte = kvm_phys_to_pte(mm_ops->virt_to_phys(childp)); > > + kvm_pte_t pte = kvm_phys_to_pte(mm_ops->virt_to_phys(childp)); > > > > pte |= FIELD_PREP(KVM_PTE_TYPE, KVM_PTE_TYPE_TABLE); > > pte |= KVM_PTE_VALID; > > - > > - WARN_ON(kvm_pte_valid(old)); > > Is there any reason to drop this warning? It is (eventually) superseded by a WARN() when a PTE isn't locked in stage2_make_pte(), but that isn't obvious in this patch alone. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel