Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1338929iof; Tue, 7 Jun 2022 03:43:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2kOXBEnunaRNNcnMDcZYn9q6HvtNOSYso8PelE9c4Bv3ZgSyfF0gOoPWURyKfqVJarjtL X-Received: by 2002:a17:902:db0f:b0:166:42b5:c819 with SMTP id m15-20020a170902db0f00b0016642b5c819mr26721517plx.96.1654598621062; Tue, 07 Jun 2022 03:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654598621; cv=none; d=google.com; s=arc-20160816; b=hzm7X1nF7P9K/qBlErrHPPlblOvISdAcU8zp+UXnjww3ui49UYG7NeuXiDQUeVSE6B WKZfpihVO+nnxxNQ8aE5GzH+Lq9zSFRr/9pyQP0CdR2iKwQNCcMVHU2/VqfFJS2mR/i/ /LlYTdaTJZOUvam1h0xdaI5IVCzeyE/SpcUQILszMgTQJmUTRUlU4TnukdbZm1c2PUa7 Ym3Rqle1/Eeg76sQ+8kMfFlGtrLX2gfQKrv+ekSlw56eYBDFTxD22gDoDqHWTKzmTkyb 8loiRvQjR1kg1w7RuLcveauatyPsXBUj3cg5+eFCz0LA2xNOka/7/7tfip+jbevgn99V +/9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=feTs37C7gOoBTTvu4J4a/W8wj3saqfjkYK0ShR5TDGk=; b=od89xeecUlAY8e3P6Hs7X7Hl4eswSB9EqzLRHAl3siqw4/Vs5oHrlDf8KxHdlZzxIl RVoviuyVErjL9v7844pWklr0smVkBbF0KHTQun3jZQks5hOl7hdaEijAZm3qwMduFD7W b5GL9ltQFlkpaVUT1udyiCk4voxSkr0Y4FyCXoV1NgGbQOPEnSZVTRm1XwlaukFvKl9u dLMoFAJRovC7vzEmEETrZbvkovokyqyOWULjhvZtNnRqiwX1ZTl4+mvh+tLot04L3+mX JmtDwCBracOrBWrnkBtQGqXM695QxPiCWXAJt93DZsCucdKkYMpxVMi+Tp3OElM7YS/+ na6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a170902f68c00b00163539c5a64si24561765plg.525.2022.06.07.03.43.26; Tue, 07 Jun 2022 03:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235346AbiFFXrL (ORCPT + 99 others); Mon, 6 Jun 2022 19:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235334AbiFFXrJ (ORCPT ); Mon, 6 Jun 2022 19:47:09 -0400 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A031C03A9; Mon, 6 Jun 2022 16:47:08 -0700 (PDT) Received: by mail-oi1-f179.google.com with SMTP id q184so4890647oia.1; Mon, 06 Jun 2022 16:47:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=feTs37C7gOoBTTvu4J4a/W8wj3saqfjkYK0ShR5TDGk=; b=Umu+7byJWB9JIeXcD5JzJ49rSzi+MWEqrwi+D6xkqrBuMQ/emB4cXMIHz7U7jYsx1I hcHAHAEQSaHEsQzuAGTPemE3nvud0ZVWEX+vkSjCfqAVKqPpTbqbFW6RMakGOCEUy9zr UhYGQjOe8d51JHP8QoQcn3RrZZGKOiqbOMeYXgNekr/aeJ1R3zRDufNEvXYfCFX2Kw9h VcvM6Baclsf7f+8GaO9D8nT9r1/F1NrARE2ThrwG8WDBUIeP4/5EqdD8jWhoYHIgWEaT R8oQEifNS6cSBxTFlLMJgn83vN+dliVAVDr7v4MqmHJ9Nwu45wvFQ4+kYfSI7Cka2OWD nQPQ== X-Gm-Message-State: AOAM531so2QwLXtanKjwa6z9auKyW5JpWn6g8QNWE5CYo8ZsKJvVsPRW euBjd+urgrQZydTjzj7JGsyBaD2xOcRQSIDBuTA= X-Received: by 2002:a05:6808:1a01:b0:32b:1f24:9213 with SMTP id bk1-20020a0568081a0100b0032b1f249213mr15031643oib.92.1654559227850; Mon, 06 Jun 2022 16:47:07 -0700 (PDT) MIME-Version: 1.0 References: <20220604044519.594-1-ravi.bangoria@amd.com> In-Reply-To: <20220604044519.594-1-ravi.bangoria@amd.com> From: Namhyung Kim Date: Mon, 6 Jun 2022 16:46:57 -0700 Message-ID: Subject: Re: [PATCH v6 0/8] perf/amd: Zen4 IBS extensions support (tool changes) To: Ravi Bangoria Cc: Arnaldo Carvalho de Melo , Kan Liang , Jiri Olsa , Ian Rogers , Peter Zijlstra , rrichter@amd.com, Ingo Molnar , Mark Rutland , Thomas Gleixner , Borislav Petkov , James Clark , Leo Yan , Andi Kleen , Stephane Eranian , like.xu.linux@gmail.com, x86@kernel.org, linux-perf-users , linux-kernel , Sandipan Das , ananth.narayan@amd.com, Kim Phillips , santosh.shukla@amd.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ravi, On Fri, Jun 3, 2022 at 9:46 PM Ravi Bangoria wrote: > > Kernel side of changes have already been applied to linus/master > (except amd-ibs.h header). This series contains perf tool changes. > > v5: https://lore.kernel.org/lkml/20220601032608.1034-1-ravi.bangoria@amd.com > v5->v6: > - Use macros instead of magic numbers for IBS l3missonly bits > - Use asprintf() instead of allocating memory and copying data manually > - Add Reviewed-by Kan Liang (patch 2-5). > > Patches prepared on acme/perf/core (9dde6cadb92b5) > > Original cover letter: > > IBS support has been enhanced with two new features in upcoming uarch: > 1. DataSrc extension and 2. L3 Miss Filtering capability. Both are > indicated by CPUID_Fn8000001B_EAX bit 11. > > DataSrc extension provides additional data source details for tagged > load/store operations. Add support for these new bits in perf report/ > script raw-dump. > > IBS L3 miss filtering works by tagging an instruction on IBS counter > overflow and generating an NMI if the tagged instruction causes an L3 > miss. Samples without an L3 miss are discarded and counter is reset > with random value (between 1-15 for fetch pmu and 1-127 for op pmu). > This helps in reducing sampling overhead when user is interested only > in such samples. One of the use case of such filtered samples is to > feed data to page-migration daemon in tiered memory systems. > > Add support for L3 miss filtering in IBS driver via new pmu attribute > "l3missonly". Example usage: > > # perf record -a -e ibs_op/l3missonly=1/ --raw-samples sleep 5 > # perf report -D > > Some important points to keep in mind while using L3 miss filtering: > 1. Hw internally reset sampling period when tagged instruction does > not cause L3 miss. But there is no way to reconstruct aggregated > sampling period when this happens. > 2. L3 miss is not the actual event being counted. Rather, IBS will > count fetch, cycles or uOps depending on the configuration. Thus > sampling period have no direct connection to L3 misses. > > 1st causes sampling period skew. Thus, I've added warning message at > perf record: > > # perf record -c 10000 -C 0 -e ibs_op/l3missonly=1/ > WARNING: Hw internally resets sampling period when L3 Miss Filtering is enabled > and tagged operation does not cause L3 Miss. This causes sampling period skew. > > User can configure smaller sampling period to get more samples while > using l3missonly. > > > Ravi Bangoria (8): > perf record ibs: Warn about sampling period skew > perf tool: Parse pmu caps sysfs only once > perf headers: Pass "cpu" pmu name while printing caps > perf headers: Store pmu caps in an array of strings > perf headers: Record non-cpu pmu capabilities > perf/x86/ibs: Add new IBS register bits into header > perf tool ibs: Sync amd ibs header file > perf script ibs: Support new IBS bits in raw trace dump Acked-by: Namhyung Kim Thanks, Namhyung > > arch/x86/include/asm/amd-ibs.h | 16 +- > tools/arch/x86/include/asm/amd-ibs.h | 16 +- > .../Documentation/perf.data-file-format.txt | 10 +- > tools/perf/arch/x86/util/evsel.c | 52 +++++ > tools/perf/builtin-inject.c | 2 +- > tools/perf/util/amd-sample-raw.c | 68 ++++++- > tools/perf/util/env.c | 62 +++++- > tools/perf/util/env.h | 14 +- > tools/perf/util/evsel.c | 7 + > tools/perf/util/evsel.h | 1 + > tools/perf/util/header.c | 189 ++++++++++-------- > tools/perf/util/header.h | 2 +- > tools/perf/util/pmu.c | 15 +- > tools/perf/util/pmu.h | 2 + > 14 files changed, 329 insertions(+), 127 deletions(-) > > -- > 2.31.1 >