All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Chris Li <sparse@chrisli.org>
Subject: Re: [PATCH v2] tracing: Make is_signed_type() compatible with sparse
Date: Wed, 2 Sep 2026 19:06:32 +0100	[thread overview]
Message-ID: <20260902190632.16e9c66d@pumpkin> (raw)
In-Reply-To: <e75964e2-6b46-4594-8bfb-ce0c0ed620a7@acm.org>

On Wed, 2 Sep 2026 09:44:49 -0700
Bart Van Assche <bvanassche@acm.org> wrote:

> On 9/2/26 9:39 AM, Steven Rostedt wrote:
> > On Wed, 2 Sep 2026 09:31:41 -0700
> > Bart Van Assche <bvanassche@acm.org> wrote:
> >   
> >> $  git grep -nHE '__field.*(blk_opf_t|enum req_op)' include/trace
> >> include/trace/events/f2fs.h:1185:		__field(enum req_op, op)
> >> include/trace/events/f2fs.h:1186:		__field(blk_opf_t, op_flags)
> >> include/trace/events/f2fs.h:1241:		__field(enum req_op,	op)
> >> include/trace/events/f2fs.h:1242:		__field(blk_opf_t,	op_flags)
> >> include/trace/events/jbd2.h:364:		__field(    blk_opf_t,  write_flags		)
> >> include/trace/events/nilfs2.h:207:		    __field_struct(enum req_op, mode)  
> > 
> > Perhaps these should be converted to normal types and assigned with
> > __force. There's no reason to have the value in the ring buffer be of a
> > __bitwise type.  

There are already a shed load (or two) of __force casts in the defines
(further up the same file) that handle some of those fields.
They probably go away if the __field() used u32 and any casts added to
the TP_fast_assign() expansion instead.

> Yikes. Typecasts in general and __force casts in particular should be 
> avoided whenever possible, isn't it?

Anything __bitwise is pretty much going to need an __force cast before the
value can be actually used.
But the syntax should have been __force(type, value) so that the compiler
doesn't see a cast.

David
 
> 
> Bart.


  parent reply	other threads:[~2026-09-02 18:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 17:00 [PATCH v2] tracing: Make is_signed_type() compatible with sparse Bart Van Assche
2026-08-31  0:20 ` Bart Van Assche
2026-08-31 14:27   ` Steven Rostedt
2026-08-31 20:44 ` David Laight
2026-08-31 21:19   ` Bart Van Assche
2026-09-01  8:20     ` David Laight
2026-09-01 18:05       ` Bart Van Assche
2026-09-01 18:45         ` Linus Torvalds
2026-09-01 19:22           ` Bart Van Assche
2026-09-01 19:35             ` Linus Torvalds
2026-09-01 19:38               ` Linus Torvalds
2026-09-01 20:06               ` Bart Van Assche
2026-09-01 20:24                 ` Linus Torvalds
2026-09-01 22:46                   ` Bart Van Assche
2026-09-05  7:48                     ` Uwe Kleine-König
2026-09-01 21:29         ` David Laight
2026-09-01 21:43           ` Bart Van Assche
2026-09-01 21:56             ` Linus Torvalds
2026-09-01 23:25               ` Steven Rostedt
2026-09-02  8:24                 ` David Laight
2026-09-02 13:36                   ` Steven Rostedt
2026-09-02 15:16                     ` David Laight
2026-09-02 16:31                     ` Bart Van Assche
2026-09-02 16:39                       ` Steven Rostedt
2026-09-02 16:44                         ` Bart Van Assche
2026-09-02 16:54                           ` Steven Rostedt
2026-09-02 17:04                             ` Linus Torvalds
2026-09-02 17:24                               ` Steven Rostedt
2026-09-02 18:06                           ` David Laight [this message]
2026-09-02 18:21                             ` Steven Rostedt
2026-09-02 20:50                               ` David Laight
2026-09-02 22:40                                 ` Bart Van Assche
2026-09-02 22:43                                 ` Linus Torvalds
2026-09-02 16:52                         ` Linus Torvalds
2026-09-03 21:50                 ` Vincent Mailhol
2026-09-04  0:26                   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260902190632.16e9c66d@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.