All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	kernel-team@android.com
Subject: Re: [PATCH 0/5] KVM: arm64: Reorganise vcpu first run
Date: Sat, 16 Oct 2021 11:49:57 +0100	[thread overview]
Message-ID: <87k0idutuy.wl-maz@kernel.org> (raw)
In-Reply-To: <20211015100548.4yd2ukon5rypexoo@gator>

On Fri, 15 Oct 2021 11:05:48 +0100,
Andrew Jones <drjones@redhat.com> wrote:
> 
> On Fri, Oct 15, 2021 at 11:49:00AM +0200, Andrew Jones wrote:
> > On Fri, Oct 15, 2021 at 10:08:17AM +0100, Marc Zyngier wrote:
> > > KVM/arm64 relies heavily on a bunch of things to be done on the first
> > > run of the vcpu. We also do a bunch of things on PID change. It turns
> > > out that these two things are pretty similar (the first PID change is
> > > also the first run).
> > > 
> > > This small series aims at simplifying all that, and to get rid of the
> > > vcpu->arch.has_run_once state.
> > > 
> > > Marc Zyngier (5):
> > >   KVM: arm64: Move SVE state mapping at HYP to finalize-time
> > >   KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line
> > >   KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and
> > >     kvm_vcpu_first_run_init()
> > >   KVM: arm64: Restructure the point where has_run_once is advertised
> > 
> > Maybe do the restructuring before the merging in order to avoid the
> > potential for bizarre states?

Yup, can do.

> 
> Also, before we do the merge I think we need to duplicate the
> 
>         if (unlikely(!kvm_vcpu_initialized(vcpu)))
>                 return -ENOEXEC;
> 
> that we currently have above the call of kvm_vcpu_first_run_init()
> into kvm_arch_vcpu_run_pid_change() because
> kvm_arch_vcpu_run_pid_change() is called before kvm_arch_vcpu_ioctl_run()
> in KVM_RUN.

Well spotted.

I think this check should be moved into kvm_arch_vcpu_run_pid_change()
instead of duplicated though, just like we have the check for
'finalized' there. After all, they are the two sides of the same coin.

This nicely moves all checks on the slow path.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Andrew Jones <drjones@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH 0/5] KVM: arm64: Reorganise vcpu first run
Date: Sat, 16 Oct 2021 11:49:57 +0100	[thread overview]
Message-ID: <87k0idutuy.wl-maz@kernel.org> (raw)
In-Reply-To: <20211015100548.4yd2ukon5rypexoo@gator>

On Fri, 15 Oct 2021 11:05:48 +0100,
Andrew Jones <drjones@redhat.com> wrote:
> 
> On Fri, Oct 15, 2021 at 11:49:00AM +0200, Andrew Jones wrote:
> > On Fri, Oct 15, 2021 at 10:08:17AM +0100, Marc Zyngier wrote:
> > > KVM/arm64 relies heavily on a bunch of things to be done on the first
> > > run of the vcpu. We also do a bunch of things on PID change. It turns
> > > out that these two things are pretty similar (the first PID change is
> > > also the first run).
> > > 
> > > This small series aims at simplifying all that, and to get rid of the
> > > vcpu->arch.has_run_once state.
> > > 
> > > Marc Zyngier (5):
> > >   KVM: arm64: Move SVE state mapping at HYP to finalize-time
> > >   KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line
> > >   KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and
> > >     kvm_vcpu_first_run_init()
> > >   KVM: arm64: Restructure the point where has_run_once is advertised
> > 
> > Maybe do the restructuring before the merging in order to avoid the
> > potential for bizarre states?

Yup, can do.

> 
> Also, before we do the merge I think we need to duplicate the
> 
>         if (unlikely(!kvm_vcpu_initialized(vcpu)))
>                 return -ENOEXEC;
> 
> that we currently have above the call of kvm_vcpu_first_run_init()
> into kvm_arch_vcpu_run_pid_change() because
> kvm_arch_vcpu_run_pid_change() is called before kvm_arch_vcpu_ioctl_run()
> in KVM_RUN.

Well spotted.

I think this check should be moved into kvm_arch_vcpu_run_pid_change()
instead of duplicated though, just like we have the check for
'finalized' there. After all, they are the two sides of the same coin.

This nicely moves all checks on the slow path.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	kernel-team@android.com
Subject: Re: [PATCH 0/5] KVM: arm64: Reorganise vcpu first run
Date: Sat, 16 Oct 2021 11:49:57 +0100	[thread overview]
Message-ID: <87k0idutuy.wl-maz@kernel.org> (raw)
In-Reply-To: <20211015100548.4yd2ukon5rypexoo@gator>

On Fri, 15 Oct 2021 11:05:48 +0100,
Andrew Jones <drjones@redhat.com> wrote:
> 
> On Fri, Oct 15, 2021 at 11:49:00AM +0200, Andrew Jones wrote:
> > On Fri, Oct 15, 2021 at 10:08:17AM +0100, Marc Zyngier wrote:
> > > KVM/arm64 relies heavily on a bunch of things to be done on the first
> > > run of the vcpu. We also do a bunch of things on PID change. It turns
> > > out that these two things are pretty similar (the first PID change is
> > > also the first run).
> > > 
> > > This small series aims at simplifying all that, and to get rid of the
> > > vcpu->arch.has_run_once state.
> > > 
> > > Marc Zyngier (5):
> > >   KVM: arm64: Move SVE state mapping at HYP to finalize-time
> > >   KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line
> > >   KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and
> > >     kvm_vcpu_first_run_init()
> > >   KVM: arm64: Restructure the point where has_run_once is advertised
> > 
> > Maybe do the restructuring before the merging in order to avoid the
> > potential for bizarre states?

Yup, can do.

> 
> Also, before we do the merge I think we need to duplicate the
> 
>         if (unlikely(!kvm_vcpu_initialized(vcpu)))
>                 return -ENOEXEC;
> 
> that we currently have above the call of kvm_vcpu_first_run_init()
> into kvm_arch_vcpu_run_pid_change() because
> kvm_arch_vcpu_run_pid_change() is called before kvm_arch_vcpu_ioctl_run()
> in KVM_RUN.

Well spotted.

I think this check should be moved into kvm_arch_vcpu_run_pid_change()
instead of duplicated though, just like we have the check for
'finalized' there. After all, they are the two sides of the same coin.

This nicely moves all checks on the slow path.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-10-16 10:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  9:08 [PATCH 0/5] KVM: arm64: Reorganise vcpu first run Marc Zyngier
2021-10-15  9:08 ` Marc Zyngier
2021-10-15  9:08 ` Marc Zyngier
2021-10-15  9:08 ` [PATCH 1/5] KVM: arm64: Move SVE state mapping at HYP to finalize-time Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08 ` [PATCH 2/5] KVM: arm64: Move kvm_arch_vcpu_run_pid_change() out of line Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08 ` [PATCH 3/5] KVM: arm64: Merge kvm_arch_vcpu_run_pid_change() and kvm_vcpu_first_run_init() Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08 ` [PATCH 4/5] KVM: arm64: Restructure the point where has_run_once is advertised Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08 ` [PATCH 5/5] KVM: arm64: Drop vcpu->arch.has_run_once for vcpu->pid Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:08   ` Marc Zyngier
2021-10-15  9:49 ` [PATCH 0/5] KVM: arm64: Reorganise vcpu first run Andrew Jones
2021-10-15  9:49   ` Andrew Jones
2021-10-15  9:49   ` Andrew Jones
2021-10-15 10:05   ` Andrew Jones
2021-10-15 10:05     ` Andrew Jones
2021-10-15 10:05     ` Andrew Jones
2021-10-16 10:49     ` Marc Zyngier [this message]
2021-10-16 10:49       ` Marc Zyngier
2021-10-16 10:49       ` Marc Zyngier

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=87k0idutuy.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=drjones@redhat.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=will@kernel.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.