Re: [PATCH v3 0/3] KVM: Set vcpu->preempted/ready iff scheduled out while running

2024-07-01 Thread David Matlack
On Tue, Jun 18, 2024 at 2:41 PM Sean Christopherson wrote: > > On Fri, 03 May 2024 11:17:31 -0700, David Matlack wrote: > > This series changes KVM to mark a vCPU as preempted/ready if-and-only-if > > it's scheduled out while running. i.e. Do not mark a vCPU > > preempted

Re: [PATCH v4 2/7] mm: multi-gen LRU: Have secondary MMUs participate in aging

2024-05-31 Thread David Matlack
On Fri, May 31, 2024 at 2:06 PM David Matlack wrote: > > On Fri, May 31, 2024 at 1:31 PM Yu Zhao wrote: > > > > On Fri, May 31, 2024 at 1:24 AM Oliver Upton wrote: > > > > > > On Wed, May 29, 2024 at 03:03:21PM -0600, Yu Zhao wrote: > > > >

Re: [PATCH v4 2/7] mm: multi-gen LRU: Have secondary MMUs participate in aging

2024-05-31 Thread David Matlack
On Fri, May 31, 2024 at 1:31 PM Yu Zhao wrote: > > On Fri, May 31, 2024 at 1:24 AM Oliver Upton wrote: > > > > On Wed, May 29, 2024 at 03:03:21PM -0600, Yu Zhao wrote: > > > On Wed, May 29, 2024 at 12:05 PM James Houghton > > > wrote: > > > > > > > > Secondary MMUs are currently consulted for

[PATCH v3 0/3] KVM: Set vcpu->preempted/ready iff scheduled out while running

2024-05-03 Thread David Matlack
85850.1659570-1-dmatl...@google.com/ David Matlack (3): KVM: Introduce vcpu->wants_to_run KVM: Ensure new code that references immediate_exit gets extra scrutiny KVM: Mark a vCPU as preempted/ready iff it's scheduled out while running arch/arm64/kvm/arm.c | 2 +- arch/loonga

[PATCH v3 1/3] KVM: Introduce vcpu->wants_to_run

2024-05-03 Thread David Matlack
a malicious userspace could invoked KVM_RUN with immediate_exit=true and then after KVM reads it to set wants_to_run=false, flip it to false. This would result in the vCPU running in KVM_RUN with wants_to_run=false. This wouldn't cause any real bugs today but is a dangerous landmine. Signed-o

[PATCH v3 2/3] KVM: Ensure new code that references immediate_exit gets extra scrutiny

2024-05-03 Thread David Matlack
ing immediate_exit directly could lead to unexpected bugs in the future. Signed-off-by: David Matlack --- include/uapi/linux/kvm.h | 15 ++- virt/kvm/kvm_main.c | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kv

[PATCH v3 3/3] KVM: Mark a vCPU as preempted/ready iff it's scheduled out while running

2024-05-03 Thread David Matlack
ving to worry about saving vCPU state triggering writes to guest memory. Suggested-by: Sean Christopherson Signed-off-by: David Matlack --- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2b29851a90bd..3973e6

Re: [PATCH v13 16/35] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-11-02 Thread David Matlack
On Thu, Nov 2, 2023 at 9:03 AM Sean Christopherson wrote: > > On Thu, Nov 02, 2023, Paolo Bonzini wrote: > > On 10/31/23 23:39, David Matlack wrote: > > > > > Maybe can you sketch out how you see this proposal being extensible to > > > >

Re: [PATCH v13 16/35] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-10-31 Thread David Matlack
On Tue, Oct 31, 2023 at 2:36 PM Sean Christopherson wrote: > On Tue, Oct 31, 2023, David Matlack wrote: > > On 2023-10-27 11:21 AM, Sean Christopherson wrote: > > > Introduce an ioctl(), KVM_CREATE_GUEST_MEMFD, to allow creating file-based > > > memory that is tie

Re: [PATCH v13 16/35] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory

2023-10-31 Thread David Matlack
On 2023-10-27 11:21 AM, Sean Christopherson wrote: > Introduce an ioctl(), KVM_CREATE_GUEST_MEMFD, to allow creating file-based > memory that is tied to a specific KVM virtual machine and whose primary > purpose is to serve guest memory. > > A guest-first memory subsystem allows for optimizations

Re: [PATCH v13 13/35] KVM: Introduce per-page memory attributes

2023-10-31 Thread David Matlack
On 2023-10-27 11:21 AM, Sean Christopherson wrote: > From: Chao Peng > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 89c1a991a3b8..df573229651b 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -808,6 +809,9 @@ struct kvm { > > #ifdef

Re: [PATCH v13 03/35] KVM: Use gfn instead of hva for mmu_notifier_retry

2023-10-30 Thread David Matlack
On Mon, Oct 30, 2023 at 10:01 AM Paolo Bonzini wrote: > > On Mon, Oct 30, 2023 at 5:53 PM David Matlack wrote: > > > > On 2023-10-27 11:21 AM, Sean Christopherson wrote: > > > From: Chao Peng > > > > > > Currently in mmu_notifier invalidate path,

Re: [PATCH v13 03/35] KVM: Use gfn instead of hva for mmu_notifier_retry

2023-10-30 Thread David Matlack
On Mon, Oct 30, 2023 at 9:53 AM David Matlack wrote: > > On 2023-10-27 11:21 AM, Sean Christopherson wrote: > > From: Chao Peng > > > > +void kvm_mmu_invalidate_range_add(struct kvm *kvm, gfn_t start, gfn_t end); > > What is the reason to separate range_add() from

Re: [PATCH v13 03/35] KVM: Use gfn instead of hva for mmu_notifier_retry

2023-10-30 Thread David Matlack
On 2023-10-27 11:21 AM, Sean Christopherson wrote: > From: Chao Peng > > Currently in mmu_notifier invalidate path, hva range is recorded and > then checked against by mmu_notifier_retry_hva() in the page fault > handling path. However, for the to be introduced private memory, a page

Re: [PATCH v2 0/4] KVM: Refactor KVM stats macros and enable custom stat names

2023-05-09 Thread David Matlack
On Mon, Mar 6, 2023 at 11:01 AM David Matlack wrote: > > This series refactors the KVM stats macros to reduce duplication and > adds the support for choosing custom names for stats. Hi Paolo, I just wanted to double-check if this series is on your radar (probably for 6.5)?

[PATCH v2 4/4] KVM: x86: Drop union for pages_{4k,2m,1g} stats

2023-03-06 Thread David Matlack
...@google.com/ Signed-off-by: David Matlack --- arch/x86/include/asm/kvm_host.h | 9 + arch/x86/kvm/x86.c | 6 +++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 808c292ad3f4..a59e41355ef4

[PATCH v2 3/4] KVM: Allow custom names for KVM_STAT()

2023-03-06 Thread David Matlack
the union for pages_{4k,2m,1g} is no longer necessary. At Google, we have several other out-of-tree stats that would benefit from this support. No functional change intended. Link: https://lore.kernel.org/all/20211019000459.3163029-1-jingzhan...@google.com/ Suggested-by: Jing Zhang Signed-off-by: Dav

[PATCH v2 1/4] KVM: Refactor stats descriptor generation macros

2023-03-06 Thread David Matlack
NTER", and "PCOUNTER"). No functional change intended. Suggested-by: Sean Christopherson Signed-off-by: David Matlack --- arch/arm64/kvm/guest.c| 14 +-- arch/mips/kvm/mips.c | 54 +-- arch/powerpc/kvm/book3s.c | 62 ++-- arch/powerpc/kvm/booke.c | 48 +

[PATCH v2 2/4] KVM: Refactor designated initializer macros for struct _kvm_stats_desc

2023-03-06 Thread David Matlack
Refactor the macros that generate struct _kvm_stats_desc designated initializers to cut down on duplication. No functional change intended. Signed-off-by: David Matlack --- include/linux/kvm_host.h | 75 +++- 1 file changed, 35 insertions(+), 40 deletions

[PATCH v2 0/4] KVM: Refactor KVM stats macros and enable custom stat names

2023-03-06 Thread David Matlack
://lore.kernel.org/kvm/20230118175300.790835-1-dmatl...@google.com/ David Matlack (4): KVM: Refactor stats descriptor generation macros KVM: Refactor designated initializer macros for struct _kvm_stats_desc KVM: Allow custom names for KVM_STAT() KVM: x86: Drop union for pages_{4k,2m,1g

Re: [PATCH V5 5/5] powerpc/kvm/stats: Implement existing and add new halt polling vcpu stats

2016-07-22 Thread David Matlack via Linuxppc-dev
ameters based on the calculated average wait and poll times. > > Signed-off-by: Suraj Jitindar Singh <sjitindarsi...@gmail.com> > Reviewed-by: David Matlack <dmatl...@google.com> > > --- > Change Log: > > V3 -> V4: > - Instead of accounting just

Re: [PATCH V4 5/5] powerpc/kvm/stats: Implement existing and add new halt polling vcpu stats

2016-07-19 Thread David Matlack
ameters based on the calculated average wait and poll times. > > Signed-off-by: Suraj Jitindar Singh <sjitindarsi...@gmail.com> Reviewed-by: David Matlack <dmatl...@google.com> > > --- > Change Log: > > V3 -> V4: > - Instead of accounting just wait

Re: [PATCH V4 4/5] kvm/stats: Add provisioning for ulong vm stats and u64 vcpu stats

2016-07-19 Thread David Matlack via Linuxppc-dev
s where they can be atomically incremented > and are 32-bit on 32-bit systems which may not be able to atomically > increment 64-bit numbers. Modify vm_stat_get() to expect ulongs. > > Signed-off-by: Suraj Jitindar Singh <sjitindarsi...@gmail.com> Looks great, thanks. Reviewed-b

Re: [PATCH V4 3/5] kvm/ppc/book3s_hv: Implement halt polling in the kvm_hv kernel module

2016-07-19 Thread David Matlack via Linuxppc-dev
On Tue, Jul 19, 2016 at 1:12 AM, Suraj Jitindar Singh wrote: > This patch introduces new halt polling functionality into the kvm_hv kernel > module. When a vcore is idle it will poll for some period of time before > scheduling itself out. > > When all of the runnable

Re: [PATCH V2 5/5] powerpc/kvm/stats: Implement existing and add new halt polling vcpu stats

2016-07-13 Thread David Matlack via Linuxppc-dev
On Tue, Jul 12, 2016 at 11:07 PM, Suraj Jitindar Singh <sjitindarsi...@gmail.com> wrote: > On 12/07/16 16:17, Suraj Jitindar Singh wrote: >> On 12/07/16 02:49, David Matlack wrote: [snip] >>> It's possible to poll and wait in one halt, conflating this stat with >&g

Re: [PATCH V2 4/5] kvm/stats: Add provisioning for 64-bit vcpu statistics

2016-07-11 Thread David Matlack via Linuxppc-dev
On Mon, Jul 11, 2016 at 12:31 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 11/07/2016 19:30, David Matlack wrote: >> On Mon, Jul 11, 2016 at 10:05 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: >>> >>> >>> On 11/07/2016 18:51, David

Re: [PATCH V2 4/5] kvm/stats: Add provisioning for 64-bit vcpu statistics

2016-07-11 Thread David Matlack
On Mon, Jul 11, 2016 at 10:05 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 11/07/2016 18:51, David Matlack wrote: >>> > vcpus have statistics associated with them which can be viewed within the >>> > debugfs. Currently

Re: [PATCH V2 3/5] kvm/ppc/book3s_hv: Implement halt polling in the kvm_hv kernel module

2016-07-11 Thread David Matlack via Linuxppc-dev
On Mon, Jul 11, 2016 at 10:07 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 11/07/2016 18:57, David Matlack wrote: >> On Mon, Jul 11, 2016 at 12:08 AM, Suraj Jitindar Singh >> <sjitindarsi...@gmail.com> wrote: >> > This patch introduces new

Re: [PATCH V2 3/5] kvm/ppc/book3s_hv: Implement halt polling in the kvm_hv kernel module

2016-07-11 Thread David Matlack via Linuxppc-dev
On Mon, Jul 11, 2016 at 12:08 AM, Suraj Jitindar Singh wrote: > This patch introduces new halt polling functionality into the kvm_hv kernel > module. When a vcore is idle it will poll for some period of time before > scheduling itself out. Is there any way to reuse the

Re: [PATCH V2 4/5] kvm/stats: Add provisioning for 64-bit vcpu statistics

2016-07-11 Thread David Matlack
On Mon, Jul 11, 2016 at 12:08 AM, Suraj Jitindar Singh wrote: > vcpus have statistics associated with them which can be viewed within the > debugfs. Currently it is assumed within the vcpu_stat_get() and > vcpu_stat_get_per_vm() functions that all of these statistics are

Re: [PATCH V2 5/5] powerpc/kvm/stats: Implement existing and add new halt polling vcpu stats

2016-07-11 Thread David Matlack via Linuxppc-dev
On Mon, Jul 11, 2016 at 12:08 AM, Suraj Jitindar Singh wrote: > vcpu stats are used to collect information about a vcpu which can be viewed > in the debugfs. For example halt_attempted_poll and halt_successful_poll > are used to keep track of the number of times the vcpu