All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: "André Przywara" <andre.przywara@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Dave Martin <Dave.Martin@arm.com>,
	kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state
Date: Mon, 18 Feb 2019 14:15:45 +0000	[thread overview]
Message-ID: <20190218141545.2d677718@why.wild-wind.fr.eu.org> (raw)
In-Reply-To: <24383efc-795c-163b-0346-315f88f3774f@arm.com>

On Mon, 18 Feb 2019 11:29:57 +0000
André Przywara <andre.przywara@arm.com> wrote:

> On 18/02/2019 09:07, Marc Zyngier wrote:
> > On Fri, 15 Feb 2019 17:26:02 +0000
> > Dave Martin <Dave.Martin@arm.com> wrote:  
> 
> Hi,
> 
> >   
> >> On Fri, Feb 15, 2019 at 11:42:27AM +0000, Marc Zyngier wrote:  
> >>> On Fri, 15 Feb 2019 09:58:57 +0000,
> >>> Andre Przywara <andre.przywara@arm.com> wrote:    
> >>>>
> >>>> On Wed, 30 Jan 2019 11:39:00 +0000
> >>>> Andre Przywara <andre.przywara@arm.com> wrote:
> >>>>
> >>>> Peter, Marc, Christoffer,
> >>>>
> >>>> can we have an opinion on whether it's useful to introduce some
> >>>> common scheme for firmware workaround system registers (parts of
> >>>> KVM_REG_ARM_FW_REG(x)), which would allow checking them for
> >>>> compatibility between two kernels without specifically knowing about
> >>>> them?
> >>>> Dave suggested to introduce some kind of signed encoding in the 4
> >>>> LSBs for all those registers (including future ones), where 0 means
> >>>> UNKNOWN and greater values are better. So without knowing about the
> >>>> particular register, one could judge whether it's safe to migrate.
> >>>> I am just not sure how useful this is, given that QEMU seems to ask
> >>>> the receiving kernel about any sysreg, and doesn't particularly care
> >>>> about the meaning of those registers. And I am not sure we really
> >>>> want to introduce some kind of forward looking scheme in the kernel
> >>>> here, short of a working crystal ball. I think the kernel policy was
> >>>> always to be as strict as possible about those things.    
> >>>
> >>> I honestly don't understand how userspace can decide whether a given
> >>> configuration is migratable or not solely based on the value of such a
> >>> register. In my experience, the target system has a role to play, and
> >>> is the only place where we can find out about whether migration is
> >>> actually possible.    
> >>
> >> Both origin and target system need to be taken into account.  I don't
> >> think that's anything new.  
> > 
> > Well, that was what I understood from Andre's question.
> >   
> >>  
> >>> As you said, userspace doesn't interpret the data, nor should it. It
> >>> is only on the receiving end that compatibility is assessed and
> >>> whether some level of compatibility can be safely ensured.
> >>>
> >>> So to sum it up, I don't believe in this approach as a general way of
> >>> describing the handling or errata.    
> >>
> >> For context, my idea attempted to put KVM, not userspace, in charge of
> >> the decision: userspace applies fixed comparison rules determined ahead
> >> of time, but KVM supplies the values compared (and hence determines the
> >> result).
> >>
> >> My worry was that otherwise we may end up with a wild-west tangle of
> >> arbitrary properties that userspace needs specific knowledge about.  
> > 
> > And this is where our understanding differs. I do not think userspace
> > has to care at all. All it has to do is to provide the saved register
> > values to the target system, and let KVM accept or refuse these
> > settings. I can't see what providing a set of predefined values back to
> > userspace gains us.
> > 
> > An unknown register on the target system fails the restore phase:
> > that's absolutely fine, as we don't want to run on a system that
> > doesn't know about the mitigation.
> > 
> > An incompatible value fails the restore as well, as KVM itself finds
> > that this is a service it cannot safely provide.
> > 
> > No userspace involvement, no QEMU upgrade required. Only the kernel
> > knows about it.  
> 
> Yes, this is what I understand as well. From experience, many times when
> we were not strict enough about some userland interface, it backfired.
> 
> The only case where such a forward-looking scheme would make sense is
> the case where the source system has a new kernel, advertising a new
> firmware workaround register, in an unknown or missing state (0 or -1).
> An older kernel on the target system might not know about this register.
> That would translate into "unknown", which is compatible with 0 or -1
> from the source. So migration would be fine, but we deny it because the
> new kernel returns -EINVAL.
> 
> But I am not sure this construct is worth implementing in the kernel. If
> people care about this case, they could implement a workaround in
> userland instead. Or just upgrade the target kernel before migration.

Upgrading the target may not be convenient. But more importantly, I
don't think we expect downgrades to be supported. This can break for an
infinity of reasons, such as the feature set implemented on the source
not being there on the target.

As you said, if userspace wants to bypass these restrictions, it can
alter the data before restoring.

> 
> >> We can tolerate a few though.  If we accumulate a significant number
> >> of errata/vulnerability properties that need to be reported to
> >> userspace, this may be worth revisiting.  If not, it doesn't matter.  
> > 
> > Andre: if you want this to make it into 5.1, the time is now.  
> 
> OK. So is v2 [1] fine then? This implements the much easier "bigger is
> better" scheme, but being 0 based instead of using a 4-bit signed encoding.
> Let me know if there is something to rework in there.
> 
> Cheers,
> Andre.
> 
> [1]
> http://lists.infradead.org/pipermail/linux-arm-kernel/2019-January/627739.html

Sorry, I've lost track of which is which. Please post something that is
consistent,  and addresses Steve's concerns if there is still any. Make
sure it applies on top of the current kvmarm/next, and provide
evidences that you've tested migration on the expected working and
expected failing configurations.

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 <marc.zyngier@arm.com>
To: "André Przywara" <andre.przywara@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Dave Martin <Dave.Martin@arm.com>,
	kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state
Date: Mon, 18 Feb 2019 14:15:45 +0000	[thread overview]
Message-ID: <20190218141545.2d677718@why.wild-wind.fr.eu.org> (raw)
In-Reply-To: <24383efc-795c-163b-0346-315f88f3774f@arm.com>

On Mon, 18 Feb 2019 11:29:57 +0000
André Przywara <andre.przywara@arm.com> wrote:

> On 18/02/2019 09:07, Marc Zyngier wrote:
> > On Fri, 15 Feb 2019 17:26:02 +0000
> > Dave Martin <Dave.Martin@arm.com> wrote:  
> 
> Hi,
> 
> >   
> >> On Fri, Feb 15, 2019 at 11:42:27AM +0000, Marc Zyngier wrote:  
> >>> On Fri, 15 Feb 2019 09:58:57 +0000,
> >>> Andre Przywara <andre.przywara@arm.com> wrote:    
> >>>>
> >>>> On Wed, 30 Jan 2019 11:39:00 +0000
> >>>> Andre Przywara <andre.przywara@arm.com> wrote:
> >>>>
> >>>> Peter, Marc, Christoffer,
> >>>>
> >>>> can we have an opinion on whether it's useful to introduce some
> >>>> common scheme for firmware workaround system registers (parts of
> >>>> KVM_REG_ARM_FW_REG(x)), which would allow checking them for
> >>>> compatibility between two kernels without specifically knowing about
> >>>> them?
> >>>> Dave suggested to introduce some kind of signed encoding in the 4
> >>>> LSBs for all those registers (including future ones), where 0 means
> >>>> UNKNOWN and greater values are better. So without knowing about the
> >>>> particular register, one could judge whether it's safe to migrate.
> >>>> I am just not sure how useful this is, given that QEMU seems to ask
> >>>> the receiving kernel about any sysreg, and doesn't particularly care
> >>>> about the meaning of those registers. And I am not sure we really
> >>>> want to introduce some kind of forward looking scheme in the kernel
> >>>> here, short of a working crystal ball. I think the kernel policy was
> >>>> always to be as strict as possible about those things.    
> >>>
> >>> I honestly don't understand how userspace can decide whether a given
> >>> configuration is migratable or not solely based on the value of such a
> >>> register. In my experience, the target system has a role to play, and
> >>> is the only place where we can find out about whether migration is
> >>> actually possible.    
> >>
> >> Both origin and target system need to be taken into account.  I don't
> >> think that's anything new.  
> > 
> > Well, that was what I understood from Andre's question.
> >   
> >>  
> >>> As you said, userspace doesn't interpret the data, nor should it. It
> >>> is only on the receiving end that compatibility is assessed and
> >>> whether some level of compatibility can be safely ensured.
> >>>
> >>> So to sum it up, I don't believe in this approach as a general way of
> >>> describing the handling or errata.    
> >>
> >> For context, my idea attempted to put KVM, not userspace, in charge of
> >> the decision: userspace applies fixed comparison rules determined ahead
> >> of time, but KVM supplies the values compared (and hence determines the
> >> result).
> >>
> >> My worry was that otherwise we may end up with a wild-west tangle of
> >> arbitrary properties that userspace needs specific knowledge about.  
> > 
> > And this is where our understanding differs. I do not think userspace
> > has to care at all. All it has to do is to provide the saved register
> > values to the target system, and let KVM accept or refuse these
> > settings. I can't see what providing a set of predefined values back to
> > userspace gains us.
> > 
> > An unknown register on the target system fails the restore phase:
> > that's absolutely fine, as we don't want to run on a system that
> > doesn't know about the mitigation.
> > 
> > An incompatible value fails the restore as well, as KVM itself finds
> > that this is a service it cannot safely provide.
> > 
> > No userspace involvement, no QEMU upgrade required. Only the kernel
> > knows about it.  
> 
> Yes, this is what I understand as well. From experience, many times when
> we were not strict enough about some userland interface, it backfired.
> 
> The only case where such a forward-looking scheme would make sense is
> the case where the source system has a new kernel, advertising a new
> firmware workaround register, in an unknown or missing state (0 or -1).
> An older kernel on the target system might not know about this register.
> That would translate into "unknown", which is compatible with 0 or -1
> from the source. So migration would be fine, but we deny it because the
> new kernel returns -EINVAL.
> 
> But I am not sure this construct is worth implementing in the kernel. If
> people care about this case, they could implement a workaround in
> userland instead. Or just upgrade the target kernel before migration.

Upgrading the target may not be convenient. But more importantly, I
don't think we expect downgrades to be supported. This can break for an
infinity of reasons, such as the feature set implemented on the source
not being there on the target.

As you said, if userspace wants to bypass these restrictions, it can
alter the data before restoring.

> 
> >> We can tolerate a few though.  If we accumulate a significant number
> >> of errata/vulnerability properties that need to be reported to
> >> userspace, this may be worth revisiting.  If not, it doesn't matter.  
> > 
> > Andre: if you want this to make it into 5.1, the time is now.  
> 
> OK. So is v2 [1] fine then? This implements the much easier "bigger is
> better" scheme, but being 0 based instead of using a 4-bit signed encoding.
> Let me know if there is something to rework in there.
> 
> Cheers,
> Andre.
> 
> [1]
> http://lists.infradead.org/pipermail/linux-arm-kernel/2019-January/627739.html

Sorry, I've lost track of which is which. Please post something that is
consistent,  and addresses Steve's concerns if there is still any. Make
sure it applies on top of the current kvmarm/next, and provide
evidences that you've tested migration on the expected working and
expected failing configurations.

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:[~2019-02-18 14:15 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 12:05 [PATCH 0/2] KVM: arm/arm64: Add VCPU workarounds firmware register Andre Przywara
2019-01-07 12:05 ` Andre Przywara
2019-01-07 12:05 ` [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state Andre Przywara
2019-01-07 12:05   ` Andre Przywara
2019-01-07 13:17   ` Steven Price
2019-01-07 13:17     ` Steven Price
2019-01-21 17:04     ` Andre Przywara
2019-01-21 17:04       ` Andre Przywara
2019-02-22 12:26     ` Andre Przywara
2019-02-22 12:26       ` Andre Przywara
2019-01-22 15:17   ` Dave Martin
2019-01-22 15:17     ` Dave Martin
2019-01-25 14:46     ` Andre Przywara
2019-01-25 14:46       ` Andre Przywara
2019-01-29 21:32       ` Dave Martin
2019-01-29 21:32         ` Dave Martin
2019-01-30 11:39         ` Andre Przywara
2019-01-30 11:39           ` Andre Przywara
2019-01-30 12:07           ` Dave Martin
2019-01-30 12:07             ` Dave Martin
2019-02-15  9:58           ` Andre Przywara
2019-02-15  9:58             ` Andre Przywara
2019-02-15 11:42             ` Marc Zyngier
2019-02-15 11:42               ` Marc Zyngier
2019-02-15 17:26               ` Dave Martin
2019-02-15 17:26                 ` Dave Martin
2019-02-18  9:07                 ` Marc Zyngier
2019-02-18  9:07                   ` Marc Zyngier
2019-02-18 10:28                   ` Dave Martin
2019-02-18 10:28                     ` Dave Martin
2019-02-18 10:59                     ` Marc Zyngier
2019-02-18 10:59                       ` Marc Zyngier
2019-02-18 11:29                   ` André Przywara
2019-02-18 11:29                     ` André Przywara
2019-02-18 14:15                     ` Marc Zyngier [this message]
2019-02-18 14:15                       ` Marc Zyngier
2019-01-07 12:05 ` [PATCH 2/2] KVM: doc: add API documentation on the KVM_REG_ARM_WORKAROUNDS register Andre Przywara
2019-01-07 12:05   ` Andre Przywara
2019-01-22 10:17 ` [PATCH 0/2] KVM: arm/arm64: Add VCPU workarounds firmware register Dave Martin
2019-01-22 10:17   ` Dave Martin
2019-01-22 10:41   ` Andre Przywara
2019-01-22 10:41     ` Andre Przywara
2019-01-22 11:11   ` Marc Zyngier
2019-01-22 11:11     ` Marc Zyngier
2019-01-22 13:56     ` Dave Martin
2019-01-22 13:56       ` Dave Martin
2019-01-22 14:51       ` Marc Zyngier
2019-01-22 14:51         ` Marc Zyngier
2019-01-22 15:28         ` Dave Martin
2019-01-22 15:28           ` Dave Martin

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=20190218141545.2d677718@why.wild-wind.fr.eu.org \
    --to=marc.zyngier@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@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.