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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-7.0-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross:

- fix running as Xen PVH guest in 32-bit mode without PAE

- fix PV device handling for suspend/resume when running as
a Xen guest

- clean up workqueue usage

- fix the Xen balloon driver for PVH dom0

- introduce the possibility to use hypercalls for console
messages in unprivileged guests

- enable Xen dom0 use of virtio devices in nested virtualization
setups

- simplify the xen-mcelog driver

* tag 'for-linus-7.0-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xenbus: Rename helpers to freeze/thaw/restore
xenbus: Use .freeze/.thaw to handle xenbus devices
xen/mcelog: simplify MCE_GETCLEAR_FLAGS using xchg()
xen/balloon: improve accuracy of initial balloon target for dom0
Partial revert "x86/xen: fix balloon target initialization for PVH dom0"
xen: introduce xen_console_io option
xen/virtio: Don't use grant-dma-ops when running as Dom0
x86/xen/pvh: Enable PAE mode for 32-bit guest only when CONFIG_X86_PAE is set
xen: privcmd: WQ_PERCPU added to alloc_workqueue users
xen/events: replace use of system_wq with system_percpu_wq

+89 -42
+5
Documentation/admin-guide/kernel-parameters.txt
··· 8437 8437 save/restore/migration must be enabled to handle larger 8438 8438 domains. 8439 8439 8440 + xen_console_io [XEN,EARLY] 8441 + Boolean option to enable/disable the usage of the Xen 8442 + console_io hypercalls to read and write to the console. 8443 + Mostly useful for debugging and development. 8444 + 8440 8445 xen_emul_unplug= [HW,X86,XEN,EARLY] 8441 8446 Unplug Xen emulated devices 8442 8447 Format: [unplug0,][unplug1]
+2
arch/x86/platform/pvh/head.S
··· 91 91 92 92 leal rva(early_stack_end)(%ebp), %esp 93 93 94 + #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 94 95 /* Enable PAE mode. */ 95 96 mov %cr4, %eax 96 97 orl $X86_CR4_PAE, %eax 97 98 mov %eax, %cr4 99 + #endif 98 100 99 101 #ifdef CONFIG_X86_64 100 102 /* Enable Long mode. */
+1 -1
arch/x86/xen/enlighten.c
··· 470 470 * driver to know how much of the physmap is unpopulated and 471 471 * set an accurate initial memory target. 472 472 */ 473 - xen_released_pages += xen_extra_mem[i].n_pfns; 473 + xen_unpopulated_pages += xen_extra_mem[i].n_pfns; 474 474 /* Zero so region is not also added to the balloon driver. */ 475 475 xen_extra_mem[i].n_pfns = 0; 476 476 }
+24 -5
drivers/tty/hvc/hvc_xen.c
··· 51 51 52 52 /* ------------------------------------------------------------------ */ 53 53 54 + static bool xen_console_io = false; 55 + static int __initdata opt_console_io = -1; 56 + 57 + static int __init parse_xen_console_io(char *arg) 58 + { 59 + bool val; 60 + int ret; 61 + 62 + ret = kstrtobool(arg, &val); 63 + if (ret == 0) 64 + opt_console_io = (int)val; 65 + 66 + return ret; 67 + } 68 + early_param("xen_console_io", parse_xen_console_io); 69 + 54 70 static struct xencons_info *vtermno_to_xencons(int vtermno) 55 71 { 56 72 struct xencons_info *entry, *ret = NULL; ··· 347 331 struct xencons_info *info; 348 332 unsigned long flags; 349 333 350 - if (!xen_initial_domain()) 334 + if (!xen_console_io) 351 335 return -ENODEV; 352 336 353 337 info = vtermno_to_xencons(HVC_COOKIE); ··· 385 369 { 386 370 struct xencons_info *info = vtermno_to_xencons(HVC_COOKIE); 387 371 if (info != NULL && info->irq) { 388 - if (!xen_initial_domain()) 372 + if (!xen_console_io) 389 373 xen_console_update_evtchn(info); 390 374 rebind_evtchn_irq(info->evtchn, info->irq); 391 375 } ··· 617 601 if (!xen_domain()) 618 602 return -ENODEV; 619 603 620 - if (xen_initial_domain()) { 604 + if (xen_console_io) { 621 605 ops = &dom0_hvc_ops; 622 606 r = xen_initial_domain_console_init(); 623 607 if (r < 0) ··· 663 647 } 664 648 device_initcall(xen_hvc_init); 665 649 666 - static int xen_cons_init(void) 650 + static int __init xen_cons_init(void) 667 651 { 668 652 const struct hv_ops *ops; 653 + 654 + xen_console_io = opt_console_io >= 0 ? opt_console_io : 655 + xen_initial_domain(); 669 656 670 657 if (!xen_domain()) 671 658 return 0; 672 659 673 - if (xen_initial_domain()) 660 + if (xen_console_io) 674 661 ops = &dom0_hvc_ops; 675 662 else { 676 663 int r;
+22 -4
drivers/xen/balloon.c
··· 724 724 static int __init balloon_init(void) 725 725 { 726 726 struct task_struct *task; 727 + long current_pages = 0; 728 + domid_t domid = DOMID_SELF; 727 729 int rc; 728 730 729 731 if (!xen_domain()) ··· 733 731 734 732 pr_info("Initialising balloon driver\n"); 735 733 736 - if (xen_released_pages >= get_num_physpages()) { 737 - WARN(1, "Released pages underflow current target"); 738 - return -ERANGE; 734 + if (xen_initial_domain()) 735 + current_pages = HYPERVISOR_memory_op(XENMEM_current_reservation, 736 + &domid); 737 + if (current_pages <= 0) { 738 + if (xen_pv_domain()) { 739 + if (xen_released_pages >= xen_start_info->nr_pages) 740 + goto underflow; 741 + current_pages = min(xen_start_info->nr_pages - 742 + xen_released_pages, max_pfn); 743 + } else { 744 + if (xen_unpopulated_pages >= get_num_physpages()) 745 + goto underflow; 746 + current_pages = get_num_physpages() - 747 + xen_unpopulated_pages; 748 + } 739 749 } 740 750 741 - balloon_stats.current_pages = get_num_physpages() - xen_released_pages; 751 + balloon_stats.current_pages = current_pages; 742 752 balloon_stats.target_pages = balloon_stats.current_pages; 743 753 balloon_stats.balloon_low = 0; 744 754 balloon_stats.balloon_high = 0; ··· 781 767 xen_balloon_init(); 782 768 783 769 return 0; 770 + 771 + underflow: 772 + WARN(1, "Released pages underflow current target"); 773 + return -ERANGE; 784 774 } 785 775 subsys_initcall(balloon_init); 786 776
+3 -3
drivers/xen/events/events_base.c
··· 581 581 eoi_list); 582 582 if (!elem || info->eoi_time < elem->eoi_time) { 583 583 list_add(&info->eoi_list, &eoi->eoi_list); 584 - mod_delayed_work_on(info->eoi_cpu, system_wq, 584 + mod_delayed_work_on(info->eoi_cpu, system_percpu_wq, 585 585 &eoi->delayed, delay); 586 586 } else { 587 587 list_for_each_entry_reverse(elem, &eoi->eoi_list, eoi_list) { ··· 666 666 break; 667 667 668 668 if (now < info->eoi_time) { 669 - mod_delayed_work_on(info->eoi_cpu, system_wq, 669 + mod_delayed_work_on(info->eoi_cpu, system_percpu_wq, 670 670 &eoi->delayed, 671 671 info->eoi_time - now); 672 672 break; ··· 782 782 783 783 WARN_ON(info->refcnt > 0); 784 784 785 - queue_rcu_work(system_wq, &info->rwork); 785 + queue_rcu_work(system_percpu_wq, &info->rwork); 786 786 } 787 787 788 788 /* Not called for lateeoi events. */
+2 -1
drivers/xen/grant-dma-ops.c
··· 366 366 if (np) { 367 367 ret = xen_dt_grant_init_backend_domid(dev, np, backend_domid); 368 368 of_node_put(np); 369 - } else if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain()) { 369 + } else if (!xen_initial_domain() && 370 + (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain())) { 370 371 dev_info(dev, "Using dom0 as backend\n"); 371 372 *backend_domid = 0; 372 373 ret = 0;
+1 -3
drivers/xen/mcelog.c
··· 165 165 case MCE_GETCLEAR_FLAGS: { 166 166 unsigned flags; 167 167 168 - do { 169 - flags = xen_mcelog.flags; 170 - } while (cmpxchg(&xen_mcelog.flags, flags, 0) != flags); 168 + flags = xchg(&xen_mcelog.flags, 0); 171 169 172 170 return put_user(flags, p); 173 171 }
+2 -1
drivers/xen/privcmd.c
··· 1091 1091 1092 1092 static int privcmd_irqfd_init(void) 1093 1093 { 1094 - irqfd_cleanup_wq = alloc_workqueue("privcmd-irqfd-cleanup", 0, 0); 1094 + irqfd_cleanup_wq = alloc_workqueue("privcmd-irqfd-cleanup", WQ_PERCPU, 1095 + 0); 1095 1096 if (!irqfd_cleanup_wq) 1096 1097 return -ENOMEM; 1097 1098
+3
drivers/xen/unpopulated-alloc.c
··· 18 18 19 19 static struct resource *target_resource; 20 20 21 + /* Pages to subtract from the memory count when setting balloon target. */ 22 + unsigned long xen_unpopulated_pages __initdata; 23 + 21 24 /* 22 25 * If arch is not happy with system "iomem_resource" being used for 23 26 * the region allocation it can provide it's own view by creating specific
+3 -3
drivers/xen/xenbus/xenbus.h
··· 120 120 121 121 void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); 122 122 123 - int xenbus_dev_suspend(struct device *dev); 124 - int xenbus_dev_resume(struct device *dev); 125 - int xenbus_dev_cancel(struct device *dev); 123 + int xenbus_dev_freeze(struct device *dev); 124 + int xenbus_dev_restore(struct device *dev); 125 + int xenbus_dev_thaw(struct device *dev); 126 126 127 127 void xenbus_otherend_changed(struct xenbus_watch *watch, 128 128 const char *path, const char *token,
+11 -11
drivers/xen/xenbus/xenbus_probe.c
··· 668 668 } 669 669 EXPORT_SYMBOL_GPL(xenbus_dev_changed); 670 670 671 - int xenbus_dev_suspend(struct device *dev) 671 + int xenbus_dev_freeze(struct device *dev) 672 672 { 673 673 int err = 0; 674 674 struct xenbus_driver *drv; ··· 683 683 if (drv->suspend) 684 684 err = drv->suspend(xdev); 685 685 if (err) 686 - dev_warn(dev, "suspend failed: %i\n", err); 686 + dev_warn(dev, "freeze failed: %i\n", err); 687 687 return 0; 688 688 } 689 - EXPORT_SYMBOL_GPL(xenbus_dev_suspend); 689 + EXPORT_SYMBOL_GPL(xenbus_dev_freeze); 690 690 691 - int xenbus_dev_resume(struct device *dev) 691 + int xenbus_dev_restore(struct device *dev) 692 692 { 693 693 int err; 694 694 struct xenbus_driver *drv; ··· 702 702 drv = to_xenbus_driver(dev->driver); 703 703 err = talk_to_otherend(xdev); 704 704 if (err) { 705 - dev_warn(dev, "resume (talk_to_otherend) failed: %i\n", err); 705 + dev_warn(dev, "restore (talk_to_otherend) failed: %i\n", err); 706 706 return err; 707 707 } 708 708 ··· 711 711 if (drv->resume) { 712 712 err = drv->resume(xdev); 713 713 if (err) { 714 - dev_warn(dev, "resume failed: %i\n", err); 714 + dev_warn(dev, "restore failed: %i\n", err); 715 715 return err; 716 716 } 717 717 } 718 718 719 719 err = watch_otherend(xdev); 720 720 if (err) { 721 - dev_warn(dev, "resume (watch_otherend) failed: %d\n", err); 721 + dev_warn(dev, "restore (watch_otherend) failed: %d\n", err); 722 722 return err; 723 723 } 724 724 725 725 return 0; 726 726 } 727 - EXPORT_SYMBOL_GPL(xenbus_dev_resume); 727 + EXPORT_SYMBOL_GPL(xenbus_dev_restore); 728 728 729 - int xenbus_dev_cancel(struct device *dev) 729 + int xenbus_dev_thaw(struct device *dev) 730 730 { 731 731 /* Do nothing */ 732 - DPRINTK("cancel"); 732 + DPRINTK("thaw"); 733 733 return 0; 734 734 } 735 - EXPORT_SYMBOL_GPL(xenbus_dev_cancel); 735 + EXPORT_SYMBOL_GPL(xenbus_dev_thaw); 736 736 737 737 /* A flag to determine if xenstored is 'ready' (i.e. has started) */ 738 738 int xenstored_ready;
+8 -10
drivers/xen/xenbus/xenbus_probe_frontend.c
··· 91 91 xenbus_otherend_changed(watch, path, token, 1); 92 92 } 93 93 94 - static void xenbus_frontend_delayed_resume(struct work_struct *w) 94 + static void xenbus_frontend_delayed_restore(struct work_struct *w) 95 95 { 96 96 struct xenbus_device *xdev = container_of(w, struct xenbus_device, work); 97 97 98 - xenbus_dev_resume(&xdev->dev); 98 + xenbus_dev_restore(&xdev->dev); 99 99 } 100 100 101 - static int xenbus_frontend_dev_resume(struct device *dev) 101 + static int xenbus_frontend_dev_restore(struct device *dev) 102 102 { 103 103 /* 104 104 * If xenstored is running in this domain, we cannot access the backend ··· 112 112 return 0; 113 113 } 114 114 115 - return xenbus_dev_resume(dev); 115 + return xenbus_dev_restore(dev); 116 116 } 117 117 118 118 static int xenbus_frontend_dev_probe(struct device *dev) 119 119 { 120 120 if (xen_store_domain_type == XS_LOCAL) { 121 121 struct xenbus_device *xdev = to_xenbus_device(dev); 122 - INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); 122 + INIT_WORK(&xdev->work, xenbus_frontend_delayed_restore); 123 123 } 124 124 125 125 return xenbus_dev_probe(dev); ··· 148 148 } 149 149 150 150 static const struct dev_pm_ops xenbus_pm_ops = { 151 - .suspend = xenbus_dev_suspend, 152 - .resume = xenbus_frontend_dev_resume, 153 - .freeze = xenbus_dev_suspend, 154 - .thaw = xenbus_dev_cancel, 155 - .restore = xenbus_dev_resume, 151 + .freeze = xenbus_dev_freeze, 152 + .thaw = xenbus_dev_thaw, 153 + .restore = xenbus_frontend_dev_restore, 156 154 }; 157 155 158 156 static struct xen_bus_type xenbus_frontend = {
+2
include/xen/xen.h
··· 69 69 #endif 70 70 71 71 #ifdef CONFIG_XEN_UNPOPULATED_ALLOC 72 + extern unsigned long xen_unpopulated_pages; 72 73 int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages); 73 74 void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages); 74 75 #include <linux/ioport.h> 75 76 int arch_xen_unpopulated_init(struct resource **res); 76 77 #else 78 + #define xen_unpopulated_pages 0UL 77 79 #include <xen/balloon.h> 78 80 static inline int xen_alloc_unpopulated_pages(unsigned int nr_pages, 79 81 struct page **pages)