Commit 66711cfe authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hyperv-next-signed-20220322' of...

Merge tag 'hyperv-next-signed-20220322' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull hyperv updates from Wei Liu:
 "Minor patches from various people"

* tag 'hyperv-next-signed-20220322' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  x86/hyperv: Output host build info as normal Windows version number
  hv_balloon: rate-limit "Unhandled message" warning
  drivers: hv: log when enabling crash_kexec_post_notifiers
  hv_utils: Add comment about max VMbus packet size in VSS driver
  Drivers: hv: Compare cpumasks and not their weights in init_vp_index()
  Drivers: hv: Rename 'alloced' to 'allocated'
  Drivers: hv: vmbus: Use struct_size() helper in kmalloc()
parents 1ebdbeb0 eeda29db
......@@ -310,10 +310,10 @@ static void __init ms_hyperv_init_platform(void)
hv_host_info_ecx = cpuid_ecx(HYPERV_CPUID_VERSION);
hv_host_info_edx = cpuid_edx(HYPERV_CPUID_VERSION);
pr_info("Hyper-V Host Build:%d-%d.%d-%d-%d.%d\n",
hv_host_info_eax, hv_host_info_ebx >> 16,
hv_host_info_ebx & 0xFFFF, hv_host_info_ecx,
hv_host_info_edx >> 24, hv_host_info_edx & 0xFFFFFF);
pr_info("Hyper-V: Host Build %d.%d.%d.%d-%d-%d\n",
hv_host_info_ebx >> 16, hv_host_info_ebx & 0xFFFF,
hv_host_info_eax, hv_host_info_edx & 0xFFFFFF,
hv_host_info_ecx, hv_host_info_edx >> 24);
}
if (ms_hyperv.features & HV_ACCESS_FREQUENCY_MSRS &&
......
......@@ -459,7 +459,7 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
* init_vp_index() can (re-)use the CPU.
*/
if (hv_is_perf_channel(channel))
hv_clear_alloced_cpu(channel->target_cpu);
hv_clear_allocated_cpu(channel->target_cpu);
/*
* Upon suspend, an in-use hv_sock channel is marked as "rescinded" and
......@@ -728,7 +728,7 @@ static void init_vp_index(struct vmbus_channel *channel)
bool perf_chn = hv_is_perf_channel(channel);
u32 i, ncpu = num_online_cpus();
cpumask_var_t available_mask;
struct cpumask *alloced_mask;
struct cpumask *allocated_mask;
u32 target_cpu;
int numa_node;
......@@ -745,7 +745,7 @@ static void init_vp_index(struct vmbus_channel *channel)
*/
channel->target_cpu = VMBUS_CONNECT_CPU;
if (perf_chn)
hv_set_alloced_cpu(VMBUS_CONNECT_CPU);
hv_set_allocated_cpu(VMBUS_CONNECT_CPU);
return;
}
......@@ -760,22 +760,21 @@ static void init_vp_index(struct vmbus_channel *channel)
continue;
break;
}
alloced_mask = &hv_context.hv_numa_map[numa_node];
allocated_mask = &hv_context.hv_numa_map[numa_node];
if (cpumask_weight(alloced_mask) ==
cpumask_weight(cpumask_of_node(numa_node))) {
if (cpumask_equal(allocated_mask, cpumask_of_node(numa_node))) {
/*
* We have cycled through all the CPUs in the node;
* reset the alloced map.
* reset the allocated map.
*/
cpumask_clear(alloced_mask);
cpumask_clear(allocated_mask);
}
cpumask_xor(available_mask, alloced_mask,
cpumask_xor(available_mask, allocated_mask,
cpumask_of_node(numa_node));
target_cpu = cpumask_first(available_mask);
cpumask_set_cpu(target_cpu, alloced_mask);
cpumask_set_cpu(target_cpu, allocated_mask);
if (channel->offermsg.offer.sub_channel_index >= ncpu ||
i > ncpu || !hv_cpuself_used(target_cpu, channel))
......
......@@ -1563,7 +1563,7 @@ static void balloon_onchannelcallback(void *context)
break;
default:
pr_warn("Unhandled message: type: %d\n", dm_hdr->type);
pr_warn_ratelimited("Unhandled message: type: %d\n", dm_hdr->type);
}
}
......
......@@ -79,8 +79,10 @@ int __init hv_common_init(void)
* calling crash enlightment interface before running kdump
* kernel.
*/
if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE)
if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
crash_kexec_post_notifiers = true;
pr_info("Hyper-V: enabling crash_kexec_post_notifiers\n");
}
/*
* Allocate the per-CPU state for the hypercall input arg.
......
......@@ -31,6 +31,9 @@ static const int fw_versions[] = {
UTIL_FW_VERSION
};
/* See comment with struct hv_vss_msg regarding the max VMbus packet size */
#define VSS_MAX_PKT_SIZE (HV_HYP_PAGE_SIZE * 2)
/*
* Timeout values are based on expecations from host
*/
......@@ -298,7 +301,7 @@ void hv_vss_onchannelcallback(void *context)
if (vss_transaction.state > HVUTIL_READY)
return;
if (vmbus_recvpacket(channel, recv_buffer, HV_HYP_PAGE_SIZE * 2, &recvlen, &requestid)) {
if (vmbus_recvpacket(channel, recv_buffer, VSS_MAX_PKT_SIZE, &recvlen, &requestid)) {
pr_err_ratelimited("VSS request received. Could not read into recv buf\n");
return;
}
......@@ -375,7 +378,7 @@ hv_vss_init(struct hv_util_service *srv)
}
recv_buffer = srv->recv_buffer;
vss_transaction.recv_channel = srv->channel;
vss_transaction.recv_channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
vss_transaction.recv_channel->max_pkt_size = VSS_MAX_PKT_SIZE;
/*
* When this driver loads, the user level daemon that
......
......@@ -405,7 +405,7 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel)
return vmbus_devs[channel->device_id].perf_device;
}
static inline bool hv_is_alloced_cpu(unsigned int cpu)
static inline bool hv_is_allocated_cpu(unsigned int cpu)
{
struct vmbus_channel *channel, *sc;
......@@ -427,23 +427,23 @@ static inline bool hv_is_alloced_cpu(unsigned int cpu)
return false;
}
static inline void hv_set_alloced_cpu(unsigned int cpu)
static inline void hv_set_allocated_cpu(unsigned int cpu)
{
cpumask_set_cpu(cpu, &hv_context.hv_numa_map[cpu_to_node(cpu)]);
}
static inline void hv_clear_alloced_cpu(unsigned int cpu)
static inline void hv_clear_allocated_cpu(unsigned int cpu)
{
if (hv_is_alloced_cpu(cpu))
if (hv_is_allocated_cpu(cpu))
return;
cpumask_clear_cpu(cpu, &hv_context.hv_numa_map[cpu_to_node(cpu)]);
}
static inline void hv_update_alloced_cpus(unsigned int old_cpu,
static inline void hv_update_allocated_cpus(unsigned int old_cpu,
unsigned int new_cpu)
{
hv_set_alloced_cpu(new_cpu);
hv_clear_alloced_cpu(old_cpu);
hv_set_allocated_cpu(new_cpu);
hv_clear_allocated_cpu(old_cpu);
}
#ifdef CONFIG_HYPERV_TESTING
......
......@@ -1129,7 +1129,7 @@ void vmbus_on_msg_dpc(unsigned long data)
}
if (entry->handler_type == VMHT_BLOCKING) {
ctx = kmalloc(sizeof(*ctx) + payload_size, GFP_ATOMIC);
ctx = kmalloc(struct_size(ctx, msg.payload, payload_size), GFP_ATOMIC);
if (ctx == NULL)
return;
......@@ -1874,7 +1874,7 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel,
/* See init_vp_index(). */
if (hv_is_perf_channel(channel))
hv_update_alloced_cpus(origin_cpu, target_cpu);
hv_update_allocated_cpus(origin_cpu, target_cpu);
/* Currently set only for storvsc channels. */
if (channel->change_target_cpu_callback) {
......
......@@ -90,6 +90,17 @@ struct hv_vss_check_dm_info {
__u32 flags;
} __attribute__((packed));
/*
* struct hv_vss_msg encodes the fields that the Linux VSS
* driver accesses. However, FREEZE messages from Hyper-V contain
* additional LUN information that Linux doesn't use and are not
* represented in struct hv_vss_msg. A received FREEZE message may
* be as large as 6,260 bytes, so the driver must allocate at least
* that much space, not sizeof(struct hv_vss_msg). Other messages
* such as AUTO_RECOVER may be as large as 12,500 bytes. However,
* because the Linux VSS driver responds that it doesn't support
* auto-recovery, it should not receive such messages.
*/
struct hv_vss_msg {
union {
struct hv_vss_hdr vss_hdr;
......
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