Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1358945pxb; Fri, 20 Aug 2021 03:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwU4xIB4+4I0/KD2ycEh1F4IJB+W6UUwiTgwZTNnVc3npceSKmfC/J6rRS//l9drLU0bmWl X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr21414854ejc.119.1629456992356; Fri, 20 Aug 2021 03:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629456992; cv=none; d=google.com; s=arc-20160816; b=N1McXahT2ysz7pbTg4JSf2EFMwYFvv50sm9Oou+wpUqQDjy7uXQMRvjTo5rZWgmsIG Vb1volmJ4VkkKopD/GjfzIW/MqGrdunerAu3Kts/BsEmwCYghaem12DjhJJTHL4fLW9F NDAd7KPx/BrBaYHO3A5nTa+71k5BiGrizEMG2Yryw8MzObXmbpswuJdsMti4l/nnPmQR 6xFaKXjkGDZBX4Sh/0urdva+bvxPZZeL1S2S2WH1qZdhKNsQhLCmptthq71rfRLnRh0i 5CNhcGnp2O2e1DPkkYdy3H/dWma/V/hIbUwYRwfh1oXS7YYJLU3xGhaDNEGCC6XroI+J +4sA== 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=5xCOtqv2tenj2Od+wPZTYC3Z57feU6O1gHbiYEDCzbQ=; b=MgP0pJjfJ1OzB9IN6R9wCOpTPp7ww9I5u26bWBVBreIttJTACubBrkxoiVAc1TvFSi +0Lcbd+cPsJ1DtBTTjtCGyPhyQGrP+g03rqT5RMjHZ/fHrlb47PgdGySOmHojr0IHC3N t4egzEshdRX1QhEmP57ScPwF5nRPS7F05dWLiYDE99CE+1vyld0KV3heZMIiBtRmrn2A PFilUbxJaDEQqqaYwbAWz1cIHaEypyhd7YUYdyou/5YRxb2hs3f5u39Pb/hrDE5SWg5O 1CEtJvvZGTYRDgjvZGFbCTcZ5Nm+BEfzEy4yPISzSooniHDm/SJhLzNx/MajBi8J/edB 33cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B+o+G6sz; 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 hr1si8675351ejc.424.2021.08.20.03.56.09; Fri, 20 Aug 2021 03:56:32 -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=B+o+G6sz; 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 S239489AbhHTKzG (ORCPT + 99 others); Fri, 20 Aug 2021 06:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239298AbhHTKy4 (ORCPT ); Fri, 20 Aug 2021 06:54:56 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E23B6C061757; Fri, 20 Aug 2021 03:54:17 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id b7so13425774edu.3; Fri, 20 Aug 2021 03:54:17 -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=5xCOtqv2tenj2Od+wPZTYC3Z57feU6O1gHbiYEDCzbQ=; b=B+o+G6szk+eRXpavZ6YUPf5bT8d1QerRz7hukoTTR96Cha1HLuXA2x50p5luQzbaRz nS9IwykomRee5HAVgPZrjd2UrVSWA+pSD3Gnq6S7aK4HjxPzoiY7aDSoEA5Ot/uBHIpv NLUUM7ALis4QTO7dA2h0gZ+lfNfpkZtmjaytbFESeRPBwURRVmGmzK6SvO+cjpUQKzr1 W3YO1fXRlVVFsHL4alRPkYKOtkRnbyQONi4I+WgeKoKyWNtam2ghTOiHGzKP69FuGMEY yAUBodMpuDIan7/wTBgWqD9nqy/sHRghf0FFTSQ/drGPYoc4AlOY9wq0efeGf1cvuMtm eSuA== 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=5xCOtqv2tenj2Od+wPZTYC3Z57feU6O1gHbiYEDCzbQ=; b=FZdhETE+uoT0o0zUukVVl1FoHGA0boLU9AaGZSjBETnfNwZobuvtDbqjvJvXciomKl QacqHJU5afNnuJxG9xchsz6RXz6mnADdKrX+c2oxaV61K4XiipzP992vBiWeQcJYNhGT WP7dQqyHReqBONSH8fHjaHm2399DeN/WmdvDLKq0su/VvtRQrZvB6NZG44KrURwv+aHP 55G0BhwZ5U5KFedth0UISjbBlmKSheWzCgxc9I79TjxhqrzwW/Tr9HAPQIgTaq6DH//z Usya3zuoffMrypc9KOdQkMvAIGTH0gQHXTgQjG0TKmKlavGH7qFhCuDJhvalDZGmf1o/ B3ZQ== X-Gm-Message-State: AOAM531cM78+5O9nxc2qI1TPWWBFJRc1TxMdrlVdFE9m+2QO++if2RxT ixBZWPAu0VLZnKHPhoTfZ6Fonx04Ff6U4llQwgc= X-Received: by 2002:aa7:c890:: with SMTP id p16mr21194998eds.280.1629456856538; Fri, 20 Aug 2021 03:54:16 -0700 (PDT) Received: from honeypot.epfl.ch (mob-176-243-199-7.net.vodafone.it. [176.243.199.7]) by smtp.googlemail.com with ESMTPSA id g29sm3451459edf.31.2021.08.20.03.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Aug 2021 03:54:16 -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, Alexey Bayduraev , Riccardo Mancini Subject: [RFC PATCH v3 05/15] tools: add sparse context/locking annotations in compiler-types.h Date: Fri, 20 Aug 2021 12:53:51 +0200 Message-Id: <6b8c28e268003ca2276c0d018248e27442fbbf49.1629454773.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 patch copies sparse context/locking annotations from include/compiler-types.h to tools/include/compiler-types.h. Signed-off-by: Riccardo Mancini --- tools/include/linux/compiler_types.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/include/linux/compiler_types.h b/tools/include/linux/compiler_types.h index feea09029f610120..24ae3054f304f274 100644 --- a/tools/include/linux/compiler_types.h +++ b/tools/include/linux/compiler_types.h @@ -13,6 +13,24 @@ #define __has_builtin(x) (0) #endif +#ifdef __CHECKER__ +/* context/locking */ +# define __must_hold(x) __attribute__((context(x,1,1))) +# define __acquires(x) __attribute__((context(x,0,1))) +# define __releases(x) __attribute__((context(x,1,0))) +# define __acquire(x) __context__(x,1) +# define __release(x) __context__(x,-1) +# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) +#else /* __CHECKER__ */ +/* context/locking */ +# define __must_hold(x) +# define __acquires(x) +# define __releases(x) +# define __acquire(x) (void)0 +# define __release(x) (void)0 +# define __cond_lock(x,c) (c) +#endif /* __CHECKER__ */ + /* Compiler specific macros. */ #ifdef __GNUC__ #include -- 2.31.1