Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4277573pxv; Mon, 19 Jul 2021 22:59:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEmZpafC8qPh011Tr3+KCjgNf3dYOwoSlJiJbNaAzPUBvoyDmrNdhN3pLmR1bd5DnGu4/H X-Received: by 2002:aa7:d809:: with SMTP id v9mr39268280edq.146.1626760749175; Mon, 19 Jul 2021 22:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626760749; cv=none; d=google.com; s=arc-20160816; b=i4wBQG7qdIdIhIFUKZax/OCITjderz9n0V2iiN3M/MS/+ouLlmJYS8OP4PpiZ0P01y z4pWGl/RbQesldiNytW8zFMnjX/HB7p29pLodnxQ5Piy68OSZrlqzylPvNlHlTk6tmQ7 aBiIEwnCxYDQzT8gkIea1fmjBqBREUmeCUoK4in+v82lr81gyq/cwJGHibpMSiuuA07b 4XUXCVk7if1vYg8Ew2jpJqB3EBAhN3ZPLbctav85nq9Bo4CICu6VmIeqVOK/zEc4rRl3 yQqNae+OtiQsFQrpZSisBK1m31goTORMwZmx+7yow88UkXIhQsz6003/uE5Dh7LLh+Qs YfOQ== 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; bh=m1lbj5bqgk5RVpEd05H47OuS2O8HVP1DiEAItX24UxU=; b=h85GpNJH0ee2+dEzYE9NVGDhhqm0rWpYT1eglCt8J+CDMYHgCFL7KN6XPG9WZV9O3o t28KJm9xB8dLch97AQTcGNy2x0JMCZkmIj9v49E83Bs6A2JM4AivEEPqxRzjdIdsOvuS wc332kAkfAUyN1Z/CnpkdzlqQtDjluNtvE6E501pbVJ84Yug4+SdWpDBVfxNBjh+Dgw2 9kUu5o6Mn5O4As6IGGKsKrl1We7BmTEk+tHimCU8hO+npFdGMoDXFPkrr/gxdm7F8sCA 1CXj0QoMZCR1hyZxJeOlMvmfrweQ04fw7Q1YYfuTd7/9Llc+8usYzXQghU7Wh8qhpi4G 5FoQ== 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 n8si5153759edy.15.2021.07.19.22.58.45; Mon, 19 Jul 2021 22:59:09 -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 S236189AbhGTFQU (ORCPT + 99 others); Tue, 20 Jul 2021 01:16:20 -0400 Received: from mga03.intel.com ([134.134.136.65]:7710 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbhGTFQP (ORCPT ); Tue, 20 Jul 2021 01:16:15 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10050"; a="211240200" X-IronPort-AV: E=Sophos;i="5.84,254,1620716400"; d="scan'208";a="211240200" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 22:56:54 -0700 X-IronPort-AV: E=Sophos;i="5.84,254,1620716400"; d="scan'208";a="500513712" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.238.4.147]) ([10.238.4.147]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 22:56:51 -0700 Subject: Re: [bug report] Patch "perf tools: Fix pattern matching for same substring in different pmu type" broken To: John Garry , Arnaldo Carvalho de Melo , Jiri Olsa , Kan Liang Cc: "linux-kernel@vger.kernel.org" , "linux-perf-users@vger.kernel.org" , Zhangshaokun , "liuqi (BA)" , Andi Kleen , "Jin, Yao" References: <44e25825-5f23-c641-9f1c-72268d895f75@huawei.com> From: "Jin, Yao" Message-ID: <1522c39e-5658-d030-2e1e-f6e5d849d29b@linux.intel.com> Date: Tue, 20 Jul 2021 13:56:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <44e25825-5f23-c641-9f1c-72268d895f75@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi John, Hi Arnaldo, On 7/19/2021 10:13 PM, John Garry wrote: > Hi guys, > > The named patch has broken PMU alias matching on my arm64 system. > > Specifically it is broken for when multiple tokens are used in the alias. For example, alias > "hisi_sccl,l3c" would previously match for PMU "hisi_sccl3_l3c7", but that no longer works. > > In my example, in looking at the code, the callchain pmu_uncore_alias_match("hisi_sccl,l3c", > "hisi_sccl3_l3c7") -> per_pmu__valid_suffix("hisi_sccl3_l3c7", "hisi_sccl") fails in the following > check: > > static bool perf_pmu__valid_suffix(char *pmu_name, char *tok) > { >     char *p; >     ... >     p = pmu_name + strlen(tok); >     ... >     if (*p != '_') //here >         return false; > } > > This check assumes the first token must be followed by a '_', but it is possibly a numeric. > It looks that the PMU alias format on arm64 has big difference than the format on x86. My new idea is we create a x86 specific perf_pmu__valid_suffix, and for other arch, the weak function always returns true. That will not change original behavior. What do you think? > Please let me know how this should work. Previously it would match on the tokens, ignoring numerics > and '_'. > > As an aside, I'll look at why our testcases don't cover this scenario and look to add a test if > necessary. > > Thanks, > john > > Ps, please cc linux-perf-users@vger.kernel.org as in the MAINTAINERS file in future, as not all > subscribe to the open kernel list (and so cannot easily reply directly). > Sorry about that! I will remember that, cc linux-perf-users@vger.kernel.org in next patch. Thanks Jin Yao