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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

No conflicts.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+934 -420
+5 -3
Documentation/i2c/summary.rst
··· 11 11 and so are not advertised as being I2C but come under different names, 12 12 e.g. TWI (Two Wire Interface), IIC. 13 13 14 - The official I2C specification is the `"I2C-bus specification and user 15 - manual" (UM10204) <https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_ 16 - published by NXP Semiconductors. 14 + The latest official I2C specification is the `"I2C-bus specification and user 15 + manual" (UM10204) <https://www.nxp.com/webapp/Download?colCode=UM10204>`_ 16 + published by NXP Semiconductors. However, you need to log-in to the site to 17 + access the PDF. An older version of the specification (revision 6) is archived 18 + `here <https://web.archive.org/web/20210813122132/https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_. 17 19 18 20 SMBus (System Management Bus) is based on the I2C protocol, and is mostly 19 21 a subset of I2C protocols and signaling. Many I2C devices will work on an
+2 -1
MAINTAINERS
··· 3769 3769 F: drivers/net/wireless/broadcom/brcm80211/ 3770 3770 3771 3771 BROADCOM BRCMSTB GPIO DRIVER 3772 - M: Gregory Fong <gregory.0xf0@gmail.com> 3772 + M: Doug Berger <opendmb@gmail.com> 3773 + M: Florian Fainelli <f.fainelli@gmail.com> 3773 3774 L: bcm-kernel-feedback-list@broadcom.com 3774 3775 S: Supported 3775 3776 F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 16 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc7 5 + EXTRAVERSION = -rc8 6 6 NAME = Gobble Gobble 7 7 8 8 # *DOCUMENTATION*
+1 -1
arch/x86/tools/relocs.c
··· 68 68 "(__parainstructions|__alt_instructions)(_end)?|" 69 69 "(__iommu_table|__apicdrivers|__smp_locks)(_end)?|" 70 70 "__(start|end)_pci_.*|" 71 - #if CONFIG_FW_LOADER_BUILTIN 71 + #if CONFIG_FW_LOADER 72 72 "__(start|end)_builtin_fw|" 73 73 #endif 74 74 "__(start|stop)___ksymtab(_gpl)?|"
+1 -1
drivers/gpio/gpio-aspeed-sgpio.c
··· 395 395 reg = ioread32(bank_reg(data, bank, reg_irq_status)); 396 396 397 397 for_each_set_bit(p, &reg, 32) 398 - generic_handle_domain_irq(gc->irq.domain, i * 32 + p * 2); 398 + generic_handle_domain_irq(gc->irq.domain, (i * 32 + p) * 2); 399 399 } 400 400 401 401 chained_irq_exit(ic, desc);
+8 -9
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 3166 3166 bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type) 3167 3167 { 3168 3168 switch (asic_type) { 3169 + #ifdef CONFIG_DRM_AMDGPU_SI 3170 + case CHIP_HAINAN: 3171 + #endif 3172 + case CHIP_TOPAZ: 3173 + /* chips with no display hardware */ 3174 + return false; 3169 3175 #if defined(CONFIG_DRM_AMD_DC) 3170 3176 case CHIP_TAHITI: 3171 3177 case CHIP_PITCAIRN: ··· 4467 4461 int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, 4468 4462 struct amdgpu_reset_context *reset_context) 4469 4463 { 4470 - int i, j, r = 0; 4464 + int i, r = 0; 4471 4465 struct amdgpu_job *job = NULL; 4472 4466 bool need_full_reset = 4473 4467 test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags); ··· 4489 4483 4490 4484 /*clear job fence from fence drv to avoid force_completion 4491 4485 *leave NULL and vm flush fence in fence drv */ 4492 - for (j = 0; j <= ring->fence_drv.num_fences_mask; j++) { 4493 - struct dma_fence *old, **ptr; 4486 + amdgpu_fence_driver_clear_job_fences(ring); 4494 4487 4495 - ptr = &ring->fence_drv.fences[j]; 4496 - old = rcu_dereference_protected(*ptr, 1); 4497 - if (old && test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &old->flags)) { 4498 - RCU_INIT_POINTER(*ptr, NULL); 4499 - } 4500 - } 4501 4488 /* after all hw jobs are reset, hw fence is meaningless, so force_completion */ 4502 4489 amdgpu_fence_driver_force_completion(ring); 4503 4490 }
+54 -22
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
··· 526 526 } 527 527 } 528 528 529 + union gc_info { 530 + struct gc_info_v1_0 v1; 531 + struct gc_info_v2_0 v2; 532 + }; 533 + 529 534 int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) 530 535 { 531 536 struct binary_header *bhdr; 532 - struct gc_info_v1_0 *gc_info; 537 + union gc_info *gc_info; 533 538 534 539 if (!adev->mman.discovery_bin) { 535 540 DRM_ERROR("ip discovery uninitialized\n"); ··· 542 537 } 543 538 544 539 bhdr = (struct binary_header *)adev->mman.discovery_bin; 545 - gc_info = (struct gc_info_v1_0 *)(adev->mman.discovery_bin + 540 + gc_info = (union gc_info *)(adev->mman.discovery_bin + 546 541 le16_to_cpu(bhdr->table_list[GC].offset)); 547 - 548 - adev->gfx.config.max_shader_engines = le32_to_cpu(gc_info->gc_num_se); 549 - adev->gfx.config.max_cu_per_sh = 2 * (le32_to_cpu(gc_info->gc_num_wgp0_per_sa) + 550 - le32_to_cpu(gc_info->gc_num_wgp1_per_sa)); 551 - adev->gfx.config.max_sh_per_se = le32_to_cpu(gc_info->gc_num_sa_per_se); 552 - adev->gfx.config.max_backends_per_se = le32_to_cpu(gc_info->gc_num_rb_per_se); 553 - adev->gfx.config.max_texture_channel_caches = le32_to_cpu(gc_info->gc_num_gl2c); 554 - adev->gfx.config.max_gprs = le32_to_cpu(gc_info->gc_num_gprs); 555 - adev->gfx.config.max_gs_threads = le32_to_cpu(gc_info->gc_num_max_gs_thds); 556 - adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gc_info->gc_gs_table_depth); 557 - adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gc_info->gc_gsprim_buff_depth); 558 - adev->gfx.config.double_offchip_lds_buf = le32_to_cpu(gc_info->gc_double_offchip_lds_buffer); 559 - adev->gfx.cu_info.wave_front_size = le32_to_cpu(gc_info->gc_wave_size); 560 - adev->gfx.cu_info.max_waves_per_simd = le32_to_cpu(gc_info->gc_max_waves_per_simd); 561 - adev->gfx.cu_info.max_scratch_slots_per_cu = le32_to_cpu(gc_info->gc_max_scratch_slots_per_cu); 562 - adev->gfx.cu_info.lds_size = le32_to_cpu(gc_info->gc_lds_size); 563 - adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->gc_num_sc_per_se) / 564 - le32_to_cpu(gc_info->gc_num_sa_per_se); 565 - adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->gc_num_packer_per_sc); 566 - 542 + switch (gc_info->v1.header.version_major) { 543 + case 1: 544 + adev->gfx.config.max_shader_engines = le32_to_cpu(gc_info->v1.gc_num_se); 545 + adev->gfx.config.max_cu_per_sh = 2 * (le32_to_cpu(gc_info->v1.gc_num_wgp0_per_sa) + 546 + le32_to_cpu(gc_info->v1.gc_num_wgp1_per_sa)); 547 + adev->gfx.config.max_sh_per_se = le32_to_cpu(gc_info->v1.gc_num_sa_per_se); 548 + adev->gfx.config.max_backends_per_se = le32_to_cpu(gc_info->v1.gc_num_rb_per_se); 549 + adev->gfx.config.max_texture_channel_caches = le32_to_cpu(gc_info->v1.gc_num_gl2c); 550 + adev->gfx.config.max_gprs = le32_to_cpu(gc_info->v1.gc_num_gprs); 551 + adev->gfx.config.max_gs_threads = le32_to_cpu(gc_info->v1.gc_num_max_gs_thds); 552 + adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gc_info->v1.gc_gs_table_depth); 553 + adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gc_info->v1.gc_gsprim_buff_depth); 554 + adev->gfx.config.double_offchip_lds_buf = le32_to_cpu(gc_info->v1.gc_double_offchip_lds_buffer); 555 + adev->gfx.cu_info.wave_front_size = le32_to_cpu(gc_info->v1.gc_wave_size); 556 + adev->gfx.cu_info.max_waves_per_simd = le32_to_cpu(gc_info->v1.gc_max_waves_per_simd); 557 + adev->gfx.cu_info.max_scratch_slots_per_cu = le32_to_cpu(gc_info->v1.gc_max_scratch_slots_per_cu); 558 + adev->gfx.cu_info.lds_size = le32_to_cpu(gc_info->v1.gc_lds_size); 559 + adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->v1.gc_num_sc_per_se) / 560 + le32_to_cpu(gc_info->v1.gc_num_sa_per_se); 561 + adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->v1.gc_num_packer_per_sc); 562 + break; 563 + case 2: 564 + adev->gfx.config.max_shader_engines = le32_to_cpu(gc_info->v2.gc_num_se); 565 + adev->gfx.config.max_cu_per_sh = le32_to_cpu(gc_info->v2.gc_num_cu_per_sh); 566 + adev->gfx.config.max_sh_per_se = le32_to_cpu(gc_info->v2.gc_num_sh_per_se); 567 + adev->gfx.config.max_backends_per_se = le32_to_cpu(gc_info->v2.gc_num_rb_per_se); 568 + adev->gfx.config.max_texture_channel_caches = le32_to_cpu(gc_info->v2.gc_num_tccs); 569 + adev->gfx.config.max_gprs = le32_to_cpu(gc_info->v2.gc_num_gprs); 570 + adev->gfx.config.max_gs_threads = le32_to_cpu(gc_info->v2.gc_num_max_gs_thds); 571 + adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gc_info->v2.gc_gs_table_depth); 572 + adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gc_info->v2.gc_gsprim_buff_depth); 573 + adev->gfx.config.double_offchip_lds_buf = le32_to_cpu(gc_info->v2.gc_double_offchip_lds_buffer); 574 + adev->gfx.cu_info.wave_front_size = le32_to_cpu(gc_info->v2.gc_wave_size); 575 + adev->gfx.cu_info.max_waves_per_simd = le32_to_cpu(gc_info->v2.gc_max_waves_per_simd); 576 + adev->gfx.cu_info.max_scratch_slots_per_cu = le32_to_cpu(gc_info->v2.gc_max_scratch_slots_per_cu); 577 + adev->gfx.cu_info.lds_size = le32_to_cpu(gc_info->v2.gc_lds_size); 578 + adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->v2.gc_num_sc_per_se) / 579 + le32_to_cpu(gc_info->v2.gc_num_sh_per_se); 580 + adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->v2.gc_num_packer_per_sc); 581 + break; 582 + default: 583 + dev_err(adev->dev, 584 + "Unhandled GC info table %d.%d\n", 585 + gc_info->v1.header.version_major, 586 + gc_info->v1.header.version_minor); 587 + return -EINVAL; 588 + } 567 589 return 0; 568 590 } 569 591
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
··· 384 384 struct amdgpu_vm_bo_base *bo_base; 385 385 int r; 386 386 387 - if (bo->tbo.resource->mem_type == TTM_PL_SYSTEM) 387 + if (!bo->tbo.resource || bo->tbo.resource->mem_type == TTM_PL_SYSTEM) 388 388 return; 389 389 390 390 r = ttm_bo_validate(&bo->tbo, &placement, &ctx);
+23 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 328 328 329 329 /** 330 330 * DOC: runpm (int) 331 - * Override for runtime power management control for dGPUs in PX/HG laptops. The amdgpu driver can dynamically power down 332 - * the dGPU on PX/HG laptops when it is idle. The default is -1 (auto enable). Setting the value to 0 disables this functionality. 331 + * Override for runtime power management control for dGPUs. The amdgpu driver can dynamically power down 332 + * the dGPUs when they are idle if supported. The default is -1 (auto enable). 333 + * Setting the value to 0 disables this functionality. 333 334 */ 334 - MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = PX only default)"); 335 + MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = auto)"); 335 336 module_param_named(runpm, amdgpu_runtime_pm, int, 0444); 336 337 337 338 /** ··· 2154 2153 adev->in_s3 = true; 2155 2154 r = amdgpu_device_suspend(drm_dev, true); 2156 2155 adev->in_s3 = false; 2157 - 2156 + if (r) 2157 + return r; 2158 + if (!adev->in_s0ix) 2159 + r = amdgpu_asic_reset(adev); 2158 2160 return r; 2159 2161 } 2160 2162 ··· 2238 2234 if (amdgpu_device_supports_px(drm_dev)) 2239 2235 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; 2240 2236 2237 + /* 2238 + * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some 2239 + * proper cleanups and put itself into a state ready for PNP. That 2240 + * can address some random resuming failure observed on BOCO capable 2241 + * platforms. 2242 + * TODO: this may be also needed for PX capable platform. 2243 + */ 2244 + if (amdgpu_device_supports_boco(drm_dev)) 2245 + adev->mp1_state = PP_MP1_STATE_UNLOAD; 2246 + 2241 2247 ret = amdgpu_device_suspend(drm_dev, false); 2242 2248 if (ret) { 2243 2249 adev->in_runpm = false; 2250 + if (amdgpu_device_supports_boco(drm_dev)) 2251 + adev->mp1_state = PP_MP1_STATE_NONE; 2244 2252 return ret; 2245 2253 } 2254 + 2255 + if (amdgpu_device_supports_boco(drm_dev)) 2256 + adev->mp1_state = PP_MP1_STATE_NONE; 2246 2257 2247 2258 if (amdgpu_device_supports_px(drm_dev)) { 2248 2259 /* Only need to handle PCI state in the driver for ATPX
+87 -39
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
··· 77 77 * Cast helper 78 78 */ 79 79 static const struct dma_fence_ops amdgpu_fence_ops; 80 + static const struct dma_fence_ops amdgpu_job_fence_ops; 80 81 static inline struct amdgpu_fence *to_amdgpu_fence(struct dma_fence *f) 81 82 { 82 83 struct amdgpu_fence *__f = container_of(f, struct amdgpu_fence, base); 83 84 84 - if (__f->base.ops == &amdgpu_fence_ops) 85 + if (__f->base.ops == &amdgpu_fence_ops || 86 + __f->base.ops == &amdgpu_job_fence_ops) 85 87 return __f; 86 88 87 89 return NULL; ··· 160 158 } 161 159 162 160 seq = ++ring->fence_drv.sync_seq; 163 - if (job != NULL && job->job_run_counter) { 161 + if (job && job->job_run_counter) { 164 162 /* reinit seq for resubmitted jobs */ 165 163 fence->seqno = seq; 166 164 } else { 167 - dma_fence_init(fence, &amdgpu_fence_ops, 168 - &ring->fence_drv.lock, 169 - adev->fence_context + ring->idx, 170 - seq); 171 - } 172 - 173 - if (job != NULL) { 174 - /* mark this fence has a parent job */ 175 - set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &fence->flags); 165 + if (job) 166 + dma_fence_init(fence, &amdgpu_job_fence_ops, 167 + &ring->fence_drv.lock, 168 + adev->fence_context + ring->idx, seq); 169 + else 170 + dma_fence_init(fence, &amdgpu_fence_ops, 171 + &ring->fence_drv.lock, 172 + adev->fence_context + ring->idx, seq); 176 173 } 177 174 178 175 amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, ··· 622 621 } 623 622 624 623 /** 624 + * amdgpu_fence_driver_clear_job_fences - clear job embedded fences of ring 625 + * 626 + * @ring: fence of the ring to be cleared 627 + * 628 + */ 629 + void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring) 630 + { 631 + int i; 632 + struct dma_fence *old, **ptr; 633 + 634 + for (i = 0; i <= ring->fence_drv.num_fences_mask; i++) { 635 + ptr = &ring->fence_drv.fences[i]; 636 + old = rcu_dereference_protected(*ptr, 1); 637 + if (old && old->ops == &amdgpu_job_fence_ops) 638 + RCU_INIT_POINTER(*ptr, NULL); 639 + } 640 + } 641 + 642 + /** 625 643 * amdgpu_fence_driver_force_completion - force signal latest fence of ring 626 644 * 627 645 * @ring: fence of the ring to signal ··· 663 643 664 644 static const char *amdgpu_fence_get_timeline_name(struct dma_fence *f) 665 645 { 666 - struct amdgpu_ring *ring; 646 + return (const char *)to_amdgpu_fence(f)->ring->name; 647 + } 667 648 668 - if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) { 669 - struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); 649 + static const char *amdgpu_job_fence_get_timeline_name(struct dma_fence *f) 650 + { 651 + struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); 670 652 671 - ring = to_amdgpu_ring(job->base.sched); 672 - } else { 673 - ring = to_amdgpu_fence(f)->ring; 674 - } 675 - return (const char *)ring->name; 653 + return (const char *)to_amdgpu_ring(job->base.sched)->name; 676 654 } 677 655 678 656 /** ··· 683 665 */ 684 666 static bool amdgpu_fence_enable_signaling(struct dma_fence *f) 685 667 { 686 - struct amdgpu_ring *ring; 668 + if (!timer_pending(&to_amdgpu_fence(f)->ring->fence_drv.fallback_timer)) 669 + amdgpu_fence_schedule_fallback(to_amdgpu_fence(f)->ring); 687 670 688 - if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) { 689 - struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); 671 + return true; 672 + } 690 673 691 - ring = to_amdgpu_ring(job->base.sched); 692 - } else { 693 - ring = to_amdgpu_fence(f)->ring; 694 - } 674 + /** 675 + * amdgpu_job_fence_enable_signaling - enable signalling on job fence 676 + * @f: fence 677 + * 678 + * This is the simliar function with amdgpu_fence_enable_signaling above, it 679 + * only handles the job embedded fence. 680 + */ 681 + static bool amdgpu_job_fence_enable_signaling(struct dma_fence *f) 682 + { 683 + struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); 695 684 696 - if (!timer_pending(&ring->fence_drv.fallback_timer)) 697 - amdgpu_fence_schedule_fallback(ring); 685 + if (!timer_pending(&to_amdgpu_ring(job->base.sched)->fence_drv.fallback_timer)) 686 + amdgpu_fence_schedule_fallback(to_amdgpu_ring(job->base.sched)); 698 687 699 688 return true; 700 689 } ··· 717 692 { 718 693 struct dma_fence *f = container_of(rcu, struct dma_fence, rcu); 719 694 720 - if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) { 721 - /* free job if fence has a parent job */ 722 - struct amdgpu_job *job; 723 - 724 - job = container_of(f, struct amdgpu_job, hw_fence); 725 - kfree(job); 726 - } else { 727 695 /* free fence_slab if it's separated fence*/ 728 - struct amdgpu_fence *fence; 696 + kmem_cache_free(amdgpu_fence_slab, to_amdgpu_fence(f)); 697 + } 729 698 730 - fence = to_amdgpu_fence(f); 731 - kmem_cache_free(amdgpu_fence_slab, fence); 732 - } 699 + /** 700 + * amdgpu_job_fence_free - free up the job with embedded fence 701 + * 702 + * @rcu: RCU callback head 703 + * 704 + * Free up the job with embedded fence after the RCU grace period. 705 + */ 706 + static void amdgpu_job_fence_free(struct rcu_head *rcu) 707 + { 708 + struct dma_fence *f = container_of(rcu, struct dma_fence, rcu); 709 + 710 + /* free job if fence has a parent job */ 711 + kfree(container_of(f, struct amdgpu_job, hw_fence)); 733 712 } 734 713 735 714 /** ··· 749 720 call_rcu(&f->rcu, amdgpu_fence_free); 750 721 } 751 722 723 + /** 724 + * amdgpu_job_fence_release - callback that job embedded fence can be freed 725 + * 726 + * @f: fence 727 + * 728 + * This is the simliar function with amdgpu_fence_release above, it 729 + * only handles the job embedded fence. 730 + */ 731 + static void amdgpu_job_fence_release(struct dma_fence *f) 732 + { 733 + call_rcu(&f->rcu, amdgpu_job_fence_free); 734 + } 735 + 752 736 static const struct dma_fence_ops amdgpu_fence_ops = { 753 737 .get_driver_name = amdgpu_fence_get_driver_name, 754 738 .get_timeline_name = amdgpu_fence_get_timeline_name, ··· 769 727 .release = amdgpu_fence_release, 770 728 }; 771 729 730 + static const struct dma_fence_ops amdgpu_job_fence_ops = { 731 + .get_driver_name = amdgpu_fence_get_driver_name, 732 + .get_timeline_name = amdgpu_job_fence_get_timeline_name, 733 + .enable_signaling = amdgpu_job_fence_enable_signaling, 734 + .release = amdgpu_job_fence_release, 735 + }; 772 736 773 737 /* 774 738 * Fence debugfs
+1 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
··· 53 53 #define AMDGPU_FENCE_FLAG_INT (1 << 1) 54 54 #define AMDGPU_FENCE_FLAG_TC_WB_ONLY (1 << 2) 55 55 56 - /* fence flag bit to indicate the face is embedded in job*/ 57 - #define AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT (DMA_FENCE_FLAG_USER_BITS + 1) 58 - 59 56 #define to_amdgpu_ring(s) container_of((s), struct amdgpu_ring, sched) 60 57 61 58 #define AMDGPU_IB_POOL_SIZE (1024 * 1024) ··· 111 114 struct dma_fence **fences; 112 115 }; 113 116 117 + void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring); 114 118 void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring); 115 119 116 120 int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
+7
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
··· 246 246 { 247 247 int r; 248 248 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 249 + bool idle_work_unexecuted; 250 + 251 + idle_work_unexecuted = cancel_delayed_work_sync(&adev->vcn.idle_work); 252 + if (idle_work_unexecuted) { 253 + if (adev->pm.dpm_enabled) 254 + amdgpu_dpm_enable_uvd(adev, false); 255 + } 249 256 250 257 r = vcn_v1_0_hw_fini(adev); 251 258 if (r)
+1
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
··· 158 158 union display_idle_optimization_u idle_info = { 0 }; 159 159 idle_info.idle_info.df_request_disabled = 1; 160 160 idle_info.idle_info.phy_ref_clk_off = 1; 161 + idle_info.idle_info.s0i2_rdy = 1; 161 162 dcn31_smu_set_display_idle_optimization(clk_mgr, idle_info.data); 162 163 /* update power state */ 163 164 clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER;
+1 -4
drivers/gpu/drm/amd/display/dc/core/dc_link.c
··· 3945 3945 config.dig_be = pipe_ctx->stream->link->link_enc_hw_inst; 3946 3946 #if defined(CONFIG_DRM_AMD_DC_DCN) 3947 3947 config.stream_enc_idx = pipe_ctx->stream_res.stream_enc->id - ENGINE_ID_DIGA; 3948 - 3948 + 3949 3949 if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY || 3950 3950 pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) { 3951 - link_enc = pipe_ctx->stream->link->link_enc; 3952 - config.dio_output_type = pipe_ctx->stream->link->ep_type; 3953 - config.dio_output_idx = link_enc->transmitter - TRANSMITTER_UNIPHY_A; 3954 3951 if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY) 3955 3952 link_enc = pipe_ctx->stream->link->link_enc; 3956 3953 else if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)
+1
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c
··· 78 78 .get_clock = dcn10_get_clock, 79 79 .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, 80 80 .calc_vupdate_position = dcn10_calc_vupdate_position, 81 + .power_down = dce110_power_down, 81 82 .set_backlight_level = dce110_set_backlight_level, 82 83 .set_abm_immediate_disable = dce110_set_abm_immediate_disable, 83 84 .set_pipe = dce110_set_pipe,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
··· 1069 1069 .timing_trace = false, 1070 1070 .clock_trace = true, 1071 1071 .disable_pplib_clock_request = true, 1072 - .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, 1072 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 1073 1073 .force_single_disp_pipe_split = false, 1074 1074 .disable_dcc = DCC_ENABLE, 1075 1075 .vsr_support = true,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn201/dcn201_resource.c
··· 603 603 .timing_trace = false, 604 604 .clock_trace = true, 605 605 .disable_pplib_clock_request = true, 606 - .pipe_split_policy = MPC_SPLIT_AVOID, 606 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 607 607 .force_single_disp_pipe_split = false, 608 608 .disable_dcc = DCC_ENABLE, 609 609 .vsr_support = true,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
··· 874 874 .clock_trace = true, 875 875 .disable_pplib_clock_request = true, 876 876 .min_disp_clk_khz = 100000, 877 - .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, 877 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 878 878 .force_single_disp_pipe_split = false, 879 879 .disable_dcc = DCC_ENABLE, 880 880 .vsr_support = true,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
··· 840 840 .timing_trace = false, 841 841 .clock_trace = true, 842 842 .disable_pplib_clock_request = true, 843 - .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, 843 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 844 844 .force_single_disp_pipe_split = false, 845 845 .disable_dcc = DCC_ENABLE, 846 846 .vsr_support = true,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c
··· 686 686 .disable_clock_gate = true, 687 687 .disable_pplib_clock_request = true, 688 688 .disable_pplib_wm_range = true, 689 - .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, 689 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 690 690 .force_single_disp_pipe_split = false, 691 691 .disable_dcc = DCC_ENABLE, 692 692 .vsr_support = true,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c
··· 211 211 .timing_trace = false, 212 212 .clock_trace = true, 213 213 .disable_pplib_clock_request = true, 214 - .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, 214 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 215 215 .force_single_disp_pipe_split = false, 216 216 .disable_dcc = DCC_ENABLE, 217 217 .vsr_support = true,
+1 -1
drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c
··· 193 193 .timing_trace = false, 194 194 .clock_trace = true, 195 195 .disable_pplib_clock_request = true, 196 - .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, 196 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 197 197 .force_single_disp_pipe_split = false, 198 198 .disable_dcc = DCC_ENABLE, 199 199 .vsr_support = true,
+1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c
··· 101 101 .z10_restore = dcn31_z10_restore, 102 102 .z10_save_init = dcn31_z10_save_init, 103 103 .set_disp_pattern_generator = dcn30_set_disp_pattern_generator, 104 + .optimize_pwr_state = dcn21_optimize_pwr_state, 104 105 .exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state, 105 106 .update_visual_confirm_color = dcn20_update_visual_confirm_color, 106 107 };
+24 -3
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
··· 355 355 clk_src_regs(3, D), 356 356 clk_src_regs(4, E) 357 357 }; 358 + /*pll_id being rempped in dmub, in driver it is logical instance*/ 359 + static const struct dce110_clk_src_regs clk_src_regs_b0[] = { 360 + clk_src_regs(0, A), 361 + clk_src_regs(1, B), 362 + clk_src_regs(2, F), 363 + clk_src_regs(3, G), 364 + clk_src_regs(4, E) 365 + }; 358 366 359 367 static const struct dce110_clk_src_shift cs_shift = { 360 368 CS_COMMON_MASK_SH_LIST_DCN2_0(__SHIFT) ··· 1002 994 .timing_trace = false, 1003 995 .clock_trace = true, 1004 996 .disable_pplib_clock_request = false, 1005 - .pipe_split_policy = MPC_SPLIT_AVOID, 997 + .pipe_split_policy = MPC_SPLIT_DYNAMIC, 1006 998 .force_single_disp_pipe_split = false, 1007 999 .disable_dcc = DCC_ENABLE, 1008 1000 .vsr_support = true, ··· 2284 2276 dcn30_clock_source_create(ctx, ctx->dc_bios, 2285 2277 CLOCK_SOURCE_COMBO_PHY_PLL1, 2286 2278 &clk_src_regs[1], false); 2287 - pool->base.clock_sources[DCN31_CLK_SRC_PLL2] = 2279 + /*move phypllx_pixclk_resync to dmub next*/ 2280 + if (dc->ctx->asic_id.hw_internal_rev == YELLOW_CARP_B0) { 2281 + pool->base.clock_sources[DCN31_CLK_SRC_PLL2] = 2282 + dcn30_clock_source_create(ctx, ctx->dc_bios, 2283 + CLOCK_SOURCE_COMBO_PHY_PLL2, 2284 + &clk_src_regs_b0[2], false); 2285 + pool->base.clock_sources[DCN31_CLK_SRC_PLL3] = 2286 + dcn30_clock_source_create(ctx, ctx->dc_bios, 2287 + CLOCK_SOURCE_COMBO_PHY_PLL3, 2288 + &clk_src_regs_b0[3], false); 2289 + } else { 2290 + pool->base.clock_sources[DCN31_CLK_SRC_PLL2] = 2288 2291 dcn30_clock_source_create(ctx, ctx->dc_bios, 2289 2292 CLOCK_SOURCE_COMBO_PHY_PLL2, 2290 2293 &clk_src_regs[2], false); 2291 - pool->base.clock_sources[DCN31_CLK_SRC_PLL3] = 2294 + pool->base.clock_sources[DCN31_CLK_SRC_PLL3] = 2292 2295 dcn30_clock_source_create(ctx, ctx->dc_bios, 2293 2296 CLOCK_SOURCE_COMBO_PHY_PLL3, 2294 2297 &clk_src_regs[3], false); 2298 + } 2299 + 2295 2300 pool->base.clock_sources[DCN31_CLK_SRC_PLL4] = 2296 2301 dcn30_clock_source_create(ctx, ctx->dc_bios, 2297 2302 CLOCK_SOURCE_COMBO_PHY_PLL4,
+31
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.h
··· 49 49 const struct dc_init_data *init_data, 50 50 struct dc *dc); 51 51 52 + /*temp: B0 specific before switch to dcn313 headers*/ 53 + #ifndef regPHYPLLF_PIXCLK_RESYNC_CNTL 54 + #define regPHYPLLF_PIXCLK_RESYNC_CNTL 0x007e 55 + #define regPHYPLLF_PIXCLK_RESYNC_CNTL_BASE_IDX 1 56 + #define regPHYPLLG_PIXCLK_RESYNC_CNTL 0x005f 57 + #define regPHYPLLG_PIXCLK_RESYNC_CNTL_BASE_IDX 1 58 + 59 + //PHYPLLF_PIXCLK_RESYNC_CNTL 60 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_RESYNC_ENABLE__SHIFT 0x0 61 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DEEP_COLOR_DTO_ENABLE_STATUS__SHIFT 0x1 62 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DCCG_DEEP_COLOR_CNTL__SHIFT 0x4 63 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_ENABLE__SHIFT 0x8 64 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_DOUBLE_RATE_ENABLE__SHIFT 0x9 65 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_RESYNC_ENABLE_MASK 0x00000001L 66 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DEEP_COLOR_DTO_ENABLE_STATUS_MASK 0x00000002L 67 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DCCG_DEEP_COLOR_CNTL_MASK 0x00000030L 68 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_ENABLE_MASK 0x00000100L 69 + #define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_DOUBLE_RATE_ENABLE_MASK 0x00000200L 70 + 71 + //PHYPLLG_PIXCLK_RESYNC_CNTL 72 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_RESYNC_ENABLE__SHIFT 0x0 73 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DEEP_COLOR_DTO_ENABLE_STATUS__SHIFT 0x1 74 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DCCG_DEEP_COLOR_CNTL__SHIFT 0x4 75 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_ENABLE__SHIFT 0x8 76 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_DOUBLE_RATE_ENABLE__SHIFT 0x9 77 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_RESYNC_ENABLE_MASK 0x00000001L 78 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DEEP_COLOR_DTO_ENABLE_STATUS_MASK 0x00000002L 79 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DCCG_DEEP_COLOR_CNTL_MASK 0x00000030L 80 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_ENABLE_MASK 0x00000100L 81 + #define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_DOUBLE_RATE_ENABLE_MASK 0x00000200L 82 + #endif 52 83 #endif /* _DCN31_RESOURCE_H_ */
+49
drivers/gpu/drm/amd/include/discovery.h
··· 143 143 uint32_t gc_num_gl2a; 144 144 }; 145 145 146 + struct gc_info_v1_1 { 147 + struct gpu_info_header header; 148 + 149 + uint32_t gc_num_se; 150 + uint32_t gc_num_wgp0_per_sa; 151 + uint32_t gc_num_wgp1_per_sa; 152 + uint32_t gc_num_rb_per_se; 153 + uint32_t gc_num_gl2c; 154 + uint32_t gc_num_gprs; 155 + uint32_t gc_num_max_gs_thds; 156 + uint32_t gc_gs_table_depth; 157 + uint32_t gc_gsprim_buff_depth; 158 + uint32_t gc_parameter_cache_depth; 159 + uint32_t gc_double_offchip_lds_buffer; 160 + uint32_t gc_wave_size; 161 + uint32_t gc_max_waves_per_simd; 162 + uint32_t gc_max_scratch_slots_per_cu; 163 + uint32_t gc_lds_size; 164 + uint32_t gc_num_sc_per_se; 165 + uint32_t gc_num_sa_per_se; 166 + uint32_t gc_num_packer_per_sc; 167 + uint32_t gc_num_gl2a; 168 + uint32_t gc_num_tcp_per_sa; 169 + uint32_t gc_num_sdp_interface; 170 + uint32_t gc_num_tcps; 171 + }; 172 + 173 + struct gc_info_v2_0 { 174 + struct gpu_info_header header; 175 + 176 + uint32_t gc_num_se; 177 + uint32_t gc_num_cu_per_sh; 178 + uint32_t gc_num_sh_per_se; 179 + uint32_t gc_num_rb_per_se; 180 + uint32_t gc_num_tccs; 181 + uint32_t gc_num_gprs; 182 + uint32_t gc_num_max_gs_thds; 183 + uint32_t gc_gs_table_depth; 184 + uint32_t gc_gsprim_buff_depth; 185 + uint32_t gc_parameter_cache_depth; 186 + uint32_t gc_double_offchip_lds_buffer; 187 + uint32_t gc_wave_size; 188 + uint32_t gc_max_waves_per_simd; 189 + uint32_t gc_max_scratch_slots_per_cu; 190 + uint32_t gc_lds_size; 191 + uint32_t gc_num_sc_per_se; 192 + uint32_t gc_num_packer_per_sc; 193 + }; 194 + 146 195 typedef struct harvest_info_header { 147 196 uint32_t signature; /* Table Signature */ 148 197 uint32_t version; /* Table Version */
+2 -5
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 1568 1568 1569 1569 smu->watermarks_bitmap &= ~(WATERMARKS_LOADED); 1570 1570 1571 - /* skip CGPG when in S0ix */ 1572 - if (smu->is_apu && !adev->in_s0ix) 1573 - smu_set_gfx_cgpg(&adev->smu, false); 1571 + smu_set_gfx_cgpg(&adev->smu, false); 1574 1572 1575 1573 return 0; 1576 1574 } ··· 1599 1601 return ret; 1600 1602 } 1601 1603 1602 - if (smu->is_apu) 1603 - smu_set_gfx_cgpg(&adev->smu, true); 1604 + smu_set_gfx_cgpg(&adev->smu, true); 1604 1605 1605 1606 smu->disable_uclk_switch = 0; 1606 1607
+2 -1
drivers/gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c
··· 120 120 121 121 int smu_v12_0_set_gfx_cgpg(struct smu_context *smu, bool enable) 122 122 { 123 - if (!(smu->adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) 123 + /* Until now the SMU12 only implemented for Renoir series so here neen't do APU check. */ 124 + if (!(smu->adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) || smu->adev->in_s0ix) 124 125 return 0; 125 126 126 127 return smu_cmn_send_smc_msg_with_param(smu,
+1 -1
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
··· 1621 1621 { 1622 1622 return smu_cmn_send_smc_msg_with_param(smu, 1623 1623 SMU_MSG_GmiPwrDnControl, 1624 - en ? 1 : 0, 1624 + en ? 0 : 1, 1625 1625 NULL); 1626 1626 } 1627 1627
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_context.c
··· 564 564 container_of_user(base, typeof(*ext), base); 565 565 const struct set_proto_ctx_engines *set = data; 566 566 struct drm_i915_private *i915 = set->i915; 567 + struct i915_engine_class_instance prev_engine; 567 568 u64 flags; 568 569 int err = 0, n, i, j; 569 570 u16 slot, width, num_siblings; ··· 630 629 /* Create contexts / engines */ 631 630 for (i = 0; i < width; ++i) { 632 631 intel_engine_mask_t current_mask = 0; 633 - struct i915_engine_class_instance prev_engine; 634 632 635 633 for (j = 0; j < num_siblings; ++j) { 636 634 struct i915_engine_class_instance ci;
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 3017 3017 fence_array = dma_fence_array_create(eb->num_batches, 3018 3018 fences, 3019 3019 eb->context->parallel.fence_context, 3020 - eb->context->parallel.seqno, 3020 + eb->context->parallel.seqno++, 3021 3021 false); 3022 3022 if (!fence_array) { 3023 3023 kfree(fences);
+28 -26
drivers/gpu/drm/nouveau/nouveau_fence.c
··· 353 353 354 354 if (ret) 355 355 return ret; 356 + 357 + fobj = NULL; 358 + } else { 359 + fobj = dma_resv_shared_list(resv); 356 360 } 357 361 358 - fobj = dma_resv_shared_list(resv); 359 - fence = dma_resv_excl_fence(resv); 360 - 361 - if (fence) { 362 - struct nouveau_channel *prev = NULL; 363 - bool must_wait = true; 364 - 365 - f = nouveau_local_fence(fence, chan->drm); 366 - if (f) { 367 - rcu_read_lock(); 368 - prev = rcu_dereference(f->channel); 369 - if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0)) 370 - must_wait = false; 371 - rcu_read_unlock(); 372 - } 373 - 374 - if (must_wait) 375 - ret = dma_fence_wait(fence, intr); 376 - 377 - return ret; 378 - } 379 - 380 - if (!exclusive || !fobj) 381 - return ret; 382 - 383 - for (i = 0; i < fobj->shared_count && !ret; ++i) { 362 + /* Waiting for the exclusive fence first causes performance regressions 363 + * under some circumstances. So manually wait for the shared ones first. 364 + */ 365 + for (i = 0; i < (fobj ? fobj->shared_count : 0) && !ret; ++i) { 384 366 struct nouveau_channel *prev = NULL; 385 367 bool must_wait = true; 386 368 ··· 380 398 381 399 if (must_wait) 382 400 ret = dma_fence_wait(fence, intr); 401 + } 402 + 403 + fence = dma_resv_excl_fence(resv); 404 + if (fence) { 405 + struct nouveau_channel *prev = NULL; 406 + bool must_wait = true; 407 + 408 + f = nouveau_local_fence(fence, chan->drm); 409 + if (f) { 410 + rcu_read_lock(); 411 + prev = rcu_dereference(f->channel); 412 + if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0)) 413 + must_wait = false; 414 + rcu_read_unlock(); 415 + } 416 + 417 + if (must_wait) 418 + ret = dma_fence_wait(fence, intr); 419 + 420 + return ret; 383 421 } 384 422 385 423 return ret;
+3
drivers/i2c/i2c-dev.c
··· 535 535 sizeof(rdwr_arg))) 536 536 return -EFAULT; 537 537 538 + if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0) 539 + return -EINVAL; 540 + 538 541 if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS) 539 542 return -EINVAL; 540 543
+9 -2
drivers/input/joystick/spaceball.c
··· 19 19 #include <linux/module.h> 20 20 #include <linux/input.h> 21 21 #include <linux/serio.h> 22 + #include <asm/unaligned.h> 22 23 23 24 #define DRIVER_DESC "SpaceTec SpaceBall 2003/3003/4000 FLX driver" 24 25 ··· 76 75 77 76 case 'D': /* Ball data */ 78 77 if (spaceball->idx != 15) return; 79 - for (i = 0; i < 6; i++) 78 + /* 79 + * Skip first three bytes; read six axes worth of data. 80 + * Axis values are signed 16-bit big-endian. 81 + */ 82 + data += 3; 83 + for (i = 0; i < ARRAY_SIZE(spaceball_axes); i++) { 80 84 input_report_abs(dev, spaceball_axes[i], 81 - (__s16)((data[2 * i + 3] << 8) | data[2 * i + 2])); 85 + (__s16)get_unaligned_be16(&data[i * 2])); 86 + } 82 87 break; 83 88 84 89 case 'K': /* Button data */
+2 -2
drivers/input/mouse/appletouch.c
··· 916 916 set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 917 917 set_bit(BTN_LEFT, input_dev->keybit); 918 918 919 + INIT_WORK(&dev->work, atp_reinit); 920 + 919 921 error = input_register_device(dev->input); 920 922 if (error) 921 923 goto err_free_buffer; 922 924 923 925 /* save our data pointer in this interface device */ 924 926 usb_set_intfdata(iface, dev); 925 - 926 - INIT_WORK(&dev->work, atp_reinit); 927 927 928 928 return 0; 929 929
+29 -20
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 1288 1288 1289 1289 static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id) 1290 1290 { 1291 - struct ena_tx_buffer *tx_info = NULL; 1291 + struct ena_tx_buffer *tx_info; 1292 1292 1293 - if (likely(req_id < tx_ring->ring_size)) { 1294 - tx_info = &tx_ring->tx_buffer_info[req_id]; 1295 - if (likely(tx_info->skb)) 1296 - return 0; 1297 - } 1293 + tx_info = &tx_ring->tx_buffer_info[req_id]; 1294 + if (likely(tx_info->skb)) 1295 + return 0; 1298 1296 1299 1297 return handle_invalid_req_id(tx_ring, req_id, tx_info, false); 1300 1298 } 1301 1299 1302 1300 static int validate_xdp_req_id(struct ena_ring *xdp_ring, u16 req_id) 1303 1301 { 1304 - struct ena_tx_buffer *tx_info = NULL; 1302 + struct ena_tx_buffer *tx_info; 1305 1303 1306 - if (likely(req_id < xdp_ring->ring_size)) { 1307 - tx_info = &xdp_ring->tx_buffer_info[req_id]; 1308 - if (likely(tx_info->xdpf)) 1309 - return 0; 1310 - } 1304 + tx_info = &xdp_ring->tx_buffer_info[req_id]; 1305 + if (likely(tx_info->xdpf)) 1306 + return 0; 1311 1307 1312 1308 return handle_invalid_req_id(xdp_ring, req_id, tx_info, true); 1313 1309 } ··· 1328 1332 1329 1333 rc = ena_com_tx_comp_req_id_get(tx_ring->ena_com_io_cq, 1330 1334 &req_id); 1331 - if (rc) 1335 + if (rc) { 1336 + if (unlikely(rc == -EINVAL)) 1337 + handle_invalid_req_id(tx_ring, req_id, NULL, 1338 + false); 1332 1339 break; 1340 + } 1333 1341 1342 + /* validate that the request id points to a valid skb */ 1334 1343 rc = validate_tx_req_id(tx_ring, req_id); 1335 1344 if (rc) 1336 1345 break; ··· 1428 1427 u16 *next_to_clean) 1429 1428 { 1430 1429 struct ena_rx_buffer *rx_info; 1430 + struct ena_adapter *adapter; 1431 1431 u16 len, req_id, buf = 0; 1432 1432 struct sk_buff *skb; 1433 1433 void *page_addr; ··· 1441 1439 rx_info = &rx_ring->rx_buffer_info[req_id]; 1442 1440 1443 1441 if (unlikely(!rx_info->page)) { 1444 - netif_err(rx_ring->adapter, rx_err, rx_ring->netdev, 1445 - "Page is NULL\n"); 1442 + adapter = rx_ring->adapter; 1443 + netif_err(adapter, rx_err, rx_ring->netdev, 1444 + "Page is NULL. qid %u req_id %u\n", rx_ring->qid, req_id); 1445 + ena_increase_stat(&rx_ring->rx_stats.bad_req_id, 1, &rx_ring->syncp); 1446 + adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID; 1447 + /* Make sure reset reason is set before triggering the reset */ 1448 + smp_mb__before_atomic(); 1449 + set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); 1446 1450 return NULL; 1447 1451 } 1448 1452 ··· 1904 1896 1905 1897 rc = ena_com_tx_comp_req_id_get(xdp_ring->ena_com_io_cq, 1906 1898 &req_id); 1907 - if (rc) 1899 + if (rc) { 1900 + if (unlikely(rc == -EINVAL)) 1901 + handle_invalid_req_id(xdp_ring, req_id, NULL, 1902 + true); 1908 1903 break; 1904 + } 1909 1905 1906 + /* validate that the request id points to a valid xdp_frame */ 1910 1907 rc = validate_xdp_req_id(xdp_ring, req_id); 1911 1908 if (rc) 1912 1909 break; ··· 4026 4013 max_num_io_queues = min_t(u32, max_num_io_queues, io_tx_cq_num); 4027 4014 /* 1 IRQ for mgmnt and 1 IRQs for each IO direction */ 4028 4015 max_num_io_queues = min_t(u32, max_num_io_queues, pci_msix_vec_count(pdev) - 1); 4029 - if (unlikely(!max_num_io_queues)) { 4030 - dev_err(&pdev->dev, "The device doesn't have io queues\n"); 4031 - return -EFAULT; 4032 - } 4033 4016 4034 4017 return max_num_io_queues; 4035 4018 }
-1
drivers/net/ethernet/freescale/xgmac_mdio.c
··· 47 47 #define MDIO_CTL_READ BIT(15) 48 48 49 49 #define MDIO_DATA(x) (x & 0xffff) 50 - #define MDIO_DATA_BSY BIT(31) 51 50 52 51 struct mdio_fsl_priv { 53 52 struct tgec_mdio_controller __iomem *mdio_base;
+51 -9
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 99 99 100 100 static struct workqueue_struct *i40e_wq; 101 101 102 + static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f, 103 + struct net_device *netdev, int delta) 104 + { 105 + struct netdev_hw_addr *ha; 106 + 107 + if (!f || !netdev) 108 + return; 109 + 110 + netdev_for_each_mc_addr(ha, netdev) { 111 + if (ether_addr_equal(ha->addr, f->macaddr)) { 112 + ha->refcount += delta; 113 + if (ha->refcount <= 0) 114 + ha->refcount = 1; 115 + break; 116 + } 117 + } 118 + } 119 + 102 120 /** 103 121 * i40e_allocate_dma_mem_d - OS specific memory alloc for shared code 104 122 * @hw: pointer to the HW structure ··· 2054 2036 hlist_for_each_entry_safe(new, h, from, hlist) { 2055 2037 /* We can simply free the wrapper structure */ 2056 2038 hlist_del(&new->hlist); 2039 + netdev_hw_addr_refcnt(new->f, vsi->netdev, -1); 2057 2040 kfree(new); 2058 2041 } 2059 2042 } ··· 2402 2383 &tmp_add_list, 2403 2384 &tmp_del_list, 2404 2385 vlan_filters); 2386 + 2387 + hlist_for_each_entry(new, &tmp_add_list, hlist) 2388 + netdev_hw_addr_refcnt(new->f, vsi->netdev, 1); 2389 + 2405 2390 if (retval) 2406 2391 goto err_no_memory_locked; 2407 2392 ··· 2538 2515 if (new->f->state == I40E_FILTER_NEW) 2539 2516 new->f->state = new->state; 2540 2517 hlist_del(&new->hlist); 2518 + netdev_hw_addr_refcnt(new->f, vsi->netdev, -1); 2541 2519 kfree(new); 2542 2520 } 2543 2521 spin_unlock_bh(&vsi->mac_filter_hash_lock); ··· 8741 8717 } 8742 8718 8743 8719 /** 8720 + * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues 8721 + * @vsi: vsi structure 8722 + * 8723 + * This updates netdev's number of tx/rx queues 8724 + * 8725 + * Returns status of setting tx/rx queues 8726 + **/ 8727 + static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi) 8728 + { 8729 + int ret; 8730 + 8731 + ret = netif_set_real_num_rx_queues(vsi->netdev, 8732 + vsi->num_queue_pairs); 8733 + if (ret) 8734 + return ret; 8735 + 8736 + return netif_set_real_num_tx_queues(vsi->netdev, 8737 + vsi->num_queue_pairs); 8738 + } 8739 + 8740 + /** 8744 8741 * i40e_vsi_open - 8745 8742 * @vsi: the VSI to open 8746 8743 * ··· 8797 8752 goto err_setup_rx; 8798 8753 8799 8754 /* Notify the stack of the actual queue counts. */ 8800 - err = netif_set_real_num_tx_queues(vsi->netdev, 8801 - vsi->num_queue_pairs); 8802 - if (err) 8803 - goto err_set_queues; 8804 - 8805 - err = netif_set_real_num_rx_queues(vsi->netdev, 8806 - vsi->num_queue_pairs); 8755 + err = i40e_netif_set_realnum_tx_rx_queues(vsi); 8807 8756 if (err) 8808 8757 goto err_set_queues; 8809 8758 ··· 14190 14151 ret = i40e_config_netdev(vsi); 14191 14152 if (ret) 14192 14153 goto err_netdev; 14154 + ret = i40e_netif_set_realnum_tx_rx_queues(vsi); 14155 + if (ret) 14156 + goto err_netdev; 14193 14157 ret = register_netdev(vsi->netdev); 14194 14158 if (ret) 14195 14159 goto err_netdev; ··· 15493 15451 15494 15452 if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && 15495 15453 hw->aq.api_min_ver > I40E_FW_MINOR_VERSION(hw)) 15496 - dev_info(&pdev->dev, 15497 - "The driver for the device detected a newer version of the NVM image v%u.%u than expected v%u.%u. Please install the most recent version of the network driver.\n", 15454 + dev_dbg(&pdev->dev, 15455 + "The driver for the device detected a newer version of the NVM image v%u.%u than v%u.%u.\n", 15498 15456 hw->aq.api_maj_ver, 15499 15457 hw->aq.api_min_ver, 15500 15458 I40E_FW_API_VERSION_MAJOR,
+32 -8
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 1877 1877 /***********************virtual channel routines******************/ 1878 1878 1879 1879 /** 1880 - * i40e_vc_send_msg_to_vf 1880 + * i40e_vc_send_msg_to_vf_ex 1881 1881 * @vf: pointer to the VF info 1882 1882 * @v_opcode: virtual channel opcode 1883 1883 * @v_retval: virtual channel return value 1884 1884 * @msg: pointer to the msg buffer 1885 1885 * @msglen: msg length 1886 + * @is_quiet: true for not printing unsuccessful return values, false otherwise 1886 1887 * 1887 1888 * send msg to VF 1888 1889 **/ 1889 - static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, 1890 - u32 v_retval, u8 *msg, u16 msglen) 1890 + static int i40e_vc_send_msg_to_vf_ex(struct i40e_vf *vf, u32 v_opcode, 1891 + u32 v_retval, u8 *msg, u16 msglen, 1892 + bool is_quiet) 1891 1893 { 1892 1894 struct i40e_pf *pf; 1893 1895 struct i40e_hw *hw; ··· 1905 1903 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; 1906 1904 1907 1905 /* single place to detect unsuccessful return values */ 1908 - if (v_retval) { 1906 + if (v_retval && !is_quiet) { 1909 1907 vf->num_invalid_msgs++; 1910 1908 dev_info(&pf->pdev->dev, "VF %d failed opcode %d, retval: %d\n", 1911 1909 vf->vf_id, v_opcode, v_retval); ··· 1933 1931 } 1934 1932 1935 1933 return 0; 1934 + } 1935 + 1936 + /** 1937 + * i40e_vc_send_msg_to_vf 1938 + * @vf: pointer to the VF info 1939 + * @v_opcode: virtual channel opcode 1940 + * @v_retval: virtual channel return value 1941 + * @msg: pointer to the msg buffer 1942 + * @msglen: msg length 1943 + * 1944 + * send msg to VF 1945 + **/ 1946 + static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, 1947 + u32 v_retval, u8 *msg, u16 msglen) 1948 + { 1949 + return i40e_vc_send_msg_to_vf_ex(vf, v_opcode, v_retval, 1950 + msg, msglen, false); 1936 1951 } 1937 1952 1938 1953 /** ··· 2714 2695 * i40e_check_vf_permission 2715 2696 * @vf: pointer to the VF info 2716 2697 * @al: MAC address list from virtchnl 2698 + * @is_quiet: set true for printing msg without opcode info, false otherwise 2717 2699 * 2718 2700 * Check that the given list of MAC addresses is allowed. Will return -EPERM 2719 2701 * if any address in the list is not valid. Checks the following conditions: ··· 2729 2709 * addresses might not be accurate. 2730 2710 **/ 2731 2711 static inline int i40e_check_vf_permission(struct i40e_vf *vf, 2732 - struct virtchnl_ether_addr_list *al) 2712 + struct virtchnl_ether_addr_list *al, 2713 + bool *is_quiet) 2733 2714 { 2734 2715 struct i40e_pf *pf = vf->pf; 2735 2716 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx]; 2736 2717 int mac2add_cnt = 0; 2737 2718 int i; 2738 2719 2720 + *is_quiet = false; 2739 2721 for (i = 0; i < al->num_elements; i++) { 2740 2722 struct i40e_mac_filter *f; 2741 2723 u8 *addr = al->list[i].addr; ··· 2761 2739 !ether_addr_equal(addr, vf->default_lan_addr.addr)) { 2762 2740 dev_err(&pf->pdev->dev, 2763 2741 "VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\n"); 2742 + *is_quiet = true; 2764 2743 return -EPERM; 2765 2744 } 2766 2745 ··· 2798 2775 (struct virtchnl_ether_addr_list *)msg; 2799 2776 struct i40e_pf *pf = vf->pf; 2800 2777 struct i40e_vsi *vsi = NULL; 2778 + bool is_quiet = false; 2801 2779 i40e_status ret = 0; 2802 2780 int i; 2803 2781 ··· 2815 2791 */ 2816 2792 spin_lock_bh(&vsi->mac_filter_hash_lock); 2817 2793 2818 - ret = i40e_check_vf_permission(vf, al); 2794 + ret = i40e_check_vf_permission(vf, al, &is_quiet); 2819 2795 if (ret) { 2820 2796 spin_unlock_bh(&vsi->mac_filter_hash_lock); 2821 2797 goto error_param; ··· 2853 2829 2854 2830 error_param: 2855 2831 /* send the response to the VF */ 2856 - return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ADD_ETH_ADDR, 2857 - ret); 2832 + return i40e_vc_send_msg_to_vf_ex(vf, VIRTCHNL_OP_ADD_ETH_ADDR, 2833 + ret, NULL, 0, is_quiet); 2858 2834 } 2859 2835 2860 2836 /**
+4 -1
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 3123 3123 total_max_rate += tx_rate; 3124 3124 num_qps += mqprio_qopt->qopt.count[i]; 3125 3125 } 3126 - if (num_qps > IAVF_MAX_REQ_QUEUES) 3126 + if (num_qps > adapter->num_active_queues) { 3127 + dev_err(&adapter->pdev->dev, 3128 + "Cannot support requested number of queues\n"); 3127 3129 return -EINVAL; 3130 + } 3128 3131 3129 3132 ret = iavf_validate_tx_bandwidth(adapter, total_max_rate); 3130 3133 return ret;
+5
drivers/net/ethernet/sfc/falcon/rx.c
··· 110 110 struct ef4_rx_page_state *state; 111 111 unsigned index; 112 112 113 + if (unlikely(!rx_queue->page_ring)) 114 + return NULL; 113 115 index = rx_queue->page_remove & rx_queue->page_ptr_mask; 114 116 page = rx_queue->page_ring[index]; 115 117 if (page == NULL) ··· 294 292 unsigned int n_frags) 295 293 { 296 294 struct ef4_rx_queue *rx_queue = ef4_channel_get_rx_queue(channel); 295 + 296 + if (unlikely(!rx_queue->page_ring)) 297 + return; 297 298 298 299 do { 299 300 ef4_recycle_rx_page(channel, rx_buf);
+5
drivers/net/ethernet/sfc/rx_common.c
··· 45 45 unsigned int index; 46 46 struct page *page; 47 47 48 + if (unlikely(!rx_queue->page_ring)) 49 + return NULL; 48 50 index = rx_queue->page_remove & rx_queue->page_ptr_mask; 49 51 page = rx_queue->page_ring[index]; 50 52 if (page == NULL) ··· 115 113 unsigned int n_frags) 116 114 { 117 115 struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel); 116 + 117 + if (unlikely(!rx_queue->page_ring)) 118 + return; 118 119 119 120 do { 120 121 efx_recycle_rx_page(channel, rx_buf);
+6 -4
drivers/net/ieee802154/atusb.c
··· 93 93 94 94 ret = usb_control_msg(usb_dev, pipe, request, requesttype, 95 95 value, index, data, size, timeout); 96 - if (ret < 0) { 96 + if (ret < size) { 97 + ret = ret < 0 ? ret : -ENODATA; 98 + 97 99 atusb->err = ret; 98 100 dev_err(&usb_dev->dev, 99 101 "%s: req 0x%02x val 0x%x idx 0x%x, error %d\n", ··· 863 861 if (!build) 864 862 return -ENOMEM; 865 863 866 - ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), 867 - ATUSB_BUILD, ATUSB_REQ_FROM_DEV, 0, 0, 868 - build, ATUSB_BUILD_SIZE, 1000); 864 + /* We cannot call atusb_control_msg() here, since this request may read various length data */ 865 + ret = usb_control_msg(atusb->usb_dev, usb_rcvctrlpipe(usb_dev, 0), ATUSB_BUILD, 866 + ATUSB_REQ_FROM_DEV, 0, 0, build, ATUSB_BUILD_SIZE, 1000); 869 867 if (ret >= 0) { 870 868 build[ret] = 0; 871 869 dev_info(&usb_dev->dev, "Firmware: build %s\n", build);
+2 -2
drivers/net/phy/fixed_phy.c
··· 239 239 /* Check if we have a GPIO associated with this fixed phy */ 240 240 if (!gpiod) { 241 241 gpiod = fixed_phy_get_gpiod(np); 242 - if (!gpiod) 243 - return ERR_PTR(-EINVAL); 242 + if (IS_ERR(gpiod)) 243 + return ERR_CAST(gpiod); 244 244 } 245 245 246 246 /* Get the next available PHY address, up to PHY_MAX_ADDR */
+6 -3
drivers/net/usb/r8152.c
··· 9642 9642 netdev->hw_features &= ~NETIF_F_RXCSUM; 9643 9643 } 9644 9644 9645 - if (udev->parent && 9646 - le16_to_cpu(udev->parent->descriptor.idVendor) == VENDOR_ID_LENOVO) { 9647 - tp->lenovo_macpassthru = 1; 9645 + if (le16_to_cpu(udev->descriptor.idVendor) == VENDOR_ID_LENOVO) { 9646 + switch (le16_to_cpu(udev->descriptor.idProduct)) { 9647 + case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2: 9648 + case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2: 9649 + tp->lenovo_macpassthru = 1; 9650 + } 9648 9651 } 9649 9652 9650 9653 if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x3011 && udev->serial &&
+5
drivers/net/usb/rndis_host.c
··· 609 609 USB_CLASS_COMM, 2 /* ACM */, 0x0ff), 610 610 .driver_info = (unsigned long) &rndis_poll_status_info, 611 611 }, { 612 + /* Hytera Communications DMR radios' "Radio to PC Network" */ 613 + USB_VENDOR_AND_INTERFACE_INFO(0x238b, 614 + USB_CLASS_COMM, 2 /* ACM */, 0x0ff), 615 + .driver_info = (unsigned long)&rndis_info, 616 + }, { 612 617 /* RNDIS is MSFT's un-official variant of CDC ACM */ 613 618 USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff), 614 619 .driver_info = (unsigned long) &rndis_info,
+4 -2
drivers/scsi/libiscsi.c
··· 3100 3100 { 3101 3101 struct iscsi_conn *conn = cls_conn->dd_data; 3102 3102 struct iscsi_session *session = conn->session; 3103 + char *tmp_persistent_address = conn->persistent_address; 3104 + char *tmp_local_ipaddr = conn->local_ipaddr; 3103 3105 3104 3106 del_timer_sync(&conn->transport_timer); 3105 3107 ··· 3123 3121 spin_lock_bh(&session->frwd_lock); 3124 3122 free_pages((unsigned long) conn->data, 3125 3123 get_order(ISCSI_DEF_MAX_RECV_SEG_LEN)); 3126 - kfree(conn->persistent_address); 3127 - kfree(conn->local_ipaddr); 3128 3124 /* regular RX path uses back_lock */ 3129 3125 spin_lock_bh(&session->back_lock); 3130 3126 kfifo_in(&session->cmdpool.queue, (void*)&conn->login_task, ··· 3134 3134 mutex_unlock(&session->eh_mutex); 3135 3135 3136 3136 iscsi_destroy_conn(cls_conn); 3137 + kfree(tmp_persistent_address); 3138 + kfree(tmp_local_ipaddr); 3137 3139 } 3138 3140 EXPORT_SYMBOL_GPL(iscsi_conn_teardown); 3139 3141
+2 -2
drivers/scsi/lpfc/lpfc_debugfs.c
··· 2954 2954 char mybuf[64]; 2955 2955 char *pbuf; 2956 2956 2957 - if (nbytes > 64) 2958 - nbytes = 64; 2957 + if (nbytes > 63) 2958 + nbytes = 63; 2959 2959 2960 2960 memset(mybuf, 0, sizeof(mybuf)); 2961 2961
+5 -2
drivers/scsi/vmw_pvscsi.c
··· 586 586 * Commands like INQUIRY may transfer less data than 587 587 * requested by the initiator via bufflen. Set residual 588 588 * count to make upper layer aware of the actual amount 589 - * of data returned. 589 + * of data returned. There are cases when controller 590 + * returns zero dataLen with non zero data - do not set 591 + * residual count in that case. 590 592 */ 591 - scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); 593 + if (e->dataLen && (e->dataLen < scsi_bufflen(cmd))) 594 + scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); 592 595 cmd->result = (DID_OK << 16); 593 596 break; 594 597
+4 -5
fs/namespace.c
··· 4263 4263 return err; 4264 4264 4265 4265 err = user_path_at(dfd, path, kattr.lookup_flags, &target); 4266 - if (err) 4267 - return err; 4268 - 4269 - err = do_mount_setattr(&target, &kattr); 4266 + if (!err) { 4267 + err = do_mount_setattr(&target, &kattr); 4268 + path_put(&target); 4269 + } 4270 4270 finish_mount_kattr(&kattr); 4271 - path_put(&target); 4272 4271 return err; 4273 4272 } 4274 4273
+2
include/linux/ipv6.h
··· 133 133 __u16 dsthao; 134 134 #endif 135 135 __u16 frag_max_size; 136 + __u16 srhoff; 136 137 137 138 #define IP6SKB_XFRM_TRANSFORMED 1 138 139 #define IP6SKB_FORWARDED 2 ··· 143 142 #define IP6SKB_HOPBYHOP 32 144 143 #define IP6SKB_L3SLAVE 64 145 144 #define IP6SKB_JUMBOGRAM 128 145 + #define IP6SKB_SEG6 256 146 146 }; 147 147 148 148 #if defined(CONFIG_NET_L3_MASTER_DEV)
+1
include/linux/mmzone.h
··· 277 277 VMSCAN_THROTTLE_WRITEBACK, 278 278 VMSCAN_THROTTLE_ISOLATED, 279 279 VMSCAN_THROTTLE_NOPROGRESS, 280 + VMSCAN_THROTTLE_CONGESTED, 280 281 NR_VMSCAN_THROTTLE, 281 282 }; 282 283
+1 -2
include/net/sctp/sctp.h
··· 112 112 struct rhashtable_iter *iter); 113 113 struct sctp_transport *sctp_transport_get_idx(struct net *net, 114 114 struct rhashtable_iter *iter, int pos); 115 - int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *), 116 - struct net *net, 115 + int sctp_transport_lookup_process(sctp_callback_t cb, struct net *net, 117 116 const union sctp_addr *laddr, 118 117 const union sctp_addr *paddr, void *p); 119 118 int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
+21
include/net/seg6.h
··· 58 58 extern void seg6_local_exit(void); 59 59 60 60 extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len, bool reduced); 61 + extern struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags); 62 + extern void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt); 61 63 extern int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, 62 64 int proto); 63 65 extern int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh); 64 66 extern int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr, 65 67 u32 tbl_id); 68 + 69 + /* If the packet which invoked an ICMP error contains an SRH return 70 + * the true destination address from within the SRH, otherwise use the 71 + * destination address in the IP header. 72 + */ 73 + static inline const struct in6_addr *seg6_get_daddr(struct sk_buff *skb, 74 + struct inet6_skb_parm *opt) 75 + { 76 + struct ipv6_sr_hdr *srh; 77 + 78 + if (opt->flags & IP6SKB_SEG6) { 79 + srh = (struct ipv6_sr_hdr *)(skb->data + opt->srhoff); 80 + return &srh->segments[0]; 81 + } 82 + 83 + return NULL; 84 + } 85 + 86 + 66 87 #endif
+3 -1
include/trace/events/vmscan.h
··· 30 30 #define _VMSCAN_THROTTLE_WRITEBACK (1 << VMSCAN_THROTTLE_WRITEBACK) 31 31 #define _VMSCAN_THROTTLE_ISOLATED (1 << VMSCAN_THROTTLE_ISOLATED) 32 32 #define _VMSCAN_THROTTLE_NOPROGRESS (1 << VMSCAN_THROTTLE_NOPROGRESS) 33 + #define _VMSCAN_THROTTLE_CONGESTED (1 << VMSCAN_THROTTLE_CONGESTED) 33 34 34 35 #define show_throttle_flags(flags) \ 35 36 (flags) ? __print_flags(flags, "|", \ 36 37 {_VMSCAN_THROTTLE_WRITEBACK, "VMSCAN_THROTTLE_WRITEBACK"}, \ 37 38 {_VMSCAN_THROTTLE_ISOLATED, "VMSCAN_THROTTLE_ISOLATED"}, \ 38 - {_VMSCAN_THROTTLE_NOPROGRESS, "VMSCAN_THROTTLE_NOPROGRESS"} \ 39 + {_VMSCAN_THROTTLE_NOPROGRESS, "VMSCAN_THROTTLE_NOPROGRESS"}, \ 40 + {_VMSCAN_THROTTLE_CONGESTED, "VMSCAN_THROTTLE_CONGESTED"} \ 39 41 ) : "VMSCAN_THROTTLE_NONE" 40 42 41 43
+7 -2
mm/damon/dbgfs.c
··· 353 353 const char __user *buf, size_t count, loff_t *ppos) 354 354 { 355 355 struct damon_ctx *ctx = file->private_data; 356 + struct damon_target *t, *next_t; 356 357 bool id_is_pid = true; 357 358 char *kbuf, *nrs; 358 359 unsigned long *targets; ··· 398 397 goto unlock_out; 399 398 } 400 399 401 - /* remove targets with previously-set primitive */ 402 - damon_set_targets(ctx, NULL, 0); 400 + /* remove previously set targets */ 401 + damon_for_each_target_safe(t, next_t, ctx) { 402 + if (targetid_is_pid(ctx)) 403 + put_pid((struct pid *)t->id); 404 + damon_destroy_target(t); 405 + } 403 406 404 407 /* Configure the context for the address space type */ 405 408 if (id_is_pid)
+56 -9
mm/vmscan.c
··· 1021 1021 unlock_page(page); 1022 1022 } 1023 1023 1024 + static bool skip_throttle_noprogress(pg_data_t *pgdat) 1025 + { 1026 + int reclaimable = 0, write_pending = 0; 1027 + int i; 1028 + 1029 + /* 1030 + * If kswapd is disabled, reschedule if necessary but do not 1031 + * throttle as the system is likely near OOM. 1032 + */ 1033 + if (pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES) 1034 + return true; 1035 + 1036 + /* 1037 + * If there are a lot of dirty/writeback pages then do not 1038 + * throttle as throttling will occur when the pages cycle 1039 + * towards the end of the LRU if still under writeback. 1040 + */ 1041 + for (i = 0; i < MAX_NR_ZONES; i++) { 1042 + struct zone *zone = pgdat->node_zones + i; 1043 + 1044 + if (!populated_zone(zone)) 1045 + continue; 1046 + 1047 + reclaimable += zone_reclaimable_pages(zone); 1048 + write_pending += zone_page_state_snapshot(zone, 1049 + NR_ZONE_WRITE_PENDING); 1050 + } 1051 + if (2 * write_pending <= reclaimable) 1052 + return true; 1053 + 1054 + return false; 1055 + } 1056 + 1024 1057 void reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason) 1025 1058 { 1026 1059 wait_queue_head_t *wqh = &pgdat->reclaim_wait[reason]; ··· 1089 1056 } 1090 1057 1091 1058 break; 1059 + case VMSCAN_THROTTLE_CONGESTED: 1060 + fallthrough; 1092 1061 case VMSCAN_THROTTLE_NOPROGRESS: 1093 - timeout = HZ/2; 1062 + if (skip_throttle_noprogress(pgdat)) { 1063 + cond_resched(); 1064 + return; 1065 + } 1066 + 1067 + timeout = 1; 1068 + 1094 1069 break; 1095 1070 case VMSCAN_THROTTLE_ISOLATED: 1096 1071 timeout = HZ/50; ··· 3362 3321 if (!current_is_kswapd() && current_may_throttle() && 3363 3322 !sc->hibernation_mode && 3364 3323 test_bit(LRUVEC_CONGESTED, &target_lruvec->flags)) 3365 - reclaim_throttle(pgdat, VMSCAN_THROTTLE_WRITEBACK); 3324 + reclaim_throttle(pgdat, VMSCAN_THROTTLE_CONGESTED); 3366 3325 3367 3326 if (should_continue_reclaim(pgdat, sc->nr_reclaimed - nr_reclaimed, 3368 3327 sc)) ··· 3427 3386 } 3428 3387 3429 3388 /* 3430 - * Do not throttle kswapd on NOPROGRESS as it will throttle on 3431 - * VMSCAN_THROTTLE_WRITEBACK if there are too many pages under 3432 - * writeback and marked for immediate reclaim at the tail of 3433 - * the LRU. 3389 + * Do not throttle kswapd or cgroup reclaim on NOPROGRESS as it will 3390 + * throttle on VMSCAN_THROTTLE_WRITEBACK if there are too many pages 3391 + * under writeback and marked for immediate reclaim at the tail of the 3392 + * LRU. 3434 3393 */ 3435 - if (current_is_kswapd()) 3394 + if (current_is_kswapd() || cgroup_reclaim(sc)) 3436 3395 return; 3437 3396 3438 3397 /* Throttle if making no progress at high prioities. */ 3439 - if (sc->priority < DEF_PRIORITY - 2) 3398 + if (sc->priority == 1 && !sc->nr_reclaimed) 3440 3399 reclaim_throttle(pgdat, VMSCAN_THROTTLE_NOPROGRESS); 3441 3400 } 3442 3401 ··· 3456 3415 unsigned long nr_soft_scanned; 3457 3416 gfp_t orig_mask; 3458 3417 pg_data_t *last_pgdat = NULL; 3418 + pg_data_t *first_pgdat = NULL; 3459 3419 3460 3420 /* 3461 3421 * If the number of buffer_heads in the machine exceeds the maximum ··· 3520 3478 /* need some check for avoid more shrink_zone() */ 3521 3479 } 3522 3480 3481 + if (!first_pgdat) 3482 + first_pgdat = zone->zone_pgdat; 3483 + 3523 3484 /* See comment about same check for global reclaim above */ 3524 3485 if (zone->zone_pgdat == last_pgdat) 3525 3486 continue; 3526 3487 last_pgdat = zone->zone_pgdat; 3527 3488 shrink_node(zone->zone_pgdat, sc); 3528 - consider_reclaim_throttle(zone->zone_pgdat, sc); 3529 3489 } 3490 + 3491 + if (first_pgdat) 3492 + consider_reclaim_throttle(first_pgdat, sc); 3530 3493 3531 3494 /* 3532 3495 * Restore to original mask to avoid the impact on the caller if we
+10 -5
net/batman-adv/multicast.c
··· 1339 1339 * @bat_priv: the bat priv with all the soft interface information 1340 1340 * @skb: The multicast packet to check 1341 1341 * @orig: an originator to be set to forward the skb to 1342 + * @is_routable: stores whether the destination is routable 1342 1343 * 1343 1344 * Return: the forwarding mode as enum batadv_forw_mode and in case of 1344 1345 * BATADV_FORW_SINGLE set the orig to the single originator the skb ··· 1347 1346 */ 1348 1347 enum batadv_forw_mode 1349 1348 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 1350 - struct batadv_orig_node **orig) 1349 + struct batadv_orig_node **orig, int *is_routable) 1351 1350 { 1352 1351 int ret, tt_count, ip_count, unsnoop_count, total_count; 1353 1352 bool is_unsnoopable = false; 1354 1353 unsigned int mcast_fanout; 1355 1354 struct ethhdr *ethhdr; 1356 - int is_routable = 0; 1357 1355 int rtr_count = 0; 1358 1356 1359 1357 ret = batadv_mcast_forw_mode_check(bat_priv, skb, &is_unsnoopable, 1360 - &is_routable); 1358 + is_routable); 1361 1359 if (ret == -ENOMEM) 1362 1360 return BATADV_FORW_NONE; 1363 1361 else if (ret < 0) ··· 1369 1369 ip_count = batadv_mcast_forw_want_all_ip_count(bat_priv, ethhdr); 1370 1370 unsnoop_count = !is_unsnoopable ? 0 : 1371 1371 atomic_read(&bat_priv->mcast.num_want_all_unsnoopables); 1372 - rtr_count = batadv_mcast_forw_rtr_count(bat_priv, is_routable); 1372 + rtr_count = batadv_mcast_forw_rtr_count(bat_priv, *is_routable); 1373 1373 1374 1374 total_count = tt_count + ip_count + unsnoop_count + rtr_count; 1375 1375 ··· 1689 1689 * @bat_priv: the bat priv with all the soft interface information 1690 1690 * @skb: the multicast packet to transmit 1691 1691 * @vid: the vlan identifier 1692 + * @is_routable: stores whether the destination is routable 1692 1693 * 1693 1694 * Sends copies of a frame with multicast destination to any node that signaled 1694 1695 * interest in it, that is either via the translation table or the according ··· 1702 1701 * is neither IPv4 nor IPv6. NET_XMIT_SUCCESS otherwise. 1703 1702 */ 1704 1703 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 1705 - unsigned short vid) 1704 + unsigned short vid, int is_routable) 1706 1705 { 1707 1706 int ret; 1708 1707 ··· 1718 1717 return ret; 1719 1718 } 1720 1719 1720 + if (!is_routable) 1721 + goto skip_mc_router; 1722 + 1721 1723 ret = batadv_mcast_forw_want_rtr(bat_priv, skb, vid); 1722 1724 if (ret != NET_XMIT_SUCCESS) { 1723 1725 kfree_skb(skb); 1724 1726 return ret; 1725 1727 } 1726 1728 1729 + skip_mc_router: 1727 1730 consume_skb(skb); 1728 1731 return ret; 1729 1732 }
+6 -4
net/batman-adv/multicast.h
··· 43 43 44 44 enum batadv_forw_mode 45 45 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 46 - struct batadv_orig_node **mcast_single_orig); 46 + struct batadv_orig_node **mcast_single_orig, 47 + int *is_routable); 47 48 48 49 int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv, 49 50 struct sk_buff *skb, ··· 52 51 struct batadv_orig_node *orig_node); 53 52 54 53 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 55 - unsigned short vid); 54 + unsigned short vid, int is_routable); 56 55 57 56 void batadv_mcast_init(struct batadv_priv *bat_priv); 58 57 ··· 69 68 70 69 static inline enum batadv_forw_mode 71 70 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 72 - struct batadv_orig_node **mcast_single_orig) 71 + struct batadv_orig_node **mcast_single_orig, 72 + int *is_routable) 73 73 { 74 74 return BATADV_FORW_ALL; 75 75 } ··· 87 85 88 86 static inline int 89 87 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 90 - unsigned short vid) 88 + unsigned short vid, int is_routable) 91 89 { 92 90 kfree_skb(skb); 93 91 return NET_XMIT_DROP;
+5 -2
net/batman-adv/soft-interface.c
··· 198 198 int gw_mode; 199 199 enum batadv_forw_mode forw_mode = BATADV_FORW_SINGLE; 200 200 struct batadv_orig_node *mcast_single_orig = NULL; 201 + int mcast_is_routable = 0; 201 202 int network_offset = ETH_HLEN; 202 203 __be16 proto; 203 204 ··· 301 300 send: 302 301 if (do_bcast && !is_broadcast_ether_addr(ethhdr->h_dest)) { 303 302 forw_mode = batadv_mcast_forw_mode(bat_priv, skb, 304 - &mcast_single_orig); 303 + &mcast_single_orig, 304 + &mcast_is_routable); 305 305 if (forw_mode == BATADV_FORW_NONE) 306 306 goto dropped; 307 307 ··· 361 359 ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid, 362 360 mcast_single_orig); 363 361 } else if (forw_mode == BATADV_FORW_SOME) { 364 - ret = batadv_mcast_forw_send(bat_priv, skb, vid); 362 + ret = batadv_mcast_forw_send(bat_priv, skb, vid, 363 + mcast_is_routable); 365 364 } else { 366 365 if (batadv_dat_snoop_outgoing_arp_request(bat_priv, 367 366 skb))
+4
net/core/lwtunnel.c
··· 197 197 nla_entype = nla_find(attrs, attrlen, RTA_ENCAP_TYPE); 198 198 199 199 if (nla_entype) { 200 + if (nla_len(nla_entype) < sizeof(u16)) { 201 + NL_SET_ERR_MSG(extack, "Invalid RTA_ENCAP_TYPE"); 202 + return -EINVAL; 203 + } 200 204 encap_type = nla_get_u16(nla_entype); 201 205 202 206 if (lwtunnel_valid_encap_type(encap_type,
+43 -6
net/ipv4/fib_semantics.c
··· 662 662 return nhs; 663 663 } 664 664 665 + static int fib_gw_from_attr(__be32 *gw, struct nlattr *nla, 666 + struct netlink_ext_ack *extack) 667 + { 668 + if (nla_len(nla) < sizeof(*gw)) { 669 + NL_SET_ERR_MSG(extack, "Invalid IPv4 address in RTA_GATEWAY"); 670 + return -EINVAL; 671 + } 672 + 673 + *gw = nla_get_in_addr(nla); 674 + 675 + return 0; 676 + } 677 + 665 678 /* only called when fib_nh is integrated into fib_info */ 666 679 static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, 667 680 int remaining, struct fib_config *cfg, ··· 717 704 return -EINVAL; 718 705 } 719 706 if (nla) { 720 - fib_cfg.fc_gw4 = nla_get_in_addr(nla); 707 + ret = fib_gw_from_attr(&fib_cfg.fc_gw4, nla, 708 + extack); 709 + if (ret) 710 + goto errout; 711 + 721 712 if (fib_cfg.fc_gw4) 722 713 fib_cfg.fc_gw_family = AF_INET; 723 714 } else if (nlav) { ··· 731 714 } 732 715 733 716 nla = nla_find(attrs, attrlen, RTA_FLOW); 734 - if (nla) 717 + if (nla) { 718 + if (nla_len(nla) < sizeof(u32)) { 719 + NL_SET_ERR_MSG(extack, "Invalid RTA_FLOW"); 720 + return -EINVAL; 721 + } 735 722 fib_cfg.fc_flow = nla_get_u32(nla); 723 + } 736 724 737 725 fib_cfg.fc_encap = nla_find(attrs, attrlen, RTA_ENCAP); 726 + /* RTA_ENCAP_TYPE length checked in 727 + * lwtunnel_valid_encap_type_attr 728 + */ 738 729 nla = nla_find(attrs, attrlen, RTA_ENCAP_TYPE); 739 730 if (nla) 740 731 fib_cfg.fc_encap_type = nla_get_u16(nla); ··· 927 902 attrlen = rtnh_attrlen(rtnh); 928 903 if (attrlen > 0) { 929 904 struct nlattr *nla, *nlav, *attrs = rtnh_attrs(rtnh); 905 + int err; 930 906 931 907 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 932 908 nlav = nla_find(attrs, attrlen, RTA_VIA); ··· 938 912 } 939 913 940 914 if (nla) { 915 + __be32 gw; 916 + 917 + err = fib_gw_from_attr(&gw, nla, extack); 918 + if (err) 919 + return err; 920 + 941 921 if (nh->fib_nh_gw_family != AF_INET || 942 - nla_get_in_addr(nla) != nh->fib_nh_gw4) 922 + gw != nh->fib_nh_gw4) 943 923 return 1; 944 924 } else if (nlav) { 945 925 struct fib_config cfg2; 946 - int err; 947 926 948 927 err = fib_gw_from_via(&cfg2, nlav, extack); 949 928 if (err) ··· 971 940 972 941 #ifdef CONFIG_IP_ROUTE_CLASSID 973 942 nla = nla_find(attrs, attrlen, RTA_FLOW); 974 - if (nla && nla_get_u32(nla) != nh->nh_tclassid) 975 - return 1; 943 + if (nla) { 944 + if (nla_len(nla) < sizeof(u32)) { 945 + NL_SET_ERR_MSG(extack, "Invalid RTA_FLOW"); 946 + return -EINVAL; 947 + } 948 + if (nla_get_u32(nla) != nh->nh_tclassid) 949 + return 1; 950 + } 976 951 #endif 977 952 } 978 953
+5 -1
net/ipv6/icmp.c
··· 57 57 #include <net/protocol.h> 58 58 #include <net/raw.h> 59 59 #include <net/rawv6.h> 60 + #include <net/seg6.h> 60 61 #include <net/transp_v6.h> 61 62 #include <net/ip6_route.h> 62 63 #include <net/addrconf.h> ··· 821 820 822 821 void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info) 823 822 { 823 + struct inet6_skb_parm *opt = IP6CB(skb); 824 824 const struct inet6_protocol *ipprot; 825 825 int inner_offset; 826 826 __be16 frag_off; ··· 830 828 831 829 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 832 830 goto out; 831 + 832 + seg6_icmp_srh(skb, opt); 833 833 834 834 nexthdr = ((struct ipv6hdr *)skb->data)->nexthdr; 835 835 if (ipv6_ext_hdr(nexthdr)) { ··· 857 853 858 854 ipprot = rcu_dereference(inet6_protos[nexthdr]); 859 855 if (ipprot && ipprot->err_handler) 860 - ipprot->err_handler(skb, NULL, type, code, inner_offset, info); 856 + ipprot->err_handler(skb, opt, type, code, inner_offset, info); 861 857 862 858 raw6_icmp_error(skb, nexthdr, type, code, inner_offset, info); 863 859 return;
+30 -2
net/ipv6/route.c
··· 5210 5210 return should_notify; 5211 5211 } 5212 5212 5213 + static int fib6_gw_from_attr(struct in6_addr *gw, struct nlattr *nla, 5214 + struct netlink_ext_ack *extack) 5215 + { 5216 + if (nla_len(nla) < sizeof(*gw)) { 5217 + NL_SET_ERR_MSG(extack, "Invalid IPv6 address in RTA_GATEWAY"); 5218 + return -EINVAL; 5219 + } 5220 + 5221 + *gw = nla_get_in6_addr(nla); 5222 + 5223 + return 0; 5224 + } 5225 + 5213 5226 static int ip6_route_multipath_add(struct fib6_config *cfg, 5214 5227 struct netlink_ext_ack *extack) 5215 5228 { ··· 5263 5250 5264 5251 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 5265 5252 if (nla) { 5266 - r_cfg.fc_gateway = nla_get_in6_addr(nla); 5253 + err = fib6_gw_from_attr(&r_cfg.fc_gateway, nla, 5254 + extack); 5255 + if (err) 5256 + goto cleanup; 5257 + 5267 5258 r_cfg.fc_flags |= RTF_GATEWAY; 5268 5259 } 5269 5260 r_cfg.fc_encap = nla_find(attrs, attrlen, RTA_ENCAP); 5261 + 5262 + /* RTA_ENCAP_TYPE length checked in 5263 + * lwtunnel_valid_encap_type_attr 5264 + */ 5270 5265 nla = nla_find(attrs, attrlen, RTA_ENCAP_TYPE); 5271 5266 if (nla) 5272 5267 r_cfg.fc_encap_type = nla_get_u16(nla); ··· 5441 5420 5442 5421 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 5443 5422 if (nla) { 5444 - nla_memcpy(&r_cfg.fc_gateway, nla, 16); 5423 + err = fib6_gw_from_attr(&r_cfg.fc_gateway, nla, 5424 + extack); 5425 + if (err) { 5426 + last_err = err; 5427 + goto next_rtnh; 5428 + } 5429 + 5445 5430 r_cfg.fc_flags |= RTF_GATEWAY; 5446 5431 } 5447 5432 } ··· 5455 5428 if (err) 5456 5429 last_err = err; 5457 5430 5431 + next_rtnh: 5458 5432 rtnh = rtnh_next(rtnh, &remaining); 5459 5433 } 5460 5434
+59
net/ipv6/seg6.c
··· 75 75 return true; 76 76 } 77 77 78 + struct ipv6_sr_hdr *seg6_get_srh(struct sk_buff *skb, int flags) 79 + { 80 + struct ipv6_sr_hdr *srh; 81 + int len, srhoff = 0; 82 + 83 + if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, &flags) < 0) 84 + return NULL; 85 + 86 + if (!pskb_may_pull(skb, srhoff + sizeof(*srh))) 87 + return NULL; 88 + 89 + srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); 90 + 91 + len = (srh->hdrlen + 1) << 3; 92 + 93 + if (!pskb_may_pull(skb, srhoff + len)) 94 + return NULL; 95 + 96 + /* note that pskb_may_pull may change pointers in header; 97 + * for this reason it is necessary to reload them when needed. 98 + */ 99 + srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); 100 + 101 + if (!seg6_validate_srh(srh, len, true)) 102 + return NULL; 103 + 104 + return srh; 105 + } 106 + 107 + /* Determine if an ICMP invoking packet contains a segment routing 108 + * header. If it does, extract the offset to the true destination 109 + * address, which is in the first segment address. 110 + */ 111 + void seg6_icmp_srh(struct sk_buff *skb, struct inet6_skb_parm *opt) 112 + { 113 + __u16 network_header = skb->network_header; 114 + struct ipv6_sr_hdr *srh; 115 + 116 + /* Update network header to point to the invoking packet 117 + * inside the ICMP packet, so we can use the seg6_get_srh() 118 + * helper. 119 + */ 120 + skb_reset_network_header(skb); 121 + 122 + srh = seg6_get_srh(skb, 0); 123 + if (!srh) 124 + goto out; 125 + 126 + if (srh->type != IPV6_SRCRT_TYPE_4) 127 + goto out; 128 + 129 + opt->flags |= IP6SKB_SEG6; 130 + opt->srhoff = (unsigned char *)srh - skb->data; 131 + 132 + out: 133 + /* Restore the network header back to the ICMP packet */ 134 + skb->network_header = network_header; 135 + } 136 + 78 137 static struct genl_family seg6_genl_family; 79 138 80 139 static const struct nla_policy seg6_genl_policy[SEG6_ATTR_MAX + 1] = {
+2 -31
net/ipv6/seg6_local.c
··· 151 151 return (struct seg6_local_lwt *)lwt->data; 152 152 } 153 153 154 - static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb, int flags) 155 - { 156 - struct ipv6_sr_hdr *srh; 157 - int len, srhoff = 0; 158 - 159 - if (ipv6_find_hdr(skb, &srhoff, IPPROTO_ROUTING, NULL, &flags) < 0) 160 - return NULL; 161 - 162 - if (!pskb_may_pull(skb, srhoff + sizeof(*srh))) 163 - return NULL; 164 - 165 - srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); 166 - 167 - len = (srh->hdrlen + 1) << 3; 168 - 169 - if (!pskb_may_pull(skb, srhoff + len)) 170 - return NULL; 171 - 172 - /* note that pskb_may_pull may change pointers in header; 173 - * for this reason it is necessary to reload them when needed. 174 - */ 175 - srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); 176 - 177 - if (!seg6_validate_srh(srh, len, true)) 178 - return NULL; 179 - 180 - return srh; 181 - } 182 - 183 154 static struct ipv6_sr_hdr *get_and_validate_srh(struct sk_buff *skb) 184 155 { 185 156 struct ipv6_sr_hdr *srh; 186 157 187 - srh = get_srh(skb, IP6_FH_F_SKIP_RH); 158 + srh = seg6_get_srh(skb, IP6_FH_F_SKIP_RH); 188 159 if (!srh) 189 160 return NULL; 190 161 ··· 172 201 struct ipv6_sr_hdr *srh; 173 202 unsigned int off = 0; 174 203 175 - srh = get_srh(skb, 0); 204 + srh = seg6_get_srh(skb, 0); 176 205 if (srh && srh->segments_left > 0) 177 206 return false; 178 207
+2 -1
net/ipv6/udp.c
··· 41 41 #include <net/transp_v6.h> 42 42 #include <net/ip6_route.h> 43 43 #include <net/raw.h> 44 + #include <net/seg6.h> 44 45 #include <net/tcp_states.h> 45 46 #include <net/ip6_checksum.h> 46 47 #include <net/ip6_tunnel.h> ··· 563 562 struct ipv6_pinfo *np; 564 563 const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data; 565 564 const struct in6_addr *saddr = &hdr->saddr; 566 - const struct in6_addr *daddr = &hdr->daddr; 565 + const struct in6_addr *daddr = seg6_get_daddr(skb, opt) ? : &hdr->daddr; 567 566 struct udphdr *uh = (struct udphdr *)(skb->data+offset); 568 567 bool tunnel = false; 569 568 struct sock *sk;
+22 -2
net/mac80211/ieee80211_i.h
··· 647 647 struct cfg80211_csa_settings settings; 648 648 }; 649 649 650 + /** 651 + * struct mesh_table 652 + * 653 + * @known_gates: list of known mesh gates and their mpaths by the station. The 654 + * gate's mpath may or may not be resolved and active. 655 + * @gates_lock: protects updates to known_gates 656 + * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr 657 + * @walk_head: linked list containing all mesh_path objects 658 + * @walk_lock: lock protecting walk_head 659 + * @entries: number of entries in the table 660 + */ 661 + struct mesh_table { 662 + struct hlist_head known_gates; 663 + spinlock_t gates_lock; 664 + struct rhashtable rhead; 665 + struct hlist_head walk_head; 666 + spinlock_t walk_lock; 667 + atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ 668 + }; 669 + 650 670 struct ieee80211_if_mesh { 651 671 struct timer_list housekeeping_timer; 652 672 struct timer_list mesh_path_timer; ··· 741 721 /* offset from skb->data while building IE */ 742 722 int meshconf_offset; 743 723 744 - struct mesh_table *mesh_paths; 745 - struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */ 724 + struct mesh_table mesh_paths; 725 + struct mesh_table mpp_paths; /* Store paths for MPP&MAP */ 746 726 int mesh_paths_generation; 747 727 int mpp_paths_generation; 748 728 };
+1 -21
net/mac80211/mesh.h
··· 127 127 u32 path_change_count; 128 128 }; 129 129 130 - /** 131 - * struct mesh_table 132 - * 133 - * @known_gates: list of known mesh gates and their mpaths by the station. The 134 - * gate's mpath may or may not be resolved and active. 135 - * @gates_lock: protects updates to known_gates 136 - * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr 137 - * @walk_head: linked list containing all mesh_path objects 138 - * @walk_lock: lock protecting walk_head 139 - * @entries: number of entries in the table 140 - */ 141 - struct mesh_table { 142 - struct hlist_head known_gates; 143 - spinlock_t gates_lock; 144 - struct rhashtable rhead; 145 - struct hlist_head walk_head; 146 - spinlock_t walk_lock; 147 - atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ 148 - }; 149 - 150 130 /* Recent multicast cache */ 151 131 /* RMC_BUCKETS must be a power of 2, maximum 256 */ 152 132 #define RMC_BUCKETS 256 ··· 288 308 void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta); 289 309 void mesh_path_flush_pending(struct mesh_path *mpath); 290 310 void mesh_path_tx_pending(struct mesh_path *mpath); 291 - int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata); 311 + void mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata); 292 312 void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata); 293 313 int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr); 294 314 void mesh_path_timer(struct timer_list *t);
+31 -58
net/mac80211/mesh_pathtbl.c
··· 47 47 mesh_path_free_rcu(tbl, mpath); 48 48 } 49 49 50 - static struct mesh_table *mesh_table_alloc(void) 50 + static void mesh_table_init(struct mesh_table *tbl) 51 51 { 52 - struct mesh_table *newtbl; 52 + INIT_HLIST_HEAD(&tbl->known_gates); 53 + INIT_HLIST_HEAD(&tbl->walk_head); 54 + atomic_set(&tbl->entries, 0); 55 + spin_lock_init(&tbl->gates_lock); 56 + spin_lock_init(&tbl->walk_lock); 53 57 54 - newtbl = kmalloc(sizeof(struct mesh_table), GFP_ATOMIC); 55 - if (!newtbl) 56 - return NULL; 57 - 58 - INIT_HLIST_HEAD(&newtbl->known_gates); 59 - INIT_HLIST_HEAD(&newtbl->walk_head); 60 - atomic_set(&newtbl->entries, 0); 61 - spin_lock_init(&newtbl->gates_lock); 62 - spin_lock_init(&newtbl->walk_lock); 63 - if (rhashtable_init(&newtbl->rhead, &mesh_rht_params)) { 64 - kfree(newtbl); 65 - return NULL; 66 - } 67 - 68 - return newtbl; 58 + /* rhashtable_init() may fail only in case of wrong 59 + * mesh_rht_params 60 + */ 61 + WARN_ON(rhashtable_init(&tbl->rhead, &mesh_rht_params)); 69 62 } 70 63 71 64 static void mesh_table_free(struct mesh_table *tbl) 72 65 { 73 66 rhashtable_free_and_destroy(&tbl->rhead, 74 67 mesh_path_rht_free, tbl); 75 - kfree(tbl); 76 68 } 77 69 78 70 /** ··· 230 238 struct mesh_path * 231 239 mesh_path_lookup(struct ieee80211_sub_if_data *sdata, const u8 *dst) 232 240 { 233 - return mpath_lookup(sdata->u.mesh.mesh_paths, dst, sdata); 241 + return mpath_lookup(&sdata->u.mesh.mesh_paths, dst, sdata); 234 242 } 235 243 236 244 struct mesh_path * 237 245 mpp_path_lookup(struct ieee80211_sub_if_data *sdata, const u8 *dst) 238 246 { 239 - return mpath_lookup(sdata->u.mesh.mpp_paths, dst, sdata); 247 + return mpath_lookup(&sdata->u.mesh.mpp_paths, dst, sdata); 240 248 } 241 249 242 250 static struct mesh_path * ··· 273 281 struct mesh_path * 274 282 mesh_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata, int idx) 275 283 { 276 - return __mesh_path_lookup_by_idx(sdata->u.mesh.mesh_paths, idx); 284 + return __mesh_path_lookup_by_idx(&sdata->u.mesh.mesh_paths, idx); 277 285 } 278 286 279 287 /** ··· 288 296 struct mesh_path * 289 297 mpp_path_lookup_by_idx(struct ieee80211_sub_if_data *sdata, int idx) 290 298 { 291 - return __mesh_path_lookup_by_idx(sdata->u.mesh.mpp_paths, idx); 299 + return __mesh_path_lookup_by_idx(&sdata->u.mesh.mpp_paths, idx); 292 300 } 293 301 294 302 /** ··· 301 309 int err; 302 310 303 311 rcu_read_lock(); 304 - tbl = mpath->sdata->u.mesh.mesh_paths; 312 + tbl = &mpath->sdata->u.mesh.mesh_paths; 305 313 306 314 spin_lock_bh(&mpath->state_lock); 307 315 if (mpath->is_gate) { ··· 410 418 if (!new_mpath) 411 419 return ERR_PTR(-ENOMEM); 412 420 413 - tbl = sdata->u.mesh.mesh_paths; 421 + tbl = &sdata->u.mesh.mesh_paths; 414 422 spin_lock_bh(&tbl->walk_lock); 415 423 mpath = rhashtable_lookup_get_insert_fast(&tbl->rhead, 416 424 &new_mpath->rhash, ··· 452 460 return -ENOMEM; 453 461 454 462 memcpy(new_mpath->mpp, mpp, ETH_ALEN); 455 - tbl = sdata->u.mesh.mpp_paths; 463 + tbl = &sdata->u.mesh.mpp_paths; 456 464 457 465 spin_lock_bh(&tbl->walk_lock); 458 466 ret = rhashtable_lookup_insert_fast(&tbl->rhead, ··· 481 489 void mesh_plink_broken(struct sta_info *sta) 482 490 { 483 491 struct ieee80211_sub_if_data *sdata = sta->sdata; 484 - struct mesh_table *tbl = sdata->u.mesh.mesh_paths; 492 + struct mesh_table *tbl = &sdata->u.mesh.mesh_paths; 485 493 static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 486 494 struct mesh_path *mpath; 487 495 ··· 540 548 void mesh_path_flush_by_nexthop(struct sta_info *sta) 541 549 { 542 550 struct ieee80211_sub_if_data *sdata = sta->sdata; 543 - struct mesh_table *tbl = sdata->u.mesh.mesh_paths; 551 + struct mesh_table *tbl = &sdata->u.mesh.mesh_paths; 544 552 struct mesh_path *mpath; 545 553 struct hlist_node *n; 546 554 ··· 555 563 static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata, 556 564 const u8 *proxy) 557 565 { 558 - struct mesh_table *tbl = sdata->u.mesh.mpp_paths; 566 + struct mesh_table *tbl = &sdata->u.mesh.mpp_paths; 559 567 struct mesh_path *mpath; 560 568 struct hlist_node *n; 561 569 ··· 589 597 */ 590 598 void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata) 591 599 { 592 - table_flush_by_iface(sdata->u.mesh.mesh_paths); 593 - table_flush_by_iface(sdata->u.mesh.mpp_paths); 600 + table_flush_by_iface(&sdata->u.mesh.mesh_paths); 601 + table_flush_by_iface(&sdata->u.mesh.mpp_paths); 594 602 } 595 603 596 604 /** ··· 636 644 /* flush relevant mpp entries first */ 637 645 mpp_flush_by_proxy(sdata, addr); 638 646 639 - err = table_path_del(sdata->u.mesh.mesh_paths, sdata, addr); 647 + err = table_path_del(&sdata->u.mesh.mesh_paths, sdata, addr); 640 648 sdata->u.mesh.mesh_paths_generation++; 641 649 return err; 642 650 } ··· 674 682 struct mesh_path *gate; 675 683 bool copy = false; 676 684 677 - tbl = sdata->u.mesh.mesh_paths; 685 + tbl = &sdata->u.mesh.mesh_paths; 678 686 679 687 rcu_read_lock(); 680 688 hlist_for_each_entry_rcu(gate, &tbl->known_gates, gate_list) { ··· 754 762 mesh_path_tx_pending(mpath); 755 763 } 756 764 757 - int mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata) 765 + void mesh_pathtbl_init(struct ieee80211_sub_if_data *sdata) 758 766 { 759 - struct mesh_table *tbl_path, *tbl_mpp; 760 - int ret; 761 - 762 - tbl_path = mesh_table_alloc(); 763 - if (!tbl_path) 764 - return -ENOMEM; 765 - 766 - tbl_mpp = mesh_table_alloc(); 767 - if (!tbl_mpp) { 768 - ret = -ENOMEM; 769 - goto free_path; 770 - } 771 - 772 - sdata->u.mesh.mesh_paths = tbl_path; 773 - sdata->u.mesh.mpp_paths = tbl_mpp; 774 - 775 - return 0; 776 - 777 - free_path: 778 - mesh_table_free(tbl_path); 779 - return ret; 767 + mesh_table_init(&sdata->u.mesh.mesh_paths); 768 + mesh_table_init(&sdata->u.mesh.mpp_paths); 780 769 } 781 770 782 771 static ··· 779 806 780 807 void mesh_path_expire(struct ieee80211_sub_if_data *sdata) 781 808 { 782 - mesh_path_tbl_expire(sdata, sdata->u.mesh.mesh_paths); 783 - mesh_path_tbl_expire(sdata, sdata->u.mesh.mpp_paths); 809 + mesh_path_tbl_expire(sdata, &sdata->u.mesh.mesh_paths); 810 + mesh_path_tbl_expire(sdata, &sdata->u.mesh.mpp_paths); 784 811 } 785 812 786 813 void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata) 787 814 { 788 - mesh_table_free(sdata->u.mesh.mesh_paths); 789 - mesh_table_free(sdata->u.mesh.mpp_paths); 815 + mesh_table_free(&sdata->u.mesh.mesh_paths); 816 + mesh_table_free(&sdata->u.mesh.mpp_paths); 790 817 }
+1 -1
net/mac80211/mlme.c
··· 5279 5279 */ 5280 5280 if (new_sta) { 5281 5281 u32 rates = 0, basic_rates = 0; 5282 - bool have_higher_than_11mbit; 5282 + bool have_higher_than_11mbit = false; 5283 5283 int min_rate = INT_MAX, min_rate_index = -1; 5284 5284 const struct cfg80211_bss_ies *ies; 5285 5285 int shift = ieee80211_vif_get_shift(&sdata->vif);
+5 -4
net/mctp/neigh.c
··· 85 85 mutex_unlock(&net->mctp.neigh_lock); 86 86 } 87 87 88 - // TODO: add a "source" flag so netlink can only delete static neighbours? 89 - static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid) 88 + static int mctp_neigh_remove(struct mctp_dev *mdev, mctp_eid_t eid, 89 + enum mctp_neigh_source source) 90 90 { 91 91 struct net *net = dev_net(mdev->dev); 92 92 struct mctp_neigh *neigh, *tmp; ··· 94 94 95 95 mutex_lock(&net->mctp.neigh_lock); 96 96 list_for_each_entry_safe(neigh, tmp, &net->mctp.neighbours, list) { 97 - if (neigh->dev == mdev && neigh->eid == eid) { 97 + if (neigh->dev == mdev && neigh->eid == eid && 98 + neigh->source == source) { 98 99 list_del_rcu(&neigh->list); 99 100 /* TODO: immediate RTM_DELNEIGH */ 100 101 call_rcu(&neigh->rcu, __mctp_neigh_free); ··· 203 202 if (!mdev) 204 203 return -ENODEV; 205 204 206 - return mctp_neigh_remove(mdev, eid); 205 + return mctp_neigh_remove(mdev, eid, MCTP_NEIGH_STATIC); 207 206 } 208 207 209 208 static int mctp_fill_neigh(struct sk_buff *skb, u32 portid, u32 seq, int event,
+1 -1
net/netrom/af_netrom.c
··· 306 306 if (optlen < sizeof(unsigned int)) 307 307 return -EINVAL; 308 308 309 - if (copy_from_sockptr(&opt, optval, sizeof(unsigned int))) 309 + if (copy_from_sockptr(&opt, optval, sizeof(unsigned long))) 310 310 return -EFAULT; 311 311 312 312 switch (optname) {
+2 -4
net/sched/sch_qfq.c
··· 1421 1421 if (err < 0) 1422 1422 return err; 1423 1423 1424 - if (qdisc_dev(sch)->tx_queue_len + 1 > QFQ_MAX_AGG_CLASSES) 1425 - max_classes = QFQ_MAX_AGG_CLASSES; 1426 - else 1427 - max_classes = qdisc_dev(sch)->tx_queue_len + 1; 1424 + max_classes = min_t(u64, (u64)qdisc_dev(sch)->tx_queue_len + 1, 1425 + QFQ_MAX_AGG_CLASSES); 1428 1426 /* max_cl_shift = floor(log_2(max_classes)) */ 1429 1427 max_cl_shift = __fls(max_classes); 1430 1428 q->max_agg_classes = 1<<max_cl_shift;
+24 -28
net/sctp/diag.c
··· 245 245 + 64; 246 246 } 247 247 248 - static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p) 248 + static int sctp_sock_dump_one(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p) 249 249 { 250 250 struct sctp_association *assoc = tsp->asoc; 251 - struct sock *sk = tsp->asoc->base.sk; 252 251 struct sctp_comm_param *commp = p; 253 - struct sk_buff *in_skb = commp->skb; 252 + struct sock *sk = ep->base.sk; 254 253 const struct inet_diag_req_v2 *req = commp->r; 255 - const struct nlmsghdr *nlh = commp->nlh; 256 - struct net *net = sock_net(in_skb->sk); 254 + struct sk_buff *skb = commp->skb; 257 255 struct sk_buff *rep; 258 256 int err; 259 257 260 258 err = sock_diag_check_cookie(sk, req->id.idiag_cookie); 261 259 if (err) 262 - goto out; 260 + return err; 263 261 264 - err = -ENOMEM; 265 262 rep = nlmsg_new(inet_assoc_attr_size(assoc), GFP_KERNEL); 266 263 if (!rep) 267 - goto out; 264 + return -ENOMEM; 268 265 269 266 lock_sock(sk); 270 - if (sk != assoc->base.sk) { 271 - release_sock(sk); 272 - sk = assoc->base.sk; 273 - lock_sock(sk); 274 - } 275 - err = inet_sctp_diag_fill(sk, assoc, rep, req, 276 - sk_user_ns(NETLINK_CB(in_skb).sk), 277 - NETLINK_CB(in_skb).portid, 278 - nlh->nlmsg_seq, 0, nlh, 279 - commp->net_admin); 280 - release_sock(sk); 281 - if (err < 0) { 282 - WARN_ON(err == -EMSGSIZE); 283 - kfree_skb(rep); 267 + if (ep != assoc->ep) { 268 + err = -EAGAIN; 284 269 goto out; 285 270 } 286 271 287 - err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid); 272 + err = inet_sctp_diag_fill(sk, assoc, rep, req, sk_user_ns(NETLINK_CB(skb).sk), 273 + NETLINK_CB(skb).portid, commp->nlh->nlmsg_seq, 0, 274 + commp->nlh, commp->net_admin); 275 + if (err < 0) { 276 + WARN_ON(err == -EMSGSIZE); 277 + goto out; 278 + } 279 + release_sock(sk); 280 + 281 + return nlmsg_unicast(sock_net(skb->sk)->diag_nlsk, rep, NETLINK_CB(skb).portid); 288 282 289 283 out: 284 + release_sock(sk); 285 + kfree_skb(rep); 290 286 return err; 291 287 } 292 288 ··· 425 429 static int sctp_diag_dump_one(struct netlink_callback *cb, 426 430 const struct inet_diag_req_v2 *req) 427 431 { 428 - struct sk_buff *in_skb = cb->skb; 429 - struct net *net = sock_net(in_skb->sk); 432 + struct sk_buff *skb = cb->skb; 433 + struct net *net = sock_net(skb->sk); 430 434 const struct nlmsghdr *nlh = cb->nlh; 431 435 union sctp_addr laddr, paddr; 432 436 struct sctp_comm_param commp = { 433 - .skb = in_skb, 437 + .skb = skb, 434 438 .r = req, 435 439 .nlh = nlh, 436 - .net_admin = netlink_net_capable(in_skb, CAP_NET_ADMIN), 440 + .net_admin = netlink_net_capable(skb, CAP_NET_ADMIN), 437 441 }; 438 442 439 443 if (req->sdiag_family == AF_INET) { ··· 456 460 paddr.v6.sin6_family = AF_INET6; 457 461 } 458 462 459 - return sctp_transport_lookup_process(sctp_tsp_dump_one, 463 + return sctp_transport_lookup_process(sctp_sock_dump_one, 460 464 net, &laddr, &paddr, &commp); 461 465 } 462 466
+15 -7
net/sctp/socket.c
··· 5312 5312 } 5313 5313 EXPORT_SYMBOL_GPL(sctp_for_each_endpoint); 5314 5314 5315 - int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *), 5316 - struct net *net, 5315 + int sctp_transport_lookup_process(sctp_callback_t cb, struct net *net, 5317 5316 const union sctp_addr *laddr, 5318 5317 const union sctp_addr *paddr, void *p) 5319 5318 { 5320 5319 struct sctp_transport *transport; 5321 - int err; 5320 + struct sctp_endpoint *ep; 5321 + int err = -ENOENT; 5322 5322 5323 5323 rcu_read_lock(); 5324 5324 transport = sctp_addrs_lookup_transport(net, laddr, paddr); 5325 + if (!transport) { 5326 + rcu_read_unlock(); 5327 + return err; 5328 + } 5329 + ep = transport->asoc->ep; 5330 + if (!sctp_endpoint_hold(ep)) { /* asoc can be peeled off */ 5331 + sctp_transport_put(transport); 5332 + rcu_read_unlock(); 5333 + return err; 5334 + } 5325 5335 rcu_read_unlock(); 5326 - if (!transport) 5327 - return -ENOENT; 5328 5336 5329 - err = cb(transport, p); 5337 + err = cb(ep, transport, p); 5338 + sctp_endpoint_put(ep); 5330 5339 sctp_transport_put(transport); 5331 - 5332 5340 return err; 5333 5341 } 5334 5342 EXPORT_SYMBOL_GPL(sctp_transport_lookup_process);
+2
net/tipc/socket.c
··· 1461 1461 msg_set_syn(hdr, 1); 1462 1462 } 1463 1463 1464 + memset(&skaddr, 0, sizeof(skaddr)); 1465 + 1464 1466 /* Determine destination */ 1465 1467 if (atype == TIPC_SERVICE_RANGE) { 1466 1468 return tipc_sendmcast(sock, ua, m, dlen, timeout);
+2 -2
net/xdp/xsk.c
··· 677 677 struct xdp_sock *xs = xdp_sk(sk); 678 678 struct xsk_buff_pool *pool; 679 679 680 + sock_poll_wait(file, sock, wait); 681 + 680 682 if (unlikely(!xsk_is_bound(xs))) 681 683 return mask; 682 684 ··· 690 688 else 691 689 /* Poll needs to drive Tx also in copy mode */ 692 690 __xsk_sendmsg(sk); 693 - } else { 694 - sock_poll_wait(file, sock, wait); 695 691 } 696 692 697 693 if (xs->rx && !xskq_prod_is_empty(xs->rx))
+1 -1
tools/perf/builtin-script.c
··· 2473 2473 if (perf_event__process_switch(tool, event, sample, machine) < 0) 2474 2474 return -1; 2475 2475 2476 - if (scripting_ops && scripting_ops->process_switch) 2476 + if (scripting_ops && scripting_ops->process_switch && !filter_cpu(sample)) 2477 2477 scripting_ops->process_switch(event, sample, machine); 2478 2478 2479 2479 if (!script->show_switch_events)
+13 -10
tools/perf/scripts/python/intel-pt-events.py
··· 32 32 except: 33 33 broken_pipe_exception = IOError 34 34 35 - glb_switch_str = None 36 - glb_switch_printed = True 35 + glb_switch_str = {} 37 36 glb_insn = False 38 37 glb_disassembler = None 39 38 glb_src = False ··· 69 70 ap = argparse.ArgumentParser(usage = "", add_help = False) 70 71 ap.add_argument("--insn-trace", action='store_true') 71 72 ap.add_argument("--src-trace", action='store_true') 73 + ap.add_argument("--all-switch-events", action='store_true') 72 74 global glb_args 73 75 global glb_insn 74 76 global glb_src ··· 256 256 print(start_str, src_str) 257 257 258 258 def do_process_event(param_dict): 259 - global glb_switch_printed 260 - if not glb_switch_printed: 261 - print(glb_switch_str) 262 - glb_switch_printed = True 263 259 event_attr = param_dict["attr"] 264 260 sample = param_dict["sample"] 265 261 raw_buf = param_dict["raw_buf"] ··· 269 273 # Symbol and dso info are not always resolved 270 274 dso = get_optional(param_dict, "dso") 271 275 symbol = get_optional(param_dict, "symbol") 276 + 277 + cpu = sample["cpu"] 278 + if cpu in glb_switch_str: 279 + print(glb_switch_str[cpu]) 280 + del glb_switch_str[cpu] 272 281 273 282 if name[0:12] == "instructions": 274 283 if glb_src: ··· 337 336 sys.exit(1) 338 337 339 338 def context_switch(ts, cpu, pid, tid, np_pid, np_tid, machine_pid, out, out_preempt, *x): 340 - global glb_switch_printed 341 - global glb_switch_str 342 339 if out: 343 340 out_str = "Switch out " 344 341 else: ··· 349 350 machine_str = "" 350 351 else: 351 352 machine_str = "machine PID %d" % machine_pid 352 - glb_switch_str = "%16s %5d/%-5d [%03u] %9u.%09u %5d/%-5d %s %s" % \ 353 + switch_str = "%16s %5d/%-5d [%03u] %9u.%09u %5d/%-5d %s %s" % \ 353 354 (out_str, pid, tid, cpu, ts / 1000000000, ts %1000000000, np_pid, np_tid, machine_str, preempt_str) 354 - glb_switch_printed = False 355 + if glb_args.all_switch_events: 356 + print(switch_str); 357 + else: 358 + global glb_switch_str 359 + glb_switch_str[cpu] = switch_str
+5 -3
tools/perf/ui/tui/setup.c
··· 170 170 "Press any key...", 0); 171 171 172 172 SLtt_set_cursor_visibility(1); 173 - SLsmg_refresh(); 174 - SLsmg_reset_smg(); 173 + if (!pthread_mutex_trylock(&ui__lock)) { 174 + SLsmg_refresh(); 175 + SLsmg_reset_smg(); 176 + pthread_mutex_unlock(&ui__lock); 177 + } 175 178 SLang_reset_tty(); 176 - 177 179 perf_error__unregister(&perf_tui_eops); 178 180 }
+6 -1
tools/perf/util/expr.c
··· 66 66 67 67 struct hashmap *ids__new(void) 68 68 { 69 - return hashmap__new(key_hash, key_equal, NULL); 69 + struct hashmap *hash; 70 + 71 + hash = hashmap__new(key_hash, key_equal, NULL); 72 + if (IS_ERR(hash)) 73 + return NULL; 74 + return hash; 70 75 } 71 76 72 77 void ids__free(struct hashmap *ids)
+1
tools/perf/util/intel-pt.c
··· 3625 3625 *args = p; 3626 3626 return 0; 3627 3627 } 3628 + p += 1; 3628 3629 while (1) { 3629 3630 vmcs = strtoull(p, &p, 0); 3630 3631 if (errno)
+17 -6
tools/perf/util/pmu.c
··· 1659 1659 return !strcmp(name, "cpu") || is_arm_pmu_core(name); 1660 1660 } 1661 1661 1662 + static bool pmu_alias_is_duplicate(struct sevent *alias_a, 1663 + struct sevent *alias_b) 1664 + { 1665 + /* Different names -> never duplicates */ 1666 + if (strcmp(alias_a->name, alias_b->name)) 1667 + return false; 1668 + 1669 + /* Don't remove duplicates for hybrid PMUs */ 1670 + if (perf_pmu__is_hybrid(alias_a->pmu) && 1671 + perf_pmu__is_hybrid(alias_b->pmu)) 1672 + return false; 1673 + 1674 + return true; 1675 + } 1676 + 1662 1677 void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, 1663 1678 bool long_desc, bool details_flag, bool deprecated, 1664 1679 const char *pmu_name) ··· 1759 1744 qsort(aliases, len, sizeof(struct sevent), cmp_sevent); 1760 1745 for (j = 0; j < len; j++) { 1761 1746 /* Skip duplicates */ 1762 - if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) { 1763 - if (!aliases[j].pmu || !aliases[j - 1].pmu || 1764 - !strcmp(aliases[j].pmu, aliases[j - 1].pmu)) { 1765 - continue; 1766 - } 1767 - } 1747 + if (j > 0 && pmu_alias_is_duplicate(&aliases[j], &aliases[j - 1])) 1748 + continue; 1768 1749 1769 1750 if (name_only) { 1770 1751 printf("%s ", aliases[j].name);
+1 -1
tools/testing/selftests/bpf/verifier/value_ptr_arith.c
··· 1078 1078 .errstr_unpriv = "R0 pointer -= pointer prohibited", 1079 1079 }, 1080 1080 { 1081 - "map access: trying to leak tained dst reg", 1081 + "map access: trying to leak tainted dst reg", 1082 1082 .insns = { 1083 1083 BPF_MOV64_IMM(BPF_REG_0, 0), 1084 1084 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
tools/testing/selftests/net/amt.sh
+2 -1
tools/testing/selftests/net/udpgro_fwd.sh
··· 193 193 SUFFIX="64 nodad" 194 194 VXDEV=vxlan6 195 195 IPT=ip6tables 196 - PING="ping6" 196 + # Use ping6 on systems where ping doesn't handle IPv6 197 + ping -w 1 -c 1 ::1 > /dev/null 2>&1 || PING="ping6" 197 198 fi 198 199 199 200 echo "IPv$family"
+10 -6
tools/testing/selftests/vm/userfaultfd.c
··· 87 87 88 88 static bool map_shared; 89 89 static int shm_fd; 90 - static int huge_fd; 90 + static int huge_fd = -1; /* only used for hugetlb_shared test */ 91 91 static char *huge_fd_off0; 92 92 static unsigned long long *count_verify; 93 93 static int uffd = -1; ··· 223 223 224 224 static void hugetlb_release_pages(char *rel_area) 225 225 { 226 + if (huge_fd == -1) 227 + return; 228 + 226 229 if (fallocate(huge_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 227 230 rel_area == huge_fd_off0 ? 0 : nr_pages * page_size, 228 231 nr_pages * page_size)) ··· 238 235 char **alloc_area_alias; 239 236 240 237 *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 241 - (map_shared ? MAP_SHARED : MAP_PRIVATE) | 242 - MAP_HUGETLB, 243 - huge_fd, *alloc_area == area_src ? 0 : 244 - nr_pages * page_size); 238 + map_shared ? MAP_SHARED : 239 + MAP_PRIVATE | MAP_HUGETLB | 240 + (*alloc_area == area_src ? 0 : MAP_NORESERVE), 241 + huge_fd, 242 + *alloc_area == area_src ? 0 : nr_pages * page_size); 245 243 if (*alloc_area == MAP_FAILED) 246 244 err("mmap of hugetlbfs file failed"); 247 245 248 246 if (map_shared) { 249 247 area_alias = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 250 - MAP_SHARED | MAP_HUGETLB, 248 + MAP_SHARED, 251 249 huge_fd, *alloc_area == area_src ? 0 : 252 250 nr_pages * page_size); 253 251 if (area_alias == MAP_FAILED)