Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4767974pxb; Tue, 31 Aug 2021 12:51:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywb27e/ORpWAyyqk1nguY9NWdCm8PpF5lsSFOEEixyH5OHVDvVj3FtbKN8XK9Xumupb6HR X-Received: by 2002:a92:c9cf:: with SMTP id k15mr21878473ilq.125.1630439462724; Tue, 31 Aug 2021 12:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630439462; cv=none; d=google.com; s=arc-20160816; b=0AuPmNbEB9zt2TZAapvQTkisKqK4X/gqSqSqC3lDkT62ZlwY5dFMSe3oc40i5xxD87 8WSUdyGqp/fNo4KGsIO8zsIuJ4zogglCU+yb2PzYBVQgBh5yjtX2Dgn7NmHwWxpzcuOT 7eaBmyrCulCMkcY0qwHmoWAsXnPFxtQAnbeGmr9SbnJwlIiGmnsfRT567E4YpHHgEWS9 J0YeL/sGbIijQaj2KF8kwWMjx69Np31KUHb7pN7jG9hjsZQh59FKIXjXJ9boKdT3dhKG 8oDjHe7jK7jVFeen8YO8rClL4TSbkPIb2FTM2IbYb3MHo1ElGdz5h5flYtCnefqqki6C Ma0Q== 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=qyV1tDyUj1EKzfunB4d7IyvHk030arLOmFMFiNu/TTk=; b=FbFDuqEI+7NIYfRN3CZKp1XEz5l+ohEtPwgmVUjWw39JnwFkrnFTxBIS7Zkd5NuE26 OA3/JP8dBSZlsQlN+o9y3xMorE08mvfvQFCdMaZzJZBXWk9x3We65t+neSiaYwdeGnEc Nf2V/fTonKW3aBMTXGgzAY3iZx6FtifjyH7kBrU1on9sJ6sv26WDm/8UIa4fdv1bgsXG 3YJ/EI+/qPEWGbzzuE+XNs0a0Jv0z431Jf+9dNEpjtweRPTKkyL9tWUj2NKbogyEWm9b Msyt0ouxPgKBS4b0wi30IC4PbYVc6WIFNa0n9kvb5D5BiLW4x1nA10LnYP6Pc0GqoLXf 27NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lyZ5Ln5L; 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 z26si17000473ioc.55.2021.08.31.12.50.51; Tue, 31 Aug 2021 12:51:02 -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=lyZ5Ln5L; 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 S240991AbhHaTsl (ORCPT + 99 others); Tue, 31 Aug 2021 15:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:56096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232016AbhHaTsj (ORCPT ); Tue, 31 Aug 2021 15:48:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADC9D60FC3; Tue, 31 Aug 2021 19:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630439263; bh=6qWa4iDpk/xVe1Ft/BT0+AL0cYx8U0yvB8CfDL4WQfE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lyZ5Ln5LBqUbTkqlMgcgGVtZWzWO+JDaM6fVY/djKM2f7F+jDsm/7HRWLsOuhi/JI 1T9udOjykm/dL/+ZSsPysnLu/bAbr+LJQjsHeJjfZzH1DKgnilKImOKgXOAClzRKNM xBGzMqet3qI0XD20LBWNneMR6PAeyueT+mJcGpY1bXwNDKyY94I2eTO5UjhjOoNRU1 0++gaNdfRrAQCWwRocf2okajwLfynB58qc1MOjYuR/xeEHmkz6RM+BZQqgxkyUen2v swRUq6mJHx2XlXoH03a4NoXKrsyknOo1SfTVh6K/5t4mdo0cVUZfiCcMruON/RJXvA NDBSHIdqdYANA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 329C24007E; Tue, 31 Aug 2021 16:47:41 -0300 (-03) Date: Tue, 31 Aug 2021 16:47:41 -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 22/37] perf evsel: move test_attr__open to success path in evsel__open_cpu Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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:28AM +0200, Riccardo Mancini escreveu: > test_attr__open ignores the fd if -1, therefore it is safe to move it to > the success path (fd >= 0). Nicely spotted, applied. - Arnaldo > Signed-off-by: Riccardo Mancini > --- > tools/perf/util/evsel.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index a1a88607fd59efcb..d2b0391569286080 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -2011,11 +2011,6 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, > > bpf_counter__install_pe(evsel, cpu, fd); > > - if (unlikely(test_attr__enabled)) { > - test_attr__open(&evsel->core.attr, pid, cpus->map[cpu], > - fd, group_fd, evsel->open_flags); > - } > - > if (fd < 0) { > err = -errno; > > @@ -2024,6 +2019,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus, > goto try_fallback; > } > > + if (unlikely(test_attr__enabled)) { > + test_attr__open(&evsel->core.attr, pid, cpus->map[cpu], > + fd, group_fd, evsel->open_flags); > + } > + > pr_debug2_peo(" = %d\n", fd); > > if (evsel->bpf_fd >= 0) { > -- > 2.31.1 -- - Arnaldo