Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp647591ybt; Wed, 24 Jun 2020 07:57:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxAFw1oxQtVqsQYbu5b3VkxmA7h8Na+jeSxOWR9ckPMWDgI0i5yFFUA5onxUyBTAlczgcL X-Received: by 2002:a05:6402:22b3:: with SMTP id cx19mr26618552edb.329.1593010624982; Wed, 24 Jun 2020 07:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593010624; cv=none; d=google.com; s=arc-20160816; b=e+IZvY1sTQVnrB3QrVcbYTNumQ1wPog9RGeqwgUl1XVSTwPGuQnKFyNV85o6shmdkj 7acp6jMRdfYbtrfhWD/wP7z9cuQtov0VHOdmYzxrAQiv4lJnlQsH/A0zZPqtY2JvpCgh Fbna7HWsGWNvnY4wTr8WBhlM/FZQb4eLbtcZgswzm4EPLD0hZz1d13ucf8vyZgJYtxQK atTs7hRPOUdRljj96+PyH2Ipghgv8BQre+swRDS/AhvQRZ8KbHmsPOuow7J4yUMCf0yu 4+KNTzvADt2mLzcYtbW/8HBLFebTytdsA69qawfDhU/Ftq9WdulqFA1UXw5t/P9I8eKb Nu6g== 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=AgKTFKJePFBBN8gT836KFy3480N6XsIyw4QBp8Lujw8=; b=L50W6mkq2VZsfzr3MAxO1/qu+f2irLCmwi2hDLYkf+5jGEP1cxYzH/gqjYeSIRt8yD 4auEqtBG+BzhZ0abyNuWd5nwCMiECEKdSDipSEHeo1dGeGE4Eoe2kgQaoGQNV1O+Hz2O u0Dgf2tqnZP3/WQHAoUBvVo/vzqJZsTSrAbex/MGWjtN3r6d5LwkeYwbHKMKmXQK1pmB PnGSBS4iipcAGSvpEZRDxwx/BmTSznUl/Garp9KiNO2oi/LxynfqyPzcLNwD1YDJAAMN lrOMQp0wwtZ/o7QzrvydOizRpCgxo8Elm5Z4v+SCydJOueeeLR1IcsMzMM4UymHWqiIY eLGQ== 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 r3si13200000eji.126.2020.06.24.07.56.40; Wed, 24 Jun 2020 07:57:04 -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 S2404026AbgFXOzG (ORCPT + 99 others); Wed, 24 Jun 2020 10:55:06 -0400 Received: from mga12.intel.com ([192.55.52.136]:3903 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389187AbgFXOzF (ORCPT ); Wed, 24 Jun 2020 10:55:05 -0400 IronPort-SDR: aK7zxTV+OdhoKwXs8JehSrqnsJwAhDJtAOzf3+Ad3ZmFXhkr8pwsGZh+meqDM0711+NJFXZZJf KuCh9zNaaZTg== X-IronPort-AV: E=McAfee;i="6000,8403,9662"; a="124137793" X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="124137793" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2020 07:55:05 -0700 IronPort-SDR: 3diYQJsZjju2gltGrThSCVqE1FJi6rWlHV1p2yw0VIgrv5bcq5+95xa+MlK87FHwj3HMI/X6Lz KcG1Ae20ZWxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="310804882" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 24 Jun 2020 07:55:05 -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 57F5B5804D6; Wed, 24 Jun 2020 07:55:03 -0700 (PDT) Subject: Re: [PATCH v8 12/13] perf record: implement control commands handling From: Alexey Budankov 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> <3107d9cd-03ec-34aa-4226-393547c55517@linux.intel.com> Organization: Intel Corp. Message-ID: <173bf24f-1db4-b496-c258-4e98536d23a5@linux.intel.com> Date: Wed, 24 Jun 2020 17:55:02 +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: <3107d9cd-03ec-34aa-4226-393547c55517@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 On 24.06.2020 17:00, Alexey Budankov wrote: > > 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(). And evlist__ctlfd_process() still should be called second time right after evlist_poll() but prior filter_polfd(). ~Alexey > > 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 >>