Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8138286rdb; Thu, 4 Jan 2024 22:40:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDWjixrbGC+pCVr8l8mmzcb2H8ob/28ehnoXFpSCkHRsOi/7JvkN5un/tkK3X0vNC0/l7m X-Received: by 2002:a50:ab06:0:b0:554:1205:58f4 with SMTP id s6-20020a50ab06000000b00554120558f4mr911935edc.36.1704436835599; Thu, 04 Jan 2024 22:40:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704436835; cv=none; d=google.com; s=arc-20160816; b=dxOk4n2zPaX63nxRwnj1ql32n2Y+2Cp7VUGLdKwCeDGGAE5wGEJEs202zWFJnWFZjU Tfjp/YVG4cnDjeMW/YnVIxlGssIMK6wD5XEQmHncWFu22GQeIq3d8Ob0dt/QubIsQG7N z508aDAVAXsLf5oDIWzPWtc3BCbgatgDXsqAo4xIHxF82aWzrCXvEiFLynTmTGR/hS8R AT7WDZsKMOv9WpBgdhTXL7HN79uVT04P6fJHTe6WrDzNx+2IoQmfqJXaHLjICgS4s0XO 7SvDxDvFtlqL0aeIWUlkJSxR2H+oGsSh77q3I7524zwICKP8WMWVd6UhIRi2KZoVHNW0 d7Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:date:message-id:dkim-signature; bh=UQcabtasED6YyQRtlveON93kfKhc0NA+dGnblGjUnDo=; fh=lLOsB4eTajVxHqzCDDVeOX3/o5wjcfR0tN3WxU+FG/A=; b=ceqvNi/u6GXJe/HMa2ROynUQIZczswLl8W2yryV/plV6eEEopYV/yVfz0JqAM3PM9D 5Vi7DUxqW+3gIKQaENfFQdfPGYywJxG4eIn57R6KsO3cD3/wTC8BHBsXaAMT/pAKyXZt lmY2w1GaW8W+8TASiVgXcutL/dOA4kaFfoklXTRTomgHqnD4zetmm1iPmRBsQltTD6XP /h2lmc7U+boS+DWP80jJP7ksd02XhUx2/T3Yrdhn/lLW8xqe3wjy+9sTJFCQXW1MatsZ CteKobFSaqWcwXU3ql6qrBqqeRiAXiWBO7Ra5dUzwv8GF6K0VKayRBQiBMcZVmhV30Jl Clgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=lng2EOyV; spf=pass (google.com: domain of linux-kernel+bounces-17516-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17516-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a21-20020a509b55000000b0054cd1a2460asi402651edj.672.2024.01.04.22.40.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 22:40:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17516-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=lng2EOyV; spf=pass (google.com: domain of linux-kernel+bounces-17516-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17516-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 210421F2285E for ; Fri, 5 Jan 2024 06:40:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E3076ABB; Fri, 5 Jan 2024 06:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="lng2EOyV" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D4DB1D68C; Fri, 5 Jan 2024 06:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4054qwcj000752; Fri, 5 Jan 2024 06:39:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=UQcabtasED6YyQRtlveON93kfKhc0NA+dGnblGjUnDo=; b=lng2EOyViyLi0kiWyZDvrGQu7AA0o46p3ryMnCLCkB1PgjUXT1HibVeX6ui0qYPamz5B hpo++OiN7OIAwHKCrmKN7b8DQ9DFZXv1uE+T5aj2AV0ha6+lKicG5U/+1LCRZv2V1/8n QVxmDn3zgGQrGAVAQacv5fdaKct2xjRcuNxn6+zoFG8pfoG7dOzq9HUJ7vPuf5ShXfVw H6ws+iaKAg3Rmr0zKjSfTqkfhqJ8uF4epWwFSOkN94LjSwoF0IYLxqRj0vbJVPm5HIbr FbHZmJP8V1xHVj3yWJJvSxMkiL2yaVoL7gRPy7A+oHOQwIJ701IAXZvB45yxt8WUp3vB gQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ve75sf58p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jan 2024 06:39:01 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4055pt4e016297; Fri, 5 Jan 2024 06:39:01 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ve75sf57x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jan 2024 06:39:01 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 4056SBbV019327; Fri, 5 Jan 2024 06:39:00 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vc30sw54r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Jan 2024 06:38:59 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4056cp3g32833808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 Jan 2024 06:38:51 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1863E20063; Fri, 5 Jan 2024 06:38:51 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D663D2005A; Fri, 5 Jan 2024 06:38:46 +0000 (GMT) Received: from [9.171.46.159] (unknown [9.171.46.159]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 5 Jan 2024 06:38:46 +0000 (GMT) Message-ID: <057a1c19-3117-1aec-41d6-4950c599b862@linux.ibm.com> Date: Fri, 5 Jan 2024 12:08:45 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH V3 0/7] Clean up perf mem To: "Liang, Kan" , acme@kernel.org, irogers@google.com, peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, john.g.garry@oracle.com, will@kernel.org, james.clark@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, yuhaixin.yhx@linux.alibaba.com, renyu.zj@linux.alibaba.com, tmricht@linux.ibm.com, ravi.bangoria@amd.com, atrajeev@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20231213195154.1085945-1-kan.liang@linux.intel.com> <8bfadc86-e137-4a9f-a9ce-0bc62464c195@linux.intel.com> Content-Language: en-US From: kajoljain In-Reply-To: <8bfadc86-e137-4a9f-a9ce-0bc62464c195@linux.intel.com> Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZRmdHNq2a3gw6YD3VOZoBLN-MIHgfhiV X-Proofpoint-GUID: btOFsyXGbKqO4PCdzXLTmz6TwPeRSz-c Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-05_02,2024-01-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 suspectscore=0 clxscore=1011 mlxlogscore=999 impostorscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401050055 On 1/3/24 01:38, Liang, Kan wrote: > Hi Kajol Jain > > On 2023-12-19 9:15 a.m., Liang, Kan wrote: >> >> >> On 2023-12-19 4:26 a.m., kajoljain wrote: >>> Hi, >>> I was trying to test this patchset on powerpc. >>> >>> After applying it on top of acme's perf-tools-next branch, I am getting >>> below error: >>> >>> INSTALL libsubcmd_headers >>> INSTALL libperf_headers >>> INSTALL libsymbol_headers >>> INSTALL libapi_headers >>> INSTALL libbpf_headers >>> CC arch/powerpc/util/mem-events.o >>> In file included from arch/powerpc/util/mem-events.c:3: >>> arch/powerpc/util/mem-events.h:5:52: error: ‘PERF_MEM_EVENTS__MAX’ >>> undeclared here (not in a function) >>> 5 | extern struct perf_mem_event >>> perf_mem_events_power[PERF_MEM_EVENTS__MAX]; >>> | >>> ^~~~~~~~~~~~~~~~~~~~ >>> make[6]: *** [/home/kajol/linux/tools/build/Makefile.build:105: >>> arch/powerpc/util/mem-events.o] Error 1 >>> make[5]: *** [/home/kajol/linux/tools/build/Makefile.build:158: util] >>> Error 2 >>> make[4]: *** [/home/kajol/linux/tools/build/Makefile.build:158: powerpc] >>> Error 2 >>> make[3]: *** [/home/kajol/linux/tools/build/Makefile.build:158: arch] >>> Error 2 >>> make[3]: *** Waiting for unfinished jobs.... >>> make[2]: *** [Makefile.perf:693: perf-in.o] Error 2 >>> make[1]: *** [Makefile.perf:251: sub-make] Error 2 >>> make: *** [Makefile:70: all] Error 2 >>> >>> It seems some headerfiles are missing from arch/powerpc/util/mem- >>> events.c >>> >> >> Leo updated the headerfiles for ARM. https://termbin.com/0dkn >> >> I guess powerpc has to do the same thing. Could you please try the below >> patch? > > > Does the patch work on powerpc? Hi Kan, Sorry I went for vacation so couldn't update. Yes this fix works. But we have another issue, actually this patch set changes uses ldlat attribute. But ldlat is not supported in powerpc because of which perf mem is failing in powerpc. I am looking into a work around to fix this issue. I will update the fix. Thanks, Kajol Jain > > > Thanks, > Kan >> >> diff --git a/tools/perf/arch/powerpc/util/mem-events.c >> b/tools/perf/arch/powerpc/util/mem-events.c >> index 72a6ac2b52f5..765d4a054b0a 100644 >> --- a/tools/perf/arch/powerpc/util/mem-events.c >> +++ b/tools/perf/arch/powerpc/util/mem-events.c >> @@ -1,5 +1,6 @@ >> // SPDX-License-Identifier: GPL-2.0 >> -#include "map_symbol.h" >> +#include "util/map_symbol.h" >> +#include "util/mem-events.h" >> #include "mem-events.h" >> >> #define E(t, n, s, l, a) { .tag = t, .name = n, .event_name = s, .ldlat >> = l, .aux_event = a } >> >> Thanks, >> Kan >> >>> Thanks, >>> Kajol Jain >>> >>> On 12/14/23 01:21, kan.liang@linux.intel.com wrote: >>>> From: Kan Liang >>>> >>>> Changes since V2: >>>> - Fix the Arm64 building error (Leo) >>>> - Add two new patches to clean up perf_mem_events__record_args() >>>> and perf_pmus__num_mem_pmus() (Leo) >>>> >>>> Changes since V1: >>>> - Fix strcmp of PMU name checking (Ravi) >>>> - Fix "/," typo (Ian) >>>> - Rename several functions with perf_pmu__mem_events prefix. (Ian) >>>> - Fold the header removal patch into the patch where the cleanups made. >>>> (Arnaldo) >>>> - Add reviewed-by and tested-by from Ian and Ravi >>>> >>>> As discussed in the below thread, the patch set is to clean up perf mem. >>>> https://lore.kernel.org/lkml/afefab15-cffc-4345-9cf4-c6a4128d4d9c@linux.intel.com/ >>>> >>>> Introduce generic functions perf_mem_events__ptr(), >>>> perf_mem_events__name() ,and is_mem_loads_aux_event() to replace the >>>> ARCH specific ones. >>>> Simplify the perf_mem_event__supported(). >>>> >>>> Only keeps the ARCH-specific perf_mem_events array in the corresponding >>>> mem-events.c for each ARCH. >>>> >>>> There is no functional change. >>>> >>>> The patch set touches almost all the ARCHs, Intel, AMD, ARM, Power and >>>> etc. But I can only test it on two Intel platforms. >>>> Please give it try, if you have machines with other ARCHs. >>>> >>>> Here are the test results: >>>> Intel hybrid machine: >>>> >>>> $perf mem record -e list >>>> ldlat-loads : available >>>> ldlat-stores : available >>>> >>>> $perf mem record -e ldlat-loads -v --ldlat 50 >>>> calling: record -e cpu_atom/mem-loads,ldlat=50/P -e cpu_core/mem-loads,ldlat=50/P >>>> >>>> $perf mem record -v >>>> calling: record -e cpu_atom/mem-loads,ldlat=30/P -e cpu_atom/mem-stores/P -e cpu_core/mem-loads,ldlat=30/P -e cpu_core/mem-stores/P >>>> >>>> $perf mem record -t store -v >>>> calling: record -e cpu_atom/mem-stores/P -e cpu_core/mem-stores/P >>>> >>>> >>>> Intel SPR: >>>> $perf mem record -e list >>>> ldlat-loads : available >>>> ldlat-stores : available >>>> >>>> $perf mem record -e ldlat-loads -v --ldlat 50 >>>> calling: record -e {cpu/mem-loads-aux/,cpu/mem-loads,ldlat=50/}:P >>>> >>>> $perf mem record -v >>>> calling: record -e {cpu/mem-loads-aux/,cpu/mem-loads,ldlat=30/}:P -e cpu/mem-stores/P >>>> >>>> $perf mem record -t store -v >>>> calling: record -e cpu/mem-stores/P >>>> >>>> Kan Liang (7): >>>> perf mem: Add mem_events into the supported perf_pmu >>>> perf mem: Clean up perf_mem_events__ptr() >>>> perf mem: Clean up perf_mem_events__name() >>>> perf mem: Clean up perf_mem_event__supported() >>>> perf mem: Clean up is_mem_loads_aux_event() >>>> perf mem: Clean up perf_mem_events__record_args() >>>> perf mem: Clean up perf_pmus__num_mem_pmus() >>>> >>>> tools/perf/arch/arm/util/pmu.c | 3 + >>>> tools/perf/arch/arm64/util/mem-events.c | 39 +--- >>>> tools/perf/arch/arm64/util/mem-events.h | 7 + >>>> tools/perf/arch/powerpc/util/mem-events.c | 13 +- >>>> tools/perf/arch/powerpc/util/mem-events.h | 7 + >>>> tools/perf/arch/powerpc/util/pmu.c | 11 ++ >>>> tools/perf/arch/s390/util/pmu.c | 3 + >>>> tools/perf/arch/x86/util/mem-events.c | 99 ++-------- >>>> tools/perf/arch/x86/util/mem-events.h | 10 + >>>> tools/perf/arch/x86/util/pmu.c | 19 +- >>>> tools/perf/builtin-c2c.c | 45 ++--- >>>> tools/perf/builtin-mem.c | 48 ++--- >>>> tools/perf/util/mem-events.c | 217 +++++++++++++--------- >>>> tools/perf/util/mem-events.h | 19 +- >>>> tools/perf/util/pmu.c | 4 +- >>>> tools/perf/util/pmu.h | 7 + >>>> tools/perf/util/pmus.c | 6 - >>>> tools/perf/util/pmus.h | 1 - >>>> 18 files changed, 278 insertions(+), 280 deletions(-) >>>> create mode 100644 tools/perf/arch/arm64/util/mem-events.h >>>> create mode 100644 tools/perf/arch/powerpc/util/mem-events.h >>>> create mode 100644 tools/perf/arch/powerpc/util/pmu.c >>>> create mode 100644 tools/perf/arch/x86/util/mem-events.h >>>> >>> >>