Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp622595ybk; Wed, 20 May 2020 07:58:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDcJGCQUOriIq5LNBorwQkTmMorNPrUGQZ7EVWk6OkeAkMelMQ/EQ7+IGBSkMvPwzrmL3J X-Received: by 2002:aa7:d691:: with SMTP id d17mr3832339edr.273.1589986714508; Wed, 20 May 2020 07:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589986714; cv=none; d=google.com; s=arc-20160816; b=g7fcNZ5hhxsxCwCXJJaThtyPnHPq6wH1spCr0NI7my31+VgpOE+R7TM7AY5J2a0rxL Vu1Vf04EMdCfXTAtsenzWJVJELJ8Gk85IcaLxelS+F/0FjBlXZDX1epuL9JVusqiWKLQ DZC/sVd+bRV6yF1F+v3GRvoENbprSdcWOxsJ2smLusWOMuh/gk42hh0r9lMVnBrvojEg +an3fZhpGWNl1q4M02/sL8Dt07oSZ/mX8v0hPEnbS72HfHUu8mstLwLTQMaX80ub029b SyznB/XxMVXwa/BaGbYmMsQsCI7yNeYvxi1v1yJ+9PYuWqeo39jU6CoRzF3Is/GNrjHN H3cQ== 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=y1TWn2vnoreLZF/L8uINvao+aJT0YLbmV0zVbYiiIns=; b=oDLIL79yjC5wFLl9LQSamIRBXCQ/UkDZMT6jn4xVW5vHZ3a8KPwGiGkgZNxbEHv3kM V5MALj0jx2wFcnaeQvzSOYVpB6Pm80zgUSO1nQcjZJZH0LiiLLd4TQQbo9OgnPeZL0jE AKAO5DbNeNCgn1bzNPqdqSwdTc3ENu0UkF059a9bhgfNd9epXxmJhJ1uYnZM0EIkiIGR 8Dg8umzhnQzHLvVlBmaGGeQLuIjYJ4YlDSwa49UyFJJcOkdj9EpTNrYb+nq57kTkZAGW jaBnbp/TXocISKDIxzNYdpMaNHBXpOlWjWe2bLSfxR7jffPOnkuZ/K4GxF6QDnd3e19D XNFA== 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 lr24si1856416ejb.383.2020.05.20.07.58.09; Wed, 20 May 2020 07:58: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 S1726832AbgETO43 (ORCPT + 99 others); Wed, 20 May 2020 10:56:29 -0400 Received: from mga09.intel.com ([134.134.136.24]:30095 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbgETO42 (ORCPT ); Wed, 20 May 2020 10:56:28 -0400 IronPort-SDR: wxiIDAoZ4m6hb5vTYNX1bedkJEjNHqIH4Wt2T/FNKrka7FHta6QXU0Lvb3RQ/5v7rqDVkgGY8V xiW7V6KjCQWA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2020 07:56:28 -0700 IronPort-SDR: Rh6lb+FSju5UaS+4nFzb30lu/Hb4am82atJLR48s10oGeGNSERWVWza7PZvMwhaQFA4zCngZ1w cd681tCEA0+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,414,1583222400"; d="scan'208";a="308744482" Received: from linux.intel.com ([10.54.29.200]) by FMSMGA003.fm.intel.com with ESMTP; 20 May 2020 07:56:27 -0700 Received: from [10.249.231.6] (abudanko-mobl.ccr.corp.intel.com [10.249.231.6]) by linux.intel.com (Postfix) with ESMTP id E2B91580100; Wed, 20 May 2020 07:56:25 -0700 (PDT) Subject: Re: [PATCH v3 2/9] perf evlist: implement control command handling functions To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <20200520123807.GD157452@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: <630cdfa9-3eed-ddb2-d3b9-0ec008fa0e68@linux.intel.com> Date: Wed, 20 May 2020 17:56:24 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200520123807.GD157452@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 20.05.2020 15:38, Jiri Olsa wrote: > On Wed, May 13, 2020 at 11:00:02AM +0300, Alexey Budankov wrote: > > SNIP > >> + >> +static int evlist__ctlfd_recv(struct evlist *evlist, enum evlist_ctl_cmd *cmd, >> + char *cmd_data, size_t data_size) >> +{ >> + int err; >> + char c; >> + size_t bytes_read = 0; >> + >> + memset(cmd_data, 0, data_size--); >> + >> + do { >> + err = read(evlist->ctl_fd, &c, 1); >> + if (err > 0) { >> + if (c == '\n' || c == '\0') >> + break; >> + cmd_data[bytes_read++] = c; >> + if (bytes_read == data_size) >> + break; >> + } else { >> + if (err == -1) >> + pr_err("Failed to read from ctlfd %d: %m\n", evlist->ctl_fd); >> + break; >> + } >> + } while (1); >> + >> + pr_debug("Message from ctl_fd: \"%s%s\"\n", cmd_data, >> + bytes_read == data_size ? "" : c == '\n' ? "\\n" : "\\0"); >> + >> + if (err > 0) { >> + if (!strncmp(cmd_data, EVLIST_CTL_CMD_ENABLE_TAG, >> + strlen(EVLIST_CTL_CMD_ENABLE_TAG))) { >> + *cmd = EVLIST_CTL_CMD_ENABLE; >> + } else if (!strncmp(cmd_data, EVLIST_CTL_CMD_DISABLE_TAG, >> + strlen(EVLIST_CTL_CMD_DISABLE_TAG))) { >> + *cmd = EVLIST_CTL_CMD_DISABLE; >> + } > > are there more comands comming? Currently no. ~Alexey