Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2920422rdh; Mon, 30 Oct 2023 11:23:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1t1AU195tD0fPYNS2oElaw3iaQFPbreIwR3tuBjoHokKt0OD4WuMTpWMg7yETyJY2PKvb X-Received: by 2002:a05:6a21:7189:b0:15e:bb88:b76e with SMTP id wq9-20020a056a21718900b0015ebb88b76emr11443695pzb.14.1698690201249; Mon, 30 Oct 2023 11:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698690201; cv=none; d=google.com; s=arc-20160816; b=VqobiCDblLF/evaysoB4b2hRbB168GjnMnPYYEo1n7EPwg8+XkrtTYBWpKa6bKzJhm N1CQrov3LRkf7kgaZRIOz/Tf0A9vEUUuyWY5OF5bf/VhuvmVEAXurDz2jJu7JUS8dm2d XCWUtmDbHyXwecM/JCWI5sy63QGfzwJgzK1WYqSPXum77llyaq6RFSgY8OigUfg4T+12 XLRvikIw5cZlG1AN7Ni6dAawwgcgUQ9srS/ZBFt51puXohZlzQM/P9kj/kt9v6nB5TkD ne/DXnGYUm/fXddMoy9ii1Bg9HrJuX3Uvbi16GAZBO2NIqaGNku8Ha4w6d3bPoZRCBj1 TB4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+/9ggluaJ++InohprDPxvdU7Uw478trPLaD3bhLrtl4=; fh=y45+A1mO1ZkVIBA2GwIiBeA0YrdOUPm8eGmq2G1cm+4=; b=qsE0nMGi0HXzipAlQGVOy96LnOMBZ6x/6T0m+rvMHTT52Y9vu4IzI/TdhsydpTiHkj iHP1fRoDGGUfl6WSKBF3/UI8uM4sr+JXCUHM/E/SB7f1PKfatR4v5piO7578TaxR9H0o pduE9btqz63dVyu/Z1pRKum+Bo7pzq+dLA3JGO6oioEpllkhK9HPVHRyOjwKcYySny3U Kv93DTeZE7gkM281/K+1X8Ruxd2Wb741izWxlIi1xBxG6vjF29mWXgmCMDdJ7LxMdP6e tHTAPHXsas0SB98xuDoYKMqOP3hkoBZccNWTT7CjqAINC8Rw2+JPtN4jXVQ2wo42og3Y Dv3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=evnelxo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q15-20020a056a00088f00b006c145df389esi373922pfj.218.2023.10.30.11.23.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 11:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=evnelxo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 597E680490A4; Mon, 30 Oct 2023 11:23:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229453AbjJ3SWk (ORCPT + 99 others); Mon, 30 Oct 2023 14:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232994AbjJ3SW0 (ORCPT ); Mon, 30 Oct 2023 14:22:26 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C3510F for ; Mon, 30 Oct 2023 11:21:44 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40859c46447so32018475e9.1 for ; Mon, 30 Oct 2023 11:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698690100; x=1699294900; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+/9ggluaJ++InohprDPxvdU7Uw478trPLaD3bhLrtl4=; b=evnelxo6BHvIfCZLkH2HljZAClVdE9ks4A0+VrbC9RPeA11urFDr2tenj96AWZwyAh DNKriGKjs9z0/Hk0iHZ0UUznlW7GwojmeUQiLnk94LmHovwxp7wxg2l7CYsRx1SpCGFv pt3EXezQdlu6PGaOfE1jrpG0yuNNjiMI9gr9GDTgXE3MLzq9zulE+JC6y4uKSSnluXR/ QMCW4L/fWQzumgtidJ2PxovL03srHOZS+U+lRsLxX6zbILHMPnqfBJeIjteHqxv9Oxyn 8p0gUE7P6cWiwtideNc5db/5PLVCeUnyqICIf+JlPh0ZwsKZQBMRxrpeLPVSO3XCEyHA YsGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698690100; x=1699294900; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+/9ggluaJ++InohprDPxvdU7Uw478trPLaD3bhLrtl4=; b=MdcaoA8bg6dvTax0xBkeC2i21IGQgfB64zxEgcQbH8dUmM1bdjOqj31xS6F/U7ymLV 2fPRKUh+Ir6Q6sK0NqYKEWkfQYAH7y4ygj8/VEEGnnXdGRm6PFG1NAl4/v/U284fGiDc 9l2lWdwWeVkHI8ovfbBEvfY6era8GMZzqEqGbejl/tDKjC7sFhhHSasLdLIs3e1sC6Y5 Apmx/1ODi2NAWmeUO1XRFTG8htQxaIRPfcP38AFF7WblJlewzjq9eoYrEDuBrLFOM1x2 1c7+Rcy1WXot4Eow0oZpiZY1DiwZ4FGG4zS8eSW0RugIHO/RQUCpRj7Mr6kRdFWSZja5 uFJA== X-Gm-Message-State: AOJu0YxiG+CgjFHlV7duy2lhWJeDZAsceENnIV4f0K8Jf0STx0EFGBX+ jqYklEgRBJg9i/Vs7LNFf7aYD9+V+dU8bdE2srIWoA== X-Received: by 2002:a05:600c:524a:b0:408:4160:1528 with SMTP id fc10-20020a05600c524a00b0040841601528mr8760818wmb.30.1698690100370; Mon, 30 Oct 2023 11:21:40 -0700 (PDT) MIME-Version: 1.0 References: <20231027182217.3615211-1-seanjc@google.com> <20231027182217.3615211-4-seanjc@google.com> In-Reply-To: From: David Matlack Date: Mon, 30 Oct 2023 11:21:12 -0700 Message-ID: Subject: Re: [PATCH v13 03/35] KVM: Use gfn instead of hva for mmu_notifier_retry To: Paolo Bonzini Cc: Sean Christopherson , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Viro , Christian Brauner , "Matthew Wilcox (Oracle)" , Andrew Morton , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Xiaoyao Li , Xu Yilun , Chao Peng , Fuad Tabba , Jarkko Sakkinen , Anish Moorthy , Yu Zhang , Isaku Yamahata , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 30 Oct 2023 11:23:16 -0700 (PDT) On Mon, Oct 30, 2023 at 10:01=E2=80=AFAM Paolo Bonzini wrote: > > On Mon, Oct 30, 2023 at 5:53=E2=80=AFPM David Matlack wrote: > > > > On 2023-10-27 11:21 AM, Sean Christopherson wrote: > > > From: Chao Peng > > > > > > Currently in mmu_notifier invalidate path, hva range is recorded and > > > then checked against by mmu_notifier_retry_hva() in the page fault > > > handling path. However, for the to be introduced private memory, a pa= ge > > ^^^^^^^^^^^^^^^^^^^^^^^^ > > > > Is there a missing word here? > > No but there could be missing hyphens ("for the to-be-introduced > private memory"); possibly a "soon" could help parsing and that is > what you were talking about? Ah that explains it :) > > > > if (likely(kvm->mmu_invalidate_in_progress =3D=3D 1)) { > > > + kvm->mmu_invalidate_range_start =3D INVALID_GPA; > > > + kvm->mmu_invalidate_range_end =3D INVALID_GPA; > > > > I don't think this is incorrect, but I was a little suprised to see thi= s > > here rather than in end() when mmu_invalidate_in_progress decrements to > > 0. > > I think that would be incorrect on the very first start? Good point. KVM could initialize start/end before registering notifiers, but that's extra code.