Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp486453ybh; Wed, 22 Jul 2020 05:48:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvLfTQ2SpY1pxD8a5vCLrn/7llVlyMj7BU6QvsZDOd6G87Kuj/fV7+vVFGj3SmnBd87YCk X-Received: by 2002:a50:f187:: with SMTP id x7mr29271532edl.59.1595422124768; Wed, 22 Jul 2020 05:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595422124; cv=none; d=google.com; s=arc-20160816; b=itguZH7tgXFOgcfr2mZlCZDNJX+Hw3M9ucdKYSH6T2clhcwOZ1CbfayA0uJxw3y7pt taJowPsxoyTNOq+ZViNpIEyTMn7QXo8/xqFKSbAUoViMuw0JE2xR0R3nTDUyPLnWpcAJ Hd1FAVcTD19cjzLgqEIRqWvMDGN+9NwcMRQ9dfoUSJBTrHTaKxVPxQbuvRQNvD4I8D0Z 8UfcBk81tHgalGxLQPzL7yNPwhNuYIH6HfBQWMb4hXODioGxVDh/g27Z0lild9ed4ZfQ xYESjVgxeAo6m6FV9klA1YumiMn2gH3x/BXpW2ZIA+st5vLzPKk1C2+HCTh00AtvPmlF Ka8A== 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=mtUccu7/L/0itxg6JRMV5E3sMMaY5/AbdAqjuaDKE8s=; b=u8ZglLvpREAeS5uEoTvpPmcfcnsoxIj2jLoiCUskRJcgZ7/Azmv27CLUUNW+M0gWA/ W12DsoJPC5DvaryGkc0Hm3zHjg6k5OnoimAql7H04qb1tnTvd9XilDQn0jiLGLC8UiBN H3ssaFQZDL3K4FR2veAThlrVyFBjXMBQocBuN7W0+viPXKHvd6mHyGB/kS/G+L3+SAuc R7nxtcAp5Dy127HgZuPU1MUg/aaclpr7LqM9fKXO1tvE0+lUvcFfxF6IZkJeqUu4nh7L k0DFLC1WhgnuXnwN5DT+xqRDf7cKkEHjj01jwjlgVeb5jlmGyegxG/Oaan2pnjalX3Zt ZRGQ== 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 fi17si13812200ejb.724.2020.07.22.05.48.21; Wed, 22 Jul 2020 05:48:44 -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 S1732250AbgGVMpv (ORCPT + 99 others); Wed, 22 Jul 2020 08:45:51 -0400 Received: from mga03.intel.com ([134.134.136.65]:14452 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbgGVMpv (ORCPT ); Wed, 22 Jul 2020 08:45:51 -0400 IronPort-SDR: vKcfbB8DomslsmFiGL4cyEBIZ/zBbPJx21GDs4qZ/5C7ojrLgWnPX1SMXsIr8lp6Ae7k7uko7P mGHCDk+VQ8JA== X-IronPort-AV: E=McAfee;i="6000,8403,9689"; a="150297447" X-IronPort-AV: E=Sophos;i="5.75,381,1589266800"; d="scan'208";a="150297447" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 05:45:50 -0700 IronPort-SDR: WJ6Qj/418nndmgvTB7pOtlXgYvSgyd0ICYRCcwjMwtaIgUxGQqn1lG/yysCIb6REj67T+kL8Lv LdsUNmnxECkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,381,1589266800"; d="scan'208";a="432364651" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 22 Jul 2020 05:45:50 -0700 Received: from [10.249.230.82] (abudanko-mobl.ccr.corp.intel.com [10.249.230.82]) by linux.intel.com (Postfix) with ESMTP id 5A5725802E4; Wed, 22 Jul 2020 05:45:44 -0700 (PDT) Subject: Re: [PATCH v12 05/15] 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: <8d91c3a0-3db4-0a7a-ae13-299adb444bd6@linux.intel.com> <62518ceb-1cc9-2aba-593b-55408d07c1bf@linux.intel.com> <20200722122734.GJ77866@kernel.org> <20200722123423.GK77866@kernel.org> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Wed, 22 Jul 2020 15:45:43 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200722123423.GK77866@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 22.07.2020 15:34, Arnaldo Carvalho de Melo wrote: > Em Wed, Jul 22, 2020 at 09:27:34AM -0300, Arnaldo Carvalho de Melo escreveu: >> Em Fri, Jul 17, 2020 at 10:01:33AM +0300, Alexey Budankov escreveu: >>> >>> Implement functions of initialization, finalization and processing >>> of control command messages coming from control file descriptors. >>> Allocate control file descriptor as descriptor at struct pollfd >>> object of evsel_list for atomic poll() operation. >>> >>> Signed-off-by: Alexey Budankov >>> Acked-by: Jiri Olsa >>> Acked-by: Namhyung Kim >> >> I'm applying locally for testing, but can you answer what is the reason >> for that newline in the CMD_ACK_TAG? I tried looking at previous >> discussion but couldn't quickly find any reasoning for that >> >> - Arnaldo >> >>> +++ b/tools/perf/util/evlist.h >>> @@ -359,4 +359,22 @@ void perf_evlist__force_leader(struct evlist *evlist); >>> struct evsel *perf_evlist__reset_weak_group(struct evlist *evlist, >>> struct evsel *evsel, >>> bool close); >>> +#define EVLIST_CTL_CMD_ENABLE_TAG "enable" >>> +#define EVLIST_CTL_CMD_DISABLE_TAG "disable" >>> +#define EVLIST_CTL_CMD_ACK_TAG "ack\n" >> >> What for? That '\n'? > > Oh, I see, this is not a _command_, it is a _response_, and the sender > expects a newline, right? Right. Shell commands can expect strings terminated by \n, e.g. 'read -u'. See sample bash script in 00/15 for example. > > So I think this needs to be marked clearly as: > > // Commands accepted by 'perf record' > > #define EVLIST_CTL_CMD_ENABLE_TAG "enable" > #define EVLIST_CTL_CMD_DISABLE_TAG "disable" > > > // Responses sent by 'perf record' > > #define EVLIST_CTL_RSP_ACK "ack" > > And then make the response add the newline, as conceivably we could have > something like "nack", "invalid", "enoperm", etc, no? That above makes sense. > > Anyway, this can be done on top of this series, so I'm continuing > processing it locally. > > - Arnaldo > Alexei