[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB415758508A7BE89E0CFBD976D4532@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Sat, 17 Feb 2024 16:46:04 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Saurabh Sengar <ssengar@...ux.microsoft.com>, "kys@...rosoft.com"
<kys@...rosoft.com>, "haiyangz@...rosoft.com" <haiyangz@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>, "decui@...rosoft.com"
<decui@...rosoft.com>, "linux-hyperv@...r.kernel.org"
<linux-hyperv@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
CC: "ssengar@...rosoft.com" <ssengar@...rosoft.com>
Subject: RE: [PATCH] Drivers: hv: Kconfig: select CPUMASK_OFFSTACK for Hyper-V
From: Saurabh Sengar <ssengar@...ux.microsoft.com> Sent: Friday, February 16, 2024 6:10 AM
> To: kys@...rosoft.com; haiyangz@...rosoft.com; wei.liu@...nel.org;
> decui@...rosoft.com; linux-hyperv@...r.kernel.org; linux-kernel@...r.kernel.org
> Cc: ssengar@...rosoft.com
> Subject: [PATCH] Drivers: hv: Kconfig: select CPUMASK_OFFSTACK for Hyper-V
>
> CPUMASK_OFFSTACK must be set to have NR_CPUS_RANGE_END value greater than
> 512, which eventually allows NR_CPUS > 512.
>
> CPUMASK_OFFSTACK can also be enabled by setting MAXSMP=y, but that will
> set NR_CPUS=8192. This is not accurate for Hyper-V, because maximum number
> of vCPU supported by Hyper-V today is 2048. Thus, enabling MAXSMP increase
> the vmlinux size unnecessary.
Note that these statements apply only to x86. arm64 doesn't have MAXSMP
or NR_CPUS_RANGE_END.
>
> This option allows NR_CPUS=2048 which saves around 1MB of vmlinux size
> for Hyper-V.
>
> Signed-off-by: Saurabh Sengar <ssengar@...ux.microsoft.com>
> ---
> drivers/hv/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
> index 0024210..bc3f496 100644
> --- a/drivers/hv/Kconfig
> +++ b/drivers/hv/Kconfig
> @@ -9,6 +9,7 @@ config HYPERV
> select PARAVIRT
> select X86_HV_CALLBACK_VECTOR if X86
> select OF_EARLY_FLATTREE if OF
> + select CPUMASK_OFFSTACK
> help
> Select this option to run Linux as a Hyper-V client operating
> system.
> --
> 1.8.3.1
>
I'm not sure that enabling CPUMASK_OFFSTACK for Hyper-V
guests is the right thing to do, as there's additional runtime
cost when CPUMASK_OFFSTACK is enabled. I agree that for
the most general case, you want NR_CPUS to be 2048, which
requires CPUMASK_OFFSTACK. But it would be legitimate to
build a kernel with NR_CPUS set to something like 64 or 256
for a more limited Hyper-V guest use case, and to not want to
incur the cost of CPUMASK_OFFSTACK.
You could consider doing something like this:
select CPUMASK_OFFSTACK if NR_CPUS > 512
But kernel builders always have the option of explicitly
enabling CPUMASK_OFFSTACK. That's what I see in the distro
vendor arm64 images in Azure, since there's currently nothing
that automatically selects CPUMASK_OFFSTACK for arm64.
So I'm wondering if selecting CPUMASK_OFFSTACK under
HYPERV should be added at all. The two aren't really related.
There are recent LKML threads on enabling CPUMASK_OFFSTACK
for arm64 -- see links below for some useful discussion of the
topic in general.
Michael
[1] https://lore.kernel.org/lkml/794a1211-630b-3ee5-55a3-c06f10df1490@linuxcom/
[2] https://lore.kernel.org/lkml/7ab6660e-e69f-a64b-0de3-b8dde14f79fa@linuxcom/
[3] https://lore.kernel.org/lkml/e0d41efb-a74e-6bb5-f325-63d42358c802@gentwo.org/
Powered by blists - more mailing lists