5.9.2-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 301/757 ath11k: Add checked value for ath11k_ahb_remove
In reply to Greg Kroah-HartmanFrom: Bo YU <[email protected]>
[ Upstream commit 80b892fc8a90e91498babf0f6817139e5ec64b5c ]
Return value form wait_for_completion_timeout should to be checked.
This is detected by Coverity: #CID:1464479 (CHECKED_RETURN)
--- drivers/net/wireless/ath/ath11k/ahb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +7 -3
@@ -981,12 +981,16 @@ static int ath11k_ahb_probe(struct platform_device *pdev)static int ath11k_ahb_remove (struct platform_device *pdev) {struct ath11k_base *ab =platform_get_drvdata (pdev); +unsigned long left;reinit_completion (&ab->driver_recovery); -if (test_bit (ATH11K_FLAG_RECOVERY , &ab->dev_flags)) -wait_for_completion_timeout (&ab->driver_recovery, -ATH11K_AHB_RECOVERY_TIMEOUT ); +if (test_bit (ATH11K_FLAG_RECOVERY , &ab->dev_flags)) { + left =wait_for_completion_timeout (&ab->driver_recovery, +ATH11K_AHB_RECOVERY_TIMEOUT ); +if (!left) +ath11k_warn (ab,"failed to receive recovery response completion\n" ); + }set_bit (ATH11K_FLAG_UNREGISTERING , &ab->dev_flags);cancel_work_sync (&ab->restart_work);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 302/757 ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 6a950755cec1a90ddaaff3e4acb5333617441c32 ]
The "tsid" is a user controlled u8 which comes from debugfs. Values more than 15 are invalid because "active_tsids" is a 16 bit variable. If the value of "tsid" is more than 31 then that leads to a shift wrapping bug.
--- drivers/net/wireless/ath/ath6kl/wmi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath6kl/wmi.c +5 -0
@@ -2645,6 +2645,11 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,return -EINVAL ; } +if (tsid >=16 ) { +ath6kl_err ("invalid tsid: %d\n" , tsid); +return -EINVAL ; + } + skb =ath6kl_wmi_get_new_buf (sizeof (*cmd));if (!skb)return -ENOMEM ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 303/757 drm: rcar-du: Put reference to VSP device
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 2a32dbdc2c7db5463483fa01fb220fd1b770c6bc ]
The reference to the VSP device acquired with of_find_device_by_node() in rcar_du_vsp_init() is never released. Fix it with a drmm action, which gets run both in the probe error path and in the remove path.
--- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +12 -0
@@ -13,6 +13,7 @@#include <drm/drm_fourcc.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_managed.h> #include <drm/drm_plane_helper.h> #include <drm/drm_vblank.h>
@@ -341,6 +342,13 @@ static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = { .atomic_destroy_state = rcar_du_vsp_plane_atomic_destroy_state, }; +static void rcar_du_vsp_cleanup (struct drm_device *dev,void *res) +{ +struct rcar_du_vsp *vsp = res; + +put_device (vsp->vsp); +} +int rcar_du_vsp_init (struct rcar_du_vsp *vsp,struct device_node *np,unsigned int crtcs) {
@@ -357,6 +365,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, vsp->vsp = &pdev->dev; + ret =drmm_add_action (rcdu->ddev, rcar_du_vsp_cleanup, vsp); +if (ret <0 ) +return ret; + ret =vsp1_du_init (vsp->vsp);if (ret <0 )return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 304/757 phy: rockchip-dphy-rx0: Include linux/delay.h
In reply to Greg Kroah-HartmanFrom: Tomasz Figa <[email protected]>
[ Upstream commit 488e3f52a82775bf9a4826a9eb59f10336c3f012 ]
Fix an implicit declaration of usleep_range():
drivers/phy/rockchip/phy-rockchip-dphy-rx0.c: In function 'rk_dphy_enable':drivers/phy/rockchip/phy-rockchip-dphy-rx0.c:203:2: error: implicit declaration of function 'usleep_range' [-Werror=implicit-function-declaration]
--- .../staging/media/phy-rockchip-dphy-rx0/phy-rockchip-dphy-rx0.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/phy-rockchip-dphy-rx0/phy-rockchip-dphy-rx0.c +1 -0
@@ -16,6 +16,7 @@*/ #include <linux/clk.h> +#include <linux/delay.h> #include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/module.h>
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 305/757 dmaengine: dmatest: Check list for emptiness before access its last entry
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit b28de385b71abf31ce68ec0387638bee26ae9024 ]
After writing a garbage to the channel we get an Oops in dmatest_chan_set() due to access to last entry in the empty list.
[ 212.670672] BUG: unable to handle page fault for address: fffffff000000020 [ 212.677562] #PF: supervisor read access in kernel mode [ 212.682702] #PF: error_code(0x0000) - not-present page ... [ 212.710074] RIP: 0010:dmatest_chan_set+0x149/0x2d0 [dmatest] [ 212.715739] Code: e8 cc f9 ff ff 48 8b 1d 0d 55 00 00 48 83 7b 10 00 0f 84 63 01 00 00 48 c7 c7 d0 65 4d c0 e8 ee 4a f5 e1 48 89 c6 48 8b 43 10 <48> 8b 40 20 48 8b 78 58 48 85 ff 0f 84 f5 00 00 00 e8 b1 41 f5 e1
Fix this by checking list for emptiness before accessing its last entry.
--- drivers/dma/dmatest.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/dma/dmatest.c +2 -3
@@ -1249,15 +1249,14 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp)add_threaded_test (info);/* Check if channel was added successfully */ - dtc = list_last_entry(&info->channels, struct dmatest_chan, node); - -if (dtc->chan) { +if (!list_empty (&info->channels)) {/* * if new channel was not successfully added, revert the * "test_channel" string to the name of the last successfully * added channel. exception for when users issues empty string * to channel parameter. */ + dtc = list_last_entry(&info->channels, struct dmatest_chan, node);if ((strcmp (dma_chan_name (dtc->chan),strim (test_channel)) !=0 ) && (strcmp ("" ,strim (test_channel)) !=0 )) { ret = -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 306/757 ASoC: cros_ec_codec: fix kconfig dependency warning for SND_SOC_CROS_EC_CODEC
In reply to Greg Kroah-HartmanFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 50b18e4a2608e3897f3787eaa7dfa869b40d9923 ]
When SND_SOC_CROS_EC_CODEC is enabled and CRYPTO is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for CRYPTO_LIB_SHA256
Depends on [n]: CRYPTO [=n]
Selected by [y]:
- SND_SOC_CROS_EC_CODEC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && CROS_EC [=y]
The reason is that SND_SOC_CROS_EC_CODEC selects CRYPTO_LIB_SHA256 without depending on or selecting CRYPTO while CRYPTO_LIB_SHA256 is subordinate to CRYPTO.
Honor the kconfig menu hierarchy to remove kconfig dependency warnings.
--- sound/soc/codecs/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/Kconfig +1 -0
@@ -540,6 +540,7 @@ config SND_SOC_CQ0093VC config SND_SOC_CROS_EC_CODEC tristate "codec driver for ChromeOS EC" depends on CROS_EC + select CRYPTO select CRYPTO_LIB_SHA256 help If you say yes here you will get support for the
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 307/757 misc: mic: scif: Fix error handling path
In reply to Greg Kroah-HartmanFrom: Souptick Joarder <[email protected]>
[ Upstream commit a81072a9c0ae734b7889929b0bc070fe3f353f0e ]
Inside __scif_pin_pages(), when map_flags != SCIF_MAP_KERNEL it will call pin_user_pages_fast() to map nr_pages. However, pin_user_pages_fast() might fail with a return value -ERRNO.
The return value is stored in pinned_pages->nr_pages. which in turn is passed to unpin_user_pages(), which expects pinned_pages->nr_pages >=0, else disaster.
Fix this by assigning pinned_pages->nr_pages to 0 if pin_user_pages_fast() returns -ERRNO.
--- drivers/misc/mic/scif/scif_rma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mic/scif/scif_rma.c +2 -2
@@ -1392,6 +1392,8 @@ int __scif_pin_pages(void *addr, size_t len, int *out_prot, (prot &SCIF_PROT_WRITE ) ?FOLL_WRITE :0 , pinned_pages->pages);if (nr_pages != pinned_pages->nr_pages) { +if (pinned_pages->nr_pages <0 ) + pinned_pages->nr_pages =0 ;if (try_upgrade) {if (ulimit)__scif_dec_pinned_vm_lock (mm, nr_pages);
@@ -1408,7 +1410,6 @@ int __scif_pin_pages(void *addr, size_t len, int *out_prot,if (pinned_pages->nr_pages < nr_pages) { err = -EFAULT ; - pinned_pages->nr_pages = nr_pages; goto dec_pinned; }
@@ -1421,7 +1422,6 @@ int __scif_pin_pages(void *addr, size_t len, int *out_prot,__scif_dec_pinned_vm_lock (mm, nr_pages);/* Something went wrong! Rollback */ error_unmap: - pinned_pages->nr_pages = nr_pages;scif_destroy_pinned_pages (pinned_pages); *pages =NULL ; dev_dbg(scif_info.mdev.this_device,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 308/757 ALSA: seq: oss: Avoid mutex lock for a long-time ioctl
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 2759caad2600d503c3b0ed800e7e03d2cd7a4c05 ]
Recently we applied a fix to cover the whole OSS sequencer ioctls with the mutex for dealing with the possible races. This works fine in general, but in theory, this may lead to unexpectedly long stall if an ioctl like SNDCTL_SEQ_SYNC is issued and an event with the far future timestamp was queued.
For fixing such a potential stall, this patch changes the mutex lock applied conditionally excluding such an ioctl command. Also, change the mutex_lock() with the interruptible version for user to allow escaping from the big-hammer mutex.
--- sound/core/seq/oss/seq_oss.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/core/seq/oss/seq_oss.c +5 -2
@@ -174,9 +174,12 @@ odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (snd_BUG_ON (!dp))return -ENXIO ; -mutex_lock (®ister_mutex); +if (cmd !=SNDCTL_SEQ_SYNC && +mutex_lock_interruptible (®ister_mutex)) +return -ERESTARTSYS ; rc =snd_seq_oss_ioctl (dp, cmd, arg); -mutex_unlock (®ister_mutex); +if (cmd !=SNDCTL_SEQ_SYNC ) +mutex_unlock (®ister_mutex);return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 309/757 net/mlx5e: IPsec: Use kvfree() for memory allocated with kvzalloc()
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
[ Upstream commit 22db4c24452a6681c7e99c6a06b38b5418395bec ]
Variables flow_group_in, spec in rx_fs_create() are allocated with kvzalloc(). It's incorrect to free them with kfree(). Use kvfree() instead.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c +2 -2
@@ -228,8 +228,8 @@ static int rx_fs_create(struct mlx5e_priv *priv, fs_prot->miss_rule = miss_rule; out: -kfree (flow_group_in); -kfree (spec); +kvfree (flow_group_in); +kvfree (spec);return err; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 310/757 usb: dwc2: Fix parameter type in function pointer prototype
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 362b9398c962c9ec563653444e15ef9032ef3a90 ]
When booting up on a Raspberry Pi 4 with Control Flow Integrity checking enabled, the following warning/panic happens:
[ 1.626435] CFI failure (target: dwc2_set_bcm_params+0x0/0x4): [ 1.632408] WARNING: CPU: 0 PID: 32 at kernel/cfi.c:30 __cfi_check_fail+0x54/0x5c [ 1.640021] Modules linked in: [ 1.643137] CPU: 0 PID: 32 Comm: kworker/0:1 Not tainted 5.8.0-rc6-next-20200724-00051-g89ba619726de #1 [ 1.652693] Hardware name: Raspberry Pi 4 Model B Rev 1.2 (DT) [ 1.658637] Workqueue: events deferred_probe_work_func [ 1.663870] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--) [ 1.669542] pc : __cfi_check_fail+0x54/0x5c [ 1.673798] lr : __cfi_check_fail+0x54/0x5c [ 1.678050] sp : ffff8000102bbaa0 [ 1.681419] x29: ffff8000102bbaa0 x28: ffffab09e21c7000 [ 1.686829] x27: 0000000000000402 x26: ffff0000f6e7c228 [ 1.692238] x25: 00000000fb7cdb0d x24: 0000000000000005 [ 1.697647] x23: ffffab09e2515000 x22: ffffab09e069a000 [ 1.703055] x21: 4c550309df1cf4c1 x20: ffffab09e2433c60 [ 1.708462] x19: ffffab09e160dc50 x18: ffff0000f6e8cc78 [ 1.713870] x17: 0000000000000041 x16: ffffab09e0bce6f8 [ 1.719278] x15: ffffab09e1c819b7 x14: 0000000000000003 [ 1.724686] x13: 00000000ffffefff x12: 0000000000000000 [ 1.730094] x11: 0000000000000000 x10: 00000000ffffffff [ 1.735501] x9 : c932f7abfc4bc600 x8 : c932f7abfc4bc600 [ 1.740910] x7 : 077207610770075f x6 : ffff0000f6c38f00 [ 1.746317] x5 : 0000000000000000 x4 : 0000000000000000 [ 1.751723] x3 : 0000000000000000 x2 : 0000000000000000 [ 1.757129] x1 : ffff8000102bb7d8 x0 : 0000000000000032 [ 1.762539] Call trace: [ 1.765030] __cfi_check_fail+0x54/0x5c [ 1.768938] __cfi_check+0x5fa6c/0x66afc [ 1.772932] dwc2_init_params+0xd74/0xd78 [ 1.777012] dwc2_driver_probe+0x484/0x6ec [ 1.781180] platform_drv_probe+0xb4/0x100 [ 1.785350] really_probe+0x228/0x63c [ 1.789076] driver_probe_device+0x80/0xc0 [ 1.793247] __device_attach_driver+0x114/0x160 [ 1.797857] bus_for_each_drv+0xa8/0x128 [ 1.801851] __device_attach.llvm.14901095709067289134+0xc0/0x170 [ 1.808050] bus_probe_device+0x44/0x100 [ 1.812044] deferred_probe_work_func+0x78/0xb8 [ 1.816656] process_one_work+0x204/0x3c4 [ 1.820736] worker_thread+0x2f0/0x4c4 [ 1.824552] kthread+0x174/0x184 [ 1.827837] ret_from_fork+0x10/0x18
CFI validates that all indirect calls go to a function with the same exact function pointer prototype. In this case, dwc2_set_bcm_params is the target, which has a parameter of type 'struct dwc2_hsotg *', but it is being implicitly cast to have a parameter of type 'void *' because that is the set_params function pointer prototype. Make the function pointer protoype match the definitions so that there is no more violation.
--- drivers/usb/dwc2/params.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/params.c +1 -1
@@ -860,7 +860,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)int dwc2_init_params (struct dwc2_hsotg *hsotg) {const struct of_device_id *match; -void (*set_params)(void *data); +void (*set_params)(struct dwc2_hsotg *data);dwc2_set_default_params (hsotg);dwc2_get_device_properties (hsotg);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 311/757 usb: dwc3: core: Properly default unspecified speed
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit b574ce3ee45937f4a01edc98c59213bfc7effe50 ]
If the maximum_speed is not specified, default the device speed base on its HW capability. Don't prematurely check HW capability before validating the maximum_speed device property. The device property takes precedence in dwc->maximum_speed.
--- drivers/usb/dwc3/core.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/usb/dwc3/core.c +18 -17
@@ -929,13 +929,6 @@ static int dwc3_core_init(struct dwc3 *dwc)*/ dwc3_writel (dwc->regs,DWC3_GUID ,LINUX_VERSION_CODE ); -/* Handle USB2.0-only core configuration */ -if (DWC3_GHWPARAMS3_SSPHY_IFC (dwc->hwparams.hwparams3) == -DWC3_GHWPARAMS3_SSPHY_IFC_DIS ) { -if (dwc->maximum_speed ==USB_SPEED_SUPER ) - dwc->maximum_speed =USB_SPEED_HIGH ; - } - ret =dwc3_phy_setup (dwc);if (ret) goto err0;
@@ -1381,6 +1374,8 @@ bool dwc3_has_imod(struct dwc3 *dwc)static void dwc3_check_params (struct dwc3 *dwc) {struct device *dev = dwc->dev; +unsigned int hwparam_gen = +DWC3_GHWPARAMS3_SSPHY_IFC (dwc->hwparams.hwparams3);/* Check for proper value of imod_interval */ if (dwc->imod_interval && !dwc3_has_imod (dwc)) {
@@ -1412,17 +1407,23 @@ static void dwc3_check_params(struct dwc3 *dwc) dwc->maximum_speed); fallthrough;case USB_SPEED_UNKNOWN : -/* default to superspeed */ - dwc->maximum_speed =USB_SPEED_SUPER ; - -/* -* default to superspeed plus if we are capable. -*/ -if ((DWC3_IP_IS (DWC31 ) ||DWC3_IP_IS (DWC32 )) && - (DWC3_GHWPARAMS3_SSPHY_IFC (dwc->hwparams.hwparams3) == -DWC3_GHWPARAMS3_SSPHY_IFC_GEN2 )) +switch (hwparam_gen) { +case DWC3_GHWPARAMS3_SSPHY_IFC_GEN2 : dwc->maximum_speed =USB_SPEED_SUPER_PLUS ; - +break ; +case DWC3_GHWPARAMS3_SSPHY_IFC_GEN1 : +if (DWC3_IP_IS (DWC32 )) + dwc->maximum_speed =USB_SPEED_SUPER_PLUS ; +else + dwc->maximum_speed =USB_SPEED_SUPER ; +break ; +case DWC3_GHWPARAMS3_SSPHY_IFC_DIS : + dwc->maximum_speed =USB_SPEED_HIGH ; +break ; +default : + dwc->maximum_speed =USB_SPEED_SUPER ; +break ; + }break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 312/757 usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit e1c08cf23172ed6fb228d75efc9f4c80a6812116 ]
Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled earlier) when usb_add_gadget_udc() has failed. This ensures that the debugfs entries created by dwc2_debugfs_init() as well as the HCD are cleaned up in the error path.
--- drivers/usb/dwc2/platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/dwc2/platform.c +5 -1
@@ -584,12 +584,16 @@ static int dwc2_driver_probe(struct platform_device *dev)if (retval) { hsotg->gadget.udc =NULL ;dwc2_hsotg_remove (hsotg); - goto error_init; + goto error_debugfs; } }#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */ return 0 ; +error_debugfs: +dwc2_debugfs_exit (hsotg); +if (hsotg->hcd_enabled) +dwc2_hcd_remove (hsotg); error_init:if (hsotg->params.activate_stm_id_vb_detection)regulator_disable (hsotg->usb33d);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 313/757 rtw88: Fix probe error handling race with firmware loading
In reply to Greg Kroah-HartmanFrom: Andreas Färber <[email protected]>
[ Upstream commit ecda9cda3338b594a1b82d62018c247132a39e57 ]
In case of rtw8822be, a probe failure after successful rtw_core_init() has been observed to occasionally lead to an oops from rtw_load_firmware_cb():
[ 3.924268] pci 0001:01:00.0: [10ec:b822] type 00 class 0xff0000 [ 3.930531] pci 0001:01:00.0: reg 0x10: [io 0x0000-0x00ff] [ 3.936360] pci 0001:01:00.0: reg 0x18: [mem 0x00000000-0x0000ffff 64bit] [ 3.944042] pci 0001:01:00.0: supports D1 D2 [ 3.948438] pci 0001:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold [ 3.957312] pci 0001:01:00.0: BAR 2: no space for [mem size 0x00010000 64bit] [ 3.964645] pci 0001:01:00.0: BAR 2: failed to assign [mem size 0x00010000 64bit] [ 3.972332] pci 0001:01:00.0: BAR 0: assigned [io 0x10000-0x100ff] [ 3.986240] rtw_8822be 0001:01:00.0: enabling device (0000 -> 0001) [ 3.992735] rtw_8822be 0001:01:00.0: failed to map pci memory [ 3.998638] rtw_8822be 0001:01:00.0: failed to request pci io region [ 4.005166] rtw_8822be 0001:01:00.0: failed to setup pci resources [ 4.011580] rtw_8822be: probe of 0001:01:00.0 failed with error -12 [ 4.018827] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 4.029121] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 4.050828] Unable to handle kernel paging request at virtual address edafeaac9607952c [ 4.058975] Mem abort info: [ 4.058980] ESR = 0x96000004 [ 4.058990] EC = 0x25: DABT (current EL), IL = 32 bits [ 4.070353] SET = 0, FnV = 0 [ 4.073487] EA = 0, S1PTW = 0 [ 4.073501] dw-apb-uart 98007800.serial: forbid DMA for kernel console [ 4.076723] Data abort info: [ 4.086415] ISV = 0, ISS = 0x00000004 [ 4.087731] Freeing unused kernel memory: 1792K [ 4.090391] CM = 0, WnR = 0 [ 4.098091] [edafeaac9607952c] address between user and kernel address ranges [ 4.105418] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 4.111129] Modules linked in: [ 4.114275] CPU: 1 PID: 31 Comm: kworker/1:1 Not tainted 5.9.0-rc5-next-20200915+ #700 [ 4.122386] Hardware name: Realtek Saola EVB (DT) [ 4.127223] Workqueue: events request_firmware_work_func [ 4.132676] pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--) [ 4.138393] pc : rtw_load_firmware_cb+0x54/0xbc [ 4.143040] lr : request_firmware_work_func+0x44/0xb4 [ 4.148217] sp : ffff800010133d70 [ 4.151616] x29: ffff800010133d70 x28: 0000000000000000 [ 4.157069] x27: 0000000000000000 x26: 0000000000000000 [ 4.162520] x25: 0000000000000000 x24: 0000000000000000 [ 4.167971] x23: ffff00007ac21908 x22: ffff00007ebb2100 [ 4.173424] x21: ffff00007ad35880 x20: edafeaac96079504 [ 4.178877] x19: ffff00007ad35870 x18: 0000000000000000 [ 4.184328] x17: 00000000000044d8 x16: 0000000000004310 [ 4.189780] x15: 0000000000000800 x14: 00000000ef006305 [ 4.195231] x13: ffffffff00000000 x12: ffffffffffffffff [ 4.200682] x11: 0000000000000020 x10: 0000000000000003 [ 4.206135] x9 : 0000000000000000 x8 : ffff00007e73f680 [ 4.211585] x7 : 0000000000000000 x6 : ffff80001119b588 [ 4.217036] x5 : ffff00007e649c80 x4 : ffff00007e649c80 [ 4.222487] x3 : ffff80001119b588 x2 : ffff8000108d1718 [ 4.227940] x1 : ffff800011bd5000 x0 : ffff00007ac21600 [ 4.233391] Call trace: [ 4.235906] rtw_load_firmware_cb+0x54/0xbc [ 4.240198] request_firmware_work_func+0x44/0xb4 [ 4.245027] process_one_work+0x178/0x1e4 [ 4.249142] worker_thread+0x1d0/0x268 [ 4.252989] kthread+0xe8/0xf8 [ 4.256127] ret_from_fork+0x10/0x18 [ 4.259800] Code: f94013f5 a8c37bfd d65f03c0 f9000260 (f9401681) [ 4.266049] ---[ end trace f822ebae1a8545c2 ]---
To avoid this, wait on the completion callbacks in rtw_core_deinit() before releasing firmware and continuing teardown.
Note that rtw_wait_firmware_completion() was introduced with c8e5695eae9959fc5774c0f490f2450be8bad3de ("rtw88: load wowlan firmware if wowlan is supported"), so backports to earlier branches may need to inline wait_for_completion(&rtwdev->fw.completion) instead.
--- drivers/net/wireless/realtek/rtw88/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +2 -0
@@ -1487,6 +1487,8 @@ void rtw_core_deinit(struct rtw_dev *rtwdev)struct rtw_rsvd_page *rsvd_pkt, *tmp;unsigned long flags; +rtw_wait_firmware_completion (rtwdev); +if (fw->firmware)release_firmware (fw->firmware);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 314/757 rtw88: Fix potential probe error handling race with wow firmware loading
In reply to Greg Kroah-HartmanFrom: Andreas Färber <[email protected]>
[ Upstream commit ac4bac99161e8f7a7a9faef70d8ca8f69d5493a9 ]
If rtw_core_init() fails to load the wow firmware, rtw_core_deinit() will not get called to clean up the regular firmware.
Ensure that an error loading the wow firmware does not produce an oops for the regular firmware by waiting on its completion to be signalled before returning. Also release the loaded firmware.
--- drivers/net/wireless/realtek/rtw88/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +3 -0
@@ -1473,6 +1473,9 @@ int rtw_core_init(struct rtw_dev *rtwdev) ret =rtw_load_firmware (rtwdev,RTW_WOWLAN_FW );if (ret) {rtw_warn (rtwdev,"no wow firmware loaded\n" ); +wait_for_completion (&rtwdev->fw.completion); +if (rtwdev->fw.firmware) +release_firmware (rtwdev->fw.firmware);return ret; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 315/757 mt76: mt7615: hold mt76 lock queueing wd in mt7615_queue_key_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit cddaaa56375615c256eb6960d3092ddb8a7a9154 ]
wq queue is always updated holding mt76 spinlock. Grab mt76 lock in mt7615_queue_key_update() before putting a new element at the end of the queue.
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -0
@@ -361,7 +361,10 @@ mt7615_queue_key_update(struct mt7615_dev *dev, enum set_key_cmd cmd, wd->key.keylen = key->keylen; wd->key.cmd = cmd; +spin_lock_bh (&dev->mt76.lock);list_add_tail (&wd->node, &dev->wd_head); +spin_unlock_bh (&dev->mt76.lock); +queue_work (dev->mt76.wq, &dev->wtbl_work);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 316/757 mt76: mt7615: release mutex in mt7615_reset_test_set
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 346f810e22428cdf73ee5cf2e0ce1b79d5671de5 ]
Reduce scope of mutex_acquire/mutex_release in mt7615_reset_test_set routine in order to fix the following static checker warning:
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:179 mt7615_reset_test_set()
warn: inconsistent returns 'dev->mt76.mutex'.
--- drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c +2 -3
@@ -165,15 +165,14 @@ mt7615_reset_test_set(void *data, u64 val)if (!mt7615_wait_for_mcu_init (dev))return 0 ; -mt7615_mutex_acquire (dev); - skb =alloc_skb (1 ,GFP_KERNEL );if (!skb)return -ENOMEM ;skb_put (skb,1 ); -mt76_tx_queue_skb_raw (dev,0 , skb,0 ); +mt7615_mutex_acquire (dev); +mt76_tx_queue_skb_raw (dev,0 , skb,0 );mt7615_mutex_release (dev);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 317/757 mt76: mt7663s: fix resume failure
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 8b7c6e1cb2cb1d4e2ee94556695d80dde6ccdcc6 ]
MT7663s have to rely on MMC_PM_KEEP_POWER in pm_flags for to avoid SDIO power is being shut off.
To fix sdio access failure like "mt7663s mmc1:0001:1: sdio write failed:
-22" for the first sdio command to access the bus in the resume handler.
--- drivers/net/wireless/mediatek/mt76/mt7615/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +2 -0
@@ -426,6 +426,8 @@ static int mt7663s_suspend(struct device *dev)return err; } +sdio_set_host_pm_flags (func,MMC_PM_KEEP_POWER ); +mt76s_stop_txrx (&mdev->mt76);return mt7663s_firmware_own (mdev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 318/757 mt76: mt7615: fix possible memory leak in mt7615_tm_set_tx_power
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit e862825dcf74203c5ab60335c341766808f47507 ]
Fix a memory leak in mt7615_tm_set_tx_power routine if mt7615_eeprom_get_target_power_index fails.
Moreover do not account req_header twice in mcu skb allocation.
--- drivers/net/wireless/mediatek/mt76/mt7615/testmode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/testmode.c +4 -2
@@ -70,7 +70,7 @@ mt7615_tm_set_tx_power(struct mt7615_phy *phy)if (dev->mt76.test.state !=MT76_TM_STATE_OFF ) tx_power = dev->mt76.test.tx_power; - len =sizeof (req_hdr) +MT7615_EE_MAX -MT_EE_NIC_CONF_0 ; + len =MT7615_EE_MAX -MT_EE_NIC_CONF_0 ; skb =mt76_mcu_msg_alloc (&dev->mt76,NULL ,sizeof (req_hdr) + len);if (!skb)return -ENOMEM ;
@@ -83,8 +83,10 @@ mt7615_tm_set_tx_power(struct mt7615_phy *phy)int index; ret =mt7615_eeprom_get_target_power_index (dev, chandef->chan, i); -if (ret <0 ) +if (ret <0 ) { +dev_kfree_skb (skb);return -EINVAL ; + } index = ret -MT_EE_NIC_CONF_0 ;if (tx_power && tx_power[i])
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 319/757 mt76: mt7615: fix a possible NULL pointer dereference in mt7615_pm_wake_work
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a081de174d11b12db9a94eb748041c2732f14c10 ]
Initialize wcid to global_wcid if msta is NULL in mt7615_pm_wake_work routine since wcid will be dereferenced running mt76_tx()
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +2 -1
@@ -1853,12 +1853,13 @@ void mt7615_pm_wake_work(struct work_struct *work)spin_lock_bh (&dev->pm.txq_lock);for (i =0 ; i <IEEE80211_NUM_ACS ; i++) {struct mt7615_sta *msta = dev->pm.tx_q[i].msta; -struct mt76_wcid *wcid = msta ? &msta->wcid :NULL ;struct ieee80211_sta *sta =NULL ; +struct mt76_wcid *wcid;if (!dev->pm.tx_q[i].skb)continue ; + wcid = msta ? &msta->wcid : &dev->mt76.global_wcid;if (msta && wcid->sta) sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 320/757 mt76: fix a possible NULL pointer dereference in mt76_testmode_dump
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit ce8463a726a5669b200a1c2c17f95bc1394cc6bf ]
Fix a possible NULL pointer dereference in mt76_testmode_dump() since nla_nest_start returns NULL in case of error
--- drivers/net/wireless/mediatek/mt76/testmode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/testmode.c +6 -2
@@ -442,9 +442,13 @@ int mt76_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,mutex_lock (&dev->mutex);if (tb[MT76_TM_ATTR_STATS ]) { + err = -EINVAL ; + a =nla_nest_start (msg,MT76_TM_ATTR_STATS ); - err =mt76_testmode_dump_stats (dev, msg); -nla_nest_end (msg, a); +if (a) { + err =mt76_testmode_dump_stats (dev, msg); +nla_nest_end (msg, a); + } goto out; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 321/757 mt76: mt7663u: fix dma header initialization
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 8da40d698111ad27b03afc40d67843e3073395e7 ]
Fix length field corruption in usb dma header introduced adding sdio support
--- drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c +3 -1
@@ -19,6 +19,7 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, { struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);int ret, seq, ep; +u32 len;mutex_lock (&mdev->mcu.mutex);
@@ -28,7 +29,8 @@ mt7663u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,else ep =MT_EP_OUT_AC_BE ; -put_unaligned_le32 (skb->len,skb_push (skb,sizeof (skb->len))); + len = skb->len; +put_unaligned_le32 (len,skb_push (skb,sizeof (len))); ret =mt76_skb_adjust_pad (skb);if (ret <0 ) goto out;
drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c +5 -2
@@ -259,8 +259,11 @@ int mt7663_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, }mt7663_usb_sdio_write_txwi (dev, wcid, qid, sta, skb); -if (mt76_is_usb (mdev)) -put_unaligned_le32 (skb->len,skb_push (skb,sizeof (skb->len))); +if (mt76_is_usb (mdev)) { +u32 len = skb->len; + +put_unaligned_le32 (len,skb_push (skb,sizeof (len))); + }return mt76_skb_adjust_pad (skb); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 322/757 mt76: mt7615: move drv_own/fw_own in mt7615_mcu_ops
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 186b659c0859704ef3b2fb634a659724f020889a ]
Introduce set_drv_ctrl and set_fw_ctrl function pointers in mt7615_mcu_ops data structure. This is a preliminary patch to enable runtime-pm for non-pci chipsets
--- .../net/wireless/mediatek/mt76/mt7615/mac.c | 4 +- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 158 +++++++++--------- .../wireless/mediatek/mt76/mt7615/mt7615.h | 6 +- .../net/wireless/mediatek/mt76/mt7615/pci.c | 4 +- 4 files changed, 89 insertions(+), 83 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +2 -2
@@ -1845,7 +1845,7 @@ void mt7615_pm_wake_work(struct work_struct *work) pm.wake_work); mphy = dev->phy.mt76; -if (mt7615_driver_own (dev)) { +if (mt7615_mcu_set_drv_ctrl (dev)) {dev_err (mphy->dev->dev,"failed to wake device\n" ); goto out; }
@@ -1944,7 +1944,7 @@ void mt7615_pm_power_save_work(struct work_struct *work) goto out; } -if (!mt7615_firmware_own (dev)) +if (!mt7615_mcu_set_fw_ctrl (dev))return ; out:queue_delayed_work (dev->mt76.wq, &dev->pm.ps_work, delta);
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +81 -77
200 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +4 -2
@@ -220,6 +220,8 @@ struct mt7615_phy {#define mt7615_mcu_add_bss_info (phy, ...) (phy->dev)->mcu_ops->add_bss_info((phy), __VA_ARGS__)#define mt7615_mcu_add_beacon (dev, ...) (dev)->mcu_ops->add_beacon_offload((dev), __VA_ARGS__)#define mt7615_mcu_set_pm (dev, ...) (dev)->mcu_ops->set_pm_state((dev), __VA_ARGS__) +#define mt7615_mcu_set_drv_ctrl (dev) (dev)->mcu_ops->set_drv_ctrl((dev)) +#define mt7615_mcu_set_fw_ctrl (dev) (dev)->mcu_ops->set_fw_ctrl((dev))struct mt7615_mcu_ops { int (*add_tx_ba)(struct mt7615_dev *dev, struct ieee80211_ampdu_params *params,
@@ -238,6 +240,8 @@ struct mt7615_mcu_ops {struct ieee80211_hw *hw, struct ieee80211_vif *vif, bool enable);int (*set_pm_state)(struct mt7615_dev *dev,int band,int state); +int (*set_drv_ctrl)(struct mt7615_dev *dev); +int (*set_fw_ctrl)(struct mt7615_dev *dev); };struct mt7615_dev {
@@ -638,8 +642,6 @@ int mt7615_mcu_set_p2p_oppps(struct ieee80211_hw *hw, struct ieee80211_vif *vif);int mt7615_mcu_set_roc (struct mt7615_phy *phy,struct ieee80211_vif *vif,struct ieee80211_channel *chan,int duration); -int mt7615_firmware_own (struct mt7615_dev *dev); -int mt7615_driver_own (struct mt7615_dev *dev);int mt7615_init_debugfs (struct mt7615_dev *dev);int mt7615_mcu_wait_response (struct mt7615_dev *dev,int cmd,int seq);
drivers/net/wireless/mediatek/mt76/mt7615/pci.c +2 -2
@@ -118,7 +118,7 @@ static int mt7615_pci_suspend(struct pci_dev *pdev, pm_message_t state)if (err) goto restore; - err =mt7615_firmware_own (dev); + err =mt7615_mcu_set_fw_ctrl (dev);if (err) goto restore;
@@ -142,7 +142,7 @@ static int mt7615_pci_resume(struct pci_dev *pdev)bool pdma_reset;int i, err; - err =mt7615_driver_own (dev); + err =mt7615_mcu_set_drv_ctrl (dev);if (err <0 )return err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 323/757 mt76: mt7622: fix fw hang on mt7622
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 6892555dbe71ed551d3779aa20747484dc9b6ad5 ]
Set poll timeout to 3s for mt7622 devices in order to avoid fw hangs. Swap mt7622_trigger_hif_int and doorbell configuration order in mt7615_mcu_drv_pmctrl routine.
Introduce mt7615_mcu_lp_drv_pmctrl routine to take care of drv_own configuration for runtime-pm.
--- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 46 +++++++++++++------ 1 file changed, 32 insertions(+), 14 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +32 -14
@@ -338,28 +338,46 @@ static int mt7615_mcu_drv_pmctrl(struct mt7615_dev *dev) {struct mt76_phy *mphy = &dev->mt76.phy;struct mt76_dev *mdev = &dev->mt76; -int i; +u32 addr; +int err; -if (!test_and_clear_bit (MT76_STATE_PM , &mphy->state)) - goto out; + addr =is_mt7663 (mdev) ?MT_PCIE_DOORBELL_PUSH :MT_CFG_LPCR_HOST ; +mt76_wr (dev, addr,MT_CFG_LPCR_HOST_DRV_OWN );mt7622_trigger_hif_int (dev, true); -for (i =0 ; i <MT7615_DRV_OWN_RETRY_COUNT ; i++) { -u32 addr; + addr =is_mt7663 (mdev) ?MT_CONN_HIF_ON_LPCTL :MT_CFG_LPCR_HOST ; + err = !mt76_poll_msec (dev, addr,MT_CFG_LPCR_HOST_FW_OWN ,0 ,3000 ); - addr =is_mt7663 (mdev) ?MT_PCIE_DOORBELL_PUSH :MT_CFG_LPCR_HOST ; -mt76_wr (dev, addr,MT_CFG_LPCR_HOST_DRV_OWN ); +mt7622_trigger_hif_int (dev, false); - addr =is_mt7663 (mdev) ?MT_CONN_HIF_ON_LPCTL :MT_CFG_LPCR_HOST ; -if (mt76_poll_msec (dev, addr,MT_CFG_LPCR_HOST_FW_OWN ,0 ,50 )) -break ; +if (err) { +dev_err (mdev->dev,"driver own failed\n" ); +return -ETIMEDOUT ; } -mt7622_trigger_hif_int (dev, false); +clear_bit (MT76_STATE_PM , &mphy->state); + +return 0 ; +} + +static int mt7615_mcu_lp_drv_pmctrl (struct mt7615_dev *dev) +{ +struct mt76_phy *mphy = &dev->mt76.phy; +int i; + +if (!test_and_clear_bit (MT76_STATE_PM , &mphy->state)) + goto out; + +for (i =0 ; i <MT7615_DRV_OWN_RETRY_COUNT ; i++) { +mt76_wr (dev,MT_PCIE_DOORBELL_PUSH ,MT_CFG_LPCR_HOST_DRV_OWN ); +if (mt76_poll_msec (dev,MT_CONN_HIF_ON_LPCTL , +MT_CFG_LPCR_HOST_FW_OWN ,0 ,50 )) +break ; + }if (i ==MT7615_DRV_OWN_RETRY_COUNT ) { -dev_err (mdev->dev,"driver own failed\n" ); +dev_err (dev->mt76.dev,"driver own failed\n" );set_bit (MT76_STATE_PM , &mphy->state);return -EIO ; }
@@ -386,7 +404,7 @@ static int mt7615_mcu_fw_pmctrl(struct mt7615_dev *dev)if (is_mt7622 (&dev->mt76) && !mt76_poll_msec (dev, addr,MT_CFG_LPCR_HOST_FW_OWN , -MT_CFG_LPCR_HOST_FW_OWN ,300 )) { +MT_CFG_LPCR_HOST_FW_OWN ,3000 )) {dev_err (dev->mt76.dev,"Timeout for firmware own\n" );clear_bit (MT76_STATE_PM , &mphy->state); err = -EIO ;
@@ -1900,7 +1918,7 @@ static const struct mt7615_mcu_ops uni_update_ops = { .add_tx_ba = mt7615_mcu_uni_tx_ba, .add_rx_ba = mt7615_mcu_uni_rx_ba, .sta_add = mt7615_mcu_uni_add_sta, - .set_drv_ctrl = mt7615_mcu_drv_pmctrl, + .set_drv_ctrl = mt7615_mcu_lp_drv_pmctrl, .set_fw_ctrl = mt7615_mcu_fw_pmctrl, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 324/757 mt76: mt7915: fix possible memory leak in mt7915_mcu_add_beacon
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 071c8ce8e92a86b8bf78678e78eb4b79fdc16768 ]
Release mcu message memory in case of failure in mt7915_mcu_add_beacon routine
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +10 -8
@@ -2335,14 +2335,6 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw,struct bss_info_bcn *bcn;int len =MT7915_BEACON_UPDATE_SIZE +MAX_BEACON_SIZE ; - rskb =mt7915_mcu_alloc_sta_req (dev, mvif,NULL , len); -if (IS_ERR (rskb)) -return PTR_ERR (rskb); - - tlv =mt7915_mcu_add_tlv (rskb,BSS_INFO_OFFLOAD ,sizeof (*bcn)); - bcn = (struct bss_info_bcn *)tlv; - bcn->enable = en; - skb =ieee80211_beacon_get_template (hw, vif, &offs);if (!skb)return -EINVAL ;
@@ -2353,6 +2345,16 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw,return -EINVAL ; } + rskb =mt7915_mcu_alloc_sta_req (dev, mvif,NULL , len); +if (IS_ERR (rskb)) { +dev_kfree_skb (skb); +return PTR_ERR (rskb); + } + + tlv =mt7915_mcu_add_tlv (rskb,BSS_INFO_OFFLOAD ,sizeof (*bcn)); + bcn = (struct bss_info_bcn *)tlv; + bcn->enable = en; +if (mvif->band_idx) { info =IEEE80211_SKB_CB (skb); info->hw_queue |=MT_TX_HW_QUEUE_EXT_PHY ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 325/757 quota: clear padding in v2r1_mem2diskdqb()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 3d3dc274ce736227e3197868ff749cff2f175f63 ]
Freshly allocated memory contains garbage, better make sure to init all struct v2r1_disk_dqblk fields to avoid KMSAN report:
BUG: KMSAN: uninit-value in qtree_entry_unused+0x137/0x1b0 fs/quota/quota_tree.c:218 CPU: 0 PID: 23373 Comm: syz-executor.1 Not tainted 5.9.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x21c/0x280 lib/dump_stack.c:118 kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:122 __msan_warning+0x58/0xa0 mm/kmsan/kmsan_instr.c:219 qtree_entry_unused+0x137/0x1b0 fs/quota/quota_tree.c:218 v2r1_mem2diskdqb+0x43d/0x710 fs/quota/quota_v2.c:285 qtree_write_dquot+0x226/0x870 fs/quota/quota_tree.c:394 v2_write_dquot+0x1ad/0x280 fs/quota/quota_v2.c:333 dquot_commit+0x4af/0x600 fs/quota/dquot.c:482 ext4_write_dquot fs/ext4/super.c:5934 [inline] ext4_mark_dquot_dirty+0x4d8/0x6a0 fs/ext4/super.c:5985 mark_dquot_dirty fs/quota/dquot.c:347 [inline] mark_all_dquot_dirty fs/quota/dquot.c:385 [inline] dquot_alloc_inode+0xc05/0x12b0 fs/quota/dquot.c:1755 __ext4_new_inode+0x8204/0x9d70 fs/ext4/ialloc.c:1155 ext4_tmpfile+0x41a/0x850 fs/ext4/namei.c:2686 vfs_tmpfile+0x2a2/0x570 fs/namei.c:3283 do_tmpfile fs/namei.c:3316 [inline] path_openat+0x4035/0x6a90 fs/namei.c:3359 do_filp_open+0x2b8/0x710 fs/namei.c:3395 do_sys_openat2+0xa88/0x1140 fs/open.c:1168 do_sys_open fs/open.c:1184 [inline] __do_compat_sys_openat fs/open.c:1242 [inline] __se_compat_sys_openat+0x2a4/0x310 fs/open.c:1240 __ia32_compat_sys_openat+0x56/0x70 fs/open.c:1240 do_syscall_32_irqs_on arch/x86/entry/common.c:80 [inline] __do_fast_syscall_32+0x129/0x180 arch/x86/entry/common.c:139 do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:162 do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:205 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf7ff4549 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000f55cd0cc EFLAGS: 00000296 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 0000000020000000 RDX: 0000000000410481 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:143 [inline] kmsan_internal_poison_shadow+0x66/0xd0 mm/kmsan/kmsan.c:126 kmsan_slab_alloc+0x8a/0xe0 mm/kmsan/kmsan_hooks.c:80 slab_alloc_node mm/slub.c:2907 [inline] slab_alloc mm/slub.c:2916 [inline] __kmalloc+0x2bb/0x4b0 mm/slub.c:3982 kmalloc include/linux/slab.h:559 [inline] getdqbuf+0x56/0x150 fs/quota/quota_tree.c:52 qtree_write_dquot+0xf2/0x870 fs/quota/quota_tree.c:378 v2_write_dquot+0x1ad/0x280 fs/quota/quota_v2.c:333 dquot_commit+0x4af/0x600 fs/quota/dquot.c:482 ext4_write_dquot fs/ext4/super.c:5934 [inline] ext4_mark_dquot_dirty+0x4d8/0x6a0 fs/ext4/super.c:5985 mark_dquot_dirty fs/quota/dquot.c:347 [inline] mark_all_dquot_dirty fs/quota/dquot.c:385 [inline] dquot_alloc_inode+0xc05/0x12b0 fs/quota/dquot.c:1755 __ext4_new_inode+0x8204/0x9d70 fs/ext4/ialloc.c:1155 ext4_tmpfile+0x41a/0x850 fs/ext4/namei.c:2686 vfs_tmpfile+0x2a2/0x570 fs/namei.c:3283 do_tmpfile fs/namei.c:3316 [inline] path_openat+0x4035/0x6a90 fs/namei.c:3359 do_filp_open+0x2b8/0x710 fs/namei.c:3395 do_sys_openat2+0xa88/0x1140 fs/open.c:1168 do_sys_open fs/open.c:1184 [inline] __do_compat_sys_openat fs/open.c:1242 [inline] __se_compat_sys_openat+0x2a4/0x310 fs/open.c:1240 __ia32_compat_sys_openat+0x56/0x70 fs/open.c:1240 do_syscall_32_irqs_on arch/x86/entry/common.c:80 [inline] __do_fast_syscall_32+0x129/0x180 arch/x86/entry/common.c:139 do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:162 do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:205 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
--- fs/quota/quota_v2.c | 1 + 1 file changed, 1 insertion(+)
fs/quota/quota_v2.c +1 -0
@@ -282,6 +282,7 @@ static void v2r1_mem2diskdqb(void *dp, struct dquot *dquot) d->dqb_curspace =cpu_to_le64 (m->dqb_curspace); d->dqb_btime =cpu_to_le64 (m->dqb_btime); d->dqb_id =cpu_to_le32 (from_kqid (&init_user_ns, dquot->dq_id)); + d->dqb_pad =0 ;if (qtree_entry_unused (info, dp)) d->dqb_itime =cpu_to_le64 (1 ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 326/757 slimbus: core: check get_addr before removing laddr ida
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit f97769fde678e111a1b7b165b380d8a3dfe54f4e ]
logical address can be either assigned by the SLIMBus controller or the core. Core uses IDA in cases where get_addr callback is not provided by the controller.
Core already has this check while allocating IDR, however during absence reporting this is not checked. This patch fixes this issue.
--- drivers/slimbus/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/slimbus/core.c +2 -2
@@ -326,8 +326,8 @@ void slim_report_absent(struct slim_device *sbdev)mutex_lock (&ctrl->lock); sbdev->is_laddr_valid = false;mutex_unlock (&ctrl->lock); - -ida_simple_remove (&ctrl->laddr_ida, sbdev->laddr); +if (!ctrl->get_laddr) +ida_simple_remove (&ctrl->laddr_ida, sbdev->laddr);slim_device_update_status (sbdev,SLIM_DEVICE_STATUS_DOWN ); }EXPORT_SYMBOL_GPL (slim_report_absent);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 327/757 slimbus: core: do not enter to clock pause mode in core
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit df2c471c4ae07e18a0396db670dca2ef867c5153 ]
Let the controller logic decide when to enter into clock pause mode! Entering in to pause mode during unregistration does not really make sense as the controller is totally going down at that point in time.
--- drivers/slimbus/core.c | 2 -- 1 file changed, 2 deletions(-)
drivers/slimbus/core.c +0 -2
@@ -301,8 +301,6 @@ int slim_unregister_controller(struct slim_controller *ctrl) {/* Remove all clients */ device_for_each_child (ctrl->dev,NULL , slim_ctrl_remove_device); -/* Enter Clock Pause */ -slim_ctrl_clk_pause (ctrl, false,0 );ida_simple_remove (&ctrl_ida, ctrl->id);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 328/757 slimbus: qcom-ngd-ctrl: disable ngd in qmi server down callback
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit 709ec3f7fc5773ac4aa6fb22c3f0ac8103c674db ]
In QMI new server notification we enable the NGD however during delete server notification we do not disable the NGD.
This can lead to multiple instances of NGD being enabled, so make sure that we disable NGD in delete server callback to fix this issue!
--- drivers/slimbus/qcom-ngd-ctrl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +4 -0
@@ -1277,9 +1277,13 @@ static void qcom_slim_ngd_qmi_del_server(struct qmi_handle *hdl, {struct qcom_slim_ngd_qmi *qmi = container_of(hdl, struct qcom_slim_ngd_qmi, svc_event_hdl); +struct qcom_slim_ngd_ctrl *ctrl = + container_of(qmi, struct qcom_slim_ngd_ctrl, qmi); qmi->svc_info.sq_node =0 ; qmi->svc_info.sq_port =0 ; + +qcom_slim_ngd_enable (ctrl, false); }static struct qmi_ops qcom_slim_ngd_qmi_svc_event_ops = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 329/757 drm/vc4: crtc: Rework a bit the CRTC state code
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 427c4a0680a28f87bb9c7bbfeac26b39ef8682ad ]
The current CRTC state reset hook in vc4 allocates a vc4_crtc_state structure as a drm_crtc_state, and relies on the fact that vc4_crtc_state embeds drm_crtc_state as its first member, and therefore can be safely cast.
However, this is pretty fragile especially since there's no check for this in place, and we're going to need to access vc4_crtc_state member at reset so this looks like a good occasion to make it more robust.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +10 -3
@@ -723,11 +723,18 @@ void vc4_crtc_destroy_state(struct drm_crtc *crtc,void vc4_crtc_reset (struct drm_crtc *crtc) { +struct vc4_crtc_state *vc4_crtc_state; +if (crtc->state)vc4_crtc_destroy_state (crtc, crtc->state); - crtc->state =kzalloc (sizeof (struct vc4_crtc_state ),GFP_KERNEL ); -if (crtc->state) -__drm_atomic_helper_crtc_reset (crtc, crtc->state); + + vc4_crtc_state =kzalloc (sizeof (*vc4_crtc_state),GFP_KERNEL ); +if (!vc4_crtc_state) { + crtc->state =NULL ; +return ; + } + +__drm_atomic_helper_crtc_reset (crtc, &vc4_crtc_state->base); }static const struct drm_crtc_funcs vc4_crtc_funcs = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 330/757 ASoC: fsl_sai: Instantiate snd_soc_dai_driver
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 22a16145af824f91014d07f8664114859900b9e6 ]
Instantiate snd_soc_dai_driver for independent symmetric control. Otherwise the symmetric setting may be overwritten by other instance.
--- sound/soc/fsl/fsl_sai.c | 19 +++++++++++-------- sound/soc/fsl/fsl_sai.h | 1 + 2 files changed, 12 insertions(+), 8 deletions(-)
sound/soc/fsl/fsl_sai.c +11 -8
@@ -694,7 +694,7 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)return 0 ; } -static struct snd_soc_dai_driver fsl_sai_dai = { +static struct snd_soc_dai_driver fsl_sai_dai_template = { .probe = fsl_sai_dai_probe, .playback = { .stream_name ="CPU-Playback" ,
@@ -966,12 +966,15 @@ static int fsl_sai_probe(struct platform_device *pdev)return ret; } +memcpy (&sai->cpu_dai_drv, &fsl_sai_dai_template, +sizeof (fsl_sai_dai_template)); +/* Sync Tx with Rx as default by following old DT binding */ sai->synchronous[RX ] = true; sai->synchronous[TX ] = false; - fsl_sai_dai.symmetric_rates =1 ; - fsl_sai_dai.symmetric_channels =1 ; - fsl_sai_dai.symmetric_samplebits =1 ; + sai->cpu_dai_drv.symmetric_rates =1 ; + sai->cpu_dai_drv.symmetric_channels =1 ; + sai->cpu_dai_drv.symmetric_samplebits =1 ;if (of_find_property (np,"fsl,sai-synchronous-rx" ,NULL ) &&of_find_property (np,"fsl,sai-asynchronous" ,NULL )) {
@@ -988,9 +991,9 @@ static int fsl_sai_probe(struct platform_device *pdev)/* Discard all settings for asynchronous mode */ sai->synchronous[RX ] = false; sai->synchronous[TX ] = false; - fsl_sai_dai.symmetric_rates =0 ; - fsl_sai_dai.symmetric_channels =0 ; - fsl_sai_dai.symmetric_samplebits =0 ; + sai->cpu_dai_drv.symmetric_rates =0 ; + sai->cpu_dai_drv.symmetric_channels =0 ; + sai->cpu_dai_drv.symmetric_samplebits =0 ; } if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
@@ -1020,7 +1023,7 @@ static int fsl_sai_probe(struct platform_device *pdev)regcache_cache_only (sai->regmap, true); ret =devm_snd_soc_register_component (&pdev->dev, &fsl_component, - &fsl_sai_dai,1 ); + &sai->cpu_dai_drv,1 );if (ret) goto err_pm_disable;
sound/soc/fsl/fsl_sai.h +1 -0
@@ -180,6 +180,7 @@ struct fsl_sai {unsigned int bclk_ratio;const struct fsl_sai_soc_data *soc_data; +struct snd_soc_dai_driver cpu_dai_drv;struct snd_dmaengine_dai_dma_data dma_params_rx;struct snd_dmaengine_dai_dma_data dma_params_tx; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 331/757 HID: hid-input: fix stylus battery reporting
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 505f394fa239cecb76d916aa858f87ed7ea7fde4 ]
With commit 4f3882177240 hid-input started clearing of "ignored" usages to avoid using garbage that might have been left in them. However "battery strength" usages should not be ignored, as we do want to use them.
--- drivers/hid/hid-input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-input.c +2 -2
@@ -797,7 +797,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x3b :/* Battery Strength */ hidinput_setup_battery (device,HID_INPUT_REPORT , field); usage->type =EV_PWR ; - goto ignore; +return ;case 0x3c :/* Invert */ map_key_clear (BTN_TOOL_RUBBER );
@@ -1059,7 +1059,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase HID_DC_BATTERYSTRENGTH :hidinput_setup_battery (device,HID_INPUT_REPORT , field); usage->type =EV_PWR ; - goto ignore; +return ; } goto unknown;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 332/757 tty: hvc: fix link error with CONFIG_SERIAL_CORE_CONSOLE=n
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 75fc65079d8253e1c25a5f8348111a85d71e0f01 ]
aarch64-linux-gnu-ld: drivers/tty/hvc/hvc_dcc.o: in function `dcc_early_write':
hvc_dcc.c:(.text+0x164): undefined reference to `uart_console_write'
The driver uses the uart_console_write(), but SERIAL_CORE_CONSOLE is not selected, so uart_console_write is not defined, then we get the error. Fix this by selecting SERIAL_CORE_CONSOLE.
--- drivers/tty/hvc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/tty/hvc/Kconfig +1 -0
@@ -81,6 +81,7 @@ config HVC_DCC bool "ARM JTAG DCC console" depends on ARM || ARM64 select HVC_DRIVER + select SERIAL_CORE_CONSOLE help This console uses the JTAG DCC on ARM to create a console under the HVC driver. This console is used through a JTAG only on ARM. If you don't have
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 333/757 tty: serial: imx: fix link error with CONFIG_SERIAL_CORE_CONSOLE=n
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 24c796926e2f88b383a76ddc871a7cdd62484f3a ]
aarch64-linux-gnu-ld: drivers/tty/serial/imx_earlycon.o: in function `imx_uart_console_early_write':
imx_earlycon.c:(.text+0x84): undefined reference to `uart_console_write'
The driver uses the uart_console_write(), but SERIAL_CORE_CONSOLE is not selected, so uart_console_write is not defined, then we get the error. Fix this by selecting SERIAL_CORE_CONSOLE.
--- drivers/tty/serial/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/Kconfig +1 -0
@@ -521,6 +521,7 @@ config SERIAL_IMX_EARLYCON depends on ARCH_MXC || COMPILE_TEST depends on OF select SERIAL_EARLYCON + select SERIAL_CORE_CONSOLE help If you have enabled the earlycon on the Freescale IMX CPU you can make it the earlycon by answering Y to this option.
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 334/757 nvmem: core: fix possibly memleak when use nvmem_cell_info_to_nvmem_cell()
In reply to Greg Kroah-HartmanFrom: Vadym Kochan <[email protected]>
[ Upstream commit fc9eec4d643597cf4cb2fef17d48110e677610da ]
Fix missing 'kfree_const(cell->name)' when call to nvmem_cell_info_to_nvmem_cell() in several places:
* after nvmem_cell_info_to_nvmem_cell() failed during nvmem_add_cells()
* during nvmem_device_cell_{read,write} when cell->name is kstrdup'ed() without calling kfree_const() at the end, but really there is no reason to do that 'dup, because the cell instance is allocated on the stack for some short period to be read/write without exposing it to the caller.
So the new nvmem_cell_info_to_nvmem_cell_nodup() helper is introduced which is used to convert cell_info -> cell without name duplication as a lighweight version of nvmem_cell_info_to_nvmem_cell().
--- drivers/nvmem/core.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
drivers/nvmem/core.c +24 -9
@@ -361,16 +361,14 @@ static void nvmem_cell_add(struct nvmem_cell *cell)blocking_notifier_call_chain (&nvmem_notifier,NVMEM_CELL_ADD , cell); } -static int nvmem_cell_info_to_nvmem_cell (struct nvmem_device *nvmem, -const struct nvmem_cell_info *info, -struct nvmem_cell *cell) +static int nvmem_cell_info_to_nvmem_cell_nodup (struct nvmem_device *nvmem, +const struct nvmem_cell_info *info, +struct nvmem_cell *cell) { cell->nvmem = nvmem; cell->offset = info->offset; cell->bytes = info->bytes; - cell->name =kstrdup_const (info->name,GFP_KERNEL ); -if (!cell->name) -return -ENOMEM ; + cell->name = info->name; cell->bit_offset = info->bit_offset; cell->nbits = info->nbits;
@@ -382,13 +380,30 @@ static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem,if (!IS_ALIGNED (cell->offset, nvmem->stride)) {dev_err (&nvmem->dev,"cell %s unaligned to nvmem stride %d\n" , - cell->name, nvmem->stride); + cell->name ?:"<unknown>" , nvmem->stride);return -EINVAL ; }return 0 ; } +static int nvmem_cell_info_to_nvmem_cell (struct nvmem_device *nvmem, +const struct nvmem_cell_info *info, +struct nvmem_cell *cell) +{ +int err; + + err =nvmem_cell_info_to_nvmem_cell_nodup (nvmem, info, cell); +if (err) +return err; + + cell->name =kstrdup_const (info->name,GFP_KERNEL ); +if (!cell->name) +return -ENOMEM ; + +return 0 ; +} +/** * nvmem_add_cells() - Add cell information to an nvmem device *
@@ -1463,7 +1478,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,if (!nvmem)return -EINVAL ; - rc =nvmem_cell_info_to_nvmem_cell (nvmem, info, &cell); + rc =nvmem_cell_info_to_nvmem_cell_nodup (nvmem, info, &cell);if (rc)return rc;
@@ -1493,7 +1508,7 @@ int nvmem_device_cell_write(struct nvmem_device *nvmem,if (!nvmem)return -EINVAL ; - rc =nvmem_cell_info_to_nvmem_cell (nvmem, info, &cell); + rc =nvmem_cell_info_to_nvmem_cell_nodup (nvmem, info, &cell);if (rc)return rc;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 335/757 hv: clocksource: Add notrace attribute to read_hv_sched_clock_*() functions
In reply to Greg Kroah-HartmanFrom: Mohammed Gamal <[email protected]>
[ Upstream commit 1f3aed01473c41c9f896fbf4c30d330655e8aa7c ]
When selecting function_graph tracer with the command:
# echo function_graph > /sys/kernel/debug/tracing/current_tracer
The kernel crashes with the following stack trace:
[69703.122389] BUG: stack guard page was hit at 000000001056545c (stack is 00000000fa3f8fed..0000000005d39503) [69703.122403] kernel stack overflow (double-fault): 0000 [#1] SMP PTI [69703.122413] CPU: 0 PID: 16982 Comm: bash Kdump: loaded Not tainted 4.18.0-236.el8.x86_64 #1 [69703.122420] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019 [69703.122433] RIP: 0010repare_ftrace_return+0xa/0x110 [69703.122458] Code: 05 00 0f 0b 48 c7 c7 10 ca 69 ae 0f b6 f0 e8 4b 52 0c 00 31 c0 eb ca 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 56 41 55 41 54 <53> 48 83 ec 18 65 48 8b 04 25 28 00 00 00 48 89 45 d8 31 c0 48 85 [69703.122467] RSP: 0018:ffffbd6d01118000 EFLAGS: 00010086 [69703.122476] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000003 [69703.122484] RDX: 0000000000000000 RSI: ffffbd6d011180d8 RDI: ffffffffadce7550 [69703.122491] RBP: ffffbd6d01118018 R08: 0000000000000000 R09: ffff9d4b09266000 [69703.122498] R10: ffff9d4b0fc04540 R11: ffff9d4b0fc20a00 R12: ffff9d4b6e42aa90 [69703.122506] R13: ffff9d4b0fc20ab8 R14: 00000000000003e8 R15: ffffbd6d0111837c [69703.122514] FS: 00007fd5f2588740(0000) GS:ffff9d4b6e400000(0000) knlGS:0000000000000000 [69703.122521] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [69703.122528] CR2: ffffbd6d01117ff8 CR3: 00000000565d8001 CR4: 00000000003606f0 [69703.122538] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [69703.122545] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [69703.122552] Call Trace: [69703.122568] ftrace_graph_caller+0x6b/0xa0 [69703.122589] ? read_hv_sched_clock_tsc+0x5/0x20 [69703.122599] read_hv_sched_clock_tsc+0x5/0x20 [69703.122611] sched_clock+0x5/0x10 [69703.122621] sched_clock_local+0x12/0x80 [69703.122631] sched_clock_cpu+0x8c/0xb0 [69703.122644] trace_clock_global+0x21/0x90 [69703.122655] ring_buffer_lock_reserve+0x100/0x3c0 [69703.122671] trace_buffer_lock_reserve+0x16/0x50 [69703.122683] __trace_graph_entry+0x28/0x90 [69703.122695] trace_graph_entry+0xfd/0x1a0 [69703.122705] ? read_hv_clock_tsc_cs+0x10/0x10 [69703.122714] ? sched_clock+0x5/0x10 [69703.122723] prepare_ftrace_return+0x99/0x110 [69703.122734] ? read_hv_clock_tsc_cs+0x10/0x10 [69703.122743] ? sched_clock+0x5/0x10 [69703.122752] ftrace_graph_caller+0x6b/0xa0 [69703.122768] ? read_hv_clock_tsc_cs+0x10/0x10 [69703.122777] ? sched_clock+0x5/0x10 [69703.122786] ? read_hv_sched_clock_tsc+0x5/0x20 [69703.122796] ? ring_buffer_unlock_commit+0x1d/0xa0 [69703.122805] read_hv_sched_clock_tsc+0x5/0x20 [69703.122814] ftrace_graph_caller+0xa0/0xa0
[ ... recursion snipped ... ]
Setting the notrace attribute for read_hv_sched_clock_msr() and read_hv_sched_clock_tsc() fixes it.
--- drivers/clocksource/hyperv_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/hyperv_timer.c +2 -2
@@ -341,7 +341,7 @@ static u64 notrace read_hv_clock_tsc_cs(struct clocksource *arg)return read_hv_clock_tsc (); } -static u64 read_hv_sched_clock_tsc (void ) +static u64 notrace read_hv_sched_clock_tsc(void) {return (read_hv_clock_tsc () - hv_sched_clock_offset) * (NSEC_PER_SEC /HV_CLOCK_HZ );
@@ -404,7 +404,7 @@ static u64 notrace read_hv_clock_msr_cs(struct clocksource *arg)return read_hv_clock_msr (); } -static u64 read_hv_sched_clock_msr (void ) +static u64 notrace read_hv_sched_clock_msr(void) {return (read_hv_clock_msr () - hv_sched_clock_offset) * (NSEC_PER_SEC /HV_CLOCK_HZ );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 336/757 nl80211: fix OBSS PD min and max offset validation
In reply to Greg Kroah-HartmanFrom: Rajkumar Manoharan <[email protected]>
[ Upstream commit 6c8b6e4a5f745ec49286ac0a3f1d591a34818f82 ]
The SRG min and max offset won't present when SRG Information Present of SR control field of Spatial Reuse Parameter Set element set to 0. Per spec. IEEE802.11ax D7.0, SRG OBSS PD Min Offset ≤ SRG OBSS PD Max Offset. Hence fix the constrain check to allow same values in both offset and also call appropriate nla_get function to read the values.
--- net/wireless/nl80211.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
net/wireless/nl80211.c +8 -10
@@ -4683,16 +4683,14 @@ static int nl80211_parse_he_obss_pd(struct nlattr *attrs,if (err)return err; -if (!tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET ] || - !tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET ]) -return -EINVAL ; - - he_obss_pd->min_offset = -nla_get_u32 (tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET ]); - he_obss_pd->max_offset = -nla_get_u32 (tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET ]); - -if (he_obss_pd->min_offset >= he_obss_pd->max_offset) +if (tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET ]) + he_obss_pd->min_offset = +nla_get_u8 (tb[NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET ]); +if (tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET ]) + he_obss_pd->max_offset = +nla_get_u8 (tb[NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET ]); + +if (he_obss_pd->min_offset > he_obss_pd->max_offset)return -EINVAL ; he_obss_pd->enable = true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 337/757 iomap: Use kzalloc to allocate iomap_page
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit a6901d4d148dcbad7efb3174afbdf68c995618c2 ]
We can skip most of the initialisation, although spinlocks still need explicit initialisation as architectures may use a non-zero value to indicate unlocked. The comment is no longer useful as attach_page_private() handles the refcount now.
--- fs/iomap/buffered-io.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
fs/iomap/buffered-io.c +1 -9
@@ -49,16 +49,8 @@ iomap_page_create(struct inode *inode, struct page *page)if (iop ||i_blocksize (inode) ==PAGE_SIZE )return iop; - iop =kmalloc (sizeof (*iop),GFP_NOFS | __GFP_NOFAIL); -atomic_set (&iop->read_count,0 ); -atomic_set (&iop->write_count,0 ); + iop =kzalloc (sizeof (*iop),GFP_NOFS | __GFP_NOFAIL);spin_lock_init (&iop->uptodate_lock); -bitmap_zero (iop->uptodate,PAGE_SIZE /SECTOR_SIZE ); - -/* -* migrate_page_move_mapping() assumes that pages with private data have -* their count elevated by 1. -*/ attach_page_private (page, iop);return iop; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 338/757 coresight: etm: perf: Fix warning caused by etm_setup_aux failure
In reply to Greg Kroah-HartmanFrom: Tingwei Zhang <[email protected]>
[ Upstream commit 716f5652a13122364a65e694386b9b26f5e98c51 ]
When coresight_build_path() fails on all the cpus, etm_setup_aux calls etm_free_aux() to free allocated event_data. WARN_ON(cpumask_empty(mask) will be triggered since cpu mask is empty. Check event_data->snk_config is not NULL first to avoid this warning.
--- drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm-perf.c +2 -2
@@ -126,10 +126,10 @@ static void free_sink_buffer(struct etm_event_data *event_data)cpumask_t *mask = &event_data->mask;struct coresight_device *sink; -if (WARN_ON (cpumask_empty (mask))) +if (!event_data->snk_config)return ; -if (!event_data->snk_config) +if (WARN_ON (cpumask_empty (mask)))return ; cpu =cpumask_first (mask);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 339/757 coresight: cti: Fix remove sysfs link error
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
[ Upstream commit 1cce921bce7dcf6fef9bdfa4dcc9406383274408 ]
CTI code to remove sysfs link to other devices on shutdown, incorrectly tries to remove a single ended link when these are all double ended. This implementation leaves elements in the link info structure undefined which results in a crash in recent tests for driver module unload.
This patch corrects the link removal code.
--- drivers/hwtracing/coresight/coresight-cti.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-cti.c +6 -3
@@ -494,12 +494,15 @@ static bool cti_add_sysfs_link(struct cti_drvdata *drvdata,return !link_err; } -static void cti_remove_sysfs_link (struct cti_trig_con *tc) +static void cti_remove_sysfs_link (struct cti_drvdata *drvdata, +struct cti_trig_con *tc) {struct coresight_sysfs_link link_info; + link_info.orig = drvdata->csdev; link_info.orig_name = tc->con_dev_name; link_info.target = tc->con_dev; + link_info.target_name =dev_name (&drvdata->csdev->dev);coresight_remove_sysfs_link (&link_info); }
@@ -590,7 +593,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidev = &ctidrv->ctidev;list_for_each_entry (tc, &ctidev->trig_cons, node) {if (tc->con_dev == csdev->ect_dev) { -cti_remove_sysfs_link (tc); +cti_remove_sysfs_link (ctidrv, tc); tc->con_dev =NULL ;break ; }
@@ -634,7 +637,7 @@ static void cti_remove_conn_xrefs(struct cti_drvdata *drvdata)if (tc->con_dev) {coresight_set_assoc_ectdev_mutex (tc->con_dev,NULL ); -cti_remove_sysfs_link (tc); +cti_remove_sysfs_link (drvdata, tc); tc->con_dev =NULL ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 340/757 coresight: cti: Fix bug clearing sysfs links on callback
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
[ Upstream commit cab280bf3533c72f95ebdb65ce534b5cdc4729dc ]
During module unload, a coresight driver module will call back into the CTI driver to remove any links between the two devices.
The current code has 2 issues:-
1) in the CTI driver the matching code is matching to the wrong device so misses all the links.
2) The callback is called too late in the unload process resulting in a crash.
This fixes both the issues.
--- drivers/hwtracing/coresight/coresight-cti.c | 2 +- drivers/hwtracing/coresight/coresight.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-cti.c +1 -1
@@ -592,7 +592,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev) ctidrv =csdev_to_cti_drvdata (csdev->ect_dev); ctidev = &ctidrv->ctidev;list_for_each_entry (tc, &ctidev->trig_cons, node) { -if (tc->con_dev == csdev->ect_dev) { +if (tc->con_dev == csdev) {cti_remove_sysfs_link (ctidrv, tc); tc->con_dev =NULL ;break ;
drivers/hwtracing/coresight/coresight.c +1 -1
@@ -1188,7 +1188,6 @@ static void coresight_device_release(struct device *dev) {struct coresight_device *csdev =to_coresight_device (dev); -cti_remove_assoc_from_csdev (csdev);fwnode_handle_put (csdev->dev.fwnode);kfree (csdev->refcnt);kfree (csdev);
@@ -1522,6 +1521,7 @@ void coresight_unregister(struct coresight_device *csdev) {etm_perf_del_symlink_sink (csdev);/* Remove references of that device in the topology */ +cti_remove_assoc_from_csdev (csdev);coresight_remove_conns (csdev);coresight_clear_default_sink (csdev);coresight_release_platform_data (csdev, csdev->pdata);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 341/757 coresight: etm4x: Fix save and restore of TRCVMIDCCTLR1 register
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit 3477326277451000bc667dfcc4fd0774c039184c ]
In commit f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states"), mistakenly TRCVMIDCCTLR1 register value was saved in trcvmidcctlr0 state variable which is used to store TRCVMIDCCTLR0 register value in etm4x_cpu_save() and then same value is written back to both TRCVMIDCCTLR0 and TRCVMIDCCTLR1 in etm4x_cpu_restore(). There is already a trcvmidcctlr1 state variable available for TRCVMIDCCTLR1, so use it.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -1237,7 +1237,7 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trccidcctlr1 =readl (drvdata->base +TRCCIDCCTLR1 ); state->trcvmidcctlr0 =readl (drvdata->base +TRCVMIDCCTLR0 ); - state->trcvmidcctlr0 =readl (drvdata->base +TRCVMIDCCTLR1 ); + state->trcvmidcctlr1 =readl (drvdata->base +TRCVMIDCCTLR1 ); state->trcclaimset =readl (drvdata->base +TRCCLAIMCLR );
@@ -1347,7 +1347,7 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata)writel_relaxed (state->trccidcctlr1, drvdata->base +TRCCIDCCTLR1 );writel_relaxed (state->trcvmidcctlr0, drvdata->base +TRCVMIDCCTLR0 ); -writel_relaxed (state->trcvmidcctlr0, drvdata->base +TRCVMIDCCTLR1 ); +writel_relaxed (state->trcvmidcctlr1, drvdata->base +TRCVMIDCCTLR1 );writel_relaxed (state->trcclaimset, drvdata->base +TRCCLAIMSET );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 342/757 ibmvnic: set up 200GBPS speed
In reply to Greg Kroah-HartmanFrom: Lijun Pan <[email protected]>
[ Upstream commit b9cd795b0e4860f482bf3741d12e1c8f3ec1cfc9 ]
Set up the speed according to crq->query_phys_parms.rsp.speed. Fix IBMVNIC_10GBPS typo.
--- drivers/net/ethernet/ibm/ibmvnic.c | 5 ++++- drivers/net/ethernet/ibm/ibmvnic.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +4 -1
@@ -4610,7 +4610,7 @@ static int handle_query_phys_parms_rsp(union ibmvnic_crq *crq,case IBMVNIC_1GBPS : adapter->speed =SPEED_1000 ;break ; -case IBMVNIC_10GBP : +case IBMVNIC_10GBPS : adapter->speed =SPEED_10000 ;break ;case IBMVNIC_25GBPS :
@@ -4625,6 +4625,9 @@ static int handle_query_phys_parms_rsp(union ibmvnic_crq *crq,case IBMVNIC_100GBPS : adapter->speed =SPEED_100000 ;break ; +case IBMVNIC_200GBPS : + adapter->speed =SPEED_200000 ; +break ;default :if (netif_carrier_ok (netdev))netdev_warn (netdev,"Unknown speed 0x%08x\n" , rspeed);
drivers/net/ethernet/ibm/ibmvnic.h +1 -1
@@ -373,7 +373,7 @@ struct ibmvnic_phys_parms {#define IBMVNIC_10MBPS 0x40000000#define IBMVNIC_100MBPS 0x20000000#define IBMVNIC_1GBPS 0x10000000 -#define IBMVNIC_10GBP 0x08000000 +#define IBMVNIC_10GBPS 0x08000000#define IBMVNIC_40GBPS 0x04000000#define IBMVNIC_100GBPS 0x02000000#define IBMVNIC_25GBPS 0x01000000
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 343/757 bpf: disallow attaching modify_return tracing functions to other BPF programs
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 1af9270e908cd50a4f5d815c9b6f794c7d57ed07 ]
Quoted 1 line
From the checks and commit messages for
modify_return, it seems it was
never the intention that it should be possible to attach a tracing program with expected_attach_type == BPF_MODIFY_RETURN to another BPF program. However, check_attach_modify_return() will only look at the function name, so if the target function starts with "security_", the attach will be allowed even for bpf2bpf attachment.
Fix this oversight by also blocking the modification if a target program is supplied.
--- kernel/bpf/verifier.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/verifier.c +5 -0
@@ -11046,6 +11046,11 @@ static int check_attach_btf_id(struct bpf_verifier_env *env) }if (prog->expected_attach_type ==BPF_MODIFY_RETURN ) { +if (tgt_prog) { +verbose (env,"can't modify return codes of BPF programs\n" ); + ret = -EINVAL ; + goto out; + } ret =check_attach_modify_return (prog, addr);if (ret) verbose(env, "%s() is not modifiable\n",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 344/757 selftests: Remove fmod_ret from test_overhead
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit b000def2e052fc8ddea31a18019f6ebe044defb3 ]
The test_overhead prog_test included an fmod_ret program that attached to __set_task_comm() in the kernel. However, this function was never listed as allowed for return modification, so this only worked because of the verifier skipping tests when a trampoline already existed for the attach point. Now that the verifier checks have been fixed, remove fmod_ret from the test so it works again.
--- tools/testing/selftests/bpf/bench.c | 3 --- .../testing/selftests/bpf/benchs/bench_rename.c | 17 ----------------- .../selftests/bpf/prog_tests/test_overhead.c | 14 +------------- .../testing/selftests/bpf/progs/test_overhead.c | 6 ------ 4 files changed, 1 insertion(+), 39 deletions(-)
tools/testing/selftests/bpf/bench.c +0 -3
@@ -311,7 +311,6 @@ extern const struct bench bench_rename_kretprobe;extern const struct bench bench_rename_rawtp;extern const struct bench bench_rename_fentry;extern const struct bench bench_rename_fexit; -extern const struct bench bench_rename_fmodret;extern const struct bench bench_trig_base;extern const struct bench bench_trig_tp;extern const struct bench bench_trig_rawtp;
@@ -332,7 +331,6 @@ static const struct bench *benchs[] = { &bench_rename_rawtp, &bench_rename_fentry, &bench_rename_fexit, - &bench_rename_fmodret, &bench_trig_base, &bench_trig_tp, &bench_trig_rawtp,
@@ -462,4 +460,3 @@ int main(int argc, char **argv)return 0 ; } -
tools/testing/selftests/bpf/benchs/bench_rename.c +0 -17
@@ -106,12 +106,6 @@ static void setup_fexit()attach_bpf (ctx.skel->progs.prog5); } -static void setup_fmodret () -{ -setup_ctx (); -attach_bpf (ctx.skel->progs.prog6); -} -static void *consumer (void *input) {return NULL ;
@@ -182,14 +176,3 @@ const struct bench bench_rename_fexit = { .report_progress = hits_drops_report_progress, .report_final = hits_drops_report_final, }; - -const struct bench bench_rename_fmodret = { - .name ="rename-fmodret" , - .validate = validate, - .setup = setup_fmodret, - .producer_thread = producer, - .consumer_thread = consumer, - .measure = measure, - .report_progress = hits_drops_report_progress, - .report_final = hits_drops_report_final, -};
tools/testing/selftests/bpf/prog_tests/test_overhead.c +1 -13
@@ -61,10 +61,9 @@ void test_test_overhead(void)const char *raw_tp_name ="raw_tp/task_rename" ;const char *fentry_name ="fentry/__set_task_comm" ;const char *fexit_name ="fexit/__set_task_comm" ; -const char *fmodret_name ="fmod_ret/__set_task_comm" ;const char *kprobe_func ="__set_task_comm" ;struct bpf_program *kprobe_prog, *kretprobe_prog, *raw_tp_prog; -struct bpf_program *fentry_prog, *fexit_prog, *fmodret_prog; +struct bpf_program *fentry_prog, *fexit_prog;struct bpf_object *obj;struct bpf_link *link;int err, duration =0 ;
@@ -97,11 +96,6 @@ void test_test_overhead(void)if (CHECK (!fexit_prog,"find_probe" ,"prog '%s' not found\n" , fexit_name)) goto cleanup; - fmodret_prog =bpf_object__find_program_by_title (obj, fmodret_name); -if (CHECK (!fmodret_prog,"find_probe" , -"prog '%s' not found\n" , fmodret_name)) - goto cleanup; - err =bpf_object__load (obj);if (CHECK (err,"obj_load" ,"err %d\n" , err)) goto cleanup;
@@ -148,12 +142,6 @@ void test_test_overhead(void)test_run ("fexit" );bpf_link__destroy (link); -/* attach fmod_ret */ - link =bpf_program__attach_trace (fmodret_prog); -if (CHECK (IS_ERR (link),"attach fmod_ret" ,"err %ld\n" ,PTR_ERR (link))) - goto cleanup; -test_run ("fmod_ret" ); -bpf_link__destroy (link); cleanup:prctl (PR_SET_NAME , comm,0L ,0L ,0L );bpf_object__close (obj);
tools/testing/selftests/bpf/progs/test_overhead.c +0 -6
@@ -39,10 +39,4 @@ int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)return 0 ; } -SEC("fmod_ret/__set_task_comm") -int BPF_PROG (prog6 ,struct task_struct *tsk,const char *buf,bool exec) -{ -return !tsk; -} - char _license[] SEC("license") = "GPL";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 345/757 qtnfmac: fix resource leaks on unsupported iftype error return path
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 63f6982075d890d7563e2469643f05a37d193f01 ]
Currently if an unsupported iftype is detected the error return path does not free the cmd_skb leading to a resource leak. Fix this by free'ing cmd_skb.
Addresses-Coverity: ("Resource leak")
--- drivers/net/wireless/quantenna/qtnfmac/commands.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/quantenna/qtnfmac/commands.c +2 -0
@@ -869,6 +869,7 @@ int qtnf_cmd_send_del_intf(struct qtnf_vif *vif)default :pr_warn ("VIF%u.%u: unsupported iftype %d\n" , vif->mac->macid, vif->vifid, vif->wdev.iftype); +dev_kfree_skb (cmd_skb); ret = -EINVAL ; goto out; }
@@ -1924,6 +1925,7 @@ int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac,break ;default :pr_err ("unsupported iftype %d\n" , vif->wdev.iftype); +dev_kfree_skb (cmd_skb); ret = -EINVAL ; goto out; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 346/757 pinctrl: aspeed: Use the right pinconf mask
In reply to Greg Kroah-HartmanFrom: Andrew Jeffery <[email protected]>
[ Upstream commit 1d6db5ae6b090d1a8edfcb36b9bf47c5f4fe27f6 ]
The Aspeed pinconf data structures are split into 'conf' and 'map' types, where the 'conf' struct defines which register and bitfield to manipulate, while the 'map' struct defines what value to write to the register and bitfield.
Both structs have a mask member, and the wrong mask was being used to tell the regmap which bits to update.
A todo is to look at whether we can remove the mask from the 'map' struct.
--- drivers/pinctrl/aspeed/pinctrl-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/aspeed/pinctrl-aspeed.c +1 -1
@@ -534,7 +534,7 @@ int aspeed_pin_config_set(struct pinctrl_dev *pctldev, unsigned int offset, val = pmap->val <<__ffs (pconf->mask); rc =regmap_update_bits (pdata->scu, pconf->reg, - pmap->mask, val); + pconf->mask, val);if (rc <0 )return rc;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 347/757 iommu/qcom: add missing put_device() call in qcom_iommu_of_xlate()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit e2eae09939a89e0994f7965ba3c676a5eac8b4b0 ]
if of_find_device_by_node() succeed, qcom_iommu_of_xlate() doesn't have a corresponding put_device(). Thus add put_device() to fix the exception handling for this function implementation.
--- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +6 -2
@@ -584,8 +584,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)* index into qcom_iommu->ctxs: */ if (WARN_ON (asid <1 ) || -WARN_ON (asid > qcom_iommu->num_ctxs)) +WARN_ON (asid > qcom_iommu->num_ctxs)) { +put_device (&iommu_pdev->dev);return -EINVAL ; + }if (!dev_iommu_priv_get (dev)) {dev_iommu_priv_set (dev, qcom_iommu);
@@ -594,8 +596,10 @@ static int qcom_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)* multiple different iommu devices. Multiple context * banks are ok, but multiple devices are not: */ -if (WARN_ON (qcom_iommu !=dev_iommu_priv_get (dev))) +if (WARN_ON (qcom_iommu !=dev_iommu_priv_get (dev))) { +put_device (&iommu_pdev->dev);return -EINVAL ; + } }return iommu_fwspec_add_ids (dev, &asid,1 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 348/757 iio: adc: stm32-adc: fix runtime autosuspend delay when slow polling
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit c537d3457542a398caa1fe58e0976c5f83cf7281 ]
When the ADC is runtime suspended and starting a conversion, the stm32-adc driver calls pm_runtime_get_sync() that gets cascaded to the parent (e.g. runtime resume of stm32-adc-core driver). This also kicks the autosuspend delay (e.g. 2s) of the parent.
Once the ADC is active, calling pm_runtime_get_sync() again (upon a new capture) won't kick the autosuspend delay for the parent (stm32-adc-core driver) as already active.
Currently, this makes the stm32-adc-core driver go in suspend state every 2s when doing slow polling. As an example, doing a capture, e.g. cat in_voltageY_raw at a 0.2s rate, the auto suspend delay for the parent isn't refreshed. Once it expires, the parent immediately falls into runtime suspended state, in between two captures, as soon as the child driver falls into runtime suspend state:
- e.g. after 2s, + child calls pm_runtime_put_autosuspend() + 100ms autosuspend delay of the child.
- stm32-adc-core switches off regulators, clocks and so on.
- They get switched on back again 100ms later in this example (at 2.2s).
So, use runtime_idle() callback in stm32-adc-core driver to call pm_runtime_mark_last_busy() for the parent driver (stm32-adc-core), to avoid this.
--- drivers/iio/adc/stm32-adc-core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/iio/adc/stm32-adc-core.c +8 -1
@@ -794,6 +794,13 @@ static int stm32_adc_core_runtime_resume(struct device *dev) {return stm32_adc_core_hw_start (dev); } + +static int stm32_adc_core_runtime_idle (struct device *dev) +{ +pm_runtime_mark_last_busy (dev); + +return 0 ; +}#endif static const struct dev_pm_ops stm32_adc_core_pm_ops = {
@@ -801,7 +808,7 @@ static const struct dev_pm_ops stm32_adc_core_pm_ops = { pm_runtime_force_resume) SET_RUNTIME_PM_OPS(stm32_adc_core_runtime_suspend, stm32_adc_core_runtime_resume, - NULL) + stm32_adc_core_runtime_idle) }; static const struct stm32_adc_priv_cfg stm32f4_adc_priv_cfg = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 349/757 net: enic: Cure the enic api locking trainwreck
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit a53b59ece86c86d16d12ccdaa1ad0c78250a9d96 ]
enic_dev_wait() has a BUG_ON(in_interrupt()).
Chasing the callers of enic_dev_wait() revealed the gems of enic_reset() and enic_tx_hang_reset() which are both invoked through work queues in order to be able to call rtnl_lock(). So far so good.
After locking rtnl both functions acquire enic::enic_api_lock which serializes against the (ab)use from infiniband. This is where the trainwreck starts.
enic::enic_api_lock is a spin_lock() which implicitly disables preemption, but both functions invoke a ton of functions under that lock which can sleep. The BUG_ON(in_interrupt()) does not trigger in that case because it can't detect the preempt disabled condition.
This clearly has never been tested with any of the mandatory debug options for 7+ years, which would have caught that for sure.
Cure it by adding a enic_api_busy member to struct enic, which is modified and evaluated with enic::enic_api_lock held.
If enic_api_devcmd_proxy_by_index() observes enic::enic_api_busy as true, it drops enic::enic_api_lock and busy waits for enic::enic_api_busy to become false.
It would be smarter to wait for a completion of that busy period, but enic_api_devcmd_proxy_by_index() is called with other spin locks held which obviously can't sleep.
Remove the BUG_ON(in_interrupt()) check as well because it's incomplete and with proper debugging enabled the problem would have been caught from the debug checks in schedule_timeout().
--- drivers/net/ethernet/cisco/enic/enic.h | 1 + drivers/net/ethernet/cisco/enic/enic_api.c | 6 +++++ drivers/net/ethernet/cisco/enic/enic_main.c | 27 ++++++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -0
@@ -169,6 +169,7 @@ struct enic {u16 num_vfs;#endif spinlock_t enic_api_lock; +bool enic_api_busy;struct enic_port_profile *pp;/* work queue cache line section */
drivers/net/ethernet/cisco/enic/enic_api.c +6 -0
@@ -34,6 +34,12 @@ int enic_api_devcmd_proxy_by_index(struct net_device *netdev, int vf,struct vnic_dev *vdev = enic->vdev;spin_lock (&enic->enic_api_lock); +while (enic->enic_api_busy) { +spin_unlock (&enic->enic_api_lock); +cpu_relax (); +spin_lock (&enic->enic_api_lock); + } +spin_lock_bh (&enic->devcmd_lock);vnic_dev_cmd_proxy_by_index_start (vdev, vf);
drivers/net/ethernet/cisco/enic/enic_main.c +21 -6
@@ -2106,8 +2106,6 @@ static int enic_dev_wait(struct vnic_dev *vdev,int done;int err; -BUG_ON (in_interrupt ()); - err =start (vdev, arg);if (err)return err;
@@ -2295,6 +2293,13 @@ static int enic_set_rss_nic_cfg(struct enic *enic) rss_hash_bits, rss_base_cpu, rss_enable); } +static void enic_set_api_busy (struct enic *enic,bool busy) +{ +spin_lock (&enic->enic_api_lock); + enic->enic_api_busy = busy; +spin_unlock (&enic->enic_api_lock); +} +static void enic_reset (struct work_struct *work) { struct enic *enic = container_of(work, struct enic, reset);
@@ -2304,7 +2309,9 @@ static void enic_reset(struct work_struct *work)rtnl_lock (); -spin_lock (&enic->enic_api_lock); +/* Stop any activity from infiniband */ +enic_set_api_busy (enic, true); +enic_stop (enic->netdev);enic_dev_soft_reset (enic);enic_reset_addr_lists (enic);
@@ -2312,7 +2319,10 @@ static void enic_reset(struct work_struct *work)enic_set_rss_nic_cfg (enic);enic_dev_set_ig_vlan_rewrite_mode (enic);enic_open (enic->netdev); -spin_unlock (&enic->enic_api_lock); + +/* Allow infiniband to fiddle with the device again */ +enic_set_api_busy (enic, false); +call_netdevice_notifiers (NETDEV_REBOOT , enic->netdev);rtnl_unlock ();
@@ -2324,7 +2334,9 @@ static void enic_tx_hang_reset(struct work_struct *work)rtnl_lock (); -spin_lock (&enic->enic_api_lock); +/* Stop any activity from infiniband */ +enic_set_api_busy (enic, true); +enic_dev_hang_notify (enic);enic_stop (enic->netdev);enic_dev_hang_reset (enic);
@@ -2333,7 +2345,10 @@ static void enic_tx_hang_reset(struct work_struct *work)enic_set_rss_nic_cfg (enic);enic_dev_set_ig_vlan_rewrite_mode (enic);enic_open (enic->netdev); -spin_unlock (&enic->enic_api_lock); + +/* Allow infiniband to fiddle with the device again */ +enic_set_api_busy (enic, false); +call_netdevice_notifiers (NETDEV_REBOOT , enic->netdev);rtnl_unlock ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 350/757 selftests/bpf: Fix endianness issues in sk_lookup/ctx_narrow_access
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 6458bde368cee77e798d05cccd2316db4d748c41 ]
This test makes a lot of narrow load checks while assuming little endian architecture, and therefore fails on s390.
Fix by introducing LSB and LSW macros and using them to perform narrow loads.
--- .../selftests/bpf/progs/test_sk_lookup.c | 216 ++++++++---------- 1 file changed, 101 insertions(+), 115 deletions(-)
tools/testing/selftests/bpf/progs/test_sk_lookup.c +101 -115
@@ -19,6 +19,17 @@#define IP6 (aaaa, bbbb, cccc, dddd) \ { bpf_htonl(aaaa), bpf_htonl(bbbb), bpf_htonl(cccc), bpf_htonl(dddd) } +/* Macros for least-significant byte and word accesses. */ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define LSE_INDEX (index, size) (index) +#else +#define LSE_INDEX (index, size) ((size) - (index) - 1) +#endif +#define LSB (value, index) \ + (((__u8 *)&(value))[LSE_INDEX((index), sizeof(value))]) +#define LSW (value, index) \ + (((__u16 *)&(value))[LSE_INDEX((index), sizeof(value) / 2)]) +#define MAX_SOCKS 32struct {
@@ -369,171 +380,146 @@ int ctx_narrow_access(struct bpf_sk_lookup *ctx) {struct bpf_sock *sk;int err, family; -__u16 *half; -__u8 *byte;bool v4; v4 = (ctx->family ==AF_INET );/* Narrow loads from family field */ - byte = (__u8 *)&ctx->family; - half = (__u16 *)&ctx->family; -if (byte[0 ] != (v4 ?AF_INET :AF_INET6 ) || - byte[1 ] !=0 || byte[2 ] !=0 || byte[3 ] !=0 ) +if (LSB (ctx->family,0 ) != (v4 ?AF_INET :AF_INET6 ) || +LSB (ctx->family,1 ) !=0 ||LSB (ctx->family,2 ) !=0 ||LSB (ctx->family,3 ) !=0 )return SK_DROP ; -if (half[0 ] != (v4 ?AF_INET :AF_INET6 )) +if (LSW (ctx->family,0 ) != (v4 ?AF_INET :AF_INET6 ))return SK_DROP ; - byte = (__u8 *)&ctx->protocol; -if (byte[0 ] !=IPPROTO_TCP || - byte[1 ] !=0 || byte[2 ] !=0 || byte[3 ] !=0 ) +/* Narrow loads from protocol field */ +if (LSB (ctx->protocol,0 ) !=IPPROTO_TCP || +LSB (ctx->protocol,1 ) !=0 ||LSB (ctx->protocol,2 ) !=0 ||LSB (ctx->protocol,3 ) !=0 )return SK_DROP ; - half = (__u16 *)&ctx->protocol; -if (half[0 ] !=IPPROTO_TCP ) +if (LSW (ctx->protocol,0 ) !=IPPROTO_TCP )return SK_DROP ;/* Narrow loads from remote_port field. Expect non-0 value. */ - byte = (__u8 *)&ctx->remote_port; -if (byte[0 ] ==0 && byte[1 ] ==0 && byte[2 ] ==0 && byte[3 ] ==0 ) +if (LSB (ctx->remote_port,0 ) ==0 &&LSB (ctx->remote_port,1 ) ==0 && +LSB (ctx->remote_port,2 ) ==0 &&LSB (ctx->remote_port,3 ) ==0 )return SK_DROP ; - half = (__u16 *)&ctx->remote_port; -if (half[0 ] ==0 ) +if (LSW (ctx->remote_port,0 ) ==0 )return SK_DROP ;/* Narrow loads from local_port field. Expect DST_PORT. */ - byte = (__u8 *)&ctx->local_port; -if (byte[0 ] != ((DST_PORT >>0 ) &0xff ) || - byte[1 ] != ((DST_PORT >>8 ) &0xff ) || - byte[2 ] !=0 || byte[3 ] !=0 ) +if (LSB (ctx->local_port,0 ) != ((DST_PORT >>0 ) &0xff ) || +LSB (ctx->local_port,1 ) != ((DST_PORT >>8 ) &0xff ) || +LSB (ctx->local_port,2 ) !=0 ||LSB (ctx->local_port,3 ) !=0 )return SK_DROP ; - half = (__u16 *)&ctx->local_port; -if (half[0 ] !=DST_PORT ) +if (LSW (ctx->local_port,0 ) !=DST_PORT )return SK_DROP ;/* Narrow loads from IPv4 fields */ if (v4) {/* Expect non-0.0.0.0 in remote_ip4 */ - byte = (__u8 *)&ctx->remote_ip4; -if (byte[0 ] ==0 && byte[1 ] ==0 && - byte[2 ] ==0 && byte[3 ] ==0 ) +if (LSB (ctx->remote_ip4,0 ) ==0 &&LSB (ctx->remote_ip4,1 ) ==0 && +LSB (ctx->remote_ip4,2 ) ==0 &&LSB (ctx->remote_ip4,3 ) ==0 )return SK_DROP ; - half = (__u16 *)&ctx->remote_ip4; -if (half[0 ] ==0 && half[1 ] ==0 ) +if (LSW (ctx->remote_ip4,0 ) ==0 &&LSW (ctx->remote_ip4,1 ) ==0 )return SK_DROP ;/* Expect DST_IP4 in local_ip4 */ - byte = (__u8 *)&ctx->local_ip4; -if (byte[0 ] != ((DST_IP4 >>0 ) &0xff ) || - byte[1 ] != ((DST_IP4 >>8 ) &0xff ) || - byte[2 ] != ((DST_IP4 >>16 ) &0xff ) || - byte[3 ] != ((DST_IP4 >>24 ) &0xff )) +if (LSB (ctx->local_ip4,0 ) != ((DST_IP4 >>0 ) &0xff ) || +LSB (ctx->local_ip4,1 ) != ((DST_IP4 >>8 ) &0xff ) || +LSB (ctx->local_ip4,2 ) != ((DST_IP4 >>16 ) &0xff ) || +LSB (ctx->local_ip4,3 ) != ((DST_IP4 >>24 ) &0xff ))return SK_DROP ; - half = (__u16 *)&ctx->local_ip4; -if (half[0 ] != ((DST_IP4 >>0 ) &0xffff ) || - half[1 ] != ((DST_IP4 >>16 ) &0xffff )) +if (LSW (ctx->local_ip4,0 ) != ((DST_IP4 >>0 ) &0xffff ) || +LSW (ctx->local_ip4,1 ) != ((DST_IP4 >>16 ) &0xffff ))return SK_DROP ; }else {/* Expect 0.0.0.0 IPs when family != AF_INET */ - byte = (__u8 *)&ctx->remote_ip4; -if (byte[0 ] !=0 || byte[1 ] !=0 && - byte[2 ] !=0 || byte[3 ] !=0 ) +if (LSB (ctx->remote_ip4,0 ) !=0 ||LSB (ctx->remote_ip4,1 ) !=0 || +LSB (ctx->remote_ip4,2 ) !=0 ||LSB (ctx->remote_ip4,3 ) !=0 )return SK_DROP ; - half = (__u16 *)&ctx->remote_ip4; -if (half[0 ] !=0 || half[1 ] !=0 ) +if (LSW (ctx->remote_ip4,0 ) !=0 ||LSW (ctx->remote_ip4,1 ) !=0 )return SK_DROP ; - byte = (__u8 *)&ctx->local_ip4; -if (byte[0 ] !=0 || byte[1 ] !=0 && - byte[2 ] !=0 || byte[3 ] !=0 ) +if (LSB (ctx->local_ip4,0 ) !=0 ||LSB (ctx->local_ip4,1 ) !=0 || +LSB (ctx->local_ip4,2 ) !=0 ||LSB (ctx->local_ip4,3 ) !=0 )return SK_DROP ; - half = (__u16 *)&ctx->local_ip4; -if (half[0 ] !=0 || half[1 ] !=0 ) +if (LSW (ctx->local_ip4,0 ) !=0 ||LSW (ctx->local_ip4,1 ) !=0 )return SK_DROP ; }/* Narrow loads from IPv6 fields */ if (!v4) { -/* Expenct non-:: IP in remote_ip6 */ - byte = (__u8 *)&ctx->remote_ip6; -if (byte[0 ] ==0 && byte[1 ] ==0 && - byte[2 ] ==0 && byte[3 ] ==0 && - byte[4 ] ==0 && byte[5 ] ==0 && - byte[6 ] ==0 && byte[7 ] ==0 && - byte[8 ] ==0 && byte[9 ] ==0 && - byte[10 ] ==0 && byte[11 ] ==0 && - byte[12 ] ==0 && byte[13 ] ==0 && - byte[14 ] ==0 && byte[15 ] ==0 ) +/* Expect non-:: IP in remote_ip6 */ +if (LSB (ctx->remote_ip6[0 ],0 ) ==0 &&LSB (ctx->remote_ip6[0 ],1 ) ==0 && +LSB (ctx->remote_ip6[0 ],2 ) ==0 &&LSB (ctx->remote_ip6[0 ],3 ) ==0 && +LSB (ctx->remote_ip6[1 ],0 ) ==0 &&LSB (ctx->remote_ip6[1 ],1 ) ==0 && +LSB (ctx->remote_ip6[1 ],2 ) ==0 &&LSB (ctx->remote_ip6[1 ],3 ) ==0 && +LSB (ctx->remote_ip6[2 ],0 ) ==0 &&LSB (ctx->remote_ip6[2 ],1 ) ==0 && +LSB (ctx->remote_ip6[2 ],2 ) ==0 &&LSB (ctx->remote_ip6[2 ],3 ) ==0 && +LSB (ctx->remote_ip6[3 ],0 ) ==0 &&LSB (ctx->remote_ip6[3 ],1 ) ==0 && +LSB (ctx->remote_ip6[3 ],2 ) ==0 &&LSB (ctx->remote_ip6[3 ],3 ) ==0 )return SK_DROP ; - half = (__u16 *)&ctx->remote_ip6; -if (half[0 ] ==0 && half[1 ] ==0 && - half[2 ] ==0 && half[3 ] ==0 && - half[4 ] ==0 && half[5 ] ==0 && - half[6 ] ==0 && half[7 ] ==0 ) +if (LSW (ctx->remote_ip6[0 ],0 ) ==0 &&LSW (ctx->remote_ip6[0 ],1 ) ==0 && +LSW (ctx->remote_ip6[1 ],0 ) ==0 &&LSW (ctx->remote_ip6[1 ],1 ) ==0 && +LSW (ctx->remote_ip6[2 ],0 ) ==0 &&LSW (ctx->remote_ip6[2 ],1 ) ==0 && +LSW (ctx->remote_ip6[3 ],0 ) ==0 &&LSW (ctx->remote_ip6[3 ],1 ) ==0 )return SK_DROP ; -/* Expect DST_IP6 in local_ip6 */ - byte = (__u8 *)&ctx->local_ip6; -if (byte[0 ] != ((DST_IP6 [0 ] >>0 ) &0xff ) || - byte[1 ] != ((DST_IP6 [0 ] >>8 ) &0xff ) || - byte[2 ] != ((DST_IP6 [0 ] >>16 ) &0xff ) || - byte[3 ] != ((DST_IP6 [0 ] >>24 ) &0xff ) || - byte[4 ] != ((DST_IP6 [1 ] >>0 ) &0xff ) || - byte[5 ] != ((DST_IP6 [1 ] >>8 ) &0xff ) || - byte[6 ] != ((DST_IP6 [1 ] >>16 ) &0xff ) || - byte[7 ] != ((DST_IP6 [1 ] >>24 ) &0xff ) || - byte[8 ] != ((DST_IP6 [2 ] >>0 ) &0xff ) || - byte[9 ] != ((DST_IP6 [2 ] >>8 ) &0xff ) || - byte[10 ] != ((DST_IP6 [2 ] >>16 ) &0xff ) || - byte[11 ] != ((DST_IP6 [2 ] >>24 ) &0xff ) || - byte[12 ] != ((DST_IP6 [3 ] >>0 ) &0xff ) || - byte[13 ] != ((DST_IP6 [3 ] >>8 ) &0xff ) || - byte[14 ] != ((DST_IP6 [3 ] >>16 ) &0xff ) || - byte[15 ] != ((DST_IP6 [3 ] >>24 ) &0xff )) +if (LSB (ctx->local_ip6[0 ],0 ) != ((DST_IP6 [0 ] >>0 ) &0xff ) || +LSB (ctx->local_ip6[0 ],1 ) != ((DST_IP6 [0 ] >>8 ) &0xff ) || +LSB (ctx->local_ip6[0 ],2 ) != ((DST_IP6 [0 ] >>16 ) &0xff ) || +LSB (ctx->local_ip6[0 ],3 ) != ((DST_IP6 [0 ] >>24 ) &0xff ) || +LSB (ctx->local_ip6[1 ],0 ) != ((DST_IP6 [1 ] >>0 ) &0xff ) || +LSB (ctx->local_ip6[1 ],1 ) != ((DST_IP6 [1 ] >>8 ) &0xff ) || +LSB (ctx->local_ip6[1 ],2 ) != ((DST_IP6 [1 ] >>16 ) &0xff ) || +LSB (ctx->local_ip6[1 ],3 ) != ((DST_IP6 [1 ] >>24 ) &0xff ) || +LSB (ctx->local_ip6[2 ],0 ) != ((DST_IP6 [2 ] >>0 ) &0xff ) || +LSB (ctx->local_ip6[2 ],1 ) != ((DST_IP6 [2 ] >>8 ) &0xff ) || +LSB (ctx->local_ip6[2 ],2 ) != ((DST_IP6 [2 ] >>16 ) &0xff ) || +LSB (ctx->local_ip6[2 ],3 ) != ((DST_IP6 [2 ] >>24 ) &0xff ) || +LSB (ctx->local_ip6[3 ],0 ) != ((DST_IP6 [3 ] >>0 ) &0xff ) || +LSB (ctx->local_ip6[3 ],1 ) != ((DST_IP6 [3 ] >>8 ) &0xff ) || +LSB (ctx->local_ip6[3 ],2 ) != ((DST_IP6 [3 ] >>16 ) &0xff ) || +LSB (ctx->local_ip6[3 ],3 ) != ((DST_IP6 [3 ] >>24 ) &0xff ))return SK_DROP ; - half = (__u16 *)&ctx->local_ip6; -if (half[0 ] != ((DST_IP6 [0 ] >>0 ) &0xffff ) || - half[1 ] != ((DST_IP6 [0 ] >>16 ) &0xffff ) || - half[2 ] != ((DST_IP6 [1 ] >>0 ) &0xffff ) || - half[3 ] != ((DST_IP6 [1 ] >>16 ) &0xffff ) || - half[4 ] != ((DST_IP6 [2 ] >>0 ) &0xffff ) || - half[5 ] != ((DST_IP6 [2 ] >>16 ) &0xffff ) || - half[6 ] != ((DST_IP6 [3 ] >>0 ) &0xffff ) || - half[7 ] != ((DST_IP6 [3 ] >>16 ) &0xffff )) +if (LSW (ctx->local_ip6[0 ],0 ) != ((DST_IP6 [0 ] >>0 ) &0xffff ) || +LSW (ctx->local_ip6[0 ],1 ) != ((DST_IP6 [0 ] >>16 ) &0xffff ) || +LSW (ctx->local_ip6[1 ],0 ) != ((DST_IP6 [1 ] >>0 ) &0xffff ) || +LSW (ctx->local_ip6[1 ],1 ) != ((DST_IP6 [1 ] >>16 ) &0xffff ) || +LSW (ctx->local_ip6[2 ],0 ) != ((DST_IP6 [2 ] >>0 ) &0xffff ) || +LSW (ctx->local_ip6[2 ],1 ) != ((DST_IP6 [2 ] >>16 ) &0xffff ) || +LSW (ctx->local_ip6[3 ],0 ) != ((DST_IP6 [3 ] >>0 ) &0xffff ) || +LSW (ctx->local_ip6[3 ],1 ) != ((DST_IP6 [3 ] >>16 ) &0xffff ))return SK_DROP ; }else {/* Expect :: IPs when family != AF_INET6 */ - byte = (__u8 *)&ctx->remote_ip6; -if (byte[0 ] !=0 || byte[1 ] !=0 || - byte[2 ] !=0 || byte[3 ] !=0 || - byte[4 ] !=0 || byte[5 ] !=0 || - byte[6 ] !=0 || byte[7 ] !=0 || - byte[8 ] !=0 || byte[9 ] !=0 || - byte[10 ] !=0 || byte[11 ] !=0 || - byte[12 ] !=0 || byte[13 ] !=0 || - byte[14 ] !=0 || byte[15 ] !=0 ) +if (LSB (ctx->remote_ip6[0 ],0 ) !=0 ||LSB (ctx->remote_ip6[0 ],1 ) !=0 || +LSB (ctx->remote_ip6[0 ],2 ) !=0 ||LSB (ctx->remote_ip6[0 ],3 ) !=0 || +LSB (ctx->remote_ip6[1 ],0 ) !=0 ||LSB (ctx->remote_ip6[1 ],1 ) !=0 || +LSB (ctx->remote_ip6[1 ],2 ) !=0 ||LSB (ctx->remote_ip6[1 ],3 ) !=0 || +LSB (ctx->remote_ip6[2 ],0 ) !=0 ||LSB (ctx->remote_ip6[2 ],1 ) !=0 || +LSB (ctx->remote_ip6[2 ],2 ) !=0 ||LSB (ctx->remote_ip6[2 ],3 ) !=0 || +LSB (ctx->remote_ip6[3 ],0 ) !=0 ||LSB (ctx->remote_ip6[3 ],1 ) !=0 || +LSB (ctx->remote_ip6[3 ],2 ) !=0 ||LSB (ctx->remote_ip6[3 ],3 ) !=0 )return SK_DROP ; - half = (__u16 *)&ctx->remote_ip6; -if (half[0 ] !=0 || half[1 ] !=0 || - half[2 ] !=0 || half[3 ] !=0 || - half[4 ] !=0 || half[5 ] !=0 || - half[6 ] !=0 || half[7 ] !=0 ) +if (LSW (ctx->remote_ip6[0 ],0 ) !=0 ||LSW (ctx->remote_ip6[0 ],1 ) !=0 || +LSW (ctx->remote_ip6[1 ],0 ) !=0 ||LSW (ctx->remote_ip6[1 ],1 ) !=0 || +LSW (ctx->remote_ip6[2 ],0 ) !=0 ||LSW (ctx->remote_ip6[2 ],1 ) !=0 || +LSW (ctx->remote_ip6[3 ],0 ) !=0 ||LSW (ctx->remote_ip6[3 ],1 ) !=0 )return SK_DROP ; - byte = (__u8 *)&ctx->local_ip6; -if (byte[0 ] !=0 || byte[1 ] !=0 || - byte[2 ] !=0 || byte[3 ] !=0 || - byte[4 ] !=0 || byte[5 ] !=0 || - byte[6 ] !=0 || byte[7 ] !=0 || - byte[8 ] !=0 || byte[9 ] !=0 || - byte[10 ] !=0 || byte[11 ] !=0 || - byte[12 ] !=0 || byte[13 ] !=0 || - byte[14 ] !=0 || byte[15 ] !=0 ) +if (LSB (ctx->local_ip6[0 ],0 ) !=0 ||LSB (ctx->local_ip6[0 ],1 ) !=0 || +LSB (ctx->local_ip6[0 ],2 ) !=0 ||LSB (ctx->local_ip6[0 ],3 ) !=0 || +LSB (ctx->local_ip6[1 ],0 ) !=0 ||LSB (ctx->local_ip6[1 ],1 ) !=0 || +LSB (ctx->local_ip6[1 ],2 ) !=0 ||LSB (ctx->local_ip6[1 ],3 ) !=0 || +LSB (ctx->local_ip6[2 ],0 ) !=0 ||LSB (ctx->local_ip6[2 ],1 ) !=0 || +LSB (ctx->local_ip6[2 ],2 ) !=0 ||LSB (ctx->local_ip6[2 ],3 ) !=0 || +LSB (ctx->local_ip6[3 ],0 ) !=0 ||LSB (ctx->local_ip6[3 ],1 ) !=0 || +LSB (ctx->local_ip6[3 ],2 ) !=0 ||LSB (ctx->local_ip6[3 ],3 ) !=0 )return SK_DROP ; - half = (__u16 *)&ctx->local_ip6; -if (half[0 ] !=0 || half[1 ] !=0 || - half[2 ] !=0 || half[3 ] !=0 || - half[4 ] !=0 || half[5 ] !=0 || - half[6 ] !=0 || half[7 ] !=0 ) +if (LSW (ctx->remote_ip6[0 ],0 ) !=0 ||LSW (ctx->remote_ip6[0 ],1 ) !=0 || +LSW (ctx->remote_ip6[1 ],0 ) !=0 ||LSW (ctx->remote_ip6[1 ],1 ) !=0 || +LSW (ctx->remote_ip6[2 ],0 ) !=0 ||LSW (ctx->remote_ip6[2 ],1 ) !=0 || +LSW (ctx->remote_ip6[3 ],0 ) !=0 ||LSW (ctx->remote_ip6[3 ],1 ) !=0 )return SK_DROP ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 351/757 pinctrl: tigerlake: Fix register offsets for TGL-H variant
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit cb8cc18508fb0cad74929ffd080bebafe91609e2 ]
It appears that almost traditionally the H variants have some deviations in the register offsets in comparison to LP ones. This is the case for Intel Tiger Lake as well. Fix register offsets for TGL-H variant.
--- drivers/pinctrl/intel/pinctrl-tigerlake.c | 42 ++++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-)
drivers/pinctrl/intel/pinctrl-tigerlake.c +25 -17
@@ -15,11 +15,13 @@#include "pinctrl-intel.h" -#define TGL_PAD_OWN 0x020 -#define TGL_PADCFGLOCK 0x080 -#define TGL_HOSTSW_OWN 0x0b0 -#define TGL_GPI_IS 0x100 -#define TGL_GPI_IE 0x120 +#define TGL_PAD_OWN 0x020 +#define TGL_LP_PADCFGLOCK 0x080 +#define TGL_H_PADCFGLOCK 0x090 +#define TGL_LP_HOSTSW_OWN 0x0b0 +#define TGL_H_HOSTSW_OWN 0x0c0 +#define TGL_GPI_IS 0x100 +#define TGL_GPI_IE 0x120#define TGL_GPP (r, s, e, g) \ { \
@@ -29,12 +31,12 @@ .gpio_base = (g), \ } -#define TGL_COMMUNITY (b, s, e, g) \ +#define TGL_COMMUNITY (b, s, e, pl, ho, g) \ { \ .barno = (b), \ .padown_offset = TGL_PAD_OWN, \ - .padcfglock_offset = TGL_PADCFGLOCK, \ - .hostown_offset = TGL_HOSTSW_OWN, \ + .padcfglock_offset = (pl), \ + .hostown_offset = (ho), \ .is_offset = TGL_GPI_IS, \ .ie_offset = TGL_GPI_IE, \ .pin_base = (s), \
@@ -43,6 +45,12 @@ .ngpps = ARRAY_SIZE(g), \ } +#define TGL_LP_COMMUNITY (b, s, e, g) \ + TGL_COMMUNITY(b, s, e, TGL_LP_PADCFGLOCK, TGL_LP_HOSTSW_OWN, g) + +#define TGL_H_COMMUNITY (b, s, e, g) \ + TGL_COMMUNITY(b, s, e, TGL_H_PADCFGLOCK, TGL_H_HOSTSW_OWN, g) +/* Tiger Lake-LP */ static const struct pinctrl_pin_desc tgllp_pins[] = {/* GPP_B */
@@ -367,10 +375,10 @@ static const struct intel_padgroup tgllp_community5_gpps[] = { };static const struct intel_community tgllp_communities[] = { -TGL_COMMUNITY (0 ,0 ,66 , tgllp_community0_gpps), -TGL_COMMUNITY (1 ,67 ,170 , tgllp_community1_gpps), -TGL_COMMUNITY (2 ,171 ,259 , tgllp_community4_gpps), -TGL_COMMUNITY (3 ,260 ,276 , tgllp_community5_gpps), +TGL_LP_COMMUNITY (0 ,0 ,66 , tgllp_community0_gpps), +TGL_LP_COMMUNITY (1 ,67 ,170 , tgllp_community1_gpps), +TGL_LP_COMMUNITY (2 ,171 ,259 , tgllp_community4_gpps), +TGL_LP_COMMUNITY (3 ,260 ,276 , tgllp_community5_gpps), };static const struct intel_pinctrl_soc_data tgllp_soc_data = {
@@ -723,11 +731,11 @@ static const struct intel_padgroup tglh_community5_gpps[] = { };static const struct intel_community tglh_communities[] = { -TGL_COMMUNITY (0 ,0 ,78 , tglh_community0_gpps), -TGL_COMMUNITY (1 ,79 ,180 , tglh_community1_gpps), -TGL_COMMUNITY (2 ,181 ,217 , tglh_community3_gpps), -TGL_COMMUNITY (3 ,218 ,266 , tglh_community4_gpps), -TGL_COMMUNITY (4 ,267 ,290 , tglh_community5_gpps), +TGL_H_COMMUNITY (0 ,0 ,78 , tglh_community0_gpps), +TGL_H_COMMUNITY (1 ,79 ,180 , tglh_community1_gpps), +TGL_H_COMMUNITY (2 ,181 ,217 , tglh_community3_gpps), +TGL_H_COMMUNITY (3 ,218 ,266 , tglh_community4_gpps), +TGL_H_COMMUNITY (4 ,267 ,290 , tglh_community5_gpps), };static const struct intel_pinctrl_soc_data tglh_soc_data = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 352/757 serial: 8250: Discard RTS/DTS setting from clock update method
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 7718453e36960dadb8dc46f2b514b309659e1270 ]
It has been a mistake to add the MCR register RTS/DTS fields setting in the generic method of the UART reference clock update. There is no point in asserting these lines at that procedure. Just discard the serial8250_out_MCR() mathod invocation from there then.
--- drivers/tty/serial/8250/8250_port.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +0 -1
@@ -2665,7 +2665,6 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk)serial8250_set_divisor (port, baud, quot, frac);serial_port_out (port,UART_LCR , up->lcr); -serial8250_out_MCR (up,UART_MCR_DTR |UART_MCR_RTS );spin_unlock_irqrestore (&port->lock, flags);serial8250_rpm_put (up);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 353/757 serial: 8250: Skip uninitialized TTY port baud rate update
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit c8dff3aa824177013d90967687f09f713a55d13f ]
It is erroneous to update the TTY port baud rate if it hasn't been initialized yet, because in that case the TTY struct isn't set. So there is no termios structure to get and re-calculate the baud if the current baud can't be reached. Let's skip the baud rate update then until the port is fully initialized.
Note the update UART clock method still sets the uartclk member with a new ref clock value even if the port is turned off. The new UART ref clock rate will be used later on the port starting up procedure.
--- drivers/tty/serial/8250/8250_port.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_port.c +4 -0
@@ -2653,6 +2653,10 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk) goto out_lock; port->uartclk = uartclk; + +if (!tty_port_initialized (&port->state->port)) + goto out_lock; + termios = &port->state->port.tty->termios; baud =serial8250_get_baud_rate (port, termios,NULL );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 354/757 serial: 8250_dw: Fix clk-notifier/port suspend deadlock
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 85985a3dcd7415dd849cf62ec14f931cd905099a ]
It has been discovered that there is a potential deadlock between the clock-change-notifier thread and the UART port suspending one:
CPU0 (suspend CPU/UART) CPU1 (update clock)
---- ----
lock(&port->mutex);
lock((work_completion)(&data->clk_work));
lock(&port->mutex);
lock((work_completion)(&data->clk_work));*** DEADLOCK ***
The best way to fix this is to eliminate the CPU0 port->mutex/work-completion scenario. So we suggest to register and unregister the clock-notifier during the DW APB UART port probe/remove procedures, instead of doing that at the points of the port startup/shutdown.
--- drivers/tty/serial/8250/8250_dw.c | 54 +++++++++++-------------------- 1 file changed, 19 insertions(+), 35 deletions(-)
drivers/tty/serial/8250/8250_dw.c +19 -35
@@ -373,39 +373,6 @@ static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios)serial8250_do_set_ldisc (p, termios); } -static int dw8250_startup (struct uart_port *p) -{ -struct dw8250_data *d =to_dw8250_data (p->private_data); -int ret; - -/* -* Some platforms may provide a reference clock shared between several -* devices. In this case before using the serial port first we have to -* make sure that any clock state change is known to the UART port at -* least post factum. -*/ -if (d->clk) { - ret =clk_notifier_register (d->clk, &d->clk_notifier); -if (ret) -dev_warn (p->dev,"Failed to set the clock notifier\n" ); - } - -return serial8250_do_startup (p); -} - -static void dw8250_shutdown (struct uart_port *p) -{ -struct dw8250_data *d =to_dw8250_data (p->private_data); - -serial8250_do_shutdown (p); - -if (d->clk) { -clk_notifier_unregister (d->clk, &d->clk_notifier); - -flush_work (&d->clk_work); - } -} -/* * dw8250_fallback_dma_filter will prevent the UART from getting just any free * channel on platforms that have DMA engines, but don't have any channels
@@ -501,8 +468,6 @@ static int dw8250_probe(struct platform_device *pdev) p->serial_out = dw8250_serial_out; p->set_ldisc = dw8250_set_ldisc; p->set_termios = dw8250_set_termios; - p->startup = dw8250_startup; - p->shutdown = dw8250_shutdown; p->membase =devm_ioremap (dev, regs->start,resource_size (regs));if (!p->membase)
@@ -622,6 +587,19 @@ static int dw8250_probe(struct platform_device *pdev) goto err_reset; } +/* +* Some platforms may provide a reference clock shared between several +* devices. In this case any clock state change must be known to the +* UART port at least post factum. +*/ +if (data->clk) { + err =clk_notifier_register (data->clk, &data->clk_notifier); +if (err) +dev_warn (p->dev,"Failed to set the clock notifier\n" ); +else +queue_work (system_unbound_wq, &data->clk_work); + } +platform_set_drvdata (pdev, data);pm_runtime_set_active (dev);
@@ -648,6 +626,12 @@ static int dw8250_remove(struct platform_device *pdev)pm_runtime_get_sync (dev); +if (data->clk) { +clk_notifier_unregister (data->clk, &data->clk_notifier); + +flush_work (&data->clk_work); + } +serial8250_unregister_port (data->data.line);reset_control_assert (data->rst);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 355/757 mfd: syscon: Dont free allocated name for regmap_config
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 529a1101212a785c5df92c314b0e718287150c3b ]
The name allocated for the regmap_config structure is freed pretty early, right after the registration of the MMIO region.
Unfortunately, that doesn't follow the life cycle that debugfs expects, as it can access the name field long after the free has occurred.
Move the free on the error path, and keep it forever otherwise.
--- drivers/mfd/syscon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/syscon.c +1 -1
@@ -108,7 +108,6 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk) syscon_config.max_register =resource_size (&res) - reg_io_width; regmap =regmap_init_mmio (NULL , base, &syscon_config); -kfree (syscon_config.name);if (IS_ERR (regmap)) {pr_err ("regmap init failed\n" ); ret =PTR_ERR (regmap);
@@ -145,6 +144,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)regmap_exit (regmap); err_regmap:iounmap (base); +kfree (syscon_config.name); err_map:kfree (syscon);return ERR_PTR (ret);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 356/757 mfd: sm501: Fix leaks in probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8ce24f8967df2836b4557a23e74dc4bb098249f1 ]
This code should clean up if sm501_init_dev() fails.
--- drivers/mfd/sm501.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mfd/sm501.c +7 -1
@@ -1415,8 +1415,14 @@ static int sm501_plat_probe(struct platform_device *dev) goto err_claim; } -return sm501_init_dev (sm); + ret =sm501_init_dev (sm); +if (ret) + goto err_unmap; + +return 0 ; + err_unmap: +iounmap (sm->regs); err_claim:release_mem_region (sm->io_res->start,0x100 ); err_res:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 357/757 dm: fix missing imposition of queue_limits from dm_wq_work() thread
In reply to Greg Kroah-HartmanFrom: Mike Snitzer <[email protected]>
[ Upstream commit 0c2915b8c6db108b1dfb240391cc5a175f97f15b ]
If a DM device was suspended when bios were issued to it, those bios would be deferred using queue_io(). Once the DM device was resumed dm_process_bio() could be called by dm_wq_work() for original bio that still needs splitting. dm_process_bio()'s check for current->bio_list (meaning call chain is within ->submit_bio) as a prerequisite for calling blk_queue_split() for "abnormal IO" would result in dm_process_bio() never imposing corresponding queue_limits (e.g. discard_granularity, discard_max_bytes, etc).
Fix this by always having dm_wq_work() resubmit deferred bios using submit_bio_noacct().
Side-effect is blk_queue_split() is always called for "abnormal IO" from ->submit_bio, be it from application thread or dm_wq_work() workqueue, so proper bio splitting and depth-first bio submission is performed. For sake of clarity, remove current->bio_list check before call to blk_queue_split().
Also, remove dm_wq_work()'s use of dm_{get,put}_live_table() -- no longer needed since IO will be reissued in terms of ->submit_bio. And rename bio variable from 'c' to 'bio'.
--- drivers/md/dm.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-)
drivers/md/dm.c +9 -25
@@ -1744,17 +1744,11 @@ static blk_qc_t dm_process_bio(struct mapped_device *md, }/* -* If in ->submit_bio we need to use blk_queue_split(), otherwise -* queue_limits for abnormal requests (e.g. discard, writesame, etc) -* won't be imposed. -* If called from dm_wq_work() for deferred bio processing, bio -* was already handled by following code with previous ->submit_bio. +* Use blk_queue_split() for abnormal IO (e.g. discard, writesame, etc) +* otherwise associated queue_limits won't be imposed. */ -if (current->bio_list) { -if (is_abnormal_io (bio)) -blk_queue_split (&bio); -/* regular IO is split by __split_and_process_bio */ - } +if (is_abnormal_io (bio)) +blk_queue_split (&bio);if (dm_get_md_type (md) ==DM_TYPE_NVME_BIO_BASED )return __process_bio (md, map, bio, ti);
@@ -2461,29 +2455,19 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)*/ static void dm_wq_work (struct work_struct *work) { - struct mapped_device *md = container_of(work, struct mapped_device, - work); -struct bio *c; -int srcu_idx; -struct dm_table *map; - - map =dm_get_live_table (md, &srcu_idx); + struct mapped_device *md = container_of(work, struct mapped_device, work); +struct bio *bio;while (!test_bit (DMF_BLOCK_IO_FOR_SUSPEND , &md->flags)) {spin_lock_irq (&md->deferred_lock); - c =bio_list_pop (&md->deferred); + bio =bio_list_pop (&md->deferred);spin_unlock_irq (&md->deferred_lock); -if (!c) +if (!bio)break ; -if (dm_request_based (md)) - (void )submit_bio_noacct (c); -else - (void )dm_process_bio (md, map, c); +submit_bio_noacct (bio); } - -dm_put_live_table (md, srcu_idx); }static void dm_queue_flush (struct mapped_device *md)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 358/757 pinctrl: single: fix pinctrl_spec.args_count bounds check
In reply to Greg Kroah-HartmanFrom: Drew Fustini <[email protected]>
[ Upstream commit 9b9448f39e83d8e6fdfed006c5db8c304a98c2cd ]
The property #pinctrl-cells can either be 1 or 2:
- if #pinctrl-cells = <1>, then pinctrl_spec.args_count = 2
- if #pinctrl-cells = <2>, then pinctrl_spec.args_count = 3
All other values of pinctrl_spec.args_count are incorrect. This fix checks the upper bound instead of just the lower bound.
--- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +1 -1
@@ -1014,7 +1014,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,if (res)return res; -if (pinctrl_spec.args_count <2 ) { +if (pinctrl_spec.args_count <2 || pinctrl_spec.args_count >3 ) {dev_err (pcs->dev,"invalid args_count for spec: %i\n" , pinctrl_spec.args_count);break ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 359/757 pinctrl: single: fix debug output when #pinctrl-cells = 2
In reply to Greg Kroah-HartmanFrom: Drew Fustini <[email protected]>
[ Upstream commit f4a2b19c37caf40f3b8487ccb9032b974a84a3a7 ]
The debug output in pcs_parse_one_pinctrl_entry() needs to be updated to print the correct pinctrl register value when #pinctrl-cells is 2.
--- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +1 -1
@@ -1033,7 +1033,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, }dev_dbg (pcs->dev,"%pOFn index: 0x%x value: 0x%x\n" , - pinctrl_spec.np, offset, pinctrl_spec.args[1 ]); + pinctrl_spec.np, offset, vals[found].val); pin =pcs_get_pin_by_offset (pcs, offset);if (pin <0 ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 360/757 staging: rtl8712: Fix enqueue_reorder_recvframe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 29838144f280fc03ca06a621568f34e1d0a65a4f ]
The logic of this function was accidentally broken by a checkpatch inspired cleanup. I've modified the code to restore the original behavior and also make checkpatch happy.
--- drivers/staging/rtl8712/rtl8712_recv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +6 -3
@@ -477,11 +477,14 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,while (!end_of_queue_search (phead, plist)) { pnextrframe = container_of(plist, union recv_frame, u.list); pnextattrib = &pnextrframe->u.hdr.attrib; + +if (SN_EQUAL (pnextattrib->seq_num, pattrib->seq_num)) +return false; +if (SN_LESS (pnextattrib->seq_num, pattrib->seq_num)) plist = plist->next; -else if (SN_EQUAL (pnextattrib->seq_num, pattrib->seq_num)) -return false; -break ; +else +break ; }list_del_init (&(prframe->u.hdr.list));list_add_tail (&(prframe->u.hdr.list), plist);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 361/757 ASoC: wm_adsp: Pass full name to snd_ctl_notify
In reply to Greg Kroah-HartmanFrom: Adam Brickman <[email protected]>
[ Upstream commit 20441614d89867142060d3bcd79cc111d8ba7a8e ]
A call to wm_adsp_write_ctl() could cause a kernel crash if it does not retrieve a valid kcontrol from snd_soc_card_get_kcontrol(). This can happen due to a missing control name prefix. Then, snd_ctl_notify() crashes when it tries to use the id field.
Modified wm_adsp_write_ctl() to incorporate the name_prefix (if applicable) such that it is able to retrieve a valid id field from the kcontrol once the platform has booted.
--- sound/soc/codecs/wm_adsp.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +19 -1
@@ -2049,6 +2049,7 @@ int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type, {struct wm_coeff_ctl *ctl;struct snd_kcontrol *kcontrol; +char ctl_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN ];int ret; ctl =wm_adsp_get_ctl (dsp, name, type, alg);
@@ -2059,8 +2060,25 @@ int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,return -EINVAL ; ret =wm_coeff_write_ctrl (ctl, buf, len); +if (ret) +return ret; + +if (ctl->flags &WMFW_CTL_FLAG_SYS ) +return 0 ; + +if (dsp->component->name_prefix) +snprintf (ctl_name,SNDRV_CTL_ELEM_ID_NAME_MAXLEN ,"%s %s" , + dsp->component->name_prefix, ctl->name); +else +snprintf (ctl_name,SNDRV_CTL_ELEM_ID_NAME_MAXLEN ,"%s" , + ctl->name); + + kcontrol =snd_soc_card_get_kcontrol (dsp->component->card, ctl_name); +if (!kcontrol) { +adsp_err (dsp,"Can't find kcontrol %s\n" , ctl_name); +return -EINVAL ; + } - kcontrol =snd_soc_card_get_kcontrol (dsp->component->card, ctl->name);snd_ctl_notify (dsp->component->card->snd_card,SNDRV_CTL_EVENT_MASK_VALUE , &kcontrol->id);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 362/757 iwlwifi: mvm: split a print to avoid a WARNING in ROC
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 903b3f9badf1d54f77b468b96706dab679b45b14 ]
A print in the remain on channel code was too long and caused a WARNING, split it.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +6 -3
@@ -3693,9 +3693,12 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, tail->apply_time_max_delay =cpu_to_le32 (delay);IWL_DEBUG_TE (mvm, -"ROC: Requesting to remain on channel %u for %ums (requested = %ums, max_delay = %ums, dtim_interval = %ums)\n" , - channel->hw_value, req_dur, duration, delay, - dtim_interval); +"ROC: Requesting to remain on channel %u for %ums\n" , + channel->hw_value, req_dur); +IWL_DEBUG_TE (mvm, +"\t(requested = %ums, max_delay = %ums, dtim_interval = %ums)\n" , + duration, delay, dtim_interval); +/* Set the node address */ memcpy (tail->node_addr, vif->addr,ETH_ALEN );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 363/757 iwlwifi: dbg: remove no filter condition
In reply to Greg Kroah-HartmanFrom: Mordechay Goodstein <[email protected]>
[ Upstream commit bfdb157127dab2a85d4096a68a00ad568c9eb590 ]
Currently if group-id and command-id values are zero we trigger and collect every RX frame,
this is not the right behavior and zero value should be handled like any other filter.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +2 -3
@@ -947,9 +947,8 @@ static bool iwl_dbg_tlv_check_fw_pkt(struct iwl_fw_runtime *fwrt,struct iwl_rx_packet *pkt = tp_data->fw_pkt;struct iwl_cmd_header *wanted_hdr = (void *)&trig_data; -if (pkt && ((wanted_hdr->cmd ==0 && wanted_hdr->group_id ==0 ) || - (pkt->hdr.cmd == wanted_hdr->cmd && - pkt->hdr.group_id == wanted_hdr->group_id))) { +if (pkt && (pkt->hdr.cmd == wanted_hdr->cmd && + pkt->hdr.group_id == wanted_hdr->group_id)) {struct iwl_rx_packet *fw_pkt = kmemdup(pkt, sizeof(*pkt) + iwl_rx_packet_payload_len(pkt),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 364/757 iwlwifi: dbg: run init_cfg function once per driver load
In reply to Greg Kroah-HartmanFrom: Mordechay Goodstein <[email protected]>
[ Upstream commit 42f8a2735cc218b6b372134684d4cd3c1423f123 ]
Every time we call init_cfg driver appends the enabled triggers to the active triggers while this should be done only once per driver load.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +3 -0
@@ -1011,6 +1011,9 @@ static void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt)enum iwl_fw_ini_buffer_location *ini_dest = &fwrt->trans->dbg.ini_dest;int ret, i; +if (*ini_dest !=IWL_FW_INI_LOCATION_INVALID ) +return ; +IWL_DEBUG_FW (fwrt,"WRT: Generating active triggers list, domain 0x%x\n" , fwrt->trans->dbg.domains_bitmap);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 365/757 usb: gadget: f_ncm: fix ncm_bitrate for SuperSpeed and above.
In reply to Greg Kroah-HartmanFrom: Lorenzo Colitti <[email protected]>
[ Upstream commit 986499b1569af980a819817f17238015b27793f6 ]
Currently, SuperSpeed NCM gadgets report a speed of 851 Mbps in USB_CDC_NOTIFY_SPEED_CHANGE. But the calculation appears to assume 16 packets per microframe, and USB 3 and above no longer use microframes.
Maximum speed is actually much higher. On a direct connection, theoretical throughput is at most 3.86 Gbps for gen1x1 and 9.36 Gbps for gen2x1, and I have seen gadget->host iperf throughput of >2 Gbps for gen1x1 and >4 Gbps for gen2x1.
Unfortunately the ConnectionSpeedChange defined in the CDC spec only uses 32-bit values, so we can't report accurate numbers for 10Gbps and above. So, report 3.75Gbps for SuperSpeed (which is roughly maximum theoretical performance) and 4.25Gbps for SuperSpeed Plus (which is close to the maximum that we can report in a 32-bit unsigned integer).
This results in:
[50879.191272] cdc_ncm 2-2:1.0 enx228b127e050c: renamed from usb0 [50879.234778] cdc_ncm 2-2:1.0 enx228b127e050c: 3750 mbit/s downlink 3750 mbit/s uplink
on SuperSpeed and:
[50798.434527] cdc_ncm 8-2:1.0 enx228b127e050c: renamed from usb0 [50798.524278] cdc_ncm 8-2:1.0 enx228b127e050c: 4250 mbit/s downlink 4250 mbit/s uplink
on SuperSpeed Plus.
--- drivers/usb/gadget/function/f_ncm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_ncm.c +4 -2
@@ -85,8 +85,10 @@ static inline struct f_ncm *func_to_ncm(struct usb_function *f)/* peak (theoretical) bulk transfer rate in bits-per-second */ static inline unsigned ncm_bitrate (struct usb_gadget *g) { -if (gadget_is_superspeed (g) && g->speed ==USB_SPEED_SUPER ) -return 13 *1024 *8 *1000 *8 ; +if (gadget_is_superspeed (g) && g->speed >=USB_SPEED_SUPER_PLUS ) +return 4250000000U ; +else if (gadget_is_superspeed (g) && g->speed ==USB_SPEED_SUPER ) +return 3750000000U ;else if (gadget_is_dualspeed (g) && g->speed ==USB_SPEED_HIGH )return 13 *512 *8 *1000 *8 ;else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 366/757 usb: gadget: u_serial: clear suspended flag when disconnecting
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
[ Upstream commit d98ef43bfb65b5201e1afe36aaf8c4f9d71b4307 ]
The commit aba3a8d01d62 ("usb: gadget: u_serial: add suspend resume callbacks") set/cleared the suspended flag in USB bus suspend/resume only. But, when a USB cable is disconnected in the suspend, since some controllers will not detect USB bus resume, the suspended flag is not cleared. After that, user cannot send any data. To fix the issue, clears the suspended flag in the gserial_disconnect().
--- drivers/usb/gadget/function/u_serial.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/u_serial.c +1 -0
@@ -1391,6 +1391,7 @@ void gserial_disconnect(struct gserial *gser)if (port->port.tty)tty_hangup (port->port.tty); } + port->suspended = false;spin_unlock_irqrestore (&port->port_lock, flags);/* disable endpoints, aborting down any active I/O */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 367/757 usb: gadget: u_ether: enable qmult on SuperSpeed Plus as well
In reply to Greg Kroah-HartmanFrom: Lorenzo Colitti <[email protected]>
[ Upstream commit 4eea21dc67b0c6ba15ae41b1defa113a680a858e ]
The u_ether driver has a qmult setting that multiplies the transmit queue length (which by default is 2).
The intent is that it should be enabled at high/super speed, but because the code does not explicitly check for USB_SUPER_PLUS, it is disabled at that speed.
Fix this by ensuring that the queue multiplier is enabled for any wired link at high speed or above. Using >= for USB_SPEED_* constants seems correct because it is what the gadget_is_xxxspeed functions do.
The queue multiplier substantially helps performance at higher speeds. On a direct SuperSpeed Plus link to a Linux laptop, iperf3 single TCP stream:
Before (qmult=1): 1.3 Gbps
After (qmult=5): 3.2 Gbps
--- drivers/usb/gadget/function/u_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/u_ether.c +1 -1
@@ -93,7 +93,7 @@ struct eth_dev {static inline int qlen (struct usb_gadget *gadget,unsigned qmult) {if (gadget_is_dualspeed (gadget) && (gadget->speed ==USB_SPEED_HIGH || - gadget->speed ==USB_SPEED_SUPER )) + gadget->speed >=USB_SPEED_SUPER ))return qmult *DEFAULT_QLEN ;else return DEFAULT_QLEN ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 368/757 bus: mhi: core: Fix the building of MHI module
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 5fc4997fd9d065c98fb312ef56ffadffccc6d61d ]
The Kbuild rule to build MHI should use the append operator. This fixes the below warning reported by Kbuild test bot.
WARNING: modpost: missing MODULE_LICENSE() in drivers/bus/mhi/core/main.o
WARNING: modpost: missing MODULE_LICENSE() in drivers/bus/mhi/core/pm.o
WARNING: modpost: missing MODULE_LICENSE() in drivers/bus/mhi/core/boot.o
--- drivers/bus/mhi/core/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-$(CONFIG_MHI_BUS) := mhi.o +obj-$(CONFIG_MHI_BUS) += mhi.o mhi-y := init.o main.o pm.o boot.o
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 369/757 ocxl: fix kconfig dependency warning for OCXL
In reply to Greg Kroah-HartmanFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 4b53a3c72116118d86fab4112277e1dc4edf273c ]
When OCXL is enabled and HOTPLUG_PCI is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for HOTPLUG_PCI_POWERNV
Depends on [n]: PCI [=y] && HOTPLUG_PCI [=n] && PPC_POWERNV [=y] && EEH [=y] Selected by [y]:
- OCXL [=y] && PPC_POWERNV [=y] && PCI [=y] && EEH [=y]
The reason is that OCXL selects HOTPLUG_PCI_POWERNV without depending on or selecting HOTPLUG_PCI while HOTPLUG_PCI_POWERNV is subordinate to HOTPLUG_PCI.
HOTPLUG_PCI_POWERNV is a visible symbol with a set of dependencies. Selecting it will lead to overlooking its other dependencies as well.
Let OCXL depend on HOTPLUG_PCI_POWERNV instead to avoid Kbuild issues.
--- drivers/misc/ocxl/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/misc/ocxl/Kconfig +1 -2
@@ -9,9 +9,8 @@ config OCXL_BASE config OCXL tristate "OpenCAPI coherent accelerator support" - depends on PPC_POWERNV && PCI && EEH + depends on PPC_POWERNV && PCI && EEH && HOTPLUG_PCI_POWERNV select OCXL_BASE - select HOTPLUG_PCI_POWERNV default m help Select this option to enable the ocxl driver for Open
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 370/757 nl80211: fix non-split wiphy information
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit ab10c22bc3b2024f0c9eafa463899a071eac8d97 ]
When dumping wiphy information, we try to split the data into many submessages, but for old userspace we still support the old mode where this doesn't happen.
However, in this case we were not resetting our state correctly and dumping multiple messages for each wiphy, which would have broken such older userspace.
This was broken pretty much immediately afterwards because it only worked in the original commit where non-split dumps didn't have any more data than split dumps...
--- net/wireless/nl80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/wireless/nl80211.c +4 -1
@@ -2355,7 +2355,10 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,* case we'll continue with more data in the next round, * but break unconditionally so unsplit data stops here. */ - state->split_start++; +if (state->split) + state->split_start++; +else + state->split_start =0 ;break ;case 9 : if (rdev->wiphy.extended_capabilities &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 371/757 usb: dwc2: Fix INTR OUT transfers in DDMA mode.
In reply to Greg Kroah-HartmanFrom: Minas Harutyunyan <[email protected]>
[ Upstream commit b2c586eb07efab982419f32b7c3bd96829bc8bcd ]
In DDMA mode if INTR OUT transfers mps not multiple of 4 then single packet corresponds to single descriptor.
Descriptor limit set to mps and desc chain limit set to mps * MAX_DMA_DESC_NUM_GENERIC. On that descriptors complete, to calculate transfer size should be considered correction value for each descriptor.
In start request function, if "continue" is true then dma buffer address should be incremmented by offset for all type of transfers, not only for Control DATA_OUT transfers.
--- drivers/usb/dwc2/gadget.c | 40 ++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-)
drivers/usb/dwc2/gadget.c +33 -7
@@ -713,8 +713,11 @@ static u32 dwc2_hsotg_read_frameno(struct dwc2_hsotg *hsotg)*/ static unsigned int dwc2_gadget_get_chain_limit (struct dwc2_hsotg_ep *hs_ep) { +const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc;int is_isoc = hs_ep->isochronous;unsigned int maxsize; +u32 mps = hs_ep->ep.maxpacket; +int dir_in = hs_ep->dir_in;if (is_isoc) maxsize = (hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT :
@@ -723,6 +726,11 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep)else maxsize =DEV_DMA_NBYTES_LIMIT *MAX_DMA_DESC_NUM_GENERIC ; +/* Interrupt OUT EP with mps not multiple of 4 */ +if (hs_ep->index) +if (usb_endpoint_xfer_int (ep_desc) && !dir_in && (mps %4 )) + maxsize = mps *MAX_DMA_DESC_NUM_GENERIC ; +return maxsize; }
@@ -738,11 +746,14 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep)* Isochronous - descriptor rx/tx bytes bitfield limit, * Control In/Bulk/Interrupt - multiple of mps. This will allow to not * have concatenations from various descriptors within one packet. +* Interrupt OUT - if mps not multiple of 4 then a single packet corresponds +* to a single descriptor. * * Selects corresponding mask for RX/TX bytes as well. */ static u32 dwc2_gadget_get_desc_params (struct dwc2_hsotg_ep *hs_ep,u32 *mask) { +const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc;u32 mps = hs_ep->ep.maxpacket;int dir_in = hs_ep->dir_in;u32 desc_size =0 ;
@@ -766,6 +777,13 @@ static u32 dwc2_gadget_get_desc_params(struct dwc2_hsotg_ep *hs_ep, u32 *mask) desc_size -= desc_size % mps; } +/* Interrupt OUT EP with mps not multiple of 4 */ +if (hs_ep->index) +if (usb_endpoint_xfer_int (ep_desc) && !dir_in && (mps %4 )) { + desc_size = mps; + *mask =DEV_DMA_NBYTES_MASK ; + } +return desc_size; }
@@ -1123,13 +1141,7 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg, length += (mps - (length % mps)); } -/* -* If more data to send, adjust DMA for EP0 out data stage. -* ureq->dma stays unchanged, hence increment it by already -* passed passed data count before starting new transaction. -*/ -if (!index && hsotg->ep0_state ==DWC2_EP0_DATA_OUT && - continuing) +if (continuing) offset = ureq->actual;/* Fill DDMA chain entries */
@@ -2320,22 +2332,36 @@ static void dwc2_hsotg_change_ep_iso_parity(struct dwc2_hsotg *hsotg,*/ static unsigned int dwc2_gadget_get_xfersize_ddma (struct dwc2_hsotg_ep *hs_ep) { +const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc;struct dwc2_hsotg *hsotg = hs_ep->parent;unsigned int bytes_rem =0 ; +unsigned int bytes_rem_correction =0 ;struct dwc2_dma_desc *desc = hs_ep->desc_list;int i;u32 status; +u32 mps = hs_ep->ep.maxpacket; +int dir_in = hs_ep->dir_in;if (!desc)return -EINVAL ; +/* Interrupt OUT EP with mps not multiple of 4 */ +if (hs_ep->index) +if (usb_endpoint_xfer_int (ep_desc) && !dir_in && (mps %4 )) + bytes_rem_correction =4 - (mps %4 ); +for (i =0 ; i < hs_ep->desc_count; ++i) { status = desc->status; bytes_rem += status &DEV_DMA_NBYTES_MASK ; + bytes_rem -= bytes_rem_correction;if (status &DEV_DMA_STS_MASK )dev_err (hsotg->dev,"descriptor %d closed with %x\n" , i, status &DEV_DMA_STS_MASK ); + +if (status &DEV_DMA_L ) +break ; + desc++; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 372/757 scsi: target: tcmu: Fix warning: page may be used uninitialized
In reply to Greg Kroah-HartmanFrom: John Donnelly <[email protected]>
[ Upstream commit 61741d8699e1fc764a309ebd20211bb1cb193110 ]
Corrects drivers/target/target_core_user.c:688:6: warning: 'page' may be used uninitialized.
--- drivers/target/target_core_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_user.c +1 -1
@@ -681,7 +681,7 @@ static void scatter_data_area(struct tcmu_dev *udev,void *from, *to =NULL ;size_t copy_bytes, to_offset, offset;struct scatterlist *sg; -struct page *page; +struct page *page =NULL ;for_each_sg (data_sg, sg, data_nents, i) {int sg_remaining = sg->length;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 373/757 scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 38b2db564d9ab7797192ef15d7aade30633ceeae ]
The be_fill_queue() function can only fail when "eq_vaddress" is NULL and since it's non-NULL here that means the function call can't fail. But imagine if it could, then in that situation we would want to store the "paddr" so that dma memory can be released.
--- drivers/scsi/be2iscsi/be_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -3020,6 +3020,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, goto create_eq_error; } + mem->dma = paddr; mem->va = eq_vaddress; ret =be_fill_queue (eq, phba->params.num_eq_entries,sizeof (struct be_eq_entry ), eq_vaddress);
@@ -3029,7 +3030,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, goto create_eq_error; } - mem->dma = paddr; ret =beiscsi_cmd_eq_create (&phba->ctrl, eq,BEISCSI_EQ_DELAY_DEF );if (ret) {
@@ -3086,6 +3086,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, goto create_cq_error; } + mem->dma = paddr; ret =be_fill_queue (cq, phba->params.num_cq_entries,sizeof (struct sol_cqe ), cq_vaddress);if (ret) {
@@ -3095,7 +3096,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, goto create_cq_error; } - mem->dma = paddr; ret =beiscsi_cmd_cq_create (&phba->ctrl, cq, eq, false, false,0 );if (ret) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 374/757 dmaengine: ioat: Allocate correct size for descriptor chunk
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 028926e4ac8f21af343c25794117fd13c08b1712 ]
dma_alloc_coherent() is called with a fixed SZ_2M size, but frees happen with IOAT_CHUNK_SIZE. Recently, IOAT_CHUNK_SIZE was reduced to 512M but the allocation did not change. To fix, change to using the IOAT_CHUNK_SIZE define.
This was caught with the upcoming patchset for converting Intel platforms to the dma-iommu implementation. It has a warning when the unmapped size differs from the mapped size.
--- drivers/dma/ioat/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/ioat/dma.c +1 -1
@@ -389,7 +389,7 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags)struct ioat_descs *descs = &ioat_chan->descs[i]; descs->virt =dma_alloc_coherent (to_dev (ioat_chan), -SZ_2M , &descs->hw, flags); +IOAT_CHUNK_SIZE , &descs->hw, flags);if (!descs->virt) {int idx;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 375/757 staging: qlge: fix build breakage with dumping enabled
In reply to Greg Kroah-HartmanFrom: Coiby Xu <[email protected]>
[ Upstream commit 51c00535537018bddd4b3fb225d18c1ae049c4e9 ]
This fixes commit 0107635e15ac
("staging: qlge: replace pr_err with netdev_err") which introduced an build breakage of missing struct ql_adapter *qdev for some functions and a warning of type mismatch with dumping enabled, i.e.,
$ make CFLAGS_MODULE="-DQL_ALL_DUMP -DQL_OB_DUMP -DQL_CB_DUMP \
-DQL_IB_DUMP -DQL_REG_DUMP -DQL_DEV_DUMP" M=drivers/staging/qlgeqlge_dbg.c: In function ‘ql_dump_ob_mac_rsp’:
qlge_dbg.c:2051:13: error: ‘qdev’ undeclared (first use in this function); did you mean ‘cdev’?
2051 | netdev_err(qdev->ndev, "%s\n", __func__);
| ^~~~
qlge_dbg.c: In function ‘ql_dump_routing_entries’:
qlge_dbg.c:1435:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
1435 | "%s: Routing Mask %d = 0x%.08x\n",
| ~^
| |
| char *
| %d
1436 | i, value);
| ~
| |
| int
qlge_dbg.c:1435:37: warning: format ‘%x’ expects a matching ‘unsigned int’ argument [-Wformat=]
1435 | "%s: Routing Mask %d = 0x%.08x\n",
| ~~~~^
| |
| unsigned intNote that now ql_dump_rx_ring/ql_dump_tx_ring won't check if the passed parameter is a null pointer.
--- drivers/staging/qlge/qlge.h | 20 ++++++++++---------- drivers/staging/qlge/qlge_dbg.c | 28 ++++++++++++++++++---------- drivers/staging/qlge/qlge_main.c | 8 ++++---- 3 files changed, 32 insertions(+), 24 deletions(-)
drivers/staging/qlge/qlge.h +10 -10
@@ -2338,21 +2338,21 @@ void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id);#endif #ifdef QL_OB_DUMP -void ql_dump_tx_desc (struct tx_buf_desc *tbd); -void ql_dump_ob_mac_iocb (struct ob_mac_iocb_req *ob_mac_iocb); -void ql_dump_ob_mac_rsp (struct ob_mac_iocb_rsp *ob_mac_rsp); -#define QL_DUMP_OB_MAC_IOCB (ob_mac_iocb) ql_dump_ob_mac_iocb(ob_mac_iocb) -#define QL_DUMP_OB_MAC_RSP (ob_mac_rsp) ql_dump_ob_mac_rsp(ob_mac_rsp) +void ql_dump_tx_desc (struct ql_adapter *qdev,struct tx_buf_desc *tbd); +void ql_dump_ob_mac_iocb (struct ql_adapter *qdev,struct ob_mac_iocb_req *ob_mac_iocb); +void ql_dump_ob_mac_rsp (struct ql_adapter *qdev,struct ob_mac_iocb_rsp *ob_mac_rsp); +#define QL_DUMP_OB_MAC_IOCB (qdev, ob_mac_iocb) ql_dump_ob_mac_iocb(qdev, ob_mac_iocb) +#define QL_DUMP_OB_MAC_RSP (qdev, ob_mac_rsp) ql_dump_ob_mac_rsp(qdev, ob_mac_rsp)#else -#define QL_DUMP_OB_MAC_IOCB (ob_mac_iocb) -#define QL_DUMP_OB_MAC_RSP (ob_mac_rsp) +#define QL_DUMP_OB_MAC_IOCB (qdev, ob_mac_iocb) +#define QL_DUMP_OB_MAC_RSP (qdev, ob_mac_rsp)#endif #ifdef QL_IB_DUMP -void ql_dump_ib_mac_rsp (struct ib_mac_iocb_rsp *ib_mac_rsp); -#define QL_DUMP_IB_MAC_RSP (ib_mac_rsp) ql_dump_ib_mac_rsp(ib_mac_rsp) +void ql_dump_ib_mac_rsp (struct ql_adapter *qdev,struct ib_mac_iocb_rsp *ib_mac_rsp); +#define QL_DUMP_IB_MAC_RSP (qdev, ib_mac_rsp) ql_dump_ib_mac_rsp(qdev, ib_mac_rsp)#else -#define QL_DUMP_IB_MAC_RSP (ib_mac_rsp) +#define QL_DUMP_IB_MAC_RSP (qdev, ib_mac_rsp)#endif #ifdef QL_ALL_DUMP
drivers/staging/qlge/qlge_dbg.c +18 -10
@@ -1431,7 +1431,7 @@ void ql_dump_routing_entries(struct ql_adapter *qdev) }if (value)netdev_err (qdev->ndev, -"%s: Routing Mask %d = 0x%.08x\n" , +"Routing Mask %d = 0x%.08x\n" , i, value); }ql_sem_unlock (qdev,SEM_RT_IDX_MASK );
@@ -1617,6 +1617,9 @@ void ql_dump_qdev(struct ql_adapter *qdev)#ifdef QL_CB_DUMP void ql_dump_wqicb (struct wqicb *wqicb) { + struct tx_ring *tx_ring = container_of(wqicb, struct tx_ring, wqicb); +struct ql_adapter *qdev = tx_ring->qdev; +netdev_err (qdev->ndev,"Dumping wqicb stuff...\n" );netdev_err (qdev->ndev,"wqicb->len = 0x%x\n" ,le16_to_cpu (wqicb->len)); netdev_err(qdev->ndev, "wqicb->flags = %x\n",
@@ -1632,8 +1635,8 @@ void ql_dump_wqicb(struct wqicb *wqicb)void ql_dump_tx_ring (struct tx_ring *tx_ring) { -if (!tx_ring) -return ; +struct ql_adapter *qdev = tx_ring->qdev; +netdev_err (qdev->ndev,"===================== Dumping tx_ring %d ===============\n" , tx_ring->wq_id);netdev_err (qdev->ndev,"tx_ring->base = %p\n" , tx_ring->wq_base);
@@ -1657,6 +1660,8 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)void ql_dump_ricb (struct ricb *ricb) {int i; +struct ql_adapter *qdev = + container_of(ricb, struct ql_adapter, ricb);netdev_err (qdev->ndev,"===================== Dumping ricb ===============\n" );netdev_err (qdev->ndev,"Dumping ricb stuff...\n" );
@@ -1686,6 +1691,9 @@ void ql_dump_ricb(struct ricb *ricb)void ql_dump_cqicb (struct cqicb *cqicb) { + struct rx_ring *rx_ring = container_of(cqicb, struct rx_ring, cqicb); +struct ql_adapter *qdev = rx_ring->qdev; +netdev_err (qdev->ndev,"Dumping cqicb stuff...\n" );netdev_err (qdev->ndev,"cqicb->msix_vect = %d\n" , cqicb->msix_vect);
@@ -1725,8 +1733,8 @@ static const char *qlge_rx_ring_type_name(struct rx_ring *rx_ring)void ql_dump_rx_ring (struct rx_ring *rx_ring) { -if (!rx_ring) -return ; +struct ql_adapter *qdev = rx_ring->qdev; +netdev_err (qdev->ndev,"===================== Dumping rx_ring %d ===============\n" , rx_ring->cq_id);
@@ -1816,7 +1824,7 @@ void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id)#endif #ifdef QL_OB_DUMP -void ql_dump_tx_desc (struct tx_buf_desc *tbd) +void ql_dump_tx_desc (struct ql_adapter *qdev,struct tx_buf_desc *tbd) {netdev_err (qdev->ndev,"tbd->addr = 0x%llx\n" ,le64_to_cpu ((u64 )tbd->addr));
@@ -1843,7 +1851,7 @@ void ql_dump_tx_desc(struct tx_buf_desc *tbd) tbd->len & TX_DESC_E ? "E" : "."); } -void ql_dump_ob_mac_iocb (struct ob_mac_iocb_req *ob_mac_iocb) +void ql_dump_ob_mac_iocb (struct ql_adapter *qdev,struct ob_mac_iocb_req *ob_mac_iocb) {struct ob_mac_tso_iocb_req *ob_mac_tso_iocb = (struct ob_mac_tso_iocb_req *)ob_mac_iocb;
@@ -1886,10 +1894,10 @@ void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb) frame_len =le16_to_cpu (ob_mac_iocb->frame_len); } tbd = &ob_mac_iocb->tbd[0 ]; -ql_dump_tx_desc (tbd); +ql_dump_tx_desc (qdev, tbd); } -void ql_dump_ob_mac_rsp (struct ob_mac_iocb_rsp *ob_mac_rsp) +void ql_dump_ob_mac_rsp (struct ql_adapter *qdev,struct ob_mac_iocb_rsp *ob_mac_rsp) {netdev_err (qdev->ndev,"%s\n" , __func__);netdev_err (qdev->ndev,"opcode = %d\n" , ob_mac_rsp->opcode);
@@ -1906,7 +1914,7 @@ void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp)#endif #ifdef QL_IB_DUMP -void ql_dump_ib_mac_rsp (struct ib_mac_iocb_rsp *ib_mac_rsp) +void ql_dump_ib_mac_rsp (struct ql_adapter *qdev,struct ib_mac_iocb_rsp *ib_mac_rsp) {netdev_err (qdev->ndev,"%s\n" , __func__);netdev_err (qdev->ndev,"opcode = 0x%x\n" , ib_mac_rsp->opcode);
drivers/staging/qlge/qlge_main.c +4 -4
@@ -1856,7 +1856,7 @@ static void ql_process_mac_split_rx_intr(struct ql_adapter *qdev,struct net_device *ndev = qdev->ndev;struct sk_buff *skb =NULL ; -QL_DUMP_IB_MAC_RSP (ib_mac_rsp); +QL_DUMP_IB_MAC_RSP (qdev, ib_mac_rsp); skb =ql_build_rx_skb (qdev, rx_ring, ib_mac_rsp);if (unlikely (!skb)) {
@@ -1954,7 +1954,7 @@ static unsigned long ql_process_mac_rx_intr(struct ql_adapter *qdev, ((le16_to_cpu (ib_mac_rsp->vlan_id) & IB_MAC_IOCB_RSP_VLAN_MASK)) : 0xffff; -QL_DUMP_IB_MAC_RSP (ib_mac_rsp); +QL_DUMP_IB_MAC_RSP (qdev, ib_mac_rsp);if (ib_mac_rsp->flags4 &IB_MAC_IOCB_RSP_HV ) {/* The data and headers are split into
@@ -2001,7 +2001,7 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev,struct tx_ring *tx_ring;struct tx_ring_desc *tx_ring_desc; -QL_DUMP_OB_MAC_RSP (mac_rsp); +QL_DUMP_OB_MAC_RSP (qdev, mac_rsp); tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; tx_ring_desc = &tx_ring->q[mac_rsp->tid];ql_unmap_send (qdev, tx_ring_desc, tx_ring_desc->map_cnt);
@@ -2593,7 +2593,7 @@ static netdev_tx_t qlge_send(struct sk_buff *skb, struct net_device *ndev) tx_ring->tx_errors++;return NETDEV_TX_BUSY ; } -QL_DUMP_OB_MAC_IOCB (mac_iocb_ptr); +QL_DUMP_OB_MAC_IOCB (qdev, mac_iocb_ptr); tx_ring->prod_idx++;if (tx_ring->prod_idx == tx_ring->wq_len) tx_ring->prod_idx =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 376/757 ipmi_si: Fix wrong return value in try_smi_init()
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
[ Upstream commit 8fe7990ceda8597e407d06bffc4bdbe835a93ece ]
On an error exit path, a negative error code should be returned instead of a positive return value.
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_si_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_intf.c +1 -1
@@ -1963,7 +1963,7 @@ static int try_smi_init(struct smi_info *new_smi)/* Do this early so it's available for logs. */ if (!new_smi->io.dev) {pr_err ("IPMI interface added with no device\n" ); - rv =EIO ; + rv = -EIO ; goto out_err; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 377/757 tracing: Fix parse_synth_field() error handling
In reply to Greg Kroah-HartmanFrom: Tom Zanussi <[email protected]>
[ Upstream commit 8fbeb52a598c7ab5aa603d6bb083b8a8d16d607a ]
synth_field_size() returns either a positive size or an error (zero or a negative value). However, the existing code assumes the only error value is 0. It doesn't handle negative error codes, as it assigns directly to field->size (a size_t; unsigned), thereby interpreting the error code as a valid size instead.
Do the test before assignment to field->size.
[ [email protected]: changelog addition, first paragraph above ]
--- kernel/trace/trace_events_synth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/trace_events_synth.c +4 -2
@@ -465,6 +465,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,struct synth_field *field;const char *prefix =NULL , *field_type = argv[0 ], *field_name, *array;int len, ret =0 ; +ssize_t size;if (field_type[0 ] ==';' ) field_type++;
@@ -520,11 +521,12 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, field->type[len -1 ] ='\0' ; } - field->size =synth_field_size (field->type); -if (!field->size) { + size =synth_field_size (field->type); +if (size <=0 ) { ret = -EINVAL ; goto free; } + field->size = size;if (synth_field_is_string (field->type)) field->is_string = true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 378/757 ASoC: mediatek: mt8183-da7219: fix wrong ops for I2S3
In reply to Greg Kroah-HartmanFrom: Tzung-Bi Shih <[email protected]>
[ Upstream commit ebb11d1d9fe2d6b4a47755f7f09b2b631046e308 ]
DA7219 uses I2S2 and I2S3 for input and output respectively. Commit 9e30251fb22e ("ASoC: mediatek: mt8183-da7219: support machine driver with rt1015") introduces a bug that:
- If using I2S2 solely, MCLK to DA7219 is 256FS.
- If using I2S3 solely, MCLK to DA7219 is 128FS.
- If using I2S3 first and then I2S2, the MCLK changes from 128FS to 256FS. As a result, no sound output to the headset. Also no sound input from the headset microphone.
Both I2S2 and I2S3 should set MCLK to 256FS. Fixes the wrong ops for I2S3.
--- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +1 -1
@@ -673,7 +673,7 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev)if (card == &mt8183_da7219_max98357_card) { dai_link->be_hw_params_fixup = mt8183_i2s_hw_params_fixup; - dai_link->ops = &mt8183_mt6358_i2s_ops; + dai_link->ops = &mt8183_da7219_i2s_ops; dai_link->cpus = i2s3_max98357a_cpus; dai_link->num_cpus =ARRAY_SIZE (i2s3_max98357a_cpus);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 379/757 staging: wfx: fix BA sessions for older firmwares
In reply to Greg Kroah-HartmanFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit 4fd1241778b08129f196605c62636a4d6d71c2c7 ]
Firmwares with API < 3.6 do not forward DELBA requests. Thus, when a Block Ack session is restarted, the reordering buffer is not flushed and the received sequence number is not contiguous. Therefore, mac80211 starts to wait some missing frames that it will never receive.
This patch disables the reordering buffer for old firmware. It is harmless when the network is unencrypted. When the network is encrypted, the non-contiguous frames will be thrown away by the TKIP/CCMP replay protection. So, the user will observe some packet loss with UDP and performance drop with TCP.
--- drivers/staging/wfx/data_rx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/wfx/data_rx.c +3 -0
@@ -17,6 +17,9 @@ static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt) {int params, tid; +if (wfx_api_older_than (wvif->wdev,3 ,6 )) +return ; +switch (mgmt->u.action.u.addba_req.action_code) {case WLAN_ACTION_ADDBA_REQ : params =le16_to_cpu (mgmt->u.action.u.addba_req.capab);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 380/757 platform/x86: mlx-platform: Remove PSU EEPROM configuration
In reply to Greg Kroah-HartmanFrom: Vadim Pasternak <[email protected]>
[ Upstream commit c071afcea6ecf24a3c119f25ce9f71ffd55b5dc2 ]
Remove PSU EEPROM configuration for systems class equipped with Mellanox chip Spectrume-2. Till now all the systems from this class used few types of power units, all equipped with EEPROM device with address space two bytes. Thus, all these devices have been handled by EEPROM driver "24c32".
There is a new requirement is to support power unit replacement by "off the shelf" device, matching electrical required parameters. Such device could be equipped with different EEPROM type, which could be one byte address space addressing or even could be not equipped with EEPROM. In such case "24c32" will not work.
--- drivers/platform/x86/mlx-platform.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/platform/x86/mlx-platform.c +2 -13
@@ -328,15 +328,6 @@ static struct i2c_board_info mlxplat_mlxcpld_psu[] = { }, }; -static struct i2c_board_info mlxplat_mlxcpld_ng_psu[] = { - { -I2C_BOARD_INFO ("24c32" ,0x51 ), - }, - { -I2C_BOARD_INFO ("24c32" ,0x50 ), - }, -}; -static struct i2c_board_info mlxplat_mlxcpld_pwr[] = { {I2C_BOARD_INFO ("dps460" ,0x59 ),
@@ -770,15 +761,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_psu_items_data[] = { .label = "psu1", .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, .mask = BIT(0), - .hpdev.brdinfo = &mlxplat_mlxcpld_ng_psu[0], - .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, }, { .label = "psu2", .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, .mask = BIT(1), - .hpdev.brdinfo = &mlxplat_mlxcpld_ng_psu[1], - .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 381/757 dm: fix request-based DM to not bounce through indirect dm_submit_bio
In reply to Greg Kroah-HartmanFrom: Mike Snitzer <[email protected]>
[ Upstream commit 681cc5e8667e8579a2da8fa4090c48a2d73fc3bb ]
It is unnecessary to force request-based DM to call into bio-based dm_submit_bio (via indirect disk->fops->submit_bio) only to have it then call blk_mq_submit_bio().
Fix this by establishing a request-based DM block_device_operations (dm_rq_blk_dops, which doesn't have .submit_bio) and update dm_setup_md_queue() to set md->disk->fops to it for DM_TYPE_REQUEST_BASED.
Remove DM_TYPE_REQUEST_BASED conditional in dm_submit_bio and unexport blk_mq_submit_bio.
--- block/blk-mq.c | 1 - drivers/md/dm.c | 25 ++++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-)
block/blk-mq.c +0 -1
@@ -2264,7 +2264,6 @@ blk_qc_t blk_mq_submit_bio(struct bio *bio)blk_queue_exit (q);return BLK_QC_T_NONE ; } -EXPORT_SYMBOL_GPL (blk_mq_submit_bio);/* only for request based dm */ void blk_mq_free_rqs (struct blk_mq_tag_set *set,struct blk_mq_tags *tags,unsigned int hctx_idx)
drivers/md/dm.c +12 -13
@@ -1762,18 +1762,6 @@ static blk_qc_t dm_submit_bio(struct bio *bio)int srcu_idx;struct dm_table *map; -if (dm_get_md_type (md) ==DM_TYPE_REQUEST_BASED ) { -/* -* We are called with a live reference on q_usage_counter, but -* that one will be released as soon as we return. Grab an -* extra one as blk_mq_submit_bio expects to be able to consume -* a reference (which lives until the request is freed in case a -* request is allocated). -*/ -percpu_ref_get (&bio->bi_disk->queue->q_usage_counter); -return blk_mq_submit_bio (bio); - } - map =dm_get_live_table (md, &srcu_idx);/* if we're suspended, we have to queue this io for later */
@@ -1843,6 +1831,7 @@ static int next_free_minor(int *minor) }static const struct block_device_operations dm_blk_dops; +static const struct block_device_operations dm_rq_blk_dops;static const struct dax_operations dm_dax_ops;static void dm_wq_work (struct work_struct *work);
@@ -2242,9 +2231,10 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)switch (type) {case DM_TYPE_REQUEST_BASED : + md->disk->fops = &dm_rq_blk_dops; r =dm_mq_init_request_queue (md, t);if (r) { -DMERR ("Cannot initialize queue for request-based dm-mq mapped device" ); +DMERR ("Cannot initialize queue for request-based dm mapped device" );return r; }break ;
@@ -3227,6 +3217,15 @@ static const struct block_device_operations dm_blk_dops = { .owner = THIS_MODULE }; +static const struct block_device_operations dm_rq_blk_dops = { + .open = dm_blk_open, + .release = dm_blk_close, + .ioctl = dm_blk_ioctl, + .getgeo = dm_blk_getgeo, + .pr_ops = &dm_pr_ops, + .owner =THIS_MODULE +}; +static const struct dax_operations dm_dax_ops = { .direct_access = dm_dax_direct_access, .dax_supported = dm_dax_supported,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 382/757 mwifiex: fix double free
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 53708f4fd9cfe389beab5c8daa763bcd0e0b4aef ]
clang static analysis reports this problem:
sdio.c:2403:3: warning: Attempt to free released memory
kfree(card->mpa_rx.buf);
^~~~~~~~~~~~~~~~~~~~~~~When mwifiex_init_sdio() fails in its first call to mwifiex_alloc_sdio_mpa_buffer, it falls back to calling it again. If the second alloc of mpa_tx.buf fails, the error handler will try to free the old, previously freed mpa_rx.buf. Reviewing the code, it looks like a second double free would happen with mwifiex_cleanup_sdio().
So set both pointers to NULL when they are freed.
--- drivers/net/wireless/marvell/mwifiex/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/sdio.c +2 -0
@@ -1976,6 +1976,8 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter,kfree (card->mpa_rx.buf); card->mpa_tx.buf_size =0 ; card->mpa_rx.buf_size =0 ; + card->mpa_tx.buf =NULL ; + card->mpa_rx.buf =NULL ; }return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 383/757 drm/panfrost: increase readl_relaxed_poll_timeout values
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit c2df75ad2a9f205820e4bc0db936d3d9af3da1ae ]
Amlogic SoC devices report the following errors frequently causing excessive dmesg log spam and early log rotataion, although the errors appear to be harmless as everything works fine:
[ 7.202702] panfrost ffe40000.gpu: error powering up gpu L2 [ 7.203760] panfrost ffe40000.gpu: error powering up gpu shader
ARM staff have advised increasing the timeout values to eliminate the errors in most normal scenarios, and testing with several different G31/G52 devices shows 20000 to be a reliable value.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panfrost/panfrost_gpu.c +2 -2
@@ -309,13 +309,13 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev)/* Just turn on everything for now */ gpu_write (pfdev,L2_PWRON_LO , pfdev->features.l2_present); ret =readl_relaxed_poll_timeout (pfdev->iomem +L2_READY_LO , - val, val == pfdev->features.l2_present,100 ,1000 ); + val, val == pfdev->features.l2_present,100 ,20000 );if (ret)dev_err (pfdev->dev,"error powering up gpu L2" );gpu_write (pfdev,SHADER_PWRON_LO , pfdev->features.shader_present); ret =readl_relaxed_poll_timeout (pfdev->iomem +SHADER_READY_LO , - val, val == pfdev->features.shader_present,100 ,1000 ); + val, val == pfdev->features.shader_present,100 ,20000 );if (ret)dev_err (pfdev->dev,"error powering up gpu shader" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 384/757 drm/amdgpu: Fix invalid number of character { in amdgpu_acpi_init
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 9c27bc97aff8bbe62b5b29ebf528291dd85d9c86 ]
Fix follow warning:
Checking drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c... [drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:770]: (error) Invalid number of character '{' when these macros are defined: ''. Checking drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: CONFIG_ACPI... [drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:770]: (error) Invalid number of character '{' when these macros are defined: 'CONFIG_ACPI'.
......
Checking drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: CONFIG_X86... [drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:770]: (error) Invalid number of character '{' when these macros are defined: 'CONFIG_X86'. Checking drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: _X86_... [drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:770]: (error) Invalid number of character '{' when these macros are defined: '_X86_'. Checking drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c: __linux__... [drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:770]: (error) Invalid number of character '{' when these macros are defined: '__linux__'.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
@@ -806,8 +806,8 @@ int amdgpu_acpi_init(struct amdgpu_device *adev) } adev->atif = atif; -if (atif->notifications.brightness_change) {#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE ) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE ) +if (atif->notifications.brightness_change) {if (amdgpu_device_has_dc_support (adev)) {#if defined(CONFIG_DRM_AMD_DC )struct amdgpu_display_manager *dm = &adev->dm;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 385/757 ipvs: clear skb->tstamp in forwarding path
In reply to Greg Kroah-HartmanFrom: Julian Anastasov <[email protected]>
[ Upstream commit 7980d2eabde82be86c5be18aa3d07e88ec13c6a1 ]
fq qdisc requires tstamp to be cleared in forwarding path
--- net/netfilter/ipvs/ip_vs_xmit.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/netfilter/ipvs/ip_vs_xmit.c +6 -0
@@ -609,6 +609,8 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb,if (ret ==NF_ACCEPT ) {nf_reset_ct (skb);skb_forward_csum (skb); +if (skb->dev) + skb->tstamp =0 ; }return ret; }
@@ -649,6 +651,8 @@ static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb,if (!local) {skb_forward_csum (skb); +if (skb->dev) + skb->tstamp =0 ;NF_HOOK (pf,NF_INET_LOCAL_OUT , cp->ipvs->net,NULL , skb,NULL ,skb_dst (skb)->dev, dst_output); }else
@@ -669,6 +673,8 @@ static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb,if (!local) {ip_vs_drop_early_demux_sk (skb);skb_forward_csum (skb); +if (skb->dev) + skb->tstamp =0 ;NF_HOOK (pf,NF_INET_LOCAL_OUT , cp->ipvs->net,NULL , skb,NULL ,skb_dst (skb)->dev, dst_output); }else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 386/757 bpf, sockmap: Remove skb_orphan and let normal skb_kfree do cleanup
In reply to Greg Kroah-HartmanFrom: John Fastabend <[email protected]>
[ Upstream commit 10d58d006356a075a7b056e0f6502db416d1a261 ]
Calling skb_orphan() is unnecessary in the strp rcv handler because the skb is from a skb_clone() in __strp_recv. So it never has a destructor or a sk assigned. Plus its confusing to read because it might hint to the reader that the skb could have an sk assigned which is not true. Even if we did have an sk assigned it would be cleaner to simply wait for the upcoming kfree_skb().
Additionally, move the comment about strparser clone up so its closer to the logic it is describing and add to it so that it is more complete.
--- net/core/skmsg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/core/skmsg.c +7 -7
@@ -662,15 +662,16 @@ static int sk_psock_bpf_run(struct sk_psock *psock, struct bpf_prog *prog, {int ret; +/* strparser clones the skb before handing it to a upper layer, +* meaning we have the same data, but sk is NULL. We do want an +* sk pointer though when we run the BPF program. So we set it +* here and then NULL it to ensure we don't trigger a BUG_ON() +* in skb/sk operations later if kfree_skb is called with a +* valid skb->sk pointer and no destructor assigned. +*/ skb->sk = psock->sk;bpf_compute_data_end_sk_skb (skb); ret =bpf_prog_run_pin_on_cpu (prog, skb); -/* strparser clones the skb before handing it to a upper layer, -* meaning skb_orphan has been called. We NULL sk on the way out -* to ensure we don't trigger a BUG_ON() in skb/sk operations -* later and because we are not charging the memory of this skb -* to any socket yet. -*/ skb->sk =NULL ;return ret; }
@@ -794,7 +795,6 @@ static void sk_psock_strp_read(struct strparser *strp, struct sk_buff *skb) } prog =READ_ONCE (psock->progs.skb_verdict);if (likely (prog)) { -skb_orphan (skb);tcp_skb_bpf_redirect_clear (skb); ret =sk_psock_bpf_run (psock, prog, skb); ret =sk_psock_map_verd (ret,tcp_skb_bpf_redirect_fetch (skb));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 387/757 net: korina: fix kfree of rx/tx descriptor array
In reply to Greg Kroah-HartmanFrom: Valentin Vidic <[email protected]>
[ Upstream commit 3af5f0f5c74ecbaf757ef06c3f80d56751277637 ]
kmalloc returns KSEG0 addresses so convert back from KSEG1 in kfree. Also make sure array is freed when the driver is unloaded from the kernel.
--- drivers/net/ethernet/korina.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/korina.c +2 -1
@@ -1113,7 +1113,7 @@ static int korina_probe(struct platform_device *pdev)return rc; probe_err_register: -kfree (lp->td_ring); +kfree (KSEG0ADDR (lp->td_ring)); probe_err_td_ring:iounmap (lp->tx_dma_regs); probe_err_dma_tx:
@@ -1133,6 +1133,7 @@ static int korina_remove(struct platform_device *pdev)iounmap (lp->eth_regs);iounmap (lp->rx_dma_regs);iounmap (lp->tx_dma_regs); +kfree (KSEG0ADDR (lp->td_ring));unregister_netdev (bif->dev);free_netdev (bif->dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 388/757 netfilter: nf_log: missing vlan offload tag and proto
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 0d9826bc18ce356e8909919ad681ad65d0a6061e ]
Dump vlan tag and proto for the usual vlan offload case if the NF_LOG_MACDECODE flag is set on. Without this information the logging is misleading as there is no reference to the VLAN header.
[12716.993704] test: IN=veth0 OUT= MACSRC=86:6c:92:ea:d6:73 MACDST=0e:3b:eb:86:73:76 VPROTO=8100 VID=10 MACPROTO=0800 SRC=192.168.10.2 DST=172.217.168.163 LEN=52 TOS=0x00 PREC=0x00 TTL=64 ID=2548 DF PROTO=TCP SPT=55848 DPT=80 WINDOW=501 RES=0x00 ACK FIN URGP=0 [12721.157643] test: IN=veth0 OUT= MACSRC=86:6c:92:ea:d6:73 MACDST=0e:3b:eb:86:73:76 VPROTO=8100 VID=10 MACPROTO=0806 ARP HTYPE=1 PTYPE=0x0800 OPCODE=2 MACSRC=86:6c:92:ea:d6:73 IPSRC=192.168.10.2 MACDST=0e:3b:eb:86:73:76 IPDST=192.168.10.1
--- include/net/netfilter/nf_log.h | 1 + net/ipv4/netfilter/nf_log_arp.c | 19 +++++++++++++++++-- net/ipv4/netfilter/nf_log_ipv4.c | 6 ++++-- net/ipv6/netfilter/nf_log_ipv6.c | 8 +++++--- net/netfilter/nf_log_common.c | 12 ++++++++++++ 5 files changed, 39 insertions(+), 7 deletions(-)
include/net/netfilter/nf_log.h +1 -0
@@ -108,6 +108,7 @@ int nf_log_dump_tcp_header(struct nf_log_buf *m, const struct sk_buff *skb, unsigned int logflags);void nf_log_dump_sk_uid_gid (struct net *net,struct nf_log_buf *m,struct sock *sk); +void nf_log_dump_vlan (struct nf_log_buf *m,const struct sk_buff *skb); void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf, unsigned int hooknum, const struct sk_buff *skb, const struct net_device *in,
net/ipv4/netfilter/nf_log_arp.c +17 -2
@@ -43,16 +43,31 @@ static void dump_arp_packet(struct nf_log_buf *m,const struct nf_loginfo *info, const struct sk_buff *skb, unsigned int nhoff) { - const struct arphdr *ah; -struct arphdr _arph; const struct arppayload *ap;struct arppayload _arpp; +const struct arphdr *ah; +unsigned int logflags; +struct arphdr _arph; ah =skb_header_pointer (skb,0 ,sizeof (_arph), &_arph);if (ah ==NULL ) {nf_log_buf_add (m,"TRUNCATED" );return ; } + +if (info->type ==NF_LOG_TYPE_LOG ) + logflags = info->u.log.logflags; +else + logflags =NF_LOG_DEFAULT_MASK ; + +if (logflags &NF_LOG_MACDECODE ) { +nf_log_buf_add (m,"MACSRC=%pM MACDST=%pM " , +eth_hdr (skb)->h_source,eth_hdr (skb)->h_dest); +nf_log_dump_vlan (m, skb); +nf_log_buf_add (m,"MACPROTO=%04x " , +ntohs (eth_hdr (skb)->h_proto)); + } +nf_log_buf_add (m,"ARP HTYPE=%d PTYPE=0x%04x OPCODE=%d" ,ntohs (ah->ar_hrd),ntohs (ah->ar_pro),ntohs (ah->ar_op));
net/ipv4/netfilter/nf_log_ipv4.c +4 -2
@@ -284,8 +284,10 @@ static void dump_ipv4_mac_header(struct nf_log_buf *m,switch (dev->type) {case ARPHRD_ETHER : -nf_log_buf_add (m,"MACSRC=%pM MACDST=%pM MACPROTO=%04x " , -eth_hdr (skb)->h_source,eth_hdr (skb)->h_dest, +nf_log_buf_add (m,"MACSRC=%pM MACDST=%pM " , +eth_hdr (skb)->h_source,eth_hdr (skb)->h_dest); +nf_log_dump_vlan (m, skb); +nf_log_buf_add (m,"MACPROTO=%04x " ,ntohs (eth_hdr (skb)->h_proto));return ;default :
net/ipv6/netfilter/nf_log_ipv6.c +5 -3
@@ -297,9 +297,11 @@ static void dump_ipv6_mac_header(struct nf_log_buf *m,switch (dev->type) {case ARPHRD_ETHER : -nf_log_buf_add (m,"MACSRC=%pM MACDST=%pM MACPROTO=%04x " , -eth_hdr (skb)->h_source,eth_hdr (skb)->h_dest, -ntohs (eth_hdr (skb)->h_proto)); +nf_log_buf_add (m,"MACSRC=%pM MACDST=%pM " , +eth_hdr (skb)->h_source,eth_hdr (skb)->h_dest); +nf_log_dump_vlan (m, skb); +nf_log_buf_add (m,"MACPROTO=%04x " , +ntohs (eth_hdr (skb)->h_proto));return ;default :break ;
net/netfilter/nf_log_common.c +12 -0
@@ -171,6 +171,18 @@ nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf, }EXPORT_SYMBOL_GPL (nf_log_dump_packet_common); +void nf_log_dump_vlan (struct nf_log_buf *m,const struct sk_buff *skb) +{ +u16 vid; + +if (!skb_vlan_tag_present (skb)) +return ; + + vid =skb_vlan_tag_get (skb); +nf_log_buf_add (m,"VPROTO=%04x VID=%u " ,ntohs (skb->vlan_proto), vid); +} +EXPORT_SYMBOL_GPL (nf_log_dump_vlan); +/* bridge and netdev logging families share this code. */ void nf_log_l2packet(struct net *net, u_int8_t pf, __be16 protocol,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 389/757 mm/swapfile.c: fix potential memory leak in sys_swapon
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 822bca52ee7eb279acfba261a423ed7ac47d6f73 ]
If we failed to drain inode, we would forget to free the swap address space allocated by init_swap_address_space() above.
--- mm/swapfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/swapfile.c +3 -1
@@ -3343,7 +3343,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) error =inode_drain_writes (inode);if (error) { inode->i_flags &= ~S_SWAPFILE ; - goto bad_swap_unlock_inode; + goto free_swap_address_space; }mutex_lock (&swapon_mutex);
@@ -3368,6 +3368,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) error =0 ; goto out; +free_swap_address_space: +exit_swap_address_space (p->type); bad_swap_unlock_inode:inode_unlock (inode); bad_swap:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 390/757 mm: memcg/slab: fix racy access to page->mem_cgroup in mem_cgroup_from_obj()
In reply to Greg Kroah-HartmanFrom: Roman Gushchin <[email protected]>
[ Upstream commit 19b629c9795bfe67bf77be8fb611b84424b56d91 ]
mem_cgroup_from_obj() checks the lowest bit of the page->mem_cgroup pointer to determine if the page has an attached obj_cgroup vector instead of a regular memcg pointer. If it's not set, it simple returns the page->mem_cgroup value as a struct mem_cgroup pointer.
The commit 10befea91b61 ("mm: memcg/slab: use a single set of kmem_caches for all allocations") changed the moment when this bit is set: if previously it was set on the allocation of the slab page, now it can be set well after, when the first accounted object is allocated on this page.
It opened a race: if page->mem_cgroup is set concurrently after the first page_has_obj_cgroups(page) check, a pointer to the obj_cgroups array can be returned as a memory cgroup pointer.
A simple check for page->mem_cgroup pointer for NULL before the page_has_obj_cgroups() check fixes the race. Indeed, if the pointer is not NULL, it's either a simple mem_cgroup pointer or a pointer to obj_cgroup vector. The pointer can be asynchronously changed from NULL to (obj_cgroup_vec | 0x1UL), but can't be changed from a valid memcg pointer to objcg vector or back.
If the object passed to mem_cgroup_from_obj() is a slab object and page->mem_cgroup is NULL, it means that the object is not accounted, so the function must return NULL.
I've discovered the race looking at the code, so far I haven't seen it in the wild.
--- mm/memcontrol.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
mm/memcontrol.c +11 -0
@@ -2887,6 +2887,17 @@ struct mem_cgroup *mem_cgroup_from_obj(void *p) page =virt_to_head_page (p); +/* +* If page->mem_cgroup is set, it's either a simple mem_cgroup pointer +* or a pointer to obj_cgroup vector. In the latter case the lowest +* bit of the pointer is set. +* The page->mem_cgroup pointer can be asynchronously changed +* from NULL to (obj_cgroup_vec | 0x1UL), but can't be changed +* from a valid memcg pointer to objcg vector or back. +*/ +if (!page->mem_cgroup) +return NULL ; +/* * Slab objects are accounted individually, not per-page. * Memcg membership data for each individual object is saved in
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 391/757 mm/memcg: fix device private memcg accounting
In reply to Greg Kroah-HartmanFrom: Ralph Campbell <[email protected]>
[ Upstream commit 9a137153fc8798a89d8fce895cd0a06ea5b8e37c ]
The code in mc_handle_swap_pte() checks for non_swap_entry() and returns NULL before checking is_device_private_entry() so device private pages are never handled. Fix this by checking for non_swap_entry() after handling device private swap PTEs.
I assume the memory cgroup accounting would be off somehow when moving a process to another memory cgroup. Currently, the device private page is charged like a normal anonymous page when allocated and is uncharged when the page is freed so I think that path is OK.
xFixes: c733a82874a7 ("mm/memcontrol: support MEMORY_DEVICE_PRIVATE")
--- mm/memcontrol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/memcontrol.c +4 -1
@@ -5511,7 +5511,7 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma,struct page *page =NULL ;swp_entry_t ent =pte_to_swp_entry (ptent); -if (!(mc.flags &MOVE_ANON ) ||non_swap_entry (ent)) +if (!(mc.flags &MOVE_ANON ))return NULL ;/*
@@ -5530,6 +5530,9 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma,return page; } +if (non_swap_entry (ent)) +return NULL ; +/* * Because lookup_swap_cache() updates some statistics counter, * we call find_get_page() with swapper_space directly.
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 392/757 mm/mmap.c: replace do_brk with do_brk_flags in comment of insert_vm_struct()
In reply to Greg Kroah-HartmanFrom: Liao Pingfang <[email protected]>
[ Upstream commit 8332326e8e47fbc35711433419c31f610153dd58 ]
Replace do_brk with do_brk_flags in comment of insert_vm_struct(), since do_brk was removed in following commit.
--- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mmap.c +1 -1
@@ -3227,7 +3227,7 @@ int insert_vm_struct(struct mm_struct *mm, struct vm_area_struct *vma)* By setting it to reflect the virtual start address of the * vma, merges and splits can happen in a seamless way, just * using the existing file pgoff checks and manipulations. -* Similarly in do_mmap and in do_brk. +* Similarly in do_mmap and in do_brk_flags. */ if (vma_is_anonymous (vma)) {BUG_ON (vma->anon_vma);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 393/757 mm/page_alloc.c: fix freeing non-compound pages
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit e320d3012d25b1fb5f3df4edb7bd44a1c362ec10 ]
Here is a very rare race which leaks memory:
Page P0 is allocated to the page cache. Page P1 is free.
Thread A Thread B Thread Cfind_get_entry():xas_load() returns P0
Removes P0 from page cache P0 finds its buddy P1
alloc_pages(GFP_KERNEL, 1) returns P0 P0 has refcount 1page_cache_get_speculative(P0)
P0 has refcount 2
__free_pages(P0) P0 has refcount 1
put_page(P0)
P1 is not freed
Fix this by freeing all the pages in __free_pages() that won't be freed by the call to put_page(). It's usually not a good idea to split a page, but this is a very unlikely scenario.
--- lib/Kconfig.debug | 9 +++++++++ lib/Makefile | 1 + lib/test_free_pages.c | 42 ++++++++++++++++++++++++++++++++++++++++++ mm/page_alloc.c | 3 +++ 4 files changed, 55 insertions(+) create mode 100644 lib/test_free_pages.c
lib/Kconfig.debug +9 -0
@@ -2367,6 +2367,15 @@ config TEST_HMM If unsure, say N. +config TEST_FREE_PAGES + tristate "Test freeing pages" + help + Test that a memory leak does not occur due to a race between + freeing a block of pages and a speculative page reference. + Loading this module is safe if your kernel has the bug fixed. + If the bug is not fixed, it will leak gigabytes of memory and + probably OOM your system. + config TEST_FPU tristate "Test floating point operations in kernel space" depends on X86 && !KCOV_INSTRUMENT_ALL
lib/Makefile +1 -0
@@ -99,6 +99,7 @@ obj-$(CONFIG_TEST_BLACKHOLE_DEV) += test_blackhole_dev.o obj-$(CONFIG_TEST_MEMINIT) += test_meminit.o obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o obj-$(CONFIG_TEST_HMM) += test_hmm.o +obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o # # CFLAGS for compiling floating point code inside the kernel. x86/Makefile turns
lib/test_free_pages.c new file +42 -0
42 lines not on this page · raw message
mm/page_alloc.c +3 -0
@@ -4961,6 +4961,9 @@ void __free_pages(struct page *page, unsigned int order) {if (put_page_testzero (page))free_the_page (page, order); +else if (!PageHead (page)) +while (order-- >0 ) +free_the_page (page + (1 << order), order); }EXPORT_SYMBOL (__free_pages);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 394/757 mm, oom_adj: dont loop through tasks in __set_oom_adj when not necessary
In reply to Greg Kroah-HartmanFrom: Suren Baghdasaryan <[email protected]>
[ Upstream commit 67197a4f28d28d0b073ab0427b03cb2ee5382578 ]
Currently __set_oom_adj loops through all processes in the system to keep oom_score_adj and oom_score_adj_min in sync between processes sharing their mm. This is done for any task with more that one mm_users, which includes processes with multiple threads (sharing mm and signals). However for such processes the loop is unnecessary because their signal structure is shared as well.
Android updates oom_score_adj whenever a tasks changes its role (background/foreground/...) or binds to/unbinds from a service, making it more/less important. Such operation can happen frequently. We noticed that updates to oom_score_adj became more expensive and after further investigation found out that the patch mentioned in "Fixes" introduced a regression. Using Pixel 4 with a typical Android workload, write time to oom_score_adj increased from ~3.57us to ~362us. Moreover this regression linearly depends on the number of multi-threaded processes running on the system.
Mark the mm with a new MMF_MULTIPROCESS flag bit when task is created with (CLONE_VM && !CLONE_THREAD && !CLONE_VFORK). Change __set_oom_adj to use MMF_MULTIPROCESS instead of mm_users to decide whether oom_score_adj update should be synchronized between multiple processes. To prevent races between clone() and __set_oom_adj(), when oom_score_adj of the process being cloned might be modified from userspace, we use oom_adj_mutex. Its scope is changed to global.
The combination of (CLONE_VM && !CLONE_THREAD) is rarely used except for the case of vfork(). To prevent performance regressions of vfork(), we skip taking oom_adj_mutex and setting MMF_MULTIPROCESS when CLONE_VFORK is specified. Clearing the MMF_MULTIPROCESS flag (when the last process sharing the mm exits) is left out of this patch to keep it simple and because it is believed that this threading model is rare. Should there ever be a need for optimizing that case as well, it can be done by hooking into the exit path, likely following the mm_update_next_owner pattern.
With the combination of (CLONE_VM && !CLONE_THREAD && !CLONE_VFORK) being quite rare, the regression is gone after the change is applied.
--- fs/proc/base.c | 3 +-- include/linux/oom.h | 1 + include/linux/sched/coredump.h | 1 + kernel/fork.c | 21 +++++++++++++++++++++ mm/oom_kill.c | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-)
fs/proc/base.c +1 -2
@@ -1055,7 +1055,6 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,static int __set_oom_adj (struct file *file,int oom_adj,bool legacy) { -static DEFINE_MUTEX (oom_adj_mutex);struct mm_struct *mm =NULL ;struct task_struct *task;int err =0 ;
@@ -1095,7 +1094,7 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)struct task_struct *p =find_lock_task_mm (task);if (p) { -if (atomic_read (&p->mm->mm_users) >1 ) { +if (test_bit (MMF_MULTIPROCESS , &p->mm->flags)) { mm = p->mm;mmgrab (mm); }
include/linux/oom.h +1 -0
@@ -55,6 +55,7 @@ struct oom_control { };extern struct mutex oom_lock; +extern struct mutex oom_adj_mutex;static inline void set_current_oom_origin (void ) {
include/linux/sched/coredump.h +1 -0
@@ -72,6 +72,7 @@ static inline int get_dumpable(struct mm_struct *mm)#define MMF_DISABLE_THP 24/* disable THP for all VMAs */ #define MMF_OOM_VICTIM 25/* mm is the oom victim */ #define MMF_OOM_REAP_QUEUED 26/* mm was queued for oom_reaper */ +#define MMF_MULTIPROCESS 27/* mm is shared between processes */ #define MMF_DISABLE_THP_MASK (1 << MMF_DISABLE_THP)#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\
kernel/fork.c +21 -0
@@ -1810,6 +1810,25 @@ static __always_inline void delayed_free_task(struct task_struct *tsk)free_task (tsk); } +static void copy_oom_score_adj (u64 clone_flags,struct task_struct *tsk) +{ +/* Skip if kernel thread */ +if (!tsk->mm) +return ; + +/* Skip if spawning a thread or using vfork */ +if ((clone_flags & (CLONE_VM |CLONE_THREAD |CLONE_VFORK )) !=CLONE_VM ) +return ; + +/* We need to synchronize with __set_oom_adj */ +mutex_lock (&oom_adj_mutex); +set_bit (MMF_MULTIPROCESS , &tsk->mm->flags); +/* Update the values in case they were changed after copy_signal */ + tsk->signal->oom_score_adj = current->signal->oom_score_adj; + tsk->signal->oom_score_adj_min = current->signal->oom_score_adj_min; +mutex_unlock (&oom_adj_mutex); +} +/* * This creates a new process as a copy of the old one, * but does not actually start it yet.
@@ -2282,6 +2301,8 @@ static __latent_entropy struct task_struct *copy_process(trace_task_newtask (p, clone_flags);uprobe_copy_process (p, clone_flags); +copy_oom_score_adj (clone_flags, p); +return p; bad_fork_cancel_cgroup:
mm/oom_kill.c +2 -0
@@ -64,6 +64,8 @@ int sysctl_oom_dump_tasks = 1;* and mark_oom_victim */ DEFINE_MUTEX (oom_lock); +/* Serializes oom_score_adj and oom_score_adj_min updates */ +DEFINE_MUTEX (oom_adj_mutex);static inline bool is_memcg_oom (struct oom_control *oc) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 395/757 fs: fix NULL dereference due to data race in prepend_path()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 09cad07547445bf3a41683e4d3abcd154c123ef5 ]
Fix data race in prepend_path() with re-reading mnt->mnt_ns twice without holding the lock.
is_mounted() does check for NULL, but is_anon_ns(mnt->mnt_ns) might re-read the pointer again which could be NULL already, if in between reads one of kern_unmount()/kern_unmount_array()/umount_tree() sets mnt->mnt_ns to NULL.
This is seen in production with the following stack trace:
BUG: kernel NULL pointer dereference, address: 0000000000000048
...
RIP: 0010:prepend_path.isra.4+0x1ce/0x2e0
Call Trace:
d_path+0xe6/0x150
proc_pid_readlink+0x8f/0x100
vfs_readlink+0xf8/0x110
do_readlinkat+0xfd/0x120
__x64_sys_readlinkat+0x1a/0x20
do_syscall_64+0x42/0x110
entry_SYSCALL_64_after_hwframe+0x44/0xa9--- fs/d_path.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/d_path.c +5 -1
@@ -102,6 +102,8 @@ static int prepend_path(const struct path *path,if (dentry == vfsmnt->mnt_root ||IS_ROOT (dentry)) {struct mount *parent =READ_ONCE (mnt->mnt_parent); +struct mnt_namespace *mnt_ns; +/* Escaped? */ if (dentry != vfsmnt->mnt_root) { bptr = *buffer;
@@ -116,7 +118,9 @@ static int prepend_path(const struct path *path, vfsmnt = &mnt->mnt;continue ; } -if (is_mounted (vfsmnt) && !is_anon_ns (mnt->mnt_ns)) + mnt_ns =READ_ONCE (mnt->mnt_ns); +/* open-coded is_mounted() to use local mnt_ns */ +if (!IS_ERR_OR_NULL (mnt_ns) && !is_anon_ns (mnt_ns)) error =1 ;// absolute root else error =2 ;// detached or not attached yet
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 396/757 selftests/ftrace: Change synthetic event name for inter-event-combined test
In reply to Greg Kroah-HartmanFrom: Tom Zanussi <[email protected]>
[ Upstream commit 96378b2088faea68f1fb05ea6b9a566fc569a44c ]
This test uses waking+wakeup_latency as an event name, which doesn't make sense since it includes an operator. Illegal names are now detected by the synthetic event command parsing, which causes this test to fail. Change the name to 'waking_plus_wakeup_latency' to prevent this.
--- .../inter-event/trigger-inter-event-combined-hist.tc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-inter-event-combined-hist.tc +4 -4
@@ -25,12 +25,12 @@ echo 'wakeup_latency u64 lat pid_t pid' >> synthetic_events echo 'hist:keys=pid:ts1=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts1:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid) if next_comm=="ping"' > events/sched/sched_switch/trigger -echo 'waking+wakeup_latency u64 lat; pid_t pid' >> synthetic_events -echo 'hist:keys=pid,lat:sort=pid,lat:ww_lat=$waking_lat+$wakeup_lat:onmatch(synthetic.wakeup_latency).waking+wakeup_latency($ww_lat,pid)' >> events/synthetic/wakeup_latency/trigger -echo 'hist:keys=pid,lat:sort=pid,lat' >> events/synthetic/waking+wakeup_latency/trigger +echo 'waking_plus_wakeup_latency u64 lat; pid_t pid' >> synthetic_events +echo 'hist:keys=pid,lat:sort=pid,lat:ww_lat=$waking_lat+$wakeup_lat:onmatch(synthetic.wakeup_latency).waking_plus_wakeup_latency($ww_lat,pid)' >> events/synthetic/wakeup_latency/trigger +echo 'hist:keys=pid,lat:sort=pid,lat' >> events/synthetic/waking_plus_wakeup_latency/trigger ping $LOCALHOST -c 3 -if ! grep -q "pid:" events/synthetic/waking+wakeup_latency/hist; then +if ! grep -q "pid:" events/synthetic/waking_plus_wakeup_latency/hist; then fail "Failed to create combined histogram" fi
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 397/757 tracing: Handle synthetic event array field type checking correctly
In reply to Greg Kroah-HartmanFrom: Tom Zanussi <[email protected]>
[ Upstream commit 10819e25799aae564005b6049a45e9808797b3bb ]
Since synthetic event array types are derived from the field name, there may be a semicolon at the end of the type which should be stripped off.
If there are more characters following that, normal type string checking will result in an invalid type.
Without this patch, you can end up with an invalid field type string that gets displayed in both the synthetic event description and the event format:
Before:
# echo 'myevent char str[16]; int v' >> synthetic_events
# cat synthetic_events
myevent char[16]; str; int v name: myevent
ID: 1936
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:char str[16];; offset:8; size:16; signed:1; field:int v; offset:40; size:4; signed:1;
print fmt: "str=%s, v=%d", REC->str, REC->v
After:
# echo 'myevent char str[16]; int v' >> synthetic_events
# cat synthetic_events
myevent char[16] str; int v# cat events/synthetic/myevent/format name: myevent ID: 1936 format: field:unsigned short common_type; offset:0; size:2; signed:0; field:unsigned char common_flags; offset:2; size:1; signed:0; field:unsigned char common_preempt_count; offset:3; size:1; signed:0; field:int common_pid; offset:4; size:4; signed:1;
field:char str[16]; offset:8; size:16; signed:1; field:int v; offset:40; size:4; signed:1;
print fmt: "str=%s, v=%d", REC->str, REC->v
--- kernel/trace/trace_events_synth.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kernel/trace/trace_events_synth.c +9 -3
@@ -132,7 +132,7 @@ static int synth_field_string_size(char *type) start +=sizeof ("char[" ) -1 ; end =strchr (type,']' ); -if (!end || end < start) +if (!end || end < start || type +strlen (type) > end +1 )return -EINVAL ; len = end - start;
@@ -502,8 +502,14 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,if (field_type[0 ] ==';' ) field_type++; len =strlen (field_type) +1 ; -if (array) - len +=strlen (array); + +if (array) { +int l =strlen (array); + +if (l && array[l -1 ] ==';' ) + l--; + len += l; + }if (prefix) len +=strlen (prefix);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 398/757 i3c: master add i3c_master_attach_boardinfo to preserve boardinfo
In reply to Greg Kroah-HartmanFrom: Parshuram Thombare <[email protected]>
[ Upstream commit 9da36a7ec42135428e1d41621e3703429bda3b2e ]
Boardinfo was lost if I3C object for devices with boardinfo available are not created or not added to the I3C device list because of some failure e.g. SETDASA failed, retrieve info failed etc This patch adds i3c_master_attach_boardinfo which scan boardinfo list in the master object and 'attach' it to the I3C device object.
--- drivers/i3c/master.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/i3c/master.c +17 -2
@@ -1782,6 +1782,21 @@ static void i3c_master_bus_cleanup(struct i3c_master_controller *master)i3c_master_detach_free_devs (master); } +static void i3c_master_attach_boardinfo (struct i3c_dev_desc *i3cdev) +{ +struct i3c_master_controller *master = i3cdev->common.master; +struct i3c_dev_boardinfo *i3cboardinfo; + +list_for_each_entry (i3cboardinfo, &master->boardinfo.i3c, node) { +if (i3cdev->info.pid != i3cboardinfo->pid) +continue ; + + i3cdev->boardinfo = i3cboardinfo; + i3cdev->info.static_addr = i3cboardinfo->static_addr; +return ; + } +} +static struct i3c_dev_desc *i3c_master_search_i3c_dev_duplicate (struct i3c_dev_desc *refdev) {
@@ -1837,10 +1852,10 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,if (ret) goto err_detach_dev; +i3c_master_attach_boardinfo (newdev); + olddev =i3c_master_search_i3c_dev_duplicate (newdev);if (olddev) { - newdev->boardinfo = olddev->boardinfo; - newdev->info.static_addr = olddev->info.static_addr; newdev->dev = olddev->dev;if (newdev->dev) newdev->dev->desc = newdev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 399/757 IB/mlx4: Fix starvation in paravirt mux/demux
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit 7fd1507df7cee9c533f38152fcd1dd769fcac6ce ]
The mlx4 driver will proxy MAD packets through the PF driver. A VM or an instantiated VF will send its MAD packets to the PF driver using loop-back. The PF driver will be informed by an interrupt, but defer the handling and polling of CQEs to a worker thread running on an ordered work-queue.
Consider the following scenario: the VMs will in short proximity in time, for example due to a network event, send many MAD packets to the PF driver. Lets say there are K VMs, each sending N packets.
The interrupt from the first VM will start the worker thread, which will poll N CQEs. A common case here is where the PF driver will multiplex the packets received from the VMs out on the wire QP.
But before the wire QP has returned a send CQE and associated interrupt, the other K - 1 VMs have sent their N packets as well.
The PF driver has to multiplex K * N packets out on the wire QP. But the send-queue on the wire QP has a finite capacity.
So, in this scenario, if K * N is larger than the send-queue capacity of the wire QP, we will get MAD packets dropped on the floor with this dynamic debug message:
mlx4_ib_multiplex_mad: failed sending GSI to wire on behalf of slave 2 (-11)
and this despite the fact that the wire send-queue could have capacity, but the PF driver isn't aware, because the wire send CQEs have not yet been polled.
We can also have a similar scenario inbound, with a wire recv-queue larger than the tunnel QP's send-queue. If many remote peers send MAD packets to the very same VM, the tunnel send-queue destined to the VM could allegedly be construed to be full by the PF driver.
This starvation is fixed by introducing separate work queues for the wire QPs vs. the tunnel QPs.
With this fix, using a dual ported HCA, 8 VFs instantiated, we could run cmtime on each of the 18 interfaces towards a similar configured peer, each cmtime instance with 800 QPs (all in all 14400 QPs) without a single CM packet getting lost.
--- drivers/infiniband/hw/mlx4/mad.c | 34 +++++++++++++++++++++++++--- drivers/infiniband/hw/mlx4/mlx4_ib.h | 2 ++ 2 files changed, 33 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx4/mad.c +31 -3
@@ -1299,6 +1299,18 @@ static void mlx4_ib_tunnel_comp_handler(struct ib_cq *cq, void *arg)spin_unlock_irqrestore (&dev->sriov.going_down_lock, flags); } +static void mlx4_ib_wire_comp_handler (struct ib_cq *cq,void *arg) +{ +unsigned long flags; +struct mlx4_ib_demux_pv_ctx *ctx = cq->cq_context; +struct mlx4_ib_dev *dev =to_mdev (ctx->ib_dev); + +spin_lock_irqsave (&dev->sriov.going_down_lock, flags); +if (!dev->sriov.is_going_down && ctx->state ==DEMUX_PV_STATE_ACTIVE ) +queue_work (ctx->wi_wq, &ctx->work); +spin_unlock_irqrestore (&dev->sriov.going_down_lock, flags); +} +static int mlx4_ib_post_pv_qp_buf (struct mlx4_ib_demux_pv_ctx *ctx,struct mlx4_ib_demux_pv_qp *tun_qp,int index)
@@ -2001,7 +2013,8 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port, cq_size *=2 ; cq_attr.cqe = cq_size; - ctx->cq =ib_create_cq (ctx->ib_dev, mlx4_ib_tunnel_comp_handler, + ctx->cq =ib_create_cq (ctx->ib_dev, + create_tun ? mlx4_ib_tunnel_comp_handler : mlx4_ib_wire_comp_handler,NULL , ctx, &cq_attr);if (IS_ERR (ctx->cq)) { ret =PTR_ERR (ctx->cq);
@@ -2038,6 +2051,7 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port,INIT_WORK (&ctx->work, mlx4_ib_sqp_comp_worker); ctx->wq =to_mdev (ibdev)->sriov.demux[port -1 ].wq; + ctx->wi_wq =to_mdev (ibdev)->sriov.demux[port -1 ].wi_wq; ret =ib_req_notify_cq (ctx->cq,IB_CQ_NEXT_COMP );if (ret) {
@@ -2181,7 +2195,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, goto err_mcg; } -snprintf (name,sizeof name,"mlx4_ibt%d" , port); +snprintf (name,sizeof (name),"mlx4_ibt%d" , port); ctx->wq =alloc_ordered_workqueue (name,WQ_MEM_RECLAIM );if (!ctx->wq) {pr_err ("Failed to create tunnelling WQ for port %d\n" , port);
@@ -2189,7 +2203,15 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, goto err_wq; } -snprintf (name,sizeof name,"mlx4_ibud%d" , port); +snprintf (name,sizeof (name),"mlx4_ibwi%d" , port); + ctx->wi_wq =alloc_ordered_workqueue (name,WQ_MEM_RECLAIM ); +if (!ctx->wi_wq) { +pr_err ("Failed to create wire WQ for port %d\n" , port); + ret = -ENOMEM ; + goto err_wiwq; + } + +snprintf (name,sizeof (name),"mlx4_ibud%d" , port); ctx->ud_wq =alloc_ordered_workqueue (name,WQ_MEM_RECLAIM );if (!ctx->ud_wq) {pr_err ("Failed to create up/down WQ for port %d\n" , port);
@@ -2200,6 +2222,10 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,return 0 ; err_udwq: +destroy_workqueue (ctx->wi_wq); + ctx->wi_wq =NULL ; + +err_wiwq:destroy_workqueue (ctx->wq); ctx->wq =NULL ;
@@ -2247,12 +2273,14 @@ static void mlx4_ib_free_demux_ctx(struct mlx4_ib_demux_ctx *ctx) ctx->tun[i]->state =DEMUX_PV_STATE_DOWNING ; }flush_workqueue (ctx->wq); +flush_workqueue (ctx->wi_wq);for (i =0 ; i < dev->dev->caps.sqp_demux; i++) {destroy_pv_resources (dev, i, ctx->port, ctx->tun[i],0 );free_pv_object (dev, i, ctx->port); }kfree (ctx->tun);destroy_workqueue (ctx->ud_wq); +destroy_workqueue (ctx->wi_wq);destroy_workqueue (ctx->wq); } }
drivers/infiniband/hw/mlx4/mlx4_ib.h +2 -0
@@ -454,6 +454,7 @@ struct mlx4_ib_demux_pv_ctx {struct ib_pd *pd;struct work_struct work;struct workqueue_struct *wq; +struct workqueue_struct *wi_wq;struct mlx4_ib_demux_pv_qp qp[2 ]; };
@@ -461,6 +462,7 @@ struct mlx4_ib_demux_ctx {struct ib_device *ib_dev;int port;struct workqueue_struct *wq; +struct workqueue_struct *wi_wq;struct workqueue_struct *ud_wq;spinlock_t ud_lock;atomic64_t subnet_prefix;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 400/757 IB/mlx4: Adjust delayed work when a dup is observed
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit 785167a114855c5aa75efca97000e405c2cc85bf ]
When scheduling delayed work to clean up the cache, if the entry already has been scheduled for deletion, we adjust the delay.
--- drivers/infiniband/hw/mlx4/cm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/mlx4/cm.c +3 -0
@@ -280,6 +280,9 @@ static void schedule_delayed(struct ib_device *ibdev, struct id_map_entry *id)if (!sriov->is_going_down && !id->scheduled_delete) { id->scheduled_delete =1 ;schedule_delayed_work (&id->timeout,CM_CLEANUP_CACHE_TIMEOUT ); + }else if (id->scheduled_delete) { +/* Adjust timeout if already scheduled */ +mod_delayed_work (system_wq, &id->timeout,CM_CLEANUP_CACHE_TIMEOUT ); }spin_unlock_irqrestore (&sriov->going_down_lock, flags);spin_unlock (&sriov->id_map_lock);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 401/757 powerpc/pseries: Fix missing of_node_put() in rng_init()
In reply to Greg Kroah-HartmanFrom: Nicholas Mc Guire <[email protected]>
[ Upstream commit 67c3e59443f5fc77be39e2ce0db75fbfa78c7965 ]
The call to of_find_compatible_node() returns a node pointer with refcount incremented thus it must be explicitly decremented here before returning.
--- arch/powerpc/platforms/pseries/rng.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/pseries/rng.c +1 -0
@@ -36,6 +36,7 @@ static __init int rng_init(void) ppc_md.get_random_seed = pseries_get_random_long; +of_node_put (dn);return 0 ; }machine_subsys_initcall (pseries, rng_init);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 402/757 powerpc/icp-hv: Fix missing of_node_put() in success path
In reply to Greg Kroah-HartmanFrom: Nicholas Mc Guire <[email protected]>
[ Upstream commit d3e669f31ec35856f5e85df9224ede5bdbf1bc7b ]
Both of_find_compatible_node() and of_find_node_by_type() will return a refcounted node on success - thus for the success path the node must be explicitly released with a of_node_put().
--- arch/powerpc/sysdev/xics/icp-hv.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/sysdev/xics/icp-hv.c +1 -0
@@ -174,6 +174,7 @@ int icp_hv_init(void) icp_ops = &icp_hv_ops; +of_node_put (np);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 403/757 rcu/tree: Force quiescent state on callback overload
In reply to Greg Kroah-HartmanFrom: Neeraj Upadhyay <[email protected]>
[ Upstream commit 9c39245382de4d52a122641952900709d4a9950b ]
On callback overload, it is necessary to quickly detect idle CPUs, and rcu_gp_fqs_check_wake() checks for this condition. Unfortunately, the code following the call to this function does not repeat this check, which means that in reality no actual quiescent-state forcing, instead only a couple of quick and pointless wakeups at the beginning of the grace period.
This commit therefore adds a check for the RCU_GP_FLAG_OVLD flag in the post-wakeup "if" statement in rcu_gp_fqs_loop().
--- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
@@ -1898,7 +1898,7 @@ static void rcu_gp_fqs_loop(void)break ;/* If time for quiescent-state forcing, do it. */ if (!time_after (rcu_state.jiffies_force_qs, jiffies) || - (gf &RCU_GP_FLAG_FQS )) { + (gf & (RCU_GP_FLAG_FQS |RCU_GP_FLAG_OVLD ))) {trace_rcu_grace_period (rcu_state.name, rcu_state.gp_seq,TPS ("fqsstart" ));rcu_gp_fqs (first_gp_fqs);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 404/757 rcutorture: Properly set rcu_fwds for OOM handling
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit c8fa63714763b7795a3f5fb7ed6d000763e6dccc ]
The conversion of rcu_fwds to dynamic allocation failed to actually allocate the required structure. This commit therefore allocates it, frees it, and updates rcu_fwds accordingly. While in the area, it abstracts the cleanup actions into rcu_torture_fwd_prog_cleanup().
--- kernel/rcu/rcutorture.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
kernel/rcu/rcutorture.c +12 -1
@@ -2160,9 +2160,20 @@ static int __init rcu_torture_fwd_prog_init(void)return -ENOMEM ;spin_lock_init (&rfp->rcu_fwd_lock); rfp->rcu_fwd_cb_tail = &rfp->rcu_fwd_cb_head; + rcu_fwds = rfp;return torture_create_kthread (rcu_torture_fwd_prog, rfp, fwd_prog_task); } +static void rcu_torture_fwd_prog_cleanup (void ) +{ +struct rcu_fwd *rfp; + +torture_stop_kthread (rcu_torture_fwd_prog, fwd_prog_task); + rfp = rcu_fwds; + rcu_fwds =NULL ; +kfree (rfp); +} +/* Callback function for RCU barrier testing. */ static void rcu_torture_barrier_cbf (struct rcu_head *rcu) {
@@ -2460,7 +2471,7 @@ rcu_torture_cleanup(void)show_rcu_gp_kthreads ();rcu_torture_read_exit_cleanup ();rcu_torture_barrier_cleanup (); -torture_stop_kthread (rcu_torture_fwd_prog, fwd_prog_task); +rcu_torture_fwd_prog_cleanup ();torture_stop_kthread (rcu_torture_stall, stall_task);torture_stop_kthread (rcu_torture_writer, writer_task);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 405/757 refperf: Avoid null pointer dereference when buf fails to allocate
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 58db5785b0d76be4582a32a7900acce88e691d36 ]
Currently in the unlikely event that buf fails to be allocated it is dereferenced a few times. Use the errexit flag to determine if buf should be written to to avoid the null pointer dereferences.
Addresses-Coverity: ("Dereference after null check")
--- kernel/rcu/refscale.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/rcu/refscale.c +5 -3
@@ -546,9 +546,11 @@ static int main_func(void *arg)// Print the average of all experiments SCALEOUT ("END OF TEST. Calculating average duration per loop (nanoseconds)...\n" ); - buf[0 ] =0 ; -strcat (buf,"\n" ); -strcat (buf,"Runs\tTime(ns)\n" ); +if (!errexit) { + buf[0 ] =0 ; +strcat (buf,"\n" ); +strcat (buf,"Runs\tTime(ns)\n" ); + }for (exp =0 ; exp < nruns; exp++) {u64 avg;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 406/757 RDMA/ucma: Fix locking for ctx->events_reported
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 98837c6c3d7285f6eca86480b6f7fac6880e27a8 ]
This value is locked under the file->mut, ensure it is held whenever touching it.
The case in ucma_migrate_id() is a race, while in ucma_free_uctx() it is already not possible for the write side to run, the movement is just for clarity.
--- drivers/infiniband/core/ucma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +3 -1
@@ -586,6 +586,7 @@ static int ucma_free_ctx(struct ucma_context *ctx)list_move_tail (&uevent->list, &list); }list_del (&ctx->list); + events_reported = ctx->events_reported;mutex_unlock (&ctx->file->mut);list_for_each_entry_safe (uevent, tmp, &list, list) {
@@ -595,7 +596,6 @@ static int ucma_free_ctx(struct ucma_context *ctx)kfree (uevent); } - events_reported = ctx->events_reported;mutex_destroy (&ctx->mutex);kfree (ctx);return events_reported;
@@ -1678,7 +1678,9 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file, cur_file = ctx->file;if (cur_file == new_file) { +mutex_lock (&cur_file->mut); resp.events_reported = ctx->events_reported; +mutex_unlock (&cur_file->mut); goto response; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 407/757 RDMA/ucma: Add missing locking around rdma_leave_multicast()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 38e03d092699891c3237b5aee9e8029d4ede0956 ]
All entry points to the rdma_cm from a ULP must be single threaded, even this error unwinds. Add the missing locking.
--- drivers/infiniband/core/ucma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/ucma.c +2 -0
@@ -1512,7 +1512,9 @@ static ssize_t ucma_process_join(struct ucma_file *file,return 0 ; err3: +mutex_lock (&ctx->mutex);rdma_leave_multicast (ctx->cm_id, (struct sockaddr *) &mc->addr); +mutex_unlock (&ctx->mutex);ucma_cleanup_mc_events (mc); err2:xa_erase (&multicast_table, mc->id);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 408/757 mtd: lpddr: fix excessive stack usage with clang
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 3e1b6469f8324bee5927b063e2aca30d3e56b907 ]
Building lpddr2_nvm with clang can result in a giant stack usage in one function:
drivers/mtd/lpddr/lpddr2_nvm.c:399:12: error: stack frame size of 1144 bytes in function 'lpddr2_nvm_probe' [-Werror,-Wframe-larger-than=]
The problem is that clang decides to build a copy of the mtd_info structure on the stack and then do a memcpy() into the actual version. It shouldn't really do it that way, but it's not strictly a bug either.
As a workaround, use a static const version of the structure to assign most of the members upfront and then only set the few members that require runtime knowledge at probe time.
--- drivers/mtd/lpddr/lpddr2_nvm.c | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
drivers/mtd/lpddr/lpddr2_nvm.c +19 -16
@@ -393,6 +393,17 @@ static int lpddr2_nvm_lock(struct mtd_info *mtd, loff_t start_add,return lpddr2_nvm_do_block_op (mtd, start_add, len,LPDDR2_NVM_LOCK ); } +static const struct mtd_info lpddr2_nvm_mtd_info = { + .type =MTD_RAM , + .writesize =1 , + .flags = (MTD_CAP_NVRAM |MTD_POWERUP_LOCK ), + ._read = lpddr2_nvm_read, + ._write = lpddr2_nvm_write, + ._erase = lpddr2_nvm_erase, + ._unlock = lpddr2_nvm_unlock, + ._lock = lpddr2_nvm_lock, +}; +/* * lpddr2_nvm driver probe method */
@@ -433,6 +444,7 @@ static int lpddr2_nvm_probe(struct platform_device *pdev) .pfow_base = OW_BASE_ADDRESS, .fldrv_priv = pcm_data, }; +if (IS_ERR (map->virt))return PTR_ERR (map->virt);
@@ -444,22 +456,13 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)return PTR_ERR (pcm_data->ctl_regs);/* Populate mtd_info data structure */ - *mtd = (struct mtd_info ) { - .dev = { .parent = &pdev->dev }, - .name = pdev->dev.init_name, - .type =MTD_RAM , - .priv = map, - .size =resource_size (add_range), - .erasesize =ERASE_BLOCKSIZE * pcm_data->bus_width, - .writesize =1 , - .writebufsize =WRITE_BUFFSIZE * pcm_data->bus_width, - .flags = (MTD_CAP_NVRAM |MTD_POWERUP_LOCK ), - ._read = lpddr2_nvm_read, - ._write = lpddr2_nvm_write, - ._erase = lpddr2_nvm_erase, - ._unlock = lpddr2_nvm_unlock, - ._lock = lpddr2_nvm_lock, - }; + *mtd = lpddr2_nvm_mtd_info; + mtd->dev.parent = &pdev->dev; + mtd->name = pdev->dev.init_name; + mtd->priv = map; + mtd->size =resource_size (add_range); + mtd->erasesize =ERASE_BLOCKSIZE * pcm_data->bus_width; + mtd->writebufsize =WRITE_BUFFSIZE * pcm_data->bus_width;/* Verify the presence of the device looking for PFOW string */ if (!lpddr2_nvm_pfow_present (map)) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 409/757 RDMA/hns: Add a check for current state before modifying QP
In reply to Greg Kroah-HartmanFrom: Lang Cheng <[email protected]>
[ Upstream commit e0ef0f68c4c0d85b1eb63f38d5d10324361280e8 ]
It should be considered an illegal operation if the ULP attempts to modify a QP from another state to the current hardware state. Otherwise, the ULP can modify some fields of QPC at any time. For example, for a QP in state of RTS, modify it from RTR to RTS can change the PSN, which is always not as expected.
--- drivers/infiniband/hw/hns/hns_roce_qp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_qp.c +4 -2
@@ -1161,8 +1161,10 @@ int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,mutex_lock (&hr_qp->mutex); - cur_state = attr_mask &IB_QP_CUR_STATE ? - attr->cur_qp_state : (enum ib_qp_state )hr_qp->state; +if (attr_mask &IB_QP_CUR_STATE && attr->cur_qp_state != hr_qp->state) + goto out; + + cur_state = hr_qp->state; new_state = attr_mask &IB_QP_STATE ? attr->qp_state : cur_state; if (ibqp->uobject &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 410/757 RDMA/umem: Fix signature of stub ib_umem_find_best_pgsz()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 61690d01db32eb1f94adc9ac2b8bb741d34e4671 ]
The original function returns unsigned long and 0 on failure.
--- include/rdma/ib_umem.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/rdma/ib_umem.h +5 -4
@@ -68,10 +68,11 @@ static inline int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offs size_t length) {return -EINVAL ; } -static inline int ib_umem_find_best_pgsz (struct ib_umem *umem, -unsigned long pgsz_bitmap, -unsigned long virt) { -return -EINVAL ; +static inline unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem, +unsigned long pgsz_bitmap, +unsigned long virt) +{ +return 0 ; }#endif /* CONFIG_INFINIBAND_USER_MEM */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 411/757 powerpc/pseries: explicitly reschedule during drmem_lmb list traversal
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit 9d6792ffe140240ae54c881cc4183f9acc24b4df ]
The drmem lmb list can have hundreds of thousands of entries, and unfortunately lookups take the form of linear searches. As long as this is the case, traversals have the potential to monopolize the CPU and provoke lockup reports, workqueue stalls, and the like unless they explicitly yield.
Rather than placing cond_resched() calls within various for_each_drmem_lmb() loop blocks in the code, put it in the iteration expression of the loop macro itself so users can't omit it.
Introduce a drmem_lmb_next() iteration helper function which calls cond_resched() at a regular interval during array traversal. Each iteration of the loop in DLPAR code paths can involve around ten RTAS calls which can each take up to 250us, so this ensures the check is performed at worst every few milliseconds.
--- arch/powerpc/include/asm/drmem.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/drmem.h +17 -1
@@ -8,6 +8,8 @@ #ifndef _ASM_POWERPC_LMB_H #define _ASM_POWERPC_LMB_H +#include <linux/sched.h> + struct drmem_lmb { u64 base_addr; u32 drc_index;
@@ -26,8 +28,22 @@ struct drmem_lmb_info {extern struct drmem_lmb_info *drmem_info; +static inline struct drmem_lmb *drmem_lmb_next (struct drmem_lmb *lmb, +const struct drmem_lmb *start) +{ +/* +* DLPAR code paths can take several milliseconds per element +* when interacting with firmware. Ensure that we don't +* unfairly monopolize the CPU. +*/ +if (((++lmb - start) %16 ) ==0 ) +cond_resched (); + +return lmb; +} +#define for_each_drmem_lmb_in_range (lmb, start, end) \ - for ((lmb) = (start); (lmb) < (end); (lmb)++) + for ((lmb) = (start); (lmb) < (end); lmb = drmem_lmb_next(lmb, start))#define for_each_drmem_lmb (lmb) \ for_each_drmem_lmb_in_range((lmb), \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 412/757 pseries/drmem: dont cache node id in drmem_lmb struct
In reply to Greg Kroah-HartmanFrom: Scott Cheloha <[email protected]>
[ Upstream commit e5e179aa3a39c818db8fbc2dce8d2cd24adaf657 ]
At memory hot-remove time we can retrieve an LMB's nid from its corresponding memory_block. There is no need to store the nid in multiple locations.
Note that lmb_to_memblock() uses find_memory_block() to get the corresponding memory_block. As find_memory_block() runs in sub-linear time this approach is negligibly slower than what we do at present.
In exchange for this lookup at hot-remove time we no longer need to call memory_add_physaddr_to_nid() during drmem_init() for each LMB. On powerpc, memory_add_physaddr_to_nid() is a linear search, so this spares us an O(n^2) initialization during boot.
On systems with many LMBs that initialization overhead is palpable and disruptive. For example, on a box with 249854 LMBs we're seeing drmem_init() take upwards of 30 seconds to complete:
[ 53.721639] drmem: initializing drmem v2 [ 80.604346] watchdog: BUG: soft lockup - CPU#65 stuck for 23s! [swapper/0:1] [ 80.604377] Modules linked in: [ 80.604389] CPU: 65 PID: 1 Comm: swapper/0 Not tainted 5.6.0-rc2+ #4 [ 80.604397] NIP: c0000000000a4980 LR: c0000000000a4940 CTR: 0000000000000000 [ 80.604407] REGS: c0002dbff8493830 TRAP: 0901 Not tainted (5.6.0-rc2+) [ 80.604412] MSR: 8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 44000248 XER: 0000000d [ 80.604431] CFAR: c0000000000a4a38 IRQMASK: 0 [ 80.604431] GPR00: c0000000000a4940 c0002dbff8493ac0 c000000001904400 c0003cfffffede30 [ 80.604431] GPR04: 0000000000000000 c000000000f4095a 000000000000002f 0000000010000000 [ 80.604431] GPR08: c0000bf7ecdb7fb8 c0000bf7ecc2d3c8 0000000000000008 c00c0002fdfb2001 [ 80.604431] GPR12: 0000000000000000 c00000001e8ec200 [ 80.604477] NIP [c0000000000a4980] hot_add_scn_to_nid+0xa0/0x3e0 [ 80.604486] LR [c0000000000a4940] hot_add_scn_to_nid+0x60/0x3e0 [ 80.604492] Call Trace: [ 80.604498] [c0002dbff8493ac0] [c0000000000a4940] hot_add_scn_to_nid+0x60/0x3e0 (unreliable) [ 80.604509] [c0002dbff8493b20] [c000000000087c10] memory_add_physaddr_to_nid+0x20/0x60 [ 80.604521] [c0002dbff8493b40] [c0000000010d4880] drmem_init+0x25c/0x2f0 [ 80.604530] [c0002dbff8493c10] [c000000000010154] do_one_initcall+0x64/0x2c0 [ 80.604540] [c0002dbff8493ce0] [c0000000010c4aa0] kernel_init_freeable+0x2d8/0x3a0 [ 80.604550] [c0002dbff8493db0] [c000000000010824] kernel_init+0x2c/0x148 [ 80.604560] [c0002dbff8493e20] [c00000000000b648] ret_from_kernel_thread+0x5c/0x74 [ 80.604567] Instruction dump: [ 80.604574] 392918e8 e9490000 e90a000a e92a0000 80ea000c 1d080018 3908ffe8 7d094214 [ 80.604586] 7fa94040 419d00dc e9490010 714a0088 <2faa0008> 409e00ac e9490000 7fbe5040 [ 89.047390] drmem: 249854 LMB(s)
With a patched kernel on the same machine we're no longer seeing the soft lockup. drmem_init() now completes in negligible time, even when the LMB count is large.
--- arch/powerpc/include/asm/drmem.h | 21 ---------------- arch/powerpc/mm/drmem.c | 6 +---- .../platforms/pseries/hotplug-memory.c | 24 ++++++++++++------- 3 files changed, 17 insertions(+), 34 deletions(-)
arch/powerpc/include/asm/drmem.h +0 -21
@@ -15,9 +15,6 @@ struct drmem_lmb {u32 drc_index;u32 aa_index;u32 flags; -#ifdef CONFIG_MEMORY_HOTPLUG -int nid; -#endif };struct drmem_lmb_info {
@@ -121,22 +118,4 @@ static inline void invalidate_lmb_associativity_index(struct drmem_lmb *lmb) lmb->aa_index = 0xffffffff; } -#ifdef CONFIG_MEMORY_HOTPLUG -static inline void lmb_set_nid (struct drmem_lmb *lmb) -{ - lmb->nid =memory_add_physaddr_to_nid (lmb->base_addr); -} -static inline void lmb_clear_nid (struct drmem_lmb *lmb) -{ - lmb->nid =-1 ; -} -#else -static inline void lmb_set_nid (struct drmem_lmb *lmb) -{ -} -static inline void lmb_clear_nid (struct drmem_lmb *lmb) -{ -} -#endif -#endif /* _ASM_POWERPC_LMB_H */
arch/powerpc/mm/drmem.c +1 -5
@@ -389,10 +389,8 @@ static void __init init_drmem_v1_lmbs(const __be32 *prop)if (!drmem_info->lmbs)return ; -for_each_drmem_lmb (lmb) { +for_each_drmem_lmb (lmb)read_drconf_v1_cell (lmb, &prop); -lmb_set_nid (lmb); - } }static void __init init_drmem_v2_lmbs (const __be32 *prop)
@@ -437,8 +435,6 @@ static void __init init_drmem_v2_lmbs(const __be32 *prop) lmb->aa_index = dr_cell.aa_index; lmb->flags = dr_cell.flags; - -lmb_set_nid (lmb); } } }
arch/powerpc/platforms/pseries/hotplug-memory.c +16 -8
@@ -354,25 +354,32 @@ static int dlpar_add_lmb(struct drmem_lmb *);static int dlpar_remove_lmb (struct drmem_lmb *lmb) { +struct memory_block *mem_block;unsigned long block_sz;int rc;if (!lmb_is_removable (lmb))return -EINVAL ; + mem_block =lmb_to_memblock (lmb); +if (mem_block ==NULL ) +return -EINVAL ; + rc =dlpar_offline_lmb (lmb); -if (rc) +if (rc) { +put_device (&mem_block->dev);return rc; + } block_sz =pseries_memory_block_size (); -__remove_memory (lmb->nid, lmb->base_addr, block_sz); +__remove_memory (mem_block->nid, lmb->base_addr, block_sz); +put_device (&mem_block->dev);/* Update memory regions for memory remove */ memblock_remove (lmb->base_addr, block_sz);invalidate_lmb_associativity_index (lmb); -lmb_clear_nid (lmb); lmb->flags &= ~DRCONF_MEM_ASSIGNED ;return 0 ;
@@ -591,7 +598,7 @@ static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index)static int dlpar_add_lmb (struct drmem_lmb *lmb) {unsigned long block_sz; -int rc; +int nid, rc;if (lmb->flags &DRCONF_MEM_ASSIGNED )return -EINVAL ;
@@ -602,11 +609,13 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)return rc; } -lmb_set_nid (lmb); block_sz =memory_block_size_bytes (); +/* Find the node id for this address. */ + nid =memory_add_physaddr_to_nid (lmb->base_addr); +/* Add the memory */ - rc =__add_memory (lmb->nid, lmb->base_addr, block_sz); + rc =__add_memory (nid, lmb->base_addr, block_sz);if (rc) {invalidate_lmb_associativity_index (lmb);return rc;
@@ -614,9 +623,8 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb) rc =dlpar_online_lmb (lmb);if (rc) { -__remove_memory (lmb->nid, lmb->base_addr, block_sz); +__remove_memory (nid, lmb->base_addr, block_sz);invalidate_lmb_associativity_index (lmb); -lmb_clear_nid (lmb); }else { lmb->flags |=DRCONF_MEM_ASSIGNED ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 413/757 RDMA/mlx5: Fix potential race between destroy and CQE poll
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 4b916ed9f9e85f705213ca8d69771d3c1cd6ee5a ]
The SRQ can be destroyed right before mlx5_cmd_get_srq is called. In such case the latter will return NULL instead of expected SRQ.
--- drivers/infiniband/hw/mlx5/cq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +3 -2
@@ -168,7 +168,7 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, {enum rdma_link_layer ll =rdma_port_get_link_layer (qp->ibqp.device,1 );struct mlx5_ib_dev *dev =to_mdev (qp->ibqp.device); -struct mlx5_ib_srq *srq; +struct mlx5_ib_srq *srq =NULL ;struct mlx5_ib_wq *wq;u16 wqe_ctr;u8 roce_packet_type;
@@ -180,7 +180,8 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,if (qp->ibqp.xrcd) { msrq =mlx5_cmd_get_srq (dev,be32_to_cpu (cqe->srqn)); - srq =to_mibsrq (msrq); +if (msrq) + srq =to_mibsrq (msrq); }else { srq =to_msrq (qp->ibqp.srq); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 414/757 mtd: mtdoops: Dont write panic data twice
In reply to Greg Kroah-HartmanFrom: Mark Tomlinson <[email protected]>
[ Upstream commit c1cf1d57d1492235309111ea6a900940213a9166 ]
If calling mtdoops_write, don't also schedule work to be done later.
Although this appears to not be causing an issue, possibly because the scheduled work will never get done, it is confusing.
--- drivers/mtd/mtdoops.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/mtd/mtdoops.c +6 -5
@@ -279,12 +279,13 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper,kmsg_dump_get_buffer (dumper, true, cxt->oops_buf +MTDOOPS_HEADER_SIZE , record_size -MTDOOPS_HEADER_SIZE ,NULL ); -/* Panics must be written immediately */ -if (reason !=KMSG_DUMP_OOPS ) +if (reason !=KMSG_DUMP_OOPS ) { +/* Panics must be written immediately */ mtdoops_write (cxt,1 ); - -/* For other cases, schedule work to write it "nicely" */ -schedule_work (&cxt->work_write); + }else { +/* For other cases, schedule work to write it "nicely" */ +schedule_work (&cxt->work_write); + } }static void mtdoops_notify_add (struct mtd_info *mtd)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 415/757 selftests/powerpc: Fix prefixes in alignment_handler signal handler
In reply to Greg Kroah-HartmanFrom: Jordan Niethe <[email protected]>
[ Upstream commit db96221a683342fd4775fd820a4d5376cd2f2ed0 ]
The signal handler in the alignment handler self test has the ability to jump over the instruction that triggered the signal. It does this by incrementing the PT_NIP in the user context by 4. If it were a prefixed instruction this will mean that the suffix is then executed which is incorrect. Instead check if the major opcode indicates a prefixed instruction (e.g. it is 1) and if so increment PT_NIP by 8.
If ISA v3.1 is not available treat it as a word instruction even if the major opcode is 1.
--- .../selftests/powerpc/alignment/alignment_handler.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/powerpc/alignment/alignment_handler.c +9 -1
@@ -64,6 +64,7 @@ int bufsize;int debug;int testing;volatile int gotsig; +bool prefixes_enabled;char *cipath ="/dev/fb0" ;long cioffset;
@@ -77,7 +78,12 @@ void sighandler(int sig, siginfo_t *info, void *ctx) } gotsig = sig;#ifdef __powerpc64__ - ucp->uc_mcontext.gp_regs[PT_NIP ] +=4 ; +if (prefixes_enabled) { +u32 inst = *(u32 *)ucp->uc_mcontext.gp_regs[PT_NIP ]; + ucp->uc_mcontext.gp_regs[PT_NIP ] += ((inst >>26 ==1 ) ?8 :4 ); + }else { + ucp->uc_mcontext.gp_regs[PT_NIP ] +=4 ; + }#else ucp->uc_mcontext.uc_regs->gregs[PT_NIP ] +=4 ;#endif
@@ -648,6 +654,8 @@ int main(int argc, char *argv[])exit (1 ); } + prefixes_enabled =have_hwcap2 (PPC_FEATURE2_ARCH_3_1 ); + rc |=test_harness (test_alignment_handler_vsx_206,"test_alignment_handler_vsx_206" ); rc |= test_harness(test_alignment_handler_vsx_207,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 416/757 perf tools: Make GTK2 support opt-in
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 4751bddd3f983af2004ec470ca38b42d7a8a53bc ]
This is bitrotting, nobody is stepping up to work on it, and since we treat warnings as errors, feature detection is failing in its main, faster test (tools/build/feature/test-all.c) because of the GTK+2 infobar check.
So make this opt-in, at some point ditch this if nobody volunteers to take care of this.
--- tools/build/Makefile.feature | 5 ++--- tools/build/feature/Makefile | 2 +- tools/build/feature/test-all.c | 10 ---------- tools/perf/Makefile.config | 4 +++- tools/perf/Makefile.perf | 6 +++--- tools/perf/builtin-version.c | 1 - 6 files changed, 9 insertions(+), 19 deletions(-)
tools/build/Makefile.feature +2 -3
@@ -38,8 +38,6 @@ FEATURE_TESTS_BASIC := \ get_current_dir_name \ gettid \ glibc \ - gtk2 \ - gtk2-infobar \ libbfd \ libcap \ libelf \
@@ -81,6 +79,8 @@ FEATURE_TESTS_EXTRA := \ compile-32 \ compile-x32 \ cplus-demangle \ + gtk2 \ + gtk2-infobar \ hello \ libbabeltrace \ libbfd-liberty \
@@ -111,7 +111,6 @@ FEATURE_DISPLAY ?= \ dwarf \ dwarf_getlocations \ glibc \ - gtk2 \ libbfd \ libcap \ libelf \
tools/build/feature/Makefile +1 -1
@@ -90,7 +90,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$( ############################### $(OUTPUT)test-all.bin: - $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma + $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma $(OUTPUT)test-hello.bin: $(BUILD)
tools/build/feature/test-all.c +0 -10
@@ -78,14 +78,6 @@# include "test-libslang.c" #undef main -#define main main_test_gtk2 -# include "test-gtk2.c" -#undef main - -#define main main_test_gtk2_infobar -# include "test-gtk2-infobar.c" -#undef main -#define main main_test_libbfd# include "test-libbfd.c" #undef main
@@ -205,8 +197,6 @@ int main(int argc, char *argv[])main_test_libelf_getshdrstrndx ();main_test_libunwind ();main_test_libslang (); -main_test_gtk2 (argc, argv); -main_test_gtk2_infobar (argc, argv);main_test_libbfd ();main_test_backtrace ();main_test_libnuma ();
tools/perf/Makefile.config +3 -1
@@ -724,12 +724,14 @@ ifndef NO_SLANG endif endif -ifndef NO_GTK2 +ifdef GTK2 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) + $(call feature_check,gtk2) ifneq ($(feature-gtk2), 1) msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); NO_GTK2 := 1 else + $(call feature_check,gtk2-infobar) ifeq ($(feature-gtk2-infobar), 1) GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT endif
tools/perf/Makefile.perf +3 -3
@@ -48,7 +48,7 @@ include ../scripts/utilities.mak # # Define NO_SLANG if you do not want TUI support. # -# Define NO_GTK2 if you do not want GTK+ GUI support. +# Define GTK2 if you want GTK+ GUI support. # # Define NO_DEMANGLE if you do not want C++ symbol demangling. #
@@ -386,7 +386,7 @@ ifneq ($(OUTPUT),) CFLAGS += -I$(OUTPUT) endif -ifndef NO_GTK2 +ifdef GTK2 ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so GTK_IN := $(OUTPUT)gtk-in.o endif
@@ -886,7 +886,7 @@ check: $(OUTPUT)common-cmds.h ### Installation rules -ifndef NO_GTK2 +ifdef GTK2 install-gtk: $(OUTPUT)libperf-gtk.so $(call QUIET_INSTALL, 'GTK UI') \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
tools/perf/builtin-version.c +0 -1
@@ -60,7 +60,6 @@ static void library_status(void)STATUS (HAVE_DWARF_SUPPORT , dwarf);STATUS (HAVE_DWARF_GETLOCATIONS_SUPPORT , dwarf_getlocations);STATUS (HAVE_GLIBC_SUPPORT , glibc); -STATUS (HAVE_GTK2_SUPPORT , gtk2);#ifndef HAVE_SYSCALL_TABLE_SUPPORT STATUS (HAVE_LIBAUDIT_SUPPORT , libaudit);#endif
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 417/757 tools feature: Add missing -lzstd to the fast path feature detection
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 6c014694b1d2702cdc736d17b60746e7b95ba664 ]
We were failing that due to GTK2+ and then for the ZSTD test, which made test-all.c, the fast path feature detection file to fail and thus trigger building all of the feature tests, slowing down the test.
Eventually the ZSTD test would be built and would succeed, since it had the needed -lzstd, avoiding:
$ cat /tmp/build/perf/feature/test-all.make.output /usr/bin/ld: /tmp/ccRRJQ4u.o: in function `main_test_libzstd': /home/acme/git/perf/tools/build/feature/test-libzstd.c:8: undefined reference to `ZSTD_createCStream' /usr/bin/ld: /home/acme/git/perf/tools/build/feature/test-libzstd.c:9: undefined reference to `ZSTD_freeCStream' collect2: error: ld returned 1 exit status $
Fix it by adding -lzstd to the test-all target.
Now I need an entry to 'perf test' to make sure that /tmp/build/perf/feature/test-all.make.output is empty...
--- tools/build/feature/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +1 -1
@@ -90,7 +90,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$( ############################### $(OUTPUT)test-all.bin: - $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma + $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd $(OUTPUT)test-hello.bin: $(BUILD)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 418/757 ARM: 9007/1: l2c: fix prefetch bits init in L2X0_AUX_CTRL using DT values
In reply to Greg Kroah-HartmanFrom: Guillaume Tucker <[email protected]>
[ Upstream commit 8e007b367a59bcdf484c81f6df9bd5a4cc179ca6 ]
The L310_PREFETCH_CTRL register bits 28 and 29 to enable data and instruction prefetch respectively can also be accessed via the L2X0_AUX_CTRL register. They appear to be actually wired together in hardware between the registers. Changing them in the prefetch register only will get undone when restoring the aux control register later on. For this reason, set these bits in both registers during initialisation according to the devicetree property values.
--- arch/arm/mm/cache-l2x0.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
arch/arm/mm/cache-l2x0.c +12 -4
@@ -1249,20 +1249,28 @@ static void __init l2c310_of_parse(const struct device_node *np, ret =of_property_read_u32 (np,"prefetch-data" , &val);if (ret ==0 ) { -if (val) +if (val) { prefetch |=L310_PREFETCH_CTRL_DATA_PREFETCH ; -else + *aux_val |=L310_PREFETCH_CTRL_DATA_PREFETCH ; + }else { prefetch &= ~L310_PREFETCH_CTRL_DATA_PREFETCH ; + *aux_val &= ~L310_PREFETCH_CTRL_DATA_PREFETCH ; + } + *aux_mask &= ~L310_PREFETCH_CTRL_DATA_PREFETCH ; }else if (ret != -EINVAL ) {pr_err ("L2C-310 OF prefetch-data property value is missing\n" ); } ret =of_property_read_u32 (np,"prefetch-instr" , &val);if (ret ==0 ) { -if (val) +if (val) { prefetch |=L310_PREFETCH_CTRL_INSTR_PREFETCH ; -else + *aux_val |=L310_PREFETCH_CTRL_INSTR_PREFETCH ; + }else { prefetch &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH ; + *aux_val &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH ; + } + *aux_mask &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH ; }else if (ret != -EINVAL ) {pr_err ("L2C-310 OF prefetch-instr property value is missing\n" ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 419/757 xfs: fix finobt btree block recovery ordering
In reply to Greg Kroah-HartmanFrom: Dave Chinner <[email protected]>
[ Upstream commit 671459676ab0e1d371c8d6b184ad1faa05b6941e ]
Nathan popped up on #xfs and pointed out that we fail to handle finobt btree blocks in xlog_recover_get_buf_lsn(). This means they always fall through the entire magic number matching code to "recover immediately". Whilst most of the time this is the correct behaviour, occasionally it will be incorrect and could potentially overwrite more recent metadata because we don't check the LSN in the on disk metadata at all.
This bug has been present since the finobt was first introduced, and is a potential cause of the occasional xfs_iget_check_free_state() failures we see that indicate that the inode btree state does not match the on disk inode state.
--- fs/xfs/xfs_buf_item_recover.c | 2 ++ 1 file changed, 2 insertions(+)
fs/xfs/xfs_buf_item_recover.c +2 -0
@@ -719,6 +719,8 @@ xlog_recover_get_buf_lsn(case XFS_ABTC_MAGIC :case XFS_RMAP_CRC_MAGIC :case XFS_REFC_CRC_MAGIC : +case XFS_FIBT_CRC_MAGIC : +case XFS_FIBT_MAGIC :case XFS_IBT_CRC_MAGIC :case XFS_IBT_MAGIC : {struct xfs_btree_block *btb = blk;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 420/757 m68knommu: include SDHC support only when hardware has it
In reply to Greg Kroah-HartmanFrom: Greg Ungerer <[email protected]>
[ Upstream commit 322c512f476f07e960cecd447ef22c15bed0e5f1 ]
The mere fact that the kernel has the MMC subsystem enabled (CONFIG_MMC enabled) does not mean that the underlying hardware platform has the SDHC hardware present. Within the ColdFire hardware defines that is signified by MCFSDHC_BASE being defined with an address.
The platform data for the ColdFire parts is including the SDHC hardware if CONFIG_MMC is enabled, instead of MCFSDHC_BASE. This means that if you are compiling for a ColdFire target that does not support SDHC but enable CONFIG_MMC you will fail to compile with errors like this:
arch/m68k/coldfire/device.c:565:12: error: ‘MCFSDHC_BASE’ undeclared here (not in a function)
.start = MCFSDHC_BASE,
^
arch/m68k/coldfire/device.c:566:25: error: ‘MCFSDHC_SIZE’ undeclared here (not in a function)
.end = MCFSDHC_BASE + MCFSDHC_SIZE - 1,
^
arch/m68k/coldfire/device.c:569:12: error: ‘MCF_IRQ_SDHC’ undeclared here (not in a function)
.start = MCF_IRQ_SDHC,
^
Make the SDHC platform support depend on MCFSDHC_BASE, that is only include it if the specific ColdFire SoC has that hardware module.
--- arch/m68k/coldfire/device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/m68k/coldfire/device.c +3 -3
@@ -554,7 +554,7 @@ static struct platform_device mcf_edma = { };#endif /* IS_ENABLED(CONFIG_MCF_EDMA) */ -#if IS_ENABLED (CONFIG_MMC ) +#ifdef MCFSDHC_BASE static struct mcf_esdhc_platform_data mcf_esdhc_data = { .max_bus_width =4 , .cd_type = ESDHC_CD_NONE,
@@ -579,7 +579,7 @@ static struct platform_device mcf_esdhc = { .resource = mcf_esdhc_resources, .dev.platform_data = &mcf_esdhc_data, }; -#endif /* IS_ENABLED(CONFIG_MMC) */ +#endif /* MCFSDHC_BASE */ static struct platform_device *mcf_devices[]__initdata = { &mcf_uart,
@@ -613,7 +613,7 @@ static struct platform_device *mcf_devices[] __initdata = {#if IS_ENABLED (CONFIG_MCF_EDMA ) &mcf_edma,#endif -#if IS_ENABLED (CONFIG_MMC ) +#ifdef MCFSDHC_BASE &mcf_esdhc,#endif };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 421/757 arc: plat-hsdk: fix kconfig dependency warning when !RESET_CONTROLLER
In reply to Greg Kroah-HartmanFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 63bcf87cb1c57956e1179f1a78dde625c7e3cba7 ]
When ARC_SOC_HSDK is enabled and RESET_CONTROLLER is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for RESET_HSDK
Depends on [n]: RESET_CONTROLLER [=n] && HAS_IOMEM [=y] && (ARC_SOC_HSDK [=y] || COMPILE_TEST [=n]) Selected by [y]:
- ARC_SOC_HSDK [=y] && ISA_ARCV2 [=y]
The reason is that ARC_SOC_HSDK selects RESET_HSDK without depending on or selecting RESET_CONTROLLER while RESET_HSDK is subordinate to RESET_CONTROLLER.
Honor the kconfig menu hierarchy to remove kconfig dependency warnings.
--- arch/arc/plat-hsdk/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arc/plat-hsdk/Kconfig +1 -0
@@ -8,5 +8,6 @@ menuconfig ARC_SOC_HSDK select ARC_HAS_ACCL_REGS select ARC_IRQ_NO_AUTOSAVE select CLK_HSDK + select RESET_CONTROLLER select RESET_HSDK select HAVE_PCI
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 422/757 ida: Free allocated bitmap in error path
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit a219b856a2b993da234108307be772448f22b0ce ]
If a bitmap needs to be allocated, and then by the time the thread is scheduled to be run again all the indices which would satisfy the allocation have been allocated then we would leak the allocation. Almost impossible to hit in practice, but a trivial fix. Found by Coverity.
--- lib/idr.c | 1 + tools/testing/radix-tree/idr-test.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
lib/idr.c +1 -0
@@ -470,6 +470,7 @@ int ida_alloc_range(struct ida *ida, unsigned int min, unsigned int max, goto retry; nospc:xas_unlock_irqrestore (&xas, flags); +kfree (alloc);return -ENOSPC ; }EXPORT_SYMBOL (ida_alloc_range);
tools/testing/radix-tree/idr-test.c +29 -0
@@ -523,8 +523,27 @@ static void *ida_random_fn(void *arg)return NULL ; } +static void *ida_leak_fn (void *arg) +{ +struct ida *ida = arg; +time_t s =time (NULL ); +int i, ret; + +rcu_register_thread (); + +do for (i =0 ; i <1000 ; i++) { + ret =ida_alloc_range (ida,128 ,128 ,GFP_KERNEL ); +if (ret >=0 ) +ida_free (ida,128 ); + }while (time (NULL ) < s +2 ); + +rcu_unregister_thread (); +return NULL ; +} +void ida_thread_tests (void ) { +DEFINE_IDA (ida);pthread_t threads[20 ];int i;
@@ -536,6 +555,16 @@ void ida_thread_tests(void)while (i--)pthread_join (threads[i],NULL ); + +for (i =0 ; i <ARRAY_SIZE (threads); i++) +if (pthread_create (&threads[i],NULL , ida_leak_fn, &ida)) { +perror ("creating ida thread" ); +exit (1 ); + } + +while (i--) +pthread_join (threads[i],NULL ); +assert (ida_is_empty (&ida)); }void ida_tests (void )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 423/757 xfs: limit entries returned when counting fsmap records
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit acd1ac3aa22fd58803a12d26b1ab7f70232f8d8d ]
If userspace asked fsmap to count the number of entries, we cannot return more than UINT_MAX entries because fmh_entries is u32. Therefore, stop counting if we hit this limit or else we will waste time to return truncated results.
--- fs/xfs/xfs_fsmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/xfs/xfs_fsmap.c +3 -0
@@ -256,6 +256,9 @@ xfs_getfsmap_helper(/* Are we just counting mappings? */ if (info->head->fmh_count ==0 ) { +if (info->head->fmh_entries ==UINT_MAX ) +return -ECANCELED ; +if (rec_daddr > info->next_daddr) info->head->fmh_entries++;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 424/757 xfs: fix deadlock and streamline xfs_getfsmap performance
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 8ffa90e1145c70c7ac47f14b59583b2296d89e72 ]
Refactor xfs_getfsmap to improve its performance: instead of indirectly calling a function that copies one record to userspace at a time, create a shadow buffer in the kernel and copy the whole array once at the end. On the author's computer, this reduces the runtime on his /home by ~20%.
This also eliminates a deadlock when running GETFSMAP against the realtime device. The current code locks the rtbitmap to create fsmappings and copies them into userspace, having not released the rtbitmap lock. If the userspace buffer is an mmap of a sparse file that itself resides on the realtime device, the write page fault will recurse into the fs for allocation, which will deadlock on the rtbitmap lock.
--- fs/xfs/xfs_fsmap.c | 45 +++++++------- fs/xfs/xfs_fsmap.h | 6 +- fs/xfs/xfs_ioctl.c | 144 ++++++++++++++++++++++++++++++--------------- 3 files changed, 124 insertions(+), 71 deletions(-)
fs/xfs/xfs_fsmap.c +25 -20
@@ -26,7 +26,7 @@#include "xfs_rtalloc.h" /* Convert an xfs_fsmap to an fsmap. */ -void +static void xfs_fsmap_from_internal (struct fsmap *dest,struct xfs_fsmap *src)
@@ -155,8 +155,7 @@ xfs_fsmap_owner_from_rmap(/* getfsmap query state */ struct xfs_getfsmap_info {struct xfs_fsmap_head *head; -xfs_fsmap_format_t formatter;/* formatting fn */ -void *format_arg;/* format buffer */ +struct fsmap *fsmap_recs;/* mapping records */ struct xfs_buf *agf_bp;/* AGF, for refcount queries */ xfs_daddr_t next_daddr;/* next daddr we expect */ u64 missing_owner;/* owner of holes */
@@ -224,6 +223,20 @@ xfs_getfsmap_is_shared(return 0 ; } +static inline void +xfs_getfsmap_format ( +struct xfs_mount *mp, +struct xfs_fsmap *xfm, +struct xfs_getfsmap_info *info) +{ +struct fsmap *rec; + +trace_xfs_getfsmap_mapping (mp, xfm); + + rec = &info->fsmap_recs[info->head->fmh_entries++]; +xfs_fsmap_from_internal (rec, xfm); +} +/* * Format a reverse mapping for getfsmap, having translated rm_startblock * into the appropriate daddr units.
@@ -288,10 +301,7 @@ xfs_getfsmap_helper( fmr.fmr_offset =0 ; fmr.fmr_length = rec_daddr - info->next_daddr; fmr.fmr_flags =FMR_OF_SPECIAL_OWNER ; - error = info->formatter (&fmr, info->format_arg); -if (error) -return error; - info->head->fmh_entries++; +xfs_getfsmap_format (mp, &fmr, info); }if (info->last)
@@ -323,11 +333,8 @@ xfs_getfsmap_helper(if (shared) fmr.fmr_flags |=FMR_OF_SHARED ; } - error = info->formatter (&fmr, info->format_arg); -if (error) -return error; - info->head->fmh_entries++; +xfs_getfsmap_format (mp, &fmr, info); out: rec_daddr +=XFS_FSB_TO_BB (mp, rec->rm_blockcount);if (info->next_daddr < rec_daddr)
@@ -795,11 +802,11 @@ xfs_getfsmap_check_keys(#endif /* CONFIG_XFS_RT */ /* -* Get filesystem's extents as described in head, and format for -* output. Calls formatter to fill the user's buffer until all -* extents are mapped, until the passed-in head->fmh_count slots have -* been filled, or until the formatter short-circuits the loop, if it -* is tracking filled-in extents on its own. +* Get filesystem's extents as described in head, and format for output. Fills +* in the supplied records array until there are no more reverse mappings to +* return or head.fmh_entries == head.fmh_count. In the second case, this +* function returns -ECANCELED to indicate that more records would have been +* returned. * * Key to Confusion * ----------------
@@ -819,8 +826,7 @@ intxfs_getfsmap ( struct xfs_mount *mp, struct xfs_fsmap_head *head, - xfs_fsmap_format_t formatter, - void *arg) + struct fsmap *fsmap_recs) { struct xfs_trans *tp = NULL;struct xfs_fsmap dkeys[2 ];/* per-dev keys */
@@ -895,8 +901,7 @@ xfs_getfsmap( info.next_daddr = head->fmh_keys[0 ].fmr_physical + head->fmh_keys[0 ].fmr_length; - info.formatter = formatter; - info.format_arg = arg; + info.fsmap_recs = fsmap_recs; info.head = head;/*
fs/xfs/xfs_fsmap.h +1 -5
@@ -27,13 +27,9 @@ struct xfs_fsmap_head { struct xfs_fsmap fmh_keys[2]; /* low and high keys */ }; -void xfs_fsmap_from_internal (struct fsmap *dest,struct xfs_fsmap *src);void xfs_fsmap_to_internal (struct xfs_fsmap *dest,struct fsmap *src); -/* fsmap to userspace formatter - copy to user & advance pointer */ -typedef int (*xfs_fsmap_format_t )(struct xfs_fsmap *,void *); -int xfs_getfsmap (struct xfs_mount *mp,struct xfs_fsmap_head *head, -xfs_fsmap_format_t formatter,void *arg); +struct fsmap *out_recs);#endif /* __XFS_FSMAP_H__ */
fs/xfs/xfs_ioctl.c +98 -46
175 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 425/757 nfs: add missing "posix" local_lock constant table definition
In reply to Greg Kroah-HartmanFrom: Scott Mayhew <[email protected]>
[ Upstream commit a2d24bcb97dc7b0be1cb891e60ae133bdf36c786 ]
"mount -o local_lock=posix..." was broken by the mount API conversion due to the missing constant.
--- fs/nfs/fs_context.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/fs_context.c +1 -0
@@ -94,6 +94,7 @@ enum {static const struct constant_table nfs_param_enums_local_lock[] = { {"all" , Opt_local_lock_all }, {"flock" , Opt_local_lock_flock }, + {"posix" , Opt_local_lock_posix }, {"none" , Opt_local_lock_none }, {} };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 426/757 xfs: fix high key handling in the rt allocators query_range function
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit d88850bd5516a77c6f727e8b6cefb64e0cc929c7 ]
Fix some off-by-one errors in xfs_rtalloc_query_range. The highest key in the realtime bitmap is always one less than the number of rt extents, which means that the key clamp at the start of the function is wrong. The 4th argument to xfs_rtfind_forw is the highest rt extent that we want to probe, which means that passing 1 less than the high key is wrong. Finally, drop the rem variable that controls the loop because we can compare the iteration point (rtstart) against the high key directly.
The sordid history of this function is that the original commit (fb3c3) incorrectly passed (high_rec->ar_startblock - 1) as the 'limit' parameter to xfs_rtfind_forw. This was wrong because the "high key" is supposed to be the largest key for which the caller wants result rows, not the key for the first row that could possibly be outside the range that the caller wants to see.
A subsequent attempt (8ad56) to strengthen the parameter checking added incorrect clamping of the parameters to the number of rt blocks in the system (despite the bitmap functions all taking units of rt extents) to avoid querying ranges past the end of rt bitmap file but failed to fix the incorrect _rtfind_forw parameter. The original _rtfind_forw parameter error then survived the conversion of the startblock and blockcount fields to rt extents (a0e5c), and the most recent off-by-one fix (a3a37) thought it was patching a problem when the end of the rt volume is not in use, but none of these fixes actually solved the original problem that the author was confused about the "limit" argument to xfs_rtfind_forw.
Sadly, all four of these patches were written by this author and even his own usage of this function and rt testing were inadequate to get this fixed quickly.
Original-problem: fb3c3de2f65c ("xfs: add a couple of queries to iterate free extents in the rtbitmap")
--- fs/xfs/libxfs/xfs_rtbitmap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
fs/xfs/libxfs/xfs_rtbitmap.c +4 -7
@@ -1018,7 +1018,6 @@ xfs_rtalloc_query_range(struct xfs_mount *mp = tp->t_mountp;xfs_rtblock_t rtstart;xfs_rtblock_t rtend; -xfs_rtblock_t rem;int is_free;int error =0 ;
@@ -1027,13 +1026,12 @@ xfs_rtalloc_query_range(if (low_rec->ar_startext >= mp->m_sb.sb_rextents || low_rec->ar_startext == high_rec->ar_startext)return 0 ; -if (high_rec->ar_startext > mp->m_sb.sb_rextents) - high_rec->ar_startext = mp->m_sb.sb_rextents; + high_rec->ar_startext =min (high_rec->ar_startext, + mp->m_sb.sb_rextents -1 );/* Iterate the bitmap, looking for discrepancies. */ rtstart = low_rec->ar_startext; - rem = high_rec->ar_startext - rtstart; -while (rem) { +while (rtstart <= high_rec->ar_startext) {/* Is the first block free? */ error =xfs_rtcheck_range (mp, tp, rtstart,1 ,1 , &rtend, &is_free);
@@ -1042,7 +1040,7 @@ xfs_rtalloc_query_range(/* How long does the extent go for? */ error =xfs_rtfind_forw (mp, tp, rtstart, - high_rec->ar_startext -1 , &rtend); + high_rec->ar_startext, &rtend);if (error)break ;
@@ -1055,7 +1053,6 @@ xfs_rtalloc_query_range(break ; } - rem -= rtend - rtstart +1 ; rtstart = rtend +1 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 427/757 RDMA/rtrs-srv: Incorporate ib_register_client into rtrs server init
In reply to Greg Kroah-HartmanFrom: Md Haris Iqbal <[email protected]>
[ Upstream commit 558d52b2976b1db3098139aa83ceb9af9066a0e7 ]
The rnbd_server module's communication manager (cm) initialization depends on the registration of the "network namespace subsystem" of the RDMA CM agent module. As such, when the kernel is configured to load the rnbd_server and the RDMA cma module during initialization; and if the rnbd_server module is initialized before RDMA cma module, a null ptr dereference occurs during the RDMA bind operation.
Call trace: Call Trace: ? xas_load+0xd/0x80 xa_load+0x47/0x80 cma_ps_find+0x44/0x70 rdma_bind_addr+0x782/0x8b0 ? get_random_bytes+0x35/0x40 rtrs_srv_cm_init+0x50/0x80 rtrs_srv_open+0x102/0x180 ? rnbd_client_init+0x6e/0x6e rnbd_srv_init_module+0x34/0x84 ? rnbd_client_init+0x6e/0x6e do_one_initcall+0x4a/0x200 kernel_init_freeable+0x1f1/0x26e ? rest_init+0xb0/0xb0 kernel_init+0xe/0x100 ret_from_fork+0x22/0x30 Modules linked in: CR2: 0000000000000015
All this happens cause the cm init is in the call chain of the module init, which is not a preferred practice.
So remove the call to rdma_create_id() from the module init call chain. Instead register rtrs-srv as an ib client, which makes sure that the rdma_create_id() is called only when an ib device is added.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 76 +++++++++++++++++++++++++- drivers/infiniband/ulp/rtrs/rtrs-srv.h | 7 +++ 2 files changed, 80 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +73 -3
@@ -16,6 +16,7 @@#include "rtrs-srv.h" #include "rtrs-log.h" #include <rdma/ib_cm.h> +#include <rdma/ib_verbs.h> MODULE_DESCRIPTION ("RDMA Transport Server" );MODULE_LICENSE ("GPL" );
@@ -31,6 +32,7 @@ MODULE_LICENSE("GPL");static struct rtrs_rdma_dev_pd dev_pd;static mempool_t *chunk_pool;struct class *rtrs_dev_class; +static struct rtrs_srv_ib_ctx ib_ctx;static int __read_mostly max_chunk_size =DEFAULT_MAX_CHUNK_SIZE ;static int __read_mostly sess_queue_depth =DEFAULT_SESS_QUEUE_DEPTH ;
@@ -2042,6 +2044,70 @@ static void free_srv_ctx(struct rtrs_srv_ctx *ctx)kfree (ctx); } +static int rtrs_srv_add_one (struct ib_device *device) +{ +struct rtrs_srv_ctx *ctx; +int ret =0 ; + +mutex_lock (&ib_ctx.ib_dev_mutex); +if (ib_ctx.ib_dev_count) + goto out; + +/* +* Since our CM IDs are NOT bound to any ib device we will create them +* only once +*/ + ctx = ib_ctx.srv_ctx; + ret =rtrs_srv_rdma_init (ctx, ib_ctx.port); +if (ret) { +/* +* We errored out here. +* According to the ib code, if we encounter an error here then the +* error code is ignored, and no more calls to our ops are made. +*/ +pr_err ("Failed to initialize RDMA connection" ); + goto err_out; + } + +out: +/* +* Keep a track on the number of ib devices added +*/ + ib_ctx.ib_dev_count++; + +err_out: +mutex_unlock (&ib_ctx.ib_dev_mutex); +return ret; +} + +static void rtrs_srv_remove_one (struct ib_device *device,void *client_data) +{ +struct rtrs_srv_ctx *ctx; + +mutex_lock (&ib_ctx.ib_dev_mutex); + ib_ctx.ib_dev_count--; + +if (ib_ctx.ib_dev_count) + goto out; + +/* +* Since our CM IDs are NOT bound to any ib device we will remove them +* only once, when the last device is removed +*/ + ctx = ib_ctx.srv_ctx; +rdma_destroy_id (ctx->cm_id_ip); +rdma_destroy_id (ctx->cm_id_ib); + +out: +mutex_unlock (&ib_ctx.ib_dev_mutex); +} + +static struct ib_client rtrs_srv_client = { + .name ="rtrs_server" , + .add = rtrs_srv_add_one, + .remove = rtrs_srv_remove_one +}; +/** * rtrs_srv_open() - open RTRS server context * @ops: callback functions
@@ -2060,7 +2126,11 @@ struct rtrs_srv_ctx *rtrs_srv_open(struct rtrs_srv_ops *ops, u16 port)if (!ctx)return ERR_PTR (-ENOMEM ); - err =rtrs_srv_rdma_init (ctx, port); +mutex_init (&ib_ctx.ib_dev_mutex); + ib_ctx.srv_ctx = ctx; + ib_ctx.port = port; + + err =ib_register_client (&rtrs_srv_client);if (err) {free_srv_ctx (ctx);return ERR_PTR (err);
@@ -2099,8 +2169,8 @@ static void close_ctx(struct rtrs_srv_ctx *ctx)*/ void rtrs_srv_close (struct rtrs_srv_ctx *ctx) { -rdma_destroy_id (ctx->cm_id_ip); -rdma_destroy_id (ctx->cm_id_ib); +ib_unregister_client (&rtrs_srv_client); +mutex_destroy (&ib_ctx.ib_dev_mutex);close_ctx (ctx);free_srv_ctx (ctx); }
drivers/infiniband/ulp/rtrs/rtrs-srv.h +7 -0
@@ -118,6 +118,13 @@ struct rtrs_srv_ctx {struct list_head srv_list; }; +struct rtrs_srv_ib_ctx { +struct rtrs_srv_ctx *srv_ctx; +u16 port; +struct mutex ib_dev_mutex; +int ib_dev_count; +}; +extern struct class *rtrs_dev_class;void close_sess (struct rtrs_srv_sess *sess);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 428/757 RDMA/core: Delete function indirection for alloc/free kernel CQ
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 7e3c66c9a989d5b53387ceebc88b9e4a9b1d6434 ]
The ib_alloc_cq*() and ib_free_cq*() are solely kernel verbs to manage CQs and doesn't need extra indirection just to call same functions with constant parameter NULL as udata.
--- drivers/infiniband/core/cq.c | 27 +++++++--------- include/rdma/ib_verbs.h | 62 ++++-------------------------------- 2 files changed, 18 insertions(+), 71 deletions(-)
drivers/infiniband/core/cq.c +12 -15
@@ -197,24 +197,22 @@ static void ib_cq_completion_workqueue(struct ib_cq *cq, void *private) }/** -* __ib_alloc_cq_user - allocate a completion queue +* __ib_alloc_cq allocate a completion queue * @dev: device to allocate the CQ for * @private: driver private data, accessible from cq->cq_context * @nr_cqe: number of CQEs to allocate * @comp_vector: HCA completion vectors for this CQ * @poll_ctx: context to poll the CQ from. * @caller: module owner name. -* @udata: Valid user data or NULL for kernel object * * This is the proper interface to allocate a CQ for in-kernel users. A * CQ allocated with this interface will automatically be polled from the * specified context. The ULP must use wr->wr_cqe instead of wr->wr_id * to use this CQ abstraction. */ -struct ib_cq *__ib_alloc_cq_user (struct ib_device *dev,void *private, -int nr_cqe,int comp_vector, -enum ib_poll_context poll_ctx, -const char *caller,struct ib_udata *udata) +struct ib_cq *__ib_alloc_cq (struct ib_device *dev,void *private,int nr_cqe, +int comp_vector,enum ib_poll_context poll_ctx, +const char *caller) {struct ib_cq_init_attr cq_attr = { .cqe = nr_cqe,
@@ -277,7 +275,7 @@ struct ib_cq *__ib_alloc_cq_user(struct ib_device *dev, void *private, out_destroy_cq:rdma_dim_destroy (cq);rdma_restrack_del (&cq->res); - cq->device->ops.destroy_cq (cq, udata); + cq->device->ops.destroy_cq (cq,NULL ); out_free_wc:kfree (cq->wc); out_free_cq:
@@ -285,7 +283,7 @@ struct ib_cq *__ib_alloc_cq_user(struct ib_device *dev, void *private,trace_cq_alloc_error (nr_cqe, comp_vector, poll_ctx, ret);return ERR_PTR (ret); } -EXPORT_SYMBOL (__ib_alloc_cq_user); +EXPORT_SYMBOL (__ib_alloc_cq);/** * __ib_alloc_cq_any - allocate a completion queue
@@ -310,17 +308,16 @@ struct ib_cq *__ib_alloc_cq_any(struct ib_device *dev, void *private,atomic_inc_return (&counter) %min_t (int, dev->num_comp_vectors,num_online_cpus ()); -return __ib_alloc_cq_user (dev, private, nr_cqe, comp_vector, poll_ctx, - caller,NULL ); +return __ib_alloc_cq (dev, private, nr_cqe, comp_vector, poll_ctx, + caller); }EXPORT_SYMBOL (__ib_alloc_cq_any);/** -* ib_free_cq_user - free a completion queue +* ib_free_cq - free a completion queue * @cq: completion queue to free. -* @udata: User data or NULL for kernel object */ -void ib_free_cq_user (struct ib_cq *cq,struct ib_udata *udata) +void ib_free_cq (struct ib_cq *cq) {if (WARN_ON_ONCE (atomic_read (&cq->usecnt)))return ;
@@ -344,11 +341,11 @@ void ib_free_cq_user(struct ib_cq *cq, struct ib_udata *udata)rdma_dim_destroy (cq);trace_cq_free (cq);rdma_restrack_del (&cq->res); - cq->device->ops.destroy_cq (cq, udata); + cq->device->ops.destroy_cq (cq,NULL );kfree (cq->wc);kfree (cq); } -EXPORT_SYMBOL (ib_free_cq_user); +EXPORT_SYMBOL (ib_free_cq);void ib_cq_pool_init (struct ib_device *dev) {
include/rdma/ib_verbs.h +6 -56
78 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 429/757 RDMA: Allow fail of destroy CQ
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 43d781b9fa562f0c6e50f62c870fbfeb9dc85213 ]
Like any other verbs objects, CQ shouldn't fail during destroy, but mlx5_ib didn't follow this contract with mixed IB verbs objects with DEVX. Such mix causes to the situation where FW and kernel are fully interdependent on the reference counting of each side.
Kernel verbs and drivers that don't have DEVX flows shouldn't fail.
--- drivers/infiniband/core/cq.c | 5 ++++- drivers/infiniband/core/verbs.c | 9 +++++++-- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 3 ++- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 2 +- drivers/infiniband/hw/cxgb4/cq.c | 3 ++- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 2 +- drivers/infiniband/hw/efa/efa.h | 2 +- drivers/infiniband/hw/efa/efa_verbs.c | 3 ++- drivers/infiniband/hw/hns/hns_roce_cq.c | 3 ++- drivers/infiniband/hw/hns/hns_roce_device.h | 4 ++-- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 3 ++- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 3 ++- drivers/infiniband/hw/mlx4/cq.c | 3 ++- drivers/infiniband/hw/mlx4/mlx4_ib.h | 2 +- drivers/infiniband/hw/mlx5/cq.c | 9 +++++++-- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- drivers/infiniband/hw/mthca/mthca_provider.c | 3 ++- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 3 ++- drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 2 +- drivers/infiniband/hw/qedr/verbs.c | 5 +++-- drivers/infiniband/hw/qedr/verbs.h | 2 +- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 4 ++-- drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 +- drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c | 3 ++- drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 2 +- drivers/infiniband/sw/rdmavt/cq.c | 3 ++- drivers/infiniband/sw/rdmavt/cq.h | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 3 ++- drivers/infiniband/sw/siw/siw_verbs.c | 3 ++- drivers/infiniband/sw/siw/siw_verbs.h | 2 +- include/rdma/ib_verbs.h | 6 ++++-- 31 files changed, 66 insertions(+), 37 deletions(-)
drivers/infiniband/core/cq.c +4 -1
@@ -319,6 +319,8 @@ EXPORT_SYMBOL(__ib_alloc_cq_any);*/ void ib_free_cq (struct ib_cq *cq) { +int ret; +if (WARN_ON_ONCE (atomic_read (&cq->usecnt)))return ;if (WARN_ON_ONCE (cq->cqe_used))
@@ -340,8 +342,9 @@ void ib_free_cq(struct ib_cq *cq)rdma_dim_destroy (cq);trace_cq_free (cq); + ret = cq->device->ops.destroy_cq (cq,NULL ); +WARN_ONCE (ret,"Destroy of kernel CQ shouldn't fail" );rdma_restrack_del (&cq->res); - cq->device->ops.destroy_cq (cq,NULL );kfree (cq->wc);kfree (cq); }
drivers/infiniband/core/verbs.c +7 -2
@@ -2011,16 +2011,21 @@ EXPORT_SYMBOL(rdma_set_cq_moderation);int ib_destroy_cq_user (struct ib_cq *cq,struct ib_udata *udata) { +int ret; +if (WARN_ON_ONCE (cq->shared))return -EOPNOTSUPP ;if (atomic_read (&cq->usecnt))return -EBUSY ; + ret = cq->device->ops.destroy_cq (cq, udata); +if (ret) +return ret; +rdma_restrack_del (&cq->res); - cq->device->ops.destroy_cq (cq, udata);kfree (cq); -return 0 ; +return ret; }EXPORT_SYMBOL (ib_destroy_cq_user);
drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 -1
@@ -2800,7 +2800,7 @@ int bnxt_re_post_recv(struct ib_qp *ib_qp, const struct ib_recv_wr *wr, }/* Completion Queues */ -void bnxt_re_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) +int bnxt_re_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) {struct bnxt_re_cq *cq;struct bnxt_qplib_nq *nq;
@@ -2816,6 +2816,7 @@ void bnxt_re_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)atomic_dec (&rdev->cq_count); nq->budget--;kfree (cq->cql); +return 0 ; } int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
drivers/infiniband/hw/bnxt_re/ib_verbs.h +1 -1
@@ -193,7 +193,7 @@ int bnxt_re_post_recv(struct ib_qp *qp, const struct ib_recv_wr *recv_wr, const struct ib_recv_wr **bad_recv_wr);int bnxt_re_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void bnxt_re_destroy_cq (struct ib_cq *cq,struct ib_udata *udata); +int bnxt_re_destroy_cq (struct ib_cq *cq,struct ib_udata *udata);int bnxt_re_poll_cq (struct ib_cq *cq,int num_entries,struct ib_wc *wc);int bnxt_re_req_notify_cq (struct ib_cq *cq,enum ib_cq_notify_flags flags);struct ib_mr *bnxt_re_get_dma_mr (struct ib_pd *pd,int mr_access_flags);
drivers/infiniband/hw/cxgb4/cq.c +2 -1
@@ -967,7 +967,7 @@ int c4iw_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc)return !err || err == -ENODATA ? npolled : err; } -void c4iw_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) +int c4iw_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) {struct c4iw_cq *chp;struct c4iw_ucontext *ucontext;
@@ -985,6 +985,7 @@ void c4iw_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) ucontext ? &ucontext->uctx : &chp->cq.rdev->uctx, chp->destroy_skb, chp->wr_waitp);c4iw_put_wr_wait (chp->wr_waitp); +return 0 ; } int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -1
@@ -992,7 +992,7 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, struct ib_udata *udata);struct ib_mr *c4iw_get_dma_mr (struct ib_pd *pd,int acc);int c4iw_dereg_mr (struct ib_mr *ib_mr,struct ib_udata *udata); -void c4iw_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata); +int c4iw_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata);int c4iw_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata);int c4iw_arm_cq (struct ib_cq *ibcq,enum ib_cq_notify_flags flags);
drivers/infiniband/hw/efa/efa.h +1 -1
@@ -139,7 +139,7 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);struct ib_qp *efa_create_qp (struct ib_pd *ibpd,struct ib_qp_init_attr *init_attr,struct ib_udata *udata); -void efa_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata); +int efa_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata);int efa_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); struct ib_mr *efa_reg_mr(struct ib_pd *ibpd, u64 start, u64 length,
drivers/infiniband/hw/efa/efa_verbs.c +2 -1
@@ -843,7 +843,7 @@ static int efa_destroy_cq_idx(struct efa_dev *dev, int cq_idx)return efa_com_destroy_cq (&dev->edev, ¶ms); } -void efa_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) +int efa_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) {struct efa_dev *dev =to_edev (ibcq->device);struct efa_cq *cq =to_ecq (ibcq);
@@ -856,6 +856,7 @@ void efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)efa_destroy_cq_idx (dev, cq->cq_idx);efa_free_mapped (dev, cq->cpu_addr, cq->dma_addr, cq->size,DMA_FROM_DEVICE ); +return 0 ; } static int cq_mmap_entries_setup(struct efa_dev *dev, struct efa_cq *cq,
drivers/infiniband/hw/hns/hns_roce_cq.c +2 -1
@@ -311,7 +311,7 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr,return ret; } -void hns_roce_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) +int hns_roce_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) {struct hns_roce_dev *hr_dev =to_hr_dev (ib_cq->device);struct hns_roce_cq *hr_cq =to_hr_cq (ib_cq);
@@ -322,6 +322,7 @@ void hns_roce_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)free_cq_buf (hr_dev, hr_cq);free_cq_db (hr_dev, hr_cq, udata);free_cqc (hr_dev, hr_cq); +return 0 ; }void hns_roce_cq_completion (struct hns_roce_dev *hr_dev,u32 cqn)
drivers/infiniband/hw/hns/hns_roce_device.h +2 -2
@@ -930,7 +930,7 @@ struct hns_roce_hw {int (*poll_cq)(struct ib_cq *ibcq,int num_entries,struct ib_wc *wc);int (*dereg_mr)(struct hns_roce_dev *hr_dev,struct hns_roce_mr *mr,struct ib_udata *udata); -void (*destroy_cq)(struct ib_cq *ibcq,struct ib_udata *udata); +int (*destroy_cq)(struct ib_cq *ibcq,struct ib_udata *udata);int (*modify_cq)(struct ib_cq *cq,u16 cq_count,u16 cq_period);int (*init_eq)(struct hns_roce_dev *hr_dev);void (*cleanup_eq)(struct hns_roce_dev *hr_dev);
@@ -1247,7 +1247,7 @@ int to_hr_qp_type(int qp_type);int hns_roce_create_cq (struct ib_cq *ib_cq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void hns_roce_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata); +int hns_roce_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata);int hns_roce_db_map_user (struct hns_roce_ucontext *context,struct ib_udata *udata,unsigned long virt,struct hns_roce_db *db);
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +2 -1
@@ -3572,7 +3572,7 @@ int hns_roce_v1_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)return 0 ; } -static void hns_roce_v1_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) +static int hns_roce_v1_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) {struct hns_roce_dev *hr_dev =to_hr_dev (ibcq->device);struct hns_roce_cq *hr_cq =to_hr_cq (ibcq);
@@ -3603,6 +3603,7 @@ static void hns_roce_v1_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata) } wait_time++; } +return 0 ; }static void set_eq_cons_index_v1 (struct hns_roce_eq *eq,int req_not)
drivers/infiniband/hw/i40iw/i40iw_verbs.c +2 -1
@@ -1052,7 +1052,7 @@ void i40iw_cq_wq_destroy(struct i40iw_device *iwdev, struct i40iw_sc_cq *cq)* @ib_cq: cq pointer * @udata: user data or NULL for kernel object */ -static void i40iw_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) +static int i40iw_destroy_cq (struct ib_cq *ib_cq,struct ib_udata *udata) {struct i40iw_cq *iwcq;struct i40iw_device *iwdev;
@@ -1064,6 +1064,7 @@ static void i40iw_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)i40iw_cq_wq_destroy (iwdev, cq);cq_free_resources (iwdev, iwcq);i40iw_rem_devusecount (iwdev); +return 0 ; }/**
drivers/infiniband/hw/mlx4/cq.c +2 -1
@@ -475,7 +475,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)return err; } -void mlx4_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +int mlx4_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) {struct mlx4_ib_dev *dev =to_mdev (cq->device);struct mlx4_ib_cq *mcq =to_mcq (cq);
@@ -495,6 +495,7 @@ void mlx4_ib_destroy_cq(struct ib_cq *cq, struct ib_udata *udata)mlx4_db_free (dev->dev, &mcq->db); }ib_umem_release (mcq->umem); +return 0 ; }static void dump_cqe (void *cqe)
drivers/infiniband/hw/mlx4/mlx4_ib.h +1 -1
@@ -738,7 +738,7 @@ int mlx4_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period);int mlx4_ib_resize_cq (struct ib_cq *ibcq,int entries,struct ib_udata *udata);int mlx4_ib_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void mlx4_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata); +int mlx4_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata);int mlx4_ib_poll_cq (struct ib_cq *ibcq,int num_entries,struct ib_wc *wc);int mlx4_ib_arm_cq (struct ib_cq *cq,enum ib_cq_notify_flags flags);void __mlx4_ib_cq_clean (struct mlx4_ib_cq *cq,u32 qpn,struct mlx4_ib_srq *srq);
drivers/infiniband/hw/mlx5/cq.c +7 -2
@@ -1024,16 +1024,21 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,return err; } -void mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +int mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) {struct mlx5_ib_dev *dev =to_mdev (cq->device);struct mlx5_ib_cq *mcq =to_mcq (cq); +int ret; + + ret =mlx5_core_destroy_cq (dev->mdev, &mcq->mcq); +if (ret) +return ret; -mlx5_core_destroy_cq (dev->mdev, &mcq->mcq);if (udata)destroy_cq_user (mcq, udata);else destroy_cq_kernel (dev, mcq); +return 0 ; }static int is_equal_rsn (struct mlx5_cqe64 *cqe64,u32 rsn)
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -1
@@ -1148,7 +1148,7 @@ int mlx5_ib_read_wqe_srq(struct mlx5_ib_srq *srq, int wqe_index, void *buffer, size_t buflen, size_t *bc);int mlx5_ib_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata); +int mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata);int mlx5_ib_poll_cq (struct ib_cq *ibcq,int num_entries,struct ib_wc *wc);int mlx5_ib_arm_cq (struct ib_cq *ibcq,enum ib_cq_notify_flags flags);int mlx5_ib_modify_cq (struct ib_cq *cq,u16 cq_count,u16 cq_period);
drivers/infiniband/hw/mthca/mthca_provider.c +2 -1
@@ -789,7 +789,7 @@ static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udareturn ret; } -static void mthca_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +static int mthca_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) {if (udata) { struct mthca_ucontext *context =
@@ -808,6 +808,7 @@ static void mthca_destroy_cq(struct ib_cq *cq, struct ib_udata *udata) to_mcq(cq)->set_ci_db_index); }mthca_free_cq (to_mdev (cq->device),to_mcq (cq)); +return 0 ; }static inline u32 convert_access (int acc)
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +2 -1
@@ -1056,7 +1056,7 @@ static void ocrdma_flush_cq(struct ocrdma_cq *cq)spin_unlock_irqrestore (&cq->cq_lock, flags); } -void ocrdma_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) +int ocrdma_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) {struct ocrdma_cq *cq =get_ocrdma_cq (ibcq);struct ocrdma_eq *eq =NULL ;
@@ -1081,6 +1081,7 @@ void ocrdma_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)ocrdma_get_db_addr (dev, pdid), dev->nic_info.db_page_size); } +return 0 ; }static int ocrdma_add_qpn_map (struct ocrdma_dev *dev,struct ocrdma_qp *qp)
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +1 -1
@@ -72,7 +72,7 @@ void ocrdma_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata);int ocrdma_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata);int ocrdma_resize_cq (struct ib_cq *,int cqe,struct ib_udata *); -void ocrdma_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata); +int ocrdma_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata); struct ib_qp *ocrdma_create_qp(struct ib_pd *, struct ib_qp_init_attr *attrs,
drivers/infiniband/hw/qedr/verbs.c +3 -2
@@ -1051,7 +1051,7 @@ int qedr_resize_cq(struct ib_cq *ibcq, int new_cnt, struct ib_udata *udata)#define QEDR_DESTROY_CQ_MAX_ITERATIONS (10)#define QEDR_DESTROY_CQ_ITER_DURATION (10) -void qedr_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) +int qedr_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) {struct qedr_dev *dev =get_qedr_dev (ibcq->device);struct qed_rdma_destroy_cq_out_params oparams;
@@ -1066,7 +1066,7 @@ void qedr_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)/* GSIs CQs are handled by driver, so they don't exist in the FW */ if (cq->cq_type ==QEDR_CQ_TYPE_GSI ) {qedr_db_recovery_del (dev, cq->db_addr, &cq->db.data); -return ; +return 0 ; } iparams.icid = cq->icid;
@@ -1114,6 +1114,7 @@ void qedr_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)* Since the destroy CQ ramrod has also been received on the EQ we can * be certain that there's no event handler in process. */ +return 0 ; } static inline int get_gid_info_from_table(struct ib_qp *ibqp,
drivers/infiniband/hw/qedr/verbs.h +1 -1
@@ -52,7 +52,7 @@ void qedr_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata);int qedr_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata);int qedr_resize_cq (struct ib_cq *,int cqe,struct ib_udata *); -void qedr_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata); +int qedr_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata);int qedr_arm_cq (struct ib_cq *ibcq,enum ib_cq_notify_flags flags);struct ib_qp *qedr_create_qp (struct ib_pd *,struct ib_qp_init_attr *attrs,struct ib_udata *);
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +2 -2
@@ -596,9 +596,9 @@ int usnic_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,return 0 ; } -void usnic_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +int usnic_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) { -return ; +return 0 ; } struct ib_mr *usnic_ib_reg_mr(struct ib_pd *pd, u64 start, u64 length,
drivers/infiniband/hw/usnic/usnic_ib_verbs.h +1 -1
@@ -60,7 +60,7 @@ int usnic_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata);int usnic_ib_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void usnic_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata); +int usnic_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata);struct ib_mr *usnic_ib_reg_mr (struct ib_pd *pd,u64 start,u64 length,u64 virt_addr,int access_flags,struct ib_udata *udata);
drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c +2 -1
@@ -235,7 +235,7 @@ static void pvrdma_free_cq(struct pvrdma_dev *dev, struct pvrdma_cq *cq)* @cq: the completion queue to destroy. * @udata: user data or null for kernel object */ -void pvrdma_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +int pvrdma_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) {struct pvrdma_cq *vcq =to_vcq (cq);union pvrdma_cmd_req req;
@@ -261,6 +261,7 @@ void pvrdma_destroy_cq(struct ib_cq *cq, struct ib_udata *udata)pvrdma_free_cq (dev, vcq);atomic_dec (&dev->num_cqs); +return 0 ; }static inline struct pvrdma_cqe *get_cqe (struct pvrdma_cq *cq,int i)
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +1 -1
@@ -411,7 +411,7 @@ int pvrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, unsigned int *sg_offset);int pvrdma_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void pvrdma_destroy_cq (struct ib_cq *cq,struct ib_udata *udata); +int pvrdma_destroy_cq (struct ib_cq *cq,struct ib_udata *udata);int pvrdma_poll_cq (struct ib_cq *ibcq,int num_entries,struct ib_wc *wc);int pvrdma_req_notify_cq (struct ib_cq *cq,enum ib_cq_notify_flags flags); int pvrdma_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,
drivers/infiniband/sw/rdmavt/cq.c +2 -1
@@ -315,7 +315,7 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,* * Called by ib_destroy_cq() in the generic verbs code. */ -void rvt_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) +int rvt_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) {struct rvt_cq *cq =ibcq_to_rvtcq (ibcq);struct rvt_dev_info *rdi = cq->rdi;
@@ -328,6 +328,7 @@ void rvt_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)kref_put (&cq->ip->ref, rvt_release_mmap_info); else vfree(cq->kqueue); +return 0 ; }/**
drivers/infiniband/sw/rdmavt/cq.h +1 -1
@@ -53,7 +53,7 @@int rvt_create_cq (struct ib_cq *ibcq,const struct ib_cq_init_attr *attr,struct ib_udata *udata); -void rvt_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata); +int rvt_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata);int rvt_req_notify_cq (struct ib_cq *ibcq,enum ib_cq_notify_flags notify_flags);int rvt_resize_cq (struct ib_cq *ibcq,int cqe,struct ib_udata *udata);int rvt_poll_cq (struct ib_cq *ibcq,int num_entries,struct ib_wc *entry);
drivers/infiniband/sw/rxe/rxe_verbs.c +2 -1
@@ -803,13 +803,14 @@ static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,return rxe_add_to_pool (&rxe->cq_pool, &cq->pelem); } -static void rxe_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) +static int rxe_destroy_cq (struct ib_cq *ibcq,struct ib_udata *udata) {struct rxe_cq *cq =to_rcq (ibcq);rxe_cq_disable (cq);rxe_drop_ref (cq); +return 0 ; }static int rxe_resize_cq (struct ib_cq *ibcq,int cqe,struct ib_udata *udata)
drivers/infiniband/sw/siw/siw_verbs.c +2 -1
@@ -1055,7 +1055,7 @@ int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr,return rv >0 ?0 : rv; } -void siw_destroy_cq (struct ib_cq *base_cq,struct ib_udata *udata) +int siw_destroy_cq (struct ib_cq *base_cq,struct ib_udata *udata) {struct siw_cq *cq =to_siw_cq (base_cq);struct siw_device *sdev =to_siw_dev (base_cq->device);
@@ -1073,6 +1073,7 @@ void siw_destroy_cq(struct ib_cq *base_cq, struct ib_udata *udata)atomic_dec (&sdev->num_cq);vfree (cq->queue); +return 0 ; }/*
drivers/infiniband/sw/siw/siw_verbs.h +1 -1
@@ -62,7 +62,7 @@ int siw_post_send(struct ib_qp *base_qp, const struct ib_send_wr *wr, const struct ib_send_wr **bad_wr);int siw_post_receive (struct ib_qp *base_qp,const struct ib_recv_wr *wr,const struct ib_recv_wr **bad_wr); -void siw_destroy_cq (struct ib_cq *base_cq,struct ib_udata *udata); +int siw_destroy_cq (struct ib_cq *base_cq,struct ib_udata *udata);int siw_poll_cq (struct ib_cq *base_cq,int num_entries,struct ib_wc *wc);int siw_req_notify_cq (struct ib_cq *base_cq,enum ib_cq_notify_flags flags); struct ib_mr *siw_reg_user_mr(struct ib_pd *base_pd, u64 start, u64 len,
include/rdma/ib_verbs.h +4 -2
@@ -2439,7 +2439,7 @@ struct ib_device_ops {int (*create_cq)(struct ib_cq *cq,const struct ib_cq_init_attr *attr,struct ib_udata *udata);int (*modify_cq)(struct ib_cq *cq,u16 cq_count,u16 cq_period); -void (*destroy_cq)(struct ib_cq *cq,struct ib_udata *udata); +int (*destroy_cq)(struct ib_cq *cq,struct ib_udata *udata);int (*resize_cq)(struct ib_cq *cq,int cqe,struct ib_udata *udata);struct ib_mr *(*get_dma_mr)(struct ib_pd *pd,int mr_access_flags); struct ib_mr *(*reg_user_mr)(struct ib_pd *pd, u64 start, u64 length,
@@ -3905,7 +3905,9 @@ int ib_destroy_cq_user(struct ib_cq *cq, struct ib_udata *udata);*/ static inline void ib_destroy_cq (struct ib_cq *cq) { -ib_destroy_cq_user (cq,NULL ); +int ret =ib_destroy_cq_user (cq,NULL ); + +WARN_ONCE (ret,"Destroy of kernel CQ shouldn't fail" ); }/**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 430/757 RDMA: Change XRCD destroy return value
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit d0c45c8556e57342d44c9548763609ffcc4e3866 ]
Update XRCD destroy flow to allow command failure.
--- drivers/infiniband/core/verbs.c | 8 ++++++-- drivers/infiniband/hw/mlx4/main.c | 3 ++- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- drivers/infiniband/hw/mlx5/qp.c | 4 ++-- include/rdma/ib_verbs.h | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-)
drivers/infiniband/core/verbs.c +6 -2
@@ -2333,13 +2333,17 @@ EXPORT_SYMBOL(ib_alloc_xrcd_user);*/ int ib_dealloc_xrcd_user (struct ib_xrcd *xrcd,struct ib_udata *udata) { +int ret; +if (atomic_read (&xrcd->usecnt))return -EBUSY ;WARN_ON (!xa_empty (&xrcd->tgt_qps)); - xrcd->device->ops.dealloc_xrcd (xrcd, udata); + ret = xrcd->device->ops.dealloc_xrcd (xrcd, udata); +if (ret) +return ret;kfree (xrcd); -return 0 ; +return ret; }EXPORT_SYMBOL (ib_dealloc_xrcd_user);
drivers/infiniband/hw/mlx4/main.c +2 -1
@@ -1256,11 +1256,12 @@ static int mlx4_ib_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)return err; } -static void mlx4_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata) +static int mlx4_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata) {ib_destroy_cq (to_mxrcd (xrcd)->cq);ib_dealloc_pd (to_mxrcd (xrcd)->pd);mlx4_xrcd_free (to_mdev (xrcd->device)->dev,to_mxrcd (xrcd)->xrcdn); +return 0 ; }static int add_gid_entry (struct ib_qp *ibqp,union ib_gid *gid)
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -1
@@ -1193,7 +1193,7 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, const struct ib_mad *in, struct ib_mad *out, size_t *out_mad_size, u16 *out_mad_pkey_index);int mlx5_ib_alloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata); -void mlx5_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata); +int mlx5_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata);int mlx5_ib_get_buf_offset (u64 addr,int page_shift,u32 *offset);int mlx5_query_ext_port_caps (struct mlx5_ib_dev *dev,u8 port); int mlx5_query_mad_ifc_smp_attr_node_info(struct ib_device *ibdev,
drivers/infiniband/hw/mlx5/qp.c +2 -2
@@ -4716,12 +4716,12 @@ int mlx5_ib_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)return mlx5_cmd_xrcd_alloc (dev->mdev, &xrcd->xrcdn,0 ); } -void mlx5_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata) +int mlx5_ib_dealloc_xrcd (struct ib_xrcd *xrcd,struct ib_udata *udata) {struct mlx5_ib_dev *dev =to_mdev (xrcd->device);u32 xrcdn =to_mxrcd (xrcd)->xrcdn; -mlx5_cmd_xrcd_dealloc (dev->mdev, xrcdn,0 ); +return mlx5_cmd_xrcd_dealloc (dev->mdev, xrcdn,0 ); }static void mlx5_ib_wq_event (struct mlx5_core_qp *core_qp,int type)
include/rdma/ib_verbs.h +1 -1
@@ -2468,7 +2468,7 @@ struct ib_device_ops {int (*attach_mcast)(struct ib_qp *qp,union ib_gid *gid,u16 lid);int (*detach_mcast)(struct ib_qp *qp,union ib_gid *gid,u16 lid);int (*alloc_xrcd)(struct ib_xrcd *xrcd,struct ib_udata *udata); -void (*dealloc_xrcd)(struct ib_xrcd *xrcd,struct ib_udata *udata); +int (*dealloc_xrcd)(struct ib_xrcd *xrcd,struct ib_udata *udata);struct ib_flow *(*create_flow)(struct ib_qp *qp,struct ib_flow_attr *flow_attr,int domain,struct ib_udata *udata);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 431/757 RDMA: Restore ability to return error for destroy WQ
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit add53535fb3033c249d9327ae3e7c36d3382bbd1 ]
Make this interface symmetrical to other destroy paths.
--- drivers/infiniband/core/uverbs_std_types_wq.c | 2 +- drivers/infiniband/core/verbs.c | 15 +++++++++------ drivers/infiniband/hw/mlx4/mlx4_ib.h | 2 +- drivers/infiniband/hw/mlx4/qp.c | 3 ++- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- drivers/infiniband/hw/mlx5/qp.c | 8 ++++++-- drivers/infiniband/hw/mlx5/qp.h | 4 ++-- drivers/infiniband/hw/mlx5/qpc.c | 5 +++-- include/rdma/ib_verbs.h | 4 ++-- 9 files changed, 27 insertions(+), 18 deletions(-)
drivers/infiniband/core/uverbs_std_types_wq.c +1 -1
@@ -16,7 +16,7 @@ static int uverbs_free_wq(struct ib_uobject *uobject, container_of(uobject, struct ib_uwq_object, uevent.uobject);int ret; - ret =ib_destroy_wq (wq, &attrs->driver_udata); + ret =ib_destroy_wq_user (wq, &attrs->driver_udata);if (ib_is_destroy_retryable (ret, why, uobject))return ret;
drivers/infiniband/core/verbs.c +9 -6
@@ -2387,25 +2387,28 @@ struct ib_wq *ib_create_wq(struct ib_pd *pd,EXPORT_SYMBOL (ib_create_wq);/** -* ib_destroy_wq - Destroys the specified user WQ. +* ib_destroy_wq_user - Destroys the specified user WQ. * @wq: The WQ to destroy. * @udata: Valid user data */ -int ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata) +int ib_destroy_wq_user (struct ib_wq *wq,struct ib_udata *udata) {struct ib_cq *cq = wq->cq;struct ib_pd *pd = wq->pd; +int ret;if (atomic_read (&wq->usecnt))return -EBUSY ; - wq->device->ops.destroy_wq (wq, udata); + ret = wq->device->ops.destroy_wq (wq, udata); +if (ret) +return ret; +atomic_dec (&pd->usecnt);atomic_dec (&cq->usecnt); - -return 0 ; +return ret; } -EXPORT_SYMBOL (ib_destroy_wq); +EXPORT_SYMBOL (ib_destroy_wq_user);/** * ib_modify_wq - Modifies the specified WQ.
drivers/infiniband/hw/mlx4/mlx4_ib.h +1 -1
@@ -892,7 +892,7 @@ void mlx4_ib_sl2vl_update(struct mlx4_ib_dev *mdev, int port);struct ib_wq *mlx4_ib_create_wq (struct ib_pd *pd,struct ib_wq_init_attr *init_attr,struct ib_udata *udata); -void mlx4_ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata); +int mlx4_ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata);int mlx4_ib_modify_wq (struct ib_wq *wq,struct ib_wq_attr *wq_attr,u32 wq_attr_mask,struct ib_udata *udata);
drivers/infiniband/hw/mlx4/qp.c +2 -1
@@ -4327,7 +4327,7 @@ int mlx4_ib_modify_wq(struct ib_wq *ibwq, struct ib_wq_attr *wq_attr,return err; } -void mlx4_ib_destroy_wq (struct ib_wq *ibwq,struct ib_udata *udata) +int mlx4_ib_destroy_wq (struct ib_wq *ibwq,struct ib_udata *udata) {struct mlx4_ib_dev *dev =to_mdev (ibwq->device);struct mlx4_ib_qp *qp =to_mqp ((struct ib_qp *)ibwq);
@@ -4338,6 +4338,7 @@ void mlx4_ib_destroy_wq(struct ib_wq *ibwq, struct ib_udata *udata)destroy_qp_common (dev, qp,MLX4_IB_RWQ_SRC , udata);kfree (qp); +return 0 ; }struct ib_rwq_ind_table
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -1
@@ -1238,7 +1238,7 @@ int mlx5_ib_check_mr_status(struct ib_mr *ibmr, u32 check_mask,struct ib_wq *mlx5_ib_create_wq (struct ib_pd *pd,struct ib_wq_init_attr *init_attr,struct ib_udata *udata); -void mlx5_ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata); +int mlx5_ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata);int mlx5_ib_modify_wq (struct ib_wq *wq,struct ib_wq_attr *wq_attr,u32 wq_attr_mask,struct ib_udata *udata); struct ib_rwq_ind_table *mlx5_ib_create_rwq_ind_table(struct ib_device *device,
drivers/infiniband/hw/mlx5/qp.c +6 -2
@@ -5056,14 +5056,18 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd,return ERR_PTR (err); } -void mlx5_ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata) +int mlx5_ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata) {struct mlx5_ib_dev *dev =to_mdev (wq->device);struct mlx5_ib_rwq *rwq =to_mrwq (wq); +int ret; -mlx5_core_destroy_rq_tracked (dev, &rwq->core_qp); + ret =mlx5_core_destroy_rq_tracked (dev, &rwq->core_qp); +if (ret) +return ret;destroy_user_rq (dev, wq->pd, rwq, udata);kfree (rwq); +return 0 ; } struct ib_rwq_ind_table *mlx5_ib_create_rwq_ind_table(struct ib_device *device,
drivers/infiniband/hw/mlx5/qp.h +2 -2
@@ -26,8 +26,8 @@ int mlx5_core_dct_query(struct mlx5_ib_dev *dev, struct mlx5_core_dct *dct,int mlx5_core_set_delay_drop (struct mlx5_ib_dev *dev,u32 timeout_usec); -void mlx5_core_destroy_rq_tracked (struct mlx5_ib_dev *dev, -struct mlx5_core_qp *rq); +int mlx5_core_destroy_rq_tracked (struct mlx5_ib_dev *dev, +struct mlx5_core_qp *rq);int mlx5_core_create_sq_tracked (struct mlx5_ib_dev *dev,u32 *in,int inlen,struct mlx5_core_qp *sq); void mlx5_core_destroy_sq_tracked(struct mlx5_ib_dev *dev,
drivers/infiniband/hw/mlx5/qpc.c +3 -2
@@ -576,11 +576,12 @@ int mlx5_core_create_rq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,return err; } -void mlx5_core_destroy_rq_tracked (struct mlx5_ib_dev *dev, -struct mlx5_core_qp *rq) +int mlx5_core_destroy_rq_tracked (struct mlx5_ib_dev *dev, +struct mlx5_core_qp *rq) {destroy_resource_common (dev, rq);destroy_rq_tracked (dev, rq->qpn, rq->uid); +return 0 ; }static void destroy_sq_tracked (struct mlx5_ib_dev *dev,u32 sqn,u16 uid)
include/rdma/ib_verbs.h +2 -2
@@ -2496,7 +2496,7 @@ struct ib_device_ops {struct ib_wq *(*create_wq)(struct ib_pd *pd,struct ib_wq_init_attr *init_attr,struct ib_udata *udata); -void (*destroy_wq)(struct ib_wq *wq,struct ib_udata *udata); +int (*destroy_wq)(struct ib_wq *wq,struct ib_udata *udata);int (*modify_wq)(struct ib_wq *wq,struct ib_wq_attr *attr,u32 wq_attr_mask,struct ib_udata *udata); struct ib_rwq_ind_table *(*create_rwq_ind_table)(
@@ -4331,7 +4331,7 @@ struct net_device *ib_device_netdev(struct ib_device *dev, u8 port);struct ib_wq *ib_create_wq (struct ib_pd *pd,struct ib_wq_init_attr *init_attr); -int ib_destroy_wq (struct ib_wq *wq,struct ib_udata *udata); +int ib_destroy_wq_user (struct ib_wq *wq,struct ib_udata *udata);int ib_modify_wq (struct ib_wq *wq,struct ib_wq_attr *attr,u32 wq_attr_mask);int ib_destroy_rwq_ind_table (struct ib_rwq_ind_table *wq_ind_table);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 432/757 RDMA/umem: Fix ib_umem_find_best_pgsz() for mappings that cross a page boundary
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit a40c20dabdf9045270767c75918feb67f0727c89 ]
It is possible for a single SGL to span an aligned boundary, eg if the SGL is
61440 -> 90112
Then the length is 28672, which currently limits the block size to 32k. With a 32k page size the two covering blocks will be:
32768->65536 and 65536->98304
However, the correct answer is a 128K block size which will span the whole 28672 bytes in a single block.
Instead of limiting based on length figure out which high IOVA bits don't change between the start and end addresses. That is the highest useful page size.
--- drivers/infiniband/core/umem.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/infiniband/core/umem.c +7 -2
@@ -156,8 +156,13 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,return 0 ; va = virt; -/* max page size not to exceed MR length */ - mask =roundup_pow_of_two (umem->length); +/* The best result is the smallest page size that results in the minimum +* number of required pages. Compute the largest page size that could +* work based on VA address bits that don't change. +*/ + mask = pgsz_bitmap & +GENMASK (BITS_PER_LONG -1 , +bits_per ((umem->length -1 + virt) ^ virt));/* offset into first SGL */ pgoff = umem->address & ~PAGE_MASK ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 433/757 RDMA/umem: Prevent small pages from being returned by ib_umem_find_best_pgsz()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 10c75ccb54e4fe548cb16d7ed426d7d709e6ae76 ]
rdma_for_each_block() makes assumptions about how the SGL is constructed that don't work if the block size is below the page size used to to build the SGL.
The rules for umem SGL construction require that the SG's all be PAGE_SIZE aligned and we don't encode the actual byte offset of the VA range inside the SGL using offset and length. So rdma_for_each_block() has no idea where the actual starting/ending point is to compute the first/last block boundary if the starting address should be within a SGL.
Fixing the SGL construction turns out to be really hard, and will be the subject of other patches. For now block smaller pages.
--- drivers/infiniband/core/umem.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/infiniband/core/umem.c +6 -0
@@ -151,6 +151,12 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,dma_addr_t mask;int i; +/* rdma_for_each_block() has a bug if the page size is smaller than the +* page size used to build the umem. For now prevent smaller page sizes +* from being returned. +*/ + pgsz_bitmap &=GENMASK (BITS_PER_LONG -1 ,PAGE_SHIFT ); +/* At minimum, drivers must support PAGE_SIZE or smaller */ if (WARN_ON (!(pgsz_bitmap &GENMASK (PAGE_SHIFT ,0 ))))return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 434/757 RDMA/qedr: Fix qp structure memory leak
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit 098e345a1a8faaad6e4e54d138773466cecc45d4 ]
The qedr_qp structure wasn't freed when the protocol was RoCE. kmemleak output when running basic RoCE scenario.
unreferenced object 0xffff927ad7e22c00 (size 1024):
comm "ib_send_bw", pid 7082, jiffies 4384133693 (age 274.698s) hex dump (first 32 bytes):
00 b0 cd a2 79 92 ff ff 00 3f a1 a2 79 92 ff ff ....y....?..y...
00 ee 5c dd 80 92 ff ff 00 f6 5c dd 80 92 ff ff ..\.......\.....
backtrace:
[<00000000b2ba0f35>] qedr_create_qp+0xb3/0x6c0 [qedr]
[<00000000e85a43dd>] ib_uverbs_handler_UVERBS_METHOD_QP_CREATE+0x555/0xad0 [ib_uverbs]
[<00000000fee4d029>] ib_uverbs_cmd_verbs+0xa5a/0xb80 [ib_uverbs]
[<000000005d622660>] ib_uverbs_ioctl+0xa4/0x110 [ib_uverbs]
[<00000000eb4cdc71>] ksys_ioctl+0x87/0xc0
[<00000000abe6b23a>] __x64_sys_ioctl+0x16/0x20
[<0000000046e7cef4>] do_syscall_64+0x4d/0x90
[<00000000c6948f76>] entry_SYSCALL_64_after_hwframe+0x44/0xa9--- drivers/infiniband/hw/qedr/verbs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/qedr/verbs.c +2 -0
@@ -2753,6 +2753,8 @@ int qedr_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)if (rdma_protocol_iwarp (&dev->ibdev,1 ))qedr_iw_qp_rem_ref (&qp->ibqp); +else +kfree (qp);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 435/757 RDMA/qedr: Fix doorbell setting
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit 0b1eddc1964351cd5ce57aff46853ed4ce9ebbff ]
Change the doorbell setting so that the maximum value between the last and current value is set. This is to avoid doorbells being lost.
--- drivers/infiniband/hw/qedr/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/qedr/verbs.c +1 -1
@@ -999,7 +999,7 @@ int qedr_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,/* Generate doorbell address. */ cq->db.data.icid = cq->icid; cq->db_addr = dev->db_addr + db_offset; - cq->db.data.params =DB_AGG_CMD_SET << + cq->db.data.params =DB_AGG_CMD_MAX <<RDMA_PWM_VAL32_DATA_AGG_CMD_SHIFT ;/* point to the very last element, passing it we will toggle */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 436/757 RDMA/qedr: Fix use of uninitialized field
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit a379ad54e55a12618cae7f6333fd1b3071de9606 ]
dev->attr.page_size_caps was used uninitialized when setting device attributes
--- drivers/infiniband/hw/qedr/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/qedr/main.c +1 -1
@@ -602,7 +602,7 @@ static int qedr_set_device_attr(struct qedr_dev *dev) qed_attr = dev->ops->rdma_query_device (dev->rdma_ctx);/* Part 2 - check capabilities */ - page_size = ~dev->attr.page_size_caps +1 ; + page_size = ~qed_attr->page_size_caps +1 ;if (page_size >PAGE_SIZE ) { DP_ERR(dev, "Kernel PAGE_SIZE is %ld which is smaller than minimum page size (%d) required by qedr\n",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 437/757 RDMA/qedr: Fix return code if accept is called on a destroyed qp
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit 8a5a10a1a74465065c75d9de1aa6685e1f1aa117 ]
In iWARP, accept could be called after a QP is already destroyed. In this case an error should be returned and not success.
--- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/qedr/qedr_iw_cm.c +4 -2
@@ -736,7 +736,7 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)struct qedr_dev *dev = ep->dev;struct qedr_qp *qp;struct qed_iwarp_accept_in params; -int rc =0 ; +int rc;DP_DEBUG (dev,QEDR_MSG_IWARP ,"Accept on qpid=%d\n" , conn_param->qpn);
@@ -759,8 +759,10 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) params.ord = conn_param->ord;if (test_and_set_bit (QEDR_IWARP_CM_WAIT_FOR_CONNECT , - &qp->iwarp_cm_flags)) + &qp->iwarp_cm_flags)) { + rc = -EINVAL ; goto err;/* QP already destroyed */ + } rc = dev->ops->iwarp_accept (dev->rdma_ctx, ¶ms);if (rc) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 438/757 RDMA/qedr: Fix inline size returned for iWARP
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit fbf58026b2256e9cd5f241a4801d79d3b2b7b89d ]
commit 59e8970b3798 ("RDMA/qedr: Return max inline data in QP query result") changed query_qp max_inline size to return the max roce inline size. When iwarp was introduced, this should have been modified to return the max inline size based on protocol. This size is cached in the device attributes
--- drivers/infiniband/hw/qedr/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/qedr/verbs.c +1 -1
@@ -2637,7 +2637,7 @@ int qedr_query_qp(struct ib_qp *ibqp, qp_attr->cap.max_recv_wr = qp->rq.max_wr; qp_attr->cap.max_send_sge = qp->sq.max_sges; qp_attr->cap.max_recv_sge = qp->rq.max_sges; - qp_attr->cap.max_inline_data =ROCE_REQ_MAX_INLINE_DATA_SIZE ; + qp_attr->cap.max_inline_data = dev->attr.max_inline; qp_init_attr->cap = qp_attr->cap; qp_attr->ah_attr.type =RDMA_AH_ATTR_TYPE_ROCE ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 439/757 powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory
In reply to Greg Kroah-HartmanFrom: Thiago Jung Bauermann <[email protected]>
[ Upstream commit eae9eec476d13fad9af6da1f44a054ee02b7b161 ]
POWER secure guests (i.e., guests which use the Protected Execution Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but they don't need the SWIOTLB memory to be in low addresses since the hypervisor doesn't have any addressing limitation.
This solves a SWIOTLB initialization problem we are seeing in secure guests with 128 GB of RAM: they are configured with 4 GB of crashkernel reserved memory, which leaves no space for SWIOTLB in low addresses.
To do this, we use mostly the same code as swiotlb_init(), but allocate the buffer using memblock_alloc() instead of memblock_alloc_low().
--- arch/powerpc/include/asm/svm.h | 4 ++++ arch/powerpc/mm/mem.c | 6 +++++- arch/powerpc/platforms/pseries/svm.c | 26 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/svm.h +4 -0
@@ -15,6 +15,8 @@ static inline bool is_secure_guest(void)return mfmsr () &MSR_S ; } +void __init svm_swiotlb_init (void ); +void dtl_cache_ctor (void *addr);#define get_dtl_cache_ctor () (is_secure_guest() ? dtl_cache_ctor : NULL)
@@ -25,6 +27,8 @@ static inline bool is_secure_guest(void) return false; } +static inline void svm_swiotlb_init (void ) {} +#define get_dtl_cache_ctor () NULL#endif /* CONFIG_PPC_SVM */
arch/powerpc/mm/mem.c +5 -1
@@ -49,6 +49,7 @@#include <asm/swiotlb.h> #include <asm/rtas.h> #include <asm/kasan.h> +#include <asm/svm.h> #include <mm/mmu_decl.h>
@@ -282,7 +283,10 @@ void __init mem_init(void)* back to to-down. */ memblock_set_bottom_up (true); -swiotlb_init (0 ); +if (is_secure_guest ()) +svm_swiotlb_init (); +else +swiotlb_init (0 );#endif high_memory = (void *)__va (max_low_pfn *PAGE_SIZE );
arch/powerpc/platforms/pseries/svm.c +26 -0
@@ -7,6 +7,7 @@*/ #include <linux/mm.h> +#include <linux/memblock.h> #include <asm/machdep.h> #include <asm/svm.h> #include <asm/swiotlb.h>
@@ -35,6 +36,31 @@ static int __init init_svm(void) }machine_early_initcall (pseries, init_svm); +/* +* Initialize SWIOTLB. Essentially the same as swiotlb_init(), except that it +* can allocate the buffer anywhere in memory. Since the hypervisor doesn't have +* any addressing limitation, we don't need to allocate it in low addresses. +*/ +void __init svm_swiotlb_init (void ) +{ +unsigned char *vstart; +unsigned long bytes, io_tlb_nslabs; + + io_tlb_nslabs = (swiotlb_size_or_default () >>IO_TLB_SHIFT ); + io_tlb_nslabs =ALIGN (io_tlb_nslabs,IO_TLB_SEGSIZE ); + + bytes = io_tlb_nslabs <<IO_TLB_SHIFT ; + + vstart =memblock_alloc (PAGE_ALIGN (bytes),PAGE_SIZE ); +if (vstart && !swiotlb_init_with_tbl (vstart, io_tlb_nslabs, false)) +return ; + +if (io_tlb_start) +memblock_free_early (io_tlb_start, +PAGE_ALIGN (io_tlb_nslabs <<IO_TLB_SHIFT )); +panic ("SVM: Cannot allocate SWIOTLB buffer" ); +} +int set_memory_encrypted (unsigned long addr,int numpages) {if (!PAGE_ALIGNED (addr))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 440/757 powerpc/watchpoint: Fix quadword instruction handling on p10 predecessors
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 4759c11ed20454b7b36db4ec15f7d5aa1519af4a ]
On p10 predecessors, watchpoint with quadword access is compared at quadword length. If the watch range is doubleword or less than that in a first half of quadword aligned 16 bytes, and if there is any unaligned quadword access which will access only the 2nd half, the handler should consider it as extraneous and emulate/single-step it before continuing.
--- arch/powerpc/include/asm/hw_breakpoint.h | 1 + arch/powerpc/kernel/hw_breakpoint.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/hw_breakpoint.h +1 -0
@@ -42,6 +42,7 @@ struct arch_hw_breakpoint {#else #define HW_BREAKPOINT_SIZE 0x8#endif +#define HW_BREAKPOINT_SIZE_QUADWORD 0x10#define DABR_MAX_LEN 8#define DAWR_MAX_LEN 512
arch/powerpc/kernel/hw_breakpoint.c +10 -2
@@ -520,9 +520,17 @@ static bool ea_hw_range_overlaps(unsigned long ea, int size, struct arch_hw_breakpoint *info) {unsigned long hw_start_addr, hw_end_addr; +unsigned long align_size =HW_BREAKPOINT_SIZE ; - hw_start_addr =ALIGN_DOWN (info->address,HW_BREAKPOINT_SIZE ); - hw_end_addr =ALIGN (info->address + info->len,HW_BREAKPOINT_SIZE ); +/* +* On p10 predecessors, quadword is handle differently then +* other instructions. +*/ +if (!cpu_has_feature (CPU_FTR_ARCH_31 ) && size ==16 ) + align_size =HW_BREAKPOINT_SIZE_QUADWORD ; + + hw_start_addr =ALIGN_DOWN (info->address, align_size); + hw_end_addr =ALIGN (info->address + info->len, align_size);return ((ea < hw_end_addr) && (ea + size > hw_start_addr)); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 441/757 powerpc/watchpoint: Fix handling of vector instructions
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 4441eb02333a9b46a0d919aa7a6d3b137b5f2562 ]
Vector load/store instructions are special because they are always aligned. Thus unaligned EA needs to be aligned down before comparing it with watch ranges. Otherwise we might consider valid event as invalid.
--- arch/powerpc/kernel/hw_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/hw_breakpoint.c +2 -0
@@ -644,6 +644,8 @@ static void get_instr_detail(struct pt_regs *regs, struct ppc_inst *instr,if (*type ==CACHEOP ) { *size =cache_op_size (); *ea &= ~(*size -1 ); + }else if (*type ==LOAD_VMX || *type ==STORE_VMX ) { + *ea &= ~(*size -1 ); } }
Signature · 1 line
2.25.1