diff mbox series

[v5,1/4] KVM: x86: Clarify the kvm_run.emulation_failure structure layout

Message ID 20210916083239.2168281-2-david.edmondson@oracle.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86: Convey the exit reason, etc. to user-space on emulation failure | expand

Commit Message

David Edmondson Sept. 16, 2021, 8:32 a.m. UTC
Until more flags for kvm_run.emulation_failure flags are defined, it
is undetermined whether new payload elements corresponding to those
flags will be additive or alternative. As a hint to userspace that an
alternative is possible, wrap the current payload elements in a union.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
---
 include/uapi/linux/kvm.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Sean Christopherson Sept. 16, 2021, 4:20 p.m. UTC | #1
On Thu, Sep 16, 2021, David Edmondson wrote:

For all these patches, assuming you want the Author credit to go to your @oracle.com
email, they need an explicit

  From: David Edmondson <david.edmondson@oracle.com>

otherwise git will default to the "From" email header and make the Author
"David Edmondson <dme@dme.org>".  And then checkpatch will rightly complain that
the SOB does not match the Author.

Adding From: can be handled automatically by "git format-patch" via "--from", e.g.

  git format-patch --from="David Edmondson <dme@dme.org>" ...

> Until more flags for kvm_run.emulation_failure flags are defined, it
> is undetermined whether new payload elements corresponding to those
> flags will be additive or alternative. As a hint to userspace that an
> alternative is possible, wrap the current payload elements in a union.
> 
> Suggested-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: David Edmondson <david.edmondson@oracle.com>
> ---
>  include/uapi/linux/kvm.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index a067410ebea5..8618fe973215 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -402,8 +402,12 @@ struct kvm_run {
>  			__u32 suberror;
>  			__u32 ndata;
>  			__u64 flags;
> -			__u8  insn_size;
> -			__u8  insn_bytes[15];
> +			union {
> +				struct {
> +					__u8  insn_size;
> +					__u8  insn_bytes[15];
> +				};
> +			};
>  		} emulation_failure;
>  		/* KVM_EXIT_OSI */
>  		struct {
> -- 
> 2.33.0
>
Borislav Petkov Sept. 16, 2021, 5:52 p.m. UTC | #2
On Thu, Sep 16, 2021 at 04:20:42PM +0000, Sean Christopherson wrote:
> On Thu, Sep 16, 2021, David Edmondson wrote:
> 
> For all these patches, assuming you want the Author credit to go to your @oracle.com
> email, they need an explicit
> 
>   From: David Edmondson <david.edmondson@oracle.com>
> 
> otherwise git will default to the "From" email header and make the Author
> "David Edmondson <dme@dme.org>".  And then checkpatch will rightly complain that
> the SOB does not match the Author.
> 
> Adding From: can be handled automatically by "git format-patch" via "--from", e.g.
> 
>   git format-patch --from="David Edmondson <dme@dme.org>" ...

Or you can put

[user]
        name = David Edmondson
        email = david.edmondson@oracle.com

in .git/config and then it'll use that as the author and you can send
from any random mail service using git send-email it'll slap the From:
correctly.
diff mbox series

Patch

diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index a067410ebea5..8618fe973215 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -402,8 +402,12 @@  struct kvm_run {
 			__u32 suberror;
 			__u32 ndata;
 			__u64 flags;
-			__u8  insn_size;
-			__u8  insn_bytes[15];
+			union {
+				struct {
+					__u8  insn_size;
+					__u8  insn_bytes[15];
+				};
+			};
 		} emulation_failure;
 		/* KVM_EXIT_OSI */
 		struct {