Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3109651rwp; Fri, 14 Jul 2023 17:57:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHYGFaIxwopHNyZAwtbeJmBOqSGY3A7ZsuvRn9YpJEhYn6tqSOHR9qqB7r/4sVjz/Vo3AIw X-Received: by 2002:a17:906:7a4c:b0:993:d90e:3102 with SMTP id i12-20020a1709067a4c00b00993d90e3102mr603089ejo.6.1689382652490; Fri, 14 Jul 2023 17:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689382652; cv=none; d=google.com; s=arc-20160816; b=XsTSIHwji4lDW71KvMDx2qfHLPtykzLhgsuDhAnUwyytv3fFex/aJdYBM/HNapm1mq hB52r/bdKvjLhoUDVRAAcDe//FY7NKVjs9dTd/EA8xNZo0UZVe22lwuijAFImzNIy0hT jjHa1tEhKjJYS5uwYqMeZwnMHdSG7/NAjRW2VCO09qMtCkSxvVPgcfzonu3lYH6Cv6BO s+ANGk0mHZT61cCbI3JupnVD47ACxhA0sPsxzgu0XPs2luXysbK25I6W3wUDaCa/5+ou 6kUKrC03HrznO9fz1+AfOPLTYPOSUu3QRcrIwRyx8ZCH7mWBIYIYCyNlYU58LvgnLa9G RctQ== 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=NQY+Dtk1XWrNNGuHSHxbkYrauldxXbZA83USiWOTL6o=; fh=0mgYt7awHARBqooV7+boW/ys14vuECt03vTY4pGVtiM=; b=N/jNmoIEwjxT9Y8Z4HVMtFYxM9kSOB9GWfd/YvW484nJ/H/Cu9382XTCZNnODGiaAT JzRZmfJx+d0Rk96DWtMeDp3W/u6D5BvKqHKvdfLqVGf56ST+Q4yZpRBdw3DoANplxM7B bjH/DysPh1b6VdTUwkszcE4v0xKlbyRxJVsC8QdKqh51OaH8TE3yl0g18MS4239yzyDm rb9Mi5HmYkRG+4Ss5OyPGYngZ13i+Na3zKWisLJpYk53NmBsr1MUZanDIO01WTT8jZN2 5Cx7zuXMg1sZ+ZRXTJUpMWntx/SCUAkMYcTvrzGKF14o2TTb7RTBH+ddHOrKEIj4uhJe nwjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=TCgWEy2z; 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 i17-20020a170906115100b0098dcadb4002si9044540eja.492.2023.07.14.17.57.09; Fri, 14 Jul 2023 17:57: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=TCgWEy2z; 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 S230371AbjGOAyl (ORCPT + 99 others); Fri, 14 Jul 2023 20:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230424AbjGOAyY (ORCPT ); Fri, 14 Jul 2023 20:54:24 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC6303AA1 for ; Fri, 14 Jul 2023 17:54:20 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-cac213f9264so2084243276.3 for ; Fri, 14 Jul 2023 17:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689382460; x=1689987260; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NQY+Dtk1XWrNNGuHSHxbkYrauldxXbZA83USiWOTL6o=; b=TCgWEy2z8oOGQwvnSBHn0AkAkVSlT9c37MgvWUaNlBXCNKNpJR/vOwVyuvEfVCFhZH 75Djs6cT8vsl01b8fPqnk9tIFBiF7zvqtCVYGWLZuWsMETu/RPDzgHfQJ0N6NM5C6vOx hB+mAtMX3eXFTzff5OpvcbDHdQLWnoerWsIudu0SL4c3QoXFOjZqkSdjyoCJtPVXGr6W //LvcxbEku4U7vC3//3dhn54WTCVJcS92mQ6c7NC+uGD3MBXy3sOfSBG1WMjwOX4vcYi XoUh9543oJXJngnlcI/Jw0nJMM49HqIHNGb/O4YAGu77Z/SnUdDFBBfexEdSrvLeIvbz Ltlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689382460; x=1689987260; 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=NQY+Dtk1XWrNNGuHSHxbkYrauldxXbZA83USiWOTL6o=; b=Yhp4nTrUOX11coTKAbUu8dNUrVEWpFkInSV+dOsZdm3jIaZxtPV9Ya/FXENyFj0jHv e4vk06OWIGiLwujfTHBzZy4Y58/TIs9PKXh+3R6oiOIuJo+TssrVdrSJOdXYPTbd0Z7j zCx1i7nFKcbOXEuueHXfSWQ2iRVKhfrxHUakCJzEzvEmEiN51+z3HRwG+nxwvNV8tevB wYldX2w4Ct4+y+FFPeSww5SAIa//L5stdVmBthw+MxYXYTywC3MAHrWXApoyT5R8Cw0P Hec6W4gigl7aEuI/kJVwHmI16FA2al4eHJcUuolv/Yw+/iJQmAU5j8qxOWJoOAmKLmep Su8w== X-Gm-Message-State: ABy/qLYRI54Ur/fDAx7wB2jRfpBTNAfOHA5Vh8LEqKZ/3tIKB5yZHCWS 7ZFqT5/dIqN7dDRJNtpuTx57Xev5diCO X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a25:ab81:0:b0:c5f:85f5:a0e5 with SMTP id v1-20020a25ab81000000b00c5f85f5a0e5mr14207ybi.5.1689382460190; Fri, 14 Jul 2023 17:54:20 -0700 (PDT) Date: Sat, 15 Jul 2023 00:54:03 +0000 In-Reply-To: <20230715005405.3689586-1-rananta@google.com> Mime-Version: 1.0 References: <20230715005405.3689586-1-rananta@google.com> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog Message-ID: <20230715005405.3689586-10-rananta@google.com> Subject: [PATCH v6 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, Gavin Shan 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=ham 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 Reviewed-by: Gavin Shan --- 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 387f2215fde7..985f605e2abc 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1082,7 +1082,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.455.g037347b96a-goog