Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1505020pxv; Fri, 2 Jul 2021 05:34:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU3r29fqL6nt70/M3VyVUUU7dJxtCLuAmONX0S0G6EbOoTDSdgUjgsyYmpdctwU1P8CkcR X-Received: by 2002:a17:906:2dd5:: with SMTP id h21mr5164845eji.522.1625229271493; Fri, 02 Jul 2021 05:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625229271; cv=none; d=google.com; s=arc-20160816; b=S5UkjpEV4orWCGNZE90nQoavvqRcnMxJ/lh2VmNYenwAEVvO3GElOcu3f71LqwB2VT tWooxRKx9aAyb3Sho6/8TZbExgFvUYnU+U5vUk6/RujjfaZcmgdtgHzXX4MrV+nbXcyb qWGaUmYGUqmS9B2MjDEEfI9Hb7BlAp5yCxmgo6yxBkKPwGb0AnBHBfRr/D8JJiGl+6QQ H5eZ+GBLYJhKAqnc6Tp35GPyU4WUosqEr1hcCA0ZQ1g/VAymJwW6EaNwmlboG+KhtcNS GCVjVo2IHg/ACWAIHNux7Zga8ssVizMqQ3XFxUSuABnhGT5u9d5m5TX5IfECNfWWvTm+ Wszw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=O0Nq/AtcoDow0ChYoQ/RVwfp+y4Fa+4UYmpLdksF2/E=; b=r7xD3aNF7dP1y+X/5sPPBrSE13B6k+TldELrlymESrMrvMQ9aM+szZGs/NjLUeP6mE MXgSoQuF/KM3rElTQuOu0VgtCS7qhE3McYqGq/tI9xg4rLwwJdKn26IC5SrTpD0ezJkX IcqRxVL/RWWHaIZ0/KGUeH1GMYBbSoaFTww3XXk07tBOmr3MqNz/DnAkfRgPzhEwgmUJ ZuWX7/ZFgRpRmMZYuXnfblGZw4P/VF2n4wgU0k61fKecS8Z9Ggt0U67ZL9CNbif1v6U9 4gNqpFQygg0EaafxyzeIvXPp9ys8Qs48J+CNw/bTL1pwC49FNIrzZ/fo9UnMrRKFnTtK 64sw== 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 y17si2815219edr.239.2021.07.02.05.34.06; Fri, 02 Jul 2021 05:34:31 -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 S232292AbhGBMfX (ORCPT + 99 others); Fri, 2 Jul 2021 08:35:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:3459 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232322AbhGBMfV (ORCPT ); Fri, 2 Jul 2021 08:35:21 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10032"; a="230397093" X-IronPort-AV: E=Sophos;i="5.83,317,1616482800"; d="scan'208";a="230397093" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 05:32:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,317,1616482800"; d="scan'208";a="642660178" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by fmsmga006.fm.intel.com with ESMTP; 02 Jul 2021 05:32:46 -0700 From: Alexey Bayduraev To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini Subject: [PATCH v9 04/24] perf record: Introduce function to propagate control commands Date: Fri, 2 Jul 2021 15:32:12 +0300 Message-Id: <260a6766bbed13b530060e8231ba8ddfecc8f795.1625227739.git.alexey.v.bayduraev@linux.intel.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce evlist__ctlfd_update() function to propagate external control commands to global evlist object. Acked-by: Andi Kleen Acked-by: Namhyung Kim Signed-off-by: Alexey Bayduraev --- 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 6ba9664089bd..3d555a98c037 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -2132,6 +2132,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 2073cfa79f79..b7aa719c638d 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -358,6 +358,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.19.0