Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp662384lqh; Fri, 31 May 2024 12:20:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrYdh+7eM0LYKOjTB+uB706OVLh4lR0nwY0hY0FFu0lDVUf5OOUhQ3n8QSjjFtxDUsKewWfhEYiMIWF8EDIDb2WR3af3P6wMER/1ZsiA== X-Google-Smtp-Source: AGHT+IFQXicgO5CdZkFjcNfvf90919mI4eOiay9gk1V7R1u4MyxojDS9c4Kuf6QQKPaqs9J56s+V X-Received: by 2002:a50:d4d6:0:b0:578:5756:1519 with SMTP id 4fb4d7f45d1cf-57a3637f588mr2810844a12.16.1717183201466; Fri, 31 May 2024 12:20:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717183201; cv=pass; d=google.com; s=arc-20160816; b=IJOKZXiTNBNC951yTM+RvdyUETj4LLC6ulgPA/3OLWIiBypCgVjOV4K34wXIWPy89e aEI6JpmHe+ngYLPOhDnJnVfHW2/N5MBRx9ZhQPjMVy9RhiPZBsM7wVKH9qpKNdy7Rqnk IlPk24kugoDgpl1npYA4vn/Y5Y742Z9YcYqLE8emdaKetfhG/wVfzX/olTMz0ySrrx1k Y9Jk8lSQ7HbaQ9KVKqIClXCJNuVfzs4KqRHDS0O5I6A/Vdiu+VQYWqIWEBENCEG0Wwo6 wTp3VvD7IEhbrZmGx8b8AD0b0eBGrormEkMHXGuIOWYe7pQ76WxbTpBtYPTJ9swwS70c jqRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2PNxbejm0F++LAZR/c3kykM2MBahftMSuulGipIjRRI=; fh=b8nykubKCbDGVc3lOwpx6FHRJT1gQAkKPSCt17bxDHo=; b=Cv7zXWVC2Vfspu1rV/Joz7xFu46026LRkZiiL++m//Z4Bp4NAs0ygZ2/pxtMWJZdL4 FYBkgwU4uq+TxgMthsn4QUJun3zwSWx4UYV301lodDRfnnnQvlvfiW/eB9hg4s04Diku p7GcCcwbKKv42si5RECalGROu6vuWUIIGWpnnjbiF+1wHGrxT8qJeCJaSj1lb9ceNrL9 SgqO8aOqsfkRpX1DIdNwfjVltQ//bg0LT7muZHMIvQpLuxcA7ye7rkd9YEjizg0/pxkQ fIre/mNJmBBGUd1rVeoQWSjevcOpOevtnwW6hwpYmwx/XmnBVQCND3UZ5OCAO+3PT9UK XZKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="OL//CPF3"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-197353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c63161si1215058a12.295.2024.05.31.12.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 12:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="OL//CPF3"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-197353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2D3181F28F87 for ; Fri, 31 May 2024 19:19:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C889E8063B; Fri, 31 May 2024 19:18:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="OL//CPF3" Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C4ED44C64 for ; Fri, 31 May 2024 19:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717183105; cv=none; b=NIjYyOFN+uJHvre1XA9pAHio95FNveQwJXj3ZvAHTcfFlxxmYVF5RE095QGwCEoLSaXU2+gX7LQGuM1HRSnRvMQwCeXuvsUaV6CP1/EnAzJZ87zsG8WIs7mm5u5HPDYBvGb9KntyzmRsCo7DMg8FfN5bQ7iyWt3V0JjrTBvg8aw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717183105; c=relaxed/simple; bh=8HZ1n1s6qKTPU9KH0f7lccCKB3kfMQ8uzpkLiQlx0XM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jmd5vEOtaBw3nqnZgy7cPMOEVojPrqWTpy540bJMTylkgz5YLs29rFYEcVrUMDQpLb4kAbbIcyWs7bL7omUQeCT9uaFNahuG2hd5l+x+bIj53XkSh/ory4PNITI3/405HYhQeyTnenBEIlp4qGfSx4zLi8GD6W7GPDt64D8FnXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=OL//CPF3; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: jthoughton@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717183102; 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=2PNxbejm0F++LAZR/c3kykM2MBahftMSuulGipIjRRI=; b=OL//CPF3OaxDLNyUcF7L7kyNMf3VPjTvzSryLUW5C3BaNJ8N7qvdo+GYUTIaqfYoH8qbo6 hUFuWYcFNlSydh5QitAFxaO+uiSO8irmL6Dy7FoK51VSXO1IpH+zzZd24unXmg4kvPBA2e eDLUrnlpHUL5vYjUk6kginvv7JlKt2g= X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: pbonzini@redhat.com X-Envelope-To: aou@eecs.berkeley.edu X-Envelope-To: ankita@nvidia.com X-Envelope-To: anup@brainfault.org X-Envelope-To: atishp@atishpatra.org X-Envelope-To: axelrasmussen@google.com X-Envelope-To: maobibo@loongson.cn X-Envelope-To: catalin.marinas@arm.com X-Envelope-To: dmatlack@google.com X-Envelope-To: rientjes@google.com X-Envelope-To: chenhuacai@kernel.org X-Envelope-To: james.morse@arm.com X-Envelope-To: corbet@lwn.net X-Envelope-To: maz@kernel.org X-Envelope-To: mpe@ellerman.id.au X-Envelope-To: npiggin@gmail.com X-Envelope-To: palmer@dabbelt.com X-Envelope-To: paul.walmsley@sifive.com X-Envelope-To: rananta@google.com X-Envelope-To: ryan.roberts@arm.com X-Envelope-To: seanjc@google.com X-Envelope-To: shahuang@redhat.com X-Envelope-To: shuah@kernel.org X-Envelope-To: suzuki.poulose@arm.com X-Envelope-To: zhaotianrui@loongson.cn X-Envelope-To: will@kernel.org X-Envelope-To: yuzhao@google.com X-Envelope-To: yuzenghui@huawei.com X-Envelope-To: kvm-riscv@lists.infradead.org X-Envelope-To: kvm@vger.kernel.org X-Envelope-To: kvmarm@lists.linux.dev X-Envelope-To: linux-arm-kernel@lists.infradead.org X-Envelope-To: linux-doc@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: linux-kselftest@vger.kernel.org X-Envelope-To: linux-mips@vger.kernel.org X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-riscv@lists.infradead.org X-Envelope-To: linuxppc-dev@lists.ozlabs.org X-Envelope-To: loongarch@lists.linux.dev Date: Fri, 31 May 2024 12:18:11 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: James Houghton Cc: Andrew Morton , Paolo Bonzini , Albert Ou , Ankit Agrawal , Anup Patel , Atish Patra , Axel Rasmussen , Bibo Mao , Catalin Marinas , David Matlack , David Rientjes , Huacai Chen , James Morse , Jonathan Corbet , Marc Zyngier , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Paul Walmsley , Raghavendra Rao Ananta , Ryan Roberts , Sean Christopherson , Shaoqin Huang , Shuah Khan , Suzuki K Poulose , Tianrui Zhao , Will Deacon , Yu Zhao , Zenghui Yu , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev Subject: Re: [PATCH v4 6/7] KVM: arm64: Relax locking for kvm_test_age_gfn and kvm_age_gfn Message-ID: References: <20240529180510.2295118-1-jthoughton@google.com> <20240529180510.2295118-7-jthoughton@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri, May 31, 2024 at 12:11:33PM -0700, Oliver Upton wrote: > On Wed, May 29, 2024 at 06:05:09PM +0000, James Houghton wrote: > > [...] > > > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > > index 9e2bbee77491..eabb07c66a07 100644 > > --- a/arch/arm64/kvm/hyp/pgtable.c > > +++ b/arch/arm64/kvm/hyp/pgtable.c > > @@ -1319,10 +1319,8 @@ static int stage2_age_walker(const struct kvm_pgtable_visit_ctx *ctx, > > data->young = true; > > > > /* > > - * stage2_age_walker() is always called while holding the MMU lock for > > - * write, so this will always succeed. Nonetheless, this deliberately > > - * follows the race detection pattern of the other stage-2 walkers in > > - * case the locking mechanics of the MMU notifiers is ever changed. > > + * This walk may not be exclusive; the PTE is permitted to change > > + * from under us. > > */ > > if (data->mkold && !stage2_try_set_pte(ctx, new)) > > return -EAGAIN; > > It is probably worth mentioning that if there was a race to update the > PTE then the GFN is most likely young, so failing to clear AF probably > isn't even consequential. Oh, and the WARN_ON() in kvm_pgtable_stage2_test_clear_young() is bogus now. Maybe demote it to: r = kvm_pgtable_walk(...); WARN_ON_ONCE(r && r != -EAGAIN); -- Thanks, Oliver