Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9727286rwd; Wed, 21 Jun 2023 11:01:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4AXc3UUBLzHkIjyLq4BN1x5mAlJcBoa0n+SUPrLxet2IjdLVUXV96Jb6OZY1ORXjbFzQ5c X-Received: by 2002:a17:903:24e:b0:1ae:8595:153 with SMTP id j14-20020a170903024e00b001ae85950153mr20022915plh.20.1687370464367; Wed, 21 Jun 2023 11:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687370464; cv=none; d=google.com; s=arc-20160816; b=N7coeD0eFP3gAAlySNHIhvKICTVKLeFAJZjw/tFX74WLfFPsTedSktb1hJAtIlUbxY WFhEAfTFD9z6wiSGDochjAPslWXckmFX52pIQafwunhPnHjgmXA0rVUEyQgRFWQZYlbu rcY+V0uZxG4ynTwjtGlxkiSAqiOjBQZr1Ok5JvlgRBrZmQ7q6IX1SljWBWN164FC15G9 wuUWD+LzoHHufrsb7kqYGceP1Bigiy14fSxCsvXaEWYD9YcnOW2Dqeu6v+4AbWbsY85C ZvT0cHkjoH3uIkU9e53RR6EOGazkCenwsSv34Nw/7+CoSFvuHN9k+eHHpBg5OcEwBUZR +8vQ== 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=kpR1MspLCCKbLGu542rFrU99snL12qe0SU5vnENHbnc=; b=S8VVqFjyX+BfBtSlzA3EyUvD3fjsutuh2fVFQgR2kU4smPPB67x+4dQvzfGQxnoMwD fxTEJie8lOwTjH0U92pqWPyLTPiUZ91C3GduuCegU9FWWjYhYCJ8eblsV8ZnmjP2oYaj QLAkPPkLmmsKnM02tYWbKW+O7QWF9AYq3dF/kHJgqVXXKg0qPcwyYmrcFOTlFm56DO36 p83VAp5AdO6TwjN3XtD28VMIyp6tfPDMMx4MVerccbcbGeVbrj3LRqmToAT4RrhIzqA8 i9UJ1DPW6banroKTuJDFy8rCLNDNaQV9nYJRWAeal5ZqQIay3UxQDPxnJzdEz+ywJZce jVOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=obkQNETd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a170902b48200b0019ca7a76d68si1414255plr.67.2023.06.21.11.00.48; Wed, 21 Jun 2023 11:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=obkQNETd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbjFURvo (ORCPT + 99 others); Wed, 21 Jun 2023 13:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231735AbjFURus (ORCPT ); Wed, 21 Jun 2023 13:50:48 -0400 Received: from mail-io1-xd4a.google.com (mail-io1-xd4a.google.com [IPv6:2607:f8b0:4864:20::d4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F9D3212A for ; Wed, 21 Jun 2023 10:50:31 -0700 (PDT) Received: by mail-io1-xd4a.google.com with SMTP id ca18e2360f4ac-77e390c2cfeso403859139f.0 for ; Wed, 21 Jun 2023 10:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687369830; x=1689961830; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kpR1MspLCCKbLGu542rFrU99snL12qe0SU5vnENHbnc=; b=obkQNETduI4Wdlr8DqbH6rQDpqF2mUi0lafiiZR1QXrNN2+tKemED10KMGrakG13Nq +F9e7JIuRjiRR9EfoJnua+9jPsENy4Tu90Vrn/2nK11OMp8Aj/golURDqyPfJ94Cfrxi hdWdLoNiohD/PMMDEG0mtQHMd7A92j4tIxNPh8D/cM9gYPH0WwqnOU4OcPsZKdr9HTOs pyGKjpe6+P6Xcb6ByP94N+J+yZmYDJogpjw8kcjVcP5B1YTqtAJdqi8Hp9kutYXKuAUx OCxMudA25zodKFZSyAwbz9vLyvHyzcqnxGuKjUldsdPVjyx7x6uGCQbzc3ZzHDMDOM0D Kg8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687369830; x=1689961830; 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=kpR1MspLCCKbLGu542rFrU99snL12qe0SU5vnENHbnc=; b=AReoERPY+6rc74YW+SOVk2FHQUkvOVlkHdNNRSW2lu7RmlKgGIYzVAmWe+MS1J4ES+ p+pJvWw26uDRysoS4wUgBBOMRy4dXgbc06NYKshPSv+z8qkxD5L5lc+Ka6HWEgJbP4HO 78x3rOpjH6HmJxwv1n52qeWL5yx+IZZNQkAqOXApZS3kIWWNn2EJONTp476f1uyrtMXU nq8+NCUVhiXrC97TXbu6sGNsVBAjzlnqX4tlAKIier8iN4jirT3rJTYbGUFavE/92rUq gxr0SUwb5xGyJ8EWthT98hZxCDuDmydnCFDK7pYj+86Pj53vFH9Y8WBin2E0FDZN4Fo+ CENA== X-Gm-Message-State: AC+VfDxgQ3QLXK+rHf6/QesdmEXboi/nUslFOxdxq3rcA4QNZkU8H929 jVUW4KfRmHUC1ww/oEK1bw4b5UvSdax1 X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a05:6602:152:b0:777:b38d:2333 with SMTP id v18-20020a056602015200b00777b38d2333mr5713635iot.3.1687369830330; Wed, 21 Jun 2023 10:50:30 -0700 (PDT) Date: Wed, 21 Jun 2023 17:50:00 +0000 In-Reply-To: <20230621175002.2832640-1-rananta@google.com> Mime-Version: 1.0 References: <20230621175002.2832640-1-rananta@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230621175002.2832640-10-rananta@google.com> Subject: [RESEND PATCH v5 09/11] KVM: arm64: Flush only the memslot after write-protect From: Raghavendra Rao Ananta To: Oliver Upton , Marc Zyngier , James Morse , Suzuki K Poulose Cc: Paolo Bonzini , Sean Christopherson , Huacai Chen , Zenghui Yu , Anup Patel , Atish Patra , Jing Zhang , Colton Lewis , Raghavendra Rao Anata , David Matlack , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After write-protecting the region, currently KVM invalidates the entire TLB entries using kvm_flush_remote_tlbs(). Instead, scope the invalidation only to the targeted memslot. If supported, the architecture would use the range-based TLBI instructions to flush the memslot or else fallback to flushing all of the TLBs. Signed-off-by: Raghavendra Rao Ananta --- arch/arm64/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index c3ec2141c3284..94f10e670c100 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -992,7 +992,7 @@ static void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot) write_lock(&kvm->mmu_lock); stage2_wp_range(&kvm->arch.mmu, start, end); write_unlock(&kvm->mmu_lock); - kvm_flush_remote_tlbs(kvm); + kvm_flush_remote_tlbs_memslot(kvm, memslot); } /** -- 2.41.0.162.gfafddb0af9-goog