Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp971435pxk; Mon, 31 Aug 2020 06:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo1KMpRneQaGG1sZcBCC1sMOdCMda0O5g89oF8XxP3iNlpsASzGY7QvLZK2Vh3zWUiAcnV X-Received: by 2002:a17:906:eda2:: with SMTP id sa2mr1287251ejb.166.1598880855492; Mon, 31 Aug 2020 06:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598880855; cv=none; d=google.com; s=arc-20160816; b=U+++bTAWjcJhqWydqUp52DqQSCliS0kqdJopdviAAXUCTGOHe8B7GOqpHhGh6Zuw/X hU1DoLiQkpFA+R2T/YNMhXsEmdWywcSFDvxl+0KP9F9NmcaR8CLctRDwJnW/YOXaPHyN ynIHI4lvgsgcM8TFeSbsB0kw0sSD3cqki/dG+Nv2lRGp+5Lb+PFZfaMJrhOHYdL4AW+D c1Yvm8PkfTA7c+h83Mfo2nAy1IQ/iOiHZAy5Ll2ObxRF/3IXaN6b5Y0EnX0eZx5NQSQO L/klaHrpCS9k1zq0T1wbOrAWPcHbva9DHXLdPXajq3zdsPUuP66i9JhI/KPq7/8dXlFo K/HA== 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=k/wK0udBhSPieA5HxMtkjR7PtV+6uuQMQ8GnpLNosqg=; b=F8igTamFbOgKrlqaBVFYr8WRbkvy2RKz4j67U00cXSEaGru4VgU3zWoKhfj6mEdnIF NejpBDUkbEvoxvUA1BJnAk8iqFGo4dYbirEl407JKalIhMwk+rUQt+EVWCtkh2fDClva YnP6HJlx9++2Dhj4zX2kUGRhbUmrdAWQxzLc1P9rGfDFzc6A4v2bHsi7v8g9uMVQEvDt f2jZG90tyeKvXt8AGYK+dEhOouqgQJ/zHHtgbatDbbr5UvnWNMzqSqgDOGDyGEjq8Jsu Zd62d/bTPjTlj+VBTGQAcs2WQNKTmAntWdtKLR0whz7Q1B2930gwaWx8J/xmt1qrjB0B gPpw== 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 r25si5009992eds.157.2020.08.31.06.33.51; Mon, 31 Aug 2020 06:34:15 -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 S1727861AbgHaNdM (ORCPT + 99 others); Mon, 31 Aug 2020 09:33:12 -0400 Received: from mga05.intel.com ([192.55.52.43]:25348 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbgHaN2k (ORCPT ); Mon, 31 Aug 2020 09:28:40 -0400 IronPort-SDR: 30MqgE3vaJIDvUvR0a/xUyIm60Gs1ocCEKZuaoeOwovJWINkzSGF48pADUGA9/jbguT7sHq1lg 3Q98Rtk5wBuA== X-IronPort-AV: E=McAfee;i="6000,8403,9729"; a="241777786" X-IronPort-AV: E=Sophos;i="5.76,375,1592895600"; d="scan'208";a="241777786" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2020 06:28:31 -0700 IronPort-SDR: 0a6RGUdFd+sq21CVvn9Wa8r3qdq8zINIwWTh3WaR5k6tS+7E1dxa8yrM/u9Ep82tNl+279rtDx B7Fxos0AYCww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,375,1592895600"; d="scan'208";a="476726708" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.73]) ([10.237.72.73]) by orsmga005.jf.intel.com with ESMTP; 31 Aug 2020 06:28:28 -0700 Subject: Re: [PATCH 4/6] perf tools: Add FIFO file names as alternative options to --control To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Andi Kleen , Alexey Budankov , Namhyung Kim , linux-kernel@vger.kernel.org References: <20200829105015.10800-1-adrian.hunter@intel.com> <20200829105015.10800-5-adrian.hunter@intel.com> <20200831131927.GD406859@krava> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <660d6f71-f34d-dd3d-bc3d-3d2b9e868267@intel.com> Date: Mon, 31 Aug 2020 16:27:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200831131927.GD406859@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 31/08/20 4:19 pm, Jiri Olsa wrote: > On Sat, Aug 29, 2020 at 01:50:13PM +0300, Adrian Hunter wrote: > > SNIP > >> + *p = '\0'; >> + >> + /* >> + * O_RDWR avoids POLLHUPs which is necessary to allow the other >> + * end of a FIFO to be repeatedly opened and closed. >> + */ >> + fd = open(s, O_RDWR | O_NONBLOCK | O_CLOEXEC); >> + if (fd < 0) { >> + pr_err("Failed to open '%s'\n", s); >> + ret = -errno; >> + goto out_free; >> + } >> + *ctl_fd = fd; >> + *ctl_fd_close = true; >> + >> + if (p && *++p) { >> + /* O_RDWR | O_NONBLOCK means the other end need not be open */ >> + fd = open(p, O_RDWR | O_NONBLOCK | O_CLOEXEC); >> + if (fd < 0) { >> + pr_err("Failed to open '%s'\n", p); >> + ret = -errno; >> + goto out_free; >> + } >> + *ctl_fd_ack = fd; >> + } >> + >> +out_free: >> + free(s); >> + return ret; >> +} >> + >> +int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *ctl_fd_close) >> { >> char *comma = NULL, *endptr = NULL; >> >> if (strncmp(str, "fd:", 3)) >> - return -EINVAL; >> + return evlist__parse_control_names(str, ctl_fd, ctl_fd_ack, ctl_fd_close); > > do we want to mention somewhere that the fifo name is everything > except for 'fd:' ? It is only mentioned in the documentation i.e. --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -627,7 +627,9 @@ option. The -e option and this one can be mixed and matched. Events can be grouped using the {} notation. endif::HAVE_LIBPFM[] +--control=ctl-fifo[,ack-fifo]:: --control=fd:ctl-fd[,ack-fd]:: +ctl-fifo / ack-fifo are opened and used as ctl-fd / ack-fd as follows. Listen on ctl-fd descriptor for command to control measurement ('enable': enable events, 'disable': disable events). Measurements can be started with events disabled using --delay=-1 option. Optionally send control command completion ('ack\n') to ack-fd descriptor > > also how likely is that we will add another channel type that > will need another keyword (likd 'fd:')? I originaly thought > we'd use 'fifo:filename' for this ... would be great to somehow > avoid future confusions Sure, I will add fifo: in V2