linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2760/3682] include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer
@ 2022-08-28 16:30 kernel test robot
  2022-09-01  9:45 ` Vlastimil Babka
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-08-28 16:30 UTC (permalink / raw)
  To: Hyeonggon Yoo; +Cc: kbuild-all, Linux Memory Management List, Vlastimil Babka

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	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-next:master 2760/3682] include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer
  2022-08-28 16:30 [linux-next:master 2760/3682] include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer kernel test robot
@ 2022-09-01  9:45 ` Vlastimil Babka
  2022-09-01 11:30   ` Hyeonggon Yoo
  0 siblings, 1 reply; 3+ messages in thread
From: Vlastimil Babka @ 2022-09-01  9:45 UTC (permalink / raw)
  To: kernel test robot, Hyeonggon Yoo; +Cc: kbuild-all, Linux Memory Management List

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")
 );

 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [linux-next:master 2760/3682] include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer
  2022-09-01  9:45 ` Vlastimil Babka
@ 2022-09-01 11:30   ` Hyeonggon Yoo
  0 siblings, 0 replies; 3+ messages in thread
From: Hyeonggon Yoo @ 2022-09-01 11:30 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: kernel test robot, kbuild-all, Linux Memory Management List

On Thu, Sep 01, 2022 at 11:45:05AM +0200, Vlastimil Babka wrote:
> 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")
>  );
> 
>  
> 

Thank you for the fix,
Looks good to me.

-- 
Thanks,
Hyeonggon


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-01 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-28 16:30 [linux-next:master 2760/3682] include/trace/events/kmem.h:54:1: sparse: sparse: restricted gfp_t degrades to integer kernel test robot
2022-09-01  9:45 ` Vlastimil Babka
2022-09-01 11:30   ` Hyeonggon Yoo

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).