Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4999144rwb; Tue, 8 Aug 2023 18:29:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuD6/jjUMn/EGsoX44gx6sbuVU85ax51IcNNCyyoqClrsRh5R9DMZcj/OVDCdUhULKarId X-Received: by 2002:a50:ed85:0:b0:522:7ab4:31fe with SMTP id h5-20020a50ed85000000b005227ab431femr1128411edr.23.1691544557700; Tue, 08 Aug 2023 18:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691544557; cv=none; d=google.com; s=arc-20160816; b=W4QvqL7LZ6nuGLW79QrgkX+vmu4QgW6WAW6Iu8h+gYTvN7FrjAng0IX8SWH8OnQ3wF iHy5I1NlyaeOLm22MzMexpDUzIOj+tM2bbCQiJ6Cg7Ydmof5DyHuF7KRRjpxHWB0z6bi kiSo3lxE7010ZufuT2rNX9LhEu3MZYzwAGP/fT8h2LEFJi9icMbQ4C18W7P7r0loUSGS Ez1LpMMTTNm/Vr+GFl9KelLG1sFZc00JaixqFw9FOpLCJsThd3yV/QxgYth6giKOrEZc LpO7gCDIimVM0LZUOMv7mwNbcm8NnCdagmWIEHpVjhmqevuWpHdd0i18wCqsbQ6JhpUR u1rQ== 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=DdFQXc9QjMOj4pMVD7mddwddfJwM0E/FVNI1wIxPkhk=; fh=yw5tXiXa6fgZNcqMuRzw9eeT6vziy3WnhZBwRz1vFio=; b=Iio4G1m1sEAFGFQBAuEW9Z2Ny9VoV1w0qY3DqMmSNcUZ65gtBKCLbEHRE9HdlS2/rY 8MLCQzYa1JLgfenTWIZLQeQIegcZ/H8kDeHZUqafW/7zK0k4jbgKiNf6EHHCK7WM5/xP EEVOvWaQMF8//W9b9t7saOxmkES1TdC1QJfXQwA7kKpmWK9fLvjvPEbZhw7qlnirY+Aw 4yfy2No0H66Eb21hMx7Yuq8eo6HTlWHKXlUj2wzAJlmOFzqGJXbt80nvR46zoRcerr1+ bMtpMPHsJ19jt/eYXxrkhdmo9qz46rzdpbXBy+UodaXfRyse6CwQgplNXpbOECrUVoLX 1WFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=GGya4r79; 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 k3-20020a056402048300b0051e7235b2e8si7808802edv.542.2023.08.08.18.28.53; Tue, 08 Aug 2023 18:29:17 -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=GGya4r79; 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 S231908AbjHHXOa (ORCPT + 99 others); Tue, 8 Aug 2023 19:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbjHHXN6 (ORCPT ); Tue, 8 Aug 2023 19:13:58 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 738F81FF5 for ; Tue, 8 Aug 2023 16:13:48 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-57320c10635so74063277b3.3 for ; Tue, 08 Aug 2023 16:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691536427; x=1692141227; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=DdFQXc9QjMOj4pMVD7mddwddfJwM0E/FVNI1wIxPkhk=; b=GGya4r79Fypy7MpijHUr6lRrKbN2KwgnqmepmFHyoEm6JOw0RI4BnR26D52ypMST14 qMrhS6uMP+X/P+04iY+CFJYP/yfNgW/oQiRxmX4L8KUMTb9SHE2leuL53nL+lEy8UfWN H6Gme/iQnweVgHOIz203N5vFFXqVCtC2ViqgYkIHf1XrsCct05bcsmV1KcRfn0mKeymj ESMAAwstxX9ujJZpbixig2EzSNSrlwlq3HWLXEyApK1JC0D3VIjPeG/oYEmpo68kYHS8 /95jhR/N+ADW8Wt9ABI0Q1X51ZWQY4WgE96INI5uDk8QgBXuW/N36eA7E8a9TtSBew8R 8+sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691536427; x=1692141227; 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=DdFQXc9QjMOj4pMVD7mddwddfJwM0E/FVNI1wIxPkhk=; b=ZSkci/PFXT4CGduboT5RFYk8NikorLyg5MJeMp9p1wt2H3P5lIJRvYSliruehegR0h 3wXbx0MuhBf6GKD76ENnydx8HgDBEl87GkBudvo7d7gpbnl2vaxQspAl/j8BlPxSTHBM d0OXHLmrVPtTU54Q0h89Bt0dmr8smoyv4jK1JU6xI+67vIFZ+LnnqwIl9eMqOcLZvaLg wlZOoTBSt2Mrpe0sLq1oIIBNLJPMh7WoNU/JsnLXpQJHuuiNxfzPjUCAqbKjdQvokJ/8 Ojx7jxfLQggvQcfHzck3bZr1TU27Rwi6BgSvTFlasX6Ek5J8zEOXFTabcYaKvAMTWwOi 1fIQ== X-Gm-Message-State: AOJu0Yzqsi+dbBqKKSumRtj6f1ymVSQCSEyxW/vmI6Tq4LFWqnZWmTnC jC5e6QLJlu9e0uRfVKruVnuV/peoE+g9 X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a25:ac09:0:b0:d0c:1f08:5fef with SMTP id w9-20020a25ac09000000b00d0c1f085fefmr19514ybi.12.1691536427532; Tue, 08 Aug 2023 16:13:47 -0700 (PDT) Date: Tue, 8 Aug 2023 23:13:28 +0000 In-Reply-To: <20230808231330.3855936-1-rananta@google.com> Mime-Version: 1.0 References: <20230808231330.3855936-1-rananta@google.com> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog Message-ID: <20230808231330.3855936-13-rananta@google.com> Subject: [PATCH v8 12/14] 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 , Reiji Watanabe , Colton Lewis , Raghavendra Rao Anata , David Matlack , Fuad Tabba , 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 , Shaoqin Huang 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,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 Reviewed-by: Gavin Shan Reviewed-by: Shaoqin Huang --- 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 294078ce16349..95ca2b86aa2cd 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1083,7 +1083,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.640.ga95def55d0-goog