From patchwork Mon Jul 2 22:33:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 140855 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp465037ljj; Mon, 2 Jul 2018 15:34:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJy4ODoIB5zXpMNUM0wF1DdpFKW1B6wguOP10oLZ1PiruyYduqTWZeC2e/tfS2jZlBHupv3 X-Received: by 2002:a63:b305:: with SMTP id i5-v6mr23361076pgf.370.1530570858535; Mon, 02 Jul 2018 15:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530570858; cv=none; d=google.com; s=arc-20160816; b=y7UgpP6kMBxshTbUeOPEMnCwkAYAqsn0/sOB9ONUCYZ2u+mA9StZIkc0L6T+P2Zn27 2g1RV8D9ZVxtuhj8KmnnFhcSirmqILPpULDcylGX2bhi51Q/E2ri59b2BSvetrZcMhyt rutw3YxBxECjWU9lE+uJMO8FmEiWak4XRdsNsz/D6c1dn9GqSRcSnJQ2hSfYDFmv5DJV aR6sYLb806njWrt8C2YsX1St/Tpyy2RR0mIQalqsanvJWAFHYWsxfTJWQFVygM7F+/AF Wp98zoaC6rF+4hAl+yj/ksw8Y9vHpJPfrTG1C/F0CRr3IXpkyyOan14ugO04HOBOohkP fR2Q== 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=Mobc576Q9r/4l1aGeNqPfkWlj0kzjpv455USWUBfVfRlUgadOVjDpSYRQ9iz3IxHKl hBcqqFzPB7ziaMmnrRdZ4DdrH71BL5ks2+Ls5lcerGRfjw+miZoUHVhU+VIs56w6UGJW yP3pS2xNAejbzBfeIHoBZ2SwJQR5iPwIiypDit6WT4bVj4Omco/ERD8HIGwmIanxBCSa lwcLEDnqNDjCu8bERbxlEeCzQT5HbkR7ZM7AGR2UE25HGngSa4u6+X8z9ERgFcaVI6Wz jLKohthrVB262f5lFOYtgwkzS+8TZTfSCAFedTzqr716Sqf4QXTbn5IEjYEiywT3i8NM dfAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHLhyH2K; 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.18; Mon, 02 Jul 2018 15:34:18 -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=XHLhyH2K; 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 S932424AbeGBWeQ (ORCPT + 31 others); Mon, 2 Jul 2018 18:34:16 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:43686 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932263AbeGBWdl (ORCPT ); Mon, 2 Jul 2018 18:33:41 -0400 Received: by mail-pl0-f65.google.com with SMTP id c41-v6so8581247plj.10 for ; Mon, 02 Jul 2018 15:33:40 -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=XHLhyH2KP3lLTK/guTRSVHiMbf778wKy4jaVyunMI8WBQGllgdtTd/Y0BCMRoWSqkY BNFNXKBqOarjdxxxS8gPKE+vWLZsU5E9SsS24Q6gOc06ncho1aPEW6DQRtyhKug5co81 JTOUFAw5bkia7Q9PjEs9YYOOVErfWmtp1iJ1U= 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=PPb57fBNGUYKe0GxhQ9Bs7t9noIz4ORVP8Hbo6dwFasB4HUCQpq7W6n9k8JbxARUqV yoXdgSzuilCF8R2Rt9BSkhV6AGCFYuBR5pW8o9B2sTa9WQGHCce6geYpbz6ZHxc72Iur sWpSDT39L8tkpvwilzevmeyGjXzoY6If3ZidaPPJUBwV8ypLdk441yfwws6epR5K8gk7 vMwbpU+4b4Nyzcn8XfErCP1/y4KxQvJfZ7WmrhTMuB6nntzY7yGAx6wgiwioht4Jd3Uz 0hox0CNT/5U+riuiYWaF1LHjY/1b6sUU7aVuSOKvEU+sFWYwth851CaJ0fVIbBNqUjRw X13A== X-Gm-Message-State: APt69E32AT0lkG/FiphzwTMo6EBDrA3c4BhkS5ghKCZRofVtqlY7FB9Y 5/wrDFVYDDktD/wOnDIbdI4Q9w== X-Received: by 2002:a17:902:8a95:: with SMTP id p21-v6mr27432493plo.91.1530570820538; Mon, 02 Jul 2018 15:33:40 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jul 2018 15:33:39 -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 3/6] perf tools: Use ioctl function to send sink configuration to kernel Date: Mon, 2 Jul 2018 16:33:27 -0600 Message-Id: <1530570810-28929-4-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 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;