Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412823rwa; Tue, 23 Aug 2022 04:29:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4aUwJIaL5Ege9RCtkHbd5s/Ah3v6K8EzKPSGqhBNP12155s9FrWRm2H5MWA3r2uqNdqWcj X-Received: by 2002:a17:906:cc0f:b0:73d:6715:f82 with SMTP id ml15-20020a170906cc0f00b0073d67150f82mr9789210ejb.270.1661254144500; Tue, 23 Aug 2022 04:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254144; cv=none; d=google.com; s=arc-20160816; b=xpHgLUKkOQot1li07BeZYY7hhNGMLBN8GIcIohQWxOWPiBen70yzWfbfC5cUOSTsN7 13qffwFClRVBqyUf2PE/JNkFq505ssWnLfkpQrqVQxwQosOjsd948l9BEVY4QohLegtk yVeAsautSdEL7dlW0ltO5adOl4TLDSNCrzkVCsFYsACOybr+DpT1TEoxDewCimk8Mjut UI6OnwaMhYnnzBWbAY4QKYUjoD3HaO/gVEzpmjzgbUh+bauKe4mmzV9N31RziVV2SyNT W5qWX5YexTCkjCxCth++N0UalvXJe+rlWfb6hFoHmYTDN6VNncI0x2H7j63N1r0N1skp BluA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OD77TABDhpnzAk12hp3N3DuEgofLOzYCcZifesslb2E=; b=hamH5q+wAJOWN8v5bXxu3WIo49T1Iq2W1xlnGtEkdIX2SVo+gFinN9EJbzDHSoOkgx fBTjZtbHZE/RoBuq0evtGalEpasfqFVNr/yoc6t35NBIsmTkJf/s7XUgxs87hqBu7aER m2z3qt0MrV/Pur7cSGobX553X+hfFoumASa65aH1dZU9nmJOaS6SmgTfrJ8muGS2j51l wX5G5wOeJAhmfs80pX/oqeV7eYsQNQojpJ021tNe2u+zg7xgAxIPR3cE6UWTFLYJSWKx V8WkOg1BAcWI4luofKx7HD/dGZwVBsvucqyBcH5oKjLHKZeQ3hpf1pXVM2zIe9aklVHO C4LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pwm3beKz; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020a509317000000b0043d556dd041si1852993eda.446.2022.08.23.04.28.38; Tue, 23 Aug 2022 04:29:04 -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=@linuxfoundation.org header.s=korg header.b=Pwm3beKz; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349447AbiHWJYC (ORCPT + 99 others); Tue, 23 Aug 2022 05:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348714AbiHWJUM (ORCPT ); Tue, 23 Aug 2022 05:20:12 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D970E89833; Tue, 23 Aug 2022 01:33:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id F243ACE1B45; Tue, 23 Aug 2022 08:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 106CCC433D6; Tue, 23 Aug 2022 08:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243579; bh=c0oQWHbTvcNHrAYGEU4I81+4AJyeLsiRKKSH4gPd8po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pwm3beKzPBY91yiuM+A7gpuA1AGAUvvaroLTG3NOgYo4m7DI7ZKTltBBHtdsMg07R BoHe99JnKnnbzy5QZiU/PB96H+ZRbXiOEt0SXDkIr4tQKwNcazzC1vqMIdG6X7Pv/z zQgMUOvWfWvpfPk3W7FX7ooOVYorQLdgJAfd9IzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabiano Rosas , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 321/365] KVM: PPC: Book3S HV: Fix "rm_exit" entry in debugfs timings Date: Tue, 23 Aug 2022 10:03:42 +0200 Message-Id: <20220823080131.606216655@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 From: Fabiano Rosas [ Upstream commit 9981bace85d816ed8724ac46e49285e8488d29e6 ] At debugfs/kvm//vcpu0/timings we show how long each part of the code takes to run: $ cat /sys/kernel/debug/kvm/*-*/vcpu0/timings rm_entry: 123785 49398892 118 4898 rm_intr: 123780 6075890 22 390 rm_exit: 0 0 0 0 <-- NOK guest: 123780 46732919988 402 9997638 cede: 0 0 0 0 <-- OK, no cede napping in P9 The "rm_exit" is always showing zero because it is the last one and end_timing does not increment the counter of the previous entry. We can fix it by calling accumulate_time again instead of end_timing. That way the counter gets incremented. The rest of the arithmetic can be ignored because there are no timing points after this and the accumulators are reset before the next round. Signed-off-by: Fabiano Rosas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220525130554.2614394-2-farosas@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/kvm/book3s_hv_p9_entry.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_p9_entry.c b/arch/powerpc/kvm/book3s_hv_p9_entry.c index 112a09b33328..7f88be386b27 100644 --- a/arch/powerpc/kvm/book3s_hv_p9_entry.c +++ b/arch/powerpc/kvm/book3s_hv_p9_entry.c @@ -438,15 +438,6 @@ void restore_p9_host_os_sprs(struct kvm_vcpu *vcpu, EXPORT_SYMBOL_GPL(restore_p9_host_os_sprs); #ifdef CONFIG_KVM_BOOK3S_HV_EXIT_TIMING -static void __start_timing(struct kvm_vcpu *vcpu, struct kvmhv_tb_accumulator *next) -{ - struct kvmppc_vcore *vc = vcpu->arch.vcore; - u64 tb = mftb() - vc->tb_offset_applied; - - vcpu->arch.cur_activity = next; - vcpu->arch.cur_tb_start = tb; -} - static void __accumulate_time(struct kvm_vcpu *vcpu, struct kvmhv_tb_accumulator *next) { struct kvmppc_vcore *vc = vcpu->arch.vcore; @@ -478,8 +469,8 @@ static void __accumulate_time(struct kvm_vcpu *vcpu, struct kvmhv_tb_accumulator curr->seqcount = seq + 2; } -#define start_timing(vcpu, next) __start_timing(vcpu, next) -#define end_timing(vcpu) __start_timing(vcpu, NULL) +#define start_timing(vcpu, next) __accumulate_time(vcpu, next) +#define end_timing(vcpu) __accumulate_time(vcpu, NULL) #define accumulate_time(vcpu, next) __accumulate_time(vcpu, next) #else #define start_timing(vcpu, next) do {} while (0) -- 2.35.1