KVM: s390: Add module parameter to fence 2G hugepages

Add the hpage_2g module parameter to KVM to allow enabling or disabling
2G hugepages in KVM.

If hpage_2g is enabled but hpage is not enabled, print a message and
disable hpage_2g.

Opportunistically fix the comment for the hpage module parameter.

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-ID: <20260609150930.665370-2-imbrenda@linux.ibm.com>
This commit is contained in:
Claudio Imbrenda 2026-06-09 17:09:27 +02:00
parent 68f8c9565c
commit 782fec4ab9

View File

@ -204,11 +204,16 @@ static int nested;
module_param(nested, int, S_IRUGO);
MODULE_PARM_DESC(nested, "Nested virtualization support");
/* allow 1m huge page guest backing, if !nested */
/* allow 1m huge page guest backing */
static int hpage;
module_param(hpage, int, 0444);
MODULE_PARM_DESC(hpage, "1m huge page backing support");
/* allow 2g huge page guest backing */
static int hpage_2g;
module_param(hpage_2g, int, 0444);
MODULE_PARM_DESC(hpage_2g, "2g huge page backing support");
/* maximum percentage of steal time for polling. >100 is treated like 100 */
static u8 halt_poll_max_steal = 10;
module_param(halt_poll_max_steal, byte, 0644);
@ -5842,6 +5847,11 @@ static int __init kvm_s390_init(void)
return -ENODEV;
}
if (hpage_2g && !hpage) {
hpage_2g = 0;
pr_info("Disabling 2G hugepage support, since 1M hugepage support is not enabled.\n");
}
for (i = 0; i < 16; i++)
kvm_s390_fac_base[i] |=
stfle_fac_list[i] & nonhyp_mask(i);