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.20a-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

- A revert of a previous commit as it is no longer necessary and has
shown to cause problems in some memory hotplug cases.

- Some small fixes and a minor cleanup.

- A patch for adding better diagnostic data in a very rare failure
case.

* tag 'for-linus-4.20a-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
pvcalls-front: fixes incorrect error handling
Revert "xen/balloon: Mark unallocated host memory as UNUSABLE"
xen: xlate_mmu: add missing header to fix 'W=1' warning
xen/x86: add diagnostic printout to xen_mc_flush() in case of error
x86/xen: cleanup includes in arch/x86/xen/spinlock.c

+37 -164
-78
arch/x86/xen/enlighten.c
··· 10 10 #include <xen/xen.h> 11 11 #include <xen/features.h> 12 12 #include <xen/page.h> 13 - #include <xen/interface/memory.h> 14 13 15 14 #include <asm/xen/hypercall.h> 16 15 #include <asm/xen/hypervisor.h> ··· 345 346 } 346 347 EXPORT_SYMBOL(xen_arch_unregister_cpu); 347 348 #endif 348 - 349 - #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG 350 - void __init arch_xen_balloon_init(struct resource *hostmem_resource) 351 - { 352 - struct xen_memory_map memmap; 353 - int rc; 354 - unsigned int i, last_guest_ram; 355 - phys_addr_t max_addr = PFN_PHYS(max_pfn); 356 - struct e820_table *xen_e820_table; 357 - const struct e820_entry *entry; 358 - struct resource *res; 359 - 360 - if (!xen_initial_domain()) 361 - return; 362 - 363 - xen_e820_table = kmalloc(sizeof(*xen_e820_table), GFP_KERNEL); 364 - if (!xen_e820_table) 365 - return; 366 - 367 - memmap.nr_entries = ARRAY_SIZE(xen_e820_table->entries); 368 - set_xen_guest_handle(memmap.buffer, xen_e820_table->entries); 369 - rc = HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap); 370 - if (rc) { 371 - pr_warn("%s: Can't read host e820 (%d)\n", __func__, rc); 372 - goto out; 373 - } 374 - 375 - last_guest_ram = 0; 376 - for (i = 0; i < memmap.nr_entries; i++) { 377 - if (xen_e820_table->entries[i].addr >= max_addr) 378 - break; 379 - if (xen_e820_table->entries[i].type == E820_TYPE_RAM) 380 - last_guest_ram = i; 381 - } 382 - 383 - entry = &xen_e820_table->entries[last_guest_ram]; 384 - if (max_addr >= entry->addr + entry->size) 385 - goto out; /* No unallocated host RAM. */ 386 - 387 - hostmem_resource->start = max_addr; 388 - hostmem_resource->end = entry->addr + entry->size; 389 - 390 - /* 391 - * Mark non-RAM regions between the end of dom0 RAM and end of host RAM 392 - * as unavailable. The rest of that region can be used for hotplug-based 393 - * ballooning. 394 - */ 395 - for (; i < memmap.nr_entries; i++) { 396 - entry = &xen_e820_table->entries[i]; 397 - 398 - if (entry->type == E820_TYPE_RAM) 399 - continue; 400 - 401 - if (entry->addr >= hostmem_resource->end) 402 - break; 403 - 404 - res = kzalloc(sizeof(*res), GFP_KERNEL); 405 - if (!res) 406 - goto out; 407 - 408 - res->name = "Unavailable host RAM"; 409 - res->start = entry->addr; 410 - res->end = (entry->addr + entry->size < hostmem_resource->end) ? 411 - entry->addr + entry->size : hostmem_resource->end; 412 - rc = insert_resource(hostmem_resource, res); 413 - if (rc) { 414 - pr_warn("%s: Can't insert [%llx - %llx) (%d)\n", 415 - __func__, res->start, res->end, rc); 416 - kfree(res); 417 - goto out; 418 - } 419 - } 420 - 421 - out: 422 - kfree(xen_e820_table); 423 - } 424 - #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */
+20 -15
arch/x86/xen/multicalls.c
··· 69 69 70 70 trace_xen_mc_flush(b->mcidx, b->argidx, b->cbidx); 71 71 72 + #if MC_DEBUG 73 + memcpy(b->debug, b->entries, 74 + b->mcidx * sizeof(struct multicall_entry)); 75 + #endif 76 + 72 77 switch (b->mcidx) { 73 78 case 0: 74 79 /* no-op */ ··· 92 87 break; 93 88 94 89 default: 95 - #if MC_DEBUG 96 - memcpy(b->debug, b->entries, 97 - b->mcidx * sizeof(struct multicall_entry)); 98 - #endif 99 - 100 90 if (HYPERVISOR_multicall(b->entries, b->mcidx) != 0) 101 91 BUG(); 102 92 for (i = 0; i < b->mcidx; i++) 103 93 if (b->entries[i].result < 0) 104 94 ret++; 95 + } 105 96 97 + if (WARN_ON(ret)) { 98 + pr_err("%d of %d multicall(s) failed: cpu %d\n", 99 + ret, b->mcidx, smp_processor_id()); 100 + for (i = 0; i < b->mcidx; i++) { 101 + if (b->entries[i].result < 0) { 106 102 #if MC_DEBUG 107 - if (ret) { 108 - printk(KERN_ERR "%d multicall(s) failed: cpu %d\n", 109 - ret, smp_processor_id()); 110 - dump_stack(); 111 - for (i = 0; i < b->mcidx; i++) { 112 - printk(KERN_DEBUG " call %2d/%d: op=%lu arg=[%lx] result=%ld\t%pF\n", 113 - i+1, b->mcidx, 103 + pr_err(" call %2d: op=%lu arg=[%lx] result=%ld\t%pF\n", 104 + i + 1, 114 105 b->debug[i].op, 115 106 b->debug[i].args[0], 116 107 b->entries[i].result, 117 108 b->caller[i]); 109 + #else 110 + pr_err(" call %2d: op=%lu arg=[%lx] result=%ld\n", 111 + i + 1, 112 + b->entries[i].op, 113 + b->entries[i].args[0], 114 + b->entries[i].result); 115 + #endif 118 116 } 119 117 } 120 - #endif 121 118 } 122 119 123 120 b->mcidx = 0; ··· 133 126 b->cbidx = 0; 134 127 135 128 local_irq_restore(flags); 136 - 137 - WARN_ON(ret); 138 129 } 139 130 140 131 struct multicall_space __xen_mc_entry(size_t args)
+4 -2
arch/x86/xen/setup.c
··· 808 808 addr = xen_e820_table.entries[0].addr; 809 809 size = xen_e820_table.entries[0].size; 810 810 while (i < xen_e820_table.nr_entries) { 811 + bool discard = false; 811 812 812 813 chunk_size = size; 813 814 type = xen_e820_table.entries[i].type; ··· 824 823 xen_add_extra_mem(pfn_s, n_pfns); 825 824 xen_max_p2m_pfn = pfn_s + n_pfns; 826 825 } else 827 - type = E820_TYPE_UNUSABLE; 826 + discard = true; 828 827 } 829 828 830 - xen_align_and_add_e820_region(addr, chunk_size, type); 829 + if (!discard) 830 + xen_align_and_add_e820_region(addr, chunk_size, type); 831 831 832 832 addr += chunk_size; 833 833 size -= chunk_size;
+1 -6
arch/x86/xen/spinlock.c
··· 3 3 * Split spinlock implementation out into its own file, so it can be 4 4 * compiled in a FTRACE-compatible way. 5 5 */ 6 - #include <linux/kernel_stat.h> 6 + #include <linux/kernel.h> 7 7 #include <linux/spinlock.h> 8 - #include <linux/debugfs.h> 9 - #include <linux/log2.h> 10 - #include <linux/gfp.h> 11 8 #include <linux/slab.h> 12 9 #include <linux/atomic.h> 13 10 14 11 #include <asm/paravirt.h> 15 12 #include <asm/qspinlock.h> 16 13 17 - #include <xen/interface/xen.h> 18 14 #include <xen/events.h> 19 15 20 16 #include "xen-ops.h" 21 - #include "debugfs.h" 22 17 23 18 static DEFINE_PER_CPU(int, lock_kicker_irq) = -1; 24 19 static DEFINE_PER_CPU(char *, irq_name);
+9 -56
drivers/xen/balloon.c
··· 251 251 kfree(resource); 252 252 } 253 253 254 - /* 255 - * Host memory not allocated to dom0. We can use this range for hotplug-based 256 - * ballooning. 257 - * 258 - * It's a type-less resource. Setting IORESOURCE_MEM will make resource 259 - * management algorithms (arch_remove_reservations()) look into guest e820, 260 - * which we don't want. 261 - */ 262 - static struct resource hostmem_resource = { 263 - .name = "Host RAM", 264 - }; 265 - 266 - void __attribute__((weak)) __init arch_xen_balloon_init(struct resource *res) 267 - {} 268 - 269 254 static struct resource *additional_memory_resource(phys_addr_t size) 270 255 { 271 - struct resource *res, *res_hostmem; 272 - int ret = -ENOMEM; 256 + struct resource *res; 257 + int ret; 273 258 274 259 res = kzalloc(sizeof(*res), GFP_KERNEL); 275 260 if (!res) ··· 263 278 res->name = "System RAM"; 264 279 res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; 265 280 266 - res_hostmem = kzalloc(sizeof(*res), GFP_KERNEL); 267 - if (res_hostmem) { 268 - /* Try to grab a range from hostmem */ 269 - res_hostmem->name = "Host memory"; 270 - ret = allocate_resource(&hostmem_resource, res_hostmem, 271 - size, 0, -1, 272 - PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); 273 - } 274 - 275 - if (!ret) { 276 - /* 277 - * Insert this resource into iomem. Because hostmem_resource 278 - * tracks portion of guest e820 marked as UNUSABLE noone else 279 - * should try to use it. 280 - */ 281 - res->start = res_hostmem->start; 282 - res->end = res_hostmem->end; 283 - ret = insert_resource(&iomem_resource, res); 284 - if (ret < 0) { 285 - pr_err("Can't insert iomem_resource [%llx - %llx]\n", 286 - res->start, res->end); 287 - release_memory_resource(res_hostmem); 288 - res_hostmem = NULL; 289 - res->start = res->end = 0; 290 - } 291 - } 292 - 293 - if (ret) { 294 - ret = allocate_resource(&iomem_resource, res, 295 - size, 0, -1, 296 - PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); 297 - if (ret < 0) { 298 - pr_err("Cannot allocate new System RAM resource\n"); 299 - kfree(res); 300 - return NULL; 301 - } 281 + ret = allocate_resource(&iomem_resource, res, 282 + size, 0, -1, 283 + PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); 284 + if (ret < 0) { 285 + pr_err("Cannot allocate new System RAM resource\n"); 286 + kfree(res); 287 + return NULL; 302 288 } 303 289 304 290 #ifdef CONFIG_SPARSEMEM ··· 281 325 pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n", 282 326 pfn, limit); 283 327 release_memory_resource(res); 284 - release_memory_resource(res_hostmem); 285 328 return NULL; 286 329 } 287 330 } ··· 705 750 set_online_page_callback(&xen_online_page); 706 751 register_memory_notifier(&xen_memory_nb); 707 752 register_sysctl_table(xen_root); 708 - 709 - arch_xen_balloon_init(&hostmem_resource); 710 753 #endif 711 754 712 755 #ifdef CONFIG_XEN_PV
+2 -2
drivers/xen/pvcalls-front.c
··· 385 385 out_error: 386 386 if (*evtchn >= 0) 387 387 xenbus_free_evtchn(pvcalls_front_dev, *evtchn); 388 - kfree(map->active.data.in); 389 - kfree(map->active.ring); 388 + free_pages((unsigned long)map->active.data.in, PVCALLS_RING_ORDER); 389 + free_page((unsigned long)map->active.ring); 390 390 return ret; 391 391 } 392 392
+1
drivers/xen/xlate_mmu.c
··· 36 36 #include <asm/xen/hypervisor.h> 37 37 38 38 #include <xen/xen.h> 39 + #include <xen/xen-ops.h> 39 40 #include <xen/page.h> 40 41 #include <xen/interface/xen.h> 41 42 #include <xen/interface/memory.h>
-5
include/xen/balloon.h
··· 44 44 { 45 45 } 46 46 #endif 47 - 48 - #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG 49 - struct resource; 50 - void arch_xen_balloon_init(struct resource *hostmem_resource); 51 - #endif