Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp552779ybj; Thu, 7 May 2020 02:03:04 -0700 (PDT) X-Google-Smtp-Source: APiQypJDly8JC6o/YU2SZEjBSYTAhi/jdAQZ6pwHy1dqBGrY6UvlhsbbayBTDrQiPSvzeSyNjgMd X-Received: by 2002:a05:6402:507:: with SMTP id m7mr1858620edv.7.1588842183981; Thu, 07 May 2020 02:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588842183; cv=none; d=google.com; s=arc-20160816; b=oIPJ50XaNyTwYep9u3bNT6RIBcCeco6ElLWSLDO4e+snZ8SRwXMnID4JfX1F/sLJbt ZoGQkQyFt6tHQZgmhZe5O5YB7+XRa1dFYx6cKcg2YfCNPV7lHdv2L+zKOEfS6yomDMYl 8wy1g62IizaKcQ/Q0ScM+LA/Ns7NmSoMhJc+SV7hUdHl9yD0rQSS3CJ/FQ6Uivqg7CXV EzLOCU3RC/Bv3Kfd/9zGeDydPECDmYJVZ5svJOFzWnf1esDd4sdZhg3bn0eJVdQuk5i1 /UiLffiME9OkYx4fqdz+9upau2yYcnz76OitToG39uEHxCmiAyifkj74buwBiYs6fPOy 308g== 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:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=XEPsIhwpvGAJ9Li63lNI08Lg3RBU84WZhXfkVrEVeOg=; b=SiFvtyUKZZET8JRxnYMfgLWbs6z3d6pDnHnEUatQdQqs9XFhfso6cAnHockLIo9mNL ziUeF0aiIA7FweBPrwqfn5i20qG+ymo7YFnxuqCaG1M+BkmrmKMDMl2S+M+u+QpM6F3K s5wIyc/+1Kk27LsttVtV1Iss531fQLBxxfI1y78lxFxFR0M9e0XdiJu7mHBWFtmc7mNU NhY2j4YCCKxXa/SjGYDy8aCx+B5dRWTOE+dgTlQ77ah0hRXm+XWlkuNkHDA6M+CsekfY MmCMMztz5GlnmgBOyzlcfUxl8fz/iby8h5RJF2LDdVJizJC8db5tF3ZDxia9MOw/6t2g bNrA== 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 8si2738757ejx.280.2020.05.07.02.02.40; Thu, 07 May 2020 02:03:03 -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 S1726350AbgEGI6z (ORCPT + 99 others); Thu, 7 May 2020 04:58:55 -0400 Received: from mga12.intel.com ([192.55.52.136]:65414 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbgEGI6y (ORCPT ); Thu, 7 May 2020 04:58:54 -0400 IronPort-SDR: DG19b6s4QGM7MK4g7/wvh6tYdhn//T5eAz98RislogxWLKMjuGKqP0eoQpihvN+m9wdQPfleRj SqXITlt5SCww== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 01:58:54 -0700 IronPort-SDR: fzkNCAkn7C3kYXeMTMFqhh2tP44Z3Z7ApxvjNMe3ExAVhWT07bJuDhdrfLjfyd8XJPlX3USrpk pdVA3jzRHEQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,363,1583222400"; d="scan'208";a="263865751" Received: from linux.intel.com ([10.54.29.200]) by orsmga006.jf.intel.com with ESMTP; 07 May 2020 01:58:49 -0700 Received: from [10.249.225.10] (abudanko-mobl.ccr.corp.intel.com [10.249.225.10]) by linux.intel.com (Postfix) with ESMTP id E348758048A; Thu, 7 May 2020 01:58:46 -0700 (PDT) Subject: Re: [PATCH v2 09/11] perf record: implement control commands handling To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <20200506202339.GH9893@kernel.org> From: Alexey Budankov Organization: Intel Corp. Message-ID: <4971d2b6-a95a-d53d-515d-7f0ba95fb2f8@linux.intel.com> Date: Thu, 7 May 2020 11:58:45 +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: <20200506202339.GH9893@kernel.org> 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 On 06.05.2020 23:23, Arnaldo Carvalho de Melo wrote: > Em Wed, May 06, 2020 at 09:29:05PM +0300, Alexey Budankov escreveu: >> >> 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: > > Shouldn't we have a pr_debug() or even pr_err() for the unsupported one? It already exists on lower level, at perf_evlist__ctlfd_process() (see patch 02/11). ~Alexey