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

Merge branch 'linus' into locking/core, to resolve conflicts

Conflicts:
include/linux/mm_types.h
mm/huge_memory.c

I removed the smp_mb__before_spinlock() like the following commit does:

8b1b436dd1cc ("mm, locking: Rework {set,clear,mm}_tlb_flush_pending()")

and fixed up the affected commits.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+678 -362
+1
MAINTAINERS
··· 14004 14004 F: include/linux/virtio*.h 14005 14005 F: include/uapi/linux/virtio_*.h 14006 14006 F: drivers/crypto/virtio/ 14007 + F: mm/balloon_compaction.c 14007 14008 14008 14009 VIRTIO CRYPTO DRIVER 14009 14010 M: Gonglei <arei.gonglei@huawei.com>
+9 -2
arch/arm/include/asm/tlb.h
··· 148 148 } 149 149 150 150 static inline void 151 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 151 + arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 152 + unsigned long start, unsigned long end) 152 153 { 153 154 tlb->mm = mm; 154 155 tlb->fullmm = !(start | (end+1)); ··· 167 166 } 168 167 169 168 static inline void 170 - tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 169 + arch_tlb_finish_mmu(struct mmu_gather *tlb, 170 + unsigned long start, unsigned long end, bool force) 171 171 { 172 + if (force) { 173 + tlb->range_start = start; 174 + tlb->range_end = end; 175 + } 176 + 172 177 tlb_flush_mmu(tlb); 173 178 174 179 /* keep the page table cache within bounds */
+6 -2
arch/ia64/include/asm/tlb.h
··· 168 168 169 169 170 170 static inline void 171 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 171 + arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 172 + unsigned long start, unsigned long end) 172 173 { 173 174 tlb->mm = mm; 174 175 tlb->max = ARRAY_SIZE(tlb->local); ··· 186 185 * collected. 187 186 */ 188 187 static inline void 189 - tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 188 + arch_tlb_finish_mmu(struct mmu_gather *tlb, 189 + unsigned long start, unsigned long end, bool force) 190 190 { 191 + if (force) 192 + tlb->need_flush = 1; 191 193 /* 192 194 * Note: tlb->nr may be 0 at this point, so we can't rely on tlb->start_addr and 193 195 * tlb->end_addr.
+11 -6
arch/s390/include/asm/tlb.h
··· 47 47 extern void tlb_table_flush(struct mmu_gather *tlb); 48 48 extern void tlb_remove_table(struct mmu_gather *tlb, void *table); 49 49 50 - static inline void tlb_gather_mmu(struct mmu_gather *tlb, 51 - struct mm_struct *mm, 52 - unsigned long start, 53 - unsigned long end) 50 + static inline void 51 + arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 52 + unsigned long start, unsigned long end) 54 53 { 55 54 tlb->mm = mm; 56 55 tlb->start = start; ··· 75 76 tlb_flush_mmu_free(tlb); 76 77 } 77 78 78 - static inline void tlb_finish_mmu(struct mmu_gather *tlb, 79 - unsigned long start, unsigned long end) 79 + static inline void 80 + arch_tlb_finish_mmu(struct mmu_gather *tlb, 81 + unsigned long start, unsigned long end, bool force) 80 82 { 83 + if (force) { 84 + tlb->start = start; 85 + tlb->end = end; 86 + } 87 + 81 88 tlb_flush_mmu(tlb); 82 89 } 83 90
+5 -3
arch/sh/include/asm/tlb.h
··· 36 36 } 37 37 38 38 static inline void 39 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 39 + arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 40 + unsigned long start, unsigned long end) 40 41 { 41 42 tlb->mm = mm; 42 43 tlb->start = start; ··· 48 47 } 49 48 50 49 static inline void 51 - tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 50 + arch_tlb_finish_mmu(struct mmu_gather *tlb, 51 + unsigned long start, unsigned long end, bool force) 52 52 { 53 - if (tlb->fullmm) 53 + if (tlb->fullmm || force) 54 54 flush_tlb_mm(tlb->mm); 55 55 56 56 /* keep the page table cache within bounds */
+16
arch/sparc/include/asm/spitfire.h
··· 47 47 #define SUN4V_CHIP_NIAGARA5 0x05 48 48 #define SUN4V_CHIP_SPARC_M6 0x06 49 49 #define SUN4V_CHIP_SPARC_M7 0x07 50 + #define SUN4V_CHIP_SPARC_M8 0x08 50 51 #define SUN4V_CHIP_SPARC64X 0x8a 51 52 #define SUN4V_CHIP_SPARC_SN 0x8b 52 53 #define SUN4V_CHIP_UNKNOWN 0xff 54 + 55 + /* 56 + * The following CPU_ID_xxx constants are used 57 + * to identify the CPU type in the setup phase 58 + * (see head_64.S) 59 + */ 60 + #define CPU_ID_NIAGARA1 ('1') 61 + #define CPU_ID_NIAGARA2 ('2') 62 + #define CPU_ID_NIAGARA3 ('3') 63 + #define CPU_ID_NIAGARA4 ('4') 64 + #define CPU_ID_NIAGARA5 ('5') 65 + #define CPU_ID_M6 ('6') 66 + #define CPU_ID_M7 ('7') 67 + #define CPU_ID_M8 ('8') 68 + #define CPU_ID_SONOMA1 ('N') 53 69 54 70 #ifndef __ASSEMBLY__ 55 71
+6
arch/sparc/kernel/cpu.c
··· 506 506 sparc_pmu_type = "sparc-m7"; 507 507 break; 508 508 509 + case SUN4V_CHIP_SPARC_M8: 510 + sparc_cpu_type = "SPARC-M8"; 511 + sparc_fpu_type = "SPARC-M8 integrated FPU"; 512 + sparc_pmu_type = "sparc-m8"; 513 + break; 514 + 509 515 case SUN4V_CHIP_SPARC_SN: 510 516 sparc_cpu_type = "SPARC-SN"; 511 517 sparc_fpu_type = "SPARC-SN integrated FPU";
+1
arch/sparc/kernel/cpumap.c
··· 328 328 case SUN4V_CHIP_NIAGARA5: 329 329 case SUN4V_CHIP_SPARC_M6: 330 330 case SUN4V_CHIP_SPARC_M7: 331 + case SUN4V_CHIP_SPARC_M8: 331 332 case SUN4V_CHIP_SPARC_SN: 332 333 case SUN4V_CHIP_SPARC64X: 333 334 rover_inc_table = niagara_iterate_method;
+14 -8
arch/sparc/kernel/head_64.S
··· 424 424 nop 425 425 426 426 70: ldub [%g1 + 7], %g2 427 - cmp %g2, '3' 427 + cmp %g2, CPU_ID_NIAGARA3 428 428 be,pt %xcc, 5f 429 429 mov SUN4V_CHIP_NIAGARA3, %g4 430 - cmp %g2, '4' 430 + cmp %g2, CPU_ID_NIAGARA4 431 431 be,pt %xcc, 5f 432 432 mov SUN4V_CHIP_NIAGARA4, %g4 433 - cmp %g2, '5' 433 + cmp %g2, CPU_ID_NIAGARA5 434 434 be,pt %xcc, 5f 435 435 mov SUN4V_CHIP_NIAGARA5, %g4 436 - cmp %g2, '6' 436 + cmp %g2, CPU_ID_M6 437 437 be,pt %xcc, 5f 438 438 mov SUN4V_CHIP_SPARC_M6, %g4 439 - cmp %g2, '7' 439 + cmp %g2, CPU_ID_M7 440 440 be,pt %xcc, 5f 441 441 mov SUN4V_CHIP_SPARC_M7, %g4 442 - cmp %g2, 'N' 442 + cmp %g2, CPU_ID_M8 443 + be,pt %xcc, 5f 444 + mov SUN4V_CHIP_SPARC_M8, %g4 445 + cmp %g2, CPU_ID_SONOMA1 443 446 be,pt %xcc, 5f 444 447 mov SUN4V_CHIP_SPARC_SN, %g4 445 448 ba,pt %xcc, 49f ··· 451 448 91: sethi %hi(prom_cpu_compatible), %g1 452 449 or %g1, %lo(prom_cpu_compatible), %g1 453 450 ldub [%g1 + 17], %g2 454 - cmp %g2, '1' 451 + cmp %g2, CPU_ID_NIAGARA1 455 452 be,pt %xcc, 5f 456 453 mov SUN4V_CHIP_NIAGARA1, %g4 457 - cmp %g2, '2' 454 + cmp %g2, CPU_ID_NIAGARA2 458 455 be,pt %xcc, 5f 459 456 mov SUN4V_CHIP_NIAGARA2, %g4 460 457 ··· 603 600 be,pt %xcc, niagara4_patch 604 601 nop 605 602 cmp %g1, SUN4V_CHIP_SPARC_M7 603 + be,pt %xcc, niagara4_patch 604 + nop 605 + cmp %g1, SUN4V_CHIP_SPARC_M8 606 606 be,pt %xcc, niagara4_patch 607 607 nop 608 608 cmp %g1, SUN4V_CHIP_SPARC_SN
+13 -2
arch/sparc/kernel/setup_64.c
··· 288 288 289 289 sun4v_patch_2insn_range(&__sun4v_2insn_patch, 290 290 &__sun4v_2insn_patch_end); 291 - if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 292 - sun4v_chip_type == SUN4V_CHIP_SPARC_SN) 291 + 292 + switch (sun4v_chip_type) { 293 + case SUN4V_CHIP_SPARC_M7: 294 + case SUN4V_CHIP_SPARC_M8: 295 + case SUN4V_CHIP_SPARC_SN: 293 296 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch, 294 297 &__sun_m7_2insn_patch_end); 298 + break; 299 + default: 300 + break; 301 + } 295 302 296 303 sun4v_hvapi_init(); 297 304 } ··· 536 529 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 537 530 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 538 531 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 532 + sun4v_chip_type == SUN4V_CHIP_SPARC_M8 || 539 533 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 540 534 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 541 535 cap |= HWCAP_SPARC_BLKINIT; ··· 546 538 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 547 539 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 548 540 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 541 + sun4v_chip_type == SUN4V_CHIP_SPARC_M8 || 549 542 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 550 543 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 551 544 cap |= HWCAP_SPARC_N2; ··· 577 568 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 578 569 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 579 570 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 571 + sun4v_chip_type == SUN4V_CHIP_SPARC_M8 || 580 572 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 581 573 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 582 574 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | ··· 588 578 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 || 589 579 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 || 590 580 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 || 581 + sun4v_chip_type == SUN4V_CHIP_SPARC_M8 || 591 582 sun4v_chip_type == SUN4V_CHIP_SPARC_SN || 592 583 sun4v_chip_type == SUN4V_CHIP_SPARC64X) 593 584 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
+13 -1
arch/sparc/mm/init_64.c
··· 1944 1944 break; 1945 1945 case SUN4V_CHIP_SPARC_M7: 1946 1946 case SUN4V_CHIP_SPARC_SN: 1947 - default: 1948 1947 /* M7 and later support 52-bit virtual addresses. */ 1949 1948 sparc64_va_hole_top = 0xfff8000000000000UL; 1950 1949 sparc64_va_hole_bottom = 0x0008000000000000UL; 1951 1950 max_phys_bits = 49; 1951 + break; 1952 + case SUN4V_CHIP_SPARC_M8: 1953 + default: 1954 + /* M8 and later support 54-bit virtual addresses. 1955 + * However, restricting M8 and above VA bits to 53 1956 + * as 4-level page table cannot support more than 1957 + * 53 VA bits. 1958 + */ 1959 + sparc64_va_hole_top = 0xfff0000000000000UL; 1960 + sparc64_va_hole_bottom = 0x0010000000000000UL; 1961 + max_phys_bits = 51; 1952 1962 break; 1953 1963 } 1954 1964 } ··· 2171 2161 */ 2172 2162 switch (sun4v_chip_type) { 2173 2163 case SUN4V_CHIP_SPARC_M7: 2164 + case SUN4V_CHIP_SPARC_M8: 2174 2165 case SUN4V_CHIP_SPARC_SN: 2175 2166 pagecv_flag = 0x00; 2176 2167 break; ··· 2324 2313 */ 2325 2314 switch (sun4v_chip_type) { 2326 2315 case SUN4V_CHIP_SPARC_M7: 2316 + case SUN4V_CHIP_SPARC_M8: 2327 2317 case SUN4V_CHIP_SPARC_SN: 2328 2318 page_cache4v_flag = _PAGE_CP_4V; 2329 2319 break;
+10 -3
arch/um/include/asm/tlb.h
··· 45 45 } 46 46 47 47 static inline void 48 - tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 48 + arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 49 + unsigned long start, unsigned long end) 49 50 { 50 51 tlb->mm = mm; 51 52 tlb->start = start; ··· 81 80 tlb_flush_mmu_free(tlb); 82 81 } 83 82 84 - /* tlb_finish_mmu 83 + /* arch_tlb_finish_mmu 85 84 * Called at the end of the shootdown operation to free up any resources 86 85 * that were required. 87 86 */ 88 87 static inline void 89 - tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 88 + arch_tlb_finish_mmu(struct mmu_gather *tlb, 89 + unsigned long start, unsigned long end, bool force) 90 90 { 91 + if (force) { 92 + tlb->start = start; 93 + tlb->end = end; 94 + tlb->need_flush = 1; 95 + } 91 96 tlb_flush_mmu(tlb); 92 97 93 98 /* keep the page table cache within bounds */
+61
drivers/block/sunvdc.c
··· 875 875 printk(KERN_INFO "%s", version); 876 876 } 877 877 878 + struct vdc_check_port_data { 879 + int dev_no; 880 + char *type; 881 + }; 882 + 883 + static int vdc_device_probed(struct device *dev, void *arg) 884 + { 885 + struct vio_dev *vdev = to_vio_dev(dev); 886 + struct vdc_check_port_data *port_data; 887 + 888 + port_data = (struct vdc_check_port_data *)arg; 889 + 890 + if ((vdev->dev_no == port_data->dev_no) && 891 + (!(strcmp((char *)&vdev->type, port_data->type))) && 892 + dev_get_drvdata(dev)) { 893 + /* This device has already been configured 894 + * by vdc_port_probe() 895 + */ 896 + return 1; 897 + } else { 898 + return 0; 899 + } 900 + } 901 + 902 + /* Determine whether the VIO device is part of an mpgroup 903 + * by locating all the virtual-device-port nodes associated 904 + * with the parent virtual-device node for the VIO device 905 + * and checking whether any of these nodes are vdc-ports 906 + * which have already been configured. 907 + * 908 + * Returns true if this device is part of an mpgroup and has 909 + * already been probed. 910 + */ 911 + static bool vdc_port_mpgroup_check(struct vio_dev *vdev) 912 + { 913 + struct vdc_check_port_data port_data; 914 + struct device *dev; 915 + 916 + port_data.dev_no = vdev->dev_no; 917 + port_data.type = (char *)&vdev->type; 918 + 919 + dev = device_find_child(vdev->dev.parent, &port_data, 920 + vdc_device_probed); 921 + 922 + if (dev) 923 + return true; 924 + 925 + return false; 926 + } 927 + 878 928 static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id) 879 929 { 880 930 struct mdesc_handle *hp; ··· 940 890 if ((vdev->dev_no << PARTITION_SHIFT) & ~(u64)MINORMASK) { 941 891 printk(KERN_ERR PFX "Port id [%llu] too large.\n", 942 892 vdev->dev_no); 893 + goto err_out_release_mdesc; 894 + } 895 + 896 + /* Check if this device is part of an mpgroup */ 897 + if (vdc_port_mpgroup_check(vdev)) { 898 + printk(KERN_WARNING 899 + "VIO: Ignoring extra vdisk port %s", 900 + dev_name(&vdev->dev)); 943 901 goto err_out_release_mdesc; 944 902 } 945 903 ··· 1001 943 if (err) 1002 944 goto err_out_free_tx_ring; 1003 945 946 + /* Note that the device driver_data is used to determine 947 + * whether the port has been probed. 948 + */ 1004 949 dev_set_drvdata(&vdev->dev, port); 1005 950 1006 951 mdesc_release(hp);
+2 -2
drivers/block/zram/zram_drv.c
··· 308 308 struct device_attribute *attr, const char *buf, size_t len) 309 309 { 310 310 struct zram *zram = dev_to_zram(dev); 311 - char compressor[CRYPTO_MAX_ALG_NAME]; 311 + char compressor[ARRAY_SIZE(zram->compressor)]; 312 312 size_t sz; 313 313 314 314 strlcpy(compressor, buf, sizeof(compressor)); ··· 327 327 return -EBUSY; 328 328 } 329 329 330 - strlcpy(zram->compressor, compressor, sizeof(compressor)); 330 + strcpy(zram->compressor, compressor); 331 331 up_write(&zram->init_lock); 332 332 return len; 333 333 }
+3 -2
drivers/dma-buf/sync_file.c
··· 304 304 { 305 305 struct sync_file *sync_file = file->private_data; 306 306 307 - if (test_bit(POLL_ENABLED, &sync_file->fence->flags)) 307 + if (test_bit(POLL_ENABLED, &sync_file->flags)) 308 308 dma_fence_remove_callback(sync_file->fence, &sync_file->cb); 309 309 dma_fence_put(sync_file->fence); 310 310 kfree(sync_file); ··· 318 318 319 319 poll_wait(file, &sync_file->wq, wait); 320 320 321 - if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { 321 + if (list_empty(&sync_file->cb.node) && 322 + !test_and_set_bit(POLL_ENABLED, &sync_file->flags)) { 322 323 if (dma_fence_add_callback(sync_file->fence, &sync_file->cb, 323 324 fence_check_cb_func) < 0) 324 325 wake_up_all(&sync_file->wq);
+1 -1
drivers/gpu/drm/bridge/tc358767.c
··· 1255 1255 1256 1256 /* port@2 is the output port */ 1257 1257 ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &tc->panel, NULL); 1258 - if (ret) 1258 + if (ret && ret != -ENODEV) 1259 1259 return ret; 1260 1260 1261 1261 /* Shut down GPIO is optional */
+2 -2
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
··· 270 270 if (ret) 271 271 return ret; 272 272 273 - if (r->reloc_offset >= bo->obj->base.size - sizeof(*ptr)) { 274 - DRM_ERROR("relocation %u outside object", i); 273 + if (r->reloc_offset > bo->obj->base.size - sizeof(*ptr)) { 274 + DRM_ERROR("relocation %u outside object\n", i); 275 275 return -EINVAL; 276 276 } 277 277
+13 -1
drivers/gpu/drm/exynos/exynos_drm_fb.c
··· 145 145 exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, 146 146 const struct drm_mode_fb_cmd2 *mode_cmd) 147 147 { 148 + const struct drm_format_info *info = drm_get_format_info(dev, mode_cmd); 148 149 struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER]; 149 150 struct drm_gem_object *obj; 150 151 struct drm_framebuffer *fb; 151 152 int i; 152 153 int ret; 153 154 154 - for (i = 0; i < drm_format_num_planes(mode_cmd->pixel_format); i++) { 155 + for (i = 0; i < info->num_planes; i++) { 156 + unsigned int height = (i == 0) ? mode_cmd->height : 157 + DIV_ROUND_UP(mode_cmd->height, info->vsub); 158 + unsigned long size = height * mode_cmd->pitches[i] + 159 + mode_cmd->offsets[i]; 160 + 155 161 obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]); 156 162 if (!obj) { 157 163 DRM_ERROR("failed to lookup gem object\n"); ··· 166 160 } 167 161 168 162 exynos_gem[i] = to_exynos_gem(obj); 163 + 164 + if (size > exynos_gem[i]->size) { 165 + i++; 166 + ret = -EINVAL; 167 + goto err; 168 + } 169 169 } 170 170 171 171 fb = exynos_drm_framebuffer_init(dev, mode_cmd, exynos_gem, i);
+22 -5
drivers/gpu/drm/i915/gvt/execlist.c
··· 46 46 #define same_context(a, b) (((a)->context_id == (b)->context_id) && \ 47 47 ((a)->lrca == (b)->lrca)) 48 48 49 + static void clean_workloads(struct intel_vgpu *vgpu, unsigned long engine_mask); 50 + 49 51 static int context_switch_events[] = { 50 52 [RCS] = RCS_AS_CONTEXT_SWITCH, 51 53 [BCS] = BCS_AS_CONTEXT_SWITCH, ··· 501 499 static int complete_execlist_workload(struct intel_vgpu_workload *workload) 502 500 { 503 501 struct intel_vgpu *vgpu = workload->vgpu; 504 - struct intel_vgpu_execlist *execlist = 505 - &vgpu->execlist[workload->ring_id]; 502 + int ring_id = workload->ring_id; 503 + struct intel_vgpu_execlist *execlist = &vgpu->execlist[ring_id]; 506 504 struct intel_vgpu_workload *next_workload; 507 - struct list_head *next = workload_q_head(vgpu, workload->ring_id)->next; 505 + struct list_head *next = workload_q_head(vgpu, ring_id)->next; 508 506 bool lite_restore = false; 509 507 int ret; 510 508 ··· 514 512 release_shadow_batch_buffer(workload); 515 513 release_shadow_wa_ctx(&workload->wa_ctx); 516 514 517 - if (workload->status || vgpu->resetting) 515 + if (workload->status || (vgpu->resetting_eng & ENGINE_MASK(ring_id))) { 516 + /* if workload->status is not successful means HW GPU 517 + * has occurred GPU hang or something wrong with i915/GVT, 518 + * and GVT won't inject context switch interrupt to guest. 519 + * So this error is a vGPU hang actually to the guest. 520 + * According to this we should emunlate a vGPU hang. If 521 + * there are pending workloads which are already submitted 522 + * from guest, we should clean them up like HW GPU does. 523 + * 524 + * if it is in middle of engine resetting, the pending 525 + * workloads won't be submitted to HW GPU and will be 526 + * cleaned up during the resetting process later, so doing 527 + * the workload clean up here doesn't have any impact. 528 + **/ 529 + clean_workloads(vgpu, ENGINE_MASK(ring_id)); 518 530 goto out; 531 + } 519 532 520 - if (!list_empty(workload_q_head(vgpu, workload->ring_id))) { 533 + if (!list_empty(workload_q_head(vgpu, ring_id))) { 521 534 struct execlist_ctx_descriptor_format *this_desc, *next_desc; 522 535 523 536 next_workload = container_of(next,
+10 -1
drivers/gpu/drm/i915/gvt/firmware.c
··· 72 72 struct intel_gvt_device_info *info = &gvt->device_info; 73 73 struct pci_dev *pdev = gvt->dev_priv->drm.pdev; 74 74 struct intel_gvt_mmio_info *e; 75 + struct gvt_mmio_block *block = gvt->mmio.mmio_block; 76 + int num = gvt->mmio.num_mmio_block; 75 77 struct gvt_firmware_header *h; 76 78 void *firmware; 77 79 void *p; 78 80 unsigned long size, crc32_start; 79 - int i; 81 + int i, j; 80 82 int ret; 81 83 82 84 size = sizeof(*h) + info->mmio_size + info->cfg_space_size; ··· 106 104 107 105 hash_for_each(gvt->mmio.mmio_info_table, i, e, node) 108 106 *(u32 *)(p + e->offset) = I915_READ_NOTRACE(_MMIO(e->offset)); 107 + 108 + for (i = 0; i < num; i++, block++) { 109 + for (j = 0; j < block->size; j += 4) 110 + *(u32 *)(p + INTEL_GVT_MMIO_OFFSET(block->offset) + j) = 111 + I915_READ_NOTRACE(_MMIO(INTEL_GVT_MMIO_OFFSET( 112 + block->offset) + j)); 113 + } 109 114 110 115 memcpy(gvt->firmware.mmio, p, info->mmio_size); 111 116
+13 -1
drivers/gpu/drm/i915/gvt/gvt.h
··· 149 149 bool active; 150 150 bool pv_notified; 151 151 bool failsafe; 152 - bool resetting; 152 + unsigned int resetting_eng; 153 153 void *sched_data; 154 154 struct vgpu_sched_ctl sched_ctl; 155 155 ··· 195 195 unsigned long vgpu_allocated_fence_num; 196 196 }; 197 197 198 + /* Special MMIO blocks. */ 199 + struct gvt_mmio_block { 200 + unsigned int device; 201 + i915_reg_t offset; 202 + unsigned int size; 203 + gvt_mmio_func read; 204 + gvt_mmio_func write; 205 + }; 206 + 198 207 #define INTEL_GVT_MMIO_HASH_BITS 11 199 208 200 209 struct intel_gvt_mmio { ··· 222 213 #define F_CMD_ACCESSED (1 << 5) 223 214 /* This reg could be accessed by unaligned address */ 224 215 #define F_UNALIGN (1 << 6) 216 + 217 + struct gvt_mmio_block *mmio_block; 218 + unsigned int num_mmio_block; 225 219 226 220 DECLARE_HASHTABLE(mmio_info_table, INTEL_GVT_MMIO_HASH_BITS); 227 221 unsigned int num_tracked_mmio;
+18 -20
drivers/gpu/drm/i915/gvt/handlers.c
··· 2857 2857 return 0; 2858 2858 } 2859 2859 2860 - /* Special MMIO blocks. */ 2861 - static struct gvt_mmio_block { 2862 - unsigned int device; 2863 - i915_reg_t offset; 2864 - unsigned int size; 2865 - gvt_mmio_func read; 2866 - gvt_mmio_func write; 2867 - } gvt_mmio_blocks[] = { 2868 - {D_SKL_PLUS, _MMIO(CSR_MMIO_START_RANGE), 0x3000, NULL, NULL}, 2869 - {D_ALL, _MMIO(MCHBAR_MIRROR_BASE_SNB), 0x40000, NULL, NULL}, 2870 - {D_ALL, _MMIO(VGT_PVINFO_PAGE), VGT_PVINFO_SIZE, 2871 - pvinfo_mmio_read, pvinfo_mmio_write}, 2872 - {D_ALL, LGC_PALETTE(PIPE_A, 0), 1024, NULL, NULL}, 2873 - {D_ALL, LGC_PALETTE(PIPE_B, 0), 1024, NULL, NULL}, 2874 - {D_ALL, LGC_PALETTE(PIPE_C, 0), 1024, NULL, NULL}, 2875 - }; 2876 - 2877 2860 static struct gvt_mmio_block *find_mmio_block(struct intel_gvt *gvt, 2878 2861 unsigned int offset) 2879 2862 { 2880 2863 unsigned long device = intel_gvt_get_device_type(gvt); 2881 - struct gvt_mmio_block *block = gvt_mmio_blocks; 2864 + struct gvt_mmio_block *block = gvt->mmio.mmio_block; 2865 + int num = gvt->mmio.num_mmio_block; 2882 2866 int i; 2883 2867 2884 - for (i = 0; i < ARRAY_SIZE(gvt_mmio_blocks); i++, block++) { 2868 + for (i = 0; i < num; i++, block++) { 2885 2869 if (!(device & block->device)) 2886 2870 continue; 2887 2871 if (offset >= INTEL_GVT_MMIO_OFFSET(block->offset) && ··· 2895 2911 vfree(gvt->mmio.mmio_attribute); 2896 2912 gvt->mmio.mmio_attribute = NULL; 2897 2913 } 2914 + 2915 + /* Special MMIO blocks. */ 2916 + static struct gvt_mmio_block mmio_blocks[] = { 2917 + {D_SKL_PLUS, _MMIO(CSR_MMIO_START_RANGE), 0x3000, NULL, NULL}, 2918 + {D_ALL, _MMIO(MCHBAR_MIRROR_BASE_SNB), 0x40000, NULL, NULL}, 2919 + {D_ALL, _MMIO(VGT_PVINFO_PAGE), VGT_PVINFO_SIZE, 2920 + pvinfo_mmio_read, pvinfo_mmio_write}, 2921 + {D_ALL, LGC_PALETTE(PIPE_A, 0), 1024, NULL, NULL}, 2922 + {D_ALL, LGC_PALETTE(PIPE_B, 0), 1024, NULL, NULL}, 2923 + {D_ALL, LGC_PALETTE(PIPE_C, 0), 1024, NULL, NULL}, 2924 + }; 2898 2925 2899 2926 /** 2900 2927 * intel_gvt_setup_mmio_info - setup MMIO information table for GVT device ··· 2945 2950 if (ret) 2946 2951 goto err; 2947 2952 } 2953 + 2954 + gvt->mmio.mmio_block = mmio_blocks; 2955 + gvt->mmio.num_mmio_block = ARRAY_SIZE(mmio_blocks); 2948 2956 2949 2957 gvt_dbg_mmio("traced %u virtual mmio registers\n", 2950 2958 gvt->mmio.num_tracked_mmio); ··· 3028 3030 gvt_mmio_func func; 3029 3031 int ret; 3030 3032 3031 - if (WARN_ON(bytes > 4)) 3033 + if (WARN_ON(bytes > 8)) 3032 3034 return -EINVAL; 3033 3035 3034 3036 /*
+2 -1
drivers/gpu/drm/i915/gvt/scheduler.c
··· 432 432 433 433 i915_gem_request_put(fetch_and_zero(&workload->req)); 434 434 435 - if (!workload->status && !vgpu->resetting) { 435 + if (!workload->status && !(vgpu->resetting_eng & 436 + ENGINE_MASK(ring_id))) { 436 437 update_guest_context(workload); 437 438 438 439 for_each_set_bit(event, workload->pending_events,
+5 -3
drivers/gpu/drm/i915/gvt/vgpu.c
··· 480 480 { 481 481 struct intel_gvt *gvt = vgpu->gvt; 482 482 struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; 483 + unsigned int resetting_eng = dmlr ? ALL_ENGINES : engine_mask; 483 484 484 485 gvt_dbg_core("------------------------------------------\n"); 485 486 gvt_dbg_core("resseting vgpu%d, dmlr %d, engine_mask %08x\n", 486 487 vgpu->id, dmlr, engine_mask); 487 - vgpu->resetting = true; 488 + 489 + vgpu->resetting_eng = resetting_eng; 488 490 489 491 intel_vgpu_stop_schedule(vgpu); 490 492 /* ··· 499 497 mutex_lock(&gvt->lock); 500 498 } 501 499 502 - intel_vgpu_reset_execlist(vgpu, dmlr ? ALL_ENGINES : engine_mask); 500 + intel_vgpu_reset_execlist(vgpu, resetting_eng); 503 501 504 502 /* full GPU reset or device model level reset */ 505 503 if (engine_mask == ALL_ENGINES || dmlr) { ··· 522 520 } 523 521 } 524 522 525 - vgpu->resetting = false; 523 + vgpu->resetting_eng = 0; 526 524 gvt_dbg_core("reset vgpu%d done\n", vgpu->id); 527 525 gvt_dbg_core("------------------------------------------\n"); 528 526 }
+8 -3
drivers/gpu/drm/i915/i915_gem_shrinker.c
··· 43 43 return true; 44 44 45 45 case MUTEX_TRYLOCK_FAILED: 46 + *unlock = false; 47 + preempt_disable(); 46 48 do { 47 49 cpu_relax(); 48 50 if (mutex_trylock(&dev_priv->drm.struct_mutex)) { 49 - case MUTEX_TRYLOCK_SUCCESS: 50 51 *unlock = true; 51 - return true; 52 + break; 52 53 } 53 54 } while (!need_resched()); 55 + preempt_enable(); 56 + return *unlock; 54 57 55 - return false; 58 + case MUTEX_TRYLOCK_SUCCESS: 59 + *unlock = true; 60 + return true; 56 61 } 57 62 58 63 BUG();
+2 -2
drivers/gpu/drm/i915/i915_perf.c
··· 1601 1601 u32 *cs; 1602 1602 int i; 1603 1603 1604 - cs = intel_ring_begin(req, n_flex_regs * 2 + 4); 1604 + cs = intel_ring_begin(req, ARRAY_SIZE(flex_mmio) * 2 + 4); 1605 1605 if (IS_ERR(cs)) 1606 1606 return PTR_ERR(cs); 1607 1607 1608 - *cs++ = MI_LOAD_REGISTER_IMM(n_flex_regs + 1); 1608 + *cs++ = MI_LOAD_REGISTER_IMM(ARRAY_SIZE(flex_mmio) + 1); 1609 1609 1610 1610 *cs++ = i915_mmio_reg_offset(GEN8_OACTXCONTROL); 1611 1611 *cs++ = (dev_priv->perf.oa.period_exponent << GEN8_OA_TIMER_PERIOD_SHIFT) |
+1
drivers/gpu/drm/i915/intel_color.c
··· 398 398 } 399 399 400 400 /* Program the max register to clamp values > 1.0. */ 401 + i = lut_size - 1; 401 402 I915_WRITE(PREC_PAL_GC_MAX(pipe, 0), 402 403 drm_color_lut_extract(lut[i].red, 16)); 403 404 I915_WRITE(PREC_PAL_GC_MAX(pipe, 1),
+1 -1
drivers/gpu/drm/i915/intel_panel.c
··· 469 469 470 470 if (i915.invert_brightness > 0 || 471 471 dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS) { 472 - return panel->backlight.max - val; 472 + return panel->backlight.max - val + panel->backlight.min; 473 473 } 474 474 475 475 return val;
+1 -1
drivers/gpu/drm/msm/Kconfig
··· 5 5 depends on ARCH_QCOM || (ARM && COMPILE_TEST) 6 6 depends on OF && COMMON_CLK 7 7 depends on MMU 8 - select QCOM_MDT_LOADER 8 + select QCOM_MDT_LOADER if ARCH_QCOM 9 9 select REGULATOR 10 10 select DRM_KMS_HELPER 11 11 select DRM_PANEL
+66 -115
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
··· 15 15 #include <linux/cpumask.h> 16 16 #include <linux/qcom_scm.h> 17 17 #include <linux/dma-mapping.h> 18 - #include <linux/of_reserved_mem.h> 18 + #include <linux/of_address.h> 19 19 #include <linux/soc/qcom/mdt_loader.h> 20 20 #include "msm_gem.h" 21 21 #include "msm_mmu.h" ··· 26 26 27 27 #define GPU_PAS_ID 13 28 28 29 - #if IS_ENABLED(CONFIG_QCOM_MDT_LOADER) 30 - 31 29 static int zap_shader_load_mdt(struct device *dev, const char *fwname) 32 30 { 33 31 const struct firmware *fw; 32 + struct device_node *np; 33 + struct resource r; 34 34 phys_addr_t mem_phys; 35 35 ssize_t mem_size; 36 36 void *mem_region = NULL; 37 37 int ret; 38 + 39 + if (!IS_ENABLED(CONFIG_ARCH_QCOM)) 40 + return -EINVAL; 41 + 42 + np = of_get_child_by_name(dev->of_node, "zap-shader"); 43 + if (!np) 44 + return -ENODEV; 45 + 46 + np = of_parse_phandle(np, "memory-region", 0); 47 + if (!np) 48 + return -EINVAL; 49 + 50 + ret = of_address_to_resource(np, 0, &r); 51 + if (ret) 52 + return ret; 53 + 54 + mem_phys = r.start; 55 + mem_size = resource_size(&r); 38 56 39 57 /* Request the MDT file for the firmware */ 40 58 ret = request_firmware(&fw, fwname, dev); ··· 69 51 } 70 52 71 53 /* Allocate memory for the firmware image */ 72 - mem_region = dmam_alloc_coherent(dev, mem_size, &mem_phys, GFP_KERNEL); 54 + mem_region = memremap(mem_phys, mem_size, MEMREMAP_WC); 73 55 if (!mem_region) { 74 56 ret = -ENOMEM; 75 57 goto out; ··· 87 69 DRM_DEV_ERROR(dev, "Unable to authorize the image\n"); 88 70 89 71 out: 72 + if (mem_region) 73 + memunmap(mem_region); 74 + 90 75 release_firmware(fw); 91 76 92 77 return ret; 93 78 } 94 - #else 95 - static int zap_shader_load_mdt(struct device *dev, const char *fwname) 96 - { 97 - return -ENODEV; 98 - } 99 - #endif 100 79 101 80 static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, 102 81 struct msm_file_private *ctx) ··· 132 117 gpu->funcs->flush(gpu); 133 118 } 134 119 135 - struct a5xx_hwcg { 120 + static const struct { 136 121 u32 offset; 137 122 u32 value; 138 - }; 139 - 140 - static const struct a5xx_hwcg a530_hwcg[] = { 123 + } a5xx_hwcg[] = { 141 124 {REG_A5XX_RBBM_CLOCK_CNTL_SP0, 0x02222222}, 142 125 {REG_A5XX_RBBM_CLOCK_CNTL_SP1, 0x02222222}, 143 126 {REG_A5XX_RBBM_CLOCK_CNTL_SP2, 0x02222222}, ··· 230 217 {REG_A5XX_RBBM_CLOCK_DELAY_VFD, 0x00002222} 231 218 }; 232 219 233 - static const struct { 234 - int (*test)(struct adreno_gpu *gpu); 235 - const struct a5xx_hwcg *regs; 236 - unsigned int count; 237 - } a5xx_hwcg_regs[] = { 238 - { adreno_is_a530, a530_hwcg, ARRAY_SIZE(a530_hwcg), }, 239 - }; 240 - 241 - static void _a5xx_enable_hwcg(struct msm_gpu *gpu, 242 - const struct a5xx_hwcg *regs, unsigned int count) 220 + void a5xx_set_hwcg(struct msm_gpu *gpu, bool state) 243 221 { 244 222 unsigned int i; 245 223 246 - for (i = 0; i < count; i++) 247 - gpu_write(gpu, regs[i].offset, regs[i].value); 224 + for (i = 0; i < ARRAY_SIZE(a5xx_hwcg); i++) 225 + gpu_write(gpu, a5xx_hwcg[i].offset, 226 + state ? a5xx_hwcg[i].value : 0); 248 227 249 - gpu_write(gpu, REG_A5XX_RBBM_CLOCK_CNTL, 0xAAA8AA00); 250 - gpu_write(gpu, REG_A5XX_RBBM_ISDB_CNT, 0x182); 251 - } 252 - 253 - static void a5xx_enable_hwcg(struct msm_gpu *gpu) 254 - { 255 - struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); 256 - unsigned int i; 257 - 258 - for (i = 0; i < ARRAY_SIZE(a5xx_hwcg_regs); i++) { 259 - if (a5xx_hwcg_regs[i].test(adreno_gpu)) { 260 - _a5xx_enable_hwcg(gpu, a5xx_hwcg_regs[i].regs, 261 - a5xx_hwcg_regs[i].count); 262 - return; 263 - } 264 - } 228 + gpu_write(gpu, REG_A5XX_RBBM_CLOCK_CNTL, state ? 0xAAA8AA00 : 0); 229 + gpu_write(gpu, REG_A5XX_RBBM_ISDB_CNT, state ? 0x182 : 0x180); 265 230 } 266 231 267 232 static int a5xx_me_init(struct msm_gpu *gpu) ··· 368 377 return ret; 369 378 } 370 379 371 - /* Set up a child device to "own" the zap shader */ 372 - static int a5xx_zap_shader_dev_init(struct device *parent, struct device *dev) 373 - { 374 - struct device_node *node; 375 - int ret; 376 - 377 - if (dev->parent) 378 - return 0; 379 - 380 - /* Find the sub-node for the zap shader */ 381 - node = of_get_child_by_name(parent->of_node, "zap-shader"); 382 - if (!node) { 383 - DRM_DEV_ERROR(parent, "zap-shader not found in device tree\n"); 384 - return -ENODEV; 385 - } 386 - 387 - dev->parent = parent; 388 - dev->of_node = node; 389 - dev_set_name(dev, "adreno_zap_shader"); 390 - 391 - ret = device_register(dev); 392 - if (ret) { 393 - DRM_DEV_ERROR(parent, "Couldn't register zap shader device\n"); 394 - goto out; 395 - } 396 - 397 - ret = of_reserved_mem_device_init(dev); 398 - if (ret) { 399 - DRM_DEV_ERROR(parent, "Unable to set up the reserved memory\n"); 400 - device_unregister(dev); 401 - } 402 - 403 - out: 404 - if (ret) 405 - dev->parent = NULL; 406 - 407 - return ret; 408 - } 409 - 410 380 static int a5xx_zap_shader_init(struct msm_gpu *gpu) 411 381 { 412 382 static bool loaded; ··· 396 444 return -ENODEV; 397 445 } 398 446 399 - ret = a5xx_zap_shader_dev_init(&pdev->dev, &a5xx_gpu->zap_dev); 400 - 401 - if (!ret) 402 - ret = zap_shader_load_mdt(&a5xx_gpu->zap_dev, 403 - adreno_gpu->info->zapfw); 447 + ret = zap_shader_load_mdt(&pdev->dev, adreno_gpu->info->zapfw); 404 448 405 449 loaded = !ret; 406 450 ··· 493 545 gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL1, 0xA6FFFFFF); 494 546 495 547 /* Enable HWCG */ 496 - a5xx_enable_hwcg(gpu); 548 + a5xx_set_hwcg(gpu, true); 497 549 498 550 gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F); 499 551 ··· 638 690 struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); 639 691 640 692 DBG("%s", gpu->name); 641 - 642 - if (a5xx_gpu->zap_dev.parent) 643 - device_unregister(&a5xx_gpu->zap_dev); 644 693 645 694 if (a5xx_gpu->pm4_bo) { 646 695 if (a5xx_gpu->pm4_iova) ··· 865 920 0x0000, 0x0002, 0x0004, 0x0020, 0x0022, 0x0026, 0x0029, 0x002B, 866 921 0x002E, 0x0035, 0x0038, 0x0042, 0x0044, 0x0044, 0x0047, 0x0095, 867 922 0x0097, 0x00BB, 0x03A0, 0x0464, 0x0469, 0x046F, 0x04D2, 0x04D3, 868 - 0x04E0, 0x0533, 0x0540, 0x0555, 0xF400, 0xF400, 0xF800, 0xF807, 869 - 0x0800, 0x081A, 0x081F, 0x0841, 0x0860, 0x0860, 0x0880, 0x08A0, 870 - 0x0B00, 0x0B12, 0x0B15, 0x0B28, 0x0B78, 0x0B7F, 0x0BB0, 0x0BBD, 871 - 0x0BC0, 0x0BC6, 0x0BD0, 0x0C53, 0x0C60, 0x0C61, 0x0C80, 0x0C82, 872 - 0x0C84, 0x0C85, 0x0C90, 0x0C98, 0x0CA0, 0x0CA0, 0x0CB0, 0x0CB2, 873 - 0x2180, 0x2185, 0x2580, 0x2585, 0x0CC1, 0x0CC1, 0x0CC4, 0x0CC7, 874 - 0x0CCC, 0x0CCC, 0x0CD0, 0x0CD8, 0x0CE0, 0x0CE5, 0x0CE8, 0x0CE8, 875 - 0x0CEC, 0x0CF1, 0x0CFB, 0x0D0E, 0x2100, 0x211E, 0x2140, 0x2145, 876 - 0x2500, 0x251E, 0x2540, 0x2545, 0x0D10, 0x0D17, 0x0D20, 0x0D23, 877 - 0x0D30, 0x0D30, 0x20C0, 0x20C0, 0x24C0, 0x24C0, 0x0E40, 0x0E43, 878 - 0x0E4A, 0x0E4A, 0x0E50, 0x0E57, 0x0E60, 0x0E7C, 0x0E80, 0x0E8E, 879 - 0x0E90, 0x0E96, 0x0EA0, 0x0EA8, 0x0EB0, 0x0EB2, 0xE140, 0xE147, 880 - 0xE150, 0xE187, 0xE1A0, 0xE1A9, 0xE1B0, 0xE1B6, 0xE1C0, 0xE1C7, 881 - 0xE1D0, 0xE1D1, 0xE200, 0xE201, 0xE210, 0xE21C, 0xE240, 0xE268, 882 - 0xE000, 0xE006, 0xE010, 0xE09A, 0xE0A0, 0xE0A4, 0xE0AA, 0xE0EB, 883 - 0xE100, 0xE105, 0xE380, 0xE38F, 0xE3B0, 0xE3B0, 0xE400, 0xE405, 884 - 0xE408, 0xE4E9, 0xE4F0, 0xE4F0, 0xE280, 0xE280, 0xE282, 0xE2A3, 885 - 0xE2A5, 0xE2C2, 0xE940, 0xE947, 0xE950, 0xE987, 0xE9A0, 0xE9A9, 886 - 0xE9B0, 0xE9B6, 0xE9C0, 0xE9C7, 0xE9D0, 0xE9D1, 0xEA00, 0xEA01, 887 - 0xEA10, 0xEA1C, 0xEA40, 0xEA68, 0xE800, 0xE806, 0xE810, 0xE89A, 888 - 0xE8A0, 0xE8A4, 0xE8AA, 0xE8EB, 0xE900, 0xE905, 0xEB80, 0xEB8F, 889 - 0xEBB0, 0xEBB0, 0xEC00, 0xEC05, 0xEC08, 0xECE9, 0xECF0, 0xECF0, 890 - 0xEA80, 0xEA80, 0xEA82, 0xEAA3, 0xEAA5, 0xEAC2, 0xA800, 0xA8FF, 891 - 0xAC60, 0xAC60, 0xB000, 0xB97F, 0xB9A0, 0xB9BF, 892 - ~0 923 + 0x04E0, 0x0533, 0x0540, 0x0555, 0x0800, 0x081A, 0x081F, 0x0841, 924 + 0x0860, 0x0860, 0x0880, 0x08A0, 0x0B00, 0x0B12, 0x0B15, 0x0B28, 925 + 0x0B78, 0x0B7F, 0x0BB0, 0x0BBD, 0x0BC0, 0x0BC6, 0x0BD0, 0x0C53, 926 + 0x0C60, 0x0C61, 0x0C80, 0x0C82, 0x0C84, 0x0C85, 0x0C90, 0x0C98, 927 + 0x0CA0, 0x0CA0, 0x0CB0, 0x0CB2, 0x2180, 0x2185, 0x2580, 0x2585, 928 + 0x0CC1, 0x0CC1, 0x0CC4, 0x0CC7, 0x0CCC, 0x0CCC, 0x0CD0, 0x0CD8, 929 + 0x0CE0, 0x0CE5, 0x0CE8, 0x0CE8, 0x0CEC, 0x0CF1, 0x0CFB, 0x0D0E, 930 + 0x2100, 0x211E, 0x2140, 0x2145, 0x2500, 0x251E, 0x2540, 0x2545, 931 + 0x0D10, 0x0D17, 0x0D20, 0x0D23, 0x0D30, 0x0D30, 0x20C0, 0x20C0, 932 + 0x24C0, 0x24C0, 0x0E40, 0x0E43, 0x0E4A, 0x0E4A, 0x0E50, 0x0E57, 933 + 0x0E60, 0x0E7C, 0x0E80, 0x0E8E, 0x0E90, 0x0E96, 0x0EA0, 0x0EA8, 934 + 0x0EB0, 0x0EB2, 0xE140, 0xE147, 0xE150, 0xE187, 0xE1A0, 0xE1A9, 935 + 0xE1B0, 0xE1B6, 0xE1C0, 0xE1C7, 0xE1D0, 0xE1D1, 0xE200, 0xE201, 936 + 0xE210, 0xE21C, 0xE240, 0xE268, 0xE000, 0xE006, 0xE010, 0xE09A, 937 + 0xE0A0, 0xE0A4, 0xE0AA, 0xE0EB, 0xE100, 0xE105, 0xE380, 0xE38F, 938 + 0xE3B0, 0xE3B0, 0xE400, 0xE405, 0xE408, 0xE4E9, 0xE4F0, 0xE4F0, 939 + 0xE280, 0xE280, 0xE282, 0xE2A3, 0xE2A5, 0xE2C2, 0xE940, 0xE947, 940 + 0xE950, 0xE987, 0xE9A0, 0xE9A9, 0xE9B0, 0xE9B6, 0xE9C0, 0xE9C7, 941 + 0xE9D0, 0xE9D1, 0xEA00, 0xEA01, 0xEA10, 0xEA1C, 0xEA40, 0xEA68, 942 + 0xE800, 0xE806, 0xE810, 0xE89A, 0xE8A0, 0xE8A4, 0xE8AA, 0xE8EB, 943 + 0xE900, 0xE905, 0xEB80, 0xEB8F, 0xEBB0, 0xEBB0, 0xEC00, 0xEC05, 944 + 0xEC08, 0xECE9, 0xECF0, 0xECF0, 0xEA80, 0xEA80, 0xEA82, 0xEAA3, 945 + 0xEAA5, 0xEAC2, 0xA800, 0xA8FF, 0xAC60, 0xAC60, 0xB000, 0xB97F, 946 + 0xB9A0, 0xB9BF, ~0 893 947 }; 894 948 895 949 static void a5xx_dump(struct msm_gpu *gpu) ··· 964 1020 { 965 1021 seq_printf(m, "status: %08x\n", 966 1022 gpu_read(gpu, REG_A5XX_RBBM_STATUS)); 1023 + 1024 + /* 1025 + * Temporarily disable hardware clock gating before going into 1026 + * adreno_show to avoid issues while reading the registers 1027 + */ 1028 + a5xx_set_hwcg(gpu, false); 967 1029 adreno_show(gpu, m); 1030 + a5xx_set_hwcg(gpu, true); 968 1031 } 969 1032 #endif 970 1033
+1 -2
drivers/gpu/drm/msm/adreno/a5xx_gpu.h
··· 36 36 uint32_t gpmu_dwords; 37 37 38 38 uint32_t lm_leakage; 39 - 40 - struct device zap_dev; 41 39 }; 42 40 43 41 #define to_a5xx_gpu(x) container_of(x, struct a5xx_gpu, base) ··· 57 59 } 58 60 59 61 bool a5xx_idle(struct msm_gpu *gpu); 62 + void a5xx_set_hwcg(struct msm_gpu *gpu, bool state); 60 63 61 64 #endif /* __A5XX_GPU_H__ */
+9 -2
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 48 48 *value = adreno_gpu->base.fast_rate; 49 49 return 0; 50 50 case MSM_PARAM_TIMESTAMP: 51 - if (adreno_gpu->funcs->get_timestamp) 52 - return adreno_gpu->funcs->get_timestamp(gpu, value); 51 + if (adreno_gpu->funcs->get_timestamp) { 52 + int ret; 53 + 54 + pm_runtime_get_sync(&gpu->pdev->dev); 55 + ret = adreno_gpu->funcs->get_timestamp(gpu, value); 56 + pm_runtime_put_autosuspend(&gpu->pdev->dev); 57 + 58 + return ret; 59 + } 53 60 return -EINVAL; 54 61 default: 55 62 DBG("%s: invalid param: %u", gpu->name, param);
+7 -7
drivers/gpu/drm/msm/dsi/dsi_host.c
··· 2137 2137 struct msm_dsi_phy_clk_request *clk_req) 2138 2138 { 2139 2139 struct msm_dsi_host *msm_host = to_msm_dsi_host(host); 2140 + int ret; 2141 + 2142 + ret = dsi_calc_clk_rate(msm_host); 2143 + if (ret) { 2144 + pr_err("%s: unable to calc clk rate, %d\n", __func__, ret); 2145 + return; 2146 + } 2140 2147 2141 2148 clk_req->bitclk_rate = msm_host->byte_clk_rate * 8; 2142 2149 clk_req->escclk_rate = msm_host->esc_clk_rate; ··· 2287 2280 struct drm_display_mode *mode) 2288 2281 { 2289 2282 struct msm_dsi_host *msm_host = to_msm_dsi_host(host); 2290 - int ret; 2291 2283 2292 2284 if (msm_host->mode) { 2293 2285 drm_mode_destroy(msm_host->dev, msm_host->mode); ··· 2297 2291 if (!msm_host->mode) { 2298 2292 pr_err("%s: cannot duplicate mode\n", __func__); 2299 2293 return -ENOMEM; 2300 - } 2301 - 2302 - ret = dsi_calc_clk_rate(msm_host); 2303 - if (ret) { 2304 - pr_err("%s: unable to calc clk rate, %d\n", __func__, ret); 2305 - return ret; 2306 2294 } 2307 2295 2308 2296 return 0;
+10 -2
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
··· 221 221 struct mdp5_ctl *ctl = mdp5_cstate->ctl; 222 222 uint32_t blend_op, fg_alpha, bg_alpha, ctl_blend_flags = 0; 223 223 unsigned long flags; 224 - enum mdp5_pipe stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { SSPP_NONE }; 225 - enum mdp5_pipe r_stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { SSPP_NONE }; 224 + enum mdp5_pipe stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { { SSPP_NONE } }; 225 + enum mdp5_pipe r_stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { { SSPP_NONE } }; 226 226 int i, plane_cnt = 0; 227 227 bool bg_alpha_enabled = false; 228 228 u32 mixer_op_mode = 0; ··· 753 753 if (!handle) { 754 754 DBG("Cursor off"); 755 755 cursor_enable = false; 756 + mdp5_enable(mdp5_kms); 756 757 goto set_cursor; 757 758 } 758 759 ··· 776 775 mdp5_crtc->cursor.height = height; 777 776 778 777 get_roi(crtc, &roi_w, &roi_h); 778 + 779 + mdp5_enable(mdp5_kms); 779 780 780 781 mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_STRIDE(lm), stride); 781 782 mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_FORMAT(lm), ··· 807 804 crtc_flush(crtc, flush_mask); 808 805 809 806 end: 807 + mdp5_disable(mdp5_kms); 810 808 if (old_bo) { 811 809 drm_flip_work_queue(&mdp5_crtc->unref_cursor_work, old_bo); 812 810 /* enable vblank to complete cursor work: */ ··· 840 836 841 837 get_roi(crtc, &roi_w, &roi_h); 842 838 839 + mdp5_enable(mdp5_kms); 840 + 843 841 spin_lock_irqsave(&mdp5_crtc->cursor.lock, flags); 844 842 mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_SIZE(lm), 845 843 MDP5_LM_CURSOR_SIZE_ROI_H(roi_h) | ··· 852 846 spin_unlock_irqrestore(&mdp5_crtc->cursor.lock, flags); 853 847 854 848 crtc_flush(crtc, flush_mask); 849 + 850 + mdp5_disable(mdp5_kms); 855 851 856 852 return 0; 857 853 }
+1 -1
drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
··· 299 299 struct mdp5_interface *intf = mdp5_encoder->intf; 300 300 301 301 if (intf->mode == MDP5_INTF_DSI_MODE_COMMAND) 302 - mdp5_cmd_encoder_disable(encoder); 302 + mdp5_cmd_encoder_enable(encoder); 303 303 else 304 304 mdp5_vid_encoder_enable(encoder); 305 305 }
+6 -6
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
··· 502 502 const char *name, bool mandatory) 503 503 { 504 504 struct device *dev = &pdev->dev; 505 - struct clk *clk = devm_clk_get(dev, name); 505 + struct clk *clk = msm_clk_get(pdev, name); 506 506 if (IS_ERR(clk) && mandatory) { 507 507 dev_err(dev, "failed to get %s (%ld)\n", name, PTR_ERR(clk)); 508 508 return PTR_ERR(clk); ··· 887 887 } 888 888 889 889 /* mandatory clocks: */ 890 - ret = get_clk(pdev, &mdp5_kms->axi_clk, "bus_clk", true); 890 + ret = get_clk(pdev, &mdp5_kms->axi_clk, "bus", true); 891 891 if (ret) 892 892 goto fail; 893 - ret = get_clk(pdev, &mdp5_kms->ahb_clk, "iface_clk", true); 893 + ret = get_clk(pdev, &mdp5_kms->ahb_clk, "iface", true); 894 894 if (ret) 895 895 goto fail; 896 - ret = get_clk(pdev, &mdp5_kms->core_clk, "core_clk", true); 896 + ret = get_clk(pdev, &mdp5_kms->core_clk, "core", true); 897 897 if (ret) 898 898 goto fail; 899 - ret = get_clk(pdev, &mdp5_kms->vsync_clk, "vsync_clk", true); 899 + ret = get_clk(pdev, &mdp5_kms->vsync_clk, "vsync", true); 900 900 if (ret) 901 901 goto fail; 902 902 903 903 /* optional clocks: */ 904 - get_clk(pdev, &mdp5_kms->lut_clk, "lut_clk", false); 904 + get_clk(pdev, &mdp5_kms->lut_clk, "lut", false); 905 905 906 906 /* we need to set a default rate before enabling. Set a safe 907 907 * rate first, then figure out hw revision, and then set a
+2 -2
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
··· 890 890 struct mdp5_hw_pipe *right_hwpipe; 891 891 const struct mdp_format *format; 892 892 uint32_t nplanes, config = 0; 893 - struct phase_step step = { 0 }; 894 - struct pixel_ext pe = { 0 }; 893 + struct phase_step step = { { 0 } }; 894 + struct pixel_ext pe = { { 0 } }; 895 895 uint32_t hdecm = 0, vdecm = 0; 896 896 uint32_t pix_format; 897 897 unsigned int rotation;
+9 -3
drivers/gpu/drm/msm/msm_gem.c
··· 383 383 struct page **pages; 384 384 385 385 vma = add_vma(obj, aspace); 386 - if (IS_ERR(vma)) 387 - return PTR_ERR(vma); 386 + if (IS_ERR(vma)) { 387 + ret = PTR_ERR(vma); 388 + goto unlock; 389 + } 388 390 389 391 pages = get_pages(obj); 390 392 if (IS_ERR(pages)) { ··· 407 405 408 406 fail: 409 407 del_vma(vma); 410 - 408 + unlock: 411 409 mutex_unlock(&msm_obj->lock); 412 410 return ret; 413 411 } ··· 930 928 if (use_vram) { 931 929 struct msm_gem_vma *vma; 932 930 struct page **pages; 931 + struct msm_gem_object *msm_obj = to_msm_bo(obj); 932 + 933 + mutex_lock(&msm_obj->lock); 933 934 934 935 vma = add_vma(obj, NULL); 936 + mutex_unlock(&msm_obj->lock); 935 937 if (IS_ERR(vma)) { 936 938 ret = PTR_ERR(vma); 937 939 goto fail;
+3 -3
drivers/gpu/drm/msm/msm_gem_submit.c
··· 34 34 struct msm_gpu *gpu, uint32_t nr_bos, uint32_t nr_cmds) 35 35 { 36 36 struct msm_gem_submit *submit; 37 - uint64_t sz = sizeof(*submit) + (nr_bos * sizeof(submit->bos[0])) + 38 - (nr_cmds * sizeof(submit->cmd[0])); 37 + uint64_t sz = sizeof(*submit) + ((u64)nr_bos * sizeof(submit->bos[0])) + 38 + ((u64)nr_cmds * sizeof(submit->cmd[0])); 39 39 40 40 if (sz > SIZE_MAX) 41 41 return NULL; ··· 451 451 if (ret) 452 452 goto out; 453 453 454 - if (!(args->fence & MSM_SUBMIT_NO_IMPLICIT)) { 454 + if (!(args->flags & MSM_SUBMIT_NO_IMPLICIT)) { 455 455 ret = submit_fence_sync(submit); 456 456 if (ret) 457 457 goto out;
+1 -1
drivers/gpu/drm/msm/msm_gem_vma.c
··· 42 42 msm_gem_unmap_vma(struct msm_gem_address_space *aspace, 43 43 struct msm_gem_vma *vma, struct sg_table *sgt) 44 44 { 45 - if (!vma->iova) 45 + if (!aspace || !vma->iova) 46 46 return; 47 47 48 48 if (aspace->mmu) {
+2
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c
··· 267 267 /* Create output path objects for each VBIOS display path. */ 268 268 i = -1; 269 269 while ((data = dcb_outp_parse(bios, ++i, &ver, &hdr, &dcbE))) { 270 + if (ver < 0x40) /* No support for chipsets prior to NV50. */ 271 + break; 270 272 if (dcbE.type == DCB_OUTPUT_UNUSED) 271 273 continue; 272 274 if (dcbE.type == DCB_OUTPUT_EOL)
+20 -21
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
··· 500 500 static int vop_enable(struct drm_crtc *crtc) 501 501 { 502 502 struct vop *vop = to_vop(crtc); 503 - int ret; 503 + int ret, i; 504 504 505 505 ret = pm_runtime_get_sync(vop->dev); 506 506 if (ret < 0) { ··· 533 533 } 534 534 535 535 memcpy(vop->regs, vop->regsbak, vop->len); 536 + /* 537 + * We need to make sure that all windows are disabled before we 538 + * enable the crtc. Otherwise we might try to scan from a destroyed 539 + * buffer later. 540 + */ 541 + for (i = 0; i < vop->data->win_size; i++) { 542 + struct vop_win *vop_win = &vop->win[i]; 543 + const struct vop_win_data *win = vop_win->data; 544 + 545 + spin_lock(&vop->reg_lock); 546 + VOP_WIN_SET(vop, win, enable, 0); 547 + spin_unlock(&vop->reg_lock); 548 + } 549 + 536 550 vop_cfg_done(vop); 537 551 538 552 /* ··· 580 566 static void vop_crtc_disable(struct drm_crtc *crtc) 581 567 { 582 568 struct vop *vop = to_vop(crtc); 583 - int i; 584 569 585 570 WARN_ON(vop->event); 586 571 587 572 rockchip_drm_psr_deactivate(&vop->crtc); 588 - 589 - /* 590 - * We need to make sure that all windows are disabled before we 591 - * disable that crtc. Otherwise we might try to scan from a destroyed 592 - * buffer later. 593 - */ 594 - for (i = 0; i < vop->data->win_size; i++) { 595 - struct vop_win *vop_win = &vop->win[i]; 596 - const struct vop_win_data *win = vop_win->data; 597 - 598 - spin_lock(&vop->reg_lock); 599 - VOP_WIN_SET(vop, win, enable, 0); 600 - spin_unlock(&vop->reg_lock); 601 - } 602 - 603 - vop_cfg_done(vop); 604 573 605 574 drm_crtc_vblank_off(crtc); 606 575 ··· 679 682 * Src.x1 can be odd when do clip, but yuv plane start point 680 683 * need align with 2 pixel. 681 684 */ 682 - if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2)) 685 + if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2)) { 686 + DRM_ERROR("Invalid Source: Yuv format not support odd xpos\n"); 683 687 return -EINVAL; 688 + } 684 689 685 690 return 0; 686 691 } ··· 763 764 spin_lock(&vop->reg_lock); 764 765 765 766 VOP_WIN_SET(vop, win, format, format); 766 - VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> 2); 767 + VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4)); 767 768 VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); 768 769 if (is_yuv_support(fb->format->format)) { 769 770 int hsub = drm_format_horz_chroma_subsampling(fb->format->format); ··· 777 778 offset += (src->y1 >> 16) * fb->pitches[1] / vsub; 778 779 779 780 dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1]; 780 - VOP_WIN_SET(vop, win, uv_vir, fb->pitches[1] >> 2); 781 + VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4)); 781 782 VOP_WIN_SET(vop, win, uv_mst, dma_addr); 782 783 } 783 784
+3
drivers/gpu/drm/rockchip/rockchip_drm_vop.h
··· 282 282 283 283 act_height = (src_h + vskiplines - 1) / vskiplines; 284 284 285 + if (act_height == dst_h) 286 + return GET_SCL_FT_BILI_DN(src_h, dst_h) / vskiplines; 287 + 285 288 return GET_SCL_FT_BILI_DN(act_height, dst_h); 286 289 } 287 290
-1
drivers/gpu/drm/stm/Kconfig
··· 7 7 select DRM_PANEL 8 8 select VIDEOMODE_HELPERS 9 9 select FB_PROVIDE_GET_FB_UNMAPPED_AREA 10 - default y 11 10 12 11 help 13 12 Enable support for the on-chip display controller on
+4
drivers/net/ethernet/broadcom/bcmsysport.c
··· 449 449 p = (char *)&dev->stats; 450 450 else 451 451 p = (char *)priv; 452 + 453 + if (priv->is_lite && !bcm_sysport_lite_stat_valid(s->type)) 454 + continue; 455 + 452 456 p += s->stat_offset; 453 457 data[j] = *(unsigned long *)p; 454 458 j++;
+1 -1
drivers/net/geneve.c
··· 1091 1091 if (data[IFLA_GENEVE_ID]) { 1092 1092 __u32 vni = nla_get_u32(data[IFLA_GENEVE_ID]); 1093 1093 1094 - if (vni >= GENEVE_VID_MASK) 1094 + if (vni >= GENEVE_N_VID) 1095 1095 return -ERANGE; 1096 1096 } 1097 1097
+35
drivers/pci/pci.c
··· 4260 4260 EXPORT_SYMBOL_GPL(pci_reset_function); 4261 4261 4262 4262 /** 4263 + * pci_reset_function_locked - quiesce and reset a PCI device function 4264 + * @dev: PCI device to reset 4265 + * 4266 + * Some devices allow an individual function to be reset without affecting 4267 + * other functions in the same device. The PCI device must be responsive 4268 + * to PCI config space in order to use this function. 4269 + * 4270 + * This function does not just reset the PCI portion of a device, but 4271 + * clears all the state associated with the device. This function differs 4272 + * from __pci_reset_function() in that it saves and restores device state 4273 + * over the reset. It also differs from pci_reset_function() in that it 4274 + * requires the PCI device lock to be held. 4275 + * 4276 + * Returns 0 if the device function was successfully reset or negative if the 4277 + * device doesn't support resetting a single function. 4278 + */ 4279 + int pci_reset_function_locked(struct pci_dev *dev) 4280 + { 4281 + int rc; 4282 + 4283 + rc = pci_probe_reset_function(dev); 4284 + if (rc) 4285 + return rc; 4286 + 4287 + pci_dev_save_and_disable(dev); 4288 + 4289 + rc = __pci_reset_function_locked(dev); 4290 + 4291 + pci_dev_restore(dev); 4292 + 4293 + return rc; 4294 + } 4295 + EXPORT_SYMBOL_GPL(pci_reset_function_locked); 4296 + 4297 + /** 4263 4298 * pci_try_reset_function - quiesce and reset a PCI device function 4264 4299 * @dev: PCI device to reset 4265 4300 *
+20
drivers/usb/host/pci-quirks.c
··· 1150 1150 } 1151 1151 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, 1152 1152 PCI_CLASS_SERIAL_USB, 8, quirk_usb_early_handoff); 1153 + 1154 + bool usb_xhci_needs_pci_reset(struct pci_dev *pdev) 1155 + { 1156 + /* 1157 + * Our dear uPD72020{1,2} friend only partially resets when 1158 + * asked to via the XHCI interface, and may end up doing DMA 1159 + * at the wrong addresses, as it keeps the top 32bit of some 1160 + * addresses from its previous programming under obscure 1161 + * circumstances. 1162 + * Give it a good wack at probe time. Unfortunately, this 1163 + * needs to happen before we've had a chance to discover any 1164 + * quirk, or the system will be in a rather bad state. 1165 + */ 1166 + if (pdev->vendor == PCI_VENDOR_ID_RENESAS && 1167 + (pdev->device == 0x0014 || pdev->device == 0x0015)) 1168 + return true; 1169 + 1170 + return false; 1171 + } 1172 + EXPORT_SYMBOL_GPL(usb_xhci_needs_pci_reset);
+1
drivers/usb/host/pci-quirks.h
··· 15 15 void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev); 16 16 void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); 17 17 void sb800_prefetch(struct device *dev, int on); 18 + bool usb_xhci_needs_pci_reset(struct pci_dev *pdev); 18 19 #else 19 20 struct pci_dev; 20 21 static inline void usb_amd_quirk_pll_disable(void) {}
+7
drivers/usb/host/xhci-pci.c
··· 284 284 285 285 driver = (struct hc_driver *)id->driver_data; 286 286 287 + /* For some HW implementation, a XHCI reset is just not enough... */ 288 + if (usb_xhci_needs_pci_reset(dev)) { 289 + dev_info(&dev->dev, "Resetting\n"); 290 + if (pci_reset_function_locked(dev)) 291 + dev_warn(&dev->dev, "Reset failed"); 292 + } 293 + 287 294 /* Prevent runtime suspending between USB-2 and USB-3 initialization */ 288 295 pm_runtime_get_noresume(&dev->dev); 289 296
+4 -4
fs/proc/meminfo.c
··· 106 106 global_node_page_state(NR_FILE_MAPPED)); 107 107 show_val_kb(m, "Shmem: ", i.sharedram); 108 108 show_val_kb(m, "Slab: ", 109 - global_page_state(NR_SLAB_RECLAIMABLE) + 110 - global_page_state(NR_SLAB_UNRECLAIMABLE)); 109 + global_node_page_state(NR_SLAB_RECLAIMABLE) + 110 + global_node_page_state(NR_SLAB_UNRECLAIMABLE)); 111 111 112 112 show_val_kb(m, "SReclaimable: ", 113 - global_page_state(NR_SLAB_RECLAIMABLE)); 113 + global_node_page_state(NR_SLAB_RECLAIMABLE)); 114 114 show_val_kb(m, "SUnreclaim: ", 115 - global_page_state(NR_SLAB_UNRECLAIMABLE)); 115 + global_node_page_state(NR_SLAB_UNRECLAIMABLE)); 116 116 seq_printf(m, "KernelStack: %8lu kB\n", 117 117 global_page_state(NR_KERNEL_STACK_KB)); 118 118 show_val_kb(m, "PageTables: ",
+5 -2
fs/proc/task_mmu.c
··· 16 16 #include <linux/mmu_notifier.h> 17 17 #include <linux/page_idle.h> 18 18 #include <linux/shmem_fs.h> 19 + #include <linux/uaccess.h> 19 20 20 21 #include <asm/elf.h> 21 - #include <linux/uaccess.h> 22 + #include <asm/tlb.h> 22 23 #include <asm/tlbflush.h> 23 24 #include "internal.h" 24 25 ··· 1009 1008 struct mm_struct *mm; 1010 1009 struct vm_area_struct *vma; 1011 1010 enum clear_refs_types type; 1011 + struct mmu_gather tlb; 1012 1012 int itype; 1013 1013 int rv; 1014 1014 ··· 1056 1054 } 1057 1055 1058 1056 down_read(&mm->mmap_sem); 1057 + tlb_gather_mmu(&tlb, mm, 0, -1); 1059 1058 if (type == CLEAR_REFS_SOFT_DIRTY) { 1060 1059 for (vma = mm->mmap; vma; vma = vma->vm_next) { 1061 1060 if (!(vma->vm_flags & VM_SOFTDIRTY)) ··· 1078 1075 walk_page_range(0, mm->highest_vm_end, &clear_refs_walk); 1079 1076 if (type == CLEAR_REFS_SOFT_DIRTY) 1080 1077 mmu_notifier_invalidate_range_end(mm, 0, -1); 1081 - flush_tlb_mm(mm); 1078 + tlb_finish_mmu(&tlb, 0, -1); 1082 1079 up_read(&mm->mmap_sem); 1083 1080 out_mm: 1084 1081 mmput(mm);
+2 -2
fs/userfaultfd.c
··· 1597 1597 uffdio_copy.len); 1598 1598 mmput(ctx->mm); 1599 1599 } else { 1600 - return -ENOSPC; 1600 + return -ESRCH; 1601 1601 } 1602 1602 if (unlikely(put_user(ret, &user_uffdio_copy->copy))) 1603 1603 return -EFAULT; ··· 1644 1644 uffdio_zeropage.range.len); 1645 1645 mmput(ctx->mm); 1646 1646 } else { 1647 - return -ENOSPC; 1647 + return -ESRCH; 1648 1648 } 1649 1649 if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage))) 1650 1650 return -EFAULT;
+4 -3
include/asm-generic/tlb.h
··· 112 112 113 113 #define HAVE_GENERIC_MMU_GATHER 114 114 115 - void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end); 115 + void arch_tlb_gather_mmu(struct mmu_gather *tlb, 116 + struct mm_struct *mm, unsigned long start, unsigned long end); 116 117 void tlb_flush_mmu(struct mmu_gather *tlb); 117 - void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, 118 - unsigned long end); 118 + void arch_tlb_finish_mmu(struct mmu_gather *tlb, 119 + unsigned long start, unsigned long end, bool force); 119 120 extern bool __tlb_remove_page_size(struct mmu_gather *tlb, struct page *page, 120 121 int page_size); 121 122
+40 -26
include/linux/mm_types.h
··· 487 487 /* numa_scan_seq prevents two threads setting pte_numa */ 488 488 int numa_scan_seq; 489 489 #endif 490 - #if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION) 491 490 /* 492 491 * An operation with batched TLB flushing is going on. Anything that 493 492 * can move process memory needs to flush the TLB when moving a 494 493 * PROT_NONE or PROT_NUMA mapped page. 495 494 */ 496 - bool tlb_flush_pending; 497 - #endif 495 + atomic_t tlb_flush_pending; 498 496 #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH 499 497 /* See flush_tlb_batched_pending() */ 500 498 bool tlb_flush_batched; ··· 520 522 return mm->cpu_vm_mask_var; 521 523 } 522 524 523 - #if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION) 525 + struct mmu_gather; 526 + extern void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 527 + unsigned long start, unsigned long end); 528 + extern void tlb_finish_mmu(struct mmu_gather *tlb, 529 + unsigned long start, unsigned long end); 530 + 524 531 /* 525 532 * Memory barriers to keep this state in sync are graciously provided by 526 533 * the page table locks, outside of which no page table modifications happen. 527 - * The barriers below prevent the compiler from re-ordering the instructions 528 - * around the memory barriers that are already present in the code. 534 + * The barriers are used to ensure the order between tlb_flush_pending updates, 535 + * which happen while the lock is not taken, and the PTE updates, which happen 536 + * while the lock is taken, are serialized. 529 537 */ 530 538 static inline bool mm_tlb_flush_pending(struct mm_struct *mm) 531 539 { ··· 539 535 * Must be called with PTL held; such that our PTL acquire will have 540 536 * observed the store from set_tlb_flush_pending(). 541 537 */ 542 - return mm->tlb_flush_pending; 538 + return atomic_read(&mm->tlb_flush_pending) > 0; 543 539 } 544 - static inline void set_tlb_flush_pending(struct mm_struct *mm) 540 + 541 + /* 542 + * Returns true if there are two above TLB batching threads in parallel. 543 + */ 544 + static inline bool mm_tlb_flush_nested(struct mm_struct *mm) 545 545 { 546 - mm->tlb_flush_pending = true; 546 + return atomic_read(&mm->tlb_flush_pending) > 1; 547 + } 548 + 549 + static inline void init_tlb_flush_pending(struct mm_struct *mm) 550 + { 551 + atomic_set(&mm->tlb_flush_pending, 0); 552 + } 553 + 554 + static inline void inc_tlb_flush_pending(struct mm_struct *mm) 555 + { 556 + atomic_inc(&mm->tlb_flush_pending); 557 + 547 558 /* 548 559 * The only time this value is relevant is when there are indeed pages 549 560 * to flush. And we'll only flush pages after changing them, which ··· 566 547 * 567 548 * So the ordering here is: 568 549 * 569 - * mm->tlb_flush_pending = true; 550 + * atomic_inc(&mm->tlb_flush_pending); 570 551 * spin_lock(&ptl); 571 552 * ... 572 553 * set_pte_at(); ··· 578 559 * spin_unlock(&ptl); 579 560 * 580 561 * flush_tlb_range(); 581 - * mm->tlb_flush_pending = false; 562 + * atomic_dec(&mm->tlb_flush_pending); 582 563 * 583 564 * So the =true store is constrained by the PTL unlock, and the =false 584 565 * store is constrained by the TLB invalidate. 585 566 */ 586 567 } 568 + 587 569 /* Clearing is done after a TLB flush, which also provides a barrier. */ 588 - static inline void clear_tlb_flush_pending(struct mm_struct *mm) 570 + static inline void dec_tlb_flush_pending(struct mm_struct *mm) 589 571 { 590 - /* see set_tlb_flush_pending */ 591 - mm->tlb_flush_pending = false; 572 + /* 573 + * Guarantee that the tlb_flush_pending does not not leak into the 574 + * critical section, since we must order the PTE change and changes to 575 + * the pending TLB flush indication. We could have relied on TLB flush 576 + * as a memory barrier, but this behavior is not clearly documented. 577 + */ 578 + smp_mb__before_atomic(); 579 + atomic_dec(&mm->tlb_flush_pending); 592 580 } 593 - #else 594 - static inline bool mm_tlb_flush_pending(struct mm_struct *mm) 595 - { 596 - return false; 597 - } 598 - static inline void set_tlb_flush_pending(struct mm_struct *mm) 599 - { 600 - } 601 - static inline void clear_tlb_flush_pending(struct mm_struct *mm) 602 - { 603 - } 604 - #endif 605 581 606 582 struct vm_fault; 607 583
+1
include/linux/pci.h
··· 1067 1067 int __pci_reset_function(struct pci_dev *dev); 1068 1068 int __pci_reset_function_locked(struct pci_dev *dev); 1069 1069 int pci_reset_function(struct pci_dev *dev); 1070 + int pci_reset_function_locked(struct pci_dev *dev); 1070 1071 int pci_try_reset_function(struct pci_dev *dev); 1071 1072 int pci_probe_reset_slot(struct pci_slot *slot); 1072 1073 int pci_reset_slot(struct pci_slot *slot);
+2 -1
include/linux/sync_file.h
··· 43 43 #endif 44 44 45 45 wait_queue_head_t wq; 46 + unsigned long flags; 46 47 47 48 struct dma_fence *fence; 48 49 struct dma_fence_cb cb; 49 50 }; 50 51 51 - #define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS 52 + #define POLL_ENABLED 0 52 53 53 54 struct sync_file *sync_file_create(struct dma_fence *fence); 54 55 struct dma_fence *sync_file_get_fence(int fd);
+3 -3
include/uapi/drm/msm_drm.h
··· 171 171 __u32 size; /* in, cmdstream size */ 172 172 __u32 pad; 173 173 __u32 nr_relocs; /* in, number of submit_reloc's */ 174 - __u64 __user relocs; /* in, ptr to array of submit_reloc's */ 174 + __u64 relocs; /* in, ptr to array of submit_reloc's */ 175 175 }; 176 176 177 177 /* Each buffer referenced elsewhere in the cmdstream submit (ie. the ··· 215 215 __u32 fence; /* out */ 216 216 __u32 nr_bos; /* in, number of submit_bo's */ 217 217 __u32 nr_cmds; /* in, number of submit_cmd's */ 218 - __u64 __user bos; /* in, ptr to array of submit_bo's */ 219 - __u64 __user cmds; /* in, ptr to array of submit_cmd's */ 218 + __u64 bos; /* in, ptr to array of submit_bo's */ 219 + __u64 cmds; /* in, ptr to array of submit_cmd's */ 220 220 __s32 fence_fd; /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN/OUT) */ 221 221 }; 222 222
+1 -1
kernel/fork.c
··· 809 809 mm_init_aio(mm); 810 810 mm_init_owner(mm, p); 811 811 mmu_notifier_mm_init(mm); 812 - clear_tlb_flush_pending(mm); 812 + init_tlb_flush_pending(mm); 813 813 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS 814 814 mm->pmd_huge_pte = NULL; 815 815 #endif
+1 -1
kernel/power/snapshot.c
··· 1650 1650 { 1651 1651 unsigned long size; 1652 1652 1653 - size = global_page_state(NR_SLAB_RECLAIMABLE) 1653 + size = global_node_page_state(NR_SLAB_RECLAIMABLE) 1654 1654 + global_node_page_state(NR_ACTIVE_ANON) 1655 1655 + global_node_page_state(NR_INACTIVE_ANON) 1656 1656 + global_node_page_state(NR_ACTIVE_FILE)
+5 -3
lib/fault-inject.c
··· 110 110 if (in_task()) { 111 111 unsigned int fail_nth = READ_ONCE(current->fail_nth); 112 112 113 - if (fail_nth && !WRITE_ONCE(current->fail_nth, fail_nth - 1)) 114 - goto fail; 113 + if (fail_nth) { 114 + if (!WRITE_ONCE(current->fail_nth, fail_nth - 1)) 115 + goto fail; 115 116 116 - return false; 117 + return false; 118 + } 117 119 } 118 120 119 121 /* No need to check any other properties if the probability is 0 */
+8 -8
lib/test_kmod.c
··· 485 485 config->test_driver); 486 486 else 487 487 len += snprintf(buf+len, PAGE_SIZE - len, 488 - "driver:\tEMTPY\n"); 488 + "driver:\tEMPTY\n"); 489 489 490 490 if (config->test_fs) 491 491 len += snprintf(buf+len, PAGE_SIZE - len, ··· 493 493 config->test_fs); 494 494 else 495 495 len += snprintf(buf+len, PAGE_SIZE - len, 496 - "fs:\tEMTPY\n"); 496 + "fs:\tEMPTY\n"); 497 497 498 498 mutex_unlock(&test_dev->config_mutex); 499 499 ··· 746 746 strlen(test_str)); 747 747 break; 748 748 case TEST_KMOD_FS_TYPE: 749 - break; 750 749 kfree_const(config->test_fs); 751 750 config->test_driver = NULL; 752 751 copied = config_copy_test_fs(config, test_str, 753 752 strlen(test_str)); 753 + break; 754 754 default: 755 755 mutex_unlock(&test_dev->config_mutex); 756 756 return -EINVAL; ··· 880 880 int (*test_sync)(struct kmod_test_device *test_dev)) 881 881 { 882 882 int ret; 883 - long new; 883 + unsigned long new; 884 884 unsigned int old_val; 885 885 886 - ret = kstrtol(buf, 10, &new); 886 + ret = kstrtoul(buf, 10, &new); 887 887 if (ret) 888 888 return ret; 889 889 ··· 918 918 unsigned int max) 919 919 { 920 920 int ret; 921 - long new; 921 + unsigned long new; 922 922 923 - ret = kstrtol(buf, 10, &new); 923 + ret = kstrtoul(buf, 10, &new); 924 924 if (ret) 925 925 return ret; 926 926 ··· 1146 1146 struct kmod_test_device *test_dev = NULL; 1147 1147 int ret; 1148 1148 1149 - mutex_unlock(&reg_dev_mutex); 1149 + mutex_lock(&reg_dev_mutex); 1150 1150 1151 1151 /* int should suffice for number of devices, test for wrap */ 1152 1152 if (unlikely(num_test_devs + 1) < 0) {
+1 -1
mm/balloon_compaction.c
··· 24 24 { 25 25 unsigned long flags; 26 26 struct page *page = alloc_page(balloon_mapping_gfp_mask() | 27 - __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_ZERO); 27 + __GFP_NOMEMALLOC | __GFP_NORETRY); 28 28 if (!page) 29 29 return NULL; 30 30
+1 -5
mm/debug.c
··· 124 124 #ifdef CONFIG_NUMA_BALANCING 125 125 "numa_next_scan %lu numa_scan_offset %lu numa_scan_seq %d\n" 126 126 #endif 127 - #if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION) 128 127 "tlb_flush_pending %d\n" 129 - #endif 130 128 "def_flags: %#lx(%pGv)\n", 131 129 132 130 mm, mm->mmap, mm->vmacache_seqnum, mm->task_size, ··· 156 158 #ifdef CONFIG_NUMA_BALANCING 157 159 mm->numa_next_scan, mm->numa_scan_offset, mm->numa_scan_seq, 158 160 #endif 159 - #if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION) 160 - mm->tlb_flush_pending, 161 - #endif 161 + atomic_read(&mm->tlb_flush_pending), 162 162 mm->def_flags, &mm->def_flags 163 163 ); 164 164 }
+7
mm/huge_memory.c
··· 1497 1497 } 1498 1498 1499 1499 /* 1500 + * The page_table_lock above provides a memory barrier 1501 + * with change_protection_range. 1502 + */ 1503 + if (mm_tlb_flush_pending(vma->vm_mm)) 1504 + flush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE); 1505 + 1506 + /* 1500 1507 * Since we took the NUMA fault, we must have observed the !accessible 1501 1508 * bit. Make sure all other CPUs agree with that, to avoid them 1502 1509 * modifying the page we're about to migrate.
+1 -1
mm/hugetlb.c
··· 4062 4062 return ret; 4063 4063 out_release_unlock: 4064 4064 spin_unlock(ptl); 4065 - out_release_nounlock: 4066 4065 if (vm_shared) 4067 4066 unlock_page(page); 4067 + out_release_nounlock: 4068 4068 put_page(page); 4069 4069 goto out; 4070 4070 }
+2 -1
mm/ksm.c
··· 1038 1038 goto out_unlock; 1039 1039 1040 1040 if (pte_write(*pvmw.pte) || pte_dirty(*pvmw.pte) || 1041 - (pte_protnone(*pvmw.pte) && pte_savedwrite(*pvmw.pte))) { 1041 + (pte_protnone(*pvmw.pte) && pte_savedwrite(*pvmw.pte)) || 1042 + mm_tlb_flush_pending(mm)) { 1042 1043 pte_t entry; 1043 1044 1044 1045 swapped = PageSwapCache(page);
+35 -7
mm/memory.c
··· 215 215 return true; 216 216 } 217 217 218 - /* tlb_gather_mmu 219 - * Called to initialize an (on-stack) mmu_gather structure for page-table 220 - * tear-down from @mm. The @fullmm argument is used when @mm is without 221 - * users and we're going to destroy the full address space (exit/execve). 222 - */ 223 - void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) 218 + void arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 219 + unsigned long start, unsigned long end) 224 220 { 225 221 tlb->mm = mm; 226 222 ··· 271 275 * Called at the end of the shootdown operation to free up any resources 272 276 * that were required. 273 277 */ 274 - void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 278 + void arch_tlb_finish_mmu(struct mmu_gather *tlb, 279 + unsigned long start, unsigned long end, bool force) 275 280 { 276 281 struct mmu_gather_batch *batch, *next; 282 + 283 + if (force) 284 + __tlb_adjust_range(tlb, start, end - start); 277 285 278 286 tlb_flush_mmu(tlb); 279 287 ··· 397 397 } 398 398 399 399 #endif /* CONFIG_HAVE_RCU_TABLE_FREE */ 400 + 401 + /* tlb_gather_mmu 402 + * Called to initialize an (on-stack) mmu_gather structure for page-table 403 + * tear-down from @mm. The @fullmm argument is used when @mm is without 404 + * users and we're going to destroy the full address space (exit/execve). 405 + */ 406 + void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, 407 + unsigned long start, unsigned long end) 408 + { 409 + arch_tlb_gather_mmu(tlb, mm, start, end); 410 + inc_tlb_flush_pending(tlb->mm); 411 + } 412 + 413 + void tlb_finish_mmu(struct mmu_gather *tlb, 414 + unsigned long start, unsigned long end) 415 + { 416 + /* 417 + * If there are parallel threads are doing PTE changes on same range 418 + * under non-exclusive lock(e.g., mmap_sem read-side) but defer TLB 419 + * flush by batching, a thread has stable TLB entry can fail to flush 420 + * the TLB by observing pte_none|!pte_dirty, for example so flush TLB 421 + * forcefully if we detect parallel PTE batching threads. 422 + */ 423 + bool force = mm_tlb_flush_nested(tlb->mm); 424 + 425 + arch_tlb_finish_mmu(tlb, start, end, force); 426 + dec_tlb_flush_pending(tlb->mm); 427 + } 400 428 401 429 /* 402 430 * Note: this doesn't free the actual pages themselves. That
+2 -2
mm/mprotect.c
··· 244 244 BUG_ON(addr >= end); 245 245 pgd = pgd_offset(mm, addr); 246 246 flush_cache_range(vma, addr, end); 247 - set_tlb_flush_pending(mm); 247 + inc_tlb_flush_pending(mm); 248 248 do { 249 249 next = pgd_addr_end(addr, end); 250 250 if (pgd_none_or_clear_bad(pgd)) ··· 256 256 /* Only flush the TLB if we actually modified any entries: */ 257 257 if (pages) 258 258 flush_tlb_range(vma, start, end); 259 - clear_tlb_flush_pending(mm); 259 + dec_tlb_flush_pending(mm); 260 260 261 261 return pages; 262 262 }
+6 -5
mm/page_alloc.c
··· 4501 4501 * Part of the reclaimable slab consists of items that are in use, 4502 4502 * and cannot be freed. Cap this estimate at the low watermark. 4503 4503 */ 4504 - available += global_page_state(NR_SLAB_RECLAIMABLE) - 4505 - min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); 4504 + available += global_node_page_state(NR_SLAB_RECLAIMABLE) - 4505 + min(global_node_page_state(NR_SLAB_RECLAIMABLE) / 2, 4506 + wmark_low); 4506 4507 4507 4508 if (available < 0) 4508 4509 available = 0; ··· 4646 4645 global_node_page_state(NR_FILE_DIRTY), 4647 4646 global_node_page_state(NR_WRITEBACK), 4648 4647 global_node_page_state(NR_UNSTABLE_NFS), 4649 - global_page_state(NR_SLAB_RECLAIMABLE), 4650 - global_page_state(NR_SLAB_UNRECLAIMABLE), 4648 + global_node_page_state(NR_SLAB_RECLAIMABLE), 4649 + global_node_page_state(NR_SLAB_UNRECLAIMABLE), 4651 4650 global_node_page_state(NR_FILE_MAPPED), 4652 4651 global_node_page_state(NR_SHMEM), 4653 4652 global_page_state(NR_PAGETABLE), ··· 7712 7711 7713 7712 /* Make sure the range is really isolated. */ 7714 7713 if (test_pages_isolated(outer_start, end, false)) { 7715 - pr_info("%s: [%lx, %lx) PFNs busy\n", 7714 + pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n", 7716 7715 __func__, outer_start, end); 7717 7716 ret = -EBUSY; 7718 7717 goto done;
+30 -22
mm/rmap.c
··· 888 888 .flags = PVMW_SYNC, 889 889 }; 890 890 int *cleaned = arg; 891 + bool invalidation_needed = false; 891 892 892 893 while (page_vma_mapped_walk(&pvmw)) { 893 894 int ret = 0; 894 - address = pvmw.address; 895 895 if (pvmw.pte) { 896 896 pte_t entry; 897 897 pte_t *pte = pvmw.pte; ··· 899 899 if (!pte_dirty(*pte) && !pte_write(*pte)) 900 900 continue; 901 901 902 - flush_cache_page(vma, address, pte_pfn(*pte)); 903 - entry = ptep_clear_flush(vma, address, pte); 902 + flush_cache_page(vma, pvmw.address, pte_pfn(*pte)); 903 + entry = ptep_clear_flush(vma, pvmw.address, pte); 904 904 entry = pte_wrprotect(entry); 905 905 entry = pte_mkclean(entry); 906 - set_pte_at(vma->vm_mm, address, pte, entry); 906 + set_pte_at(vma->vm_mm, pvmw.address, pte, entry); 907 907 ret = 1; 908 908 } else { 909 909 #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE ··· 913 913 if (!pmd_dirty(*pmd) && !pmd_write(*pmd)) 914 914 continue; 915 915 916 - flush_cache_page(vma, address, page_to_pfn(page)); 917 - entry = pmdp_huge_clear_flush(vma, address, pmd); 916 + flush_cache_page(vma, pvmw.address, page_to_pfn(page)); 917 + entry = pmdp_huge_clear_flush(vma, pvmw.address, pmd); 918 918 entry = pmd_wrprotect(entry); 919 919 entry = pmd_mkclean(entry); 920 - set_pmd_at(vma->vm_mm, address, pmd, entry); 920 + set_pmd_at(vma->vm_mm, pvmw.address, pmd, entry); 921 921 ret = 1; 922 922 #else 923 923 /* unexpected pmd-mapped page? */ ··· 926 926 } 927 927 928 928 if (ret) { 929 - mmu_notifier_invalidate_page(vma->vm_mm, address); 930 929 (*cleaned)++; 930 + invalidation_needed = true; 931 931 } 932 + } 933 + 934 + if (invalidation_needed) { 935 + mmu_notifier_invalidate_range(vma->vm_mm, address, 936 + address + (1UL << compound_order(page))); 932 937 } 933 938 934 939 return true; ··· 1328 1323 }; 1329 1324 pte_t pteval; 1330 1325 struct page *subpage; 1331 - bool ret = true; 1326 + bool ret = true, invalidation_needed = false; 1332 1327 enum ttu_flags flags = (enum ttu_flags)arg; 1333 1328 1334 1329 /* munlock has nothing to gain from examining un-locked vmas */ ··· 1368 1363 VM_BUG_ON_PAGE(!pvmw.pte, page); 1369 1364 1370 1365 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte); 1371 - address = pvmw.address; 1372 - 1373 1366 1374 1367 if (!(flags & TTU_IGNORE_ACCESS)) { 1375 - if (ptep_clear_flush_young_notify(vma, address, 1368 + if (ptep_clear_flush_young_notify(vma, pvmw.address, 1376 1369 pvmw.pte)) { 1377 1370 ret = false; 1378 1371 page_vma_mapped_walk_done(&pvmw); ··· 1379 1376 } 1380 1377 1381 1378 /* Nuke the page table entry. */ 1382 - flush_cache_page(vma, address, pte_pfn(*pvmw.pte)); 1379 + flush_cache_page(vma, pvmw.address, pte_pfn(*pvmw.pte)); 1383 1380 if (should_defer_flush(mm, flags)) { 1384 1381 /* 1385 1382 * We clear the PTE but do not flush so potentially ··· 1389 1386 * transition on a cached TLB entry is written through 1390 1387 * and traps if the PTE is unmapped. 1391 1388 */ 1392 - pteval = ptep_get_and_clear(mm, address, pvmw.pte); 1389 + pteval = ptep_get_and_clear(mm, pvmw.address, 1390 + pvmw.pte); 1393 1391 1394 1392 set_tlb_ubc_flush_pending(mm, pte_dirty(pteval)); 1395 1393 } else { 1396 - pteval = ptep_clear_flush(vma, address, pvmw.pte); 1394 + pteval = ptep_clear_flush(vma, pvmw.address, pvmw.pte); 1397 1395 } 1398 1396 1399 1397 /* Move the dirty bit to the page. Now the pte is gone. */ ··· 1409 1405 if (PageHuge(page)) { 1410 1406 int nr = 1 << compound_order(page); 1411 1407 hugetlb_count_sub(nr, mm); 1412 - set_huge_swap_pte_at(mm, address, 1408 + set_huge_swap_pte_at(mm, pvmw.address, 1413 1409 pvmw.pte, pteval, 1414 1410 vma_mmu_pagesize(vma)); 1415 1411 } else { 1416 1412 dec_mm_counter(mm, mm_counter(page)); 1417 - set_pte_at(mm, address, pvmw.pte, pteval); 1413 + set_pte_at(mm, pvmw.address, pvmw.pte, pteval); 1418 1414 } 1419 1415 1420 1416 } else if (pte_unused(pteval)) { ··· 1438 1434 swp_pte = swp_entry_to_pte(entry); 1439 1435 if (pte_soft_dirty(pteval)) 1440 1436 swp_pte = pte_swp_mksoft_dirty(swp_pte); 1441 - set_pte_at(mm, address, pvmw.pte, swp_pte); 1437 + set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); 1442 1438 } else if (PageAnon(page)) { 1443 1439 swp_entry_t entry = { .val = page_private(subpage) }; 1444 1440 pte_t swp_pte; ··· 1464 1460 * If the page was redirtied, it cannot be 1465 1461 * discarded. Remap the page to page table. 1466 1462 */ 1467 - set_pte_at(mm, address, pvmw.pte, pteval); 1463 + set_pte_at(mm, pvmw.address, pvmw.pte, pteval); 1468 1464 SetPageSwapBacked(page); 1469 1465 ret = false; 1470 1466 page_vma_mapped_walk_done(&pvmw); ··· 1472 1468 } 1473 1469 1474 1470 if (swap_duplicate(entry) < 0) { 1475 - set_pte_at(mm, address, pvmw.pte, pteval); 1471 + set_pte_at(mm, pvmw.address, pvmw.pte, pteval); 1476 1472 ret = false; 1477 1473 page_vma_mapped_walk_done(&pvmw); 1478 1474 break; ··· 1488 1484 swp_pte = swp_entry_to_pte(entry); 1489 1485 if (pte_soft_dirty(pteval)) 1490 1486 swp_pte = pte_swp_mksoft_dirty(swp_pte); 1491 - set_pte_at(mm, address, pvmw.pte, swp_pte); 1487 + set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); 1492 1488 } else 1493 1489 dec_mm_counter(mm, mm_counter_file(page)); 1494 1490 discard: 1495 1491 page_remove_rmap(subpage, PageHuge(page)); 1496 1492 put_page(page); 1497 - mmu_notifier_invalidate_page(mm, address); 1493 + invalidation_needed = true; 1498 1494 } 1495 + 1496 + if (invalidation_needed) 1497 + mmu_notifier_invalidate_range(mm, address, 1498 + address + (1UL << compound_order(page))); 1499 1499 return ret; 1500 1500 } 1501 1501
+10 -2
mm/shmem.c
··· 1022 1022 */ 1023 1023 if (IS_ENABLED(CONFIG_TRANSPARENT_HUGE_PAGECACHE)) { 1024 1024 spin_lock(&sbinfo->shrinklist_lock); 1025 - if (list_empty(&info->shrinklist)) { 1025 + /* 1026 + * _careful to defend against unlocked access to 1027 + * ->shrink_list in shmem_unused_huge_shrink() 1028 + */ 1029 + if (list_empty_careful(&info->shrinklist)) { 1026 1030 list_add_tail(&info->shrinklist, 1027 1031 &sbinfo->shrinklist); 1028 1032 sbinfo->shrinklist_len++; ··· 1821 1817 * to shrink under memory pressure. 1822 1818 */ 1823 1819 spin_lock(&sbinfo->shrinklist_lock); 1824 - if (list_empty(&info->shrinklist)) { 1820 + /* 1821 + * _careful to defend against unlocked access to 1822 + * ->shrink_list in shmem_unused_huge_shrink() 1823 + */ 1824 + if (list_empty_careful(&info->shrinklist)) { 1825 1825 list_add_tail(&info->shrinklist, 1826 1826 &sbinfo->shrinklist); 1827 1827 sbinfo->shrinklist_len++;
+1 -1
mm/util.c
··· 633 633 * which are reclaimable, under pressure. The dentry 634 634 * cache and most inode caches should fall into this 635 635 */ 636 - free += global_page_state(NR_SLAB_RECLAIMABLE); 636 + free += global_node_page_state(NR_SLAB_RECLAIMABLE); 637 637 638 638 /* 639 639 * Leave reserved pages. The pages are not for anonymous pages.
+7
net/ipv4/af_inet.c
··· 1731 1731 net->ipv4.sysctl_ip_prot_sock = PROT_SOCK; 1732 1732 #endif 1733 1733 1734 + /* Some igmp sysctl, whose values are always used */ 1735 + net->ipv4.sysctl_igmp_max_memberships = 20; 1736 + net->ipv4.sysctl_igmp_max_msf = 10; 1737 + /* IGMP reports for link-local multicast groups are enabled by default */ 1738 + net->ipv4.sysctl_igmp_llm_reports = 1; 1739 + net->ipv4.sysctl_igmp_qrv = 2; 1740 + 1734 1741 return 0; 1735 1742 } 1736 1743
-6
net/ipv4/igmp.c
··· 2974 2974 goto out_sock; 2975 2975 } 2976 2976 2977 - /* Sysctl initialization */ 2978 - net->ipv4.sysctl_igmp_max_memberships = 20; 2979 - net->ipv4.sysctl_igmp_max_msf = 10; 2980 - /* IGMP reports for link-local multicast groups are enabled by default */ 2981 - net->ipv4.sysctl_igmp_llm_reports = 1; 2982 - net->ipv4.sysctl_igmp_qrv = 2; 2983 2977 return 0; 2984 2978 2985 2979 out_sock:
+5 -3
net/ipv4/ip_output.c
··· 965 965 csummode = CHECKSUM_PARTIAL; 966 966 967 967 cork->length += length; 968 - if ((((length + (skb ? skb->len : fragheaderlen)) > mtu) || 969 - (skb && skb_is_gso(skb))) && 968 + if ((skb && skb_is_gso(skb)) || 969 + (((length + (skb ? skb->len : fragheaderlen)) > mtu) && 970 + (skb_queue_len(queue) <= 1) && 970 971 (sk->sk_protocol == IPPROTO_UDP) && 971 972 (rt->dst.dev->features & NETIF_F_UFO) && !dst_xfrm(&rt->dst) && 972 - (sk->sk_type == SOCK_DGRAM) && !sk->sk_no_check_tx) { 973 + (sk->sk_type == SOCK_DGRAM) && !sk->sk_no_check_tx)) { 973 974 err = ip_ufo_append_data(sk, queue, getfrag, from, length, 974 975 hh_len, fragheaderlen, transhdrlen, 975 976 maxfraglen, flags); ··· 1289 1288 return -EINVAL; 1290 1289 1291 1290 if ((size + skb->len > mtu) && 1291 + (skb_queue_len(&sk->sk_write_queue) == 1) && 1292 1292 (sk->sk_protocol == IPPROTO_UDP) && 1293 1293 (rt->dst.dev->features & NETIF_F_UFO)) { 1294 1294 if (skb->ip_summed != CHECKSUM_PARTIAL)
+1 -1
net/ipv4/udp.c
··· 802 802 if (is_udplite) /* UDP-Lite */ 803 803 csum = udplite_csum(skb); 804 804 805 - else if (sk->sk_no_check_tx) { /* UDP csum disabled */ 805 + else if (sk->sk_no_check_tx && !skb_is_gso(skb)) { /* UDP csum off */ 806 806 807 807 skb->ip_summed = CHECKSUM_NONE; 808 808 goto send;
+4 -3
net/ipv6/ip6_output.c
··· 1381 1381 */ 1382 1382 1383 1383 cork->length += length; 1384 - if ((((length + (skb ? skb->len : headersize)) > mtu) || 1385 - (skb && skb_is_gso(skb))) && 1384 + if ((skb && skb_is_gso(skb)) || 1385 + (((length + (skb ? skb->len : headersize)) > mtu) && 1386 + (skb_queue_len(queue) <= 1) && 1386 1387 (sk->sk_protocol == IPPROTO_UDP) && 1387 1388 (rt->dst.dev->features & NETIF_F_UFO) && !dst_xfrm(&rt->dst) && 1388 - (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk)) { 1389 + (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk))) { 1389 1390 err = ip6_ufo_append_data(sk, queue, getfrag, from, length, 1390 1391 hh_len, fragheaderlen, exthdrlen, 1391 1392 transhdrlen, mtu, flags, fl6);
+9 -4
net/packet/af_packet.c
··· 3700 3700 3701 3701 if (optlen != sizeof(val)) 3702 3702 return -EINVAL; 3703 - if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) 3704 - return -EBUSY; 3705 3703 if (copy_from_user(&val, optval, sizeof(val))) 3706 3704 return -EFAULT; 3707 3705 if (val > INT_MAX) 3708 3706 return -EINVAL; 3709 - po->tp_reserve = val; 3710 - return 0; 3707 + lock_sock(sk); 3708 + if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { 3709 + ret = -EBUSY; 3710 + } else { 3711 + po->tp_reserve = val; 3712 + ret = 0; 3713 + } 3714 + release_sock(sk); 3715 + return ret; 3711 3716 } 3712 3717 case PACKET_LOSS: 3713 3718 {
+1 -1
net/sched/act_ipt.c
··· 49 49 return PTR_ERR(target); 50 50 51 51 t->u.kernel.target = target; 52 + memset(&par, 0, sizeof(par)); 52 53 par.net = net; 53 54 par.table = table; 54 - par.entryinfo = NULL; 55 55 par.target = target; 56 56 par.targinfo = t->data; 57 57 par.hook_mask = hook;
+1 -3
net/tipc/node.c
··· 1455 1455 /* Initiate synch mode if applicable */ 1456 1456 if ((usr == TUNNEL_PROTOCOL) && (mtyp == SYNCH_MSG) && (oseqno == 1)) { 1457 1457 syncpt = iseqno + exp_pkts - 1; 1458 - if (!tipc_link_is_up(l)) { 1459 - tipc_link_fsm_evt(l, LINK_ESTABLISH_EVT); 1458 + if (!tipc_link_is_up(l)) 1460 1459 __tipc_node_link_up(n, bearer_id, xmitq); 1461 - } 1462 1460 if (n->state == SELF_UP_PEER_UP) { 1463 1461 n->sync_point = syncpt; 1464 1462 tipc_link_fsm_evt(l, LINK_SYNCH_BEGIN_EVT);