All of lore.kernel.org
 help / color / mirror / Atom feed
* [norov:smp4 9/15] kernel/smp.c:832:17: warning: this 'if' clause does not guard...
@ 2025-06-26  5:00 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-06-26  5:00 UTC (permalink / raw)
  To: Yury Norov; +Cc: oe-kbuild-all

tree:   https://github.com/norov/linux smp4
head:   f4b86696cf011ee576d79e4ea53b0fb3ebea6017
commit: 21f3b4c48b93669f2e9398f292b64ed2ffb43c34 [9/15] reverse logic save indent
config: arc-randconfig-002-20250626 (https://download.01.org/0day-ci/archive/20250626/202506261231.DO8WZ5ap-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250626/202506261231.DO8WZ5ap-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506261231.DO8WZ5ap-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/smp.c: In function 'smp_call_function_many_cond':
   kernel/smp.c:832:84: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     832 |                 if (!llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu)));
         |                                                                                    ^
>> kernel/smp.c:832:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     832 |                 if (!llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu)));
         |                 ^~
   kernel/smp.c:833:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     833 |                         continue;
         |                         ^~~~~~~~


vim +/if +832 kernel/smp.c

   771	
   772	static void smp_call_function_many_cond(const struct cpumask *mask,
   773						smp_call_func_t func, void *info,
   774						unsigned int scf_flags,
   775						smp_cond_func_t cond_func)
   776	{
   777		int cpu, last_cpu, this_cpu = smp_processor_id();
   778		struct call_function_data *cfd;
   779		bool wait = scf_flags & SCF_WAIT;
   780		int nr_cpus = 0;
   781		bool run_remote = false;
   782	
   783		lockdep_assert_preemption_disabled();
   784	
   785		/*
   786		 * Can deadlock when called with interrupts disabled.
   787		 * We allow cpu's that are not yet online though, as no one else can
   788		 * send smp call function interrupt to this cpu and as such deadlocks
   789		 * can't happen.
   790		 */
   791		if (cpu_online(this_cpu) && !oops_in_progress &&
   792		    !early_boot_irqs_disabled)
   793			lockdep_assert_irqs_enabled();
   794	
   795		/*
   796		 * When @wait we can deadlock when we interrupt between llist_add() and
   797		 * arch_send_call_function_ipi*(); when !@wait we can deadlock due to
   798		 * csd_lock() on because the interrupt context uses the same csd
   799		 * storage.
   800		 */
   801		WARN_ON_ONCE(!in_task());
   802	
   803		/* Check if we need remote execution, i.e., any CPU excluding this one. */
   804		if (cpumask_any_and_but(mask, cpu_online_mask, this_cpu) < nr_cpu_ids)
   805			goto local_exec;
   806	
   807		run_remote = true;
   808		cfd = this_cpu_ptr(&cfd_data);
   809		cpumask_and(cfd->cpumask, mask, cpu_online_mask);
   810		__cpumask_clear_cpu(this_cpu, cfd->cpumask);
   811	
   812		cpumask_clear(cfd->cpumask_ipi);
   813		for_each_cpu(cpu, cfd->cpumask) {
   814			call_single_data_t *csd = per_cpu_ptr(cfd->csd, cpu);
   815	
   816			if (cond_func && !cond_func(cpu, info)) {
   817				__cpumask_clear_cpu(cpu, cfd->cpumask);
   818				continue;
   819			}
   820	
   821			csd_lock(csd);
   822			if (wait)
   823				csd->node.u_flags |= CSD_TYPE_SYNC;
   824			csd->func = func;
   825			csd->info = info;
   826	#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
   827			csd->node.src = smp_processor_id();
   828			csd->node.dst = cpu;
   829	#endif
   830			trace_csd_queue_cpu(cpu, _RET_IP_, func, csd);
   831	
 > 832			if (!llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu)));
   833				continue;
   834	
   835			__cpumask_set_cpu(cpu, cfd->cpumask_ipi);
   836			nr_cpus++;
   837			last_cpu = cpu;
   838		}
   839	
   840		/*
   841		 * Choose the most efficient way to send an IPI. Note that the
   842		 * number of CPUs might be zero due to concurrent changes to the
   843		 * provided mask.
   844		 */
   845		if (nr_cpus == 1)
   846			send_call_function_single_ipi(last_cpu);
   847		else if (likely(nr_cpus > 1))
   848			send_call_function_ipi_mask(cfd->cpumask_ipi);
   849		else
   850			run_remote = false;
   851	
   852	local_exec:
   853		/* Check if we need local execution. */
   854		if ((scf_flags & SCF_RUN_LOCAL) && cpumask_test_cpu(this_cpu, mask) &&
   855		    (!cond_func || cond_func(this_cpu, info))) {
   856			unsigned long flags;
   857	
   858			local_irq_save(flags);
   859			csd_do_func(func, info, NULL);
   860			local_irq_restore(flags);
   861		}
   862	
   863		if (!run_remote || !wait)
   864			return;
   865	
   866		for_each_cpu(cpu, cfd->cpumask) {
   867			call_single_data_t *csd;
   868	
   869			csd = per_cpu_ptr(cfd->csd, cpu);
   870			csd_lock_wait(csd);
   871		}
   872	}
   873	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-26  5:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-26  5:00 [norov:smp4 9/15] kernel/smp.c:832:17: warning: this 'if' clause does not guard kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.