Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1544171ybj; Fri, 8 May 2020 03:57:17 -0700 (PDT) X-Google-Smtp-Source: APiQypJA/SOo4HTmY50x/9yk7Tk/ETG1ofJULLvxemPNL28WC6kuTGecmziNztb6URDNPhDF6dIq X-Received: by 2002:a17:906:11c9:: with SMTP id o9mr1415413eja.64.1588935437540; Fri, 08 May 2020 03:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588935437; cv=none; d=google.com; s=arc-20160816; b=cwUZprHEEJZ9vJXryunsrfp+6K+2lProqItQnrKudCe5OjOQ9LII55io+B0rSMfM3c JSm5VN49Sa9vNZ7+c8Wiw7++IUZKFmgvFcY3se1v7I2mhTynGEhxWDq4iS+JfZEpRQX9 +ylsW2imnKV9IAGIK5qpioWWZWDc8sPnGG87zWNLNzOxqDIWZuLPblB8+l/p/N7pEJ54 kridLWgdsmFYP3+ZUK1wjrUkq04HJmmPyyhoCvKO5f2sF+5HKWSlH5BqwdrcKYVJ2JFx nFfCSOh4hCW+rG4yv1Q4FNMsEaagPgoUcC8yNJuObcVfqHdBgqeP1kwbV79kp23SQoaf JK5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject:ironport-sdr :ironport-sdr; bh=s343iMms6o2hYdEAG3pn4IjiGqtOnyXHAH/0KZEQhUk=; b=FQSrNk+FzDcXAJ7+FsK9fYfwEgYS+Snl43youZ7ffRkTLgbLJq0/spiT7POWseqr98 UtTe0VCfPumvMkcDxf/4TmsJyN0rfUSr05qlUk1AF0VZvH1SIyAQiPvOTrJBH6nToY0z LjFnvqTtJWC+l3Izqe0fiU/uCpo6SSDb3slLYIMhn7tY/9DD97YftoR9v2+kHwg8z3sG pEEmeGXr59yJ1lznLZ/j/ie9E4j1Grhr6Dhl+Qcp7dmo5mzpJ4BPxO8A+Pio2n5fZq2M XeNUGjgpAJQ/IYahRXhXUwkylwm5tMxz2Vqj9AmPQl6S0jqF50MULt7KP7QvX4HWIFML rHBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si771537edr.298.2020.05.08.03.56.44; Fri, 08 May 2020 03:57:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbgEHKxX (ORCPT + 99 others); Fri, 8 May 2020 06:53:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:39631 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727121AbgEHKxW (ORCPT ); Fri, 8 May 2020 06:53:22 -0400 IronPort-SDR: pZ4a/3DS3OJRyv61tBJoRRgfd7cAxnIoQ59p+kTOtP9YmQimsMWsk1cRo1ZTMoMylzLLofy4Bt soxMuyiUxjvQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 03:53:22 -0700 IronPort-SDR: 8McVCCELIja3m7yiNksP4+DOph/HgK89isJSHPrBAM9Jg0r9nDfcx6gtr0KH5h80TRGvQI29CF vuUvTK4aOd8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,367,1583222400"; d="scan'208";a="250365776" Received: from linux.intel.com ([10.54.29.200]) by fmsmga007.fm.intel.com with ESMTP; 08 May 2020 03:53:22 -0700 Received: from [10.249.224.104] (abudanko-mobl.ccr.corp.intel.com [10.249.224.104]) by linux.intel.com (Postfix) with ESMTP id 3E0815805B4; Fri, 8 May 2020 03:53:20 -0700 (PDT) Subject: [PATCH v3 8/9] perf record: implement control commands handling From: Alexey Budankov To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <0b63e751-5c45-3311-d930-15f1ebe72601@linux.intel.com> Organization: Intel Corp. Message-ID: <26304bd6-33b1-2104-51e3-f9f75c577058@linux.intel.com> Date: Fri, 8 May 2020 13:53:18 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <0b63e751-5c45-3311-d930-15f1ebe72601@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement handling of 'enable' and 'disable' control commands coming from control file descriptor. Signed-off-by: Alexey Budankov --- tools/perf/builtin-record.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 44fba34bc5aa..3ed352508b83 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1496,6 +1496,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) bool disabled = false, draining = false; int fd; float ratio = 0; + enum evlist_ctl_cmd cmd = EVLIST_CTL_CMD_UNSUPPORTED; atexit(record__sig_exit); signal(SIGCHLD, sig_handler); @@ -1793,8 +1794,23 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) * Propagate error, only if there's any. Ignore positive * number of returned events and interrupt error. */ - if (err > 0 || (err < 0 && errno == EINTR)) + if (err > 0 || (err < 0 && errno == EINTR)) { err = 0; + if (evlist__ctlfd_process(rec->evlist, &cmd) > 0) { + switch (cmd) { + case EVLIST_CTL_CMD_ENABLE: + pr_info(EVLIST_ENABLED_MSG); + break; + case EVLIST_CTL_CMD_DISABLE: + pr_info(EVLIST_DISABLED_MSG); + break; + case EVLIST_CTL_CMD_ACK: + case EVLIST_CTL_CMD_UNSUPPORTED: + default: + break; + } + } + } waking++; if (evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0) -- 2.24.1