Re: [peterz-queue:sched/core 14/15] kernel/sched/core.c:9815:43: error: passing argument 1 of 'zalloc_cpumask_var_node' from incompatible pointer type

Waiman Long
2022-10-13T14:03:24Z

On 10/13/22 09:49, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
> head: e7c69e86e29590d8bacd63595f3a687d97288ccc
> commit: ecf44ad8a0325439035003643fd11725147fae18 [14/15] sched: Enforce user requested affinity
> config: x86_64-randconfig-a013
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> reproduce (this is a W=1 build):
> # https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=ecf44ad8a0325439035003643fd11725147fae18
> git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
> git fetch --no-tags peterz-queue sched/core
> git checkout ecf44ad8a0325439035003643fd11725147fae18
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
> kernel/sched/core.c: In function 'sched_init':
>>> kernel/sched/core.c:9815:43: error: passing argument 1 of 'zalloc_cpumask_var_node' from incompatible pointer type [-Werror=incompatible-pointer-types]
> 9815 | zalloc_cpumask_var_node(rq->scratch_mask, GFP_KERNEL, cpu_to_node(i));

Sorry, it should have a '&' in front of rq->scratch_mask.

Cheers,
Longman

> | ~~^~~~~~~~~~~~~~
> | |
> | struct cpumask *
> In file included from arch/x86/include/asm/cpumask.h:5,
> from arch/x86/include/asm/msr.h:11,
> from arch/x86/include/asm/processor.h:22,
> from arch/x86/include/asm/cpufeature.h:5,
> from arch/x86/include/asm/thread_info.h:53,
> from include/linux/thread_info.h:60,
> from arch/x86/include/asm/preempt.h:7,
> from include/linux/preempt.h:78,
> from include/linux/spinlock.h:56,
> from include/linux/wait.h:9,
> from include/linux/wait_bit.h:8,
> from include/linux/fs.h:6,
> from include/linux/highmem.h:5,
> from kernel/sched/core.c:9:
> include/linux/cpumask.h:880:59: note: expected 'struct cpumask (*)[1]' but argument is of type 'struct cpumask *'
> 880 | static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
> | ~~~~~~~~~~~~~~~^~~~
> cc1: some warnings being treated as errors
>
>
> vim +/zalloc_cpumask_var_node +9815 kernel/sched/core.c
>
> 9767
> 9768 rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime;
> 9769 #ifdef CONFIG_RT_GROUP_SCHED
> 9770 init_tg_rt_entry(&root_task_group, &rq->rt, NULL, i, NULL);
> 9771 #endif
> 9772 #ifdef CONFIG_SMP
> 9773 rq->sd = NULL;
> 9774 rq->rd = NULL;
> 9775 rq->cpu_capacity = rq->cpu_capacity_orig = SCHED_CAPACITY_SCALE;
> 9776 rq->balance_callback = &balance_push_callback;
> 9777 rq->active_balance = 0;
> 9778 rq->next_balance = jiffies;
> 9779 rq->push_cpu = 0;
> 9780 rq->cpu = i;
> 9781 rq->online = 0;
> 9782 rq->idle_stamp = 0;
> 9783 rq->avg_idle = 2*sysctl_sched_migration_cost;
> 9784 rq->wake_stamp = jiffies;
> 9785 rq->wake_avg_idle = rq->avg_idle;
> 9786 rq->max_idle_balance_cost = sysctl_sched_migration_cost;
> 9787
> 9788 INIT_LIST_HEAD(&rq->cfs_tasks);
> 9789
> 9790 rq_attach_root(rq, &def_root_domain);
> 9791 #ifdef CONFIG_NO_HZ_COMMON
> 9792 rq->last_blocked_load_update_tick = jiffies;
> 9793 atomic_set(&rq->nohz_flags, 0);
> 9794
> 9795 INIT_CSD(&rq->nohz_csd, nohz_csd_func, rq);
> 9796 #endif
> 9797 #ifdef CONFIG_HOTPLUG_CPU
> 9798 rcuwait_init(&rq->hotplug_wait);
> 9799 #endif
> 9800 #endif /* CONFIG_SMP */
> 9801 hrtick_rq_init(rq);
> 9802 atomic_set(&rq->nr_iowait, 0);
> 9803
> 9804 #ifdef CONFIG_SCHED_CORE
> 9805 rq->core = rq;
> 9806 rq->core_pick = NULL;
> 9807 rq->core_enabled = 0;
> 9808 rq->core_tree = RB_ROOT;
> 9809 rq->core_forceidle_count = 0;
> 9810 rq->core_forceidle_occupation = 0;
> 9811 rq->core_forceidle_start = 0;
> 9812
> 9813 rq->core_cookie = 0UL;
> 9814 #endif
>> 9815 zalloc_cpumask_var_node(rq->scratch_mask, GFP_KERNEL, cpu_to_node(i));
> 9816 }
> 9817
> 9818 set_load_weight(&init_task, false);
> 9819
> 9820 /*
> 9821 * The boot idle thread does lazy MMU switching as well:
> 9822 */
> 9823 mmgrab(&init_mm);
> 9824 enter_lazy_tlb(&init_mm, current);
> 9825
> 9826 /*
> 9827 * The idle task doesn't need the kthread struct to function, but it
> 9828 * is dressed up as a per-CPU kthread and thus needs to play the part
> 9829 * if we want to avoid special-casing it in code that deals with per-CPU
> 9830 * kthreads.
> 9831 */
> 9832 WARN_ON(!set_kthread_struct(current));
> 9833
> 9834 /*
> 9835 * Make us the idle thread. Technically, schedule() should not be
> 9836 * called from this thread, however somewhere below it might be,
> 9837 * but because we are the idle thread, we just pick up running again
> 9838 * when this runqueue becomes "idle".
> 9839 */
> 9840 init_idle(current, smp_processor_id());
> 9841
> 9842 calc_load_update = jiffies + LOAD_FREQ;
> 9843
>