Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp60296ybj; Wed, 6 May 2020 11:32:19 -0700 (PDT) X-Google-Smtp-Source: APiQypITlq78him5MHn+hQUcTKc8L8uFsKbPoMcQH7FOuZFF9avIgb4XWtdHeAImW9qinfSndU2v X-Received: by 2002:a05:6402:3046:: with SMTP id bu6mr8281964edb.106.1588789939417; Wed, 06 May 2020 11:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588789939; cv=none; d=google.com; s=arc-20160816; b=UJSTqzOa5xY+7PWmdoIJFQMNTlimWLCKMUxsD0Dircyq6G9GfpV8K8LbuZKJJuYYYg 73LX+Bw5KaR9YiDgC9IMIQD4jrnu9a931kxu14+mUzEVGdKhv2LF8zTDM+H9Fwn5aCDN lvMs/emWsZEbqyiAszt6cvShzg7/CEmhGAPF7eJPJj5K/7Lq76/gdTB79WBS/gkiROVq K0XxAn7OwTx8lTF7Zn6iowc8s/BHY/AOeSqaNtEp3nI0qljrGyp0anrpDNKOeiR47ztk aoqGgYOjx2VdFUFHU2zf/Qb+2LvzAAV5b2kZfAx0ARVWBRXPLY2JMVmapUKTNLLlNKug WSMw== 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=kBe76PRI0gr7NrTPoynNNoEW+22y1IsvV5obairxM20=; b=QmzSVXw5YnLNpSBl7eeIWidrusaPMvVjpV9Tw/wxb4QAe35/PhXv1cWJ4KW54WhIlQ zRfaC9AAQiAZzcE1QffDvLH4uDFSuofF2IO0xf53/sXo1Px6F7Q4WJpr9MkSE3sYD6u6 oxBV4BAkhaGsw+Qsc3IqSa/GI3wleAWJWTRUoS/Kd31zPL8W5bPcb/zra+tNg4JmxGtI NgN8qfK2JAIdAq2U9yWyoEdEr7lM4LSPhh5kSjyiRaTNjJicglQWqyHBdmcMqXi9Wu1W /QVamBlf9WJdLUWic1RIk8VNTFK5gKFiUNeG+P1U8CZK6vR0sSJcnitY1DD9D93WqSVs wlqw== 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 p6si1655612eja.77.2020.05.06.11.31.54; Wed, 06 May 2020 11:32:19 -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 S1730283AbgEFS3P (ORCPT + 99 others); Wed, 6 May 2020 14:29:15 -0400 Received: from mga01.intel.com ([192.55.52.88]:60991 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730181AbgEFS3K (ORCPT ); Wed, 6 May 2020 14:29:10 -0400 IronPort-SDR: rOul27SXoC24q3Y0tiTVz2nJb8pIEJCSbx3B5Uid7jT49VetsoF9LLlluQGVuNHBLA/ygyxyTN J/spM7dRj/7g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 11:29:09 -0700 IronPort-SDR: EK5bpHvrmLWRKas6QxOzKpS2y34lxOHVL0qgTYpkLCnwfjykOx0JYEFVvi7XnZR3PwA+U8mK+/ 2YfSX8z0PAiA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,360,1583222400"; d="scan'208";a="339090730" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 06 May 2020 11:29:09 -0700 Received: from [10.249.228.227] (abudanko-mobl.ccr.corp.intel.com [10.249.228.227]) by linux.intel.com (Postfix) with ESMTP id 51FD758043A; Wed, 6 May 2020 11:29:07 -0700 (PDT) Subject: [PATCH v2 09/11] 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: Organization: Intel Corp. Message-ID: Date: Wed, 6 May 2020 21:29:05 +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: 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 8a14e68b86ad..2278a3efc747 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 = 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 (perf_evlist__ctlfd_process(rec->evlist, &cmd) > 0) { + switch (cmd) { + case CTL_CMD_ENABLE: + pr_info(PERF_EVLIST__ENABLED_MSG); + break; + case CTL_CMD_DISABLE: + pr_info(PERF_EVLIST__DISABLED_MSG); + break; + case CTL_CMD_ACK: + case CTL_CMD_UNSUPPORTED: + default: + break; + } + } + } waking++; if (evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0) -- 2.24.1