lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Apr 2024 02:49:02 +0800
From: kernel test robot <lkp@...el.com>
To: Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Cc: oe-kbuild-all@...ts.linux.dev, Peter Zijlstra <peterz@...radead.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Shrikanth Hegde <sshegde@...ux.ibm.com>,
	Valentin Schneider <vschneid@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH 3/5] sched: Split out kernel/sched/numa_balancing.c from
 kernel/sched/fair.c

Hi Ingo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/sched/core]
[also build test WARNING on next-20240405]
[cannot apply to linux/master linus/master peterz-queue/sched/core v6.9-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ingo-Molnar/sched-Split-out-kernel-sched-syscalls-c-from-kernel-sched-core-c/20240407-164646
base:   tip/sched/core
patch link:    https://lore.kernel.org/r/20240407084319.1462211-4-mingo%40kernel.org
patch subject: [PATCH 3/5] sched: Split out kernel/sched/numa_balancing.c from kernel/sched/fair.c
config: x86_64-randconfig-121-20240408 (https://download.01.org/0day-ci/archive/20240408/202404080242.0PsxhOlk-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240408/202404080242.0PsxhOlk-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404080242.0PsxhOlk-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> kernel/sched/numa_balancing.c:1654:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct task_struct *tsk @@     got struct task_struct [noderef] __rcu * @@
   kernel/sched/numa_balancing.c:1654:13: sparse:     expected struct task_struct *tsk
   kernel/sched/numa_balancing.c:1654:13: sparse:     got struct task_struct [noderef] __rcu *
   kernel/sched/numa_balancing.c: note: in included file (through include/linux/mmzone.h, include/linux/memory-tiers.h):
   include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false
   include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false
   kernel/sched/numa_balancing.c:1600:9: sparse: sparse: context imbalance in 'task_numa_placement' - different lock contexts for basic block

vim +1654 kernel/sched/numa_balancing.c

  1619	
  1620	static void task_numa_group(struct task_struct *p, int cpupid, int flags,
  1621				int *priv)
  1622	{
  1623		struct numa_group *grp, *my_grp;
  1624		struct task_struct *tsk;
  1625		bool join = false;
  1626		int cpu = cpupid_to_cpu(cpupid);
  1627		int i;
  1628	
  1629		if (unlikely(!deref_curr_numa_group(p))) {
  1630			unsigned int size = sizeof(struct numa_group) +
  1631					    NR_NUMA_HINT_FAULT_STATS *
  1632					    nr_node_ids * sizeof(unsigned long);
  1633	
  1634			grp = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
  1635			if (!grp)
  1636				return;
  1637	
  1638			refcount_set(&grp->refcount, 1);
  1639			grp->active_nodes = 1;
  1640			grp->max_faults_cpu = 0;
  1641			spin_lock_init(&grp->lock);
  1642			grp->gid = p->pid;
  1643	
  1644			for (i = 0; i < NR_NUMA_HINT_FAULT_STATS * nr_node_ids; i++)
  1645				grp->faults[i] = p->numa_faults[i];
  1646	
  1647			grp->total_faults = p->total_numa_faults;
  1648	
  1649			grp->nr_tasks++;
  1650			rcu_assign_pointer(p->numa_group, grp);
  1651		}
  1652	
  1653		rcu_read_lock();
> 1654		tsk = READ_ONCE(cpu_rq(cpu)->curr);
  1655	
  1656		if (!cpupid_match_pid(tsk, cpupid))
  1657			goto no_join;
  1658	
  1659		grp = rcu_dereference(tsk->numa_group);
  1660		if (!grp)
  1661			goto no_join;
  1662	
  1663		my_grp = deref_curr_numa_group(p);
  1664		if (grp == my_grp)
  1665			goto no_join;
  1666	
  1667		/*
  1668		 * Only join the other group if its bigger; if we're the bigger group,
  1669		 * the other task will join us.
  1670		 */
  1671		if (my_grp->nr_tasks > grp->nr_tasks)
  1672			goto no_join;
  1673	
  1674		/*
  1675		 * Tie-break on the grp address.
  1676		 */
  1677		if (my_grp->nr_tasks == grp->nr_tasks && my_grp > grp)
  1678			goto no_join;
  1679	
  1680		/* Always join threads in the same process. */
  1681		if (tsk->mm == current->mm)
  1682			join = true;
  1683	
  1684		/* Simple filter to avoid false positives due to PID collisions */
  1685		if (flags & TNF_SHARED)
  1686			join = true;
  1687	
  1688		/* Update priv based on whether false sharing was detected */
  1689		*priv = !join;
  1690	
  1691		if (join && !get_numa_group(grp))
  1692			goto no_join;
  1693	
  1694		rcu_read_unlock();
  1695	
  1696		if (!join)
  1697			return;
  1698	
  1699		WARN_ON_ONCE(irqs_disabled());
  1700		double_lock_irq(&my_grp->lock, &grp->lock);
  1701	
  1702		for (i = 0; i < NR_NUMA_HINT_FAULT_STATS * nr_node_ids; i++) {
  1703			my_grp->faults[i] -= p->numa_faults[i];
  1704			grp->faults[i] += p->numa_faults[i];
  1705		}
  1706		my_grp->total_faults -= p->total_numa_faults;
  1707		grp->total_faults += p->total_numa_faults;
  1708	
  1709		my_grp->nr_tasks--;
  1710		grp->nr_tasks++;
  1711	
  1712		spin_unlock(&my_grp->lock);
  1713		spin_unlock_irq(&grp->lock);
  1714	
  1715		rcu_assign_pointer(p->numa_group, grp);
  1716	
  1717		put_numa_group(my_grp);
  1718		return;
  1719	
  1720	no_join:
  1721		rcu_read_unlock();
  1722		return;
  1723	}
  1724	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ