linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Kimberly Brown <kimbrownkd@gmail.com>
Cc: Michael Kelley <mikelley@microsoft.com>,
	Long Li <longli@microsoft.com>,
	Sasha Levin <Alexander.Levin@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Drivers: hv: vmbus: Expose monitor data when channel uses monitor pages
Date: Tue, 26 Feb 2019 09:18:48 +0100	[thread overview]
Message-ID: <20190226081848.GA15659@kroah.com> (raw)
In-Reply-To: <20190226053530.GA2897@ubu-Virtual-Machine>

On Tue, Feb 26, 2019 at 12:35:30AM -0500, Kimberly Brown wrote:
> There are two methods for signaling the host: the monitor page mechanism
> and hypercalls. The monitor page mechanism is used by performance
> critical channels (storage, networking, etc.) because it provides
> improved throughput. However, latency is increased. Monitor pages are
> allocated to these channels.
> 
> Monitor pages are not allocated to channels that do not use the monitor
> page mechanism. Therefore, these channels do not have a valid monitor id
> or valid monitor page data. In these cases, some of the "_show"
> functions return incorrect data. They return an invalid monitor id and
> data that is beyond the bounds of the hv_monitor_page array fields.
> 
> The "channel->offermsg.monitor_allocated" value can be used to determine
> whether monitor pages have been allocated to a channel.
> 
> Move the device-level monitor page attributes to a separate
> attribute_group struct. If the channel uses the monitor page mechanism,
> set up the sysfs files for these attributes in vmbus_device_register().
> 
> Move the channel-level monitor page attributes to a separate
> attribute_group struct. If the channel uses the monitor page mechanism,
> set up the sysfs files for these attributes in vmbus_add_channel_kobj().
> 
> Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com>
> ---
> Changes in v3:
> The monitor "_show" functions no longer return an error when a channel
> does not use the monitor page mechanism. Instead, the monitor page sysfs
> files are created only when a channel uses the monitor page mechanism.
> This change was suggested by G. Kroah-Hartman.
> 
> Note: this patch was originally patch 2/2 in a patchset. Patch 1/2 has
> already been added to char-misc-testing, so I'm not resending it.
> 
> Changes in v2:
>  - Changed the return value for cases where monitor_allocated is not set
>    to "-EINVAL".
>  - Updated the commit message to provide more details about the monitor
>    page mechanism.
>  - Updated the sysfs documentation to describe the new return value.
> 
>  Documentation/ABI/stable/sysfs-bus-vmbus | 12 ++++--
>  drivers/hv/vmbus_drv.c                   | 52 +++++++++++++++++++-----
>  2 files changed, 51 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus b/Documentation/ABI/stable/sysfs-bus-vmbus
> index 826689dcc2e6..6d5cb195b119 100644
> --- a/Documentation/ABI/stable/sysfs-bus-vmbus
> +++ b/Documentation/ABI/stable/sysfs-bus-vmbus
> @@ -81,7 +81,9 @@ What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>/latency
>  Date:		September. 2017
>  KernelVersion:	4.14
>  Contact:	Stephen Hemminger <sthemmin@microsoft.com>
> -Description:	Channel signaling latency
> +Description:	Channel signaling latency. This file is available only for
> +		performance critical channels (storage, network, etc.) that use
> +		the monitor page mechanism.
>  Users:		Debugging tools
>  
>  What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>/out_mask
> @@ -95,7 +97,9 @@ What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>/pending
>  Date:		September. 2017
>  KernelVersion:	4.14
>  Contact:	Stephen Hemminger <sthemmin@microsoft.com>
> -Description:	Channel interrupt pending state
> +Description:	Channel interrupt pending state. This file is available only for
> +                performance critical channels (storage, network, etc.) that use
> +                the monitor page mechanism.
>  Users:		Debugging tools
>  
>  What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>/read_avail
> @@ -137,7 +141,9 @@ What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>/monitor_id
>  Date:		January. 2018
>  KernelVersion:	4.16
>  Contact:	Stephen Hemminger <sthemmin@microsoft.com>
> -Description:	Monitor bit associated with channel
> +Description:	Monitor bit associated with channel. This file is available only
> +		for performance critical channels (storage, network, etc.) that
> +		use the monitor page mechanism.
>  Users:		Debugging tools and userspace drivers
>  
>  What:		/sys/bus/vmbus/devices/<UUID>/channels/<N>/ring
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 000b53e5a17a..ede858b0ee46 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -601,19 +601,12 @@ static DEVICE_ATTR_RW(driver_override);
>  static struct attribute *vmbus_dev_attrs[] = {
>  	&dev_attr_id.attr,
>  	&dev_attr_state.attr,
> -	&dev_attr_monitor_id.attr,
>  	&dev_attr_class_id.attr,
>  	&dev_attr_device_id.attr,
>  	&dev_attr_modalias.attr,
>  #ifdef CONFIG_NUMA
>  	&dev_attr_numa_node.attr,
>  #endif
> -	&dev_attr_server_monitor_pending.attr,
> -	&dev_attr_client_monitor_pending.attr,
> -	&dev_attr_server_monitor_latency.attr,
> -	&dev_attr_client_monitor_latency.attr,
> -	&dev_attr_server_monitor_conn_id.attr,
> -	&dev_attr_client_monitor_conn_id.attr,
>  	&dev_attr_out_intr_mask.attr,
>  	&dev_attr_out_read_index.attr,
>  	&dev_attr_out_write_index.attr,
> @@ -632,6 +625,22 @@ static struct attribute *vmbus_dev_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(vmbus_dev);
>  
> +/*
> + *  Set up per device monitor page attributes. These attributes are used only by
> + *  channels that use the monitor page mechanism.
> + */
> +static struct attribute *vmbus_dev_monitor_attrs[] = {
> +	&dev_attr_monitor_id.attr,
> +	&dev_attr_server_monitor_pending.attr,
> +	&dev_attr_client_monitor_pending.attr,
> +	&dev_attr_server_monitor_latency.attr,
> +	&dev_attr_client_monitor_latency.attr,
> +	&dev_attr_server_monitor_conn_id.attr,
> +	&dev_attr_client_monitor_conn_id.attr,
> +	NULL
> +};
> +ATTRIBUTE_GROUPS(vmbus_dev_monitor);

No need to create a special group for this and then manually add it if
you need it.  Just the is_visible() callback in the attribute instead, as
that is what it is there for.

Thanks,

greg k-h

  reply	other threads:[~2019-02-26  8:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7481d15f52427917a5f620e29308c1aa5c63f3eb.1550554279.git.kimbrownkd@gmail.com>
2019-02-26  5:35 ` [PATCH v3] Drivers: hv: vmbus: Expose monitor data when channel uses monitor pages Kimberly Brown
2019-02-26  8:18   ` Greg KH [this message]
2019-03-01 19:18   ` [PATCH v4] Drivers: hv: vmbus: Expose monitor data only when monitor pages are used Kimberly Brown
2019-03-02 18:39     ` Michael Kelley
2019-03-03 21:40       ` Kimberly Brown
2019-03-03  8:05     ` Greg KH
2019-03-03 21:11       ` Kimberly Brown
2019-03-04  7:38         ` Greg KH
2019-03-08 22:46     ` [PATCH v5] " Kimberly Brown
2019-03-09  7:21       ` Greg KH
2019-03-12  0:04         ` Kimberly Brown
2019-03-19  4:04       ` [PATCH v6] " Kimberly Brown
2019-03-19  9:26         ` Greg KH
2019-03-20 20:18         ` Michael Kelley
2019-03-21  3:57         ` Sasha Levin
2019-03-21 15:55           ` Michael Kelley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190226081848.GA15659@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Alexander.Levin@microsoft.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kimbrownkd@gmail.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=mikelley@microsoft.com \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).