Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp609162pxb; Thu, 25 Feb 2021 10:19:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbnpwCo6YxgvxqRLbaBg/aUVGCEbypT/2oEmspcxlJdD6am92fNySZ4FicgF8/LekRFW+C X-Received: by 2002:aa7:d34e:: with SMTP id m14mr4308136edr.223.1614277168200; Thu, 25 Feb 2021 10:19:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614277168; cv=none; d=google.com; s=arc-20160816; b=je2A05cCobF5KVvzvcmx0LOscCjhzudBxsdFLeH3sqrX/zGAyEDCzTVnuPAw5vxker Zz4t5XZ6viW9MOebSHxCNjqJHkVokYcYJtg6hnxrdjYKKXnmC7VZQHNBguMrII36LT5X qvj4hjsAPdPD2h5zACJFbR6jet4cZ/qosIDsdYOvtGFbDt251aP14anrEBNgro7DnVLu qDTPggvQ42EWTH/mnnU8qZWLFJMp+eGd9yc5zmvM2CM0AL/6jhAIB8+kE8cODGj8gFPy EsJKdPB9DXaGD2La+1ylh+ppE5RTMDv31NkrPYWE3oNceq6KmSqGUUmDjkrk/7a2nSrt TyNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=91KG0dW4h8eaWVtd75/f30WhAILKsN5As4nR1hNXNAQ=; b=HaTYNpO2bLxpCCgh1yjZw4e/1XlYybYHFJrY14VtmVAc+YjfiIk+wXFcdFDVFyyFmV s2Bqwly2y2ssBcQ/sgJp8ICqAbaT67fS5X3qa5G+3Uja6V/dLHk7V3IGo4qFnHYqu/zW 3K9eVVqYAYu9EHeeIaRLHcflnZtkiONq8eqznCiWMxumDn+Upo3ENtSus9d1tH6s83Ya y0hRRbkvZHSjPPsEd6CtaRea+SIrYd/pE9yzWkngHIyBoLdsjanl6H5muvkaYhscBfQ8 y4WSZLI+24zWoBNdWCKtBLo0IXf9awLB9ofMg5mPF4CzkfptS+QGYeR9Ew8zn4S8ViT8 C/fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TrCRaRzl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca18si3614305ejb.521.2021.02.25.10.19.04; Thu, 25 Feb 2021 10:19:28 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TrCRaRzl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbhBYSST (ORCPT + 99 others); Thu, 25 Feb 2021 13:18:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42484 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231895AbhBYSSS (ORCPT ); Thu, 25 Feb 2021 13:18:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614277011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=91KG0dW4h8eaWVtd75/f30WhAILKsN5As4nR1hNXNAQ=; b=TrCRaRzlzPNwDdVTsbNrrEXi5KCG5TKtUDxCuVTfObt4ckqHpqaRID6VkbVVoxyh7D4CPP L0IPenDKrDUZTxnM1g8//4mQrh8lyZyl7yqdUP5rdM9AQZ5/Rtf6miD8NQwGK8hs1VRBgE P+IbpxMdqZhunq740SIH+jlD5AMvk9Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-EH_OXAIdOLS5_Rd1Seojpg-1; Thu, 25 Feb 2021 13:16:46 -0500 X-MC-Unique: EH_OXAIdOLS5_Rd1Seojpg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A3FF106BAEE; Thu, 25 Feb 2021 18:16:44 +0000 (UTC) Received: from krava (unknown [10.40.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16A225D9D2; Thu, 25 Feb 2021 18:16:40 +0000 (UTC) Date: Thu, 25 Feb 2021 19:16:39 +0100 From: Jiri Olsa To: "Jin, Yao" Cc: kernel test robot , Chris Wilson , Arnaldo Carvalho de Melo , Jiri Olsa , Tvrtko Ursulin , Matthew Brost , LKML , lkp@lists.01.org, lkp@intel.com, Andi Kleen , Adrian Hunter , "Liang, Kan" , "Jin, Yao" , "Yi, Ammy" Subject: Re: [drm/i915/gt] 8c3b1ba0e7: perf-sanity-tests.Parse_event_definition_strings.fail Message-ID: References: <20210224074841.GD6114@xsang-OptiPlex-9020> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 25, 2021 at 02:33:57PM +0100, Jiri Olsa wrote: > On Thu, Feb 25, 2021 at 04:06:23PM +0800, Jin, Yao wrote: > > Hi Chris, Arnaldo, Jiri, > > > > We observe the parsing error for "software/xxx/" on some platforms. > > > > For example, > > > > # perf stat -e software/r1a/ -a -- sleep 1 > > event syntax error: 'software/r1a/' > > \___ parser error > > Run 'perf list' for a list of valid events > > > > Usage: perf stat [] [] > > > > -e, --event event selector. use 'perf list' to list available events > > > > And perf test is failed too. > > > > # perf test 6 -vv > > ... > > running test 4 'software/r1a/'failed to parse event 'software/r1a/', err 1, str 'parser error' > > event syntax error: 'software/r1a/' > > \___ parser error > > > > running test 4 'software/r0x1a/'failed to parse event 'software/r0x1a/', err 1, str 'parser error' > > event syntax error: 'software/r0x1a/' > > \___ parser error > > ... > > > > The issue should be the conflict between event "i915/software-gt-awake-time/" and pmu "software". > > > > # perf list | grep i915/software > > i915/software-gt-awake-time/ [Kernel PMU event] > > > > Perf supports the event format as "prefix-xxx-suffix", so the "software" > > string in "software-gt-awake-time" is added to perf_pmu_events_list as > > PMU_EVENT_SYMBOL_PREFIX. When parsing the string such as "software/xxx/", > > it’s parsed as PMU_EVENT_SYMBOL_PREFIX for "software", then it would error > > out in next processing. > > > > So the easy way is to rename "software-gt-awake-time" to "gt-awake-time", > > right? Otherwise we have to hardcode something in perf tool. > > > > What do you think of this issue and the solution? > > > > BTW, as the robot reported, it's related to the commit 8c3b1ba0e7ea > > ("drm/i915/gt: Track the overall awake/busy time"). > > yes, I think you're right.. I'll try to reproduce and check on this > > I'm still not clear why is that parsing fail if those 2 events are > distinguished by - and / ... but yep, we are asking for trouble in > here ;-) > > I think we could either prioritaze one or add extra check when we > add prefix-xxx-suffix events and do not add ones that have conflict.. > that seems like best solution to me now would patch below work for you? jirka --- diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 42c84adeb2fb..e1d0f1028401 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -2041,8 +2041,16 @@ static void perf_pmu__parse_init(void) char *tmp = strchr(alias->name, '-'); if (tmp != NULL) { - SET_SYMBOL(strndup(alias->name, tmp - alias->name), - PMU_EVENT_SYMBOL_PREFIX); + char *prefix = strndup(alias->name, tmp - alias->name); + + if (perf_pmu__find(prefix)) { + pr_debug("perf_pmu__parse_init: skipping conflicting alias '%s'\n", + alias->name); + free(prefix); + continue; + } + + SET_SYMBOL(prefix, PMU_EVENT_SYMBOL_PREFIX); p++; SET_SYMBOL(strdup(++tmp), PMU_EVENT_SYMBOL_SUFFIX); len += 2;