From patchwork Wed Jul 18 21:48:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 142309 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1022469ljj; Wed, 18 Jul 2018 14:48:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfIlJ/09i+ZoRhXNU3w1C8dGh6ONm+INGa/IQNDNEhKu5MYL07BKAwBQBA9q8bG2lXKyMGc X-Received: by 2002:a17:902:aa8f:: with SMTP id d15-v6mr7589759plr.64.1531950512763; Wed, 18 Jul 2018 14:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531950512; cv=none; d=google.com; s=arc-20160816; b=smoURU8agShTql3FP3nW2pf6cdWpvZh0iqwkMQaz9BY6JQU16Rhy5SebPLf1iXQqUM 9uYqTcakW74jUkEGF0VNe6HD6svDrJ2tA9lMqwB4X5X9agNe4ePTjMbQ2mUmTGOA8Mfc MOYIPrVgfxOlROhkPcgcCz9/6H/ofqSG8f+sMJyjNCGiMBiPu0ocnUCae4nNs6A93pqe oQZHsIblDV1gj/eA1NXVafnnrcEQAwIPJOwLKhPAKq1d0JtuuMIB1RpWyg7hHp+LYB97 ZVHkO5FsnunBII7xYlsmVJnrLkrl5qgT4g0FE1nlPIan6oF7qNS0lvPx2xfQYkNb/nFu lE8A== 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=Ssk15r/wVyFabVOEmVABQIGp1LVox6RX+qDbU91TvSLHDno4t2V6YNapAjWkkW9eDO 3/33DzuwTm5MhOnH1ArPxX9G2xBTVxGSkljpkffmRFSPYRrpgI0sYmDNw2kuqovicedM YRP2qaLgUTATSkBbSxCgX8ucDjtU5J67sx31J83hPSHXw6qMgBDejYE7fR8LfeT811r+ HLEAr41xsX07jRbEss20OGDiso+u2cfFO0hNWIIB8SZb8pn4HQ3UypMT/60hAnUnpCpE ryBWWzWmBtWecjw8O+jkSDfNnlaZAJZA2spfcBdpdMCuUmKPRUvmwpNtRdGcCAEMNcgi KNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QpFjYGj5; 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 f59-v6si4061668plf.500.2018.07.18.14.48.32; Wed, 18 Jul 2018 14:48:32 -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=QpFjYGj5; 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 S1731028AbeGRW2V (ORCPT + 31 others); Wed, 18 Jul 2018 18:28:21 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:37349 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730947AbeGRW2T (ORCPT ); Wed, 18 Jul 2018 18:28:19 -0400 Received: by mail-it0-f65.google.com with SMTP id p17-v6so6494240itc.2 for ; Wed, 18 Jul 2018 14:48:29 -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=QpFjYGj58tqSM0njnd7/94/7ydOBwDzbQljaZ9pOexmY3tQF0TItQ96N+rY+2nRgFM 5xpWdjR2vbBseICvWcFcDktGDve0u6kU6fKEVGgcwuhTTOIoflGrU+7YBoy+ztf1KhnA 7fqkLFy7OgO6214hrfqstwbkoX+v0vRf2YE/E= 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=EEg5JqDBi5zIibVxXYp9MwenLLMflRH9jCFWcoMER8DK8pVdoL5kdyJvcCtyEBHM46 TcBDZ+dE/0n0p3H1Qe/CLpa0ZgwTkYYCXx+Drk2PteULusUuxCShWNgmtiCUhhDJdFmE oSXuGsDE0CteE+NkxMqnDNBFpRXYKEi5QMF75mkMXVZpaqzSO3knSNxmpcS9ht9zI3Zn Yqyge0RYbUxqxFQi4sbbNAKSdqBpEuCzJLgc61F5CCAY3bp49r1rUcsALzZXO5PaFBKi L3okypubkiUztdC8y+ighLedPIqGr0poz05tbAc/4sZ9MtVWn1iR+ERJ1GrkgE9/d+GS mp5w== X-Gm-Message-State: AOUpUlHf/mAQUnj3hylpvdOu9Tkg3jLIZv4RUchmtgKIsUepztSRd1Q8 pMYWYGZNrtmHA1r5oOl5U6WCUA== X-Received: by 2002:a24:a43:: with SMTP id 64-v6mr3577718itw.140.1531950508662; Wed, 18 Jul 2018 14:48:28 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id w193-v6sm2093386ita.35.2018.07.18.14.48.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jul 2018 14:48:27 -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, kim.phillips@arm.com, suzuki.poulosi@arm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 7/7] perf tools: Use ioctl function to send sink configuration to kernel Date: Wed, 18 Jul 2018 15:48:07 -0600 Message-Id: <1531950487-24554-8-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531950487-24554-1-git-send-email-mathieu.poirier@linaro.org> References: <1531950487-24554-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;