Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp855994rwe; Fri, 14 Apr 2023 10:32:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9EvjlMNSCfzxKCDRuNlrtfJUZj4gtLp5kn9DaWhRZmbUQuT9KdTmpU0107O/DmHYzaXV9 X-Received: by 2002:a17:90b:33cd:b0:234:384f:79c with SMTP id lk13-20020a17090b33cd00b00234384f079cmr6238047pjb.33.1681493552982; Fri, 14 Apr 2023 10:32:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681493552; cv=none; d=google.com; s=arc-20160816; b=iF6mUuYaC5FUzzq3MGTvZ5jWRanbjAhOzzNPPqiSuDP4Og4TJvmWwK2cTkUbEQo8Ck +MEJxpY+4YcPSQixDArGK4eBA0ayaJuvdLDsYDmHKM8zMWzNqT8B4Vo+q+1yCjjOKlS9 I3iYGj2oLQUox/1exN/Q8AGY55CleLhF5w6Zvvi3bDhI50lyRkRTgG014KLJsiDp6btG 2FDoN7Q0RRIMiZvEhLr+4BM9xw1ol6FE2fP+FXb0MLofu5tRZY2TDlOQDqDV+j78ao2f oGgp20Vpcb35Ymb/NVBhJ8TIJtji2QCYLA0WZ+nBAq5M+ji14V0nd5zjctOB/8ivvkWQ xK5A== 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=KPViUvkFxC3TgEpc/g+CHYNB1CL2Y9j6aLSEKzBNRU4=; b=R2sBkkV2l7ZwJ7gKcfODy67ffjfCbH/7EUutwVrBPGWK+rsSolQRxrBzggpYYrrqsV KlkFpcefDbnWIfpDyMDVacfmvLPLLu6x6/dqfwibys95r7eyNoYYnI5jn7Y/o9NAetxP 6iLKjxw3x+JsniEp9pml1Xta9oIBziwomWDdHZCqQL5xbpetHWS6TkpGR4iC6ATIc6BK fVcd/BYW5K8o5iz6xcfN9hIkcADdYwff0q+M2bO60MuU5Ay3UrXczhfSE0U5HDkCOuc4 rY5Fw/BTU0GOeBo1MNV48RZ9nZdwwBU4QcXzzH+auFaKegTJQ+OgsHWnBOBvifyJgNBh drYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=bfUCUQuK; 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 d19-20020a17090ab31300b0023f7d84cb10si5024037pjr.127.2023.04.14.10.32.21; Fri, 14 Apr 2023 10:32:32 -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=bfUCUQuK; 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 S230451AbjDNR3u (ORCPT + 99 others); Fri, 14 Apr 2023 13:29:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbjDNR3g (ORCPT ); Fri, 14 Apr 2023 13:29:36 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A276D5BB0 for ; Fri, 14 Apr 2023 10:29:30 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id t66-20020a254645000000b00b74680a7904so19777333yba.15 for ; Fri, 14 Apr 2023 10:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681493370; x=1684085370; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KPViUvkFxC3TgEpc/g+CHYNB1CL2Y9j6aLSEKzBNRU4=; b=bfUCUQuKiETTWlzQAbfjNWEznPFMMabCQwMyvFryGC5wRD7C7JsvkTJRpUdEZwuD3d EmNvtIVJ1PzWXZp48dtSC3Uqt+Qd7L6LI6SYR2R18kQn4tOvoKZvDTWk28yQdgjV/t+g aEQHdU35HFceLmkmPdsoDUlmW9uweT8xG74XVcOTweM7F/e4vvyBkpSw2ZfUszXVuX67 16Y20IFlGTWB08vhSSrtkSoRM6c/HGCuncpoLyYgPWweOItK5ELHtnPUFzjbLrNEYcNm uWOezjyZmaPewp35SfIf/iN4YAyxULNabW1cY5mFVAaVM+373vhmIlEchR/iiRJYdrBd +lIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681493370; x=1684085370; 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=KPViUvkFxC3TgEpc/g+CHYNB1CL2Y9j6aLSEKzBNRU4=; b=Npds7Kbseb3BAcg3yIgvwvXqXliK5LungbByN0spXSmrQOmm/WKE5wSIxwQAEuQGae 2c5KoLva6+iRsM24uM3hPku19+Bcp3WP7umI4y/vL8uSaxAT6w/mrC8QcPPsS5ovNfn8 KcQmbiNRZBNVaAlV9Z3M5xmLUy9PKodU7EeqlQ7gsvE/dMr+1ffh3DtjkQEbR2+M7LIA WtleIhOj4yLqjmkcZEOew2FIVv8lzz6pUmzSb8x9MCrDl4cCf0WD14cZMrXLuEUObh2H 0HvzNEBSJpNK6ZGEvqwbsnJ4XSTW828PwYcL35nMQkJKiOsiVSBjR24L2skb7p9KlJ3P sh5A== X-Gm-Message-State: AAQBX9e5oFhSlxSyQP7c7xr8NJ57xmKUqg3COIZenpkBOKiMgDQRUeZe 0EelUh3edqCdqB0jPRMWqBHWXUU/Nb2G X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a81:c406:0:b0:54d:913b:c9e8 with SMTP id j6-20020a81c406000000b0054d913bc9e8mr3919984ywi.5.1681493369929; Fri, 14 Apr 2023 10:29:29 -0700 (PDT) Date: Fri, 14 Apr 2023 17:29:19 +0000 In-Reply-To: <20230414172922.812640-1-rananta@google.com> Mime-Version: 1.0 References: <20230414172922.812640-1-rananta@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230414172922.812640-5-rananta@google.com> Subject: [PATCH v3 4/7] KVM: arm64: Flush only the memslot after write-protect From: Raghavendra Rao Ananta To: Oliver Upton , Marc Zyngier , James Morse , Suzuki K Poulose Cc: Ricardo Koller , Paolo Bonzini , Jing Zhang , Colton Lewis , Raghavendra Rao Anata , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, 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 e3673b4c10292..2ea6eb4ea763e 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -996,7 +996,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.40.0.634.g4ca3ef3211-goog