Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2682191pxk; Mon, 14 Sep 2020 22:18:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYjFJbzd+yxjJAXi1mjF6Arnd3lt1Q6mnx6fwNohdy9p7cEjWwzje87bffU0f+V0ZREC8K X-Received: by 2002:aa7:d40f:: with SMTP id z15mr20927294edq.247.1600147129701; Mon, 14 Sep 2020 22:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600147129; cv=none; d=google.com; s=arc-20160816; b=Ak43XfDQtdv4wIw8FrgOKFv25iHoADsBQH/dPUqKfIIz7EpuJeG5oEcvjwt6do6uxh gtESVGPuPdA7G+/AYYpshK0eL+qugSXIrT5rCgs7vrhAcWdp17DEnhkE65PwrXy0yLXF G5PiZkidkPMSg3f3x2f+KZKpPGBKeSsmShan3a/u3bYGT3D+vfkV+0SgtZuKj4zWIacn FPuALQSj/1a/UYYAM/R7e5rydYlFCeyIUnZAT4DfcgDAGRaJx3bItbKb94qCkdLibcum JJlbxL5gMfLfmJpOZmYJJS5G6pBdVF/HmnzYd9IiBryZViaKnczeeWOFBrsqVl11fg0Y XKyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iR9itKcMJs79Q2oWzWkGeUGaEOEnD9YYCRPWnD87X7M=; b=APvEKn2ob5SDvOaSI9XnTz6mk82LGwIcNfWs6lMMI9ay7KQmsxzsb5jw9DVcuvhBXt Q3m/8h7Y1R4IO+6Cds8bbzhLnBQC9QfWWKW6ucBiG1SSGm0y+g0P4RCenz0037kZkADA fZaXVpeHLZyzHmcDv5fl7mUTxicFONeEipTCn7M0CAJMBhThvut5pC4i+u2CePhHyWYY TkGy78bIEhX5rI2kIOzdxnG5Oech+47pDm2OpDTUH+hWfbMbgeg/WbUmHQVSpAsecu0f Gj3GnsWSGB8joOrhv5SKI0dUFViJJEefDZV8Hu3/M58nMR4uf4N8lXw4ZyS7tRjq3a42 wioQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jLhkzP3E; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si8431258ejt.170.2020.09.14.22.18.27; Mon, 14 Sep 2020 22:18:49 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=jLhkzP3E; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbgIOFPe (ORCPT + 99 others); Tue, 15 Sep 2020 01:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbgIOFP3 (ORCPT ); Tue, 15 Sep 2020 01:15:29 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED3CC06174A for ; Mon, 14 Sep 2020 22:15:27 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id z4so1833149wrr.4 for ; Mon, 14 Sep 2020 22:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iR9itKcMJs79Q2oWzWkGeUGaEOEnD9YYCRPWnD87X7M=; b=jLhkzP3EuzQA7vsDJ+JKyctmtLYh43QXXIDmjrFhKNXAbWTcpveooeLiVzV67JKaBq ZAuDTPOKVjrc+gS+4bIM0oEpBWLg/BxQ21XHZSx2jcQFq/KkJ2ep9WMBEJCINvNr7mkU 7XOZhjASfEV45szPp+z25HoIVzt/2HUoTxuoxq5DYHGT904SlrMDDSl2Rbw4u1b8njZJ i2YXQs+CL8t8FPkTMd5is3AhmEYGfethaseiLjyNhxfoILqlWKMQeDiXQw/UXGLz3sSP Y3pkQiJOZhG9U9Y60YUSNm1ttMXnRIMVFOIUUy1SrOOU16OlHC6qMvxPi+TloAtUhmLH q9fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iR9itKcMJs79Q2oWzWkGeUGaEOEnD9YYCRPWnD87X7M=; b=CEQFvVmDrhuX/BzNgZBN9bE7yQyG/LRyV+hTXq3vE1HctW15QS+P3KJEZ1iY5mWXOL ZQrqx9uTjsFu8u81UWEDNwgzy/UnPL4sQCYweOWoS+8MJLcima/MZFafhSlcnAXSBjBp da46+agy+m/bSGnlf7HZk7AZiizBxC72DT9nlN1fJNNoJPhXRKMtTJjCGHFHNQRh1+up D6600M5MdEYr3lrMa723P/n9EHCF03ZxZtJxzV+h3CQFHjnz5GUcrU9L1hwfayfF8LSx 6fZ+gZiRHQsYCDQzn4yfDKJ7SjlzUzBU40ahzufjWxHyYqCDh8MwBdMxa3Iv/HQop3n/ c+4Q== X-Gm-Message-State: AOAM530TL18cKWty5zJ85G5DUWAHlY+KlRF5JaZkdTEFlcQe9zZ04xDy QXd/03ZVQeLWK6FHEVGTMw7HixBo255ABIUCznFyBA== X-Received: by 2002:a5d:608a:: with SMTP id w10mr18581226wrt.48.1600146926452; Mon, 14 Sep 2020 22:15:26 -0700 (PDT) MIME-Version: 1.0 References: <20200915031819.386559-1-namhyung@kernel.org> In-Reply-To: <20200915031819.386559-1-namhyung@kernel.org> From: Ian Rogers Date: Mon, 14 Sep 2020 22:15:11 -0700 Message-ID: Subject: Re: [PATCHSET v2 00/11] perf tools: Fix various memory leaks To: Namhyung Kim , Jin Yao , Andi Kleen Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , Mark Rutland , Alexander Shishkin , Stephane Eranian , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 8:18 PM Namhyung Kim wrote: > > Hello, > > I've found and fixed a bunch of memory leaks during perf pmu and > metric tests with address sanitizer. Before this, the tests were > mostly failed due to the leaks since ASAN makes it return non-zero. > > Now I'm seeing no error with ASAN like below: > > $ ./perf test pmu metric > 9: Parse perf pmu format : Ok > 10: PMU events : > 10.1: PMU event table sanity : Ok > 10.2: PMU event map aliases : Ok > 10.3: Parsing of PMU event table metrics : Skip (some metrics failed) > 10.4: Parsing of PMU event table metrics with fake PMUs : Ok > 67: Parse and process metrics : Ok > > The failure in 10.3 seems due to parse errors like below: > > Multiple errors dropping message: unknown term 'filter_opc' for pmu 'uncore_cbox_0' > (valid terms: event,edge,inv,umask,cmask,config,config1,config2,name,period,freq, > branch_type,time,call-graph,stack-size,no-inherit,inherit,max-stack, > nr,no-overwrite,overwrite,driver-config,percore,aux-output,aux-sample-size) > > > Parse event failed metric 'DRAM_Parallel_Reads' id 'arb/event=0x80,umask=0x2,thresh=1/' > expr 'arb@event\=0x80\,umask\=0x2@ / arb@event\=0x80\,umask\=0x2\,thresh\=1@' > Error string 'unknown term 'thresh' for pmu 'uncore_arb'' help > 'valid terms: event,edge,inv,umask,cmask,config,config1,config2,name,period,freq, > branch_type,time,call-graph,stack-size,no-inherit,inherit,max-stack, > nr,no-overwrite,overwrite,driver-config,percore,aux-output,aux-sample-size' The 10.3 failure seems to be a problem in the skl metric DRAM_Parallel_Reads: https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json?h=perf/core#n319 arb@event\\=0x80\\,umask\\=0x2@ / arb@event\\=0x80\\,umask\\=0x2\\,thresh\\=1@ The test failure message is: Parse event failed metric 'DRAM_Parallel_Reads' id 'arb/event=0x80,umask=0x2,thresh=1/' expr 'arb@event\=0x80\,umask\=0x2@ / arb@event\=0x80\,umask\=0x2\,thresh\=1@' Error string 'unknown term 'thresh' for pmu 'uncore_arb'' help 'valid terms: event,edge,inv,umask,cmask,config,config1,config2,name,period,freq,branch_type,time,call-graph,stack-size,no-inherit,inherit,max-stack,nr,no-overwrite,overwrite,driver-config,percore,aux-output,aux-sample-size' The 01.org version of this from: https://download.01.org/perfmon/TMA_Metrics.xlsx is: UNC_ARB_TRK_OCCUPANCY.DATA_READ / UNC_ARB_TRK_OCCUPANCY.DATA_READ:c1 It seems that :c1 has been translated into thresh=1 but that thresh doesn't exist as a format option (just "cmask edge event inv umask" are present). I wonder if Andi or Jin you could look into this broken metric? Thanks, Ian > * Changes from v1: > - Add 'Acked-by: Jiri' > > > The patches are also available at 'perf/metric-fix-v2' branch on > > git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git > > Thanks > Namhyung > > > Namhyung Kim (11): > perf metric: Fix some memory leaks > perf metric: Fix some memory leaks - part 2 > perf evlist: Fix cpu/thread map leak > perf parse-event: Fix cpu map leaks > perf parse-event: Fix memory leak in evsel->unit > perf test: Fix memory leaks in parse-metric test > perf metric: Release expr_parse_ctx after testing > perf metric: Free metric when it failed to resolve > perf metric: Do not free metric when failed to resolve > perf test: Free aliases for PMU event map aliases test > perf test: Free formats for perf pmu parse test > > tools/perf/tests/parse-metric.c | 14 ++++++++----- > tools/perf/tests/pmu-events.c | 5 +++++ > tools/perf/tests/pmu.c | 1 + > tools/perf/util/evlist.c | 11 ++++++++--- > tools/perf/util/metricgroup.c | 35 +++++++++++++++++++++++---------- > tools/perf/util/parse-events.c | 9 +++++++-- > tools/perf/util/pmu.c | 13 +++++++++++- > tools/perf/util/pmu.h | 2 ++ > tools/perf/util/stat-shadow.c | 8 +++++--- > 9 files changed, 74 insertions(+), 24 deletions(-) > > -- > 2.28.0.618.gf4bc123cb7-goog >