Skip to content

Commit

Permalink
hyper-v: Use fast hypercall for HVCALL_SIGNAL_EVENT
Browse files Browse the repository at this point in the history
We need to pass only 8 bytes of input for HvSignalEvent which makes it a
perfect fit for fast hypercall. hv_input_signal_event_buffer is not needed
any more and hv_input_signal_event is converted to union for convenience.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Jork Loeser <Jork.Loeser@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Simon Xiao <sixiao@microsoft.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: devel@linuxdriverproject.org
Link: http://lkml.kernel.org/r/20170802160921.21791-5-vkuznets@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Vitaly Kuznetsov authored and Ingo Molnar committed Aug 10, 2017
1 parent 6a8edbd commit 0578417
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
13 changes: 2 additions & 11 deletions drivers/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,21 +805,12 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
/*
* Setup state for signalling the host.
*/
newchannel->sig_event = (struct hv_input_signal_event *)
(ALIGN((unsigned long)
&newchannel->sig_buf,
HV_HYPERCALL_PARAM_ALIGN));

newchannel->sig_event->connectionid.asu32 = 0;
newchannel->sig_event->connectionid.u.id = VMBUS_EVENT_CONNECTION_ID;
newchannel->sig_event->flag_number = 0;
newchannel->sig_event->rsvdz = 0;
newchannel->sig_event = VMBUS_EVENT_CONNECTION_ID;

if (vmbus_proto_version != VERSION_WS2008) {
newchannel->is_dedicated_interrupt =
(offer->is_dedicated_interrupt != 0);
newchannel->sig_event->connectionid.u.id =
offer->connection_id;
newchannel->sig_event = offer->connection_id;
}

memcpy(&newchannel->offermsg, offer,
Expand Down
2 changes: 1 addition & 1 deletion drivers/hv/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,6 @@ void vmbus_set_event(struct vmbus_channel *channel)
if (!channel->is_dedicated_interrupt)
vmbus_send_interrupt(child_relid);

hv_do_hypercall(HVCALL_SIGNAL_EVENT, channel->sig_event, NULL);
hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event);
}
EXPORT_SYMBOL_GPL(vmbus_set_event);
15 changes: 1 addition & 14 deletions include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,18 +677,6 @@ union hv_connection_id {
} u;
};

/* Definition of the hv_signal_event hypercall input structure. */
struct hv_input_signal_event {
union hv_connection_id connectionid;
u16 flag_number;
u16 rsvdz;
};

struct hv_input_signal_event_buffer {
u64 align8;
struct hv_input_signal_event event;
};

enum hv_numa_policy {
HV_BALANCED = 0,
HV_LOCALIZED,
Expand Down Expand Up @@ -770,8 +758,7 @@ struct vmbus_channel {
} callback_mode;

bool is_dedicated_interrupt;
struct hv_input_signal_event_buffer sig_buf;
struct hv_input_signal_event *sig_event;
u64 sig_event;

/*
* Starting with win8, this field will be used to specify
Expand Down

0 comments on commit 0578417

Please sign in to comment.