* [PATCH] drm/i915/gvt/kvmgt: Fix the build failure in kvmgt.
@ 2021-02-08 18:52 Yu Zhang
2021-02-09 1:08 ` Zhenyu Wang
0 siblings, 1 reply; 2+ messages in thread
From: Yu Zhang @ 2021-02-08 18:52 UTC (permalink / raw)
To: zhenyuw, zhi.a.wang
Cc: jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied, daniel,
intel-gvt-dev, intel-gfx, dri-devel, linux-kernel, kvm
Previously, commit 531810caa9f4 ("KVM: x86/mmu: Use
an rwlock for the x86 MMU") replaced KVM's mmu_lock
with type rwlock_t. This will cause a build failure
in kvmgt, which uses the same lock when trying to add/
remove some GFNs to/from the page tracker. Fix it with
write_lock/unlocks in kvmgt.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Yu Zhang <yu.c.zhang@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.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/i915/gvt/kvmgt: Fix the build failure in kvmgt.
2021-02-08 18:52 [PATCH] drm/i915/gvt/kvmgt: Fix the build failure in kvmgt Yu Zhang
@ 2021-02-09 1:08 ` Zhenyu Wang
0 siblings, 0 replies; 2+ messages in thread
From: Zhenyu Wang @ 2021-02-09 1:08 UTC (permalink / raw)
To: Yu Zhang
Cc: zhi.a.wang, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
daniel, intel-gvt-dev, intel-gfx, dri-devel, linux-kernel, kvm
[-- Attachment #1: Type: text/plain, Size: 2662 bytes --]
On 2021.02.09 02:52:10 +0800, Yu Zhang wrote:
> Previously, commit 531810caa9f4 ("KVM: x86/mmu: Use
> an rwlock for the x86 MMU") replaced KVM's mmu_lock
> with type rwlock_t. This will cause a build failure
> in kvmgt, which uses the same lock when trying to add/
> remove some GFNs to/from the page tracker. Fix it with
> write_lock/unlocks in kvmgt.
Thanks for the fix! I saw Paolo has already carried one
in -next, so we are fine.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Yu Zhang <yu.c.zhang@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.17.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-09 1:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 18:52 [PATCH] drm/i915/gvt/kvmgt: Fix the build failure in kvmgt Yu Zhang
2021-02-09 1:08 ` Zhenyu Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).