[rcu:urezki-pcount.2020.09.26a 17/17] kernel/rcu/tree.c:3315:52: sparse: sparse: incorrect type in argument 2 (different base types)

From: kernel test robot
Date: Sat Sep 26 2020 - 19:01:24 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head: e9bed2a1239b017d78cec5de66adce0560f6d077
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/17] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations
config: i386-randconfig-s002-20200927 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-201-g24bdaac6-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?id=e9bed2a1239b017d78cec5de66adce0560f6d077
git remote add rcu https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
git fetch --no-tags rcu urezki-pcount.2020.09.26a
git checkout e9bed2a1239b017d78cec5de66adce0560f6d077
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

kernel/rcu/tree.c:1344:13: sparse: sparse: context imbalance in 'rcu_start_this_gp' - different lock contexts for basic block
kernel/rcu/tree.c:1787:9: sparse: sparse: context imbalance in 'rcu_gp_init' - different lock contexts for basic block
kernel/rcu/tree.c:2542:9: sparse: sparse: context imbalance in 'force_qs_rnp' - different lock contexts for basic block
kernel/rcu/tree.c:2596:25: sparse: sparse: context imbalance in 'rcu_force_quiescent_state' - unexpected unlock
kernel/rcu/tree.c:3299:29: sparse: sparse: incorrect type in initializer (different base types) @@ expected int gfp @@ got restricted gfp_t @@
kernel/rcu/tree.c:3299:29: sparse: expected int gfp
kernel/rcu/tree.c:3299:29: sparse: got restricted gfp_t
>> kernel/rcu/tree.c:3315:52: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted gfp_t [usertype] flags @@ got int gfp @@
>> kernel/rcu/tree.c:3315:52: sparse: expected restricted gfp_t [usertype] flags
kernel/rcu/tree.c:3315:52: sparse: got int gfp
kernel/rcu/tree.c: note: in included file:
kernel/rcu/tree_stall.h:749:17: sparse: sparse: context imbalance in 'rcu_check_gp_start_stall' - different lock contexts for basic block
kernel/rcu/tree.c: note: in included file:
kernel/rcu/tree_exp.h:189:9: sparse: sparse: context imbalance in '__rcu_report_exp_rnp' - different lock contexts for basic block

vim +3315 kernel/rcu/tree.c

3292
3293 static inline bool
3294 add_ptr_to_bulk_krc_lock(struct kfree_rcu_cpu **krcp,
3295 unsigned long *flags, void *ptr, bool can_sleep)
3296 {
3297 struct kvfree_rcu_bulk_data *bnode;
3298 bool can_alloc_page = preemptible();
3299 int gfp = can_sleep ? GFP_NOWAIT | __GFP_NOWARN : GFP_ATOMIC;
3300 int idx;
3301
3302 *krcp = krc_this_cpu_lock(flags);
3303 if (unlikely(!(*krcp)->initialized))
3304 return false;
3305
3306 idx = !!is_vmalloc_addr(ptr);
3307
3308 /* Check if a new block is required. */
3309 if (!(*krcp)->bkvhead[idx] ||
3310 (*krcp)->bkvhead[idx]->nr_records == KVFREE_BULK_MAX_ENTR) {
3311 bnode = get_cached_bnode(*krcp);
3312 if (!bnode && can_alloc_page) {
3313 migrate_disable();
3314 krc_this_cpu_unlock(*krcp, *flags);
> 3315 bnode = kmalloc(PAGE_SIZE, gfp);
3316 *krcp = krc_this_cpu_lock(flags);
3317 migrate_enable();
3318 }
3319
3320 /* Switch to emergency path. */
3321 if (unlikely(!bnode))
3322 return false;
3323
3324 /* Initialize the new block. */
3325 bnode->nr_records = 0;
3326 bnode->next = (*krcp)->bkvhead[idx];
3327
3328 /* Attach it to the head. */
3329 (*krcp)->bkvhead[idx] = bnode;
3330 }
3331
3332 /* Finally insert. */
3333 (*krcp)->bkvhead[idx]->records
3334 [(*krcp)->bkvhead[idx]->nr_records++] = ptr;
3335
3336 return true;
3337 }
3338

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip