Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99f63620 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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

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

Sasha writes:

1. Exopsing counters for state changes of channel ring buffers; this is
useful to investigate performance issues. By Kimberly Brown.

2. Switching to the new generic UUID API, by Andy Shevchenko.

* tag 'hyperv-next-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  Drivers: hv: vmbus: Expose counters for interrupts and full conditions
  vmbus: Switch to use new generic UUID API
parents b3bf147b 396ae57e
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -146,3 +146,36 @@ KernelVersion: 4.16
Contact:	Stephen Hemminger <sthemmin@microsoft.com>
Description:	Binary file created by uio_hv_generic for ring buffer
Users:		Userspace drivers

What:           /sys/bus/vmbus/devices/<UUID>/channels/<N>/intr_in_full
Date:           February 2019
KernelVersion:  5.0
Contact:        Michael Kelley <mikelley@microsoft.com>
Description:    Number of guest to host interrupts caused by the inbound ring
		buffer transitioning from full to not full while a packet is
		waiting for buffer space to become available
Users:          Debugging tools

What:           /sys/bus/vmbus/devices/<UUID>/channels/<N>/intr_out_empty
Date:           February 2019
KernelVersion:  5.0
Contact:        Michael Kelley <mikelley@microsoft.com>
Description:    Number of guest to host interrupts caused by the outbound ring
		buffer transitioning from empty to not empty
Users:          Debugging tools

What:           /sys/bus/vmbus/devices/<UUID>/channels/<N>/out_full_first
Date:           February 2019
KernelVersion:  5.0
Contact:        Michael Kelley <mikelley@microsoft.com>
Description:    Number of write operations that were the first to encounter an
		outbound ring buffer full condition
Users:          Debugging tools

What:           /sys/bus/vmbus/devices/<UUID>/channels/<N>/out_full_total
Date:           February 2019
KernelVersion:  5.0
Contact:        Michael Kelley <mikelley@microsoft.com>
Description:    Total number of write operations that encountered an outbound
		ring buffer full condition
Users:          Debugging tools
+2 −2
Original line number Diff line number Diff line
@@ -282,8 +282,8 @@ int vmbus_open(struct vmbus_channel *newchannel,
EXPORT_SYMBOL_GPL(vmbus_open);

/* Used for Hyper-V Socket: a guest client's connect() to the host */
int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
				  const uuid_le *shv_host_servie_id)
int vmbus_send_tl_connect_request(const guid_t *shv_guest_servie_id,
				  const guid_t *shv_host_servie_id)
{
	struct vmbus_channel_tl_connect_request conn_msg;
	int ret;
+9 −9
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ static const struct vmbus_device vmbus_devs[] = {
};

static const struct {
	uuid_le guid;
	guid_t guid;
} vmbus_unsupported_devs[] = {
	{ HV_AVMA1_GUID },
	{ HV_AVMA2_GUID },
@@ -171,26 +171,26 @@ static void vmbus_rescind_cleanup(struct vmbus_channel *channel)
	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}

static bool is_unsupported_vmbus_devs(const uuid_le *guid)
static bool is_unsupported_vmbus_devs(const guid_t *guid)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(vmbus_unsupported_devs); i++)
		if (!uuid_le_cmp(*guid, vmbus_unsupported_devs[i].guid))
		if (guid_equal(guid, &vmbus_unsupported_devs[i].guid))
			return true;
	return false;
}

static u16 hv_get_dev_type(const struct vmbus_channel *channel)
{
	const uuid_le *guid = &channel->offermsg.offer.if_type;
	const guid_t *guid = &channel->offermsg.offer.if_type;
	u16 i;

	if (is_hvsock_channel(channel) || is_unsupported_vmbus_devs(guid))
		return HV_UNKNOWN;

	for (i = HV_IDE; i < HV_UNKNOWN; i++) {
		if (!uuid_le_cmp(*guid, vmbus_devs[i].guid))
		if (guid_equal(guid, &vmbus_devs[i].guid))
			return i;
	}
	pr_info("Unknown GUID: %pUl\n", guid);
@@ -561,10 +561,10 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
	atomic_dec(&vmbus_connection.offer_in_progress);

	list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
		if (!uuid_le_cmp(channel->offermsg.offer.if_type,
				 newchannel->offermsg.offer.if_type) &&
		    !uuid_le_cmp(channel->offermsg.offer.if_instance,
				 newchannel->offermsg.offer.if_instance)) {
		if (guid_equal(&channel->offermsg.offer.if_type,
			       &newchannel->offermsg.offer.if_type) &&
		    guid_equal(&channel->offermsg.offer.if_instance,
			       &newchannel->offermsg.offer.if_instance)) {
			fnew = false;
			break;
		}
+2 −2
Original line number Diff line number Diff line
@@ -312,8 +312,8 @@ extern const struct vmbus_channel_message_table_entry

/* General vmbus interface */

struct hv_device *vmbus_device_create(const uuid_le *type,
				      const uuid_le *instance,
struct hv_device *vmbus_device_create(const guid_t *type,
				      const guid_t *instance,
				      struct vmbus_channel *channel);

int vmbus_device_register(struct hv_device *child_device_obj);
+13 −1
Original line number Diff line number Diff line
@@ -74,9 +74,11 @@ static void hv_signal_on_write(u32 old_write, struct vmbus_channel *channel)
	 * This is the only case we need to signal when the
	 * ring transitions from being empty to non-empty.
	 */
	if (old_write == READ_ONCE(rbi->ring_buffer->read_index))
	if (old_write == READ_ONCE(rbi->ring_buffer->read_index)) {
		++channel->intr_out_empty;
		vmbus_setevent(channel);
	}
}

/* Get the next write location for the specified ring buffer. */
static inline u32
@@ -272,10 +274,19 @@ int hv_ringbuffer_write(struct vmbus_channel *channel,
	 * is empty since the read index == write index.
	 */
	if (bytes_avail_towrite <= totalbytes_towrite) {
		++channel->out_full_total;

		if (!channel->out_full_flag) {
			++channel->out_full_first;
			channel->out_full_flag = true;
		}

		spin_unlock_irqrestore(&outring_info->ring_lock, flags);
		return -EAGAIN;
	}

	channel->out_full_flag = false;

	/* Write to the ring buffer */
	next_write_location = hv_get_next_write_location(outring_info);

@@ -530,6 +541,7 @@ void hv_pkt_iter_close(struct vmbus_channel *channel)
	if (curr_write_sz <= pending_sz)
		return;

	++channel->intr_in_full;
	vmbus_setevent(channel);
}
EXPORT_SYMBOL_GPL(hv_pkt_iter_close);
Loading