IB/rdmavt: add missing locks in rvt_ruc_loopback
Subsystems (5)
Sasha Levin
maintainerPATCH 1/20 IB/rdmavt: add missing locks in rvt_ruc_loopback
From: Niels Dossche <[email protected]>
[ Upstream commit 22cbc6c2681a0a4fe76150270426e763d52353a4 ]
The documentation of the function rvt_error_qp says both r_lock and s_lock need to be held when calling that function.
It also asserts using lockdep that both of those locks are held. rvt_error_qp is called form rvt_send_cq, which is called from rvt_qp_complete_swqe, which is called from rvt_send_complete, which is called from rvt_ruc_loopback in two places. Both of these places do not hold r_lock. Fix this by acquiring a spin_lock of r_lock in both of these places.
The r_lock acquiring cannot be added in rvt_qp_complete_swqe because some of its other callers already have r_lock acquired.
--- drivers/infiniband/sw/rdmavt/qp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +5 -1
@@ -2812,7 +2812,7 @@ void rvt_qp_iter(struct rvt_dev_info *rdi,EXPORT_SYMBOL (rvt_qp_iter);/* -* This should be called with s_lock held. +* This should be called with s_lock and r_lock held. */ void rvt_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status)
@@ -3171,7 +3171,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp) rvp->n_loop_pkts++; flush_send: sqp->s_rnr_retry = sqp->s_rnr_retry_cnt; +spin_lock (&sqp->r_lock);rvt_send_complete (sqp, wqe, send_status); +spin_unlock (&sqp->r_lock);if (local_ops) {atomic_dec (&sqp->local_ops_pending); local_ops =0 ;
@@ -3225,7 +3227,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp)spin_unlock_irqrestore (&qp->r_lock, flags); serr_no_r_lock:spin_lock_irqsave (&sqp->s_lock, flags); +spin_lock (&sqp->r_lock);rvt_send_complete (sqp, wqe, send_status); +spin_unlock (&sqp->r_lock);if (sqp->ibqp.qp_type ==IB_QPT_RC ) {int lastwqe;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/20 ARM: dts: ox820: align interrupt controller node name with dtschema
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit fbcd5ad7a419ad40644a0bb8b4152bc660172d8a ]
Fixes dtbs_check warnings like:
gic@1000: $nodename:0: 'gic@1000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
--- arch/arm/boot/dts/ox820.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ox820.dtsi +1 -1
@@ -287,7 +287,7 @@ local-timer@600 { clocks = <&armclk>; }; - gic: gic@1000 { + gic: interrupt-controller@1000 { compatible = "arm,arm11mp-gic"; interrupt-controller; #interrupt-cells = <3>;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/20 PM / devfreq: rk3399_dmc: Disable edev on remove()
In reply to Sasha LevinFrom: Brian Norris <[email protected]>
[ Upstream commit 2fccf9e6050e0e3b8b4cd275d41daf7f7fa22804 ]
Otherwise we hit an unablanced enable-count when unbinding the DFI device:
[ 1279.659119] ------------[ cut here ]------------ [ 1279.659179] WARNING: CPU: 2 PID: 5638 at drivers/devfreq/devfreq-event.c:360 devfreq_event_remove_edev+0x84/0x8c ... [ 1279.659352] Hardware name: Google Kevin (DT) [ 1279.659363] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [ 1279.659371] pc : devfreq_event_remove_edev+0x84/0x8c [ 1279.659380] lr : devm_devfreq_event_release+0x1c/0x28 ... [ 1279.659571] Call trace: [ 1279.659582] devfreq_event_remove_edev+0x84/0x8c [ 1279.659590] devm_devfreq_event_release+0x1c/0x28 [ 1279.659602] release_nodes+0x1cc/0x244 [ 1279.659611] devres_release_all+0x44/0x60 [ 1279.659621] device_release_driver_internal+0x11c/0x1ac [ 1279.659629] device_driver_detach+0x20/0x2c [ 1279.659641] unbind_store+0x7c/0xb0 [ 1279.659650] drv_attr_store+0x2c/0x40 [ 1279.659663] sysfs_kf_write+0x44/0x58 [ 1279.659672] kernfs_fop_write_iter+0xf4/0x190 [ 1279.659684] vfs_write+0x2b0/0x2e4 [ 1279.659693] ksys_write+0x80/0xec [ 1279.659701] __arm64_sys_write+0x24/0x30 [ 1279.659714] el0_svc_common+0xf0/0x1d8 [ 1279.659724] do_el0_svc_compat+0x28/0x3c [ 1279.659738] el0_svc_compat+0x10/0x1c [ 1279.659746] el0_sync_compat_handler+0xa8/0xcc [ 1279.659758] el0_sync_compat+0x188/0x1c0 [ 1279.659768] ---[ end trace cec200e5094155b4 ]---
--- drivers/devfreq/rk3399_dmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/devfreq/rk3399_dmc.c +2 -0
@@ -485,6 +485,8 @@ static int rk3399_dmcfreq_remove(struct platform_device *pdev) {struct rk3399_dmcfreq *dmcfreq =dev_get_drvdata (&pdev->dev); +devfreq_event_disable_edev (dmcfreq->edev); +/* * Before remove the opp table we need to unregister the opp notifier. */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/20 fs: jfs: fix possible NULL pointer dereference in dbFree()
In reply to Sasha LevinFrom: Zixuan Fu <[email protected]>
[ Upstream commit 0d4837fdb796f99369cf7691d33de1b856bcaf1f ]
In our fault-injection testing, the variable "nblocks" in dbFree() can be zero when kmalloc_array() fails in dtSearch(). In this case, the variable
"mp" in dbFree() would be NULL and then it is dereferenced in
"write_metapage(mp)".
The failure log is listed as follows:
[ 13.824137] BUG: kernel NULL pointer dereference, address: 0000000000000020 ... [ 13.827416] RIP: 0010:dbFree+0x5f7/0x910 [jfs] [ 13.834341] Call Trace: [ 13.834540] <TASK> [ 13.834713] txFreeMap+0x7b4/0xb10 [jfs] [ 13.835038] txUpdateMap+0x311/0x650 [jfs] [ 13.835375] jfs_lazycommit+0x5f2/0xc70 [jfs] [ 13.835726] ? sched_dynamic_update+0x1b0/0x1b0 [ 13.836092] kthread+0x3c2/0x4a0 [ 13.836355] ? txLockFree+0x160/0x160 [jfs] [ 13.836763] ? kthread_unuse_mm+0x160/0x160 [ 13.837106] ret_from_fork+0x1f/0x30 [ 13.837402] </TASK>
...
This patch adds a NULL check of "mp" before "write_metapage(mp)" is called.
--- fs/jfs/jfs_dmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +2 -1
@@ -385,7 +385,8 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) }/* write the last buffer. */ -write_metapage (mp); +if (mp) +write_metapage (mp);IREAD_UNLOCK (ipbmap);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/20 arm64: Expand ESR_ELx_WFx_ISS_TI to match its ARMv8.7 definition
In reply to Sasha LevinFrom: Marc Zyngier <[email protected]>
[ Upstream commit 6a437208cb942a2dd98f7e1c3fd347ed3d425ffc ]
Starting with FEAT_WFXT in ARMv8.7, the TI field in the ISS that is reported on a WFx trap is expanded by one bit to allow the description of WFET and WFIT.
Special care is taken to exclude the WFxT bit from the mask used to match WFI so that it also matches WFIT when trapped from EL0.
--- arch/arm64/include/asm/esr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/include/asm/esr.h +4 -2
@@ -128,7 +128,8 @@#define ESR_ELx_CV (UL(1) << 24)#define ESR_ELx_COND_SHIFT (20)#define ESR_ELx_COND_MASK (UL(0xF) << ESR_ELx_COND_SHIFT) -#define ESR_ELx_WFx_ISS_TI (UL(1) << 0) +#define ESR_ELx_WFx_ISS_TI (UL(3) << 0) +#define ESR_ELx_WFx_ISS_WFxT (UL(2) << 0)#define ESR_ELx_WFx_ISS_WFI (UL(0) << 0)#define ESR_ELx_WFx_ISS_WFE (UL(1) << 0)#define ESR_ELx_xVC_IMM_MASK ((1UL << 16) - 1)
@@ -141,7 +142,8 @@#define DISR_EL1_ESR_MASK (ESR_ELx_AET | ESR_ELx_EA | ESR_ELx_FSC)/* ESR value templates for specific events */ -#define ESR_ELx_WFx_MASK (ESR_ELx_EC_MASK | ESR_ELx_WFx_ISS_TI) +#define ESR_ELx_WFx_MASK (ESR_ELx_EC_MASK | \ + (ESR_ELx_WFx_ISS_TI & ~ESR_ELx_WFx_ISS_WFxT))#define ESR_ELx_WFx_WFI_VAL ((ESR_ELx_EC_WFx << ESR_ELx_EC_SHIFT) | \ ESR_ELx_WFx_ISS_WFI)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/20 ARM: OMAP1: clock: Fix UART rate reporting algorithm
In reply to Sasha LevinFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 338d5d476cde853dfd97378d20496baabc2ce3c0 ]
Since its introduction to the mainline kernel, omap1_uart_recalc() helper makes incorrect use of clk->enable_bit as a ready to use bitmap mask while it only provides the bit number. Fix it.
--- arch/arm/mach-omap1/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap1/clock.c +1 -1
@@ -41,7 +41,7 @@ static DEFINE_SPINLOCK(clockfw_lock);unsigned long omap1_uart_recalc (struct clk *clk) {unsigned int val =__raw_readl (clk->enable_reg); -return val & clk->enable_bit ?48000000 :12000000 ; +return val &1 << clk->enable_bit ?48000000 :12000000 ; }unsigned long omap1_sossi_recalc (struct clk *clk)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/20 selftests/resctrl: Change the default limited time to 120 seconds
In reply to Sasha LevinFrom: Shaopeng Tan <[email protected]>
[ Upstream commit e2e3fb6ef0d6548defbe0be6e092397aaa92f3a1 ]
When testing on a Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz the resctrl selftests fail due to timeout after exceeding the default time limit of 45 seconds. On this system the test takes about 68 seconds. Since the failing test by default accesses a fixed size of memory, the execution time should not vary significantly between different environment. A new default of 120 seconds should be sufficient yet easy to customize with the introduction of the "settings" file for reference.
--- tools/testing/selftests/resctrl/settings | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tools/testing/selftests/resctrl/settings
tools/testing/selftests/resctrl/settings new file +3 -0
@@ -0,0 +1,3 @@ +# If running time is longer than 120 seconds when new tests are added in +# the future, increase timeout here. +timeout=120
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/20 powerpc/fadump: Fix fadump to work with a different endian capture kernel
In reply to Sasha LevinFrom: Hari Bathini <[email protected]>
[ Upstream commit b74196af372f7cb4902179009265fe63ac81824f ]
Dump capture would fail if capture kernel is not of the endianess as the production kernel, because the in-memory data structure (struct opal_fadump_mem_struct) shared across production kernel and capture kernel assumes the same endianess for both the kernels, which doesn't have to be true always. Fix it by having a well-defined endianess for struct opal_fadump_mem_struct.
--- arch/powerpc/platforms/powernv/opal-fadump.c | 94 +++++++++++--------- arch/powerpc/platforms/powernv/opal-fadump.h | 10 +-- 2 files changed, 57 insertions(+), 47 deletions(-)
arch/powerpc/platforms/powernv/opal-fadump.c +52 -42
@@ -60,7 +60,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) addr =be64_to_cpu (addr);pr_debug ("Kernel metadata addr: %llx\n" , addr); opal_fdm_active = (void *)addr; -if (opal_fdm_active->registered_regions ==0 ) +if (be16_to_cpu (opal_fdm_active->registered_regions) ==0 )return ; ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_BOOT_MEM , &addr);
@@ -95,17 +95,17 @@ static int opal_fadump_unregister(struct fw_dump *fadump_conf);static void opal_fadump_update_config (struct fw_dump *fadump_conf,const struct opal_fadump_mem_struct *fdm) { -pr_debug ("Boot memory regions count: %d\n" , fdm->region_cnt); +pr_debug ("Boot memory regions count: %d\n" ,be16_to_cpu (fdm->region_cnt));/* * The destination address of the first boot memory region is the * destination address of boot memory regions. */ - fadump_conf->boot_mem_dest_addr = fdm->rgn[0 ].dest; + fadump_conf->boot_mem_dest_addr =be64_to_cpu (fdm->rgn[0 ].dest);pr_debug ("Destination address of boot memory regions: %#016llx\n" , fadump_conf->boot_mem_dest_addr); - fadump_conf->fadumphdr_addr = fdm->fadumphdr_addr; + fadump_conf->fadumphdr_addr =be64_to_cpu (fdm->fadumphdr_addr); }/*
@@ -126,9 +126,9 @@ static void opal_fadump_get_config(struct fw_dump *fadump_conf, fadump_conf->boot_memory_size =0 ;pr_debug ("Boot memory regions:\n" ); -for (i =0 ; i < fdm->region_cnt; i++) { - base = fdm->rgn[i].src; - size = fdm->rgn[i].size; +for (i =0 ; i <be16_to_cpu (fdm->region_cnt); i++) { + base =be64_to_cpu (fdm->rgn[i].src); + size =be64_to_cpu (fdm->rgn[i].size);pr_debug ("\t[%03d] base: 0x%lx, size: 0x%lx\n" , i, base, size); fadump_conf->boot_mem_addr[i] = base;
@@ -143,7 +143,7 @@ static void opal_fadump_get_config(struct fw_dump *fadump_conf,* Start address of reserve dump area (permanent reservation) for * re-registering FADump after dump capture. */ - fadump_conf->reserve_dump_area_start = fdm->rgn[0 ].dest; + fadump_conf->reserve_dump_area_start =be64_to_cpu (fdm->rgn[0 ].dest);/* * Rarely, but it can so happen that system crashes before all
@@ -155,13 +155,14 @@ static void opal_fadump_get_config(struct fw_dump *fadump_conf,* Hope the memory that could not be preserved only has pages * that are usually filtered out while saving the vmcore. */ -if (fdm->region_cnt > fdm->registered_regions) { +if (be16_to_cpu (fdm->region_cnt) >be16_to_cpu (fdm->registered_regions)) {pr_warn ("Not all memory regions were saved!!!\n" );pr_warn (" Unsaved memory regions:\n" ); - i = fdm->registered_regions; -while (i < fdm->region_cnt) { + i =be16_to_cpu (fdm->registered_regions); +while (i <be16_to_cpu (fdm->region_cnt)) {pr_warn ("\t[%03d] base: 0x%llx, size: 0x%llx\n" , - i, fdm->rgn[i].src, fdm->rgn[i].size); + i,be64_to_cpu (fdm->rgn[i].src), +be64_to_cpu (fdm->rgn[i].size)); i++; }
@@ -170,7 +171,7 @@ static void opal_fadump_get_config(struct fw_dump *fadump_conf, } fadump_conf->boot_mem_top = (fadump_conf->boot_memory_size + hole_size); - fadump_conf->boot_mem_regs_cnt = fdm->region_cnt; + fadump_conf->boot_mem_regs_cnt =be16_to_cpu (fdm->region_cnt);opal_fadump_update_config (fadump_conf, fdm); }
@@ -178,35 +179,38 @@ static void opal_fadump_get_config(struct fw_dump *fadump_conf,static void opal_fadump_init_metadata (struct opal_fadump_mem_struct *fdm) { fdm->version =OPAL_FADUMP_VERSION ; - fdm->region_cnt =0 ; - fdm->registered_regions =0 ; - fdm->fadumphdr_addr =0 ; + fdm->region_cnt =cpu_to_be16 (0 ); + fdm->registered_regions =cpu_to_be16 (0 ); + fdm->fadumphdr_addr =cpu_to_be64 (0 ); }static u64 opal_fadump_init_mem_struct (struct fw_dump *fadump_conf) {u64 addr = fadump_conf->reserve_dump_area_start; +u16 reg_cnt;int i; opal_fdm =__va (fadump_conf->kernel_metadata);opal_fadump_init_metadata (opal_fdm);/* Boot memory regions */ + reg_cnt =be16_to_cpu (opal_fdm->region_cnt);for (i =0 ; i < fadump_conf->boot_mem_regs_cnt; i++) { - opal_fdm->rgn[i].src = fadump_conf->boot_mem_addr[i]; - opal_fdm->rgn[i].dest = addr; - opal_fdm->rgn[i].size = fadump_conf->boot_mem_sz[i]; + opal_fdm->rgn[i].src =cpu_to_be64 (fadump_conf->boot_mem_addr[i]); + opal_fdm->rgn[i].dest =cpu_to_be64 (addr); + opal_fdm->rgn[i].size =cpu_to_be64 (fadump_conf->boot_mem_sz[i]); - opal_fdm->region_cnt++; + reg_cnt++; addr += fadump_conf->boot_mem_sz[i]; } + opal_fdm->region_cnt =cpu_to_be16 (reg_cnt);/* * Kernel metadata is passed to f/w and retrieved in capture kerenl. * So, use it to save fadump header address instead of calculating it. */ - opal_fdm->fadumphdr_addr = (opal_fdm->rgn[0 ].dest + - fadump_conf->boot_memory_size); + opal_fdm->fadumphdr_addr =cpu_to_be64 (be64_to_cpu (opal_fdm->rgn[0 ].dest) + + fadump_conf->boot_memory_size);opal_fadump_update_config (fadump_conf, opal_fdm);
@@ -269,18 +273,21 @@ static u64 opal_fadump_get_bootmem_min(void)static int opal_fadump_register (struct fw_dump *fadump_conf) {s64 rc =OPAL_PARAMETER ; +u16 registered_regs;int i, err = -EIO ; -for (i =0 ; i < opal_fdm->region_cnt; i++) { + registered_regs =be16_to_cpu (opal_fdm->registered_regions); +for (i =0 ; i <be16_to_cpu (opal_fdm->region_cnt); i++) { rc =opal_mpipl_update (OPAL_MPIPL_ADD_RANGE , - opal_fdm->rgn[i].src, - opal_fdm->rgn[i].dest, - opal_fdm->rgn[i].size); +be64_to_cpu (opal_fdm->rgn[i].src), +be64_to_cpu (opal_fdm->rgn[i].dest), +be64_to_cpu (opal_fdm->rgn[i].size));if (rc !=OPAL_SUCCESS )break ; - opal_fdm->registered_regions++; + registered_regs++; } + opal_fdm->registered_regions =cpu_to_be16 (registered_regs);switch (rc) {case OPAL_SUCCESS :
@@ -291,7 +298,8 @@ static int opal_fadump_register(struct fw_dump *fadump_conf)case OPAL_RESOURCE :/* If MAX regions limit in f/w is hit, warn and proceed. */ pr_warn ("%d regions could not be registered for MPIPL as MAX limit is reached!\n" , - (opal_fdm->region_cnt - opal_fdm->registered_regions)); + (be16_to_cpu (opal_fdm->region_cnt) - +be16_to_cpu (opal_fdm->registered_regions))); fadump_conf->dump_registered =1 ; err =0 ;break ;
@@ -312,7 +320,7 @@ static int opal_fadump_register(struct fw_dump *fadump_conf)* If some regions were registered before OPAL_MPIPL_ADD_RANGE * OPAL call failed, unregister all regions. */ -if ((err <0 ) && (opal_fdm->registered_regions >0 )) +if ((err <0 ) && (be16_to_cpu (opal_fdm->registered_regions) >0 ))opal_fadump_unregister (fadump_conf);return err;
@@ -328,7 +336,7 @@ static int opal_fadump_unregister(struct fw_dump *fadump_conf)return -EIO ; } - opal_fdm->registered_regions =0 ; + opal_fdm->registered_regions =cpu_to_be16 (0 ); fadump_conf->dump_registered =0 ;return 0 ; }
@@ -563,19 +571,20 @@ static void opal_fadump_region_show(struct fw_dump *fadump_conf,else fdm_ptr = opal_fdm; -for (i =0 ; i < fdm_ptr->region_cnt; i++) { +for (i =0 ; i <be16_to_cpu (fdm_ptr->region_cnt); i++) {/* * Only regions that are registered for MPIPL * would have dump data. */ if ((fadump_conf->dump_active) && - (i < fdm_ptr->registered_regions)) - dumped_bytes = fdm_ptr->rgn[i].size; + (i <be16_to_cpu (fdm_ptr->registered_regions))) + dumped_bytes =be64_to_cpu (fdm_ptr->rgn[i].size);seq_printf (m,"DUMP: Src: %#016llx, Dest: %#016llx, " , - fdm_ptr->rgn[i].src, fdm_ptr->rgn[i].dest); +be64_to_cpu (fdm_ptr->rgn[i].src), +be64_to_cpu (fdm_ptr->rgn[i].dest));seq_printf (m,"Size: %#llx, Dumped: %#llx bytes\n" , - fdm_ptr->rgn[i].size, dumped_bytes); +be64_to_cpu (fdm_ptr->rgn[i].size), dumped_bytes); }/* Dump is active. Show reserved area start address. */
@@ -624,6 +633,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) {const __be32 *prop;unsigned long dn; +__be64 be_addr;u64 addr =0 ;int i, len;s64 ret;
@@ -680,13 +690,13 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)if (!prop)return ; - ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_KERNEL , &addr); -if ((ret !=OPAL_SUCCESS ) || !addr) { + ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_KERNEL , &be_addr); +if ((ret !=OPAL_SUCCESS ) || !be_addr) {pr_err ("Failed to get Kernel metadata (%lld)\n" , ret);return ; } - addr =be64_to_cpu (addr); + addr =be64_to_cpu (be_addr);pr_debug ("Kernel metadata addr: %llx\n" , addr); opal_fdm_active =__va (addr);
@@ -697,14 +707,14 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) }/* Kernel regions not registered with f/w for MPIPL */ -if (opal_fdm_active->registered_regions ==0 ) { +if (be16_to_cpu (opal_fdm_active->registered_regions) ==0 ) { opal_fdm_active =NULL ;return ; } - ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_CPU , &addr); -if (addr) { - addr =be64_to_cpu (addr); + ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_CPU , &be_addr); +if (be_addr) { + addr =be64_to_cpu (be_addr);pr_debug ("CPU metadata addr: %llx\n" , addr); opal_cpu_metadata =__va (addr); }
arch/powerpc/platforms/powernv/opal-fadump.h +5 -5
@@ -31,14 +31,14 @@* OPAL FADump kernel metadata * * The address of this structure will be registered with f/w for retrieving -* and processing during crash dump. +* in the capture kernel to process the crash dump. */ struct opal_fadump_mem_struct {u8 version;u8 reserved[3 ]; -u16 region_cnt;/* number of regions */ -u16 registered_regions;/* Regions registered for MPIPL */ -u64 fadumphdr_addr; +__be16 region_cnt;/* number of regions */ +__be16 registered_regions;/* Regions registered for MPIPL */ +__be64 fadumphdr_addr;struct opal_mpipl_region rgn[FADUMP_MAX_MEM_REGS ]; } __packed;
@@ -135,7 +135,7 @@ static inline void opal_fadump_read_regs(char *bufp, unsigned int regs_cnt,for (i =0 ; i < regs_cnt; i++, bufp += reg_entry_size) { reg_entry = (struct hdat_fadump_reg_entry *)bufp; val = (cpu_endian ?be64_to_cpu (reg_entry->reg_val) : - reg_entry->reg_val); + (u64)(reg_entry->reg_val)); opal_fadump_set_regval_regnum(regs, be32_to_cpu(reg_entry->reg_type), be32_to_cpu(reg_entry->reg_num),
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/20 fat: add ratelimit to fat*_ent_bread()
In reply to Sasha LevinFrom: OGAWA Hirofumi <[email protected]>
[ Upstream commit 183c3237c928109d2008c0456dff508baf692b20 ]
fat*_ent_bread() can be the cause of too many report on I/O error path. So use fat_msg_ratelimit() instead.
--- fs/fat/fatent.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/fat/fatent.c +4 -3
@@ -93,7 +93,8 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent, err_brelse:brelse (bhs[0 ]); err: -fat_msg (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , (llu )blocknr); +fat_msg_ratelimit (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , + (llu )blocknr);return -EIO ; }
@@ -106,8 +107,8 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent, fatent->fat_inode =MSDOS_SB (sb)->fat_inode; fatent->bhs[0 ] =sb_bread (sb, blocknr);if (!fatent->bhs[0 ]) { -fat_msg (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , - (llu )blocknr); +fat_msg_ratelimit (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , + (llu )blocknr);return -EIO ; } fatent->nr_bhs =1 ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/20 ARM: versatile: Add missing of_node_put in dcscb_init
In reply to Sasha LevinFrom: Peng Wu <[email protected]>
[ Upstream commit 23b44f9c649bbef10b45fa33080cd8b4166800ae ]
The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak.
--- arch/arm/mach-vexpress/dcscb.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-vexpress/dcscb.c +1 -0
@@ -143,6 +143,7 @@ static int __init dcscb_init(void)if (!node)return -ENODEV ; dcscb_base =of_iomap (node,0 ); +of_node_put (node);if (!dcscb_base)return -EADDRNOTAVAIL ; cfg =readl_relaxed (dcscb_base +DCS_CFG_R );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/20 ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f038e8186fbc5723d7d38c6fa1d342945107347e ]
The Samsung s524ad0xd1 EEPROM should use atmel,24c128 fallback, according to the AT24 EEPROM bindings.
--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos5250-smdk5250.dts +2 -2
@@ -128,7 +128,7 @@ &i2c_0 { samsung,i2c-max-bus-freq = <20000>; eeprom@50 { - compatible = "samsung,s524ad0xd1"; + compatible = "samsung,s524ad0xd1", "atmel,24c128"; reg = <0x50>; };
@@ -287,7 +287,7 @@ &i2c_1 { samsung,i2c-max-bus-freq = <20000>; eeprom@51 { - compatible = "samsung,s524ad0xd1"; + compatible = "samsung,s524ad0xd1", "atmel,24c128"; reg = <0x51>; };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/20 ARM: hisi: Add missing of_node_put after of_find_compatible_node
In reply to Sasha LevinFrom: Peng Wu <[email protected]>
[ Upstream commit 9bc72e47d4630d58a840a66a869c56b29554cfe4 ]
of_find_compatible_node will increment the refcount of the returned device_node. Calling of_node_put() to avoid the refcount leak
--- arch/arm/mach-hisi/platsmp.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-hisi/platsmp.c +4 -0
@@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus) } ctrl_base =of_iomap (np,0 );if (!ctrl_base) { +of_node_put (np);pr_err ("failed to map address\n" );return ; }if (of_property_read_u32 (np,"smp-offset" , &offset) <0 ) { +of_node_put (np);pr_err ("failed to find smp-offset property\n" );return ; } ctrl_base += offset; +of_node_put (np); } }
@@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)if (WARN_ON (!node))return -1 ; ctrl_base =of_iomap (node,0 ); +of_node_put (node);/* set the secondary core boot from DDR */ remap_reg_value =readl_relaxed (ctrl_base +REG_SC_CTRL );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/20 PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
In reply to Sasha LevinFrom: Yicong Yang <[email protected]>
[ Upstream commit a91ee0e9fca9d7501286cfbced9b30a33e52740a ]
The sysfs sriov_numvfs_store() path acquires the device lock before the config space access lock:
sriov_numvfs_store
device_lock # A (1) acquire device lock
sriov_configure
vfio_pci_sriov_configure # (for example)
vfio_pci_core_sriov_configure
pci_disable_sriov
sriov_disable
pci_cfg_access_lock
pci_wait_cfg # B (4) wait for dev->block_cfg_access == 0
Previously, pci_dev_lock() acquired the config space access lock before the device lock:
pci_dev_lock
pci_cfg_access_lock
dev->block_cfg_access = 1 # B (2) set dev->block_cfg_access = 1
device_lock # A (3) wait for device lock
Any path that uses pci_dev_lock(), e.g., pci_reset_function(), may deadlock with sriov_numvfs_store() if the operations occur in the sequence
(1) (2) (3) (4).
Avoid the deadlock by reversing the order in pci_dev_lock() so it acquires the device lock before the config space access lock, the same as the sriov_numvfs_store() path.
[bhelgaas: combined and adapted commit log from Jay Zhou's independent subsequent posting:
https://lore.kernel.org/r/[email protected]]
--- drivers/pci/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pci.c +5 -5
@@ -4915,18 +4915,18 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe)static void pci_dev_lock (struct pci_dev *dev) { -pci_cfg_access_lock (dev);/* block PM suspend, driver probe, etc. */ device_lock (&dev->dev); +pci_cfg_access_lock (dev); }/* Return 1 on successful lock, 0 on contention */ static int pci_dev_trylock (struct pci_dev *dev) { -if (pci_cfg_access_trylock (dev)) { -if (device_trylock (&dev->dev)) +if (device_trylock (&dev->dev)) { +if (pci_cfg_access_trylock (dev))return 1 ; -pci_cfg_access_unlock (dev); +device_unlock (&dev->dev); }return 0 ;
@@ -4934,8 +4934,8 @@ static int pci_dev_trylock(struct pci_dev *dev)static void pci_dev_unlock (struct pci_dev *dev) { -device_unlock (&dev->dev);pci_cfg_access_unlock (dev); +device_unlock (&dev->dev); }static void pci_dev_save_and_disable (struct pci_dev *dev)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/20 tracing: incorrect isolate_mote_t cast in mm_vmscan_lru_isolate
In reply to Sasha LevinFrom: Vasily Averin <[email protected]>
[ Upstream commit 2b132903de7124dd9a758be0c27562e91a510848 ]
Fixes following sparse warnings:
CHECK mm/vmscan.cmm/vmscan.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/vmscan.h):./include/trace/events/vmscan.h:281:1: sparse: warning:
cast to restricted isolate_mode_t./include/trace/events/vmscan.h:281:1: sparse: warning:
restricted isolate_mode_t degrades to integer
--- include/trace/events/vmscan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/trace/events/vmscan.h +2 -2
@@ -283,7 +283,7 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __field(unsigned long, nr_scanned) __field(unsigned long, nr_skipped) __field(unsigned long, nr_taken) - __field(isolate_mode_t, isolate_mode) + __field(unsigned int, isolate_mode) __field(int, lru) ),
@@ -294,7 +294,7 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __entry->nr_scanned = nr_scanned; __entry->nr_skipped = nr_skipped; __entry->nr_taken = nr_taken; - __entry->isolate_mode = isolate_mode; + __entry->isolate_mode = (__force unsigned int )isolate_mode; __entry->lru = lru; ),
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/20 powerpc/xics: fix refcount leak in icp_opal_init()
In reply to Sasha LevinFrom: Lv Ruyi <[email protected]>
[ Upstream commit 5dd9e27ea4a39f7edd4bf81e9e70208e7ac0b7c9 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, use of_node_put() on it when done.
--- arch/powerpc/sysdev/xics/icp-opal.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/sysdev/xics/icp-opal.c +1 -0
@@ -195,6 +195,7 @@ int icp_opal_init(void)printk ("XICS: Using OPAL ICP fallbacks\n" ); +of_node_put (np);return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/20 powerpc/powernv: fix missing of_node_put in uv_init()
In reply to Sasha LevinFrom: Lv Ruyi <[email protected]>
[ Upstream commit 3ffa9fd471f57f365bc54fc87824c530422f64a5 ]
of_find_compatible_node() returns node pointer with refcount incremented, use of_node_put() on it when done.
--- arch/powerpc/platforms/powernv/ultravisor.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/powernv/ultravisor.c +1 -0
@@ -55,6 +55,7 @@ static int __init uv_init(void)return -ENODEV ; uv_memcons =memcons_init (node,"memcons" ); +of_node_put (node);if (!uv_memcons)return -ENOENT ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 17/20 macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled
In reply to Sasha LevinFrom: Finn Thain <[email protected]>
[ Upstream commit 86ce436e30d86327c9f5260f718104ae7b21f506 ]
drivers/macintosh/via-pmu-event.o: In function `via_pmu_event':
via-pmu-event.c:(.text+0x44): undefined reference to input_event' via-pmu-event.c:(.text+0x68): undefined reference to input_event' via-pmu-event.c:(.text+0x94): undefined reference to input_event' via-pmu-event.c:(.text+0xb8): undefined reference to input_event' drivers/macintosh/via-pmu-event.o: In function `via_pmu_event_init':
via-pmu-event.c:(.init.text+0x20): undefined reference to input_allocate_device' via-pmu-event.c:(.init.text+0xc4): undefined reference to input_register_device' via-pmu-event.c:(.init.text+0xd4): undefined reference to `input_free_device' make[1]: *** [Makefile:1155: vmlinux] Error 1
make: *** [Makefile:350: __build_one_by_one] Error 2
Don't call into the input subsystem unless CONFIG_INPUT is built-in.
--- drivers/macintosh/Kconfig | 4 ++++ drivers/macintosh/Makefile | 3 ++- drivers/macintosh/via-pmu.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/macintosh/Kconfig +4 -0
@@ -67,6 +67,10 @@ config ADB_PMU this device; you should do so if your machine is one of those mentioned above. +config ADB_PMU_EVENT + def_bool y + depends on ADB_PMU && INPUT=y + config ADB_PMU_LED bool "Support for the Power/iBook front LED" depends on PPC_PMAC && ADB_PMU
drivers/macintosh/Makefile +2 -1
@@ -12,7 +12,8 @@ obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o obj-$(CONFIG_INPUT_ADBHID) += adbhid.o obj-$(CONFIG_ANSLCD) += ans-lcd.o -obj-$(CONFIG_ADB_PMU) += via-pmu.o via-pmu-event.o +obj-$(CONFIG_ADB_PMU) += via-pmu.o +obj-$(CONFIG_ADB_PMU_EVENT) += via-pmu-event.o obj-$(CONFIG_ADB_PMU_LED) += via-pmu-led.o obj-$(CONFIG_PMAC_BACKLIGHT) += via-pmu-backlight.o obj-$(CONFIG_ADB_CUDA) += via-cuda.o
drivers/macintosh/via-pmu.c +1 -1
@@ -1464,7 +1464,7 @@ pmu_handle_data(unsigned char *data, int len)pmu_pass_intr (data, len);/* len == 6 is probably a bad check. But how do I * know what PMU versions send what events here? */ -if (len ==6 ) { +if (IS_ENABLED (CONFIG_ADB_PMU_EVENT ) && len ==6 ) {via_pmu_event (PMU_EVT_POWER , !!(data[1 ]&8 ));via_pmu_event (PMU_EVT_LID , data[1 ]&1 ); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 18/20 powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
In reply to Sasha LevinFrom: Peng Wu <[email protected]>
[ Upstream commit 57b742a5b8945118022973e6416b71351df512fb ]
The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak.
--- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/dart_iommu.c +4 -2
@@ -403,9 +403,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) }/* Initialize the DART HW */ -if (dart_init (dn) !=0 ) +if (dart_init (dn) !=0 ) { +of_node_put (dn);return ; - + }/* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected
@@ -418,6 +419,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)/* Setup pci_dma ops */ set_pci_dma_ops (&dma_iommu_ops); +of_node_put (dn); }#ifdef CONFIG_PM
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 19/20 RDMA/hfi1: Prevent panic when SDMA is disabled
In reply to Sasha LevinFrom: Douglas Miller <[email protected]>
[ Upstream commit 629e052d0c98e46dde9f0824f0aa437f678d9b8f ]
If the hfi1 module is loaded with HFI1_CAP_SDMA off, a call to hfi1_write_iter() will dereference a NULL pointer and panic. A typical stack frame is:
sdma_select_user_engine [hfi1]
hfi1_user_sdma_process_request [hfi1]
hfi1_write_iter [hfi1]
do_iter_readv_writev
do_iter_write
vfs_writev
do_writev
do_syscall_64
The fix is to test for SDMA in hfi1_write_iter() and fail the I/O with EINVAL.
--- drivers/infiniband/hw/hfi1/file_ops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hfi1/file_ops.c +2 -0
@@ -308,6 +308,8 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)unsigned long dim = from->nr_segs;int idx; +if (!HFI1_CAP_IS_KSET (SDMA )) +return -EINVAL ; idx =srcu_read_lock (&fd->pq_srcu); pq =srcu_dereference (fd->pq, &fd->pq_srcu);if (!cq || !pq) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 20/20 drm: fix EDID struct for old ARM OABI format
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
[ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ]
When building the kernel for arm with the "-mabi=apcs-gnu" option, gcc will force alignment of all structures and unions to a word boundary (see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=XX" option if you're a gcc person), even when the members of said structures do not want or need said alignment.
This completely messes up the structure alignment of 'struct edid' on those targets, because even though all the embedded structures are marked with "__attribute__((packed))", the unions that contain them are not.
This was exposed by commit f1e4c916f97f ("drm/edid: add EDID block count and size helpers"), but the bug is pre-existing. That commit just made the structure layout problem cause a build failure due to the addition of the
BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);
sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data().
This legacy union alignment should probably not be used in the first place, but we can fix the layout by adding the packed attribute to the union entries even when each member is already packed and it shouldn't matter in a sane build environment.
You can see this issue with a trivial test program:
union {
struct {
char c[5];
};
struct {
char d;
unsigned e;
} __attribute__((packed));} a = { "1234" };
where building this with a normal "gcc -S" will result in the expected 5-byte size of said union:
.type a, @object .size a, 5
but with an ARM compiler and the old ABI:
arm-linux-gnu-gcc -mabi=apcs-gnu -mfloat-abi=soft -S t.c
you get
.type a, %object .size a, 8
instead, because even though each member of the union is packed, the union itself still gets aligned.
This was reported by Sudip for the spear3xx_defconfig target.
--- include/drm/drm_edid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/drm/drm_edid.h +3 -3
@@ -116,7 +116,7 @@ struct detailed_data_monitor_range {u8 supported_scalings;u8 preferred_refresh; } __attribute__((packed)) cvt; - } formula; + } __attribute__((packed)) formula; } __attribute__((packed));struct detailed_data_wpindex {
@@ -149,7 +149,7 @@ struct detailed_non_pixel {struct detailed_data_wpindex color;struct std_timing timings[6 ];struct cvt_timing cvt[4 ]; - } data; + } __attribute__((packed)) data; } __attribute__((packed));#define EDID_DETAIL_EST_TIMINGS 0xf7
@@ -167,7 +167,7 @@ struct detailed_timing {union {struct detailed_pixel_timing pixel_data;struct detailed_non_pixel other_data; - } data; + } __attribute__((packed)) data; } __attribute__((packed));#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
Signature · 1 line
2.35.1