Subject: Re: linux-next: build failure after merge of the kvm tree

From: Yu Zhang <[email-masked]>
Date: Mon, 8 Feb 2021 19:18:22 +0800

Thanks a lot for reporting this, Stephen. Just sent out a patch
to fix it in kvmgt.

B.R.
Yu

On Mon, Feb 08, 2021 at 04:33:08PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the kvm tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
> 
> drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_add':
> drivers/gpu/drm/i915/gvt/kvmgt.c:1706:12: error: passing argument 1 of 'spin_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
>  1706 |  spin_lock(&kvm->mmu_lock);
>       |            ^~~~~~~~~~~~~~
>       |            |
>       |            rwlock_t *
> In file included from include/linux/wait.h:9,
>                  from include/linux/pid.h:6,
>                  from include/linux/sched.h:14,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from drivers/gpu/drm/i915/gvt/kvmgt.c:32:
> include/linux/spinlock.h:352:51: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'rwlock_t *'
>   352 | static __always_inline void spin_lock(spinlock_t *lock)
>       |                                       ~~~~~~~~~~~~^~~~
> drivers/gpu/drm/i915/gvt/kvmgt.c:1715:14: error: passing argument 1 of 'spin_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
>  1715 |  spin_unlock(&kvm->mmu_lock);
>       |              ^~~~~~~~~~~~~~
>       |              |
>       |              rwlock_t *
> In file included from include/linux/wait.h:9,
>                  from include/linux/pid.h:6,
>                  from include/linux/sched.h:14,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from drivers/gpu/drm/i915/gvt/kvmgt.c:32:
> include/linux/spinlock.h:392:53: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'rwlock_t *'
>   392 | static __always_inline void spin_unlock(spinlock_t *lock)
>       |                                         ~~~~~~~~~~~~^~~~
> drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_remove':
> drivers/gpu/drm/i915/gvt/kvmgt.c:1740:12: error: passing argument 1 of 'spin_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
>  1740 |  spin_lock(&kvm->mmu_lock);
>       |            ^~~~~~~~~~~~~~
>       |            |
>       |            rwlock_t *
> In file included from include/linux/wait.h:9,
>                  from include/linux/pid.h:6,
>                  from include/linux/sched.h:14,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from drivers/gpu/drm/i915/gvt/kvmgt.c:32:
> include/linux/spinlock.h:352:51: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'rwlock_t *'
>   352 | static __always_inline void spin_lock(spinlock_t *lock)
>       |                                       ~~~~~~~~~~~~^~~~
> drivers/gpu/drm/i915/gvt/kvmgt.c:1749:14: error: passing argument 1 of 'spin_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
>  1749 |  spin_unlock(&kvm->mmu_lock);
>       |              ^~~~~~~~~~~~~~
>       |              |
>       |              rwlock_t *
> In file included from include/linux/wait.h:9,
>                  from include/linux/pid.h:6,
>                  from include/linux/sched.h:14,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from drivers/gpu/drm/i915/gvt/kvmgt.c:32:
> include/linux/spinlock.h:392:53: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'rwlock_t *'
>   392 | static __always_inline void spin_unlock(spinlock_t *lock)
>       |                                         ~~~~~~~~~~~~^~~~
> drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_flush_slot':
> drivers/gpu/drm/i915/gvt/kvmgt.c:1775:12: error: passing argument 1 of 'spin_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
>  1775 |  spin_lock(&kvm->mmu_lock);
>       |            ^~~~~~~~~~~~~~
>       |            |
>       |            rwlock_t *
> In file included from include/linux/wait.h:9,
>                  from include/linux/pid.h:6,
>                  from include/linux/sched.h:14,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from drivers/gpu/drm/i915/gvt/kvmgt.c:32:
> include/linux/spinlock.h:352:51: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'rwlock_t *'
>   352 | static __always_inline void spin_lock(spinlock_t *lock)
>       |                                       ~~~~~~~~~~~~^~~~
> drivers/gpu/drm/i915/gvt/kvmgt.c:1784:14: error: passing argument 1 of 'spin_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
>  1784 |  spin_unlock(&kvm->mmu_lock);
>       |              ^~~~~~~~~~~~~~
>       |              |
>       |              rwlock_t *
> In file included from include/linux/wait.h:9,
>                  from include/linux/pid.h:6,
>                  from include/linux/sched.h:14,
>                  from include/linux/ratelimit.h:6,
>                  from include/linux/dev_printk.h:16,
>                  from include/linux/device.h:15,
>                  from drivers/gpu/drm/i915/gvt/kvmgt.c:32:
> include/linux/spinlock.h:392:53: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'rwlock_t *'
>   392 | static __always_inline void spin_unlock(spinlock_t *lock)
>       |                                         ~~~~~~~~~~~~^~~~
> cc1: all warnings being treated as errors
> 
> Caused by commit
> 
>   531810caa9f4 ("KVM: x86/mmu: Use an rwlock for the x86 MMU")
> 
> I have used the kvm tree from next-20210204 for today.
> 
> -- 
> Cheers,
> Stephen Rothwell