Commit 9a6b1a17 authored by Dexuan Cui's avatar Dexuan Cui Committed by Wei Liu

Drivers: hv: vmbus: Remove the per-CPU post_msg_page

The post_msg_page was introduced in 2014 in
commit b29ef354 ("Drivers: hv: vmbus: Cleanup hv_post_message()")

Commit 68bb7bfb ("X86/Hyper-V: Enable IPI enlightenments") introduced
the hyperv_pcpu_input_arg in 2018, which can be used in hv_post_message().

Remove post_msg_page to simplify the code a little bit.
Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
Reviewed-by: default avatarJinank Jain <jinankjain@linux.microsoft.com>
Link: https://lore.kernel.org/r/20230408213441.15472-1-decui@microsoft.comSigned-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent c0e96acf
...@@ -84,14 +84,15 @@ int hv_post_message(union hv_connection_id connection_id, ...@@ -84,14 +84,15 @@ int hv_post_message(union hv_connection_id connection_id,
void *payload, size_t payload_size) void *payload, size_t payload_size)
{ {
struct hv_input_post_message *aligned_msg; struct hv_input_post_message *aligned_msg;
struct hv_per_cpu_context *hv_cpu; unsigned long flags;
u64 status; u64 status;
if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT) if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
return -EMSGSIZE; return -EMSGSIZE;
hv_cpu = get_cpu_ptr(hv_context.cpu_context); local_irq_save(flags);
aligned_msg = hv_cpu->post_msg_page;
aligned_msg = *this_cpu_ptr(hyperv_pcpu_input_arg);
aligned_msg->connectionid = connection_id; aligned_msg->connectionid = connection_id;
aligned_msg->reserved = 0; aligned_msg->reserved = 0;
aligned_msg->message_type = message_type; aligned_msg->message_type = message_type;
...@@ -106,11 +107,7 @@ int hv_post_message(union hv_connection_id connection_id, ...@@ -106,11 +107,7 @@ int hv_post_message(union hv_connection_id connection_id,
status = hv_do_hypercall(HVCALL_POST_MESSAGE, status = hv_do_hypercall(HVCALL_POST_MESSAGE,
aligned_msg, NULL); aligned_msg, NULL);
/* Preemption must remain disabled until after the hypercall local_irq_restore(flags);
* so some other thread can't get scheduled onto this cpu and
* corrupt the per-cpu post_msg_page
*/
put_cpu_ptr(hv_cpu);
return hv_result(status); return hv_result(status);
} }
...@@ -162,12 +159,6 @@ int hv_synic_alloc(void) ...@@ -162,12 +159,6 @@ int hv_synic_alloc(void)
goto err; goto err;
} }
} }
hv_cpu->post_msg_page = (void *)get_zeroed_page(GFP_ATOMIC);
if (hv_cpu->post_msg_page == NULL) {
pr_err("Unable to allocate post msg page\n");
goto err;
}
} }
return 0; return 0;
...@@ -190,7 +181,6 @@ void hv_synic_free(void) ...@@ -190,7 +181,6 @@ void hv_synic_free(void)
free_page((unsigned long)hv_cpu->synic_event_page); free_page((unsigned long)hv_cpu->synic_event_page);
free_page((unsigned long)hv_cpu->synic_message_page); free_page((unsigned long)hv_cpu->synic_message_page);
free_page((unsigned long)hv_cpu->post_msg_page);
} }
kfree(hv_context.hv_numa_map); kfree(hv_context.hv_numa_map);
......
...@@ -122,10 +122,6 @@ enum { ...@@ -122,10 +122,6 @@ enum {
struct hv_per_cpu_context { struct hv_per_cpu_context {
void *synic_message_page; void *synic_message_page;
void *synic_event_page; void *synic_event_page;
/*
* buffer to post messages to the host.
*/
void *post_msg_page;
/* /*
* Starting with win8, we can take channel interrupts on any CPU; * Starting with win8, we can take channel interrupts on any CPU;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment