Linux-HyperV Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs
@ 2020-07-23  6:59 Chi Song
  2020-07-23 17:08 ` Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Chi Song @ 2020-07-23  6:59 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	David S. Miller, Jakub Kicinski
  Cc: linux-hyperv, netdev, linux-kernel

An imbalanced TX indirection table causes netvsc to have low
performance. This table is created and managed during runtime. To help
better diagnose performance issues caused by imbalanced tables, it needs
make TX indirection tables visible.

Because TX indirection table is driver specified information, so
display it via ethtool register dump.

Signed-off-by: Chi Song <chisong@microsoft.com>
---
v7: move to ethtool register dump
v6: update names to be more precise, remove useless assignment
v5: update variable orders
v4: use a separated group to organize tx_indirection better, change
 location of attributes init/exit to netvsc_drv_init/exit

 drivers/net/hyperv/netvsc_drv.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/hyperv/netvsc_drv.c
b/drivers/net/hyperv/netvsc_drv.c
index 6267f706e8ee..3288221726ea 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1934,6 +1934,23 @@ static int netvsc_set_features(struct net_device
*ndev,
 	return ret;
 }

+static int netvsc_get_regs_len(struct net_device *netdev)
+{
+	return VRSS_SEND_TAB_SIZE * sizeof(u32);
+}
+
+static void netvsc_get_regs(struct net_device *netdev,
+			    struct ethtool_regs *regs, void *p)
+{
+	struct net_device_context *ndc = netdev_priv(netdev);
+	u32 *regs_buff = p;
+
+	/* increase the version, if buffer format is changed. */
+	regs->version = 1;
+
+	memcpy(regs_buff, ndc->tx_table, VRSS_SEND_TAB_SIZE *
sizeof(u32));
+}
+
 static u32 netvsc_get_msglevel(struct net_device *ndev)
 {
 	struct net_device_context *ndev_ctx = netdev_priv(ndev);
@@ -1950,6 +1967,8 @@ static void netvsc_set_msglevel(struct net_device
*ndev, u32 val)

 static const struct ethtool_ops ethtool_ops = {
 	.get_drvinfo	= netvsc_get_drvinfo,
+	.get_regs_len	= netvsc_get_regs_len,
+	.get_regs	= netvsc_get_regs,
 	.get_msglevel	= netvsc_get_msglevel,
 	.set_msglevel	= netvsc_set_msglevel,
 	.get_link	= ethtool_op_get_link,
-- 
2.25.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-23  6:59 [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs Chi Song
@ 2020-07-23 17:08 ` Jakub Kicinski
  2020-07-23 19:35 ` Michal Kubecek
  2020-07-24  4:14 ` [PATCH v8 " Chi Song
  2 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2020-07-23 17:08 UTC (permalink / raw)
  To: Chi Song
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	David S. Miller, linux-hyperv, netdev, linux-kernel

On Wed, 22 Jul 2020 23:59:09 -0700 (PDT) Chi Song wrote:
> An imbalanced TX indirection table causes netvsc to have low
> performance. This table is created and managed during runtime. To help
> better diagnose performance issues caused by imbalanced tables, it needs
> make TX indirection tables visible.
> 
> Because TX indirection table is driver specified information, so
> display it via ethtool register dump.
> 
> Signed-off-by: Chi Song <chisong@microsoft.com>

The patch looks good to me, but it has been corrupted by your email
client, could you perhaps try git send-email?

> +	memcpy(regs_buff, ndc->tx_table, VRSS_SEND_TAB_SIZE *
> sizeof(u32));

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-23  6:59 [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs Chi Song
  2020-07-23 17:08 ` Jakub Kicinski
@ 2020-07-23 19:35 ` Michal Kubecek
  2020-07-23 19:55   ` Haiyang Zhang
  2020-07-24  4:14 ` [PATCH v8 " Chi Song
  2 siblings, 1 reply; 8+ messages in thread
From: Michal Kubecek @ 2020-07-23 19:35 UTC (permalink / raw)
  To: Chi Song
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	David S. Miller, Jakub Kicinski, linux-hyperv, netdev,
	linux-kernel

On Wed, Jul 22, 2020 at 11:59:09PM -0700, Chi Song wrote:
> An imbalanced TX indirection table causes netvsc to have low
> performance. This table is created and managed during runtime. To help
> better diagnose performance issues caused by imbalanced tables, it needs
> make TX indirection tables visible.
> 
> Because TX indirection table is driver specified information, so
> display it via ethtool register dump.

Is the Tx indirection table really unique to netvsc or can we expect
other drivers to support similar feature? Also, would it make sense to
allow also setting the table with ethtool? (AFAICS it can be only set
from hypervisor at the moment.)

It kind of feels that the actual reason for using register dump was that
it's there and it was easy to use rather than that the information would
logically belong there. We already have a specific interface for getting
and seting receive indirection table; perhaps it would make sense to
have also one for the transmit indirection table.

Michal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-23 19:35 ` Michal Kubecek
@ 2020-07-23 19:55   ` Haiyang Zhang
  2020-07-23 20:22     ` Michal Kubecek
  0 siblings, 1 reply; 8+ messages in thread
From: Haiyang Zhang @ 2020-07-23 19:55 UTC (permalink / raw)
  To: Michal Kubecek, Chi Song
  Cc: KY Srinivasan, Stephen Hemminger, Wei Liu, David S. Miller,
	Jakub Kicinski, linux-hyperv, netdev, linux-kernel



> -----Original Message-----
> From: Michal Kubecek <mkubecek@suse.cz>
> Sent: Thursday, July 23, 2020 3:36 PM
> To: Chi Song <Song.Chi@microsoft.com>
> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> Wei Liu <wei.liu@kernel.org>; David S. Miller <davem@davemloft.net>; Jakub
> Kicinski <kuba@kernel.org>; linux-hyperv@vger.kernel.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v7 net-next] net: hyperv: dump TX indirection table to
> ethtool regs
> 
> On Wed, Jul 22, 2020 at 11:59:09PM -0700, Chi Song wrote:
> > An imbalanced TX indirection table causes netvsc to have low
> > performance. This table is created and managed during runtime. To help
> > better diagnose performance issues caused by imbalanced tables, it needs
> > make TX indirection tables visible.
> >
> > Because TX indirection table is driver specified information, so
> > display it via ethtool register dump.
> 
> Is the Tx indirection table really unique to netvsc or can we expect
> other drivers to support similar feature? Also, would it make sense to
> allow also setting the table with ethtool? (AFAICS it can be only set
> from hypervisor at the moment.)

Currently, TX indirection table is only used by the Hyper-V synthetic NIC. I'm 
not aware of any other NIC planning to use this.
This table is created by host dynamically based on host side CPU usage, 
and provided to the VM periodically. Our protocol doesn't let the guest side 
to change it.

Thanks,
- Haiyang


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-23 19:55   ` Haiyang Zhang
@ 2020-07-23 20:22     ` Michal Kubecek
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Kubecek @ 2020-07-23 20:22 UTC (permalink / raw)
  To: Haiyang Zhang
  Cc: Chi Song, KY Srinivasan, Stephen Hemminger, Wei Liu,
	David S. Miller, Jakub Kicinski, linux-hyperv, netdev,
	linux-kernel

On Thu, Jul 23, 2020 at 07:55:20PM +0000, Haiyang Zhang wrote:
> > -----Original Message-----
> > From: Michal Kubecek <mkubecek@suse.cz>
> > Sent: Thursday, July 23, 2020 3:36 PM
> > To: Chi Song <Song.Chi@microsoft.com>
> > Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> > <haiyangz@microsoft.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> > Wei Liu <wei.liu@kernel.org>; David S. Miller <davem@davemloft.net>; Jakub
> > Kicinski <kuba@kernel.org>; linux-hyperv@vger.kernel.org;
> > netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v7 net-next] net: hyperv: dump TX indirection table to
> > ethtool regs
> > 
> > On Wed, Jul 22, 2020 at 11:59:09PM -0700, Chi Song wrote:
> > > An imbalanced TX indirection table causes netvsc to have low
> > > performance. This table is created and managed during runtime. To help
> > > better diagnose performance issues caused by imbalanced tables, it needs
> > > make TX indirection tables visible.
> > >
> > > Because TX indirection table is driver specified information, so
> > > display it via ethtool register dump.
> > 
> > Is the Tx indirection table really unique to netvsc or can we expect
> > other drivers to support similar feature? Also, would it make sense to
> > allow also setting the table with ethtool? (AFAICS it can be only set
> > from hypervisor at the moment.)
> 
> Currently, TX indirection table is only used by the Hyper-V synthetic NIC. I'm 
> not aware of any other NIC planning to use this.
> This table is created by host dynamically based on host side CPU usage, 
> and provided to the VM periodically. Our protocol doesn't let the guest side 
> to change it.

If host is expected to rewrite the table periodically, it would indeed
be of little use to set it on guest side. OK, let's do it as register
dump and see if someone else comes with similar feature.

Michal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v8 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-23  6:59 [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs Chi Song
  2020-07-23 17:08 ` Jakub Kicinski
  2020-07-23 19:35 ` Michal Kubecek
@ 2020-07-24  4:14 ` Chi Song
  2020-07-24 15:28   ` Haiyang Zhang
  2020-07-24 22:18   ` David Miller
  2 siblings, 2 replies; 8+ messages in thread
From: Chi Song @ 2020-07-24  4:14 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, Wei Liu,
	David S. Miller, Jakub Kicinski
  Cc: linux-hyperv, netdev, linux-kernel

An imbalanced TX indirection table causes netvsc to have low
performance. This table is created and managed during runtime. To help
better diagnose performance issues caused by imbalanced tables, it needs
make TX indirection tables visible.

Because TX indirection table is driver specified information, so
display it via ethtool register dump.

Signed-off-by: Chi Song <chisong@microsoft.com>
---
v8: fix corrupt patch file
v7: move to ethtool register dump
v6: update names to be more precise, remove useless assignment
v5: update variable orders
v4: use a separated group to organize tx_indirection better, change 
 location of attributes init/exit to netvsc_drv_init/exit

 drivers/net/hyperv/netvsc_drv.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 6267f706e8ee..3288221726ea 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1934,6 +1934,23 @@ static int netvsc_set_features(struct net_device *ndev,
 	return ret;
 }
 
+static int netvsc_get_regs_len(struct net_device *netdev)
+{
+	return VRSS_SEND_TAB_SIZE * sizeof(u32);
+}
+
+static void netvsc_get_regs(struct net_device *netdev,
+			    struct ethtool_regs *regs, void *p)
+{
+	struct net_device_context *ndc = netdev_priv(netdev);
+	u32 *regs_buff = p;
+
+	/* increase the version, if buffer format is changed. */
+	regs->version = 1;
+
+	memcpy(regs_buff, ndc->tx_table, VRSS_SEND_TAB_SIZE * sizeof(u32));
+}
+
 static u32 netvsc_get_msglevel(struct net_device *ndev)
 {
 	struct net_device_context *ndev_ctx = netdev_priv(ndev);
@@ -1950,6 +1967,8 @@ static void netvsc_set_msglevel(struct net_device *ndev, u32 val)
 
 static const struct ethtool_ops ethtool_ops = {
 	.get_drvinfo	= netvsc_get_drvinfo,
+	.get_regs_len	= netvsc_get_regs_len,
+	.get_regs	= netvsc_get_regs,
 	.get_msglevel	= netvsc_get_msglevel,
 	.set_msglevel	= netvsc_set_msglevel,
 	.get_link	= ethtool_op_get_link,
-- 
2.25.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v8 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-24  4:14 ` [PATCH v8 " Chi Song
@ 2020-07-24 15:28   ` Haiyang Zhang
  2020-07-24 22:18   ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Haiyang Zhang @ 2020-07-24 15:28 UTC (permalink / raw)
  To: Chi Song, KY Srinivasan, Stephen Hemminger, Wei Liu,
	David S. Miller, Jakub Kicinski
  Cc: linux-hyperv, netdev, linux-kernel



> -----Original Message-----
> From: Chi Song <chisong@linux.microsoft.com>
> Sent: Friday, July 24, 2020 12:14 AM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> Wei Liu <wei.liu@kernel.org>; David S. Miller <davem@davemloft.net>; Jakub
> Kicinski <kuba@kernel.org>
> Cc: linux-hyperv@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH v8 net-next] net: hyperv: dump TX indirection table to ethtool
> regs
> 
> An imbalanced TX indirection table causes netvsc to have low
> performance. This table is created and managed during runtime. To help
> better diagnose performance issues caused by imbalanced tables, it needs
> make TX indirection tables visible.
> 
> Because TX indirection table is driver specified information, so
> display it via ethtool register dump.
> 
> Signed-off-by: Chi Song <chisong@microsoft.com>

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v8 net-next] net: hyperv: dump TX indirection table to ethtool regs
  2020-07-24  4:14 ` [PATCH v8 " Chi Song
  2020-07-24 15:28   ` Haiyang Zhang
@ 2020-07-24 22:18   ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2020-07-24 22:18 UTC (permalink / raw)
  To: chisong
  Cc: kys, haiyangz, sthemmin, wei.liu, kuba, linux-hyperv, netdev,
	linux-kernel

From: Chi Song <chisong@linux.microsoft.com>
Date: Thu, 23 Jul 2020 21:14:26 -0700

> An imbalanced TX indirection table causes netvsc to have low
> performance. This table is created and managed during runtime. To help
> better diagnose performance issues caused by imbalanced tables, it needs
> make TX indirection tables visible.
> 
> Because TX indirection table is driver specified information, so
> display it via ethtool register dump.
> 
> Signed-off-by: Chi Song <chisong@microsoft.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23  6:59 [PATCH v7 net-next] net: hyperv: dump TX indirection table to ethtool regs Chi Song
2020-07-23 17:08 ` Jakub Kicinski
2020-07-23 19:35 ` Michal Kubecek
2020-07-23 19:55   ` Haiyang Zhang
2020-07-23 20:22     ` Michal Kubecek
2020-07-24  4:14 ` [PATCH v8 " Chi Song
2020-07-24 15:28   ` Haiyang Zhang
2020-07-24 22:18   ` David Miller

Linux-HyperV Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hyperv/0 linux-hyperv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hyperv linux-hyperv/ https://lore.kernel.org/linux-hyperv \
		linux-hyperv@vger.kernel.org
	public-inbox-index linux-hyperv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hyperv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git