From patchwork Mon Jul 2 22:33:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 10502585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B89076028F for ; Mon, 2 Jul 2018 22:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A682828B90 for ; Mon, 2 Jul 2018 22:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A8D028B93; Mon, 2 Jul 2018 22:37:04 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable 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 318DD28B99 for ; Mon, 2 Jul 2018 22:37:04 +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:References: In-Reply-To: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:List-Owner; bh=ngbCYh7pwhISh8linJMgtboTjUYAZWZDfpRertTxz3g=; b=TykHlOgQzvzFhKioITWVM+JrcK 9K03z6cyGWIINmuLtd/2sBDTLnvIa4zMoLhWKpHCAn71uH1NYF/BjwLKTi7fYXS/2zSo//oqmE6Ef Pjr1MuCCKZJ2q0fQdryTl6DkKMEpPa/bv30pcow3Lckwjt7IpofDieYsG2cV//FiEP2IPV09Gsqy7 +LYHdXNwIwl0ex2Ak6wKaj+mmP+GEAuL3lGwOaPN2T8umlO3Fys4MePLDnZ2ZWAZHCspHYnnhRZVM Ayy6WmUr16wOWTj/jjjlZNFUdyNiFYseVJvdHf5k7p819GVfWOLJStCsQQ+j/edQ0DjPB0eAU+bYs tngrAv6g==; 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 1fa7RK-0006B4-Pl; Mon, 02 Jul 2018 22:36:58 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fa7OE-00036v-PT for linux-arm-kernel@lists.infradead.org; Mon, 02 Jul 2018 22:33:48 +0000 Received: by mail-pf0-x241.google.com with SMTP id e10-v6so4034pfn.1 for ; Mon, 02 Jul 2018 15:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=44uRkWGk/Osvmk24aNdLebhqCx/Gifs6WBek1wZDfO8=; b=EJsKreuLczzPxxAeQS9U4zc42OStBcWtV3mG5AtxdY4SiLAO2PnVUq3GAUizBO1Enm D9p3Mtz/f6Jy6HHYXEi6CIgtI8oTug41GeHaAue5xdq/4HF4Q2b5iUSXXw/mz3tKZpyq ANE35Koraq1X+XhyRcDJyFeQwMe2L5+XdZG0Q= 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:in-reply-to :references; bh=44uRkWGk/Osvmk24aNdLebhqCx/Gifs6WBek1wZDfO8=; b=qSpD2/2OAo1F3uzXiZ1dN6bgomDg6PCsuXkaPtAynVmyQwnNYHjDNqGGSDuVVKoGWu okzrOTwFn4j364BUi2RDxW0ygJTS2Ui+WJTmnLTt9kVlcZvHH0qji5yQvB86r8VcdapC GOmzJ2ytbjJA4cTUcrP6Vx0Ucfqw7XrJEFw0nnhTG/QMKcG/NdqRDyN3Qw3t0C74nuvz k6qrn3Cr2SfYWkeOr8MU9bNOGjrQefL4LkXJGzTVU9wczL3TmAOyEEDF2WNsQeAkGNlW 9P6QmFohDpnixAzHjW9j+MKjtuFWkdlHgvy3CwfjqW6XExNs53Qe3UdqLlghAl8kDLxa lZog== X-Gm-Message-State: APt69E2Xvr5n3CeKpf2gpsVGFzbc+Gh83vmHkKoxu5pDqNSUEZj/XKZz nGk+a35go+Wkt0scZbKj80NVfQ== X-Google-Smtp-Source: AAOMgpfP2k8LGuujrnyseQ9BmVyBsws57GGsZjH7Bc31R/Ds9ZzH+p/gni7oHCRXAr744reyiszE8w== X-Received: by 2002:a62:a8e:: with SMTP id 14-v6mr27103338pfk.57.1530570815969; Mon, 02 Jul 2018 15:33:35 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id p11-v6sm21764132pgu.16.2018.07.02.15.33.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jul 2018 15:33:34 -0700 (PDT) From: Mathieu Poirier To: peterz@infradead.org, acme@kernel.org Subject: [PATCH 1/6] perf tools: Use ioctl to communicate driver configuration to kernel Date: Mon, 2 Jul 2018 16:33:25 -0600 Message-Id: <1530570810-28929-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530570810-28929-1-git-send-email-mathieu.poirier@linaro.org> References: <1530570810-28929-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180702_153346_904635_6BCD6B51 X-CRM114-Status: GOOD ( 12.63 ) 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, mathieu.poirier@linaro.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, mingo@redhat.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 Following in the footsteps of what was done for filters, adding the necessary mechanic needed to push down driver specific configuration to the kernel using an ioctl. By proceeding this way PMU specific configuration can be communicated to each event. Signed-off-by: Mathieu Poirier --- include/uapi/linux/perf_event.h | 1 + tools/include/uapi/linux/perf_event.h | 1 + tools/perf/util/evsel.c | 7 +++++++ tools/perf/util/evsel.h | 1 + 4 files changed, 10 insertions(+) diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index b8e288a1f740..b5b3241877df 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -460,6 +460,7 @@ struct perf_event_query_bpf { #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) #define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) +#define PERF_EVENT_IOC_SET_DRV_CONFIG _IOW('$', 12, char *) enum perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0, diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h index b8e288a1f740..b5b3241877df 100644 --- a/tools/include/uapi/linux/perf_event.h +++ b/tools/include/uapi/linux/perf_event.h @@ -460,6 +460,7 @@ struct perf_event_query_bpf { #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) #define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *) #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *) +#define PERF_EVENT_IOC_SET_DRV_CONFIG _IOW('$', 12, char *) enum perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0, diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 94fce4f537e9..534aca4c642c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1162,6 +1162,13 @@ static int perf_evsel__append_filter(struct perf_evsel *evsel, return -1; } +int perf_evsel__apply_drv_config(struct perf_evsel *evsel, const char *config) +{ + return perf_evsel__run_ioctl(evsel, + PERF_EVENT_IOC_SET_DRV_CONFIG, + (void *)config); +} + int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter) { return perf_evsel__append_filter(evsel, "(%s) && (%s)", filter); diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index d277930b19a1..0f671bd2a988 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -271,6 +271,7 @@ int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter); int perf_evsel__append_addr_filter(struct perf_evsel *evsel, const char *filter); int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter); +int perf_evsel__apply_drv_config(struct perf_evsel *evsel, const char *config); int perf_evsel__enable(struct perf_evsel *evsel); int perf_evsel__disable(struct perf_evsel *evsel);