From: Vasily Averin <vvs@openvz.org>
To: kernel test robot <lkp@intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>
Cc: kbuild-all@lists.01.org, Shakeel Butt <shakeelb@google.com>,
kernel@openvz.org, linux-kernel@vger.kernel.org,
Roman Gushchin <roman.gushchin@linux.dev>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
cgroups@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>,
Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH] percpu: improve percpu_alloc_percpu event trace
Date: Sat, 7 May 2022 17:51:16 +0300 [thread overview]
Message-ID: <e1c09bbb-2c58-a986-c704-1db538da905a@openvz.org> (raw)
In-Reply-To: <202205070420.aAhuqpYk-lkp@intel.com>
On 5/6/22 23:38, kernel test robot wrote:
>>> include/trace/events/percpu.h:11:1: sparse: sparse: cast from restricted gfp_t
>>> include/trace/events/percpu.h:11:1: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned long flags @@ got restricted gfp_t [usertype] gfp_flags @@
> include/trace/events/percpu.h:11:1: sparse: expected unsigned long flags
> include/trace/events/percpu.h:11:1: sparse: got restricted gfp_t [usertype] gfp_flags
> mm/percpu.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/percpu.h):
>>> include/trace/events/percpu.h:11:1: sparse: sparse: cast to restricted gfp_t
>>> include/trace/events/percpu.h:11:1: sparse: sparse: cast to restricted gfp_t
>>> include/trace/events/percpu.h:11:1: sparse: sparse: restricted gfp_t degrades to integer
>>> include/trace/events/percpu.h:11:1: sparse: sparse: restricted gfp_t degrades to integer
> mm/percpu.c:2012:24: sparse: sparse: context imbalance in 'pcpu_balance_free' - unexpected unlock
The same messages are generated for any other gfp_t argument in trace events.
As far as I understand it is not a bug per se,
but trace macros lacks __force attribute in 'gfp_t'-> 'unsigned long' casts.
The same thing happens with mode_t and with some other places using __print_flags()
for __bitwise marked types.
I can make sparse happy, here and elsewhere but it requires a lot of __force attributes.
Is anyone interested in such patches, or can we silently ignore these messages?
Need to add __force attribute to all entries in __def_gfpflag_names array
and add few changes into trace description, below is an example.
> vim +11 include/trace/events/percpu.h
>
> df95e795a72289 Dennis Zhou 2017-06-19 10
> df95e795a72289 Dennis Zhou 2017-06-19 @11 TRACE_EVENT(percpu_alloc_percpu,
> df95e795a72289 Dennis Zhou 2017-06-19 12
> df95e795a72289 Dennis Zhou 2017-06-19 13 TP_PROTO(bool reserved, bool is_atomic, size_t size,
> dee6876db0a7a4 Vasily Averin 2022-05-06 14 size_t align, void *base_addr, int off,
> dee6876db0a7a4 Vasily Averin 2022-05-06 15 void __percpu *ptr, size_t bytes_alloc, gfp_t gfp_flags),
> df95e795a72289 Dennis Zhou 2017-06-19 16
> dee6876db0a7a4 Vasily Averin 2022-05-06 17 TP_ARGS(reserved, is_atomic, size, align, base_addr, off, ptr,
> dee6876db0a7a4 Vasily Averin 2022-05-06 18 bytes_alloc, gfp_flags),
> df95e795a72289 Dennis Zhou 2017-06-19 19
> df95e795a72289 Dennis Zhou 2017-06-19 20 TP_STRUCT__entry(
> df95e795a72289 Dennis Zhou 2017-06-19 21 __field( bool, reserved )
> df95e795a72289 Dennis Zhou 2017-06-19 22 __field( bool, is_atomic )
> df95e795a72289 Dennis Zhou 2017-06-19 23 __field( size_t, size )
> df95e795a72289 Dennis Zhou 2017-06-19 24 __field( size_t, align )
> df95e795a72289 Dennis Zhou 2017-06-19 25 __field( void *, base_addr )
> df95e795a72289 Dennis Zhou 2017-06-19 26 __field( int, off )
> df95e795a72289 Dennis Zhou 2017-06-19 27 __field( void __percpu *, ptr )
> dee6876db0a7a4 Vasily Averin 2022-05-06 28 __field( size_t, bytes_alloc )
> dee6876db0a7a4 Vasily Averin 2022-05-06 29 __field( gfp_t, gfp_flags )
VvS: need to replace gfp_t to unsigned long ...
> df95e795a72289 Dennis Zhou 2017-06-19 30 ),
> df95e795a72289 Dennis Zhou 2017-06-19 31 TP_fast_assign(
> df95e795a72289 Dennis Zhou 2017-06-19 32 __entry->reserved = reserved;
> df95e795a72289 Dennis Zhou 2017-06-19 33 __entry->is_atomic = is_atomic;
> df95e795a72289 Dennis Zhou 2017-06-19 34 __entry->size = size;
> df95e795a72289 Dennis Zhou 2017-06-19 35 __entry->align = align;
> df95e795a72289 Dennis Zhou 2017-06-19 36 __entry->base_addr = base_addr;
> df95e795a72289 Dennis Zhou 2017-06-19 37 __entry->off = off;
> df95e795a72289 Dennis Zhou 2017-06-19 38 __entry->ptr = ptr;
> dee6876db0a7a4 Vasily Averin 2022-05-06 39 __entry->bytes_alloc = bytes_alloc;
> dee6876db0a7a4 Vasily Averin 2022-05-06 40 __entry->gfp_flags = gfp_flags;
VvS: ... and use here (__force unsigned long)
> df95e795a72289 Dennis Zhou 2017-06-19 41 ),
> df95e795a72289 Dennis Zhou 2017-06-19 42
> dee6876db0a7a4 Vasily Averin 2022-05-06 43 TP_printk("reserved=%d is_atomic=%d size=%zu align=%zu base_addr=%p off=%d ptr=%p bytes_alloc=%zu gfp_flags=%s",
> df95e795a72289 Dennis Zhou 2017-06-19 44 __entry->reserved, __entry->is_atomic,
> df95e795a72289 Dennis Zhou 2017-06-19 45 __entry->size, __entry->align,
> dee6876db0a7a4 Vasily Averin 2022-05-06 46 __entry->base_addr, __entry->off, __entry->ptr,
> dee6876db0a7a4 Vasily Averin 2022-05-06 47 __entry->bytes_alloc, show_gfp_flags(__entry->gfp_flags))
> df95e795a72289 Dennis Zhou 2017-06-19 48 );
> df95e795a72289 Dennis Zhou 2017-06-19 49
Thank you,
Vasily Averin
next prev parent reply other threads:[~2022-05-07 14:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 4:46 [PATCH] percpu: improve percpu_alloc_percpu event trace Vasily Averin
2022-05-06 7:52 ` Vasily Averin
2022-05-06 19:29 ` [PATCH v2] " Vasily Averin
2022-05-11 2:33 ` Roman Gushchin
2022-05-11 5:11 ` Vasily Averin
2022-05-11 17:30 ` Roman Gushchin
2022-05-15 22:06 ` Steven Rostedt
2022-05-06 20:38 ` [PATCH] " kernel test robot
2022-05-07 14:51 ` Vasily Averin [this message]
2022-05-07 19:02 ` [PATCH mm] tracing: incorrect gfp_t conversion Vasily Averin
2022-05-07 19:37 ` Andrew Morton
2022-05-07 22:28 ` Vasily Averin
2022-05-07 22:48 ` Andrew Morton
2022-05-07 23:00 ` Andrew Morton
2022-05-08 20:37 ` Matthew Wilcox
2022-05-08 20:51 ` Joe Perches
2022-05-11 7:20 ` [PATCH mm v2] " Vasily Averin
2022-05-15 22:09 ` Steven Rostedt
2022-05-16 20:55 ` Andrew Morton
2022-05-09 21:06 ` [PATCH] percpu: improve percpu_alloc_percpu event trace Steven Rostedt
2022-05-10 4:22 ` Vasily Averin
2022-05-10 14:16 ` 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=e1c09bbb-2c58-a986-c704-1db538da905a@openvz.org \
--to=vvs@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=cl@linux-foundation.org \
--cc=dennis@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=kernel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=shakeelb@google.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
/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 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).