Drivers: hv: vmbus: Use get_cpu() to get the current CPU

Replace calls for smp_processor_id() to get_cpu() to get the CPU ID of
the current CPU. In these instances, there is no correctness issue with
regards to preemption, we just need the current CPU ID.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
K. Y. Srinivasan 2014-12-14 23:34:51 -08:00 committed by Greg Kroah-Hartman
parent ca04455fba
commit 87712bf81d
2 changed files with 7 additions and 3 deletions

View File

@ -815,7 +815,7 @@ int vmbus_request_offers(void)
struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary) struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary)
{ {
struct list_head *cur, *tmp; struct list_head *cur, *tmp;
int cur_cpu = hv_context.vp_index[smp_processor_id()]; int cur_cpu;
struct vmbus_channel *cur_channel; struct vmbus_channel *cur_channel;
struct vmbus_channel *outgoing_channel = primary; struct vmbus_channel *outgoing_channel = primary;
int cpu_distance, new_cpu_distance; int cpu_distance, new_cpu_distance;
@ -823,6 +823,8 @@ struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary)
if (list_empty(&primary->sc_list)) if (list_empty(&primary->sc_list))
return outgoing_channel; return outgoing_channel;
cur_cpu = hv_context.vp_index[get_cpu()];
put_cpu();
list_for_each_safe(cur, tmp, &primary->sc_list) { list_for_each_safe(cur, tmp, &primary->sc_list) {
cur_channel = list_entry(cur, struct vmbus_channel, sc_list); cur_channel = list_entry(cur, struct vmbus_channel, sc_list);
if (cur_channel->state != CHANNEL_OPENED_STATE) if (cur_channel->state != CHANNEL_OPENED_STATE)

View File

@ -80,8 +80,10 @@ static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo,
msg->interrupt_page = virt_to_phys(vmbus_connection.int_page); msg->interrupt_page = virt_to_phys(vmbus_connection.int_page);
msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages[0]); msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages[0]);
msg->monitor_page2 = virt_to_phys(vmbus_connection.monitor_pages[1]); msg->monitor_page2 = virt_to_phys(vmbus_connection.monitor_pages[1]);
if (version == VERSION_WIN8_1) if (version == VERSION_WIN8_1) {
msg->target_vcpu = hv_context.vp_index[smp_processor_id()]; msg->target_vcpu = hv_context.vp_index[get_cpu()];
put_cpu();
}
/* /*
* Add to list before we send the request since we may * Add to list before we send the request since we may