Message ID | 20210208113437.94661-1-pbonzini@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [FYI] i915: kvmgt: the KVM mmu_lock is now an rwlock | expand |
On 2021.02.08 06:34:37 -0500, Paolo Bonzini wrote: > Adjust the KVMGT page tracking callbacks. > > Cc: Zhenyu Wang <zhenyuw@linux.intel.com> > Cc: Zhi Wang <zhi.a.wang@intel.com> > Cc: intel-gvt-dev@lists.freedesktop.org > Cc: intel-gfx@lists.freedesktop.org > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- Thanks for that! Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com> > drivers/gpu/drm/i915/gvt/kvmgt.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c > index 60f1a386dd06..b4348256ae95 100644 > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c > @@ -1703,7 +1703,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn) > return -EINVAL; > } > > - spin_lock(&kvm->mmu_lock); > + write_lock(&kvm->mmu_lock); > > if (kvmgt_gfn_is_write_protected(info, gfn)) > goto out; > @@ -1712,7 +1712,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn) > kvmgt_protect_table_add(info, gfn); > > out: > - spin_unlock(&kvm->mmu_lock); > + write_unlock(&kvm->mmu_lock); > srcu_read_unlock(&kvm->srcu, idx); > return 0; > } > @@ -1737,7 +1737,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn) > return -EINVAL; > } > > - spin_lock(&kvm->mmu_lock); > + write_lock(&kvm->mmu_lock); > > if (!kvmgt_gfn_is_write_protected(info, gfn)) > goto out; > @@ -1746,7 +1746,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn) > kvmgt_protect_table_del(info, gfn); > > out: > - spin_unlock(&kvm->mmu_lock); > + write_unlock(&kvm->mmu_lock); > srcu_read_unlock(&kvm->srcu, idx); > return 0; > } > @@ -1772,7 +1772,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm, > struct kvmgt_guest_info *info = container_of(node, > struct kvmgt_guest_info, track_node); > > - spin_lock(&kvm->mmu_lock); > + write_lock(&kvm->mmu_lock); > for (i = 0; i < slot->npages; i++) { > gfn = slot->base_gfn + i; > if (kvmgt_gfn_is_write_protected(info, gfn)) { > @@ -1781,7 +1781,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm, > kvmgt_protect_table_del(info, gfn); > } > } > - spin_unlock(&kvm->mmu_lock); > + write_unlock(&kvm->mmu_lock); > } > > static bool __kvmgt_vgpu_exist(struct intel_vgpu *vgpu, struct kvm *kvm) > -- > 2.26.2 > > _______________________________________________ > intel-gvt-dev mailing list > intel-gvt-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
Hi Paolo, I love your patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on linux/master drm-tip/drm-tip linus/master v5.11-rc6 next-20210125] [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] url: https://github.com/0day-ci/linux/commits/Paolo-Bonzini/i915-kvmgt-the-KVM-mmu_lock-is-now-an-rwlock/20210209-070812 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-rhel-8.3 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/e1625dbf5fa4aea9c53da01a04bfb55443375c30 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Paolo-Bonzini/i915-kvmgt-the-KVM-mmu_lock-is-now-an-rwlock/20210209-070812 git checkout e1625dbf5fa4aea9c53da01a04bfb55443375c30 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_add': drivers/gpu/drm/i915/gvt/kvmgt.c:1706:13: error: passing argument 1 of '_raw_write_lock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1706 | write_lock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:70:42: note: in definition of macro 'write_lock' 70 | #define write_lock(lock) _raw_write_lock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:19:43: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ~~~~~~~~~~^~~~ >> drivers/gpu/drm/i915/gvt/kvmgt.c:1715:15: error: passing argument 1 of '__raw_write_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1715 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock_api_smp.h:88:52: note: in definition of macro '_raw_write_unlock' 88 | #define _raw_write_unlock(lock) __raw_write_unlock(lock) | ^~~~ drivers/gpu/drm/i915/gvt/kvmgt.c:1715:2: note: in expansion of macro 'write_unlock' 1715 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~ include/linux/rwlock_api_smp.h:216:49: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 216 | static inline void __raw_write_unlock(rwlock_t *lock) | ~~~~~~~~~~^~~~ In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_remove': drivers/gpu/drm/i915/gvt/kvmgt.c:1740:13: error: passing argument 1 of '_raw_write_lock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1740 | write_lock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:70:42: note: in definition of macro 'write_lock' 70 | #define write_lock(lock) _raw_write_lock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:19:43: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ~~~~~~~~~~^~~~ drivers/gpu/drm/i915/gvt/kvmgt.c:1749:15: error: passing argument 1 of '__raw_write_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1749 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock_api_smp.h:88:52: note: in definition of macro '_raw_write_unlock' 88 | #define _raw_write_unlock(lock) __raw_write_unlock(lock) | ^~~~ drivers/gpu/drm/i915/gvt/kvmgt.c:1749:2: note: in expansion of macro 'write_unlock' 1749 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~ include/linux/rwlock_api_smp.h:216:49: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 216 | static inline void __raw_write_unlock(rwlock_t *lock) | ~~~~~~~~~~^~~~ In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_flush_slot': drivers/gpu/drm/i915/gvt/kvmgt.c:1775:13: error: passing argument 1 of '_raw_write_lock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1775 | write_lock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:70:42: note: in definition of macro 'write_lock' 70 | #define write_lock(lock) _raw_write_lock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:19:43: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ~~~~~~~~~~^~~~ drivers/gpu/drm/i915/gvt/kvmgt.c:1784:15: error: passing argument 1 of '__raw_write_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1784 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock_api_smp.h:88:52: note: in definition of macro '_raw_write_unlock' 88 | #define _raw_write_unlock(lock) __raw_write_unlock(lock) | ^~~~ drivers/gpu/drm/i915/gvt/kvmgt.c:1784:2: note: in expansion of macro 'write_unlock' 1784 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~ include/linux/rwlock_api_smp.h:216:49: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 216 | static inline void __raw_write_unlock(rwlock_t *lock) | ~~~~~~~~~~^~~~ cc1: all warnings being treated as errors vim +/__raw_write_unlock +1715 drivers/gpu/drm/i915/gvt/kvmgt.c 1685 1686 static int kvmgt_page_track_add(unsigned long handle, u64 gfn) 1687 { 1688 struct kvmgt_guest_info *info; 1689 struct kvm *kvm; 1690 struct kvm_memory_slot *slot; 1691 int idx; 1692 1693 if (!handle_valid(handle)) 1694 return -ESRCH; 1695 1696 info = (struct kvmgt_guest_info *)handle; 1697 kvm = info->kvm; 1698 1699 idx = srcu_read_lock(&kvm->srcu); 1700 slot = gfn_to_memslot(kvm, gfn); 1701 if (!slot) { 1702 srcu_read_unlock(&kvm->srcu, idx); 1703 return -EINVAL; 1704 } 1705 1706 write_lock(&kvm->mmu_lock); 1707 1708 if (kvmgt_gfn_is_write_protected(info, gfn)) 1709 goto out; 1710 1711 kvm_slot_page_track_add_page(kvm, slot, gfn, KVM_PAGE_TRACK_WRITE); 1712 kvmgt_protect_table_add(info, gfn); 1713 1714 out: > 1715 write_unlock(&kvm->mmu_lock); 1716 srcu_read_unlock(&kvm->srcu, idx); 1717 return 0; 1718 } 1719 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Paolo, I love your patch! Yet something to improve: [auto build test ERROR on drm-intel/for-linux-next] [also build test ERROR on linux/master drm-tip/drm-tip linus/master v5.11-rc6 next-20210125] [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] url: https://github.com/0day-ci/linux/commits/Paolo-Bonzini/i915-kvmgt-the-KVM-mmu_lock-is-now-an-rwlock/20210209-070812 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/e1625dbf5fa4aea9c53da01a04bfb55443375c30 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Paolo-Bonzini/i915-kvmgt-the-KVM-mmu_lock-is-now-an-rwlock/20210209-070812 git checkout e1625dbf5fa4aea9c53da01a04bfb55443375c30 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_add': >> drivers/gpu/drm/i915/gvt/kvmgt.c:1706:13: error: passing argument 1 of '_raw_write_lock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1706 | write_lock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:70:42: note: in definition of macro 'write_lock' 70 | #define write_lock(lock) _raw_write_lock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:19:43: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ~~~~~~~~~~^~~~ In file included from include/linux/spinlock.h:312, 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: >> drivers/gpu/drm/i915/gvt/kvmgt.c:1715:15: error: passing argument 1 of '_raw_write_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1715 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:106:47: note: in definition of macro 'write_unlock' 106 | #define write_unlock(lock) _raw_write_unlock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:31:45: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 31 | void __lockfunc _raw_write_unlock(rwlock_t *lock) __releases(lock); | ~~~~~~~~~~^~~~ In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_remove': drivers/gpu/drm/i915/gvt/kvmgt.c:1740:13: error: passing argument 1 of '_raw_write_lock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1740 | write_lock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:70:42: note: in definition of macro 'write_lock' 70 | #define write_lock(lock) _raw_write_lock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:19:43: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 19 | void __lockfunc _raw_write_lock(rwlock_t *lock) __acquires(lock); | ~~~~~~~~~~^~~~ In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c:1749:15: error: passing argument 1 of '_raw_write_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1749 | write_unlock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:106:47: note: in definition of macro 'write_unlock' 106 | #define write_unlock(lock) _raw_write_unlock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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/rwlock_api_smp.h:31:45: note: expected 'rwlock_t *' {aka 'struct <anonymous> *'} but argument is of type 'spinlock_t *' {aka 'struct spinlock *'} 31 | void __lockfunc _raw_write_unlock(rwlock_t *lock) __releases(lock); | ~~~~~~~~~~^~~~ In file included from include/linux/spinlock.h:312, 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: drivers/gpu/drm/i915/gvt/kvmgt.c: In function 'kvmgt_page_track_flush_slot': drivers/gpu/drm/i915/gvt/kvmgt.c:1775:13: error: passing argument 1 of '_raw_write_lock' from incompatible pointer type [-Werror=incompatible-pointer-types] 1775 | write_lock(&kvm->mmu_lock); | ^~~~~~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} include/linux/rwlock.h:70:42: note: in definition of macro 'write_lock' 70 | #define write_lock(lock) _raw_write_lock(lock) | ^~~~ In file included from include/linux/spinlock_api_smp.h:190, from include/linux/spinlock.h:318, 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, vim +/_raw_write_lock +1706 drivers/gpu/drm/i915/gvt/kvmgt.c 1685 1686 static int kvmgt_page_track_add(unsigned long handle, u64 gfn) 1687 { 1688 struct kvmgt_guest_info *info; 1689 struct kvm *kvm; 1690 struct kvm_memory_slot *slot; 1691 int idx; 1692 1693 if (!handle_valid(handle)) 1694 return -ESRCH; 1695 1696 info = (struct kvmgt_guest_info *)handle; 1697 kvm = info->kvm; 1698 1699 idx = srcu_read_lock(&kvm->srcu); 1700 slot = gfn_to_memslot(kvm, gfn); 1701 if (!slot) { 1702 srcu_read_unlock(&kvm->srcu, idx); 1703 return -EINVAL; 1704 } 1705 > 1706 write_lock(&kvm->mmu_lock); 1707 1708 if (kvmgt_gfn_is_write_protected(info, gfn)) 1709 goto out; 1710 1711 kvm_slot_page_track_add_page(kvm, slot, gfn, KVM_PAGE_TRACK_WRITE); 1712 kvmgt_protect_table_add(info, gfn); 1713 1714 out: > 1715 write_unlock(&kvm->mmu_lock); 1716 srcu_read_unlock(&kvm->srcu, idx); 1717 return 0; 1718 } 1719 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index 60f1a386dd06..b4348256ae95 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -1703,7 +1703,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn) return -EINVAL; } - spin_lock(&kvm->mmu_lock); + write_lock(&kvm->mmu_lock); if (kvmgt_gfn_is_write_protected(info, gfn)) goto out; @@ -1712,7 +1712,7 @@ static int kvmgt_page_track_add(unsigned long handle, u64 gfn) kvmgt_protect_table_add(info, gfn); out: - spin_unlock(&kvm->mmu_lock); + write_unlock(&kvm->mmu_lock); srcu_read_unlock(&kvm->srcu, idx); return 0; } @@ -1737,7 +1737,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn) return -EINVAL; } - spin_lock(&kvm->mmu_lock); + write_lock(&kvm->mmu_lock); if (!kvmgt_gfn_is_write_protected(info, gfn)) goto out; @@ -1746,7 +1746,7 @@ static int kvmgt_page_track_remove(unsigned long handle, u64 gfn) kvmgt_protect_table_del(info, gfn); out: - spin_unlock(&kvm->mmu_lock); + write_unlock(&kvm->mmu_lock); srcu_read_unlock(&kvm->srcu, idx); return 0; } @@ -1772,7 +1772,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm, struct kvmgt_guest_info *info = container_of(node, struct kvmgt_guest_info, track_node); - spin_lock(&kvm->mmu_lock); + write_lock(&kvm->mmu_lock); for (i = 0; i < slot->npages; i++) { gfn = slot->base_gfn + i; if (kvmgt_gfn_is_write_protected(info, gfn)) { @@ -1781,7 +1781,7 @@ static void kvmgt_page_track_flush_slot(struct kvm *kvm, kvmgt_protect_table_del(info, gfn); } } - spin_unlock(&kvm->mmu_lock); + write_unlock(&kvm->mmu_lock); } static bool __kvmgt_vgpu_exist(struct intel_vgpu *vgpu, struct kvm *kvm)
Adjust the KVMGT page tracking callbacks. Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Cc: Zhi Wang <zhi.a.wang@intel.com> Cc: intel-gvt-dev@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- drivers/gpu/drm/i915/gvt/kvmgt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)