Re: [PATCH 4/8] KVM: x86: interrupt based APF page-ready event delivery

From: Vivek Goyal
Date: Wed May 13 2020 - 10:03:17 EST


On Wed, May 13, 2020 at 09:53:50AM -0400, Vivek Goyal wrote:

[..]
> > > And this notion of same structure being shared across multiple events
> > > at the same time is just going to create more confusion, IMHO. If we
> > > can decouple it by serializing it, that definitely feels simpler to
> > > understand.
> >
> > What if we just add sub-structures to the structure, e.g.
> >
> > struct kvm_vcpu_pv_apf_data {
> > struct {
> > __u32 apf_flag;
> > } legacy_apf_data;
> > struct {
> > __u32 token;
> > } apf_interrupt_data;
> > ....
> > __u8 pad[56]; |
> > __u32 enabled; |
> > };
> >
> > would it make it more obvious?

On a second thought, given we are not planning to use
this structure for synchrous events anymore, I think defining
struct might be overkill. May be a simple comment will do.

struct kvm_vcpu_pv_apf_data {
/* Used by page fault based page not present notifications. Soon
* it will be legacy
*/
__u32 apf_flag;
/* Used for interrupt based page ready notifications */
__u32 token;
...
...
}

Thanks
Vivek