All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Sebastian Ene <sebastianene@google.com>
Cc: kvm@vger.kernel.org, qperret@google.com, will@kernel.org,
	julien.thierry.kdev@gmail.com
Subject: Re: [PATCH kvmtool v7 2/3] aarch64: Add stolen time support
Date: Thu, 03 Mar 2022 17:51:36 +0000	[thread overview]
Message-ID: <87pmn22ac7.wl-maz@kernel.org> (raw)
In-Reply-To: <YiCuBsKsh4TAZqTs@google.com>

On Thu, 03 Mar 2022 12:01:10 +0000,
Sebastian Ene <sebastianene@google.com> wrote:
> 
> > > +int kvm_cpu__setup_pvtime(struct kvm_cpu *vcpu)
> > > +{
> > > +	int ret;
> > > +	bool has_stolen_time;
> > > +	u64 pvtime_guest_addr = ARM_PVTIME_MMIO_BASE + vcpu->cpu_id *
> > > +		ARM_PVTIME_STRUCT_SIZE;
> > > +	struct kvm_config *kvm_cfg = NULL;
> > > +	struct kvm_device_attr pvtime_attr = (struct kvm_device_attr) {
> > > +		.group	= KVM_ARM_VCPU_PVTIME_CTRL,
> > > +		.addr	= KVM_ARM_VCPU_PVTIME_IPA
> > > +	};
> > > +
> > > +	kvm_cfg = &vcpu->kvm->cfg;
> > > +	if (kvm_cfg->no_pvtime)
> > > +		return 0;
> > > +
> > > +	if (!pvtime_data.is_supported)
> > > +		return -ENOTSUP;
> > 
> > It is a bit odd to have this hard failure if running on a system that
> > doesn't have pvtime. It forces the user to alter their command-line,
> > which is a bit annoying. I'd rather have a soft-fail here.
> > 
> 
> The flag 'is_supported' is set to false when we support pvtime but we
> fail to configure it. We verify that we support pvtime by calling the check
> extension KVM_CAP_STEAL_TIME. I think the naming is odd here for the
> flag name. It should be : 'is_failed_cfg'.

Ah, I see. Yes, the name is misleading.

>
> > > +
> > > +	has_stolen_time = kvm__supports_extension(vcpu->kvm,
> > > +						  KVM_CAP_STEAL_TIME);
> > > +	if (!has_stolen_time)
> > > +		return 0;

Here, you could force no_pvtime to 1, and avoid checking for each vcpu
once you detected that the host is not equipped to deal with it.

Thanks,

	M.

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

  reply	other threads:[~2022-03-03 17:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 14:07 [PATCH kvmtool v7 0/3] aarch64: Add stolen time support Sebastian Ene
2022-03-02 14:07 ` Sebastian Ene
2022-03-02 14:07 ` [PATCH kvmtool v7 1/3] aarch64: Populate the vCPU struct before target->init() Sebastian Ene
2022-03-02 14:07   ` Sebastian Ene
2022-03-02 14:21   ` Marc Zyngier
2022-03-02 14:21     ` Marc Zyngier
2022-03-02 14:07 ` [PATCH kvmtool v7 2/3] aarch64: Add stolen time support Sebastian Ene
2022-03-02 14:07   ` Sebastian Ene
2022-03-02 14:41   ` Marc Zyngier
2022-03-02 14:41     ` Marc Zyngier
2022-03-03 12:01     ` Sebastian Ene
2022-03-03 17:51       ` Marc Zyngier [this message]
2022-03-07 11:46         ` Sebastian Ene
2022-03-07 10:52     ` Alexandru Elisei
2022-03-07 10:52       ` Alexandru Elisei
2022-03-07 11:46   ` Alexandru Elisei
2022-03-07 11:46     ` Alexandru Elisei
2022-03-07 14:55     ` Sebastian Ene
2022-03-02 14:07 ` [PATCH kvmtool v7 3/3] Add --no-pvtime command line argument Sebastian Ene
2022-03-02 14:07   ` Sebastian Ene

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=87pmn22ac7.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=qperret@google.com \
    --cc=sebastianene@google.com \
    --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.