Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3373462pxb; Mon, 17 Jan 2022 18:56:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9DNbg1kncXcVnqZgGTq8q/iIeQkp9pwf4lHnQ7WZpHX9sSowL0/C3n7Ed+/yqIUL+gNhN X-Received: by 2002:a17:902:d509:b0:14a:83bc:fd76 with SMTP id b9-20020a170902d50900b0014a83bcfd76mr22293657plg.40.1642474615855; Mon, 17 Jan 2022 18:56:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642474615; cv=none; d=google.com; s=arc-20160816; b=QnVXviF7bVYSrgKSdaKTxRE7pfFXzzZJOvkL/DlyEeez2tllVab4kU4GlDXdikc+mj vCdb/1vpOwFdDWp6Tpxl+34DKAIqO/qagQCUfGqW6LJcMU0/w9Ncm6O702nxRFz8WYvZ 5/BoXDgninC+8mX0z7A/EfFp7QsfuTglu+RwMAgxnpl1xEjkP8MDPwrkWZA6ZMC9ktWq nzPDrl4c6ML8K4b5HuZd0yFUVYefvmZWSQ1XkRb+W23bz+0vdxjQSbPmoPWFh0p3h9ER 8WPhC2L/niQykcKcdPM3IrU6pYi2RnJxbwTjT9VbUSCC2r6bBJ+nNtlkPSdcYYCs7jZ4 +u2Q== 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 :dkim-signature; bh=OO1p+0Y37yw6kWKEA4d3+o0+qLorfUgzSHjsz1NwjNk=; b=EjDFuVFEYO3GJE5wFgErYI7EgJKbc/bnV9EtZq+rjWwsGDnzA9do/PF/E6N00VzqVn 3obcgzTvnjuPgXKw24+aSmhq5MRZNyJKunyG/XIf28xC2kBBoSJwwl88dmLk8ItJgya6 nHCc5AXQESvf6amjjbqetTQyFPCnubiLpT/jDGjhvqoiSWLeY8A73wtUrjTveNNQiweZ RKH43R8gjwRV+sRleM7tcyS3iWSwupr52JpK0o0MsuDCYCDPUg5LmStLEtnT63IaM3tZ L3Axh8cqkEVfQzH3Zv0a478XX/eo2+bRgxi7UFh5GsSPksd5rj2Q9OqpUTO/kY+/lhRY EHxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iK+uDiYl; 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=pass (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 d8si16569813pgu.739.2022.01.17.18.56.42; Mon, 17 Jan 2022 18:56:55 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=iK+uDiYl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242678AbiAQSe5 (ORCPT + 99 others); Mon, 17 Jan 2022 13:34:57 -0500 Received: from mga12.intel.com ([192.55.52.136]:48606 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242674AbiAQSex (ORCPT ); Mon, 17 Jan 2022 13:34:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642444493; x=1673980493; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=erpC/Dx6pqbW4EyR2ekvXQCrbWogcl+3QBNVqLLTqXQ=; b=iK+uDiYlfeODitGLbJsa3MrwaBn1K5g+WeBm6057MTgeyuUydBgMkcGP 01Ok40i+GU3/PhfRN5nxVPSRkJxzwLGuLyEnFOUmC3AXU+jF0hM7fOrHl Fhy48pTWWUQ/PzS3oqsRnNa9Nb/lB9GJh2K91zoBXBrc9E4I2XPw1JviS oz0gt9SaxhscgYLVJSTz9Viqq/5Y79z47NOIFtkbXtl+kaLM5sQ16HlhJ 2wuvNOnGqbNCbNEZ5Ql+DQWYNfDDhRIilT8F+IUMcASSQacKVwcr7u5Mo /OpJL8lzlo4dFSrZYd9uHxGbQM7YyUJ1KQGOtz0F5K7zDfZtnOODTSBTG w==; X-IronPort-AV: E=McAfee;i="6200,9189,10229"; a="224655987" X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="224655987" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2022 10:34:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="492434211" Received: from nntpat99-84.inn.intel.com ([10.125.99.84]) by orsmga002.jf.intel.com with ESMTP; 17 Jan 2022 10:34:50 -0800 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 v13 04/16] perf record: Introduce function to propagate control commands Date: Mon, 17 Jan 2022 21:34:24 +0300 Message-Id: <7df52c9816b13c74897b9e518128b29a391462fe.1642440724.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 6e88d404b5b3..48a865221636 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -2131,6 +2131,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 64cba56fbc74..a21daaa5fc1b 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -410,6 +410,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