Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3407979rwa; Tue, 23 Aug 2022 04:23:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Okhskig3t5Q6lDvkZ0Z2uqrX6gzs3I3bTi8RhQmGtNJ1T5WSHYm3Ksz+l2A6DlmSgI253 X-Received: by 2002:a17:90b:3b8a:b0:1f5:1df2:1fff with SMTP id pc10-20020a17090b3b8a00b001f51df21fffmr2879825pjb.169.1661253825196; Tue, 23 Aug 2022 04:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253825; cv=none; d=google.com; s=arc-20160816; b=yk2VXADWd23iwW1WfoBMjitZkHMJdEaEqN/TDeZLIa9lsZtr7/3CeypGTAghvkUHPj XCHBaCLRb9mmavK6DDUOvXfotQChNdZJOk4muxtjyZ6R+31p5RKOfaU//CO3weq9xKm/ tlPsG4/J6Vq9CZALkrg6mji/UFpoWedF4ZAis/pKcZG54i6kKqa7tsm5FEqdRquMhlHZ MhmKPqaO5acSxu5autr8iITEiJrY5OR5s6vZI8A0Y2uBrcUh9W2+JzypTtkEq7Cn2GTo 3ooR70pJFEFVvWpyJSIO8TTirMonjhdipgRRhj/gclFBUhaYCCSNW2NFGuX+YwQqbtK5 RN2A== 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=fnhlChGnLFxSZ1tdEVB9Tm3KRxcTqeILNkm9ijLRKXA=; b=h8Ik7YlXvbVlq6LFMuvHrLEikED0Id/36SurAnf+lCT1UvsCk9LvAjv7q4Vkt+ngxs sBFvGaIhrgMoyG/cDw6e9AhJsaScbdqAzERbU6eRAZeTGCZCCM0Ne/NXh3eIecOZnSEc kJstnnsGeDdAnyLjHOcKNBsqjaqfSbh7tS50KV0UxEEaBq4K72ddnFJSfAXCsUiF0GKZ hVx1KvUUkkw4pDt8I2bto3wh/7SJ2DtFuoxEGmWwKvgPd+fY9a7aCdjsXBpZMYaFvjQR NoHpCFGcOACmfIiANfRp/BNTJQ7RBfZMR31M98cLO9oa4I3nbnrghCge1l1m5BUQ9lMb Sjqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ojgmgqxd; 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 9-20020a631849000000b00429cd0df384si15416987pgy.520.2022.08.23.04.23.34; Tue, 23 Aug 2022 04:23:45 -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=ojgmgqxd; 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 S1354743AbiHWK0R (ORCPT + 99 others); Tue, 23 Aug 2022 06:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353651AbiHWKLr (ORCPT ); Tue, 23 Aug 2022 06:11:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C655A273D; Tue, 23 Aug 2022 01:58:03 -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 ams.source.kernel.org (Postfix) with ESMTPS id 25CCBB81C3A; Tue, 23 Aug 2022 08:58:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E118C433D6; Tue, 23 Aug 2022 08:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245080; bh=et9RcAsV13Sdx2IlqD0sI3Jvs/62/1aMjIDH0P/bCOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ojgmgqxdxAcMX0wyVbF1QYwCh5+1Pi+2LmDkoGpQP0d91emMhr/svFO2hclmZWbzg 1gOHPvgRqMtaJqXxuAyHNUwoYYp7Eqi1GApd/yQez8oaV3j2dtm1DksQqB9Xy3RXEA /jdjFymTpMHIx+qooJB8SKhQn71vk0yYfjf3MNMU= 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.15 208/244] KVM: PPC: Book3S HV: Fix "rm_exit" entry in debugfs timings Date: Tue, 23 Aug 2022 10:26:07 +0200 Message-Id: <20220823080106.453315374@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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 961b3d70483c..a0e0c28408c0 100644 --- a/arch/powerpc/kvm/book3s_hv_p9_entry.c +++ b/arch/powerpc/kvm/book3s_hv_p9_entry.c @@ -7,15 +7,6 @@ #include #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; @@ -47,8 +38,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