hyperv-next for 5.18

-----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCAAxFiEEIbPD0id6easf0xsudhRwX5BBoF4FAmI6MhgTHHdlaS5saXVA
 a2VybmVsLm9yZwAKCRB2FHBfkEGgXiBkB/9FEaebcytvBMNVnz/fprfQWfYxdrUB
 wmDB9dnJVPX6UcWg6DuDv7KqatimDp7JrnKrNsrqlgF6Wafn/wI3Cdf8ZUi8CgtZ
 Walq8m2QM9j8WCm4EtgmluzGkHjAn6llmjE7XoLmo/A8MYp0FZhJzghKfCEu54EB
 9DhgqQX+zzy7n32CxoAWrGrHegnGeqMpj3rhQ4qVuNn+bOzZ/wTyJQPmXTu4hSW1
 0PrXRnfzqnODkB6QDUantABZM5bh1VsqwIlENp+xAFQVsQpsc35lW7AUg7JXczVn
 ES0+UHG7wVWPJCtIfD4FgIFT1xekPKxRYX9U66LMRbWGYhXfohQX+wFt
 =u62V
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Linus Torvalds 2022-03-24 12:30:37 -07:00
commit 66711cfea6
8 changed files with 42 additions and 27 deletions

View File

@ -310,10 +310,10 @@ static void __init ms_hyperv_init_platform(void)
hv_host_info_ecx = cpuid_ecx(HYPERV_CPUID_VERSION); hv_host_info_ecx = cpuid_ecx(HYPERV_CPUID_VERSION);
hv_host_info_edx = cpuid_edx(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", 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 >> 16, hv_host_info_ebx & 0xFFFF,
hv_host_info_ebx & 0xFFFF, hv_host_info_ecx, hv_host_info_eax, hv_host_info_edx & 0xFFFFFF,
hv_host_info_edx >> 24, hv_host_info_edx & 0xFFFFFF); hv_host_info_ecx, hv_host_info_edx >> 24);
} }
if (ms_hyperv.features & HV_ACCESS_FREQUENCY_MSRS && if (ms_hyperv.features & HV_ACCESS_FREQUENCY_MSRS &&

View File

@ -459,7 +459,7 @@ void hv_process_channel_removal(struct vmbus_channel *channel)
* init_vp_index() can (re-)use the CPU. * init_vp_index() can (re-)use the CPU.
*/ */
if (hv_is_perf_channel(channel)) 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 * 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); bool perf_chn = hv_is_perf_channel(channel);
u32 i, ncpu = num_online_cpus(); u32 i, ncpu = num_online_cpus();
cpumask_var_t available_mask; cpumask_var_t available_mask;
struct cpumask *alloced_mask; struct cpumask *allocated_mask;
u32 target_cpu; u32 target_cpu;
int numa_node; int numa_node;
@ -745,7 +745,7 @@ static void init_vp_index(struct vmbus_channel *channel)
*/ */
channel->target_cpu = VMBUS_CONNECT_CPU; channel->target_cpu = VMBUS_CONNECT_CPU;
if (perf_chn) if (perf_chn)
hv_set_alloced_cpu(VMBUS_CONNECT_CPU); hv_set_allocated_cpu(VMBUS_CONNECT_CPU);
return; return;
} }
@ -760,22 +760,21 @@ static void init_vp_index(struct vmbus_channel *channel)
continue; continue;
break; break;
} }
alloced_mask = &hv_context.hv_numa_map[numa_node]; allocated_mask = &hv_context.hv_numa_map[numa_node];
if (cpumask_weight(alloced_mask) == if (cpumask_equal(allocated_mask, cpumask_of_node(numa_node))) {
cpumask_weight(cpumask_of_node(numa_node))) {
/* /*
* We have cycled through all the CPUs in the 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)); cpumask_of_node(numa_node));
target_cpu = cpumask_first(available_mask); 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 || if (channel->offermsg.offer.sub_channel_index >= ncpu ||
i > ncpu || !hv_cpuself_used(target_cpu, channel)) i > ncpu || !hv_cpuself_used(target_cpu, channel))

View File

@ -1563,7 +1563,7 @@ static void balloon_onchannelcallback(void *context)
break; break;
default: default:
pr_warn("Unhandled message: type: %d\n", dm_hdr->type); pr_warn_ratelimited("Unhandled message: type: %d\n", dm_hdr->type);
} }
} }

View File

@ -79,8 +79,10 @@ int __init hv_common_init(void)
* calling crash enlightment interface before running kdump * calling crash enlightment interface before running kdump
* kernel. * 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; 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. * Allocate the per-CPU state for the hypercall input arg.

View File

@ -31,6 +31,9 @@ static const int fw_versions[] = {
UTIL_FW_VERSION 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 * Timeout values are based on expecations from host
*/ */
@ -298,7 +301,7 @@ void hv_vss_onchannelcallback(void *context)
if (vss_transaction.state > HVUTIL_READY) if (vss_transaction.state > HVUTIL_READY)
return; 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"); pr_err_ratelimited("VSS request received. Could not read into recv buf\n");
return; return;
} }
@ -375,7 +378,7 @@ hv_vss_init(struct hv_util_service *srv)
} }
recv_buffer = srv->recv_buffer; recv_buffer = srv->recv_buffer;
vss_transaction.recv_channel = srv->channel; 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 * When this driver loads, the user level daemon that

View File

@ -405,7 +405,7 @@ static inline bool hv_is_perf_channel(struct vmbus_channel *channel)
return vmbus_devs[channel->device_id].perf_device; 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; struct vmbus_channel *channel, *sc;
@ -427,23 +427,23 @@ static inline bool hv_is_alloced_cpu(unsigned int cpu)
return false; 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)]); 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; return;
cpumask_clear_cpu(cpu, &hv_context.hv_numa_map[cpu_to_node(cpu)]); 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) unsigned int new_cpu)
{ {
hv_set_alloced_cpu(new_cpu); hv_set_allocated_cpu(new_cpu);
hv_clear_alloced_cpu(old_cpu); hv_clear_allocated_cpu(old_cpu);
} }
#ifdef CONFIG_HYPERV_TESTING #ifdef CONFIG_HYPERV_TESTING

View File

@ -1129,7 +1129,7 @@ void vmbus_on_msg_dpc(unsigned long data)
} }
if (entry->handler_type == VMHT_BLOCKING) { 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) if (ctx == NULL)
return; return;
@ -1874,7 +1874,7 @@ static ssize_t target_cpu_store(struct vmbus_channel *channel,
/* See init_vp_index(). */ /* See init_vp_index(). */
if (hv_is_perf_channel(channel)) 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. */ /* Currently set only for storvsc channels. */
if (channel->change_target_cpu_callback) { if (channel->change_target_cpu_callback) {

View File

@ -90,6 +90,17 @@ struct hv_vss_check_dm_info {
__u32 flags; __u32 flags;
} __attribute__((packed)); } __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 { struct hv_vss_msg {
union { union {
struct hv_vss_hdr vss_hdr; struct hv_vss_hdr vss_hdr;