* [PATCH] xfs: fix sparse checker warnings on kmem tracepoints
@ 2019-12-18 22:18 Eric Sandeen
2019-12-18 23:11 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2019-12-18 22:18 UTC (permalink / raw)
To: linux-xfs
Sparse checker doesn't like kmem.c tracepoints:
kmem.c:18:32: warning: incorrect type in argument 2 (different base types)
kmem.c:18:32: expected int [signed] flags
kmem.c:18:32: got restricted xfs_km_flags_t [usertype] flags
So take an xfs_km_flags_t, and cast it to an int when we print it.
Fixes: 0ad95687c3ad ("xfs: add kmem allocation trace points")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index c13bb3655e48..dd165b6d2289 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -3545,11 +3545,11 @@ TRACE_EVENT(xfs_pwork_init,
)
DECLARE_EVENT_CLASS(xfs_kmem_class,
- TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
+ TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip),
TP_ARGS(size, flags, caller_ip),
TP_STRUCT__entry(
__field(ssize_t, size)
- __field(int, flags)
+ __field(xfs_km_flags_t, flags)
__field(unsigned long, caller_ip)
),
TP_fast_assign(
@@ -3559,13 +3559,13 @@ DECLARE_EVENT_CLASS(xfs_kmem_class,
),
TP_printk("size %zd flags 0x%x caller %pS",
__entry->size,
- __entry->flags,
+ (int)__entry->flags,
(char *)__entry->caller_ip)
)
#define DEFINE_KMEM_EVENT(name) \
DEFINE_EVENT(xfs_kmem_class, name, \
- TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
+ TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip), \
TP_ARGS(size, flags, caller_ip))
DEFINE_KMEM_EVENT(kmem_alloc);
DEFINE_KMEM_EVENT(kmem_alloc_io);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix sparse checker warnings on kmem tracepoints
2019-12-18 22:18 [PATCH] xfs: fix sparse checker warnings on kmem tracepoints Eric Sandeen
@ 2019-12-18 23:11 ` Darrick J. Wong
2019-12-18 23:27 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2019-12-18 23:11 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-xfs
On Wed, Dec 18, 2019 at 04:18:16PM -0600, Eric Sandeen wrote:
> Sparse checker doesn't like kmem.c tracepoints:
>
> kmem.c:18:32: warning: incorrect type in argument 2 (different base types)
> kmem.c:18:32: expected int [signed] flags
> kmem.c:18:32: got restricted xfs_km_flags_t [usertype] flags
>
> So take an xfs_km_flags_t, and cast it to an int when we print it.
>
> Fixes: 0ad95687c3ad ("xfs: add kmem allocation trace points")
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks ok insofar as cem will eventually kill these off, right?
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
>
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index c13bb3655e48..dd165b6d2289 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -3545,11 +3545,11 @@ TRACE_EVENT(xfs_pwork_init,
> )
>
> DECLARE_EVENT_CLASS(xfs_kmem_class,
> - TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
> + TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip),
> TP_ARGS(size, flags, caller_ip),
> TP_STRUCT__entry(
> __field(ssize_t, size)
> - __field(int, flags)
> + __field(xfs_km_flags_t, flags)
> __field(unsigned long, caller_ip)
> ),
> TP_fast_assign(
> @@ -3559,13 +3559,13 @@ DECLARE_EVENT_CLASS(xfs_kmem_class,
> ),
> TP_printk("size %zd flags 0x%x caller %pS",
> __entry->size,
> - __entry->flags,
> + (int)__entry->flags,
> (char *)__entry->caller_ip)
> )
>
> #define DEFINE_KMEM_EVENT(name) \
> DEFINE_EVENT(xfs_kmem_class, name, \
> - TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
> + TP_PROTO(ssize_t size, xfs_km_flags_t flags, unsigned long caller_ip), \
> TP_ARGS(size, flags, caller_ip))
> DEFINE_KMEM_EVENT(kmem_alloc);
> DEFINE_KMEM_EVENT(kmem_alloc_io);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix sparse checker warnings on kmem tracepoints
2019-12-18 23:11 ` Darrick J. Wong
@ 2019-12-18 23:27 ` Eric Sandeen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2019-12-18 23:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On 12/18/19 5:11 PM, Darrick J. Wong wrote:
> On Wed, Dec 18, 2019 at 04:18:16PM -0600, Eric Sandeen wrote:
>> Sparse checker doesn't like kmem.c tracepoints:
>>
>> kmem.c:18:32: warning: incorrect type in argument 2 (different base types)
>> kmem.c:18:32: expected int [signed] flags
>> kmem.c:18:32: got restricted xfs_km_flags_t [usertype] flags
>>
>> So take an xfs_km_flags_t, and cast it to an int when we print it.
>>
>> Fixes: 0ad95687c3ad ("xfs: add kmem allocation trace points")
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>
> Looks ok insofar as cem will eventually kill these off, right?
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Oh, I guess so - if you want to just wait for that and drop this
patch, it's fine.
-Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-18 23:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 22:18 [PATCH] xfs: fix sparse checker warnings on kmem tracepoints Eric Sandeen
2019-12-18 23:11 ` Darrick J. Wong
2019-12-18 23:27 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).