Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp91103pxb; Tue, 31 Aug 2021 15:57:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTW9KHUuJ9qimVJXY5U8s/YxsORXujGvMUOXkmd8nN++f3aAh4BOxN5VBbArm9Kv2PibIR X-Received: by 2002:a05:6e02:12b3:: with SMTP id f19mr22614945ilr.234.1630450624574; Tue, 31 Aug 2021 15:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630450624; cv=none; d=google.com; s=arc-20160816; b=iGjITS0fYgDReiAMbJRLEYfgXBMxdqz9Wz1Mxpwc9Cu1HBlcv87497z+nrTe0DAgR4 hHOGVd9fNwkjL/mvEFcg4oEQoFBsHcNw9cTzSy+m9ZCbZPJlzuo2XTzhcPXadSIsoUKQ VXtCiHcSNYhNupqOYC5VhWTk/CrInrqbS0vF3czwnnwjwunMrCLI27r2MQhoyJSA0h+M E6oRe5KV27Y8Nvqz2Dky1MvW9K2o1k2ieIN9ZNarn+/V2tB+wFkNBv3qSvsj1LOp+zfH 4Pk5jzNFLAPFXEBS+NVL3eIoTOI0g8sXZBF7a6ZkKWZ8h67/l0qqxF6bjI9f8Q10MfUx UkWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=76e1CFWoS9QTeuaCn91wqJ5TBZiRghj/rFRtHvZVfnk=; b=UuAAwE/XFYAVuDHRfoLyEa6BIKvlnbm+/6DIcb451CR7BdxJDOuBVG+5xGIVk9qZV+ LdxiSIV6uHM8SxNZprsiHq+qqkXSXLjXLFb1X8JHZ+gw1HNb58q/FNWmEVwKExR+UNwj gV+H4XAJ3fFo6mhEYEgSrBSsF6xGZcQ6btJYlkxmFlfpUEOO8NXNXs02XsIA3gqxk2nW mYocm0N6Sv4SVOekObqvhAuqWOwgl0hECrEm4Jk36kQkM1zLOCUzPEK27+dqss542T0z MQYClm8sPT6M8fJ5QfVJfAV9Li7124F2nw6XRTrUKwmpgoN1BsWkqg+/ukQquVIiZTWx 3EaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=neZ6Scwx; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si10677iot.52.2021.08.31.15.56.27; Tue, 31 Aug 2021 15:57:04 -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=@kernel.org header.s=k20201202 header.b=neZ6Scwx; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240877AbhHaTgN (ORCPT + 99 others); Tue, 31 Aug 2021 15:36:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:45912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240895AbhHaTgD (ORCPT ); Tue, 31 Aug 2021 15:36:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E479661059; Tue, 31 Aug 2021 19:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630438508; bh=lJl812jWZ9pp2L8z9pIZmOr/kh8QoAiHqxxqA2KL4To=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=neZ6ScwxRqrUqfakfaz1ENR+ujv8fVP+pl58AfTYWRRiXMVRDZwhDBB/HXYyw2E0b L74BHdggQHv6No/mtajI6bpihIe4mWs7AUgGZy7egETQEfEIShWcV/i0J2fAdU3KPx grw5oA6BWoYuTU4nxOq0FicgX7A7C37/tMKcrjvaj0/Lq6k5qXyp/3vbONv30whu90 5e/4H8FoVmLDPDSrKodXDHftDRJkEQaFEsIVueUIHyXTEhS+SHuXS8SCXqYubmHldT M4sWhTzQZarzdnv0fn76DyAi8MSPZadZN7qG3grX0AxsmEtxkuhDfWTDemdqZMj2F9 twhdvLAptB52g== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C47304007E; Tue, 31 Aug 2021 16:35:04 -0300 (-03) Date: Tue, 31 Aug 2021 16:35:04 -0300 From: Arnaldo Carvalho de Melo To: Riccardo Mancini Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [RFC PATCH v1 17/37] perf evsel: separate missing feature disabling from evsel__open_cpu Message-ID: References: <48138bd2932646dde315505da733c2ca635ad2ee.1629490974.git.rickyman7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48138bd2932646dde315505da733c2ca635ad2ee.1629490974.git.rickyman7@gmail.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Aug 21, 2021 at 11:19:23AM +0200, Riccardo Mancini escreveu: > 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. Thanks, applied as the end result is the same. - Arnaldo > 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 -- - Arnaldo