Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4241651pxu; Mon, 12 Oct 2020 13:25:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVFAgpdPZbBiQjU+mCLBfk19k+bLRvHlGj2heCJqdF+coM8FRqgEQMO7uIccbCoTvZ+awj X-Received: by 2002:a17:906:9396:: with SMTP id l22mr29301263ejx.36.1602534305536; Mon, 12 Oct 2020 13:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602534305; cv=none; d=google.com; s=arc-20160816; b=avVancVohscRGmW1C13TeXpidDRiLUOxKbLPkhGiyF3FHis8gAauB41+I3e0AM7vcB IEbNyHZO64HjZXgIDySZSWL4uCAZXgzLtPm4fonLOY7HSIY8my3a05ja3RVmlFNSFeMg oc3HBNDbCtaMTv+hPwwJwglcieQ3hOiZjBqas3OOrsl18hHwxUkhcQa1IZYIHzzC1wqI sFBo4fVepyQ15i8jA7DKtSPbUDp8/de/CAJUjdgKPOoKnYa6HTHdzlmpCR6e9qeGLgWp L7hhabB3J5E2veNtWGrxhpw8w8br6M7ALsy2fjc3l++SYEytk/tCeFk7AD8gAAIj91iY 4ucw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence: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=ep4Zcaiy6BychF8St0JbhhKcYQbrOvBHABFqjSwGGxM=; b=WWdARn5FOMQ2s9ruH4CVaxGTX5QhTPv+woRNWgtp0oZ3vx7ho98v3p1qp7+RwIN3ot I7ALqIgwNeC+ROSSXRQRQxHBiduU9jBghUvGA/mYSjoqw+po37dVjqh7pV9HrfXp6EEf ZWzB9GCedYx7gUiULtfQtMJPT+Pd3Eyz6anxS40cLZ/hxuzTc8jGBYBW9+li11gfUGPl GFvCA75L4T6yzTv0YcLWcnsJi/Wz1P7y+drKS2tnK3JNNPQ+RzD+zmH+n2N401hjbZp6 Qw8g/5oWXaDsonTNXImLzts13buVwayHLEckv57hkBw4w6UGcA66tmc5DewlKV+n+rPE OQXQ== 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 rn19si12375920ejb.340.2020.10.12.13.24.41; Mon, 12 Oct 2020 13:25:05 -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 S1728751AbgJLJFG (ORCPT + 99 others); Mon, 12 Oct 2020 05:05:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:45501 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbgJLJFF (ORCPT ); Mon, 12 Oct 2020 05:05:05 -0400 IronPort-SDR: Elq6fIDi/Wyfo/WxQYAs/L3XCDKFsGN45HMgQJuGek6A3+O4ECAqSRJmz1AWWsLlJlKCHjHd1m RZ3AMVRzoNGA== X-IronPort-AV: E=McAfee;i="6000,8403,9771"; a="183166436" X-IronPort-AV: E=Sophos;i="5.77,366,1596524400"; d="scan'208";a="183166436" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2020 02:05:05 -0700 IronPort-SDR: PHMNhXqveA+YrccAdC264ItdcwakJ566OPLIZpXvoG/lKPJhRU8genOgX4vC8465PpSbVBzrq4 nS9/Sx0DPbzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,366,1596524400"; d="scan'208";a="313380820" Received: from linux.intel.com ([10.54.29.200]) by orsmga003.jf.intel.com with ESMTP; 12 Oct 2020 02:05:04 -0700 Received: from [10.249.225.186] (abudanko-mobl.ccr.corp.intel.com [10.249.225.186]) by linux.intel.com (Postfix) with ESMTP id 5EA1F5805EC; Mon, 12 Oct 2020 02:05:02 -0700 (PDT) Subject: [PATCH v1 11/15] perf evlist: introduce evlist__ctlfd_update() to update ctl fd status To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Namhyung Kim , Alexander Shishkin , Andi Kleen , Adrian Hunter , Peter Zijlstra , Ingo Molnar , linux-kernel References: <810f3a69-0004-9dff-a911-b7ff97220ae0@linux.intel.com> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Mon, 12 Oct 2020 12:05:01 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <810f3a69-0004-9dff-a911-b7ff97220ae0@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce evlist__ctlfd_update() to update ctl fd poll status in evlist pollfd array using other pollfd object. Signed-off-by: Alexey Budankov --- tools/perf/util/evlist.c | 16 ++++++++++++++++ tools/perf/util/evlist.h | 1 + 2 files changed, 17 insertions(+) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 8bdf3d2c907c..758a4896fedd 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -1970,6 +1970,22 @@ int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd) return err; } +int evlist__ctlfd_update(struct evlist *evlist, struct pollfd *update) +{ + int ctlfd_pos = evlist->ctl_fd.pos; + struct pollfd *entries = evlist->core.pollfd.entries; + + if (!evlist__ctlfd_initialized(evlist)) + return 0; + + if (entries[ctlfd_pos].fd != update->fd || + entries[ctlfd_pos].events != update->events) + return -1; + + entries[ctlfd_pos].revents = update->revents; + return 0; +} + struct evsel *evlist__find_evsel(struct evlist *evlist, int idx) { struct evsel *evsel; diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index e1a450322bc5..9b73d6ccf066 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -380,6 +380,7 @@ void evlist__close_control(int ctl_fd, int ctl_fd_ack, bool *ctl_fd_close); int evlist__initialize_ctlfd(struct evlist *evlist, int ctl_fd, int ctl_fd_ack); int evlist__finalize_ctlfd(struct evlist *evlist); bool evlist__ctlfd_initialized(struct evlist *evlist); +int evlist__ctlfd_update(struct evlist *evlist, struct pollfd *update); int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd); int evlist__ctlfd_ack(struct evlist *evlist); -- 2.24.1