From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Thu, 21 Sep 2023 07:24:29 -0700 Subject: [RFC PATCH v12 02/33] KVM: Use gfn instead of hva for mmu_notifier_retry In-Reply-To: References: <20230914015531.1419405-1-seanjc@google.com> <20230914015531.1419405-3-seanjc@google.com> Message-ID: List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. 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. 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 2BBF2E7107A for ; Thu, 21 Sep 2023 14:24:46 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iKfz3FQaZo2C15VSiYIdm0IqBTn9TKGIoxXpYwl0pCA=; b=E93rvbvzlLpH91aRnjJTnuTDMT 58gzDIc/FEmsO95cLkWMXyzGtVppCUM6sjWXtI7kEe8faikL6d3un4hyPpnaScXtbsPdVWAx5evzX Noc/qYUcMc+jWKNubmOFqek8mSqP3zRtXdf29ysjdi82QcSwVJ0TqsCqWhQ8id56IYGeOAlx+S3nu J67pubcuSYpCyNOdACqVtdOPY0nuwhU6R/KrohqJeY8LudpA+2J0imic3r1CExzPScPR9lIG05/h9 QDN6VSABY6Z8GfwDUeB5kq8Fu92h5ao6bpsRT9UUt/trg3ImatBZXPFwwUyTOPm/rwwPxP5nqCRzw uOQBz0PA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjKbe-006Fyl-0h; Thu, 21 Sep 2023 14:24:38 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjKbZ-006Fwf-2U for linux-riscv@lists.infradead.org; Thu, 21 Sep 2023 14:24:36 +0000 Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1c577fea3dcso8361285ad.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.infradead.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=i42f9Lc1sTmK1duCL0p9kDfVhu3/gBD9GsPcr2D3GUJ+d24xdge9Tyi8KeC8AfbrFR 2zoUC/6gDqiCE2JgL7JT2KAOHv1WpfMDQomx/OLGTMwihAY0X/HgMdk3D7XlFS00evj5 zYW2+Cjj90KtMOtIsHFtYcaDMqEVJ2J/qVF7rxhHtGZL/z2gRaaOXaX3tJbB0reF98mv yoYFn1ENU8IKxsqjnYeWAGai8qEsKh3nSFCp69249xgl7LwVtoj2FhzDsjNzZ/sHlm40 KrcxvVLmRMkWl2EIudtR13FeZG2EDnRy6o0Lx0Xs1Ew6NeCatiJAbGpE/1z3Udo3J07a eXZg== 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=tB9cJc9BnOLk4KIYNqU7SiNTKTP0fu1+FahvmsMjKONg8oXiMw9Rkty7H+DTpB3921 /nG8XwnS3fknCMGIKg6KWIf70rbe9P3bfRyOFGIaHGnbkc4pLQNjHgq5qNXBFshNtFt4 a1UbmRArdkTYzsD9YsBO1J5WPVExtL/OPrkQaI1UPHyEze0o1cPS8EPvO6s8cMqoJKSK imFU6fTDbg048YT3dWIUYLxjkEH6RqLBw5fMeoNjIrKL5ER+2taDxCjCDoZCxQUnyjc1 ZXsS+H4HjmLsS4XIcB22jOPp/J8Ci/Mh8tId0NpNL2N3lpA6MsnVGb2Dhdy8LjhIwCli 3EnQ== X-Gm-Message-State: AOJu0YxVqvtgg2g3Hl2xIuMxXaQ74LTszMModJwRQZG4rSd8sYvnn1b+ J3zInumEIs+UN17ANgqMdqhwSnezjzU= 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: 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" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_072433_811877_AC4F5676 X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 2ECE8E7107F for ; Thu, 21 Sep 2023 14:25:27 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=uypvPAE1; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4RryNj50sWz3cPS for ; Fri, 22 Sep 2023 00:25:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=uypvPAE1; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=flex--seanjc.bounces.google.com (client-ip=2607:f8b0:4864:20::649; helo=mail-pl1-x649.google.com; envelope-from=3h1imzqykdcqseanjcgoogle.comlinuxppc-devlists.ozlabs.org@flex--seanjc.bounces.google.com; receiver=lists.ozlabs.org) Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4RryMk50c7z2yq4 for ; Fri, 22 Sep 2023 00:24:33 +1000 (AEST) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1c448ba292dso8362645ad.3 for ; Thu, 21 Sep 2023 07:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695306271; x=1695911071; darn=lists.ozlabs.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=uypvPAE1wk2nXrdiF0mhMLNGyVezcJH9t+2HVkPSf1DJx7PD0jrNqwKxPDyQypGwZk n4YEsfM9fc33Nt8kMhTl2H0rg1O8e9D4CM3W5V7Q/f2+qgm313gC/23N0SKiI4T/G6qS UJKPTwd+1RR/LNKpxtrXnsJbE5ssBvNvILMkKegtPGEeD70c19HDAuc+tsCmKKy9kmih UTbhTF15ocbnwbOgoflDwslUOaQxixQK5xd6nAMn/x2iE7yBp2NQ9Y3pZzF4iEd3z3yy n/RAkgOcUkTzH7pTwSkGKsbB58niOeHdL5LRmSqEIzPI75GcB6sei4tdVAGGr00YV6y2 xvWQ== 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=EvmgdB/hpVh2GwRZpEu8Gw7lQsV4R+4sbxhqBqVzckDpibxan91Ys0PWmAdplDCrg+ hVv0E9vsSEuyQ/Nx+Pu8kk7LiLmJoIcAMBI4u0pyilnzhXc37XNqHluonoYakcsGL6G8 0kI8I3gVx7s3R2NBOvIHoDDW8wDwDEKuQn1MYy0UHpbBe2IVRuGs43NXkSJd2GCrkDI4 j0yO72OLW/5aVPHTVm5czYY0qtXmBRohd4ufFxe9YEO31c9cajv0UszqMOiQZCYm2gga Jancj9a9+NxvP9PoMAD7tcxDq3bzUF7c3WBG8wwKdds2LMpKmHx1ox15mIP3woidTPLu 48CA== X-Gm-Message-State: AOJu0Yzb2gudBmpyCQ6ue7s8Z8aOAopnJcO+q/wWXSOw3Rkea86fm+hU Z0X0QDPZx2cYF30m3QPueT5YkBwSkhY= 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: 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 Content-Type: text/plain; charset="us-ascii" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, David Hildenbrand , Yu Zhang , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Chao Peng , linux-riscv@lists.infradead.org, Isaku Yamahata , Paul Moore , Marc Zyngier , Huacai Chen , James Morris , "Matthew Wilcox \(Oracle\)" , Wang , Fuad Tabba , Jarkko Sakkinen , "Serge E. Hallyn" , Maciej Szmigiero , Albert Ou , Vlastimil Babka , Michael Roth , Ackerley Tng , Paul Walmsley , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Isaku Yamahata , Quentin Perret , Liam Merwick , linux-mips@vger.kernel.org, Oliver Upton , linux-security-module@vger.kernel.org, Palmer Dabbelt , "Kirill A . Shutemov" , kvm-riscv@lists.infradead.org, Anup Patel , linux-fsdevel@vger.kernel.org, Paolo Bonzini , Andrew Morton , Vishal Annapurve , linuxppc-dev@lists.ozlabs.org, Anish Moorthy Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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. 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 CF6E5E7107F for ; Thu, 21 Sep 2023 14:25:02 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VjQbW3I4PzrhTMjZwkmQVoqmxu3pnvIPTkdr/d7BnK8=; b=D+xA0a/BTdLAal3pVw8jp3Tudp 0ibJtCegs8YuHTZGmRW6GrYPfIj7lYrcP6zNlakDGpIZEqaUXJdLgHDbjQjkLbsSAfqWECDJnKqG6 bwly5rz4kxNEVprvQb8pux71dbgqxLkGIB+ZSm/M2/j+aJRXFPqpQ3dQr2S+j7roMcA4OU4E1z9ku bBCGtuhQcmMgHJl1jiH+yypwS7A0W8QGdkLxXKGjoAXZwC2UmC715A1sYXI2rqHgrJvO/BCW1oveh YnHEoW0NIRvxBymrwjFzNngvXTtWYdcBALELhR77ZRmYqUY+/zYvAceS/76tGzMQd5qGTtlWqrYsb F/WIQ0zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjKbd-006FyL-1I; Thu, 21 Sep 2023 14:24:37 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjKbZ-006Fwd-1p for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 14:24:35 +0000 Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1c43cd8b6cbso8533165ad.0 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.infradead.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=i42f9Lc1sTmK1duCL0p9kDfVhu3/gBD9GsPcr2D3GUJ+d24xdge9Tyi8KeC8AfbrFR 2zoUC/6gDqiCE2JgL7JT2KAOHv1WpfMDQomx/OLGTMwihAY0X/HgMdk3D7XlFS00evj5 zYW2+Cjj90KtMOtIsHFtYcaDMqEVJ2J/qVF7rxhHtGZL/z2gRaaOXaX3tJbB0reF98mv yoYFn1ENU8IKxsqjnYeWAGai8qEsKh3nSFCp69249xgl7LwVtoj2FhzDsjNzZ/sHlm40 KrcxvVLmRMkWl2EIudtR13FeZG2EDnRy6o0Lx0Xs1Ew6NeCatiJAbGpE/1z3Udo3J07a eXZg== 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=e5a3APPLfdcsOgLzdsvE9/m5mEg4IVk49kmuM3iIiQm4nAM2ENt5qRUMlPunJyHd44 fafKEpFg18E6xsOljTKma4/2S9WPB1r2sQsDW57Daz/tQrjipD8ZGA+G9vXBhXEbW77e l/ah5xGXYgur/vqST0QmNkXgpBOoIQP/y7a6PyR60YEXpHzE0dPk77Gct2tHIwHJS+ap GEnRt4mv9SrQoXjLNTKTorCXjcIZA/+/jrPHWJqIeDM2Eg3sldBlJCPCE2xbN/uG+oHC 4mbBxznNZqIBjX5xO3ZabLbUBlAXwzybERTxbcr9XnlTig5ezy7/Fv6u7VOsx7p9V0Nf kBOA== X-Gm-Message-State: AOJu0YwbWRNE0fKVZng7TrByBVKUZI3DPPZPCHvqptdAzqNu/f+qsE0B KkIDT/igtB1mSAoUfHTNldTdUA3lZEE= 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: 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" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_072433_623872_EBEAB94C X-CRM114-Status: GOOD ( 12.41 ) 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 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel