Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp608013ybt; Wed, 24 Jun 2020 07:03:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydXgswxvTVOVtkYpVROhWgwaX0384xawg8NJ/c0k9qMoCkvYpVUWfM++Vn0NlKZ0J4C80t X-Received: by 2002:a05:6402:1752:: with SMTP id v18mr27488743edx.107.1593007416167; Wed, 24 Jun 2020 07:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593007416; cv=none; d=google.com; s=arc-20160816; b=YaFv2AmrozwWmAjySpEoVy2tzD94lxbqRfD78YeWLHk8dCaV5dAVCdESA90tq3rwW1 tsLp3Y8lS2hZeFn6p9C+zWXQT38clkYDYScIPT8u9M+CEIPQi+U81E2YgIthygzXjuN0 XMFEHPhCaZ9JNHxJjlA0HGWtnDS0BcAdNxu2Kyaw0P2a8u0Zsy++WfO5vk4Dwetbs0/r BirM+SyDq/09hYt4LBAS7xxMOnnP8NIVDU1rFZx50E7Y7K/rslzN33DUtxZjyIx938x2 Qcx89GfpfW71p+npH2MA8ltaNa4ummjSbdXfo8J0yS5miVeGL9YzDgY9vKsQTeNE9MUj pqGg== 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=kRby4YIGxtsLWN5O7ifUjACO4a0QrT/DngiANppoo+w=; b=K3fySmaugGG3aJCHrCkkDqtB+bmU2oPLmMc0ZZMSotUAgf+LzTXclSTumwks9sD2/m gGlGnmHbf+7N/IZvmGcM+wBhDbv3sbdxYBHaErDWurtfqTVHkONRicZeowtEGF6NGzCq Xa45LvVFwZG0JQi+CtCxRBsCIM/T/BNyLkHHu7z3G0PQUg1ErRnstsWMxiHMT/fJNtYL iekBeNgww2x5enILnm/HOPme4g5HoUlh3gwkVXxkDxZoumPYNcVa8P7whomd4ktrByM5 HsG37V+3yd6I70bmGutlx0jK+/VJMzmxG+D7zMbjP5twlhgOvYe/ojjMDcNPo+fhm4Wj ukMw== 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 u5si14065063edq.596.2020.06.24.07.03.12; Wed, 24 Jun 2020 07:03:36 -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 S2404019AbgFXOAR (ORCPT + 99 others); Wed, 24 Jun 2020 10:00:17 -0400 Received: from mga06.intel.com ([134.134.136.31]:22056 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403781AbgFXOAQ (ORCPT ); Wed, 24 Jun 2020 10:00:16 -0400 IronPort-SDR: ZoOsFt/VOlVslvC7EP8bEsugmd8aV6GlyY2ejKNTCQI8CVpNe9irPfIVYLLJny4f5Rr1AdJm9h lwfIQgQ2T/AQ== X-IronPort-AV: E=McAfee;i="6000,8403,9661"; a="205968222" X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="205968222" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2020 07:00:16 -0700 IronPort-SDR: t9zRy+M+jG/vIQR4eT1EhJAChy4qMB2lbHjKm6AGunEVfUsUhx0bgP5nIPJSGkcWpDEGznCpa9 wAsTfnNeK/Aw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="310789745" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 24 Jun 2020 07:00:16 -0700 Received: from [10.249.228.248] (abudanko-mobl.ccr.corp.intel.com [10.249.228.248]) by linux.intel.com (Postfix) with ESMTP id D8AEB5805B5; Wed, 24 Jun 2020 07:00:13 -0700 (PDT) Subject: Re: [PATCH v8 12/13] perf record: implement control commands handling To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <0781a077-aa82-5b4a-273e-c17372a72b93@linux.intel.com> <20200623145434.GD2619137@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: <3107d9cd-03ec-34aa-4226-393547c55517@linux.intel.com> Date: Wed, 24 Jun 2020 17:00:12 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200623145434.GD2619137@krava> 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 23.06.2020 17:54, Jiri Olsa wrote: > On Wed, Jun 17, 2020 at 11:43:58AM +0300, Alexey Budankov wrote: >> >> Implement handling of 'enable' and 'disable' control commands >> coming from control file descriptor. >> >> Signed-off-by: Alexey Budankov >> --- >> tools/perf/builtin-record.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c >> index d0b29a1070a0..0394e068dde8 100644 >> --- a/tools/perf/builtin-record.c >> +++ b/tools/perf/builtin-record.c >> @@ -1527,6 +1527,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); >> @@ -1830,6 +1831,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) >> alarm(rec->switch_output.time); >> } >> >> + 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; >> + } >> + } > > so there's still the filter call like: > > if (evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0) > draining = true; > > it will never be 0 if the control fds are stil alive no? Due to change in filter_pollfd() and preceding evlist__ctlfd_process() call now control fd is not counted by filter_pollfd(). However event fds with .revents == 0 are not counted either and this breaks the algorithm thus something more is still required to cover this gap. ~Alexey > > jirka >