Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp935782ybj; Thu, 7 May 2020 10:53:34 -0700 (PDT) X-Google-Smtp-Source: APiQypJYWdrjOEo9skI2WVog/EJ1cXaW63eQH7mefg2kGXxDOBZaCOZF7YQJfJd+vF9/gR+zBy8M X-Received: by 2002:a05:6402:3094:: with SMTP id de20mr13287844edb.158.1588874014132; Thu, 07 May 2020 10:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588874014; cv=none; d=google.com; s=arc-20160816; b=ruYxEsxuwu1ugjGA3oAhnRivq8bL9myWx2ZBVUYqmvZ2rUOIElOZgPO+pstpsd3o1F Ztz9ORQ/vXL+VprmxGHyU5AR8lMHgqycS8Q/ojuyKvGsSu9Y0XZLZnBBdgWsQzntopeY EGOqxkP95MmJAPP+UJX8CRHStgeRfhQdL58mVy5sTQ+yKV2kyfyanhVmKzw4wAaCm9sB lTa1KFVUuDW85tW7aJ0rh34xRPgVnEtAe95U1OLekb9EkYN1Ut51dPRpwNya8F4H1gGh 5tJvZeUpKDdddGKP8RKE5pKRyeXigvj6uAZL+W8+0t53Ia7TYEyGBRGnU9trDn2AcOcY pHFQ== 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=s0yO3kyAZdOtx1li/dAhekV8wP7qyqoLqQ4FFDUf1Uc=; b=ExtPW6osh0VrDUd5+ugGbRZbTjL+k0S774H/tIrQURBku5IF7d0DjepCpoN6y28/Sk mRt+/A4xKlM3hq+10vJCxD2vQP/Q5KHSxxnGwSvuU4RC9uzkvaeoOOflqB3C1cGntEfa VFBVnyzUEJyyqHWRW3Aef0wTo/IKFdS1gEBZ2DPJ4hq2Jvnd+JCsjEKV6K4P0aZL2RyP AW6Wk27su6a4nGe9iU+Fog0aSy22u+tgztnQpUCGI48qiJ88ibeZYKMHH7SvMwwVceoo ujB7sZiebNRTZAsuW7eHC64oAE/MtF8OYYSX5KKIoqYuEPDVYZGWf6ofvjAiYXqYbE57 +EBA== 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 k2si3480821edh.267.2020.05.07.10.53.09; Thu, 07 May 2020 10:53:34 -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 S1726860AbgEGRvO (ORCPT + 99 others); Thu, 7 May 2020 13:51:14 -0400 Received: from mga01.intel.com ([192.55.52.88]:26332 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726367AbgEGRvO (ORCPT ); Thu, 7 May 2020 13:51:14 -0400 IronPort-SDR: R0cYG4A7OOXZIl6g+nYohZ7lbhZr1uWQFQhMxGP2CVpjD1oxCzXG3/NajucCi8zdqPS6P+UBZN XIL+hvkx+q/A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 10:51:13 -0700 IronPort-SDR: V3DVH0xRnKf5l3LJZsiL+WE3XAvo1wmQRvSuEN5astS3+3DH5FWICFR/ZBi/w56Ja0UaKyRBEH 2WXrMcHxNyAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,364,1583222400"; d="scan'208";a="295800455" Received: from linux.intel.com ([10.54.29.200]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2020 10:51:13 -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 7C1D55805EF; Thu, 7 May 2020 10:51:11 -0700 (PDT) Subject: Re: [PATCH v2 02/11] perf evlist: implement control command handling functions To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <142da58d-7ff1-ea73-89e0-30342a710aab@linux.intel.com> <20200506202138.GF9893@kernel.org> <68696671-50f7-7602-fc64-7802a8eab29a@linux.intel.com> <20200507170136.GG31109@kernel.org> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Thu, 7 May 2020 20:51:10 +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: <20200507170136.GG31109@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 07.05.2020 20:01, Arnaldo Carvalho de Melo wrote: > Em Thu, May 07, 2020 at 11:32:53AM +0300, Alexey Budankov escreveu: >> >> On 06.05.2020 23:21, Arnaldo Carvalho de Melo wrote: >>> Em Wed, May 06, 2020 at 09:19:22PM +0300, Alexey Budankov escreveu: >>>> >>>> Implement functions of initialization, finalization and processing >>>> of control commands coming from control file descriptors. >>>> >>>> Signed-off-by: Alexey Budankov >>>> --- >>>> tools/perf/util/evlist.c | 100 +++++++++++++++++++++++++++++++++++++++ >>>> tools/perf/util/evlist.h | 12 +++++ >>>> 2 files changed, 112 insertions(+) >> >> >> >>>> diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h >>>> index 62f259d89b41..84386850c290 100644 >>>> --- a/tools/perf/util/evlist.h >>>> +++ b/tools/perf/util/evlist.h >>>> @@ -358,4 +358,16 @@ void perf_evlist__force_leader(struct evlist *evlist); >>>> struct evsel *perf_evlist__reset_weak_group(struct evlist *evlist, >>>> struct evsel *evsel, >>>> bool close); >>>> + >>>> +enum evlist_ctl_cmd { >>>> + CTL_CMD_UNSUPPORTED = 0, >>>> + CTL_CMD_ENABLE = 'e', >>>> + CTL_CMD_DISABLE = 'd', >>>> + CTL_CMD_ACK = 'a' >>>> +}; >>> >>> Can we make this a string, I think we'll eventually ask for lots more >> >> Like this? >> >> #define EVLIST__CTL_CMD_ENABLE "enable" >> #define EVLIST__CTL_CMD_DISABLE "disable" >> #define EVLIST__CTL_CMD_ACK "ack" > > Yeah Well, ok. Accepted in v3. Command becomes of variable length of chars + \n, in comparison to current single char + \n. > >>> stuff, like asking for a --switch-output snapshot with --overwrite, >>> reconfiguring events to increase/decrease frequency, etc, interfacing >>> with PERF_EVENT_IOC_MODIFY_ATTRIBUTES, PERF_EVENT_IOC_SET_FILTER, etc. >>> >>> This will also allow us to have parameters, etc, wdyt? >> >> Being a part of this patch the extension will implement configurability >> that potentially could never be used. >> >> Switch from int to string commands of variable length belongs to >> the patches also implementing usage of that string commands. > > Well, at that point we would have to support both, i.e. the way you're > doing now with integers, and as strings, otherwise 3rd party tooling > (vtune? :)) using this interface would break. > > I.e. this is like the syscall interface. > > So if we have "enable" now we can go ahead and forever understand that > as "please enable this evlist", but in the future we can extend it and > pass parameters to it, to control how that enablement will take place, > perhaps with a delay, etc. > >>> Also please since these are events that deal with 'struct evlist', name >>> them with the evlist__ prefix, not the perf_evlist__ one, as those >>> should be used with 'struct perf_evlist', i.e. the one in libperf >>> (tools/lib/perf/). >> >> Accepted in v3. >> >>> >>> Right now this is inconsistent, we did it that way to minimize >>> disruption of the codebase when moving things from tools/perf/ to >>> tools/lib/perf/, but this confuses things and I just did a >>> s/perf_evsel__/evsel__) for things dealing with 'struct evsel', so lets >>> not add new ones with the wrong prefix, eventually we'll have perf_ only >>> for things in libperf. >>> >>>> + >>>> +int perf_evlist__initialize_ctlfd(struct evlist *evlist, int ctl_fd, int ctl_fd_ack); >>>> +int perf_evlist__finalize_ctlfd(struct evlist *evlist); >>>> +int perf_evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd); >>>> + >>>> #endif /* __PERF_EVLIST_H */ >>>> -- >>>> 2.24.1 >>>> >>>> >>> >