Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus-6.15a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

- A simple fix adding the module description of the Xenbus frontend
module

- A fix correcting the xen-acpi-processor Kconfig dependency for PVH
Dom0 support

- A fix for the Xen balloon driver when running as Xen Dom0 in PVH mode

- A fix for PVH Dom0 in order to avoid problems with CPU idle and
frequency drivers conflicting with Xen

* tag 'for-linus-6.15a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
x86/xen: disable CPU idle and frequency drivers for PVH dom0
x86/xen: fix balloon target initialization for PVH dom0
xen: Change xen-acpi-processor dom0 dependency
xenbus: add module description

+54 -15
+10
arch/x86/xen/enlighten.c
··· 70 70 */ 71 71 struct shared_info *HYPERVISOR_shared_info = &xen_dummy_shared_info; 72 72 73 + /* Number of pages released from the initial allocation. */ 74 + unsigned long xen_released_pages; 75 + 73 76 static __ref void xen_get_vendor(void) 74 77 { 75 78 init_cpu_devs(); ··· 469 466 xen_free_unpopulated_pages(1, &pg); 470 467 } 471 468 469 + /* 470 + * Account for the region being in the physmap but unpopulated. 471 + * The value in xen_released_pages is used by the balloon 472 + * driver to know how much of the physmap is unpopulated and 473 + * set an accurate initial memory target. 474 + */ 475 + xen_released_pages += xen_extra_mem[i].n_pfns; 472 476 /* Zero so region is not also added to the balloon driver. */ 473 477 xen_extra_mem[i].n_pfns = 0; 474 478 }
+18 -1
arch/x86/xen/enlighten_pvh.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/acpi.h> 3 + #include <linux/cpufreq.h> 4 + #include <linux/cpuidle.h> 3 5 #include <linux/export.h> 4 6 #include <linux/mm.h> 5 7 ··· 125 123 { 126 124 pvh_reserve_extra_memory(); 127 125 128 - if (xen_initial_domain()) 126 + if (xen_initial_domain()) { 129 127 xen_add_preferred_consoles(); 128 + 129 + /* 130 + * Disable usage of CPU idle and frequency drivers: when 131 + * running as hardware domain the exposed native ACPI tables 132 + * causes idle and/or frequency drivers to attach and 133 + * malfunction. It's Xen the entity that controls the idle and 134 + * frequency states. 135 + * 136 + * For unprivileged domains the exposed ACPI tables are 137 + * fabricated and don't contain such data. 138 + */ 139 + disable_cpuidle(); 140 + disable_cpufreq(); 141 + WARN_ON(xen_set_default_idle()); 142 + } 130 143 } 131 144 132 145 void __init xen_pvh_init(struct boot_params *boot_params)
-3
arch/x86/xen/setup.c
··· 37 37 38 38 #define GB(x) ((uint64_t)(x) * 1024 * 1024 * 1024) 39 39 40 - /* Number of pages released from the initial allocation. */ 41 - unsigned long xen_released_pages; 42 - 43 40 /* Memory map would allow PCI passthrough. */ 44 41 bool xen_pv_pci_possible; 45 42
+1 -1
drivers/xen/Kconfig
··· 278 278 279 279 config XEN_ACPI_PROCESSOR 280 280 tristate "Xen ACPI processor" 281 - depends on XEN && XEN_PV_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ 281 + depends on XEN && XEN_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ 282 282 default m 283 283 help 284 284 This ACPI processor uploads Power Management information to the Xen
+24 -10
drivers/xen/balloon.c
··· 679 679 } 680 680 EXPORT_SYMBOL(xen_free_ballooned_pages); 681 681 682 - static void __init balloon_add_regions(void) 682 + static int __init balloon_add_regions(void) 683 683 { 684 684 unsigned long start_pfn, pages; 685 685 unsigned long pfn, extra_pfn_end; ··· 702 702 for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) 703 703 balloon_append(pfn_to_page(pfn)); 704 704 705 - balloon_stats.total_pages += extra_pfn_end - start_pfn; 705 + /* 706 + * Extra regions are accounted for in the physmap, but need 707 + * decreasing from current_pages to balloon down the initial 708 + * allocation, because they are already accounted for in 709 + * total_pages. 710 + */ 711 + if (extra_pfn_end - start_pfn >= balloon_stats.current_pages) { 712 + WARN(1, "Extra pages underflow current target"); 713 + return -ERANGE; 714 + } 715 + balloon_stats.current_pages -= extra_pfn_end - start_pfn; 706 716 } 717 + 718 + return 0; 707 719 } 708 720 709 721 static int __init balloon_init(void) 710 722 { 711 723 struct task_struct *task; 724 + int rc; 712 725 713 726 if (!xen_domain()) 714 727 return -ENODEV; 715 728 716 729 pr_info("Initialising balloon driver\n"); 717 730 718 - #ifdef CONFIG_XEN_PV 719 - balloon_stats.current_pages = xen_pv_domain() 720 - ? min(xen_start_info->nr_pages - xen_released_pages, max_pfn) 721 - : get_num_physpages(); 722 - #else 723 - balloon_stats.current_pages = get_num_physpages(); 724 - #endif 731 + if (xen_released_pages >= get_num_physpages()) { 732 + WARN(1, "Released pages underflow current target"); 733 + return -ERANGE; 734 + } 735 + 736 + balloon_stats.current_pages = get_num_physpages() - xen_released_pages; 725 737 balloon_stats.target_pages = balloon_stats.current_pages; 726 738 balloon_stats.balloon_low = 0; 727 739 balloon_stats.balloon_high = 0; ··· 750 738 register_sysctl_init("xen/balloon", balloon_table); 751 739 #endif 752 740 753 - balloon_add_regions(); 741 + rc = balloon_add_regions(); 742 + if (rc) 743 + return rc; 754 744 755 745 task = kthread_run(balloon_thread, NULL, "xen-balloon"); 756 746 if (IS_ERR(task)) {
+1
drivers/xen/xenbus/xenbus_probe_frontend.c
··· 513 513 late_initcall(boot_wait_for_devices); 514 514 #endif 515 515 516 + MODULE_DESCRIPTION("Xen PV-device frontend support"); 516 517 MODULE_LICENSE("GPL");