Re: [PATCH 02/15] hyperv: uapi-fy synic event flags definitions

From: Roman Kagan
Date: Wed Dec 21 2016 - 02:33:50 EST


On Tue, Dec 20, 2016 at 09:24:53AM -0800, Stephen Hemminger wrote:
> On Tue, 20 Dec 2016 18:55:49 +0300
> Roman Kagan <rkagan@xxxxxxxxxxxxx> wrote:
>
> > Move definitions related to the Hyper-V SynIC event flags to a header
> > where they can be consumed by userspace.
> >
> > While doing so, also clean up their use by switching to standard bitops
> > and struct-based dereferencing. The latter is also done for message
> > pages.
> >
> > Signed-off-by: Roman Kagan <rkagan@xxxxxxxxxxxxx>
> > ---
> > arch/x86/include/uapi/asm/hyperv.h | 13 +++++++++
> > drivers/hv/hyperv_vmbus.h | 24 ++--------------
> > drivers/hv/channel_mgmt.c | 10 +++----
> > drivers/hv/connection.c | 47 ++++++++++---------------------
> > drivers/hv/vmbus_drv.c | 57 ++++++++++++++------------------------
> > 5 files changed, 54 insertions(+), 97 deletions(-)
> >
> > diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h
> > index 6098ab5..af542a3 100644
> > --- a/arch/x86/include/uapi/asm/hyperv.h
> > +++ b/arch/x86/include/uapi/asm/hyperv.h
> > @@ -363,4 +363,17 @@ struct hv_timer_message_payload {
> > #define HV_STIMER_AUTOENABLE (1ULL << 3)
> > #define HV_STIMER_SINT(config) (__u8)(((config) >> 16) & 0x0F)
> >
> > +/* Define synthetic interrupt controller flag constants. */
> > +#define HV_EVENT_FLAGS_COUNT (256 * 8)
> > +
> > +/* Define the synthetic interrupt controller event flags format. */
> > +struct hv_synic_event_flags {
> > + __u64 flags[HV_EVENT_FLAGS_COUNT / 64];
> > +};
> > +
> > +/* Define the synthetic interrupt flags page layout. */
> > +struct hv_synic_event_flags_page {
> > + struct hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT];
> > +};
> > +
> > #endif
>
> How are these going to be exposed to user space?
>
> They should really be unsigned long since there is no guarantee of atomic operation
> on 64 bit values on 32 bit architectures.

Indeed, absolutely. These are bitmaps and should be unsigned long[], of
course. I'll fix it in the next iteration.

Thanks,
Roman.