All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	will@kernel.org, maz@kernel.org, apatel@ventanamicro.com,
	atishp@rivosinc.com, seanjc@google.com, pgonda@google.com
Subject: Re: [PATCH 0/4] KVM: fix KVM_EXIT_SYSTEM_EVENT mess
Date: Fri, 22 Apr 2022 07:58:25 +0000	[thread overview]
Message-ID: <YmJgIQe+5zGbrxoF@google.com> (raw)
In-Reply-To: <20220421180443.1465634-1-pbonzini@redhat.com>

Hi Paolo,

On Thu, Apr 21, 2022 at 02:04:39PM -0400, Paolo Bonzini wrote:
> The KVM_SYSTEM_EVENT_NDATA_VALID mechanism that was introduced
> contextually with KVM_SYSTEM_EVENT_SEV_TERM is not a good match
> for ARM and RISC-V, which want to communicate information even
> for existing KVM_SYSTEM_EVENT_* constants.  Userspace is not ready
> to filter out bit 31 of type, and fails to process the
> KVM_EXIT_SYSTEM_EVENT exit.
> 
> Therefore, tie the availability of ndata to a system capability;
> if the capability is present, ndata is always valid, so patch 1
> makes x86 always initialize it.  Then patches 2 and 3 fix
> ARM and RISC-V compilation and patch 4 enables the capability.
> 
> Only compiled on x86, waiting for acks.
> 
> Paolo
> 
> Paolo Bonzini (4):
>   KVM: x86: always initialize system_event.ndata
>   KVM: ARM: replace system_event.flags with ndata and data[0]
>   KVM: RISC-V: replace system_event.flags with ndata and data[0]
>   KVM: tell userspace that system_event.ndata is valid

Is there any way we could clean this up in 5.18 and leave the whole
ndata/data pattern for 5.19?

IOW, for 5.18 go back and fix the padding:

	struct {
		__u32 type;
		__u32 pad;
		__u64 flags;
	} system_event;

Then for 5.19 circle back on the data business, except use a flag bit
for it:

	struct {
		__u32 type;
		__u32 pad;
	#define KVM_SYSTEM_EVENT_NDATA_VALID	(1u << 63)
		__u64 flags;
		__u64 ndata;
		__u64 data[16];
	} system_event;

Where we apply that bit to system_event::flags this time instead of
::type. Could also go the CAP route.

Wouldn't this be enough to preserve ABI with whatever userspace has been
spun up for system_event::flags already and also keep the SEV stuff
happy in 5.19?

It is a bit weird to churn existing UAPI usage in the very next kernel
cycle, but could be convinced otherwise :)

--
Thanks,
Oliver

  parent reply	other threads:[~2022-04-22  7:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 18:04 [PATCH 0/4] KVM: fix KVM_EXIT_SYSTEM_EVENT mess Paolo Bonzini
2022-04-21 18:04 ` [PATCH 1/4] KVM: x86: always initialize system_event.ndata Paolo Bonzini
2022-04-22  9:48   ` Marc Zyngier
2022-04-22 10:11     ` Paolo Bonzini
2022-04-21 18:04 ` [PATCH 2/4] KVM: ARM: replace system_event.flags with ndata and data[0] Paolo Bonzini
2022-04-21 18:04 ` [PATCH 3/4] KVM: RISC-V: " Paolo Bonzini
2022-04-21 18:04 ` [PATCH 4/4] KVM: tell userspace that system_event.ndata is valid Paolo Bonzini
2022-04-22  7:58 ` Oliver Upton [this message]
2022-04-22  9:41   ` [PATCH 0/4] KVM: fix KVM_EXIT_SYSTEM_EVENT mess Paolo Bonzini
2022-04-22 10:01     ` Marc Zyngier
2022-04-22 10:19       ` Paolo Bonzini

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=YmJgIQe+5zGbrxoF@google.com \
    --to=oupton@google.com \
    --cc=apatel@ventanamicro.com \
    --cc=atishp@rivosinc.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=seanjc@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.