Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp431274ybk; Wed, 13 May 2020 04:05:49 -0700 (PDT) X-Google-Smtp-Source: APiQypJkR26x8/wQyHG60RLJoERAAaNFfIjyaM1ws6lFjLOrzeANIahOs78JC/T4FMsGk0w+FQiM X-Received: by 2002:a17:906:7f0c:: with SMTP id d12mr21187050ejr.40.1589367948884; Wed, 13 May 2020 04:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589367948; cv=none; d=google.com; s=arc-20160816; b=UJWpcVY/jzXrGl/eWNS2IgzXPz7XcgqgHW29+GCJpSzBrQe2D9Foty0tt7wQ4YIO6N Bz5tnT/TFLVZZn02sR7eTPhV3t99qzJp3pPUCkRy6hXV72fzYE5dq89/6F1OucqNeDzh OiSWFwEFfqwYI8YYSpe3hNAJkHMsaNMUrvdW7YrnsXO2JqynCFd58mAU5bmqilVOE1jW cw2KXetAW9KVIB7KBjOZrfyy+3dob/W93L45y7HKwISmwDUASCX8QLmzUNICjaCY7vxe GhmHE3kWIL8UYxfWbv5wdzAwj75/2MRBj2SkOTxG4SUY6HbGLlI6SBV2FqnANPbB3o2q MUOg== 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=u3zthGrjA4Wg+H4jUgDSJE+y/EYprRQxskRa2GASJwU=; b=dW+aFH3IE/7hb10skmJHnLBUwNJrY6zVn5OJh3jHZPMibe3tOP1Wg34Z/p7BLliucw 7PrLJU3xgz3mJH9iqZ8QkIlJ+7TNN11JpncsKuEvXrOcXx58WZiurdzrWouY4kuU4mte 7HMwAjRPZruVxwYsF/7RpM+evgxis057kBMCq8FRCOv3UJH5366b4eEMecR/0PQxAHVW JxqPBfkvPQXWRn+JHJuTCqNH6Fe3LksHB4UabjO3zZNzdHy9Gg/4N4ELXKeh24d5PN5o 1+IqQ7fSVVVcF+bahl68ZG99SDOE1tRenDW1nURxQ6/zCKaK7jZZCZnT9FNAuneySUED qUjA== 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 bt16si2073619edb.7.2020.05.13.04.05.25; Wed, 13 May 2020 04:05:48 -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 S1729722AbgEMIE3 (ORCPT + 99 others); Wed, 13 May 2020 04:04:29 -0400 Received: from mga12.intel.com ([192.55.52.136]:36955 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbgEMIE3 (ORCPT ); Wed, 13 May 2020 04:04:29 -0400 IronPort-SDR: rzNmS4yBbc0OB0qugDU3l6drX7lfMDjXsdSHJXUHn4nYeqMNsrzUkEBfFFVjkzOWnUaVS8OzyU x+IrNt9Hl+bg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 01:04:29 -0700 IronPort-SDR: hvfmiW9n/dexrwztqT/5I5mS1V6ijzXjhh41vo0KbnBPK7m+JfGf1zzjs6OwR1n5vzONKWeoT4 GpTjzuNT0z7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,387,1583222400"; d="scan'208";a="463844698" Received: from linux.intel.com ([10.54.29.200]) by fmsmga005.fm.intel.com with ESMTP; 13 May 2020 01:04:29 -0700 Received: from [10.249.229.18] (abudanko-mobl.ccr.corp.intel.com [10.249.229.18]) by linux.intel.com (Postfix) with ESMTP id 1198F5804B6; Wed, 13 May 2020 01:04:26 -0700 (PDT) Subject: [PATCH v3 8/9] perf record: implement 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: Organization: Intel Corp. Message-ID: <25f98682-5ef2-4257-f302-93b29da707a9@linux.intel.com> Date: Wed, 13 May 2020 11:04:25 +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 50dc2fe626e5..72f388623364 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1505,6 +1505,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); @@ -1802,8 +1803,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