From patchwork Wed Aug 24 15:39:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12953763 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9F66C00140 for ; Wed, 24 Aug 2022 15:42:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239870AbiHXPmK (ORCPT ); Wed, 24 Aug 2022 11:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239867AbiHXPlX (ORCPT ); Wed, 24 Aug 2022 11:41:23 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B14563F3D for ; Wed, 24 Aug 2022 08:41:16 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-33d9f6f4656so52126187b3.21 for ; Wed, 24 Aug 2022 08:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=mq5FPo+AM7Zy4O9tMPHTBeU5z09469F+MvTFiiQ8luk=; b=j28RrTDdPl6USPzEqsb5k4CLTQ0gugdm4nXOjAZa8REs0POvR6h5zY95N71xwsrNm4 bpIPAF06AJOHQMglSzPCkoa/9yruH2UKwLS5s5W/1sf6AWFgd3FUN4te/wPwyfq4Qw6U dcSmtHtUVHfJaGaWqB7uxDYcm/mHEUUTGQuZtT+a6NDLDU0p0ZlzhoD3Ise7LB3xQO0J i79Nal859TkoKhrY3bZZo9H2ITiy0dle61pcaDPmyEkHWAhvStWXT0ixfTAk/3jFH7dC Voa0TdobTGvDKUKB/oQdeDZKd7JMzLQohRthXtV1VdEpgO0DrseG0olwxgEXjuCvx8Ku +gqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=mq5FPo+AM7Zy4O9tMPHTBeU5z09469F+MvTFiiQ8luk=; b=l5+KDLyNu9igaz4sHiqGSPO98wyjiI7P8qZtZorkQm+bEYIFVDXgi8e0bqbI7oF5k3 jmqVyEFFA+P7QwcsZcR+eToGwHfqr7VrRq35qPHtd7fAsJhfyP4203mFGZGgELyg1ol4 o8NP5LT5CYdf3HkFCadMaSw96+SY5qmRXx9t+E5GLEy0Vm6ikdVm2XQ9+U91YLhQHoGY JWvfp/gULZGvcxipUAG+0pXKN+z3OFVEIHYZ6DL+jqJ03Ke4QhyA8lFXYxqyxiV/Nry0 rWN87NbzsxGC8DLtG0n1HVzilhwQJHWCHAIhDy9QcQaeiGIfZBUOQZ+YD44g++iPtECa Ibbw== X-Gm-Message-State: ACgBeo1GNtxyF2mEXMPCaIFvvmsHlkhCn/ed8OKd9zIbHMKM8k8BIUDJ EJ37J/HP/eHt3thSZX0gEgVFBEu9w+Pn X-Google-Smtp-Source: AA6agR5HenVVA08d8hNFo9P64Hkt7PhicsOZTG74PjiVurZ5ytVEd0pKdh/s/Eym5MGmf/WFsbX0NCO/Fs8I X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:ab82:a348:500d:1fc4]) (user=irogers job=sendgmr) by 2002:a25:2f58:0:b0:695:8490:a2a with SMTP id v85-20020a252f58000000b0069584900a2amr18998326ybv.138.1661355675365; Wed, 24 Aug 2022 08:41:15 -0700 (PDT) Date: Wed, 24 Aug 2022 08:39:00 -0700 In-Reply-To: <20220824153901.488576-1-irogers@google.com> Message-Id: <20220824153901.488576-18-irogers@google.com> Mime-Version: 1.0 References: <20220824153901.488576-1-irogers@google.com> X-Mailer: git-send-email 2.37.2.609.g9ff673ca1a-goog Subject: [PATCH v3 17/18] perf top: Fixes for thread safety analysis From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Darren Hart , Davidlohr Bueso , " =?utf-8?q?Andr=C3=A9_Almeida?= " , Nathan Chancellor , Nick Desaulniers , Tom Rix , Weiguo Li , Athira Rajeev , Thomas Richter , Ravi Bangoria , Dario Petrillo , Hewenliang , yaowenbin , Wenyu Liu , Song Liu , Andrii Nakryiko , Dave Marchevsky , Leo Yan , Kim Phillips , Pavithra Gurushankar , Alexandre Truong , Quentin Monnet , William Cohen , Andres Freund , Adrian Hunter , " =?utf-8?q?Martin_Li=C5=A1ka?= " , Colin Ian King , James Clark , Fangrui Song , Stephane Eranian , Kajol Jain , Alexey Bayduraev , Riccardo Mancini , Andi Kleen , Masami Hiramatsu , Zechuan Chen , Jason Wang , Christophe JAILLET , Remi Bernon , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Cc: Ian Rogers Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Add annotations to describe lock behavior. Signed-off-by: Ian Rogers --- tools/perf/builtin-top.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 5af3347eedc1..e89208b4ad4b 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -196,6 +196,7 @@ static void perf_top__record_precise_ip(struct perf_top *top, struct hist_entry *he, struct perf_sample *sample, struct evsel *evsel, u64 ip) + EXCLUSIVE_LOCKS_REQUIRED(he->hists->lock) { struct annotation *notes; struct symbol *sym = he->ms.sym; @@ -724,13 +725,13 @@ static void *display_thread(void *arg) static int hist_iter__top_callback(struct hist_entry_iter *iter, struct addr_location *al, bool single, void *arg) + EXCLUSIVE_LOCKS_REQUIRED(iter->he->hists->lock) { struct perf_top *top = arg; - struct hist_entry *he = iter->he; struct evsel *evsel = iter->evsel; if (perf_hpp_list.sym && single) - perf_top__record_precise_ip(top, he, iter->sample, evsel, al->addr); + perf_top__record_precise_ip(top, iter->he, iter->sample, evsel, al->addr); hist__account_cycles(iter->sample->branch_stack, al, iter->sample, !(top->record_opts.branch_stack & PERF_SAMPLE_BRANCH_ANY),