From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1094DC43387 for ; Mon, 17 Dec 2018 17:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3B0D214C6 for ; Mon, 17 Dec 2018 17:21:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linaro.org header.i=@linaro.org header.b="a8jaAhQD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388298AbeLQRVu (ORCPT ); Mon, 17 Dec 2018 12:21:50 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41980 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727186AbeLQRVu (ORCPT ); Mon, 17 Dec 2018 12:21:50 -0500 Received: by mail-pl1-f194.google.com with SMTP id u6so6426952plm.8 for ; Mon, 17 Dec 2018 09:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Yzzy5cbsbIfUDrm2/cUff8ZiTSbnfPoPgDNURDr33A8=; b=a8jaAhQD+i6hI83fRC+CDzto8wWTF8OEsorQrb7kniPhJVrnU8SfLbMf0Xn7tivg50 Dd5SVxL83lTk0L5TBQVq7NI/6ZMkpy+8B8PXJ6CApfGmcaTwoX6S4o5bSlk8u8qV/dIZ Cg3chmUaZyYosSvogHKE3yi1iVYktWKzRsmQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Yzzy5cbsbIfUDrm2/cUff8ZiTSbnfPoPgDNURDr33A8=; b=ViIrTjcIE4vk/fpaWCm9oOQwhVH15WAa342E6VEW2je3rUE3/4PvzcOFz/RtCHkaBa EVnGeh22DEV4sPD00XlrHfy1vndEsiCcM2wOIHBcFe3X0uVPjuR55JroGB8BgZCXAb9S gLX2FeuDDsibN56kOsxgDmDMHodJL7+VNHOxqcxObbGAkwdaA1/BMAqofekv+r6hL98J Fr3xo2vWOdDKnOcRJfTeN4OjBTW2YI7Wuc6p/lc5yCV6Jwrc4VRIJJQXSXKzPIhnDYPs RIEQNmaFwlnv+eUXGmNluSYvHH3y6GPZ1fLVaFWZZZjkBLCFceDZ4oPDN7tIym8UiEQN eJPQ== X-Gm-Message-State: AA+aEWZDB5odKVbQPrtsXMK5+i3/k/lckr8ZH7r518jqieM2oR51yPER 0f9Fle08Q0YBevyIl/1W2/5q+ShuZ10= X-Google-Smtp-Source: AFSGD/XtxLtYNGU6F2etgMtW/QNN4Y30g40zJ4FRuwbT98GtB9DaK6bz/qhHNyHDNZ99mR+gArtWHw== X-Received: by 2002:a17:902:bb98:: with SMTP id m24mr13025374pls.71.1545067309406; Mon, 17 Dec 2018 09:21:49 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j6sm20526648pfg.126.2018.12.17.09.21.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 09:21:48 -0800 (PST) From: Mathieu Poirier To: acme@kernel.org, peterz@infradead.org, gregkh@linuxfoundation.org Cc: mingo@redhat.com, tglx@linutronix.de, alexander.shishkin@linux.intel.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, will.deacon@arm.com, mark.rutland@arm.com, jolsa@redhat.com, namhyung@kernel.org, adrian.hunter@intel.com, ast@kernel.org, hpa@zytor.com, suzuki.poulosi@arm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v5 0/6] perf: Add ioctl for PMU driver configuration Date: Mon, 17 Dec 2018 10:21:40 -0700 Message-Id: <1545067306-31687-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the coresight world there can be more than one sink to aggregate trace data generated by CPUs, hence the need for users to select which one to use from the perf command line. Up until now sysfs was used to communicate sink information to the kernel but that was never the right way to proceed because it breaks when more than one perf session are created at the same time. The situation was manageable when working with per-thread scenarios where a single HW trace event is created but in CPU-wide mode a HW trace event is created for each CPU that is specified on the perf command line, taking us back to the concurrency problem we have when dealing with multiple per-thread session. This work fits in a wider scheme to support CPU-wide trace scenarios on CoreSight that is available here [1]. The first step in that venture is to address sysfs concurrency issues, which this patchset does. The main difference with V4 is the usage of a CoreSight sink's HW start address (u64) to uniquely identify a sink, negating the need to use the component's name (char *). By using a u64 we can theoretically add the sink information to the perf_event_attr structure, avoiding the need to add a new perf ioctl(). On the flip side it would introduce a very specific CoreSight field to a structure that is generic. I have opted for the ioctl() method, let me know if you want me to proceed with the latter. Regards, Mathieu # Before this set: root@juno:/home/linaro# perf record -e cs_etm/@20070000.etr/ -C 2,3 sleep 1 failed to mmap with 12 (Cannot allocate memory) # After this set: root@juno:/home/linaro# perf record -e cs_etm/@20070000.etr/ -C 2,3 sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 4.145 MB perf.data ] [1]. https://git.linaro.org/people/mathieu.poirier/coresight.git/log/?h=cpu-wide-coresight --- Changes for V5: . Went from a char * to a u64 for ioctl argument (GKH). . Added a better description of the problem being fixed to the cover letter (GKH). Changes for V4: . Made passing of information between ioctl() and PMU simpler. Mathieu Poirier (6): perf: Introduce ioctl to communicate driver configuration to kernel perf/core: Use ioctl to communicate driver configuration to kernel perf/aux: Make perf_event accessible to setup_aux() coresight: Use PMU driver configuration for sink selection perf tools: Make perf_evsel accessible to PMU driver configuration code perf tools: Use ioctl function to send sink information to kernel arch/s390/kernel/perf_cpum_sf.c | 6 +- arch/x86/events/intel/bts.c | 4 +- arch/x86/events/intel/pt.c | 5 +- drivers/hwtracing/coresight/coresight-etm-perf.c | 80 +++++++++++++++++----- drivers/perf/arm_spe_pmu.c | 6 +- include/linux/perf_event.h | 40 ++++++++++- include/uapi/linux/perf_event.h | 1 + kernel/events/core.c | 67 +++++++++++++++++++ kernel/events/ring_buffer.c | 2 +- tools/include/uapi/linux/perf_event.h | 1 + tools/perf/arch/arm/util/cs-etm.c | 84 +++++++++++++++++++++++- tools/perf/arch/arm/util/cs-etm.h | 3 +- tools/perf/util/drv_configs.c | 30 ++------- tools/perf/util/evsel.c | 6 ++ tools/perf/util/evsel.h | 1 + tools/perf/util/pmu.h | 3 +- 16 files changed, 287 insertions(+), 52 deletions(-) -- 2.7.4