diff mbox series

[v4] net: netvsc: Update default VMBus channels

Message ID 1724735791-22815-1-git-send-email-ernis@linux.microsoft.com (mailing list archive)
State Accepted
Commit 646f071d315b75e87583de290d333478d42ccde1
Delegated to: Netdev Maintainers
Headers show
Series [v4] net: netvsc: Update default VMBus channels | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-27--18-00 (tests: 714)

Commit Message

Erni Sri Satya Vennela Aug. 27, 2024, 5:16 a.m. UTC
Change VMBus channels macro (VRSS_CHANNEL_DEFAULT) in
Linux netvsc from 8 to 16 to align with Azure Windows VM
and improve networking throughput.

For VMs having less than 16 vCPUS, the channels depend
on number of vCPUs. For greater than 16 vCPUs,
set the channels to maximum of VRSS_CHANNEL_DEFAULT and
number of physical cores / 2 which is returned by
netif_get_num_default_rss_queues() as a way to optimize CPU
resource utilization and scale for high-end processors with
many cores.
Maximum number of channels are by default set to 64.

Based on this change the channel creation would change as follows:

-----------------------------------------------------------------
| No. of vCPU |  dev_info->num_chn |    channels created        |
-----------------------------------------------------------------
|    1-16     |        16	   |          vCPU              |
|    >16      |  max(16,#cores/2)  | min(64 , max(16,#cores/2)) |
-----------------------------------------------------------------

Performance tests showed significant improvement in throughput:
- 0.54% for 16 vCPUs
- 0.83% for 32 vCPUs
- 0.86% for 48 vCPUs
- 9.72% for 64 vCPUs
- 13.57% for 96 vCPUs

Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
---
Changes in v4:
* Update commit message for channels created
---
Changes in v3:
* Use netif_get_num_default_rss_queues() to set channels
* Change terminology for channels in commit message
---
Changes in v2:
* Set dev_info->num_chn based on vCPU count.
---
 drivers/net/hyperv/hyperv_net.h | 2 +-
 drivers/net/hyperv/netvsc_drv.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Michael Kelley Aug. 28, 2024, 3:08 p.m. UTC | #1
From: Erni Sri Satya Vennela <ernis@linux.microsoft.com> Sent: Monday, August 26, 2024 10:17 PM
> 
> Change VMBus channels macro (VRSS_CHANNEL_DEFAULT) in
> Linux netvsc from 8 to 16 to align with Azure Windows VM
> and improve networking throughput.
> 
> For VMs having less than 16 vCPUS, the channels depend
> on number of vCPUs. For greater than 16 vCPUs,
> set the channels to maximum of VRSS_CHANNEL_DEFAULT and
> number of physical cores / 2 which is returned by
> netif_get_num_default_rss_queues() as a way to optimize CPU
> resource utilization and scale for high-end processors with
> many cores.
> Maximum number of channels are by default set to 64.
> 
> Based on this change the channel creation would change as follows:
> 
> -----------------------------------------------------------------
> | No. of vCPU |  dev_info->num_chn |    channels created        |
> -----------------------------------------------------------------
> |    1-16     |        16	   |          vCPU              |
> |    >16      |  max(16,#cores/2)  | min(64 , max(16,#cores/2)) |
> -----------------------------------------------------------------
> 
> Performance tests showed significant improvement in throughput:
> - 0.54% for 16 vCPUs
> - 0.83% for 32 vCPUs
> - 0.86% for 48 vCPUs
> - 9.72% for 64 vCPUs
> - 13.57% for 96 vCPUs
> 
> Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
> ---
> Changes in v4:
> * Update commit message for channels created
> ---
> Changes in v3:
> * Use netif_get_num_default_rss_queues() to set channels
> * Change terminology for channels in commit message
> ---
> Changes in v2:
> * Set dev_info->num_chn based on vCPU count.
> ---
>  drivers/net/hyperv/hyperv_net.h | 2 +-
>  drivers/net/hyperv/netvsc_drv.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index 810977952f95..e690b95b1bbb 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -882,7 +882,7 @@ struct nvsp_message {
> 
>  #define VRSS_SEND_TAB_SIZE 16  /* must be power of 2 */
>  #define VRSS_CHANNEL_MAX 64
> -#define VRSS_CHANNEL_DEFAULT 8
> +#define VRSS_CHANNEL_DEFAULT 16
> 
>  #define RNDIS_MAX_PKT_DEFAULT 8
>  #define RNDIS_PKT_ALIGN_DEFAULT 8
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 44142245343d..a6482afe4217 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -987,7 +987,8 @@ struct netvsc_device_info *netvsc_devinfo_get(struct
> netvsc_device *nvdev)
>  			dev_info->bprog = prog;
>  		}
>  	} else {
> -		dev_info->num_chn = VRSS_CHANNEL_DEFAULT;
> +		dev_info->num_chn = max(VRSS_CHANNEL_DEFAULT,
> +					netif_get_num_default_rss_queues());
>  		dev_info->send_sections = NETVSC_DEFAULT_TX;
>  		dev_info->send_section_size = NETVSC_SEND_SECTION_SIZE;
>  		dev_info->recv_sections = NETVSC_DEFAULT_RX;
> --
> 2.34.1
> 

Reviewed-by: Michael Kelley <mhklinux@outlook.com>
patchwork-bot+netdevbpf@kernel.org Aug. 29, 2024, 1 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 26 Aug 2024 22:16:31 -0700 you wrote:
> Change VMBus channels macro (VRSS_CHANNEL_DEFAULT) in
> Linux netvsc from 8 to 16 to align with Azure Windows VM
> and improve networking throughput.
> 
> For VMs having less than 16 vCPUS, the channels depend
> on number of vCPUs. For greater than 16 vCPUs,
> set the channels to maximum of VRSS_CHANNEL_DEFAULT and
> number of physical cores / 2 which is returned by
> netif_get_num_default_rss_queues() as a way to optimize CPU
> resource utilization and scale for high-end processors with
> many cores.
> Maximum number of channels are by default set to 64.
> 
> [...]

Here is the summary with links:
  - [v4] net: netvsc: Update default VMBus channels
    https://git.kernel.org/netdev/net-next/c/646f071d315b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 810977952f95..e690b95b1bbb 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -882,7 +882,7 @@  struct nvsp_message {
 
 #define VRSS_SEND_TAB_SIZE 16  /* must be power of 2 */
 #define VRSS_CHANNEL_MAX 64
-#define VRSS_CHANNEL_DEFAULT 8
+#define VRSS_CHANNEL_DEFAULT 16
 
 #define RNDIS_MAX_PKT_DEFAULT 8
 #define RNDIS_PKT_ALIGN_DEFAULT 8
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 44142245343d..a6482afe4217 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -987,7 +987,8 @@  struct netvsc_device_info *netvsc_devinfo_get(struct netvsc_device *nvdev)
 			dev_info->bprog = prog;
 		}
 	} else {
-		dev_info->num_chn = VRSS_CHANNEL_DEFAULT;
+		dev_info->num_chn = max(VRSS_CHANNEL_DEFAULT,
+					netif_get_num_default_rss_queues());
 		dev_info->send_sections = NETVSC_DEFAULT_TX;
 		dev_info->send_section_size = NETVSC_SEND_SECTION_SIZE;
 		dev_info->recv_sections = NETVSC_DEFAULT_RX;