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 'powerpc-5.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
"Two weeks worth of accumulated fixes:

- A fix for a performance regression seen on PowerVM LPARs using
dedicated CPUs, caused by our vcpu_is_preempted() returning true
even for idle CPUs.

- One of the ultravisor support patches broke KVM on big endian hosts
in v5.4.

- Our KUAP (Kernel User Access Prevention) code missed allowing
access in __clear_user(), which could lead to an oops or erroneous
SEGV when triggered via PTRACE_GETREGSET.

- Two fixes for the ocxl driver, an open/remove race, and a memory
leak in an error path.

- A handful of other small fixes.

Thanks to: Andrew Donnellan, Christian Zigotzky, Christophe Leroy,
Christoph Hellwig, Daniel Axtens, David Hildenbrand, Frederic Barrat,
Gautham R. Shenoy, Greg Kurz, Ihor Pasichnyk, Juri Lelli, Marcus
Comstedt, Mike Rapoport, Parth Shah, Srikar Dronamraju, Vaidyanathan
Srinivasan"

* tag 'powerpc-5.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
KVM: PPC: Book3S HV: Fix regression on big endian hosts
powerpc: Fix __clear_user() with KUAP enabled
powerpc/pseries/cmm: fix managed page counts when migrating pages between zones
powerpc/8xx: fix bogus __init on mmu_mapin_ram_chunk()
ocxl: Fix potential memory leak on context creation
powerpc/irq: fix stack overflow verification
powerpc: Ensure that swiotlb buffer is allocated from low memory
powerpc/shared: Use static key to detect shared processor
powerpc/vcpu: Assume dedicated processors as non-preempt
ocxl: Fix concurrent AFU open and device removal

+62 -36
+5 -8
arch/powerpc/include/asm/spinlock.h
··· 36 36 #endif 37 37 38 38 #ifdef CONFIG_PPC_PSERIES 39 + DECLARE_STATIC_KEY_FALSE(shared_processor); 40 + 39 41 #define vcpu_is_preempted vcpu_is_preempted 40 42 static inline bool vcpu_is_preempted(int cpu) 41 43 { 42 - if (!firmware_has_feature(FW_FEATURE_SPLPAR)) 44 + if (!static_branch_unlikely(&shared_processor)) 43 45 return false; 44 46 return !!(be32_to_cpu(lppaca_of(cpu).yield_count) & 1); 45 47 } ··· 112 110 113 111 static inline bool is_shared_processor(void) 114 112 { 115 - /* 116 - * LPPACA is only available on Pseries so guard anything LPPACA related to 117 - * allow other platforms (which include this common header) to compile. 118 - */ 119 - #ifdef CONFIG_PPC_PSERIES 120 - return (IS_ENABLED(CONFIG_PPC_SPLPAR) && 121 - lppaca_shared_proc(local_paca->lppaca_ptr)); 113 + #ifdef CONFIG_PPC_SPLPAR 114 + return static_branch_unlikely(&shared_processor); 122 115 #else 123 116 return false; 124 117 #endif
+7 -2
arch/powerpc/include/asm/uaccess.h
··· 401 401 return n; 402 402 } 403 403 404 - extern unsigned long __clear_user(void __user *addr, unsigned long size); 404 + unsigned long __arch_clear_user(void __user *addr, unsigned long size); 405 405 406 406 static inline unsigned long clear_user(void __user *addr, unsigned long size) 407 407 { ··· 409 409 might_fault(); 410 410 if (likely(access_ok(addr, size))) { 411 411 allow_write_to_user(addr, size); 412 - ret = __clear_user(addr, size); 412 + ret = __arch_clear_user(addr, size); 413 413 prevent_write_to_user(addr, size); 414 414 } 415 415 return ret; 416 + } 417 + 418 + static inline unsigned long __clear_user(void __user *addr, unsigned long size) 419 + { 420 + return clear_user(addr, size); 416 421 } 417 422 418 423 extern long strncpy_from_user(char *dst, const char __user *src, long count);
+2 -2
arch/powerpc/kernel/irq.c
··· 619 619 620 620 trace_irq_entry(regs); 621 621 622 - check_stack_overflow(); 623 - 624 622 /* 625 623 * Query the platform PIC for the interrupt & ack it. 626 624 * ··· 649 651 cursp = (void *)(current_stack_pointer() & ~(THREAD_SIZE - 1)); 650 652 irqsp = hardirq_ctx[raw_smp_processor_id()]; 651 653 sirqsp = softirq_ctx[raw_smp_processor_id()]; 654 + 655 + check_stack_overflow(); 652 656 653 657 /* Already there ? */ 654 658 if (unlikely(cursp == irqsp || cursp == sirqsp)) {
+2 -2
arch/powerpc/kvm/book3s_hv_rmhandlers.S
··· 1117 1117 ld r7, VCPU_GPR(R7)(r4) 1118 1118 bne ret_to_ultra 1119 1119 1120 - lwz r0, VCPU_CR(r4) 1120 + ld r0, VCPU_CR(r4) 1121 1121 mtcr r0 1122 1122 1123 1123 ld r0, VCPU_GPR(R0)(r4) ··· 1137 1137 * R3 = UV_RETURN 1138 1138 */ 1139 1139 ret_to_ultra: 1140 - lwz r0, VCPU_CR(r4) 1140 + ld r0, VCPU_CR(r4) 1141 1141 mtcr r0 1142 1142 1143 1143 ld r0, VCPU_GPR(R3)(r4)
+2 -2
arch/powerpc/lib/string_32.S
··· 17 17 LG_CACHELINE_BYTES = L1_CACHE_SHIFT 18 18 CACHELINE_MASK = (L1_CACHE_BYTES-1) 19 19 20 - _GLOBAL(__clear_user) 20 + _GLOBAL(__arch_clear_user) 21 21 /* 22 22 * Use dcbz on the complete cache lines in the destination 23 23 * to set them to zero. This requires that the destination ··· 87 87 EX_TABLE(8b, 91b) 88 88 EX_TABLE(9b, 91b) 89 89 90 - EXPORT_SYMBOL(__clear_user) 90 + EXPORT_SYMBOL(__arch_clear_user)
+3 -3
arch/powerpc/lib/string_64.S
··· 17 17 .section ".text" 18 18 19 19 /** 20 - * __clear_user: - Zero a block of memory in user space, with less checking. 20 + * __arch_clear_user: - Zero a block of memory in user space, with less checking. 21 21 * @to: Destination address, in user space. 22 22 * @n: Number of bytes to zero. 23 23 * ··· 58 58 mr r3,r4 59 59 blr 60 60 61 - _GLOBAL_TOC(__clear_user) 61 + _GLOBAL_TOC(__arch_clear_user) 62 62 cmpdi r4,32 63 63 neg r6,r3 64 64 li r0,0 ··· 181 181 cmpdi r4,32 182 182 blt .Lshort_clear 183 183 b .Lmedium_clear 184 - EXPORT_SYMBOL(__clear_user) 184 + EXPORT_SYMBOL(__arch_clear_user)
+8
arch/powerpc/mm/mem.c
··· 289 289 BUILD_BUG_ON(MMU_PAGE_COUNT > 16); 290 290 291 291 #ifdef CONFIG_SWIOTLB 292 + /* 293 + * Some platforms (e.g. 85xx) limit DMA-able memory way below 294 + * 4G. We force memblock to bottom-up mode to ensure that the 295 + * memory allocated in swiotlb_init() is DMA-able. 296 + * As it's the last memblock allocation, no need to reset it 297 + * back to to-down. 298 + */ 299 + memblock_set_bottom_up(true); 292 300 swiotlb_init(0); 293 301 #endif 294 302
+1 -1
arch/powerpc/mm/nohash/8xx.c
··· 103 103 patch_instruction_site(site, instr); 104 104 } 105 105 106 - void __init mmu_mapin_ram_chunk(unsigned long offset, unsigned long top, pgprot_t prot) 106 + static void mmu_mapin_ram_chunk(unsigned long offset, unsigned long top, pgprot_t prot) 107 107 { 108 108 unsigned long s = offset; 109 109 unsigned long v = PAGE_OFFSET + s;
+10
arch/powerpc/platforms/pseries/cmm.c
··· 539 539 /* balloon page list reference */ 540 540 get_page(newpage); 541 541 542 + /* 543 + * When we migrate a page to a different zone, we have to fixup the 544 + * count of both involved zones as we adjusted the managed page count 545 + * when inflating. 546 + */ 547 + if (page_zone(page) != page_zone(newpage)) { 548 + adjust_managed_page_count(page, 1); 549 + adjust_managed_page_count(newpage, -1); 550 + } 551 + 542 552 spin_lock_irqsave(&b_dev_info->pages_lock, flags); 543 553 balloon_page_insert(b_dev_info, newpage); 544 554 balloon_page_delete(page);
+7
arch/powerpc/platforms/pseries/setup.c
··· 74 74 #include "pseries.h" 75 75 #include "../../../../drivers/pci/pci.h" 76 76 77 + DEFINE_STATIC_KEY_FALSE(shared_processor); 78 + EXPORT_SYMBOL_GPL(shared_processor); 79 + 77 80 int CMO_PrPSP = -1; 78 81 int CMO_SecPSP = -1; 79 82 unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT_4K); ··· 761 758 762 759 if (firmware_has_feature(FW_FEATURE_LPAR)) { 763 760 vpa_init(boot_cpuid); 761 + 762 + if (lppaca_shared_proc(get_lppaca())) 763 + static_branch_enable(&shared_processor); 764 + 764 765 ppc_md.power_save = pseries_lpar_idle; 765 766 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; 766 767 #ifdef CONFIG_PCI_IOV
+4 -4
drivers/misc/ocxl/context.c
··· 10 10 int pasid; 11 11 struct ocxl_context *ctx; 12 12 13 - *context = kzalloc(sizeof(struct ocxl_context), GFP_KERNEL); 14 - if (!*context) 13 + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 14 + if (!ctx) 15 15 return -ENOMEM; 16 - 17 - ctx = *context; 18 16 19 17 ctx->afu = afu; 20 18 mutex_lock(&afu->contexts_lock); ··· 20 22 afu->pasid_base + afu->pasid_max, GFP_KERNEL); 21 23 if (pasid < 0) { 22 24 mutex_unlock(&afu->contexts_lock); 25 + kfree(ctx); 23 26 return pasid; 24 27 } 25 28 afu->pasid_count++; ··· 42 43 * duration of the life of the context 43 44 */ 44 45 ocxl_afu_get(afu); 46 + *context = ctx; 45 47 return 0; 46 48 } 47 49 EXPORT_SYMBOL_GPL(ocxl_context_alloc);
+11 -12
drivers/misc/ocxl/file.c
··· 18 18 static struct mutex minors_idr_lock; 19 19 static struct idr minors_idr; 20 20 21 - static struct ocxl_file_info *find_file_info(dev_t devno) 21 + static struct ocxl_file_info *find_and_get_file_info(dev_t devno) 22 22 { 23 23 struct ocxl_file_info *info; 24 24 25 - /* 26 - * We don't declare an RCU critical section here, as our AFU 27 - * is protected by a reference counter on the device. By the time the 28 - * info reference is removed from the idr, the ref count of 29 - * the device is already at 0, so no user API will access that AFU and 30 - * this function can't return it. 31 - */ 25 + mutex_lock(&minors_idr_lock); 32 26 info = idr_find(&minors_idr, MINOR(devno)); 27 + if (info) 28 + get_device(&info->dev); 29 + mutex_unlock(&minors_idr_lock); 33 30 return info; 34 31 } 35 32 ··· 55 58 56 59 pr_debug("%s for device %x\n", __func__, inode->i_rdev); 57 60 58 - info = find_file_info(inode->i_rdev); 61 + info = find_and_get_file_info(inode->i_rdev); 59 62 if (!info) 60 63 return -ENODEV; 61 64 62 65 rc = ocxl_context_alloc(&ctx, info->afu, inode->i_mapping); 63 - if (rc) 66 + if (rc) { 67 + put_device(&info->dev); 64 68 return rc; 65 - 69 + } 70 + put_device(&info->dev); 66 71 file->private_data = ctx; 67 72 return 0; 68 73 } ··· 486 487 { 487 488 struct ocxl_file_info *info = container_of(dev, struct ocxl_file_info, dev); 488 489 489 - free_minor(info); 490 490 ocxl_afu_put(info->afu); 491 491 kfree(info); 492 492 } ··· 575 577 576 578 ocxl_file_make_invisible(info); 577 579 ocxl_sysfs_unregister_afu(info); 580 + free_minor(info); 578 581 device_unregister(&info->dev); 579 582 } 580 583