]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: s390: Add module parameter to fence 2G hugepages
authorClaudio Imbrenda <imbrenda@linux.ibm.com>
Tue, 9 Jun 2026 15:09:27 +0000 (17:09 +0200)
committerClaudio Imbrenda <imbrenda@linux.ibm.com>
Tue, 9 Jun 2026 15:30:57 +0000 (17:30 +0200)
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>

arch/s390/kvm/kvm-s390.c

index f6521f16532ae0a49da2cde891b01e3277025372..abc7941d7bb46cdc68c4201814a34aa160111530 100644 (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);