From patchwork Wed Nov 28 22:01:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 10703437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19A9115A8 for ; Wed, 28 Nov 2018 22:01:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09F802DE5F for ; Wed, 28 Nov 2018 22:01:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F21362DEC2; Wed, 28 Nov 2018 22:01:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CC142DE5F for ; Wed, 28 Nov 2018 22:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Sqfg07d1PV7ZfBQppdm3ikkZS9XNtkTMCjSDCtWdrzo=; b=f1c whRY5WVFhCm1FPBdOH8ceSd2YJgnHGNYSOOa93YgCafGejl8CHg2RmfWm5/kgYwHLZG5arlr1Xtmf 2QYbmGbMIdzcQjf+toNQ7i2QiZ1VaPuPzjs2vBfRb4K9yXMGlCL9DwEMVXvhU8fk/20OnQ4WKrjqp mCjVIlYAEWYntlWRM4bIVpAsQ1qfHVBqC+B+rqK+shd/DF5mWDwjRy679QtMzOfzrWy9nhJ11nUCC ylLs/LcW0QnkiwrQPrqEd6E7Dq7l+Ibeh/vm0XlBqf/TKlsMlQ5yLMKrSYQf4n0IlyzY4iYk7siqX WQXJAQjKfcZ1sNsXboBuSP2VGxR728A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gS7tn-0008JP-E2; Wed, 28 Nov 2018 22:01:35 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gS7tj-0008IT-6s for linux-arm-kernel@lists.infradead.org; Wed, 28 Nov 2018 22:01:33 +0000 Received: by mail-pl1-x644.google.com with SMTP id g9so5575936plo.3 for ; Wed, 28 Nov 2018 14:01:21 -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=7aj3LJl/otFhIEi9eRonY/qXn3nkgbWFEKET08mBECw=; b=j2//ZgiJUWr5rpEUo9ivQshZmZbLAU665/2VlD/AG2hMmzIFFXAJ2A6uuiKt55QF9Z U0yoyfkSC8y/LYUVQmfGWn68r9+ScyzAvFlQ1xI9w2VJgmYtvbmJIKvvXm61752+w/y8 xnXpqaLZWvStAeOiuDjQyBtcE7thE/b9eoJ+M= 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=7aj3LJl/otFhIEi9eRonY/qXn3nkgbWFEKET08mBECw=; b=EdGNy9GATca/z9nfA6pKx9JjhLGjxypaxL7DOymkwTi5XP3biPnh1yJ5SEHfNm21ah MmnHGNp9sNVSXWpkZCQSq+ibMvJdRUb7usfX8ncyBfW19KfYNkUDYQXDItn/3a3uIeN0 /QAnbhWab/TmUUf6B7A81jhB/QDw7pFNeCb1zD3Qa07YubTKdAACqcPyWkGIb6Q5IxdS miZpne5cdFffvRppQ8JyIOuhgRKcP/Y7vLNbUkW3znuctNz711e8HTUgA0psEGLWu+3T MNBo3zNOFRTFFswmhejI2zqHS5Vxm4zliP3RAuvWo9CUP9wau8T2hmBPjNNIJURaLtSC nl4Q== X-Gm-Message-State: AA+aEWYL9a6l+KzeTrhtnOOofGt8qs9OXqERYx9xo0MymmGTqi2qOpp+ TkIGUwo5C33ZkEd2xOmnta8cxXhp5bA= X-Google-Smtp-Source: AFSGD/WKkpX1MX45VwfMDgqmEEiYCgeOwNXpjNm/SKpsZZTC83u6esIlb1gW8zzITO3gZ8pyu4OXMQ== X-Received: by 2002:a17:902:4025:: with SMTP id b34mr39017356pld.181.1543442480554; Wed, 28 Nov 2018 14:01:20 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 12sm8698051pgd.35.2018.11.28.14.01.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Nov 2018 14:01:19 -0800 (PST) From: Mathieu Poirier To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com Subject: [PATCH v4 0/6] perf: Add ioctl for PMU driver configuration Date: Wed, 28 Nov 2018 15:01:12 -0700 Message-Id: <1543442478-31465-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181128_140131_266429_83313220 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-s390@vger.kernel.org, alexander.shishkin@linux.intel.com, will.deacon@arm.com, hpa@zytor.com, heiko.carstens@de.ibm.com, adrian.hunter@intel.com, ast@kernel.org, suzuki.poulosi@arm.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, schwidefsky@de.ibm.com, namhyung@kernel.org, tglx@linutronix.de, jolsa@redhat.com, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is the fourth iteration of a set that adds the capability to communicate event specific configuration to PMU kernel drivers using an ioctl(). Though targeted at the identification of CoreSight sinks when operating in CPU-wide trace scenarios the functionality is made generic enough for anyone to use. The work fits in a wider scheme to support CPU-wide trace scenarios on CoreSight that is available here[1]. If someone is to test the functionality using this branch, note that only dumping of CPU-wide trace data is working. Full decoding capability is being verified. Patch 1 to 3 deal with kernel enhancement to the perf core while patch 4 is CoreSight specific. Patches 5 and 6 concentrate on the perf tools. # 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 ] Thanks, Mathieu [1]. https://git.linaro.org/people/mathieu.poirier/coresight.git/log/?h=cpu-wide-coresight --- Changes for V4: . Made passing of information between ioctl() and PMU simpler. . Rebased to 4.20-rc4 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 configuration 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 | 64 ++++++++++++++++------ drivers/perf/arm_spe_pmu.c | 6 +-- include/linux/perf_event.h | 40 +++++++++++++- include/uapi/linux/perf_event.h | 1 + kernel/events/core.c | 69 ++++++++++++++++++++++++ kernel/events/ring_buffer.c | 2 +- tools/include/uapi/linux/perf_event.h | 1 + tools/perf/arch/arm/util/cs-etm.c | 67 ++++++++++++++++++++++- tools/perf/arch/arm/util/cs-etm.h | 3 +- tools/perf/util/drv_configs.c | 30 +++-------- tools/perf/util/evsel.c | 7 +++ tools/perf/util/evsel.h | 1 + tools/perf/util/pmu.h | 3 +- 16 files changed, 257 insertions(+), 52 deletions(-)