drm/amdgpu: fix and cleanup amdgpu_gem_object_close v4
Subsystems (36)
Sasha Levin
maintainerPATCH 1/175 drm/amdgpu: fix and cleanup amdgpu_gem_object_close v4
From: Christian König <[email protected]>
[ Upstream commit 82c416b13cb7d22b96ec0888b296a48dff8a09eb ]
The problem is that we can't add the clear fence to the BO when there is an exclusive fence on it since we can't guarantee the the clear fence will complete after the exclusive one.
To fix this refactor the function and also add the exclusive fence as shared to the resv object.
v2: fix warning
v3: add excl fence as shared instead
v4: squash in fix for fence handling in amdgpu_gem_object_close
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 43 ++++++++++++++----------- 1 file changed, 25 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +25 -18
@@ -161,16 +161,17 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,struct amdgpu_bo_list_entry vm_pd;struct list_head list, duplicates; +struct dma_fence *fence =NULL ;struct ttm_validate_buffer tv;struct ww_acquire_ctx ticket;struct amdgpu_bo_va *bo_va; -int r; +long r;INIT_LIST_HEAD (&list);INIT_LIST_HEAD (&duplicates); tv.bo = &bo->tbo; - tv.num_shared =1 ; + tv.num_shared =2 ;list_add (&tv.head, &list);amdgpu_vm_get_pd_bo (vm, &list, &vm_pd);
@@ -178,28 +179,34 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, r =ttm_eu_reserve_buffers (&ticket, &list, false, &duplicates, false);if (r) {dev_err (adev->dev,"leaking bo va because " -"we fail to reserve bo (%d)\n" , r); +"we fail to reserve bo (%ld)\n" , r);return ; } bo_va =amdgpu_vm_bo_find (vm, bo); -if (bo_va && --bo_va->ref_count ==0 ) { -amdgpu_vm_bo_rmv (adev, bo_va); - -if (amdgpu_vm_ready (vm)) { -struct dma_fence *fence =NULL ; +if (!bo_va || --bo_va->ref_count) + goto out_unlock; - r =amdgpu_vm_clear_freed (adev, vm, &fence); -if (unlikely (r)) { -dev_err (adev->dev,"failed to clear page " -"tables on GEM object close (%d)\n" , r); - } +amdgpu_vm_bo_rmv (adev, bo_va); +if (!amdgpu_vm_ready (vm)) + goto out_unlock; -if (fence) { -amdgpu_bo_fence (bo, fence, true); -dma_fence_put (fence); - } - } + fence =dma_resv_get_excl (bo->tbo.base.resv); +if (fence) { +amdgpu_bo_fence (bo, fence, true); + fence =NULL ; } + + r =amdgpu_vm_clear_freed (adev, vm, &fence); +if (r || !fence) + goto out_unlock; + +amdgpu_bo_fence (bo, fence, true); +dma_fence_put (fence); + +out_unlock: +if (unlikely (r <0 )) +dev_err (adev->dev,"failed to clear page " +"tables on GEM object close (%ld)\n" , r);ttm_eu_backoff_reservation (&ticket, &list); }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 2/175 ath10k: Fix the race condition in firmware dump work queue
From: Maharaja Kennadyrajan <[email protected]>
[ Upstream commit 3d1c60460fb2823a19ead9e6ec8f184dd7271aa7 ]
There is a race condition, when the user writes 'hw-restart' and 'hard' in the simulate_fw_crash debugfs file without any delay. In the above scenario, the firmware dump work queue(scheduled by 'hard') should be handled gracefully, while the target is in the 'hw-restart'.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00044
--- drivers/net/wireless/ath/ath10k/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/pci.c +1 -0
@@ -2074,6 +2074,7 @@ static void ath10k_pci_hif_stop(struct ath10k *ar)ath10k_pci_irq_sync (ar);napi_synchronize (&ar->napi);napi_disable (&ar->napi); +cancel_work_sync (&ar_pci->dump_work);/* Most likely the device has HTT Rx ring configured. The only way to * prevent the device from accessing (and possible corrupting) host
Signature · 7 lines
2.25.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 3/175 ath9x: Fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit 19d6c375d671ce9949a864fb9a03e19f5487b4d3 ]
Add barrier to accessing the stack array skb_pool.
The case reported by syzbot:
https://lore.kernel.org/linux-usb/[email protected]
BUG: KASAN: stack-out-of-bounds in ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:626 [inline] BUG: KASAN: stack-out-of-bounds in ath9k_hif_usb_rx_cb+0xdf6/0xf70 drivers/net/wireless/ath/ath9k/hif_usb.c:666 Write of size 8 at addr ffff8881db309a28 by task swapper/1/0 Call Trace: ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:626 [inline] ath9k_hif_usb_rx_cb+0xdf6/0xf70 drivers/net/wireless/ath/ath9k/hif_usb.c:666 __usb_hcd_giveback_urb+0x1f2/0x470 drivers/usb/core/hcd.c:1648 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1713 dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +5 -0
@@ -612,6 +612,11 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, hif_dev->remain_skb = nskb;spin_unlock (&hif_dev->rx_lock); }else { +if (pool_index ==MAX_PKT_NUM_IN_TRANSFER ) { +dev_err (&hif_dev->udev->dev, +"ath9k_htc: over RX MAX_PKT_NUM\n" ); + goto err; + } nskb =__dev_alloc_skb (pkt_len +32 ,GFP_ATOMIC );if (!nskb) { dev_err(&hif_dev->udev->dev,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 4/175 ath9k: Fix use-after-free Write in ath9k_htc_rx_msg
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit e4ff08a4d727146bb6717a39a8d399d834654345 ]
Write out of slab bounds. We should check epid.
The case reported by syzbot:
https://lore.kernel.org/linux-usb/[email protected]
BUG: KASAN: use-after-free in htc_process_conn_rsp drivers/net/wireless/ath/ath9k/htc_hst.c:131 [inline] BUG: KASAN: use-after-free in ath9k_htc_rx_msg+0xa25/0xaf0 drivers/net/wireless/ath/ath9k/htc_hst.c:443 Write of size 2 at addr ffff8881cea291f0 by task swapper/1/0 Call Trace: htc_process_conn_rsp drivers/net/wireless/ath/ath9k/htc_hst.c:131
[inline]ath9k_htc_rx_msg+0xa25/0xaf0drivers/net/wireless/ath/ath9k/htc_hst.c:443ath9k_hif_usb_reg_in_cb+0x1ba/0x630drivers/net/wireless/ath/ath9k/hif_usb.c:718
__usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716 dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath9k/htc_hst.c +3 -0
@@ -113,6 +113,9 @@ static void htc_process_conn_rsp(struct htc_target *target,if (svc_rspmsg->status ==HTC_SERVICE_SUCCESS ) { epid = svc_rspmsg->endpoint_id; +if (epid <0 || epid >=ENDPOINT_MAX ) +return ; + service_id =be16_to_cpu (svc_rspmsg->service_id); max_msglen =be16_to_cpu (svc_rspmsg->max_msg_len); endpoint = &target->endpoint[epid];
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 5/175 ath9k: Fix use-after-free Read in htc_connect_service
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit ced21a4c726bdc60b1680c050a284b08803bc64c ]
The skb is consumed by htc_send_epid, so it needn't release again.
The case reported by syzbot:
https://lore.kernel.org/linux-usb/[email protected]
usb 1-1: ath9k_htc: Firmware ath9k_htc/htc_9271-1.4.0.fw requested usb 1-1: ath9k_htc: Transferred FW: ath9k_htc/htc_9271-1.4.0.fw, size:
51008
usb 1-1: Service connection timeout for: 256
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:26 [inline] BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:134 [inline] BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:1042 [inline] BUG: KASAN: use-after-free in kfree_skb+0x32/0x3d0 net/core/skbuff.c:692 Read of size 4 at addr ffff8881d0957994 by task kworker/1:2/83 Call Trace: kfree_skb+0x32/0x3d0 net/core/skbuff.c:692 htc_connect_service.cold+0xa9/0x109 drivers/net/wireless/ath/ath9k/htc_hst.c:282 ath9k_wmi_connect+0xd2/0x1a0 drivers/net/wireless/ath/ath9k/wmi.c:265 ath9k_init_htc_services.constprop.0+0xb4/0x650
drivers/net/wireless/ath/ath9k/htc_drv_init.c:146ath9k_htc_probe_device+0x25a/0x1d80drivers/net/wireless/ath/ath9k/htc_drv_init.c:959ath9k_htc_hw_init+0x31/0x60drivers/net/wireless/ath/ath9k/htc_hst.c:501ath9k_hif_usb_firmware_cb+0x26b/0x500drivers/net/wireless/ath/ath9k/hif_usb.c:1187request_firmware_work_func+0x126/0x242drivers/base/firmware_loader/main.c:976
process_one_work+0x94b/0x1620 kernel/workqueue.c:2264 worker_thread+0x96/0xe20 kernel/workqueue.c:2410 kthread+0x318/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Allocated by task 83: kmem_cache_alloc_node+0xdc/0x330 mm/slub.c:2814 __alloc_skb+0xba/0x5a0 net/core/skbuff.c:198 alloc_skb include/linux/skbuff.h:1081 [inline] htc_connect_service+0x2cc/0x840 drivers/net/wireless/ath/ath9k/htc_hst.c:257 ath9k_wmi_connect+0xd2/0x1a0 drivers/net/wireless/ath/ath9k/wmi.c:265 ath9k_init_htc_services.constprop.0+0xb4/0x650
drivers/net/wireless/ath/ath9k/htc_drv_init.c:146ath9k_htc_probe_device+0x25a/0x1d80drivers/net/wireless/ath/ath9k/htc_drv_init.c:959ath9k_htc_hw_init+0x31/0x60drivers/net/wireless/ath/ath9k/htc_hst.c:501ath9k_hif_usb_firmware_cb+0x26b/0x500drivers/net/wireless/ath/ath9k/hif_usb.c:1187request_firmware_work_func+0x126/0x242drivers/base/firmware_loader/main.c:976
process_one_work+0x94b/0x1620 kernel/workqueue.c:2264 worker_thread+0x96/0xe20 kernel/workqueue.c:2410 kthread+0x318/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Freed by task 0: kfree_skb+0x102/0x3d0 net/core/skbuff.c:690 ath9k_htc_txcompletion_cb+0x1f8/0x2b0 drivers/net/wireless/ath/ath9k/htc_hst.c:356 hif_usb_regout_cb+0x10b/0x1b0 drivers/net/wireless/ath/ath9k/hif_usb.c:90 __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716 dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786 __do_softirq+0x21e/0x950 kernel/softirq.c:292
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 3 --- drivers/net/wireless/ath/ath9k/wmi.c | 1 - 2 files changed, 4 deletions(-)
drivers/net/wireless/ath/ath9k/htc_hst.c +0 -3
@@ -173,7 +173,6 @@ static int htc_config_pipe_credits(struct htc_target *target) time_left =wait_for_completion_timeout (&target->cmd_wait,HZ );if (!time_left) {dev_err (target->dev,"HTC credit config timeout\n" ); -kfree_skb (skb);return -ETIMEDOUT ; }
@@ -209,7 +208,6 @@ static int htc_setup_complete(struct htc_target *target) time_left =wait_for_completion_timeout (&target->cmd_wait,HZ );if (!time_left) {dev_err (target->dev,"HTC start timeout\n" ); -kfree_skb (skb);return -ETIMEDOUT ; }
@@ -282,7 +280,6 @@ int htc_connect_service(struct htc_target *target,if (!time_left) {dev_err (target->dev,"Service connection timeout for: %d\n" , service_connreq->service_id); -kfree_skb (skb);return -ETIMEDOUT ; }
drivers/net/wireless/ath/ath9k/wmi.c +0 -1
@@ -336,7 +336,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,ath_dbg (common,WMI ,"Timeout waiting for WMI command: %s\n" ,wmi_cmd_to_name (cmd_id));mutex_unlock (&wmi->op_mutex); -kfree_skb (skb);return -ETIMEDOUT ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/175 drm: bridge: adv7511: Extend list of audio sample rates
In reply to Sasha LevinFrom: Bogdan Togorean <[email protected]>
[ Upstream commit b97b6a1f6e14a25d1e1ca2a46c5fa3e2ca374e22 ]
ADV7511 support sample rates up to 192kHz. CTS and N parameters should be computed accordingly so this commit extend the list up to maximum supported sample rate.
--- drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +7 -5
@@ -19,13 +19,15 @@ static void adv7511_calc_cts_n(unsigned int f_tmds, unsigned int fs, {switch (fs) {case 32000 : - *n =4096 ; +case 48000 : +case 96000 : +case 192000 : + *n = fs *128 /1000 ;break ;case 44100 : - *n =6272 ; -break ; -case 48000 : - *n =6144 ; +case 88200 : +case 176400 : + *n = fs *128 /900 ;break ; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 7/175 media: staging: imgu: do not hold spinlock during freeing mmu page table
In reply to Sasha LevinFrom: Bingbu Cao <[email protected]>
[ Upstream commit e1ebe9f9c88e5a78fcc4670a9063c9b3cd87dda4 ]
ImgU need set the mmu page table in memory as uncached, and set back to write-back when free the page table by set_memory_wb(), set_memory_wb() can not do flushing without interrupt, so the spinlock should not be hold during ImgU page alloc and free, the interrupt should be enabled during memory cache flush.
This patch release spinlock before freeing pages table.
--- drivers/staging/media/ipu3/ipu3-mmu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/media/ipu3/ipu3-mmu.c +6 -4
@@ -174,8 +174,10 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx)spin_lock_irqsave (&mmu->lock, flags); l2pt = mmu->l2pts[l1pt_idx]; -if (l2pt) - goto done; +if (l2pt) { +spin_unlock_irqrestore (&mmu->lock, flags); +return l2pt; + }spin_unlock_irqrestore (&mmu->lock, flags);
@@ -190,8 +192,9 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) l2pt = mmu->l2pts[l1pt_idx];if (l2pt) { +spin_unlock_irqrestore (&mmu->lock, flags);imgu_mmu_free_page_table (new_l2pt); - goto done; +return l2pt; } l2pt = new_l2pt;
@@ -200,7 +203,6 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) pteval =IPU3_ADDR2PTE (virt_to_phys (new_l2pt)); mmu->l1pt[l1pt_idx] = pteval; -done:spin_unlock_irqrestore (&mmu->lock, flags);return l2pt; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 8/175 media: imx: imx7-mipi-csis: Cleanup and fix subdev pad format handling
In reply to Sasha LevinFrom: Laurent Pinchart <[email protected]>
[ Upstream commit d321dd233b9f2bb407b8e6b4759408f09ec207c3 ]
The subdev set pad format operation currently misbehaves in multiple ways:
- mipi_csis_try_format() unconditionally stores the format in the device state, even for V4L2_SUBDEV_FORMAT_TRY.
- The format is never stored in the pad cfg, but the pad cfg format always overwrites the format requested by the user.
- The sink format is not propagated to the source.
Fix all this by reworking the set format operation as follows:
1. For the source pad, turn set() into get() as the source format is not modifiable.
2. Validate the requested format and updated the stored format accordingly.
3. Return the format actually set.
4. Propagate the format from sink to source.
--- drivers/staging/media/imx/imx7-mipi-csis.c | 82 ++++++++++------------ 1 file changed, 37 insertions(+), 45 deletions(-)
drivers/staging/media/imx/imx7-mipi-csis.c +37 -45
@@ -657,28 +657,6 @@ static int mipi_csis_init_cfg(struct v4l2_subdev *mipi_sd,return 0 ; } -static struct csis_pix_format const * -mipi_csis_try_format (struct v4l2_subdev *mipi_sd,struct v4l2_mbus_framefmt *mf) -{ -struct csi_state *state =mipi_sd_to_csis_state (mipi_sd); -struct csis_pix_format const *csis_fmt; - - csis_fmt =find_csis_format (mf->code); -if (!csis_fmt) - csis_fmt = &mipi_csis_formats[0 ]; - -v4l_bound_align_image (&mf->width,1 ,CSIS_MAX_PIX_WIDTH , - csis_fmt->pix_width_alignment, - &mf->height,1 ,CSIS_MAX_PIX_HEIGHT ,1 , -0 ); - - state->format_mbus.code = csis_fmt->code; - state->format_mbus.width = mf->width; - state->format_mbus.height = mf->height; - -return csis_fmt; -} -static struct v4l2_mbus_framefmt * mipi_csis_get_format(struct csi_state *state, struct v4l2_subdev_pad_config *cfg,
@@ -691,53 +669,67 @@ mipi_csis_get_format(struct csi_state *state,return &state->format_mbus; } -static int mipi_csis_set_fmt (struct v4l2_subdev *mipi_sd, +static int mipi_csis_get_fmt (struct v4l2_subdev *mipi_sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_format *sdformat) {struct csi_state *state =mipi_sd_to_csis_state (mipi_sd); -struct csis_pix_format const *csis_fmt;struct v4l2_mbus_framefmt *fmt; -if (sdformat->pad >=CSIS_PADS_NUM ) -return -EINVAL ; - - fmt =mipi_csis_get_format (state, cfg, sdformat->which, sdformat->pad); -mutex_lock (&state->lock); -if (sdformat->pad ==CSIS_PAD_SOURCE ) { - sdformat->format = *fmt; - goto unlock; - } - - csis_fmt =mipi_csis_try_format (mipi_sd, &sdformat->format); - + fmt =mipi_csis_get_format (state, cfg, sdformat->which, sdformat->pad); sdformat->format = *fmt; - -if (csis_fmt && sdformat->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) - state->csis_fmt = csis_fmt; -else - cfg->try_fmt = sdformat->format; - -unlock:mutex_unlock (&state->lock);return 0 ; } -static int mipi_csis_get_fmt (struct v4l2_subdev *mipi_sd, +static int mipi_csis_set_fmt (struct v4l2_subdev *mipi_sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_format *sdformat) {struct csi_state *state =mipi_sd_to_csis_state (mipi_sd); +struct csis_pix_format const *csis_fmt;struct v4l2_mbus_framefmt *fmt; -mutex_lock (&state->lock); +/* +* The CSIS can't transcode in any way, the source format can't be +* modified. +*/ +if (sdformat->pad ==CSIS_PAD_SOURCE ) +return mipi_csis_get_fmt (mipi_sd, cfg, sdformat); + +if (sdformat->pad !=CSIS_PAD_SINK ) +return -EINVAL ; fmt =mipi_csis_get_format (state, cfg, sdformat->which, sdformat->pad); +mutex_lock (&state->lock); + +/* Validate the media bus code and clamp the size. */ + csis_fmt =find_csis_format (sdformat->format.code); +if (!csis_fmt) + csis_fmt = &mipi_csis_formats[0 ]; + + fmt->code = csis_fmt->code; + fmt->width = sdformat->format.width; + fmt->height = sdformat->format.height; + +v4l_bound_align_image (&fmt->width,1 ,CSIS_MAX_PIX_WIDTH , + csis_fmt->pix_width_alignment, + &fmt->height,1 ,CSIS_MAX_PIX_HEIGHT ,1 ,0 ); + sdformat->format = *fmt; +/* Propagate the format from sink to source. */ + fmt =mipi_csis_get_format (state, cfg, sdformat->which, +CSIS_PAD_SOURCE ); + *fmt = sdformat->format; + +/* Store the CSIS format descriptor for active formats. */ +if (sdformat->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) + state->csis_fmt = csis_fmt; +mutex_unlock (&state->lock);return 0 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 9/175 crypto: ccp -- don't "select" CONFIG_DMADEVICES
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit eebac678556d6927f09a992872f4464cf3aecc76 ]
DMADEVICES is the top-level option for the slave DMA subsystem, and should not be selected by device drivers, as this can cause circular dependencies such as:
drivers/net/ethernet/freescale/Kconfig:6:error: recursive dependency detected!drivers/net/ethernet/freescale/Kconfig:6: symbol NET_VENDOR_FREESCALE depends on PPC_BESTCOMMdrivers/dma/bestcomm/Kconfig:6: symbol PPC_BESTCOMM depends on DMADEVICESdrivers/dma/Kconfig:6: symbol DMADEVICES is selected by CRYPTO_DEV_SP_CCPdrivers/crypto/ccp/Kconfig:10: symbol CRYPTO_DEV_SP_CCP depends on CRYPTOcrypto/Kconfig:16: symbol CRYPTO is selected by LIBCRC32C
lib/Kconfig:222: symbol LIBCRC32C is selected by LIQUIDIOdrivers/net/ethernet/cavium/Kconfig:65: symbol LIQUIDIO depends on PTP_1588_CLOCKdrivers/ptp/Kconfig:8: symbol PTP_1588_CLOCK is implied by FECdrivers/net/ethernet/freescale/Kconfig:23: symbol FEC depends on NET_VENDOR_FREESCALE
The LIQUIDIO driver causing this problem is addressed in a separate patch, but this change is needed to prevent it from happening again.
Using "depends on DMADEVICES" is what we do for all other implementations of slave DMA controllers as well.
--- drivers/crypto/ccp/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/ccp/Kconfig +1 -2
@@ -10,10 +10,9 @@ config CRYPTO_DEV_CCP_DD config CRYPTO_DEV_SP_CCP bool "Cryptographic Coprocessor device" default y - depends on CRYPTO_DEV_CCP_DD + depends on CRYPTO_DEV_CCP_DD && DMADEVICES select HW_RANDOM select DMA_ENGINE - select DMADEVICES select CRYPTO_SHA1 select CRYPTO_SHA256 help
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 10/175 media: vicodec: Fix error codes in probe function
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit f36592e7b343d853edf44d3545bb68961c0949a4 ]
If these functions fail then we return success, but we should instead preserve negative error code and return that.
--- drivers/media/platform/vicodec/vicodec-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/media/platform/vicodec/vicodec-core.c +9 -6
@@ -2172,16 +2172,19 @@ static int vicodec_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dev); -if (register_instance (dev, &dev->stateful_enc, -"stateful-encoder" , true)) + ret =register_instance (dev, &dev->stateful_enc,"stateful-encoder" , + true); +if (ret) goto unreg_dev; -if (register_instance (dev, &dev->stateful_dec, -"stateful-decoder" , false)) + ret =register_instance (dev, &dev->stateful_dec,"stateful-decoder" , + false); +if (ret) goto unreg_sf_enc; -if (register_instance (dev, &dev->stateless_dec, -"stateless-decoder" , false)) + ret =register_instance (dev, &dev->stateless_dec,"stateless-decoder" , + false); +if (ret) goto unreg_sf_dec;#ifdef CONFIG_MEDIA_CONTROLLER
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/175 media: si2157: Better check for running tuner in init
In reply to Sasha LevinFrom: Brad Love <[email protected]>
[ Upstream commit e955f959ac52e145f27ff2be9078b646d0352af0 ]
Getting the Xtal trim property to check if running is less error prone. Reset if_frequency if state is unknown.
Replaces the previous "garbage check".
--- drivers/media/tuners/si2157.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/media/tuners/si2157.c +7 -8
@@ -75,24 +75,23 @@ static int si2157_init(struct dvb_frontend *fe)struct si2157_cmd cmd;const struct firmware *fw;const char *fw_name; -unsigned int uitmp, chip_id; +unsigned int chip_id, xtal_trim;dev_dbg (&client->dev,"\n" ); -/* Returned IF frequency is garbage when firmware is not running */ -memcpy (cmd.args,"\x15\x00\x06\x07" ,4 ); +/* Try to get Xtal trim property, to verify tuner still running */ +memcpy (cmd.args,"\x15\x00\x04\x02" ,4 ); cmd.wlen =4 ; cmd.rlen =4 ; ret =si2157_cmd_execute (client, &cmd); -if (ret) - goto err; - uitmp = cmd.args[2 ] <<0 | cmd.args[3 ] <<8 ; -dev_dbg (&client->dev,"if_frequency kHz=%u\n" , uitmp); + xtal_trim = cmd.args[2 ] | (cmd.args[3 ] <<8 ); -if (uitmp == dev->if_frequency /1000 ) +if (ret ==0 && xtal_trim <16 ) goto warm; + dev->if_frequency =0 ;/* we no longer know current tuner state */ +/* power up */ if (dev->chiptype ==SI2157_CHIPTYPE_SI2146 ) {memcpy (cmd.args,"\xc0\x05\x01\x00\x00\x0b\x00\x00\x01" ,9 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/175 objtool: Ignore empty alternatives
In reply to Sasha LevinFrom: Julien Thierry <[email protected]>
[ Upstream commit 7170cf47d16f1ba29eca07fd818870b7af0a93a5 ]
The .alternatives section can contain entries with no original instructions. Objtool will currently crash when handling such an entry.
Just skip that entry, but still give a warning to discourage useless entries.
--- tools/objtool/check.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/objtool/check.c +6 -0
@@ -865,6 +865,12 @@ static int add_special_section_alts(struct objtool_file *file) }if (special_alt->group) { +if (!special_alt->orig_len) { +WARN_FUNC ("empty alternative entry" , + orig_insn->sec, orig_insn->offset); +continue ; + } + ret =handle_group_alt (file, special_alt, orig_insn, &new_insn);if (ret)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/175 spi: spi-mem: Fix Dual/Quad modes on Octal-capable devices
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 80300a7d5f2d7178335652f41d2e55ba898b4ec1 ]
Currently buswidths 2 and 4 are rejected for a device that advertises Octal capabilities. Allow these buswidths, just like is done for buswidth 2 and Quad-capable devices.
--- drivers/spi/spi-mem.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/spi/spi-mem.c +6 -4
@@ -108,15 +108,17 @@ static int spi_check_buswidth_req(struct spi_mem *mem, u8 buswidth, bool tx)return 0 ;case 2 : -if ((tx && (mode & (SPI_TX_DUAL |SPI_TX_QUAD ))) || - (!tx && (mode & (SPI_RX_DUAL |SPI_RX_QUAD )))) +if ((tx && + (mode & (SPI_TX_DUAL |SPI_TX_QUAD |SPI_TX_OCTAL ))) || + (!tx && + (mode & (SPI_RX_DUAL |SPI_RX_QUAD |SPI_RX_OCTAL ))))return 0 ;break ;case 4 : -if ((tx && (mode &SPI_TX_QUAD )) || - (!tx && (mode &SPI_RX_QUAD ))) +if ((tx && (mode & (SPI_TX_QUAD |SPI_TX_OCTAL ))) || + (!tx && (mode & (SPI_RX_QUAD |SPI_RX_OCTAL ))))return 0 ;break ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/175 drm/amdgpu: Init data to avoid oops while reading pp_num_states.
In reply to Sasha LevinFrom: limingyu <[email protected]>
[ Upstream commit 6f81b2d047c59eb77cd04795a44245d6a52cdaec ]
For chip like CHIP_OLAND with si enabled(amdgpu.si_support=1), the amdgpu will expose pp_num_states to the /sys directory. In this moment, read the pp_num_states file will excute the amdgpu_get_pp_num_states func. In our case, the data hasn't been initialized, so the kernel will access some ilegal address, trigger the segmentfault and system will reboot soon:
uos@uos-PC:~$ cat /sys/devices/pci0000\:00/0000\:00\:00.0/0000\:01\:00
.0/pp_num_states Message from syslogd@uos-PC at Apr 22 09:26:20 ...
kernel:[ 82.154129] Internal error: Oops: 96000004 [#1] SMPThis patch aims to fix this problem, avoid that reading file triggers the kernel sementfault.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -1
@@ -416,8 +416,11 @@ static ssize_t amdgpu_get_pp_num_states(struct device *dev, ret =smu_get_power_num_states (&adev->smu, &data);if (ret)return ret; - }else if (adev->powerplay.pp_funcs->get_pp_num_states) + }else if (adev->powerplay.pp_funcs->get_pp_num_states) {amdgpu_dpm_get_pp_num_states (adev, &data); + }else { +memset (&data,0 ,sizeof (data)); + } buf_len =snprintf (buf,PAGE_SIZE ,"states: %d\n" , data.nums);for (i =0 ; i < data.nums; i++)
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 15/175 arm64/kernel: Fix range on invalidating dcache for boot page tables
In reply to Sasha LevinFrom: Gavin Shan <[email protected]>
[ Upstream commit 9d2d75ede59bc1edd8561f2ee9d4702a5ea0ae30 ]
Prior to commit 8eb7e28d4c642c31 ("arm64/mm: move runtime pgds to rodata"), idmap_pgd_dir, tramp_pg_dir, reserved_ttbr0, swapper_pg_dir, and init_pg_dir were contiguous at the end of the kernel image. The maintenance at the end of __create_page_tables assumed these were contiguous, and affected everything from the start of idmap_pg_dir to the end of init_pg_dir.
That commit moved all but init_pg_dir into the .rodata section, with other data placed between idmap_pg_dir and init_pg_dir, but did not update the maintenance. Hence the maintenance is performed on much more data than necessary (but as the bootloader previously made this clean to the PoC there is no functional problem).
As we only alter idmap_pg_dir, and init_pg_dir, we only need to perform maintenance for these. As the other dirs are in .rodata, the bootloader will have initialised them as expected and cleaned them to the PoC. The kernel will initialize them as necessary after enabling the MMU.
This patch reworks the maintenance to only cover the idmap_pg_dir and init_pg_dir to avoid this unnecessary work.
--- arch/arm64/include/asm/pgtable.h | 1 + arch/arm64/kernel/head.S | 12 +++++++++--- arch/arm64/kernel/vmlinux.lds.S | 1 + 3 files changed, 11 insertions(+), 3 deletions(-)
arch/arm64/include/asm/pgtable.h +1 -0
@@ -456,6 +456,7 @@ extern pgd_t init_pg_dir[PTRS_PER_PGD];extern pgd_t init_pg_end[];extern pgd_t swapper_pg_dir[PTRS_PER_PGD ];extern pgd_t idmap_pg_dir[PTRS_PER_PGD ]; +extern pgd_t idmap_pg_end[];extern pgd_t tramp_pg_dir[PTRS_PER_PGD ];extern void set_swapper_pgd (pgd_t *pgdp,pgd_t pgd);
arch/arm64/kernel/head.S +9 -3
@@ -393,13 +393,19 @@ __create_page_tables: /* * Since the page tables have been populated with non-cacheable - * accesses (MMU disabled), invalidate the idmap and swapper page - * tables again to remove any speculatively loaded cache lines. + * accesses (MMU disabled), invalidate those tables again to + * remove any speculatively loaded cache lines. */ + dmb sy + adrp x0, idmap_pg_dir + adrp x1, idmap_pg_end + sub x1, x1, x0 + bl __inval_dcache_area + + adrp x0, init_pg_dir adrp x1, init_pg_end sub x1, x1, x0 - dmb sy bl __inval_dcache_area ret x28
arch/arm64/kernel/vmlinux.lds.S +1 -0
@@ -142,6 +142,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); idmap_pg_dir = .; . += IDMAP_DIR_SIZE; + idmap_pg_end = .; #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 tramp_pg_dir = .;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/175 libbpf: Fix memory leak and possible double-free in hashmap__clear
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 229bf8bf4d910510bc1a2fd0b89bd467cd71050d ]
Fix memory leak in hashmap_clear() not freeing hashmap_entry structs for each of the remaining entries. Also NULL-out bucket list to prevent possible double-free between hashmap__clear() and hashmap__free().
Running test_progs-asan flavor clearly showed this problem.
--- tools/lib/bpf/hashmap.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/lib/bpf/hashmap.c +7 -0
@@ -56,7 +56,14 @@ struct hashmap *hashmap__new(hashmap_hash_fn hash_fn,void hashmap__clear (struct hashmap *map) { +struct hashmap_entry *cur, *tmp; +int bkt; + +hashmap__for_each_entry_safe (map, cur, tmp, bkt) { +free (cur); + }free (map->buckets); + map->buckets =NULL ; map->cap = map->cap_bits = map->sz =0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 17/175 spi: pxa2xx: Apply CS clk quirk to BXT
In reply to Sasha LevinFrom: Evan Green <[email protected]>
[ Upstream commit 6eefaee4f2d366a389da0eb95e524ba82bf358c4 ]
With a couple allies at Intel, and much badgering, I got confirmation from Intel that at least BXT suffers from the same SPI chip-select issue as Cannonlake (and beyond). The issue being that after going through runtime suspend/resume, toggling the chip-select line without also sending data does nothing.
Add the quirk to BXT to briefly toggle dynamic clock gating off and on, forcing the fabric to wake up enough to notice the CS register change.
--- drivers/spi/spi-pxa2xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-pxa2xx.c +1 -0
@@ -148,6 +148,7 @@ static const struct lpss_config lpss_platforms[] = { .tx_threshold_hi = 48, .cs_sel_shift = 8, .cs_sel_mask = 3 << 8, + .cs_clk_stays_gated = true, }, {/* LPSS_CNL_SSP */ .offset = 0x200,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 18/175 x86,smap: Fix smap_{save,restore}() alternatives
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 1ff865e343c2b59469d7e41d370a980a3f972c71 ]
As reported by objtool:
lib/ubsan.o: warning: objtool: .altinstr_replacement+0x0: alternative modifies stack lib/ubsan.o: warning: objtool: .altinstr_replacement+0x7: alternative modifies stack
the smap_{save,restore}() alternatives violate (the newly enforced) rule on stack invariance. That is, due to there only being a single ORC table it must be valid to any alternative. These alternatives violate this with the direct result that unwinds will not be correct when it hits between the PUSH and POP instructions.
Rewrite the functions to only have a conditional jump.
--- arch/x86/include/asm/smap.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/include/asm/smap.h +8 -3
@@ -57,8 +57,10 @@ static __always_inline unsigned long smap_save(void) {unsigned long flags; - asm volatile (ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC, - X86_FEATURE_SMAP) + asmvolatile ("# smap_save\n\t" + ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP) + "pushf; pop %0; " __ASM_CLAC "\n\t" + "1:" : "=rm" (flags) : : "memory", "cc"); return flags;
@@ -66,7 +68,10 @@ static __always_inline unsigned long smap_save(void) static __always_inline void smap_restore(unsigned long flags) { - asm volatile (ALTERNATIVE("", "push %0; popf", X86_FEATURE_SMAP) + asmvolatile ("# smap_restore\n\t" + ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP) + "push %0; popf\n\t" + "1:" : : "g" (flags) : "memory", "cc"); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/175 sched/fair: Refill bandwidth before scaling
In reply to Sasha LevinFrom: Huaixin Chang <[email protected]>
[ Upstream commit 5a6d6a6ccb5f48ca8cf7c6d64ff83fd9c7999390 ]
In order to prevent possible hardlockup of sched_cfs_period_timer() loop, loop count is introduced to denote whether to scale quota and period or not. However, scale is done between forwarding period timer and refilling cfs bandwidth runtime, which means that period timer is forwarded with old "period" while runtime is refilled with scaled "quota".
Move do_sched_cfs_period_timer() before scaling to solve this.
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -4942,6 +4942,8 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)if (!overrun)break ; + idle =do_sched_cfs_period_timer (cfs_b, overrun, flags); +if (++count >3 ) {u64 new, old =ktime_to_ns (cfs_b->period);
@@ -4971,8 +4973,6 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)/* reset count so we don't come right back in here */ count =0 ; } - - idle =do_sched_cfs_period_timer (cfs_b, overrun, flags); }if (idle) cfs_b->period_active =0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 20/175 net: atlantic: make hw_get_regs optional
In reply to Sasha LevinFrom: Mark Starovoytov <[email protected]>
[ Upstream commit d0f23741c202c685447050713907f3be39a985ee ]
This patch fixes potential crash in case if hw_get_regs is NULL.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +6 -0
@@ -690,6 +690,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)u32 *regs_buff = p;int err =0 ; +if (unlikely (!self->aq_hw_ops->hw_get_regs)) +return -EOPNOTSUPP ; + regs->version =1 ; err = self->aq_hw_ops->hw_get_regs(self->aq_hw,
@@ -704,6 +707,9 @@ int aq_nic_get_regs(struct aq_nic_s *self, struct ethtool_regs *regs, void *p)int aq_nic_get_regs_count (struct aq_nic_s *self) { +if (unlikely (!self->aq_hw_ops->hw_get_regs)) +return 0 ; +return self->aq_nic_cfg.aq_hw_caps->mac_regs_count; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 21/175 net: ena: fix error returning in ena_com_get_hash_function()
In reply to Sasha LevinFrom: Arthur Kiyanovski <[email protected]>
[ Upstream commit e9a1de378dd46375f9abfd8de1e6f59ee114a793 ]
In case the "func" parameter is NULL we now return "-EINVAL". This shouldn't happen in general, but when it does happen, this is the proper way to handle it.
We also check func for NULL in the beginning of the function, as there is no reason to do all the work and realize in the end of the function it was useless.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/amazon/ena/ena_com.c +4 -2
@@ -2349,6 +2349,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, rss->hash_key;int rc; +if (unlikely (!func)) +return -EINVAL ; + rc = ena_com_get_feature_ex(ena_dev, &get_resp, ENA_ADMIN_RSS_HASH_FUNCTION, rss->hash_key_dma_addr,
@@ -2361,8 +2364,7 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,if (rss->hash_func) rss->hash_func--; -if (func) - *func = rss->hash_func; + *func = rss->hash_func;if (key)memcpy (key, hash_key->key, (size_t )(hash_key->keys_num) <<2 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 22/175 efi/libstub/x86: Work around LLVM ELF quirk build regression
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit f77767ed5f4d398b29119563155e4ece2dfeee13 ]
When building the x86 EFI stub with Clang, the libstub Makefile rules that manipulate the ELF object files may throw an error like:
STUBCPY drivers/firmware/efi/libstub/efi-stub-helper.stub.o
strip: drivers/firmware/efi/libstub/efi-stub-helper.stub.o: Failed to find link section for section 10
objcopy: drivers/firmware/efi/libstub/efi-stub-helper.stub.o: Failed to find link section for section 10
This is the result of a LLVM feature [0] where symbol references are stored in a LLVM specific .llvm_addrsig section in a non-transparent way, causing generic ELF tools such as strip or objcopy to choke on them.
So force the compiler not to emit these sections, by passing the appropriate command line option.
[0] https://sourceware.org/bugzilla/show_bug.cgi?id=23817
--- drivers/firmware/efi/libstub/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/libstub/Makefile +1 -0
@@ -28,6 +28,7 @@ KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \ -D__NO_FORTIFY \ $(call cc-option,-ffreestanding) \ $(call cc-option,-fno-stack-protector) \ + $(call cc-option,-fno-addrsig) \ -D__DISABLE_EXPORTS GCOV_PROFILE := n
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 23/175 ath10k: remove the max_sched_scan_reqs value
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit d431f8939c1419854dfe89dd345387f5397c6edd ]
The struct cfg80211_wowlan of NET_DETECT WoWLAN feature share the same struct cfg80211_sched_scan_request together with scheduled scan request feature, and max_sched_scan_reqs of wiphy is only used for sched scan, and ath10k does not support scheduled scan request feature, so ath10k does not set flag NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR, but ath10k set max_sched_scan_reqs of wiphy to a non zero value 1, then function nl80211_add_commands_unsplit of cfg80211 will set it support command NL80211_CMD_START_SCHED_SCAN because max_sched_scan_reqs is a non zero value, but actually ath10k not support it, then it leads a mismatch result for sched scan of cfg80211, then application shill found the mismatch and stop running case of MAC random address scan and then the case fail.
After remove max_sched_scan_reqs value, it keeps match for sched scan and case of MAC random address scan pass.
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00029. Tested with QCA6174 PCIe with firmware WLAN.RM.4.4.1-00110-QCARMSWP-1.
--- drivers/net/wireless/ath/ath10k/mac.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +0 -1
@@ -8811,7 +8811,6 @@ int ath10k_mac_register(struct ath10k *ar) ar->hw->wiphy->max_scan_ie_len =WLAN_SCAN_PARAMS_MAX_IE_LEN ;if (test_bit (WMI_SERVICE_NLO , ar->wmi.svc_map)) { - ar->hw->wiphy->max_sched_scan_reqs =1 ; ar->hw->wiphy->max_sched_scan_ssids =WMI_PNO_MAX_SUPP_NETWORKS ; ar->hw->wiphy->max_match_sets =WMI_PNO_MAX_SUPP_NETWORKS ; ar->hw->wiphy->max_sched_scan_ie_len =WMI_PNO_MAX_IE_LENGTH ;
Signature · 7 lines
2.25.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 24/175 arm64: cacheflush: Fix KGDB trap detection
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit ab8ad279ceac4fc78ae4dcf1a26326e05695e537 ]
flush_icache_range() contains a bodge to avoid issuing IPIs when the kgdb trap handler is running because issuing IPIs is unsafe (and not needed) in this execution context. However the current test, based on kgdb_connected is flawed: it both over-matches and under-matches.
The over match occurs because kgdb_connected is set when gdb attaches to the stub and remains set during normal running. This is relatively harmelss because in almost all cases irq_disabled() will be false.
The under match is more serious. When kdb is used instead of kgdb to access the debugger then kgdb_connected is not set in all the places that the debug core updates sw breakpoints (and hence flushes the icache). This can lead to deadlock.
Fix by replacing the ad-hoc check with the proper kgdb macro. This also allows us to drop the #ifdef wrapper.
--- arch/arm64/include/asm/cacheflush.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/cacheflush.h +3 -3
@@ -79,7 +79,7 @@ static inline void flush_icache_range(unsigned long start, unsigned long end)* IPI all online CPUs so that they undergo a context synchronization * event and are forced to refetch the new instructions. */ -#ifdef CONFIG_KGDB +/* * KGDB performs cache maintenance with interrupts disabled, so we * will deadlock trying to IPI the secondary CPUs. In theory, we can
@@ -89,9 +89,9 @@ static inline void flush_icache_range(unsigned long start, unsigned long end)* the patching operation, so we don't need extra IPIs here anyway. * In which case, add a KGDB-specific bodge and return early. */ -if (kgdb_connected &&irqs_disabled ()) +if (in_dbg_master ())return ; -#endif +kick_all_cpus_sync (); }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 25/175 media: staging: ipu3: Fix stale list entries on parameter queue failure
In reply to Sasha LevinFrom: Tomasz Figa <[email protected]>
[ Upstream commit 735a02f1bbc2c5e6e9cdbf0222948ff03ff7ab2d ]
When queuing parameters fails, current code bails out without deleting the corresponding vb2 buffer from the driver buffer list, but the buffer is returned to vb2. This leads to stale list entries and a crash when the driver stops streaming:
[ 224.935561] ipu3-imgu 0000:00:05.0: set parameters failed. [ 224.998932] ipu3-imgu 0000:00:05.0: set parameters failed. [ 225.064430] ipu3-imgu 0000:00:05.0: set parameters failed. [ 225.128534] ipu3-imgu 0000:00:05.0: set parameters failed. [ 225.194945] ipu3-imgu 0000:00:05.0: set parameters failed. [ 225.360363] ------------[ cut here ]------------ [ 225.360372] WARNING: CPU: 0 PID: 6704 at drivers/media/common/videobuf2/videobuf2-core.c:927 vb2_buffer_done+0x20f/0x21a [videobuf2_common] [ 225.360374] Modules linked in: snd_seq_dummy snd_seq snd_seq_device
veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common videobuf2_dma_sg videobuf2_memops ov13858 ov5670 v4l2_fwnode dw9714 acpi_als xt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring cros_ec_light_prox cros_ec_sensors cros_ec_sensors_core industrialio_triggered_buffer kfifo_buf industrialio cros_ec_sensorsupport cdc_ether btusb btrtl btintel btbcm usbnet bluetooth ecdh_generic ecc hid_google_hammer iwlmvm iwl7000_mac80211 r8152 mii lzo_rle lzo_compress iwlwifi zram cfg80211 joydev
[ 225.360400] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G C 5.4.30 #5 [ 225.360402] Hardware name: HP Soraka/Soraka, BIOS Google_Soraka.10431.106.0 12/03/2019 [ 225.360405] RIP: 0010:vb2_buffer_done+0x20f/0x21a [videobuf2_common] [ 225.360408] Code: 5e 41 5f 5d e9 e0 16 5a d4 41 8b 55 08 48 c7 c7 8f 8b 5c c0 48 c7 c6 36 9a 5c c0 44 89 f9 31 c0 e8 a5 1c 5b d4 e9 53 fe ff ff <0f> 0b eb a3 e8 12 d7 43 d4 eb 97 0f 1f 44 00 00 55 48 89 e5 41 56 [ 225.360410] RSP: 0018:ffff9468ab32fba8 EFLAGS: 00010297 [ 225.360412] RAX: ffff8aa7a51577a8 RBX: dead000000000122 RCX: ffff8aa7a51577a8 [ 225.360414] RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffff8aa7a5157400 [ 225.360416] RBP: ffff9468ab32fbd8 R08: ffff8aa64e47e600 R09: 0000000000000000 [ 225.360418] R10: 0000000000000000 R11: ffffffffc06036e6 R12: dead000000000100 [ 225.360420] R13: ffff8aa7820f1940 R14: ffff8aa7a51577a8 R15: 0000000000000006 [ 225.360422] FS: 00007c1146ffd700(0000) GS:ffff8aa7baa00000(0000) knlGS:0000000000000000 [ 225.360424] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 225.360426] CR2: 00007aea3473a000 CR3: 00000000537d6004 CR4: 00000000003606f0 [ 225.360427] Call Trace: [ 225.360434] imgu_return_all_buffers+0x6f/0x8e [ipu3_imgu] [ 225.360438] imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu] [ 225.360441] __vb2_queue_cancel+0x33/0x22d [videobuf2_common] [ 225.360443] vb2_core_streamoff+0x16/0x78 [videobuf2_common] [ 225.360448] __video_do_ioctl+0x33d/0x42a [ 225.360452] video_usercopy+0x34a/0x615 [ 225.360455] ? video_ioctl2+0x16/0x16 [ 225.360458] v4l2_ioctl+0x46/0x53 [ 225.360462] do_vfs_ioctl+0x50a/0x787 [ 225.360465] ksys_ioctl+0x58/0x83 [ 225.360468] __x64_sys_ioctl+0x1a/0x1e [ 225.360470] do_syscall_64+0x54/0x68 [ 225.360474] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 225.360476] RIP: 0033:0x7c118030f497 [ 225.360479] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48 [ 225.360480] RSP: 002b:00007c1146ffa5a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 225.360483] RAX: ffffffffffffffda RBX: 00007c1140010018 RCX: 00007c118030f497 [ 225.360484] RDX: 00007c114001019c RSI: 0000000040045613 RDI: 000000000000004c [ 225.360486] RBP: 00007c1146ffa700 R08: 00007c1140010048 R09: 0000000000000000 [ 225.360488] R10: 0000000000000000 R11: 0000000000000246 R12: 00007c11400101b0 [ 225.360489] R13: 00007c1140010200 R14: 00007c1140010048 R15: 0000000000000001 [ 225.360492] ---[ end trace 73625ecfbd1c930e ]--- [ 225.360498] general protection fault: 0000 [#1] PREEMPT SMP PTI [ 225.360501] CPU: 0 PID: 6704 Comm: CameraDeviceOps Tainted: G WC 5.4.30 #5 [ 225.360502] Hardware name: HP Soraka/Soraka, BIOS Google_Soraka.10431.106.0 12/03/2019 [ 225.360505] RIP: 0010:imgu_return_all_buffers+0x52/0x8e [ipu3_imgu] [ 225.360507] Code: d4 49 8b 85 70 0a 00 00 49 81 c5 70 0a 00 00 49 39 c5 74 3b 49 bc 00 01 00 00 00 00 ad de 49 8d 5c 24 22 4c 8b 30 48 8b 48 08 <49> 89 4e 08 4c 89 31 4c 89 20 48 89 58 08 48 8d b8 58 fc ff ff 44 [ 225.360509] RSP: 0018:ffff9468ab32fbe8 EFLAGS: 00010293 [ 225.360511] RAX: ffff8aa7a51577a8 RBX: dead000000000122 RCX: dead000000000122 [ 225.360512] RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffff8aa7a5157400 [ 225.360514] RBP: ffff9468ab32fc18 R08: ffff8aa64e47e600 R09: 0000000000000000 [ 225.360515] R10: 0000000000000000 R11: ffffffffc06036e6 R12: dead000000000100 [ 225.360517] R13: ffff8aa7820f1940 R14: dead000000000100 R15: 0000000000000006 [ 225.360519] FS: 00007c1146ffd700(0000) GS:ffff8aa7baa00000(0000) knlGS:0000000000000000 [ 225.360521] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 225.360523] CR2: 00007aea3473a000 CR3: 00000000537d6004 CR4: 00000000003606f0 [ 225.360525] Call Trace: [ 225.360528] imgu_vb2_stop_streaming+0xd6/0xf0 [ipu3_imgu] [ 225.360531] __vb2_queue_cancel+0x33/0x22d [videobuf2_common] [ 225.360534] vb2_core_streamoff+0x16/0x78 [videobuf2_common] [ 225.360537] __video_do_ioctl+0x33d/0x42a [ 225.360540] video_usercopy+0x34a/0x615 [ 225.360542] ? video_ioctl2+0x16/0x16 [ 225.360546] v4l2_ioctl+0x46/0x53 [ 225.360548] do_vfs_ioctl+0x50a/0x787 [ 225.360551] ksys_ioctl+0x58/0x83 [ 225.360554] __x64_sys_ioctl+0x1a/0x1e [ 225.360556] do_syscall_64+0x54/0x68 [ 225.360559] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 225.360561] RIP: 0033:0x7c118030f497 [ 225.360563] Code: 8a 66 90 48 8b 05 d1 d9 2b 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a1 d9 2b 00 f7 d8 64 89 01 48 [ 225.360565] RSP: 002b:00007c1146ffa5a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 225.360567] RAX: ffffffffffffffda RBX: 00007c1140010018 RCX: 00007c118030f497 [ 225.360569] RDX: 00007c114001019c RSI: 0000000040045613 RDI: 000000000000004c [ 225.360570] RBP: 00007c1146ffa700 R08: 00007c1140010048 R09: 0000000000000000 [ 225.360572] R10: 0000000000000000 R11: 0000000000000246 R12: 00007c11400101b0 [ 225.360574] R13: 00007c1140010200 R14: 00007c1140010048 R15: 0000000000000001 [ 225.360576] Modules linked in: snd_seq_dummy snd_seq snd_seq_device
veth bridge stp llc tun nf_nat_tftp nf_conntrack_tftp nf_nat_ftp nf_conntrack_ftp esp6 ah6 ip6t_REJECT ip6t_ipv6header cmac rfcomm uinput ipu3_imgu(C) ipu3_cio2 iova videobuf2_v4l2 videobuf2_common videobuf2_dma_sg videobuf2_memops ov13858 ov567
Fix this by moving the list_del() call just below the list_first_entry() call when the buffer no longer needs to be in the list.
--- drivers/staging/media/ipu3/ipu3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu3/ipu3.c +1 -1
@@ -261,6 +261,7 @@ int imgu_queue_buffers(struct imgu_device *imgu, bool initial, unsigned int pipe ivb =list_first_entry (&imgu_pipe->nodes[node].buffers, struct imgu_vb2_buffer, list); +list_del (&ivb->list); vb = &ivb->vbb.vb2_buf; r =imgu_css_set_parameters (&imgu->css, pipe,vb2_plane_vaddr (vb,0 ));
@@ -274,7 +275,6 @@ int imgu_queue_buffers(struct imgu_device *imgu, bool initial, unsigned int pipevb2_buffer_done (vb,VB2_BUF_STATE_DONE );dev_dbg (&imgu->pci_dev->dev,"queue user parameters %d to css." , vb->index); -list_del (&ivb->list); }else if (imgu_pipe->queue_enabled[node]) {struct imgu_css_buffer *buf =imgu_queue_getbuf (imgu, node, pipe);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 26/175 rtw88: fix an issue about leak system resources
In reply to Sasha LevinFrom: Dejin Zheng <[email protected]>
[ Upstream commit 191f6b08bfef24e1a9641eaac96ed030a7be4599 ]
the related system resources were not released when pci_iomap() return error in the rtw_pci_io_mapping() function. add pci_release_regions() to fix it.
--- drivers/net/wireless/realtek/rtw88/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtw88/pci.c +1 -0
@@ -974,6 +974,7 @@ static int rtw_pci_io_mapping(struct rtw_dev *rtwdev, len =pci_resource_len (pdev, bar_id); rtwpci->mmap =pci_iomap (pdev, bar_id, len);if (!rtwpci->mmap) { +pci_release_regions (pdev);rtw_err (rtwdev,"failed to map pci memory\n" );return -ENOMEM ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 27/175 spi: dw: Zero DMA Tx and Rx configurations on stack
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 3cb97e223d277f84171cc4ccecab31e08b2ee7b5 ]
Some DMA controller drivers do not tolerate non-zero values in the DMA configuration structures. Zero them to avoid issues with such DMA controller drivers. Even despite above this is a good practice per se.
--- drivers/spi/spi-dw-mid.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-dw-mid.c +2 -0
@@ -147,6 +147,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws,if (!xfer->tx_buf)return NULL ; +memset (&txconf,0 ,sizeof (txconf)); txconf.direction =DMA_MEM_TO_DEV ; txconf.dst_addr = dws->dma_addr; txconf.dst_maxburst =16 ;
@@ -193,6 +194,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,if (!xfer->rx_buf)return NULL ; +memset (&rxconf,0 ,sizeof (rxconf)); rxconf.direction =DMA_DEV_TO_MEM ; rxconf.src_addr = dws->dma_addr; rxconf.src_maxburst =16 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 28/175 x86/cpu/amd: Make erratum #1054 a legacy erratum
In reply to Sasha LevinFrom: Kim Phillips <[email protected]>
[ Upstream commit e2abfc0448a46d8a137505aa180caf14070ec535 ]
Commit
21b5ee59ef18 ("x86/cpu/amd: Enable the fixed Instructions Retired
counter IRPERF")
mistakenly added erratum #1054 as an OS Visible Workaround (OSVW) ID 0. Erratum #1054 is not OSVW ID 0 [1], so make it a legacy erratum.
There would never have been a false positive on older hardware that has OSVW bit 0 set, since the IRPERF feature was not available.
However, save a couple of RDMSR executions per thread, on modern system configurations that correctly set non-zero values in their OSVW_ID_Length MSRs.
[1] Revision Guide for AMD Family 17h Models 00h-0Fh Processors. The revision guide is available from the bugzilla link below.
--- arch/x86/kernel/cpu/amd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/amd.c +1 -2
@@ -1117,8 +1117,7 @@ static const int amd_erratum_383[] =/* #1054: Instructions Retired Performance Counter May Be Inaccurate */ static const int amd_erratum_1054[] = -AMD_OSVW_ERRATUM (0 ,AMD_MODEL_RANGE (0x17 ,0 ,0 ,0x2f ,0xf )); - +AMD_LEGACY_ERRATUM (AMD_MODEL_RANGE (0x17 ,0 ,0 ,0x2f ,0xf ));static bool cpu_has_amd_erratum (struct cpuinfo_x86 *cpu,const int *erratum) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 29/175 ACPICA: Dispatcher: add status checks
In reply to Sasha LevinFrom: Erik Kaneda <[email protected]>
[ Upstream commit 6bfe5344b2956d0bee116f1c640aef05e5cddd76 ]
ACPICA commit 3244c1eeba9f9fb9ccedb875f7923a3d85e0c6aa
The status chekcs are used to to avoid NULL pointer dereference on field objects
--- drivers/acpi/acpica/dsfield.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/acpi/acpica/dsfield.c +12 -5
@@ -518,13 +518,20 @@ acpi_ds_create_field(union acpi_parse_object *op, info.region_node = region_node; status =acpi_ds_get_field_names (&info, walk_state, arg->common.next); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } +if (info.region_node->object->region.space_id == -ACPI_ADR_SPACE_PLATFORM_COMM - && !(region_node->object->field.internal_pcc_buffer = -ACPI_ALLOCATE_ZEROED (info.region_node->object->region. - length))) { -return_ACPI_STATUS (AE_NO_MEMORY ); +ACPI_ADR_SPACE_PLATFORM_COMM ) { + region_node->object->field.internal_pcc_buffer = +ACPI_ALLOCATE_ZEROED (info.region_node->object->region. + length); +if (!region_node->object->field.internal_pcc_buffer) { +return_ACPI_STATUS (AE_NO_MEMORY ); + } } +return_ACPI_STATUS (status); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 30/175 block: alloc map and request for new hardware queue
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit fd689871bbfbb41cd77379d3e9e5f4def0f7d6c6 ]
Alloc new map and request for new hardware queue when increse hardware queue count. Before this patch, it will show a warning for each new hardware queue, but it's not enough, these hctx have no maps and reqeust, when a bio was mapped to these hardware queue, it will trigger kernel panic when get request from these hctx.
Test environment:
* A NVMe disk supports 128 io queues
* 96 cpus in system
A corner case can always trigger this panic, there are 96
io queues allocated for HCTX_TYPE_DEFAULT type, the corresponding kernel
log: nvme nvme0: 96/0/0 default/read/poll queues. Now we set nvme write queues to 96, then nvme will alloc others(32) queues for read, but blk_mq_update_nr_hw_queues does not alloc map and request for these new added io queues. So when process read nvme disk, it will trigger kernel panic when get request from these hardware context.
Reproduce script:
nr=$(expr cat /sys/block/nvme0n1/device/queue_count - 1) echo $nr > /sys/module/nvme/parameters/write_queues echo 1 > /sys/block/nvme0n1/device/reset_controller dd if=/dev/nvme0n1 of=/dev/null bs=4K count=1
[ 8040.805626] ------------[ cut here ]------------ [ 8040.805627] WARNING: CPU: 82 PID: 12921 at block/blk-mq.c:2578 blk_mq_map_swqueue+0x2b6/0x2c0 [ 8040.805627] Modules linked in: nvme nvme_core nf_conntrack_netlink xt_addrtype br_netfilter overlay xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nft_counter nf_nat_tftp nf_conntrack_tftp nft_masq nf_tables_set nft_fib_inet nft_f
ib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack tun bridge nf_defrag_ipv6 nf_defrag_ipv4 stp llc ip6_tables ip_tables nft_compat rfkill ip_set nf_tables nfne tlink sunrpc intel_rapl_msr intel_rapl_common skx_edac nfit libnvdimm x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass ipmi_ssif crct10dif_pclmul crc32_pclmul iTCO_wdt iTCO_vendor_support ghash_clmulni_intel intel_ cstate intel_uncore raid0 joydev intel_rapl_perf ipmi_si pcspkr mei_me ioatdma sg ipmi_devintf mei i2c_i801 dca lpc_ich ipmi_msghandler acpi_power_meter acpi_pad xfs libcrc32c sd_mod ast i2c_algo_bit drm_vram_helper drm_ttm_helper ttm d rm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops
[ 8040.805637] ahci drm i40e libahci crc32c_intel libata t10_pi wmi dm_mirror dm_region_hash dm_log dm_mod [last unloaded: nvme_core] [ 8040.805640] CPU: 82 PID: 12921 Comm: kworker/u194:2 Kdump: loaded Tainted: G W 5.6.0-rc5.78317c+ #2 [ 8040.805640] Hardware name: Inspur SA5212M5/YZMB-00882-104, BIOS 4.0.9 08/27/2019 [ 8040.805641] Workqueue: nvme-reset-wq nvme_reset_work [nvme] [ 8040.805642] RIP: 0010:blk_mq_map_swqueue+0x2b6/0x2c0 [ 8040.805643] Code: 00 00 00 00 00 41 83 c5 01 44 39 6d 50 77 b8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 48 8b bb 98 00 00 00 89 d6 e8 8c 81 03 00 eb 83 <0f> 0b e9 52 ff ff ff 0f 1f 00 0f 1f 44 00 00 41 57 48 89 f1 41 56 [ 8040.805643] RSP: 0018:ffffba590d2e7d48 EFLAGS: 00010246 [ 8040.805643] RAX: 0000000000000000 RBX: ffff9f013e1ba800 RCX: 000000000000003d [ 8040.805644] RDX: ffff9f00ffff6000 RSI: 0000000000000003 RDI: ffff9ed200246d90 [ 8040.805644] RBP: ffff9f00f6a79860 R08: 0000000000000000 R09: 000000000000003d [ 8040.805645] R10: 0000000000000001 R11: ffff9f0138c3d000 R12: ffff9f00fb3a9008 [ 8040.805645] R13: 000000000000007f R14: ffffffff96822660 R15: 000000000000005f [ 8040.805645] FS: 0000000000000000(0000) GS:ffff9f013fa80000(0000) knlGS:0000000000000000 [ 8040.805646] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8040.805646] CR2: 00007f7f397fa6f8 CR3: 0000003d8240a002 CR4: 00000000007606e0 [ 8040.805647] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 8040.805647] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 8040.805647] PKRU: 55555554 [ 8040.805647] Call Trace: [ 8040.805649] blk_mq_update_nr_hw_queues+0x31b/0x390 [ 8040.805650] nvme_reset_work+0xb4b/0xeab [nvme] [ 8040.805651] process_one_work+0x1a7/0x370 [ 8040.805652] worker_thread+0x1c9/0x380 [ 8040.805653] ? max_active_store+0x80/0x80 [ 8040.805655] kthread+0x112/0x130 [ 8040.805656] ? __kthread_parkme+0x70/0x70 [ 8040.805657] ret_from_fork+0x35/0x40 [ 8040.805658] ---[ end trace b5f13b1e73ccb5d3 ]--- [ 8229.365135] BUG: kernel NULL pointer dereference, address: 0000000000000004 [ 8229.365165] #PF: supervisor read access in kernel mode [ 8229.365178] #PF: error_code(0x0000) - not-present page [ 8229.365191] PGD 0 P4D 0 [ 8229.365201] Oops: 0000 [#1] SMP PTI [ 8229.365212] CPU: 77 PID: 13024 Comm: dd Kdump: loaded Tainted: G W 5.6.0-rc5.78317c+ #2 [ 8229.365232] Hardware name: Inspur SA5212M5/YZMB-00882-104, BIOS 4.0.9 08/27/2019 [ 8229.365253] RIP: 0010:blk_mq_get_tag+0x227/0x250 [ 8229.365265] Code: 44 24 04 44 01 e0 48 8b 74 24 38 65 48 33 34 25 28 00 00 00 75 33 48 83 c4 40 5b 5d 41 5c 41 5d 41 5e c3 48 8d 68 10 4c 89 ef <44> 8b 60 04 48 89 ee e8 dd f9 ff ff 83 f8 ff 75 c8 e9 67 fe ff ff [ 8229.365304] RSP: 0018:ffffba590e977970 EFLAGS: 00010246 [ 8229.365317] RAX: 0000000000000000 RBX: ffff9f00f6a79860 RCX: ffffba590e977998 [ 8229.365333] RDX: 0000000000000000 RSI: ffff9f012039b140 RDI: ffffba590e977a38 [ 8229.365349] RBP: 0000000000000010 R08: ffffda58ff94e190 R09: ffffda58ff94e198 [ 8229.365365] R10: 0000000000000011 R11: ffff9f00f6a79860 R12: 0000000000000000 [ 8229.365381] R13: ffffba590e977a38 R14: ffff9f012039b140 R15: 0000000000000001 [ 8229.365397] FS: 00007f481c230580(0000) GS:ffff9f013f940000(0000) knlGS:0000000000000000 [ 8229.365415] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8229.365428] CR2: 0000000000000004 CR3: 0000005f35e26004 CR4: 00000000007606e0 [ 8229.365444] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 8229.365460] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 8229.365476] PKRU: 55555554 [ 8229.365484] Call Trace: [ 8229.365498] ? finish_wait+0x80/0x80 [ 8229.365512] blk_mq_get_request+0xcb/0x3f0 [ 8229.365525] blk_mq_make_request+0x143/0x5d0 [ 8229.365538] generic_make_request+0xcf/0x310 [ 8229.365553] ? scan_shadow_nodes+0x30/0x30 [ 8229.365564] submit_bio+0x3c/0x150 [ 8229.365576] mpage_readpages+0x163/0x1a0 [ 8229.365588] ? blkdev_direct_IO+0x490/0x490 [ 8229.365601] read_pages+0x6b/0x190 [ 8229.365612] __do_page_cache_readahead+0x1c1/0x1e0 [ 8229.365626] ondemand_readahead+0x182/0x2f0 [ 8229.365639] generic_file_buffered_read+0x590/0xab0 [ 8229.365655] new_sync_read+0x12a/0x1c0 [ 8229.365666] vfs_read+0x8a/0x140 [ 8229.365676] ksys_read+0x59/0xd0 [ 8229.365688] do_syscall_64+0x55/0x1d0 [ 8229.365700] entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- block/blk-mq.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
block/blk-mq.c +12 -12
@@ -2493,18 +2493,6 @@ static void blk_mq_map_swqueue(struct request_queue *q)* If the cpu isn't present, the cpu is mapped to first hctx. */ for_each_possible_cpu (i) { - hctx_idx = set->map[HCTX_TYPE_DEFAULT ].mq_map[i]; -/* unmapped hw queue can be remapped after CPU topo changed */ -if (!set->tags[hctx_idx] && - !__blk_mq_alloc_rq_map (set, hctx_idx)) { -/* -* If tags initialization fail for some hctx, -* that hctx won't be brought online. In this -* case, remap the current ctx to hctx[0] which -* is guaranteed to always have tags allocated -*/ - set->map[HCTX_TYPE_DEFAULT ].mq_map[i] =0 ; - } ctx =per_cpu_ptr (q->queue_ctx, i);for (j =0 ; j < set->nr_maps; j++) {
@@ -2513,6 +2501,18 @@ static void blk_mq_map_swqueue(struct request_queue *q) HCTX_TYPE_DEFAULT, i);continue ; } + hctx_idx = set->map[j].mq_map[i]; +/* unmapped hw queue can be remapped after CPU topo changed */ +if (!set->tags[hctx_idx] && + !__blk_mq_alloc_rq_map (set, hctx_idx)) { +/* +* If tags initialization fail for some hctx, +* that hctx won't be brought online. In this +* case, remap the current ctx to hctx[0] which +* is guaranteed to always have tags allocated +*/ + set->map[j].mq_map[i] =0 ; + } hctx =blk_mq_map_queue_type (q, j, i); ctx->hctxs[j] = hctx;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 31/175 arm64: insn: Fix two bugs in encoding 32-bit logical immediates
In reply to Sasha LevinFrom: Luke Nelson <[email protected]>
[ Upstream commit 579d1b3faa3735e781ff74aac0afd598515dbc63 ]
This patch fixes two issues present in the current function for encoding arm64 logical immediates when using the 32-bit variants of instructions.
First, the code does not correctly reject an all-ones 32-bit immediate, and returns an undefined instruction encoding.
Second, the code incorrectly rejects some 32-bit immediates that are actually encodable as logical immediates. The root cause is that the code uses a default mask of 64-bit all-ones, even for 32-bit immediates. This causes an issue later on when the default mask is used to fill the top bits of the immediate with ones, shown here:
/*
* Pattern: 0..01..10..01..1
*
* Fill the unused top bits with ones, and check if
* the result is a valid immediate (all ones with a
* contiguous ranges of zeroes).
*/
imm |= ~mask;
if (!range_of_ones(~imm))
return AARCH64_BREAK_FAULT;
To see the problem, consider an immediate of the form 0..01..10..01..1, where the upper 32 bits are zero, such as 0x80000001. The code checks if ~(imm | ~mask) contains a range of ones: the incorrect mask yields 1..10..01..10..0, which fails the check; the correct mask yields 0..01..10..0, which succeeds.
The fix for both issues is to generate a correct mask based on the instruction immediate size, and use the mask to check for all-ones, all-zeroes, and values wider than the mask.
Currently, arch/arm64/kvm/va_layout.c is the only user of this function, which uses 64-bit immediates and therefore won't trigger these bugs.
We tested the new code against llvm-mc with all 1,302 encodable 32-bit logical immediates and all 5,334 encodable 64-bit logical immediates.
--- arch/arm64/kernel/insn.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm64/kernel/insn.c +7 -7
@@ -1508,16 +1508,10 @@ static u32 aarch64_encode_immediate(u64 imm, u32 insn) {unsigned int immr, imms, n, ones, ror, esz, tmp; -u64 mask = ~0UL ; - -/* Can't encode full zeroes or full ones */ -if (!imm || !~imm) -return AARCH64_BREAK_FAULT ; +u64 mask;switch (variant) {case AARCH64_INSN_VARIANT_32BIT : -if (upper_32_bits (imm)) -return AARCH64_BREAK_FAULT ; esz =32 ;break ;case AARCH64_INSN_VARIANT_64BIT :
@@ -1529,6 +1523,12 @@ static u32 aarch64_encode_immediate(u64 imm,return AARCH64_BREAK_FAULT ; } + mask =GENMASK (esz -1 ,0 ); + +/* Can't encode full zeroes, full ones, or value wider than the mask */ +if (!imm || imm == mask || imm & ~mask) +return AARCH64_BREAK_FAULT ; +/* * Inverse of Replicate(). Try to spot a repeating pattern * with a pow2 stride.
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 32/175 block: reset mapping if failed to update hardware queue count
In reply to Sasha LevinFrom: Weiping Zhang <[email protected]>
[ Upstream commit aa880ad690ab6d4c53934af85fb5a43e69ecb0f5 ]
When we increase hardware queue count, blk_mq_update_queue_map will reset the mapping between cpu and hardware queue base on the hardware queue count(set->nr_hw_queues). The mapping cannot be reset if it encounters error in blk_mq_realloc_hw_ctxs, but the fallback flow will continue using it, then blk_mq_map_swqueue will touch a invalid memory, because the mapping points to a wrong hctx.
blktest block/030:
null_blk: module loaded
Increasing nr_hw_queues to 8 fails, fallback to 1
==================================================================
BUG: KASAN: null-ptr-deref in blk_mq_map_swqueue+0x2f2/0x830 Read of size 8 at addr 0000000000000128 by task nproc/8541 CPU: 5 PID: 8541 Comm: nproc Not tainted 5.7.0-rc4-dbg+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014 Call Trace: dump_stack+0xa5/0xe6 __kasan_report.cold+0x65/0xbb kasan_report+0x45/0x60 check_memory_region+0x15e/0x1c0 __kasan_check_read+0x15/0x20 blk_mq_map_swqueue+0x2f2/0x830 __blk_mq_update_nr_hw_queues+0x3df/0x690 blk_mq_update_nr_hw_queues+0x32/0x50 nullb_device_submit_queues_store+0xde/0x160 [null_blk] configfs_write_file+0x1c4/0x250 [configfs] __vfs_write+0x4c/0x90 vfs_write+0x14b/0x2d0 ksys_write+0xdd/0x180 __x64_sys_write+0x47/0x50 do_syscall_64+0x6f/0x310 entry_SYSCALL_64_after_hwframe+0x49/0xb3
--- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
@@ -3304,8 +3304,8 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, prev_nr_hw_queues = set->nr_hw_queues; set->nr_hw_queues = nr_hw_queues; -blk_mq_update_queue_map (set); fallback: +blk_mq_update_queue_map (set);list_for_each_entry (q, &set->tag_list, tag_set_list) {blk_mq_realloc_hw_ctxs (set, q);if (q->nr_hw_queues != set->nr_hw_queues) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 33/175 drm: rcar-du: Set primary plane zpos immutably at initializing
In reply to Sasha LevinFrom: Tomohito Esaki <[email protected]>
[ Upstream commit 7982471d01aac33994276bf567c8f1f3a137648a ]
According to drm_plane_create_zpos_property() function documentation, all planes zpos range should be set if zpos property is supported. However, the rcar-du driver didn't set primary plane zpos range. Since the primary plane's zpos is fixed, set it immutably.
--- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 16 +++++++++------- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_plane.c +9 -7
@@ -785,13 +785,15 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)drm_plane_create_alpha_property (&plane->plane); -if (type ==DRM_PLANE_TYPE_PRIMARY ) -continue ; - -drm_object_attach_property (&plane->plane.base, - rcdu->props.colorkey, -RCAR_DU_COLORKEY_NONE ); -drm_plane_create_zpos_property (&plane->plane,1 ,1 ,7 ); +if (type ==DRM_PLANE_TYPE_PRIMARY ) { +drm_plane_create_zpos_immutable_property (&plane->plane, +0 ); + }else { +drm_object_attach_property (&plane->plane.base, + rcdu->props.colorkey, +RCAR_DU_COLORKEY_NONE ); +drm_plane_create_zpos_property (&plane->plane,1 ,1 ,7 ); + } }return 0 ;
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +8 -6
@@ -392,12 +392,14 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,drm_plane_helper_add (&plane->plane, &rcar_du_vsp_plane_helper_funcs); -if (type ==DRM_PLANE_TYPE_PRIMARY ) -continue ; - -drm_plane_create_alpha_property (&plane->plane); -drm_plane_create_zpos_property (&plane->plane,1 ,1 , - vsp->num_planes -1 ); +if (type ==DRM_PLANE_TYPE_PRIMARY ) { +drm_plane_create_zpos_immutable_property (&plane->plane, +0 ); + }else { +drm_plane_create_alpha_property (&plane->plane); +drm_plane_create_zpos_property (&plane->plane,1 ,1 , + vsp->num_planes -1 ); + } }return 0 ;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 34/175 lockdown: Allow unprivileged users to see lockdown status
In reply to Sasha LevinFrom: Jeremy Cline <[email protected]>
[ Upstream commit 60cf7c5ed5f7087c4de87a7676b8c82d96fd166c ]
A number of userspace tools, such as systemtap, need a way to see the current lockdown state so they can gracefully deal with the kernel being locked down. The state is already exposed in /sys/kernel/security/lockdown, but is only readable by root. Adjust the permissions so unprivileged users can read the state.
--- security/lockdown/lockdown.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/lockdown/lockdown.c +1 -1
@@ -175,7 +175,7 @@ static int __init lockdown_secfs_init(void) {struct dentry *dentry; - dentry =securityfs_create_file ("lockdown" ,0600 ,NULL ,NULL , + dentry =securityfs_create_file ("lockdown" ,0644 ,NULL ,NULL , &lockdown_ops);return PTR_ERR_OR_ZERO (dentry); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 35/175 ixgbe: Fix XDP redirect on archs with PAGE_SIZE above 4K
In reply to Sasha LevinFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 88eb0ee17b2ece64fcf6689a4557a5c2e7a89c4b ]
The ixgbe driver have another memory model when compiled on archs with PAGE_SIZE above 4096 bytes. In this mode it doesn't split the page in two halves, but instead increment rx_buffer->page_offset by truesize of packet (which include headroom and tailroom for skb_shared_info).
This is done correctly in ixgbe_build_skb(), but in ixgbe_rx_buffer_flip which is currently only called on XDP_TX and XDP_REDIRECT, it forgets to add the tailroom for skb_shared_info. This breaks XDP_REDIRECT, for veth and cpumap. Fix by adding size of skb_shared_info tailroom.
Maintainers notice: This fix have been queued to Jeff.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
@@ -2254,7 +2254,8 @@ static void ixgbe_rx_buffer_flip(struct ixgbe_ring *rx_ring, rx_buffer->page_offset ^= truesize;#else unsigned int truesize =ring_uses_build_skb (rx_ring) ? -SKB_DATA_ALIGN (IXGBE_SKB_PAD + size) : +SKB_DATA_ALIGN (IXGBE_SKB_PAD + size) + +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )) :SKB_DATA_ALIGN (size); rx_buffer->page_offset += truesize;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 36/175 platform/x86: dell-laptop: don't register micmute LED if there is no token
In reply to Sasha LevinFrom: Koba Ko <[email protected]>
[ Upstream commit 257e03a334ccb96e657bf5f6ab3b5693a22c2aa4 ]
On Dell G3-3590, error message is issued during boot up, "platform::micmute: Setting an LED's brightness failed (-19)", but there's no micmute led on the machine.
Get the related tokens of SMBIOS, GLOBAL_MIC_MUTE_DISABLE/ENABLE. If one of two tokens doesn't exist,
don't call led_classdev_register() for platform::micmute. After that, you wouldn't see the platform::micmute in /sys/class/leds/, and the error message wouldn't see in dmesg.
--- drivers/platform/x86/dell-laptop.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/platform/x86/dell-laptop.c +7 -4
@@ -2204,10 +2204,13 @@ static int __init dell_init(void)dell_laptop_register_notifier (&dell_laptop_notifier); - micmute_led_cdev.brightness =ledtrig_audio_get (LED_AUDIO_MICMUTE ); - ret =led_classdev_register (&platform_device->dev, &micmute_led_cdev); -if (ret <0 ) - goto fail_led; +if (dell_smbios_find_token (GLOBAL_MIC_MUTE_DISABLE ) && +dell_smbios_find_token (GLOBAL_MIC_MUTE_ENABLE )) { + micmute_led_cdev.brightness =ledtrig_audio_get (LED_AUDIO_MICMUTE ); + ret =led_classdev_register (&platform_device->dev, &micmute_led_cdev); +if (ret <0 ) + goto fail_led; + }if (acpi_video_get_backlight_type () != acpi_backlight_vendor)return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 37/175 MIPS: Loongson: Build ATI Radeon GPU driver as module
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit a44de7497f91834df0b8b6d459e259788ba66794 ]
When ATI Radeon GPU driver has been compiled directly into the kernel instead of as a module, we should make sure the firmware for the model (check available ones in /lib/firmware/radeon) is built-in to the kernel as well, otherwise there exists the following fatal error during GPU init, change CONFIG_DRM_RADEON=y to CONFIG_DRM_RADEON=m to fix it.
[ 1.900997] [drm] Loading RS780 Microcode [ 1.905077] radeon 0000:01:05.0: Direct firmware load for radeon/RS780_pfp.bin failed with error -2 [ 1.914140] r600_cp: Failed to load firmware "radeon/RS780_pfp.bin" [ 1.920405] [drm:r600_init] *ERROR* Failed to load firmware! [ 1.926069] radeon 0000:01:05.0: Fatal error during GPU init [ 1.931729] [drm] radeon: finishing device.
--- arch/mips/configs/loongson3_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/configs/loongson3_defconfig +1 -1
@@ -231,7 +231,7 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_USB_SUPPORT=y CONFIG_USB_VIDEO_CLASS=m CONFIG_DRM=y -CONFIG_DRM_RADEON=y +CONFIG_DRM_RADEON=m CONFIG_FB_RADEON=y CONFIG_LCD_CLASS_DEVICE=y CONFIG_LCD_PLATFORM=m
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 38/175 Bluetooth: Add SCO fallback for invalid LMP parameters error
In reply to Sasha LevinFrom: Hsin-Yu Chao <[email protected]>
[ Upstream commit 56b5453a86203a44726f523b4133c1feca49ce7c ]
Bluetooth PTS test case HFP/AG/ACC/BI-12-I accepts SCO connection with invalid parameter at the first SCO request expecting AG to attempt another SCO request with the use of "safe settings" for given codec, base on section 5.7.1.2 of HFP 1.7 specification.
This patch addresses it by adding "Invalid LMP Parameters" (0x1e) to the SCO fallback case. Verified with below log:
< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17
Handle: 256
Transmit bandwidth: 8000
Receive bandwidth: 8000
Max latency: 13
Setting: 0x0003
Input Coding: Linear
Input Data Format: 1's complement
Input Sample Size: 8-bit
# of bits padding at MSB: 0
Air Coding Format: Transparent Data
Retransmission effort: Optimize for link quality (0x02) Packet type: 0x0380
3-EV3 may not be used
2-EV5 may not be used
3-EV5 may not be used
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
Setup Synchronous Connection (0x01|0x0028) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5
Num handles: 1
Handle: 256
Count: 1
Quoted 1 line
HCI Event: Max Slots Change (
0x1b) plen 3
Handle: 256
Max slots: 1
Quoted 1 line
HCI Event: Synchronous Connect Complete (
0x2c) plen 17
Status: Invalid LMP Parameters / Invalid LL Parameters (0x1e)
Handle: 0
Address: 00:1B:DC:F2:21:59 (OUI 00-1B-DC)
Link type: eSCO (0x02)
Transmission interval: 0x00
Retransmission window: 0x02
RX packet length: 0
TX packet length: 0
Air mode: Transparent (0x03)< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17
Handle: 256
Transmit bandwidth: 8000
Receive bandwidth: 8000
Max latency: 8
Setting: 0x0003
Input Coding: Linear
Input Data Format: 1's complement
Input Sample Size: 8-bit
# of bits padding at MSB: 0
Air Coding Format: Transparent Data
Retransmission effort: Optimize for link quality (0x02) Packet type: 0x03c8
EV3 may be used
2-EV3 may not be used
3-EV3 may not be used
2-EV5 may not be used
3-EV5 may not be used
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
Setup Synchronous Connection (0x01|0x0028) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: Max Slots Change (
0x1b) plen 3
Handle: 256
Max slots: 5
Quoted 1 line
HCI Event: Max Slots Change (
0x1b) plen 3
Handle: 256
Max slots: 1
Quoted 1 line
HCI Event: Synchronous Connect Complete (
0x2c) plen 17
Status: Success (0x00)
Handle: 257
Address: 00:1B:DC:F2:21:59 (OUI 00-1B-DC)
Link type: eSCO (0x02)
Transmission interval: 0x06
Retransmission window: 0x04
RX packet length: 30
TX packet length: 30
Air mode: Transparent (0x03)--- net/bluetooth/hci_event.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_event.c +1 -0
@@ -4216,6 +4216,7 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,case 0x11 :/* Unsupported Feature or Parameter Value */ case 0x1c :/* SCO interval rejected */ case 0x1a :/* Unsupported Remote Feature */ +case 0x1e :/* Invalid LMP Parameters */ case 0x1f :/* Unspecified error */ case 0x20 :/* Unsupported LMP Parameter value */ if (conn->out) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 39/175 kgdb: Disable WARN_CONSOLE_UNLOCKED for all kgdb
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 202164fbfa2b2ffa3e66b504e0f126ba9a745006 ]
In commit 81eaadcae81b ("kgdboc: disable the console lock when in kgdb") we avoided the WARN_CONSOLE_UNLOCKED() yell when we were in kgdboc. That still works fine, but it turns out that we get a similar yell when using other I/O drivers. One example is the "I/O driver" for the kgdb test suite (kgdbts). When I enabled that I again got the same yells.
Even though "kgdbts" doesn't actually interact with the user over the console, using it still causes kgdb to print to the consoles. That trips the same warning:
con_is_visible+0x60/0x68 con_scroll+0x110/0x1b8 lf+0x4c/0xc8 vt_console_print+0x1b8/0x348 vkdb_printf+0x320/0x89c kdb_printf+0x68/0x90 kdb_main_loop+0x190/0x860 kdb_stub+0x2cc/0x3ec kgdb_cpu_enter+0x268/0x744 kgdb_handle_exception+0x1a4/0x200 kgdb_compiled_brk_fn+0x34/0x44 brk_handler+0x7c/0xb8 do_debug_exception+0x1b4/0x228
Let's increment/decrement the "ignore_console_lock_warning" variable all the time when we enter the debugger.
This will allow us to later revert commit 81eaadcae81b ("kgdboc:
disable the console lock when in kgdb").
--- kernel/debug/debug_core.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/debug/debug_core.c +4 -0
@@ -634,6 +634,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,if (kgdb_skipexception (ks->ex_vector, ks->linux_regs)) goto kgdb_restore; +atomic_inc (&ignore_console_lock_warning); +/* Call the I/O driver's pre_exception routine */ if (dbg_io_ops->pre_exception) dbg_io_ops->pre_exception ();
@@ -706,6 +708,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,if (dbg_io_ops->post_exception) dbg_io_ops->post_exception (); +atomic_dec (&ignore_console_lock_warning); +if (!kgdb_single_step) {raw_spin_unlock (&dbg_slave_lock);/* Wait till all the CPUs have quit from the debugger. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 40/175 kgdb: Prevent infinite recursive entries to the debugger
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 3ca676e4ca60d1834bb77535dafe24169cadacef ]
If we detect that we recursively entered the debugger we should hack our I/O ops to NULL so that the panic() in the next line won't actually cause another recursion into the debugger. The first line of kgdb_panic() will check this and return.
--- kernel/debug/debug_core.c | 1 + 1 file changed, 1 insertion(+)
kernel/debug/debug_core.c +1 -0
@@ -501,6 +501,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks)if (exception_level >1 ) {dump_stack (); + kgdb_io_module_registered = false;panic ("Recursive entry to debugger" ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 41/175 pmu/smmuv3: Clear IRQ affinity hint on device removal
In reply to Sasha LevinFrom: Jean-Philippe Brucker <[email protected]>
[ Upstream commit 10f6cd2af21bb44faab31a50ec3361d7649e5a39 ]
Currently when trying to remove the SMMUv3 PMU module we get a WARN_ON_ONCE from free_irq(), because the affinity hint set during probe hasn't been properly cleared.
[ 238.878383] WARNING: CPU: 0 PID: 175 at kernel/irq/manage.c:1744 free_irq+0x324/0x358 ... [ 238.897263] Call trace: [ 238.897998] free_irq+0x324/0x358 [ 238.898792] devm_irq_release+0x18/0x28 [ 238.899189] release_nodes+0x1b0/0x228 [ 238.899984] devres_release_all+0x38/0x60 [ 238.900779] device_release_driver_internal+0x10c/0x1d0 [ 238.901574] driver_detach+0x50/0xe0 [ 238.902368] bus_remove_driver+0x5c/0xd8 [ 238.903448] driver_unregister+0x30/0x60 [ 238.903958] platform_driver_unregister+0x14/0x20 [ 238.905075] arm_smmu_pmu_exit+0x1c/0xecc [arm_smmuv3_pmu] [ 238.905547] __arm64_sys_delete_module+0x14c/0x260 [ 238.906342] el0_svc_common.constprop.0+0x74/0x178 [ 238.907355] do_el0_svc+0x24/0x90 [ 238.907932] el0_sync_handler+0x11c/0x198 [ 238.908979] el0_sync+0x158/0x180
Just like the other perf drivers, clear the affinity hint before releasing the device.
--- drivers/perf/arm_smmuv3_pmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/perf/arm_smmuv3_pmu.c +4 -1
@@ -815,7 +815,7 @@ static int smmu_pmu_probe(struct platform_device *pdev)if (err) {dev_err (dev,"Error %d registering hotplug, PMU @%pa\n" , err, &res_0->start); -return err; + goto out_clear_affinity; } err =perf_pmu_register (&smmu_pmu->pmu, name,-1 );
@@ -834,6 +834,8 @@ static int smmu_pmu_probe(struct platform_device *pdev) out_unregister:cpuhp_state_remove_instance_nocalls (cpuhp_state_num, &smmu_pmu->node); +out_clear_affinity: +irq_set_affinity_hint (smmu_pmu->irq,NULL );return err; }
@@ -843,6 +845,7 @@ static int smmu_pmu_remove(struct platform_device *pdev)perf_pmu_unregister (&smmu_pmu->pmu);cpuhp_state_remove_instance_nocalls (cpuhp_state_num, &smmu_pmu->node); +irq_set_affinity_hint (smmu_pmu->irq,NULL );return 0 ; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 42/175 ACPI/IORT: Fix PMCG node single ID mapping handling
In reply to Sasha LevinFrom: Tuan Phan <[email protected]>
[ Upstream commit 50c8ab8d9fbf5b18d5162a797ca26568afc0af1a ]
An IORT PMCG node can have no ID mapping if its overflow interrupt is wire based therefore the code that parses the PMCG node can not assume the node will always have a single mapping present at index 0.
Fix iort_get_id_mapping_index() by checking for an overflow interrupt and mapping count.
--- drivers/acpi/arm64/iort.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/arm64/iort.c +5 -0
@@ -361,6 +361,7 @@ static struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node,static int iort_get_id_mapping_index (struct acpi_iort_node *node) {struct acpi_iort_smmu_v3 *smmu; +struct acpi_iort_pmcg *pmcg;switch (node->type) {case ACPI_IORT_NODE_SMMU_V3 :
@@ -388,6 +389,10 @@ static int iort_get_id_mapping_index(struct acpi_iort_node *node)return smmu->id_mapping_index;case ACPI_IORT_NODE_PMCG : + pmcg = (struct acpi_iort_pmcg *)node->node_data; +if (pmcg->overflow_gsiv || node->mapping_count ==0 ) +return -EINVAL ; +return 0 ;default :return -EINVAL ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 43/175 mips: Fix cpu_has_mips64r1/2 activation for MIPS32 CPUs
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit a2ac81c6ef4018ea49c034ce165bb9ea1cf99f3e ]
Commit 1aeba347b3a9 ("MIPS: Hardcode cpu_has_mips* where target ISA allows") updated the cpu_has_mips* macro to be replaced with a constant expression where it's possible. By mistake it wasn't done correctly for cpu_has_mips64r1/cpu_has_mips64r2 macro. They are defined to be replaced with conditional expression __isa_range_or_flag(), which means either ISA revision being within the range or the corresponding CPU options flag was set at the probe stage or both being true at the same time. But the ISA level value doesn't indicate whether the ISA is MIPS32 or MIPS64. Due to this if we select MIPS32r1 - MIPS32r5 architectures the __isa_range() macro will activate the cpu_has_mips64rX flags, which is incorrect. In order to fix the problem we make sure the 64bits CPU support is enabled by means of checking the flag cpu_has_64bits aside with proper ISA range and specific Revision flag being set.
--- arch/mips/include/asm/cpu-features.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/include/asm/cpu-features.h +4 -2
@@ -288,10 +288,12 @@# define cpu_has_mips32r6 __isa_ge_or_flag(6, MIPS_CPU_ISA_M32R6)#endif #ifndef cpu_has_mips64r1 -# define cpu_has_mips64r1 __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1) +# define cpu_has_mips64r1 (cpu_has_64bits && \ + __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1))#endif #ifndef cpu_has_mips64r2 -# define cpu_has_mips64r2 __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2) +# define cpu_has_mips64r2 (cpu_has_64bits && \ + __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2))#endif #ifndef cpu_has_mips64r6# define cpu_has_mips64r6 __isa_ge_and_flag(6, MIPS_CPU_ISA_M64R6)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 44/175 spi: dw: Enable interrupts in accordance with DMA xfer mode
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit 43dba9f3f98c2b184a19f856f06fe22817bfd9e0 ]
It's pointless to track the Tx overrun interrupts if Rx-only SPI transfer is issued. Similarly there is no need in handling the Rx overrun/underrun interrupts if Tx-only SPI transfer is executed. So lets unmask the interrupts only if corresponding SPI transactions are implied.
--- drivers/spi/spi-dw-mid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/spi/spi-dw-mid.c +8 -4
@@ -220,19 +220,23 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,static int mid_spi_dma_setup (struct dw_spi *dws,struct spi_transfer *xfer) { -u16 dma_ctrl =0 ; +u16 imr =0 , dma_ctrl =0 ;dw_writel (dws,DW_SPI_DMARDLR ,0xf );dw_writel (dws,DW_SPI_DMATDLR ,0x10 ); -if (xfer->tx_buf) +if (xfer->tx_buf) { dma_ctrl |=SPI_DMA_TDMAE ; -if (xfer->rx_buf) + imr |=SPI_INT_TXOI ; + } +if (xfer->rx_buf) { dma_ctrl |=SPI_DMA_RDMAE ; + imr |=SPI_INT_RXUI |SPI_INT_RXOI ; + }dw_writel (dws,DW_SPI_DMACR , dma_ctrl);/* Set the interrupt mask */ -spi_umask_intr (dws,SPI_INT_TXOI |SPI_INT_RXUI |SPI_INT_RXOI ); +spi_umask_intr (dws, imr); dws->transfer_handler = dma_transfer;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 45/175 clocksource: dw_apb_timer: Make CPU-affiliation being optional
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit cee43dbf2ee3f430434e2b66994eff8a1aeda889 ]
Currently the DW APB Timer driver binds each clockevent timers to a particular CPU. This isn't good for multiple reasons. First of all seeing the device is placed on APB bus (which makes it accessible from any CPU core), accessible over MMIO and having the DYNIRQ flag set we can be sure that manually binding the timer to any CPU just isn't correct. By doing so we just set an extra limitation on device usage. This also doesn't reflect the device actual capability, since by setting the IRQ affinity we can make it virtually local to any CPU. Secondly imagine if you had a real CPU-local timer with the same rating and the same CPU-affinity. In this case if DW APB timer was registered first, then due to the clockevent framework tick-timer selection procedure we'll end up with the real CPU-local timer being left unselected for clock-events tracking. But on most of the platforms (MIPS/ARM/etc) such timers are normally embedded into the CPU core and are accessible with much better performance then devices placed on APB. For instance in MIPS architectures there is r4k-timer, which is CPU-local, assigned with the same rating, and normally its clockevent device is registered after the platform-specific one.
So in order to fix all of these issues let's make the DW APB Timer CPU affinity being optional and deactivated by passing a negative CPU id, which will effectively set the DW APB clockevent timer cpumask to 'cpu_possible_mask'.
--- drivers/clocksource/dw_apb_timer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/dw_apb_timer.c +3 -2
@@ -222,7 +222,8 @@ static int apbt_next_event(unsigned long delta,/** * dw_apb_clockevent_init() - use an APB timer as a clock_event_device * -* @cpu: The CPU the events will be targeted at. +* @cpu: The CPU the events will be targeted at or -1 if CPU affiliation +* isn't required. * @name: The name used for the timer and the IRQ for it. * @rating: The rating to give the timer. * @base: I/O base for the timer registers.
@@ -257,7 +258,7 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating, dw_ced->ced.max_delta_ticks =0x7fffffff ; dw_ced->ced.min_delta_ns =clockevent_delta2ns (5000 , &dw_ced->ced); dw_ced->ced.min_delta_ticks =5000 ; - dw_ced->ced.cpumask =cpumask_of (cpu); + dw_ced->ced.cpumask = cpu <0 ? cpu_possible_mask :cpumask_of (cpu); dw_ced->ced.features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT |CLOCK_EVT_FEAT_DYNIRQ ; dw_ced->ced.set_state_shutdown = apbt_shutdown;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 46/175 clocksource: dw_apb_timer_of: Fix missing clockevent timers
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit 6d2e16a3181bafb77b535095c39ad1c8b9558c8c ]
Commit 100214889973 ("clocksource: dw_apb_timer_of: use clocksource_of_init") replaced a publicly available driver initialization method with one called by the timer_probe() method available after CLKSRC_OF. In current implementation it traverses all the timers available in the system and calls their initialization methods if corresponding devices were either in dtb or in acpi. But if before the commit any number of available timers would be installed as clockevent and clocksource devices, after that there would be at most two. The rest are just ignored since default case branch doesn't do anything. I don't see a reason of such behaviour, neither the commit message explains it. Moreover this might be wrong if on some platforms these timers might be used for different purpose, as virtually CPU-local clockevent timers and as an independent broadcast timer. So in order to keep the compatibility with the platforms where the order of the timers detection has some meaning, lets add the secondly discovered timer to be of clocksource/sched_clock type, while the very first and the others would provide the clockevents service.
--- drivers/clocksource/dw_apb_timer_of.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clocksource/dw_apb_timer_of.c +2 -4
@@ -147,10 +147,6 @@ static int num_called;static int __init dw_apb_timer_init (struct device_node *timer) {switch (num_called) { -case 0 : -pr_debug ("%s: found clockevent timer\n" , __func__); -add_clockevent (timer); -break ;case 1 :pr_debug ("%s: found clocksource timer\n" , __func__);add_clocksource (timer);
@@ -161,6 +157,8 @@ static int __init dw_apb_timer_init(struct device_node *timer)#endif break ;default : +pr_debug ("%s: found clockevent timer\n" , __func__); +add_clockevent (timer);break ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 47/175 media: dvbdev: Fix tuner->demod media controller link
In reply to Sasha LevinFrom: Brad Love <[email protected]>
[ Upstream commit 9f984cacf4f4d53fd8a3f44d7f13528b81c1f6a8 ]
Fixes bug exposed by:
[a3fbc2e6bb0: media: mc-entity.c: use WARN_ON, validate link pads]
The dvbdev incorrectly requests a tuner sink pad to connect to a demux sink pad. The media controller failure percolates back and the dvb device creation fails. Fix this by requesting a tuner source pad. Instead of forcing that pad to be index zero, check if a negative integer error is returned. A note is added that first source pad found is chosen.
Affected bridges cx231xx and em28xx printed the below warning[s] when a variety of media controller dvb enabled devices were connected. The warning returns an error causing all affected devices to fail DVB device creation.
[ 253.138332] ------------[ cut here ]------------ [ 253.138339] WARNING: CPU: 0 PID: 1550 at drivers/media/mc/mc-entity.c:669 media_create_pad_link+0x1e0/0x200 [mc] [ 253.138339] Modules linked in: si2168 em28xx_dvb(+) em28xx si2157 lgdt3306a cx231xx_dvb dvb_core cx231xx_alsa cx25840 cx231xx tveeprom cx2341x i2c_mux videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc ir_rc5_decoder rc_hauppauge mceusb rc_core eda c_mce_amd kvm nls_iso8859_1 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper efi_pstore wmi_bmof k10temp asix usbnet mii nouveau snd_hda_codec_realtek snd_hda_codec_generic input_leds ledtrig_audio snd_hda_codec_hdmi mxm_wmi snd_hda_in tel video snd_intel_dspcfg ttm snd_hda_codec drm_kms_helper snd_hda_core drm snd_hwdep snd_seq_midi snd_seq_midi_event i2c_algo_bit snd_pcm snd_rawmidi fb_sys_fops snd_seq syscopyarea sysfillrect snd_seq_device sysimgblt snd_timer snd soundcore ccp mac_hid sch_fq_codel parport_p c ppdev lp parport ip_tables x_tables autofs4 vfio_pci irqbypass vfio_virqfd vfio_iommu_type1 vfio hid_generic usbhid hid i2c_piix4 ahci libahci wmi gpio_amdpt [ 253.138370] gpio_generic [ 253.138372] CPU: 0 PID: 1550 Comm: modprobe Tainted: G W 5.7.0-rc2+ #181 [ 253.138373] Hardware name: MSI MS-7A39/B350M GAMING PRO (MS-7A39), BIOS 2.G0 04/27/2018 [ 253.138376] RIP: 0010:media_create_pad_link+0x1e0/0x200 [mc] [ 253.138378] Code: 26 fd ff ff 44 8b 4d d0 eb d9 0f 0b 41 b9 ea ff ff ff 44 89 c8 c3 0f 0b 41 b9 ea ff ff ff eb f2 0f 0b 41 b9 ea ff ff ff eb e8 <0f> 0b 41 b9 ea ff ff ff eb af 0f 0b 41 b9 ea ff ff ff eb a5 66 90 [ 253.138379] RSP: 0018:ffffb9ecc0ee7a78 EFLAGS: 00010246 [ 253.138380] RAX: ffff943f706c99d8 RBX: 0000000000000000 RCX: 0000000000000000 [ 253.138381] RDX: ffff943f613e0180 RSI: 0000000000000000 RDI: ffff943f706c9958 [ 253.138381] RBP: ffffb9ecc0ee7ab0 R08: 0000000000000001 R09: ffff943f613e0180 [ 253.138382] R10: ffff943f613e0180 R11: ffff943f706c9400 R12: 0000000000000000 [ 253.138383] R13: 0000000000000001 R14: ffff943f706c9958 R15: 0000000000000001 [ 253.138384] FS: 00007f3cd29ba540(0000) GS:ffff943f8ec00000(0000) knlGS:0000000000000000 [ 253.138385] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 253.138385] CR2: 000055f7de0ca830 CR3: 00000003dd208000 CR4: 00000000003406f0 [ 253.138386] Call Trace: [ 253.138392] media_create_pad_links+0x104/0x1b0 [mc] [ 253.138397] dvb_create_media_graph+0x350/0x5f0 [dvb_core] [ 253.138402] em28xx_dvb_init+0x5ea/0x2600 [em28xx_dvb] [ 253.138408] em28xx_register_extension+0x63/0xc0 [em28xx] [ 253.138410] ? 0xffffffffc039c000 [ 253.138412] em28xx_dvb_register+0x15/0x1000 [em28xx_dvb] [ 253.138416] do_one_initcall+0x71/0x250 [ 253.138418] ? do_init_module+0x27/0x22e [ 253.138421] ? _cond_resched+0x1a/0x50 [ 253.138423] ? kmem_cache_alloc_trace+0x1ec/0x270 [ 253.138425] ? __vunmap+0x1e3/0x240 [ 253.138427] do_init_module+0x5f/0x22e [ 253.138430] load_module+0x2525/0x2d40 [ 253.138436] __do_sys_finit_module+0xe5/0x120 [ 253.138438] ? __do_sys_finit_module+0xe5/0x120 [ 253.138442] __x64_sys_finit_module+0x1a/0x20 [ 253.138443] do_syscall_64+0x57/0x1b0 [ 253.138445] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 253.138446] RIP: 0033:0x7f3cd24dc839 [ 253.138448] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 [ 253.138449] RSP: 002b:00007ffe4fc514d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 253.138450] RAX: ffffffffffffffda RBX: 000055a9237f63f0 RCX: 00007f3cd24dc839 [ 253.138451] RDX: 0000000000000000 RSI: 000055a922c3ad2e RDI: 0000000000000000 [ 253.138451] RBP: 000055a922c3ad2e R08: 0000000000000000 R09: 0000000000000000 [ 253.138452] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 253.138453] R13: 000055a9237f5550 R14: 0000000000040000 R15: 000055a9237f63f0 [ 253.138456] ---[ end trace a60f19c54aa96ec4 ]---
[ 234.915628] ------------[ cut here ]------------ [ 234.915640] WARNING: CPU: 0 PID: 1502 at drivers/media/mc/mc-entity.c:669 media_create_pad_link+0x1e0/0x200 [mc] [ 234.915641] Modules linked in: si2157 lgdt3306a cx231xx_dvb(+) dvb_core cx231xx_alsa cx25840 cx231xx tveeprom cx2341x i2c_mux videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc ir_rc5_decoder rc_hauppauge mceusb rc_core edac_mce_amd kvm nls_iso8859 _1 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper efi_pstore wmi_bmof k10temp asix usbnet mii nouveau snd_hda_codec_realtek snd_hda_codec_generic input_leds ledtrig_audio snd_hda_codec_hdmi mxm_wmi snd_hda_intel video snd_intel_dspcf g ttm snd_hda_codec drm_kms_helper snd_hda_core drm snd_hwdep snd_seq_midi snd_seq_midi_event i2c_algo_bit snd_pcm snd_rawmidi fb_sys_fops snd_seq syscopyarea sysfillrect snd_seq_device sysimgblt snd_timer snd soundcore ccp mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tab les x_tables autofs4 vfio_pci irqbypass vfio_virqfd vfio_iommu_type1 vfio hid_generic usbhid hid i2c_piix4 ahci libahci wmi gpio_amdpt gpio_generic [ 234.915700] CPU: 0 PID: 1502 Comm: modprobe Not tainted 5.7.0-rc2+ #181 [ 234.915702] Hardware name: MSI MS-7A39/B350M GAMING PRO (MS-7A39), BIOS 2.G0 04/27/2018 [ 234.915709] RIP: 0010:media_create_pad_link+0x1e0/0x200 [mc] [ 234.915712] Code: 26 fd ff ff 44 8b 4d d0 eb d9 0f 0b 41 b9 ea ff ff ff 44 89 c8 c3 0f 0b 41 b9 ea ff ff ff eb f2 0f 0b 41 b9 ea ff ff ff eb e8 <0f> 0b 41 b9 ea ff ff ff eb af 0f 0b 41 b9 ea ff ff ff eb a5 66 90 [ 234.915714] RSP: 0018:ffffb9ecc1b6fa50 EFLAGS: 00010246 [ 234.915717] RAX: ffff943f8c94a9d8 RBX: 0000000000000000 RCX: 0000000000000000 [ 234.915719] RDX: ffff943f613e0900 RSI: 0000000000000000 RDI: ffff943f8c94a958 [ 234.915721] RBP: ffffb9ecc1b6fa88 R08: 0000000000000001 R09: ffff943f613e0900 [ 234.915723] R10: ffff943f613e0900 R11: ffff943f6b590c00 R12: 0000000000000000 [ 234.915724] R13: 0000000000000001 R14: ffff943f8c94a958 R15: 0000000000000001 [ 234.915727] FS: 00007f4ca3646540(0000) GS:ffff943f8ec00000(0000) knlGS:0000000000000000 [ 234.915729] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 234.915731] CR2: 00007fff7a53ba18 CR3: 00000003da614000 CR4: 00000000003406f0 [ 234.915733] Call Trace: [ 234.915745] media_create_pad_links+0x104/0x1b0 [mc] [ 234.915756] dvb_create_media_graph+0x350/0x5f0 [dvb_core] [ 234.915766] dvb_init.part.4+0x691/0x1360 [cx231xx_dvb] [ 234.915780] dvb_init+0x1a/0x20 [cx231xx_dvb] [ 234.915787] cx231xx_register_extension+0x71/0xa0 [cx231xx] [ 234.915791] ? 0xffffffffc042f000 [ 234.915796] cx231xx_dvb_register+0x15/0x1000 [cx231xx_dvb] [ 234.915802] do_one_initcall+0x71/0x250 [ 234.915807] ? do_init_module+0x27/0x22e [ 234.915811] ? _cond_resched+0x1a/0x50 [ 234.915816] ? kmem_cache_alloc_trace+0x1ec/0x270 [ 234.915820] ? __vunmap+0x1e3/0x240 [ 234.915826] do_init_module+0x5f/0x22e [ 234.915831] load_module+0x2525/0x2d40 [ 234.915848] __do_sys_finit_module+0xe5/0x120 [ 234.915850] ? __do_sys_finit_module+0xe5/0x120 [ 234.915862] __x64_sys_finit_module+0x1a/0x20 [ 234.915865] do_syscall_64+0x57/0x1b0 [ 234.915870] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 234.915872] RIP: 0033:0x7f4ca3168839 [ 234.915876] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 [ 234.915878] RSP: 002b:00007ffcea3db3b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 234.915881] RAX: ffffffffffffffda RBX: 000055af22c29340 RCX: 00007f4ca3168839 [ 234.915882] RDX: 0000000000000000 RSI: 000055af22c38390 RDI: 0000000000000001 [ 234.915884] RBP: 000055af22c38390 R08: 0000000000000000 R09: 0000000000000000 [ 234.915885] R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000000 [ 234.915887] R13: 000055af22c29060 R14: 0000000000040000 R15: 0000000000000000 [ 234.915896] ---[ end trace a60f19c54aa96ec3 ]---
--- drivers/media/dvb-core/dvbdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/dvb-core/dvbdev.c +3 -2
@@ -707,9 +707,10 @@ int dvb_create_media_graph(struct dvb_adapter *adap, }if (ntuner && ndemod) { - pad_source =media_get_pad_index (tuner, true, +/* NOTE: first found tuner source pad presumed correct */ + pad_source =media_get_pad_index (tuner, false,PAD_SIGNAL_ANALOG ); -if (pad_source) +if (pad_source <0 )return -EINVAL ; ret = media_create_pad_links(mdev, MEDIA_ENT_F_TUNER,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 48/175 btrfs: account for trans_block_rsv in may_commit_transaction
In reply to Sasha LevinFrom: Josef Bacik <[email protected]>
[ Upstream commit bb4f58a747f0421b10645fbf75a6acc88da0de50 ]
On ppc64le with 64k page size (respectively 64k block size) generic/320 was failing and debug output showed we were getting a premature ENOSPC with a bunch of space in btrfs_fs_info::trans_block_rsv.
This meant there were still open transaction handles holding space, yet the flusher didn't commit the transaction because it deemed the freed space won't be enough to satisfy the current reserve ticket. Fix this by accounting for space in trans_block_rsv when deciding whether the current transaction should be committed or not.
--- fs/btrfs/space-info.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/space-info.c +6 -0
@@ -462,6 +462,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,struct reserve_ticket *ticket =NULL ;struct btrfs_block_rsv *delayed_rsv = &fs_info->delayed_block_rsv;struct btrfs_block_rsv *delayed_refs_rsv = &fs_info->delayed_refs_rsv; +struct btrfs_block_rsv *trans_rsv = &fs_info->trans_block_rsv;struct btrfs_trans_handle *trans;u64 bytes_needed;u64 reclaim_bytes =0 ;
@@ -524,6 +525,11 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,spin_lock (&delayed_refs_rsv->lock); reclaim_bytes += delayed_refs_rsv->reserved;spin_unlock (&delayed_refs_rsv->lock); + +spin_lock (&trans_rsv->lock); + reclaim_bytes += trans_rsv->reserved; +spin_unlock (&trans_rsv->lock); +if (reclaim_bytes >= bytes_needed) goto commit; bytes_needed -= reclaim_bytes;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 49/175 btrfs: do not ignore error from btrfs_next_leaf() when inserting checksums
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit 7e4a3f7ed5d54926ec671bbb13e171cfe179cc50 ]
We are currently treating any non-zero return value from btrfs_next_leaf() the same way, by going to the code that inserts a new checksum item in the tree. However if btrfs_next_leaf() returns an error (a value < 0), we should just stop and return the error, and not behave as if nothing has happened, since in that case we do not have a way to know if there is a next leaf or we are currently at the last leaf already.
So fix that by returning the error from btrfs_next_leaf().
--- fs/btrfs/file-item.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/file-item.c +4 -2
@@ -798,10 +798,12 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, nritems =btrfs_header_nritems (path->nodes[0 ]);if (!nritems || (path->slots[0 ] >= nritems -1 )) { ret =btrfs_next_leaf (root, path); -if (ret ==1 ) +if (ret <0 ) { + goto out; + }else if (ret >0 ) { found_next =1 ; -if (ret !=0 ) goto insert; + } slot = path->slots[0 ]; }btrfs_item_key_to_cpu (path->nodes[0 ], &found_key, slot);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 50/175 ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit e1de94380af588bdf6ad6f0cc1f75004c35bc096 ]
Recent work with KASan exposed the folling hard-coded bitmask in arch/arm/mm/proc-macros.S:
bic rd, sp, #8128
bic rd, rd, #63
This forms the bitmask 0x1FFF that is coinciding with (PAGE_SIZE << THREAD_SIZE_ORDER) - 1, this code was assuming that THREAD_SIZE is always 8K (8192).
As KASan was increasing THREAD_SIZE_ORDER to 2, I ran into this bug.
Fix it by this little oneline suggested by Ard:
bic rd, sp, #(THREAD_SIZE - 1) & ~63
Where THREAD_SIZE is defined using THREAD_SIZE_ORDER.
We have to also include <linux/const.h> since the THREAD_SIZE expands to use the _AC() macro.
--- arch/arm/mm/proc-macros.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mm/proc-macros.S +2 -1
@@ -5,6 +5,7 @@ * VMA_VM_FLAGS * VM_EXEC */ +#include <linux/const.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h>
@@ -30,7 +31,7 @@ * act_mm - get current->active_mm */ .macro act_mm, rd - bic \rd, sp, #8128 + bic \rd, sp, #(THREAD_SIZE - 1) & ~63 bic \rd, \rd, #63 ldr \rd, [\rd, #TI_TASK] .if (TSK_ACTIVE_MM > IMM12_MASK)
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 51/175 batman-adv: Revert "disable ethtool link speed detection when auto negotiation off"
In reply to Sasha LevinFrom: Sven Eckelmann <[email protected]>
[ Upstream commit 9ad346c90509ebd983f60da7d082f261ad329507 ]
The commit 8c46fcd78308 ("batman-adv: disable ethtool link speed detection when auto negotiation off") disabled the usage of ethtool's link_ksetting when auto negotation was enabled due to invalid values when used with tun/tap virtual net_devices. According to the patch, automatic measurements should be used for these kind of interfaces.
But there are major flaws with this argumentation:
* automatic measurements are not implemented
* auto negotiation has nothing to do with the validity of the retrieved values
The first point has to be fixed by a longer patch series. The "validity" part of the second point must be addressed in the same patch series by dropping the usage of ethtool's link_ksetting (thus always doing automatic measurements over ethernet).
Drop the patch again to have more default values for various net_device types/configurations. The user can still overwrite them using the batadv_hardif's BATADV_ATTR_THROUGHPUT_OVERRIDE.
--- net/batman-adv/bat_v_elp.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
net/batman-adv/bat_v_elp.c +1 -14
@@ -120,20 +120,7 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)rtnl_lock (); ret =__ethtool_get_link_ksettings (hard_iface->net_dev, &link_settings);rtnl_unlock (); - -/* Virtual interface drivers such as tun / tap interfaces, VLAN, etc -* tend to initialize the interface throughput with some value for the -* sake of having a throughput number to export via ethtool. This -* exported throughput leaves batman-adv to conclude the interface -* throughput is genuine (reflecting reality), thus no measurements -* are necessary. -* -* Based on the observation that those interface types also tend to set -* the link auto-negotiation to 'off', batman-adv shall check this -* setting to differentiate between genuine link throughput information -* and placeholders installed by virtual interfaces. -*/ -if (ret ==0 && link_settings.base.autoneg ==AUTONEG_ENABLE ) { +if (ret ==0 ) {/* link characteristics might change over time */ if (link_settings.base.duplex ==DUPLEX_FULL ) hard_iface->bat_v.flags |=BATADV_FULL_DUPLEX ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 52/175 ice: Fix memory leak
In reply to Sasha LevinFrom: Surabhi Boob <[email protected]>
[ Upstream commit 1aaef2bc4e0a5ce9e4dd86359e6a0bf52c6aa64f ]
Handle memory leak on filter management initialization failure.
--- drivers/net/ethernet/intel/ice/ice_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +7 -1
@@ -436,6 +436,7 @@ static void ice_init_flex_flds(struct ice_hw *hw, enum ice_rxdid prof_id)static enum ice_status ice_init_fltr_mgmt_struct (struct ice_hw *hw) {struct ice_switch_info *sw; +enum ice_status status; hw->switch_info =devm_kzalloc (ice_hw_to_dev (hw),sizeof (*hw->switch_info),GFP_KERNEL );
@@ -446,7 +447,12 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)INIT_LIST_HEAD (&sw->vsi_list_map_head); -return ice_init_def_sw_recp (hw); + status =ice_init_def_sw_recp (hw); +if (status) { +devm_kfree (ice_hw_to_dev (hw), hw->switch_info); +return status; + } +return 0 ; }/**
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 53/175 ice: Fix for memory leaks and modify ICE_FREE_CQ_BUFS
In reply to Sasha LevinFrom: Surabhi Boob <[email protected]>
[ Upstream commit 68d270783742783f96e89ef92ac24ab3c7fb1d31 ]
Handle memory leaks during control queue initialization and buffer allocation failures. The macro ICE_FREE_CQ_BUFS is modified to re-use for this fix.
--- drivers/net/ethernet/intel/ice/ice_controlq.c | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/ice/ice_controlq.c +28 -21
@@ -199,7 +199,9 @@ ice_alloc_rq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq) cq->rq.r.rq_bi[i].pa =0 ; cq->rq.r.rq_bi[i].size =0 ; } + cq->rq.r.rq_bi =NULL ;devm_kfree (ice_hw_to_dev (hw), cq->rq.dma_head); + cq->rq.dma_head =NULL ;return ICE_ERR_NO_MEMORY ; }
@@ -245,7 +247,9 @@ ice_alloc_sq_bufs(struct ice_hw *hw, struct ice_ctl_q_info *cq) cq->sq.r.sq_bi[i].pa =0 ; cq->sq.r.sq_bi[i].size =0 ; } + cq->sq.r.sq_bi =NULL ;devm_kfree (ice_hw_to_dev (hw), cq->sq.dma_head); + cq->sq.dma_head =NULL ;return ICE_ERR_NO_MEMORY ; }
@@ -304,6 +308,28 @@ ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)return 0 ; } +#define ICE_FREE_CQ_BUFS(hw, qi, ring) \ +do { \ + int i; \ + /* free descriptors */ \ + if ((qi)->ring.r.ring##_bi) \ + for (i = 0; i < (qi)->num_##ring##_entries; i++) \ + if ((qi)->ring.r.ring##_bi[i].pa) { \ + dmam_free_coherent(ice_hw_to_dev(hw), \ + (qi)->ring.r.ring##_bi[i].size, \ + (qi)->ring.r.ring##_bi[i].va, \ + (qi)->ring.r.ring##_bi[i].pa); \ + (qi)->ring.r.ring##_bi[i].va = NULL;\ + (qi)->ring.r.ring##_bi[i].pa = 0;\ + (qi)->ring.r.ring##_bi[i].size = 0;\ + } \ +/* free the buffer info list */ \ +if ((qi)->ring.cmd_buf) \ +devm_kfree (ice_hw_to_dev (hw), (qi)->ring.cmd_buf); \ +/* free DMA head */ \ +devm_kfree (ice_hw_to_dev (hw), (qi)->ring.dma_head); \ +}while (0 ) +/** * ice_init_sq - main initialization routine for Control ATQ * @hw: pointer to the hardware structure
@@ -357,6 +383,7 @@ static enum ice_status ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq) goto init_ctrlq_exit; init_ctrlq_free_rings: +ICE_FREE_CQ_BUFS (hw, cq, sq);ice_free_cq_ring (hw, &cq->sq); init_ctrlq_exit:
@@ -416,33 +443,13 @@ static enum ice_status ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq) goto init_ctrlq_exit; init_ctrlq_free_rings: +ICE_FREE_CQ_BUFS (hw, cq, rq);ice_free_cq_ring (hw, &cq->rq); init_ctrlq_exit:return ret_code; } -#define ICE_FREE_CQ_BUFS(hw, qi, ring) \ -do { \ - int i; \ - /* free descriptors */ \ - for (i = 0; i < (qi)->num_##ring##_entries; i++) \ - if ((qi)->ring.r.ring##_bi[i].pa) { \ - dmam_free_coherent(ice_hw_to_dev(hw), \ - (qi)->ring.r.ring##_bi[i].size,\ - (qi)->ring.r.ring##_bi[i].va,\ - (qi)->ring.r.ring##_bi[i].pa);\ - (qi)->ring.r.ring##_bi[i].va = NULL; \ - (qi)->ring.r.ring##_bi[i].pa = 0; \ - (qi)->ring.r.ring##_bi[i].size = 0; \ - } \ -/* free the buffer info list */ \ -if ((qi)->ring.cmd_buf) \ -devm_kfree (ice_hw_to_dev (hw), (qi)->ring.cmd_buf); \ -/* free DMA head */ \ -devm_kfree (ice_hw_to_dev (hw), (qi)->ring.dma_head); \ -}while (0 ) -/** * ice_shutdown_sq - shutdown the Control ATQ * @hw: pointer to the hardware structure
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 54/175 mmc: meson-mx-sdio: trigger a soft reset after a timeout or CRC error
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 91995b904ec2e44b5c159ac6a5d3f154345a4de7 ]
The vendor driver (from the 3.10 kernel) triggers a soft reset every time before starting a new command. While this fixes a problem where SDIO cards are not detected at all (because all commands simply timed out) this hurts SD card read performance a bit (in my tests between 10% to 20%).
Trigger a soft reset after we got a CRC error or if the previous command timed out (just like the vendor driver from the same 3.10 kernel for the newer SDHC controller IP does). This fixes detection of SDIO cards and doesn't hurt SD card read performance at the same time.
With this patch the initialization of an RTL8723BS SDIO card looks like this:
req done (CMD52): -110: 00000000 00000000 00000000 00000000 clock 400000Hz busmode 2 powermode 2 cs 1 Vdd 21 width 1 timing 0 starting CMD0 arg 00000000 flags 000000c0
req done (CMD0): 0: 00000000 00000000 00000000 00000000 clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0 starting CMD8 arg 000001aa flags 000002f5
req done (CMD8): -110: 00000000 00000000 00000000 00000000 starting CMD5 arg 00000000 flags 000002e1
req done (CMD5): 0: 90ff0000 00000000 00000000 00000000 starting CMD5 arg 00200000 flags 000002e1
req done (CMD5): 0: 90ff0000 00000000 00000000 00000000 starting CMD3 arg 00000000 flags 00000075
req done (CMD3): 0: 00010000 00000000 00000000 00000000 starting CMD7 arg 00010000 flags 00000015
req done (CMD7): 0: 00001e00 00000000 00000000 00000000 starting CMD52 arg 00000000 flags 00000195
req done (CMD52): 0: 00001032 00000000 00000000 00000000 [... more CMD52 omitted ...]
clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 2 clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 2 starting CMD52 arg 00000e00 flags 00000195
req done (CMD52): 0: 00001000 00000000 00000000 00000000 starting CMD52 arg 80000e02 flags 00000195
req done (CMD52): 0: 00001002 00000000 00000000 00000000 clock 50000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 4 timing 2 starting CMD52 arg 00020000 flags 00000195
req done (CMD52): 0: 00001007 00000000 00000000 00000000 [... more CMD52 omitted ...]
new high speed SDIO card at address 0001
--- drivers/mmc/host/meson-mx-sdio.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/meson-mx-sdio.c +3 -0
@@ -246,6 +246,9 @@ static void meson_mx_mmc_request_done(struct meson_mx_mmc_host *host) mrq = host->mrq; +if (host->cmd->error) +meson_mx_mmc_soft_reset (host); + host->mrq =NULL ; host->cmd =NULL ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 55/175 Bluetooth: btmtkuart: Improve exception handling in btmtuart_probe()
In reply to Sasha LevinFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 4803c54ca24923a30664bea2a7772db6e7303c51 ]
Calls of the functions clk_disable_unprepare() and hci_free_dev() were missing for the exception handling.
Thus add the missed function calls together with corresponding jump targets.
--- drivers/bluetooth/btmtkuart.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/bluetooth/btmtkuart.c +8 -6
@@ -1015,7 +1015,7 @@ static int btmtkuart_probe(struct serdev_device *serdev)if (btmtkuart_is_standalone (bdev)) { err =clk_prepare_enable (bdev->osc);if (err <0 ) -return err; + goto err_hci_free_dev;if (bdev->boot) {gpiod_set_value_cansleep (bdev->boot,1 );
@@ -1028,10 +1028,8 @@ static int btmtkuart_probe(struct serdev_device *serdev)/* Power on */ err =regulator_enable (bdev->vcc); -if (err <0 ) { -clk_disable_unprepare (bdev->osc); -return err; - } +if (err <0 ) + goto err_clk_disable_unprepare;/* Reset if the reset-gpios is available otherwise the board * -level design should be guaranteed.
@@ -1063,7 +1061,6 @@ static int btmtkuart_probe(struct serdev_device *serdev) err =hci_register_dev (hdev);if (err <0 ) {dev_err (&serdev->dev,"Can't register HCI device\n" ); -hci_free_dev (hdev); goto err_regulator_disable; }
@@ -1072,6 +1069,11 @@ static int btmtkuart_probe(struct serdev_device *serdev) err_regulator_disable:if (btmtkuart_is_standalone (bdev))regulator_disable (bdev->vcc); +err_clk_disable_unprepare: +if (btmtkuart_is_standalone (bdev)) +clk_disable_unprepare (bdev->osc); +err_hci_free_dev: +hci_free_dev (hdev);return err; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 56/175 spi: dw: Fix Rx-only DMA transfers
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit 46164fde6b7890e7a3982d54549947c8394c0192 ]
Tx-only DMA transfers are working perfectly fine since in this case the code just ignores the Rx FIFO overflow interrupts. But it turns out the SPI Rx-only transfers are broken since nothing pushing any data to the shift registers, so the Rx FIFO is left empty and the SPI core subsystems just returns a timeout error. Since DW DMAC driver doesn't support something like cyclic write operations of a single byte to a device register, the only way to support the Rx-only SPI transfers is to fake it by using a dummy Tx-buffer. This is what we intend to fix in this commit by setting the SPI_CONTROLLER_MUST_TX flag for DMA-capable platform.
--- drivers/spi/spi-dw.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw.c +1 -0
@@ -518,6 +518,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) dws->dma_inited =0 ; }else { master->can_dma = dws->dma_ops->can_dma; + master->flags |=SPI_CONTROLLER_MUST_TX ; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 57/175 x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit
In reply to Sasha LevinFrom: Jon Doron <[email protected]>
[ Upstream commit f7d31e65368aeef973fab788aa22c4f1d5a6af66 ]
The problem the patch is trying to address is the fact that 'struct kvm_hyperv_exit' has different layout on when compiling in 32 and 64 bit modes.
In 64-bit mode the default alignment boundary is 64 bits thus forcing extra gaps after 'type' and 'msr' but in 32-bit mode the boundary is at 32 bits thus no extra gaps.
This is an issue as even when the kernel is 64 bit, the userspace using the interface can be both 32 and 64 bit but the same 32 bit userspace has to work with 32 bit kernel.
The issue is fixed by forcing the 64 bit layout, this leads to ABI change for 32 bit builds and while we are obviously breaking '32 bit userspace with 32 bit kernel' case, we're fixing the '32 bit userspace with 64 bit kernel' one.
As the interface has no (known) users and 32 bit KVM is rather baroque nowadays, this seems like a reasonable decision.
Message-Id: <[email protected]>
--- Documentation/virt/kvm/api.txt | 2 ++ include/uapi/linux/kvm.h | 2 ++ 2 files changed, 4 insertions(+)
Documentation/virt/kvm/api.txt +2 -0
@@ -4444,9 +4444,11 @@ EOI was received. #define KVM_EXIT_HYPERV_SYNIC 1 #define KVM_EXIT_HYPERV_HCALL 2 __u32 type; + __u32 pad1; union { struct { __u32 msr; + __u32 pad2; __u64 control; __u64 evt_page; __u64 msg_page;
include/uapi/linux/kvm.h +2 -0
@@ -189,9 +189,11 @@ struct kvm_hyperv_exit {#define KVM_EXIT_HYPERV_SYNIC 1#define KVM_EXIT_HYPERV_HCALL 2__u32 type; +__u32 pad1;union {struct {__u32 msr; +__u32 pad2;__u64 control;__u64 evt_page;__u64 msg_page;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 58/175 net: vmxnet3: fix possible buffer overflow caused by bad DMA value in vmxnet3_get_rss()
In reply to Sasha LevinFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 3e1c6846b9e108740ef8a37be80314053f5dd52a ]
The value adapter->rss_conf is stored in DMA memory, and it is assigned to rssConf, so rssConf->indTableSize can be modified at anytime by malicious hardware. Because rssConf->indTableSize is assigned to n, buffer overflow may occur when the code "rssConf->indTable[n]" is executed.
To fix this possible bug, n is checked after being used.
--- drivers/net/vmxnet3/vmxnet3_ethtool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vmxnet3/vmxnet3_ethtool.c +2 -0
@@ -702,6 +702,8 @@ vmxnet3_get_rss(struct net_device *netdev, u32 *p, u8 *key, u8 *hfunc) *hfunc =ETH_RSS_HASH_TOP ;if (!p)return 0 ; +if (n >UPT1_RSS_MAX_IND_TABLE_SIZE ) +return 0 ;while (n--) p[n] = rssConf->indTable[n];return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 59/175 tun: correct header offsets in napi frags mode
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit 96aa1b22bd6bb9fccf62f6261f390ed6f3e7967f ]
Tun in IFF_NAPI_FRAGS mode calls napi_gro_frags. Unlike netif_rx and netif_gro_receive, this expects skb->data to point to the mac layer.
But skb_probe_transport_header, __skb_get_hash_symmetric, and xdp_do_generic in tun_get_user need skb->data to point to the network header. Flow dissection also needs skb->protocol set, so eth_type_trans has to be called.
Ensure the link layer header lies in linear as eth_type_trans pulls ETH_HLEN. Then take the same code paths for frags as for not frags. Push the link layer header back just before calling napi_gro_frags.
By pulling up to ETH_HLEN from frag0 into linear, this disables the frag0 optimization in the special case when IFF_NAPI_FRAGS is used with zero length iov[0] (and thus empty skb->linear).
--- drivers/net/tun.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/tun.c +10 -4
@@ -1908,8 +1908,11 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, skb->dev = tun->dev;break ;case IFF_TAP : -if (!frags) - skb->protocol =eth_type_trans (skb, tun->dev); +if (frags && !pskb_may_pull (skb,ETH_HLEN )) { + err = -ENOMEM ; + goto drop; + } + skb->protocol =eth_type_trans (skb, tun->dev);break ; }
@@ -1966,9 +1969,12 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, }if (frags) { +u32 headlen; +/* Exercise flow dissector code path. */ -u32 headlen =eth_get_headlen (tun->dev, skb->data, -skb_headlen (skb)); +skb_push (skb,ETH_HLEN ); + headlen =eth_get_headlen (tun->dev, skb->data, +skb_headlen (skb));if (unlikely (headlen >skb_headlen (skb))) {this_cpu_inc (tun->pcpu_stats->rx_dropped);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 60/175 x86: fix vmap arguments in map_irq_stack
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 0348801151b5aefbcf9d6e9b9e30aceb3a2a7b13 ]
vmap does not take a gfp_t, the flags argument is for VM_* flags.
--- arch/x86/kernel/irq_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/irq_64.c +1 -1
@@ -43,7 +43,7 @@ static int map_irq_stack(unsigned int cpu) pages[i] =pfn_to_page (pa >>PAGE_SHIFT ); } - va =vmap (pages,IRQ_STACK_SIZE /PAGE_SIZE ,GFP_KERNEL ,PAGE_KERNEL ); + va =vmap (pages,IRQ_STACK_SIZE /PAGE_SIZE ,VM_MAP ,PAGE_KERNEL );if (!va)return -ENOMEM ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 61/175 staging: android: ion: use vmap instead of vm_map_ram
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 5bf9917452112694b2c774465ee4dbe441c84b77 ]
vm_map_ram can keep mappings around after the vm_unmap_ram. Using that with non-PAGE_KERNEL mappings can lead to all kinds of aliasing issues.
--- drivers/staging/android/ion/ion_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion_heap.c +2 -2
@@ -99,12 +99,12 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,static int ion_heap_clear_pages (struct page **pages,int num,pgprot_t pgprot) { -void *addr =vm_map_ram (pages, num,-1 , pgprot); +void *addr =vmap (pages, num,VM_MAP , pgprot);if (!addr)return -ENOMEM ;memset (addr,0 ,PAGE_SIZE * num); -vm_unmap_ram (addr, num); +vunmap (addr);return 0 ; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 62/175 ath10k: fix kernel null pointer dereference
In reply to Sasha LevinFrom: Venkateswara Naralasetty <[email protected]>
[ Upstream commit acb31476adc9ff271140cdd4d3c707ff0c97f5a4 ]
Currently sta airtime is updated without any lock in case of host based airtime calculation. Which may result in accessing the invalid sta pointer in case of continuous station connect/disconnect.
This patch fix the kernel null pointer dereference by updating the station airtime with proper RCU lock in case of host based airtime calculation.
Proceeding with the analysis of "ARM Kernel Panic".
The APSS crash happened due to OOPS on CPU 0.
Crash Signature : Unable to handle kernel NULL pointer dereference at virtual address 00000300
During the crash,
PC points to "ieee80211_sta_register_airtime+0x1c/0x448 [mac80211]" LR points to "ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]". The Backtrace obtained is as follows:
[<bf880238>] (ieee80211_sta_register_airtime [mac80211]) from [<bf945a38>] (ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]) [<bf945a38>] (ath10k_txrx_tx_unref [ath10k_core]) from [<bf9428e4>] (ath10k_htt_txrx_compl_task+0xa50/0xfc0 [ath10k_core]) [<bf9428e4>] (ath10k_htt_txrx_compl_task [ath10k_core]) from [<bf9b9bc8>] (ath10k_pci_napi_poll+0x50/0xf8 [ath10k_pci]) [<bf9b9bc8>] (ath10k_pci_napi_poll [ath10k_pci]) from [<c059e3b0>] (net_rx_action+0xac/0x160)
[<c059e3b0>] (net_rx_action) from [<c02329a4>] (__do_softirq+0x104/0x294) [<c02329a4>] (__do_softirq) from [<c0232b64>] (run_ksoftirqd+0x30/0x90) [<c0232b64>] (run_ksoftirqd) from [<c024e358>] (smpboot_thread_fn+0x25c/0x274) [<c024e358>] (smpboot_thread_fn) from [<c02482fc>] (kthread+0xd8/0xec)
Tested HW: QCA9888
Tested FW: 10.4-3.10-00047
--- drivers/net/wireless/ath/ath10k/txrx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath10k/txrx.c +2 -0
@@ -84,9 +84,11 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,wake_up (&htt->empty_tx_wq);spin_unlock_bh (&htt->tx_lock); +rcu_read_lock ();if (txq && txq->sta && skb_cb->airtime_est)ieee80211_sta_register_airtime (txq->sta, txq->tid, skb_cb->airtime_est,0 ); +rcu_read_unlock ();if (ar->bus_param.dev_type !=ATH10K_DEV_TYPE_HL )dma_unmap_single (dev, skb_cb->paddr, msdu->len,DMA_TO_DEVICE );
Signature · 7 lines
2.25.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 63/175 ath9k: Fix use-after-free Read in ath9k_wmi_ctrl_rx
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit abeaa85054ff8cfe8b99aafc5c70ea067e5d0908 ]
Free wmi later after cmd urb has been killed, as urb cb will access wmi.
the case reported by syzbot:
https://lore.kernel.org/linux-usb/[email protected]
BUG: KASAN: use-after-free in ath9k_wmi_ctrl_rx+0x416/0x500 drivers/net/wireless/ath/ath9k/wmi.c:215 Read of size 1 at addr ffff8881cef1417c by task swapper/1/0 Call Trace: <IRQ> ath9k_wmi_ctrl_rx+0x416/0x500 drivers/net/wireless/ath/ath9k/wmi.c:215 ath9k_htc_rx_msg+0x2da/0xaf0 drivers/net/wireless/ath/ath9k/htc_hst.c:459 ath9k_hif_usb_reg_in_cb+0x1ba/0x630 drivers/net/wireless/ath/ath9k/hif_usb.c:718 __usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716 dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 5 +++-- drivers/net/wireless/ath/ath9k/hif_usb.h | 1 + drivers/net/wireless/ath/ath9k/htc_drv_init.c | 10 +++++++--- drivers/net/wireless/ath/ath9k/wmi.c | 5 ++++- drivers/net/wireless/ath/ath9k/wmi.h | 3 ++- 5 files changed, 17 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +3 -2
@@ -978,7 +978,7 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev)return -ENOMEM ; } -static void ath9k_hif_usb_dealloc_urbs (struct hif_device_usb *hif_dev) +void ath9k_hif_usb_dealloc_urbs (struct hif_device_usb *hif_dev) {usb_kill_anchored_urbs (&hif_dev->regout_submitted);ath9k_hif_usb_dealloc_reg_in_urbs (hif_dev);
@@ -1346,8 +1346,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)if (hif_dev->flags &HIF_USB_READY ) {ath9k_htc_hw_deinit (hif_dev->htc_handle, unplugged); -ath9k_htc_hw_free (hif_dev->htc_handle);ath9k_hif_usb_dev_deinit (hif_dev); +ath9k_destoy_wmi (hif_dev->htc_handle->drv_priv); +ath9k_htc_hw_free (hif_dev->htc_handle); }usb_set_intfdata (interface,NULL );
drivers/net/wireless/ath/ath9k/hif_usb.h +1 -0
@@ -133,5 +133,6 @@ struct hif_device_usb {int ath9k_hif_usb_init (void );void ath9k_hif_usb_exit (void ); +void ath9k_hif_usb_dealloc_urbs (struct hif_device_usb *hif_dev);#endif /* HTC_USB_H */
drivers/net/wireless/ath/ath9k/htc_drv_init.c +7 -3
@@ -931,8 +931,9 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv,int ath9k_htc_probe_device (struct htc_target *htc_handle,struct device *dev,u16 devid,char *product,u32 drv_info) { -struct ieee80211_hw *hw; +struct hif_device_usb *hif_dev;struct ath9k_htc_priv *priv; +struct ieee80211_hw *hw;int ret; hw =ieee80211_alloc_hw (sizeof (struct ath9k_htc_priv ), &ath9k_htc_ops);
@@ -967,7 +968,10 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,return 0 ; err_init: -ath9k_deinit_wmi (priv); +ath9k_stop_wmi (priv); + hif_dev = (struct hif_device_usb *)htc_handle->hif_dev; +ath9k_hif_usb_dealloc_urbs (hif_dev); +ath9k_destoy_wmi (priv); err_free:ieee80211_free_hw (hw);return ret;
@@ -982,7 +986,7 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) htc_handle->drv_priv->ah->ah_flags |=AH_UNPLUGGED ;ath9k_deinit_device (htc_handle->drv_priv); -ath9k_deinit_wmi (htc_handle->drv_priv); +ath9k_stop_wmi (htc_handle->drv_priv);ieee80211_free_hw (htc_handle->drv_priv->hw); } }
drivers/net/wireless/ath/ath9k/wmi.c +4 -1
@@ -112,14 +112,17 @@ struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv)return wmi; } -void ath9k_deinit_wmi (struct ath9k_htc_priv *priv) +void ath9k_stop_wmi (struct ath9k_htc_priv *priv) {struct wmi *wmi = priv->wmi;mutex_lock (&wmi->op_mutex); wmi->stopped = true;mutex_unlock (&wmi->op_mutex); +} +void ath9k_destoy_wmi (struct ath9k_htc_priv *priv) +{kfree (priv->wmi); }
drivers/net/wireless/ath/ath9k/wmi.h +2 -1
@@ -179,7 +179,6 @@ struct wmi { };struct wmi *ath9k_init_wmi (struct ath9k_htc_priv *priv); -void ath9k_deinit_wmi (struct ath9k_htc_priv *priv);int ath9k_wmi_connect (struct htc_target *htc,struct wmi *wmi,enum htc_endpoint_id *wmi_ctrl_epid); int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
@@ -189,6 +188,8 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,void ath9k_wmi_event_tasklet (unsigned long data);void ath9k_fatal_work (struct work_struct *work);void ath9k_wmi_event_drain (struct ath9k_htc_priv *priv); +void ath9k_stop_wmi (struct ath9k_htc_priv *priv); +void ath9k_destoy_wmi (struct ath9k_htc_priv *priv);#define WMI_CMD (_wmi_cmd) \ do { \
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 64/175 ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb
In reply to Sasha LevinFrom: Qiujun Huang <[email protected]>
[ Upstream commit 2bbcaaee1fcbd83272e29f31e2bb7e70d8c49e05 ]
In ath9k_hif_usb_rx_cb interface number is assumed to be 0. usb_ifnum_to_if(urb->dev, 0)
But it isn't always true.
The case reported by syzbot:
https://lore.kernel.org/linux-usb/[email protected]
usb 2-1: new high-speed USB device number 2 using dummy_hcd usb 2-1: config 1 has an invalid interface number: 2 but max is 0 usb 2-1: config 1 has no interface number 0
usb 2-1: New USB device found, idVendor=0cf3, idProduct=9271, bcdDevice= 1.08
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
general protection fault, probably for non-canonical address 0xdffffc0000000015: 0000 [#1] SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000a8-0x00000000000000af] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.6.0-rc5-syzkaller #0
Call Trace
__usb_hcd_giveback_urb+0x29a/0x550 drivers/usb/core/hcd.c:1650 usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1716 dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966 call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786 __do_softirq+0x21e/0x950 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x178/0x1a0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:546 [inline] smp_apic_timer_interrupt+0x141/0x540 arch/x86/kernel/apic/apic.c:1146 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 48 ++++++++++++++++++------ drivers/net/wireless/ath/ath9k/hif_usb.h | 5 +++ 2 files changed, 42 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +37 -11
@@ -643,9 +643,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,static void ath9k_hif_usb_rx_cb (struct urb *urb) { -struct sk_buff *skb = (struct sk_buff *) urb->context; -struct hif_device_usb *hif_dev = -usb_get_intfdata (usb_ifnum_to_if (urb->dev,0 )); +struct rx_buf *rx_buf = (struct rx_buf *)urb->context; +struct hif_device_usb *hif_dev = rx_buf->hif_dev; +struct sk_buff *skb = rx_buf->skb;int ret;if (!skb)
@@ -685,14 +685,15 @@ static void ath9k_hif_usb_rx_cb(struct urb *urb)return ; free:kfree_skb (skb); +kfree (rx_buf); }static void ath9k_hif_usb_reg_in_cb (struct urb *urb) { -struct sk_buff *skb = (struct sk_buff *) urb->context; +struct rx_buf *rx_buf = (struct rx_buf *)urb->context; +struct hif_device_usb *hif_dev = rx_buf->hif_dev; +struct sk_buff *skb = rx_buf->skb;struct sk_buff *nskb; -struct hif_device_usb *hif_dev = -usb_get_intfdata (usb_ifnum_to_if (urb->dev,0 ));int ret;if (!skb)
@@ -750,6 +751,7 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)return ; free:kfree_skb (skb); +kfree (rx_buf); urb->context =NULL ; }
@@ -795,7 +797,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)init_usb_anchor (&hif_dev->mgmt_submitted);for (i =0 ; i <MAX_TX_URB_NUM ; i++) { - tx_buf =kzalloc (sizeof (struct tx_buf ),GFP_KERNEL ); + tx_buf =kzalloc (sizeof (*tx_buf),GFP_KERNEL );if (!tx_buf) goto err;
@@ -832,8 +834,9 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)static int ath9k_hif_usb_alloc_rx_urbs (struct hif_device_usb *hif_dev) { -struct urb *urb =NULL ; +struct rx_buf *rx_buf =NULL ;struct sk_buff *skb =NULL ; +struct urb *urb =NULL ;int i, ret;init_usb_anchor (&hif_dev->rx_submitted);
@@ -841,6 +844,12 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)for (i =0 ; i <MAX_RX_URB_NUM ; i++) { + rx_buf =kzalloc (sizeof (*rx_buf),GFP_KERNEL ); +if (!rx_buf) { + ret = -ENOMEM ; + goto err_rxb; + } +/* Allocate URB */ urb =usb_alloc_urb (0 ,GFP_KERNEL );if (urb ==NULL ) {
@@ -855,11 +864,14 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) goto err_skb; } + rx_buf->hif_dev = hif_dev; + rx_buf->skb = skb; +usb_fill_bulk_urb (urb, hif_dev->udev,usb_rcvbulkpipe (hif_dev->udev,USB_WLAN_RX_PIPE ), skb->data,MAX_RX_BUF_SIZE , - ath9k_hif_usb_rx_cb, skb); + ath9k_hif_usb_rx_cb, rx_buf);/* Anchor URB */ usb_anchor_urb (urb, &hif_dev->rx_submitted);
@@ -885,6 +897,8 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) err_skb:usb_free_urb (urb); err_urb: +kfree (rx_buf); +err_rxb:ath9k_hif_usb_dealloc_rx_urbs (hif_dev);return ret; }
@@ -896,14 +910,21 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev)static int ath9k_hif_usb_alloc_reg_in_urbs (struct hif_device_usb *hif_dev) { -struct urb *urb =NULL ; +struct rx_buf *rx_buf =NULL ;struct sk_buff *skb =NULL ; +struct urb *urb =NULL ;int i, ret;init_usb_anchor (&hif_dev->reg_in_submitted);for (i =0 ; i <MAX_REG_IN_URB_NUM ; i++) { + rx_buf =kzalloc (sizeof (*rx_buf),GFP_KERNEL ); +if (!rx_buf) { + ret = -ENOMEM ; + goto err_rxb; + } +/* Allocate URB */ urb =usb_alloc_urb (0 ,GFP_KERNEL );if (urb ==NULL ) {
@@ -918,11 +939,14 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) goto err_skb; } + rx_buf->hif_dev = hif_dev; + rx_buf->skb = skb; +usb_fill_int_urb (urb, hif_dev->udev,usb_rcvintpipe (hif_dev->udev,USB_REG_IN_PIPE ), skb->data,MAX_REG_IN_BUF_SIZE , - ath9k_hif_usb_reg_in_cb, skb,1 ); + ath9k_hif_usb_reg_in_cb, rx_buf,1 );/* Anchor URB */ usb_anchor_urb (urb, &hif_dev->reg_in_submitted);
@@ -948,6 +972,8 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) err_skb:usb_free_urb (urb); err_urb: +kfree (rx_buf); +err_rxb:ath9k_hif_usb_dealloc_reg_in_urbs (hif_dev);return ret; }
drivers/net/wireless/ath/ath9k/hif_usb.h +5 -0
@@ -86,6 +86,11 @@ struct tx_buf {struct list_head list; }; +struct rx_buf { +struct sk_buff *skb; +struct hif_device_usb *hif_dev; +}; +#define HIF_USB_TX_STOP BIT(0)#define HIF_USB_TX_FLUSH BIT(1)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 65/175 media: staging/intel-ipu3: Implement lock for stream on/off operations
In reply to Sasha LevinFrom: Bingbu Cao <[email protected]>
[ Upstream commit 33e3c349b2bf1235be458df09fb8d237141486c4 ]
Currently concurrent stream off operations on ImgU nodes are not synchronized, leading to use-after-free bugs (as reported by KASAN).
[ 250.090724] BUG: KASAN: use-after-free in ipu3_dmamap_free+0xc5/0x116 [ipu3_imgu] [ 250.090726] Read of size 8 at addr ffff888127b29bc0 by task yavta/18836 [ 250.090731] Hardware name: HP Soraka/Soraka, BIOS Google_Soraka.10431.17.0 03/22/2018 [ 250.090732] Call Trace: [ 250.090735] dump_stack+0x6a/0xb1 [ 250.090739] print_address_description+0x8e/0x279 [ 250.090743] ? ipu3_dmamap_free+0xc5/0x116 [ipu3_imgu] [ 250.090746] kasan_report+0x260/0x28a [ 250.090750] ipu3_dmamap_free+0xc5/0x116 [ipu3_imgu] [ 250.090754] ipu3_css_pool_cleanup+0x24/0x37 [ipu3_imgu] [ 250.090759] ipu3_css_pipeline_cleanup+0x61/0xb9 [ipu3_imgu] [ 250.090763] ipu3_css_stop_streaming+0x1f2/0x321 [ipu3_imgu] [ 250.090768] imgu_s_stream+0x94/0x443 [ipu3_imgu] [ 250.090772] ? ipu3_vb2_buf_queue+0x280/0x280 [ipu3_imgu] [ 250.090775] ? vb2_dma_sg_unmap_dmabuf+0x16/0x6f [videobuf2_dma_sg] [ 250.090778] ? vb2_buffer_in_use+0x36/0x58 [videobuf2_common] [ 250.090782] ipu3_vb2_stop_streaming+0xf9/0x135 [ipu3_imgu]
Implemented a lock to synchronize imgu stream on / off operations and the modification of streaming flag (in struct imgu_device), to prevent these issues.
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 10 ++++++++++ drivers/staging/media/ipu3/ipu3.c | 3 +++ drivers/staging/media/ipu3/ipu3.h | 4 ++++ 3 files changed, 17 insertions(+)
drivers/staging/media/ipu3/ipu3-v4l2.c +10 -0
@@ -367,8 +367,10 @@ static void imgu_vb2_buf_queue(struct vb2_buffer *vb)vb2_set_plane_payload (vb,0 , need_bytes); +mutex_lock (&imgu->streaming_lock);if (imgu->streaming)imgu_queue_buffers (imgu, false, node->pipe); +mutex_unlock (&imgu->streaming_lock);dev_dbg (&imgu->pci_dev->dev,"%s for pipe %u node %u" , __func__, node->pipe, node->id);
@@ -468,10 +470,13 @@ static int imgu_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)dev_dbg (dev,"%s node name %s pipe %u id %u" , __func__, node->name, node->pipe, node->id); +mutex_lock (&imgu->streaming_lock);if (imgu->streaming) { r = -EBUSY ; +mutex_unlock (&imgu->streaming_lock); goto fail_return_bufs; } +mutex_unlock (&imgu->streaming_lock);if (!node->enabled) {dev_err (dev,"IMGU node is not enabled" );
@@ -498,9 +503,11 @@ static int imgu_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)/* Start streaming of the whole pipeline now */ dev_dbg (dev,"IMGU streaming is ready to start" ); +mutex_lock (&imgu->streaming_lock); r =imgu_s_stream (imgu, true);if (!r) imgu->streaming = true; +mutex_unlock (&imgu->streaming_lock);return 0 ;
@@ -532,6 +539,7 @@ static void imgu_vb2_stop_streaming(struct vb2_queue *vq)dev_err (&imgu->pci_dev->dev,"failed to stop subdev streaming\n" ); +mutex_lock (&imgu->streaming_lock);/* Was this the first node with streaming disabled? */ if (imgu->streaming &&imgu_all_nodes_streaming (imgu, node)) {/* Yes, really stop streaming now */
@@ -542,6 +550,8 @@ static void imgu_vb2_stop_streaming(struct vb2_queue *vq) }imgu_return_all_buffers (imgu, node,VB2_BUF_STATE_ERROR ); +mutex_unlock (&imgu->streaming_lock); +media_pipeline_stop (&node->vdev.entity); }
drivers/staging/media/ipu3/ipu3.c +3 -0
@@ -663,6 +663,7 @@ static int imgu_pci_probe(struct pci_dev *pci_dev,return r;mutex_init (&imgu->lock); +mutex_init (&imgu->streaming_lock);atomic_set (&imgu->qbuf_barrier,0 );init_waitqueue_head (&imgu->buf_drain_wq);
@@ -726,6 +727,7 @@ static int imgu_pci_probe(struct pci_dev *pci_dev, out_css_powerdown:imgu_css_set_powerdown (&pci_dev->dev, imgu->base); out_mutex_destroy: +mutex_destroy (&imgu->streaming_lock);mutex_destroy (&imgu->lock);return r;
@@ -743,6 +745,7 @@ static void imgu_pci_remove(struct pci_dev *pci_dev)imgu_css_set_powerdown (&pci_dev->dev, imgu->base);imgu_dmamap_exit (imgu);imgu_mmu_exit (imgu->mmu); +mutex_destroy (&imgu->streaming_lock);mutex_destroy (&imgu->lock); }
drivers/staging/media/ipu3/ipu3.h +4 -0
@@ -146,6 +146,10 @@ struct imgu_device {* vid_buf.list and css->queue */ struct mutex lock; + +/* Lock to protect writes to streaming flag in this struct */ +struct mutex streaming_lock; +/* Forbid streaming and buffer queuing during system suspend. */ atomic_t qbuf_barrier;/* Indicate if system suspend take place while imgu is streaming. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 66/175 spi: Respect DataBitLength field of SpiSerialBusV2() ACPI resource
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 0dadde344d965566589cd82797893d5aa06557a3 ]
By unknown reason the commit 64bee4d28c9e
("spi / ACPI: add ACPI enumeration support")
missed the DataBitLength property to encounter when parse SPI slave device data from ACPI.
Fill the gap here.
--- drivers/spi/spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi.c +1 -0
@@ -1950,6 +1950,7 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) } lookup->max_speed_hz = sb->connection_speed; + lookup->bits_per_word = sb->data_bit_length;if (sb->clock_phase ==ACPI_SPI_SECOND_PHASE ) lookup->mode |=SPI_CPHA ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 67/175 brcmfmac: fix wrong location to get firmware feature
In reply to Sasha LevinFrom: Jaehoon Chung <[email protected]>
[ Upstream commit c57673852062428cdeabdd6501ac8b8e4c302067 ]
sup_wpa feature is getting after setting feature_disable flag. If firmware is supported sup_wpa feature, it's always enabled regardless of feature_disable flag.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +2 -1
@@ -283,13 +283,14 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)if (!err) ifp->drvr->feat_flags |=BIT (BRCMF_FEAT_SCAN_RANDOM_MAC ); +brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_FWSUP ,"sup_wpa" ); +if (drvr->settings->feature_disable) {brcmf_dbg (INFO ,"Features: 0x%02x, disable: 0x%02x\n" , ifp->drvr->feat_flags, drvr->settings->feature_disable); ifp->drvr->feat_flags &= ~drvr->settings->feature_disable; } -brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_FWSUP ,"sup_wpa" );brcmf_feat_firmware_overrides (drvr);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 68/175 regulator: qcom-rpmh: Fix typos in pm8150 and pm8150l
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 906746ba26d0b45688f4c3b730c35f765dc958ba ]
Fix typos in pm8150 l13/l16/l17 and pm8150l ldo8 supplies.
--- drivers/regulator/qcom-rpmh-regulator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/regulator/qcom-rpmh-regulator.c +4 -4
@@ -832,11 +832,11 @@ static const struct rpmh_vreg_init_data pm8150_vreg_data[] = {RPMH_VREG ("ldo10" ,"ldo%s10" , &pmic5_pldo,"vdd-l2-l10" ),RPMH_VREG ("ldo11" ,"ldo%s11" , &pmic5_nldo,"vdd-l1-l8-l11" ),RPMH_VREG ("ldo12" ,"ldo%s12" , &pmic5_pldo_lv,"vdd-l7-l12-l14-l15" ), -RPMH_VREG ("ldo13" ,"ldo%s13" , &pmic5_pldo,"vdd-l13-l6-l17" ), +RPMH_VREG ("ldo13" ,"ldo%s13" , &pmic5_pldo,"vdd-l13-l16-l17" ),RPMH_VREG ("ldo14" ,"ldo%s14" , &pmic5_pldo_lv,"vdd-l7-l12-l14-l15" ),RPMH_VREG ("ldo15" ,"ldo%s15" , &pmic5_pldo_lv,"vdd-l7-l12-l14-l15" ), -RPMH_VREG ("ldo16" ,"ldo%s16" , &pmic5_pldo,"vdd-l13-l6-l17" ), -RPMH_VREG ("ldo17" ,"ldo%s17" , &pmic5_pldo,"vdd-l13-l6-l17" ), +RPMH_VREG ("ldo16" ,"ldo%s16" , &pmic5_pldo,"vdd-l13-l16-l17" ), +RPMH_VREG ("ldo17" ,"ldo%s17" , &pmic5_pldo,"vdd-l13-l16-l17" ), RPMH_VREG("ldo18", "ldo%s18", &pmic5_nldo, "vdd-l3-l4-l5-l18"), {}, };
@@ -857,7 +857,7 @@ static const struct rpmh_vreg_init_data pm8150l_vreg_data[] = {RPMH_VREG ("ldo5" ,"ldo%s5" , &pmic5_pldo,"vdd-l4-l5-l6" ),RPMH_VREG ("ldo6" ,"ldo%s6" , &pmic5_pldo,"vdd-l4-l5-l6" ),RPMH_VREG ("ldo7" ,"ldo%s7" , &pmic5_pldo,"vdd-l7-l11" ), -RPMH_VREG ("ldo8" ,"ldo%s8" , &pmic5_pldo_lv,"vdd-l1-l8-l11" ), +RPMH_VREG ("ldo8" ,"ldo%s8" , &pmic5_pldo_lv,"vdd-l1-l8" ),RPMH_VREG ("ldo9" ,"ldo%s9" , &pmic5_pldo,"vdd-l9-l10" ),RPMH_VREG ("ldo10" ,"ldo%s10" , &pmic5_pldo,"vdd-l9-l10" ), RPMH_VREG("ldo11", "ldo%s11", &pmic5_pldo, "vdd-l7-l11"),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 69/175 tools api fs: Make xxx__mountpoint() more scalable
In reply to Sasha LevinFrom: Stephane Eranian <[email protected]>
[ Upstream commit c6fddb28bad26e5472cb7acf7b04cd5126f1a4ab ]
The xxx_mountpoint() interface provided by fs.c finds mount points for common pseudo filesystems. The first time xxx_mountpoint() is invoked, it scans the mount table (/proc/mounts) looking for a match. If found, it is cached. The price to scan /proc/mounts is paid once if the mount is found.
When the mount point is not found, subsequent calls to xxx_mountpoint() scan /proc/mounts over and over again. There is no caching.
This causes a scaling issue in perf record with hugeltbfs__mountpoint(). The function is called for each process found in synthesize__mmap_events(). If the machine has thousands of processes and if the /proc/mounts has many entries this could cause major overhead in perf record. We have observed multi-second slowdowns on some configurations.
As an example on a laptop:
Before:
$ sudo umount /dev/hugepages $ strace -e trace=openat -o /tmp/tt perf record -a ls $ fgrep mounts /tmp/tt 285
After:
$ sudo umount /dev/hugepages $ strace -e trace=openat -o /tmp/tt perf record -a ls $ fgrep mounts /tmp/tt 1
One could argue that the non-caching in case the moint point is not found is intentional. That way subsequent calls may discover a moint point if the sysadmin mounts the filesystem. But the same argument could be made against caching the mount point. It could be unmounted causing errors. It all depends on the intent of the interface. This patch assumes it is expected to scan /proc/mounts once. The patch documents the caching behavior in the fs.h header file.
An alternative would be to just fix perf record. But it would solve the problem with hugetlbs__mountpoint() but there could be similar issues (possibly down the line) with other xxx_mountpoint() calls in perf or other tools.
--- tools/lib/api/fs/fs.c | 17 +++++++++++++++++ tools/lib/api/fs/fs.h | 12 ++++++++++++ 2 files changed, 29 insertions(+)
tools/lib/api/fs/fs.c +17 -0
@@ -90,6 +90,7 @@ struct fs {const char *const *mounts;char path[PATH_MAX ];bool found; +bool checked;long magic; };
@@ -111,31 +112,37 @@ static struct fs fs__entries[] = { .name = "sysfs", .mounts = sysfs__fs_known_mountpoints, .magic = SYSFS_MAGIC, + .checked = false, }, [FS__PROCFS] = { .name = "proc", .mounts = procfs__known_mountpoints, .magic = PROC_SUPER_MAGIC, + .checked = false, }, [FS__DEBUGFS] = { .name = "debugfs", .mounts = debugfs__known_mountpoints, .magic = DEBUGFS_MAGIC, + .checked = false, }, [FS__TRACEFS] = { .name = "tracefs", .mounts = tracefs__known_mountpoints, .magic = TRACEFS_MAGIC, + .checked = false, }, [FS__HUGETLBFS] = { .name = "hugetlbfs", .mounts = hugetlbfs__known_mountpoints, .magic = HUGETLBFS_MAGIC, + .checked = false, }, [FS__BPF_FS] = { .name = "bpf", .mounts = bpf_fs__known_mountpoints, .magic = BPF_FS_MAGIC, + .checked = false, }, };
@@ -158,6 +165,7 @@ static bool fs__read_mounts(struct fs *fs) }fclose (fp); + fs->checked = true;return fs->found = found; }
@@ -220,6 +228,7 @@ static bool fs__env_override(struct fs *fs)return false; fs->found = true; + fs->checked = true;strncpy (fs->path, override_path,sizeof (fs->path) -1 ); fs->path[sizeof (fs->path) -1 ] ='\0' ;return true;
@@ -246,6 +255,14 @@ static const char *fs__mountpoint(int idx)if (fs->found)return (const char *)fs->path; +/* the mount point was already checked for the mount point +* but and did not exist, so return NULL to avoid scanning again. +* This makes the found and not found paths cost equivalent +* in case of multiple calls. +*/ +if (fs->checked) +return NULL ; +return fs__get_mountpoint (fs); }
tools/lib/api/fs/fs.h +12 -0
@@ -18,6 +18,18 @@ const char *name##__mount(void); \ bool name##__configured(void); \ +/* +* The xxxx__mountpoint() entry points find the first match mount point for each +* filesystems listed below, where xxxx is the filesystem type. +* +* The interface is as follows: +* +* - If a mount point is found on first call, it is cached and used for all +* subsequent calls. +* +* - If a mount point is not found, NULL is returned on first call and all +* subsequent calls. +*/ FS(sysfs) FS(procfs) FS(debugfs)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 70/175 e1000: Distribute switch variables for initialization
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit a34c7f5156654ebaf7eaace102938be7ff7036cb ]
Variables declared in a switch statement before any case statements cannot be automatically initialized with compiler instrumentation (as they are not part of any execution flow). With GCC's proposed automatic stack variable initialization feature, this triggers a warning (and they don't get initialized). Clang's automatic stack variable initialization (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also doesn't initialize such variables[1]. Note that these warnings (or silent skipping) happen before the dead-store elimination optimization phase, so even when the automatic initializations are later elided in favor of direct initializations, the warnings remain.
To avoid these problems, move such variables into the "case" where they're used or lift them up into the main function body.
drivers/net/ethernet/intel/e1000/e1000_main.c: In function ?e1000_xmit_frame?:drivers/net/ethernet/intel/e1000/e1000_main.c:3143:18: warning: statement will never be executed [-Wswitch-unreachable]
3143 | unsigned int pull_size;
| ^~~~~~~~~[1] https://bugs.llvm.org/show_bug.cgi?id=44916
--- drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +3 -1
@@ -3140,8 +3140,9 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb);if (skb->data_len && hdr_len == len) {switch (hw->mac_type) { +case e1000_82544: {unsigned int pull_size; -case e1000_82544: +/* Make sure we have room to chop off 4 bytes, * and that the end alignment will work out to * this hardware's requirements
@@ -3162,6 +3163,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, } len =skb_headlen (skb);break ; + }default :/* do nothing */ break ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 71/175 dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
In reply to Sasha LevinFrom: Jitao Shi <[email protected]>
[ Upstream commit b0ff9b590733079f7f9453e5976a9dd2630949e3 ]
Add property "pinctrl-names" to swap pin mode between gpio and dpi mode. Set the dpi pins to gpio mode and output-low to avoid leakage current when dpi disabled.
--- .../devicetree/bindings/display/mediatek/mediatek,dpi.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt +6 -0
@@ -16,6 +16,9 @@ Required properties: Documentation/devicetree/bindings/graph.txt. This port should be connected to the input port of an attached HDMI or LVDS encoder chip. +Optional properties: +- pinctrl-names: Contain "default" and "sleep". + Example: dpi0: dpi@1401d000 {
@@ -26,6 +29,9 @@ dpi0: dpi@1401d000 { <&mmsys CLK_MM_DPI_ENGINE>, <&apmixedsys CLK_APMIXED_TVDPLL>; clock-names = "pixel", "engine", "pll"; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&dpi_pin_func>; + pinctrl-1 = <&dpi_pin_idle>; port { dpi0_out: endpoint {
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 72/175 drm/mediatek: set dpi pin mode to gpio low to avoid leakage current
In reply to Sasha LevinFrom: Jitao Shi <[email protected]>
[ Upstream commit 6bd4763fd532cff43f9b15704f324c45a9806f53 ]
Config dpi pins mode to output and pull low when dpi is disabled. Aovid leakage current from some dpi pins (Hsync Vsync DE ... ).
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/mediatek/mtk_dpi.c +31 -0
@@ -10,7 +10,9 @@#include <linux/kernel.h> #include <linux/of.h> #include <linux/of_device.h> +#include <linux/of_gpio.h> #include <linux/of_graph.h> +#include <linux/pinctrl/consumer.h> #include <linux/platform_device.h> #include <linux/types.h>
@@ -73,6 +75,9 @@ struct mtk_dpi {enum mtk_dpi_out_yc_map yc_map;enum mtk_dpi_out_bit_num bit_num;enum mtk_dpi_out_channel_swap channel_swap; +struct pinctrl *pinctrl; +struct pinctrl_state *pins_gpio; +struct pinctrl_state *pins_dpi;int refcount; };
@@ -378,6 +383,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)if (--dpi->refcount !=0 )return ; +if (dpi->pinctrl && dpi->pins_gpio) +pinctrl_select_state (dpi->pinctrl, dpi->pins_gpio); +mtk_dpi_disable (dpi);clk_disable_unprepare (dpi->pixel_clk);clk_disable_unprepare (dpi->engine_clk);
@@ -402,6 +410,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) goto err_pixel; } +if (dpi->pinctrl && dpi->pins_dpi) +pinctrl_select_state (dpi->pinctrl, dpi->pins_dpi); +mtk_dpi_enable (dpi);return 0 ;
@@ -689,6 +700,26 @@ static int mtk_dpi_probe(struct platform_device *pdev) dpi->dev = dev; dpi->conf = (struct mtk_dpi_conf *)of_device_get_match_data (dev); + dpi->pinctrl =devm_pinctrl_get (&pdev->dev); +if (IS_ERR (dpi->pinctrl)) { + dpi->pinctrl =NULL ; +dev_dbg (&pdev->dev,"Cannot find pinctrl!\n" ); + } +if (dpi->pinctrl) { + dpi->pins_gpio =pinctrl_lookup_state (dpi->pinctrl,"sleep" ); +if (IS_ERR (dpi->pins_gpio)) { + dpi->pins_gpio =NULL ; +dev_dbg (&pdev->dev,"Cannot find pinctrl idle!\n" ); + } +if (dpi->pins_gpio) +pinctrl_select_state (dpi->pinctrl, dpi->pins_gpio); + + dpi->pins_dpi =pinctrl_lookup_state (dpi->pinctrl,"default" ); +if (IS_ERR (dpi->pins_dpi)) { + dpi->pins_dpi =NULL ; +dev_dbg (&pdev->dev,"Cannot find pinctrl active!\n" ); + } + } mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); dpi->regs =devm_ioremap_resource (dev, mem);if (IS_ERR (dpi->regs)) {
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 73/175 audit: fix a net reference leak in audit_send_reply()
In reply to Sasha LevinFrom: Paul Moore <[email protected]>
[ Upstream commit a48b284b403a4a073d8beb72d2bb33e54df67fb6 ]
If audit_send_reply() fails when trying to create a new thread to send the reply it also fails to cleanup properly, leaking a reference to a net structure. This patch fixes the error path and makes a handful of other cleanups that came up while fixing the code.
--- kernel/audit.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-)
kernel/audit.c +29 -21
@@ -923,19 +923,30 @@ struct sk_buff *audit_make_reply(int seq, int type, int done,return NULL ; } +static void audit_free_reply (struct audit_reply *reply) +{ +if (!reply) +return ; + +if (reply->skb) +kfree_skb (reply->skb); +if (reply->net) +put_net (reply->net); +kfree (reply); +} +static int audit_send_reply_thread (void *arg) {struct audit_reply *reply = (struct audit_reply *)arg; -struct sock *sk =audit_get_sk (reply->net);audit_ctl_lock ();audit_ctl_unlock ();/* Ignore failure. It'll only happen if the sender goes away, because our timeout is set to infinite. */ -netlink_unicast (sk, reply->skb, reply->portid,0 ); -put_net (reply->net); -kfree (reply); +netlink_unicast (audit_get_sk (reply->net), reply->skb, reply->portid,0 ); + reply->skb =NULL ; +audit_free_reply (reply);return 0 ; }
@@ -949,35 +960,32 @@ static int audit_send_reply_thread(void *arg)* @payload: payload data * @size: payload size * -* Allocates an skb, builds the netlink message, and sends it to the port id. -* No failure notifications. +* Allocates a skb, builds the netlink message, and sends it to the port id. */ static void audit_send_reply (struct sk_buff *request_skb,int seq,int type,int done,int multi,const void *payload,int size) { -struct net *net =sock_net (NETLINK_CB (request_skb).sk); -struct sk_buff *skb;struct task_struct *tsk; -struct audit_reply *reply =kmalloc (sizeof (struct audit_reply ), -GFP_KERNEL ); +struct audit_reply *reply; + reply =kzalloc (sizeof (*reply),GFP_KERNEL );if (!reply)return ; - skb =audit_make_reply (seq, type, done, multi, payload, size); -if (!skb) - goto out; - - reply->net =get_net (net); + reply->skb =audit_make_reply (seq, type, done, multi, payload, size); +if (!reply->skb) + goto err; + reply->net =get_net (sock_net (NETLINK_CB (request_skb).sk)); reply->portid =NETLINK_CB (request_skb).portid; - reply->skb = skb; tsk =kthread_run (audit_send_reply_thread, reply,"audit_send_reply" ); -if (!IS_ERR (tsk)) -return ; -kfree_skb (skb); -out: -kfree (reply); +if (IS_ERR (tsk)) + goto err; + +return ; + +err: +audit_free_reply (reply); }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 74/175 media: dvb: return -EREMOTEIO on i2c transfer failure.
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 96f3a9392799dd0f6472648a7366622ffd0989f3 ]
Currently when i2c transfers fail the error return -EREMOTEIO is assigned to err but then later overwritten when the tuner attach call is made. Fix this by returning early with the error return code -EREMOTEIO on i2c transfer failure errors.
If the transfer fails, an uninitialized value will be read from b2.
Addresses-Coverity: ("Unused value")
--- drivers/media/usb/dvb-usb/dibusb-mb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dibusb-mb.c +1 -1
@@ -81,7 +81,7 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap)if (i2c_transfer (&adap->dev->i2c_adap, msg,2 ) !=2 ) {err ("tuner i2c write failed." ); - ret = -EREMOTEIO ; +return -EREMOTEIO ; }if (adap->fe_adap[0 ].fe->ops.i2c_gate_ctrl)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 75/175 media: platform: fcp: Set appropriate DMA parameters
In reply to Sasha LevinFrom: Kieran Bingham <[email protected]>
[ Upstream commit dd844fb8e50b12e65bbdc5746c9876c6735500df ]
Enabling CONFIG_DMA_API_DEBUG=y and CONFIG_DMA_API_DEBUG_SG=y will enable extra validation on DMA operations ensuring that the size restraints are met.
When using the FCP in conjunction with the VSP1/DU, and display frames, the size of the DMA operations is larger than the default maximum segment size reported by the DMA core (64K). With the DMA debug enabled, this produces a warning such as the following:
"DMA-API: rcar-fcp fea27000.fcp: mapping sg segment longer than device claims to support [len=3145728] [max=65536]"
We have no specific limitation on the segment size which isn't already handled by the VSP1/DU which actually handles the DMA allcoations and buffer management, so define a maximum segment size of up to 4GB (a 32 bit mask).
--- drivers/media/platform/rcar-fcp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/media/platform/rcar-fcp.c +5 -0
@@ -8,6 +8,7 @@*/ #include <linux/device.h> +#include <linux/dma-mapping.h> #include <linux/list.h> #include <linux/module.h> #include <linux/mod_devicetable.h>
@@ -21,6 +22,7 @@struct rcar_fcp_device {struct list_head list;struct device *dev; +struct device_dma_parameters dma_parms; };static LIST_HEAD (fcp_devices);
@@ -136,6 +138,9 @@ static int rcar_fcp_probe(struct platform_device *pdev) fcp->dev = &pdev->dev; + fcp->dev->dma_parms = &fcp->dma_parms; +dma_set_max_seg_size (fcp->dev,DMA_BIT_MASK (32 )); +pm_runtime_enable (&pdev->dev);mutex_lock (&fcp_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 76/175 MIPS: Make sparse_init() using top-down allocation
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 269b3a9ac538c4ae87f84be640b9fa89914a2489 ]
In the current code, if CONFIG_SWIOTLB is set, when failed to get IO TLB memory from the low pages by plat_swiotlb_setup(), it may lead to the boot process failed with kernel panic.
(1) On the Loongson and SiByte platformarch/mips/loongson64/dma.carch/mips/sibyte/common/dma.c
void __init plat_swiotlb_setup(void)
{
swiotlb_init(1);
}kernel/dma/swiotlb.c
void __initswiotlb_init(int verbose)
{
...
vstart = memblock_alloc_low(PAGE_ALIGN(bytes), PAGE_SIZE);
if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose))
return;
...
pr_warn("Cannot allocate buffer");
no_iotlb_memory = true;
}phys_addr_t swiotlb_tbl_map_single()
{
...
if (no_iotlb_memory)
panic("Can not allocate SWIOTLB buffer earlier ...");...
}
(2) On the Cavium OCTEON platformarch/mips/cavium-octeon/dma-octeon.c
void __init plat_swiotlb_setup(void)
{
...
octeon_swiotlb = memblock_alloc_low(swiotlbsize, PAGE_SIZE);
if (!octeon_swiotlb)
panic("%s: Failed to allocate %zu bytes align=%lx\n",
__func__, swiotlbsize, PAGE_SIZE);...
}
Because IO_TLB_DEFAULT_SIZE is 64M, if the rest size of low memory is less than 64M when call plat_swiotlb_setup(), we can easily reproduce the panic case.
In order to reduce the possibility of kernel panic when failed to get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate low memory as small as possible before plat_swiotlb_setup(), so make sparse_init() using top-down allocation.
--- arch/mips/kernel/setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/mips/kernel/setup.c +10 -0
@@ -653,7 +653,17 @@ static void __init arch_mem_init(char **cmdline_p) crashk_res.end - crashk_res.start + 1);#endif device_tree_init (); + +/* +* In order to reduce the possibility of kernel panic when failed to +* get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate +* low memory as small as possible before plat_swiotlb_setup(), so +* make sparse_init() using top-down allocation. +*/ +memblock_set_bottom_up (false);sparse_init (); +memblock_set_bottom_up (true); +plat_swiotlb_setup ();dma_contiguous_reserve (PFN_PHYS (max_low_pfn));
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 77/175 ath10k: add flush tx packets for SDIO chip
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit dd7fc5545bbafdbd6c1efdc996b61883b285bdc5 ]
When station connected to AP, and run TX traffic such as TCP/UDP, and system enter suspend state, then mac80211 call ath10k_flush with set drop flag, recently it only send wmi peer flush to firmware and firmware will flush all pending TX packets, for PCIe, firmware will indicate the TX packets status to ath10k, and then ath10k indicate to mac80211 TX complete with the status, then all the packets has been flushed at this moment. For SDIO chip, it is different, its TX complete indication is disabled by default, and it has a tx queue in ath10k, and its tx credit control is enabled, total tx credit is 96, when its credit is not sufficient, then the packets will buffered in the tx queue of ath10k, max packets is TARGET_TLV_NUM_MSDU_DESC_HL which is 1024, for SDIO, when mac80211 call ath10k_flush with set drop flag, maybe it have pending packets in tx queue of ath10k, and if it does not have sufficient tx credit, the packets will stay in queue untill tx credit report from firmware, if it is a noisy environment, tx speed is low and the tx credit report from firmware will delay more time, then the num_pending_tx will remain > 0 untill all packets send to firmware. After the 1st ath10k_flush, mac80211 will call the 2nd ath10k_flush without set drop flag immediately, then it will call to ath10k_mac_wait_tx_complete, and it wait untill num_pending_tx become to 0, in noisy environment, it is esay to wait about near 5 seconds, then it cause the suspend take long time.
1st and 2nd callstack of ath10k_flush
[ 303.740427] ath10k_sdio mmc1:0001:1: ath10k_flush drop:1, pending:0-0 [ 303.740495] ------------[ cut here ]------------ [ 303.740739] WARNING: CPU: 1 PID: 3921 at /mnt/host/source/src/third_party/kernel/v4.19/drivers/net/wireless/ath/ath10k/mac.c:7025 ath10k_flush+0x54/0x104 [ath10k_core] [ 303.740757] Modules linked in: bridge stp llc ath10k_sdio ath10k_core rfcomm uinput cros_ec_rpmsg mtk_seninf mtk_cam_isp mtk_vcodec_enc mtk_fd mtk_vcodec_dec mtk_vcodec_common mtk_dip mtk_mdp3 videobuf2_dma_contig videobuf2_memops v4l2_mem2mem videobuf2_v4l2 videobuf2_common hid_google_hammer hci_uart btqca bluetooth dw9768 ov8856 ecdh_generic ov02a10 v4l2_fwnode mtk_scp mtk_rpmsg rpmsg_core mtk_scp_ipi ipt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring cros_ec_sensors_sync cros_ec_light_prox cros_ec_sensors industrialio_triggered_buffer [ 303.740914] kfifo_buf cros_ec_activity cros_ec_sensors_core lzo_rle lzo_compress ath mac80211 zram cfg80211 joydev [last unloaded: ath10k_core] [ 303.741009] CPU: 1 PID: 3921 Comm: kworker/u16:10 Tainted: G W 4.19.95 #2 [ 303.741027] Hardware name: MediaTek krane sku176 board (DT) [ 303.741061] Workqueue: events_unbound async_run_entry_fn [ 303.741086] pstate: 60000005 (nZCv daif -PAN -UAO) [ 303.741166] pc : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.741244] lr : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.741260] sp : ffffffdf080e77a0 [ 303.741276] x29: ffffffdf080e77a0 x28: ffffffdef3730040 [ 303.741300] x27: ffffff907c2240a0 x26: ffffffde6ff39afc [ 303.741321] x25: ffffffdef3730040 x24: ffffff907bf61018 [ 303.741343] x23: ffffff907c2240a0 x22: ffffffde6ff39a50 [ 303.741364] x21: 0000000000000001 x20: ffffffde6ff39a50 [ 303.741385] x19: ffffffde6bac2420 x18: 0000000000017200 [ 303.741407] x17: ffffff907c24a000 x16: 0000000000000037 [ 303.741428] x15: ffffff907b49a568 x14: ffffff907cf332c1 [ 303.741476] x13: 00000000000922e4 x12: 0000000000000000 [ 303.741497] x11: 0000000000000001 x10: 0000000000000007 [ 303.741518] x9 : f2256b8c1de4bc00 x8 : f2256b8c1de4bc00 [ 303.741539] x7 : ffffff907ab5e764 x6 : 0000000000000000 [ 303.741560] x5 : 0000000000000080 x4 : 0000000000000001 [ 303.741582] x3 : ffffffdf080e74a8 x2 : ffffff907aa91244 [ 303.741603] x1 : ffffffdf080e74a8 x0 : 0000000000000024 [ 303.741624] Call trace: [ 303.741701] ath10k_flush+0x54/0x104 [ath10k_core] [ 303.741941] __ieee80211_flush_queues+0x1dc/0x358 [mac80211] [ 303.742098] ieee80211_flush_queues+0x34/0x44 [mac80211] [ 303.742253] ieee80211_set_disassoc+0xc0/0x5ec [mac80211] [ 303.742399] ieee80211_mgd_deauth+0x720/0x7d4 [mac80211] [ 303.742535] ieee80211_deauth+0x24/0x30 [mac80211] [ 303.742720] cfg80211_mlme_deauth+0x250/0x3bc [cfg80211] [ 303.742849] cfg80211_mlme_down+0x90/0xd0 [cfg80211] [ 303.742971] cfg80211_disconnect+0x340/0x3a0 [cfg80211] [ 303.743087] __cfg80211_leave+0xe4/0x17c [cfg80211] [ 303.743203] cfg80211_leave+0x38/0x50 [cfg80211] [ 303.743319] wiphy_suspend+0x84/0x5bc [cfg80211] [ 303.743335] dpm_run_callback+0x170/0x304 [ 303.743346] __device_suspend+0x2dc/0x3e8 [ 303.743356] async_suspend+0x2c/0xb0 [ 303.743370] async_run_entry_fn+0x48/0xf8 [ 303.743383] process_one_work+0x304/0x604 [ 303.743394] worker_thread+0x248/0x3f4 [ 303.743403] kthread+0x120/0x130 [ 303.743416] ret_from_fork+0x10/0x18
[ 303.743812] ath10k_sdio mmc1:0001:1: ath10k_flush drop:0, pending:0-0 [ 303.743858] ------------[ cut here ]------------ [ 303.744057] WARNING: CPU: 1 PID: 3921 at /mnt/host/source/src/third_party/kernel/v4.19/drivers/net/wireless/ath/ath10k/mac.c:7025 ath10k_flush+0x54/0x104 [ath10k_core] [ 303.744075] Modules linked in: bridge stp llc ath10k_sdio ath10k_core rfcomm uinput cros_ec_rpmsg mtk_seninf mtk_cam_isp mtk_vcodec_enc mtk_fd mtk_vcodec_dec mtk_vcodec_common mtk_dip mtk_mdp3 videobuf2_dma_contig videobuf2_memops v4l2_mem2mem videobuf2_v4l2 videobuf2_common hid_google_hammer hci_uart btqca bluetooth dw9768 ov8856 ecdh_generic ov02a10 v4l2_fwnode mtk_scp mtk_rpmsg rpmsg_core mtk_scp_ipi ipt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring cros_ec_sensors_sync cros_ec_light_prox cros_ec_sensors industrialio_triggered_buffer kfifo_buf cros_ec_activity cros_ec_sensors_core lzo_rle lzo_compress ath mac80211 zram cfg80211 joydev [last unloaded: ath10k_core] [ 303.744256] CPU: 1 PID: 3921 Comm: kworker/u16:10 Tainted: G W 4.19.95 #2 [ 303.744273] Hardware name: MediaTek krane sku176 board (DT) [ 303.744301] Workqueue: events_unbound async_run_entry_fn [ 303.744325] pstate: 60000005 (nZCv daif -PAN -UAO) [ 303.744403] pc : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.744480] lr : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.744496] sp : ffffffdf080e77a0 [ 303.744512] x29: ffffffdf080e77a0 x28: ffffffdef3730040 [ 303.744534] x27: ffffff907c2240a0 x26: ffffffde6ff39afc [ 303.744556] x25: ffffffdef3730040 x24: ffffff907bf61018 [ 303.744577] x23: ffffff907c2240a0 x22: ffffffde6ff39a50 [ 303.744598] x21: 0000000000000000 x20: ffffffde6ff39a50 [ 303.744620] x19: ffffffde6bac2420 x18: 000000000001831c [ 303.744641] x17: ffffff907c24a000 x16: 0000000000000037 [ 303.744662] x15: ffffff907b49a568 x14: ffffff907cf332c1 [ 303.744683] x13: 00000000000922ea x12: 0000000000000000 [ 303.744704] x11: 0000000000000001 x10: 0000000000000007 [ 303.744747] x9 : f2256b8c1de4bc00 x8 : f2256b8c1de4bc00 [ 303.744768] x7 : ffffff907ab5e764 x6 : 0000000000000000 [ 303.744789] x5 : 0000000000000080 x4 : 0000000000000001 [ 303.744810] x3 : ffffffdf080e74a8 x2 : ffffff907aa91244 [ 303.744831] x1 : ffffffdf080e74a8 x0 : 0000000000000024 [ 303.744853] Call trace: [ 303.744929] ath10k_flush+0x54/0x104 [ath10k_core] [ 303.745098] __ieee80211_flush_queues+0x1dc/0x358 [mac80211] [ 303.745277] ieee80211_flush_queues+0x34/0x44 [mac80211] [ 303.745424] ieee80211_set_disassoc+0x108/0x5ec [mac80211] [ 303.745569] ieee80211_mgd_deauth+0x720/0x7d4 [mac80211] [ 303.745706] ieee80211_deauth+0x24/0x30 [mac80211] [ 303.745853] cfg80211_mlme_deauth+0x250/0x3bc [cfg80211] [ 303.745979] cfg80211_mlme_down+0x90/0xd0 [cfg80211] [ 303.746103] cfg80211_disconnect+0x340/0x3a0 [cfg80211] [ 303.746219] __cfg80211_leave+0xe4/0x17c [cfg80211] [ 303.746335] cfg80211_leave+0x38/0x50 [cfg80211] [ 303.746452] wiphy_suspend+0x84/0x5bc [cfg80211] [ 303.746467] dpm_run_callback+0x170/0x304 [ 303.746477] __device_suspend+0x2dc/0x3e8 [ 303.746487] async_suspend+0x2c/0xb0 [ 303.746498] async_run_entry_fn+0x48/0xf8 [ 303.746510] process_one_work+0x304/0x604 [ 303.746521] worker_thread+0x248/0x3f4 [ 303.746530] kthread+0x120/0x130 [ 303.746542] ret_from_fork+0x10/0x18
one sample's debugging log: it wait 3190 ms(5000 - 1810).
1st ath10k_flush, it has 120 packets in tx queue of ath10k:
<...>-1513 [000] .... 25374.786005: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_flush drop:1, pending:120-0 <...>-1513 [000] ...1 25374.788375: ath10k_log_warn: ath10k_sdio mmc1:0001:1 ath10k_htt_tx_mgmt_inc_pending htt->num_pending_mgmt_tx:0 <...>-1500 [001] .... 25374.790143: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:121
2st ath10k_flush, it has 121 packets in tx queue of ath10k:
<...>-1513 [000] .... 25374.790571: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_flush drop:0, pending:121-0 <...>-1513 [000] .... 25374.791990: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_mac_wait_tx_complete state:1 pending:121-0 <...>-1508 [001] .... 25374.792696: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:46 <...>-1508 [001] .... 25374.792700: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:46 <...>-1508 [001] .... 25374.792729: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:121 <...>-1508 [001] .... 25374.792937: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:88, count:32, len:49792 <...>-1508 [001] .... 25374.793031: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:75, count:14, len:21784 kworker/u16:0-25773 [003] .... 25374.793701: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:46 <...>-1881 [000] .... 25375.073178: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:24 <...>-1881 [000] .... 25375.073182: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:24 <...>-1881 [000] .... 25375.073429: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:75 <...>-1879 [001] .... 25375.074090: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:24 <...>-1881 [000] .... 25375.074123: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:51, count:24, len:37344 <...>-1879 [001] .... 25375.270126: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:26 <...>-1879 [001] .... 25375.270130: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:26 <...>-1488 [000] .... 25375.270174: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:51 <...>-1488 [000] .... 25375.270529: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:25, count:26, len:40456 <...>-1879 [001] .... 25375.270693: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:26 <...>-1488 [001] .... 25377.775885: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:12 <...>-1488 [001] .... 25377.775890: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:12 <...>-1488 [001] .... 25377.775933: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:25 <...>-1488 [001] .... 25377.776059: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:13, count:12, len:18672 <...>-1879 [001] .... 25377.776100: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:12 <...>-1488 [001] .... 25377.878079: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:15 <...>-1488 [001] .... 25377.878087: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:15 <...>-1879 [000] .... 25377.878323: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:13 <...>-1879 [000] .... 25377.878487: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:0, count:13, len:20228 <...>-1879 [000] .... 25377.878497: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:13 <...>-1488 [001] .... 25377.919927: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:11 <...>-1488 [001] .... 25377.919932: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:13 <...>-1488 [001] .... 25377.919976: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:0 <...>-1881 [000] .... 25377.982645: ath10k_log_warn: ath10k_sdio mmc1:0001:1 HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION status:0 <...>-1513 [001] .... 25377.982973: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_mac_wait_tx_complete time_left:1810, pending:0-0
Flush all pending TX packets for the 1st ath10k_flush reduced the wait time of the 2nd ath10k_flush and then suspend take short time.
This Patch only effect SDIO chips.
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00042.
--- drivers/net/wireless/ath/ath10k/htt.h | 7 +++++++ drivers/net/wireless/ath/ath10k/htt_tx.c | 8 +++++++- drivers/net/wireless/ath/ath10k/mac.c | 1 + 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htt.h +7 -0
@@ -2033,6 +2033,7 @@ struct ath10k_htt_tx_ops {int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,u8 max_subfrms_ampdu,u8 max_subfrms_amsdu); +void (*htt_flush_tx)(struct ath10k_htt *htt); };static inline int ath10k_htt_send_rx_ring_cfg (struct ath10k_htt *htt)
@@ -2072,6 +2073,12 @@ static inline int ath10k_htt_tx(struct ath10k_htt *htt,return htt->tx_ops->htt_tx (htt, txmode, msdu); } +static inline void ath10k_htt_flush_tx (struct ath10k_htt *htt) +{ +if (htt->tx_ops->htt_flush_tx) + htt->tx_ops->htt_flush_tx (htt); +} +static inline int ath10k_htt_alloc_txbuff (struct ath10k_htt *htt) {if (!htt->tx_ops->htt_alloc_txbuff)
drivers/net/wireless/ath/ath10k/htt_tx.c +7 -1
@@ -529,9 +529,14 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt) htt->tx_mem_allocated = false; } -void ath10k_htt_tx_stop (struct ath10k_htt *htt) +static void ath10k_htt_flush_tx_queue (struct ath10k_htt *htt) {idr_for_each (&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); +} + +void ath10k_htt_tx_stop (struct ath10k_htt *htt) +{ +ath10k_htt_flush_tx_queue (htt);idr_destroy (&htt->pending_tx); }
@@ -1774,6 +1779,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_hl = { .htt_send_frag_desc_bank_cfg = ath10k_htt_send_frag_desc_bank_cfg_32, .htt_tx = ath10k_htt_tx_hl, .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_32, + .htt_flush_tx = ath10k_htt_flush_tx_queue, };void ath10k_htt_set_tx_ops (struct ath10k_htt *htt)
drivers/net/wireless/ath/ath10k/mac.c +1 -0
@@ -7082,6 +7082,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,ath10k_wmi_peer_flush (ar, arvif->vdev_id, arvif->bssid, bitmap); } +ath10k_htt_flush_tx (&ar->htt); }return ; }
Signature · 7 lines
2.25.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 78/175 Bluetooth: btbcm: Add 2 missing models to subver tables
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit c03ee9af4e07112bd3fc688daca9e654f41eca93 ]
Currently the bcm_uart_subver_ and bcm_usb_subver_table-s lack entries for the BCM4324B5 and BCM20703A1 chipsets. This makes the code use just "BCM" as prefix for the filename to pass to request-firmware, making it harder for users to figure out which firmware they need. This especially is problematic with the UART attached BCM4324B5 where this leads to the filename being just "BCM.hcd".
Add the 2 missing devices to subver tables. This has been tested on:
1. A Dell XPS15 9550 where this makes btbcm.c try to load "BCM20703A1-0a5c-6410.hcd" before it tries to load "BCM-0a5c-6410.hcd".
2. A Thinkpad 8 where this makes btbcm.c try to load "BCM4324B5.hcd" before it tries to load "BCM.hcd"
--- drivers/bluetooth/btbcm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btbcm.c +2 -0
@@ -329,6 +329,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = { { 0x410e, "BCM43341B0" }, /* 002.001.014 */ { 0x4204, "BCM2076B1" }, /* 002.002.004 */ { 0x4406, "BCM4324B3" }, /* 002.004.006 */ + { 0x4606, "BCM4324B5" }, /* 002.006.006 */ { 0x6109, "BCM4335C0" }, /* 003.001.009 */ { 0x610c, "BCM4354" }, /* 003.001.012 */ { 0x2122, "BCM4343A0" }, /* 001.001.034 */
@@ -343,6 +344,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = { };static const struct bcm_subver_table bcm_usb_subver_table[] = { + {0x2105 ,"BCM20703A1" },/* 001.001.005 */ {0x210b ,"BCM43142A0" },/* 001.001.011 */ {0x2112 ,"BCM4314A0" },/* 001.001.018 */ {0x2118 ,"BCM20702A0" },/* 001.001.024 */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 79/175 audit: fix a net reference leak in audit_list_rules_send()
In reply to Sasha LevinFrom: Paul Moore <[email protected]>
[ Upstream commit 3054d06719079388a543de6adb812638675ad8f5 ]
If audit_list_rules_send() fails when trying to create a new thread to send the rules it also fails to cleanup properly, leaking a reference to a net structure. This patch fixes the error patch and renames audit_send_list() to audit_send_list_thread() to better match its cousin, audit_send_reply_thread().
--- kernel/audit.c | 2 +- kernel/audit.h | 2 +- kernel/auditfilter.c | 16 +++++++--------- 3 files changed, 9 insertions(+), 11 deletions(-)
kernel/audit.c +1 -1
@@ -879,7 +879,7 @@ static int kauditd_thread(void *dummy)return 0 ; } -int audit_send_list (void *_dest) +int audit_send_list_thread (void *_dest) {struct audit_netlink_list *dest = _dest;struct sk_buff *skb;
kernel/audit.h +1 -1
@@ -229,7 +229,7 @@ struct audit_netlink_list {struct sk_buff_head q; }; -int audit_send_list (void *_dest); +int audit_send_list_thread (void *_dest);extern int selinux_audit_rule_update (void );
kernel/auditfilter.c +7 -9
@@ -1161,11 +1161,8 @@ int audit_rule_change(int type, int seq, void *data, size_t datasz)*/ int audit_list_rules_send (struct sk_buff *request_skb,int seq) { -u32 portid =NETLINK_CB (request_skb).portid; -struct net *net =sock_net (NETLINK_CB (request_skb).sk);struct task_struct *tsk;struct audit_netlink_list *dest; -int err =0 ;/* We can't just spew out the rules here because we might fill * the available socket buffer space and deadlock waiting for
@@ -1173,25 +1170,26 @@ int audit_list_rules_send(struct sk_buff *request_skb, int seq)* happen if we're actually running in the context of auditctl * trying to _send_ the stuff */ - dest =kmalloc (sizeof (struct audit_netlink_list ),GFP_KERNEL ); + dest =kmalloc (sizeof (*dest),GFP_KERNEL );if (!dest)return -ENOMEM ; - dest->net =get_net (net); - dest->portid = portid; + dest->net =get_net (sock_net (NETLINK_CB (request_skb).sk)); + dest->portid =NETLINK_CB (request_skb).portid;skb_queue_head_init (&dest->q);mutex_lock (&audit_filter_mutex);audit_list_rules (seq, &dest->q);mutex_unlock (&audit_filter_mutex); - tsk =kthread_run (audit_send_list, dest,"audit_send_list" ); + tsk =kthread_run (audit_send_list_thread, dest,"audit_send_list" );if (IS_ERR (tsk)) {skb_queue_purge (&dest->q); +put_net (dest->net);kfree (dest); - err =PTR_ERR (tsk); +return PTR_ERR (tsk); } -return err; +return 0 ; }int audit_comparator (u32 left,u32 op,u32 right)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 80/175 Drivers: hv: vmbus: Always handle the VMBus messages on CPU0
In reply to Sasha LevinFrom: "Andrea Parri (Microsoft)" <[email protected]>
[ Upstream commit 8a857c55420f29da4fc131adc22b12d474c48f4c ]
A Linux guest have to pick a "connect CPU" to communicate with the Hyper-V host. This CPU can not be taken offline because Hyper-V does not provide a way to change that CPU assignment.
Current code sets the connect CPU to whatever CPU ends up running the function vmbus_negotiate_version(), and this will generate problems if that CPU is taken offine.
Establish CPU0 as the connect CPU, and add logics to prevents the
connect CPU from being taken offline. We could pick some other CPU,
and we could pick that "other CPU" dynamically if there was a reason to do so at some point in the future. But for now, #defining the connect CPU to 0 is the most straightforward and least complex solution.
While on this, add inline comments explaining "why" offer and rescind messages should not be handled by a same serialized work queue.
--- drivers/hv/connection.c | 20 +------------------- drivers/hv/hv.c | 7 +++++++ drivers/hv/hyperv_vmbus.h | 11 ++++++----- drivers/hv/vmbus_drv.c | 20 +++++++++++++++++--- 4 files changed, 31 insertions(+), 27 deletions(-)
drivers/hv/connection.c +1 -19
@@ -67,7 +67,6 @@ static __u32 vmbus_get_next_version(__u32 current_version)int vmbus_negotiate_version (struct vmbus_channel_msginfo *msginfo,u32 version) {int ret =0 ; -unsigned int cur_cpu;struct vmbus_channel_initiate_contact *msg;unsigned long flags;
@@ -100,24 +99,7 @@ int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, u32 version) msg->monitor_page1 =virt_to_phys (vmbus_connection.monitor_pages[0 ]); msg->monitor_page2 =virt_to_phys (vmbus_connection.monitor_pages[1 ]); -/* -* We want all channel messages to be delivered on CPU 0. -* This has been the behavior pre-win8. This is not -* perf issue and having all channel messages delivered on CPU 0 -* would be ok. -* For post win8 hosts, we support receiving channel messagges on -* all the CPUs. This is needed for kexec to work correctly where -* the CPU attempting to connect may not be CPU 0. -*/ -if (version >=VERSION_WIN8_1 ) { - cur_cpu =get_cpu (); - msg->target_vcpu =hv_cpu_number_to_vp_number (cur_cpu); - vmbus_connection.connect_cpu = cur_cpu; -put_cpu (); - }else { - msg->target_vcpu =0 ; - vmbus_connection.connect_cpu =0 ; - } + msg->target_vcpu =hv_cpu_number_to_vp_number (VMBUS_CONNECT_CPU );/* * Add to list before we send the request since we may
drivers/hv/hv.c +7 -0
@@ -249,6 +249,13 @@ int hv_synic_cleanup(unsigned int cpu)bool channel_found = false;unsigned long flags; +/* +* Hyper-V does not provide a way to change the connect CPU once +* it is set; we must prevent the connect CPU from going offline. +*/ +if (cpu ==VMBUS_CONNECT_CPU ) +return -EBUSY ; +/* * Search for channels which are bound to the CPU we're about to * cleanup. In case we find one and vmbus is still connected we need to
drivers/hv/hyperv_vmbus.h +6 -5
@@ -212,12 +212,13 @@ enum vmbus_connect_state {#define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT -struct vmbus_connection { -/* -* CPU on which the initial host contact was made. -*/ -int connect_cpu; +/* +* The CPU that Hyper-V will interrupt for VMBUS messages, such as +* CHANNELMSG_OFFERCHANNEL and CHANNELMSG_RESCIND_CHANNELOFFER. +*/ +#define VMBUS_CONNECT_CPU 0 +struct vmbus_connection {u32 msg_conn_id;atomic_t offer_in_progress;
drivers/hv/vmbus_drv.c +17 -3
@@ -1092,14 +1092,28 @@ void vmbus_on_msg_dpc(unsigned long data)/* * If we are handling the rescind message; * schedule the work on the global work queue. +* +* The OFFER message and the RESCIND message should +* not be handled by the same serialized work queue, +* because the OFFER handler may call vmbus_open(), +* which tries to open the channel by sending an +* OPEN_CHANNEL message to the host and waits for +* the host's response; however, if the host has +* rescinded the channel before it receives the +* OPEN_CHANNEL message, the host just silently +* ignores the OPEN_CHANNEL message; as a result, +* the guest's OFFER handler hangs for ever, if we +* handle the RESCIND message in the same serialized +* work queue: the RESCIND handler can not start to +* run before the OFFER handler finishes. */ -schedule_work_on (vmbus_connection.connect_cpu, +schedule_work_on (VMBUS_CONNECT_CPU , &ctx->work);break ;case CHANNELMSG_OFFERCHANNEL :atomic_inc (&vmbus_connection.offer_in_progress); -queue_work_on (vmbus_connection.connect_cpu, +queue_work_on (VMBUS_CONNECT_CPU , vmbus_connection.work_queue, &ctx->work);break ;
@@ -1146,7 +1160,7 @@ static void vmbus_force_channel_rescinded(struct vmbus_channel *channel)INIT_WORK (&ctx->work, vmbus_onmessage_work); -queue_work_on (vmbus_connection.connect_cpu, +queue_work_on (VMBUS_CONNECT_CPU , vmbus_connection.work_queue, &ctx->work); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 81/175 dpaa2-eth: fix return codes used in ndo_setup_tc
In reply to Sasha LevinFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit b89c1e6bdc73f5775e118eb2ab778e75b262b30c ]
Drivers ndo_setup_tc call should return -EOPNOTSUPP, when it cannot support the qdisc type. Other return values will result in failing the qdisc setup. This lead to qdisc noop getting assigned, which will drop all TX packets on the interface.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +2 -2
@@ -1981,7 +1981,7 @@ static int dpaa2_eth_setup_tc(struct net_device *net_dev,int i;if (type !=TC_SETUP_QDISC_MQPRIO ) -return -EINVAL ; +return -EOPNOTSUPP ; mqprio->hw =TC_MQPRIO_HW_OFFLOAD_TCS ; num_queues =dpaa2_eth_queue_count (priv);
@@ -1993,7 +1993,7 @@ static int dpaa2_eth_setup_tc(struct net_device *net_dev,if (num_tc >dpaa2_eth_tc_count (priv)) {netdev_err (net_dev,"Max %d traffic classes supported\n" ,dpaa2_eth_tc_count (priv)); -return -EINVAL ; +return -EOPNOTSUPP ; }if (!num_tc) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 82/175 netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 0d7c83463fdf7841350f37960a7abadd3e650b41 ]
Instead of EINVAL which should be used for malformed netlink messages.
--- net/netfilter/nft_nat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_nat.c +2 -2
@@ -129,7 +129,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, priv->type =NF_NAT_MANIP_DST ;break ;default : -return -EINVAL ; +return -EOPNOTSUPP ; }if (tb[NFTA_NAT_FAMILY ] ==NULL )
@@ -196,7 +196,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,if (tb[NFTA_NAT_FLAGS ]) { priv->flags =ntohl (nla_get_be32 (tb[NFTA_NAT_FLAGS ]));if (priv->flags & ~NF_NAT_RANGE_MASK ) -return -EINVAL ; +return -EOPNOTSUPP ; }return nf_ct_netns_get (ctx->net, family);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 83/175 selftests/bpf: Fix memory leak in extract_build_id()
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 9f56bb531a809ecaa7f0ddca61d2cf3adc1cb81a ]
getline() allocates string, which has to be freed.
--- tools/testing/selftests/bpf/test_progs.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_progs.c +1 -0
@@ -293,6 +293,7 @@ int extract_build_id(char *build_id, size_t size) len = size;memcpy (build_id, line, len); build_id[len] ='\0' ; +free (line);return 0 ; err:fclose (fp);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 84/175 net: bcmgenet: set Rx mode before starting netif
In reply to Sasha LevinFrom: Doug Berger <[email protected]>
[ Upstream commit 72f96347628e73dbb61b307f18dd19293cc6792a ]
This commit explicitly calls the bcmgenet_set_rx_mode() function when the network interface is started. This function is normally called by ndo_set_rx_mode when the flags are changed, but apparently not when the driver is suspended and resumed.
This change ensures that address filtering or promiscuous mode are properly restored by the driver after the MAC may have been reset.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 -0
@@ -69,6 +69,9 @@#define GENET_RDMA_REG_OFF (priv->hw_params->rdma_offset + \ TOTAL_DESC * DMA_DESC_SIZE) +/* Forward declarations */ +static void bcmgenet_set_rx_mode (struct net_device *dev); +static inline void bcmgenet_writel (u32 value,void __iomem *offset) {/* MIPS chips strapped for BE will automagically configure the
@@ -2852,6 +2855,7 @@ static void bcmgenet_netif_start(struct net_device *dev)struct bcmgenet_priv *priv =netdev_priv (dev);/* Start the network engine */ +bcmgenet_set_rx_mode (dev);bcmgenet_enable_rx_napi (priv);umac_enable_set (priv,CMD_TX_EN |CMD_RX_EN , true);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 85/175 net: bcmgenet: Fix WoL with password after deep sleep
In reply to Sasha LevinFrom: Doug Berger <[email protected]>
[ Upstream commit 6f7689057a0f10a6c967b9f2759d7a3dc948b930 ]
Broadcom STB chips support a deep sleep mode where all register contents are lost. Because we were stashing the MagicPacket password into some of these registers a suspend into that deep sleep then a resumption would not lead to being able to wake-up from MagicPacket with password again.
Fix this by keeping a software copy of the password and program it during suspend.
--- .../net/ethernet/broadcom/genet/bcmgenet.h | 2 + .../ethernet/broadcom/genet/bcmgenet_wol.c | 39 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.h +2 -0
@@ -14,6 +14,7 @@#include <linux/if_vlan.h> #include <linux/phy.h> #include <linux/dim.h> +#include <linux/ethtool.h> /* total number of Buffer Descriptors, same for Rx/Tx */ #define TOTAL_DESC 256
@@ -674,6 +675,7 @@ struct bcmgenet_priv {/* WOL */ struct clk *clk_wol;u32 wolopts; +u8 sopass[SOPASS_MAX ];struct bcmgenet_mib_counters mib;
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +18 -21
@@ -41,18 +41,13 @@void bcmgenet_get_wol (struct net_device *dev,struct ethtool_wolinfo *wol) {struct bcmgenet_priv *priv =netdev_priv (dev); -u32 reg; wol->supported =WAKE_MAGIC |WAKE_MAGICSECURE ; wol->wolopts = priv->wolopts;memset (wol->sopass,0 ,sizeof (wol->sopass)); -if (wol->wolopts &WAKE_MAGICSECURE ) { - reg =bcmgenet_umac_readl (priv,UMAC_MPD_PW_MS ); -put_unaligned_be16 (reg, &wol->sopass[0 ]); - reg =bcmgenet_umac_readl (priv,UMAC_MPD_PW_LS ); -put_unaligned_be32 (reg, &wol->sopass[2 ]); - } +if (wol->wolopts &WAKE_MAGICSECURE ) +memcpy (wol->sopass, priv->sopass,sizeof (priv->sopass)); }/* ethtool function - set WOL (Wake on LAN) settings.
@@ -62,7 +57,6 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) {struct bcmgenet_priv *priv =netdev_priv (dev);struct device *kdev = &priv->pdev->dev; -u32 reg;if (!device_can_wakeup (kdev))return -ENOTSUPP ;
@@ -70,17 +64,8 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)if (wol->wolopts & ~(WAKE_MAGIC |WAKE_MAGICSECURE ))return -EINVAL ; - reg =bcmgenet_umac_readl (priv,UMAC_MPD_CTRL ); -if (wol->wolopts &WAKE_MAGICSECURE ) { -bcmgenet_umac_writel (priv,get_unaligned_be16 (&wol->sopass[0 ]), -UMAC_MPD_PW_MS ); -bcmgenet_umac_writel (priv,get_unaligned_be32 (&wol->sopass[2 ]), -UMAC_MPD_PW_LS ); - reg |=MPD_PW_EN ; - }else { - reg &= ~MPD_PW_EN ; - } -bcmgenet_umac_writel (priv, reg,UMAC_MPD_CTRL ); +if (wol->wolopts &WAKE_MAGICSECURE ) +memcpy (priv->sopass, wol->sopass,sizeof (priv->sopass));/* Flag the device and relevant IRQ as wakeup capable */ if (wol->wolopts) {
@@ -120,6 +105,14 @@ static int bcmgenet_poll_wol_status(struct bcmgenet_priv *priv)return retries; } +static void bcmgenet_set_mpd_password (struct bcmgenet_priv *priv) +{ +bcmgenet_umac_writel (priv,get_unaligned_be16 (&priv->sopass[0 ]), +UMAC_MPD_PW_MS ); +bcmgenet_umac_writel (priv,get_unaligned_be32 (&priv->sopass[2 ]), +UMAC_MPD_PW_LS ); +} +int bcmgenet_wol_power_down_cfg (struct bcmgenet_priv *priv,enum bcmgenet_power_mode mode) {
@@ -140,13 +133,17 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv, reg =bcmgenet_umac_readl (priv,UMAC_MPD_CTRL ); reg |=MPD_EN ; +if (priv->wolopts &WAKE_MAGICSECURE ) { +bcmgenet_set_mpd_password (priv); + reg |=MPD_PW_EN ; + }bcmgenet_umac_writel (priv, reg,UMAC_MPD_CTRL );/* Do not leave UniMAC in MPD mode only */ retries =bcmgenet_poll_wol_status (priv);if (retries <0 ) { reg =bcmgenet_umac_readl (priv,UMAC_MPD_CTRL ); - reg &= ~MPD_EN ; + reg &= ~(MPD_EN |MPD_PW_EN );bcmgenet_umac_writel (priv, reg,UMAC_MPD_CTRL );return retries; }
@@ -185,7 +182,7 @@ void bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv, reg =bcmgenet_umac_readl (priv,UMAC_MPD_CTRL );if (!(reg &MPD_EN ))return ;/* already powered up so skip the rest */ - reg &= ~MPD_EN ; + reg &= ~(MPD_EN |MPD_PW_EN );bcmgenet_umac_writel (priv, reg,UMAC_MPD_CTRL );/* Disable CRC Forward */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 86/175 lib/mpi: Fix 64-bit MIPS build with Clang
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 18f1ca46858eac22437819937ae44aa9a8f9f2fa ]
When building 64r6_defconfig with CONFIG_MIPS32_O32 disabled and CONFIG_CRYPTO_RSA enabled:
lib/mpi/generic_mpih-mul1.c:37:24: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/mpi/longlong.h:664:22: note: expanded from macro 'umul_ppmm'
: "=d" ((UDItype)(w0))
~~~~~~~~~~^~~
lib/mpi/generic_mpih-mul1.c:37:13: error: invalid use of a cast in a
inline asm context requiring an l-value: remove the cast
or build with -fheinous-gnu-extensions
umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/mpi/longlong.h:668:22: note: expanded from macro 'umul_ppmm'
: "=d" ((UDItype)(w1))
~~~~~~~~~~^~~2 errors generated.
This special case for umul_ppmm for MIPS64r6 was added in commit bbc25bee37d2b ("lib/mpi: Fix umul_ppmm() for MIPS64r6"), due to GCC being inefficient and emitting a __multi3 intrinsic.
There is no such issue with clang; with this patch applied, I can build this configuration without any problems and there are no link errors like mentioned in the commit above (which I can still reproduce with GCC 9.3.0 when that commit is reverted). Only use this definition when GCC is being used.
This really should have been caught by commit b0c091ae04f67 ("lib/mpi:
Eliminate unused umul_ppmm definitions for MIPS") when I was messing around in this area but I was not testing 64-bit MIPS at the time.
--- lib/mpi/longlong.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mpi/longlong.h +1 -1
@@ -653,7 +653,7 @@ do { \************** MIPS/64 ************** ***************************************/ #if (defined(__mips) && __mips >=3 ) &&W_TYPE_SIZE ==64 -#if defined(__mips_isa_rev) && __mips_isa_rev >=6 +#if defined(__mips_isa_rev) && __mips_isa_rev >=6 && defined(CONFIG_CC_IS_GCC )/* * GCC ends up emitting a __multi3 intrinsic call for MIPS64r6 with the plain C * code below, so we special case MIPS64r6 until the compiler can do better.
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 87/175 perf: Add cond_resched() to task_function_call()
In reply to Sasha LevinFrom: Barret Rhoden <[email protected]>
[ Upstream commit 2ed6edd33a214bca02bd2b45e3fc3038a059436b ]
Under rare circumstances, task_function_call() can repeatedly fail and cause a soft lockup.
There is a slight race where the process is no longer running on the cpu we targeted by the time remote_function() runs. The code will simply try again. If we are very unlucky, this will continue to fail, until a watchdog fires. This can happen in a heavily loaded, multi-core virtual machine.
--- kernel/events/core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
kernel/events/core.c +14 -9
@@ -93,11 +93,11 @@ static void remote_function(void *data)* @info: the function call argument * * Calls the function @func when the task is currently running. This might -* be on the current CPU, which just calls the function directly +* be on the current CPU, which just calls the function directly. This will +* retry due to any failures in smp_call_function_single(), such as if the +* task_cpu() goes offline concurrently. * -* returns: @func return value, or -* -ESRCH - when the process isn't running -* -EAGAIN - when the process moved away +* returns @func return value or -ESRCH when the process isn't running */ static int task_function_call (struct task_struct *p,remote_function_f func,void *info)
@@ -110,11 +110,16 @@ task_function_call(struct task_struct *p, remote_function_f func, void *info) };int ret; -do { - ret =smp_call_function_single (task_cpu (p), remote_function, &data,1 ); -if (!ret) - ret = data.ret; - }while (ret == -EAGAIN ); +for (;;) { + ret =smp_call_function_single (task_cpu (p), remote_function, + &data,1 ); + ret = !ret ? data.ret : -EAGAIN ; + +if (ret != -EAGAIN ) +break ; + +cond_resched (); + }return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 88/175 exit: Move preemption fixup up, move blocking operations down
In reply to Sasha LevinFrom: Jann Horn <[email protected]>
[ Upstream commit 586b58cac8b4683eb58a1446fbc399de18974e40 ]
With CONFIG_DEBUG_ATOMIC_SLEEP=y and CONFIG_CGROUPS=y, kernel oopses in non-preemptible context look untidy; after the main oops, the kernel prints a "sleeping function called from invalid context" report because exit_signals() -> cgroup_threadgroup_change_begin() -> percpu_down_read() can sleep, and that happens before the preempt_count_set(PREEMPT_ENABLED) fixup.
It looks like the same thing applies to profile_task_exit() and kcov_task_exit().
Fix it by moving the preemption fixup up and the calls to profile_task_exit() and kcov_task_exit() down.
--- kernel/exit.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
kernel/exit.c +16 -9
@@ -713,8 +713,12 @@ void __noreturn do_exit(long code)struct task_struct *tsk = current;int group_dead; -profile_task_exit (tsk); -kcov_task_exit (tsk); +/* +* We can get here from a kernel oops, sometimes with preemption off. +* Start by checking for critical errors. +* Then fix up important state like USER_DS and preemption. +* Then do everything else. +*/ WARN_ON (blk_needs_flush_plug (tsk));
@@ -732,6 +736,16 @@ void __noreturn do_exit(long code)*/ set_fs (USER_DS ); +if (unlikely (in_atomic ())) { +pr_info ("note: %s[%d] exited with preempt_count %d\n" , + current->comm,task_pid_nr (current), +preempt_count ()); +preempt_count_set (PREEMPT_ENABLED ); + } + +profile_task_exit (tsk); +kcov_task_exit (tsk); +ptrace_event (PTRACE_EVENT_EXIT , code);validate_creds_for_do_exit (tsk);
@@ -749,13 +763,6 @@ void __noreturn do_exit(long code)exit_signals (tsk);/* sets PF_EXITING */ -if (unlikely (in_atomic ())) { -pr_info ("note: %s[%d] exited with preempt_count %d\n" , - current->comm,task_pid_nr (current), -preempt_count ()); -preempt_count_set (PREEMPT_ENABLED ); - } -/* sync mm's RSS info before statistics gathering */ if (tsk->mm)sync_mm_rss (tsk->mm);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 89/175 sched/core: Fix illegal RCU from offline CPUs
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit bf2c59fce4074e55d622089b34be3a6bc95484fb ]
In the CPU-offline process, it calls mmdrop() after idle entry and the subsequent call to cpuhp_report_idle_dead(). Once execution passes the call to rcu_report_dead(), RCU is ignoring the CPU, which results in lockdep complaining when mmdrop() uses RCU from either memcg or debugobjects below.
Fix it by cleaning up the active_mm state from BP instead. Every arch which has CONFIG_HOTPLUG_CPU should have already called idle_task_exit() from AP. The only exception is parisc because it switches them to &init_mm unconditionally (see smp_boot_one_cpu() and smp_cpu_init()), but the patch will still work there because it calls mmgrab(&init_mm) in smp_cpu_init() and then should call mmdrop(&init_mm) in finish_cpu().
WARNING: suspicious RCU usage
-----------------------------
kernel/workqueue.c:710 RCU or wq_pool_mutex should be held!
other info that might help us debug this:
RCU used illegally from offline CPU!
Call Trace: dump_stack+0xf4/0x164 (unreliable) lockdep_rcu_suspicious+0x140/0x164 get_work_pool+0x110/0x150 __queue_work+0x1bc/0xca0 queue_work_on+0x114/0x120 css_release+0x9c/0xc0 percpu_ref_put_many+0x204/0x230 free_pcp_prepare+0x264/0x570 free_unref_page+0x38/0xf0 __mmdrop+0x21c/0x2c0 idle_task_exit+0x170/0x1b0 pnv_smp_cpu_kill_self+0x38/0x2e0 cpu_die+0x48/0x64 arch_cpu_idle_dead+0x30/0x50 do_idle+0x2f4/0x470 cpu_startup_entry+0x38/0x40 start_secondary+0x7a8/0xa80 start_secondary_resume+0x10/0x14
--- arch/powerpc/platforms/powernv/smp.c | 1 - include/linux/sched/mm.h | 2 ++ kernel/cpu.c | 18 +++++++++++++++++- kernel/sched/core.c | 5 +++-- 4 files changed, 22 insertions(+), 4 deletions(-)
arch/powerpc/platforms/powernv/smp.c +0 -1
@@ -167,7 +167,6 @@ static void pnv_smp_cpu_kill_self(void)/* Standard hot unplug procedure */ idle_task_exit (); - current->active_mm =NULL ;/* for sanity */ cpu =smp_processor_id ();DBG ("CPU%d offline\n" , cpu);generic_set_cpu_dead (cpu);
include/linux/sched/mm.h +2 -0
@@ -49,6 +49,8 @@ static inline void mmdrop(struct mm_struct *mm)__mmdrop (mm); } +void mmdrop (struct mm_struct *mm); +/* * This has to be called after a get_task_mm()/mmget_not_zero() * followed by taking the mmap_sem for writing before modifying the
kernel/cpu.c +17 -1
@@ -3,6 +3,7 @@* * This code is licenced under the GPL. */ +#include <linux/sched/mm.h> #include <linux/proc_fs.h> #include <linux/smp.h> #include <linux/init.h>
@@ -564,6 +565,21 @@ static int bringup_cpu(unsigned int cpu)return bringup_wait_for_ap (cpu); } +static int finish_cpu (unsigned int cpu) +{ +struct task_struct *idle =idle_thread_get (cpu); +struct mm_struct *mm = idle->active_mm; + +/* +* idle_task_exit() will have switched to &init_mm, now +* clean up any remaining active_mm state. +*/ +if (mm != &init_mm) + idle->active_mm = &init_mm; +mmdrop (mm); +return 0 ; +} +/* * Hotplug state machine related functions */
@@ -1434,7 +1450,7 @@ static struct cpuhp_step cpuhp_hp_states[] = { [CPUHP_BRINGUP_CPU] = { .name = "cpu:bringup", .startup.single = bringup_cpu, - .teardown.single = NULL, + .teardown.single = finish_cpu, .cant_stop = true, },/* Final state before CPU kills itself */
kernel/sched/core.c +3 -2
@@ -6177,13 +6177,14 @@ void idle_task_exit(void)struct mm_struct *mm = current->active_mm;BUG_ON (cpu_online (smp_processor_id ())); +BUG_ON (current !=this_rq ()->idle);if (mm != &init_mm) {switch_mm (mm, &init_mm, current); - current->active_mm = &init_mm;finish_arch_post_lock_switch (); } -mmdrop (mm); + +/* finish_cpu(), as ran on the BP, will clean up the active_mm state */ }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 90/175 drivers/perf: hisi: Fix typo in events attribute array
In reply to Sasha LevinFrom: Shaokun Zhang <[email protected]>
[ Upstream commit 88562f06ebf56587788783e5420f25fde3ca36c8 ]
Fix up one typo: wr_dr_64b -> wr_ddr_64b.
--- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c +1 -1
@@ -285,7 +285,7 @@ static struct attribute *hisi_hha_pmu_events_attr[] = {HISI_PMU_EVENT_ATTR (rx_wbip,0x05 ),HISI_PMU_EVENT_ATTR (rx_wtistash,0x11 ),HISI_PMU_EVENT_ATTR (rd_ddr_64b,0x1c ), -HISI_PMU_EVENT_ATTR (wr_dr_64b,0x1d ), +HISI_PMU_EVENT_ATTR (wr_ddr_64b,0x1d ),HISI_PMU_EVENT_ATTR (rd_ddr_128b,0x1e ),HISI_PMU_EVENT_ATTR (wr_ddr_128b,0x1f ), HISI_PMU_EVENT_ATTR(spill_num, 0x20),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 91/175 iocost_monitor: drop string wrap around numbers when outputting json
In reply to Sasha LevinFrom: Tejun Heo <[email protected]>
[ Upstream commit 21f3cfeab304fc07b90d93d98d4d2f62110fe6b2 ]
Wrapping numbers in strings is used by some to work around bit-width issues in some enviroments. The problem isn't innate to json and the workaround seems to cause more integration problems than help. Let's drop the string wrapping.
--- tools/cgroup/iocost_monitor.py | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-)
tools/cgroup/iocost_monitor.py +21 -21
@@ -112,14 +112,14 @@ class IocStat: def dict(self, now): return { 'device' : devname, - 'timestamp' : str(now), - 'enabled' : str(int(self.enabled)), - 'running' : str(int(self.running)), - 'period_ms' : str(self.period_ms), - 'period_at' : str(self.period_at), - 'period_vtime_at' : str(self.vperiod_at), - 'busy_level' : str(self.busy_level), - 'vrate_pct' : str(self.vrate_pct), } + 'timestamp' : now, + 'enabled' : self.enabled, + 'running' : self.running, + 'period_ms' : self.period_ms, + 'period_at' : self.period_at, + 'period_vtime_at' : self.vperiod_at, + 'busy_level' : self.busy_level, + 'vrate_pct' : self.vrate_pct, } def table_preamble_str(self): state = ('RUN' if self.running else 'IDLE') if self.enabled else 'OFF'
@@ -179,19 +179,19 @@ class IocgStat: def dict(self, now, path): out = { 'cgroup' : path, - 'timestamp' : str(now), - 'is_active' : str(int(self.is_active)), - 'weight' : str(self.weight), - 'weight_active' : str(self.active), - 'weight_inuse' : str(self.inuse), - 'hweight_active_pct' : str(self.hwa_pct), - 'hweight_inuse_pct' : str(self.hwi_pct), - 'inflight_pct' : str(self.inflight_pct), - 'debt_ms' : str(self.debt_ms), - 'use_delay' : str(self.use_delay), - 'delay_ms' : str(self.delay_ms), - 'usage_pct' : str(self.usage), - 'address' : str(hex(self.address)) } + 'timestamp' : now, + 'is_active' : self.is_active, + 'weight' : self.weight, + 'weight_active' : self.active, + 'weight_inuse' : self.inuse, + 'hweight_active_pct' : self.hwa_pct, + 'hweight_inuse_pct' : self.hwi_pct, + 'inflight_pct' : self.inflight_pct, + 'debt_ms' : self.debt_ms, + 'use_delay' : self.use_delay, + 'delay_ms' : self.delay_ms, + 'usage_pct' : self.usage, + 'address' : self.address } for i in range(len(self.usages)): out[f'usage_pct_{i}'] = str(self.usages[i]) return out
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 92/175 net: lpc-enet: fix error return code in lpc_mii_init()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 88ec7cb22ddde725ed4ce15991f0bd9dd817fd85 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/net/ethernet/nxp/lpc_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/nxp/lpc_eth.c +2 -1
@@ -815,7 +815,8 @@ static int lpc_mii_init(struct netdata_local *pldat)if (mdiobus_register (pldat->mii_bus)) goto err_out_unregister_bus; -if (lpc_mii_probe (pldat->ndev) !=0 ) + err =lpc_mii_probe (pldat->ndev); +if (err) goto err_out_unregister_bus;return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 93/175 selinux: fix error return code in policydb_read()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 4c09f8b6913a779ca0c70ea8058bf21537eebb3b ]
Fix to return negative error code -ENOMEM from the kvcalloc() error handling case instead of 0, as done elsewhere in this function.
--- security/selinux/ss/policydb.c | 1 + 1 file changed, 1 insertion(+)
security/selinux/ss/policydb.c +1 -0
@@ -2496,6 +2496,7 @@ int policydb_read(struct policydb *p, void *fp)if (rc) goto bad; + rc = -ENOMEM ; p->type_attr_map_array =kvcalloc (p->p_types.nprim,sizeof (*p->type_attr_map_array),GFP_KERNEL );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 94/175 drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit e00edb4efbbc07425441a3be2aa87abaf5800d96 ]
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference since devm_ioremap() does not check input parameters for null.
This is detected by Coccinelle semantic patch.
@@
expression pdev, res, n, t, e, e1, e2;
@@
res = \(platform_get_resource\|platform_get_resource_byname\)(pdev, t, n);
+ if (!res)
+ return -EINVAL;
... when != res == NULL
e = devm_ioremap(e1, res->start, e2);
--- drivers/net/ethernet/ti/davinci_mdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/ti/davinci_mdio.c +2 -0
@@ -397,6 +397,8 @@ static int davinci_mdio_probe(struct platform_device *pdev) data->dev = dev; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -EINVAL ; data->regs =devm_ioremap (dev, res->start,resource_size (res));if (!data->regs)return -ENOMEM ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 95/175 media: cec: silence shift wrapping warning in __cec_s_log_addrs()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3b5af3171e2d5a73ae6f04965ed653d039904eb6 ]
The log_addrs->log_addr_type[i] value is a u8 which is controlled by the user and comes from the ioctl. If it's over 31 then that results in undefined behavior (shift wrapping) and that leads to a Smatch static checker warning. We already cap the value later so we can silence the warning just by re-ordering the existing checks.
I think the UBSan checker will also catch this bug at runtime and generate a warning. But otherwise the bug is harmless.
--- drivers/media/cec/cec-adap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/cec/cec-adap.c +4 -4
@@ -1732,6 +1732,10 @@ int __cec_s_log_addrs(struct cec_adapter *adap,unsigned j; log_addrs->log_addr[i] =CEC_LOG_ADDR_INVALID ; +if (log_addrs->log_addr_type[i] >CEC_LOG_ADDR_TYPE_UNREGISTERED ) { +dprintk (1 ,"unknown logical address type\n" ); +return -EINVAL ; + }if (type_mask & (1 << log_addrs->log_addr_type[i])) {dprintk (1 ,"duplicate logical address type\n" );return -EINVAL ;
@@ -1752,10 +1756,6 @@ int __cec_s_log_addrs(struct cec_adapter *adap,dprintk (1 ,"invalid primary device type\n" );return -EINVAL ; } -if (log_addrs->log_addr_type[i] >CEC_LOG_ADDR_TYPE_UNREGISTERED ) { -dprintk (1 ,"unknown logical address type\n" ); -return -EINVAL ; - }for (j =0 ; j < feature_sz; j++) {if ((features[j] &0x80 ) ==0 ) {if (op_is_dev_features)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 96/175 net: allwinner: Fix use correct return type for ndo_start_xmit()
In reply to Sasha LevinFrom: Yunjian Wang <[email protected]>
[ Upstream commit 09f6c44aaae0f1bdb8b983d7762676d5018c53bc ]
The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix the ndo function to use the correct type. And emac_start_xmit() can leak one skb if 'channel' == 3.
--- drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/allwinner/sun4i-emac.c +2 -2
@@ -432,7 +432,7 @@ static void emac_timeout(struct net_device *dev)/* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int emac_start_xmit (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t emac_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct emac_board_info *db =netdev_priv (dev);unsigned long channel;
@@ -440,7 +440,7 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) channel = db->tx_fifo_stat &3 ;if (channel ==3 ) -return 1 ; +return NETDEV_TX_BUSY ; channel = (channel ==1 ?1 :0 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 97/175 powerpc/spufs: fix copy_to_user while atomic
In reply to Sasha LevinFrom: Jeremy Kerr <[email protected]>
[ Upstream commit 88413a6bfbbe2f648df399b62f85c934460b7a4d ]
Currently, we may perform a copy_to_user (through simple_read_from_buffer()) while holding a context's register_lock, while accessing the context save area.
This change uses a temporary buffer for the context save area data, which we then pass to simple_read_from_buffer.
Includes changes from Christoph Hellwig <[email protected]>.
--- arch/powerpc/platforms/cell/spufs/file.c | 113 +++++++++++++++-------- 1 file changed, 75 insertions(+), 38 deletions(-)
arch/powerpc/platforms/cell/spufs/file.c +75 -38
@@ -1978,8 +1978,9 @@ static ssize_t __spufs_mbox_info_read(struct spu_context *ctx,static ssize_t spufs_mbox_info_read (struct file *file,char __user *buf,size_t len,loff_t *pos) { -int ret;struct spu_context *ctx = file->private_data; +u32 stat, data; +int ret;if (!access_ok (buf, len))return -EFAULT ;
@@ -1988,11 +1989,16 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,if (ret)return ret;spin_lock (&ctx->csa.register_lock); - ret =__spufs_mbox_info_read (ctx, buf, len, pos); + stat = ctx->csa.prob.mb_stat_R; + data = ctx->csa.prob.pu_mb_R;spin_unlock (&ctx->csa.register_lock);spu_release_saved (ctx); -return ret; +/* EOF if there's no entry in the mbox */ +if (!(stat &0x0000ff )) +return 0 ; + +return simple_read_from_buffer (buf, len, pos, &data,sizeof (data)); }static const struct file_operations spufs_mbox_info_fops = {
@@ -2019,6 +2025,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; +u32 stat, data;int ret;if (!access_ok (buf, len))
@@ -2028,11 +2035,16 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,if (ret)return ret;spin_lock (&ctx->csa.register_lock); - ret =__spufs_ibox_info_read (ctx, buf, len, pos); + stat = ctx->csa.prob.mb_stat_R; + data = ctx->csa.priv2.puint_mb_R;spin_unlock (&ctx->csa.register_lock);spu_release_saved (ctx); -return ret; +/* EOF if there's no entry in the ibox */ +if (!(stat &0xff0000 )) +return 0 ; + +return simple_read_from_buffer (buf, len, pos, &data,sizeof (data)); }static const struct file_operations spufs_ibox_info_fops = {
@@ -2041,6 +2053,11 @@ static const struct file_operations spufs_ibox_info_fops = { .llseek = generic_file_llseek, }; +static size_t spufs_wbox_info_cnt (struct spu_context *ctx) +{ +return (4 - ((ctx->csa.prob.mb_stat_R &0x00ff00 ) >>8 )) *sizeof (u32); +} +static ssize_t __spufs_wbox_info_read (struct spu_context *ctx,char __user *buf,size_t len,loff_t *pos) {
@@ -2049,7 +2066,7 @@ static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,u32 wbox_stat; wbox_stat = ctx->csa.prob.mb_stat_R; - cnt =4 - ((wbox_stat &0x00ff00 ) >>8 ); + cnt =spufs_wbox_info_cnt (ctx);for (i =0 ; i < cnt; i++) { data[i] = ctx->csa.spu_mailbox_data[i]; }
@@ -2062,7 +2079,8 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; -int ret; +u32 data[ARRAY_SIZE (ctx->csa.spu_mailbox_data)]; +int ret, count;if (!access_ok (buf, len))return -EFAULT ;
@@ -2071,11 +2089,13 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,if (ret)return ret;spin_lock (&ctx->csa.register_lock); - ret =__spufs_wbox_info_read (ctx, buf, len, pos); + count =spufs_wbox_info_cnt (ctx); +memcpy (&data, &ctx->csa.spu_mailbox_data,sizeof (data));spin_unlock (&ctx->csa.register_lock);spu_release_saved (ctx); -return ret; +return simple_read_from_buffer (buf, len, pos, &data, + count *sizeof (u32)); }static const struct file_operations spufs_wbox_info_fops = {
@@ -2084,27 +2104,33 @@ static const struct file_operations spufs_wbox_info_fops = { .llseek = generic_file_llseek, }; -static ssize_t __spufs_dma_info_read (struct spu_context *ctx, -char __user *buf,size_t len,loff_t *pos) +static void spufs_get_dma_info (struct spu_context *ctx, +struct spu_dma_info *info) { -struct spu_dma_info info; -struct mfc_cq_sr *qp, *spuqp;int i; - info.dma_info_type = ctx->csa.priv2.spu_tag_status_query_RW; - info.dma_info_mask = ctx->csa.lscsa->tag_mask.slot[0 ]; - info.dma_info_status = ctx->csa.spu_chnldata_RW[24 ]; - info.dma_info_stall_and_notify = ctx->csa.spu_chnldata_RW[25 ]; - info.dma_info_atomic_command_status = ctx->csa.spu_chnldata_RW[27 ]; + info->dma_info_type = ctx->csa.priv2.spu_tag_status_query_RW; + info->dma_info_mask = ctx->csa.lscsa->tag_mask.slot[0 ]; + info->dma_info_status = ctx->csa.spu_chnldata_RW[24 ]; + info->dma_info_stall_and_notify = ctx->csa.spu_chnldata_RW[25 ]; + info->dma_info_atomic_command_status = ctx->csa.spu_chnldata_RW[27 ];for (i =0 ; i <16 ; i++) { - qp = &info.dma_info_command_data[i]; - spuqp = &ctx->csa.priv2.spuq[i]; +struct mfc_cq_sr *qp = &info->dma_info_command_data[i]; +struct mfc_cq_sr *spuqp = &ctx->csa.priv2.spuq[i]; qp->mfc_cq_data0_RW = spuqp->mfc_cq_data0_RW; qp->mfc_cq_data1_RW = spuqp->mfc_cq_data1_RW; qp->mfc_cq_data2_RW = spuqp->mfc_cq_data2_RW; qp->mfc_cq_data3_RW = spuqp->mfc_cq_data3_RW; } +} + +static ssize_t __spufs_dma_info_read (struct spu_context *ctx, +char __user *buf,size_t len,loff_t *pos) +{ +struct spu_dma_info info; + +spufs_get_dma_info (ctx, &info);return simple_read_from_buffer (buf, len, pos, &info,sizeof info);
@@ -2114,6 +2140,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; +struct spu_dma_info info;int ret;if (!access_ok (buf, len))
@@ -2123,11 +2150,12 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,if (ret)return ret;spin_lock (&ctx->csa.register_lock); - ret =__spufs_dma_info_read (ctx, buf, len, pos); +spufs_get_dma_info (ctx, &info);spin_unlock (&ctx->csa.register_lock);spu_release_saved (ctx); -return ret; +return simple_read_from_buffer (buf, len, pos, &info, +sizeof (info)); }static const struct file_operations spufs_dma_info_fops = {
@@ -2136,13 +2164,31 @@ static const struct file_operations spufs_dma_info_fops = { .llseek = no_llseek, }; +static void spufs_get_proxydma_info (struct spu_context *ctx, +struct spu_proxydma_info *info) +{ +int i; + + info->proxydma_info_type = ctx->csa.prob.dma_querytype_RW; + info->proxydma_info_mask = ctx->csa.prob.dma_querymask_RW; + info->proxydma_info_status = ctx->csa.prob.dma_tagstatus_R; + +for (i =0 ; i <8 ; i++) { +struct mfc_cq_sr *qp = &info->proxydma_info_command_data[i]; +struct mfc_cq_sr *puqp = &ctx->csa.priv2.puq[i]; + + qp->mfc_cq_data0_RW = puqp->mfc_cq_data0_RW; + qp->mfc_cq_data1_RW = puqp->mfc_cq_data1_RW; + qp->mfc_cq_data2_RW = puqp->mfc_cq_data2_RW; + qp->mfc_cq_data3_RW = puqp->mfc_cq_data3_RW; + } +} +static ssize_t __spufs_proxydma_info_read (struct spu_context *ctx,char __user *buf,size_t len,loff_t *pos) {struct spu_proxydma_info info; -struct mfc_cq_sr *qp, *puqp;int ret =sizeof info; -int i;if (len < ret)return -EINVAL ;
@@ -2150,18 +2196,7 @@ static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,if (!access_ok (buf, len))return -EFAULT ; - info.proxydma_info_type = ctx->csa.prob.dma_querytype_RW; - info.proxydma_info_mask = ctx->csa.prob.dma_querymask_RW; - info.proxydma_info_status = ctx->csa.prob.dma_tagstatus_R; -for (i =0 ; i <8 ; i++) { - qp = &info.proxydma_info_command_data[i]; - puqp = &ctx->csa.priv2.puq[i]; - - qp->mfc_cq_data0_RW = puqp->mfc_cq_data0_RW; - qp->mfc_cq_data1_RW = puqp->mfc_cq_data1_RW; - qp->mfc_cq_data2_RW = puqp->mfc_cq_data2_RW; - qp->mfc_cq_data3_RW = puqp->mfc_cq_data3_RW; - } +spufs_get_proxydma_info (ctx, &info);return simple_read_from_buffer (buf, len, pos, &info,sizeof info);
@@ -2171,17 +2206,19 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; +struct spu_proxydma_info info;int ret; ret =spu_acquire_saved (ctx);if (ret)return ret;spin_lock (&ctx->csa.register_lock); - ret =__spufs_proxydma_info_read (ctx, buf, len, pos); +spufs_get_proxydma_info (ctx, &info);spin_unlock (&ctx->csa.register_lock);spu_release_saved (ctx); -return ret; +return simple_read_from_buffer (buf, len, pos, &info, +sizeof (info)); } static const struct file_operations spufs_proxydma_info_fops = {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 98/175 ath9k_htc: Silence undersized packet warnings
In reply to Sasha LevinFrom: Masashi Honma <[email protected]>
[ Upstream commit 450edd2805982d14ed79733a82927d2857b27cac ]
Some devices like TP-Link TL-WN722N produces this kind of messages frequently.
kernel: ath: phy0: Short RX data len, dropping (dlen: 4)
This warning is useful for developers to recognize that the device (Wi-Fi dongle or USB hub etc) is noisy but not for general users. So this patch make this warning to debug message.
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=207539
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +3 -3
@@ -999,9 +999,9 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,* which are not PHY_ERROR (short radar pulses have a length of 3) */ if (unlikely (!rs_datalen || (rs_datalen <10 && !is_phyerr))) { -ath_warn (common, -"Short RX data len, dropping (dlen: %d)\n" , - rs_datalen); +ath_dbg (common,ANY , +"Short RX data len, dropping (dlen: %d)\n" , + rs_datalen); goto rx_next; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 99/175 libertas_tf: avoid a null dereference in pointer priv
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 049ceac308b0d57c4f06b9fb957cdf95d315cf0b ]
Currently there is a check if priv is null when calling lbtf_remove_card but not in a previous call to if_usb_reset_dev that can also dereference priv. Fix this by also only calling lbtf_remove_card if priv is null.
It is noteable that there don't seem to be any bugs reported that the null pointer dereference has ever occurred, so I'm not sure if the null check is required, but since we're doing a null check anyway it should be done for both function calls.
Addresses-Coverity: ("Dereference before null check")
--- drivers/net/wireless/marvell/libertas_tf/if_usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/libertas_tf/if_usb.c +3 -3
@@ -247,10 +247,10 @@ static void if_usb_disconnect(struct usb_interface *intf)lbtf_deb_enter (LBTF_DEB_MAIN ); -if_usb_reset_device (priv); - -if (priv) +if (priv) { +if_usb_reset_device (priv);lbtf_remove_card (priv); + }/* Unlink and free urb */ if_usb_free (cardp);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 100/175 xfs: clean up the error handling in xfs_swap_extents
In reply to Sasha LevinFrom: "Darrick J. Wong" <[email protected]>
[ Upstream commit 8bc3b5e4b70d28f8edcafc3c9e4de515998eea9e ]
Make sure we release resources properly if we cannot clean out the COW extents in preparation for an extent swap.
--- fs/xfs/xfs_bmap_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_bmap_util.c +1 -1
@@ -1760,7 +1760,7 @@ xfs_swap_extents(if (xfs_inode_has_cow_data (tip)) { error =xfs_reflink_cancel_cow_range (tip,0 ,NULLFILEOFF , true);if (error) -return error; + goto out_unlock; }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 101/175 Crypto/chcr: fix for ccm(aes) failed test
In reply to Sasha LevinFrom: Devulapally Shiva Krishna <[email protected]>
[ Upstream commit 10b0c75d7bc19606fa9a62c8ab9180e95c0e0385 ]
The ccm(aes) test fails when req->assoclen > ~240bytes.
The problem is the value assigned to auth_offset is wrong. As auth_offset is unsigned char, it can take max value as 255. So fix it by making it unsigned int.
--- drivers/crypto/chelsio/chcr_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/chelsio/chcr_algo.c +1 -1
@@ -2818,7 +2818,7 @@ static void fill_sec_cpl_for_aead(struct cpl_tx_sec_pdu *sec_cpl,unsigned int mac_mode =CHCR_SCMD_AUTH_MODE_CBCMAC ;unsigned int c_id =a_ctx (tfm)->tx_chan_id;unsigned int ccm_xtra; -unsigned char tag_offset =0 , auth_offset =0 ; +unsigned int tag_offset =0 , auth_offset =0 ;unsigned int assoclen;if (get_aead_subtype (tfm) ==CRYPTO_ALG_SUB_TYPE_AEAD_RFC4309 )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 102/175 drm/vkms: Hold gem object while still in-use
In reply to Sasha LevinFrom: Ezequiel Garcia <[email protected]>
[ Upstream commit 0ea2ea42b31abc1141f2fd3911f952a97d401fcb ]
We need to keep the reference to the drm_gem_object until the last access by vkms_dumb_create.
Therefore, the put the object after it is used.
This fixes a use-after-free issue reported by syzbot.
While here, change vkms_gem_create() symbol to static.
--- drivers/gpu/drm/vkms/vkms_drv.h | 5 ----- drivers/gpu/drm/vkms/vkms_gem.c | 11 ++++++----- 2 files changed, 6 insertions(+), 10 deletions(-)
drivers/gpu/drm/vkms/vkms_drv.h +0 -5
@@ -121,11 +121,6 @@ struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev, enum drm_plane_type type, int index);/* Gem stuff */ -struct drm_gem_object *vkms_gem_create (struct drm_device *dev, -struct drm_file *file, -u32 *handle, -u64 size); -vm_fault_t vkms_gem_fault (struct vm_fault *vmf); int vkms_dumb_create(struct drm_file *file, struct drm_device *dev,
drivers/gpu/drm/vkms/vkms_gem.c +6 -5
@@ -95,10 +95,10 @@ vm_fault_t vkms_gem_fault(struct vm_fault *vmf)return ret; } -struct drm_gem_object *vkms_gem_create (struct drm_device *dev, -struct drm_file *file, -u32 *handle, -u64 size) +static struct drm_gem_object *vkms_gem_create (struct drm_device *dev, +struct drm_file *file, +u32 *handle, +u64 size) {struct vkms_gem_object *obj;int ret;
@@ -111,7 +111,6 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,return ERR_CAST (obj); ret =drm_gem_handle_create (file, &obj->gem, handle); -drm_gem_object_put_unlocked (&obj->gem);if (ret)return ERR_PTR (ret);
@@ -140,6 +139,8 @@ int vkms_dumb_create(struct drm_file *file, struct drm_device *dev, args->size = gem_obj->size; args->pitch = pitch; +drm_gem_object_put_unlocked (gem_obj); +DRM_DEBUG_DRIVER ("Created object of size %lld\n" , size);return 0 ;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 103/175 MIPS: Truncate link address into 32bit for 32bit kernel
In reply to Sasha LevinFrom: Jiaxun Yang <[email protected]>
[ Upstream commit ff487d41036035376e47972c7c522490b839ab37 ]
LLD failed to link vmlinux with 64bit load address for 32bit ELF while bfd will strip 64bit address into 32bit silently.
To fix LLD build, we should truncate load address provided by platform into 32bit for 32bit kernel.
--- arch/mips/Makefile | 13 ++++++++++++- arch/mips/boot/compressed/Makefile | 2 +- arch/mips/kernel/vmlinux.lds.S | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-)
arch/mips/Makefile +12 -1
@@ -285,12 +285,23 @@ ifdef CONFIG_64BIT endif endif +# When linking a 32-bit executable the LLVM linker cannot cope with a +# 32-bit load address that has been sign-extended to 64 bits. Simply +# remove the upper 32 bits then, as it is safe to do so with other +# linkers. +ifdef CONFIG_64BIT + load-ld = $(load-y) +else + load-ld = $(subst 0xffffffff,0x,$(load-y)) +endif + KBUILD_AFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y) -KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) +KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld) KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ + LINKER_LOAD_ADDRESS=$(load-ld) \ VMLINUX_ENTRY_ADDRESS=$(entry-y) \ PLATFORM="$(platform-y)" \ ITS_INPUTS="$(its-y)"
arch/mips/boot/compressed/Makefile +1 -1
@@ -90,7 +90,7 @@ ifneq ($(zload-y),) VMLINUZ_LOAD_ADDRESS := $(zload-y) else VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ - $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) + $(obj)/vmlinux.bin $(LINKER_LOAD_ADDRESS)) endif UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
arch/mips/kernel/vmlinux.lds.S +1 -1
@@ -50,7 +50,7 @@ SECTIONS /* . = 0xa800000000300000; */ . = 0xffffffff80300000; #endif - . = VMLINUX_LOAD_ADDRESS; + . = LINKER_LOAD_ADDRESS; /* read-only */ _text = .; /* Text and read-only data */ .text : {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 104/175 mips: cm: Fix an invalid error code of INTVN_*_ERR
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit 8a0efb8b101665a843205eab3d67ab09cb2d9a8d ]
Commit 3885c2b463f6 ("MIPS: CM: Add support for reporting CM cache errors") adds cm2_causes[] array with map of error type ID and pointers to the short description string. There is a mistake in the table, since according to MIPS32 manual CM2_ERROR_TYPE = {17,18} correspond to INTVN_WR_ERR and INTVN_RD_ERR, while the table claims they have {0x17,0x18} codes. This is obviously hex-dec copy-paste bug. Moreover codes {0x18 - 0x1a} indicate L2 ECC errors.
--- arch/mips/kernel/mips-cm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/kernel/mips-cm.c +3 -3
@@ -119,9 +119,9 @@ static char *cm2_causes[32] = {"COH_RD_ERR" ,"MMIO_WR_ERR" ,"MMIO_RD_ERR" ,"0x07" ,"0x08" ,"0x09" ,"0x0a" ,"0x0b" ,"0x0c" ,"0x0d" ,"0x0e" ,"0x0f" , -"0x10" ,"0x11" ,"0x12" ,"0x13" , -"0x14" ,"0x15" ,"0x16" ,"INTVN_WR_ERR" , -"INTVN_RD_ERR" ,"0x19" ,"0x1a" ,"0x1b" , +"0x10" ,"INTVN_WR_ERR" ,"INTVN_RD_ERR" ,"0x13" , +"0x14" ,"0x15" ,"0x16" ,"0x17" , +"0x18" ,"0x19" ,"0x1a" ,"0x1b" ,"0x1c" ,"0x1d" ,"0x1e" ,"0x1f" };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 105/175 kgdb: Fix spurious true from in_dbg_master()
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 3fec4aecb311995189217e64d725cfe84a568de3 ]
Currently there is a small window where a badly timed migration could cause in_dbg_master() to spuriously return true. Specifically if we migrate to a new core after reading the processor id and the previous core takes a breakpoint then we will evaluate true if we read kgdb_active before we get the IPI to bring us to halt.
Fix this by checking irqs_disabled() first. Interrupts are always disabled when we are executing the kgdb trap so this is an acceptable prerequisite. This also allows us to replace raw_smp_processor_id() with smp_processor_id() since the short circuit logic will prevent warnings from PREEMPT_DEBUG.
--- include/linux/kgdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kgdb.h +1 -1
@@ -323,7 +323,7 @@ extern void gdbstub_exit(int status);extern int kgdb_single_step;extern atomic_t kgdb_active;#define in_dbg_master () \ - (raw_smp_processor_id() == atomic_read(&kgdb_active)) + (irqs_disabled() && (smp_processor_id() == atomic_read(&kgdb_active)))extern bool dbg_is_early;extern void __init dbg_late_init (void );extern void kgdb_panic (const char *msg);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 106/175 xfs: reset buffer write failure state on successful completion
In reply to Sasha LevinFrom: Brian Foster <[email protected]>
[ Upstream commit b6983e80b03bd4fd42de71993b3ac7403edac758 ]
The buffer write failure flag is intended to control the internal write retry that XFS has historically implemented to help mitigate the severity of transient I/O errors. The flag is set when a buffer is resubmitted from the I/O completion path due to a previous failure. It is checked on subsequent I/O completions to skip the internal retry and fall through to the higher level configurable error handling mechanism. The flag is cleared in the synchronous and delwri submission paths and also checked in various places to log write failure messages.
There are a couple minor problems with the current usage of this flag. One is that we issue an internal retry after every submission from xfsaild due to how delwri submission clears the flag. This results in double the expected or configured number of write attempts when under sustained failures. Another more subtle issue is that the flag is never cleared on successful I/O completion. This can cause xfs_wait_buftarg() to suggest that dirty buffers are being thrown away due to the existence of the flag, when the reality is that the flag might still be set because the write succeeded on the retry.
Clear the write failure flag on successful I/O completion to address both of these problems. This means that the internal retry attempt occurs once since the last time a buffer write failed and that various other contexts only see the flag set when the immediately previous write attempt has failed.
--- fs/xfs/xfs_buf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/xfs_buf.c +5 -3
@@ -1162,8 +1162,10 @@ xfs_buf_ioend( bp->b_ops->verify_read (bp); } -if (!bp->b_error) +if (!bp->b_error) { + bp->b_flags &= ~XBF_WRITE_FAIL ; bp->b_flags |=XBF_DONE ; + }if (bp->b_iodone) (*(bp->b_iodone))(bp);
@@ -1223,7 +1225,7 @@ xfs_bwrite( bp->b_flags |=XBF_WRITE ; bp->b_flags &= ~(XBF_ASYNC |XBF_READ | _XBF_DELWRI_Q | -XBF_WRITE_FAIL |XBF_DONE ); +XBF_DONE ); error =xfs_buf_submit (bp);if (error)
@@ -1929,7 +1931,7 @@ xfs_buf_delwri_submit_buffers(* synchronously. Otherwise, drop the buffer from the delwri * queue and submit async. */ - bp->b_flags &= ~(_XBF_DELWRI_Q |XBF_WRITE_FAIL ); + bp->b_flags &= ~_XBF_DELWRI_Q; bp->b_flags |=XBF_WRITE ;if (wait_list) { bp->b_flags &= ~XBF_ASYNC ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 107/175 xfs: fix duplicate verification from xfs_qm_dqflush()
In reply to Sasha LevinFrom: Brian Foster <[email protected]>
[ Upstream commit 629dcb38dc351947ed6a26a997d4b587f3bd5c7e ]
The pre-flush dquot verification in xfs_qm_dqflush() duplicates the read verifier by checking the dquot in the on-disk buffer. Instead, verify the in-core variant before it is flushed to the buffer.
--- fs/xfs/xfs_dquot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/xfs/xfs_dquot.c +4 -5
@@ -1116,13 +1116,12 @@ xfs_qm_dqflush( dqb = bp->b_addr + dqp->q_bufoffset; ddqp = &dqb->dd_diskdq; -/* -* A simple sanity check in case we got a corrupted dquot. -*/ - fa =xfs_dqblk_verify (mp, dqb,be32_to_cpu (ddqp->d_id),0 ); +/* sanity check the in-core structure before we flush */ + fa =xfs_dquot_verify (mp, &dqp->q_core,be32_to_cpu (dqp->q_core.d_id), +0 );if (fa) {xfs_alert (mp,"corrupt dquot ID 0x%x in memory at %pS" , -be32_to_cpu (ddqp->d_id), fa); +be32_to_cpu (dqp->q_core.d_id), fa);xfs_buf_relse (bp);xfs_dqfunlock (dqp);xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 108/175 platform/x86: intel-vbtn: Use acpi_evaluate_integer()
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 18937875a231d831c309716d6d8fc358f8381881 ]
Use acpi_evaluate_integer() instead of open-coding it.
This is a preparation patch for adding a intel_vbtn_has_switches() helper function.
--- drivers/platform/x86/intel-vbtn.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/platform/x86/intel-vbtn.c +6 -13
@@ -118,28 +118,21 @@ static void detect_tablet_mode(struct platform_device *device)const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE );struct intel_vbtn_priv *priv =dev_get_drvdata (&device->dev);acpi_handle handle =ACPI_HANDLE (&device->dev); -struct acpi_buffer vgbs_output = {ACPI_ALLOCATE_BUFFER ,NULL }; -union acpi_object *obj; +unsigned long long vgbs;acpi_status status;int m;if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) - goto out; +return ; - status =acpi_evaluate_object (handle,"VGBS" ,NULL , &vgbs_output); + status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);if (ACPI_FAILURE (status)) - goto out; - - obj = vgbs_output.pointer; -if (!(obj && obj->type ==ACPI_TYPE_INTEGER )) - goto out; +return ; - m = !(obj->integer.value &TABLET_MODE_FLAG ); + m = !(vgbs &TABLET_MODE_FLAG );input_report_switch (priv->input_dev,SW_TABLET_MODE , m); - m = (obj->integer.value &DOCK_MODE_FLAG ) ?1 :0 ; + m = (vgbs &DOCK_MODE_FLAG ) ?1 :0 ;input_report_switch (priv->input_dev,SW_DOCK , m); -out: -kfree (vgbs_output.pointer); }static int intel_vbtn_probe (struct platform_device *device)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 109/175 platform/x86: intel-vbtn: Split keymap into buttons and switches parts
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit f6ba524970c4b73b234bf41ecd6628f5803b1559 ]
Split the sparse keymap into 2 separate keymaps, a buttons and a switches keymap and combine the 2 to a single map again in intel_vbtn_input_setup().
This is a preparation patch for not telling userspace that we have switches when we do not have them (and for doing the same for the buttons).
--- drivers/platform/x86/intel-vbtn.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/platform/x86/intel-vbtn.c +25 -3
@@ -39,14 +39,20 @@ static const struct key_entry intel_vbtn_keymap[] = { { KE_IGNORE, 0xC7, { KEY_VOLUMEDOWN } }, /* volume-down key release */ { KE_KEY, 0xC8, { KEY_ROTATE_LOCK_TOGGLE } }, /* rotate-lock key press */ { KE_KEY, 0xC9, { KEY_ROTATE_LOCK_TOGGLE } }, /* rotate-lock key release */ +}; + +static const struct key_entry intel_vbtn_switchmap[] = { {KE_SW ,0xCA , { .sw = {SW_DOCK ,1 } } },/* Docked */ {KE_SW ,0xCB , { .sw = {SW_DOCK ,0 } } },/* Undocked */ {KE_SW ,0xCC , { .sw = {SW_TABLET_MODE ,1 } } },/* Tablet */ {KE_SW ,0xCD , { .sw = {SW_TABLET_MODE ,0 } } },/* Laptop */ - { KE_END }, }; +#define KEYMAP_LEN \ + (ARRAY_SIZE(intel_vbtn_keymap) + ARRAY_SIZE(intel_vbtn_switchmap) + 1) +struct intel_vbtn_priv { +struct key_entry keymap[KEYMAP_LEN ];struct input_dev *input_dev;bool wakeup_mode; };
@@ -54,13 +60,29 @@ struct intel_vbtn_priv {static int intel_vbtn_input_setup (struct platform_device *device) {struct intel_vbtn_priv *priv =dev_get_drvdata (&device->dev); -int ret; +int ret, keymap_len =0 ; + +if (true) { +memcpy (&priv->keymap[keymap_len], intel_vbtn_keymap, +ARRAY_SIZE (intel_vbtn_keymap) * +sizeof (struct key_entry )); + keymap_len +=ARRAY_SIZE (intel_vbtn_keymap); + } + +if (true) { +memcpy (&priv->keymap[keymap_len], intel_vbtn_switchmap, +ARRAY_SIZE (intel_vbtn_switchmap) * +sizeof (struct key_entry )); + keymap_len +=ARRAY_SIZE (intel_vbtn_switchmap); + } + + priv->keymap[keymap_len].type =KE_END ; priv->input_dev =devm_input_allocate_device (&device->dev);if (!priv->input_dev)return -ENOMEM ; - ret =sparse_keymap_setup (priv->input_dev, intel_vbtn_keymap,NULL ); + ret =sparse_keymap_setup (priv->input_dev, priv->keymap,NULL );if (ret)return ret;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 110/175 platform/x86: intel-vbtn: Do not advertise switches to userspace if they are not there
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 990fbb48067bf8cfa34b7d1e6e1674eaaef2f450 ]
Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a DMI chassis-type check to avoid accidentally reporting SW_TABLET_MODE = 1 to userspace on laptops (specifically on the Dell XPS 9360), to avoid e.g. userspace ignoring touchpad events because userspace thought the device was in tablet-mode.
But if we are not getting the initial status of the switch because the device does not have a tablet mode, then we really should not advertise the presence of a tablet-mode switch to userspace at all, as userspace may use the mere presence of this switch for certain heuristics.
--- drivers/platform/x86/intel-vbtn.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/platform/x86/intel-vbtn.c +19 -6
@@ -54,6 +54,7 @@ static const struct key_entry intel_vbtn_switchmap[] = {struct intel_vbtn_priv {struct key_entry keymap[KEYMAP_LEN ];struct input_dev *input_dev; +bool has_switches;bool wakeup_mode; };
@@ -69,7 +70,7 @@ static int intel_vbtn_input_setup(struct platform_device *device) keymap_len +=ARRAY_SIZE (intel_vbtn_keymap); } -if (true) { +if (priv->has_switches) {memcpy (&priv->keymap[keymap_len], intel_vbtn_switchmap,ARRAY_SIZE (intel_vbtn_switchmap) *sizeof (struct key_entry ));
@@ -137,16 +138,12 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)static void detect_tablet_mode (struct platform_device *device) { -const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE );struct intel_vbtn_priv *priv =dev_get_drvdata (&device->dev);acpi_handle handle =ACPI_HANDLE (&device->dev);unsigned long long vgbs;acpi_status status;int m; -if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) -return ; - status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);if (ACPI_FAILURE (status))return ;
@@ -157,6 +154,19 @@ static void detect_tablet_mode(struct platform_device *device)input_report_switch (priv->input_dev,SW_DOCK , m); } +static bool intel_vbtn_has_switches (acpi_handle handle) +{ +const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE ); +unsigned long long vgbs; +acpi_status status; + +if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) +return false; + + status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs); +return ACPI_SUCCESS (status); +} +static int intel_vbtn_probe (struct platform_device *device) {acpi_handle handle =ACPI_HANDLE (&device->dev);
@@ -175,13 +185,16 @@ static int intel_vbtn_probe(struct platform_device *device)return -ENOMEM ;dev_set_drvdata (&device->dev, priv); + priv->has_switches =intel_vbtn_has_switches (handle); + err =intel_vbtn_input_setup (device);if (err) {pr_err ("Failed to setup Intel Virtual Button\n" );return err; } -detect_tablet_mode (device); +if (priv->has_switches) +detect_tablet_mode (device); status = acpi_install_notify_handler(handle, ACPI_DEVICE_NOTIFY,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 111/175 platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 1fac39fd0316b19c3e57a182524332332d1643ce ]
Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a DMI chassis-type check to avoid accidentally reporting SW_TABLET_MODE = 1 to userspace on laptops.
Some devices with a detachable keyboard and using the intel-vbnt (INT33D6) interface to report if they are in tablet mode (keyboard detached) or not, report 32 / "Detachable" as chassis-type, e.g. the HP Pavilion X2 series.
Other devices with a detachable keyboard and using the intel-vbnt (INT33D6) interface to report SW_TABLET_MODE, report 8 / "Portable" as chassis-type. The Dell Venue 11 Pro 7130 is an example of this.
Extend the DMI chassis-type check to also accept Portables and Detachables so that the intel-vbtn driver will report SW_TABLET_MODE on these devices.
Note the chassis-type check was originally added to avoid a false-positive tablet-mode report on the Dell XPS 9360 laptop. To the best of my knowledge that laptop is using a chassis-type of 9 / "Laptop", so after this commit we still ignore the tablet-switch for that chassis-type.
--- drivers/platform/x86/intel-vbtn.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/platform/x86/intel-vbtn.c +11 -1
@@ -157,12 +157,22 @@ static void detect_tablet_mode(struct platform_device *device)static bool intel_vbtn_has_switches (acpi_handle handle) {const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE ); +unsigned long chassis_type_int;unsigned long long vgbs;acpi_status status; -if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) +if (kstrtoul (chassis_type,10 , &chassis_type_int))return false; +switch (chassis_type_int) { +case 8 :/* Portable */ +case 31 :/* Convertible */ +case 32 :/* Detachable */ +break ; +default : +return false; + } + status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);return ACPI_SUCCESS (status); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 112/175 iwlwifi: avoid debug max amsdu config overwriting itself
In reply to Sasha LevinFrom: Mordechay Goodstein <[email protected]>
[ Upstream commit a65a5824298b06049dbaceb8a9bd19709dc9507c ]
If we set amsdu_len one after another the second one overwrites the orig_amsdu_len so allow only moving from debug to non debug state.
Also the TLC update check was wrong: it was checking that also the orig is smaller then the new updated size, which is not the case in debug amsdu mode.
--- drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 11 +++++++---- drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c | 15 ++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +7 -4
@@ -5,10 +5,9 @@* * GPL LICENSE SUMMARY * -* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH -* Copyright(c) 2018 - 2019 Intel Corporation +* Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -28,10 +27,9 @@* * BSD LICENSE * -* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH -* Copyright(c) 2018 - 2019 Intel Corporation +* Copyright(c) 2012 - 2014, 2018 - 2020 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -478,6 +476,11 @@ static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,if (kstrtou16 (buf,0 , &amsdu_len))return -EINVAL ; +/* only change from debug set <-> debug unset */ +if ((amsdu_len && mvmsta->orig_amsdu_len) || + (!!amsdu_len && mvmsta->orig_amsdu_len)) +return -EBUSY ; +if (amsdu_len) { mvmsta->orig_amsdu_len = sta->max_amsdu_len; sta->max_amsdu_len = amsdu_len;
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +8 -7
@@ -367,14 +367,15 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,u16 size =le32_to_cpu (notif->amsdu_size);int i; -/* -* In debug sta->max_amsdu_len < size -* so also check with orig_amsdu_len which holds the original -* data before debugfs changed the value -*/ -if (WARN_ON (sta->max_amsdu_len < size && - mvmsta->orig_amsdu_len < size)) +if (sta->max_amsdu_len < size) { +/* +* In debug sta->max_amsdu_len < size +* so also check with orig_amsdu_len which holds the +* original data before debugfs changed the value +*/ +WARN_ON (mvmsta->orig_amsdu_len < size); goto out; + } mvmsta->amsdu_enabled =le32_to_cpu (notif->amsdu_enabled); mvmsta->max_amsdu_len = size;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 113/175 nvme: refine the Qemu Identify CNS quirk
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit b9a5c3d4c34d8bd9fd75f7f28d18a57cb68da237 ]
Add a helper to check if we can use Identify CNS values > 1, and refine the Qemu quirk to not apply to reported versions larger than 1.1, as the Qemu implementation had been fixed by then.
--- drivers/nvme/host/core.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +14 -2
@@ -1032,6 +1032,19 @@ void nvme_stop_keep_alive(struct nvme_ctrl *ctrl) }EXPORT_SYMBOL_GPL (nvme_stop_keep_alive); +/* +* In NVMe 1.0 the CNS field was just a binary controller or namespace +* flag, thus sending any new CNS opcodes has a big chance of not working. +* Qemu unfortunately had that bug after reporting a 1.1 version compliance +* (but not for any later version). +*/ +static bool nvme_ctrl_limited_cns (struct nvme_ctrl *ctrl) +{ +if (ctrl->quirks &NVME_QUIRK_IDENTIFY_CNS ) +return ctrl->vs <NVME_VS (1 ,2 ,0 ); +return ctrl->vs <NVME_VS (1 ,1 ,0 ); +} +static int nvme_identify_ctrl (struct nvme_ctrl *dev,struct nvme_id_ctrl **id) {struct nvme_command c = { };
@@ -3740,8 +3753,7 @@ static void nvme_scan_work(struct work_struct *work)mutex_lock (&ctrl->scan_lock); nn =le32_to_cpu (id->nn); -if (ctrl->vs >=NVME_VS (1 ,1 ,0 ) && - !(ctrl->quirks &NVME_QUIRK_IDENTIFY_CNS )) { +if (!nvme_ctrl_limited_cns (ctrl)) {if (!nvme_scan_ns_list (ctrl, nn)) goto out_free_id; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 114/175 nvme-pci: align io queue count with allocted nvme_queue in nvme_probe
In reply to Sasha LevinFrom: Weiping Zhang <[email protected]>
[ Upstream commit 2a5bcfdd41d68559567cec3c124a75e093506cc1 ]
Since commit 147b27e4bd08 ("nvme-pci: allocate device queues storage space at probe"), nvme_alloc_queue does not alloc the nvme queues itself anymore.
If the write/poll_queues module parameters are changed at runtime to values larger than the number of allocated queues in nvme_probe, nvme_alloc_queue will access unallocated memory.
Add a new nr_allocated_queues member to struct nvme_dev to record how many queues were alloctated in nvme_probe to avoid using more than the allocated queues after a reset following a change to the write/poll_queues module parameters.
Also add nr_write_queues and nr_poll_queues members to allow refreshing the number of write and poll queues based on a change to the module parameters when resetting the controller.
--- drivers/nvme/host/pci.c | 57 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-)
drivers/nvme/host/pci.c +33 -24
@@ -128,6 +128,9 @@ struct nvme_dev {dma_addr_t host_mem_descs_dma;struct nvme_host_mem_buf_desc *host_mem_descs;void **host_mem_desc_bufs; +unsigned int nr_allocated_queues; +unsigned int nr_write_queues; +unsigned int nr_poll_queues; };static int io_queue_depth_set (const char *val,const struct kernel_param *kp)
@@ -210,25 +213,14 @@ struct nvme_iod {struct scatterlist *sg; }; -static unsigned int max_io_queues (void ) +static inline unsigned int nvme_dbbuf_size (struct nvme_dev *dev) { -return num_possible_cpus () + write_queues + poll_queues; -} - -static unsigned int max_queue_count (void ) -{ -/* IO queues + admin queue */ -return 1 +max_io_queues (); -} - -static inline unsigned int nvme_dbbuf_size (u32 stride) -{ -return (max_queue_count () *8 * stride); +return dev->nr_allocated_queues *8 * dev->db_stride; }static int nvme_dbbuf_dma_alloc (struct nvme_dev *dev) { -unsigned int mem_size =nvme_dbbuf_size (dev->db_stride); +unsigned int mem_size =nvme_dbbuf_size (dev);if (dev->dbbuf_dbs)return 0 ;
@@ -253,7 +245,7 @@ static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)static void nvme_dbbuf_dma_free (struct nvme_dev *dev) { -unsigned int mem_size =nvme_dbbuf_size (dev->db_stride); +unsigned int mem_size =nvme_dbbuf_size (dev);if (dev->dbbuf_dbs) { dma_free_coherent(dev->dev, mem_size,
@@ -2030,7 +2022,7 @@ static int nvme_setup_host_mem(struct nvme_dev *dev)static void nvme_calc_irq_sets (struct irq_affinity *affd,unsigned int nrirqs) {struct nvme_dev *dev = affd->priv; -unsigned int nr_read_queues; +unsigned int nr_read_queues, nr_write_queues = dev->nr_write_queues;/* * If there is no interupt available for queues, ensure that
@@ -2046,12 +2038,12 @@ static void nvme_calc_irq_sets(struct irq_affinity *affd, unsigned int nrirqs)if (!nrirqs) { nrirqs =1 ; nr_read_queues =0 ; - }else if (nrirqs ==1 || !write_queues) { + }else if (nrirqs ==1 || !nr_write_queues) { nr_read_queues =0 ; - }else if (write_queues >= nrirqs) { + }else if (nr_write_queues >= nrirqs) { nr_read_queues =1 ; }else { - nr_read_queues = nrirqs - write_queues; + nr_read_queues = nrirqs - nr_write_queues; } dev->io_queues[HCTX_TYPE_DEFAULT ] = nrirqs - nr_read_queues;
@@ -2075,7 +2067,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues)* Poll queues don't need interrupts, but we need at least one IO * queue left over for non-polled IO. */ - this_p_queues = poll_queues; + this_p_queues = dev->nr_poll_queues;if (this_p_queues >= nr_io_queues) { this_p_queues = nr_io_queues -1 ; irq_queues =1 ;
@@ -2105,14 +2097,25 @@ static void nvme_disable_io_queues(struct nvme_dev *dev)__nvme_disable_io_queues (dev, nvme_admin_delete_cq); } +static unsigned int nvme_max_io_queues (struct nvme_dev *dev) +{ +return num_possible_cpus () + dev->nr_write_queues + dev->nr_poll_queues; +} +static int nvme_setup_io_queues (struct nvme_dev *dev) {struct nvme_queue *adminq = &dev->queues[0 ];struct pci_dev *pdev =to_pci_dev (dev->dev); -int result, nr_io_queues; +unsigned int nr_io_queues;unsigned long size; +int result; - nr_io_queues =max_io_queues (); +/* +* Sample the module parameters once at reset time so that we have +* stable values to work with. +*/ + dev->nr_write_queues = write_queues; + dev->nr_poll_queues = poll_queues;/* * If tags are shared with admin queue (Apple bug), then
@@ -2120,6 +2123,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)*/ if (dev->ctrl.quirks &NVME_QUIRK_SHARED_TAGS ) nr_io_queues =1 ; +else + nr_io_queues =min (nvme_max_io_queues (dev), + dev->nr_allocated_queues -1 ); result =nvme_set_queue_count (&dev->ctrl, &nr_io_queues);if (result <0 )
@@ -2794,8 +2800,11 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (!dev)return -ENOMEM ; - dev->queues =kcalloc_node (max_queue_count (),sizeof (struct nvme_queue ), -GFP_KERNEL , node); + dev->nr_write_queues = write_queues; + dev->nr_poll_queues = poll_queues; + dev->nr_allocated_queues =nvme_max_io_queues (dev) +1 ; + dev->queues =kcalloc_node (dev->nr_allocated_queues, +sizeof (struct nvme_queue ),GFP_KERNEL , node);if (!dev->queues) goto free;
Signature · 7 lines
2.25.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 115/175 nvme-tcp: use bh_lock in data_ready
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 386e5e6e1aa90b479fcf0467935922df8524393d ]
data_ready may be invoked from send context or from softirq, so need bh locking for that.
--- drivers/nvme/host/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/tcp.c +2 -2
@@ -784,11 +784,11 @@ static void nvme_tcp_data_ready(struct sock *sk) {struct nvme_tcp_queue *queue; -read_lock (&sk->sk_callback_lock); +read_lock_bh (&sk->sk_callback_lock); queue = sk->sk_user_data;if (likely (queue && queue->rd_enabled))queue_work_on (queue->io_cpu, nvme_tcp_wq, &queue->io_work); -read_unlock (&sk->sk_callback_lock); +read_unlock_bh (&sk->sk_callback_lock); }static void nvme_tcp_write_space (struct sock *sk)
Signature · 7 lines
2.25.1 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Sasha Levin
maintainerPATCH 116/175 ath10k: Remove msdu from idr when management pkt send fails
In reply to Sasha LevinFrom: Rakesh Pillai <[email protected]>
[ Upstream commit c730c477176ad4af86d9aae4d360a7ad840b073a ]
Currently when the sending of any management pkt via wmi command fails, the packet is being unmapped freed in the error handling. But the idr entry added, which is used to track these packet is not getting removed.
Hence, during unload, in wmi cleanup, all the entries in IDR are removed and the corresponding buffer is attempted to be freed. This can cause a situation where one packet is attempted to be freed twice.
Fix this error by rmeoving the msdu from the idr
list when the sending of a management packet over
wmi fails.
Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/mac.c | 3 +++ drivers/net/wireless/ath/ath10k/wmi-ops.h | 10 ++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.c | 15 +++++++++++++++ 3 files changed, 28 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +3 -0
@@ -3911,6 +3911,9 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)if (ret) {ath10k_warn (ar,"failed to transmit management frame by ref via WMI: %d\n" , ret); +/* remove this msdu from idr tracking */ +ath10k_wmi_cleanup_mgmt_tx_send (ar, skb); +dma_unmap_single (ar->dev, paddr, skb->len,DMA_TO_DEVICE );ieee80211_free_txskb (ar->hw, skb);
drivers/net/wireless/ath/ath10k/wmi-ops.h +10 -0
@@ -133,6 +133,7 @@ struct wmi_ops {struct sk_buff *(*gen_mgmt_tx_send)(struct ath10k *ar,struct sk_buff *skb,dma_addr_t paddr); +int (*cleanup_mgmt_tx_send)(struct ath10k *ar,struct sk_buff *msdu);struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar,u64 module_enable,u32 log_level);struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar,u32 filter);
@@ -441,6 +442,15 @@ ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar)return ar->wmi.ops->get_txbf_conf_scheme (ar); } +static inline int +ath10k_wmi_cleanup_mgmt_tx_send (struct ath10k *ar,struct sk_buff *msdu) +{ +if (!ar->wmi.ops->cleanup_mgmt_tx_send) +return -EOPNOTSUPP ; + +return ar->wmi.ops->cleanup_mgmt_tx_send (ar, msdu); +} +static inline int ath10k_wmi_mgmt_tx_send (struct ath10k *ar,struct sk_buff *msdu,dma_addr_t paddr)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +15 -0
@@ -2837,6 +2837,18 @@ ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, u32 stats_mask)return skb; } +static int +ath10k_wmi_tlv_op_cleanup_mgmt_tx_send (struct ath10k *ar, +struct sk_buff *msdu) +{ +struct ath10k_skb_cb *cb =ATH10K_SKB_CB (msdu); +struct ath10k_wmi *wmi = &ar->wmi; + +idr_remove (&wmi->mgmt_pending_tx, cb->msdu_id); + +return 0 ; +} +static int ath10k_wmi_mgmt_tx_alloc_msdu_id (struct ath10k *ar,struct sk_buff *skb,dma_addr_t paddr)
@@ -2911,6 +2923,8 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,if (desc_id <0 ) goto err_free_skb; + cb->msdu_id = desc_id; + ptr = (void *)skb->data; tlv = ptr; tlv->tag =__cpu_to_le16 (WMI_TLV_TAG_STRUCT_MGMT_TX_CMD );
@@ -4339,6 +4353,7 @@ static const struct wmi_ops wmi_tlv_ops = { .gen_force_fw_hang = ath10k_wmi_tlv_op_gen_force_fw_hang,/* .gen_mgmt_tx = not implemented; HTT is used */ .gen_mgmt_tx_send = ath10k_wmi_tlv_op_gen_mgmt_tx_send, + .cleanup_mgmt_tx_send = ath10k_wmi_tlv_op_cleanup_mgmt_tx_send, .gen_dbglog_cfg = ath10k_wmi_tlv_op_gen_dbglog_cfg, .gen_pktlog_enable = ath10k_wmi_tlv_op_gen_pktlog_enable, .gen_pktlog_disable = ath10k_wmi_tlv_op_gen_pktlog_disable,
Signature · 7 lines
2.25.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 117/175 wcn36xx: Fix error handling path in 'wcn36xx_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a86308fc534edeceaf64670c691e17485436a4f4 ]
In case of error, 'qcom_wcnss_open_channel()' must be undone by a call to 'rpmsg_destroy_ept()', as already done in the remove function.
--- drivers/net/wireless/ath/wcn36xx/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wcn36xx/main.c +4 -2
@@ -1341,7 +1341,7 @@ static int wcn36xx_probe(struct platform_device *pdev)if (addr && ret !=ETH_ALEN ) {wcn36xx_err ("invalid local-mac-address\n" ); ret = -EINVAL ; - goto out_wq; + goto out_destroy_ept; }else if (addr) {wcn36xx_info ("mac address: %pM\n" , addr);SET_IEEE80211_PERM_ADDR (wcn->hw, addr);
@@ -1349,7 +1349,7 @@ static int wcn36xx_probe(struct platform_device *pdev) ret =wcn36xx_platform_get_resources (wcn, pdev);if (ret) - goto out_wq; + goto out_destroy_ept;wcn36xx_init_ieee80211 (wcn); ret =ieee80211_register_hw (wcn->hw);
@@ -1361,6 +1361,8 @@ static int wcn36xx_probe(struct platform_device *pdev) out_unmap:iounmap (wcn->ccu_base);iounmap (wcn->dxe_base); +out_destroy_ept: +rpmsg_destroy_ept (wcn->smd_channel); out_wq:ieee80211_free_hw (hw); out_err:
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 118/175 net: qed*: Reduce RX and TX default ring count when running inside kdump kernel
In reply to Sasha LevinFrom: Bhupesh Sharma <[email protected]>
[ Upstream commit 73e030977f7884dbe1be0018bab517e8d02760f8 ]
Normally kdump kernel(s) run under severe memory constraint with the basic idea being to save the crashdump vmcore reliably when the primary kernel panics/hangs.
Currently the qed* ethernet driver ends up consuming a lot of memory in the kdump kernel, leading to kdump kernel panic when one tries to save the vmcore via ssh/nfs (thus utilizing the services of the underlying qed* network interfaces).
An example OOM message log seen in the kdump kernel can be seen here [1], with crashkernel size reservation of 512M.
Using tools like memstrack (see [2]), we can track the modules taking up the bulk of memory in the kdump kernel and organize the memory usage output as per 'highest allocator first'. An example log for the OOM case indicates that the qed* modules end up allocating approximately 216M memory, which is a large part of the total crashkernel size:
dracut-pre-pivot[676]: ======== Report format module_summary: ======== dracut-pre-pivot[676]: Module qed using 149.6MB (2394 pages), peak allocation 149.6MB (2394 pages) dracut-pre-pivot[676]: Module qede using 65.3MB (1045 pages), peak allocation 65.3MB (1045 pages)
This patch reduces the default RX and TX ring count from 1024 to 64 when running inside kdump kernel, which leads to a significant memory saving.
An example log with the patch applied shows the reduced memory
allocation in the kdump kernel:
dracut-pre-pivot[674]: ======== Report format module_summary: ======== dracut-pre-pivot[674]: Module qed using 141.8MB (2268 pages), peak allocation 141.8MB (2268 pages) <..snip..>
[dracut-pre-pivot[674]: Module qede using 4.8MB (76 pages), peak allocation 4.9MB (78 pages)
Tested crashdump vmcore save via ssh/nfs protocol using underlying qed* network interface after applying this patch.
[1] OOM log:
------------
kworker/0:6: page allocation failure: order:6, mode:0x60c0c0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null) kworker/0:6 cpuset=/ mems_allowed=0
CPU: 0 PID: 145 Comm: kworker/0:6 Not tainted 4.18.0-109.el8.aarch64 #1 Hardware name: To be filled by O.E.M. Saber/Saber, BIOS 0ACKL025 01/18/2019 Workqueue: events work_for_cpu_fn Call trace: dump_backtrace+0x0/0x188 show_stack+0x24/0x30 dump_stack+0x90/0xb4 warn_alloc+0xf4/0x178 __alloc_pages_nodemask+0xcac/0xd58 alloc_pages_current+0x8c/0xf8 kmalloc_order_trace+0x38/0x108 qed_iov_alloc+0x40/0x248 [qed] qed_resc_alloc+0x224/0x518 [qed] qed_slowpath_start+0x254/0x928 [qed] __qede_probe+0xf8/0x5e0 [qede] qede_probe+0x68/0xd8 [qede] local_pci_probe+0x44/0xa8 work_for_cpu_fn+0x20/0x30 process_one_work+0x1ac/0x3e8 worker_thread+0x44/0x448 kthread+0x130/0x138 ret_from_fork+0x10/0x18 Cannot start slowpath qede: probe of 0000:05:00.1 failed with error -12
[2]. Memstrack tool: https://github.com/ryncsn/memstrack
--- drivers/net/ethernet/qlogic/qede/qede.h | 2 ++ drivers/net/ethernet/qlogic/qede/qede_main.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qede/qede.h +2 -0
@@ -574,12 +574,14 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,#define RX_RING_SIZE ((u16)BIT(RX_RING_SIZE_POW))#define NUM_RX_BDS_MAX (RX_RING_SIZE - 1)#define NUM_RX_BDS_MIN 128 +#define NUM_RX_BDS_KDUMP_MIN 63#define NUM_RX_BDS_DEF ((u16)BIT(10) - 1)#define TX_RING_SIZE_POW 13#define TX_RING_SIZE ((u16)BIT(TX_RING_SIZE_POW))#define NUM_TX_BDS_MAX (TX_RING_SIZE - 1)#define NUM_TX_BDS_MIN 128 +#define NUM_TX_BDS_KDUMP_MIN 63#define NUM_TX_BDS_DEF NUM_TX_BDS_MAX#define QEDE_MIN_PKT_LEN 64
drivers/net/ethernet/qlogic/qede/qede_main.c +9 -2
@@ -29,6 +29,7 @@* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include <linux/crash_dump.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/version.h>
@@ -707,8 +708,14 @@ static struct qede_dev *qede_alloc_etherdev(struct qed_dev *cdev, edev->dp_module = dp_module; edev->dp_level = dp_level; edev->ops = qed_ops; - edev->q_num_rx_buffers =NUM_RX_BDS_DEF ; - edev->q_num_tx_buffers =NUM_TX_BDS_DEF ; + +if (is_kdump_kernel ()) { + edev->q_num_rx_buffers =NUM_RX_BDS_KDUMP_MIN ; + edev->q_num_tx_buffers =NUM_TX_BDS_KDUMP_MIN ; + }else { + edev->q_num_rx_buffers =NUM_RX_BDS_DEF ; + edev->q_num_tx_buffers =NUM_TX_BDS_DEF ; + }DP_INFO (edev,"Allocated netdev with %d tx queues and %d rx queues\n" , info->num_queues, info->num_queues);
Signature · 7 lines
2.25.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Sasha Levin
maintainerPATCH 119/175 drm/mcde: dsi: Fix return value check in mcde_dsi_bind()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 761e9f4f80a21a4b845097027030bef863001636 ]
The of_drm_find_bridge() function returns NULL on error, it doesn't return error pointers so this check doesn't work.
--- drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/mcde/mcde_dsi.c +3 -4
@@ -940,10 +940,9 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, panel =NULL ; bridge =of_drm_find_bridge (child); -if (IS_ERR (bridge)) { -dev_err (dev,"failed to find bridge (%ld)\n" , -PTR_ERR (bridge)); -return PTR_ERR (bridge); +if (!bridge) { +dev_err (dev,"failed to find bridge\n" ); +return -EINVAL ; } } }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 120/175 mt76: avoid rx reorder buffer overflow
In reply to Sasha LevinFrom: Ryder Lee <[email protected]>
[ Upstream commit 7c4f744d6703757be959f521a7a441bf34745d99 ]
Enlarge slot to support 11ax 256 BA (256 MPDUs in an AMPDU)
--- drivers/net/wireless/mediatek/mt76/agg-rx.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt76.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/agg-rx.c +4 -4
@@ -143,8 +143,8 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)struct ieee80211_sta *sta;struct mt76_rx_tid *tid;bool sn_less; -u16 seqno, head, size; -u8 ackp, idx; +u16 seqno, head, size, idx; +u8 ackp;__skb_queue_tail (frames, skb);
@@ -230,7 +230,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames) }int mt76_rx_aggr_start (struct mt76_dev *dev,struct mt76_wcid *wcid,u8 tidno, -u16 ssn,u8 size) +u16 ssn,u16 size) {struct mt76_rx_tid *tid;
@@ -254,7 +254,7 @@ EXPORT_SYMBOL_GPL(mt76_rx_aggr_start);static void mt76_rx_aggr_shutdown (struct mt76_dev *dev,struct mt76_rx_tid *tid) { -u8 size = tid->size; +u16 size = tid->size;int i;cancel_delayed_work (&tid->reorder_work);
drivers/net/wireless/mediatek/mt76/mt76.h +3 -3
@@ -240,8 +240,8 @@ struct mt76_rx_tid {struct delayed_work reorder_work;u16 head; -u8 size; -u8 nframes; +u16 size; +u16 nframes; u8 started:1, stopped:1, timer_pending:1;
@@ -723,7 +723,7 @@ int mt76_get_survey(struct ieee80211_hw *hw, int idx,void mt76_set_stream_caps (struct mt76_dev *dev,bool vht);int mt76_rx_aggr_start (struct mt76_dev *dev,struct mt76_wcid *wcid,u8 tid, -u16 ssn,u8 size); +u16 ssn,u16 size);void mt76_rx_aggr_stop (struct mt76_dev *dev,struct mt76_wcid *wcid,u8 tid); void mt76_wcid_key_setup(struct mt76_dev *dev, struct mt76_wcid *wcid,
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 121/175 md: don't flush workqueue unconditionally in md_open
In reply to Sasha LevinFrom: Guoqing Jiang <[email protected]>
[ Upstream commit f6766ff6afff70e2aaf39e1511e16d471de7c3ae ]
We need to check mddev->del_work before flush workqueu since the purpose of flush is to ensure the previous md is disappeared. Otherwise the similar deadlock appeared if LOCKDEP is enabled, it is due to md_open holds the bdev->bd_mutex before flush workqueue.
kernel: [ 154.522645] ======================================================
kernel: [ 154.522647] WARNING: possible circular locking dependency detected
kernel: [ 154.522650] 5.6.0-rc7-lp151.27-default #25 Tainted: G O
kernel: [ 154.522651] ------------------------------------------------------
kernel: [ 154.522653] mdadm/2482 is trying to acquire lock:
kernel: [ 154.522655] ffff888078529128 ((wq_completion)md_misc){+.+.}, at: flush_workqueue+0x84/0x4b0
kernel: [ 154.522673]
kernel: [ 154.522673] but task is already holding lock:
kernel: [ 154.522675] ffff88804efa9338 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x79/0x590
kernel: [ 154.522691]
kernel: [ 154.522691] which lock already depends on the new lock.
kernel: [ 154.522691]
kernel: [ 154.522694]
kernel: [ 154.522694] the existing dependency chain (in reverse order) is:
kernel: [ 154.522696]
kernel: [ 154.522696] -> #4 (&bdev->bd_mutex){+.+.}:
kernel: [ 154.522704] __mutex_lock+0x87/0x950
kernel: [ 154.522706] __blkdev_get+0x79/0x590
kernel: [ 154.522708] blkdev_get+0x65/0x140
kernel: [ 154.522709] blkdev_get_by_dev+0x2f/0x40
kernel: [ 154.522716] lock_rdev+0x3d/0x90 [md_mod]
kernel: [ 154.522719] md_import_device+0xd6/0x1b0 [md_mod]
kernel: [ 154.522723] new_dev_store+0x15e/0x210 [md_mod]
kernel: [ 154.522728] md_attr_store+0x7a/0xc0 [md_mod]
kernel: [ 154.522732] kernfs_fop_write+0x117/0x1b0
kernel: [ 154.522735] vfs_write+0xad/0x1a0
kernel: [ 154.522737] ksys_write+0xa4/0xe0
kernel: [ 154.522745] do_syscall_64+0x64/0x2b0
kernel: [ 154.522748] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522749]
kernel: [ 154.522749] -> #3 (&mddev->reconfig_mutex){+.+.}:
kernel: [ 154.522752] __mutex_lock+0x87/0x950
kernel: [ 154.522756] new_dev_store+0xc9/0x210 [md_mod]
kernel: [ 154.522759] md_attr_store+0x7a/0xc0 [md_mod]
kernel: [ 154.522761] kernfs_fop_write+0x117/0x1b0
kernel: [ 154.522763] vfs_write+0xad/0x1a0
kernel: [ 154.522765] ksys_write+0xa4/0xe0
kernel: [ 154.522767] do_syscall_64+0x64/0x2b0
kernel: [ 154.522769] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522770]
kernel: [ 154.522770] -> #2 (kn->count#253){++++}:
kernel: [ 154.522775] __kernfs_remove+0x253/0x2c0
kernel: [ 154.522778] kernfs_remove+0x1f/0x30
kernel: [ 154.522780] kobject_del+0x28/0x60
kernel: [ 154.522783] mddev_delayed_delete+0x24/0x30 [md_mod]
kernel: [ 154.522786] process_one_work+0x2a7/0x5f0
kernel: [ 154.522788] worker_thread+0x2d/0x3d0
kernel: [ 154.522793] kthread+0x117/0x130
kernel: [ 154.522795] ret_from_fork+0x3a/0x50
kernel: [ 154.522796]
kernel: [ 154.522796] -> #1 ((work_completion)(&mddev->del_work)){+.+.}:
kernel: [ 154.522800] process_one_work+0x27e/0x5f0
kernel: [ 154.522802] worker_thread+0x2d/0x3d0
kernel: [ 154.522804] kthread+0x117/0x130
kernel: [ 154.522806] ret_from_fork+0x3a/0x50
kernel: [ 154.522807]
kernel: [ 154.522807] -> #0 ((wq_completion)md_misc){+.+.}:
kernel: [ 154.522813] __lock_acquire+0x1392/0x1690
kernel: [ 154.522816] lock_acquire+0xb4/0x1a0
kernel: [ 154.522818] flush_workqueue+0xab/0x4b0
kernel: [ 154.522821] md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522823] __blkdev_get+0xea/0x590
kernel: [ 154.522825] blkdev_get+0x65/0x140
kernel: [ 154.522828] do_dentry_open+0x1d1/0x380
kernel: [ 154.522831] path_openat+0x567/0xcc0
kernel: [ 154.522834] do_filp_open+0x9b/0x110
kernel: [ 154.522836] do_sys_openat2+0x201/0x2a0
kernel: [ 154.522838] do_sys_open+0x57/0x80
kernel: [ 154.522840] do_syscall_64+0x64/0x2b0
kernel: [ 154.522842] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522844]
kernel: [ 154.522844] other info that might help us debug this:
kernel: [ 154.522844]
kernel: [ 154.522846] Chain exists of:
kernel: [ 154.522846] (wq_completion)md_misc --> &mddev->reconfig_mutex --> &bdev->bd_mutex
kernel: [ 154.522846]
kernel: [ 154.522850] Possible unsafe locking scenario:
kernel: [ 154.522850]
kernel: [ 154.522852] CPU0 CPU1
kernel: [ 154.522853] ---- ----
kernel: [ 154.522854] lock(&bdev->bd_mutex);
kernel: [ 154.522856] lock(&mddev->reconfig_mutex);
kernel: [ 154.522858] lock(&bdev->bd_mutex);
kernel: [ 154.522860] lock((wq_completion)md_misc);
kernel: [ 154.522861]
kernel: [ 154.522861] *** DEADLOCK ***
kernel: [ 154.522861]
kernel: [ 154.522864] 1 lock held by mdadm/2482:
kernel: [ 154.522865] #0: ffff88804efa9338 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x79/0x590
kernel: [ 154.522868]
kernel: [ 154.522868] stack backtrace:
kernel: [ 154.522873] CPU: 1 PID: 2482 Comm: mdadm Tainted: G O 5.6.0-rc7-lp151.27-default #25
kernel: [ 154.522875] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
kernel: [ 154.522878] Call Trace:
kernel: [ 154.522881] dump_stack+0x8f/0xcb
kernel: [ 154.522884] check_noncircular+0x194/0x1b0
kernel: [ 154.522888] ? __lock_acquire+0x1392/0x1690
kernel: [ 154.522890] __lock_acquire+0x1392/0x1690
kernel: [ 154.522893] lock_acquire+0xb4/0x1a0
kernel: [ 154.522895] ? flush_workqueue+0x84/0x4b0
kernel: [ 154.522898] flush_workqueue+0xab/0x4b0
kernel: [ 154.522900] ? flush_workqueue+0x84/0x4b0
kernel: [ 154.522905] ? md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522908] md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522910] __blkdev_get+0xea/0x590
kernel: [ 154.522912] ? bd_acquire+0xc0/0xc0
kernel: [ 154.522914] blkdev_get+0x65/0x140
kernel: [ 154.522916] ? bd_acquire+0xc0/0xc0
kernel: [ 154.522918] do_dentry_open+0x1d1/0x380
kernel: [ 154.522921] path_openat+0x567/0xcc0
kernel: [ 154.522923] ? __lock_acquire+0x380/0x1690
kernel: [ 154.522926] do_filp_open+0x9b/0x110
kernel: [ 154.522929] ? __alloc_fd+0xe5/0x1f0
kernel: [ 154.522935] ? kmem_cache_alloc+0x28c/0x630
kernel: [ 154.522939] ? do_sys_openat2+0x201/0x2a0
kernel: [ 154.522941] do_sys_openat2+0x201/0x2a0
kernel: [ 154.522944] do_sys_open+0x57/0x80
kernel: [ 154.522946] do_syscall_64+0x64/0x2b0
kernel: [ 154.522948] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522951] RIP: 0033:0x7f98d279d9ae
And md_alloc also flushed the same workqueue, but the thing is different here. Because all the paths call md_alloc don't hold bdev->bd_mutex, and the flush is necessary to avoid race condition, so leave it as it is.
--- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -7607,7 +7607,8 @@ static int md_open(struct block_device *bdev, fmode_t mode)*/ mddev_put (mddev);/* Wait until bdev->bd_disk is definitely gone */ -flush_workqueue (md_misc_wq); +if (work_pending (&mddev->del_work)) +flush_workqueue (md_misc_wq);/* Then retry the open from the top */ return -ERESTARTSYS ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 122/175 raid5: remove gfp flags from scribble_alloc()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit ba54d4d4d2844c234f1b4692bd8c9e0f833c8a54 ]
Using GFP_NOIO flag to call scribble_alloc() from resize_chunk() does not have the expected behavior. kvmalloc_array() inside scribble_alloc() which receives the GFP_NOIO flag will eventually call kmalloc_node() to allocate physically continuous pages.
Now we have memalloc scope APIs in mddev_suspend()/mddev_resume() to prevent memory reclaim I/Os during raid array suspend context, calling to kvmalloc_array() with GFP_KERNEL flag may avoid deadlock of recursive I/O as expected.
This patch removes the useless gfp flags from parameters list of scribble_alloc(), and call kvmalloc_array() with GFP_KERNEL flag. The incorrect GFP_NOIO flag does not exist anymore.
--- drivers/md/raid5.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/md/raid5.c +9 -6
@@ -2228,14 +2228,19 @@ static int grow_stripes(struct r5conf *conf, int num)* of the P and Q blocks. */ static int scribble_alloc (struct raid5_percpu *percpu, -int num,int cnt,gfp_t flags) +int num,int cnt) {size_t obj_size =sizeof (struct page *) * (num+2 ) +sizeof (addr_conv_t) * (num+2 );void *scribble; - scribble =kvmalloc_array (cnt, obj_size, flags); +/* +* If here is in raid array suspend context, it is in memalloc noio +* context as well, there is no potential recursive memory reclaim +* I/Os with the GFP_KERNEL flag. +*/ + scribble =kvmalloc_array (cnt, obj_size,GFP_KERNEL );if (!scribble)return -ENOMEM ;
@@ -2267,8 +2272,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors) percpu =per_cpu_ptr (conf->percpu, cpu); err =scribble_alloc (percpu, new_disks, - new_sectors /STRIPE_SECTORS , -GFP_NOIO ); + new_sectors /STRIPE_SECTORS );if (err)break ; }
@@ -6765,8 +6769,7 @@ static int alloc_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu conf->previous_raid_disks), max(conf->chunk_sectors, conf->prev_chunk_sectors) - / STRIPE_SECTORS, - GFP_KERNEL)) { + / STRIPE_SECTORS)) {free_scratch_buffer (conf, percpu);return -ENOMEM ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 123/175 net: dsa: mt7530: set CPU port to fallback mode
In reply to Sasha LevinFrom: DENG Qingfang <[email protected]>
[ Upstream commit 38152ea37d8bdaffa22603e0a5b5b86cfa8714c9 ]
Currently, setting a bridge's self PVID to other value and deleting the default VID 1 renders untagged ports of that VLAN unable to talk to the CPU port:
bridge vlan add dev br0 vid 2 pvid untagged self bridge vlan del dev br0 vid 1 self
bridge vlan add dev sw0p0 vid 2 pvid untagged bridge vlan del dev sw0p0 vid 1
# br0 cannot send untagged frames out of sw0p0 anymore
That is because the CPU port is set to security mode and its PVID is still 1, and untagged frames are dropped due to VLAN member violation.
Set the CPU port to fallback mode so untagged frames can pass through.
--- drivers/net/dsa/mt7530.c | 11 ++++++++--- drivers/net/dsa/mt7530.h | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/net/dsa/mt7530.c +8 -3
@@ -818,10 +818,15 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) PCR_MATRIX_MASK, PCR_MATRIX(MT7530_ALL_MEMBERS));/* Trapped into security mode allows packet forwarding through VLAN -* table lookup. +* table lookup. CPU port is set to fallback mode to let untagged +* frames pass through. */ -mt7530_rmw (priv,MT7530_PCR_P (port),PCR_PORT_VLAN_MASK , -MT7530_PORT_SECURITY_MODE ); +if (dsa_is_cpu_port (ds, port)) +mt7530_rmw (priv,MT7530_PCR_P (port),PCR_PORT_VLAN_MASK , +MT7530_PORT_FALLBACK_MODE ); +else +mt7530_rmw (priv,MT7530_PCR_P (port),PCR_PORT_VLAN_MASK , +MT7530_PORT_SECURITY_MODE );/* Set the port as a user port which is to be able to recognize VID * from incoming packets before fetching entry within the VLAN table.
drivers/net/dsa/mt7530.h +6 -0
@@ -148,6 +148,12 @@ enum mt7530_port_mode {/* Port Matrix Mode: Frames are forwarded by the PCR_MATRIX members. */ MT7530_PORT_MATRIX_MODE =PORT_VLAN (0 ), +/* Fallback Mode: Forward received frames with ingress ports that do +* not belong to the VLAN member. Frames whose VID is not listed on +* the VLAN table are forwarded by the PCR_MATRIX members. +*/ + MT7530_PORT_FALLBACK_MODE = PORT_VLAN(1), +/* Security Mode: Discard any frame due to ingress membership * violation or VID missed on the VLAN table. */
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 124/175 iocost: don't let vrate run wild while there's no saturation signal
In reply to Sasha LevinFrom: Tejun Heo <[email protected]>
[ Upstream commit 81ca627a933063fa63a6d4c66425de822a2ab7f5 ]
When the QoS targets are met and nothing is being throttled, there's no way to tell how saturated the underlying device is - it could be almost entirely idle, at the cusp of saturation or anywhere inbetween. Given that there's no information, it's best to keep vrate as-is in this state. Before 7cd806a9a953 ("iocost: improve nr_lagging handling"), this was the case - if the device isn't missing QoS targets and nothing is being throttled, busy_level was reset to zero.
While fixing nr_lagging handling, 7cd806a9a953 ("iocost: improve nr_lagging handling") broke this. Now, while the device is hitting QoS targets and nothing is being throttled, vrate keeps getting adjusted according to the existing busy_level.
This led to vrate keeping climing till it hits max when there's an IO issuer with limited request concurrency if the vrate started low. vrate starts getting adjusted upwards until the issuer can issue IOs w/o being throttled. From then on, QoS targets keeps getting met and nothing on the system needs throttling and vrate keeps getting increased due to the existing busy_level.
This patch makes the following changes to the busy_level logic.
* Reset busy_level if nr_shortages is zero to avoid the above scenario.
* Make non-zero nr_lagging block lowering nr_level but still clear positive busy_level if there's clear non-saturation signal - QoS targets are met and nr_shortages is non-zero. nr_lagging's role is preventing adjusting vrate upwards while there are long-running commands and it shouldn't keep busy_level positive while there's clear non-saturation signal.
* Restructure code for clarity and add comments.
--- block/blk-iocost.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
block/blk-iocost.c +24 -4
@@ -1546,19 +1546,39 @@ static void ioc_timer_fn(struct timer_list *timer)if (rq_wait_pct >RQ_WAIT_BUSY_PCT || missed_ppm[READ ] > ppm_rthr || missed_ppm[WRITE ] > ppm_wthr) { +/* clearly missing QoS targets, slow down vrate */ ioc->busy_level =max (ioc->busy_level,0 ); ioc->busy_level++; }else if (rq_wait_pct <=RQ_WAIT_BUSY_PCT *UNBUSY_THR_PCT /100 && missed_ppm[READ ] <= ppm_rthr *UNBUSY_THR_PCT /100 && missed_ppm[WRITE ] <= ppm_wthr *UNBUSY_THR_PCT /100 ) { -/* take action iff there is contention */ -if (nr_shortages && !nr_lagging) { +/* QoS targets are being met with >25% margin */ +if (nr_shortages) { +/* +* We're throttling while the device has spare +* capacity. If vrate was being slowed down, stop. +*/ ioc->busy_level =min (ioc->busy_level,0 ); -/* redistribute surpluses first */ -if (!nr_surpluses) + +/* +* If there are IOs spanning multiple periods, wait +* them out before pushing the device harder. If +* there are surpluses, let redistribution work it +* out first. +*/ +if (!nr_lagging && !nr_surpluses) ioc->busy_level--; + }else { +/* +* Nobody is being throttled and the users aren't +* issuing enough IOs to saturate the device. We +* simply don't know how close the device is to +* saturation. Coast. +*/ + ioc->busy_level =0 ; } }else { +/* inside the hysterisis margin, we're good */ ioc->busy_level =0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 125/175 selftests: fix flower parent qdisc
In reply to Sasha LevinFrom: Vlad Buslov <[email protected]>
[ Upstream commit 0531b0357ba37464e5c0033e1b7c69bbf5ecd8fb ]
Flower tests used to create ingress filter with specified parent qdisc "parent ffff:" but dump them on "ingress". With recent commit that fixed tcm_parent handling in dump those are not considered same parent anymore, which causes iproute2 tc to emit additional "parent ffff:" in first line of filter dump output. The change in output causes filter match in tests to fail.
Prevent parent qdisc output when dumping filters in flower tests by always correctly specifying "ingress" parent both when creating and dumping filters.
--- .../selftests/tc-testing/tc-tests/filters/tests.json | 6 +++--- tools/testing/selftests/tc-testing/tdc_batch.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/tc-testing/tc-tests/filters/tests.json +3 -3
@@ -54,7 +54,7 @@ "setup": [ "$TC qdisc add dev $DEV2 ingress" ], - "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 parent ffff: handle 0xffffffff flower action ok", + "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 ingress handle 0xffffffff flower action ok", "expExitCode": "0", "verifyCmd": "$TC filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower.*handle 0xffffffff",
@@ -99,9 +99,9 @@ }, "setup": [ "$TC qdisc add dev $DEV2 ingress", - "$TC filter add dev $DEV2 protocol ip prio 1 parent ffff: flower dst_mac e4:11:22:11:4a:51 src_mac e4:11:22:11:4a:50 ip_proto tcp src_ip 1.1.1.1 dst_ip 2.2.2.2 action drop" + "$TC filter add dev $DEV2 protocol ip prio 1 ingress flower dst_mac e4:11:22:11:4a:51 src_mac e4:11:22:11:4a:50 ip_proto tcp src_ip 1.1.1.1 dst_ip 2.2.2.2 action drop" ], - "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip prio 1 parent ffff: flower dst_mac e4:11:22:11:4a:51 src_mac e4:11:22:11:4a:50 ip_proto tcp src_ip 1.1.1.1 dst_ip 2.2.2.2 action drop", + "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip prio 1 ingress flower dst_mac e4:11:22:11:4a:51 src_mac e4:11:22:11:4a:50 ip_proto tcp src_ip 1.1.1.1 dst_ip 2.2.2.2 action drop", "expExitCode": "2", "verifyCmd": "$TC -s filter show dev $DEV2 ingress", "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
tools/testing/selftests/tc-testing/tdc_batch.py +3 -3
@@ -72,21 +72,21 @@ mac_prefix = args.mac_prefix def format_add_filter(device, prio, handle, skip, src_mac, dst_mac, share_action): - return ("filter add dev {} {} protocol ip parent ffff: handle {} " + return ("filter add dev {} {} protocol ip ingress handle {} " " flower {} src_mac {} dst_mac {} action drop {}".format( device, prio, handle, skip, src_mac, dst_mac, share_action)) def format_rep_filter(device, prio, handle, skip, src_mac, dst_mac, share_action): - return ("filter replace dev {} {} protocol ip parent ffff: handle {} " + return ("filter replace dev {} {} protocol ip ingress handle {} " " flower {} src_mac {} dst_mac {} action drop {}".format( device, prio, handle, skip, src_mac, dst_mac, share_action)) def format_del_filter(device, prio, handle, skip, src_mac, dst_mac, share_action): - return ("filter del dev {} {} protocol ip parent ffff: handle {} " + return ("filter del dev {} {} protocol ip ingress handle {} " "flower".format(device, prio, handle))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 126/175 veth: Adjust hard_start offset on redirect XDP frames
In reply to Sasha LevinFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 5c8572251fabc5bb49fd623c064e95a9daf6a3e3 ]
When native XDP redirect into a veth device, the frame arrives in the xdp_frame structure. It is then processed in veth_xdp_rcv_one(), which can run a new XDP bpf_prog on the packet. Doing so requires converting xdp_frame to xdp_buff, but the tricky part is that xdp_frame memory area is located in the top (data_hard_start) memory area that xdp_buff will point into.
The current code tried to protect the xdp_frame area, by assigning xdp_buff.data_hard_start past this memory. This results in 32 bytes less headroom to expand into via BPF-helper bpf_xdp_adjust_head().
This protect step is actually not needed, because BPF-helper bpf_xdp_adjust_head() already reserve this area, and don't allow BPF-prog to expand into it. Thus, it is safe to point data_hard_start directly at xdp_frame memory area.
--- drivers/net/veth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/veth.c +4 -4
@@ -510,13 +510,15 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq, struct veth_xdp_tx_bq *bq) {void *hard_start = frame->data - frame->headroom; -void *head = hard_start -sizeof (struct xdp_frame );int len = frame->len, delta =0 ;struct xdp_frame orig_frame;struct bpf_prog *xdp_prog;unsigned int headroom;struct sk_buff *skb; +/* bpf_xdp_adjust_head() assures BPF cannot access xdp_frame area */ + hard_start -=sizeof (struct xdp_frame ); +rcu_read_lock (); xdp_prog =rcu_dereference (rq->xdp_prog);if (likely (xdp_prog)) {
@@ -538,7 +540,6 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,break ;case XDP_TX : orig_frame = *frame; - xdp.data_hard_start = head; xdp.rxq->mem = frame->mem;if (unlikely (veth_xdp_tx (rq->dev, &xdp, bq) <0 )) {trace_xdp_exception (rq->dev, xdp_prog, act);
@@ -550,7 +551,6 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq, goto xdp_xmit;case XDP_REDIRECT : orig_frame = *frame; - xdp.data_hard_start = head; xdp.rxq->mem = frame->mem;if (xdp_do_redirect (rq->dev, &xdp, xdp_prog)) { frame = &orig_frame;
@@ -572,7 +572,7 @@ static struct sk_buff *veth_xdp_rcv_one(struct veth_rq *rq,rcu_read_unlock (); headroom =sizeof (struct xdp_frame ) + frame->headroom - delta; - skb =veth_build_skb (head, headroom, len,0 ); + skb =veth_build_skb (hard_start, headroom, len,0 );if (!skb) {xdp_return_frame (frame); goto err;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 127/175 net/mlx5e: IPoIB, Drop multicast packets that this interface sent
In reply to Sasha LevinFrom: Erez Shitrit <[email protected]>
[ Upstream commit 8b46d424a743ddfef8056d5167f13ee7ebd1dcad ]
After enabled loopback packets for IPoIB, we need to drop these packets that this HCA has replicated and came back to the same interface that sent them.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +12 -3
@@ -1428,6 +1428,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)#ifdef CONFIG_MLX5_CORE_IPOIB +#define MLX5_IB_GRH_SGID_OFFSET 8#define MLX5_IB_GRH_DGID_OFFSET 24#define MLX5_GID_SIZE 16
@@ -1441,6 +1442,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,struct net_device *netdev;struct mlx5e_priv *priv;char *pseudo_header; +u32 flags_rqpn;u32 qpn;u8 *dgid;u8 g;
@@ -1462,7 +1464,8 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, tstamp = &priv->tstamp; stats = &priv->channel_stats[rq->ix].rq; - g = (be32_to_cpu (cqe->flags_rqpn) >>28 ) &3 ; + flags_rqpn =be32_to_cpu (cqe->flags_rqpn); + g = (flags_rqpn >>28 ) &3 ; dgid = skb->data +MLX5_IB_GRH_DGID_OFFSET ;if ((!g) || dgid[0 ] !=0xff ) skb->pkt_type =PACKET_HOST ;
@@ -1471,9 +1474,15 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,else skb->pkt_type =PACKET_MULTICAST ; -/* TODO: IB/ipoib: Allow mcast packets from other VFs -* 68996a6e760e5c74654723eeb57bf65628ae87f4 +/* Drop packets that this interface sent, ie multicast packets +* that the HCA has replicated. */ +if (g && (qpn == (flags_rqpn &0xffffff )) && + (memcmp (netdev->dev_addr +4 , skb->data +MLX5_IB_GRH_SGID_OFFSET , +MLX5_GID_SIZE ) ==0 )) { + skb->dev =NULL ; +return ; + }skb_pull (skb,MLX5_IB_GRH_BYTES );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 128/175 rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit beb12813bc75d4a23de43b85ad1c7cb28d27631e ]
Seven years ago we tried to fix a leak but actually introduced a double free instead. It was an understandable mistake because the code was a bit confusing and the free was done in the wrong place. The "skb" pointer is freed in both _rtl_usb_tx_urb_setup() and _rtl_usb_transmit(). The free belongs _rtl_usb_transmit() instead of _rtl_usb_tx_urb_setup() and I've cleaned the code up a bit to hopefully make it more clear.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +2 -6
@@ -881,10 +881,8 @@ static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw,WARN_ON (NULL == skb); _urb =usb_alloc_urb (0 ,GFP_ATOMIC ); -if (!_urb) { -kfree_skb (skb); +if (!_urb)return NULL ; - }_rtl_install_trx_info (rtlusb, skb, ep_num);usb_fill_bulk_urb (_urb, rtlusb->udev,usb_sndbulkpipe (rtlusb->udev, ep_num), skb->data, skb->len, _rtl_tx_complete, skb);
@@ -898,7 +896,6 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,struct rtl_usb *rtlusb =rtl_usbdev (rtl_usbpriv (hw));u32 ep_num;struct urb *_urb =NULL ; -struct sk_buff *_skb =NULL ;WARN_ON (NULL == rtlusb->usb_tx_aggregate_hdl);if (unlikely (IS_USB_STOP (rtlusb))) {
@@ -907,8 +904,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,return ; } ep_num = rtlusb->ep_map.ep_mapping[qnum]; - _skb = skb; - _urb =_rtl_usb_tx_urb_setup (hw, _skb, ep_num); + _urb =_rtl_usb_tx_urb_setup (hw, skb, ep_num);if (unlikely (!_urb)) {pr_err ("Can't allocate urb. Drop skb!\n" );kfree_skb (skb);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 129/175 mwifiex: Fix memory corruption in dump_station
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 3aa42bae9c4d1641aeb36f1a8585cd1d506cf471 ]
The mwifiex_cfg80211_dump_station() uses static variable for iterating over a linked list of all associated stations (when the driver is in UAP role). This has a race condition if .dump_station is called in parallel for multiple interfaces. This corruption can be triggered by registering multiple SSIDs and calling, in parallel for multiple interfaces
iw dev <iface> station dump
[16750.719775] Unable to handle kernel paging request at virtual address dead000000000110 ... [16750.899173] Call trace: [16750.901696] mwifiex_cfg80211_dump_station+0x94/0x100 [mwifiex] [16750.907824] nl80211_dump_station+0xbc/0x278 [cfg80211] [16750.913160] netlink_dump+0xe8/0x320 [16750.916827] netlink_recvmsg+0x1b4/0x338 [16750.920861] ____sys_recvmsg+0x7c/0x2b0 [16750.924801] ___sys_recvmsg+0x70/0x98 [16750.928564] __sys_recvmsg+0x58/0xa0 [16750.932238] __arm64_sys_recvmsg+0x28/0x30 [16750.936453] el0_svc_common.constprop.3+0x90/0x158 [16750.941378] do_el0_svc+0x74/0x90 [16750.944784] el0_sync_handler+0x12c/0x1a8 [16750.948903] el0_sync+0x114/0x140 [16750.952312] Code: f9400003 f907f423 eb02007f 54fffd60 (b9401060) [16750.958583] ---[ end trace c8ad181c2f4b8576 ]---
This patch drops the use of the static iterator, and instead every time the function is called iterates to the idx-th position of the linked-list.
It would be better to convert the code not to use linked list for associated stations storage (since the chip has a limited number of associated stations anyway - it could just be an array). Such a change may be proposed in the future. In the meantime this patch can backported into stable kernels in this simple form.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -8
@@ -1496,7 +1496,8 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); -static struct mwifiex_sta_node *node; +struct mwifiex_sta_node *node; +int i;if ((GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_STA ) && priv->media_connected && idx ==0 ) {
@@ -1506,13 +1507,10 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,mwifiex_send_cmd (priv,HOST_CMD_APCMD_STA_LIST , HostCmd_ACT_GEN_GET,0 ,NULL , true); -if (node && (&node->list == &priv->sta_list)) { - node =NULL ; -return -ENOENT ; - } - - node =list_prepare_entry (node, &priv->sta_list, list); -list_for_each_entry_continue (node, &priv->sta_list, list) { + i =0 ; +list_for_each_entry (node, &priv->sta_list, list) { +if (i++ != idx) +continue ;ether_addr_copy (mac, node->mac_addr);return mwifiex_dump_station_info (priv, node, sinfo); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 130/175 kgdboc: Use a platform device to handle tty drivers showing up late
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit 68e55f61c13842baf825958129698c5371db432c ]
If you build CONFIG_KGDB_SERIAL_CONSOLE into the kernel then you should be able to have KGDB init itself at bootup by specifying the "kgdboc=..." kernel command line parameter. This has worked OK for me for many years, but on a new device I switched to it stopped working.
The problem is that on this new device the serial driver gets its probe deferred. Now when kgdb initializes it can't find the tty driver and when it gives up it never tries again.
We could try to find ways to move up the initialization of the serial driver and such a thing might be worthwhile, but it's nice to be robust against serial drivers that load late. We could move kgdb to init itself later but that penalizes our ability to debug early boot code on systems where the driver inits early. We could roll our own system of detecting when new tty drivers get loaded and then use that to figure out when kgdb can init, but that's ugly.
Instead, let's jump on the -EPROBE_DEFER bandwagon. We'll create a singleton instance of a "kgdboc" platform device. If we can't find our tty device when the singleton "kgdboc" probes we'll return -EPROBE_DEFER which means that the system will call us back later to try again when the tty device might be there.
We won't fully transition all of the kgdboc to a platform device because early kgdb initialization (via the "ekgdboc" kernel command line parameter) still runs before the platform device has been created. The kgdb platform device is merely used as a convenient way to hook into the system's normal probe deferral mechanisms.
As part of this, we'll ever-so-slightly change how the "kgdboc=..." kernel command line parameter works. Previously if you booted up and kgdb couldn't find the tty driver then later reading '/sys/module/kgdboc/parameters/kgdboc' would return a blank string. Now kgdb will keep track of the string that came as part of the command line and give it back to you. It's expected that this should be an OK change.
--- drivers/tty/serial/kgdboc.c | 126 +++++++++++++++++++++++++++++------- 1 file changed, 101 insertions(+), 25 deletions(-)
drivers/tty/serial/kgdboc.c +101 -25
@@ -20,6 +20,7 @@#include <linux/vt_kern.h> #include <linux/input.h> #include <linux/module.h> +#include <linux/platform_device.h> #define MAX_CONFIG_LEN 40
@@ -27,6 +28,7 @@ static struct kgdb_io kgdboc_io_ops;/* -1 = init not run yet, 0 = unconfigured, 1 = configured. */ static int configured =-1 ; +static DEFINE_MUTEX (config_mutex);static char config[MAX_CONFIG_LEN ];static struct kparam_string kps = {
@@ -38,6 +40,8 @@ static int kgdboc_use_kms; /* 1 if we use kernel mode switching */static struct tty_driver *kgdb_tty_driver;static int kgdb_tty_line; +static struct platform_device *kgdboc_pdev; +#ifdef CONFIG_KDB_KEYBOARD static int kgdboc_reset_connect(struct input_handler *handler, struct input_dev *dev,
@@ -133,11 +137,13 @@ static void kgdboc_unregister_kbd(void)static void cleanup_kgdboc (void ) { +if (configured !=1 ) +return ; +if (kgdb_unregister_nmi_console ())return ;kgdboc_unregister_kbd (); -if (configured ==1 ) -kgdb_unregister_io_module (&kgdboc_io_ops); +kgdb_unregister_io_module (&kgdboc_io_ops); }static int configure_kgdboc (void )
@@ -200,20 +206,79 @@ static int configure_kgdboc(void)kgdb_unregister_io_module (&kgdboc_io_ops); noconfig:kgdboc_unregister_kbd (); - config[0 ] =0 ; configured =0 ; -cleanup_kgdboc ();return err; } +static int kgdboc_probe (struct platform_device *pdev) +{ +int ret =0 ; + +mutex_lock (&config_mutex); +if (configured !=1 ) { + ret =configure_kgdboc (); + +/* Convert "no device" to "defer" so we'll keep trying */ +if (ret == -ENODEV ) + ret = -EPROBE_DEFER ; + } +mutex_unlock (&config_mutex); + +return ret; +} + +static struct platform_driver kgdboc_platform_driver = { + .probe = kgdboc_probe, + .driver = { + .name ="kgdboc" , + .suppress_bind_attrs = true, + }, +}; +static int __init init_kgdboc (void ) { -/* Already configured? */ -if (configured ==1 ) +int ret; + +/* +* kgdboc is a little bit of an odd "platform_driver". It can be +* up and running long before the platform_driver object is +* created and thus doesn't actually store anything in it. There's +* only one instance of kgdb so anything is stored as global state. +* The platform_driver is only created so that we can leverage the +* kernel's mechanisms (like -EPROBE_DEFER) to call us when our +* underlying tty is ready. Here we init our platform driver and +* then create the single kgdboc instance. +*/ + ret =platform_driver_register (&kgdboc_platform_driver); +if (ret) +return ret; + + kgdboc_pdev =platform_device_alloc ("kgdboc" ,PLATFORM_DEVID_NONE ); +if (!kgdboc_pdev) { + ret = -ENOMEM ; + goto err_did_register; + } + + ret =platform_device_add (kgdboc_pdev); +if (!ret)return 0 ; -return configure_kgdboc (); +platform_device_put (kgdboc_pdev); + +err_did_register: +platform_driver_unregister (&kgdboc_platform_driver); +return ret; +} + +static void exit_kgdboc (void ) +{ +mutex_lock (&config_mutex); +cleanup_kgdboc (); +mutex_unlock (&config_mutex); + +platform_device_unregister (kgdboc_pdev); +platform_driver_unregister (&kgdboc_platform_driver); }static int kgdboc_get_char (void )
@@ -236,24 +301,20 @@ static int param_set_kgdboc_var(const char *kmessage, const struct kernel_param *kp) {size_t len =strlen (kmessage); +int ret =0 ;if (len >=MAX_CONFIG_LEN ) {pr_err ("config string too long\n" );return -ENOSPC ; } -/* Only copy in the string if the init function has not run yet */ -if (configured <0 ) { -strcpy (config, kmessage); -return 0 ; - } -if (kgdb_connected) {pr_err ("Cannot reconfigure while KGDB is connected.\n" ); -return -EBUSY ; } +mutex_lock (&config_mutex); +strcpy (config, kmessage);/* Chop out \n char as a result of echo */ if (len && config[len -1 ] =='\n' )
@@ -262,8 +323,30 @@ static int param_set_kgdboc_var(const char *kmessage,if (configured ==1 )cleanup_kgdboc (); -/* Go and configure with the new params. */ -return configure_kgdboc (); +/* +* Configure with the new params as long as init already ran. +* Note that we can get called before init if someone loads us +* with "modprobe kgdboc kgdboc=..." or if they happen to use the +* the odd syntax of "kgdboc.kgdboc=..." on the kernel command. +*/ +if (configured >=0 ) + ret =configure_kgdboc (); + +/* +* If we couldn't configure then clear out the config. Note that +* specifying an invalid config on the kernel command line vs. +* through sysfs have slightly different behaviors. If we fail +* to configure what was specified on the kernel command line +* we'll leave it in the 'config' and return -EPROBE_DEFER from +* our probe. When specified through sysfs userspace is +* responsible for loading the tty driver before setting up. +*/ +if (ret) + config[0 ] ='\0' ; + +mutex_unlock (&config_mutex); + +return ret; }static int dbg_restore_graphics;
@@ -326,15 +409,8 @@ __setup("kgdboc=", kgdboc_option_setup);/* This is only available if kgdboc is a built in for early debugging */ static int __init kgdboc_early_init (char *opt) { -/* save the first character of the config string because the -* init routine can destroy it. -*/ -char save_ch; -kgdboc_option_setup (opt); - save_ch = config[0 ]; -init_kgdboc (); - config[0 ] = save_ch; +configure_kgdboc ();return 0 ; }
@@ -342,7 +418,7 @@ early_param("ekgdboc", kgdboc_early_init);#endif /* CONFIG_KGDB_SERIAL_CONSOLE */ module_init (init_kgdboc); -module_exit (cleanup_kgdboc); +module_exit (exit_kgdboc);module_param_call (kgdboc, param_set_kgdboc_var, param_get_string, &kps,0644 );MODULE_PARM_DESC (kgdboc,"<serial_device>[,baud]" );MODULE_DESCRIPTION ("KGDB Console TTY Driver" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 131/175 x86/boot: Correct relocation destination on old linkers
In reply to Sasha LevinFrom: Arvind Sankar <[email protected]>
[ Upstream commit 5214028dd89e49ba27007c3ee475279e584261f0 ]
For the 32-bit kernel, as described in
6d92bc9d483a ("x86/build: Build compressed x86 kernels as PIE"),
pre-2.26 binutils generates R_386_32 relocations in PIE mode. Since the startup code does not perform relocation, any reloc entry with R_386_32 will remain as 0 in the executing code.
Commit
974f221c84b0 ("x86/boot: Move compressed kernel to the end of the
decompression buffer")
added a new symbol _end but did not mark it hidden, which doesn't give the correct offset on older linkers. This causes the compressed kernel to be copied beyond the end of the decompression buffer, rather than flush against it. This region of memory may be reserved or already allocated for other purposes by the bootloader.
Mark _end as hidden to fix. This changes the relocation from R_386_32 to R_386_RELATIVE even on the pre-2.26 binutils.
For 64-bit, this is not strictly necessary, as the 64-bit kernel is only built as PIE if the linker supports -z noreloc-overflow, which implies binutils-2.27+, but for consistency, mark _end as hidden here too.
The below illustrates the before/after impact of the patch using binutils-2.25 and gcc-4.6.4 (locally compiled from source) and QEMU.
Disassembly before patch:
48: 8b 86 60 02 00 00 mov 0x260(%esi),%eax
4e: 2d 00 00 00 00 sub $0x0,%eax
4f: R_386_32 _end
Disassembly after patch:
48: 8b 86 60 02 00 00 mov 0x260(%esi),%eax
4e: 2d 00 f0 76 00 sub $0x76f000,%eax
4f: R_386_RELATIVE *ABS*Dump from extract_kernel before patch:
early console in extract_kernel input_data: 0x0207c098 <--- this is at output + init_size input_len: 0x0074fef1 output: 0x01000000 output_len: 0x00fa63d0 kernel_total_size: 0x0107c000 needed_size: 0x0107c000
Dump from extract_kernel after patch:
early console in extract_kernel input_data: 0x0190d098 <--- this is at output + init_size - _end input_len: 0x0074fef1 output: 0x01000000 output_len: 0x00fa63d0 kernel_total_size: 0x0107c000 needed_size: 0x0107c000
--- arch/x86/boot/compressed/head_32.S | 5 +++-- arch/x86/boot/compressed/head_64.S | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/boot/compressed/head_32.S +3 -2
@@ -49,16 +49,17 @@ * Position Independent Executable (PIE) so that linker won't optimize * R_386_GOT32X relocation to its fixed symbol address. Older * linkers generate R_386_32 relocations against locally defined symbols, - * _bss, _ebss, _got and _egot, in PIE. It isn't wrong, just less + * _bss, _ebss, _got, _egot and _end, in PIE. It isn't wrong, just less * optimal than R_386_RELATIVE. But the x86 kernel fails to properly handle * R_386_32 relocations when relocating the kernel. To generate - * R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as + * R_386_RELATIVE relocations, we mark _bss, _ebss, _got, _egot and _end as * hidden: */ .hidden _bss .hidden _ebss .hidden _got .hidden _egot + .hidden _end __HEAD ENTRY(startup_32)
arch/x86/boot/compressed/head_64.S +1 -0
@@ -42,6 +42,7 @@ .hidden _ebss .hidden _got .hidden _egot + .hidden _end __HEAD .code32
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 132/175 sched: Defend cfs and rt bandwidth quota against overflow
In reply to Sasha LevinFrom: Huaixin Chang <[email protected]>
[ Upstream commit d505b8af58912ae1e1a211fabc9995b19bd40828 ]
When users write some huge number into cpu.cfs_quota_us or cpu.rt_runtime_us, overflow might happen during to_ratio() shifts of schedulable checks.
to_ratio() could be altered to avoid unnecessary internal overflow, but min_cfs_quota_period is less than 1 << BW_SHIFT, so a cutoff would still be needed. Set a cap MAX_BW for cfs_quota_us and rt_runtime_us to prevent overflow.
--- kernel/sched/core.c | 8 ++++++++ kernel/sched/rt.c | 12 +++++++++++- kernel/sched/sched.h | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-)
kernel/sched/core.c +8 -0
@@ -7374,6 +7374,8 @@ static DEFINE_MUTEX(cfs_constraints_mutex);const u64 max_cfs_quota_period =1 *NSEC_PER_SEC ;/* 1s */ static const u64 min_cfs_quota_period =1 *NSEC_PER_MSEC ;/* 1ms */ +/* More than 203 days if BW_SHIFT equals 20. */ +static const u64 max_cfs_runtime =MAX_BW *NSEC_PER_USEC ;static int __cfs_schedulable (struct task_group *tg,u64 period,u64 runtime);
@@ -7401,6 +7403,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)if (period > max_cfs_quota_period)return -EINVAL ; +/* +* Bound quota to defend quota against overflow during bandwidth shift. +*/ +if (quota !=RUNTIME_INF && quota > max_cfs_runtime) +return -EINVAL ; +/* * Prevent race between setting of cfs_rq->runtime_enabled and * unthrottle_offline_cfs_rqs().
kernel/sched/rt.c +11 -1
@@ -9,6 +9,8 @@int sched_rr_timeslice =RR_TIMESLICE ;int sysctl_sched_rr_timeslice = (MSEC_PER_SEC /HZ ) *RR_TIMESLICE ; +/* More than 4 hours if BW_SHIFT equals 20. */ +static const u64 max_rt_runtime =MAX_BW ;static int do_sched_rt_period_timer (struct rt_bandwidth *rt_b,int overrun);
@@ -2513,6 +2515,12 @@ static int tg_set_rt_bandwidth(struct task_group *tg,if (rt_period ==0 )return -EINVAL ; +/* +* Bound quota to defend quota against overflow during bandwidth shift. +*/ +if (rt_runtime !=RUNTIME_INF && rt_runtime > max_rt_runtime) +return -EINVAL ; +mutex_lock (&rt_constraints_mutex);read_lock (&tasklist_lock); err =__rt_schedulable (tg, rt_period, rt_runtime);
@@ -2634,7 +2642,9 @@ static int sched_rt_global_validate(void)return -EINVAL ;if ((sysctl_sched_rt_runtime !=RUNTIME_INF ) && - (sysctl_sched_rt_runtime > sysctl_sched_rt_period)) + ((sysctl_sched_rt_runtime > sysctl_sched_rt_period) || + ((u64 )sysctl_sched_rt_runtime * +NSEC_PER_USEC > max_rt_runtime)))return -EINVAL ;return 0 ;
kernel/sched/sched.h +2 -0
@@ -1889,6 +1889,8 @@ extern void init_dl_rq_bw_ratio(struct dl_rq *dl_rq);#define BW_SHIFT 20#define BW_UNIT (1 << BW_SHIFT)#define RATIO_SHIFT 8 +#define MAX_BW_BITS (64 - BW_SHIFT) +#define MAX_BW ((1ULL << MAX_BW_BITS) - 1)unsigned long to_ratio (u64 period,u64 runtime);extern void init_entity_runnable_average (struct sched_entity *se);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 133/175 mips: MAAR: Use more precise address mask
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit bbb5946eb545fab8ad8f46bce8a803e1c0c39d47 ]
Indeed according to the MIPS32 Privileged Resource Architecgture the MAAR pair register address field either takes [12:31] bits for non-XPA systems and [12:55] otherwise. In any case the current address mask is just wrong for 64-bit and 32-bits XPA chips. So lets extend it to 59-bits of physical address value. This shall cover the 64-bits architecture and systems with XPA enabled, and won't cause any problem for non-XPA 32-bit systems, since address values exceeding the architecture specific MAAR mask will be just truncated with setting zeros in the unsupported upper bits.
--- arch/mips/include/asm/mipsregs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/mipsregs.h +1 -1
@@ -750,7 +750,7 @@/* MAAR bit definitions */ #define MIPS_MAAR_VH (_U64CAST_(1) << 63) -#define MIPS_MAAR_ADDR ((BIT_ULL(BITS_PER_LONG - 12) - 1) << 12) +#define MIPS_MAAR_ADDR GENMASK_ULL(55, 12)#define MIPS_MAAR_ADDR_SHIFT 12#define MIPS_MAAR_S (_ULCAST_(1) << 1)#define MIPS_MAAR_VL (_ULCAST_(1) << 0)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 134/175 mips: Add udelay lpj numbers adjustment
In reply to Sasha LevinFrom: Serge Semin <[email protected]>
[ Upstream commit ed26aacfb5f71eecb20a51c4467da440cb719d66 ]
Loops-per-jiffies is a special number which represents a number of noop-loop cycles per CPU-scheduler quantum - jiffies. As you understand aside from CPU-specific implementation it depends on the CPU frequency. So when a platform has the CPU frequency fixed, we have no problem and the current udelay interface will work just fine. But as soon as CPU-freq driver is enabled and the cores frequency changes, we'll end up with distorted udelay's. In order to fix this we have to accordinly adjust the per-CPU udelay_val (the same as the global loops_per_jiffy) number. This can be done in the CPU-freq transition event handler. We subscribe to that event in the MIPS arch time-inititalization method.
--- arch/mips/kernel/time.c | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
arch/mips/kernel/time.c +70 -0
@@ -18,12 +18,82 @@#include <linux/smp.h> #include <linux/spinlock.h> #include <linux/export.h> +#include <linux/cpufreq.h> +#include <linux/delay.h> #include <asm/cpu-features.h> #include <asm/cpu-type.h> #include <asm/div64.h> #include <asm/time.h> +#ifdef CONFIG_CPU_FREQ + +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref); +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref_freq); +static unsigned long glb_lpj_ref; +static unsigned long glb_lpj_ref_freq; + +static int cpufreq_callback (struct notifier_block *nb, +unsigned long val,void *data) +{ +struct cpufreq_freqs *freq = data; +struct cpumask *cpus = freq->policy->cpus; +unsigned long lpj; +int cpu; + +/* +* Skip lpj numbers adjustment if the CPU-freq transition is safe for +* the loops delay. (Is this possible?) +*/ +if (freq->flags &CPUFREQ_CONST_LOOPS ) +return NOTIFY_OK ; + +/* Save the initial values of the lpjes for future scaling. */ +if (!glb_lpj_ref) { + glb_lpj_ref = boot_cpu_data.udelay_val; + glb_lpj_ref_freq = freq->old; + +for_each_online_cpu (cpu) { +per_cpu (pcp_lpj_ref, cpu) = + cpu_data[cpu].udelay_val; +per_cpu (pcp_lpj_ref_freq, cpu) = freq->old; + } + } + +/* +* Adjust global lpj variable and per-CPU udelay_val number in +* accordance with the new CPU frequency. +*/ +if ((val ==CPUFREQ_PRECHANGE && freq->old < freq->new) || + (val ==CPUFREQ_POSTCHANGE && freq->old > freq->new)) { + loops_per_jiffy =cpufreq_scale (glb_lpj_ref, + glb_lpj_ref_freq, + freq->new); + +for_each_cpu (cpu, cpus) { + lpj =cpufreq_scale (per_cpu (pcp_lpj_ref, cpu), +per_cpu (pcp_lpj_ref_freq, cpu), + freq->new); + cpu_data[cpu].udelay_val = (unsigned int )lpj; + } + } + +return NOTIFY_OK ; +} + +static struct notifier_block cpufreq_notifier = { + .notifier_call = cpufreq_callback, +}; + +static int __init register_cpufreq_notifier (void ) +{ +return cpufreq_register_notifier (&cpufreq_notifier, +CPUFREQ_TRANSITION_NOTIFIER ); +} +core_initcall (register_cpufreq_notifier); + +#endif /* CONFIG_CPU_FREQ */ +/* * forward reference */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 135/175 crypto: stm32/crc32 - fix ext4 chksum BUG_ON()
In reply to Sasha LevinFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit 49c2c082e00e0bc4f5cbb7c21c7f0f873b35ab09 ]
Allow use of crc_update without prior call to crc_init.
And change (and fix) driver to use CRC device even on unaligned buffers.
--- drivers/crypto/stm32/stm32-crc32.c | 98 +++++++++++++++--------------- 1 file changed, 48 insertions(+), 50 deletions(-)
drivers/crypto/stm32/stm32-crc32.c +48 -50
@@ -28,8 +28,10 @@/* Registers values */ #define CRC_CR_RESET BIT(0) -#define CRC_CR_REVERSE (BIT(7) | BIT(6) | BIT(5))#define CRC_INIT_DEFAULT 0xFFFFFFFF +#define CRC_CR_REV_IN_WORD (BIT(6) | BIT(5)) +#define CRC_CR_REV_IN_BYTE BIT(5) +#define CRC_CR_REV_OUT BIT(7)#define CRC_AUTOSUSPEND_DELAY 50
@@ -38,8 +40,6 @@ struct stm32_crc {struct device *dev;void __iomem *regs;struct clk *clk; -u8 pending_data[sizeof (u32)]; -size_t nb_pending_bytes; };struct stm32_crc_list {
@@ -59,7 +59,6 @@ struct stm32_crc_ctx {struct stm32_crc_desc_ctx {u32 partial;/* crc32c: partial in first 4 bytes of that struct */ -struct stm32_crc *crc; };static int stm32_crc32_cra_init (struct crypto_tfm *tfm)
@@ -101,25 +100,22 @@ static int stm32_crc_init(struct shash_desc *desc)struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); -list_for_each_entry (crc, &crc_list.dev_list, list) { - ctx->crc = crc; -break ; - } + crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list);spin_unlock_bh (&crc_list.lock); -pm_runtime_get_sync (ctx->crc->dev); +pm_runtime_get_sync (crc->dev);/* Reset, set key, poly and configure in bit reverse mode */ -writel_relaxed (bitrev32 (mctx->key), ctx->crc->regs +CRC_INIT ); -writel_relaxed (bitrev32 (mctx->poly), ctx->crc->regs +CRC_POL ); -writel_relaxed (CRC_CR_RESET |CRC_CR_REVERSE , ctx->crc->regs +CRC_CR ); +writel_relaxed (bitrev32 (mctx->key), crc->regs +CRC_INIT ); +writel_relaxed (bitrev32 (mctx->poly), crc->regs +CRC_POL ); +writel_relaxed (CRC_CR_RESET |CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR );/* Store partial result */ - ctx->partial =readl_relaxed (ctx->crc->regs +CRC_DR ); - ctx->crc->nb_pending_bytes =0 ; + ctx->partial =readl_relaxed (crc->regs +CRC_DR ); -pm_runtime_mark_last_busy (ctx->crc->dev); -pm_runtime_put_autosuspend (ctx->crc->dev); +pm_runtime_mark_last_busy (crc->dev); +pm_runtime_put_autosuspend (crc->dev);return 0 ; }
@@ -128,31 +124,49 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8, unsigned int length) {struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); -struct stm32_crc *crc = ctx->crc; -u32 *d32; -unsigned int i; +struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm); +struct stm32_crc *crc; + +spin_lock_bh (&crc_list.lock); + crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); +spin_unlock_bh (&crc_list.lock);pm_runtime_get_sync (crc->dev); -if (unlikely (crc->nb_pending_bytes)) { -while (crc->nb_pending_bytes !=sizeof (u32) && length) { -/* Fill in pending data */ - crc->pending_data[crc->nb_pending_bytes++] = *(d8++); +/* +* Restore previously calculated CRC for this context as init value +* Restore polynomial configuration +* Configure in register for word input data, +* Configure out register in reversed bit mode data. +*/ +writel_relaxed (bitrev32 (ctx->partial), crc->regs +CRC_INIT ); +writel_relaxed (bitrev32 (mctx->poly), crc->regs +CRC_POL ); +writel_relaxed (CRC_CR_RESET |CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); + +if (d8 !=PTR_ALIGN (d8,sizeof (u32))) { +/* Configure for byte data */ +writel_relaxed (CRC_CR_REV_IN_BYTE |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); +while (d8 !=PTR_ALIGN (d8,sizeof (u32)) && length) { +writeb_relaxed (*d8++, crc->regs +CRC_DR ); length--; } - -if (crc->nb_pending_bytes ==sizeof (u32)) { -/* Process completed pending data */ -writel_relaxed (*(u32 *)crc->pending_data, - crc->regs +CRC_DR ); - crc->nb_pending_bytes =0 ; - } +/* Configure for word data */ +writel_relaxed (CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); } - d32 = (u32 *)d8; -for (i =0 ; i < length >>2 ; i++) -/* Process 32 bits data */ -writel_relaxed (*(d32++), crc->regs +CRC_DR ); +for (; length >=sizeof (u32); d8 +=sizeof (u32), length -=sizeof (u32)) +writel_relaxed (*((u32 *)d8), crc->regs +CRC_DR ); + +if (length) { +/* Configure for byte data */ +writel_relaxed (CRC_CR_REV_IN_BYTE |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); +while (length--) +writeb_relaxed (*d8++, crc->regs +CRC_DR ); + }/* Store partial result */ ctx->partial =readl_relaxed (crc->regs +CRC_DR );
@@ -160,22 +174,6 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8,pm_runtime_mark_last_busy (crc->dev);pm_runtime_put_autosuspend (crc->dev); -/* Check for pending data (non 32 bits) */ - length &=3 ; -if (likely (!length)) -return 0 ; - -if ((crc->nb_pending_bytes + length) >=sizeof (u32)) { -/* Shall not happen */ -dev_err (crc->dev,"Pending data overflow\n" ); -return -EINVAL ; - } - - d8 = (const u8 *)d32; -for (i =0 ; i < length; i++) -/* Store pending data */ - crc->pending_data[crc->nb_pending_bytes++] = *(d8++); -return 0 ; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 136/175 crypto: stm32/crc32 - fix run-time self test issue.
In reply to Sasha LevinFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit a8cc3128bf2c01c4d448fe17149e87132113b445 ]
Fix wrong crc32 initialisation value:
"alg: shash: stm32_crc32 test failed (wrong result) on test vector 0, cfg="init+update+final aligned buffer"
cra_name="crc32c" expects an init value of 0XFFFFFFFF, cra_name="crc32" expects an init value of 0.
--- drivers/crypto/stm32/stm32-crc32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/stm32/stm32-crc32.c +3 -3
@@ -28,10 +28,10 @@/* Registers values */ #define CRC_CR_RESET BIT(0) -#define CRC_INIT_DEFAULT 0xFFFFFFFF#define CRC_CR_REV_IN_WORD (BIT(6) | BIT(5))#define CRC_CR_REV_IN_BYTE BIT(5)#define CRC_CR_REV_OUT BIT(7) +#define CRC32C_INIT_DEFAULT 0xFFFFFFFF#define CRC_AUTOSUSPEND_DELAY 50
@@ -65,7 +65,7 @@ static int stm32_crc32_cra_init(struct crypto_tfm *tfm) {struct stm32_crc_ctx *mctx =crypto_tfm_ctx (tfm); - mctx->key =CRC_INIT_DEFAULT ; + mctx->key =0 ; mctx->poly =CRC32_POLY_LE ;return 0 ; }
@@ -74,7 +74,7 @@ static int stm32_crc32c_cra_init(struct crypto_tfm *tfm) {struct stm32_crc_ctx *mctx =crypto_tfm_ctx (tfm); - mctx->key =CRC_INIT_DEFAULT ; + mctx->key =CRC32C_INIT_DEFAULT ; mctx->poly =CRC32C_POLY_LE ;return 0 ; }
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 137/175 crypto: stm32/crc32 - fix multi-instance
In reply to Sasha LevinFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit 10b89c43a64eb0d236903b79a3bc9d8f6cbfd9c7 ]
Ensure CRC algorithm is registered only once in crypto framework when there are several instances of CRC devices.
Update the CRC device list management to avoid that only the first CRC instance is used.
--- drivers/crypto/stm32/stm32-crc32.c | 48 ++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 12 deletions(-)
drivers/crypto/stm32/stm32-crc32.c +36 -12
@@ -93,16 +93,29 @@ static int stm32_crc_setkey(struct crypto_shash *tfm, const u8 *key,return 0 ; } -static int stm32_crc_init (struct shash_desc *desc) +static struct stm32_crc *stm32_crc_get_next_crc (void ) { -struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); -struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm);struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); +if (crc) +list_move_tail (&crc->list, &crc_list.dev_list);spin_unlock_bh (&crc_list.lock); +return crc; +} + +static int stm32_crc_init (struct shash_desc *desc) +{ +struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); +struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm); +struct stm32_crc *crc; + + crc =stm32_crc_get_next_crc (); +if (!crc) +return -ENODEV ; +pm_runtime_get_sync (crc->dev);/* Reset, set key, poly and configure in bit reverse mode */
@@ -127,9 +140,9 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8,struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm);struct stm32_crc *crc; -spin_lock_bh (&crc_list.lock); - crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); -spin_unlock_bh (&crc_list.lock); + crc =stm32_crc_get_next_crc (); +if (!crc) +return -ENODEV ;pm_runtime_get_sync (crc->dev);
@@ -202,6 +215,8 @@ static int stm32_crc_digest(struct shash_desc *desc, const u8 *data,return stm32_crc_init (desc) ?:stm32_crc_finup (desc, data, length, out); } +static unsigned int refcnt; +static DEFINE_MUTEX (refcnt_lock);static struct shash_alg algs[] = {/* CRC-32 */ {
@@ -292,12 +307,18 @@ static int stm32_crc_probe(struct platform_device *pdev)list_add (&crc->list, &crc_list.dev_list);spin_unlock (&crc_list.lock); - ret =crypto_register_shashes (algs,ARRAY_SIZE (algs)); -if (ret) { -dev_err (dev,"Failed to register\n" ); -clk_disable_unprepare (crc->clk); -return ret; +mutex_lock (&refcnt_lock); +if (!refcnt) { + ret =crypto_register_shashes (algs,ARRAY_SIZE (algs)); +if (ret) { +mutex_unlock (&refcnt_lock); +dev_err (dev,"Failed to register\n" ); +clk_disable_unprepare (crc->clk); +return ret; + } } + refcnt++; +mutex_unlock (&refcnt_lock);dev_info (dev,"Initialized\n" );
@@ -318,7 +339,10 @@ static int stm32_crc_remove(struct platform_device *pdev)list_del (&crc->list);spin_unlock (&crc_list.lock); -crypto_unregister_shashes (algs,ARRAY_SIZE (algs)); +mutex_lock (&refcnt_lock); +if (!--refcnt) +crypto_unregister_shashes (algs,ARRAY_SIZE (algs)); +mutex_unlock (&refcnt_lock);pm_runtime_disable (crc->dev);pm_runtime_put_noidle (crc->dev);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 138/175 drm/amd/powerpay: Disable gfxoff when setting manual mode on picasso and raven
In reply to Sasha LevinFrom: chen gong <[email protected]>
[ Upstream commit cbd2d08c7463e78d625a69e9db27ad3004cbbd99 ]
[Problem description]
1. Boot up picasso platform, launches desktop, Don't do anything (APU enter into "gfxoff" state)
2. Remote login to platform using SSH, then type the command line:
sudo su -c "echo manual > /sys/class/drm/card0/device/power_dpm_force_performance_level" sudo su -c "echo 2 > /sys/class/drm/card0/device/pp_dpm_sclk" (fix SCLK to 1400MHz)
3. Move the mouse around in Window
4. Phenomenon : The screen frozen
Tester will switch sclk level during glmark2 run time.
APU will enter "gfxoff" state intermittently during glmark2 run time. The system got hanged if fix GFXCLK to 1400MHz when APU is in "gfxoff" state.
[Debug]
1. Fix SCLK to X MHz
1400: screen frozen, screen black, then OS will reboot.
1300: screen frozen.
1200: screen frozen, screen black.
1100: screen frozen, screen black, then OS will reboot.
1000: screen frozen, screen black.
900: screen frozen, screen black, then OS will reboot.
800: Situation Nomal, issue disappear.
700: Situation Nomal, issue disappear.
2. SBIOS setting: AMD CBS --> SMU Debug Options -->SMU Debug --> "GFX DLDO Psm Margin Control":
50 : Situation Nomal, issue disappear.
45 : Situation Nomal, issue disappear.
40 : Situation Nomal, issue disappear.
35 : Situation Nomal, issue disappear.
30 : screen black.
25 : screen frozen, then blurred screen.
20 : screen frozen.
15 : screen black.
10 : screen frozen.
5 : screen frozen, then blurred screen.
3. Disable GFXOFF feature
Situation Nomal, issue disappear.
[Why]
Through a period of time debugging with Sys Eng team and SMU team, Sys Eng team said this is voltage/frequency marginal issue not a F/W or H/W bug. This experiment proves that default targetPsm [for f=1400MHz] is not sufficient when GFXOFF is enabled on Picasso.
SMU team think it is an odd test conditions to force sclk="1400MHz" when GPU is in "gfxoff" state,then wake up the GFX. SCLK should be in the "lowest frequency" when gfxoff.
[How]
Disable gfxoff when setting manual mode.
Enable gfxoff when setting other mode(exiting manual mode) again.
By the way, from the user point of view, now that user switch to manual mode and force SCLK Frequency, he don't want SCLK be controlled by workload.It becomes meaningless to "switch to manual mode" if APU enter "gfxoff" due to lack of workload at this point.
Tips: Same issue observed on Raven.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9 -0
@@ -370,6 +370,15 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,if (current_level == level)return count; +if (adev->asic_type ==CHIP_RAVEN ) { +if (adev->rev_id <8 ) { +if (current_level !=AMD_DPM_FORCED_LEVEL_MANUAL && level ==AMD_DPM_FORCED_LEVEL_MANUAL ) +amdgpu_gfx_off_ctrl (adev, false); +else if (current_level ==AMD_DPM_FORCED_LEVEL_MANUAL && level !=AMD_DPM_FORCED_LEVEL_MANUAL ) +amdgpu_gfx_off_ctrl (adev, true); + } + } +/* profile_exit setting is valid only when current mode is in profile mode */ if (!(current_level & (AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD | AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 139/175 drm/amdgpu: Sync with VM root BO when switching VM to CPU update mode
In reply to Sasha LevinFrom: Felix Kuehling <[email protected]>
[ Upstream commit 90ca78deb004abe75b5024968a199acb96bb70f9 ]
This fixes an intermittent bug where a root PD clear operation still in progress could overwrite a PDE update done by the CPU, resulting in a VM fault.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +9 -2
@@ -2867,10 +2867,17 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, unsWARN_ONCE ((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible (&adev->gmc)),"CPU update of VM recommended only for large BAR system\n" ); -if (vm->use_cpu_for_update) +if (vm->use_cpu_for_update) { +/* Sync with last SDMA update/clear before switching to CPU */ + r =amdgpu_bo_sync_wait (vm->root.base.bo, +AMDGPU_FENCE_OWNER_UNDEFINED , true); +if (r) + goto free_idr; + vm->update_funcs = &amdgpu_vm_cpu_funcs; -else + }else { vm->update_funcs = &amdgpu_vm_sdma_funcs; + }dma_fence_put (vm->last_update); vm->last_update =NULL ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 140/175 selftests/bpf: CONFIG_IPV6_SEG6_BPF required for test_seg6_loop.o
In reply to Sasha LevinFrom: Alan Maguire <[email protected]>
[ Upstream commit 3c8e8cf4b18b3a7034fab4c4504fc4b54e4b6195 ]
test_seg6_loop.o uses the helper bpf_lwt_seg6_adjust_srh(); it will not be present if CONFIG_IPV6_SEG6_BPF is not specified.
--- tools/testing/selftests/bpf/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/config +1 -0
@@ -25,6 +25,7 @@ CONFIG_XDP_SOCKETS=y CONFIG_FTRACE_SYSCALLS=y CONFIG_IPV6_TUNNEL=y CONFIG_IPV6_GRE=y +CONFIG_IPV6_SEG6_BPF=y CONFIG_NET_FOU=m CONFIG_NET_FOU_IP_TUNNELS=y CONFIG_IPV6_FOU=m
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 141/175 x86/mm: Stop printing BRK addresses
In reply to Sasha LevinFrom: Arvind Sankar <[email protected]>
[ Upstream commit 67d631b7c05eff955ccff4139327f0f92a5117e5 ]
This currently leaks kernel physical addresses into userspace.
--- arch/x86/mm/init.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/init.c +0 -2
@@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num) }else { pfn = pgt_buf_end; pgt_buf_end += num; -printk (KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n" , - pfn <<PAGE_SHIFT , (pgt_buf_end <<PAGE_SHIFT ) -1 ); }for (i =0 ; i < num; i++) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 142/175 MIPS: tools: Fix resource leak in elf-entry.c
In reply to Sasha LevinFrom: Kaige Li <[email protected]>
[ Upstream commit f33a0b941017b9cb5a4e975af198b855b2f2b455 ]
There is a file descriptor resource leak in elf-entry.c, fix this by adding fclose() before return and die.
--- arch/mips/tools/elf-entry.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/mips/tools/elf-entry.c +8 -1
@@ -51,11 +51,14 @@ int main(int argc, const char *argv[]) nread =fread (&hdr,1 ,sizeof (hdr), file);if (nread !=sizeof (hdr)) {perror ("Unable to read input file" ); +fclose (file);return EXIT_FAILURE ; } -if (memcmp (hdr.ehdr32.e_ident,ELFMAG ,SELFMAG )) +if (memcmp (hdr.ehdr32.e_ident,ELFMAG ,SELFMAG )) { +fclose (file);die ("Input is not an ELF\n" ); + }switch (hdr.ehdr32.e_ident[EI_CLASS ]) {case ELFCLASS32 :
@@ -67,6 +70,7 @@ int main(int argc, const char *argv[]) entry =be32toh (hdr.ehdr32.e_entry);break ;default : +fclose (file);die ("Invalid ELF encoding\n" ); }
@@ -83,14 +87,17 @@ int main(int argc, const char *argv[]) entry =be64toh (hdr.ehdr64.e_entry);break ;default : +fclose (file);die ("Invalid ELF encoding\n" ); }break ;default : +fclose (file);die ("Invalid ELF class\n" ); }printf ("0x%016" PRIx64"\n" , entry); +fclose (file);return EXIT_SUCCESS ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 143/175 m68k: mac: Don't call via_flush_cache() on Mac IIfx
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit bcc44f6b74106b31f0b0408b70305a40360d63b7 ]
There is no VIA2 chip on the Mac IIfx, so don't call via_flush_cache(). This avoids a boot crash which appeared in v5.4.
printk: console [ttyS0] enabled
printk: bootconsole [debug0] disabled
printk: bootconsole [debug0] disabled
Calibrating delay loop... 9.61 BogoMIPS (lpj=48064)pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear) Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
devtmpfs: initialized
random: get_random_u32 called from bucket_table_alloc.isra.27+0x68/0x194 with crng_init=0
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns futex hash table entries: 256 (order: -1, 3072 bytes, linear)
NET: Registered protocol family 16
Data read fault at 0x00000000 in Super Data (pc=0x8a6a)
BAD KERNEL BUSERR
Oops: 00000000 Modules linked in: PC: [<00008a6a>] via_flush_cache+0x12/0x2c SR: 2700 SP: 01c1fe3c a2: 01c24000 d0: 00001119 d1: 0000000c d2: 00012000 d3: 0000000f d4: 01c06840 d5: 00033b92 a0: 00000000 a1: 00000000
Process swapper (pid: 1, task=01c24000)
Frame format=B ssw=0755 isc=0200 isb=fff7 daddr=00000000 dobuf=01c1fed0 baddr=00008a6e dibuf=0000004e ver=f
Stack from 01c1fec4:
01c1fed0 00007d7e 00010080 01c1fedc 0000792e 00000001 01c1fef4 00006b40
01c80000 00040000 00000006 00000003 01c1ff1c 004a545e 004ff200 00040000
00000000 00000003 01c06840 00033b92 004a5410 004b6c88 01c1ff84 000021e2
00000073 00000003 01c06840 00033b92 0038507a 004bb094 004b6ca8 004b6c88
004b6ca4 004b6c88 000021ae 00020002 00000000 01c0685d 00000000 01c1ffb4
0049f938 00409c85 01c06840 0045bd40 00000073 00000002 00000002 00000000
Call Trace: [<00007d7e>] mac_cache_card_flush+0x12/0x1c
[<00010080>] fix_dnrm+0x2/0x18
[<0000792e>] cache_push+0x46/0x5a
[<00006b40>] arch_dma_prep_coherent+0x60/0x6e
[<00040000>] switched_to_dl+0x76/0xd0
[<004a545e>] dma_atomic_pool_init+0x4e/0x188
[<00040000>] switched_to_dl+0x76/0xd0
[<00033b92>] parse_args+0x0/0x370
[<004a5410>] dma_atomic_pool_init+0x0/0x188
[<000021e2>] do_one_initcall+0x34/0x1be
[<00033b92>] parse_args+0x0/0x370
[<0038507a>] strcpy+0x0/0x1e
[<000021ae>] do_one_initcall+0x0/0x1be
[<00020002>] do_proc_dointvec_conv+0x54/0x74
[<0049f938>] kernel_init_freeable+0x126/0x190
[<0049f94c>] kernel_init_freeable+0x13a/0x190
[<004a5410>] dma_atomic_pool_init+0x0/0x188
[<00041798>] complete+0x0/0x3c
[<000b9b0c>] kfree+0x0/0x20a
[<0038df98>] schedule+0x0/0xd0
[<0038d604>] kernel_init+0x0/0xda
[<0038d610>] kernel_init+0xc/0xda
[<0038d604>] kernel_init+0x0/0xda
[<00002d38>] ret_from_kernel_thread+0xc/0x14
Code: 0000 2079 0048 10da 2279 0048 10c8 d3c8 <1011> 0200 fff7 1280 d1f9 0048 10c8 1010 0000 0008 1080 4e5e 4e75 4e56 0000 2039
Disabling lock debugging due to kernel taint
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000bThanks to Stan Johnson for capturing the console log and running git bisect.
Git bisect said commit 8e3a68fb55e0 ("dma-mapping: make dma_atomic_pool_init self-contained") is the first "bad" commit. I don't know why. Perhaps mach_l2_flush first became reachable with that commit.
--- arch/m68k/include/asm/mac_via.h | 1 + arch/m68k/mac/config.c | 21 ++------------------- arch/m68k/mac/via.c | 6 +++++- 3 files changed, 8 insertions(+), 20 deletions(-)
arch/m68k/include/asm/mac_via.h +1 -0
@@ -257,6 +257,7 @@ extern int rbv_present,via_alt_mapping;struct irq_desc ; +extern void via_l2_flush (int writeback);extern void via_register_interrupts (void );extern void via_irq_enable (int );extern void via_irq_disable (int );
arch/m68k/mac/config.c +2 -19
@@ -59,7 +59,6 @@ extern void iop_preinit(void);extern void iop_init (void );extern void via_init (void );extern void via_init_clock (irq_handler_t func); -extern void via_flush_cache (void );extern void oss_init (void );extern void psc_init (void );extern void baboon_init (void );
@@ -130,21 +129,6 @@ int __init mac_parse_bootinfo(const struct bi_record *record)return unknown; } -/* -* Flip into 24bit mode for an instant - flushes the L2 cache card. We -* have to disable interrupts for this. Our IRQ handlers will crap -* themselves if they take an IRQ in 24bit mode! -*/ - -static void mac_cache_card_flush (int writeback) -{ -unsigned long flags; - -local_irq_save (flags); -via_flush_cache (); -local_irq_restore (flags); -} -void __init config_mac (void ) {if (!MACH_IS_MAC )
@@ -175,9 +159,8 @@ void __init config_mac(void)* not. */ -if (macintosh_config->ident ==MAC_MODEL_IICI - || macintosh_config->ident ==MAC_MODEL_IIFX ) - mach_l2_flush = mac_cache_card_flush; +if (macintosh_config->ident ==MAC_MODEL_IICI ) + mach_l2_flush = via_l2_flush; }
arch/m68k/mac/via.c +5 -1
@@ -294,10 +294,14 @@ void via_debug_dump(void)* the system into 24-bit mode for an instant. */ -void via_flush_cache (void ) +void via_l2_flush (int writeback) { +unsigned long flags; + +local_irq_save (flags); via2[gBufB] &= ~VIA2B_vMode32; via2[gBufB] |= VIA2B_vMode32; +local_irq_restore (flags); }/*
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 144/175 btrfs: improve global reserve stealing logic
In reply to Sasha LevinFrom: Josef Bacik <[email protected]>
[ Upstream commit 7f9fe614407692f670601a634621138233ac00d7 ]
For unlink transactions and block group removal btrfs_start_transaction_fallback_global_rsv will first try to start an ordinary transaction and if it fails it will fall back to reserving the required amount by stealing from the global reserve. This is problematic because of all the same reasons we had with previous iterations of the ENOSPC handling, thundering herd. We get a bunch of failures all at once, everybody tries to allocate from the global reserve, some win and some lose, we get an ENSOPC.
Fix this behavior by introducing BTRFS_RESERVE_FLUSH_ALL_STEAL. It's used to mark unlink reservation. To fix this we need to integrate this logic into the normal ENOSPC infrastructure. We still go through all of the normal flushing work, and at the moment we begin to fail all the tickets we try to satisfy any tickets that are allowed to steal by stealing from the global reserve. If this works we start the flushing system over again just like we would with a normal ticket satisfaction. This serializes our global reserve stealing, so we don't have the thundering herd problem.
--- fs/btrfs/block-group.c | 2 +- fs/btrfs/ctree.h | 1 + fs/btrfs/inode.c | 2 +- fs/btrfs/space-info.c | 37 ++++++++++++++++++++++++++++++++++++- fs/btrfs/space-info.h | 1 + fs/btrfs/transaction.c | 42 +++++------------------------------------- fs/btrfs/transaction.h | 3 +-- 7 files changed, 46 insertions(+), 42 deletions(-)
fs/btrfs/block-group.c +1 -1
@@ -1167,7 +1167,7 @@ struct btrfs_trans_handle *btrfs_start_trans_remove_block_group(free_extent_map (em);return btrfs_start_transaction_fallback_global_rsv (fs_info->extent_root, - num_items,1 ); + num_items); }/*
fs/btrfs/ctree.h +1 -0
@@ -2465,6 +2465,7 @@ enum btrfs_reserve_flush_enum {BTRFS_RESERVE_FLUSH_LIMIT ,BTRFS_RESERVE_FLUSH_EVICT ,BTRFS_RESERVE_FLUSH_ALL , + BTRFS_RESERVE_FLUSH_ALL_STEAL, }; enum btrfs_flush_state {
fs/btrfs/inode.c +1 -1
@@ -4250,7 +4250,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir)* 1 for the inode ref * 1 for the inode */ -return btrfs_start_transaction_fallback_global_rsv (root,5 ,5 ); +return btrfs_start_transaction_fallback_global_rsv (root,5 ); }static int btrfs_unlink (struct inode *dir,struct dentry *dentry)
fs/btrfs/space-info.c +36 -1
@@ -689,6 +689,34 @@ static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info, !test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state)); } +static bool steal_from_global_rsv (struct btrfs_fs_info *fs_info, +struct btrfs_space_info *space_info, +struct reserve_ticket *ticket) +{ +struct btrfs_block_rsv *global_rsv = &fs_info->global_block_rsv; +u64 min_bytes; + +if (global_rsv->space_info != space_info) +return false; + +spin_lock (&global_rsv->lock); + min_bytes =div_factor (global_rsv->size,5 ); +if (global_rsv->reserved < min_bytes + ticket->bytes) { +spin_unlock (&global_rsv->lock); +return false; + } + global_rsv->reserved -= ticket->bytes; + ticket->bytes =0 ; +list_del_init (&ticket->list); +wake_up (&ticket->wait); + space_info->tickets_id++; +if (global_rsv->reserved < global_rsv->size) + global_rsv->full =0 ; +spin_unlock (&global_rsv->lock); + +return true; +} +/* * maybe_fail_all_tickets - we've exhausted our flushing, start failing tickets * @fs_info - fs_info for this fs
@@ -721,6 +749,10 @@ static bool maybe_fail_all_tickets(struct btrfs_fs_info *fs_info, ticket =list_first_entry (&space_info->tickets, struct reserve_ticket, list); +if (ticket->steal && +steal_from_global_rsv (fs_info, space_info, ticket)) +return true; +/* * may_commit_transaction will avoid committing the transaction * if it doesn't feel like the space reclaimed by the commit
@@ -940,6 +972,7 @@ static int handle_reserve_ticket(struct btrfs_fs_info *fs_info,switch (flush) {case BTRFS_RESERVE_FLUSH_ALL : +case BTRFS_RESERVE_FLUSH_ALL_STEAL :wait_reserve_ticket (fs_info, space_info, ticket);break ;case BTRFS_RESERVE_FLUSH_LIMIT :
@@ -1039,7 +1072,9 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info, ticket.bytes = orig_bytes; ticket.error =0 ;init_waitqueue_head (&ticket.wait); -if (flush ==BTRFS_RESERVE_FLUSH_ALL ) { + ticket.steal = (flush ==BTRFS_RESERVE_FLUSH_ALL_STEAL ); +if (flush ==BTRFS_RESERVE_FLUSH_ALL || + flush ==BTRFS_RESERVE_FLUSH_ALL_STEAL ) {list_add_tail (&ticket.list, &space_info->tickets);if (!space_info->flush) { space_info->flush =1 ;
fs/btrfs/space-info.h +1 -0
@@ -72,6 +72,7 @@ struct btrfs_space_info {struct reserve_ticket {u64 bytes;int error; +bool steal;struct list_head list;wait_queue_head_t wait; };
fs/btrfs/transaction.c +5 -37
55 lines not on this page · raw message
fs/btrfs/transaction.h +1 -2
@@ -181,8 +181,7 @@ struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, unsigned int num_items);struct btrfs_trans_handle *btrfs_start_transaction_fallback_global_rsv (struct btrfs_root *root, -unsigned int num_items, -int min_factor); +unsigned int num_items);struct btrfs_trans_handle *btrfs_join_transaction (struct btrfs_root *root);struct btrfs_trans_handle *btrfs_join_transaction_nolock (struct btrfs_root *root);struct btrfs_trans_handle *btrfs_join_transaction_nostart (struct btrfs_root *root);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 145/175 btrfs: qgroup: mark qgroup inconsistent if we're inherting snapshot to a new qgroup
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit cbab8ade585a18c4334b085564d9d046e01a3f70 ]
[BUG]
For the following operation, qgroup is guaranteed to be screwed up due to snapshot adding to a new qgroup:
# mkfs.btrfs -f $dev # mount $dev $mnt # btrfs qgroup en $mnt # btrfs subv create $mnt/src # xfs_io -f -c "pwrite 0 1m" $mnt/src/file # sync # btrfs qgroup create 1/0 $mnt/src # btrfs subv snapshot -i 1/0 $mnt/src $mnt/snapshot # btrfs qgroup show -prce $mnt/src qgroupid rfer excl max_rfer max_excl parent child -------- ---- ---- -------- -------- ------ ----- 0/5 16.00KiB 16.00KiB none none --- --- 0/257 1.02MiB 16.00KiB none none --- --- 0/258 1.02MiB 16.00KiB none none 1/0 --- 1/0 0.00B 0.00B none none --- 0/258 ^^^^^^^^^^^^^^^^^^^^
[CAUSE]
The problem is in btrfs_qgroup_inherit(), we don't have good enough check to determine if the new relation would break the existing accounting.
Unlike btrfs_add_qgroup_relation(), which has proper check to determine if we can do quick update without a rescan, in btrfs_qgroup_inherit() we can even assign a snapshot to multiple qgroups.
[FIX]
Fix it by manually marking qgroup inconsistent for snapshot inheritance.
For subvolume creation, since all its extents are exclusively owned, we don't need to rescan.
In theory, we should call relation check like quick_update_accounting() when doing qgroup inheritance and inform user about qgroup accounting inconsistency.
But we don't have good mechanism to relay that back to the user in the snapshot creation context, thus we can only silently mark the qgroup inconsistent.
Anyway, user shouldn't use qgroup inheritance during snapshot creation, and should add qgroup relationship after snapshot creation by 'btrfs qgroup assign', which has a much better UI to inform user about qgroup inconsistent and kick in rescan automatically.
--- fs/btrfs/qgroup.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/qgroup.c +14 -0
@@ -2636,6 +2636,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,struct btrfs_root *quota_root;struct btrfs_qgroup *srcgroup;struct btrfs_qgroup *dstgroup; +bool need_rescan = false;u32 level_size =0 ;u64 nums;
@@ -2779,6 +2780,13 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, goto unlock; } ++i_qgroups; + +/* +* If we're doing a snapshot, and adding the snapshot to a new +* qgroup, the numbers are guaranteed to be incorrect. +*/ +if (srcid) + need_rescan = true; }for (i =0 ; i < inherit->num_ref_copies; ++i, i_qgroups +=2 ) {
@@ -2798,6 +2806,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dst->rfer = src->rfer - level_size; dst->rfer_cmpr = src->rfer_cmpr - level_size; + +/* Manually tweaking numbers certainly needs a rescan */ + need_rescan = true; }for (i =0 ; i < inherit->num_excl_copies; ++i, i_qgroups +=2 ) {struct btrfs_qgroup *src;
@@ -2816,6 +2827,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dst->excl = src->excl + level_size; dst->excl_cmpr = src->excl_cmpr + level_size; + need_rescan = true; } unlock:
@@ -2823,6 +2835,8 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, out:if (!committing)mutex_unlock (&fs_info->qgroup_ioctl_lock); +if (need_rescan) + fs_info->qgroup_flags |=BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT ;return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 146/175 net: ethernet: fec: move GPR register offset and bit into DT
In reply to Sasha LevinFrom: Fugang Duan <[email protected]>
[ Upstream commit 8a448bf832af537d26aa557d183a16943dce4510 ]
The commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) set the GPR reigster offset and bit in driver for wake on lan feature.
But it introduces two issues here:
- one SOC has two instances, they have different bit
- different SOCs may have different offset and bit
So to support wake-on-lan feature on other i.MX platforms, it should configure the GPR reigster offset and bit from DT.
So the patch is to improve the commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) to support multiple ethernet instances on i.MX series.
v2:
* switch back to store the quirks bitmask in driver_data
v3:
* suggested by Sascha Hauer, use a struct fec_devinfo for abstracting differences between different hardware variants, it can give more freedom to describe the differences.
--- drivers/net/ethernet/freescale/fec_main.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +12 -12
@@ -88,8 +88,6 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);struct fec_devinfo {u32 quirks; -u8 stop_gpr_reg; -u8 stop_gpr_bit; };static const struct fec_devinfo fec_imx25_info = {
@@ -112,8 +110,6 @@ static const struct fec_devinfo fec_imx6q_info = {FEC_QUIRK_HAS_BUFDESC_EX |FEC_QUIRK_HAS_CSUM |FEC_QUIRK_HAS_VLAN |FEC_QUIRK_ERR006358 | FEC_QUIRK_HAS_RACC, - .stop_gpr_reg = 0x34, - .stop_gpr_bit = 27, }; static const struct fec_devinfo fec_mvf600_info = {
@@ -3452,19 +3448,23 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) }static int fec_enet_init_stop_mode (struct fec_enet_private *fep, -struct fec_devinfo *dev_info,struct device_node *np) {struct device_node *gpr_np; +u32 out_val[3 ];int ret =0 ; -if (!dev_info) -return 0 ; - - gpr_np =of_parse_phandle (np,"gpr" ,0 ); + gpr_np =of_parse_phandle (np,"fsl,stop-mode" ,0 );if (!gpr_np)return 0 ; + ret =of_property_read_u32_array (np,"fsl,stop-mode" , out_val, +ARRAY_SIZE (out_val)); +if (ret) { +dev_dbg (&fep->pdev->dev,"no stop mode property\n" ); +return ret; + } + fep->stop_gpr.gpr =syscon_node_to_regmap (gpr_np);if (IS_ERR (fep->stop_gpr.gpr)) {dev_err (&fep->pdev->dev,"could not find gpr regmap\n" );
@@ -3473,8 +3473,8 @@ static int fec_enet_init_stop_mode(struct fec_enet_private *fep, goto out; } - fep->stop_gpr.reg = dev_info->stop_gpr_reg; - fep->stop_gpr.bit = dev_info->stop_gpr_bit; + fep->stop_gpr.reg = out_val[1 ]; + fep->stop_gpr.bit = out_val[2 ]; out:of_node_put (gpr_np);
@@ -3550,7 +3550,7 @@ fec_probe(struct platform_device *pdev)if (of_get_property (np,"fsl,magic-packet" ,NULL )) fep->wol_flag |=FEC_WOL_HAS_MAGIC_PACKET ; - ret =fec_enet_init_stop_mode (fep, dev_info, np); + ret =fec_enet_init_stop_mode (fep, np);if (ret) goto failed_stop_mode;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 147/175 macvlan: Skip loopback packets in RX handler
In reply to Sasha LevinFrom: Alexander Sverdlin <[email protected]>
[ Upstream commit 81f3dc9349ce0bf7b8447f147f45e70f0a5b36a6 ]
Ignore loopback-originatig packets soon enough and don't try to process L2 header where it doesn't exist. The very similar br_handle_frame() in bridge code performs exactly the same check.
This is an example of such ICMPv6 packet:
skb len=96 headroom=40 headlen=96 tailroom=56 mac=(40,0) net=(40,40) trans=80shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0)) csum(0xae2e9a2f ip_summed=1 complete_sw=0 valid=0 level=0) hash(0xc97ebd88 sw=1 l4=1) proto=0x86dd pkttype=5 iif=24 dev name=etha01.212 feat=0x0x0000000040005000
skb headroom: 00000000: 00 7c 86 52 84 88 ff ff 00 00 00 00 00 00 08 00 skb headroom: 00000010: 45 00 00 9e 5d 5c 40 00 40 11 33 33 00 00 00 01 skb headroom: 00000020: 02 40 43 80 00 00 86 dd skb linear: 00000000: 60 09 88 bd 00 38 3a ff fe 80 00 00 00 00 00 00 skb linear: 00000010: 00 40 43 ff fe 80 00 00 ff 02 00 00 00 00 00 00 skb linear: 00000020: 00 00 00 00 00 00 00 01 86 00 61 00 40 00 00 2d skb linear: 00000030: 00 00 00 00 00 00 00 00 03 04 40 e0 00 00 01 2c skb linear: 00000040: 00 00 00 78 00 00 00 00 fd 5f 42 68 23 87 a8 81 skb linear: 00000050: 00 00 00 00 00 00 00 00 01 01 02 40 43 80 00 00 skb tailroom: 00000000: ... skb tailroom: 00000010: ... skb tailroom: 00000020: ... skb tailroom: 00000030: ...
Call Trace, how it happens exactly:
...
macvlan_handle_frame+0x321/0x425 [macvlan] ? macvlan_forward_source+0x110/0x110 [macvlan] __netif_receive_skb_core+0x545/0xda0 ? enqueue_task_fair+0xe5/0x8e0 ? __netif_receive_skb_one_core+0x36/0x70 __netif_receive_skb_one_core+0x36/0x70 process_backlog+0x97/0x140 net_rx_action+0x1eb/0x350 ? __hrtimer_run_queues+0x136/0x2e0 __do_softirq+0xe3/0x383 do_softirq_own_stack+0x2a/0x40 </IRQ> do_softirq.part.4+0x4e/0x50 netif_rx_ni+0x60/0xd0 dev_loopback_xmit+0x83/0xf0 ip6_finish_output2+0x575/0x590 [ipv6] ? ip6_cork_release.isra.1+0x64/0x90 [ipv6] ? __ip6_make_skb+0x38d/0x680 [ipv6] ? ip6_output+0x6c/0x140 [ipv6] ip6_output+0x6c/0x140 [ipv6] ip6_send_skb+0x1e/0x60 [ipv6] rawv6_sendmsg+0xc4b/0xe10 [ipv6] ? proc_put_long+0xd0/0xd0 ? rw_copy_check_uvector+0x4e/0x110 ? sock_sendmsg+0x36/0x40 sock_sendmsg+0x36/0x40 ___sys_sendmsg+0x2b6/0x2d0 ? proc_dointvec+0x23/0x30 ? addrconf_sysctl_forward+0x8d/0x250 [ipv6] ? dev_forward_change+0x130/0x130 [ipv6] ? _raw_spin_unlock+0x12/0x30 ? proc_sys_call_handler.isra.14+0x9f/0x110 ? __call_rcu+0x213/0x510 ? get_max_files+0x10/0x10 ? trace_hardirqs_on+0x2c/0xe0 ? __sys_sendmsg+0x63/0xa0 __sys_sendmsg+0x63/0xa0 do_syscall_64+0x6c/0x1e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- drivers/net/macvlan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/macvlan.c +4 -0
@@ -447,6 +447,10 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)int ret;rx_handler_result_t handle_res; +/* Packets from dev_loopback_xmit() do not have L2 header, bail out */ +if (unlikely (skb->pkt_type ==PACKET_LOOPBACK )) +return RX_HANDLER_PASS ; + port =macvlan_port_get_rcu (skb->dev);if (is_multicast_ether_addr (eth->h_dest)) {unsigned int hash;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 148/175 PCI: Don't disable decoding when mmio_always_on is set
In reply to Sasha LevinFrom: Jiaxun Yang <[email protected]>
[ Upstream commit b6caa1d8c80cb71b6162cb1f1ec13aa655026c9f ]
Don't disable MEM/IO decoding when a device have both non_compliant_bars and mmio_always_on.
That would allow us quirk devices with junk in BARs but can't disable their decoding.
--- drivers/pci/probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/probe.c +1 -1
@@ -1777,7 +1777,7 @@ int pci_setup_device(struct pci_dev *dev)/* Device class may be changed after fixup */ class = dev->class >>8 ; -if (dev->non_compliant_bars) { +if (dev->non_compliant_bars && !dev->mmio_always_on) {pci_read_config_word (dev,PCI_COMMAND , &cmd);if (cmd & (PCI_COMMAND_IO |PCI_COMMAND_MEMORY )) {pci_info (dev,"device has non-compliant BARs; disabling IO/MEM decoding\n" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 149/175 MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe()
In reply to Sasha LevinFrom: YuanJunQing <[email protected]>
[ Upstream commit 31e1b3efa802f97a17628dde280006c4cee4ce5e ]
Register "a1" is unsaved in this function,
when CONFIG_TRACE_IRQFLAGS is enabled,
the TRACE_IRQS_OFF macro will call trace_hardirqs_off(), and this may change register "a1".
The changed register "a1" as argument will be send to do_fpe() and do_msa_fpe().
--- arch/mips/kernel/genex.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/kernel/genex.S +3 -3
@@ -474,20 +474,20 @@ NESTED(nmi_handler, PT_SIZE, sp) .endm .macro __build_clear_fpe + CLI + TRACE_IRQS_OFF .set push /* gas fails to assemble cfc1 for some archs (octeon).*/ \ .set mips1 SET_HARDFLOAT cfc1 a1, fcr31 .set pop - CLI - TRACE_IRQS_OFF .endm .macro __build_clear_msa_fpe - _cfcmsa a1, MSA_CSR CLI TRACE_IRQS_OFF + _cfcmsa a1, MSA_CSR .endm .macro __build_clear_ade
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 150/175 bcache: fix refcount underflow in bcache_device_free()
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit 86da9f736740eba602389908574dfbb0f517baa5 ]
The problematic code piece in bcache_device_free() is,
785 static void bcache_device_free(struct bcache_device *d) 786 {
787 struct gendisk *disk = d->disk;
[snipped]
799 if (disk) {
800 if (disk->flags & GENHD_FL_UP)
801 del_gendisk(disk);
802
803 if (disk->queue)
804 blk_cleanup_queue(disk->queue);
805
806 ida_simple_remove(&bcache_device_idx,
807 first_minor_to_idx(disk->first_minor));
808 put_disk(disk);
809 }
[snipped]
816 }
At line 808, put_disk(disk) may encounter kobject refcount of 'disk' being underflow.
Here is how to reproduce the issue,
- Attche the backing device to a cache device and do random write to make the cache being dirty.
- Stop the bcache device while the cache device has dirty data of the backing device.
- Only register the backing device back, NOT register cache device.
- The bcache device node /dev/bcache0 won't show up, because backing device waits for the cache device shows up for the missing dirty data.
- Now echo 1 into /sys/fs/bcache/pendings_cleanup, to stop the pending backing device.
- After the pending backing device stopped, use 'dmesg' to check kernel message, a use-after-free warning from KASA reported the refcount of kobject linked to the 'disk' is underflow.
The dropping refcount at line 808 in the above code piece is added by add_disk(d->disk) in bch_cached_dev_run(). But in the above condition the cache device is not registered, bch_cached_dev_run() has no chance to be called and the refcount is not added. The put_disk() for a non- added refcount of gendisk kobject triggers a underflow warning.
This patch checks whether GENHD_FL_UP is set in disk->flags, if it is not set then the bcache device was not added, don't call put_disk() and the the underflow issue can be avoided.
--- drivers/md/bcache/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/bcache/super.c +5 -2
@@ -789,7 +789,9 @@ static void bcache_device_free(struct bcache_device *d)bcache_device_detach (d);if (disk) { -if (disk->flags &GENHD_FL_UP ) +bool disk_added = (disk->flags &GENHD_FL_UP ) !=0 ; + +if (disk_added)del_gendisk (disk);if (disk->queue)
@@ -797,7 +799,8 @@ static void bcache_device_free(struct bcache_device *d)ida_simple_remove (&bcache_device_idx,first_minor_to_idx (disk->first_minor)); -put_disk (disk); +if (disk_added) +put_disk (disk); }bioset_exit (&d->bio_split);
Signature · 1 line
2.25.1