Re: kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 8 Nov 2023 13:55:21 +0800
kernel test robot <lkp@xxxxxxxxx> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   305230142ae0637213bf6e04f6d9f10bbcb74af8
> commit: c0a581d7126c0bbc96163276f585fd7b4e4d8d0e tracing: Disable interrupt or preemption before acquiring arch_spinlock_t
> date:   1 year, 1 month ago
> config: loongarch-randconfig-r123-20231107 (https://download.01.org/0day-ci/archive/20231108/202311081340.3k72KKdg-lkp@xxxxxxxxx/config)
> compiler: loongarch64-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20231108/202311081340.3k72KKdg-lkp@xxxxxxxxx/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311081340.3k72KKdg-lkp@xxxxxxxxx/
> 
> sparse warnings: (new ones prefixed by >>)
>    kernel/trace/trace.c:406:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct trace_export **list @@     got struct trace_export [noderef] __rcu ** @@
>    kernel/trace/trace.c:406:28: sparse:     expected struct trace_export **list
>    kernel/trace/trace.c:406:28: sparse:     got struct trace_export [noderef] __rcu **
>    kernel/trace/trace.c:420:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct trace_export **list @@     got struct trace_export [noderef] __rcu ** @@
>    kernel/trace/trace.c:420:33: sparse:     expected struct trace_export **list
>    kernel/trace/trace.c:420:33: sparse:     got struct trace_export [noderef] __rcu **
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got unsigned int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got unsigned int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got unsigned int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got unsigned int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got unsigned int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got unsigned int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got unsigned int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got unsigned int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got int [noderef] __percpu * @@  
>    kernel/trace/trace.c:2430:9: sparse:     expected void *ptr
>    kernel/trace/trace.c:2430:9: sparse:     got int [noderef] __percpu *
> >> kernel/trace/trace.c:2430:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *ptr @@     got int [noderef] __percpu * @@  


> 
> vim +2430 kernel/trace/trace.c
> 
>   2410	
>   2411	static int trace_save_cmdline(struct task_struct *tsk)
>   2412	{
>   2413		unsigned tpid, idx;
>   2414	
>   2415		/* treat recording of idle task as a success */
>   2416		if (!tsk->pid)
>   2417			return 1;
>   2418	
>   2419		tpid = tsk->pid & (PID_MAX_DEFAULT - 1);
>   2420	
>   2421		/*
>   2422		 * It's not the end of the world if we don't get
>   2423		 * the lock, but we also don't want to spin
>   2424		 * nor do we want to disable interrupts,
>   2425		 * so if we miss here, then better luck next time.
>   2426		 *
>   2427		 * This is called within the scheduler and wake up, so interrupts
>   2428		 * had better been disabled and run queue lock been held.
>   2429		 */
> > 2430		lockdep_assert_preemption_disabled();  

The above is a generic lockdep utility. Sounds to me that this is a bug in
the loongarch code that doesn't handle this properly.

-- Steve


>   2431		if (!arch_spin_trylock(&trace_cmdline_lock))
>   2432			return 0;
>   2433	
>   2434		idx = savedcmd->map_pid_to_cmdline[tpid];
>   2435		if (idx == NO_CMDLINE_MAP) {
>   2436			idx = (savedcmd->cmdline_idx + 1) % savedcmd->cmdline_num;
>   2437	
>   2438			savedcmd->map_pid_to_cmdline[tpid] = idx;
>   2439			savedcmd->cmdline_idx = idx;
>   2440		}
>   2441	
>   2442		savedcmd->map_cmdline_to_pid[idx] = tsk->pid;
>   2443		set_cmdline(idx, tsk->comm);
>   2444	
>   2445		arch_spin_unlock(&trace_cmdline_lock);
>   2446	
>   2447		return 1;
>   2448	}
>   2449	
> 




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux