From: Oliver Upton <oliver.upton@linux.dev>
To: kvm-riscv@lists.infradead.org
Subject: [PATCH v2 1/6] KVM: Add a flag to track if a loaded vCPU is scheduled out
Date: Wed, 22 May 2024 08:16:07 -0700 [thread overview]
Message-ID: <Zk4MN49212SaW1_z@linux.dev> (raw)
In-Reply-To: <20240522014013.1672962-2-seanjc@google.com>
On Tue, May 21, 2024 at 06:40:08PM -0700, Sean Christopherson wrote:
> Add a kvm_vcpu.scheduled_out flag to track if a vCPU is in the process of
> being scheduled out (vCPU put path), or if the vCPU is being reloaded
> after being scheduled out (vCPU load path). In the short term, this will
> allow dropping kvm_arch_sched_in(), as arch code can query scheduled_out
> during kvm_arch_vcpu_load().
>
> Longer term, scheduled_out opens up other potential optimizations, without
> creating subtle/brittle dependencies. E.g. it allows KVM to keep guest
> state (that is managed via kvm_arch_vcpu_{load,put}()) loaded across
> kvm_sched_{out,in}(), if KVM knows the state isn't accessed by the host
> kernel. Forcing arch code to coordinate between kvm_arch_sched_{in,out}()
> and kvm_arch_vcpu_{load,put}() is awkward, not reusable, and relies on the
> exact ordering of calls into arch code.
>
> Adding scheduled_out also obviates the need for a kvm_arch_sched_out()
> hook, e.g. if arch code needs to do something novel when putting vCPU
> state.
>
> And even if KVM never uses scheduled_out for anything beyond dropping
> kvm_arch_sched_in(), just being able to remove all of the arch stubs makes
> it worth adding the flag.
>
> Link: https://lore.kernel.org/all/20240430224431.490139-1-seanjc at google.com
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
WARNING: multiple messages have this Message-ID (diff)
From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
Tianrui Zhao <zhaotianrui@loongson.cn>,
Bibo Mao <maobibo@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Anup Patel <anup@brainfault.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, loongarch@lists.linux.dev,
linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] KVM: Add a flag to track if a loaded vCPU is scheduled out
Date: Wed, 22 May 2024 08:16:07 -0700 [thread overview]
Message-ID: <Zk4MN49212SaW1_z@linux.dev> (raw)
In-Reply-To: <20240522014013.1672962-2-seanjc@google.com>
On Tue, May 21, 2024 at 06:40:08PM -0700, Sean Christopherson wrote:
> Add a kvm_vcpu.scheduled_out flag to track if a vCPU is in the process of
> being scheduled out (vCPU put path), or if the vCPU is being reloaded
> after being scheduled out (vCPU load path). In the short term, this will
> allow dropping kvm_arch_sched_in(), as arch code can query scheduled_out
> during kvm_arch_vcpu_load().
>
> Longer term, scheduled_out opens up other potential optimizations, without
> creating subtle/brittle dependencies. E.g. it allows KVM to keep guest
> state (that is managed via kvm_arch_vcpu_{load,put}()) loaded across
> kvm_sched_{out,in}(), if KVM knows the state isn't accessed by the host
> kernel. Forcing arch code to coordinate between kvm_arch_sched_{in,out}()
> and kvm_arch_vcpu_{load,put}() is awkward, not reusable, and relies on the
> exact ordering of calls into arch code.
>
> Adding scheduled_out also obviates the need for a kvm_arch_sched_out()
> hook, e.g. if arch code needs to do something novel when putting vCPU
> state.
>
> And even if KVM never uses scheduled_out for anything beyond dropping
> kvm_arch_sched_in(), just being able to remove all of the arch stubs makes
> it worth adding the flag.
>
> Link: https://lore.kernel.org/all/20240430224431.490139-1-seanjc@google.com
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
WARNING: multiple messages have this Message-ID (diff)
From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
Tianrui Zhao <zhaotianrui@loongson.cn>,
Bibo Mao <maobibo@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Anup Patel <anup@brainfault.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, loongarch@lists.linux.dev,
linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] KVM: Add a flag to track if a loaded vCPU is scheduled out
Date: Wed, 22 May 2024 08:16:07 -0700 [thread overview]
Message-ID: <Zk4MN49212SaW1_z@linux.dev> (raw)
In-Reply-To: <20240522014013.1672962-2-seanjc@google.com>
On Tue, May 21, 2024 at 06:40:08PM -0700, Sean Christopherson wrote:
> Add a kvm_vcpu.scheduled_out flag to track if a vCPU is in the process of
> being scheduled out (vCPU put path), or if the vCPU is being reloaded
> after being scheduled out (vCPU load path). In the short term, this will
> allow dropping kvm_arch_sched_in(), as arch code can query scheduled_out
> during kvm_arch_vcpu_load().
>
> Longer term, scheduled_out opens up other potential optimizations, without
> creating subtle/brittle dependencies. E.g. it allows KVM to keep guest
> state (that is managed via kvm_arch_vcpu_{load,put}()) loaded across
> kvm_sched_{out,in}(), if KVM knows the state isn't accessed by the host
> kernel. Forcing arch code to coordinate between kvm_arch_sched_{in,out}()
> and kvm_arch_vcpu_{load,put}() is awkward, not reusable, and relies on the
> exact ordering of calls into arch code.
>
> Adding scheduled_out also obviates the need for a kvm_arch_sched_out()
> hook, e.g. if arch code needs to do something novel when putting vCPU
> state.
>
> And even if KVM never uses scheduled_out for anything beyond dropping
> kvm_arch_sched_in(), just being able to remove all of the arch stubs makes
> it worth adding the flag.
>
> Link: https://lore.kernel.org/all/20240430224431.490139-1-seanjc@google.com
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Marc Zyngier <maz@kernel.org>,
Huacai Chen <chenhuacai@kernel.org>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Albert Ou <aou@eecs.berkeley.edu>, Bibo Mao <maobibo@loongson.cn>,
loongarch@lists.linux.dev,
Paul Walmsley <paul.walmsley@sifive.com>,
kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
Anup Patel <anup@brainfault.org>,
linux-mips@vger.kernel.org, Palmer Dabbelt <palmer@dabbelt.com>,
kvm-riscv@lists.infradead.org,
Paolo Bonzini <pbonzini@redhat.com>,
Tianrui Zhao <zhaotianrui@loongson.cn>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/6] KVM: Add a flag to track if a loaded vCPU is scheduled out
Date: Wed, 22 May 2024 08:16:07 -0700 [thread overview]
Message-ID: <Zk4MN49212SaW1_z@linux.dev> (raw)
In-Reply-To: <20240522014013.1672962-2-seanjc@google.com>
On Tue, May 21, 2024 at 06:40:08PM -0700, Sean Christopherson wrote:
> Add a kvm_vcpu.scheduled_out flag to track if a vCPU is in the process of
> being scheduled out (vCPU put path), or if the vCPU is being reloaded
> after being scheduled out (vCPU load path). In the short term, this will
> allow dropping kvm_arch_sched_in(), as arch code can query scheduled_out
> during kvm_arch_vcpu_load().
>
> Longer term, scheduled_out opens up other potential optimizations, without
> creating subtle/brittle dependencies. E.g. it allows KVM to keep guest
> state (that is managed via kvm_arch_vcpu_{load,put}()) loaded across
> kvm_sched_{out,in}(), if KVM knows the state isn't accessed by the host
> kernel. Forcing arch code to coordinate between kvm_arch_sched_{in,out}()
> and kvm_arch_vcpu_{load,put}() is awkward, not reusable, and relies on the
> exact ordering of calls into arch code.
>
> Adding scheduled_out also obviates the need for a kvm_arch_sched_out()
> hook, e.g. if arch code needs to do something novel when putting vCPU
> state.
>
> And even if KVM never uses scheduled_out for anything beyond dropping
> kvm_arch_sched_in(), just being able to remove all of the arch stubs makes
> it worth adding the flag.
>
> Link: https://lore.kernel.org/all/20240430224431.490139-1-seanjc@google.com
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
WARNING: multiple messages have this Message-ID (diff)
From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
Tianrui Zhao <zhaotianrui@loongson.cn>,
Bibo Mao <maobibo@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Anup Patel <anup@brainfault.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, loongarch@lists.linux.dev,
linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] KVM: Add a flag to track if a loaded vCPU is scheduled out
Date: Wed, 22 May 2024 08:16:07 -0700 [thread overview]
Message-ID: <Zk4MN49212SaW1_z@linux.dev> (raw)
In-Reply-To: <20240522014013.1672962-2-seanjc@google.com>
On Tue, May 21, 2024 at 06:40:08PM -0700, Sean Christopherson wrote:
> Add a kvm_vcpu.scheduled_out flag to track if a vCPU is in the process of
> being scheduled out (vCPU put path), or if the vCPU is being reloaded
> after being scheduled out (vCPU load path). In the short term, this will
> allow dropping kvm_arch_sched_in(), as arch code can query scheduled_out
> during kvm_arch_vcpu_load().
>
> Longer term, scheduled_out opens up other potential optimizations, without
> creating subtle/brittle dependencies. E.g. it allows KVM to keep guest
> state (that is managed via kvm_arch_vcpu_{load,put}()) loaded across
> kvm_sched_{out,in}(), if KVM knows the state isn't accessed by the host
> kernel. Forcing arch code to coordinate between kvm_arch_sched_{in,out}()
> and kvm_arch_vcpu_{load,put}() is awkward, not reusable, and relies on the
> exact ordering of calls into arch code.
>
> Adding scheduled_out also obviates the need for a kvm_arch_sched_out()
> hook, e.g. if arch code needs to do something novel when putting vCPU
> state.
>
> And even if KVM never uses scheduled_out for anything beyond dropping
> kvm_arch_sched_in(), just being able to remove all of the arch stubs makes
> it worth adding the flag.
>
> Link: https://lore.kernel.org/all/20240430224431.490139-1-seanjc@google.com
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-05-22 15:16 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 1:40 [PATCH v2 0/6] KVM: Fold kvm_arch_sched_in() into kvm_arch_vcpu_load() Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` [PATCH v2 1/6] KVM: Add a flag to track if a loaded vCPU is scheduled out Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 15:16 ` Oliver Upton [this message]
2024-05-22 15:16 ` Oliver Upton
2024-05-22 15:16 ` Oliver Upton
2024-05-22 15:16 ` Oliver Upton
2024-05-22 15:16 ` Oliver Upton
2024-05-22 1:40 ` [PATCH v2 2/6] KVM: VMX: Move PLE grow/shrink helpers above vmx_vcpu_load() Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` [PATCH v2 3/6] KVM: x86: Fold kvm_arch_sched_in() into kvm_arch_vcpu_load() Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-23 22:47 ` Huang, Kai
2024-05-23 22:47 ` Huang, Kai
2024-05-23 22:47 ` Huang, Kai
2024-05-23 22:47 ` Huang, Kai
2024-05-23 22:47 ` Huang, Kai
2024-05-28 19:16 ` Sean Christopherson
2024-05-28 19:16 ` Sean Christopherson
2024-05-28 19:16 ` Sean Christopherson
2024-05-28 19:16 ` Sean Christopherson
2024-05-28 19:16 ` Sean Christopherson
2024-05-29 10:50 ` Huang, Kai
2024-05-29 10:50 ` Huang, Kai
2024-05-29 10:50 ` Huang, Kai
2024-05-29 10:50 ` Huang, Kai
2024-05-29 10:50 ` Huang, Kai
2024-05-29 12:54 ` Sean Christopherson
2024-05-29 12:54 ` Sean Christopherson
2024-05-29 12:54 ` Sean Christopherson
2024-05-29 12:54 ` Sean Christopherson
2024-05-29 12:54 ` Sean Christopherson
2024-05-22 1:40 ` [PATCH v2 4/6] KVM: Delete the now unused kvm_arch_sched_in() Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-24 1:50 ` maobibo
2024-05-24 1:50 ` maobibo
2024-05-24 1:50 ` maobibo
2024-05-24 1:50 ` maobibo
2024-05-24 1:50 ` maobibo
2024-05-22 1:40 ` [PATCH v2 5/6] KVM: x86: Unconditionally set l1tf_flush_l1d during vCPU load Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-23 22:42 ` Huang, Kai
2024-05-23 22:42 ` Huang, Kai
2024-05-23 22:42 ` Huang, Kai
2024-05-23 22:42 ` Huang, Kai
2024-05-23 22:42 ` Huang, Kai
2024-05-22 1:40 ` [PATCH v2 6/6] KVM: x86: Drop now-superflous setting of l1tf_flush_l1d in vcpu_run() Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-22 1:40 ` Sean Christopherson
2024-05-23 22:48 ` [PATCH v2 0/6] KVM: Fold kvm_arch_sched_in() into kvm_arch_vcpu_load() Huang, Kai
2024-05-23 22:48 ` Huang, Kai
2024-05-23 22:48 ` Huang, Kai
2024-05-23 22:48 ` Huang, Kai
2024-05-23 22:48 ` Huang, Kai
2024-06-12 1:18 ` Sean Christopherson
2024-06-12 1:18 ` Sean Christopherson
2024-06-12 1:18 ` Sean Christopherson
2024-06-12 1:18 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zk4MN49212SaW1_z@linux.dev \
--to=oliver.upton@linux.dev \
--cc=kvm-riscv@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.