Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2350666rdb; Thu, 21 Sep 2023 16:35:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTLCREUOyEKpDLl/WlBUZhAwWIntjSbg7ojoSeHnhfrFG6DeruolzYVlQoxbls6Ml4IBzt X-Received: by 2002:a05:6a20:4303:b0:15c:8555:a21c with SMTP id h3-20020a056a20430300b0015c8555a21cmr1643277pzk.8.1695339305680; Thu, 21 Sep 2023 16:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695339305; cv=none; d=google.com; s=arc-20160816; b=NnMDnHiguKxIqER4o82ooPMTwURI4NjVZ+iToI2TZZ9uLAR08alEfs3OBlMfxCAAip XTuLeybfsj+CdnRpzqFC5a7/Se8l9SD705rvOD82Fq1kQU/loncKYSBQX5392lfZMVAs 0inKN96NSoQjSTl5U2PM5ra5N/j4A2yvDyr1u7eRT5gw5gqDQhNhjKILhudqClwd5cMG cUsZWbdC0r4hM+t4x8aQuzQpaeo4+PDwWeWJ6/CNzdHV7D5KTg3LdtkbXXIVNYkNUnyS Jrw74UmCe31RVMWHwuzkFXYuLYTeyuwg8kUtdO+Lg2KuXJkt6gNbZCs73UysWx80O9Md /eXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=VFujV55InQpfIcmwhWIdcFo9LOSK6bP3ULKilR3pEPA=; fh=w51hLg2DMexND5MJ1pnR/yAQHK++aIx12kZWCEVmzno=; b=IRsf5AqksNV69SL/zTqgqlY9n3cFC4woByMhrdPTmfkNV0oINFtDN+Nmwd7FGkrHXH vqFG04y6G7fN8K/B7bvZWWUr7fi+bC90sEK/ZVvQhK9TUaUkGUEQsyfpdZozTEgBnzLH tj12gg1Ljdaqotsb5orIJ8VplOM0+VChg6YkxcoZJQY7KbCk4Q+RmtbEHAsT5xB6sZGU VyaSrZhSZv3uETInNZouAfvxGhVjSsqRJBGXQCeuQGmokOFyxJKYdy4osjdGAXWUSx5e Vron4c+CXDnUWht4J0eoWZ3WoWHLAUajSbVP7wX9iTMwANul+zUUZtuRSolSQmu+68S1 tJhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CRrY5DH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00573e7fd674esi2312274pgb.661.2023.09.21.16.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:35:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CRrY5DH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 10752831ED91; Thu, 21 Sep 2023 14:07:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231279AbjIUVHJ (ORCPT + 99 others); Thu, 21 Sep 2023 17:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233268AbjIUVFj (ORCPT ); Thu, 21 Sep 2023 17:05:39 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF1D26DE01 for ; Thu, 21 Sep 2023 10:32:34 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-690a0ec0be4so1147314b3a.1 for ; Thu, 21 Sep 2023 10:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695317554; x=1695922354; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=VFujV55InQpfIcmwhWIdcFo9LOSK6bP3ULKilR3pEPA=; b=CRrY5DH6PB4BwXaEGzcHDlcir4MD72Km3WSYqM2eWTj93A1wQ1C6wh8A0S9dz1YXGI 8JTJSzUPgq9gB8WJQ2650xRU4IODoJA9ttmV6GFotUyD0AKY9VjieSr9nYp3IvysXnvg DjW09svO/Iktgs4Biyc9eMa+lhhUDuHftnK2ncYtQf/72FiZV9inILs5mLFteZqO756F GKYCopYONuRUazKxfRBeTIsHjIa3nOCEPZ+IgOGq+tSCHAg45ATbTikShguve6C0EayE O9mrQGTlA30G2YuN8lwYG0zPVqwAaVdhWJ8VJWzITm7a6IhBBnfMvVuISW1yS8yy0XCE fVoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695317554; x=1695922354; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VFujV55InQpfIcmwhWIdcFo9LOSK6bP3ULKilR3pEPA=; b=oV/l5Lsk7CI/GlYWimyvlRfOj15gw3TwFpVccE3a6eECzvNqPP27cZ0Dcp0YJcLxNZ jsx/hB0rxPJrjUXijCROC/82X2+OjmP5PibftnPLqZ8ISmSGrmt02hyq+ndWDMQ3btJ3 pQNp/UmxQbbry6njikdBT/9Q7DvZGv7kn9+fuITV1MpJ3bTzRNmlSJaa6oYp6iBSjtTG UMNvyxkm0G/hQ0ooTEj0uXcxuHUHSN3yZgDi3CXBxwQ5Rmi/kKb/u7d6eNSCpr3Fu6xU /jXGSC4vC56eJ29KPpH02TFIHsQijVvWZPiyZvC7Qxm4EFxpGcDGW6Z0nwNYG5l23wzw BEoA== X-Gm-Message-State: AOJu0YyVIYsewoVD8Lx3fg80IsuYRGSHN+cg0SHSyYlxqMtxbGBiPw9V cqnV6iSVUdZXqEZM2lxWCcO373Kiiso= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:ce86:b0:1c3:c127:558 with SMTP id f6-20020a170902ce8600b001c3c1270558mr71199plg.0.1695306271120; Thu, 21 Sep 2023 07:24:31 -0700 (PDT) Date: Thu, 21 Sep 2023 07:24:29 -0700 In-Reply-To: Mime-Version: 1.0 References: <20230914015531.1419405-1-seanjc@google.com> <20230914015531.1419405-3-seanjc@google.com> Message-ID: Subject: Re: [RFC PATCH v12 02/33] KVM: Use gfn instead of hva for mmu_notifier_retry From: Sean Christopherson To: Xu Yilun Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" , 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-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Anish Moorthy , Yu Zhang , Isaku Yamahata , 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="us-ascii" X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:07:11 -0700 (PDT) On Thu, Sep 21, 2023, Xu Yilun wrote: > When the invalidation acrosses multiple slots, I'm not sure if the > contiguous HVA range must correspond to contiguous GFN range. If not, > are we producing a larger range than required? Multiple invalidations are all but guaranteed to yield a range that covers addresses that aren't actually being invalidated. This is true today. > And when the invalidation acrosses multiple address space, I'm almost > sure it is wrong to merge GFN ranges from different address spaces. It's not "wrong" in the sense that false positives do not cause functional problems, at worst a false positive can unnecessarily stall a vCPU until the unrelated invalidations complete. Multiple concurrent invalidations are not common, and if they do happen, they are likely related and will have spacial locality in both host virtual address space and guest physical address space. Given that, we chose for the simple (and fast!) approach of maintaining a single all-encompassing range.