Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp110176pxy; Wed, 21 Apr 2021 20:18:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgU7LgBOmswNzUnZu4PBMi8LIg4AK5xUO73kWz2TlPF6mdw17Wld0F16bIt8gfe5yJoztb X-Received: by 2002:a63:f651:: with SMTP id u17mr1393990pgj.148.1619061511095; Wed, 21 Apr 2021 20:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619061511; cv=none; d=google.com; s=arc-20160816; b=hXSdxxnP7irsVFijFOZ3qrLGmZ/D5qp6uadVcYFHbGwyYHX5b8gDNoSt04FrnrwG82 p4NHGrJK1bRqu+qWiIscoD2xUcJjya77i2KDVuOuYtbuSASMqXyIvL3uGvoPe0JSv+z/ 3Xo1p0LVYkCO0mYWKrl6dOAl+rD0+kjTZJnmmNeXQrAsAOu08llwCL+nC77udGrTfM0K gdBpFX+BeMDCfPN2KoKT2CBH8+4XiqZctW89lJJJj8k6IcyYwh1q210QkojDyuTa8Mf0 /m7fr6Wcnvb3UJK/ZzZfoxeRh+lrX0n9aNN5GrlUwRrwrPCgMAzW1Af+CBaAg9Drsn7a Wghg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=r165rt3HE1sNS1DLiX38okZfeV5BPnisdj04gWinsF8=; b=x2FcHgfnSzgGvI5Kk1hPf+b+mhESbDW3sl5gGGnvks6Lo8EtJx+aroxtxMirtJ/+BH XUgmqccmKoqZ3oSPUncb4kdvJqQdVY609vwW9wyM3ZF9VLd0nUo3YprY9IJDV59iF5z2 6GpeWoatrwF5+4Rq03DrEnHyW6J1W6Fost8UR7S81zFXXlgOMRyUpphGcXhu86eGNpQ6 0DtaVxreYRVRNcD5MNYFgnO02mgHGQXdZCIx9VOouZxeuExJYTd7e7xs5o8GAoHpwysH iyRPUCod0QfnpislB4Y3xAbZILYxEEi4bQ6+rlFnSGwXh6t3ceV7yueqWzawvzzTYSbK JGaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si1627649pfl.171.2021.04.21.20.18.18; Wed, 21 Apr 2021 20:18:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234475AbhDVDRx (ORCPT + 99 others); Wed, 21 Apr 2021 23:17:53 -0400 Received: from mga18.intel.com ([134.134.136.126]:13574 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbhDVDRw (ORCPT ); Wed, 21 Apr 2021 23:17:52 -0400 IronPort-SDR: Nxk6rqJcb7PUioFo0/usAp2hnew/lxj9/Ruoej77wLXehvbvUpZZlZTIKzALUJUCWq2AEfObPh ozVhBx9LAWDA== X-IronPort-AV: E=McAfee;i="6200,9189,9961"; a="183304368" X-IronPort-AV: E=Sophos;i="5.82,241,1613462400"; d="scan'208";a="183304368" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 20:16:58 -0700 IronPort-SDR: fUPT+MPQOVG0IKK0A+jG6q2HwBfctbodIzmZWE9HHhnq1ufrWWa7KvfFpuFyHrUbARVZtaC4OZ jVcwM3XKa3lA== X-IronPort-AV: E=Sophos;i="5.82,241,1613462400"; d="scan'208";a="427756783" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.238.4.6]) ([10.238.4.6]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2021 20:16:55 -0700 Subject: Re: [PATCH v4 24/25] perf tests: Support 'Convert perf time to TSC' test for hybrid To: Jiri Olsa Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com References: <20210416140517.18206-1-yao.jin@linux.intel.com> <20210416140517.18206-25-yao.jin@linux.intel.com> From: "Jin, Yao" Message-ID: Date: Thu, 22 Apr 2021 11:16:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On 4/22/2021 2:29 AM, Jiri Olsa wrote: > On Fri, Apr 16, 2021 at 10:05:16PM +0800, Jin Yao wrote: >> Since for "cycles:u' on hybrid platform, it creates two "cycles". >> So the second evsel in evlist also needs initialization. >> >> With this patch, >> >> # ./perf test 71 >> 71: Convert perf time to TSC : Ok >> >> Signed-off-by: Jin Yao >> --- >> tools/perf/tests/perf-time-to-tsc.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c >> index 680c3cffb128..72f268c6cc5d 100644 >> --- a/tools/perf/tests/perf-time-to-tsc.c >> +++ b/tools/perf/tests/perf-time-to-tsc.c >> @@ -20,6 +20,7 @@ >> #include "tsc.h" >> #include "mmap.h" >> #include "tests.h" >> +#include "pmu.h" >> >> #define CHECK__(x) { \ >> while ((x) < 0) { \ >> @@ -66,6 +67,10 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe >> u64 test_tsc, comm1_tsc, comm2_tsc; >> u64 test_time, comm1_time = 0, comm2_time = 0; >> struct mmap *md; >> + bool hybrid = false; >> + >> + if (perf_pmu__has_hybrid()) >> + hybrid = true; >> >> threads = thread_map__new(-1, getpid(), UINT_MAX); >> CHECK_NOT_NULL__(threads); >> @@ -88,6 +93,17 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe >> evsel->core.attr.disabled = 1; >> evsel->core.attr.enable_on_exec = 0; >> >> + /* >> + * For hybrid "cycles:u", it creates two events. >> + * Init the second evsel here. >> + */ >> + if (hybrid) { > > same, don't see the reason for 'hybrid' variable > OK, will use 'if (perf_pmu__has_hybrid())' instead. Thanks Jin Yao > jirka > >> + evsel = evsel__next(evsel); >> + evsel->core.attr.comm = 1; >> + evsel->core.attr.disabled = 1; >> + evsel->core.attr.enable_on_exec = 0; >> + } >> + >> CHECK__(evlist__open(evlist)); >> >> CHECK__(evlist__mmap(evlist, UINT_MAX)); >> -- >> 2.17.1 >> >