Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3526003pxb; Mon, 4 Apr 2022 19:57:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzseMvlrtpOHPbu5M9uJVsoBNMr7TwuIiBoytCuHAEcJomJgdSGxzGlhXWkn5vGkVyswK+t X-Received: by 2002:a17:90b:4d01:b0:1c9:ec79:1b35 with SMTP id mw1-20020a17090b4d0100b001c9ec791b35mr1465309pjb.77.1649127449765; Mon, 04 Apr 2022 19:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649127449; cv=none; d=google.com; s=arc-20160816; b=s2Qp+mJJnB0/4eQ39+9H9h2hjRm5v3gfCy0DfBRsX737Ul0jjOKXZylotC9pqhC1rC AlHFkUGkoWia3oj+cf6RqbBpJPW8fMpHhufZdgHGdDXo9yihglV4mwAXtM/HSiNFXU/K lHXS47sj12RLdKzntO14m8bGIHOuC3aX03HyCzoC2TrgBO4oXvZCVAIhJKXXS5EoHe+Q 76pxlSmSLYtza6RFl9GOSe8ctC4h5kpsqAsoLZsYRc53+/YTOsR/3FwgZw3Q5gBCg4yA cn9TKn3RQ8Qo6VnbHHGoI9kEdXuE22YfKQl3Gp7xDb+vJzps9y2rrV3r23dBp92EcGSw QSEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=r5K6b0sc6oOdX9PQxMtrYXV8USG1YlONAxoBoZNU3l4=; b=mLR8IWSTsN3C3w3IG4YITSvomP6x/ovp6QyXueCQx3suegXQDCcMMbSeW6NjJ1OQt8 IdzWjicjFz+rzXJ21f3McnD4DJY6rPiSknudbUDBR1qQIOLYXY5pNALmPapLcbOcuA90 1vS+gUBgpcQwCunF+CUJ7jnQRvzQZndA531aXImxzvOxfrt81n4MJScoiH3/V3tHzFGz IPV/HHJXjOzeB0PgelN/E5dMg8IcnLgU6NIYqPxAd5WWtKaURKowhdulRqEIXv5Abnsz ZneU/rjui0nfm6E/AYczk46k5XI9wCwZ7481QRPGz/K/d21wsBuesv1KmPjekwq43xy2 NhkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=KK3qDVtl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p9-20020a170902b08900b00153b2d16575si10788590plr.381.2022.04.04.19.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:57:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=KK3qDVtl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11E713010A3; Mon, 4 Apr 2022 18:22:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358233AbiDDDxj (ORCPT + 99 others); Sun, 3 Apr 2022 23:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347096AbiDDDxe (ORCPT ); Sun, 3 Apr 2022 23:53:34 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1128A30F5B for ; Sun, 3 Apr 2022 20:51:38 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id b19so12479168wrh.11 for ; Sun, 03 Apr 2022 20:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r5K6b0sc6oOdX9PQxMtrYXV8USG1YlONAxoBoZNU3l4=; b=KK3qDVtl6tM1RC0vWJnjyjAOaBy9HeE8/J3cKTugiWs6TNndA8Vg82MGSJiu79ETZ9 X+G314yykqvPYI2h4vxy4qqe0E8bDEu6Pk23l8xjJMUNi4sSsIUwyXUPZb3codKUinnS 7eLz56OFMh+1h+AdCdVcpMxwkT0tCike5pComkqD4oMYKXMz8k3wGwwT7UrbveBFjtRV Ql3xXEdAWWyf/cRgLKSfwCvFdjvS0exmaL4XX1iOCKrs/N84Me5KcmEyAJsWdb4YGTs4 8yDSipiD22wqji5E7+BXbjOGj1jhfghTr1RjRNbedQ0BdvxbxVt2GRKJULuUKAon/jNy T/Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=r5K6b0sc6oOdX9PQxMtrYXV8USG1YlONAxoBoZNU3l4=; b=tpuaIEULTzxCjIycLr6/OR2SY/z7SBAkhSB12YlkeglrFDOuh8BzZwJeQpLZW+5Kap uPpbAQoEGP7Cj+BY038Oyc65OVCLFmys/v+24k3TDz8u7SKY6YwtjErYdMIceUv6uxqA tYmIe1Ypxa8VzBVYig0otWnWQXWDGGX7iJOpBi+ofjRFkubyHiMmnKdaTt5U9/4ynB0I JAj2hZTZnj80pgD21hgB2TYpHREL5jXsRQWdeaFBBxnpcVullouritmSQi8UjX5q2Djm lb2VDXphnI2qIfR04901gS3vVE++lwz5LyLIXvn5kZMNJ460xCwGQHluQsj8bIyVtTKy gU+w== X-Gm-Message-State: AOAM530A/NGNXcpTLgGc2dpywo56bbN34JoXIY7mT/uQ5PNzDX+ShK/L 1EaWr4MAzRF66Uk+HORQtTW17Z/cbhEX83QZ41kDOA== X-Received: by 2002:a5d:6c6b:0:b0:1ea:77ea:dde8 with SMTP id r11-20020a5d6c6b000000b001ea77eadde8mr15660633wrz.690.1649044297423; Sun, 03 Apr 2022 20:51:37 -0700 (PDT) MIME-Version: 1.0 References: <20220317035521.272486-1-apatel@ventanamicro.com> In-Reply-To: <20220317035521.272486-1-apatel@ventanamicro.com> From: Anup Patel Date: Mon, 4 Apr 2022 09:20:27 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put() To: Anup Patel Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Albert Ou , Alistair Francis , KVM General , "open list:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv)" , linux-riscv , "linux-kernel@vger.kernel.org List" , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Mar 17, 2022 at 9:25 AM Anup Patel wrote: > > We might have RISC-V systems (such as QEMU) where VMID is not part > of the TLB entry tag so these systems will have to flush all TLB > entries upon any change in hgatp.VMID. > > Currently, we zero-out hgatp CSR in kvm_arch_vcpu_put() and we > re-program hgatp CSR in kvm_arch_vcpu_load(). For above described > systems, this will flush all TLB entries whenever VCPU exits to > user-space hence reducing performance. > > This patch fixes above described performance issue by not clearing > hgatp CSR in kvm_arch_vcpu_put(). > > Fixes: 34bde9d8b9e6 ("RISC-V: KVM: Implement VCPU world-switch") > Cc: stable@vger.kernel.org > Signed-off-by: Anup Patel I have queued this patch for RC fixes. Thanks, Anup > --- > arch/riscv/kvm/vcpu.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c > index 624166004e36..6785aef4cbd4 100644 > --- a/arch/riscv/kvm/vcpu.c > +++ b/arch/riscv/kvm/vcpu.c > @@ -653,8 +653,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) > vcpu->arch.isa); > kvm_riscv_vcpu_host_fp_restore(&vcpu->arch.host_context); > > - csr_write(CSR_HGATP, 0); > - > csr->vsstatus = csr_read(CSR_VSSTATUS); > csr->vsie = csr_read(CSR_VSIE); > csr->vstvec = csr_read(CSR_VSTVEC); > -- > 2.25.1 >