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-4.19c-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
"This contains some minor cleanups and fixes:

- a new knob for controlling scrubbing of pages returned by the Xen
balloon driver to the Xen hypervisor to address a boot performance
issue seen in large guests booted pre-ballooned

- a fix of a regression in the gntdev driver which made it impossible
to use fully virtualized guests (HVM guests) with a 4.19 based dom0

- a fix in Xen cpu hotplug functionality which could be triggered by
wrong admin commands (setting number of active vcpus to 0)

One further note: the patches have all been under test for several
days in another branch. This branch has been rebased in order to avoid
merge conflicts"

* tag 'for-linus-4.19c-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/gntdev: fix up blockable calls to mn_invl_range_start
xen: fix GCC warning and remove duplicate EVTCHN_ROW/EVTCHN_COL usage
xen: avoid crash in disable_hotplug_cpu
xen/balloon: add runtime control for scrubbing ballooned out pages
xen/manage: don't complain about an empty value in control/sysrq node

+61 -27
+9
Documentation/ABI/stable/sysfs-devices-system-xen_memory
··· 75 75 Description: 76 76 Amount (in KiB) of low (or normal) memory in the 77 77 balloon. 78 + 79 + What: /sys/devices/system/xen_memory/xen_memory0/scrub_pages 80 + Date: September 2018 81 + KernelVersion: 4.20 82 + Contact: xen-devel@lists.xenproject.org 83 + Description: 84 + Control scrubbing pages before returning them to Xen for others domains 85 + use. Can be set with xen_scrub_pages cmdline 86 + parameter. Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT.
+6
Documentation/admin-guide/kernel-parameters.txt
··· 5000 5000 Disables the PV optimizations forcing the HVM guest to 5001 5001 run as generic HVM guest with no PV drivers. 5002 5002 5003 + xen_scrub_pages= [XEN] 5004 + Boolean option to control scrubbing pages before giving them back 5005 + to Xen, for use by other domains. Can be also changed at runtime 5006 + with /sys/devices/system/xen_memory/xen_memory0/scrub_pages. 5007 + Default value controlled with CONFIG_XEN_SCRUB_PAGES_DEFAULT. 5008 + 5003 5009 xirc2ps_cs= [NET,PCMCIA] 5004 5010 Format: 5005 5011 <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
+7 -3
drivers/xen/Kconfig
··· 79 79 This value is used to allocate enough space in internal 80 80 tables needed for physical memory administration. 81 81 82 - config XEN_SCRUB_PAGES 83 - bool "Scrub pages before returning them to system" 82 + config XEN_SCRUB_PAGES_DEFAULT 83 + bool "Scrub pages before returning them to system by default" 84 84 depends on XEN_BALLOON 85 85 default y 86 86 help 87 87 Scrub pages before returning them to the system for reuse by 88 88 other domains. This makes sure that any confidential data 89 89 is not accidentally visible to other domains. Is it more 90 - secure, but slightly less efficient. 90 + secure, but slightly less efficient. This can be controlled with 91 + xen_scrub_pages=0 parameter and 92 + /sys/devices/system/xen_memory/xen_memory0/scrub_pages. 93 + This option only sets the default value. 94 + 91 95 If in doubt, say yes. 92 96 93 97 config XEN_DEV_EVTCHN
+8 -7
drivers/xen/cpu_hotplug.c
··· 19 19 20 20 static void disable_hotplug_cpu(int cpu) 21 21 { 22 - if (cpu_online(cpu)) { 23 - lock_device_hotplug(); 22 + if (!cpu_is_hotpluggable(cpu)) 23 + return; 24 + lock_device_hotplug(); 25 + if (cpu_online(cpu)) 24 26 device_offline(get_cpu_device(cpu)); 25 - unlock_device_hotplug(); 26 - } 27 - if (cpu_present(cpu)) 27 + if (!cpu_online(cpu) && cpu_present(cpu)) { 28 28 xen_arch_unregister_cpu(cpu); 29 - 30 - set_cpu_present(cpu, false); 29 + set_cpu_present(cpu, false); 30 + } 31 + unlock_device_hotplug(); 31 32 } 32 33 33 34 static int vcpu_online(unsigned int cpu)
+1 -1
drivers/xen/events/events_base.c
··· 138 138 clear_evtchn_to_irq_row(row); 139 139 } 140 140 141 - evtchn_to_irq[EVTCHN_ROW(evtchn)][EVTCHN_COL(evtchn)] = irq; 141 + evtchn_to_irq[row][col] = irq; 142 142 return 0; 143 143 } 144 144
+15 -11
drivers/xen/gntdev.c
··· 492 492 return true; 493 493 } 494 494 495 - static void unmap_if_in_range(struct gntdev_grant_map *map, 496 - unsigned long start, unsigned long end) 495 + static int unmap_if_in_range(struct gntdev_grant_map *map, 496 + unsigned long start, unsigned long end, 497 + bool blockable) 497 498 { 498 499 unsigned long mstart, mend; 499 500 int err; 501 + 502 + if (!in_range(map, start, end)) 503 + return 0; 504 + 505 + if (!blockable) 506 + return -EAGAIN; 500 507 501 508 mstart = max(start, map->vma->vm_start); 502 509 mend = min(end, map->vma->vm_end); ··· 515 508 (mstart - map->vma->vm_start) >> PAGE_SHIFT, 516 509 (mend - mstart) >> PAGE_SHIFT); 517 510 WARN_ON(err); 511 + 512 + return 0; 518 513 } 519 514 520 515 static int mn_invl_range_start(struct mmu_notifier *mn, ··· 528 519 struct gntdev_grant_map *map; 529 520 int ret = 0; 530 521 531 - /* TODO do we really need a mutex here? */ 532 522 if (blockable) 533 523 mutex_lock(&priv->lock); 534 524 else if (!mutex_trylock(&priv->lock)) 535 525 return -EAGAIN; 536 526 537 527 list_for_each_entry(map, &priv->maps, next) { 538 - if (in_range(map, start, end)) { 539 - ret = -EAGAIN; 528 + ret = unmap_if_in_range(map, start, end, blockable); 529 + if (ret) 540 530 goto out_unlock; 541 - } 542 - unmap_if_in_range(map, start, end); 543 531 } 544 532 list_for_each_entry(map, &priv->freeable_maps, next) { 545 - if (in_range(map, start, end)) { 546 - ret = -EAGAIN; 533 + ret = unmap_if_in_range(map, start, end, blockable); 534 + if (ret) 547 535 goto out_unlock; 548 - } 549 - unmap_if_in_range(map, start, end); 550 536 } 551 537 552 538 out_unlock:
+4 -2
drivers/xen/manage.c
··· 280 280 /* 281 281 * The Xenstore watch fires directly after registering it and 282 282 * after a suspend/resume cycle. So ENOENT is no error but 283 - * might happen in those cases. 283 + * might happen in those cases. ERANGE is observed when we get 284 + * an empty value (''), this happens when we acknowledge the 285 + * request by writing '\0' below. 284 286 */ 285 - if (err != -ENOENT) 287 + if (err != -ENOENT && err != -ERANGE) 286 288 pr_err("Error %d reading sysrq code in control/sysrq\n", 287 289 err); 288 290 xenbus_transaction_end(xbt, 1);
+4
drivers/xen/mem-reservation.c
··· 14 14 15 15 #include <xen/interface/memory.h> 16 16 #include <xen/mem-reservation.h> 17 + #include <linux/moduleparam.h> 18 + 19 + bool __read_mostly xen_scrub_pages = IS_ENABLED(CONFIG_XEN_SCRUB_PAGES_DEFAULT); 20 + core_param(xen_scrub_pages, xen_scrub_pages, bool, 0); 17 21 18 22 /* 19 23 * Use one extent per PAGE_SIZE to avoid to break down the page into
+3
drivers/xen/xen-balloon.c
··· 44 44 #include <xen/xenbus.h> 45 45 #include <xen/features.h> 46 46 #include <xen/page.h> 47 + #include <xen/mem-reservation.h> 47 48 48 49 #define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10)) 49 50 ··· 138 137 static DEVICE_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay); 139 138 static DEVICE_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count); 140 139 static DEVICE_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count); 140 + static DEVICE_BOOL_ATTR(scrub_pages, 0644, xen_scrub_pages); 141 141 142 142 static ssize_t show_target_kb(struct device *dev, struct device_attribute *attr, 143 143 char *buf) ··· 205 203 &dev_attr_max_schedule_delay.attr.attr, 206 204 &dev_attr_retry_count.attr.attr, 207 205 &dev_attr_max_retry_count.attr.attr, 206 + &dev_attr_scrub_pages.attr.attr, 208 207 NULL 209 208 }; 210 209
+4 -3
include/xen/mem-reservation.h
··· 17 17 18 18 #include <xen/page.h> 19 19 20 + extern bool xen_scrub_pages; 21 + 20 22 static inline void xenmem_reservation_scrub_page(struct page *page) 21 23 { 22 - #ifdef CONFIG_XEN_SCRUB_PAGES 23 - clear_highpage(page); 24 - #endif 24 + if (xen_scrub_pages) 25 + clear_highpage(page); 25 26 } 26 27 27 28 #ifdef CONFIG_XEN_HAVE_PVMMU