Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28362470rwd; Tue, 4 Jul 2023 18:25:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlHRAX2RLOY3VSpzFTTp6My07SqJtMaVXA+7jmvu/erHtgwUzvWi3km+aPrPwYo8gg5vAsTk X-Received: by 2002:a05:6870:f150:b0:1b0:3771:736c with SMTP id l16-20020a056870f15000b001b03771736cmr19154531oac.41.1688520343829; Tue, 04 Jul 2023 18:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688520343; cv=none; d=google.com; s=arc-20160816; b=CcfI3aPJ/dIYKCq3yz93cjttLJ9uiWjGZI/7Y6UrkFbdUgh+NEjhdAY8bLMNDc3y7w AdAg2gyNUysCg11Z83Ig2X6oQGAdbe0ZdZruzB0Yrhse7gL3HcNFRNX+3MwXrTXjAF1e pgh36K7c63gC4G4qYPT+P7aPxMt2Lc3821gZ0w5d2vPvecvAFfTJFW3ATY2CnIbwQtym Z8IIig5b3zdR+rxGead/iQK/6nxk8ov9tVGq7QSEZCc3UkOARYtjGdKh+CULgY+ze6jt tYkloZD1mmrJ7IqVFdkod1zwBJF+8SCTr76+CrMYTOu5L8jis67jHrfFNPGvQeiPrJwU KGEg== 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=05Y7FRqpionSiuOM6vbmN3tWEYWnCWQeWHLoVh2gOCU=; fh=uWizyy3yoGrWSfcrQcWEgE41lkw1KX0BFzXr8P5wzsY=; b=ZuUEbzbp5eDZw335MQ1bICu7UzIVCN8mZXU1gxXvdpClfim+rryhNHWPCqDNvrrfa7 66800SpaAmBfWxV4zyUhReHvj7Uk/jwegK60wH8GZuWqnXGT97HfCZdt95etnTCv0ldC gXRV7qHRgoNy5/5DTjuSGsXm4rMjObO3EkTUv7/CA0fSUn6v3a0dGMgCyvwYFty+WpCs oquA9xzlbA8IlAGykC/A0ktZNif1NEu4ozGMWT+/hMHWbtuz04hVWE7iQTSetE6eDxTF FB7972Eoix5QUXQzEibbE7y7pPRTYoIx2fk7PEHGHrraAOg1jc/uBUB3xOb67QXk3CGb /LNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VLC9ME4w; 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 w4-20020a17090aad4400b00263e9b06a99si479945pjv.77.2023.07.04.18.25.31; Tue, 04 Jul 2023 18:25:43 -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=VLC9ME4w; 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 S231130AbjGEAwS (ORCPT + 99 others); Tue, 4 Jul 2023 20:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbjGEAwR (ORCPT ); Tue, 4 Jul 2023 20:52:17 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08EC1B6 for ; Tue, 4 Jul 2023 17:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688518291; 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=05Y7FRqpionSiuOM6vbmN3tWEYWnCWQeWHLoVh2gOCU=; b=VLC9ME4wuex+2bMgUm59JB0N0/nv2cKkDXaxKYhadZUfgn3ZbsrpNfMhjzy3zC76FgBMaP BcxH27VIYxAh8c9knzWHAoiTJXmP88bzScW62Sg75sbNAwj6i+SZ/mKTSrwQC4rStQW1PS nKoiAoOjkNUHCsQyDnc/njC58PCJoPI= Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-42-TRuJLeGgNai4Zw8L06hY6Q-1; Tue, 04 Jul 2023 20:51:29 -0400 X-MC-Unique: TRuJLeGgNai4Zw8L06hY6Q-1 Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-56942442eb0so66349337b3.1 for ; Tue, 04 Jul 2023 17:51:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688518289; x=1691110289; 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=05Y7FRqpionSiuOM6vbmN3tWEYWnCWQeWHLoVh2gOCU=; b=HWH2UO3aL/GfI6IR4vejEa+Ieg77i23Iez+dhAbSNrcIqA6l1WOtCNmwpzmKex5ocr ocoU1jf/kFcxCGivS+7mcsnxuBH4jEHB1A+23Sn6W5mVE2CUd718MdO/owsoFbRzl8OF rNsnXthbmm2LwC311L/5oDaA+II72GiNQFUIq40YgcVx80ws06h8uVWGccFxsdu+4fHB c4rQE03LyN4yCNLibTm+8lNm9eu4a6UpkJcaRpQL6Hldr1oEa2TIQKd5jF9jGUZxoKEz XuV1iG7ivvEqSCt/vAHl3RABJ2DyUdiHf3agYqH5ciLhGYL84coxDXf4FH7sSXB8hFap 7Jqg== X-Gm-Message-State: ABy/qLZt1nY7iDK1uE81b/PcoG9gnl2HNSRQpK+lkFuHib6aVfEdPQPV WYIANMcte0iMOmh3Y0sD1WS6AIZjvOJxW32XZC8vHrApjp6C3I42GYnj5hLp4pK+CfbRUBGDC6J ru5Dc9pjEGIHFVkNRlIVsyDFV X-Received: by 2002:a81:6643:0:b0:573:592a:6f7e with SMTP id a64-20020a816643000000b00573592a6f7emr15236890ywc.19.1688518289388; Tue, 04 Jul 2023 17:51:29 -0700 (PDT) X-Received: by 2002:a81:6643:0:b0:573:592a:6f7e with SMTP id a64-20020a816643000000b00573592a6f7emr15236876ywc.19.1688518289160; Tue, 04 Jul 2023 17:51:29 -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 j25-20020aa78dd9000000b006687b4f2044sm16074713pfr.164.2023.07.04.17.51.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jul 2023 17:51:28 -0700 (PDT) Message-ID: Date: Wed, 5 Jul 2023 10:51:18 +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 10/11] KVM: arm64: Invalidate the table entries upon a range 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-11-rananta@google.com> From: Gavin Shan In-Reply-To: <20230621175002.2832640-11-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=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 On 6/22/23 03:50, Raghavendra Rao Ananta wrote: > Currently, during the operations such as a hugepage collapse, > KVM would flush the entire VM's context using 'vmalls12e1is' > TLBI operation. Specifically, if the VM is faulting on many > hugepages (say after dirty-logging), it creates a performance > penalty for the guest whose pages have already been faulted > earlier as they would have to refill their TLBs again. > > Instead, leverage kvm_tlb_flush_vmid_range() for table entries. > If the system supports it, only the required range will be > flushed. Else, it'll fallback to the previous mechanism. > > Signed-off-by: Raghavendra Rao Ananta > --- > arch/arm64/kvm/hyp/pgtable.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > Reviewed-by: Gavin Shan > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c > index df8ac14d9d3d4..50ef7623c54db 100644 > --- a/arch/arm64/kvm/hyp/pgtable.c > +++ b/arch/arm64/kvm/hyp/pgtable.c > @@ -766,7 +766,8 @@ static bool stage2_try_break_pte(const struct kvm_pgtable_visit_ctx *ctx, > * value (if any). > */ > if (kvm_pte_table(ctx->old, ctx->level)) > - kvm_call_hyp(__kvm_tlb_flush_vmid, mmu); > + kvm_tlb_flush_vmid_range(mmu, ctx->addr, > + kvm_granule_size(ctx->level)); > else if (kvm_pte_valid(ctx->old)) > kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr, ctx->level); >