Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1359706pxb; Fri, 20 Aug 2021 03:57:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIxyYu9xqJddlVKQlMlzCA61oOexxzJpFrNLmPlRADoDLXiRUEr/w9/7KvrXpdQlvHDpbU X-Received: by 2002:aa7:c78e:: with SMTP id n14mr21284816eds.381.1629457071677; Fri, 20 Aug 2021 03:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629457071; cv=none; d=google.com; s=arc-20160816; b=OfzwkpAYVO/+yfkhS4FnSE3qHNI/Mrwqroywbo6FOPn8yRIqLWy32RD7aIVtQWX97o S2gFNSclP1uhnHc8EnYWbWWngCD+HOXG++bXX6fNro64+FV4sne4fTioer32CTL+nfal ef+2+IOq12VVdOJjI2MhvPU7Kb+vy3tIErqkMehXev2+LZMBoH6nmwCazvLOtZooto/d 1TlN9LjVmCu9AwaDWiefnE+0W2uVJlaEHrYzjwtxvVYkQfcD6SoHJIxNe1SIQC6Htha9 ly2W8aFM0B9k0WRV/gV/ks01l089affBbqZVMU/aokqnXNwEgs5KpJ0i6J00xqff8OGC uwGg== 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=B1TwEsY+qGtY8ZIip/DFmceb5xuwhe2EKlWEX/tGJMw=; b=qNqpXVabKwuyP+V1l/pgOO5WXR6Lxqznes4ipE2TLsiWS4RmHfoJXvti91/WEm2ppu J3WH+T/J8LgOyvzUobpaQR1zlUE4gbqflCI/LUG7P8HY+rRrK3Z+LXSbUKox5/CPKqzf b3p3usqweaGmEY462eqtn58iiTHi79Fbm6sW5Zfa2OOpVSSaR+ZRm8ntaXYxqI6e0mnc rL2C7uAJRp+g9jMYFlWhmOmHbnj91zsUpmgH3gFJ0x4oPENlx2Dj20sWea4Kgi77LYIA 4zxBiQduZaEQRu+0F17KH7b1KVa/1bRQnN/oScvCrtfHnurTpnt9+AZcd6j4VGWsQp36 Wb+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NQILQJ+2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si5940923edb.198.2021.08.20.03.57.28; Fri, 20 Aug 2021 03:57:51 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NQILQJ+2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240051AbhHTKzo (ORCPT + 99 others); Fri, 20 Aug 2021 06:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239584AbhHTKzP (ORCPT ); Fri, 20 Aug 2021 06:55:15 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E929C0612AB; Fri, 20 Aug 2021 03:54:34 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id q3so13407825edt.5; Fri, 20 Aug 2021 03:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B1TwEsY+qGtY8ZIip/DFmceb5xuwhe2EKlWEX/tGJMw=; b=NQILQJ+2ib6lfhp9n2EzNvSNDc4xaKPOpEZUkIuKx4mg3xD2DQwjO82lCcVpovp9YA tsaw77RHVtu2SqdNmu/uU8Rj1S6936P3Q+5SW9545KOMtpY076hBlPehSXDcOVkIb3UN 7bWr1++r6Tya7pdDR7B6Um6j5TTR/tke3u7RMNj9nDU12H/1CRmRC60C7GtoagtIQ5Ps fDyphi7hVDOC6yfKgsoZANfQ4FwI72C5EwGVpsxcRFlqn3njVsem6Dxn1oebnkG6gQCq WBUS+yOFlB/RXpLpb7FHBhoycxv4fiZUOT7EhHFmclga9RHrl+rZ9csznTR0ns35KuBd 4Itw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B1TwEsY+qGtY8ZIip/DFmceb5xuwhe2EKlWEX/tGJMw=; b=fmQUYmbFhJA1soyrRsrhmKYaACvGP285/2mhba8HnvmqGa4qlsfqgpOgKbSXV6IAsM zNJOZg+bVUiJfNlpfgdsSEEQZ2+Uu3lrFRU57DEYNF9/+WNAcQeexxZLRWQ+j4ufQ5A6 7HC1zDPM9abreFGf1V+dwLIT2oy56G/7aChyiE6usqsh2aUAn07UjTxhex0JzoIkv7oH Ic0sBrkroHRMO6WU7kuCBh14SoQFvYc1qicdrmD3Uk/U+zooWtQwr8FuBalBLVROyrTC L0NsLu1S+ar7VCj1Phym4jZ2iyoq66ed+IjGUA5CKGWQMVeHbt5WFtkSTLcCUp1CeSs9 TB5g== X-Gm-Message-State: AOAM530AIv6WnexoNHyCoYzbfUfvbgywdZtoLLXz4cWWDmgqKRfdWl2w gG7v5LAVU4U8foicYNP6O3c= X-Received: by 2002:a05:6402:d49:: with SMTP id ec9mr21424736edb.333.1629456872597; Fri, 20 Aug 2021 03:54:32 -0700 (PDT) Received: from honeypot.epfl.ch (mob-176-243-199-7.net.vodafone.it. [176.243.199.7]) by smtp.googlemail.com with ESMTPSA id g29sm3451459edf.31.2021.08.20.03.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Aug 2021 03:54:32 -0700 (PDT) From: Riccardo Mancini To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexey Bayduraev , Riccardo Mancini Subject: [RFC PATCH v3 13/15] perf top: setup global workqueue Date: Fri, 20 Aug 2021 12:53:59 +0200 Message-Id: <331e87d881040594673af3399a8b925442fa46d2.1629454773.git.rickyman7@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch initializes the global workqueue in perf-top if nr_threads_synthesize is set. This patch is a preparation for using the global_workqueue in synthesize. Signed-off-by: Riccardo Mancini --- tools/perf/builtin-top.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a3ae9176a83e2453..9b4f220920780a95 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -49,6 +49,7 @@ #include "util/term.h" #include "util/intlist.h" #include "util/parse-branch-options.h" +#include "util/workqueue/workqueue.h" #include "arch/common.h" #include "ui/ui.h" @@ -1767,8 +1768,23 @@ int cmd_top(int argc, const char **argv) opts->no_bpf_event = true; } + if (top.nr_threads_synthesize == UINT_MAX) + top.nr_threads_synthesize = sysconf(_SC_NPROCESSORS_ONLN); + if (top.nr_threads_synthesize > 1) { + status = setup_global_workqueue(top.nr_threads_synthesize); + if (status) { + create_workqueue_strerror(global_wq, errbuf, sizeof(errbuf)); + pr_err("setup_global_workqueue: %s\n", errbuf); + goto out_stop_sb_th; + } + } + status = __cmd_top(&top); + if (top.nr_threads_synthesize > 1) + teardown_global_workqueue(); + +out_stop_sb_th: if (!opts->no_bpf_event) evlist__stop_sb_thread(top.sb_evlist); -- 2.31.1