On Mon, Oct 28, 2024, Nam Cao wrote:
> This is the first part of a 5-part series (split for convenience). All 5
> parts are:
>
> Part 1: https://lore.kernel.org/lkml/cover.1729864615.git.nam...@linutronix.de
> Part 2: https://lore.kernel.org/lkml/cover.1729864823.git.nam...@linutronix.de
> Part 3:
On Tue, Oct 15, 2024, Arnd Bergmann wrote:
> From: Arnd Bergmann
>
> Depending on x86 and KVM is not enough, as the kvm helper functions
> that get called here are controlled by CONFIG_KVM_X86, which is
> disabled if both KVM_INTEL and KVM_AMD are turned off.
>
> ERROR: modpost: "kvm_write_track
On Thu, Aug 31, 2023, Like Xu wrote:
> On 31/8/2023 4:50 am, Sean Christopherson wrote:
> > On Wed, Aug 30, 2023, Like Xu wrote:
> > > On 2023/7/29 09:35, Sean Christopherson wrote:
> > > > Disallow moving memslots if the VM has external page-track users, i.e.
>
On Wed, Aug 30, 2023, Like Xu wrote:
> On 2023/7/29 09:35, Sean Christopherson wrote:
> > Disallow moving memslots if the VM has external page-track users, i.e. if
> > KVMGT is being used to expose a virtual GPU to the guest, as KVMGT doesn't
> > correctly ha
On Thu, Aug 10, 2023, Yan Zhao wrote:
> On Thu, Aug 10, 2023 at 07:21:03AM +0800, Yan Zhao wrote:
> > > Reading the value after acquiring mmu_lock ensures that both vCPUs will
> > > see whatever
> > > value "loses" the race, i.e. whatever written value is processed second
> > > ('Y' in the
> > >
On Wed, Aug 09, 2023, Yan Zhao wrote:
> On Mon, Aug 07, 2023 at 10:19:07AM -0700, Sean Christopherson wrote:
> > On Mon, Aug 07, 2023, Like Xu wrote:
> > > On 23/12/2022 8:57 am, Sean Christopherson wrote:
> > > > +static inline void kvm_page_track_write(struct kvm_
On Mon, Aug 07, 2023, Like Xu wrote:
> On 23/12/2022 8:57 am, Sean Christopherson wrote:
> > +static inline void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa,
> > + const u8 *new, int bytes)
> > +{
> > + __kvm_page_track_
On Fri, 28 Jul 2023 18:35:06 -0700, Sean Christopherson wrote:
> Fix a handful of minor bugs in KVMGT, and overhaul KVM's page-track APIs
> to provide a leaner and cleaner interface. The motivation for this
> series is to (significantly) reduce the number of KVM APIs that KVMGT
On Tue, Aug 01, 2023, Yan Zhao wrote:
> On Fri, Jul 28, 2023 at 06:35:12PM -0700, Sean Christopherson wrote:
> > Move the check that a vGPU is attacked from is_2MB_gtt_possible() all the
> typo: "attacked" --> "attached"
>
> > way up to shadow_ppgtt_mm
TEL_VGPU_STATUS_ATTACHED
|
|-> intel_vgpu_page_track_handler()
|
|-> ppgtt_write_protection_handler()
|
|-> ppgtt_handle_guest_write_page_table_bytes()
|
|-> ppgtt_handle_guest_write_page_table() [see 1]
Signed-off-by: Sean Christopherson
---
v4.1:
- Actually ma
ended.
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 7 +--
arch/x86/kvm/mmu/mmu.c| 4 +-
arch/x86/kvm/mmu/page_track.c | 85 ---
arch/x86/kvm/mmu/page_track.h
Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/kvm/mmu/page_track.c | 17 +++--
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c
index b835ba7f325c..29ae61f1e303 100644
--- a/
Bug the VM if something attempts to write-track a gfn, but write-tracking
isn't enabled. The VM is doomed (and KVM has an egregious bug) if KVM or
KVMGT wants to shadow guest page tables but can't because write-tracking
isn't enabled.
Tested-by: Yongwei Ma
Signed-off-by: Sean
ange intended.
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 8
arch/x86/kvm/mmu/mmu.c| 8
arch/x86/kvm/mmu/page_track.c | 21 +
arch/x86/kvm/mmu/page_track.h | 4 ++--
drivers
M
iff attachment to VM is successful").
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 11 +--
arch/x86/kvm/mmu/page_track.c | 18 --
drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +++---
7;s no
reason to use KVM's helper for this one case.
No functional change intended.
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gvt.h | 3 ++-
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
2 files changed, 3 insertions(+), 2 del
r
memslots. This is a baby step toward making kvm_host.h a KVM-internal
header in the very distant future.
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 21 ++---
arch/x86/kvm/mmu/mmu.c| 3 ++-
arch/x
t; so that including
headers directly from the command line, e.g. for testing include guards,
doesn't fail due to a struct having an incomplete type.
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 2 ++
arch/
From: Yan Zhao
Remove ->track_remove_slot(), there are no longer any users and it's
unlikely a "flush" hook will ever be the correct API to provide to an
external page-track user.
Cc: Zhenyu Wang
Suggested-by: Sean Christopherson
Signed-off-by: Yan Zhao
Tested-by: Yongwei
0% certain the
memory region will be removed, i.e. is invoked slightly later in KVM's
memslot modification flow.
Cc: Zhenyu Wang
Suggested-by: Sean Christopherson
Signed-off-by: Yan Zhao
[sean: handle name change, massage changelog, rebase]
Tested-by: Yan Zhao
Tested-by: Yongwei Ma
Tested-by: Yongwei Ma
Signed-off-by: Yan Zhao
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 12
arch/x86/kvm/mmu/page_track.c | 27 +--
arch/x86/kvm/x86.c| 3 +++
en Gardon
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 12 +--
arch/x86/include/asm/kvm_page_track.h | 11 +--
arch/x86/kvm/mmu/mmu.c| 14 ++--
arch/x86/kvm/mmu/page_track.c | 111 --
arch/x86/
commit edd4fa37baa6 ("KVM: x86: Allocate
new rmap and large page tracking when moving memslot").
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 3 +++
arch/x86/kvm/mmu/page_track.c
Drop @vcpu from KVM's ->track_write() hook provided for external users of
the page-track APIs now that KVM itself doesn't use the page-track
mechanism.
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 5 ++
its write-tracking
metadata is about to be deleted.
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 8 +---
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/
viewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 1 -
arch/x86/kvm/mmu.h | 2 ++
arch/x86/kvm/mmu/mmu.c | 13 ++---
arch/x86/kvm/mmu/page_track.c | 2 ++
4 files changed, 6 insertions(+), 12 delet
xpose kvm_mmu_zap_all_fast() outside of mmu.c. Keeping
everything in mmu.c will also likely simplify supporting TDX, which
intends to do zap only relevant SPTEs on memslot updates.
No functional change intended.
Suggested-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christoph
|-> mutex_lock(&vgpu->cache_lock);
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 55 +++
drivers/gpu/drm/i915/gvt/page_track.c | 10 +
2 files changed, 33 inser
allow a protecting the gfn hash with vgpu_lock without too much fuss.
No functional change intended.
Fixes: ba25d977571e ("drm/i915/gvt: Do not destroy ppgtt_mm during vGPU
D3->D0.")
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu
/20221110014821.1548347-2-sea...@google.com
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
arch/x86/kvm/mmu/mmu.c | 10 ++
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index c6dee659d592
;t backed by a compatible hugepage in the
host. Dropping the pre-check on a THP makes it much more likely that the
"error" will be encountered in normal operation.
Reviewed-by: Yan Zhao
Tested-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/
: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 97c6d3c53710..6f52886c4051 100644
--- a/drivers/
) into the case
statements so that the 2MiB case can try intel_gvt_dma_map_guest_page()
and fallback to splitting the entry on failure.
Reviewed-by: Zhi Wang
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/
m/i915/gvt: Add 2M huge gtt support")
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
ind
TEL_VGPU_STATUS_ATTACHED
|
|-> intel_vgpu_page_track_handler()
|
|-> ppgtt_write_protection_handler()
|
|-> ppgtt_handle_guest_write_page_table_bytes()
|
|-> ppgtt_handle_guest_write_page_table() [see 1]
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/
ff-by: Yan Zhao
[sean: write changelog]
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 429f0f993a13..0366a699baf5 100644
--- a/dr
with discontiguous pfns.
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index de675d799c7d..429f0f993a13 1006
t page".
Fixes: b901b252b6cf ("drm/i915/gvt: Add 2M huge gtt support")
Reviewed-by: Yan Zhao
Tested-by: Yongwei Ma
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 4
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/driver
intel_gvt_is_valid_gfn() to do GFN validity check from KVM side
while later mapping the GFN through VFIO interface is unnecessarily
fragile and confusing for unaware readers.
Signed-off-by: Yan Zhao
[sean: remove now-unused local variables]
Acked-by: Zhi Wang
Tested-by: Yongwei Ma
Signed-of
@kvm directly in the inner __kvm_page_track_write(). [Yan]
- Delete the gfn sanity check that relies on kvm_is_visible_gfn() instead
of providing a dedicated interface. [Yan]
v1: https://lore.kernel.org/lkml/20221223005739.1295925-1-sea...@google.com
Sean Christopherson (24):
drm/i915/gvt: V
On Thu, Jul 13, 2023, Christian Brauner wrote:
> diff --git a/fs/eventfd.c b/fs/eventfd.c
> index dc9e01053235..077be5da72bd 100644
> --- a/fs/eventfd.c
> +++ b/fs/eventfd.c
> @@ -43,9 +43,10 @@ struct eventfd_ctx {
> int id;
> };
>
> -__u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __u
On Thu, May 18, 2023, Yan Zhao wrote:
> On Wed, May 17, 2023 at 07:50:26AM -0700, Sean Christopherson wrote:
> > On Tue, May 16, 2023, Yan Zhao wrote:
> > > hi Sean
> > >
> > > Do you think it's necessary to double check that struct page pointers
&g
On Tue, May 16, 2023, Yan Zhao wrote:
> hi Sean
>
> Do you think it's necessary to double check that struct page pointers
> are also contiguous?
No, the virtual address space should be irrelevant. The only way it would be
problematic is if something in dma_map_page() expected to be able to acces
On Mon, May 15, 2023, Zhi A Wang wrote:
> On 5/13/2023 8:35 AM, Sean Christopherson wrote:
> > Move the check that a vGPU is attacked from is_2MB_gtt_possible() to its
> > sole caller, ppgtt_populate_shadow_entry(). All of the paths in
> > ppgtt_populate_shadow_entry()
M
iff attachment to VM is successful").
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 11 +--
arch/x86/kvm/mmu/page_track.c | 18 --
drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +++--
3 files c
Bug the VM if something attempts to write-track a gfn, but write-tracking
isn't enabled. The VM is doomed (and KVM has an egregious bug) if KVM or
KVMGT wants to shadow guest page tables but can't because write-tracking
isn't enabled.
Signed-off-by: Sean Christopherson
---
a
ardon
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 12 +--
arch/x86/include/asm/kvm_page_track.h | 11 +--
arch/x86/kvm/mmu/mmu.c| 14 ++--
arch/x86/kvm/mmu/page_track.c | 111 --
arch/x86/kvm/mmu/page_t
7;s no
reason to use KVM's helper for this one case.
No functional change intended.
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gvt.h | 3 ++-
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/d
ended.
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 7 +--
arch/x86/kvm/mmu/mmu.c| 4 +-
arch/x86/kvm/mmu/page_track.c | 85 ---
arch/x86/kvm/mmu/page_track.h | 5 ++
drivers/gpu/drm
t; so that including
headers directly from the command line, e.g. for testing include guards,
doesn't fail due to a struct having an incomplete type.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 2 ++
arch/x86/include/asm/kvm_page_track.h | 22 +--
Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/kvm/mmu/page_track.c | 17 +++--
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c
index b835ba7f325c..29ae61f1e303 100644
--- a/arch/x86/kvm/mmu/page
r
memslots. This is a baby step toward making kvm_host.h a KVM-internal
header in the very distant future.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 21 ++---
arch/x86/kvm/mmu/mmu.c| 3 ++-
arch/x86/kvm/mmu/page_track.c
intended.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 8
arch/x86/kvm/mmu/mmu.c| 8
arch/x86/kvm/mmu/page_track.c | 21 +
arch/x86/kvm/mmu/page_track.h | 4 ++--
drivers/gpu/drm/i915/gvt/
nternals (memslots). This will
help set the stage for additional cleanups to the page-track APIs.
Opportunistically align the existing srcu_read_lock_held() usage so that
the new case doesn't stand out like a sore thumb (and not aligning the
new code makes bots unhappy).
Cc: Zhenyu Wang
Sig
commit edd4fa37baa6 ("KVM: x86: Allocate
new rmap and large page tracking when moving memslot").
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 3 +++
arch/x86/kvm/mmu/page_track.c | 5 +
arch/x86/kvm/x86.c
From: Yan Zhao
Remove ->track_remove_slot(), there are no longer any users and it's
unlikely a "flush" hook will ever be the correct API to provide to an
external page-track user.
Cc: Zhenyu Wang
Suggested-by: Sean Christopherson
Signed-off-by: Yan Zhao
Signed-off-by: S
0% certain the
memory region will be removed, i.e. is invoked slightly later in KVM's
memslot modification flow.
Cc: Zhenyu Wang
Suggested-by: Sean Christopherson
Signed-off-by: Yan Zhao
[sean: handle name change, massage changelog, rebase]
Tested-by: Yan Zhao
Signed-off-by: Sean Christoph
its write-tracking
metadata is about to be deleted.
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 8 +---
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index aae
iewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 1 -
arch/x86/kvm/mmu.h | 2 ++
arch/x86/kvm/mmu/mmu.c | 13 ++---
arch/x86/kvm/mmu/page_track.c | 2 ++
4 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/arc
Drop @vcpu from KVM's ->track_write() hook provided for external users of
the page-track APIs now that KVM itself doesn't use the page-track
mechanism.
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 5 ++---
arch/x86/kvm/mmu
allow a protecting the gfn hash with vgpu_lock without too much fuss.
No functional change intended.
Fixes: ba25d977571e ("drm/i915/gvt: Do not destroy ppgtt_mm during vGPU
D3->D0.")
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/g
/20221110014821.1548347-2-sea...@google.com
Signed-off-by: Sean Christopherson
---
arch/x86/kvm/mmu/mmu.c | 10 ++
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 2e4476d38377..23a79723031b 100644
--- a/arch/x86/kvm/mmu
|-> mutex_lock(&vgpu->cache_lock);
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 55 +++
drivers/gpu/drm/i915/gvt/page_track.c | 10 +
2 files changed, 33 insertions(+), 32 deleti
xpose kvm_mmu_zap_all_fast() outside of mmu.c. Keeping
everything in mmu.c will also likely simplify supporting TDX, which
intends to do zap only relevant SPTEs on memslot updates.
No functional change intended.
Suggested-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
arch/x86/includ
;t backed by a compatible hugepage in the
host. Dropping the pre-check on a THP makes it much more likely that the
"error" will be encountered in normal operation.
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 49 ++--
dr
ed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 92ceefe1e6fb..117bac85ac2c 100644
--- a/drivers/gpu/drm/i915/gvt/kvmg
) into the case
statements so that the 2MiB case can try intel_gvt_dma_map_guest_page()
and fallback to splitting the entry on failure.
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/g
will make it more obvious that a future cleanup of
is_2MB_gtt_possible() isn't introducing a bug.
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i91
m/i915/gvt: Add 2M huge gtt support")
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index f30922c55a0c..5426
with discontiguous pfns.
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index de675d799c7d..429f0f993a13 100644
--- a/drivers/gpu/drm/i
intel_gvt_is_valid_gfn() to do GFN validity check from KVM side
while later mapping the GFN through VFIO interface is unnecessarily
fragile and confusing for unaware readers.
Signed-off-by: Yan Zhao
[sean: remove now-unused local variables]
Signed-off-by: Sean Christopherso
t page".
Fixes: b901b252b6cf ("drm/i915/gvt: Add 2M huge gtt support")
Reviewed-by: Yan Zhao
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gtt.c | 4
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i91
k_write(). [Yan]
- Delete the gfn sanity check that relies on kvm_is_visible_gfn() instead
of providing a dedicated interface. [Yan]
v1: https://lore.kernel.org/lkml/20221223005739.1295925-1-sea...@google.com
Sean Christopherson (24):
drm/i915/gvt: Verify pfn is "valid" before derefere
On Mon, May 08, 2023, Yan Zhao wrote:
> On Thu, May 04, 2023 at 10:17:20AM +0800, Yan Zhao wrote:
> > On Wed, May 03, 2023 at 04:16:10PM -0700, Sean Christopherson wrote:
> > > Finally getting back to this series...
> > >
> > > On Thu, Mar 23, 2023, Yan Zhao wr
On Sat, May 06, 2023, Yan Zhao wrote:
> On Sat, May 06, 2023 at 02:35:41PM +0800, Yan Zhao wrote:
> > > > Maybe the checking of PageTransHuge(cur_page) and bailing out is not
> > > > necessary.
> > > > If a page is not transparent huge, but there are 512 contigous 4K
> > > > pages, I think it's st
On Fri, Mar 17, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:36PM -0800, Sean Christopherson wrote:
> > When shadowing a GTT entry with a 2M page, explicitly verify that the
> > first page pinned by VFIO is a transparent hugepage instead of assuming
> >
On Wed, Mar 15, 2023, Sean Christopherson wrote:
> On Wed, Mar 15, 2023, Yan Zhao wrote:
> > On Fri, Mar 10, 2023 at 04:22:51PM -0800, Sean Christopherson wrote:
> > > Disable the page-track notifier code at compile time if there are no
> > &
Finally getting back to this series...
On Thu, Mar 23, 2023, Yan Zhao wrote:
> On Fri, Mar 17, 2023 at 04:28:56PM +0800, Yan Zhao wrote:
> > On Fri, Mar 10, 2023 at 04:22:56PM -0800, Sean Christopherson wrote:
> > ...
> > > +int kvm_write_track_add_gfn(st
On Fri, Mar 17, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:47PM -0800, Sean Christopherson wrote:
> > From: Yan Zhao
> >
> > Add a new page-track hook, track_remove_region(), that is called when a
> > memslot DELETE operation is about to be committed. Th
On Wed, Mar 15, 2023, Andrzej Hajda wrote:
> On 13.03.2023 16:37, Wang, Wei W wrote:
> > On Saturday, March 11, 2023 8:23 AM, Sean Christopherson wrote:
> > > diff --git a/drivers/gpu/drm/i915/gvt/gtt.c
> > > b/drivers/gpu/drm/i915/gvt/gtt.c
> > > ind
On Wed, Mar 15, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:51PM -0800, Sean Christopherson wrote:
> > Disable the page-track notifier code at compile time if there are no
> > external users, i.e. if CONFIG_KVM_EXTERNAL_WRITE_TRACKING=n. KVM itself
> > now hooks emu
On Wed, Mar 15, 2023, Yan Zhao wrote:
> Nit: there is a typo in the commit header: "iff" -> "if"
>
> > -void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, const u8 *new,
> > - int bytes)
> > +void __kvm_page_track_write(struct kvm *kvm, gpa_t gpa, const u8 *new, int
>
On Wed, Mar 15, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:45PM -0800, Sean Christopherson wrote:
> > Disallow moving memslots if the VM has external page-track users, i.e. if
> > KVMGT is being used to expose a virtual GPU to the guest, as KVM doesn't
> > corr
On Wed, Mar 15, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:42PM -0800, Sean Christopherson wrote:
> ...
> > -static void kvm_mmu_invalidate_zap_pages_in_memslot(struct kvm *kvm,
> > - struct kvm_memory_slot *slot,
> > -
On Wed, Mar 15, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:50PM -0800, Sean Christopherson wrote:
> > Bury the declaration of the page-track helpers that are intended only for
> > internal KVM use in a "private" header. In addition to guarding against
> >
On Tue, Mar 14, 2023, Yan Zhao wrote:
> On Fri, Mar 10, 2023 at 04:22:35PM -0800, Sean Christopherson wrote:
> > Honor KVM's max allowed page size when determining whether or not a 2MiB
> > GTT shadow page can be created for the guest. Querying KVM's max allowed
&g
7;s no
reason to use KVM's helper for this one case.
No functional change intended.
Signed-off-by: Sean Christopherson
---
drivers/gpu/drm/i915/gvt/gvt.h | 3 ++-
drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/g
M
iff attachment to VM is successful").
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 10 --
arch/x86/kvm/mmu/page_track.c | 18 --
drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +++--
3 files changed, 23 insertions(+), 22
Disable the page-track notifier code at compile time if there are no
external users, i.e. if CONFIG_KVM_EXTERNAL_WRITE_TRACKING=n. KVM itself
now hooks emulated writes directly instead of relying on the page-track
mechanism.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm
ended.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 8 +--
arch/x86/kvm/mmu/mmu.c| 4 +-
arch/x86/kvm/mmu/page_track.c | 86 ---
arch/x86/kvm/mmu/page_track.h | 5 ++
drivers/gpu/drm/i915/gvt/kvmgt.c
intended.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 8
arch/x86/kvm/mmu/mmu.c| 8
arch/x86/kvm/mmu/page_track.c | 21 +
arch/x86/kvm/mmu/page_track.h | 4 ++--
drivers/gpu/drm/i915/gvt/
Bug the VM if something attempts to write-track a gfn, but write-tracking
isn't enabled. The VM is doomed (and KVM has an egregious bug) if KVM or
KVMGT wants to shadow guest page tables but can't because write-tracking
isn't enabled.
Signed-off-by: Sean Christopherson
---
a
When adding/removing gfns to/from write-tracking, assert that mmu_lock
is held for write, and that either slots_lock or kvm->srcu is held.
mmu_lock must be held for write to protect gfn_write_track's refcount,
and SRCU or slots_lock must be held to protect the memslot itself.
Signed-off-
From: Yan Zhao
Remove ->track_remove_slot(), there are no longer any users and it's
unlikely a "flush" hook will ever be the correct API to provide to an
external page-track user.
Cc: Zhenyu Wang
Suggested-by: Sean Christopherson
Signed-off-by: Yan Zhao
Signed-off-by: S
ardon
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_host.h | 12 +--
arch/x86/include/asm/kvm_page_track.h | 11 +--
arch/x86/kvm/mmu/mmu.c| 14 ++--
arch/x86/kvm/mmu/page_track.c | 111 --
arch/x86/kvm/mmu/page_t
r
memslots. This is a baby step toward making kvm_host.h a KVM-internal
header in the very distant future.
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 26 -
arch/x86/kvm/mmu/mmu.c| 3 ++-
arch/x86/kvm/mmu/page_track.c
0% certain the
memory region will be removed, i.e. is invoked slightly later in KVM's
memslot modification flow.
Cc: Zhenyu Wang
Suggested-by: Sean Christopherson
Signed-off-by: Yan Zhao
[sean: handle name change, massage changelog, rebase]
Signed-off-by: Sean Christopherson
---
drive
e, whereas external
users, i.e. KVMGT, have no ties to the current vCPU and so should never
need the vCPU.
Moving away from the page-track mechanism will allow dropping use of the
page-track mechanism for KVM's own MMU, and will also allow simplifying
and cleaning up the page-track APIs.
Sign
nternals (memslots). This will
help set the stage for additional cleanups to the page-track APIs.
Cc: Zhenyu Wang
Signed-off-by: Yan Zhao
Co-developed-by: Sean Christopherson
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 12
arch/x86/kvm/mmu/page
commit edd4fa37baa6 ("KVM: x86: Allocate
new rmap and large page tracking when moving memslot").
Signed-off-by: Sean Christopherson
---
arch/x86/include/asm/kvm_page_track.h | 3 +++
arch/x86/kvm/mmu/page_track.c | 5 +
arch/x86/kvm/x86.c| 7 +++
1 - 100 of 167 matches
Mail list logo