Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp7042227pxv; Fri, 30 Jul 2021 08:40:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTYsE6vrYWjXodSvA4uI3PgYMo2tnw2lKw/c2fcS7atDvKsYv+G57pk99wYXt4XrTKzsyh X-Received: by 2002:a05:6e02:13b1:: with SMTP id h17mr2233568ilo.213.1627659620067; Fri, 30 Jul 2021 08:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627659620; cv=none; d=google.com; s=arc-20160816; b=tlkn8v4Mlxh2wYT0yQZvTZxjIiVAXld6GOCLzM9fiSZ5iaj/Sdt/eZTGIBTzDXFt1X MtVhAifOFbLejvS4L8es/mGmxQNfH+T4i/XIHbE9oVPfYLio+oeZvsg3v7fe3DxOSDRq TtVeT5kCk1AXd2xo9c06psB6DVz08QUPqqZovRtcyiJppiBJ+qMrm6y14gqiOhFxQLvg Mghtw5E8gH3FBeh2rXm12Nd1olSUI7bwK8aYu4MKLvQXcm6AY5mWx0SrGUwawOZ3OOde L/OgSz4G0l/8qG0YB8/+kdzzRLrkbtu4GhuNLgb5M8Cz/codNIY3HDCArYec9IJLkEXu OCZw== 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=kZSbaF52L+ZtKAly2+OEDW+qlbYF1qp647kUZrXzhSmPMvRZUNr7Y8JPvOze3tjVvS hktUIxqafkrJjnJth+Eu2HsltZuml6CAJ8AjbpGNH+FwuzUJ4ZGwUBMJ/dWOwh+f8+jU i7MO6fxQxekvcyhiicpqAndhhM5IQd4xMKIp2+Kd/K3ojqoV6yC4WLoSNPpDUk2YAm54 2sQ2j7M5teEmVd1nOizgF7GpXAYFzJW7XQg0SnK/ekCnG8SOB2v6Kyzt1epqyb6YwdoG JwulNZrbL0bSoa4Fc2Cq9lv6U95jk320IWn49xj13o2B067T9WlZcceYiKPCQvxZTT2v UIgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qOKc9BC5; 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 p16si2082422ilj.162.2021.07.30.08.40.08; Fri, 30 Jul 2021 08:40:20 -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=qOKc9BC5; 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 S233780AbhG3PiQ (ORCPT + 99 others); Fri, 30 Jul 2021 11:38:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232793AbhG3PfA (ORCPT ); Fri, 30 Jul 2021 11:35:00 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D662C06179C; Fri, 30 Jul 2021 08:34:28 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id u15-20020a05600c19cfb02902501bdb23cdso9479874wmq.0; Fri, 30 Jul 2021 08:34:28 -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=qOKc9BC5zP9dReUvB1bsK31L8KyUvJjYxbUiI091CFdY04bok0qSF1ldvLDq2qqbVd fNq4+twMD+q5LkBapkPEzH0EVmFZV9bnmvAcsvx1W6ST70TO9gRNOoyg+ucqrVJs7AOG 8fXj9JhGdg+x6iwbw5mXgBkhL4qonNUDQcpHSTJe9cejlb+JAqKSz0TP2gkqleadpLjS LWsti7Z39gbpc+BeAC2zMmZFfJT3yOeKnsDyVQLALg5bdTPh+NUwWHBwl1LRDC2uQtD3 fJDNX8u7W07vZ9TwVI4Cet//Z+Cmo1atGY1dlU8FxoqjFx2hviJCHlzTTXV/cavudjYf iYJw== 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=uUjZG66e8EzQMonJQNSPcxNQI+DJlcV96jqeskKspfgD0/ofg4lBzm/sZIJ485qukV zx/giDiJxrDM+BelqHw3WeIViLa3EKcjyvpoKfmE59DVsYq8deIz0XMIjIrtuv9ovxin R2/2E33IxIork8OZM3RZXW9oy0VKkfL7UOGooT3dufPes66Rv11HXFzp5itI4KNurZzp 3g+OPurTddzb0/toAU71ibuXBxKAB8icGF25LH5Bj2MjHLFp5Mws6Ja52qOOTDLVlCbN RuiZDbQOX3lilQG7RzhTJP58Vcy900RB1yOCstnKrhM0ZFJYl7ZFlp9cyAKVhow2A6y4 c+NA== X-Gm-Message-State: AOAM5308FsJHDBkUPLkL15tmNsvIw6O/paBkvOvS7qit1Or6zO3Z27X4 XWKLmluzoTkzd2VJjYmy69I= X-Received: by 2002:a7b:c3ce:: with SMTP id t14mr2921100wmj.50.1627659266938; Fri, 30 Jul 2021 08:34:26 -0700 (PDT) Received: from honeypot.lan ([2001:b07:6456:fd99:ced0:db1c:53e1:191e]) by smtp.googlemail.com with ESMTPSA id v15sm2354727wmj.39.2021.07.30.08.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 08:34:26 -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 v2 05/10] tools: add sparse context/locking annotations in compiler-types.h Date: Fri, 30 Jul 2021 17:34:12 +0200 Message-Id: <58b2f161ce856ec8b499f4dcf60a10adc84651e0.1627657061.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