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

Pull xen fixes and cleanups from Juergen Gross:

- a fix in the Xen balloon driver avoiding hitting a BUG_ON() in some
cases, plus a follow-on cleanup series for that driver

- a patch for introducing non-blocking EFI callbacks in Xen's EFI
driver, plu a cleanup patch for Xen EFI handling merging the x86 and
ARM arch specific initialization into the Xen EFI driver

- a fix of the Xen xenbus driver avoiding a self-deadlock when cleaning
up after a user process has died

- a fix for Xen on ARM after removal of ZONE_DMA

- a cleanup patch for avoiding build warnings for Xen on ARM

* tag 'for-linus-5.4-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/xenbus: fix self-deadlock after killing user process
xen/efi: have a common runtime setup function
arm: xen: mm: use __GPF_DMA32 for arm64
xen/balloon: Clear PG_offline in balloon_retrieve()
xen/balloon: Mark pages PG_offline in balloon_append()
xen/balloon: Drop __balloon_append()
xen/balloon: Set pages PageOffline() in balloon_add_region()
ARM: xen: unexport HYPERVISOR_platform_op function
xen/efi: Set nonblocking callbacks

+79 -139
-6
arch/arm/include/asm/xen/xen-ops.h
··· 1 - #ifndef _ASM_XEN_OPS_H 2 - #define _ASM_XEN_OPS_H 3 - 4 - void xen_efi_runtime_setup(void); 5 - 6 - #endif /* _ASM_XEN_OPS_H */
-1
arch/arm/xen/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o 3 - obj-$(CONFIG_XEN_EFI) += efi.o
-28
arch/arm/xen/efi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Copyright (c) 2015, Linaro Limited, Shannon Zhao 4 - */ 5 - 6 - #include <linux/efi.h> 7 - #include <xen/xen-ops.h> 8 - #include <asm/xen/xen-ops.h> 9 - 10 - /* Set XEN EFI runtime services function pointers. Other fields of struct efi, 11 - * e.g. efi.systab, will be set like normal EFI. 12 - */ 13 - void __init xen_efi_runtime_setup(void) 14 - { 15 - efi.get_time = xen_efi_get_time; 16 - efi.set_time = xen_efi_set_time; 17 - efi.get_wakeup_time = xen_efi_get_wakeup_time; 18 - efi.set_wakeup_time = xen_efi_set_wakeup_time; 19 - efi.get_variable = xen_efi_get_variable; 20 - efi.get_next_variable = xen_efi_get_next_variable; 21 - efi.set_variable = xen_efi_set_variable; 22 - efi.query_variable_info = xen_efi_query_variable_info; 23 - efi.update_capsule = xen_efi_update_capsule; 24 - efi.query_capsule_caps = xen_efi_query_capsule_caps; 25 - efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; 26 - efi.reset_system = xen_efi_reset_system; 27 - } 28 - EXPORT_SYMBOL_GPL(xen_efi_runtime_setup);
+1 -2
arch/arm/xen/enlighten.c
··· 15 15 #include <xen/xen-ops.h> 16 16 #include <asm/xen/hypervisor.h> 17 17 #include <asm/xen/hypercall.h> 18 - #include <asm/xen/xen-ops.h> 19 18 #include <asm/system_misc.h> 20 19 #include <asm/efi.h> 21 20 #include <linux/interrupt.h> ··· 436 437 EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); 437 438 EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op); 438 439 EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op); 439 - EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op); 440 + EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw); 440 441 EXPORT_SYMBOL_GPL(HYPERVISOR_multicall); 441 442 EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist); 442 443 EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op);
+4 -1
arch/arm/xen/mm.c
··· 28 28 29 29 for_each_memblock(memory, reg) { 30 30 if (reg->base < (phys_addr_t)0xffffffff) { 31 - flags |= __GFP_DMA; 31 + if (IS_ENABLED(CONFIG_ZONE_DMA32)) 32 + flags |= __GFP_DMA32; 33 + else 34 + flags |= __GFP_DMA; 32 35 break; 33 36 } 34 37 }
-7
arch/arm64/include/asm/xen/xen-ops.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_XEN_OPS_H 3 - #define _ASM_XEN_OPS_H 4 - 5 - void xen_efi_runtime_setup(void); 6 - 7 - #endif /* _ASM_XEN_OPS_H */
-1
arch/arm64/xen/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) 3 3 obj-y := xen-arm.o hypercall.o 4 - obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)
+1 -13
arch/x86/xen/efi.c
··· 57 57 return NULL; 58 58 59 59 /* Here we know that Xen runs on EFI platform. */ 60 - 61 - efi.get_time = xen_efi_get_time; 62 - efi.set_time = xen_efi_set_time; 63 - efi.get_wakeup_time = xen_efi_get_wakeup_time; 64 - efi.set_wakeup_time = xen_efi_set_wakeup_time; 65 - efi.get_variable = xen_efi_get_variable; 66 - efi.get_next_variable = xen_efi_get_next_variable; 67 - efi.set_variable = xen_efi_set_variable; 68 - efi.query_variable_info = xen_efi_query_variable_info; 69 - efi.update_capsule = xen_efi_update_capsule; 70 - efi.query_capsule_caps = xen_efi_query_capsule_caps; 71 - efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; 72 - efi.reset_system = xen_efi_reset_system; 60 + xen_efi_runtime_setup(); 73 61 74 62 efi_systab_xen.tables = info->cfg.addr; 75 63 efi_systab_xen.nr_tables = info->cfg.nent;
+7 -17
drivers/xen/balloon.c
··· 156 156 (GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC) 157 157 158 158 /* balloon_append: add the given page to the balloon. */ 159 - static void __balloon_append(struct page *page) 159 + static void balloon_append(struct page *page) 160 160 { 161 + __SetPageOffline(page); 162 + 161 163 /* Lowmem is re-populated first, so highmem pages go at list tail. */ 162 164 if (PageHighMem(page)) { 163 165 list_add_tail(&page->lru, &ballooned_pages); ··· 169 167 balloon_stats.balloon_low++; 170 168 } 171 169 wake_up(&balloon_wq); 172 - } 173 - 174 - static void balloon_append(struct page *page) 175 - { 176 - __balloon_append(page); 177 170 } 178 171 179 172 /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ ··· 189 192 else 190 193 balloon_stats.balloon_low--; 191 194 195 + __ClearPageOffline(page); 192 196 return page; 193 197 } 194 198 ··· 375 377 for (i = 0; i < size; i++) { 376 378 p = pfn_to_page(start_pfn + i); 377 379 __online_page_set_limits(p); 378 - __SetPageOffline(p); 379 - __balloon_append(p); 380 + balloon_append(p); 380 381 } 381 382 mutex_unlock(&balloon_mutex); 382 383 } ··· 441 444 xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]); 442 445 443 446 /* Relinquish the page back to the allocator. */ 444 - __ClearPageOffline(page); 445 447 free_reserved_page(page); 446 448 } 447 449 ··· 467 471 state = BP_EAGAIN; 468 472 break; 469 473 } 470 - __SetPageOffline(page); 471 474 adjust_managed_page_count(page, -1); 472 475 xenmem_reservation_scrub_page(page); 473 476 list_add(&page->lru, &pages); ··· 606 611 while (pgno < nr_pages) { 607 612 page = balloon_retrieve(true); 608 613 if (page) { 609 - __ClearPageOffline(page); 610 614 pages[pgno++] = page; 611 615 #ifdef CONFIG_XEN_HAVE_PVMMU 612 616 /* ··· 647 653 mutex_lock(&balloon_mutex); 648 654 649 655 for (i = 0; i < nr_pages; i++) { 650 - if (pages[i]) { 651 - __SetPageOffline(pages[i]); 656 + if (pages[i]) 652 657 balloon_append(pages[i]); 653 - } 654 658 } 655 659 656 660 balloon_stats.target_unpopulated -= nr_pages; ··· 666 674 unsigned long pages) 667 675 { 668 676 unsigned long pfn, extra_pfn_end; 669 - struct page *page; 670 677 671 678 /* 672 679 * If the amount of usable memory has been limited (e.g., with ··· 675 684 extra_pfn_end = min(max_pfn, start_pfn + pages); 676 685 677 686 for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) { 678 - page = pfn_to_page(pfn); 679 687 /* totalram_pages and totalhigh_pages do not 680 688 include the boot-time balloon extension, so 681 689 don't subtract from it. */ 682 - __balloon_append(page); 690 + balloon_append(pfn_to_page(pfn)); 683 691 } 684 692 685 693 balloon_stats.total_pages += extra_pfn_end - start_pfn;
+47 -37
drivers/xen/efi.c
··· 40 40 41 41 #define efi_data(op) (op.u.efi_runtime_call) 42 42 43 - efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 43 + static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 44 44 { 45 45 struct xen_platform_op op = INIT_EFI_OP(get_time); 46 46 ··· 61 61 62 62 return efi_data(op).status; 63 63 } 64 - EXPORT_SYMBOL_GPL(xen_efi_get_time); 65 64 66 - efi_status_t xen_efi_set_time(efi_time_t *tm) 65 + static efi_status_t xen_efi_set_time(efi_time_t *tm) 67 66 { 68 67 struct xen_platform_op op = INIT_EFI_OP(set_time); 69 68 ··· 74 75 75 76 return efi_data(op).status; 76 77 } 77 - EXPORT_SYMBOL_GPL(xen_efi_set_time); 78 78 79 - efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, 80 - efi_time_t *tm) 79 + static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, 80 + efi_bool_t *pending, 81 + efi_time_t *tm) 81 82 { 82 83 struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); 83 84 ··· 97 98 98 99 return efi_data(op).status; 99 100 } 100 - EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time); 101 101 102 - efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) 102 + static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) 103 103 { 104 104 struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); 105 105 ··· 115 117 116 118 return efi_data(op).status; 117 119 } 118 - EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time); 119 120 120 - efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, 121 - u32 *attr, unsigned long *data_size, 122 - void *data) 121 + static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, 122 + u32 *attr, unsigned long *data_size, 123 + void *data) 123 124 { 124 125 struct xen_platform_op op = INIT_EFI_OP(get_variable); 125 126 ··· 138 141 139 142 return efi_data(op).status; 140 143 } 141 - EXPORT_SYMBOL_GPL(xen_efi_get_variable); 142 144 143 - efi_status_t xen_efi_get_next_variable(unsigned long *name_size, 144 - efi_char16_t *name, 145 - efi_guid_t *vendor) 145 + static efi_status_t xen_efi_get_next_variable(unsigned long *name_size, 146 + efi_char16_t *name, 147 + efi_guid_t *vendor) 146 148 { 147 149 struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name); 148 150 ··· 161 165 162 166 return efi_data(op).status; 163 167 } 164 - EXPORT_SYMBOL_GPL(xen_efi_get_next_variable); 165 168 166 - efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, 167 - u32 attr, unsigned long data_size, 168 - void *data) 169 + static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, 170 + u32 attr, unsigned long data_size, 171 + void *data) 169 172 { 170 173 struct xen_platform_op op = INIT_EFI_OP(set_variable); 171 174 ··· 181 186 182 187 return efi_data(op).status; 183 188 } 184 - EXPORT_SYMBOL_GPL(xen_efi_set_variable); 185 189 186 - efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, 187 - u64 *remaining_space, 188 - u64 *max_variable_size) 190 + static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, 191 + u64 *remaining_space, 192 + u64 *max_variable_size) 189 193 { 190 194 struct xen_platform_op op = INIT_EFI_OP(query_variable_info); 191 195 ··· 202 208 203 209 return efi_data(op).status; 204 210 } 205 - EXPORT_SYMBOL_GPL(xen_efi_query_variable_info); 206 211 207 - efi_status_t xen_efi_get_next_high_mono_count(u32 *count) 212 + static efi_status_t xen_efi_get_next_high_mono_count(u32 *count) 208 213 { 209 214 struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); 210 215 ··· 214 221 215 222 return efi_data(op).status; 216 223 } 217 - EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count); 218 224 219 - efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, 220 - unsigned long count, unsigned long sg_list) 225 + static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, 226 + unsigned long count, unsigned long sg_list) 221 227 { 222 228 struct xen_platform_op op = INIT_EFI_OP(update_capsule); 223 229 ··· 233 241 234 242 return efi_data(op).status; 235 243 } 236 - EXPORT_SYMBOL_GPL(xen_efi_update_capsule); 237 244 238 - efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, 239 - unsigned long count, u64 *max_size, 240 - int *reset_type) 245 + static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, 246 + unsigned long count, u64 *max_size, int *reset_type) 241 247 { 242 248 struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); 243 249 ··· 254 264 255 265 return efi_data(op).status; 256 266 } 257 - EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps); 258 267 259 - void xen_efi_reset_system(int reset_type, efi_status_t status, 260 - unsigned long data_size, efi_char16_t *data) 268 + static void xen_efi_reset_system(int reset_type, efi_status_t status, 269 + unsigned long data_size, efi_char16_t *data) 261 270 { 262 271 switch (reset_type) { 263 272 case EFI_RESET_COLD: ··· 270 281 BUG(); 271 282 } 272 283 } 273 - EXPORT_SYMBOL_GPL(xen_efi_reset_system); 284 + 285 + /* 286 + * Set XEN EFI runtime services function pointers. Other fields of struct efi, 287 + * e.g. efi.systab, will be set like normal EFI. 288 + */ 289 + void __init xen_efi_runtime_setup(void) 290 + { 291 + efi.get_time = xen_efi_get_time; 292 + efi.set_time = xen_efi_set_time; 293 + efi.get_wakeup_time = xen_efi_get_wakeup_time; 294 + efi.set_wakeup_time = xen_efi_set_wakeup_time; 295 + efi.get_variable = xen_efi_get_variable; 296 + efi.get_next_variable = xen_efi_get_next_variable; 297 + efi.set_variable = xen_efi_set_variable; 298 + efi.set_variable_nonblocking = xen_efi_set_variable; 299 + efi.query_variable_info = xen_efi_query_variable_info; 300 + efi.query_variable_info_nonblocking = xen_efi_query_variable_info; 301 + efi.update_capsule = xen_efi_update_capsule; 302 + efi.query_capsule_caps = xen_efi_query_capsule_caps; 303 + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; 304 + efi.reset_system = xen_efi_reset_system; 305 + }
+18 -2
drivers/xen/xenbus/xenbus_dev_frontend.c
··· 55 55 #include <linux/string.h> 56 56 #include <linux/slab.h> 57 57 #include <linux/miscdevice.h> 58 + #include <linux/workqueue.h> 58 59 59 60 #include <xen/xenbus.h> 60 61 #include <xen/xen.h> ··· 117 116 wait_queue_head_t read_waitq; 118 117 119 118 struct kref kref; 119 + 120 + struct work_struct wq; 120 121 }; 121 122 122 123 /* Read out any raw xenbus messages queued up. */ ··· 303 300 mutex_unlock(&adap->dev_data->reply_mutex); 304 301 } 305 302 306 - static void xenbus_file_free(struct kref *kref) 303 + static void xenbus_worker(struct work_struct *wq) 307 304 { 308 305 struct xenbus_file_priv *u; 309 306 struct xenbus_transaction_holder *trans, *tmp; 310 307 struct watch_adapter *watch, *tmp_watch; 311 308 struct read_buffer *rb, *tmp_rb; 312 309 313 - u = container_of(kref, struct xenbus_file_priv, kref); 310 + u = container_of(wq, struct xenbus_file_priv, wq); 314 311 315 312 /* 316 313 * No need for locking here because there are no other users, ··· 334 331 kfree(rb); 335 332 } 336 333 kfree(u); 334 + } 335 + 336 + static void xenbus_file_free(struct kref *kref) 337 + { 338 + struct xenbus_file_priv *u; 339 + 340 + /* 341 + * We might be called in xenbus_thread(). 342 + * Use workqueue to avoid deadlock. 343 + */ 344 + u = container_of(kref, struct xenbus_file_priv, kref); 345 + schedule_work(&u->wq); 337 346 } 338 347 339 348 static struct xenbus_transaction_holder *xenbus_get_transaction( ··· 665 650 INIT_LIST_HEAD(&u->watches); 666 651 INIT_LIST_HEAD(&u->read_buffers); 667 652 init_waitqueue_head(&u->read_waitq); 653 + INIT_WORK(&u->wq, xenbus_worker); 668 654 669 655 mutex_init(&u->reply_mutex); 670 656 mutex_init(&u->msgbuffer_mutex);
+1 -24
include/xen/xen-ops.h
··· 212 212 213 213 bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); 214 214 215 - efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); 216 - efi_status_t xen_efi_set_time(efi_time_t *tm); 217 - efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, 218 - efi_time_t *tm); 219 - efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm); 220 - efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, 221 - u32 *attr, unsigned long *data_size, 222 - void *data); 223 - efi_status_t xen_efi_get_next_variable(unsigned long *name_size, 224 - efi_char16_t *name, efi_guid_t *vendor); 225 - efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, 226 - u32 attr, unsigned long data_size, 227 - void *data); 228 - efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, 229 - u64 *remaining_space, 230 - u64 *max_variable_size); 231 - efi_status_t xen_efi_get_next_high_mono_count(u32 *count); 232 - efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, 233 - unsigned long count, unsigned long sg_list); 234 - efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, 235 - unsigned long count, u64 *max_size, 236 - int *reset_type); 237 - void xen_efi_reset_system(int reset_type, efi_status_t status, 238 - unsigned long data_size, efi_char16_t *data); 215 + void xen_efi_runtime_setup(void); 239 216 240 217 241 218 #ifdef CONFIG_PREEMPT