From patchwork Thu Jul 5 22:13:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 141234 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2427720ljj; Thu, 5 Jul 2018 15:14:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd8+QVjEU1/A699P/CdANvdnshk8Di/xTyJU9R65l+S1cp3H9nCXHLNjZJJWFKi1bbbbSl9 X-Received: by 2002:a65:4d05:: with SMTP id i5-v6mr7021575pgt.58.1530828852955; Thu, 05 Jul 2018 15:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530828852; cv=none; d=google.com; s=arc-20160816; b=fBVn9Zlslpj0LO6A0arsG0jm1+Djh4kBH0LVa3/L+tyzhoYKMZNh9qXk/6VgqA82xA 74sjzX9XC/GbUZhSwE++DfMFtK1VfW1FZt+IQVV84vkwDXfmjFm81hmREBhepuG/bRQ3 wn46i2/sb6/y+qpx+3qXgn953NYP0gBbJ6Y809/evXOuL0y/GlgSefJwGW0uoDYdBB1h lSsH7HaqLMpm52kx71cyc6pu6TMfPB/3GioYY0Dy2JUEb8fXaM65X/KpuvyV7HEn6/BC hRKx9+RglNnQw7VoNiba4os9jdgXs0mpC/XMWM098SGzpviuDidLDfoDJhQxu9RknySm vxsA== 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=OWMIpVbHHUucjZTQ8WkuficHw0asDAcRYsZ+36nc5jY=; b=Icr8EEQvx5gvkC1wjPIJlKjiCgS2qY2Ts/josrb27ohVMACqshYfum72Z5qqiqst5B feP0TSnUtCpLhuA1Dot94Cl56RlzFzB2/tvz8h5TGXCxZS00mNJJlz0j/PvAU9Ph05M7 6vmsqd4cCTBeiELfFc3nn7OKl3tGWrNTwV1gvhvGJZxXRloCwA+EAYMyzgwvgmSwAkRQ rPGZMCy2cwqF78pZvgDU0QY1PVZD/TbeaFdabXwlC+3OJxMXWptqbAn3r1D7qQ7e8gV/ 7n+N51/M0GcHXaAqZjBHlhH/j3uEiiFgCTPI5STQkHbUHtUNAfvUFcirr+uhYFlLHpAx r5JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=frAb5TSw; 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 c14-v6si7503425pfl.319.2018.07.05.15.14.12; Thu, 05 Jul 2018 15:14:12 -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=frAb5TSw; 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 S1753914AbeGEWOJ (ORCPT + 31 others); Thu, 5 Jul 2018 18:14:09 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:40363 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753806AbeGEWOG (ORCPT ); Thu, 5 Jul 2018 18:14:06 -0400 Received: by mail-pl0-f65.google.com with SMTP id t6-v6so1873980plo.7 for ; Thu, 05 Jul 2018 15:14:05 -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=OWMIpVbHHUucjZTQ8WkuficHw0asDAcRYsZ+36nc5jY=; b=frAb5TSwjMgxydpfosxygvBWPmg0eUmVPDThn/GV3Isixjgz7WPl42pQEiQAxacSKK DFOVZRAS+2rEXlltTbyOCdveE/mNQ2aplWXdUVtDtBkteFNuXaDgi/l3wHP0ZlhFhKkV p5AMECl8lk8ysopogVD8LdDRRlEmbXzZXV+zw= 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=OWMIpVbHHUucjZTQ8WkuficHw0asDAcRYsZ+36nc5jY=; b=HnvdmIRI/VNHg/eGsVhUz5tcCMY/WxiGk8RwhdBtfsJWnNK+J3dCZ7mXxBHZH4DunP wTHrH+pJ0qgCNeVur1u4NmzuHMhanJbDM+QXu2rjcMRXhxrM1kc0tYqVOHsI3EF/Faef PXa5o48P2agInyPXbMWHS9/jiAEMLgHDkcygezDr2l2b82nmaohaFgFZ0LamyQZqdrwk 4hn2l8nIGSaPifQ+sJ4rsWbIAv5WWPWyzoR4ivgcillQJOQ/sAyl6lTCcxHxXqMA7hTV PA3ujUPFIXtWQakZ9mvKaxKJBPPk8RqLRFILc05YbCdTQ/i9MYohA1YZA0cutz3GPSV7 YXyQ== X-Gm-Message-State: APt69E0idyIingajdNvFmo/NShyg58C77dNk576AuXIM9h/+lVAkQ/LZ mt7aU4G2O1jtHAAkRVQySe9nkA== X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr7735563pll.343.1530828845525; Thu, 05 Jul 2018 15:14:05 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id r89-v6sm13297486pfa.75.2018.07.05.15.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Jul 2018 15:14:04 -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, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 7/7] perf tools: Use ioctl function to send sink configuration to kernel Date: Thu, 5 Jul 2018 16:13:47 -0600 Message-Id: <1530828827-11604-8-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530828827-11604-1-git-send-email-mathieu.poirier@linaro.org> References: <1530828827-11604-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 Using sysFS to communicate sink information for a trace session doesn't work when more than one CPU is involved in the scenario. As such communicate the sink information to each event by using the SET_DRV_CONFIG ioctl command. Signed-off-by: Mathieu Poirier --- tools/perf/arch/arm/util/cs-etm.c | 54 ++++----------------------------------- 1 file changed, 5 insertions(+), 49 deletions(-) -- 2.7.4 diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index d8081c2e6d44..cb0978eb7181 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -599,55 +599,10 @@ struct auxtrace_record *cs_etm_record_init(int *err) return NULL; } -static FILE *cs_device__open_file(const char *name) +static int cs_etm_set_drv_config_term(struct perf_evsel *evsel, + const char *term) { - struct stat st; - char path[PATH_MAX]; - const char *sysfs; - - sysfs = sysfs__mountpoint(); - if (!sysfs) - return NULL; - - snprintf(path, PATH_MAX, - "%s" CS_BUS_DEVICE_PATH "%s", sysfs, name); - - if (stat(path, &st) < 0) - return NULL; - - return fopen(path, "w"); - -} - -static int __printf(2, 3) cs_device__print_file(const char *name, const char *fmt, ...) -{ - va_list args; - FILE *file; - int ret = -EINVAL; - - va_start(args, fmt); - file = cs_device__open_file(name); - if (file) { - ret = vfprintf(file, fmt, args); - fclose(file); - } - va_end(args); - return ret; -} - -static int cs_etm_set_drv_config_term(struct perf_evsel_config_term *term) -{ - int ret; - char enable_sink[ENABLE_SINK_MAX]; - - snprintf(enable_sink, ENABLE_SINK_MAX, "%s/%s", - term->val.drv_cfg, "enable_sink"); - - ret = cs_device__print_file(enable_sink, "%d", 1); - if (ret < 0) - return ret; - - return 0; + return perf_evsel__apply_drv_config(evsel, term); } int cs_etm_set_drv_config(struct perf_evsel *evsel, @@ -660,7 +615,8 @@ int cs_etm_set_drv_config(struct perf_evsel *evsel, if (term->type != PERF_EVSEL__CONFIG_TERM_DRV_CFG) continue; - err = cs_etm_set_drv_config_term(term); + err = cs_etm_set_drv_config_term(evsel, + term->val.drv_cfg); if (err) { *err_term = term; break;