From: Vlastimil Babka <vbabka@suse.cz>
To: kernel test robot <lkp@intel.com>, Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 2760/3682] include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer
Date: Thu, 1 Sep 2022 11:45:05 +0200 [thread overview]
Message-ID: <b6c7f090-58ad-738c-a990-238a6023fb13@suse.cz> (raw)
In-Reply-To: <202208290041.W6s9gjtG-lkp@intel.com>
On 8/28/22 18:30, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: 8d0c42c9e80791e8baba2932d2cbd2dcead50d47
> commit: 86431e299ca5a0e16405201535b6060936146215 [2760/3682] mm/slab_common: drop kmem_alloc & avoid dereferencing fields when not using
> config: openrisc-randconfig-s033-20220828 (https://download.01.org/0day-ci/archive/20220829/202208290041.W6s9gjtG-lkp@intel.com/config)
> compiler: or1k-linux-gcc (GCC) 12.1.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.4-39-gce1a6720-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=86431e299ca5a0e16405201535b6060936146215
> git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> git fetch --no-tags linux-next master
> git checkout 86431e299ca5a0e16405201535b6060936146215
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> sparse warnings: (new ones prefixed by >>)
> mm/slab_common.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/kmem.h):
>>> include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer
>
> vim +54 include/trace/events/kmem.h
>
> 53
> > 54 TRACE_EVENT(kmalloc,
> 55
> 56 TP_PROTO(unsigned long call_site,
> 57 const void *ptr,
> 58 size_t bytes_req,
> 59 size_t bytes_alloc,
> 60 gfp_t gfp_flags,
> 61 int node),
> 62
> 63 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
> 64
> 65 TP_STRUCT__entry(
> 66 __field( unsigned long, call_site )
> 67 __field( const void *, ptr )
> 68 __field( size_t, bytes_req )
> 69 __field( size_t, bytes_alloc )
> 70 __field( unsigned long, gfp_flags )
> 71 __field( int, node )
> 72 ),
> 73
> 74 TP_fast_assign(
> 75 __entry->call_site = call_site;
> 76 __entry->ptr = ptr;
> 77 __entry->bytes_req = bytes_req;
> 78 __entry->bytes_alloc = bytes_alloc;
> 79 __entry->gfp_flags = (__force unsigned long)gfp_flags;
> 80 __entry->node = node;
> 81 ),
> 82
> 83 TP_printk("call_site=%pS ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d accounted=%s",
> 84 (void *)__entry->call_site,
> 85 __entry->ptr,
> 86 __entry->bytes_req,
> 87 __entry->bytes_alloc,
> 88 show_gfp_flags(__entry->gfp_flags),
> 89 __entry->node,
> 90 (IS_ENABLED(CONFIG_MEMCG_KMEM) &&
> 91 (__entry->gfp_flags & __GFP_ACCOUNT)) ? "true" : "false")
> 92 );
> 93
Amending the commit with
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 8c6f96604244..243073cfc29d 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -88,7 +88,7 @@ TRACE_EVENT(kmalloc,
show_gfp_flags(__entry->gfp_flags),
__entry->node,
(IS_ENABLED(CONFIG_MEMCG_KMEM) &&
- (__entry->gfp_flags & __GFP_ACCOUNT)) ? "true" : "false")
+ (__entry->gfp_flags & (__force unsigned long)__GFP_ACCOUNT)) ? "true" : "false")
);
next prev parent reply other threads:[~2022-09-01 9:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-28 16:30 kernel test robot
2022-09-01 9:45 ` Vlastimil Babka [this message]
2022-09-01 11:30 ` Hyeonggon Yoo
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=b6c7f090-58ad-738c-a990-238a6023fb13@suse.cz \
--to=vbabka@suse.cz \
--cc=42.hyeyoo@gmail.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
/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