Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1012811pxb; Tue, 17 Aug 2021 01:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvFv8/rN7+gali1xCUvhoQLlcat9ODU3B7Bn3tEQqE0TilRnd+XZV0XI3nH86hHTS2O1r+ X-Received: by 2002:a17:906:405:: with SMTP id d5mr2693409eja.189.1629188760974; Tue, 17 Aug 2021 01:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629188760; cv=none; d=google.com; s=arc-20160816; b=uHkraG21pJCzT9aTXZMYN+VIDdXvoMfRtFfW5iCHB0O/aaMTpNsa7JLRLTdrTRAb9r 4w43D6UKkhiwQasarV95TvdjLfG3azYpZnezeTNqGKWa2Z8jKJqPXPcVfiwyLQN7o1CO Ygfz3foyhaEdefsuZtdz2NpeOUJx9yB+WVdWxv4MKW0pWJgpBPqDlq0lg8MiOTKvp2WE +NtuS8yDQ4rCe+cx5kno3GKmHYtEzxEWY9PCeu0Ap5Mvt/nK8MibWmGC2QPncuGNuBUN L4iYJ2PYluvUKBSGEl+BVsfinzf4NfOp2KDLt3QR9GNU2UBG8bgoxJDbTQIonj+SgMkf WX8Q== 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=WqRl92db+P3jc6yTwCmQT/nlxF4Bqj/3T9aLRwG/Ic4=; b=A6A9WIRdUm0M9dGVSU6ZbXfYlPBurACY/ItBK2ah2UUYn/6+qYd+MPEhUONXQP9JY7 9tlXT0O33Jf6+umAp7YdelWdkVCYuPd85R/KE+Wj48+Sdp53sJWRQCsk4kIu1hlti5n2 Hn/ONUpHkGoSDmqtQD67G8KH7xmszBuujXzcB+GeBaIV67uzObiKDYpR4flmUum7BAga 1j1ZOC79QrudztchzN+6sPNxFxb5eu+jzEVGuhIS6XjEiYqfazmPumY69gY4N7C7GDEA W/kQSmNEEZhOr1iP4+IxttFVdb3PAFULy6uXrtjqli1rZ6KbhNFcuI90DgXn1JIHratW oZEw== 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 u17si1798638eda.469.2021.08.17.01.25.38; Tue, 17 Aug 2021 01:26:00 -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 S239269AbhHQIYY (ORCPT + 99 others); Tue, 17 Aug 2021 04:24:24 -0400 Received: from mga07.intel.com ([134.134.136.100]:11537 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239223AbhHQIYR (ORCPT ); Tue, 17 Aug 2021 04:24:17 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="279763187" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="279763187" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 01:23:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="471080204" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by orsmga008.jf.intel.com with ESMTP; 17 Aug 2021 01:23:41 -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 v11 04/24] perf record: Introduce function to propagate control commands Date: Tue, 17 Aug 2021 11:23:07 +0300 Message-Id: <9acea475bea3913fa4916999ed7d1304be0e0ac4.1629186429.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 Reviewed-by: Riccardo Mancini Tested-by: Riccardo Mancini 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 47581a237c7a..088f57593ebc 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -2114,6 +2114,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 5c22383489ae..2429c7bcb4b6 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -356,6 +356,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