From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D424B67D for ; Thu, 21 Sep 2023 14:24:31 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-1c577fea3dcso8361305ad.2 for ; Thu, 21 Sep 2023 07:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695306271; x=1695911071; darn=lists.linux.dev; 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=oJzf05w0jhA1hYW0VgtY0Qtcpq1XvcD3SepJJcDfODaclFbotgrUHJd0eqZoCTk7zE B8GWAjLafT3KWYvokECleE9APovxft9wP2nVCkz7XnT+JkiwW9lUuwi2KBC2UHhQfp/P G/Na4dxmpKdhBNYKPct0866381x/21xXCZN/f/T/aW04JbKODsGLrgPJtlgnNLrm1CAm ZIddtTu+6Kqr2t02qivYNIF4+TAD2513dksdOeWpae8xrwuGLxCBEl/7tyKoBhh/LpZf mQfpqMDbcgzxQUr6+lOifGto/zFcWBT5QKHhgfpS8AZSoynYz65761EuwrkgGb9k3Q8+ GpuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695306271; x=1695911071; 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=DtvfZVC6PNzQCE6/lfif05BZLxuApxHmJjWfhmZt+DqgUQCDNsYyubdEbnRW5xivC/ WoXqtkIZ6orF/CH/spAweWRK0Lo2i8kvMO1LeICSagH4b0mjnqZO6Xo+1L6lA9uTcd/6 kG06Ronvg8KQuz/RNRu0wxWRrAjsprRg1ViVQL+SYyX9yqvNts1DGNsnT5uLwHvEh+95 jwXVPCHZpHl6aNJBt0siOWmX+1fqKQXLad3PsQ0iCzSOBbXjkZRMoMoNk7rjCoOYUYbn rc81ioV7GCaG0DzngB2CTN4QzBK9net5hL48pixe1ydFoVTItmvrm+QikDrnPQsoPSE1 FTcQ== X-Gm-Message-State: AOJu0Yy+ss73S0uxpmECvW+vitv8Qa0d0Y3Wzvh5oLcz0fgsioNHtyPN yxbYNqxcF4QCqCFjlpuJrnaxMxMm/64= X-Google-Smtp-Source: AGHT+IGn6bxt0aytyfRrQvdNGXaSXeT8sIcIptWMB2qfEas65NY2TcrLdWuDyigFBOjNZ28AUG3erUeC33s= 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: Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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" 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.