Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp684505rwe; Fri, 26 Aug 2022 12:16:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR654A2n+QbfFIF3J3wdAHk8mtqkqiiJ1ph0DQZuMXoegPWdB454EbSipBv9FWZQiKhTJejQ X-Received: by 2002:a17:907:d07:b0:72e:ec79:ad0f with SMTP id gn7-20020a1709070d0700b0072eec79ad0fmr6425632ejc.296.1661541364050; Fri, 26 Aug 2022 12:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661541364; cv=none; d=google.com; s=arc-20160816; b=EVBs/8/9RrpAm2MFmPGJSq5StKA1Jk2TQrVcho4vWLjavwgqTRUO6KaCIvDNcfW/VE y6SvPipvif6lCVkGxxuF7rqBaVa1wKXBEuOIsygevZcicaVH8dVhdGbpoRAIiKBZBzE+ GEKJPcJC/w77bzKEjAfb1cRWob0TB0U8yR+ULdXw1r5U6XyEguQEH3BWHCpKcMS3HYqR FLaSe4tf/kuUt7hkOG5o8RtdXSbsvXLaWOj+qsPnX2MkzrSyQivSIyLVmaf6DnFForhU mP3exx25nyQia5hEUtDwR9qfHaPiCyyilXl6+gi+GWAmVJhQ9ROBif66ZVm/a3e5IT+U 91CQ== 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=BrAZD8wCWgdo1Rg8KgZ9dF7bqfKfaRL4L5RXDzuBFTI=; b=W5Bb75qX3pE4pWjTFBkvcFy0yoDS4qXZOu5OOxVF361c5T9V/R11sFD5g21v3xnxj/ 7fl0ZTYQihnGrO4GRfkQ0dxFlD+1bwL6KJs0uDM+sC64FlhV7FSj5ZRHMVVhG6YFOrBx ydLCa3RYw9wXuIzxn/v+AGOv3KA4VRJ11oHxFNSmzl7wB/uSXi6dEbU2RR1thqQS0wqX DWxwYKOZsVWnDdeiS1a2lWRqRY0le0pOQ03pbQ4J2cPYr9CqT78PSxzDOs686ajVFX2a LVCzipe4hOPVWMT85PcD1m7gtgqid5y1GUe1lyPpURwGhBkXkgVlcpv4FDCzZl2sH/YE TOIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=llIVgHln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga26-20020a1709070c1a00b00730d106e832si2041256ejc.248.2022.08.26.12.15.36; Fri, 26 Aug 2022 12:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=llIVgHln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239758AbiHZTNp (ORCPT + 99 others); Fri, 26 Aug 2022 15:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiHZTNl (ORCPT ); Fri, 26 Aug 2022 15:13:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B2B98CB4; Fri, 26 Aug 2022 12:13:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8726DB83117; Fri, 26 Aug 2022 19:13:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3BB3C433D6; Fri, 26 Aug 2022 19:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661541218; bh=JE597L0A8gq9ni57nPTbmMIrbFvwDzfCUptaHqm/PD8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=llIVgHlns//rbdeTSXSMeKly1n1//+21QUco6oCapWf30ICEfWmSE0BwDs9Gppwby Q74BxtWgot+r8SAsvro02yInv4G7BD1J7DfBgWrzuuxnJf85wtrzEQTc9CrfjQk0nH ZUksYFBilRTg59WqWKZ7zC+abisJaposQOz8wqKAfpAtFoHcmC5n4TGDhm80QYQ4oI 16OsjtzdR6aaaxZLsBoeQRWYilvc8My2Mce4OZI4KL1PNn/T1lkiD/JOFKdoocJXRx u5EMdf1RsMU/4kBFqeiOvqT8Tq4ewyvXyAzeewn0qmVbxXgirW8loLME+y3UBKaHxE SE9puroD7iMcg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 36438404A1; Fri, 26 Aug 2022 16:13:35 -0300 (-03) Date: Fri, 26 Aug 2022 16:13:35 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Darren Hart , Davidlohr Bueso , =?iso-8859-1?Q?Andr=E9?= 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 , Martin =?utf-8?B?TGnFoWth?= , 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 Subject: Re: [PATCH v3 15/18] perf mutex: Add thread safety annotations Message-ID: References: <20220824153901.488576-1-irogers@google.com> <20220824153901.488576-16-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Aug 26, 2022 at 10:00:43AM -0700, Ian Rogers escreveu: > On Fri, Aug 26, 2022 at 9:45 AM Arnaldo Carvalho de Melo > wrote: > > > > Em Wed, Aug 24, 2022 at 08:38:58AM -0700, Ian Rogers escreveu: > > > Add thread safety annotations to struct mutex so that when compiled with > > > clang's -Wthread-safety warnings are generated for erroneous lock > > > patterns. NO_THREAD_SAFETY_ANALYSIS is needed for > > > mutex_lock/mutex_unlock as the analysis doesn't under pthread calls. > > > > So even having the guards checking if the attribute is available it > > seems at least clang 11.0 is needed, as the "lockable" arg was > > introduced there: > > > > 37 42.61 fedora:32 : FAIL clang version 10.0.1 (Fedora 10.0.1-3.fc32) > > In file included from /git/perf-6.0.0-rc2/tools/perf/util/../ui/ui.h:5: > > /git/perf-6.0.0-rc2/tools/perf/util/../ui/../util/mutex.h:74:8: error: invalid capability name 'lockable'; capability name must be 'mutex' or 'role' [-Werror,-Wthread-safety-attributes] > > struct LOCKABLE mutex { > > ^ > > /git/perf-6.0.0-rc2/tools/perf/util/../ui/../util/mutex.h:35:44: note: expanded from macro 'LOCKABLE' > > #define LOCKABLE __attribute__((capability("lockable"))) > > > capability("lockable") can just be lockable, the capability > generalization came in a later clang release. > > That is change: > #define LOCKABLE __attribute__((capability("lockable"))) > to: > #define LOCKABLE __attribute__((lockable)) > > and later clangs take the earlier name. Do you want a v5 for this 1 liner? I did it and I'm now testing, thanks. - Arnaldo diff --git a/tools/perf/util/mutex.h b/tools/perf/util/mutex.h index 48a2d87598f0d725..29b5494b213a3fc9 100644 --- a/tools/perf/util/mutex.h +++ b/tools/perf/util/mutex.h @@ -32,7 +32,7 @@ #define PT_GUARDED_BY(x) __attribute__((pt_guarded_by(x))) /* Documents if a type is a lockable type. */ -#define LOCKABLE __attribute__((capability("lockable"))) +#define LOCKABLE __attribute__((lockable)) /* Documents functions that acquire a lock in the body of a function, and do not release it. */ #define EXCLUSIVE_LOCK_FUNCTION(...) __attribute__((exclusive_lock_function(__VA_ARGS__))) - Arnaldo