Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp279274pxb; Sat, 21 Aug 2021 02:23:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5hkbYvWLe7p5S2QLj6xWMvVMgoF/oWqpHSbtiQGQrQxRs9E63iDFvwDU/ZllyyIYcC4bG X-Received: by 2002:a05:6402:278b:: with SMTP id b11mr26273283ede.339.1629537819969; Sat, 21 Aug 2021 02:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629537819; cv=none; d=google.com; s=arc-20160816; b=eoo/7QGelZjqHOKNPziIN3aYvDhsc+CIB8Z9jGvsT9Fk9wNMEpKnIBdZer5TrRjbR+ 14+1nmGfJI5Uq0zfYM6wcWqOnaoLVT3YJiUEufU/EoeMiWOJP7Ke05P8o86jLi2HZ5+X 8d9VqmrBkttrQU/CsQUCZ5zRl1+RgZxJrh2J/PKNVeKeiTus9NI4zXrgTOIF9PUoLezs Tjl0VfgKQ7+OZHGULqfSBFqYj8cnomvoCiTlVfc3JVExvmol6I3iRmGYEmdOZsL8sW4m 89JDntCn8AqcPPFvGWgSdhJRR8/Xh7FDlI+qS/3JYj7SngSov+jBEONkNjgKqmRT9/cz TdPQ== 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=2bmu3Fw9zmgDwWJcJ4+5MOZxCKRd0DdpkeYuxgu64FQ=; b=PDGKIN4e4TUqyFy/P9FRmlL1iYxYHAg5iQ42yOeNj9CX1/nyqrDZemZ5SHdaEgXVHC JWZRaLgJjEPxwkdDT/yUowWmHAXlAaIGIutKeMTiPAXFLjC8ejxLDiSkZi4M2KoMZ5SV rzb9WC9R84QdVIOqyoJYtnt9o/wutJOa3bdyz5s8AoFJ/Xx+LVhheNqSEgIJ3O6fHV3t bhoyFJBMxwT6SoUHgGQR0O00/thY7Xupm3ccaJyLqSIFM82oRHSM51nI6to7hFFh1WIj mNp3Uj7dx11lLRHc4muYI5tlcR8h+KeQjAuWG/MlEMUFkc1aQlfVjUUQwvtqGclkZJ59 G7Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BZ0kBqFE; 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 p7si266222edq.331.2021.08.21.02.23.16; Sat, 21 Aug 2021 02:23:39 -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=BZ0kBqFE; 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 S234890AbhHUJVw (ORCPT + 99 others); Sat, 21 Aug 2021 05:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234117AbhHUJVQ (ORCPT ); Sat, 21 Aug 2021 05:21:16 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 144EAC0613CF; Sat, 21 Aug 2021 02:20:11 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id d11so25134679eja.8; Sat, 21 Aug 2021 02:20:11 -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=2bmu3Fw9zmgDwWJcJ4+5MOZxCKRd0DdpkeYuxgu64FQ=; b=BZ0kBqFERbWnZHrCk4EMplslRN4zRsOzoj7eeWeGHoHcNqT56Rk2D1nu1rPk+O/8n2 EGh8oS9XuM8H3wlXq6MAJxukf5fLXy867ewCIqIe5RU3lujHHBK0JtFt05UsZGipYLQR 97qp9japXOXLaLq0RT72RMnc/Zsp62qtyBiYswImys9IhtLKpT6NW8HER4K5NEy7gJYE PF6sZxVcM0Il6hdY/kyF2LeLAk4VpN7LIxXk2RlhKszkDA3crwwLn+/tRJb3LsxkvtS2 YuviLTREkjyHRm2ElVPdXU55R1v/r/uVzgpxfcWL4Mxb7P4Vzm2zM1FwHjd582U5RG7I 4wxQ== 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=2bmu3Fw9zmgDwWJcJ4+5MOZxCKRd0DdpkeYuxgu64FQ=; b=ZQfJEI2z3ouzksPRfrsexX36a/ekb2rl0n/fgJcg7m8hQ/nvaQRTUFyaDsZIRhd1YT Drc4g7q8e792ZL9zIfQBzMcTdkE8zZstrXvPfb8X0zIF+WHFbyT1zOoJryyfNg+rLR9t RS5ar/hCCIbxwixhuXzLN2s7DKLmddNJijo37XWCzJSHs3Fi0ChIALhqUdlsB6hybqLo EVtvb/8IV8ezic0OlQxcpwfrTHf1Ywi4u3jnAVqblCQSbA29Wy3J0HyVfXa1zbF1F/Jm 13SzIgqrfA66Vz86QHq+919cieBUnW/yFY4UKn4/fAaBlUW+NTF9x1kQN17LgyEm9NRM m4Og== X-Gm-Message-State: AOAM531RqyahX3J2rBbIuoqQOaYkkucWrnCpKH7Osb18wdtUrSDWSYhj Qs3j4EAl25tnjsxNGli/dvLkEL9cL8GVsL4wDxM= X-Received: by 2002:a17:906:dc51:: with SMTP id yz17mr2036023ejb.498.1629537609566; Sat, 21 Aug 2021 02:20:09 -0700 (PDT) Received: from honeypot.. (mob-176-243-254-204.net.vodafone.it. [176.243.254.204]) by smtp.googlemail.com with ESMTPSA id a25sm4003878ejv.91.2021.08.21.02.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 02:20:09 -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, Riccardo Mancini Subject: [RFC PATCH v1 17/37] perf evsel: separate missing feature disabling from evsel__open_cpu Date: Sat, 21 Aug 2021 11:19:23 +0200 Message-Id: <48138bd2932646dde315505da733c2ca635ad2ee.1629490974.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 is a preparatory patch for the following patches with the goal to separate in evlist__open_cpu the actual opening, which could be performed in parallel, from the existing fallback mechanisms, which should be handled sequentially. This patch separates the disabling of missing features from evlist__open_cpu into a new function evsel__disable_missing_features. Signed-off-by: Riccardo Mancini --- tools/perf/util/evsel.c | 57 ++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 509a2970a94b3142..f0bc89f743915800 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1794,33 +1794,8 @@ static int __evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus, return 0; } -static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, - struct perf_thread_map *threads, - int start_cpu, int end_cpu) +static void evsel__disable_missing_features(struct evsel *evsel) { - int cpu, thread, nthreads; - int pid = -1, err, old_errno; - enum { NO_CHANGE, SET_TO_MAX, INCREASED_MAX } set_rlimit = NO_CHANGE; - - err = __evsel__prepare_open(evsel, cpus, threads); - if (err) - return err; - - if (cpus == NULL) - cpus = empty_cpu_map; - - if (threads == NULL) - threads = empty_thread_map; - - if (evsel->core.system_wide) - nthreads = 1; - else - nthreads = threads->nr; - - if (evsel->cgrp) - pid = evsel->cgrp->fd; - -fallback_missing_features: if (perf_missing_features.weight_struct) { evsel__set_sample_bit(evsel, WEIGHT); evsel__reset_sample_bit(evsel, WEIGHT_STRUCT); @@ -1850,6 +1825,36 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, evsel->core.attr.branch_sample_type &= ~PERF_SAMPLE_BRANCH_HW_INDEX; if (perf_missing_features.sample_id_all) evsel->core.attr.sample_id_all = 0; +} + +static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, + struct perf_thread_map *threads, + int start_cpu, int end_cpu) +{ + int cpu, thread, nthreads; + int pid = -1, err, old_errno; + enum { NO_CHANGE, SET_TO_MAX, INCREASED_MAX } set_rlimit = NO_CHANGE; + + err = __evsel__prepare_open(evsel, cpus, threads); + if (err) + return err; + + if (cpus == NULL) + cpus = empty_cpu_map; + + if (threads == NULL) + threads = empty_thread_map; + + if (evsel->core.system_wide) + nthreads = 1; + else + nthreads = threads->nr; + + if (evsel->cgrp) + pid = evsel->cgrp->fd; + +fallback_missing_features: + evsel__disable_missing_features(evsel); display_attr(&evsel->core.attr); -- 2.31.1