Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp14630rwe; Tue, 23 Aug 2022 17:13:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6AMcNza8JolfYWbA9NKGcofSO29rigORgqXyqy6Yk+LPV3/vN8McPv7xRUV/UU4r0vZeP4 X-Received: by 2002:a05:6a00:1996:b0:52e:b0f7:8c67 with SMTP id d22-20020a056a00199600b0052eb0f78c67mr27178784pfl.20.1661299990994; Tue, 23 Aug 2022 17:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661299990; cv=none; d=google.com; s=arc-20160816; b=USB8DEWde5MFjHYqN5ryhjfe4akzuejROPmF/NJhiD78ng1eMO+eaCZLtfauPvYiYO Gw70cXI+XQtmZXzfRjQGTlZTSaR7cEYnx3nw5GpG51foPqUEQ4VMvN9keb3Hw4LMjMBd ALKd9gyuS1OG+B053q2j8ZJrMQibnF3mXAcWxdLUCiw4RnKKh4vwICFt70nqwOwVUPM5 ua0XUMVJqIWgffoK0jFWMA5K/7uRJLs5axhJ5yv2d1NgsQdRp+epjC6Z9Xd4OupGwTjn 5enjA89UBFy/bIQP051KajI/h20/AXbdtr9C3PTbKESUToaWrw4cupE7eeNvNlCLaXBP /9Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=N8z/G91/SbtVlc37TcfygB6X/h5Jzj+Q20SD9rHN/eM=; b=dypjo3m5tVrVkLtEeb2GYv1dD++oEfyxjqE8UTYroXaSUkfERrdBCu+r7qbV3yptQ+ lJazxrhiG+9CZslVx4Lw/RSGljVsEcwDCJf6VAHz0eRJiJ2c7Cojv+mTBBuVnXNYaAwK yaVRZBisoYhstJAl4hQq2l+WQhS3WpRDSOPPi3WmNJSxu7T3/L/6sHqbFB5eT0DqLaEy 9ho14e/8sxDJAo7VjEz7ispXO7CD3a5Z8gGPbdDPa567hTJaK4GGfsU01zlRcK7E/mdH chUz9EXTRv+0TfHP3dx5zhB2evlaaGGSVFoBooXgRQUvRxaUb0omOXdBGx/AMhReJspk NQ9A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a654005000000b0041b67157cf1si16822178pgp.365.2022.08.23.17.12.59; Tue, 23 Aug 2022 17:13:10 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231835AbiHXAJT (ORCPT + 99 others); Tue, 23 Aug 2022 20:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbiHXAJR (ORCPT ); Tue, 23 Aug 2022 20:09:17 -0400 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC54554678 for ; Tue, 23 Aug 2022 17:09:15 -0700 (PDT) Received: by mail-pj1-f52.google.com with SMTP id x14-20020a17090a8a8e00b001fb61a71d99so3635857pjn.2 for ; Tue, 23 Aug 2022 17:09:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=N8z/G91/SbtVlc37TcfygB6X/h5Jzj+Q20SD9rHN/eM=; b=nR4DwypWavBq1kA84tNznStdKyAj7ULAVa2ys7jRomjK64GP17Hjs77O6VZjcToS9H Di0ayYEXAXFLi3P4fwcJYzkp2pcX9rcPsXR9b1CMWzU1dwKe+0UTbR27FaVsGUNu+Pp1 eiANOPSIKkW42wLgBAo4i0a4KRkrY3WFlao9tN5G82hzzlCkydXeWDf4u0RJxX7Glvtk +LYaqBT2h4jZLShoHlhtfTAToMcViM7RWFbMLPYAsZhrvCiUcJcbc9NzuPM9oiZL3srK r9SG5InuAzfajJhR9mwhCAJubRFW0h9duLqx5XiOD0K7LSareny3FmO9m86SAi3HsXOB kjgw== X-Gm-Message-State: ACgBeo24g17o5lHlOAWUOVEH3g7akeMmQltB8bKy6c5Ee/8kO3375Doj 4mOjSMitp1iqsfgbi7b8z5Y= X-Received: by 2002:a17:90a:c789:b0:1fa:6bc0:77f6 with SMTP id gn9-20020a17090ac78900b001fa6bc077f6mr5714383pjb.1.1661299755208; Tue, 23 Aug 2022 17:09:15 -0700 (PDT) Received: from ?IPV6:2620:0:1000:2514:88b5:5b05:a7c4:f02b? ([2620:0:1000:2514:88b5:5b05:a7c4:f02b]) by smtp.gmail.com with ESMTPSA id m6-20020a1709026bc600b0016c9e5f290esm9115754plt.10.2022.08.23.17.09.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Aug 2022 17:09:14 -0700 (PDT) Message-ID: Date: Tue, 23 Aug 2022 17:09:12 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Bart Van Assche Subject: Re: [for-linus][PATCH 01/10] tracing: Suppress sparse warnings triggered by is_signed_type() To: Linus Torvalds Cc: Rasmus Villemoes , Steven Rostedt , linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Christoph Hellwig , Luc Van Oostenryck , Jens Axboe References: <20220821000737.328590235@goodmis.org> <20220821000844.510643400@goodmis.org> <5700ac75-f6a9-877e-4011-9b314f12b5ab@acm.org> <02daa3d6-2847-d7e0-e23e-411076c6d4db@rasmusvillemoes.dk> <0163b361-14bf-7b4c-751a-14f1a004b1a9@acm.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 On 8/23/22 16:18, Linus Torvalds wrote: > On Tue, Aug 23, 2022 at 3:05 PM Bart Van Assche wrote: >> >> Thank you Rasmus for having shared this information. Since sparse will >> have to be modified anyway, how about extending it such that the bitwise >> attribute can be removed from a type, e.g. via a new no_bitwise >> attribute? > > I think it's actually easier to just make sparse happy. > > Can you try the sparse version at > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/sparse.git > > which I just set up temporarily with some patches of mine. It also > makes that '__cond_acquires' thing work that refcount_dec_and_lock() > uses. > > It does require that kernel change to make > > #define is_signed_type(type) (((type)(-1)) <= (type)0) > > in both places, since only "no bits set" and "all bits set" are > special values for bitwise types. > > Those patches of mine are fairly hacky, and I think Luc would probably > do it differently, but apart from the very last one, they aren't > actively disgusting. Hi Linus, I'm probably doing something wrong but even with sparse commit 658ee8e0f631 ("unrestricted values are unrestricted even after a cast") I see warnings being triggered by users of the is_signed_type() macro, warnings that disappear if I change the definition of the is_signed_type() macro into 0: $ make C=2 fs/f2fs/ #include #include +#include struct trace_array; struct array_buffer; @@ -814,8 +815,6 @@ extern int trace_add_event_call(struct trace_event_call *call); extern int trace_remove_event_call(struct trace_event_call *call); extern int trace_event_get_offsets(struct trace_event_call *call); -#define is_signed_type(type) (((type)(-1)) < (type)1) - int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); int trace_set_clr_event(const char *system, const char *event, int set); int trace_array_set_clr_event(struct trace_array *tr, const char *system, Thanks, Bart.