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: 140856 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp465269ljj; Mon, 2 Jul 2018 15:34:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpca93khm0hoElTcp4WIHpDKt97FwUIdh9uzKeGwLWZ4yrfXQzZMuQNQTEVwQcKytT7SdXvQ X-Received: by 2002:a63:790b:: with SMTP id u11-v6mr21143606pgc.111.1530570877915; Mon, 02 Jul 2018 15:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530570877; cv=none; d=google.com; s=arc-20160816; b=ra+zuq+brnKMnc3wzLTyjpv9NekhZ66LOyhqMfFs0N+dKeVoPLCxEqc4zcDWAt6qIi FX90itcka27rJmCCF8mZkSvMfVglOa7OReKYs7uKFyOW2N6zOBHBa07kxTag+aJPEreT PEpW3zv66o0oBHy7MlpRWiPairIvn+3T/AILoCn172/P+hwHgDgmPETqPh8jBs9B7bm+ ZlcVrKYicguOtFzp4/vfV2dYfU10Ntcmg4rHVlya4w5k0ZL2u/SirGVJKuFMnmHhcyF+ ggneE6PxhcUxIjDs2ONGeNk/eQANvZBy96H+vquKqgdaNj+i3u8/tEkundR5iAtqBPPB dlcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=44uRkWGk/Osvmk24aNdLebhqCx/Gifs6WBek1wZDfO8=; b=SsyT8Vpyj+i/Jzgr5WzhcCEi8LMZ3gPI0K03ETHBSkXFsdK9jYmcBZ88gU617mJhq2 HSpgovIiYuQMF6ELR3Le32YE1LMtqk2vFJn8v3nbXYlfbAwpSWJIh0HvOERF2nmC5Xb/ QBFt6AifeijKIMdxi5BkEr3V7cIPer6rG2Cg4tZixyFjZjjpPEZNFsq9EzhQmxHSNk96 qFQzttlXL/eJUFG9jxZajQZaQASWEcsWyNvyhxhh+qqsNF4iaqtPYbCze0s3L5mBZQ+8 tWhcFGiTZ7adodk4y4646ETOD1QVPN299zp7y2C6ROm3kwNUhNQ4GwNnU0zhEMalpEqO 64Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EJsKreuL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si15202669pge.80.2018.07.02.15.34.37; Mon, 02 Jul 2018 15:34:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EJsKreuL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932458AbeGBWef (ORCPT + 31 others); Mon, 2 Jul 2018 18:34:35 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34531 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753635AbeGBWdg (ORCPT ); Mon, 2 Jul 2018 18:33:36 -0400 Received: by mail-pf0-f193.google.com with SMTP id e10-v6so4033pfn.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=lxF1+HfSMhCXM5OZyZXybCNh8gsFdoP1KwmKHNqRVICcZkb58+S8GXLLvcZd9rDiAL f1unaJxP1nBOKCGOUz/ay4noHNYz8c5FWIxNOGcvHVQSCsFGS9NeWZsPr0QUjkxNHZoc +mrG/C9/MubV5jvE76gQQ8ybyxa7p2e0bknsY+Kx1M9yvOTYTNQy0bJMcbDLZnjb4PRt BWm1JbKv8AuceUqNNwWHJ3fs0hpC5TTepowT3jl5Yzchv4VS29g2VcX2pesyOJ6Qizcq vn8aS5i2pnRGoEfG+Ro5ewaRHoOhVpmHeNgMevjSyLkNcuMOvCl1bFCsDjAfehgQFn/e XXnw== X-Gm-Message-State: APt69E30EitTVydY7sAfcKCS7QjrebV8aPC0FfUwg0HemAaWLigbc1u1 JzJZvTKxi4RRfeQWvayXTOV/Xg== 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 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, gregkh@linuxfoundation.org, hpa@zytor.com, mathieu.poirier@linaro.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.7.4 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);