Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28355386rwd; Tue, 4 Jul 2023 18:16:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGvfpufkqR94kVcK23/S3u70e+H8EsShfj+ggpMpu8+KNwxNYmGmTm+Qjpjsm+ODvO2jdp+ X-Received: by 2002:a05:6358:19:b0:134:d26d:e27b with SMTP id 25-20020a056358001900b00134d26de27bmr10497523rww.25.1688519786839; Tue, 04 Jul 2023 18:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688519786; cv=none; d=google.com; s=arc-20160816; b=iFZ6LfQ+Oug/vPAi7WhWjnzWavLBmPima63c7kcuBre5g5UC99TzdkGQd5/qWggmmm Cd2DabkAjOH+9T2MklYmSXKdF65gB+0C5wzy+ievcmQnPUkToe8JpkFjM9RPTYs5Pvzp NJYZtV1R4cXQ/2AmQjJiig9BT8FBhkh/PYdlQIG5wNQ9veEZh3iH9UrdQmwuSHcl6nfl K/XaVDWM7jab8wNOc9MOlJ1DqkqphgUAT3JdkvCW2AH+QZ6IX2DhHGJXBdJeShbGnTRT 7rC0HUn7Bg7iWz5mDWI+TkNW9rbnnIk/WNlwWJtlVBMyP7XRhpw0BGhCtkhJcpSWn+Pr esOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9kggeUHVn+fybi/vP4cTbHO7AeLXxPNqVprkHx0Chh4=; fh=TstZmECAHWuiHcOzBTznBis8cUiYYD7m507pTr8673Q=; b=cm0KTprfWQuUN3tBtEhCvTHUWWT+gDwclH6sXdaMZ0kc0Dlbjvl5zgqVZ2nqbP7o78 stoxq1wDMiNm6MKsTKi89ywr8c7Baw3q7PAbXWwPHn4awK0oKtuijLC2N/svhWSyB/cT rUEMU8Y7XItjIfXe33UdSEBrCvp9zsVcbAEAsYKQeg6J3CTkp4XPbjqFU2gLqb3kteR7 /kKZLHRQF4gzWRq/Dey+I/VD5Smi83Vqubq8X3Fo6kfngvE4zZXC1nQgcTNX7K1km57G JDfmVHdMFF0/Fqp73spR4dkUaeN4EtqzYXFfxMixi4wHODS0OF6h23HpA3UJrqvX0sSo 6p/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O81tKq8f; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s40-20020a056a0017a800b006786b7f4cc4si19587790pfg.240.2023.07.04.18.16.07; Tue, 04 Jul 2023 18:16:26 -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=@redhat.com header.s=mimecast20190719 header.b=O81tKq8f; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbjGEAgX (ORCPT + 99 others); Tue, 4 Jul 2023 20:36:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjGEAgU (ORCPT ); Tue, 4 Jul 2023 20:36:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C916E75 for ; Tue, 4 Jul 2023 17:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688517340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9kggeUHVn+fybi/vP4cTbHO7AeLXxPNqVprkHx0Chh4=; b=O81tKq8fRI8p+KUS98bkZeL+2EcMSYw834SFyQqs681DLC7biTgM/aKdv09zVSncHYPypj 0d05YEp+krPQE7WX3RCmlVn60sUrwF2IZ+dJLfDiC5WWgRRcqhySV09PK7AfLdmyj9QVK1 4ODMTLBTUEgVU5UnGTvcrnzRi1HozLU= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-hbAiVSDxMWqPGyFJIuwGdA-1; Tue, 04 Jul 2023 20:35:38 -0400 X-MC-Unique: hbAiVSDxMWqPGyFJIuwGdA-1 Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-1b8a44ee130so14536685ad.1 for ; Tue, 04 Jul 2023 17:35:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688517338; x=1691109338; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9kggeUHVn+fybi/vP4cTbHO7AeLXxPNqVprkHx0Chh4=; b=E1JJzOTO4W/jVpRjij7s4J41JTl5dx+sDl63exJ94T2UklDecIZy6AJ1JBrkBuJKK/ 5Zr5FpOjmw8qNtwQWjYX/pN8ki+WPCsxZuz99muYN9KjizuiOurlgifKyTfEF5GVWjO9 kWCWVuxoRMQ4gy5KP6X+SewxrSYflkrjEay1UuOvAVnQnvT1hIXmkbwl7kw1+wzRX1UW +bdRzdpbJl/FU0SW5nmDUg3CmG9O+bZaEenEDVHOlFZavIUjgBeO0u7nXUgHX/n8Ir8x b8u7tj4aAacLQRHgSWyloabfK4/EFHWTdvxnVPNLf2tHFM3mkId6vH8+jpsO33NdRu69 38Ag== X-Gm-Message-State: ABy/qLbrManob4rfUS0e4JTokYtJHP8wNwdbCOT5a3bRTOPt56VKmR3C fZS5fPB9vJeO1AQlzIvxuoAg16MqgMxLklvnvaECv7nPbmmSOoRFfG5oag5j7/a3IgYbQdIO9UQ qLnS6wXCrzay+ay8OBLicsfAP X-Received: by 2002:a17:902:dac4:b0:1b8:9195:1dd8 with SMTP id q4-20020a170902dac400b001b891951dd8mr5383574plx.51.1688517337916; Tue, 04 Jul 2023 17:35:37 -0700 (PDT) X-Received: by 2002:a17:902:dac4:b0:1b8:9195:1dd8 with SMTP id q4-20020a170902dac400b001b891951dd8mr5383559plx.51.1688517337630; Tue, 04 Jul 2023 17:35:37 -0700 (PDT) Received: from ?IPV6:2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5? ([2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5]) by smtp.gmail.com with ESMTPSA id ix6-20020a170902f80600b001b87f957ba5sm6601048plb.12.2023.07.04.17.35.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jul 2023 17:35:37 -0700 (PDT) Message-ID: <73a4655a-2c63-3209-1153-2fc816e8990e@redhat.com> Date: Wed, 5 Jul 2023 10:35:28 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RESEND PATCH v5 09/11] KVM: arm64: Flush only the memslot after write-protect Content-Language: en-US To: Raghavendra Rao Ananta , 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 , 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 References: <20230621175002.2832640-1-rananta@google.com> <20230621175002.2832640-10-rananta@google.com> From: Gavin Shan In-Reply-To: <20230621175002.2832640-10-rananta@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 6/22/23 03:50, Raghavendra Rao Ananta wrote: > 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(-) > Reviewed-by: Gavin Shan > 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); > } > > /**