Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2248023ybb; Fri, 27 Mar 2020 01:51:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt7UTI8jOHgLf72PoPEy//2oumH/np+CxUK57mEbItXlFanuu6KkGTRfOugKv1iMdht74C8 X-Received: by 2002:aca:c4d3:: with SMTP id u202mr3396355oif.20.1585299068488; Fri, 27 Mar 2020 01:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585299068; cv=none; d=google.com; s=arc-20160816; b=OGjlM8dKK3tPYGhSCmykQqY3BHDI15ZU/sv08fKEiWqM7m7Uw8bGY5uzWDSoY3aefK x+bxHogJuQuIjaBUBSHnhjE8TffgA//KJMODl+vCXLZWUHY2ZiIuW0C0qjiu70ulWLwT voESp+LeSbf70l5LZspDEGbIphGp3kb05wmDhNFTiH8EV+1z6td8xWLk03iE4erqbYxy nwhoUxmeQz4E5U1evXUCeusI3wVbbdSjbz23nu/RpkK2dIKrrXlwbvQWSdF77I45iNKB HhoPIugM52u9idNcOYpVR7YQmA2+OCH5d7+HkDD+laIK8SH9MBbHBxf+WNu3+jM4Mm8E HHZw== 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=Qas0c951Cf0u5LDfGXs6jI/5GmNXBlck7lc4HItwe6s=; b=CIub8Efbv+bHurxWYDsHbKB4bwVBBybsGhpcM5NmcrvuU32bFwhcS8WaUlBIBzb830 z4H/OhiGaLUcV3JAZvFSRGsNL8StDXzCqvo4YeoCLt4O9HLtQJvEykWfwuMJQt2uMOQa uk2LT7BXMb2y5Wq7RfeCynrmwbvjJXxOVHQC5ID/2GxSDntZxYF1iFjUagPShArTPA6c bj9Sb3u64RYR3UFTK8QUpi+DtQyoNVVrubSWZ0gJ5WetnM2AYLVPukP8Fk/yf2PPKoWF iA9yIv/wksSfJX74pOYkQ0Z0apoSwaJhpPsBEix7ts/Dq6JkYEbnF9G0qnf6HX317qAM /h8g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si2024114otr.186.2020.03.27.01.50.55; Fri, 27 Mar 2020 01:51:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbgC0Iuc (ORCPT + 99 others); Fri, 27 Mar 2020 04:50:32 -0400 Received: from mga02.intel.com ([134.134.136.20]:8312 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgC0Iuc (ORCPT ); Fri, 27 Mar 2020 04:50:32 -0400 IronPort-SDR: jnQwyytBsfJTrd6pZT4l5AQD3kqYNatVjoCUv5AuOA9oyQ9r/npsTGbKYLWWHPVydXglAORg3Z Ht5XPw0t8plg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2020 01:50:31 -0700 IronPort-SDR: Uisx96pK35clw9YgyfO/QLv+sU+bBHhXMMvK/yJZU1YAmdsQemiqJFJkEYlZRePanbxN4mUZXH xcqIWN7gxt6Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,311,1580803200"; d="scan'208";a="448940722" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2020 01:50:31 -0700 Received: from [10.249.36.56] (abudanko-mobl.ccr.corp.intel.com [10.249.36.56]) by linux.intel.com (Postfix) with ESMTP id E4F885803E3; Fri, 27 Mar 2020 01:50:28 -0700 (PDT) Subject: [PATCH v1 7/8] perf record: implement resume and pause control commands handling From: Alexey Budankov To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <825a5132-b58d-c0b6-b050-5a6040386ec7@linux.intel.com> Organization: Intel Corp. Message-ID: Date: Fri, 27 Mar 2020 11:50:27 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <825a5132-b58d-c0b6-b050-5a6040386ec7@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 events coming from control file descriptor. Signed-off-by: Alexey Budankov --- tools/perf/builtin-record.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f99751943b40..ae6f7d08e472 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1418,6 +1418,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) struct evlist *sb_evlist = NULL; int fd; float ratio = 0; + enum evlist_ctl_cmd cmd = CTL_CMD_UNSUPPORTED; atexit(record__sig_exit); signal(SIGCHLD, sig_handler); @@ -1620,6 +1621,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) perf_evlist__start_workload(rec->evlist); } + perf_evlist__initialize_ctlfd(rec->evlist, opts->ctl_fd, opts->ctl_fd_ack); + if (opts->initial_delay) { pr_info(PERF_EVLIST__PAUSED_MSG); if (opts->initial_delay > 0) { @@ -1710,8 +1713,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_RESUME: + pr_info(PERF_EVLIST__RESUMED_MSG); + break; + case CTL_CMD_PAUSE: + pr_info(PERF_EVLIST__PAUSED_MSG); + break; + case CTL_CMD_ACK: + case CTL_CMD_UNSUPPORTED: + default: + break; + } + } + } waking++; if (evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0) @@ -1751,6 +1769,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) record__synthesize_workload(rec, true); out_child: + perf_evlist__finalize_ctlfd(rec->evlist); record__mmap_read_all(rec, true); record__aio_mmap_read_sync(rec); -- 2.24.1