From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] kvm-unit-tests: x86: pmu: call measure for every counter in check_counters_many Date: Mon, 25 Aug 2014 18:45:38 +0200 Message-ID: <53FB6832.6080800@redhat.com> References: <1408049924-18848-1-git-send-email-chris.j.arges@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: Chris J Arges , kvm@vger.kernel.org Return-path: Received: from mail-qg0-f51.google.com ([209.85.192.51]:49738 "EHLO mail-qg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbaHYQpp (ORCPT ); Mon, 25 Aug 2014 12:45:45 -0400 Received: by mail-qg0-f51.google.com with SMTP id a108so13223075qge.24 for ; Mon, 25 Aug 2014 09:45:44 -0700 (PDT) In-Reply-To: <1408049924-18848-1-git-send-email-chris.j.arges@canonical.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 14/08/2014 22:58, Chris J Arges ha scritto: > In the check_counters_many function measure was only being called on the last > counter, causing the pmu test to fail. I don't understand. measure loops on all N counters and calls start_event (which in turn calls global_enable) and stop_event (which calls global_disable) on all counters. > This ensures that measure is called for > each counter in the array before calling verify_counter. Actually the point of this test is to run the loop while all the counters are active, so this patch is just masking another bug. Paolo > Signed-off-by: Chris J Arges > --- > x86/pmu.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/x86/pmu.c b/x86/pmu.c > index 5c85146..3402d1e 100644 > --- a/x86/pmu.c > +++ b/x86/pmu.c > @@ -287,11 +287,11 @@ static void check_counters_many(void) > n++; > } > > - measure(cnt, n); > - > - for (i = 0; i < n; i++) > + for (i = 0; i < n; i++) { > + measure(&cnt[i], 1); > if (!verify_counter(&cnt[i])) > break; > + } > > report("all counters", i == n); > } >