Re: arch/x86/include/asm/preempt.h:75:9: sparse: context imbalance in 'vcpu_enter_guest' - unexpected unlock

From: Paolo Bonzini
Date: Tue May 09 2017 - 11:29:13 EST




On 09/05/2017 14:32, kbuild test robot wrote:
> ./arch/x86/kvm/trace.h:1153:1: sparse: odd constant _Bool cast (ffffffffffffffff becomes 1)
> ./arch/x86/kvm/trace.h:1322:1: sparse: odd constant _Bool cast (ffffffffffffffff becomes 1)
> ./arch/x86/kvm/trace.h:1322:1: sparse: odd constant _Bool cast (ffffffffffffffff becomes 1)
>>> arch/x86/include/asm/preempt.h:75:9: sparse: context imbalance in 'vcpu_enter_guest' - unexpected unlock

I can't really make much sense of this, but vcpu_enter_guest seems okay
to me.

Paolo

> vim +/vcpu_enter_guest +75 arch/x86/include/asm/preempt.h
>
> c2daa3be Peter Zijlstra 2013-08-14 59 static __always_inline void clear_preempt_need_resched(void)
> c2daa3be Peter Zijlstra 2013-08-14 60 {
> b3ca1c10 Christoph Lameter 2014-04-07 61 raw_cpu_or_4(__preempt_count, PREEMPT_NEED_RESCHED);
> c2daa3be Peter Zijlstra 2013-08-14 62 }
> c2daa3be Peter Zijlstra 2013-08-14 63
> c2daa3be Peter Zijlstra 2013-08-14 64 static __always_inline bool test_preempt_need_resched(void)
> c2daa3be Peter Zijlstra 2013-08-14 65 {
> b3ca1c10 Christoph Lameter 2014-04-07 66 return !(raw_cpu_read_4(__preempt_count) & PREEMPT_NEED_RESCHED);
> c2daa3be Peter Zijlstra 2013-08-14 67 }
> c2daa3be Peter Zijlstra 2013-08-14 68
> c2daa3be Peter Zijlstra 2013-08-14 69 /*
> c2daa3be Peter Zijlstra 2013-08-14 70 * The various preempt_count add/sub methods
> c2daa3be Peter Zijlstra 2013-08-14 71 */
> c2daa3be Peter Zijlstra 2013-08-14 72
> c2daa3be Peter Zijlstra 2013-08-14 73 static __always_inline void __preempt_count_add(int val)
> c2daa3be Peter Zijlstra 2013-08-14 74 {
> b3ca1c10 Christoph Lameter 2014-04-07 @75 raw_cpu_add_4(__preempt_count, val);
> c2daa3be Peter Zijlstra 2013-08-14 76 }
> c2daa3be Peter Zijlstra 2013-08-14 77
> c2daa3be Peter Zijlstra 2013-08-14 78 static __always_inline void __preempt_count_sub(int val)
> c2daa3be Peter Zijlstra 2013-08-14 79 {
> b3ca1c10 Christoph Lameter 2014-04-07 80 raw_cpu_add_4(__preempt_count, -val);
> c2daa3be Peter Zijlstra 2013-08-14 81 }
> c2daa3be Peter Zijlstra 2013-08-14 82
> ba1f14fb Peter Zijlstra 2013-11-28 83 /*
>
> :::::: The code at line 75 was first introduced by commit
> :::::: b3ca1c10d7b32fdfdfaf5484eda486323f52d9be percpu: add raw_cpu_ops
>
> :::::: TO: Christoph Lameter <cl@xxxxxxxxx>
> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
>