5.4.48-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 1/261 ACPI: GED: use correct trigger type field in _Exx / _Lxx handling
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit e5c399b0bd6490c12c0af2a9eaa9d7cd805d52c9 upstream.
Commit ea6f3af4c5e63f69 ("ACPI: GED: add support for _Exx / _Lxx handler methods") added a reference to the 'triggering' field of either the normal or the extended ACPI IRQ resource struct, but inadvertently used the wrong pointer in the latter case. Note that both pointers refer to the same union, and the 'triggering' field appears at the same offset in both struct types, so it currently happens to work by accident. But let's fix it nonetheless
--- drivers/acpi/evged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/evged.c +1 -1
@@ -94,7 +94,7 @@ static acpi_status acpi_ged_request_inte trigger = p->triggering; }else { gsi = pext->interrupts[0 ]; - trigger = p->triggering; + trigger = pext->triggering; } irq = r.start;
Greg Kroah-Hartman
maintainerPATCH 10/261 objtool: Ignore empty alternatives
In reply to Greg Kroah-HartmanFrom: Julien Thierry <[email protected]>
[ Upstream commit 7170cf47d16f1ba29eca07fd818870b7af0a93a5 ]
The .alternatives section can contain entries with no original instructions. Objtool will currently crash when handling such an entry.
Just skip that entry, but still give a warning to discourage useless entries.
--- tools/objtool/check.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/objtool/check.c +6 -0
@@ -865,6 +865,12 @@ static int add_special_section_alts(struct objtool_file *file) }if (special_alt->group) { +if (!special_alt->orig_len) { +WARN_FUNC ("empty alternative entry" , + orig_insn->sec, orig_insn->offset); +continue ; + } + ret =handle_group_alt (file, special_alt, orig_insn, &new_insn);if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 11/261 spi: spi-mem: Fix Dual/Quad modes on Octal-capable devices
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 80300a7d5f2d7178335652f41d2e55ba898b4ec1 ]
Currently buswidths 2 and 4 are rejected for a device that advertises Octal capabilities. Allow these buswidths, just like is done for buswidth 2 and Quad-capable devices.
--- drivers/spi/spi-mem.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/spi/spi-mem.c +6 -4
@@ -108,15 +108,17 @@ static int spi_check_buswidth_req(struct spi_mem *mem, u8 buswidth, bool tx)return 0 ;case 2 : -if ((tx && (mode & (SPI_TX_DUAL |SPI_TX_QUAD ))) || - (!tx && (mode & (SPI_RX_DUAL |SPI_RX_QUAD )))) +if ((tx && + (mode & (SPI_TX_DUAL |SPI_TX_QUAD |SPI_TX_OCTAL ))) || + (!tx && + (mode & (SPI_RX_DUAL |SPI_RX_QUAD |SPI_RX_OCTAL ))))return 0 ;break ;case 4 : -if ((tx && (mode &SPI_TX_QUAD )) || - (!tx && (mode &SPI_RX_QUAD ))) +if ((tx && (mode & (SPI_TX_QUAD |SPI_TX_OCTAL ))) || + (!tx && (mode & (SPI_RX_QUAD |SPI_RX_OCTAL ))))return 0 ;break ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 13/261 arm64/kernel: Fix range on invalidating dcache for boot page tables
In reply to Greg Kroah-HartmanFrom: Gavin Shan <[email protected]>
[ Upstream commit 9d2d75ede59bc1edd8561f2ee9d4702a5ea0ae30 ]
Prior to commit 8eb7e28d4c642c31 ("arm64/mm: move runtime pgds to rodata"), idmap_pgd_dir, tramp_pg_dir, reserved_ttbr0, swapper_pg_dir, and init_pg_dir were contiguous at the end of the kernel image. The maintenance at the end of __create_page_tables assumed these were contiguous, and affected everything from the start of idmap_pg_dir to the end of init_pg_dir.
That commit moved all but init_pg_dir into the .rodata section, with other data placed between idmap_pg_dir and init_pg_dir, but did not update the maintenance. Hence the maintenance is performed on much more data than necessary (but as the bootloader previously made this clean to the PoC there is no functional problem).
As we only alter idmap_pg_dir, and init_pg_dir, we only need to perform maintenance for these. As the other dirs are in .rodata, the bootloader will have initialised them as expected and cleaned them to the PoC. The kernel will initialize them as necessary after enabling the MMU.
This patch reworks the maintenance to only cover the idmap_pg_dir and init_pg_dir to avoid this unnecessary work.
--- arch/arm64/include/asm/pgtable.h | 1 + arch/arm64/kernel/head.S | 12 +++++++++--- arch/arm64/kernel/vmlinux.lds.S | 1 + 3 files changed, 11 insertions(+), 3 deletions(-)
arch/arm64/include/asm/pgtable.h +1 -0
@@ -456,6 +456,7 @@ extern pgd_t init_pg_dir[PTRS_PER_PGD];extern pgd_t init_pg_end[];extern pgd_t swapper_pg_dir[PTRS_PER_PGD ];extern pgd_t idmap_pg_dir[PTRS_PER_PGD ]; +extern pgd_t idmap_pg_end[];extern pgd_t tramp_pg_dir[PTRS_PER_PGD ];extern void set_swapper_pgd (pgd_t *pgdp,pgd_t pgd);
arch/arm64/kernel/head.S +9 -3
@@ -393,13 +393,19 @@ __create_page_tables: /* * Since the page tables have been populated with non-cacheable - * accesses (MMU disabled), invalidate the idmap and swapper page - * tables again to remove any speculatively loaded cache lines. + * accesses (MMU disabled), invalidate those tables again to + * remove any speculatively loaded cache lines. */ + dmb sy + adrp x0, idmap_pg_dir + adrp x1, idmap_pg_end + sub x1, x1, x0 + bl __inval_dcache_area + + adrp x0, init_pg_dir adrp x1, init_pg_end sub x1, x1, x0 - dmb sy bl __inval_dcache_area ret x28
arch/arm64/kernel/vmlinux.lds.S +1 -0
@@ -142,6 +142,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); idmap_pg_dir = .; . += IDMAP_DIR_SIZE; + idmap_pg_end = .; #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 tramp_pg_dir = .;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 12/261 drm/amdgpu: Init data to avoid oops while reading pp_num_states.
In reply to Greg Kroah-HartmanFrom: limingyu <[email protected]>
[ Upstream commit 6f81b2d047c59eb77cd04795a44245d6a52cdaec ]
For chip like CHIP_OLAND with si enabled(amdgpu.si_support=1), the amdgpu will expose pp_num_states to the /sys directory. In this moment, read the pp_num_states file will excute the amdgpu_get_pp_num_states func. In our case, the data hasn't been initialized, so the kernel will access some ilegal address, trigger the segmentfault and system will reboot soon:
uos@uos-PC:~$ cat /sys/devices/pci0000\:00/0000\:00\:00.0/0000\:01\:00
.0/pp_num_states Message from syslogd@uos-PC at Apr 22 09:26:20 ...
kernel:[ 82.154129] Internal error: Oops: 96000004 [#1] SMPThis patch aims to fix this problem, avoid that reading file triggers the kernel sementfault.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -1
@@ -416,8 +416,11 @@ static ssize_t amdgpu_get_pp_num_states(struct device *dev, ret =smu_get_power_num_states (&adev->smu, &data);if (ret)return ret; - }else if (adev->powerplay.pp_funcs->get_pp_num_states) + }else if (adev->powerplay.pp_funcs->get_pp_num_states) {amdgpu_dpm_get_pp_num_states (adev, &data); + }else { +memset (&data,0 ,sizeof (data)); + } buf_len =snprintf (buf,PAGE_SIZE ,"states: %d\n" , data.nums);for (i =0 ; i < data.nums; i++)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 14/261 libbpf: Fix memory leak and possible double-free in hashmap__clear
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 229bf8bf4d910510bc1a2fd0b89bd467cd71050d ]
Fix memory leak in hashmap_clear() not freeing hashmap_entry structs for each of the remaining entries. Also NULL-out bucket list to prevent possible double-free between hashmap__clear() and hashmap__free().
Running test_progs-asan flavor clearly showed this problem.
--- tools/lib/bpf/hashmap.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/lib/bpf/hashmap.c +7 -0
@@ -56,7 +56,14 @@ struct hashmap *hashmap__new(hashmap_hash_fn hash_fn,void hashmap__clear (struct hashmap *map) { +struct hashmap_entry *cur, *tmp; +int bkt; + +hashmap__for_each_entry_safe (map, cur, tmp, bkt) { +free (cur); + }free (map->buckets); + map->buckets =NULL ; map->cap = map->cap_bits = map->sz =0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 16/261 x86,smap: Fix smap_{save,restore}() alternatives
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 1ff865e343c2b59469d7e41d370a980a3f972c71 ]
As reported by objtool:
lib/ubsan.o: warning: objtool: .altinstr_replacement+0x0: alternative modifies stack lib/ubsan.o: warning: objtool: .altinstr_replacement+0x7: alternative modifies stack
the smap_{save,restore}() alternatives violate (the newly enforced) rule on stack invariance. That is, due to there only being a single ORC table it must be valid to any alternative. These alternatives violate this with the direct result that unwinds will not be correct when it hits between the PUSH and POP instructions.
Rewrite the functions to only have a conditional jump.
--- arch/x86/include/asm/smap.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/include/asm/smap.h +8 -3
@@ -57,8 +57,10 @@ static __always_inline unsigned long smap_save(void) {unsigned long flags; - asm volatile (ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC, - X86_FEATURE_SMAP) + asmvolatile ("# smap_save\n\t" + ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP) + "pushf; pop %0; " __ASM_CLAC "\n\t" + "1:" : "=rm" (flags) : : "memory", "cc"); return flags;
@@ -66,7 +68,10 @@ static __always_inline unsigned long smap_save(void) static __always_inline void smap_restore(unsigned long flags) { - asm volatile (ALTERNATIVE("", "push %0; popf", X86_FEATURE_SMAP) + asmvolatile ("# smap_restore\n\t" + ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP) + "push %0; popf\n\t" + "1:" : : "g" (flags) : "memory", "cc"); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 17/261 sched/fair: Refill bandwidth before scaling
In reply to Greg Kroah-HartmanFrom: Huaixin Chang <[email protected]>
[ Upstream commit 5a6d6a6ccb5f48ca8cf7c6d64ff83fd9c7999390 ]
In order to prevent possible hardlockup of sched_cfs_period_timer() loop, loop count is introduced to denote whether to scale quota and period or not. However, scale is done between forwarding period timer and refilling cfs bandwidth runtime, which means that period timer is forwarded with old "period" while runtime is refilled with scaled "quota".
Move do_sched_cfs_period_timer() before scaling to solve this.
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -4942,6 +4942,8 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)if (!overrun)break ; + idle =do_sched_cfs_period_timer (cfs_b, overrun, flags); +if (++count >3 ) {u64 new, old =ktime_to_ns (cfs_b->period);
@@ -4971,8 +4973,6 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)/* reset count so we don't come right back in here */ count =0 ; } - - idle =do_sched_cfs_period_timer (cfs_b, overrun, flags); }if (idle) cfs_b->period_active =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 2/261 drm/amdgpu: fix and cleanup amdgpu_gem_object_close v4
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
[ Upstream commit 82c416b13cb7d22b96ec0888b296a48dff8a09eb ]
The problem is that we can't add the clear fence to the BO when there is an exclusive fence on it since we can't guarantee the the clear fence will complete after the exclusive one.
To fix this refactor the function and also add the exclusive fence as shared to the resv object.
v2: fix warning
v3: add excl fence as shared instead
v4: squash in fix for fence handling in amdgpu_gem_object_close
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 43 ++++++++++++++----------- 1 file changed, 25 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +25 -18
@@ -161,16 +161,17 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,struct amdgpu_bo_list_entry vm_pd;struct list_head list, duplicates; +struct dma_fence *fence =NULL ;struct ttm_validate_buffer tv;struct ww_acquire_ctx ticket;struct amdgpu_bo_va *bo_va; -int r; +long r;INIT_LIST_HEAD (&list);INIT_LIST_HEAD (&duplicates); tv.bo = &bo->tbo; - tv.num_shared =1 ; + tv.num_shared =2 ;list_add (&tv.head, &list);amdgpu_vm_get_pd_bo (vm, &list, &vm_pd);
@@ -178,28 +179,34 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, r =ttm_eu_reserve_buffers (&ticket, &list, false, &duplicates, false);if (r) {dev_err (adev->dev,"leaking bo va because " -"we fail to reserve bo (%d)\n" , r); +"we fail to reserve bo (%ld)\n" , r);return ; } bo_va =amdgpu_vm_bo_find (vm, bo); -if (bo_va && --bo_va->ref_count ==0 ) { -amdgpu_vm_bo_rmv (adev, bo_va); - -if (amdgpu_vm_ready (vm)) { -struct dma_fence *fence =NULL ; +if (!bo_va || --bo_va->ref_count) + goto out_unlock; - r =amdgpu_vm_clear_freed (adev, vm, &fence); -if (unlikely (r)) { -dev_err (adev->dev,"failed to clear page " -"tables on GEM object close (%d)\n" , r); - } +amdgpu_vm_bo_rmv (adev, bo_va); +if (!amdgpu_vm_ready (vm)) + goto out_unlock; -if (fence) { -amdgpu_bo_fence (bo, fence, true); -dma_fence_put (fence); - } - } + fence =dma_resv_get_excl (bo->tbo.base.resv); +if (fence) { +amdgpu_bo_fence (bo, fence, true); + fence =NULL ; } + + r =amdgpu_vm_clear_freed (adev, vm, &fence); +if (r || !fence) + goto out_unlock; + +amdgpu_bo_fence (bo, fence, true); +dma_fence_put (fence); + +out_unlock: +if (unlikely (r <0 )) +dev_err (adev->dev,"failed to clear page " +"tables on GEM object close (%ld)\n" , r);ttm_eu_backoff_reservation (&ticket, &list); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 19/261 net: ena: fix error returning in ena_com_get_hash_function()
In reply to Greg Kroah-HartmanFrom: Arthur Kiyanovski <[email protected]>
[ Upstream commit e9a1de378dd46375f9abfd8de1e6f59ee114a793 ]
In case the "func" parameter is NULL we now return "-EINVAL". This shouldn't happen in general, but when it does happen, this is the proper way to handle it.
We also check func for NULL in the beginning of the function, as there is no reason to do all the work and realize in the end of the function it was useless.
--- drivers/net/ethernet/amazon/ena/ena_com.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/amazon/ena/ena_com.c +4 -2
@@ -2349,6 +2349,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, rss->hash_key;int rc; +if (unlikely (!func)) +return -EINVAL ; + rc = ena_com_get_feature_ex(ena_dev, &get_resp, ENA_ADMIN_RSS_HASH_FUNCTION, rss->hash_key_dma_addr,
@@ -2361,8 +2364,7 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,if (rss->hash_func) rss->hash_func--; -if (func) - *func = rss->hash_func; + *func = rss->hash_func;if (key)memcpy (key, hash_key->key, (size_t )(hash_key->keys_num) <<2 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 22/261 arm64: cacheflush: Fix KGDB trap detection
In reply to Greg Kroah-HartmanFrom: Daniel Thompson <[email protected]>
[ Upstream commit ab8ad279ceac4fc78ae4dcf1a26326e05695e537 ]
flush_icache_range() contains a bodge to avoid issuing IPIs when the kgdb trap handler is running because issuing IPIs is unsafe (and not needed) in this execution context. However the current test, based on kgdb_connected is flawed: it both over-matches and under-matches.
The over match occurs because kgdb_connected is set when gdb attaches to the stub and remains set during normal running. This is relatively harmelss because in almost all cases irq_disabled() will be false.
The under match is more serious. When kdb is used instead of kgdb to access the debugger then kgdb_connected is not set in all the places that the debug core updates sw breakpoints (and hence flushes the icache). This can lead to deadlock.
Fix by replacing the ad-hoc check with the proper kgdb macro. This also allows us to drop the #ifdef wrapper.
--- arch/arm64/include/asm/cacheflush.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/cacheflush.h +3 -3
@@ -79,7 +79,7 @@ static inline void flush_icache_range(unsigned long start, unsigned long end)* IPI all online CPUs so that they undergo a context synchronization * event and are forced to refetch the new instructions. */ -#ifdef CONFIG_KGDB +/* * KGDB performs cache maintenance with interrupts disabled, so we * will deadlock trying to IPI the secondary CPUs. In theory, we can
@@ -89,9 +89,9 @@ static inline void flush_icache_range(unsigned long start, unsigned long end)* the patching operation, so we don't need extra IPIs here anyway. * In which case, add a KGDB-specific bodge and return early. */ -if (kgdb_connected &&irqs_disabled ()) +if (in_dbg_master ())return ; -#endif +kick_all_cpus_sync (); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 4/261 drm: bridge: adv7511: Extend list of audio sample rates
In reply to Greg Kroah-HartmanFrom: Bogdan Togorean <[email protected]>
[ Upstream commit b97b6a1f6e14a25d1e1ca2a46c5fa3e2ca374e22 ]
ADV7511 support sample rates up to 192kHz. CTS and N parameters should be computed accordingly so this commit extend the list up to maximum supported sample rate.
--- drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c +7 -5
@@ -19,13 +19,15 @@ static void adv7511_calc_cts_n(unsigned int f_tmds, unsigned int fs, {switch (fs) {case 32000 : - *n =4096 ; +case 48000 : +case 96000 : +case 192000 : + *n = fs *128 /1000 ;break ;case 44100 : - *n =6272 ; -break ; -case 48000 : - *n =6144 ; +case 88200 : +case 176400 : + *n = fs *128 /900 ;break ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 5/261 media: staging: imgu: do not hold spinlock during freeing mmu page table
In reply to Greg Kroah-HartmanFrom: Bingbu Cao <[email protected]>
[ Upstream commit e1ebe9f9c88e5a78fcc4670a9063c9b3cd87dda4 ]
ImgU need set the mmu page table in memory as uncached, and set back to write-back when free the page table by set_memory_wb(), set_memory_wb() can not do flushing without interrupt, so the spinlock should not be hold during ImgU page alloc and free, the interrupt should be enabled during memory cache flush.
This patch release spinlock before freeing pages table.
--- drivers/staging/media/ipu3/ipu3-mmu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/media/ipu3/ipu3-mmu.c +6 -4
@@ -174,8 +174,10 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx)spin_lock_irqsave (&mmu->lock, flags); l2pt = mmu->l2pts[l1pt_idx]; -if (l2pt) - goto done; +if (l2pt) { +spin_unlock_irqrestore (&mmu->lock, flags); +return l2pt; + }spin_unlock_irqrestore (&mmu->lock, flags);
@@ -190,8 +192,9 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) l2pt = mmu->l2pts[l1pt_idx];if (l2pt) { +spin_unlock_irqrestore (&mmu->lock, flags);imgu_mmu_free_page_table (new_l2pt); - goto done; +return l2pt; } l2pt = new_l2pt;
@@ -200,7 +203,6 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) pteval =IPU3_ADDR2PTE (virt_to_phys (new_l2pt)); mmu->l1pt[l1pt_idx] = pteval; -done:spin_unlock_irqrestore (&mmu->lock, flags);return l2pt; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 6/261 media: imx: imx7-mipi-csis: Cleanup and fix subdev pad format handling
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit d321dd233b9f2bb407b8e6b4759408f09ec207c3 ]
The subdev set pad format operation currently misbehaves in multiple ways:
- mipi_csis_try_format() unconditionally stores the format in the device state, even for V4L2_SUBDEV_FORMAT_TRY.
- The format is never stored in the pad cfg, but the pad cfg format always overwrites the format requested by the user.
- The sink format is not propagated to the source.
Fix all this by reworking the set format operation as follows:
1. For the source pad, turn set() into get() as the source format is not modifiable.
2. Validate the requested format and updated the stored format accordingly.
3. Return the format actually set.
4. Propagate the format from sink to source.
--- drivers/staging/media/imx/imx7-mipi-csis.c | 82 ++++++++++------------ 1 file changed, 37 insertions(+), 45 deletions(-)
drivers/staging/media/imx/imx7-mipi-csis.c +37 -45
@@ -657,28 +657,6 @@ static int mipi_csis_init_cfg(struct v4l2_subdev *mipi_sd,return 0 ; } -static struct csis_pix_format const * -mipi_csis_try_format (struct v4l2_subdev *mipi_sd,struct v4l2_mbus_framefmt *mf) -{ -struct csi_state *state =mipi_sd_to_csis_state (mipi_sd); -struct csis_pix_format const *csis_fmt; - - csis_fmt =find_csis_format (mf->code); -if (!csis_fmt) - csis_fmt = &mipi_csis_formats[0 ]; - -v4l_bound_align_image (&mf->width,1 ,CSIS_MAX_PIX_WIDTH , - csis_fmt->pix_width_alignment, - &mf->height,1 ,CSIS_MAX_PIX_HEIGHT ,1 , -0 ); - - state->format_mbus.code = csis_fmt->code; - state->format_mbus.width = mf->width; - state->format_mbus.height = mf->height; - -return csis_fmt; -} -static struct v4l2_mbus_framefmt * mipi_csis_get_format(struct csi_state *state, struct v4l2_subdev_pad_config *cfg,
@@ -691,53 +669,67 @@ mipi_csis_get_format(struct csi_state *state,return &state->format_mbus; } -static int mipi_csis_set_fmt (struct v4l2_subdev *mipi_sd, +static int mipi_csis_get_fmt (struct v4l2_subdev *mipi_sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_format *sdformat) {struct csi_state *state =mipi_sd_to_csis_state (mipi_sd); -struct csis_pix_format const *csis_fmt;struct v4l2_mbus_framefmt *fmt; -if (sdformat->pad >=CSIS_PADS_NUM ) -return -EINVAL ; - - fmt =mipi_csis_get_format (state, cfg, sdformat->which, sdformat->pad); -mutex_lock (&state->lock); -if (sdformat->pad ==CSIS_PAD_SOURCE ) { - sdformat->format = *fmt; - goto unlock; - } - - csis_fmt =mipi_csis_try_format (mipi_sd, &sdformat->format); - + fmt =mipi_csis_get_format (state, cfg, sdformat->which, sdformat->pad); sdformat->format = *fmt; - -if (csis_fmt && sdformat->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) - state->csis_fmt = csis_fmt; -else - cfg->try_fmt = sdformat->format; - -unlock:mutex_unlock (&state->lock);return 0 ; } -static int mipi_csis_get_fmt (struct v4l2_subdev *mipi_sd, +static int mipi_csis_set_fmt (struct v4l2_subdev *mipi_sd,struct v4l2_subdev_pad_config *cfg,struct v4l2_subdev_format *sdformat) {struct csi_state *state =mipi_sd_to_csis_state (mipi_sd); +struct csis_pix_format const *csis_fmt;struct v4l2_mbus_framefmt *fmt; -mutex_lock (&state->lock); +/* +* The CSIS can't transcode in any way, the source format can't be +* modified. +*/ +if (sdformat->pad ==CSIS_PAD_SOURCE ) +return mipi_csis_get_fmt (mipi_sd, cfg, sdformat); + +if (sdformat->pad !=CSIS_PAD_SINK ) +return -EINVAL ; fmt =mipi_csis_get_format (state, cfg, sdformat->which, sdformat->pad); +mutex_lock (&state->lock); + +/* Validate the media bus code and clamp the size. */ + csis_fmt =find_csis_format (sdformat->format.code); +if (!csis_fmt) + csis_fmt = &mipi_csis_formats[0 ]; + + fmt->code = csis_fmt->code; + fmt->width = sdformat->format.width; + fmt->height = sdformat->format.height; + +v4l_bound_align_image (&fmt->width,1 ,CSIS_MAX_PIX_WIDTH , + csis_fmt->pix_width_alignment, + &fmt->height,1 ,CSIS_MAX_PIX_HEIGHT ,1 ,0 ); + sdformat->format = *fmt; +/* Propagate the format from sink to source. */ + fmt =mipi_csis_get_format (state, cfg, sdformat->which, +CSIS_PAD_SOURCE ); + *fmt = sdformat->format; + +/* Store the CSIS format descriptor for active formats. */ +if (sdformat->which ==V4L2_SUBDEV_FORMAT_ACTIVE ) + state->csis_fmt = csis_fmt; +mutex_unlock (&state->lock);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 8/261 media: vicodec: Fix error codes in probe function
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f36592e7b343d853edf44d3545bb68961c0949a4 ]
If these functions fail then we return success, but we should instead preserve negative error code and return that.
--- drivers/media/platform/vicodec/vicodec-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/media/platform/vicodec/vicodec-core.c +9 -6
@@ -2172,16 +2172,19 @@ static int vicodec_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dev); -if (register_instance (dev, &dev->stateful_enc, -"stateful-encoder" , true)) + ret =register_instance (dev, &dev->stateful_enc,"stateful-encoder" , + true); +if (ret) goto unreg_dev; -if (register_instance (dev, &dev->stateful_dec, -"stateful-decoder" , false)) + ret =register_instance (dev, &dev->stateful_dec,"stateful-decoder" , + false); +if (ret) goto unreg_sf_enc; -if (register_instance (dev, &dev->stateless_dec, -"stateless-decoder" , false)) + ret =register_instance (dev, &dev->stateless_dec,"stateless-decoder" , + false); +if (ret) goto unreg_sf_dec;#ifdef CONFIG_MEDIA_CONTROLLER
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 7/261 crypto: ccp -- dont "select" CONFIG_DMADEVICES
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit eebac678556d6927f09a992872f4464cf3aecc76 ]
DMADEVICES is the top-level option for the slave DMA subsystem, and should not be selected by device drivers, as this can cause circular dependencies such as:
drivers/net/ethernet/freescale/Kconfig:6:error: recursive dependency detected!drivers/net/ethernet/freescale/Kconfig:6: symbol NET_VENDOR_FREESCALE depends on PPC_BESTCOMMdrivers/dma/bestcomm/Kconfig:6: symbol PPC_BESTCOMM depends on DMADEVICESdrivers/dma/Kconfig:6: symbol DMADEVICES is selected by CRYPTO_DEV_SP_CCPdrivers/crypto/ccp/Kconfig:10: symbol CRYPTO_DEV_SP_CCP depends on CRYPTOcrypto/Kconfig:16: symbol CRYPTO is selected by LIBCRC32C
lib/Kconfig:222: symbol LIBCRC32C is selected by LIQUIDIOdrivers/net/ethernet/cavium/Kconfig:65: symbol LIQUIDIO depends on PTP_1588_CLOCKdrivers/ptp/Kconfig:8: symbol PTP_1588_CLOCK is implied by FECdrivers/net/ethernet/freescale/Kconfig:23: symbol FEC depends on NET_VENDOR_FREESCALE
The LIQUIDIO driver causing this problem is addressed in a separate patch, but this change is needed to prevent it from happening again.
Using "depends on DMADEVICES" is what we do for all other implementations of slave DMA controllers as well.
--- drivers/crypto/ccp/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/ccp/Kconfig +1 -2
@@ -10,10 +10,9 @@ config CRYPTO_DEV_CCP_DD config CRYPTO_DEV_SP_CCP bool "Cryptographic Coprocessor device" default y - depends on CRYPTO_DEV_CCP_DD + depends on CRYPTO_DEV_CCP_DD && DMADEVICES select HW_RANDOM select DMA_ENGINE - select DMADEVICES select CRYPTO_SHA1 select CRYPTO_SHA256 help
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/261 media: si2157: Better check for running tuner in init
In reply to Greg Kroah-HartmanFrom: Brad Love <[email protected]>
[ Upstream commit e955f959ac52e145f27ff2be9078b646d0352af0 ]
Getting the Xtal trim property to check if running is less error prone. Reset if_frequency if state is unknown.
Replaces the previous "garbage check".
--- drivers/media/tuners/si2157.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/media/tuners/si2157.c +7 -8
@@ -75,24 +75,23 @@ static int si2157_init(struct dvb_frontend *fe)struct si2157_cmd cmd;const struct firmware *fw;const char *fw_name; -unsigned int uitmp, chip_id; +unsigned int chip_id, xtal_trim;dev_dbg (&client->dev,"\n" ); -/* Returned IF frequency is garbage when firmware is not running */ -memcpy (cmd.args,"\x15\x00\x06\x07" ,4 ); +/* Try to get Xtal trim property, to verify tuner still running */ +memcpy (cmd.args,"\x15\x00\x04\x02" ,4 ); cmd.wlen =4 ; cmd.rlen =4 ; ret =si2157_cmd_execute (client, &cmd); -if (ret) - goto err; - uitmp = cmd.args[2 ] <<0 | cmd.args[3 ] <<8 ; -dev_dbg (&client->dev,"if_frequency kHz=%u\n" , uitmp); + xtal_trim = cmd.args[2 ] | (cmd.args[3 ] <<8 ); -if (uitmp == dev->if_frequency /1000 ) +if (ret ==0 && xtal_trim <16 ) goto warm; + dev->if_frequency =0 ;/* we no longer know current tuner state */ +/* power up */ if (dev->chiptype ==SI2157_CHIPTYPE_SI2146 ) {memcpy (cmd.args,"\xc0\x05\x01\x00\x00\x0b\x00\x00\x01" ,9 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 34/261 MIPS: Loongson: Build ATI Radeon GPU driver as module
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit a44de7497f91834df0b8b6d459e259788ba66794 ]
When ATI Radeon GPU driver has been compiled directly into the kernel instead of as a module, we should make sure the firmware for the model (check available ones in /lib/firmware/radeon) is built-in to the kernel as well, otherwise there exists the following fatal error during GPU init, change CONFIG_DRM_RADEON=y to CONFIG_DRM_RADEON=m to fix it.
[ 1.900997] [drm] Loading RS780 Microcode [ 1.905077] radeon 0000:01:05.0: Direct firmware load for radeon/RS780_pfp.bin failed with error -2 [ 1.914140] r600_cp: Failed to load firmware "radeon/RS780_pfp.bin" [ 1.920405] [drm:r600_init] *ERROR* Failed to load firmware! [ 1.926069] radeon 0000:01:05.0: Fatal error during GPU init [ 1.931729] [drm] radeon: finishing device.
--- arch/mips/configs/loongson3_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/configs/loongson3_defconfig +1 -1
@@ -231,7 +231,7 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_USB_SUPPORT=y CONFIG_USB_VIDEO_CLASS=m CONFIG_DRM=y -CONFIG_DRM_RADEON=y +CONFIG_DRM_RADEON=m CONFIG_FB_RADEON=y CONFIG_LCD_CLASS_DEVICE=y CONFIG_LCD_PLATFORM=m
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 35/261 Bluetooth: Add SCO fallback for invalid LMP parameters error
In reply to Greg Kroah-HartmanFrom: Hsin-Yu Chao <[email protected]>
[ Upstream commit 56b5453a86203a44726f523b4133c1feca49ce7c ]
Bluetooth PTS test case HFP/AG/ACC/BI-12-I accepts SCO connection with invalid parameter at the first SCO request expecting AG to attempt another SCO request with the use of "safe settings" for given codec, base on section 5.7.1.2 of HFP 1.7 specification.
This patch addresses it by adding "Invalid LMP Parameters" (0x1e) to the SCO fallback case. Verified with below log:
< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17
Handle: 256
Transmit bandwidth: 8000
Receive bandwidth: 8000
Max latency: 13
Setting: 0x0003
Input Coding: Linear
Input Data Format: 1's complement
Input Sample Size: 8-bit
# of bits padding at MSB: 0
Air Coding Format: Transparent Data
Retransmission effort: Optimize for link quality (0x02) Packet type: 0x0380
3-EV3 may not be used
2-EV5 may not be used
3-EV5 may not be used
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
Setup Synchronous Connection (0x01|0x0028) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5
Num handles: 1
Handle: 256
Count: 1
Quoted 1 line
HCI Event: Max Slots Change (
0x1b) plen 3
Handle: 256
Max slots: 1
Quoted 1 line
HCI Event: Synchronous Connect Complete (
0x2c) plen 17
Status: Invalid LMP Parameters / Invalid LL Parameters (0x1e)
Handle: 0
Address: 00:1B:DC:F2:21:59 (OUI 00-1B-DC)
Link type: eSCO (0x02)
Transmission interval: 0x00
Retransmission window: 0x02
RX packet length: 0
TX packet length: 0
Air mode: Transparent (0x03)< HCI Command: Setup Synchronous Connection (0x01|0x0028) plen 17
Handle: 256
Transmit bandwidth: 8000
Receive bandwidth: 8000
Max latency: 8
Setting: 0x0003
Input Coding: Linear
Input Data Format: 1's complement
Input Sample Size: 8-bit
# of bits padding at MSB: 0
Air Coding Format: Transparent Data
Retransmission effort: Optimize for link quality (0x02) Packet type: 0x03c8
EV3 may be used
2-EV3 may not be used
3-EV3 may not be used
2-EV5 may not be used
3-EV5 may not be used
Quoted 1 line
HCI Event: Command Status (
0x0f) plen 4
Setup Synchronous Connection (0x01|0x0028) ncmd 1
Status: Success (0x00)Quoted 1 line
HCI Event: Max Slots Change (
0x1b) plen 3
Handle: 256
Max slots: 5
Quoted 1 line
HCI Event: Max Slots Change (
0x1b) plen 3
Handle: 256
Max slots: 1
Quoted 1 line
HCI Event: Synchronous Connect Complete (
0x2c) plen 17
Status: Success (0x00)
Handle: 257
Address: 00:1B:DC:F2:21:59 (OUI 00-1B-DC)
Link type: eSCO (0x02)
Transmission interval: 0x06
Retransmission window: 0x04
RX packet length: 30
TX packet length: 30
Air mode: Transparent (0x03)--- net/bluetooth/hci_event.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_event.c +1 -0
@@ -4216,6 +4216,7 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,case 0x11 :/* Unsupported Feature or Parameter Value */ case 0x1c :/* SCO interval rejected */ case 0x1a :/* Unsupported Remote Feature */ +case 0x1e :/* Invalid LMP Parameters */ case 0x1f :/* Unspecified error */ case 0x20 :/* Unsupported LMP Parameter value */ if (conn->out) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 37/261 kgdb: Prevent infinite recursive entries to the debugger
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit 3ca676e4ca60d1834bb77535dafe24169cadacef ]
If we detect that we recursively entered the debugger we should hack our I/O ops to NULL so that the panic() in the next line won't actually cause another recursion into the debugger. The first line of kgdb_panic() will check this and return.
--- kernel/debug/debug_core.c | 1 + 1 file changed, 1 insertion(+)
kernel/debug/debug_core.c +1 -0
@@ -501,6 +501,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks)if (exception_level >1 ) {dump_stack (); + kgdb_io_module_registered = false;panic ("Recursive entry to debugger" ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 40/261 mips: Fix cpu_has_mips64r1/2 activation for MIPS32 CPUs
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit a2ac81c6ef4018ea49c034ce165bb9ea1cf99f3e ]
Commit 1aeba347b3a9 ("MIPS: Hardcode cpu_has_mips* where target ISA allows") updated the cpu_has_mips* macro to be replaced with a constant expression where it's possible. By mistake it wasn't done correctly for cpu_has_mips64r1/cpu_has_mips64r2 macro. They are defined to be replaced with conditional expression __isa_range_or_flag(), which means either ISA revision being within the range or the corresponding CPU options flag was set at the probe stage or both being true at the same time. But the ISA level value doesn't indicate whether the ISA is MIPS32 or MIPS64. Due to this if we select MIPS32r1 - MIPS32r5 architectures the __isa_range() macro will activate the cpu_has_mips64rX flags, which is incorrect. In order to fix the problem we make sure the 64bits CPU support is enabled by means of checking the flag cpu_has_64bits aside with proper ISA range and specific Revision flag being set.
--- arch/mips/include/asm/cpu-features.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/include/asm/cpu-features.h +4 -2
@@ -288,10 +288,12 @@# define cpu_has_mips32r6 __isa_ge_or_flag(6, MIPS_CPU_ISA_M32R6)#endif #ifndef cpu_has_mips64r1 -# define cpu_has_mips64r1 __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1) +# define cpu_has_mips64r1 (cpu_has_64bits && \ + __isa_range_or_flag(1, 6, MIPS_CPU_ISA_M64R1))#endif #ifndef cpu_has_mips64r2 -# define cpu_has_mips64r2 __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2) +# define cpu_has_mips64r2 (cpu_has_64bits && \ + __isa_range_or_flag(2, 6, MIPS_CPU_ISA_M64R2))#endif #ifndef cpu_has_mips64r6# define cpu_has_mips64r6 __isa_ge_and_flag(6, MIPS_CPU_ISA_M64R6)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 41/261 spi: dw: Enable interrupts in accordance with DMA xfer mode
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 43dba9f3f98c2b184a19f856f06fe22817bfd9e0 ]
It's pointless to track the Tx overrun interrupts if Rx-only SPI transfer is issued. Similarly there is no need in handling the Rx overrun/underrun interrupts if Tx-only SPI transfer is executed. So lets unmask the interrupts only if corresponding SPI transactions are implied.
--- drivers/spi/spi-dw-mid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/spi/spi-dw-mid.c +8 -4
@@ -220,19 +220,23 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,static int mid_spi_dma_setup (struct dw_spi *dws,struct spi_transfer *xfer) { -u16 dma_ctrl =0 ; +u16 imr =0 , dma_ctrl =0 ;dw_writel (dws,DW_SPI_DMARDLR ,0xf );dw_writel (dws,DW_SPI_DMATDLR ,0x10 ); -if (xfer->tx_buf) +if (xfer->tx_buf) { dma_ctrl |=SPI_DMA_TDMAE ; -if (xfer->rx_buf) + imr |=SPI_INT_TXOI ; + } +if (xfer->rx_buf) { dma_ctrl |=SPI_DMA_RDMAE ; + imr |=SPI_INT_RXUI |SPI_INT_RXOI ; + }dw_writel (dws,DW_SPI_DMACR , dma_ctrl);/* Set the interrupt mask */ -spi_umask_intr (dws,SPI_INT_TXOI |SPI_INT_RXUI |SPI_INT_RXOI ); +spi_umask_intr (dws, imr); dws->transfer_handler = dma_transfer;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 42/261 clocksource: dw_apb_timer: Make CPU-affiliation being optional
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit cee43dbf2ee3f430434e2b66994eff8a1aeda889 ]
Currently the DW APB Timer driver binds each clockevent timers to a particular CPU. This isn't good for multiple reasons. First of all seeing the device is placed on APB bus (which makes it accessible from any CPU core), accessible over MMIO and having the DYNIRQ flag set we can be sure that manually binding the timer to any CPU just isn't correct. By doing so we just set an extra limitation on device usage. This also doesn't reflect the device actual capability, since by setting the IRQ affinity we can make it virtually local to any CPU. Secondly imagine if you had a real CPU-local timer with the same rating and the same CPU-affinity. In this case if DW APB timer was registered first, then due to the clockevent framework tick-timer selection procedure we'll end up with the real CPU-local timer being left unselected for clock-events tracking. But on most of the platforms (MIPS/ARM/etc) such timers are normally embedded into the CPU core and are accessible with much better performance then devices placed on APB. For instance in MIPS architectures there is r4k-timer, which is CPU-local, assigned with the same rating, and normally its clockevent device is registered after the platform-specific one.
So in order to fix all of these issues let's make the DW APB Timer CPU affinity being optional and deactivated by passing a negative CPU id, which will effectively set the DW APB clockevent timer cpumask to 'cpu_possible_mask'.
--- drivers/clocksource/dw_apb_timer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clocksource/dw_apb_timer.c +3 -2
@@ -222,7 +222,8 @@ static int apbt_next_event(unsigned long delta,/** * dw_apb_clockevent_init() - use an APB timer as a clock_event_device * -* @cpu: The CPU the events will be targeted at. +* @cpu: The CPU the events will be targeted at or -1 if CPU affiliation +* isn't required. * @name: The name used for the timer and the IRQ for it. * @rating: The rating to give the timer. * @base: I/O base for the timer registers.
@@ -257,7 +258,7 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating, dw_ced->ced.max_delta_ticks =0x7fffffff ; dw_ced->ced.min_delta_ns =clockevent_delta2ns (5000 , &dw_ced->ced); dw_ced->ced.min_delta_ticks =5000 ; - dw_ced->ced.cpumask =cpumask_of (cpu); + dw_ced->ced.cpumask = cpu <0 ? cpu_possible_mask :cpumask_of (cpu); dw_ced->ced.features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT |CLOCK_EVT_FEAT_DYNIRQ ; dw_ced->ced.set_state_shutdown = apbt_shutdown;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 43/261 clocksource: dw_apb_timer_of: Fix missing clockevent timers
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 6d2e16a3181bafb77b535095c39ad1c8b9558c8c ]
Commit 100214889973 ("clocksource: dw_apb_timer_of: use clocksource_of_init") replaced a publicly available driver initialization method with one called by the timer_probe() method available after CLKSRC_OF. In current implementation it traverses all the timers available in the system and calls their initialization methods if corresponding devices were either in dtb or in acpi. But if before the commit any number of available timers would be installed as clockevent and clocksource devices, after that there would be at most two. The rest are just ignored since default case branch doesn't do anything. I don't see a reason of such behaviour, neither the commit message explains it. Moreover this might be wrong if on some platforms these timers might be used for different purpose, as virtually CPU-local clockevent timers and as an independent broadcast timer. So in order to keep the compatibility with the platforms where the order of the timers detection has some meaning, lets add the secondly discovered timer to be of clocksource/sched_clock type, while the very first and the others would provide the clockevents service.
--- drivers/clocksource/dw_apb_timer_of.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/clocksource/dw_apb_timer_of.c +2 -4
@@ -147,10 +147,6 @@ static int num_called;static int __init dw_apb_timer_init (struct device_node *timer) {switch (num_called) { -case 0 : -pr_debug ("%s: found clockevent timer\n" , __func__); -add_clockevent (timer); -break ;case 1 :pr_debug ("%s: found clocksource timer\n" , __func__);add_clocksource (timer);
@@ -161,6 +157,8 @@ static int __init dw_apb_timer_init(struct device_node *timer)#endif break ;default : +pr_debug ("%s: found clockevent timer\n" , __func__); +add_clockevent (timer);break ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 44/261 media: dvbdev: Fix tuner->demod media controller link
In reply to Greg Kroah-HartmanFrom: Brad Love <[email protected]>
[ Upstream commit 9f984cacf4f4d53fd8a3f44d7f13528b81c1f6a8 ]
Fixes bug exposed by:
[a3fbc2e6bb0: media: mc-entity.c: use WARN_ON, validate link pads]
The dvbdev incorrectly requests a tuner sink pad to connect to a demux sink pad. The media controller failure percolates back and the dvb device creation fails. Fix this by requesting a tuner source pad. Instead of forcing that pad to be index zero, check if a negative integer error is returned. A note is added that first source pad found is chosen.
Affected bridges cx231xx and em28xx printed the below warning[s] when a variety of media controller dvb enabled devices were connected. The warning returns an error causing all affected devices to fail DVB device creation.
[ 253.138332] ------------[ cut here ]------------ [ 253.138339] WARNING: CPU: 0 PID: 1550 at drivers/media/mc/mc-entity.c:669 media_create_pad_link+0x1e0/0x200 [mc] [ 253.138339] Modules linked in: si2168 em28xx_dvb(+) em28xx si2157 lgdt3306a cx231xx_dvb dvb_core cx231xx_alsa cx25840 cx231xx tveeprom cx2341x i2c_mux videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc ir_rc5_decoder rc_hauppauge mceusb rc_core eda c_mce_amd kvm nls_iso8859_1 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper efi_pstore wmi_bmof k10temp asix usbnet mii nouveau snd_hda_codec_realtek snd_hda_codec_generic input_leds ledtrig_audio snd_hda_codec_hdmi mxm_wmi snd_hda_in tel video snd_intel_dspcfg ttm snd_hda_codec drm_kms_helper snd_hda_core drm snd_hwdep snd_seq_midi snd_seq_midi_event i2c_algo_bit snd_pcm snd_rawmidi fb_sys_fops snd_seq syscopyarea sysfillrect snd_seq_device sysimgblt snd_timer snd soundcore ccp mac_hid sch_fq_codel parport_p c ppdev lp parport ip_tables x_tables autofs4 vfio_pci irqbypass vfio_virqfd vfio_iommu_type1 vfio hid_generic usbhid hid i2c_piix4 ahci libahci wmi gpio_amdpt [ 253.138370] gpio_generic [ 253.138372] CPU: 0 PID: 1550 Comm: modprobe Tainted: G W 5.7.0-rc2+ #181 [ 253.138373] Hardware name: MSI MS-7A39/B350M GAMING PRO (MS-7A39), BIOS 2.G0 04/27/2018 [ 253.138376] RIP: 0010:media_create_pad_link+0x1e0/0x200 [mc] [ 253.138378] Code: 26 fd ff ff 44 8b 4d d0 eb d9 0f 0b 41 b9 ea ff ff ff 44 89 c8 c3 0f 0b 41 b9 ea ff ff ff eb f2 0f 0b 41 b9 ea ff ff ff eb e8 <0f> 0b 41 b9 ea ff ff ff eb af 0f 0b 41 b9 ea ff ff ff eb a5 66 90 [ 253.138379] RSP: 0018:ffffb9ecc0ee7a78 EFLAGS: 00010246 [ 253.138380] RAX: ffff943f706c99d8 RBX: 0000000000000000 RCX: 0000000000000000 [ 253.138381] RDX: ffff943f613e0180 RSI: 0000000000000000 RDI: ffff943f706c9958 [ 253.138381] RBP: ffffb9ecc0ee7ab0 R08: 0000000000000001 R09: ffff943f613e0180 [ 253.138382] R10: ffff943f613e0180 R11: ffff943f706c9400 R12: 0000000000000000 [ 253.138383] R13: 0000000000000001 R14: ffff943f706c9958 R15: 0000000000000001 [ 253.138384] FS: 00007f3cd29ba540(0000) GS:ffff943f8ec00000(0000) knlGS:0000000000000000 [ 253.138385] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 253.138385] CR2: 000055f7de0ca830 CR3: 00000003dd208000 CR4: 00000000003406f0 [ 253.138386] Call Trace: [ 253.138392] media_create_pad_links+0x104/0x1b0 [mc] [ 253.138397] dvb_create_media_graph+0x350/0x5f0 [dvb_core] [ 253.138402] em28xx_dvb_init+0x5ea/0x2600 [em28xx_dvb] [ 253.138408] em28xx_register_extension+0x63/0xc0 [em28xx] [ 253.138410] ? 0xffffffffc039c000 [ 253.138412] em28xx_dvb_register+0x15/0x1000 [em28xx_dvb] [ 253.138416] do_one_initcall+0x71/0x250 [ 253.138418] ? do_init_module+0x27/0x22e [ 253.138421] ? _cond_resched+0x1a/0x50 [ 253.138423] ? kmem_cache_alloc_trace+0x1ec/0x270 [ 253.138425] ? __vunmap+0x1e3/0x240 [ 253.138427] do_init_module+0x5f/0x22e [ 253.138430] load_module+0x2525/0x2d40 [ 253.138436] __do_sys_finit_module+0xe5/0x120 [ 253.138438] ? __do_sys_finit_module+0xe5/0x120 [ 253.138442] __x64_sys_finit_module+0x1a/0x20 [ 253.138443] do_syscall_64+0x57/0x1b0 [ 253.138445] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 253.138446] RIP: 0033:0x7f3cd24dc839 [ 253.138448] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 [ 253.138449] RSP: 002b:00007ffe4fc514d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 253.138450] RAX: ffffffffffffffda RBX: 000055a9237f63f0 RCX: 00007f3cd24dc839 [ 253.138451] RDX: 0000000000000000 RSI: 000055a922c3ad2e RDI: 0000000000000000 [ 253.138451] RBP: 000055a922c3ad2e R08: 0000000000000000 R09: 0000000000000000 [ 253.138452] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 253.138453] R13: 000055a9237f5550 R14: 0000000000040000 R15: 000055a9237f63f0 [ 253.138456] ---[ end trace a60f19c54aa96ec4 ]---
[ 234.915628] ------------[ cut here ]------------ [ 234.915640] WARNING: CPU: 0 PID: 1502 at drivers/media/mc/mc-entity.c:669 media_create_pad_link+0x1e0/0x200 [mc] [ 234.915641] Modules linked in: si2157 lgdt3306a cx231xx_dvb(+) dvb_core cx231xx_alsa cx25840 cx231xx tveeprom cx2341x i2c_mux videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc ir_rc5_decoder rc_hauppauge mceusb rc_core edac_mce_amd kvm nls_iso8859 _1 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper efi_pstore wmi_bmof k10temp asix usbnet mii nouveau snd_hda_codec_realtek snd_hda_codec_generic input_leds ledtrig_audio snd_hda_codec_hdmi mxm_wmi snd_hda_intel video snd_intel_dspcf g ttm snd_hda_codec drm_kms_helper snd_hda_core drm snd_hwdep snd_seq_midi snd_seq_midi_event i2c_algo_bit snd_pcm snd_rawmidi fb_sys_fops snd_seq syscopyarea sysfillrect snd_seq_device sysimgblt snd_timer snd soundcore ccp mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tab les x_tables autofs4 vfio_pci irqbypass vfio_virqfd vfio_iommu_type1 vfio hid_generic usbhid hid i2c_piix4 ahci libahci wmi gpio_amdpt gpio_generic [ 234.915700] CPU: 0 PID: 1502 Comm: modprobe Not tainted 5.7.0-rc2+ #181 [ 234.915702] Hardware name: MSI MS-7A39/B350M GAMING PRO (MS-7A39), BIOS 2.G0 04/27/2018 [ 234.915709] RIP: 0010:media_create_pad_link+0x1e0/0x200 [mc] [ 234.915712] Code: 26 fd ff ff 44 8b 4d d0 eb d9 0f 0b 41 b9 ea ff ff ff 44 89 c8 c3 0f 0b 41 b9 ea ff ff ff eb f2 0f 0b 41 b9 ea ff ff ff eb e8 <0f> 0b 41 b9 ea ff ff ff eb af 0f 0b 41 b9 ea ff ff ff eb a5 66 90 [ 234.915714] RSP: 0018:ffffb9ecc1b6fa50 EFLAGS: 00010246 [ 234.915717] RAX: ffff943f8c94a9d8 RBX: 0000000000000000 RCX: 0000000000000000 [ 234.915719] RDX: ffff943f613e0900 RSI: 0000000000000000 RDI: ffff943f8c94a958 [ 234.915721] RBP: ffffb9ecc1b6fa88 R08: 0000000000000001 R09: ffff943f613e0900 [ 234.915723] R10: ffff943f613e0900 R11: ffff943f6b590c00 R12: 0000000000000000 [ 234.915724] R13: 0000000000000001 R14: ffff943f8c94a958 R15: 0000000000000001 [ 234.915727] FS: 00007f4ca3646540(0000) GS:ffff943f8ec00000(0000) knlGS:0000000000000000 [ 234.915729] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 234.915731] CR2: 00007fff7a53ba18 CR3: 00000003da614000 CR4: 00000000003406f0 [ 234.915733] Call Trace: [ 234.915745] media_create_pad_links+0x104/0x1b0 [mc] [ 234.915756] dvb_create_media_graph+0x350/0x5f0 [dvb_core] [ 234.915766] dvb_init.part.4+0x691/0x1360 [cx231xx_dvb] [ 234.915780] dvb_init+0x1a/0x20 [cx231xx_dvb] [ 234.915787] cx231xx_register_extension+0x71/0xa0 [cx231xx] [ 234.915791] ? 0xffffffffc042f000 [ 234.915796] cx231xx_dvb_register+0x15/0x1000 [cx231xx_dvb] [ 234.915802] do_one_initcall+0x71/0x250 [ 234.915807] ? do_init_module+0x27/0x22e [ 234.915811] ? _cond_resched+0x1a/0x50 [ 234.915816] ? kmem_cache_alloc_trace+0x1ec/0x270 [ 234.915820] ? __vunmap+0x1e3/0x240 [ 234.915826] do_init_module+0x5f/0x22e [ 234.915831] load_module+0x2525/0x2d40 [ 234.915848] __do_sys_finit_module+0xe5/0x120 [ 234.915850] ? __do_sys_finit_module+0xe5/0x120 [ 234.915862] __x64_sys_finit_module+0x1a/0x20 [ 234.915865] do_syscall_64+0x57/0x1b0 [ 234.915870] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 234.915872] RIP: 0033:0x7f4ca3168839 [ 234.915876] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 [ 234.915878] RSP: 002b:00007ffcea3db3b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 234.915881] RAX: ffffffffffffffda RBX: 000055af22c29340 RCX: 00007f4ca3168839 [ 234.915882] RDX: 0000000000000000 RSI: 000055af22c38390 RDI: 0000000000000001 [ 234.915884] RBP: 000055af22c38390 R08: 0000000000000000 R09: 0000000000000000 [ 234.915885] R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000000 [ 234.915887] R13: 000055af22c29060 R14: 0000000000040000 R15: 0000000000000000 [ 234.915896] ---[ end trace a60f19c54aa96ec3 ]---
--- drivers/media/dvb-core/dvbdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/dvb-core/dvbdev.c +3 -2
@@ -707,9 +707,10 @@ int dvb_create_media_graph(struct dvb_adapter *adap, }if (ntuner && ndemod) { - pad_source =media_get_pad_index (tuner, true, +/* NOTE: first found tuner source pad presumed correct */ + pad_source =media_get_pad_index (tuner, false,PAD_SIGNAL_ANALOG ); -if (pad_source) +if (pad_source <0 )return -EINVAL ; ret = media_create_pad_links(mdev, MEDIA_ENT_F_TUNER,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 45/261 btrfs: account for trans_block_rsv in may_commit_transaction
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit bb4f58a747f0421b10645fbf75a6acc88da0de50 ]
On ppc64le with 64k page size (respectively 64k block size) generic/320 was failing and debug output showed we were getting a premature ENOSPC with a bunch of space in btrfs_fs_info::trans_block_rsv.
This meant there were still open transaction handles holding space, yet the flusher didn't commit the transaction because it deemed the freed space won't be enough to satisfy the current reserve ticket. Fix this by accounting for space in trans_block_rsv when deciding whether the current transaction should be committed or not.
--- fs/btrfs/space-info.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/space-info.c +6 -0
@@ -462,6 +462,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,struct reserve_ticket *ticket =NULL ;struct btrfs_block_rsv *delayed_rsv = &fs_info->delayed_block_rsv;struct btrfs_block_rsv *delayed_refs_rsv = &fs_info->delayed_refs_rsv; +struct btrfs_block_rsv *trans_rsv = &fs_info->trans_block_rsv;struct btrfs_trans_handle *trans;u64 bytes_needed;u64 reclaim_bytes =0 ;
@@ -524,6 +525,11 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,spin_lock (&delayed_refs_rsv->lock); reclaim_bytes += delayed_refs_rsv->reserved;spin_unlock (&delayed_refs_rsv->lock); + +spin_lock (&trans_rsv->lock); + reclaim_bytes += trans_rsv->reserved; +spin_unlock (&trans_rsv->lock); +if (reclaim_bytes >= bytes_needed) goto commit; bytes_needed -= reclaim_bytes;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 49/261 ice: Fix memory leak
In reply to Greg Kroah-HartmanFrom: Surabhi Boob <[email protected]>
[ Upstream commit 1aaef2bc4e0a5ce9e4dd86359e6a0bf52c6aa64f ]
Handle memory leak on filter management initialization failure.
--- drivers/net/ethernet/intel/ice/ice_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +7 -1
@@ -436,6 +436,7 @@ static void ice_init_flex_flds(struct ice_hw *hw, enum ice_rxdid prof_id)static enum ice_status ice_init_fltr_mgmt_struct (struct ice_hw *hw) {struct ice_switch_info *sw; +enum ice_status status; hw->switch_info =devm_kzalloc (ice_hw_to_dev (hw),sizeof (*hw->switch_info),GFP_KERNEL );
@@ -446,7 +447,12 @@ static enum ice_status ice_init_fltr_mgmt_struct(struct ice_hw *hw)INIT_LIST_HEAD (&sw->vsi_list_map_head); -return ice_init_def_sw_recp (hw); + status =ice_init_def_sw_recp (hw); +if (status) { +devm_kfree (ice_hw_to_dev (hw), hw->switch_info); +return status; + } +return 0 ; }/**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 47/261 ARM: 8978/1: mm: make act_mm() respect THREAD_SIZE
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit e1de94380af588bdf6ad6f0cc1f75004c35bc096 ]
Recent work with KASan exposed the folling hard-coded bitmask in arch/arm/mm/proc-macros.S:
bic rd, sp, #8128
bic rd, rd, #63
This forms the bitmask 0x1FFF that is coinciding with (PAGE_SIZE << THREAD_SIZE_ORDER) - 1, this code was assuming that THREAD_SIZE is always 8K (8192).
As KASan was increasing THREAD_SIZE_ORDER to 2, I ran into this bug.
Fix it by this little oneline suggested by Ard:
bic rd, sp, #(THREAD_SIZE - 1) & ~63
Where THREAD_SIZE is defined using THREAD_SIZE_ORDER.
We have to also include <linux/const.h> since the THREAD_SIZE expands to use the _AC() macro.
--- arch/arm/mm/proc-macros.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mm/proc-macros.S +2 -1
@@ -5,6 +5,7 @@ * VMA_VM_FLAGS * VM_EXEC */ +#include <linux/const.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h>
@@ -30,7 +31,7 @@ * act_mm - get current->active_mm */ .macro act_mm, rd - bic \rd, sp, #8128 + bic \rd, sp, #(THREAD_SIZE - 1) & ~63 bic \rd, \rd, #63 ldr \rd, [\rd, #TI_TASK] .if (TSK_ACTIVE_MM > IMM12_MASK)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 53/261 spi: dw: Fix Rx-only DMA transfers
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 46164fde6b7890e7a3982d54549947c8394c0192 ]
Tx-only DMA transfers are working perfectly fine since in this case the code just ignores the Rx FIFO overflow interrupts. But it turns out the SPI Rx-only transfers are broken since nothing pushing any data to the shift registers, so the Rx FIFO is left empty and the SPI core subsystems just returns a timeout error. Since DW DMAC driver doesn't support something like cyclic write operations of a single byte to a device register, the only way to support the Rx-only SPI transfers is to fake it by using a dummy Tx-buffer. This is what we intend to fix in this commit by setting the SPI_CONTROLLER_MUST_TX flag for DMA-capable platform.
--- drivers/spi/spi-dw.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-dw.c +1 -0
@@ -529,6 +529,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) dws->dma_inited =0 ; }else { master->can_dma = dws->dma_ops->can_dma; + master->flags |=SPI_CONTROLLER_MUST_TX ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 29/261 block: reset mapping if failed to update hardware queue count
In reply to Greg Kroah-HartmanFrom: Weiping Zhang <[email protected]>
[ Upstream commit aa880ad690ab6d4c53934af85fb5a43e69ecb0f5 ]
When we increase hardware queue count, blk_mq_update_queue_map will reset the mapping between cpu and hardware queue base on the hardware queue count(set->nr_hw_queues). The mapping cannot be reset if it encounters error in blk_mq_realloc_hw_ctxs, but the fallback flow will continue using it, then blk_mq_map_swqueue will touch a invalid memory, because the mapping points to a wrong hctx.
blktest block/030:
null_blk: module loaded
Increasing nr_hw_queues to 8 fails, fallback to 1
==================================================================
BUG: KASAN: null-ptr-deref in blk_mq_map_swqueue+0x2f2/0x830 Read of size 8 at addr 0000000000000128 by task nproc/8541 CPU: 5 PID: 8541 Comm: nproc Not tainted 5.7.0-rc4-dbg+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4-rebuilt.opensuse.org 04/01/2014 Call Trace: dump_stack+0xa5/0xe6 __kasan_report.cold+0x65/0xbb kasan_report+0x45/0x60 check_memory_region+0x15e/0x1c0 __kasan_check_read+0x15/0x20 blk_mq_map_swqueue+0x2f2/0x830 __blk_mq_update_nr_hw_queues+0x3df/0x690 blk_mq_update_nr_hw_queues+0x32/0x50 nullb_device_submit_queues_store+0xde/0x160 [null_blk] configfs_write_file+0x1c4/0x250 [configfs] __vfs_write+0x4c/0x90 vfs_write+0x14b/0x2d0 ksys_write+0xdd/0x180 __x64_sys_write+0x47/0x50 do_syscall_64+0x6f/0x310 entry_SYSCALL_64_after_hwframe+0x49/0xb3
--- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
@@ -3304,8 +3304,8 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, prev_nr_hw_queues = set->nr_hw_queues; set->nr_hw_queues = nr_hw_queues; -blk_mq_update_queue_map (set); fallback: +blk_mq_update_queue_map (set);list_for_each_entry (q, &set->tag_list, tag_set_list) {blk_mq_realloc_hw_ctxs (set, q);if (q->nr_hw_queues != set->nr_hw_queues) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 30/261 drm: rcar-du: Set primary plane zpos immutably at initializing
In reply to Greg Kroah-HartmanFrom: Tomohito Esaki <[email protected]>
[ Upstream commit 7982471d01aac33994276bf567c8f1f3a137648a ]
According to drm_plane_create_zpos_property() function documentation, all planes zpos range should be set if zpos property is supported. However, the rcar-du driver didn't set primary plane zpos range. Since the primary plane's zpos is fixed, set it immutably.
--- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 16 +++++++++------- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_plane.c +9 -7
@@ -785,13 +785,15 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)drm_plane_create_alpha_property (&plane->plane); -if (type ==DRM_PLANE_TYPE_PRIMARY ) -continue ; - -drm_object_attach_property (&plane->plane.base, - rcdu->props.colorkey, -RCAR_DU_COLORKEY_NONE ); -drm_plane_create_zpos_property (&plane->plane,1 ,1 ,7 ); +if (type ==DRM_PLANE_TYPE_PRIMARY ) { +drm_plane_create_zpos_immutable_property (&plane->plane, +0 ); + }else { +drm_object_attach_property (&plane->plane.base, + rcdu->props.colorkey, +RCAR_DU_COLORKEY_NONE ); +drm_plane_create_zpos_property (&plane->plane,1 ,1 ,7 ); + } }return 0 ;
drivers/gpu/drm/rcar-du/rcar_du_vsp.c +8 -6
@@ -392,12 +392,14 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,drm_plane_helper_add (&plane->plane, &rcar_du_vsp_plane_helper_funcs); -if (type ==DRM_PLANE_TYPE_PRIMARY ) -continue ; - -drm_plane_create_alpha_property (&plane->plane); -drm_plane_create_zpos_property (&plane->plane,1 ,1 , - vsp->num_planes -1 ); +if (type ==DRM_PLANE_TYPE_PRIMARY ) { +drm_plane_create_zpos_immutable_property (&plane->plane, +0 ); + }else { +drm_plane_create_alpha_property (&plane->plane); +drm_plane_create_zpos_property (&plane->plane,1 ,1 , + vsp->num_planes -1 ); + } }return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 54/261 x86/kvm/hyper-v: Explicitly align hcall param for kvm_hyperv_exit
In reply to Greg Kroah-HartmanFrom: Jon Doron <[email protected]>
[ Upstream commit f7d31e65368aeef973fab788aa22c4f1d5a6af66 ]
The problem the patch is trying to address is the fact that 'struct kvm_hyperv_exit' has different layout on when compiling in 32 and 64 bit modes.
In 64-bit mode the default alignment boundary is 64 bits thus forcing extra gaps after 'type' and 'msr' but in 32-bit mode the boundary is at 32 bits thus no extra gaps.
This is an issue as even when the kernel is 64 bit, the userspace using the interface can be both 32 and 64 bit but the same 32 bit userspace has to work with 32 bit kernel.
The issue is fixed by forcing the 64 bit layout, this leads to ABI change for 32 bit builds and while we are obviously breaking '32 bit userspace with 32 bit kernel' case, we're fixing the '32 bit userspace with 64 bit kernel' one.
As the interface has no (known) users and 32 bit KVM is rather baroque nowadays, this seems like a reasonable decision.
Message-Id: <[email protected]>
--- Documentation/virt/kvm/api.txt | 2 ++ include/uapi/linux/kvm.h | 2 ++ 2 files changed, 4 insertions(+)
Documentation/virt/kvm/api.txt +2 -0
@@ -4444,9 +4444,11 @@ EOI was received. #define KVM_EXIT_HYPERV_SYNIC 1 #define KVM_EXIT_HYPERV_HCALL 2 __u32 type; + __u32 pad1; union { struct { __u32 msr; + __u32 pad2; __u64 control; __u64 evt_page; __u64 msg_page;
include/uapi/linux/kvm.h +2 -0
@@ -189,9 +189,11 @@ struct kvm_hyperv_exit {#define KVM_EXIT_HYPERV_SYNIC 1#define KVM_EXIT_HYPERV_HCALL 2__u32 type; +__u32 pad1;union {struct {__u32 msr; +__u32 pad2;__u64 control;__u64 evt_page;__u64 msg_page;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 68/261 media: dvb: return -EREMOTEIO on i2c transfer failure.
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 96f3a9392799dd0f6472648a7366622ffd0989f3 ]
Currently when i2c transfers fail the error return -EREMOTEIO is assigned to err but then later overwritten when the tuner attach call is made. Fix this by returning early with the error return code -EREMOTEIO on i2c transfer failure errors.
If the transfer fails, an uninitialized value will be read from b2.
Addresses-Coverity: ("Unused value")
--- drivers/media/usb/dvb-usb/dibusb-mb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dibusb-mb.c +1 -1
@@ -81,7 +81,7 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap)if (i2c_transfer (&adap->dev->i2c_adap, msg,2 ) !=2 ) {err ("tuner i2c write failed." ); - ret = -EREMOTEIO ; +return -EREMOTEIO ; }if (adap->fe_adap[0 ].fe->ops.i2c_gate_ctrl)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 32/261 ixgbe: Fix XDP redirect on archs with PAGE_SIZE above 4K
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 88eb0ee17b2ece64fcf6689a4557a5c2e7a89c4b ]
The ixgbe driver have another memory model when compiled on archs with PAGE_SIZE above 4096 bytes. In this mode it doesn't split the page in two halves, but instead increment rx_buffer->page_offset by truesize of packet (which include headroom and tailroom for skb_shared_info).
This is done correctly in ixgbe_build_skb(), but in ixgbe_rx_buffer_flip which is currently only called on XDP_TX and XDP_REDIRECT, it forgets to add the tailroom for skb_shared_info. This breaks XDP_REDIRECT, for veth and cpumap. Fix by adding size of skb_shared_info tailroom.
Maintainers notice: This fix have been queued to Jeff.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
@@ -2254,7 +2254,8 @@ static void ixgbe_rx_buffer_flip(struct ixgbe_ring *rx_ring, rx_buffer->page_offset ^= truesize;#else unsigned int truesize =ring_uses_build_skb (rx_ring) ? -SKB_DATA_ALIGN (IXGBE_SKB_PAD + size) : +SKB_DATA_ALIGN (IXGBE_SKB_PAD + size) + +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )) :SKB_DATA_ALIGN (size); rx_buffer->page_offset += truesize;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 57/261 staging: android: ion: use vmap instead of vm_map_ram
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 5bf9917452112694b2c774465ee4dbe441c84b77 ]
vm_map_ram can keep mappings around after the vm_unmap_ram. Using that with non-PAGE_KERNEL mappings can lead to all kinds of aliasing issues.
--- drivers/staging/android/ion/ion_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion_heap.c +2 -2
@@ -99,12 +99,12 @@ int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,static int ion_heap_clear_pages (struct page **pages,int num,pgprot_t pgprot) { -void *addr =vm_map_ram (pages, num,-1 , pgprot); +void *addr =vmap (pages, num,VM_MAP , pgprot);if (!addr)return -ENOMEM ;memset (addr,0 ,PAGE_SIZE * num); -vm_unmap_ram (addr, num); +vunmap (addr);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 70/261 MIPS: Make sparse_init() using top-down allocation
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 269b3a9ac538c4ae87f84be640b9fa89914a2489 ]
In the current code, if CONFIG_SWIOTLB is set, when failed to get IO TLB memory from the low pages by plat_swiotlb_setup(), it may lead to the boot process failed with kernel panic.
(1) On the Loongson and SiByte platformarch/mips/loongson64/dma.carch/mips/sibyte/common/dma.c
void __init plat_swiotlb_setup(void)
{
swiotlb_init(1);
}kernel/dma/swiotlb.c
void __initswiotlb_init(int verbose)
{
...
vstart = memblock_alloc_low(PAGE_ALIGN(bytes), PAGE_SIZE);
if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose))
return;
...
pr_warn("Cannot allocate buffer");
no_iotlb_memory = true;
}phys_addr_t swiotlb_tbl_map_single()
{
...
if (no_iotlb_memory)
panic("Can not allocate SWIOTLB buffer earlier ...");...
}
(2) On the Cavium OCTEON platformarch/mips/cavium-octeon/dma-octeon.c
void __init plat_swiotlb_setup(void)
{
...
octeon_swiotlb = memblock_alloc_low(swiotlbsize, PAGE_SIZE);
if (!octeon_swiotlb)
panic("%s: Failed to allocate %zu bytes align=%lx\n",
__func__, swiotlbsize, PAGE_SIZE);...
}
Because IO_TLB_DEFAULT_SIZE is 64M, if the rest size of low memory is less than 64M when call plat_swiotlb_setup(), we can easily reproduce the panic case.
In order to reduce the possibility of kernel panic when failed to get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate low memory as small as possible before plat_swiotlb_setup(), so make sparse_init() using top-down allocation.
--- arch/mips/kernel/setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/mips/kernel/setup.c +10 -0
@@ -653,7 +653,17 @@ static void __init arch_mem_init(char **cmdline_p) crashk_res.end - crashk_res.start + 1);#endif device_tree_init (); + +/* +* In order to reduce the possibility of kernel panic when failed to +* get IO TLB memory under CONFIG_SWIOTLB, it is better to allocate +* low memory as small as possible before plat_swiotlb_setup(), so +* make sparse_init() using top-down allocation. +*/ +memblock_set_bottom_up (false);sparse_init (); +memblock_set_bottom_up (true); +plat_swiotlb_setup ();dma_contiguous_reserve (PFN_PHYS (max_low_pfn));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 71/261 ath10k: add flush tx packets for SDIO chip
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit dd7fc5545bbafdbd6c1efdc996b61883b285bdc5 ]
When station connected to AP, and run TX traffic such as TCP/UDP, and system enter suspend state, then mac80211 call ath10k_flush with set drop flag, recently it only send wmi peer flush to firmware and firmware will flush all pending TX packets, for PCIe, firmware will indicate the TX packets status to ath10k, and then ath10k indicate to mac80211 TX complete with the status, then all the packets has been flushed at this moment. For SDIO chip, it is different, its TX complete indication is disabled by default, and it has a tx queue in ath10k, and its tx credit control is enabled, total tx credit is 96, when its credit is not sufficient, then the packets will buffered in the tx queue of ath10k, max packets is TARGET_TLV_NUM_MSDU_DESC_HL which is 1024, for SDIO, when mac80211 call ath10k_flush with set drop flag, maybe it have pending packets in tx queue of ath10k, and if it does not have sufficient tx credit, the packets will stay in queue untill tx credit report from firmware, if it is a noisy environment, tx speed is low and the tx credit report from firmware will delay more time, then the num_pending_tx will remain > 0 untill all packets send to firmware. After the 1st ath10k_flush, mac80211 will call the 2nd ath10k_flush without set drop flag immediately, then it will call to ath10k_mac_wait_tx_complete, and it wait untill num_pending_tx become to 0, in noisy environment, it is esay to wait about near 5 seconds, then it cause the suspend take long time.
1st and 2nd callstack of ath10k_flush
[ 303.740427] ath10k_sdio mmc1:0001:1: ath10k_flush drop:1, pending:0-0 [ 303.740495] ------------[ cut here ]------------ [ 303.740739] WARNING: CPU: 1 PID: 3921 at /mnt/host/source/src/third_party/kernel/v4.19/drivers/net/wireless/ath/ath10k/mac.c:7025 ath10k_flush+0x54/0x104 [ath10k_core] [ 303.740757] Modules linked in: bridge stp llc ath10k_sdio ath10k_core rfcomm uinput cros_ec_rpmsg mtk_seninf mtk_cam_isp mtk_vcodec_enc mtk_fd mtk_vcodec_dec mtk_vcodec_common mtk_dip mtk_mdp3 videobuf2_dma_contig videobuf2_memops v4l2_mem2mem videobuf2_v4l2 videobuf2_common hid_google_hammer hci_uart btqca bluetooth dw9768 ov8856 ecdh_generic ov02a10 v4l2_fwnode mtk_scp mtk_rpmsg rpmsg_core mtk_scp_ipi ipt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring cros_ec_sensors_sync cros_ec_light_prox cros_ec_sensors industrialio_triggered_buffer [ 303.740914] kfifo_buf cros_ec_activity cros_ec_sensors_core lzo_rle lzo_compress ath mac80211 zram cfg80211 joydev [last unloaded: ath10k_core] [ 303.741009] CPU: 1 PID: 3921 Comm: kworker/u16:10 Tainted: G W 4.19.95 #2 [ 303.741027] Hardware name: MediaTek krane sku176 board (DT) [ 303.741061] Workqueue: events_unbound async_run_entry_fn [ 303.741086] pstate: 60000005 (nZCv daif -PAN -UAO) [ 303.741166] pc : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.741244] lr : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.741260] sp : ffffffdf080e77a0 [ 303.741276] x29: ffffffdf080e77a0 x28: ffffffdef3730040 [ 303.741300] x27: ffffff907c2240a0 x26: ffffffde6ff39afc [ 303.741321] x25: ffffffdef3730040 x24: ffffff907bf61018 [ 303.741343] x23: ffffff907c2240a0 x22: ffffffde6ff39a50 [ 303.741364] x21: 0000000000000001 x20: ffffffde6ff39a50 [ 303.741385] x19: ffffffde6bac2420 x18: 0000000000017200 [ 303.741407] x17: ffffff907c24a000 x16: 0000000000000037 [ 303.741428] x15: ffffff907b49a568 x14: ffffff907cf332c1 [ 303.741476] x13: 00000000000922e4 x12: 0000000000000000 [ 303.741497] x11: 0000000000000001 x10: 0000000000000007 [ 303.741518] x9 : f2256b8c1de4bc00 x8 : f2256b8c1de4bc00 [ 303.741539] x7 : ffffff907ab5e764 x6 : 0000000000000000 [ 303.741560] x5 : 0000000000000080 x4 : 0000000000000001 [ 303.741582] x3 : ffffffdf080e74a8 x2 : ffffff907aa91244 [ 303.741603] x1 : ffffffdf080e74a8 x0 : 0000000000000024 [ 303.741624] Call trace: [ 303.741701] ath10k_flush+0x54/0x104 [ath10k_core] [ 303.741941] __ieee80211_flush_queues+0x1dc/0x358 [mac80211] [ 303.742098] ieee80211_flush_queues+0x34/0x44 [mac80211] [ 303.742253] ieee80211_set_disassoc+0xc0/0x5ec [mac80211] [ 303.742399] ieee80211_mgd_deauth+0x720/0x7d4 [mac80211] [ 303.742535] ieee80211_deauth+0x24/0x30 [mac80211] [ 303.742720] cfg80211_mlme_deauth+0x250/0x3bc [cfg80211] [ 303.742849] cfg80211_mlme_down+0x90/0xd0 [cfg80211] [ 303.742971] cfg80211_disconnect+0x340/0x3a0 [cfg80211] [ 303.743087] __cfg80211_leave+0xe4/0x17c [cfg80211] [ 303.743203] cfg80211_leave+0x38/0x50 [cfg80211] [ 303.743319] wiphy_suspend+0x84/0x5bc [cfg80211] [ 303.743335] dpm_run_callback+0x170/0x304 [ 303.743346] __device_suspend+0x2dc/0x3e8 [ 303.743356] async_suspend+0x2c/0xb0 [ 303.743370] async_run_entry_fn+0x48/0xf8 [ 303.743383] process_one_work+0x304/0x604 [ 303.743394] worker_thread+0x248/0x3f4 [ 303.743403] kthread+0x120/0x130 [ 303.743416] ret_from_fork+0x10/0x18
[ 303.743812] ath10k_sdio mmc1:0001:1: ath10k_flush drop:0, pending:0-0 [ 303.743858] ------------[ cut here ]------------ [ 303.744057] WARNING: CPU: 1 PID: 3921 at /mnt/host/source/src/third_party/kernel/v4.19/drivers/net/wireless/ath/ath10k/mac.c:7025 ath10k_flush+0x54/0x104 [ath10k_core] [ 303.744075] Modules linked in: bridge stp llc ath10k_sdio ath10k_core rfcomm uinput cros_ec_rpmsg mtk_seninf mtk_cam_isp mtk_vcodec_enc mtk_fd mtk_vcodec_dec mtk_vcodec_common mtk_dip mtk_mdp3 videobuf2_dma_contig videobuf2_memops v4l2_mem2mem videobuf2_v4l2 videobuf2_common hid_google_hammer hci_uart btqca bluetooth dw9768 ov8856 ecdh_generic ov02a10 v4l2_fwnode mtk_scp mtk_rpmsg rpmsg_core mtk_scp_ipi ipt_MASQUERADE fuse iio_trig_sysfs cros_ec_sensors_ring cros_ec_sensors_sync cros_ec_light_prox cros_ec_sensors industrialio_triggered_buffer kfifo_buf cros_ec_activity cros_ec_sensors_core lzo_rle lzo_compress ath mac80211 zram cfg80211 joydev [last unloaded: ath10k_core] [ 303.744256] CPU: 1 PID: 3921 Comm: kworker/u16:10 Tainted: G W 4.19.95 #2 [ 303.744273] Hardware name: MediaTek krane sku176 board (DT) [ 303.744301] Workqueue: events_unbound async_run_entry_fn [ 303.744325] pstate: 60000005 (nZCv daif -PAN -UAO) [ 303.744403] pc : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.744480] lr : ath10k_flush+0x54/0x104 [ath10k_core] [ 303.744496] sp : ffffffdf080e77a0 [ 303.744512] x29: ffffffdf080e77a0 x28: ffffffdef3730040 [ 303.744534] x27: ffffff907c2240a0 x26: ffffffde6ff39afc [ 303.744556] x25: ffffffdef3730040 x24: ffffff907bf61018 [ 303.744577] x23: ffffff907c2240a0 x22: ffffffde6ff39a50 [ 303.744598] x21: 0000000000000000 x20: ffffffde6ff39a50 [ 303.744620] x19: ffffffde6bac2420 x18: 000000000001831c [ 303.744641] x17: ffffff907c24a000 x16: 0000000000000037 [ 303.744662] x15: ffffff907b49a568 x14: ffffff907cf332c1 [ 303.744683] x13: 00000000000922ea x12: 0000000000000000 [ 303.744704] x11: 0000000000000001 x10: 0000000000000007 [ 303.744747] x9 : f2256b8c1de4bc00 x8 : f2256b8c1de4bc00 [ 303.744768] x7 : ffffff907ab5e764 x6 : 0000000000000000 [ 303.744789] x5 : 0000000000000080 x4 : 0000000000000001 [ 303.744810] x3 : ffffffdf080e74a8 x2 : ffffff907aa91244 [ 303.744831] x1 : ffffffdf080e74a8 x0 : 0000000000000024 [ 303.744853] Call trace: [ 303.744929] ath10k_flush+0x54/0x104 [ath10k_core] [ 303.745098] __ieee80211_flush_queues+0x1dc/0x358 [mac80211] [ 303.745277] ieee80211_flush_queues+0x34/0x44 [mac80211] [ 303.745424] ieee80211_set_disassoc+0x108/0x5ec [mac80211] [ 303.745569] ieee80211_mgd_deauth+0x720/0x7d4 [mac80211] [ 303.745706] ieee80211_deauth+0x24/0x30 [mac80211] [ 303.745853] cfg80211_mlme_deauth+0x250/0x3bc [cfg80211] [ 303.745979] cfg80211_mlme_down+0x90/0xd0 [cfg80211] [ 303.746103] cfg80211_disconnect+0x340/0x3a0 [cfg80211] [ 303.746219] __cfg80211_leave+0xe4/0x17c [cfg80211] [ 303.746335] cfg80211_leave+0x38/0x50 [cfg80211] [ 303.746452] wiphy_suspend+0x84/0x5bc [cfg80211] [ 303.746467] dpm_run_callback+0x170/0x304 [ 303.746477] __device_suspend+0x2dc/0x3e8 [ 303.746487] async_suspend+0x2c/0xb0 [ 303.746498] async_run_entry_fn+0x48/0xf8 [ 303.746510] process_one_work+0x304/0x604 [ 303.746521] worker_thread+0x248/0x3f4 [ 303.746530] kthread+0x120/0x130 [ 303.746542] ret_from_fork+0x10/0x18
one sample's debugging log: it wait 3190 ms(5000 - 1810).
1st ath10k_flush, it has 120 packets in tx queue of ath10k:
<...>-1513 [000] .... 25374.786005: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_flush drop:1, pending:120-0 <...>-1513 [000] ...1 25374.788375: ath10k_log_warn: ath10k_sdio mmc1:0001:1 ath10k_htt_tx_mgmt_inc_pending htt->num_pending_mgmt_tx:0 <...>-1500 [001] .... 25374.790143: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:121
2st ath10k_flush, it has 121 packets in tx queue of ath10k:
<...>-1513 [000] .... 25374.790571: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_flush drop:0, pending:121-0 <...>-1513 [000] .... 25374.791990: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_mac_wait_tx_complete state:1 pending:121-0 <...>-1508 [001] .... 25374.792696: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:46 <...>-1508 [001] .... 25374.792700: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:46 <...>-1508 [001] .... 25374.792729: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:121 <...>-1508 [001] .... 25374.792937: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:88, count:32, len:49792 <...>-1508 [001] .... 25374.793031: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:75, count:14, len:21784 kworker/u16:0-25773 [003] .... 25374.793701: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:46 <...>-1881 [000] .... 25375.073178: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:24 <...>-1881 [000] .... 25375.073182: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:24 <...>-1881 [000] .... 25375.073429: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:75 <...>-1879 [001] .... 25375.074090: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:24 <...>-1881 [000] .... 25375.074123: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:51, count:24, len:37344 <...>-1879 [001] .... 25375.270126: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:26 <...>-1879 [001] .... 25375.270130: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:26 <...>-1488 [000] .... 25375.270174: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:51 <...>-1488 [000] .... 25375.270529: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:25, count:26, len:40456 <...>-1879 [001] .... 25375.270693: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:26 <...>-1488 [001] .... 25377.775885: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:12 <...>-1488 [001] .... 25377.775890: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:12 <...>-1488 [001] .... 25377.775933: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:25 <...>-1488 [001] .... 25377.776059: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:13, count:12, len:18672 <...>-1879 [001] .... 25377.776100: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:12 <...>-1488 [001] .... 25377.878079: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:15 <...>-1488 [001] .... 25377.878087: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:15 <...>-1879 [000] .... 25377.878323: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:13 <...>-1879 [000] .... 25377.878487: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx status:0, eid:1, req count:0, count:13, len:20228 <...>-1879 [000] .... 25377.878497: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx complete, eid:1, pending complete count:13 <...>-1488 [001] .... 25377.919927: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit update: delta:11 <...>-1488 [001] .... 25377.919932: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 credit total:13 <...>-1488 [001] .... 25377.919976: ath10k_log_dbg: ath10k_sdio mmc1:0001:1 bundle tx work, eid:1, count:0 <...>-1881 [000] .... 25377.982645: ath10k_log_warn: ath10k_sdio mmc1:0001:1 HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION status:0 <...>-1513 [001] .... 25377.982973: ath10k_log_err: ath10k_sdio mmc1:0001:1 ath10k_mac_wait_tx_complete time_left:1810, pending:0-0
Flush all pending TX packets for the 1st ath10k_flush reduced the wait time of the 2nd ath10k_flush and then suspend take short time.
This Patch only effect SDIO chips.
Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00042.
--- drivers/net/wireless/ath/ath10k/htt.h | 7 +++++++ drivers/net/wireless/ath/ath10k/htt_tx.c | 8 +++++++- drivers/net/wireless/ath/ath10k/mac.c | 1 + 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htt.h +7 -0
@@ -2033,6 +2033,7 @@ struct ath10k_htt_tx_ops {int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,u8 max_subfrms_ampdu,u8 max_subfrms_amsdu); +void (*htt_flush_tx)(struct ath10k_htt *htt); };static inline int ath10k_htt_send_rx_ring_cfg (struct ath10k_htt *htt)
@@ -2072,6 +2073,12 @@ static inline int ath10k_htt_tx(struct ath10k_htt *htt,return htt->tx_ops->htt_tx (htt, txmode, msdu); } +static inline void ath10k_htt_flush_tx (struct ath10k_htt *htt) +{ +if (htt->tx_ops->htt_flush_tx) + htt->tx_ops->htt_flush_tx (htt); +} +static inline int ath10k_htt_alloc_txbuff (struct ath10k_htt *htt) {if (!htt->tx_ops->htt_alloc_txbuff)
drivers/net/wireless/ath/ath10k/htt_tx.c +7 -1
@@ -529,9 +529,14 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt) htt->tx_mem_allocated = false; } -void ath10k_htt_tx_stop (struct ath10k_htt *htt) +static void ath10k_htt_flush_tx_queue (struct ath10k_htt *htt) {idr_for_each (&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); +} + +void ath10k_htt_tx_stop (struct ath10k_htt *htt) +{ +ath10k_htt_flush_tx_queue (htt);idr_destroy (&htt->pending_tx); }
@@ -1774,6 +1779,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_hl = { .htt_send_frag_desc_bank_cfg = ath10k_htt_send_frag_desc_bank_cfg_32, .htt_tx = ath10k_htt_tx_hl, .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg_32, + .htt_flush_tx = ath10k_htt_flush_tx_queue, };void ath10k_htt_set_tx_ops (struct ath10k_htt *htt)
drivers/net/wireless/ath/ath10k/mac.c +1 -0
@@ -7082,6 +7082,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,ath10k_wmi_peer_flush (ar, arvif->vdev_id, arvif->bssid, bitmap); } +ath10k_htt_flush_tx (&ar->htt); }return ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 67/261 audit: fix a net reference leak in audit_send_reply()
In reply to Greg Kroah-HartmanFrom: Paul Moore <[email protected]>
[ Upstream commit a48b284b403a4a073d8beb72d2bb33e54df67fb6 ]
If audit_send_reply() fails when trying to create a new thread to send the reply it also fails to cleanup properly, leaking a reference to a net structure. This patch fixes the error path and makes a handful of other cleanups that came up while fixing the code.
--- kernel/audit.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-)
kernel/audit.c +29 -21
@@ -923,19 +923,30 @@ out_kfree_skb:return NULL ; } +static void audit_free_reply (struct audit_reply *reply) +{ +if (!reply) +return ; + +if (reply->skb) +kfree_skb (reply->skb); +if (reply->net) +put_net (reply->net); +kfree (reply); +} +static int audit_send_reply_thread (void *arg) {struct audit_reply *reply = (struct audit_reply *)arg; -struct sock *sk =audit_get_sk (reply->net);audit_ctl_lock ();audit_ctl_unlock ();/* Ignore failure. It'll only happen if the sender goes away, because our timeout is set to infinite. */ -netlink_unicast (sk, reply->skb, reply->portid,0 ); -put_net (reply->net); -kfree (reply); +netlink_unicast (audit_get_sk (reply->net), reply->skb, reply->portid,0 ); + reply->skb =NULL ; +audit_free_reply (reply);return 0 ; }
@@ -949,35 +960,32 @@ static int audit_send_reply_thread(void *arg)* @payload: payload data * @size: payload size * -* Allocates an skb, builds the netlink message, and sends it to the port id. -* No failure notifications. +* Allocates a skb, builds the netlink message, and sends it to the port id. */ static void audit_send_reply (struct sk_buff *request_skb,int seq,int type,int done,int multi,const void *payload,int size) { -struct net *net =sock_net (NETLINK_CB (request_skb).sk); -struct sk_buff *skb;struct task_struct *tsk; -struct audit_reply *reply =kmalloc (sizeof (struct audit_reply ), -GFP_KERNEL ); +struct audit_reply *reply; + reply =kzalloc (sizeof (*reply),GFP_KERNEL );if (!reply)return ; - skb =audit_make_reply (seq, type, done, multi, payload, size); -if (!skb) - goto out; - - reply->net =get_net (net); + reply->skb =audit_make_reply (seq, type, done, multi, payload, size); +if (!reply->skb) + goto err; + reply->net =get_net (sock_net (NETLINK_CB (request_skb).sk)); reply->portid =NETLINK_CB (request_skb).portid; - reply->skb = skb; tsk =kthread_run (audit_send_reply_thread, reply,"audit_send_reply" ); -if (!IS_ERR (tsk)) -return ; -kfree_skb (skb); -out: -kfree (reply); +if (IS_ERR (tsk)) + goto err; + +return ; + +err: +audit_free_reply (reply); }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 72/261 Bluetooth: btbcm: Add 2 missing models to subver tables
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit c03ee9af4e07112bd3fc688daca9e654f41eca93 ]
Currently the bcm_uart_subver_ and bcm_usb_subver_table-s lack entries for the BCM4324B5 and BCM20703A1 chipsets. This makes the code use just "BCM" as prefix for the filename to pass to request-firmware, making it harder for users to figure out which firmware they need. This especially is problematic with the UART attached BCM4324B5 where this leads to the filename being just "BCM.hcd".
Add the 2 missing devices to subver tables. This has been tested on:
1. A Dell XPS15 9550 where this makes btbcm.c try to load "BCM20703A1-0a5c-6410.hcd" before it tries to load "BCM-0a5c-6410.hcd".
2. A Thinkpad 8 where this makes btbcm.c try to load "BCM4324B5.hcd" before it tries to load "BCM.hcd"
--- drivers/bluetooth/btbcm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btbcm.c +2 -0
@@ -329,6 +329,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = { { 0x410e, "BCM43341B0" }, /* 002.001.014 */ { 0x4204, "BCM2076B1" }, /* 002.002.004 */ { 0x4406, "BCM4324B3" }, /* 002.004.006 */ + { 0x4606, "BCM4324B5" }, /* 002.006.006 */ { 0x6109, "BCM4335C0" }, /* 003.001.009 */ { 0x610c, "BCM4354" }, /* 003.001.012 */ { 0x2122, "BCM4343A0" }, /* 001.001.034 */
@@ -343,6 +344,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = { };static const struct bcm_subver_table bcm_usb_subver_table[] = { + {0x2105 ,"BCM20703A1" },/* 001.001.005 */ {0x210b ,"BCM43142A0" },/* 001.001.011 */ {0x2112 ,"BCM4314A0" },/* 001.001.018 */ {0x2118 ,"BCM20702A0" },/* 001.001.024 */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 75/261 dpaa2-eth: fix return codes used in ndo_setup_tc
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit b89c1e6bdc73f5775e118eb2ab778e75b262b30c ]
Drivers ndo_setup_tc call should return -EOPNOTSUPP, when it cannot support the qdisc type. Other return values will result in failing the qdisc setup. This lead to qdisc noop getting assigned, which will drop all TX packets on the interface.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +2 -2
@@ -1981,7 +1981,7 @@ static int dpaa2_eth_setup_tc(struct net_device *net_dev,int i;if (type !=TC_SETUP_QDISC_MQPRIO ) -return -EINVAL ; +return -EOPNOTSUPP ; mqprio->hw =TC_MQPRIO_HW_OFFLOAD_TCS ; num_queues =dpaa2_eth_queue_count (priv);
@@ -1993,7 +1993,7 @@ static int dpaa2_eth_setup_tc(struct net_device *net_dev,if (num_tc >dpaa2_eth_tc_count (priv)) {netdev_err (net_dev,"Max %d traffic classes supported\n" ,dpaa2_eth_tc_count (priv)); -return -EINVAL ; +return -EOPNOTSUPP ; }if (!num_tc) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 76/261 netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 0d7c83463fdf7841350f37960a7abadd3e650b41 ]
Instead of EINVAL which should be used for malformed netlink messages.
--- net/netfilter/nft_nat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_nat.c +2 -2
@@ -129,7 +129,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, priv->type =NF_NAT_MANIP_DST ;break ;default : -return -EINVAL ; +return -EOPNOTSUPP ; }if (tb[NFTA_NAT_FAMILY ] ==NULL )
@@ -196,7 +196,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,if (tb[NFTA_NAT_FLAGS ]) { priv->flags =ntohl (nla_get_be32 (tb[NFTA_NAT_FLAGS ]));if (priv->flags & ~NF_NAT_RANGE_MASK ) -return -EINVAL ; +return -EOPNOTSUPP ; }return nf_ct_netns_get (ctx->net, family);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 58/261 ath10k: fix kernel null pointer dereference
In reply to Greg Kroah-HartmanFrom: Venkateswara Naralasetty <[email protected]>
[ Upstream commit acb31476adc9ff271140cdd4d3c707ff0c97f5a4 ]
Currently sta airtime is updated without any lock in case of host based airtime calculation. Which may result in accessing the invalid sta pointer in case of continuous station connect/disconnect.
This patch fix the kernel null pointer dereference by updating the station airtime with proper RCU lock in case of host based airtime calculation.
Proceeding with the analysis of "ARM Kernel Panic".
The APSS crash happened due to OOPS on CPU 0.
Crash Signature : Unable to handle kernel NULL pointer dereference at virtual address 00000300
During the crash,
PC points to "ieee80211_sta_register_airtime+0x1c/0x448 [mac80211]" LR points to "ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]". The Backtrace obtained is as follows:
[<bf880238>] (ieee80211_sta_register_airtime [mac80211]) from [<bf945a38>] (ath10k_txrx_tx_unref+0x17c/0x364 [ath10k_core]) [<bf945a38>] (ath10k_txrx_tx_unref [ath10k_core]) from [<bf9428e4>] (ath10k_htt_txrx_compl_task+0xa50/0xfc0 [ath10k_core]) [<bf9428e4>] (ath10k_htt_txrx_compl_task [ath10k_core]) from [<bf9b9bc8>] (ath10k_pci_napi_poll+0x50/0xf8 [ath10k_pci]) [<bf9b9bc8>] (ath10k_pci_napi_poll [ath10k_pci]) from [<c059e3b0>] (net_rx_action+0xac/0x160)
[<c059e3b0>] (net_rx_action) from [<c02329a4>] (__do_softirq+0x104/0x294) [<c02329a4>] (__do_softirq) from [<c0232b64>] (run_ksoftirqd+0x30/0x90) [<c0232b64>] (run_ksoftirqd) from [<c024e358>] (smpboot_thread_fn+0x25c/0x274) [<c024e358>] (smpboot_thread_fn) from [<c02482fc>] (kthread+0xd8/0xec)
Tested HW: QCA9888
Tested FW: 10.4-3.10-00047
--- drivers/net/wireless/ath/ath10k/txrx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath10k/txrx.c +2 -0
@@ -84,9 +84,11 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,wake_up (&htt->empty_tx_wq);spin_unlock_bh (&htt->tx_lock); +rcu_read_lock ();if (txq && txq->sta && skb_cb->airtime_est)ieee80211_sta_register_airtime (txq->sta, txq->tid, skb_cb->airtime_est,0 ); +rcu_read_unlock ();if (ar->bus_param.dev_type !=ATH10K_DEV_TYPE_HL )dma_unmap_single (dev, skb_cb->paddr, msdu->len,DMA_TO_DEVICE );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 77/261 selftests/bpf: Fix memory leak in extract_build_id()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 9f56bb531a809ecaa7f0ddca61d2cf3adc1cb81a ]
getline() allocates string, which has to be freed.
--- tools/testing/selftests/bpf/test_progs.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_progs.c +1 -0
@@ -293,6 +293,7 @@ int extract_build_id(char *build_id, size_t size) len = size;memcpy (build_id, line, len); build_id[len] ='\0' ; +free (line);return 0 ; err:fclose (fp);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 80/261 lib/mpi: Fix 64-bit MIPS build with Clang
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 18f1ca46858eac22437819937ae44aa9a8f9f2fa ]
When building 64r6_defconfig with CONFIG_MIPS32_O32 disabled and CONFIG_CRYPTO_RSA enabled:
lib/mpi/generic_mpih-mul1.c:37:24: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/mpi/longlong.h:664:22: note: expanded from macro 'umul_ppmm'
: "=d" ((UDItype)(w0))
~~~~~~~~~~^~~
lib/mpi/generic_mpih-mul1.c:37:13: error: invalid use of a cast in a
inline asm context requiring an l-value: remove the cast
or build with -fheinous-gnu-extensions
umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/mpi/longlong.h:668:22: note: expanded from macro 'umul_ppmm'
: "=d" ((UDItype)(w1))
~~~~~~~~~~^~~2 errors generated.
This special case for umul_ppmm for MIPS64r6 was added in commit bbc25bee37d2b ("lib/mpi: Fix umul_ppmm() for MIPS64r6"), due to GCC being inefficient and emitting a __multi3 intrinsic.
There is no such issue with clang; with this patch applied, I can build this configuration without any problems and there are no link errors like mentioned in the commit above (which I can still reproduce with GCC 9.3.0 when that commit is reverted). Only use this definition when GCC is being used.
This really should have been caught by commit b0c091ae04f67 ("lib/mpi:
Eliminate unused umul_ppmm definitions for MIPS") when I was messing around in this area but I was not testing 64-bit MIPS at the time.
--- lib/mpi/longlong.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/mpi/longlong.h +1 -1
@@ -653,7 +653,7 @@ do { \************** MIPS/64 ************** ***************************************/ #if (defined(__mips) && __mips >=3 ) &&W_TYPE_SIZE ==64 -#if defined(__mips_isa_rev) && __mips_isa_rev >=6 +#if defined(__mips_isa_rev) && __mips_isa_rev >=6 && defined(CONFIG_CC_IS_GCC )/* * GCC ends up emitting a __multi3 intrinsic call for MIPS64r6 with the plain C * code below, so we special case MIPS64r6 until the compiler can do better.
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 82/261 sched/core: Fix illegal RCU from offline CPUs
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit bf2c59fce4074e55d622089b34be3a6bc95484fb ]
In the CPU-offline process, it calls mmdrop() after idle entry and the subsequent call to cpuhp_report_idle_dead(). Once execution passes the call to rcu_report_dead(), RCU is ignoring the CPU, which results in lockdep complaining when mmdrop() uses RCU from either memcg or debugobjects below.
Fix it by cleaning up the active_mm state from BP instead. Every arch which has CONFIG_HOTPLUG_CPU should have already called idle_task_exit() from AP. The only exception is parisc because it switches them to &init_mm unconditionally (see smp_boot_one_cpu() and smp_cpu_init()), but the patch will still work there because it calls mmgrab(&init_mm) in smp_cpu_init() and then should call mmdrop(&init_mm) in finish_cpu().
WARNING: suspicious RCU usage
-----------------------------
kernel/workqueue.c:710 RCU or wq_pool_mutex should be held!
other info that might help us debug this:
RCU used illegally from offline CPU!
Call Trace: dump_stack+0xf4/0x164 (unreliable) lockdep_rcu_suspicious+0x140/0x164 get_work_pool+0x110/0x150 __queue_work+0x1bc/0xca0 queue_work_on+0x114/0x120 css_release+0x9c/0xc0 percpu_ref_put_many+0x204/0x230 free_pcp_prepare+0x264/0x570 free_unref_page+0x38/0xf0 __mmdrop+0x21c/0x2c0 idle_task_exit+0x170/0x1b0 pnv_smp_cpu_kill_self+0x38/0x2e0 cpu_die+0x48/0x64 arch_cpu_idle_dead+0x30/0x50 do_idle+0x2f4/0x470 cpu_startup_entry+0x38/0x40 start_secondary+0x7a8/0xa80 start_secondary_resume+0x10/0x14
--- arch/powerpc/platforms/powernv/smp.c | 1 - include/linux/sched/mm.h | 2 ++ kernel/cpu.c | 18 +++++++++++++++++- kernel/sched/core.c | 5 +++-- 4 files changed, 22 insertions(+), 4 deletions(-)
arch/powerpc/platforms/powernv/smp.c +0 -1
@@ -167,7 +167,6 @@ static void pnv_smp_cpu_kill_self(void)/* Standard hot unplug procedure */ idle_task_exit (); - current->active_mm =NULL ;/* for sanity */ cpu =smp_processor_id ();DBG ("CPU%d offline\n" , cpu);generic_set_cpu_dead (cpu);
include/linux/sched/mm.h +2 -0
@@ -49,6 +49,8 @@ static inline void mmdrop(struct mm_struct *mm)__mmdrop (mm); } +void mmdrop (struct mm_struct *mm); +/* * This has to be called after a get_task_mm()/mmget_not_zero() * followed by taking the mmap_sem for writing before modifying the
kernel/cpu.c +17 -1
@@ -3,6 +3,7 @@* * This code is licenced under the GPL. */ +#include <linux/sched/mm.h> #include <linux/proc_fs.h> #include <linux/smp.h> #include <linux/init.h>
@@ -564,6 +565,21 @@ static int bringup_cpu(unsigned int cpu)return bringup_wait_for_ap (cpu); } +static int finish_cpu (unsigned int cpu) +{ +struct task_struct *idle =idle_thread_get (cpu); +struct mm_struct *mm = idle->active_mm; + +/* +* idle_task_exit() will have switched to &init_mm, now +* clean up any remaining active_mm state. +*/ +if (mm != &init_mm) + idle->active_mm = &init_mm; +mmdrop (mm); +return 0 ; +} +/* * Hotplug state machine related functions */
@@ -1434,7 +1450,7 @@ static struct cpuhp_step cpuhp_hp_states[] = { [CPUHP_BRINGUP_CPU] = { .name = "cpu:bringup", .startup.single = bringup_cpu, - .teardown.single = NULL, + .teardown.single = finish_cpu, .cant_stop = true, },/* Final state before CPU kills itself */
kernel/sched/core.c +3 -2
@@ -6177,13 +6177,14 @@ void idle_task_exit(void)struct mm_struct *mm = current->active_mm;BUG_ON (cpu_online (smp_processor_id ())); +BUG_ON (current !=this_rq ()->idle);if (mm != &init_mm) {switch_mm (mm, &init_mm, current); - current->active_mm = &init_mm;finish_arch_post_lock_switch (); } -mmdrop (mm); + +/* finish_cpu(), as ran on the BP, will clean up the active_mm state */ }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 84/261 iocost_monitor: drop string wrap around numbers when outputting json
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
[ Upstream commit 21f3cfeab304fc07b90d93d98d4d2f62110fe6b2 ]
Wrapping numbers in strings is used by some to work around bit-width issues in some enviroments. The problem isn't innate to json and the workaround seems to cause more integration problems than help. Let's drop the string wrapping.
--- tools/cgroup/iocost_monitor.py | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-)
tools/cgroup/iocost_monitor.py +21 -21
@@ -112,14 +112,14 @@ class IocStat: def dict(self, now): return { 'device' : devname, - 'timestamp' : str(now), - 'enabled' : str(int(self.enabled)), - 'running' : str(int(self.running)), - 'period_ms' : str(self.period_ms), - 'period_at' : str(self.period_at), - 'period_vtime_at' : str(self.vperiod_at), - 'busy_level' : str(self.busy_level), - 'vrate_pct' : str(self.vrate_pct), } + 'timestamp' : now, + 'enabled' : self.enabled, + 'running' : self.running, + 'period_ms' : self.period_ms, + 'period_at' : self.period_at, + 'period_vtime_at' : self.vperiod_at, + 'busy_level' : self.busy_level, + 'vrate_pct' : self.vrate_pct, } def table_preamble_str(self): state = ('RUN' if self.running else 'IDLE') if self.enabled else 'OFF'
@@ -179,19 +179,19 @@ class IocgStat: def dict(self, now, path): out = { 'cgroup' : path, - 'timestamp' : str(now), - 'is_active' : str(int(self.is_active)), - 'weight' : str(self.weight), - 'weight_active' : str(self.active), - 'weight_inuse' : str(self.inuse), - 'hweight_active_pct' : str(self.hwa_pct), - 'hweight_inuse_pct' : str(self.hwi_pct), - 'inflight_pct' : str(self.inflight_pct), - 'debt_ms' : str(self.debt_ms), - 'use_delay' : str(self.use_delay), - 'delay_ms' : str(self.delay_ms), - 'usage_pct' : str(self.usage), - 'address' : str(hex(self.address)) } + 'timestamp' : now, + 'is_active' : self.is_active, + 'weight' : self.weight, + 'weight_active' : self.active, + 'weight_inuse' : self.inuse, + 'hweight_active_pct' : self.hwa_pct, + 'hweight_inuse_pct' : self.hwi_pct, + 'inflight_pct' : self.inflight_pct, + 'debt_ms' : self.debt_ms, + 'use_delay' : self.use_delay, + 'delay_ms' : self.delay_ms, + 'usage_pct' : self.usage, + 'address' : self.address } for i in range(len(self.usages)): out[f'usage_pct_{i}'] = str(self.usages[i]) return out
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 83/261 drivers/perf: hisi: Fix typo in events attribute array
In reply to Greg Kroah-HartmanFrom: Shaokun Zhang <[email protected]>
[ Upstream commit 88562f06ebf56587788783e5420f25fde3ca36c8 ]
Fix up one typo: wr_dr_64b -> wr_ddr_64b.
--- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c +1 -1
@@ -285,7 +285,7 @@ static struct attribute *hisi_hha_pmu_events_attr[] = {HISI_PMU_EVENT_ATTR (rx_wbip,0x05 ),HISI_PMU_EVENT_ATTR (rx_wtistash,0x11 ),HISI_PMU_EVENT_ATTR (rd_ddr_64b,0x1c ), -HISI_PMU_EVENT_ATTR (wr_dr_64b,0x1d ), +HISI_PMU_EVENT_ATTR (wr_ddr_64b,0x1d ),HISI_PMU_EVENT_ATTR (rd_ddr_128b,0x1e ),HISI_PMU_EVENT_ATTR (wr_ddr_128b,0x1f ), HISI_PMU_EVENT_ATTR(spill_num, 0x20),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 86/261 selinux: fix error return code in policydb_read()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 4c09f8b6913a779ca0c70ea8058bf21537eebb3b ]
Fix to return negative error code -ENOMEM from the kvcalloc() error handling case instead of 0, as done elsewhere in this function.
--- security/selinux/ss/policydb.c | 1 + 1 file changed, 1 insertion(+)
security/selinux/ss/policydb.c +1 -0
@@ -2496,6 +2496,7 @@ int policydb_read(struct policydb *p, void *fp)if (rc) goto bad; + rc = -ENOMEM ; p->type_attr_map_array =kvcalloc (p->p_types.nprim,sizeof (*p->type_attr_map_array),GFP_KERNEL );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 60/261 spi: Respect DataBitLength field of SpiSerialBusV2() ACPI resource
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 0dadde344d965566589cd82797893d5aa06557a3 ]
By unknown reason the commit 64bee4d28c9e
("spi / ACPI: add ACPI enumeration support")
missed the DataBitLength property to encounter when parse SPI slave device data from ACPI.
Fill the gap here.
--- drivers/spi/spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi.c +1 -0
@@ -1950,6 +1950,7 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) } lookup->max_speed_hz = sb->connection_speed; + lookup->bits_per_word = sb->data_bit_length;if (sb->clock_phase ==ACPI_SPI_SECOND_PHASE ) lookup->mode |=SPI_CPHA ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 61/261 brcmfmac: fix wrong location to get firmware feature
In reply to Greg Kroah-HartmanFrom: Jaehoon Chung <[email protected]>
[ Upstream commit c57673852062428cdeabdd6501ac8b8e4c302067 ]
sup_wpa feature is getting after setting feature_disable flag. If firmware is supported sup_wpa feature, it's always enabled regardless of feature_disable flag.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +2 -1
@@ -283,13 +283,14 @@ void brcmf_feat_attach(struct brcmf_pub *drvr)if (!err) ifp->drvr->feat_flags |=BIT (BRCMF_FEAT_SCAN_RANDOM_MAC ); +brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_FWSUP ,"sup_wpa" ); +if (drvr->settings->feature_disable) {brcmf_dbg (INFO ,"Features: 0x%02x, disable: 0x%02x\n" , ifp->drvr->feat_flags, drvr->settings->feature_disable); ifp->drvr->feat_flags &= ~drvr->settings->feature_disable; } -brcmf_feat_iovar_int_get (ifp,BRCMF_FEAT_FWSUP ,"sup_wpa" );brcmf_feat_firmware_overrides (drvr);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 63/261 tools api fs: Make xxx__mountpoint() more scalable
In reply to Greg Kroah-HartmanFrom: Stephane Eranian <[email protected]>
[ Upstream commit c6fddb28bad26e5472cb7acf7b04cd5126f1a4ab ]
The xxx_mountpoint() interface provided by fs.c finds mount points for common pseudo filesystems. The first time xxx_mountpoint() is invoked, it scans the mount table (/proc/mounts) looking for a match. If found, it is cached. The price to scan /proc/mounts is paid once if the mount is found.
When the mount point is not found, subsequent calls to xxx_mountpoint() scan /proc/mounts over and over again. There is no caching.
This causes a scaling issue in perf record with hugeltbfs__mountpoint(). The function is called for each process found in synthesize__mmap_events(). If the machine has thousands of processes and if the /proc/mounts has many entries this could cause major overhead in perf record. We have observed multi-second slowdowns on some configurations.
As an example on a laptop:
Before:
$ sudo umount /dev/hugepages $ strace -e trace=openat -o /tmp/tt perf record -a ls $ fgrep mounts /tmp/tt 285
After:
$ sudo umount /dev/hugepages $ strace -e trace=openat -o /tmp/tt perf record -a ls $ fgrep mounts /tmp/tt 1
One could argue that the non-caching in case the moint point is not found is intentional. That way subsequent calls may discover a moint point if the sysadmin mounts the filesystem. But the same argument could be made against caching the mount point. It could be unmounted causing errors. It all depends on the intent of the interface. This patch assumes it is expected to scan /proc/mounts once. The patch documents the caching behavior in the fs.h header file.
An alternative would be to just fix perf record. But it would solve the problem with hugetlbs__mountpoint() but there could be similar issues (possibly down the line) with other xxx_mountpoint() calls in perf or other tools.
--- tools/lib/api/fs/fs.c | 17 +++++++++++++++++ tools/lib/api/fs/fs.h | 12 ++++++++++++ 2 files changed, 29 insertions(+)
tools/lib/api/fs/fs.c +17 -0
@@ -90,6 +90,7 @@ struct fs {const char *const *mounts;char path[PATH_MAX ];bool found; +bool checked;long magic; };
@@ -111,31 +112,37 @@ static struct fs fs__entries[] = { .name = "sysfs", .mounts = sysfs__fs_known_mountpoints, .magic = SYSFS_MAGIC, + .checked = false, }, [FS__PROCFS] = { .name = "proc", .mounts = procfs__known_mountpoints, .magic = PROC_SUPER_MAGIC, + .checked = false, }, [FS__DEBUGFS] = { .name = "debugfs", .mounts = debugfs__known_mountpoints, .magic = DEBUGFS_MAGIC, + .checked = false, }, [FS__TRACEFS] = { .name = "tracefs", .mounts = tracefs__known_mountpoints, .magic = TRACEFS_MAGIC, + .checked = false, }, [FS__HUGETLBFS] = { .name = "hugetlbfs", .mounts = hugetlbfs__known_mountpoints, .magic = HUGETLBFS_MAGIC, + .checked = false, }, [FS__BPF_FS] = { .name = "bpf", .mounts = bpf_fs__known_mountpoints, .magic = BPF_FS_MAGIC, + .checked = false, }, };
@@ -158,6 +165,7 @@ static bool fs__read_mounts(struct fs *fs) }fclose (fp); + fs->checked = true;return fs->found = found; }
@@ -220,6 +228,7 @@ static bool fs__env_override(struct fs *fs)return false; fs->found = true; + fs->checked = true;strncpy (fs->path, override_path,sizeof (fs->path) -1 ); fs->path[sizeof (fs->path) -1 ] ='\0' ;return true;
@@ -246,6 +255,14 @@ static const char *fs__mountpoint(int idx)if (fs->found)return (const char *)fs->path; +/* the mount point was already checked for the mount point +* but and did not exist, so return NULL to avoid scanning again. +* This makes the found and not found paths cost equivalent +* in case of multiple calls. +*/ +if (fs->checked) +return NULL ; +return fs__get_mountpoint (fs); }
tools/lib/api/fs/fs.h +12 -0
@@ -18,6 +18,18 @@ const char *name##__mount(void); \ bool name##__configured(void); \ +/* +* The xxxx__mountpoint() entry points find the first match mount point for each +* filesystems listed below, where xxxx is the filesystem type. +* +* The interface is as follows: +* +* - If a mount point is found on first call, it is cached and used for all +* subsequent calls. +* +* - If a mount point is not found, NULL is returned on first call and all +* subsequent calls. +*/ FS(sysfs) FS(procfs) FS(debugfs)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 65/261 dt-bindings: display: mediatek: control dpi pins mode to avoid leakage
In reply to Greg Kroah-HartmanFrom: Jitao Shi <[email protected]>
[ Upstream commit b0ff9b590733079f7f9453e5976a9dd2630949e3 ]
Add property "pinctrl-names" to swap pin mode between gpio and dpi mode. Set the dpi pins to gpio mode and output-low to avoid leakage current when dpi disabled.
--- .../devicetree/bindings/display/mediatek/mediatek,dpi.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt +6 -0
@@ -16,6 +16,9 @@ Required properties: Documentation/devicetree/bindings/graph.txt. This port should be connected to the input port of an attached HDMI or LVDS encoder chip. +Optional properties: +- pinctrl-names: Contain "default" and "sleep". + Example: dpi0: dpi@1401d000 {
@@ -26,6 +29,9 @@ dpi0: dpi@1401d000 { <&mmsys CLK_MM_DPI_ENGINE>, <&apmixedsys CLK_APMIXED_TVDPLL>; clock-names = "pixel", "engine", "pll"; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&dpi_pin_func>; + pinctrl-1 = <&dpi_pin_idle>; port { dpi0_out: endpoint {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 56/261 x86: fix vmap arguments in map_irq_stack
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 0348801151b5aefbcf9d6e9b9e30aceb3a2a7b13 ]
vmap does not take a gfp_t, the flags argument is for VM_* flags.
--- arch/x86/kernel/irq_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/irq_64.c +1 -1
@@ -43,7 +43,7 @@ static int map_irq_stack(unsigned int cpu) pages[i] =pfn_to_page (pa >>PAGE_SHIFT ); } - va =vmap (pages,IRQ_STACK_SIZE /PAGE_SIZE ,GFP_KERNEL ,PAGE_KERNEL ); + va =vmap (pages,IRQ_STACK_SIZE /PAGE_SIZE ,VM_MAP ,PAGE_KERNEL );if (!va)return -ENOMEM ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 89/261 net: allwinner: Fix use correct return type for ndo_start_xmit()
In reply to Greg Kroah-HartmanFrom: Yunjian Wang <[email protected]>
[ Upstream commit 09f6c44aaae0f1bdb8b983d7762676d5018c53bc ]
The method ndo_start_xmit() returns a value of type netdev_tx_t. Fix the ndo function to use the correct type. And emac_start_xmit() can leak one skb if 'channel' == 3.
--- drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/allwinner/sun4i-emac.c +2 -2
@@ -432,7 +432,7 @@ static void emac_timeout(struct net_device *dev)/* Hardware start transmission. * Send a packet to media from the upper layer. */ -static int emac_start_xmit (struct sk_buff *skb,struct net_device *dev) +static netdev_tx_t emac_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct emac_board_info *db =netdev_priv (dev);unsigned long channel;
@@ -440,7 +440,7 @@ static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev) channel = db->tx_fifo_stat &3 ;if (channel ==3 ) -return 1 ; +return NETDEV_TX_BUSY ; channel = (channel ==1 ?1 :0 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 99/261 platform/x86: intel-vbtn: Use acpi_evaluate_integer()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 18937875a231d831c309716d6d8fc358f8381881 ]
Use acpi_evaluate_integer() instead of open-coding it.
This is a preparation patch for adding a intel_vbtn_has_switches() helper function.
--- drivers/platform/x86/intel-vbtn.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/platform/x86/intel-vbtn.c +6 -13
@@ -118,28 +118,21 @@ static void detect_tablet_mode(struct platform_device *device)const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE );struct intel_vbtn_priv *priv =dev_get_drvdata (&device->dev);acpi_handle handle =ACPI_HANDLE (&device->dev); -struct acpi_buffer vgbs_output = {ACPI_ALLOCATE_BUFFER ,NULL }; -union acpi_object *obj; +unsigned long long vgbs;acpi_status status;int m;if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) - goto out; +return ; - status =acpi_evaluate_object (handle,"VGBS" ,NULL , &vgbs_output); + status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);if (ACPI_FAILURE (status)) - goto out; - - obj = vgbs_output.pointer; -if (!(obj && obj->type ==ACPI_TYPE_INTEGER )) - goto out; +return ; - m = !(obj->integer.value &TABLET_MODE_FLAG ); + m = !(vgbs &TABLET_MODE_FLAG );input_report_switch (priv->input_dev,SW_TABLET_MODE , m); - m = (obj->integer.value &DOCK_MODE_FLAG ) ?1 :0 ; + m = (vgbs &DOCK_MODE_FLAG ) ?1 :0 ;input_report_switch (priv->input_dev,SW_DOCK , m); -out: -kfree (vgbs_output.pointer); }static int intel_vbtn_probe (struct platform_device *device)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 101/261 platform/x86: intel-vbtn: Do not advertise switches to userspace if they are not there
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 990fbb48067bf8cfa34b7d1e6e1674eaaef2f450 ]
Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a DMI chassis-type check to avoid accidentally reporting SW_TABLET_MODE = 1 to userspace on laptops (specifically on the Dell XPS 9360), to avoid e.g. userspace ignoring touchpad events because userspace thought the device was in tablet-mode.
But if we are not getting the initial status of the switch because the device does not have a tablet mode, then we really should not advertise the presence of a tablet-mode switch to userspace at all, as userspace may use the mere presence of this switch for certain heuristics.
--- drivers/platform/x86/intel-vbtn.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/platform/x86/intel-vbtn.c +19 -6
@@ -54,6 +54,7 @@ static const struct key_entry intel_vbtn_switchmap[] = {struct intel_vbtn_priv {struct key_entry keymap[KEYMAP_LEN ];struct input_dev *input_dev; +bool has_switches;bool wakeup_mode; };
@@ -69,7 +70,7 @@ static int intel_vbtn_input_setup(struct platform_device *device) keymap_len +=ARRAY_SIZE (intel_vbtn_keymap); } -if (true) { +if (priv->has_switches) {memcpy (&priv->keymap[keymap_len], intel_vbtn_switchmap,ARRAY_SIZE (intel_vbtn_switchmap) *sizeof (struct key_entry ));
@@ -137,16 +138,12 @@ out_unknown:static void detect_tablet_mode (struct platform_device *device) { -const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE );struct intel_vbtn_priv *priv =dev_get_drvdata (&device->dev);acpi_handle handle =ACPI_HANDLE (&device->dev);unsigned long long vgbs;acpi_status status;int m; -if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) -return ; - status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);if (ACPI_FAILURE (status))return ;
@@ -157,6 +154,19 @@ static void detect_tablet_mode(struct platform_device *device)input_report_switch (priv->input_dev,SW_DOCK , m); } +static bool intel_vbtn_has_switches (acpi_handle handle) +{ +const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE ); +unsigned long long vgbs; +acpi_status status; + +if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) +return false; + + status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs); +return ACPI_SUCCESS (status); +} +static int intel_vbtn_probe (struct platform_device *device) {acpi_handle handle =ACPI_HANDLE (&device->dev);
@@ -175,13 +185,16 @@ static int intel_vbtn_probe(struct platform_device *device)return -ENOMEM ;dev_set_drvdata (&device->dev, priv); + priv->has_switches =intel_vbtn_has_switches (handle); + err =intel_vbtn_input_setup (device);if (err) {pr_err ("Failed to setup Intel Virtual Button\n" );return err; } -detect_tablet_mode (device); +if (priv->has_switches) +detect_tablet_mode (device); status = acpi_install_notify_handler(handle, ACPI_DEVICE_NOTIFY,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 102/261 platform/x86: intel-vbtn: Also handle tablet-mode switch on "Detachable" and "Portable" chassis-types
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 1fac39fd0316b19c3e57a182524332332d1643ce ]
Commit de9647efeaa9 ("platform/x86: intel-vbtn: Only activate tablet mode switch on 2-in-1's") added a DMI chassis-type check to avoid accidentally reporting SW_TABLET_MODE = 1 to userspace on laptops.
Some devices with a detachable keyboard and using the intel-vbnt (INT33D6) interface to report if they are in tablet mode (keyboard detached) or not, report 32 / "Detachable" as chassis-type, e.g. the HP Pavilion X2 series.
Other devices with a detachable keyboard and using the intel-vbnt (INT33D6) interface to report SW_TABLET_MODE, report 8 / "Portable" as chassis-type. The Dell Venue 11 Pro 7130 is an example of this.
Extend the DMI chassis-type check to also accept Portables and Detachables so that the intel-vbtn driver will report SW_TABLET_MODE on these devices.
Note the chassis-type check was originally added to avoid a false-positive tablet-mode report on the Dell XPS 9360 laptop. To the best of my knowledge that laptop is using a chassis-type of 9 / "Laptop", so after this commit we still ignore the tablet-switch for that chassis-type.
--- drivers/platform/x86/intel-vbtn.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/platform/x86/intel-vbtn.c +11 -1
@@ -157,12 +157,22 @@ static void detect_tablet_mode(struct platform_device *device)static bool intel_vbtn_has_switches (acpi_handle handle) {const char *chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE ); +unsigned long chassis_type_int;unsigned long long vgbs;acpi_status status; -if (!(chassis_type &&strcmp (chassis_type,"31" ) ==0 )) +if (kstrtoul (chassis_type,10 , &chassis_type_int))return false; +switch (chassis_type_int) { +case 8 :/* Portable */ +case 31 :/* Convertible */ +case 32 :/* Detachable */ +break ; +default : +return false; + } + status =acpi_evaluate_integer (handle,"VGBS" ,NULL , &vgbs);return ACPI_SUCCESS (status); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 104/261 nvme: refine the Qemu Identify CNS quirk
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit b9a5c3d4c34d8bd9fd75f7f28d18a57cb68da237 ]
Add a helper to check if we can use Identify CNS values > 1, and refine the Qemu quirk to not apply to reported versions larger than 1.1, as the Qemu implementation had been fixed by then.
--- drivers/nvme/host/core.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/nvme/host/core.c +14 -2
@@ -1032,6 +1032,19 @@ void nvme_stop_keep_alive(struct nvme_ctrl *ctrl) }EXPORT_SYMBOL_GPL (nvme_stop_keep_alive); +/* +* In NVMe 1.0 the CNS field was just a binary controller or namespace +* flag, thus sending any new CNS opcodes has a big chance of not working. +* Qemu unfortunately had that bug after reporting a 1.1 version compliance +* (but not for any later version). +*/ +static bool nvme_ctrl_limited_cns (struct nvme_ctrl *ctrl) +{ +if (ctrl->quirks &NVME_QUIRK_IDENTIFY_CNS ) +return ctrl->vs <NVME_VS (1 ,2 ,0 ); +return ctrl->vs <NVME_VS (1 ,1 ,0 ); +} +static int nvme_identify_ctrl (struct nvme_ctrl *dev,struct nvme_id_ctrl **id) {struct nvme_command c = { };
@@ -3740,8 +3753,7 @@ static void nvme_scan_work(struct work_struct *work)mutex_lock (&ctrl->scan_lock); nn =le32_to_cpu (id->nn); -if (ctrl->vs >=NVME_VS (1 ,1 ,0 ) && - !(ctrl->quirks &NVME_QUIRK_IDENTIFY_CNS )) { +if (!nvme_ctrl_limited_cns (ctrl)) {if (!nvme_scan_ns_list (ctrl, nn)) goto out_free_id; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 105/261 nvme-pci: align io queue count with allocted nvme_queue in nvme_probe
In reply to Greg Kroah-HartmanFrom: Weiping Zhang <[email protected]>
[ Upstream commit 2a5bcfdd41d68559567cec3c124a75e093506cc1 ]
Since commit 147b27e4bd08 ("nvme-pci: allocate device queues storage space at probe"), nvme_alloc_queue does not alloc the nvme queues itself anymore.
If the write/poll_queues module parameters are changed at runtime to values larger than the number of allocated queues in nvme_probe, nvme_alloc_queue will access unallocated memory.
Add a new nr_allocated_queues member to struct nvme_dev to record how many queues were alloctated in nvme_probe to avoid using more than the allocated queues after a reset following a change to the write/poll_queues module parameters.
Also add nr_write_queues and nr_poll_queues members to allow refreshing the number of write and poll queues based on a change to the module parameters when resetting the controller.
--- drivers/nvme/host/pci.c | 57 ++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-)
drivers/nvme/host/pci.c +33 -24
@@ -128,6 +128,9 @@ struct nvme_dev {dma_addr_t host_mem_descs_dma;struct nvme_host_mem_buf_desc *host_mem_descs;void **host_mem_desc_bufs; +unsigned int nr_allocated_queues; +unsigned int nr_write_queues; +unsigned int nr_poll_queues; };static int io_queue_depth_set (const char *val,const struct kernel_param *kp)
@@ -210,25 +213,14 @@ struct nvme_iod {struct scatterlist *sg; }; -static unsigned int max_io_queues (void ) +static inline unsigned int nvme_dbbuf_size (struct nvme_dev *dev) { -return num_possible_cpus () + write_queues + poll_queues; -} - -static unsigned int max_queue_count (void ) -{ -/* IO queues + admin queue */ -return 1 +max_io_queues (); -} - -static inline unsigned int nvme_dbbuf_size (u32 stride) -{ -return (max_queue_count () *8 * stride); +return dev->nr_allocated_queues *8 * dev->db_stride; }static int nvme_dbbuf_dma_alloc (struct nvme_dev *dev) { -unsigned int mem_size =nvme_dbbuf_size (dev->db_stride); +unsigned int mem_size =nvme_dbbuf_size (dev);if (dev->dbbuf_dbs)return 0 ;
@@ -253,7 +245,7 @@ static int nvme_dbbuf_dma_alloc(struct nvme_dev *dev)static void nvme_dbbuf_dma_free (struct nvme_dev *dev) { -unsigned int mem_size =nvme_dbbuf_size (dev->db_stride); +unsigned int mem_size =nvme_dbbuf_size (dev);if (dev->dbbuf_dbs) { dma_free_coherent(dev->dev, mem_size,
@@ -2030,7 +2022,7 @@ static int nvme_setup_host_mem(struct nvme_dev *dev)static void nvme_calc_irq_sets (struct irq_affinity *affd,unsigned int nrirqs) {struct nvme_dev *dev = affd->priv; -unsigned int nr_read_queues; +unsigned int nr_read_queues, nr_write_queues = dev->nr_write_queues;/* * If there is no interupt available for queues, ensure that
@@ -2046,12 +2038,12 @@ static void nvme_calc_irq_sets(struct irq_affinity *affd, unsigned int nrirqs)if (!nrirqs) { nrirqs =1 ; nr_read_queues =0 ; - }else if (nrirqs ==1 || !write_queues) { + }else if (nrirqs ==1 || !nr_write_queues) { nr_read_queues =0 ; - }else if (write_queues >= nrirqs) { + }else if (nr_write_queues >= nrirqs) { nr_read_queues =1 ; }else { - nr_read_queues = nrirqs - write_queues; + nr_read_queues = nrirqs - nr_write_queues; } dev->io_queues[HCTX_TYPE_DEFAULT ] = nrirqs - nr_read_queues;
@@ -2075,7 +2067,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues)* Poll queues don't need interrupts, but we need at least one IO * queue left over for non-polled IO. */ - this_p_queues = poll_queues; + this_p_queues = dev->nr_poll_queues;if (this_p_queues >= nr_io_queues) { this_p_queues = nr_io_queues -1 ; irq_queues =1 ;
@@ -2105,14 +2097,25 @@ static void nvme_disable_io_queues(struct nvme_dev *dev)__nvme_disable_io_queues (dev, nvme_admin_delete_cq); } +static unsigned int nvme_max_io_queues (struct nvme_dev *dev) +{ +return num_possible_cpus () + dev->nr_write_queues + dev->nr_poll_queues; +} +static int nvme_setup_io_queues (struct nvme_dev *dev) {struct nvme_queue *adminq = &dev->queues[0 ];struct pci_dev *pdev =to_pci_dev (dev->dev); -int result, nr_io_queues; +unsigned int nr_io_queues;unsigned long size; +int result; - nr_io_queues =max_io_queues (); +/* +* Sample the module parameters once at reset time so that we have +* stable values to work with. +*/ + dev->nr_write_queues = write_queues; + dev->nr_poll_queues = poll_queues;/* * If tags are shared with admin queue (Apple bug), then
@@ -2120,6 +2123,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)*/ if (dev->ctrl.quirks &NVME_QUIRK_SHARED_TAGS ) nr_io_queues =1 ; +else + nr_io_queues =min (nvme_max_io_queues (dev), + dev->nr_allocated_queues -1 ); result =nvme_set_queue_count (&dev->ctrl, &nr_io_queues);if (result <0 )
@@ -2794,8 +2800,11 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (!dev)return -ENOMEM ; - dev->queues =kcalloc_node (max_queue_count (),sizeof (struct nvme_queue ), -GFP_KERNEL , node); + dev->nr_write_queues = write_queues; + dev->nr_poll_queues = poll_queues; + dev->nr_allocated_queues =nvme_max_io_queues (dev) +1 ; + dev->queues =kcalloc_node (dev->nr_allocated_queues, +sizeof (struct nvme_queue ),GFP_KERNEL , node);if (!dev->queues) goto free;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 107/261 ath10k: Remove msdu from idr when management pkt send fails
In reply to Greg Kroah-HartmanFrom: Rakesh Pillai <[email protected]>
[ Upstream commit c730c477176ad4af86d9aae4d360a7ad840b073a ]
Currently when the sending of any management pkt via wmi command fails, the packet is being unmapped freed in the error handling. But the idr entry added, which is used to track these packet is not getting removed.
Hence, during unload, in wmi cleanup, all the entries in IDR are removed and the corresponding buffer is attempted to be freed. This can cause a situation where one packet is attempted to be freed twice.
Fix this error by rmeoving the msdu from the idr
list when the sending of a management packet over
wmi fails.
Tested HW: WCN3990
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/mac.c | 3 +++ drivers/net/wireless/ath/ath10k/wmi-ops.h | 10 ++++++++++ drivers/net/wireless/ath/ath10k/wmi-tlv.c | 15 +++++++++++++++ 3 files changed, 28 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +3 -0
@@ -3911,6 +3911,9 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work)if (ret) {ath10k_warn (ar,"failed to transmit management frame by ref via WMI: %d\n" , ret); +/* remove this msdu from idr tracking */ +ath10k_wmi_cleanup_mgmt_tx_send (ar, skb); +dma_unmap_single (ar->dev, paddr, skb->len,DMA_TO_DEVICE );ieee80211_free_txskb (ar->hw, skb);
drivers/net/wireless/ath/ath10k/wmi-ops.h +10 -0
@@ -133,6 +133,7 @@ struct wmi_ops {struct sk_buff *(*gen_mgmt_tx_send)(struct ath10k *ar,struct sk_buff *skb,dma_addr_t paddr); +int (*cleanup_mgmt_tx_send)(struct ath10k *ar,struct sk_buff *msdu);struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar,u64 module_enable,u32 log_level);struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar,u32 filter);
@@ -441,6 +442,15 @@ ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar)return ar->wmi.ops->get_txbf_conf_scheme (ar); } +static inline int +ath10k_wmi_cleanup_mgmt_tx_send (struct ath10k *ar,struct sk_buff *msdu) +{ +if (!ar->wmi.ops->cleanup_mgmt_tx_send) +return -EOPNOTSUPP ; + +return ar->wmi.ops->cleanup_mgmt_tx_send (ar, msdu); +} +static inline int ath10k_wmi_mgmt_tx_send (struct ath10k *ar,struct sk_buff *msdu,dma_addr_t paddr)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +15 -0
@@ -2837,6 +2837,18 @@ ath10k_wmi_tlv_op_gen_request_stats(struct ath10k *ar, u32 stats_mask)return skb; } +static int +ath10k_wmi_tlv_op_cleanup_mgmt_tx_send (struct ath10k *ar, +struct sk_buff *msdu) +{ +struct ath10k_skb_cb *cb =ATH10K_SKB_CB (msdu); +struct ath10k_wmi *wmi = &ar->wmi; + +idr_remove (&wmi->mgmt_pending_tx, cb->msdu_id); + +return 0 ; +} +static int ath10k_wmi_mgmt_tx_alloc_msdu_id (struct ath10k *ar,struct sk_buff *skb,dma_addr_t paddr)
@@ -2911,6 +2923,8 @@ ath10k_wmi_tlv_op_gen_mgmt_tx_send(struct ath10k *ar, struct sk_buff *msdu,if (desc_id <0 ) goto err_free_skb; + cb->msdu_id = desc_id; + ptr = (void *)skb->data; tlv = ptr; tlv->tag =__cpu_to_le16 (WMI_TLV_TAG_STRUCT_MGMT_TX_CMD );
@@ -4339,6 +4353,7 @@ static const struct wmi_ops wmi_tlv_ops = { .gen_force_fw_hang = ath10k_wmi_tlv_op_gen_force_fw_hang,/* .gen_mgmt_tx = not implemented; HTT is used */ .gen_mgmt_tx_send = ath10k_wmi_tlv_op_gen_mgmt_tx_send, + .cleanup_mgmt_tx_send = ath10k_wmi_tlv_op_cleanup_mgmt_tx_send, .gen_dbglog_cfg = ath10k_wmi_tlv_op_gen_dbglog_cfg, .gen_pktlog_enable = ath10k_wmi_tlv_op_gen_pktlog_enable, .gen_pktlog_disable = ath10k_wmi_tlv_op_gen_pktlog_disable,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 106/261 nvme-tcp: use bh_lock in data_ready
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 386e5e6e1aa90b479fcf0467935922df8524393d ]
data_ready may be invoked from send context or from softirq, so need bh locking for that.
--- drivers/nvme/host/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/tcp.c +2 -2
@@ -784,11 +784,11 @@ static void nvme_tcp_data_ready(struct sock *sk) {struct nvme_tcp_queue *queue; -read_lock (&sk->sk_callback_lock); +read_lock_bh (&sk->sk_callback_lock); queue = sk->sk_user_data;if (likely (queue && queue->rd_enabled))queue_work_on (queue->io_cpu, nvme_tcp_wq, &queue->io_work); -read_unlock (&sk->sk_callback_lock); +read_unlock_bh (&sk->sk_callback_lock); }static void nvme_tcp_write_space (struct sock *sk)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 108/261 wcn36xx: Fix error handling path in wcn36xx_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a86308fc534edeceaf64670c691e17485436a4f4 ]
In case of error, 'qcom_wcnss_open_channel()' must be undone by a call to 'rpmsg_destroy_ept()', as already done in the remove function.
--- drivers/net/wireless/ath/wcn36xx/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wcn36xx/main.c +4 -2
@@ -1341,7 +1341,7 @@ static int wcn36xx_probe(struct platform_device *pdev)if (addr && ret !=ETH_ALEN ) {wcn36xx_err ("invalid local-mac-address\n" ); ret = -EINVAL ; - goto out_wq; + goto out_destroy_ept; }else if (addr) {wcn36xx_info ("mac address: %pM\n" , addr);SET_IEEE80211_PERM_ADDR (wcn->hw, addr);
@@ -1349,7 +1349,7 @@ static int wcn36xx_probe(struct platform_device *pdev) ret =wcn36xx_platform_get_resources (wcn, pdev);if (ret) - goto out_wq; + goto out_destroy_ept;wcn36xx_init_ieee80211 (wcn); ret =ieee80211_register_hw (wcn->hw);
@@ -1361,6 +1361,8 @@ static int wcn36xx_probe(struct platform_device *pdev) out_unmap:iounmap (wcn->ccu_base);iounmap (wcn->dxe_base); +out_destroy_ept: +rpmsg_destroy_ept (wcn->smd_channel); out_wq:ieee80211_free_hw (hw); out_err:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 109/261 net: qed*: Reduce RX and TX default ring count when running inside kdump kernel
In reply to Greg Kroah-HartmanFrom: Bhupesh Sharma <[email protected]>
[ Upstream commit 73e030977f7884dbe1be0018bab517e8d02760f8 ]
Normally kdump kernel(s) run under severe memory constraint with the basic idea being to save the crashdump vmcore reliably when the primary kernel panics/hangs.
Currently the qed* ethernet driver ends up consuming a lot of memory in the kdump kernel, leading to kdump kernel panic when one tries to save the vmcore via ssh/nfs (thus utilizing the services of the underlying qed* network interfaces).
An example OOM message log seen in the kdump kernel can be seen here [1], with crashkernel size reservation of 512M.
Using tools like memstrack (see [2]), we can track the modules taking up the bulk of memory in the kdump kernel and organize the memory usage output as per 'highest allocator first'. An example log for the OOM case indicates that the qed* modules end up allocating approximately 216M memory, which is a large part of the total crashkernel size:
dracut-pre-pivot[676]: ======== Report format module_summary: ======== dracut-pre-pivot[676]: Module qed using 149.6MB (2394 pages), peak allocation 149.6MB (2394 pages) dracut-pre-pivot[676]: Module qede using 65.3MB (1045 pages), peak allocation 65.3MB (1045 pages)
This patch reduces the default RX and TX ring count from 1024 to 64 when running inside kdump kernel, which leads to a significant memory saving.
An example log with the patch applied shows the reduced memory
allocation in the kdump kernel:
dracut-pre-pivot[674]: ======== Report format module_summary: ======== dracut-pre-pivot[674]: Module qed using 141.8MB (2268 pages), peak allocation 141.8MB (2268 pages) <..snip..>
[dracut-pre-pivot[674]: Module qede using 4.8MB (76 pages), peak allocation 4.9MB (78 pages)
Tested crashdump vmcore save via ssh/nfs protocol using underlying qed* network interface after applying this patch.
[1] OOM log:
------------
kworker/0:6: page allocation failure: order:6, mode:0x60c0c0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null) kworker/0:6 cpuset=/ mems_allowed=0
CPU: 0 PID: 145 Comm: kworker/0:6 Not tainted 4.18.0-109.el8.aarch64 #1 Hardware name: To be filled by O.E.M. Saber/Saber, BIOS 0ACKL025 01/18/2019 Workqueue: events work_for_cpu_fn Call trace: dump_backtrace+0x0/0x188 show_stack+0x24/0x30 dump_stack+0x90/0xb4 warn_alloc+0xf4/0x178 __alloc_pages_nodemask+0xcac/0xd58 alloc_pages_current+0x8c/0xf8 kmalloc_order_trace+0x38/0x108 qed_iov_alloc+0x40/0x248 [qed] qed_resc_alloc+0x224/0x518 [qed] qed_slowpath_start+0x254/0x928 [qed] __qede_probe+0xf8/0x5e0 [qede] qede_probe+0x68/0xd8 [qede] local_pci_probe+0x44/0xa8 work_for_cpu_fn+0x20/0x30 process_one_work+0x1ac/0x3e8 worker_thread+0x44/0x448 kthread+0x130/0x138 ret_from_fork+0x10/0x18 Cannot start slowpath qede: probe of 0000:05:00.1 failed with error -12
[2]. Memstrack tool: https://github.com/ryncsn/memstrack
--- drivers/net/ethernet/qlogic/qede/qede.h | 2 ++ drivers/net/ethernet/qlogic/qede/qede_main.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qede/qede.h +2 -0
@@ -574,12 +574,14 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,#define RX_RING_SIZE ((u16)BIT(RX_RING_SIZE_POW))#define NUM_RX_BDS_MAX (RX_RING_SIZE - 1)#define NUM_RX_BDS_MIN 128 +#define NUM_RX_BDS_KDUMP_MIN 63#define NUM_RX_BDS_DEF ((u16)BIT(10) - 1)#define TX_RING_SIZE_POW 13#define TX_RING_SIZE ((u16)BIT(TX_RING_SIZE_POW))#define NUM_TX_BDS_MAX (TX_RING_SIZE - 1)#define NUM_TX_BDS_MIN 128 +#define NUM_TX_BDS_KDUMP_MIN 63#define NUM_TX_BDS_DEF NUM_TX_BDS_MAX#define QEDE_MIN_PKT_LEN 64
drivers/net/ethernet/qlogic/qede/qede_main.c +9 -2
@@ -29,6 +29,7 @@* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include <linux/crash_dump.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/version.h>
@@ -707,8 +708,14 @@ static struct qede_dev *qede_alloc_etherdev(struct qed_dev *cdev, edev->dp_module = dp_module; edev->dp_level = dp_level; edev->ops = qed_ops; - edev->q_num_rx_buffers =NUM_RX_BDS_DEF ; - edev->q_num_tx_buffers =NUM_TX_BDS_DEF ; + +if (is_kdump_kernel ()) { + edev->q_num_rx_buffers =NUM_RX_BDS_KDUMP_MIN ; + edev->q_num_tx_buffers =NUM_TX_BDS_KDUMP_MIN ; + }else { + edev->q_num_rx_buffers =NUM_RX_BDS_DEF ; + edev->q_num_tx_buffers =NUM_TX_BDS_DEF ; + }DP_INFO (edev,"Allocated netdev with %d tx queues and %d rx queues\n" , info->num_queues, info->num_queues);
Signature · 9 lines
2.25.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Greg Kroah-Hartman
maintainerPATCH 110/261 drm/mcde: dsi: Fix return value check in mcde_dsi_bind()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 761e9f4f80a21a4b845097027030bef863001636 ]
The of_drm_find_bridge() function returns NULL on error, it doesn't return error pointers so this check doesn't work.
--- drivers/gpu/drm/mcde/mcde_dsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/mcde/mcde_dsi.c +3 -4
@@ -940,10 +940,9 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, panel =NULL ; bridge =of_drm_find_bridge (child); -if (IS_ERR (bridge)) { -dev_err (dev,"failed to find bridge (%ld)\n" , -PTR_ERR (bridge)); -return PTR_ERR (bridge); +if (!bridge) { +dev_err (dev,"failed to find bridge\n" ); +return -EINVAL ; } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 112/261 md: dont flush workqueue unconditionally in md_open
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
[ Upstream commit f6766ff6afff70e2aaf39e1511e16d471de7c3ae ]
We need to check mddev->del_work before flush workqueu since the purpose of flush is to ensure the previous md is disappeared. Otherwise the similar deadlock appeared if LOCKDEP is enabled, it is due to md_open holds the bdev->bd_mutex before flush workqueue.
kernel: [ 154.522645] ======================================================
kernel: [ 154.522647] WARNING: possible circular locking dependency detected
kernel: [ 154.522650] 5.6.0-rc7-lp151.27-default #25 Tainted: G O
kernel: [ 154.522651] ------------------------------------------------------
kernel: [ 154.522653] mdadm/2482 is trying to acquire lock:
kernel: [ 154.522655] ffff888078529128 ((wq_completion)md_misc){+.+.}, at: flush_workqueue+0x84/0x4b0
kernel: [ 154.522673]
kernel: [ 154.522673] but task is already holding lock:
kernel: [ 154.522675] ffff88804efa9338 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x79/0x590
kernel: [ 154.522691]
kernel: [ 154.522691] which lock already depends on the new lock.
kernel: [ 154.522691]
kernel: [ 154.522694]
kernel: [ 154.522694] the existing dependency chain (in reverse order) is:
kernel: [ 154.522696]
kernel: [ 154.522696] -> #4 (&bdev->bd_mutex){+.+.}:
kernel: [ 154.522704] __mutex_lock+0x87/0x950
kernel: [ 154.522706] __blkdev_get+0x79/0x590
kernel: [ 154.522708] blkdev_get+0x65/0x140
kernel: [ 154.522709] blkdev_get_by_dev+0x2f/0x40
kernel: [ 154.522716] lock_rdev+0x3d/0x90 [md_mod]
kernel: [ 154.522719] md_import_device+0xd6/0x1b0 [md_mod]
kernel: [ 154.522723] new_dev_store+0x15e/0x210 [md_mod]
kernel: [ 154.522728] md_attr_store+0x7a/0xc0 [md_mod]
kernel: [ 154.522732] kernfs_fop_write+0x117/0x1b0
kernel: [ 154.522735] vfs_write+0xad/0x1a0
kernel: [ 154.522737] ksys_write+0xa4/0xe0
kernel: [ 154.522745] do_syscall_64+0x64/0x2b0
kernel: [ 154.522748] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522749]
kernel: [ 154.522749] -> #3 (&mddev->reconfig_mutex){+.+.}:
kernel: [ 154.522752] __mutex_lock+0x87/0x950
kernel: [ 154.522756] new_dev_store+0xc9/0x210 [md_mod]
kernel: [ 154.522759] md_attr_store+0x7a/0xc0 [md_mod]
kernel: [ 154.522761] kernfs_fop_write+0x117/0x1b0
kernel: [ 154.522763] vfs_write+0xad/0x1a0
kernel: [ 154.522765] ksys_write+0xa4/0xe0
kernel: [ 154.522767] do_syscall_64+0x64/0x2b0
kernel: [ 154.522769] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522770]
kernel: [ 154.522770] -> #2 (kn->count#253){++++}:
kernel: [ 154.522775] __kernfs_remove+0x253/0x2c0
kernel: [ 154.522778] kernfs_remove+0x1f/0x30
kernel: [ 154.522780] kobject_del+0x28/0x60
kernel: [ 154.522783] mddev_delayed_delete+0x24/0x30 [md_mod]
kernel: [ 154.522786] process_one_work+0x2a7/0x5f0
kernel: [ 154.522788] worker_thread+0x2d/0x3d0
kernel: [ 154.522793] kthread+0x117/0x130
kernel: [ 154.522795] ret_from_fork+0x3a/0x50
kernel: [ 154.522796]
kernel: [ 154.522796] -> #1 ((work_completion)(&mddev->del_work)){+.+.}:
kernel: [ 154.522800] process_one_work+0x27e/0x5f0
kernel: [ 154.522802] worker_thread+0x2d/0x3d0
kernel: [ 154.522804] kthread+0x117/0x130
kernel: [ 154.522806] ret_from_fork+0x3a/0x50
kernel: [ 154.522807]
kernel: [ 154.522807] -> #0 ((wq_completion)md_misc){+.+.}:
kernel: [ 154.522813] __lock_acquire+0x1392/0x1690
kernel: [ 154.522816] lock_acquire+0xb4/0x1a0
kernel: [ 154.522818] flush_workqueue+0xab/0x4b0
kernel: [ 154.522821] md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522823] __blkdev_get+0xea/0x590
kernel: [ 154.522825] blkdev_get+0x65/0x140
kernel: [ 154.522828] do_dentry_open+0x1d1/0x380
kernel: [ 154.522831] path_openat+0x567/0xcc0
kernel: [ 154.522834] do_filp_open+0x9b/0x110
kernel: [ 154.522836] do_sys_openat2+0x201/0x2a0
kernel: [ 154.522838] do_sys_open+0x57/0x80
kernel: [ 154.522840] do_syscall_64+0x64/0x2b0
kernel: [ 154.522842] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522844]
kernel: [ 154.522844] other info that might help us debug this:
kernel: [ 154.522844]
kernel: [ 154.522846] Chain exists of:
kernel: [ 154.522846] (wq_completion)md_misc --> &mddev->reconfig_mutex --> &bdev->bd_mutex
kernel: [ 154.522846]
kernel: [ 154.522850] Possible unsafe locking scenario:
kernel: [ 154.522850]
kernel: [ 154.522852] CPU0 CPU1
kernel: [ 154.522853] ---- ----
kernel: [ 154.522854] lock(&bdev->bd_mutex);
kernel: [ 154.522856] lock(&mddev->reconfig_mutex);
kernel: [ 154.522858] lock(&bdev->bd_mutex);
kernel: [ 154.522860] lock((wq_completion)md_misc);
kernel: [ 154.522861]
kernel: [ 154.522861] *** DEADLOCK ***
kernel: [ 154.522861]
kernel: [ 154.522864] 1 lock held by mdadm/2482:
kernel: [ 154.522865] #0: ffff88804efa9338 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x79/0x590
kernel: [ 154.522868]
kernel: [ 154.522868] stack backtrace:
kernel: [ 154.522873] CPU: 1 PID: 2482 Comm: mdadm Tainted: G O 5.6.0-rc7-lp151.27-default #25
kernel: [ 154.522875] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
kernel: [ 154.522878] Call Trace:
kernel: [ 154.522881] dump_stack+0x8f/0xcb
kernel: [ 154.522884] check_noncircular+0x194/0x1b0
kernel: [ 154.522888] ? __lock_acquire+0x1392/0x1690
kernel: [ 154.522890] __lock_acquire+0x1392/0x1690
kernel: [ 154.522893] lock_acquire+0xb4/0x1a0
kernel: [ 154.522895] ? flush_workqueue+0x84/0x4b0
kernel: [ 154.522898] flush_workqueue+0xab/0x4b0
kernel: [ 154.522900] ? flush_workqueue+0x84/0x4b0
kernel: [ 154.522905] ? md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522908] md_open+0xb6/0xc0 [md_mod]
kernel: [ 154.522910] __blkdev_get+0xea/0x590
kernel: [ 154.522912] ? bd_acquire+0xc0/0xc0
kernel: [ 154.522914] blkdev_get+0x65/0x140
kernel: [ 154.522916] ? bd_acquire+0xc0/0xc0
kernel: [ 154.522918] do_dentry_open+0x1d1/0x380
kernel: [ 154.522921] path_openat+0x567/0xcc0
kernel: [ 154.522923] ? __lock_acquire+0x380/0x1690
kernel: [ 154.522926] do_filp_open+0x9b/0x110
kernel: [ 154.522929] ? __alloc_fd+0xe5/0x1f0
kernel: [ 154.522935] ? kmem_cache_alloc+0x28c/0x630
kernel: [ 154.522939] ? do_sys_openat2+0x201/0x2a0
kernel: [ 154.522941] do_sys_openat2+0x201/0x2a0
kernel: [ 154.522944] do_sys_open+0x57/0x80
kernel: [ 154.522946] do_syscall_64+0x64/0x2b0
kernel: [ 154.522948] entry_SYSCALL_64_after_hwframe+0x49/0xbe
kernel: [ 154.522951] RIP: 0033:0x7f98d279d9ae
And md_alloc also flushed the same workqueue, but the thing is different here. Because all the paths call md_alloc don't hold bdev->bd_mutex, and the flush is necessary to avoid race condition, so leave it as it is.
--- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -7607,7 +7607,8 @@ static int md_open(struct block_device *bdev, fmode_t mode)*/ mddev_put (mddev);/* Wait until bdev->bd_disk is definitely gone */ -flush_workqueue (md_misc_wq); +if (work_pending (&mddev->del_work)) +flush_workqueue (md_misc_wq);/* Then retry the open from the top */ return -ERESTARTSYS ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 113/261 raid5: remove gfp flags from scribble_alloc()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit ba54d4d4d2844c234f1b4692bd8c9e0f833c8a54 ]
Using GFP_NOIO flag to call scribble_alloc() from resize_chunk() does not have the expected behavior. kvmalloc_array() inside scribble_alloc() which receives the GFP_NOIO flag will eventually call kmalloc_node() to allocate physically continuous pages.
Now we have memalloc scope APIs in mddev_suspend()/mddev_resume() to prevent memory reclaim I/Os during raid array suspend context, calling to kvmalloc_array() with GFP_KERNEL flag may avoid deadlock of recursive I/O as expected.
This patch removes the useless gfp flags from parameters list of scribble_alloc(), and call kvmalloc_array() with GFP_KERNEL flag. The incorrect GFP_NOIO flag does not exist anymore.
--- drivers/md/raid5.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/md/raid5.c +9 -6
@@ -2228,14 +2228,19 @@ static int grow_stripes(struct r5conf *conf, int num)* of the P and Q blocks. */ static int scribble_alloc (struct raid5_percpu *percpu, -int num,int cnt,gfp_t flags) +int num,int cnt) {size_t obj_size =sizeof (struct page *) * (num+2 ) +sizeof (addr_conv_t) * (num+2 );void *scribble; - scribble =kvmalloc_array (cnt, obj_size, flags); +/* +* If here is in raid array suspend context, it is in memalloc noio +* context as well, there is no potential recursive memory reclaim +* I/Os with the GFP_KERNEL flag. +*/ + scribble =kvmalloc_array (cnt, obj_size,GFP_KERNEL );if (!scribble)return -ENOMEM ;
@@ -2267,8 +2272,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors) percpu =per_cpu_ptr (conf->percpu, cpu); err =scribble_alloc (percpu, new_disks, - new_sectors /STRIPE_SECTORS , -GFP_NOIO ); + new_sectors /STRIPE_SECTORS );if (err)break ; }
@@ -6765,8 +6769,7 @@ static int alloc_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu conf->previous_raid_disks), max(conf->chunk_sectors, conf->prev_chunk_sectors) - / STRIPE_SECTORS, - GFP_KERNEL)) { + / STRIPE_SECTORS)) {free_scratch_buffer (conf, percpu);return -ENOMEM ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 114/261 iocost: dont let vrate run wild while theres no saturation signal
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
[ Upstream commit 81ca627a933063fa63a6d4c66425de822a2ab7f5 ]
When the QoS targets are met and nothing is being throttled, there's no way to tell how saturated the underlying device is - it could be almost entirely idle, at the cusp of saturation or anywhere inbetween. Given that there's no information, it's best to keep vrate as-is in this state. Before 7cd806a9a953 ("iocost: improve nr_lagging handling"), this was the case - if the device isn't missing QoS targets and nothing is being throttled, busy_level was reset to zero.
While fixing nr_lagging handling, 7cd806a9a953 ("iocost: improve nr_lagging handling") broke this. Now, while the device is hitting QoS targets and nothing is being throttled, vrate keeps getting adjusted according to the existing busy_level.
This led to vrate keeping climing till it hits max when there's an IO issuer with limited request concurrency if the vrate started low. vrate starts getting adjusted upwards until the issuer can issue IOs w/o being throttled. From then on, QoS targets keeps getting met and nothing on the system needs throttling and vrate keeps getting increased due to the existing busy_level.
This patch makes the following changes to the busy_level logic.
* Reset busy_level if nr_shortages is zero to avoid the above scenario.
* Make non-zero nr_lagging block lowering nr_level but still clear positive busy_level if there's clear non-saturation signal - QoS targets are met and nr_shortages is non-zero. nr_lagging's role is preventing adjusting vrate upwards while there are long-running commands and it shouldn't keep busy_level positive while there's clear non-saturation signal.
* Restructure code for clarity and add comments.
--- block/blk-iocost.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
block/blk-iocost.c +24 -4
@@ -1546,19 +1546,39 @@ skip_surplus_transfers:if (rq_wait_pct >RQ_WAIT_BUSY_PCT || missed_ppm[READ ] > ppm_rthr || missed_ppm[WRITE ] > ppm_wthr) { +/* clearly missing QoS targets, slow down vrate */ ioc->busy_level =max (ioc->busy_level,0 ); ioc->busy_level++; }else if (rq_wait_pct <=RQ_WAIT_BUSY_PCT *UNBUSY_THR_PCT /100 && missed_ppm[READ ] <= ppm_rthr *UNBUSY_THR_PCT /100 && missed_ppm[WRITE ] <= ppm_wthr *UNBUSY_THR_PCT /100 ) { -/* take action iff there is contention */ -if (nr_shortages && !nr_lagging) { +/* QoS targets are being met with >25% margin */ +if (nr_shortages) { +/* +* We're throttling while the device has spare +* capacity. If vrate was being slowed down, stop. +*/ ioc->busy_level =min (ioc->busy_level,0 ); -/* redistribute surpluses first */ -if (!nr_surpluses) + +/* +* If there are IOs spanning multiple periods, wait +* them out before pushing the device harder. If +* there are surpluses, let redistribution work it +* out first. +*/ +if (!nr_lagging && !nr_surpluses) ioc->busy_level--; + }else { +/* +* Nobody is being throttled and the users aren't +* issuing enough IOs to saturate the device. We +* simply don't know how close the device is to +* saturation. Coast. +*/ + ioc->busy_level =0 ; } }else { +/* inside the hysterisis margin, we're good */ ioc->busy_level =0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 116/261 net/mlx5e: IPoIB, Drop multicast packets that this interface sent
In reply to Greg Kroah-HartmanFrom: Erez Shitrit <[email protected]>
[ Upstream commit 8b46d424a743ddfef8056d5167f13ee7ebd1dcad ]
After enabled loopback packets for IPoIB, we need to drop these packets that this HCA has replicated and came back to the same interface that sent them.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +12 -3
@@ -1428,6 +1428,7 @@ out:#ifdef CONFIG_MLX5_CORE_IPOIB +#define MLX5_IB_GRH_SGID_OFFSET 8#define MLX5_IB_GRH_DGID_OFFSET 24#define MLX5_GID_SIZE 16
@@ -1441,6 +1442,7 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,struct net_device *netdev;struct mlx5e_priv *priv;char *pseudo_header; +u32 flags_rqpn;u32 qpn;u8 *dgid;u8 g;
@@ -1462,7 +1464,8 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq, tstamp = &priv->tstamp; stats = &priv->channel_stats[rq->ix].rq; - g = (be32_to_cpu (cqe->flags_rqpn) >>28 ) &3 ; + flags_rqpn =be32_to_cpu (cqe->flags_rqpn); + g = (flags_rqpn >>28 ) &3 ; dgid = skb->data +MLX5_IB_GRH_DGID_OFFSET ;if ((!g) || dgid[0 ] !=0xff ) skb->pkt_type =PACKET_HOST ;
@@ -1471,9 +1474,15 @@ static inline void mlx5i_complete_rx_cqe(struct mlx5e_rq *rq,else skb->pkt_type =PACKET_MULTICAST ; -/* TODO: IB/ipoib: Allow mcast packets from other VFs -* 68996a6e760e5c74654723eeb57bf65628ae87f4 +/* Drop packets that this interface sent, ie multicast packets +* that the HCA has replicated. */ +if (g && (qpn == (flags_rqpn &0xffffff )) && + (memcmp (netdev->dev_addr +4 , skb->data +MLX5_IB_GRH_SGID_OFFSET , +MLX5_GID_SIZE ) ==0 )) { + skb->dev =NULL ; +return ; + }skb_pull (skb,MLX5_IB_GRH_BYTES );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 117/261 rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit beb12813bc75d4a23de43b85ad1c7cb28d27631e ]
Seven years ago we tried to fix a leak but actually introduced a double free instead. It was an understandable mistake because the code was a bit confusing and the free was done in the wrong place. The "skb" pointer is freed in both _rtl_usb_tx_urb_setup() and _rtl_usb_transmit(). The free belongs _rtl_usb_transmit() instead of _rtl_usb_tx_urb_setup() and I've cleaned the code up a bit to hopefully make it more clear.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +2 -6
@@ -881,10 +881,8 @@ static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw,WARN_ON (NULL == skb); _urb =usb_alloc_urb (0 ,GFP_ATOMIC ); -if (!_urb) { -kfree_skb (skb); +if (!_urb)return NULL ; - }_rtl_install_trx_info (rtlusb, skb, ep_num);usb_fill_bulk_urb (_urb, rtlusb->udev,usb_sndbulkpipe (rtlusb->udev, ep_num), skb->data, skb->len, _rtl_tx_complete, skb);
@@ -898,7 +896,6 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,struct rtl_usb *rtlusb =rtl_usbdev (rtl_usbpriv (hw));u32 ep_num;struct urb *_urb =NULL ; -struct sk_buff *_skb =NULL ;WARN_ON (NULL == rtlusb->usb_tx_aggregate_hdl);if (unlikely (IS_USB_STOP (rtlusb))) {
@@ -907,8 +904,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb,return ; } ep_num = rtlusb->ep_map.ep_mapping[qnum]; - _skb = skb; - _urb =_rtl_usb_tx_urb_setup (hw, _skb, ep_num); + _urb =_rtl_usb_tx_urb_setup (hw, skb, ep_num);if (unlikely (!_urb)) {pr_err ("Can't allocate urb. Drop skb!\n" );kfree_skb (skb);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 118/261 mwifiex: Fix memory corruption in dump_station
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 3aa42bae9c4d1641aeb36f1a8585cd1d506cf471 ]
The mwifiex_cfg80211_dump_station() uses static variable for iterating over a linked list of all associated stations (when the driver is in UAP role). This has a race condition if .dump_station is called in parallel for multiple interfaces. This corruption can be triggered by registering multiple SSIDs and calling, in parallel for multiple interfaces
iw dev <iface> station dump
[16750.719775] Unable to handle kernel paging request at virtual address dead000000000110 ... [16750.899173] Call trace: [16750.901696] mwifiex_cfg80211_dump_station+0x94/0x100 [mwifiex] [16750.907824] nl80211_dump_station+0xbc/0x278 [cfg80211] [16750.913160] netlink_dump+0xe8/0x320 [16750.916827] netlink_recvmsg+0x1b4/0x338 [16750.920861] ____sys_recvmsg+0x7c/0x2b0 [16750.924801] ___sys_recvmsg+0x70/0x98 [16750.928564] __sys_recvmsg+0x58/0xa0 [16750.932238] __arm64_sys_recvmsg+0x28/0x30 [16750.936453] el0_svc_common.constprop.3+0x90/0x158 [16750.941378] do_el0_svc+0x74/0x90 [16750.944784] el0_sync_handler+0x12c/0x1a8 [16750.948903] el0_sync+0x114/0x140 [16750.952312] Code: f9400003 f907f423 eb02007f 54fffd60 (b9401060) [16750.958583] ---[ end trace c8ad181c2f4b8576 ]---
This patch drops the use of the static iterator, and instead every time the function is called iterates to the idx-th position of the linked-list.
It would be better to convert the code not to use linked list for associated stations storage (since the chip has a limited number of associated stations anyway - it could just be an array). Such a change may be proposed in the future. In the meantime this patch can backported into stable kernels in this simple form.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +6 -8
@@ -1496,7 +1496,8 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo) { struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); -static struct mwifiex_sta_node *node; +struct mwifiex_sta_node *node; +int i;if ((GET_BSS_ROLE (priv) ==MWIFIEX_BSS_ROLE_STA ) && priv->media_connected && idx ==0 ) {
@@ -1506,13 +1507,10 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,mwifiex_send_cmd (priv,HOST_CMD_APCMD_STA_LIST , HostCmd_ACT_GEN_GET,0 ,NULL , true); -if (node && (&node->list == &priv->sta_list)) { - node =NULL ; -return -ENOENT ; - } - - node =list_prepare_entry (node, &priv->sta_list, list); -list_for_each_entry_continue (node, &priv->sta_list, list) { + i =0 ; +list_for_each_entry (node, &priv->sta_list, list) { +if (i++ != idx) +continue ;ether_addr_copy (mac, node->mac_addr);return mwifiex_dump_station_info (priv, node, sinfo); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 93/261 Crypto/chcr: fix for ccm(aes) failed test
In reply to Greg Kroah-HartmanFrom: Devulapally Shiva Krishna <[email protected]>
[ Upstream commit 10b0c75d7bc19606fa9a62c8ab9180e95c0e0385 ]
The ccm(aes) test fails when req->assoclen > ~240bytes.
The problem is the value assigned to auth_offset is wrong. As auth_offset is unsigned char, it can take max value as 255. So fix it by making it unsigned int.
--- drivers/crypto/chelsio/chcr_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/chelsio/chcr_algo.c +1 -1
@@ -2818,7 +2818,7 @@ static void fill_sec_cpl_for_aead(struct cpl_tx_sec_pdu *sec_cpl,unsigned int mac_mode =CHCR_SCMD_AUTH_MODE_CBCMAC ;unsigned int c_id =a_ctx (tfm)->tx_chan_id;unsigned int ccm_xtra; -unsigned char tag_offset =0 , auth_offset =0 ; +unsigned int tag_offset =0 , auth_offset =0 ;unsigned int assoclen;if (get_aead_subtype (tfm) ==CRYPTO_ALG_SUB_TYPE_AEAD_RFC4309 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 94/261 MIPS: Truncate link address into 32bit for 32bit kernel
In reply to Greg Kroah-HartmanFrom: Jiaxun Yang <[email protected]>
[ Upstream commit ff487d41036035376e47972c7c522490b839ab37 ]
LLD failed to link vmlinux with 64bit load address for 32bit ELF while bfd will strip 64bit address into 32bit silently.
To fix LLD build, we should truncate load address provided by platform into 32bit for 32bit kernel.
--- arch/mips/Makefile | 13 ++++++++++++- arch/mips/boot/compressed/Makefile | 2 +- arch/mips/kernel/vmlinux.lds.S | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-)
arch/mips/Makefile +12 -1
@@ -285,12 +285,23 @@ ifdef CONFIG_64BIT endif endif +# When linking a 32-bit executable the LLVM linker cannot cope with a +# 32-bit load address that has been sign-extended to 64 bits. Simply +# remove the upper 32 bits then, as it is safe to do so with other +# linkers. +ifdef CONFIG_64BIT + load-ld = $(load-y) +else + load-ld = $(subst 0xffffffff,0x,$(load-y)) +endif + KBUILD_AFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y) -KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) +KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld) KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ + LINKER_LOAD_ADDRESS=$(load-ld) \ VMLINUX_ENTRY_ADDRESS=$(entry-y) \ PLATFORM="$(platform-y)" \ ITS_INPUTS="$(its-y)"
arch/mips/boot/compressed/Makefile +1 -1
@@ -90,7 +90,7 @@ ifneq ($(zload-y),) VMLINUZ_LOAD_ADDRESS := $(zload-y) else VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ - $(obj)/vmlinux.bin $(VMLINUX_LOAD_ADDRESS)) + $(obj)/vmlinux.bin $(LINKER_LOAD_ADDRESS)) endif UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
arch/mips/kernel/vmlinux.lds.S +1 -1
@@ -50,7 +50,7 @@ SECTIONS /* . = 0xa800000000300000; */ . = 0xffffffff80300000; #endif - . = VMLINUX_LOAD_ADDRESS; + . = LINKER_LOAD_ADDRESS; /* read-only */ _text = .; /* Text and read-only data */ .text : {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 95/261 mips: cm: Fix an invalid error code of INTVN_*_ERR
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 8a0efb8b101665a843205eab3d67ab09cb2d9a8d ]
Commit 3885c2b463f6 ("MIPS: CM: Add support for reporting CM cache errors") adds cm2_causes[] array with map of error type ID and pointers to the short description string. There is a mistake in the table, since according to MIPS32 manual CM2_ERROR_TYPE = {17,18} correspond to INTVN_WR_ERR and INTVN_RD_ERR, while the table claims they have {0x17,0x18} codes. This is obviously hex-dec copy-paste bug. Moreover codes {0x18 - 0x1a} indicate L2 ECC errors.
--- arch/mips/kernel/mips-cm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/kernel/mips-cm.c +3 -3
@@ -119,9 +119,9 @@ static char *cm2_causes[32] = {"COH_RD_ERR" ,"MMIO_WR_ERR" ,"MMIO_RD_ERR" ,"0x07" ,"0x08" ,"0x09" ,"0x0a" ,"0x0b" ,"0x0c" ,"0x0d" ,"0x0e" ,"0x0f" , -"0x10" ,"0x11" ,"0x12" ,"0x13" , -"0x14" ,"0x15" ,"0x16" ,"INTVN_WR_ERR" , -"INTVN_RD_ERR" ,"0x19" ,"0x1a" ,"0x1b" , +"0x10" ,"INTVN_WR_ERR" ,"INTVN_RD_ERR" ,"0x13" , +"0x14" ,"0x15" ,"0x16" ,"0x17" , +"0x18" ,"0x19" ,"0x1a" ,"0x1b" ,"0x1c" ,"0x1d" ,"0x1e" ,"0x1f" };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 96/261 kgdb: Fix spurious true from in_dbg_master()
In reply to Greg Kroah-HartmanFrom: Daniel Thompson <[email protected]>
[ Upstream commit 3fec4aecb311995189217e64d725cfe84a568de3 ]
Currently there is a small window where a badly timed migration could cause in_dbg_master() to spuriously return true. Specifically if we migrate to a new core after reading the processor id and the previous core takes a breakpoint then we will evaluate true if we read kgdb_active before we get the IPI to bring us to halt.
Fix this by checking irqs_disabled() first. Interrupts are always disabled when we are executing the kgdb trap so this is an acceptable prerequisite. This also allows us to replace raw_smp_processor_id() with smp_processor_id() since the short circuit logic will prevent warnings from PREEMPT_DEBUG.
--- include/linux/kgdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kgdb.h +1 -1
@@ -323,7 +323,7 @@ extern void gdbstub_exit(int status);extern int kgdb_single_step;extern atomic_t kgdb_active;#define in_dbg_master () \ - (raw_smp_processor_id() == atomic_read(&kgdb_active)) + (irqs_disabled() && (smp_processor_id() == atomic_read(&kgdb_active)))extern bool dbg_is_early;extern void __init dbg_late_init (void );extern void kgdb_panic (const char *msg);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 97/261 xfs: reset buffer write failure state on successful completion
In reply to Greg Kroah-HartmanFrom: Brian Foster <[email protected]>
[ Upstream commit b6983e80b03bd4fd42de71993b3ac7403edac758 ]
The buffer write failure flag is intended to control the internal write retry that XFS has historically implemented to help mitigate the severity of transient I/O errors. The flag is set when a buffer is resubmitted from the I/O completion path due to a previous failure. It is checked on subsequent I/O completions to skip the internal retry and fall through to the higher level configurable error handling mechanism. The flag is cleared in the synchronous and delwri submission paths and also checked in various places to log write failure messages.
There are a couple minor problems with the current usage of this flag. One is that we issue an internal retry after every submission from xfsaild due to how delwri submission clears the flag. This results in double the expected or configured number of write attempts when under sustained failures. Another more subtle issue is that the flag is never cleared on successful I/O completion. This can cause xfs_wait_buftarg() to suggest that dirty buffers are being thrown away due to the existence of the flag, when the reality is that the flag might still be set because the write succeeded on the retry.
Clear the write failure flag on successful I/O completion to address both of these problems. This means that the internal retry attempt occurs once since the last time a buffer write failed and that various other contexts only see the flag set when the immediately previous write attempt has failed.
--- fs/xfs/xfs_buf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/xfs_buf.c +5 -3
@@ -1162,8 +1162,10 @@ xfs_buf_ioend( bp->b_ops->verify_read (bp); } -if (!bp->b_error) +if (!bp->b_error) { + bp->b_flags &= ~XBF_WRITE_FAIL ; bp->b_flags |=XBF_DONE ; + }if (bp->b_iodone) (*(bp->b_iodone))(bp);
@@ -1223,7 +1225,7 @@ xfs_bwrite( bp->b_flags |=XBF_WRITE ; bp->b_flags &= ~(XBF_ASYNC |XBF_READ | _XBF_DELWRI_Q | -XBF_WRITE_FAIL |XBF_DONE ); +XBF_DONE ); error =xfs_buf_submit (bp);if (error)
@@ -1929,7 +1931,7 @@ xfs_buf_delwri_submit_buffers(* synchronously. Otherwise, drop the buffer from the delwri * queue and submit async. */ - bp->b_flags &= ~(_XBF_DELWRI_Q |XBF_WRITE_FAIL ); + bp->b_flags &= ~_XBF_DELWRI_Q; bp->b_flags |=XBF_WRITE ;if (wait_list) { bp->b_flags &= ~XBF_ASYNC ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 88/261 media: cec: silence shift wrapping warning in __cec_s_log_addrs()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 3b5af3171e2d5a73ae6f04965ed653d039904eb6 ]
The log_addrs->log_addr_type[i] value is a u8 which is controlled by the user and comes from the ioctl. If it's over 31 then that results in undefined behavior (shift wrapping) and that leads to a Smatch static checker warning. We already cap the value later so we can silence the warning just by re-ordering the existing checks.
I think the UBSan checker will also catch this bug at runtime and generate a warning. But otherwise the bug is harmless.
--- drivers/media/cec/cec-adap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/cec/cec-adap.c +4 -4
@@ -1732,6 +1732,10 @@ int __cec_s_log_addrs(struct cec_adapter *adap,unsigned j; log_addrs->log_addr[i] =CEC_LOG_ADDR_INVALID ; +if (log_addrs->log_addr_type[i] >CEC_LOG_ADDR_TYPE_UNREGISTERED ) { +dprintk (1 ,"unknown logical address type\n" ); +return -EINVAL ; + }if (type_mask & (1 << log_addrs->log_addr_type[i])) {dprintk (1 ,"duplicate logical address type\n" );return -EINVAL ;
@@ -1752,10 +1756,6 @@ int __cec_s_log_addrs(struct cec_adapter *adap,dprintk (1 ,"invalid primary device type\n" );return -EINVAL ; } -if (log_addrs->log_addr_type[i] >CEC_LOG_ADDR_TYPE_UNREGISTERED ) { -dprintk (1 ,"unknown logical address type\n" ); -return -EINVAL ; - }for (j =0 ; j < feature_sz; j++) {if ((features[j] &0x80 ) ==0 ) {if (op_is_dev_features)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 121/261 sched: Defend cfs and rt bandwidth quota against overflow
In reply to Greg Kroah-HartmanFrom: Huaixin Chang <[email protected]>
[ Upstream commit d505b8af58912ae1e1a211fabc9995b19bd40828 ]
When users write some huge number into cpu.cfs_quota_us or cpu.rt_runtime_us, overflow might happen during to_ratio() shifts of schedulable checks.
to_ratio() could be altered to avoid unnecessary internal overflow, but min_cfs_quota_period is less than 1 << BW_SHIFT, so a cutoff would still be needed. Set a cap MAX_BW for cfs_quota_us and rt_runtime_us to prevent overflow.
--- kernel/sched/core.c | 8 ++++++++ kernel/sched/rt.c | 12 +++++++++++- kernel/sched/sched.h | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-)
kernel/sched/core.c +8 -0
@@ -7374,6 +7374,8 @@ static DEFINE_MUTEX(cfs_constraints_mutex);const u64 max_cfs_quota_period =1 *NSEC_PER_SEC ;/* 1s */ static const u64 min_cfs_quota_period =1 *NSEC_PER_MSEC ;/* 1ms */ +/* More than 203 days if BW_SHIFT equals 20. */ +static const u64 max_cfs_runtime =MAX_BW *NSEC_PER_USEC ;static int __cfs_schedulable (struct task_group *tg,u64 period,u64 runtime);
@@ -7401,6 +7403,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota)if (period > max_cfs_quota_period)return -EINVAL ; +/* +* Bound quota to defend quota against overflow during bandwidth shift. +*/ +if (quota !=RUNTIME_INF && quota > max_cfs_runtime) +return -EINVAL ; +/* * Prevent race between setting of cfs_rq->runtime_enabled and * unthrottle_offline_cfs_rqs().
kernel/sched/rt.c +11 -1
@@ -9,6 +9,8 @@int sched_rr_timeslice =RR_TIMESLICE ;int sysctl_sched_rr_timeslice = (MSEC_PER_SEC /HZ ) *RR_TIMESLICE ; +/* More than 4 hours if BW_SHIFT equals 20. */ +static const u64 max_rt_runtime =MAX_BW ;static int do_sched_rt_period_timer (struct rt_bandwidth *rt_b,int overrun);
@@ -2513,6 +2515,12 @@ static int tg_set_rt_bandwidth(struct task_group *tg,if (rt_period ==0 )return -EINVAL ; +/* +* Bound quota to defend quota against overflow during bandwidth shift. +*/ +if (rt_runtime !=RUNTIME_INF && rt_runtime > max_rt_runtime) +return -EINVAL ; +mutex_lock (&rt_constraints_mutex);read_lock (&tasklist_lock); err =__rt_schedulable (tg, rt_period, rt_runtime);
@@ -2634,7 +2642,9 @@ static int sched_rt_global_validate(void)return -EINVAL ;if ((sysctl_sched_rt_runtime !=RUNTIME_INF ) && - (sysctl_sched_rt_runtime > sysctl_sched_rt_period)) + ((sysctl_sched_rt_runtime > sysctl_sched_rt_period) || + ((u64 )sysctl_sched_rt_runtime * +NSEC_PER_USEC > max_rt_runtime)))return -EINVAL ;return 0 ;
kernel/sched/sched.h +2 -0
@@ -1889,6 +1889,8 @@ extern void init_dl_rq_bw_ratio(struct dl_rq *dl_rq);#define BW_SHIFT 20#define BW_UNIT (1 << BW_SHIFT)#define RATIO_SHIFT 8 +#define MAX_BW_BITS (64 - BW_SHIFT) +#define MAX_BW ((1ULL << MAX_BW_BITS) - 1)unsigned long to_ratio (u64 period,u64 runtime);extern void init_entity_runnable_average (struct sched_entity *se);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 130/261 x86/mm: Stop printing BRK addresses
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit 67d631b7c05eff955ccff4139327f0f92a5117e5 ]
This currently leaks kernel physical addresses into userspace.
--- arch/x86/mm/init.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/mm/init.c +0 -2
@@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num) }else { pfn = pgt_buf_end; pgt_buf_end += num; -printk (KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n" , - pfn <<PAGE_SHIFT , (pgt_buf_end <<PAGE_SHIFT ) -1 ); }for (i =0 ; i < num; i++) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 134/261 btrfs: qgroup: mark qgroup inconsistent if were inherting snapshot to a new qgroup
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit cbab8ade585a18c4334b085564d9d046e01a3f70 ]
[BUG]
For the following operation, qgroup is guaranteed to be screwed up due to snapshot adding to a new qgroup:
# mkfs.btrfs -f $dev # mount $dev $mnt # btrfs qgroup en $mnt # btrfs subv create $mnt/src # xfs_io -f -c "pwrite 0 1m" $mnt/src/file # sync # btrfs qgroup create 1/0 $mnt/src # btrfs subv snapshot -i 1/0 $mnt/src $mnt/snapshot # btrfs qgroup show -prce $mnt/src qgroupid rfer excl max_rfer max_excl parent child -------- ---- ---- -------- -------- ------ ----- 0/5 16.00KiB 16.00KiB none none --- --- 0/257 1.02MiB 16.00KiB none none --- --- 0/258 1.02MiB 16.00KiB none none 1/0 --- 1/0 0.00B 0.00B none none --- 0/258 ^^^^^^^^^^^^^^^^^^^^
[CAUSE]
The problem is in btrfs_qgroup_inherit(), we don't have good enough check to determine if the new relation would break the existing accounting.
Unlike btrfs_add_qgroup_relation(), which has proper check to determine if we can do quick update without a rescan, in btrfs_qgroup_inherit() we can even assign a snapshot to multiple qgroups.
[FIX]
Fix it by manually marking qgroup inconsistent for snapshot inheritance.
For subvolume creation, since all its extents are exclusively owned, we don't need to rescan.
In theory, we should call relation check like quick_update_accounting() when doing qgroup inheritance and inform user about qgroup accounting inconsistency.
But we don't have good mechanism to relay that back to the user in the snapshot creation context, thus we can only silently mark the qgroup inconsistent.
Anyway, user shouldn't use qgroup inheritance during snapshot creation, and should add qgroup relationship after snapshot creation by 'btrfs qgroup assign', which has a much better UI to inform user about qgroup inconsistent and kick in rescan automatically.
--- fs/btrfs/qgroup.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/qgroup.c +14 -0
@@ -2636,6 +2636,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid,struct btrfs_root *quota_root;struct btrfs_qgroup *srcgroup;struct btrfs_qgroup *dstgroup; +bool need_rescan = false;u32 level_size =0 ;u64 nums;
@@ -2779,6 +2780,13 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, goto unlock; } ++i_qgroups; + +/* +* If we're doing a snapshot, and adding the snapshot to a new +* qgroup, the numbers are guaranteed to be incorrect. +*/ +if (srcid) + need_rescan = true; }for (i =0 ; i < inherit->num_ref_copies; ++i, i_qgroups +=2 ) {
@@ -2798,6 +2806,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dst->rfer = src->rfer - level_size; dst->rfer_cmpr = src->rfer_cmpr - level_size; + +/* Manually tweaking numbers certainly needs a rescan */ + need_rescan = true; }for (i =0 ; i < inherit->num_excl_copies; ++i, i_qgroups +=2 ) {struct btrfs_qgroup *src;
@@ -2816,6 +2827,7 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans, u64 srcid, dst->excl = src->excl + level_size; dst->excl_cmpr = src->excl_cmpr + level_size; + need_rescan = true; } unlock:
@@ -2823,6 +2835,8 @@ unlock: out:if (!committing)mutex_unlock (&fs_info->qgroup_ioctl_lock); +if (need_rescan) + fs_info->qgroup_flags |=BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT ;return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 135/261 net: ethernet: fec: move GPR register offset and bit into DT
In reply to Greg Kroah-HartmanFrom: Fugang Duan <[email protected]>
[ Upstream commit 8a448bf832af537d26aa557d183a16943dce4510 ]
The commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) set the GPR reigster offset and bit in driver for wake on lan feature.
But it introduces two issues here:
- one SOC has two instances, they have different bit
- different SOCs may have different offset and bit
So to support wake-on-lan feature on other i.MX platforms, it should configure the GPR reigster offset and bit from DT.
So the patch is to improve the commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) to support multiple ethernet instances on i.MX series.
v2:
* switch back to store the quirks bitmask in driver_data
v3:
* suggested by Sascha Hauer, use a struct fec_devinfo for abstracting differences between different hardware variants, it can give more freedom to describe the differences.
--- drivers/net/ethernet/freescale/fec_main.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +12 -12
@@ -88,8 +88,6 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);struct fec_devinfo {u32 quirks; -u8 stop_gpr_reg; -u8 stop_gpr_bit; };static const struct fec_devinfo fec_imx25_info = {
@@ -112,8 +110,6 @@ static const struct fec_devinfo fec_imx6q_info = {FEC_QUIRK_HAS_BUFDESC_EX |FEC_QUIRK_HAS_CSUM |FEC_QUIRK_HAS_VLAN |FEC_QUIRK_ERR006358 | FEC_QUIRK_HAS_RACC, - .stop_gpr_reg = 0x34, - .stop_gpr_bit = 27, }; static const struct fec_devinfo fec_mvf600_info = {
@@ -3452,19 +3448,23 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) }static int fec_enet_init_stop_mode (struct fec_enet_private *fep, -struct fec_devinfo *dev_info,struct device_node *np) {struct device_node *gpr_np; +u32 out_val[3 ];int ret =0 ; -if (!dev_info) -return 0 ; - - gpr_np =of_parse_phandle (np,"gpr" ,0 ); + gpr_np =of_parse_phandle (np,"fsl,stop-mode" ,0 );if (!gpr_np)return 0 ; + ret =of_property_read_u32_array (np,"fsl,stop-mode" , out_val, +ARRAY_SIZE (out_val)); +if (ret) { +dev_dbg (&fep->pdev->dev,"no stop mode property\n" ); +return ret; + } + fep->stop_gpr.gpr =syscon_node_to_regmap (gpr_np);if (IS_ERR (fep->stop_gpr.gpr)) {dev_err (&fep->pdev->dev,"could not find gpr regmap\n" );
@@ -3473,8 +3473,8 @@ static int fec_enet_init_stop_mode(struct fec_enet_private *fep, goto out; } - fep->stop_gpr.reg = dev_info->stop_gpr_reg; - fep->stop_gpr.bit = dev_info->stop_gpr_bit; + fep->stop_gpr.reg = out_val[1 ]; + fep->stop_gpr.bit = out_val[2 ]; out:of_node_put (gpr_np);
@@ -3550,7 +3550,7 @@ fec_probe(struct platform_device *pdev)if (of_get_property (np,"fsl,magic-packet" ,NULL )) fep->wol_flag |=FEC_WOL_HAS_MAGIC_PACKET ; - ret =fec_enet_init_stop_mode (fep, dev_info, np); + ret =fec_enet_init_stop_mode (fep, np);if (ret) goto failed_stop_mode;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 122/261 mips: MAAR: Use more precise address mask
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit bbb5946eb545fab8ad8f46bce8a803e1c0c39d47 ]
Indeed according to the MIPS32 Privileged Resource Architecgture the MAAR pair register address field either takes [12:31] bits for non-XPA systems and [12:55] otherwise. In any case the current address mask is just wrong for 64-bit and 32-bits XPA chips. So lets extend it to 59-bits of physical address value. This shall cover the 64-bits architecture and systems with XPA enabled, and won't cause any problem for non-XPA 32-bit systems, since address values exceeding the architecture specific MAAR mask will be just truncated with setting zeros in the unsupported upper bits.
--- arch/mips/include/asm/mipsregs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/mipsregs.h +1 -1
@@ -750,7 +750,7 @@/* MAAR bit definitions */ #define MIPS_MAAR_VH (_U64CAST_(1) << 63) -#define MIPS_MAAR_ADDR ((BIT_ULL(BITS_PER_LONG - 12) - 1) << 12) +#define MIPS_MAAR_ADDR GENMASK_ULL(55, 12)#define MIPS_MAAR_ADDR_SHIFT 12#define MIPS_MAAR_S (_ULCAST_(1) << 1)#define MIPS_MAAR_VL (_ULCAST_(1) << 0)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 136/261 macvlan: Skip loopback packets in RX handler
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
[ Upstream commit 81f3dc9349ce0bf7b8447f147f45e70f0a5b36a6 ]
Ignore loopback-originatig packets soon enough and don't try to process L2 header where it doesn't exist. The very similar br_handle_frame() in bridge code performs exactly the same check.
This is an example of such ICMPv6 packet:
skb len=96 headroom=40 headlen=96 tailroom=56 mac=(40,0) net=(40,40) trans=80shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0)) csum(0xae2e9a2f ip_summed=1 complete_sw=0 valid=0 level=0) hash(0xc97ebd88 sw=1 l4=1) proto=0x86dd pkttype=5 iif=24 dev name=etha01.212 feat=0x0x0000000040005000
skb headroom: 00000000: 00 7c 86 52 84 88 ff ff 00 00 00 00 00 00 08 00 skb headroom: 00000010: 45 00 00 9e 5d 5c 40 00 40 11 33 33 00 00 00 01 skb headroom: 00000020: 02 40 43 80 00 00 86 dd skb linear: 00000000: 60 09 88 bd 00 38 3a ff fe 80 00 00 00 00 00 00 skb linear: 00000010: 00 40 43 ff fe 80 00 00 ff 02 00 00 00 00 00 00 skb linear: 00000020: 00 00 00 00 00 00 00 01 86 00 61 00 40 00 00 2d skb linear: 00000030: 00 00 00 00 00 00 00 00 03 04 40 e0 00 00 01 2c skb linear: 00000040: 00 00 00 78 00 00 00 00 fd 5f 42 68 23 87 a8 81 skb linear: 00000050: 00 00 00 00 00 00 00 00 01 01 02 40 43 80 00 00 skb tailroom: 00000000: ... skb tailroom: 00000010: ... skb tailroom: 00000020: ... skb tailroom: 00000030: ...
Call Trace, how it happens exactly:
...
macvlan_handle_frame+0x321/0x425 [macvlan] ? macvlan_forward_source+0x110/0x110 [macvlan] __netif_receive_skb_core+0x545/0xda0 ? enqueue_task_fair+0xe5/0x8e0 ? __netif_receive_skb_one_core+0x36/0x70 __netif_receive_skb_one_core+0x36/0x70 process_backlog+0x97/0x140 net_rx_action+0x1eb/0x350 ? __hrtimer_run_queues+0x136/0x2e0 __do_softirq+0xe3/0x383 do_softirq_own_stack+0x2a/0x40 </IRQ> do_softirq.part.4+0x4e/0x50 netif_rx_ni+0x60/0xd0 dev_loopback_xmit+0x83/0xf0 ip6_finish_output2+0x575/0x590 [ipv6] ? ip6_cork_release.isra.1+0x64/0x90 [ipv6] ? __ip6_make_skb+0x38d/0x680 [ipv6] ? ip6_output+0x6c/0x140 [ipv6] ip6_output+0x6c/0x140 [ipv6] ip6_send_skb+0x1e/0x60 [ipv6] rawv6_sendmsg+0xc4b/0xe10 [ipv6] ? proc_put_long+0xd0/0xd0 ? rw_copy_check_uvector+0x4e/0x110 ? sock_sendmsg+0x36/0x40 sock_sendmsg+0x36/0x40 ___sys_sendmsg+0x2b6/0x2d0 ? proc_dointvec+0x23/0x30 ? addrconf_sysctl_forward+0x8d/0x250 [ipv6] ? dev_forward_change+0x130/0x130 [ipv6] ? _raw_spin_unlock+0x12/0x30 ? proc_sys_call_handler.isra.14+0x9f/0x110 ? __call_rcu+0x213/0x510 ? get_max_files+0x10/0x10 ? trace_hardirqs_on+0x2c/0xe0 ? __sys_sendmsg+0x63/0xa0 __sys_sendmsg+0x63/0xa0 do_syscall_64+0x6c/0x1e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- drivers/net/macvlan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/macvlan.c +4 -0
@@ -447,6 +447,10 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)int ret;rx_handler_result_t handle_res; +/* Packets from dev_loopback_xmit() do not have L2 header, bail out */ +if (unlikely (skb->pkt_type ==PACKET_LOOPBACK )) +return RX_HANDLER_PASS ; + port =macvlan_port_get_rcu (skb->dev);if (is_multicast_ether_addr (eth->h_dest)) {unsigned int hash;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 143/261 ice: fix potential double free in probe unrolling
In reply to Greg Kroah-HartmanFrom: Jacob Keller <[email protected]>
[ Upstream commit bc3a024101ca497bea4c69be4054c32a5c349f1d ]
If ice_init_interrupt_scheme fails, ice_probe will jump to clearing up the interrupts. This can lead to some static analysis tools such as the compiler sanitizers complaining about double free problems.
Since ice_init_interrupt_scheme already unrolls internally on failure, there is no need to call ice_clear_interrupt_scheme when it fails. Add a new unroll label and use that instead.
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +2 -1
@@ -2900,7 +2900,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)if (err) {dev_err (dev,"ice_init_interrupt_scheme failed: %d\n" , err); err = -EIO ; - goto err_init_interrupt_unroll; + goto err_init_vsi_unroll; }/* Driver is mostly up */
@@ -2986,6 +2986,7 @@ err_msix_misc_unroll:ice_free_irq_msix_misc (pf); err_init_interrupt_unroll:ice_clear_interrupt_scheme (pf); +err_init_vsi_unroll:devm_kfree (dev, pf->vsi); err_init_pf_unroll:ice_deinit_pf (pf);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 147/261 spi: dw: Return any value retrieved from the dma_transfer callback
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit f0410bbf7d0fb80149e3b17d11d31f5b5197873e ]
DW APB SSI DMA-part of the driver may need to perform the requested SPI-transfer synchronously. In that case the dma_transfer() callback will return 0 as a marker of the SPI transfer being finished so the SPI core doesn't need to wait and may proceed with the SPI message trasnfers pumping procedure. This will be needed to fix the problem when DMA transactions are finished, but there is still data left in the SPI Tx/Rx FIFOs being sent/received. But for now make dma_transfer to return 1 as the normal dw_spi_transfer_one() method.
--- drivers/spi/spi-dw-mid.c | 2 +- drivers/spi/spi-dw.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/spi/spi-dw-mid.c +1 -1
@@ -266,7 +266,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, struct spi_transfer *xfer)dma_async_issue_pending (dws->txchan); } -return 0 ; +return 1 ; }static void mid_spi_dma_stop (struct dw_spi *dws)
drivers/spi/spi-dw.c +2 -5
@@ -381,11 +381,8 @@ static int dw_spi_transfer_one(struct spi_controller *master,spi_enable_chip (dws,1 ); -if (dws->dma_mapped) { - ret = dws->dma_ops->dma_transfer (dws, transfer); -if (ret <0 ) -return ret; - } +if (dws->dma_mapped) +return dws->dma_ops->dma_transfer (dws, transfer);if (chip->poll_mode)return poll_transfer (dws);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 149/261 platform/x86: hp-wmi: Convert simple_strtoul() to kstrtou32()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5cdc45ed3948042f0d73c6fec5ee9b59e637d0d2 ]
First of all, unsigned long can overflow u32 value on 64-bit machine. Second, simple_strtoul() doesn't check for overflow in the input.
Convert simple_strtoul() to kstrtou32() to eliminate above issues.
--- drivers/platform/x86/hp-wmi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +8 -2
@@ -461,8 +461,14 @@ static ssize_t postcode_show(struct device *dev, struct device_attribute *attr,static ssize_t als_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { -u32 tmp =simple_strtoul (buf,NULL ,10 ); -int ret =hp_wmi_perform_query (HPWMI_ALS_QUERY ,HPWMI_WRITE , &tmp, +u32 tmp; +int ret; + + ret =kstrtou32 (buf,10 , &tmp); +if (ret) +return ret; + + ret =hp_wmi_perform_query (HPWMI_ALS_QUERY ,HPWMI_WRITE , &tmp,sizeof (tmp),sizeof (tmp));if (ret)return ret <0 ? ret : -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 123/261 mips: Add udelay lpj numbers adjustment
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit ed26aacfb5f71eecb20a51c4467da440cb719d66 ]
Loops-per-jiffies is a special number which represents a number of noop-loop cycles per CPU-scheduler quantum - jiffies. As you understand aside from CPU-specific implementation it depends on the CPU frequency. So when a platform has the CPU frequency fixed, we have no problem and the current udelay interface will work just fine. But as soon as CPU-freq driver is enabled and the cores frequency changes, we'll end up with distorted udelay's. In order to fix this we have to accordinly adjust the per-CPU udelay_val (the same as the global loops_per_jiffy) number. This can be done in the CPU-freq transition event handler. We subscribe to that event in the MIPS arch time-inititalization method.
--- arch/mips/kernel/time.c | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
arch/mips/kernel/time.c +70 -0
@@ -18,12 +18,82 @@#include <linux/smp.h> #include <linux/spinlock.h> #include <linux/export.h> +#include <linux/cpufreq.h> +#include <linux/delay.h> #include <asm/cpu-features.h> #include <asm/cpu-type.h> #include <asm/div64.h> #include <asm/time.h> +#ifdef CONFIG_CPU_FREQ + +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref); +static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref_freq); +static unsigned long glb_lpj_ref; +static unsigned long glb_lpj_ref_freq; + +static int cpufreq_callback (struct notifier_block *nb, +unsigned long val,void *data) +{ +struct cpufreq_freqs *freq = data; +struct cpumask *cpus = freq->policy->cpus; +unsigned long lpj; +int cpu; + +/* +* Skip lpj numbers adjustment if the CPU-freq transition is safe for +* the loops delay. (Is this possible?) +*/ +if (freq->flags &CPUFREQ_CONST_LOOPS ) +return NOTIFY_OK ; + +/* Save the initial values of the lpjes for future scaling. */ +if (!glb_lpj_ref) { + glb_lpj_ref = boot_cpu_data.udelay_val; + glb_lpj_ref_freq = freq->old; + +for_each_online_cpu (cpu) { +per_cpu (pcp_lpj_ref, cpu) = + cpu_data[cpu].udelay_val; +per_cpu (pcp_lpj_ref_freq, cpu) = freq->old; + } + } + +/* +* Adjust global lpj variable and per-CPU udelay_val number in +* accordance with the new CPU frequency. +*/ +if ((val ==CPUFREQ_PRECHANGE && freq->old < freq->new) || + (val ==CPUFREQ_POSTCHANGE && freq->old > freq->new)) { + loops_per_jiffy =cpufreq_scale (glb_lpj_ref, + glb_lpj_ref_freq, + freq->new); + +for_each_cpu (cpu, cpus) { + lpj =cpufreq_scale (per_cpu (pcp_lpj_ref, cpu), +per_cpu (pcp_lpj_ref_freq, cpu), + freq->new); + cpu_data[cpu].udelay_val = (unsigned int )lpj; + } + } + +return NOTIFY_OK ; +} + +static struct notifier_block cpufreq_notifier = { + .notifier_call = cpufreq_callback, +}; + +static int __init register_cpufreq_notifier (void ) +{ +return cpufreq_register_notifier (&cpufreq_notifier, +CPUFREQ_TRANSITION_NOTIFIER ); +} +core_initcall (register_cpufreq_notifier); + +#endif /* CONFIG_CPU_FREQ */ +/* * forward reference */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 150/261 platform/x86: intel-hid: Add a quirk to support HP Spectre X2 (2015)
In reply to Greg Kroah-HartmanFrom: Nickolai Kozachenko <[email protected]>
[ Upstream commit 8fe63eb757ac6e661a384cc760792080bdc738dc ]
HEBC method reports capabilities of 5 button array but HP Spectre X2 (2015) does not have this control method (the same was for Wacom MobileStudio Pro). Expand previous DMI quirk by Alex Hung to also enable 5 button array for this system.
--- drivers/platform/x86/intel-hid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel-hid.c +7 -0
@@ -77,6 +77,13 @@ static const struct dmi_system_id button_array_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Wacom MobileStudio Pro 16"), }, }, + { + .ident = "HP Spectre x2 (2015)", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"), + }, + }, { } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 124/261 crypto: stm32/crc32 - fix ext4 chksum BUG_ON()
In reply to Greg Kroah-HartmanFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit 49c2c082e00e0bc4f5cbb7c21c7f0f873b35ab09 ]
Allow use of crc_update without prior call to crc_init.
And change (and fix) driver to use CRC device even on unaligned buffers.
--- drivers/crypto/stm32/stm32-crc32.c | 98 +++++++++++++++--------------- 1 file changed, 48 insertions(+), 50 deletions(-)
drivers/crypto/stm32/stm32-crc32.c +48 -50
@@ -28,8 +28,10 @@/* Registers values */ #define CRC_CR_RESET BIT(0) -#define CRC_CR_REVERSE (BIT(7) | BIT(6) | BIT(5))#define CRC_INIT_DEFAULT 0xFFFFFFFF +#define CRC_CR_REV_IN_WORD (BIT(6) | BIT(5)) +#define CRC_CR_REV_IN_BYTE BIT(5) +#define CRC_CR_REV_OUT BIT(7)#define CRC_AUTOSUSPEND_DELAY 50
@@ -38,8 +40,6 @@ struct stm32_crc {struct device *dev;void __iomem *regs;struct clk *clk; -u8 pending_data[sizeof (u32)]; -size_t nb_pending_bytes; };struct stm32_crc_list {
@@ -59,7 +59,6 @@ struct stm32_crc_ctx {struct stm32_crc_desc_ctx {u32 partial;/* crc32c: partial in first 4 bytes of that struct */ -struct stm32_crc *crc; };static int stm32_crc32_cra_init (struct crypto_tfm *tfm)
@@ -101,25 +100,22 @@ static int stm32_crc_init(struct shash_desc *desc)struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); -list_for_each_entry (crc, &crc_list.dev_list, list) { - ctx->crc = crc; -break ; - } + crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list);spin_unlock_bh (&crc_list.lock); -pm_runtime_get_sync (ctx->crc->dev); +pm_runtime_get_sync (crc->dev);/* Reset, set key, poly and configure in bit reverse mode */ -writel_relaxed (bitrev32 (mctx->key), ctx->crc->regs +CRC_INIT ); -writel_relaxed (bitrev32 (mctx->poly), ctx->crc->regs +CRC_POL ); -writel_relaxed (CRC_CR_RESET |CRC_CR_REVERSE , ctx->crc->regs +CRC_CR ); +writel_relaxed (bitrev32 (mctx->key), crc->regs +CRC_INIT ); +writel_relaxed (bitrev32 (mctx->poly), crc->regs +CRC_POL ); +writel_relaxed (CRC_CR_RESET |CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR );/* Store partial result */ - ctx->partial =readl_relaxed (ctx->crc->regs +CRC_DR ); - ctx->crc->nb_pending_bytes =0 ; + ctx->partial =readl_relaxed (crc->regs +CRC_DR ); -pm_runtime_mark_last_busy (ctx->crc->dev); -pm_runtime_put_autosuspend (ctx->crc->dev); +pm_runtime_mark_last_busy (crc->dev); +pm_runtime_put_autosuspend (crc->dev);return 0 ; }
@@ -128,31 +124,49 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8, unsigned int length) {struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); -struct stm32_crc *crc = ctx->crc; -u32 *d32; -unsigned int i; +struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm); +struct stm32_crc *crc; + +spin_lock_bh (&crc_list.lock); + crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); +spin_unlock_bh (&crc_list.lock);pm_runtime_get_sync (crc->dev); -if (unlikely (crc->nb_pending_bytes)) { -while (crc->nb_pending_bytes !=sizeof (u32) && length) { -/* Fill in pending data */ - crc->pending_data[crc->nb_pending_bytes++] = *(d8++); +/* +* Restore previously calculated CRC for this context as init value +* Restore polynomial configuration +* Configure in register for word input data, +* Configure out register in reversed bit mode data. +*/ +writel_relaxed (bitrev32 (ctx->partial), crc->regs +CRC_INIT ); +writel_relaxed (bitrev32 (mctx->poly), crc->regs +CRC_POL ); +writel_relaxed (CRC_CR_RESET |CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); + +if (d8 !=PTR_ALIGN (d8,sizeof (u32))) { +/* Configure for byte data */ +writel_relaxed (CRC_CR_REV_IN_BYTE |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); +while (d8 !=PTR_ALIGN (d8,sizeof (u32)) && length) { +writeb_relaxed (*d8++, crc->regs +CRC_DR ); length--; } - -if (crc->nb_pending_bytes ==sizeof (u32)) { -/* Process completed pending data */ -writel_relaxed (*(u32 *)crc->pending_data, - crc->regs +CRC_DR ); - crc->nb_pending_bytes =0 ; - } +/* Configure for word data */ +writel_relaxed (CRC_CR_REV_IN_WORD |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); } - d32 = (u32 *)d8; -for (i =0 ; i < length >>2 ; i++) -/* Process 32 bits data */ -writel_relaxed (*(d32++), crc->regs +CRC_DR ); +for (; length >=sizeof (u32); d8 +=sizeof (u32), length -=sizeof (u32)) +writel_relaxed (*((u32 *)d8), crc->regs +CRC_DR ); + +if (length) { +/* Configure for byte data */ +writel_relaxed (CRC_CR_REV_IN_BYTE |CRC_CR_REV_OUT , + crc->regs +CRC_CR ); +while (length--) +writeb_relaxed (*d8++, crc->regs +CRC_DR ); + }/* Store partial result */ ctx->partial =readl_relaxed (crc->regs +CRC_DR );
@@ -160,22 +174,6 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8,pm_runtime_mark_last_busy (crc->dev);pm_runtime_put_autosuspend (crc->dev); -/* Check for pending data (non 32 bits) */ - length &=3 ; -if (likely (!length)) -return 0 ; - -if ((crc->nb_pending_bytes + length) >=sizeof (u32)) { -/* Shall not happen */ -dev_err (crc->dev,"Pending data overflow\n" ); -return -EINVAL ; - } - - d8 = (const u8 *)d32; -for (i =0 ; i < length; i++) -/* Store pending data */ - crc->pending_data[crc->nb_pending_bytes++] = *(d8++); -return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 126/261 crypto: stm32/crc32 - fix multi-instance
In reply to Greg Kroah-HartmanFrom: Nicolas Toromanoff <[email protected]>
[ Upstream commit 10b89c43a64eb0d236903b79a3bc9d8f6cbfd9c7 ]
Ensure CRC algorithm is registered only once in crypto framework when there are several instances of CRC devices.
Update the CRC device list management to avoid that only the first CRC instance is used.
--- drivers/crypto/stm32/stm32-crc32.c | 48 ++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 12 deletions(-)
drivers/crypto/stm32/stm32-crc32.c +36 -12
@@ -93,16 +93,29 @@ static int stm32_crc_setkey(struct crypto_shash *tfm, const u8 *key,return 0 ; } -static int stm32_crc_init (struct shash_desc *desc) +static struct stm32_crc *stm32_crc_get_next_crc (void ) { -struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); -struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm);struct stm32_crc *crc;spin_lock_bh (&crc_list.lock); crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); +if (crc) +list_move_tail (&crc->list, &crc_list.dev_list);spin_unlock_bh (&crc_list.lock); +return crc; +} + +static int stm32_crc_init (struct shash_desc *desc) +{ +struct stm32_crc_desc_ctx *ctx =shash_desc_ctx (desc); +struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm); +struct stm32_crc *crc; + + crc =stm32_crc_get_next_crc (); +if (!crc) +return -ENODEV ; +pm_runtime_get_sync (crc->dev);/* Reset, set key, poly and configure in bit reverse mode */
@@ -127,9 +140,9 @@ static int stm32_crc_update(struct shash_desc *desc, const u8 *d8,struct stm32_crc_ctx *mctx =crypto_shash_ctx (desc->tfm);struct stm32_crc *crc; -spin_lock_bh (&crc_list.lock); - crc = list_first_entry(&crc_list.dev_list, struct stm32_crc, list); -spin_unlock_bh (&crc_list.lock); + crc =stm32_crc_get_next_crc (); +if (!crc) +return -ENODEV ;pm_runtime_get_sync (crc->dev);
@@ -202,6 +215,8 @@ static int stm32_crc_digest(struct shash_desc *desc, const u8 *data,return stm32_crc_init (desc) ?:stm32_crc_finup (desc, data, length, out); } +static unsigned int refcnt; +static DEFINE_MUTEX (refcnt_lock);static struct shash_alg algs[] = {/* CRC-32 */ {
@@ -292,12 +307,18 @@ static int stm32_crc_probe(struct platform_device *pdev)list_add (&crc->list, &crc_list.dev_list);spin_unlock (&crc_list.lock); - ret =crypto_register_shashes (algs,ARRAY_SIZE (algs)); -if (ret) { -dev_err (dev,"Failed to register\n" ); -clk_disable_unprepare (crc->clk); -return ret; +mutex_lock (&refcnt_lock); +if (!refcnt) { + ret =crypto_register_shashes (algs,ARRAY_SIZE (algs)); +if (ret) { +mutex_unlock (&refcnt_lock); +dev_err (dev,"Failed to register\n" ); +clk_disable_unprepare (crc->clk); +return ret; + } } + refcnt++; +mutex_unlock (&refcnt_lock);dev_info (dev,"Initialized\n" );
@@ -318,7 +339,10 @@ static int stm32_crc_remove(struct platform_device *pdev)list_del (&crc->list);spin_unlock (&crc_list.lock); -crypto_unregister_shashes (algs,ARRAY_SIZE (algs)); +mutex_lock (&refcnt_lock); +if (!--refcnt) +crypto_unregister_shashes (algs,ARRAY_SIZE (algs)); +mutex_unlock (&refcnt_lock);pm_runtime_disable (crc->dev);pm_runtime_put_noidle (crc->dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 120/261 x86/boot: Correct relocation destination on old linkers
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit 5214028dd89e49ba27007c3ee475279e584261f0 ]
For the 32-bit kernel, as described in
6d92bc9d483a ("x86/build: Build compressed x86 kernels as PIE"),
pre-2.26 binutils generates R_386_32 relocations in PIE mode. Since the startup code does not perform relocation, any reloc entry with R_386_32 will remain as 0 in the executing code.
Commit
974f221c84b0 ("x86/boot: Move compressed kernel to the end of the
decompression buffer")
added a new symbol _end but did not mark it hidden, which doesn't give the correct offset on older linkers. This causes the compressed kernel to be copied beyond the end of the decompression buffer, rather than flush against it. This region of memory may be reserved or already allocated for other purposes by the bootloader.
Mark _end as hidden to fix. This changes the relocation from R_386_32 to R_386_RELATIVE even on the pre-2.26 binutils.
For 64-bit, this is not strictly necessary, as the 64-bit kernel is only built as PIE if the linker supports -z noreloc-overflow, which implies binutils-2.27+, but for consistency, mark _end as hidden here too.
The below illustrates the before/after impact of the patch using binutils-2.25 and gcc-4.6.4 (locally compiled from source) and QEMU.
Disassembly before patch:
48: 8b 86 60 02 00 00 mov 0x260(%esi),%eax
4e: 2d 00 00 00 00 sub $0x0,%eax
4f: R_386_32 _end
Disassembly after patch:
48: 8b 86 60 02 00 00 mov 0x260(%esi),%eax
4e: 2d 00 f0 76 00 sub $0x76f000,%eax
4f: R_386_RELATIVE *ABS*Dump from extract_kernel before patch:
early console in extract_kernel input_data: 0x0207c098 <--- this is at output + init_size input_len: 0x0074fef1 output: 0x01000000 output_len: 0x00fa63d0 kernel_total_size: 0x0107c000 needed_size: 0x0107c000
Dump from extract_kernel after patch:
early console in extract_kernel input_data: 0x0190d098 <--- this is at output + init_size - _end input_len: 0x0074fef1 output: 0x01000000 output_len: 0x00fa63d0 kernel_total_size: 0x0107c000 needed_size: 0x0107c000
--- arch/x86/boot/compressed/head_32.S | 5 +++-- arch/x86/boot/compressed/head_64.S | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/boot/compressed/head_32.S +3 -2
@@ -49,16 +49,17 @@ * Position Independent Executable (PIE) so that linker won't optimize * R_386_GOT32X relocation to its fixed symbol address. Older * linkers generate R_386_32 relocations against locally defined symbols, - * _bss, _ebss, _got and _egot, in PIE. It isn't wrong, just less + * _bss, _ebss, _got, _egot and _end, in PIE. It isn't wrong, just less * optimal than R_386_RELATIVE. But the x86 kernel fails to properly handle * R_386_32 relocations when relocating the kernel. To generate - * R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as + * R_386_RELATIVE relocations, we mark _bss, _ebss, _got, _egot and _end as * hidden: */ .hidden _bss .hidden _ebss .hidden _got .hidden _egot + .hidden _end __HEAD ENTRY(startup_32)
arch/x86/boot/compressed/head_64.S +1 -0
@@ -42,6 +42,7 @@ .hidden _ebss .hidden _got .hidden _egot + .hidden _end __HEAD .code32
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 129/261 selftests/bpf: CONFIG_IPV6_SEG6_BPF required for test_seg6_loop.o
In reply to Greg Kroah-HartmanFrom: Alan Maguire <[email protected]>
[ Upstream commit 3c8e8cf4b18b3a7034fab4c4504fc4b54e4b6195 ]
test_seg6_loop.o uses the helper bpf_lwt_seg6_adjust_srh(); it will not be present if CONFIG_IPV6_SEG6_BPF is not specified.
--- tools/testing/selftests/bpf/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/config +1 -0
@@ -25,6 +25,7 @@ CONFIG_XDP_SOCKETS=y CONFIG_FTRACE_SYSCALLS=y CONFIG_IPV6_TUNNEL=y CONFIG_IPV6_GRE=y +CONFIG_IPV6_SEG6_BPF=y CONFIG_NET_FOU=m CONFIG_NET_FOU_IP_TUNNELS=y CONFIG_IPV6_FOU=m
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 154/261 bpf: Fix map permissions check
In reply to Greg Kroah-HartmanFrom: Anton Protopopov <[email protected]>
[ Upstream commit 1ea0f9120c8ce105ca181b070561df5cbd6bc049 ]
The map_lookup_and_delete_elem() function should check for both FMODE_CAN_WRITE and FMODE_CAN_READ permissions because it returns a map element to user space.
--- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/bpf/syscall.c +2 -1
@@ -1118,7 +1118,8 @@ static int map_lookup_and_delete_elem(union bpf_attr *attr) map =__bpf_map_get (f);if (IS_ERR (map))return PTR_ERR (map); -if (!(map_get_sys_perms (map, f) &FMODE_CAN_WRITE )) { +if (!(map_get_sys_perms (map, f) &FMODE_CAN_READ ) || + !(map_get_sys_perms (map, f) &FMODE_CAN_WRITE )) { err = -EPERM ; goto err_put; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 169/261 mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()
In reply to Greg Kroah-HartmanFrom: Andrea Arcangeli <[email protected]>
commit c444eb564fb16645c172d550359cb3d75fe8a040 upstream.
Write protect anon page faults require an accurate mapcount to decide if to break the COW or not. This is implemented in the THP path with reuse_swap_page() -> page_trans_huge_map_swapcount()/page_trans_huge_mapcount().
If the COW triggers while the other processes sharing the page are under a huge pmd split, to do an accurate reading, we must ensure the mapcount isn't computed while it's being transferred from the head page to the tail pages.
reuse_swap_cache() already runs serialized by the page lock, so it's enough to add the page lock around __split_huge_pmd_locked too, in order to add the missing serialization.
Note: the commit in "Fixes" is just to facilitate the backporting, because the code before such commit didn't try to do an accurate THP mapcount calculation and it instead used the page_count() to decide if to COW or not. Both the page_count and the pin_count are THP-wide refcounts, so they're inaccurate if used in reuse_swap_page(). Reverting such commit (besides the unrelated fix to the local anon_vma assignment) would have also opened the window for memory corruption side effects to certain workloads as documented in such commit header.
--- mm/huge_memory.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
mm/huge_memory.c +28 -3
@@ -2301,6 +2301,8 @@ void __split_huge_pmd(struct vm_area_str {spinlock_t *ptl;struct mmu_notifier_range range; +bool was_locked = false; +pmd_t _pmd; mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, address & HPAGE_PMD_MASK,
@@ -2313,11 +2315,32 @@ void __split_huge_pmd(struct vm_area_str* pmd against. Otherwise we can end up replacing wrong page. */ VM_BUG_ON (freeze && !page); -if (page && page !=pmd_page (*pmd)) - goto out; +if (page) { +VM_WARN_ON_ONCE (!PageLocked (page)); + was_locked = true; +if (page !=pmd_page (*pmd)) + goto out; + } +repeat:if (pmd_trans_huge (*pmd)) { - page =pmd_page (*pmd); +if (!page) { + page =pmd_page (*pmd); +if (unlikely (!trylock_page (page))) { +get_page (page); + _pmd = *pmd; +spin_unlock (ptl); +lock_page (page); +spin_lock (ptl); +if (unlikely (!pmd_same (*pmd, _pmd))) { +unlock_page (page); +put_page (page); + page =NULL ; + goto repeat; + } +put_page (page); + } + }if (PageMlocked (page))clear_page_mlock (page); }else if (!(pmd_devmap (*pmd) ||is_pmd_migration_entry (*pmd)))
@@ -2325,6 +2348,8 @@ void __split_huge_pmd(struct vm_area_str__split_huge_pmd_locked (vma, pmd, range.start, freeze); out:spin_unlock (ptl); +if (!was_locked && page) +unlock_page (page);/* * No need to double call mmu_notifier->invalidate_range() callback. * They are 3 cases to consider inside __split_huge_pmd_locked():
Greg Kroah-Hartman
maintainerPATCH 166/261 btrfs: fix space_info bytes_may_use underflow after nocow buffered write
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 467dc47ea99c56e966e99d09dae54869850abeeb upstream.
When doing a buffered write we always try to reserve data space for it, even when the file has the NOCOW bit set or the write falls into a file range covered by a prealloc extent. This is done both because it is expensive to check if we can do a nocow write (checking if an extent is shared through reflinks or if there's a hole in the range for example), and because when writeback starts we might actually need to fallback to COW mode (for example the block group containing the target extents was turned into RO mode due to a scrub or balance).
When we are unable to reserve data space we check if we can do a nocow write, and if we can, we proceed with dirtying the pages and setting up the range for delalloc. In this case the bytes_may_use counter of the data space_info object is not incremented, unlike in the case where we are able to reserve data space (done through btrfs_check_data_free_space() which calls btrfs_alloc_data_chunk_ondemand()).
Later when running delalloc we attempt to start writeback in nocow mode but we might revert back to cow mode, for example because in the meanwhile a block group was turned into RO mode by a scrub or relocation. The cow path after successfully allocating an extent ends up calling btrfs_add_reserved_bytes(), which expects the bytes_may_use counter of the data space_info object to have been incremented before - but we did not do it when the buffered write started, since there was not enough available data space. So btrfs_add_reserved_bytes() ends up decrementing the bytes_may_use counter anyway, and when the counter's current value is smaller then the size of the allocated extent we get a stack trace like the following:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 20138 at fs/btrfs/space-info.h:115 btrfs_add_reserved_bytes+0x3d6/0x4e0 [btrfs] Modules linked in: btrfs blake2b_generic xor raid6_pq libcrc32c (...) CPU: 0 PID: 20138 Comm: kworker/u8:15 Not tainted 5.6.0-rc7-btrfs-next-58 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 Workqueue: writeback wb_workfn (flush-btrfs-1754) RIP: 0010:btrfs_add_reserved_bytes+0x3d6/0x4e0 [btrfs] Code: ff ff 48 (...) RSP: 0018:ffffbda18a4b3568 EFLAGS: 00010287 RAX: 0000000000000000 RBX: ffff9ca076f5d800 RCX: 0000000000000000 RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff9ca068470410 RBP: fffffffffffff000 R08: 0000000000000001 R09: 0000000000000000 R10: ffff9ca079d58040 R11: 0000000000000000 R12: ffff9ca068470400 R13: ffff9ca0408b2000 R14: 0000000000001000 R15: ffff9ca076f5d800 FS: 0000000000000000(0000) GS:ffff9ca07a600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005605dbfe7048 CR3: 0000000138570006 CR4: 00000000003606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: find_free_extent+0x4a0/0x16c0 [btrfs] btrfs_reserve_extent+0x91/0x180 [btrfs] cow_file_range+0x12d/0x490 [btrfs] run_delalloc_nocow+0x341/0xa40 [btrfs] btrfs_run_delalloc_range+0x1ea/0x6d0 [btrfs] ? find_lock_delalloc_range+0x221/0x250 [btrfs] writepage_delalloc+0xe8/0x150 [btrfs] __extent_writepage+0xe8/0x4c0 [btrfs] extent_write_cache_pages+0x237/0x530 [btrfs] ? btrfs_wq_submit_bio+0x9f/0xc0 [btrfs] extent_writepages+0x44/0xa0 [btrfs] do_writepages+0x23/0x80 __writeback_single_inode+0x59/0x700 writeback_sb_inodes+0x267/0x5f0 __writeback_inodes_wb+0x87/0xe0 wb_writeback+0x382/0x590 ? wb_workfn+0x4a2/0x6c0 wb_workfn+0x4a2/0x6c0 process_one_work+0x26d/0x6a0 worker_thread+0x4f/0x3e0 ? process_one_work+0x6a0/0x6a0 kthread+0x103/0x140 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x3a/0x50 irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffff94ebdedf>] copy_process+0x74f/0x2020 softirqs last enabled at (0): [<ffffffff94ebdedf>] copy_process+0x74f/0x2020 softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace f9f6ef8ec4cd8ec9 ]---
So to fix this, when falling back into cow mode check if space was not reserved, by testing for the bit EXTENT_NORESERVE in the respective file range, and if not, increment the bytes_may_use counter for the data space_info object. Also clear the EXTENT_NORESERVE bit from the range, so that if the cow path fails it decrements the bytes_may_use counter when clearing the delalloc range (through the btrfs_clear_delalloc_extent() callback).
--- fs/btrfs/inode.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-)
fs/btrfs/inode.c +56 -5
@@ -49,6 +49,7 @@#include "qgroup.h" #include "delalloc-space.h" #include "block-group.h" +#include "space-info.h" struct btrfs_iget_args {struct btrfs_key *location;
@@ -1322,6 +1323,56 @@ static noinline int csum_exist_in_range(return 1 ; } +static int fallback_to_cow (struct inode *inode,struct page *locked_page, +const u64 start,const u64 end, +int *page_started,unsigned long *nr_written) +{ +struct extent_io_tree *io_tree = &BTRFS_I (inode)->io_tree; +u64 range_start = start; +u64 count; + +/* +* If EXTENT_NORESERVE is set it means that when the buffered write was +* made we had not enough available data space and therefore we did not +* reserve data space for it, since we though we could do NOCOW for the +* respective file range (either there is prealloc extent or the inode +* has the NOCOW bit set). +* +* However when we need to fallback to COW mode (because for example the +* block group for the corresponding extent was turned to RO mode by a +* scrub or relocation) we need to do the following: +* +* 1) We increment the bytes_may_use counter of the data space info. +* If COW succeeds, it allocates a new data extent and after doing +* that it decrements the space info's bytes_may_use counter and +* increments its bytes_reserved counter by the same amount (we do +* this at btrfs_add_reserved_bytes()). So we need to increment the +* bytes_may_use counter to compensate (when space is reserved at +* buffered write time, the bytes_may_use counter is incremented); +* +* 2) We clear the EXTENT_NORESERVE bit from the range. We do this so +* that if the COW path fails for any reason, it decrements (through +* extent_clear_unlock_delalloc()) the bytes_may_use counter of the +* data space info, which we incremented in the step above. +*/ + count =count_range_bits (io_tree, &range_start, end, end +1 - start, +EXTENT_NORESERVE ,0 ); +if (count >0 ) { +struct btrfs_fs_info *fs_info =BTRFS_I (inode)->root->fs_info; +struct btrfs_space_info *sinfo = fs_info->data_sinfo; + +spin_lock (&sinfo->lock); +btrfs_space_info_update_bytes_may_use (fs_info, sinfo, count); +spin_unlock (&sinfo->lock); + +clear_extent_bit (io_tree, start, end,EXTENT_NORESERVE ,0 ,0 , +NULL ); + } + +return cow_file_range (inode, locked_page, start, end, page_started, + nr_written,1 ); +} +/* * when nowcow writeback call back. This checks for snapshots or COW copies * of the extents that exist in the file, and COWs the file as required.
@@ -1569,9 +1620,9 @@ out_check:* NOCOW, following one which needs to be COW'ed */ if (cow_start != (u64)-1 ) { - ret =cow_file_range (inode, locked_page, - cow_start, found_key.offset -1 , - page_started, nr_written,1 ); + ret =fallback_to_cow (inode, locked_page, cow_start, + found_key.offset -1 , + page_started, nr_written);if (ret) {if (nocow) btrfs_dec_nocow_writers(fs_info,
@@ -1660,8 +1711,8 @@ out_check:if (cow_start != (u64)-1 ) { cur_offset = end; - ret =cow_file_range (inode, locked_page, cow_start, end, - page_started, nr_written,1 ); + ret =fallback_to_cow (inode, locked_page, cow_start, end, + page_started, nr_written);if (ret) goto error; }
Greg Kroah-Hartman
maintainerPATCH 170/261 mm: initialize deferred pages with interrupts enabled
In reply to Greg Kroah-HartmanFrom: Pavel Tatashin <[email protected]>
commit 3d060856adfc59afb9d029c233141334cfaba418 upstream.
Initializing struct pages is a long task and keeping interrupts disabled for the duration of this operation introduces a number of problems.
1. jiffies are not updated for long period of time, and thus incorrect time is reported. See proposed solution and discussion here:
lkml/[email protected]
2. It prevents farther improving deferred page initialization by allowing intra-node multi-threading.
We are keeping interrupts disabled to solve a rather theoretical problem that was never observed in real world (See 3a2d7fa8a3d5).
Let's keep interrupts enabled. In case we ever encounter a scenario where an interrupt thread wants to allocate large amount of memory this early in boot we can deal with that by growing zone (see deferred_grow_zone()) by the needed amount before starting deferred_init_memmap() threads.
Before:
[ 1.232459] node 0 initialised, 12058412 pages in 1ms
After:
[ 1.632580] node 0 initialised, 12051227 pages in 436ms
--- include/linux/mmzone.h | 2 ++ mm/page_alloc.c | 20 +++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-)
include/linux/mmzone.h +2 -0
@@ -709,6 +709,8 @@ typedef struct pglist_data {/* * Must be held any time you expect node_start_pfn, * node_present_pages, node_spanned_pages or nr_zones to stay constant. +* Also synchronizes pgdat->first_deferred_pfn during deferred page +* init. * * pgdat_resize_lock() and pgdat_resize_unlock() are provided to * manipulate node_size_lock without checking for CONFIG_MEMORY_HOTPLUG
mm/page_alloc.c +7 -13
@@ -1793,6 +1793,13 @@ static int __init deferred_init_memmap(vBUG_ON (pgdat->first_deferred_pfn >pgdat_end_pfn (pgdat)); pgdat->first_deferred_pfn =ULONG_MAX ; +/* +* Once we unlock here, the zone cannot be grown anymore, thus if an +* interrupt thread must allocate this early in boot, zone must be +* pre-grown prior to start of deferred page initialization. +*/ +pgdat_resize_unlock (pgdat, &flags); +/* Only the highest zone is deferred so find it */ for (zid =0 ; zid <MAX_NR_ZONES ; zid++) { zone = pgdat->node_zones + zid;
@@ -1813,8 +1820,6 @@ static int __init deferred_init_memmap(vwhile (spfn < epfn) nr_pages +=deferred_init_maxorder (&i, zone, &spfn, &epfn); zone_empty: -pgdat_resize_unlock (pgdat, &flags); -/* Sanity check that the next zone really is unpopulated */ WARN_ON (++zid <MAX_NR_ZONES &&populated_zone (++zone));
@@ -1857,17 +1862,6 @@ deferred_grow_zone(struct zone *zone, unpgdat_resize_lock (pgdat, &flags);/* -* If deferred pages have been initialized while we were waiting for -* the lock, return true, as the zone was grown. The caller will retry -* this zone. We won't return to this function since the caller also -* has this static branch. -*/ -if (!static_branch_unlikely (&deferred_pages)) { -pgdat_resize_unlock (pgdat, &flags); -return true; - } - -/* * If someone grew this zone while we were waiting for spinlock, return * true, as there might be enough pages already. */
Greg Kroah-Hartman
maintainerPATCH 172/261 mm/pagealloc.c: call touch_nmi_watchdog() on max order boundaries in deferred init
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
commit 117003c32771df617acf66e140fbdbdeb0ac71f5 upstream.
Patch series "initialize deferred pages with interrupts enabled", v4.
Keep interrupts enabled during deferred page initialization in order to make code more modular and allow jiffies to update.
Original approach, and discussion can be found here:
http://lkml.kernel.org/r/[email protected]
This patch (of 3):
deferred_init_memmap() disables interrupts the entire time, so it calls touch_nmi_watchdog() periodically to avoid soft lockup splats. Soon it will run with interrupts enabled, at which point cond_resched() should be used instead.
deferred_grow_zone() makes the same watchdog calls through code shared with deferred init but will continue to run with interrupts disabled, so it can't call cond_resched().
Pull the watchdog calls up to these two places to allow the first to be changed later, independently of the second. The frequency reduces from twice per pageblock (init and free) to once per max order block.
--- mm/page_alloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/page_alloc.c +4 -3
@@ -1640,7 +1640,6 @@ static void __init deferred_free_pages(u }else if (!(pfn & nr_pgmask)) {deferred_free_range (pfn - nr_free, nr_free); nr_free =1 ; -touch_nmi_watchdog (); }else { nr_free++; }
@@ -1670,7 +1669,6 @@ static unsigned long __init deferred_incontinue ; }else if (!page || !(pfn & nr_pgmask)) { page =pfn_to_page (pfn); -touch_nmi_watchdog (); }else { page++; }
@@ -1817,8 +1815,10 @@ static int __init deferred_init_memmap(v* that we can avoid introducing any issues with the buddy * allocator. */ -while (spfn < epfn) +while (spfn < epfn) { nr_pages +=deferred_init_maxorder (&i, zone, &spfn, &epfn); +touch_nmi_watchdog (); + } zone_empty:/* Sanity check that the next zone really is unpopulated */ WARN_ON (++zid <MAX_NR_ZONES &&populated_zone (++zone));
@@ -1889,6 +1889,7 @@ deferred_grow_zone(struct zone *zone, un first_deferred_pfn = spfn; nr_pages +=deferred_init_maxorder (&i, zone, &spfn, &epfn); +touch_nmi_watchdog ();/* We should only stop along section boundaries */ if ((first_deferred_pfn ^ spfn) <PAGES_PER_SECTION )
Greg Kroah-Hartman
maintainerPATCH 155/261 bpf: Refactor sockmap redirect code so its easy to reuse
In reply to Greg Kroah-HartmanFrom: John Fastabend <[email protected]>
[ Upstream commit ca2f5f21dbbd5e3a00cd3e97f728aa2ca0b2e011 ]
We will need this block of code called from tls context shortly lets refactor the redirect logic so its easy to use. This also cleans up the switch stmt so we have fewer fallthrough cases.
No logic changes are intended.
--- net/core/skmsg.c | 55 ++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 21 deletions(-)
net/core/skmsg.c +34 -21
@@ -686,13 +686,43 @@ static struct sk_psock *sk_psock_from_strp(struct strparser *strp) return container_of(parser, struct sk_psock, parser); } -static void sk_psock_verdict_apply (struct sk_psock *psock, -struct sk_buff *skb,int verdict) +static void sk_psock_skb_redirect (struct sk_psock *psock,struct sk_buff *skb) {struct sk_psock *psock_other;struct sock *sk_other;bool ingress; + sk_other =tcp_skb_bpf_redirect_fetch (skb); +if (unlikely (!sk_other)) { +kfree_skb (skb); +return ; + } + psock_other =sk_psock (sk_other); +if (!psock_other ||sock_flag (sk_other,SOCK_DEAD ) || + !sk_psock_test_state (psock_other,SK_PSOCK_TX_ENABLED )) { +kfree_skb (skb); +return ; + } + + ingress =tcp_skb_bpf_ingress (skb); +if ((!ingress &&sock_writeable (sk_other)) || + (ingress && +atomic_read (&sk_other->sk_rmem_alloc) <= + sk_other->sk_rcvbuf)) { +if (!ingress) +skb_set_owner_w (skb, sk_other); +skb_queue_tail (&psock_other->ingress_skb, skb); +schedule_work (&psock_other->work); + }else { +kfree_skb (skb); + } +} + +static void sk_psock_verdict_apply (struct sk_psock *psock, +struct sk_buff *skb,int verdict) +{ +struct sock *sk_other; +switch (verdict) {case __SK_PASS: sk_other = psock->sk;
@@ -711,25 +741,8 @@ static void sk_psock_verdict_apply(struct sk_psock *psock, } goto out_free;case __SK_REDIRECT: - sk_other =tcp_skb_bpf_redirect_fetch (skb); -if (unlikely (!sk_other)) - goto out_free; - psock_other =sk_psock (sk_other); -if (!psock_other ||sock_flag (sk_other,SOCK_DEAD ) || - !sk_psock_test_state (psock_other,SK_PSOCK_TX_ENABLED )) - goto out_free; - ingress =tcp_skb_bpf_ingress (skb); -if ((!ingress &&sock_writeable (sk_other)) || - (ingress && -atomic_read (&sk_other->sk_rmem_alloc) <= - sk_other->sk_rcvbuf)) { -if (!ingress) -skb_set_owner_w (skb, sk_other); -skb_queue_tail (&psock_other->ingress_skb, skb); -schedule_work (&psock_other->work); -break ; - } -/* fall-through */ +sk_psock_skb_redirect (psock, skb); +break ;case __SK_DROP:/* fall-through */ default :
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 173/261 mm: call cond_resched() from deferred_init_memmap()
In reply to Greg Kroah-HartmanFrom: Pavel Tatashin <[email protected]>
commit da97f2d56bbd880b4138916a7ef96f9881a551b2 upstream.
Now that deferred pages are initialized with interrupts enabled we can replace touch_nmi_watchdog() with cond_resched(), as it was before 3a2d7fa8a3d5.
For now, we cannot do the same in deferred_grow_zone() as it is still initializes pages with interrupts disabled.
This change fixes RCU problem described in
https://lkml.kernel.org/r/[email protected]
[ 60.474005] rcu: INFO: rcu_sched detected stalls on CPUs/tasks: [ 60.475000] rcu: 1-...0: (0 ticks this GP) idle=02a/1/0x4000000000000000 softirq=1/1 fqs=15000 [ 60.475000] rcu: (detected by 0, t=60002 jiffies, g=-1199, q=1) [ 60.475000] Sending NMI from CPU 0 to CPUs 1: [ 1.760091] NMI backtrace for cpu 1 [ 1.760091] CPU: 1 PID: 20 Comm: pgdatinit0 Not tainted 4.18.0-147.9.1.el8_1.x86_64 #1 [ 1.760091] Hardware name: Red Hat KVM, BIOS 1.13.0-1.module+el8.2.0+5520+4e5817f3 04/01/2014 [ 1.760091] RIP: 0010:__init_single_page.isra.65+0x10/0x4f [ 1.760091] Code: 48 83 cf 63 48 89 f8 0f 1f 40 00 48 89 c6 48 89 d7 e8 6b 18 80 ff 66 90 5b c3 31 c0 b9 10 00 00 00 49 89 f8 48 c1 e6 33 f3 ab <b8> 07 00 00 00 48 c1 e2 36 41 c7 40 34 01 00 00 00 48 c1 e0 33 41 [ 1.760091] RSP: 0000:ffffba783123be40 EFLAGS: 00000006 [ 1.760091] RAX: 0000000000000000 RBX: fffffad34405e300 RCX: 0000000000000000 [ 1.760091] RDX: 0000000000000000 RSI: 0010000000000000 RDI: fffffad34405e340 [ 1.760091] RBP: 0000000033f3177e R08: fffffad34405e300 R09: 0000000000000002 [ 1.760091] R10: 000000000000002b R11: ffff98afb691a500 R12: 0000000000000002 [ 1.760091] R13: 0000000000000000 R14: 000000003f03ea00 R15: 000000003e10178c [ 1.760091] FS: 0000000000000000(0000) GS:ffff9c9ebeb00000(0000) knlGS:0000000000000000 [ 1.760091] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.760091] CR2: 00000000ffffffff CR3: 000000a1cf20a001 CR4: 00000000003606e0 [ 1.760091] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1.760091] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1.760091] Call Trace: [ 1.760091] deferred_init_pages+0x8f/0xbf [ 1.760091] deferred_init_memmap+0x184/0x29d [ 1.760091] ? deferred_free_pages.isra.97+0xba/0xba [ 1.760091] kthread+0x112/0x130 [ 1.760091] ? kthread_flush_work_fn+0x10/0x10 [ 1.760091] ret_from_fork+0x35/0x40 [ 89.123011] node 0 initialised, 1055935372 pages in 88650ms
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -1817,7 +1817,7 @@ static int __init deferred_init_memmap(v*/ while (spfn < epfn) { nr_pages +=deferred_init_maxorder (&i, zone, &spfn, &epfn); -touch_nmi_watchdog (); +cond_resched (); } zone_empty:/* Sanity check that the next zone really is unpopulated */
Greg Kroah-Hartman
maintainerPATCH 175/261 ima: Switch to ima_hash_algo for boot aggregate
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 6f1a1d103b48b1533a9c804e7a069e2c8e937ce7 upstream.
boot_aggregate is the first entry of IMA measurement list. Its purpose is to link pre-boot measurements to IMA measurements. As IMA was designed to work with a TPM 1.2, the SHA1 PCR bank was always selected even if a TPM 2.0 with support for stronger hash algorithms is available.
This patch first tries to find a PCR bank with the IMA default hash algorithm. If it does not find it, it selects the SHA256 PCR bank for TPM 2.0 and SHA1 for TPM 1.2. Ultimately, it selects SHA1 also for TPM 2.0 if the SHA256 PCR bank is not found.
If none of the PCR banks above can be found, boot_aggregate file digest is filled with zeros, as for TPM bypass, making it impossible to perform a remote attestation of the system.
--- security/integrity/ima/ima_crypto.c | 47 +++++++++++++++++++++++++++++++----- security/integrity/ima/ima_init.c | 20 ++++++++++++--- 2 files changed, 57 insertions(+), 10 deletions(-)
security/integrity/ima/ima_crypto.c +41 -6
@@ -655,18 +655,29 @@ static void __init ima_pcrread(u32 idx, }/* -* Calculate the boot aggregate hash +* The boot_aggregate is a cumulative hash over TPM registers 0 - 7. With +* TPM 1.2 the boot_aggregate was based on reading the SHA1 PCRs, but with +* TPM 2.0 hash agility, TPM chips could support multiple TPM PCR banks, +* allowing firmware to configure and enable different banks. +* +* Knowing which TPM bank is read to calculate the boot_aggregate digest +* needs to be conveyed to a verifier. For this reason, use the same +* hash algorithm for reading the TPM PCRs as for calculating the boot +* aggregate digest as stored in the measurement list. */ -static int __init ima_calc_boot_aggregate_tfm (char *digest, +static int __init ima_calc_boot_aggregate_tfm (char *digest,u16 alg_id,struct crypto_shash *tfm) { -struct tpm_digest d = { .alg_id =TPM_ALG_SHA1 , .digest = {0 } }; +struct tpm_digest d = { .alg_id = alg_id, .digest = {0 } };int rc;u32 i;SHASH_DESC_ON_STACK (shash, tfm); shash->tfm = tfm; +pr_devel ("calculating the boot-aggregate based on TPM bank: %04x\n" , + d.alg_id); + rc =crypto_shash_init (shash);if (rc !=0 )return rc;
@@ -675,7 +686,8 @@ static int __init ima_calc_boot_aggregatfor (i =TPM_PCR0 ; i <TPM_PCR8 ; i++) {ima_pcrread (i, &d);/* now accumulate with current aggregate */ - rc =crypto_shash_update (shash, d.digest,TPM_DIGEST_SIZE ); + rc =crypto_shash_update (shash, d.digest, +crypto_shash_digestsize (tfm)); }if (!rc)crypto_shash_final (shash, digest);
@@ -685,14 +697,37 @@ static int __init ima_calc_boot_aggregatint __init ima_calc_boot_aggregate (struct ima_digest_data *hash) {struct crypto_shash *tfm; -int rc; +u16 crypto_id, alg_id; +int rc, i, bank_idx =-1 ; + +for (i =0 ; i < ima_tpm_chip->nr_allocated_banks; i++) { + crypto_id = ima_tpm_chip->allocated_banks[i].crypto_id; +if (crypto_id == hash->algo) { + bank_idx = i; +break ; + } + +if (crypto_id ==HASH_ALGO_SHA256 ) + bank_idx = i; + +if (bank_idx ==-1 && crypto_id ==HASH_ALGO_SHA1 ) + bank_idx = i; + } + +if (bank_idx ==-1 ) { +pr_err ("No suitable TPM algorithm for boot aggregate\n" ); +return 0 ; + } + + hash->algo = ima_tpm_chip->allocated_banks[bank_idx].crypto_id; tfm =ima_alloc_tfm (hash->algo);if (IS_ERR (tfm))return PTR_ERR (tfm); hash->length =crypto_shash_digestsize (tfm); - rc =ima_calc_boot_aggregate_tfm (hash->digest, tfm); + alg_id = ima_tpm_chip->allocated_banks[bank_idx].alg_id; + rc =ima_calc_boot_aggregate_tfm (hash->digest, alg_id, tfm);ima_free_tfm (tfm);
security/integrity/ima/ima_init.c +16 -4
@@ -27,7 +27,7 @@ struct tpm_chip *ima_tpm_chip;/* Add the boot aggregate to the IMA measurement list and extend * the PCR register. * -* Calculate the boot aggregate, a SHA1 over tpm registers 0-7, +* Calculate the boot aggregate, a hash over tpm registers 0-7, * assuming a TPM chip exists, and zeroes if the TPM chip does not * exist. Add the boot aggregate measurement to the measurement * list and extend the PCR register.
@@ -51,15 +51,27 @@ static int __init ima_add_boot_aggregateint violation =0 ;struct {struct ima_digest_data hdr; -char digest[TPM_DIGEST_SIZE ]; +char digest[TPM_MAX_DIGEST_SIZE ]; } hash;memset (iint,0 ,sizeof (*iint));memset (&hash,0 ,sizeof (hash)); iint->ima_hash = &hash.hdr; - iint->ima_hash->algo =HASH_ALGO_SHA1 ; - iint->ima_hash->length =SHA1_DIGEST_SIZE ; + iint->ima_hash->algo = ima_hash_algo; + iint->ima_hash->length = hash_digest_size[ima_hash_algo]; +/* +* With TPM 2.0 hash agility, TPM chips could support multiple TPM +* PCR banks, allowing firmware to configure and enable different +* banks. The SHA1 bank is not necessarily enabled. +* +* Use the same hash algorithm for reading the TPM PCRs as for +* calculating the boot aggregate digest. Preference is given to +* the configured IMA default hash algorithm. Otherwise, use the +* TCG required banks - SHA256 for TPM 2.0, SHA1 for TPM 1.2. +* Ultimately select SHA1 also for TPM 2.0 if the SHA256 PCR bank +* is not found. +*/ if (ima_tpm_chip) { result =ima_calc_boot_aggregate (&hash.hdr);if (result <0 ) {
Greg Kroah-Hartman
maintainerPATCH 176/261 ima: Evaluate error in init_ima()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit e144d6b265415ddbdc54b3f17f4f95133effa5a8 upstream.
Evaluate error in init_ima() before register_blocking_lsm_notifier() and return if not zero.
--- security/integrity/ima/ima_main.c | 3 +++ 1 file changed, 3 insertions(+)
security/integrity/ima/ima_main.c +3 -0
@@ -712,6 +712,9 @@ static int __init init_ima(void) error =ima_init (); } +if (error) +return error; + error =register_blocking_lsm_notifier (&ima_lsm_policy_notifier);if (error)pr_warn ("Couldn't register LSM notifier, error %d\n" , error);
Greg Kroah-Hartman
maintainerPATCH 177/261 ima: Directly assign the ima_default_policy pointer to ima_rules
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 067a436b1b0aafa593344fddd711a755a58afb3b upstream.
This patch prevents the following oops:
[ 10.771813] BUG: kernel NULL pointer dereference, address: 0000000000000 [...] [ 10.779790] RIP: 0010:ima_match_policy+0xf7/0xb80 [...] [ 10.798576] Call Trace: [ 10.798993] ? ima_lsm_policy_change+0x2b0/0x2b0 [ 10.799753] ? inode_init_owner+0x1a0/0x1a0 [ 10.800484] ? _raw_spin_lock+0x7a/0xd0 [ 10.801592] ima_must_appraise.part.0+0xb6/0xf0 [ 10.802313] ? ima_fix_xattr.isra.0+0xd0/0xd0 [ 10.803167] ima_must_appraise+0x4f/0x70 [ 10.804004] ima_post_path_mknod+0x2e/0x80 [ 10.804800] do_mknodat+0x396/0x3c0
It occurs when there is a failure during IMA initialization, and ima_init_policy() is not called. IMA hooks still call ima_match_policy() but ima_rules is NULL. This patch prevents the crash by directly assigning the ima_default_policy pointer to ima_rules when ima_rules is defined. This wouldn't alter the existing behavior, as ima_rules is always set at the end of ima_init_policy().
--- security/integrity/ima/ima_policy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/integrity/ima/ima_policy.c +1 -2
@@ -204,7 +204,7 @@ static struct ima_rule_entry *arch_policstatic LIST_HEAD (ima_default_rules);static LIST_HEAD (ima_policy_rules);static LIST_HEAD (ima_temp_rules); -static struct list_head *ima_rules; +static struct list_head *ima_rules = &ima_default_rules;static int ima_policy__initdata ;
@@ -712,7 +712,6 @@ void __init ima_init_policy(void)ARRAY_SIZE (default_appraise_rules), IMA_DEFAULT_POLICY); - ima_rules = &ima_default_rules;ima_update_policy_flag (); }
Greg Kroah-Hartman
maintainerPATCH 180/261 evm: Fix possible memory leak in evm_calc_hmac_or_hash()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
commit 0c4395fb2aa77341269ea619c5419ea48171883f upstream.
Don't immediately return if the signature is portable and security.ima is not present. Just set error so that memory allocated is freed before returning from evm_calc_hmac_or_hash().
--- security/integrity/evm/evm_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_crypto.c +1 -1
@@ -243,7 +243,7 @@ static int evm_calc_hmac_or_hash(struct/* Portable EVM signatures must include an IMA hash */ if (type ==EVM_XATTR_PORTABLE_DIGSIG && !ima_present) -return -EPERM ; + error = -EPERM ; out:kfree (xattr_value);kfree (desc);
Greg Kroah-Hartman
maintainerPATCH 181/261 ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max
In reply to Greg Kroah-HartmanFrom: Harshad Shirwadkar <[email protected]>
commit c36a71b4e35ab35340facdd6964a00956b9fef0a upstream.
If eh->eh_max is 0, EXT_MAX_EXTENT/INDEX would evaluate to unsigned (-1) resulting in illegal memory accesses. Although there is no consistent repro, we see that generic/019 sometimes crashes because of this bug.
Ran gce-xfstests smoke and verified that there were no regressions.
--- fs/ext4/ext4_extents.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ext4/ext4_extents.h +6 -3
@@ -170,10 +170,13 @@ struct partial_cluster { (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)#define EXT_LAST_INDEX (__hdr__) \ (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) -#define EXT_MAX_EXTENT (__hdr__) \ - (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) +#define EXT_MAX_EXTENT (__hdr__) \ + ((le16_to_cpu((__hdr__)->eh_max)) ? \ + ((EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)) \ + : 0)#define EXT_MAX_INDEX (__hdr__) \ - (EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1) + ((le16_to_cpu((__hdr__)->eh_max)) ? \ + ((EXT_FIRST_INDEX((__hdr__)) + le16_to_cpu((__hdr__)->eh_max) - 1)) : 0)static inline struct ext4_extent_header *ext_inode_hdr (struct inode *inode) {
Greg Kroah-Hartman
maintainerPATCH 184/261 PCI: Avoid Pericom USB controller OHCI/EHCI PME# defect
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 68f5fc4ea9ddf9f77720d568144219c4e6452cde ]
Both Pericom OHCI and EHCI devices advertise PME# support from all power states:
06:00.0 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e] (rev 01) (prog-if 10 [OHCI])
Subsystem: Pericom Semiconductor PI7C9X442SL USB OHCI Controller [12d8:400e]
Capabilities: [80] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
06:00.2 USB controller [0c03]: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f] (rev 01) (prog-if 20 [EHCI])
Subsystem: Pericom Semiconductor PI7C9X442SL USB EHCI Controller [12d8:400f]
Capabilities: [80] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
But testing shows that it's unreliable: there is a 20% chance PME# won't be asserted when a USB device is plugged.
Remove PME support for both devices to make USB plugging work reliably.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205981
--- drivers/pci/quirks.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
@@ -5551,6 +5551,19 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev) }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ASMEDIA ,0x2142 , pci_fixup_no_d0_pme); +/* +* Device [12d8:0x400e] and [12d8:0x400f] +* These devices advertise PME# support in all power states but don't +* reliably assert it. +*/ +static void pci_fixup_no_pme (struct pci_dev *dev) +{ +pci_info (dev,"PME# is unreliable, disabling it\n" ); + dev->pme_support =0 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_PERICOM ,0x400e , pci_fixup_no_pme); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_PERICOM ,0x400f , pci_fixup_no_pme); +static void apex_pci_fixup_class (struct pci_dev *pdev) { pdev->class = (PCI_CLASS_SYSTEM_OTHER <<8 ) | pdev->class;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 156/261 bpf: Fix running sk_skb program types with ktls
In reply to Greg Kroah-HartmanFrom: John Fastabend <[email protected]>
[ Upstream commit e91de6afa81c10e9f855c5695eb9a53168d96b73 ]
KTLS uses a stream parser to collect TLS messages and send them to the upper layer tls receive handler. This ensures the tls receiver has a full TLS header to parse when it is run. However, when a socket has BPF_SK_SKB_STREAM_VERDICT program attached before KTLS is enabled we end up with two stream parsers running on the same socket.
The result is both try to run on the same socket. First the KTLS stream parser runs and calls read_sock() which will tcp_read_sock which in turn calls tcp_rcv_skb(). This dequeues the skb from the sk_receive_queue. When this is done KTLS code then data_ready() callback which because we stacked KTLS on top of the bpf stream verdict program has been replaced with sk_psock_start_strp(). This will in turn kick the stream parser again and eventually do the same thing KTLS did above calling into tcp_rcv_skb() and dequeuing a skb from the sk_receive_queue.
At this point the data stream is broke. Part of the stream was handled by the KTLS side some other bytes may have been handled by the BPF side. Generally this results in either missing data or more likely a "Bad Message" complaint from the kTLS receive handler as the BPF program steals some bytes meant to be in a TLS header and/or the TLS header length is no longer correct.
We've already broke the idealized model where we can stack ULPs in any order with generic callbacks on the TX side to handle this. So in this patch we do the same thing but for RX side. We add a sk_psock_strp_enabled() helper so TLS can learn a BPF verdict program is running and add a tls_sw_has_ctx_rx() helper so BPF side can learn there is a TLS ULP on the socket.
Then on BPF side we omit calling our stream parser to avoid breaking the data stream for the KTLS receiver. Then on the KTLS side we call BPF_SK_SKB_STREAM_VERDICT once the KTLS receiver is done with the packet but before it posts the msg to userspace. This gives us symmetry between the TX and RX halfs and IMO makes it usable again. On the TX side we process packets in this order BPF -> TLS -> TCP and on the receive side in the reverse order TCP -> TLS -> BPF.
Discovered while testing OpenSSL 3.0 Alpha2.0 release.
--- include/linux/skmsg.h | 8 ++++++++ include/net/tls.h | 9 +++++++++ net/core/skmsg.c | 43 ++++++++++++++++++++++++++++++++++++++++--- net/tls/tls_sw.c | 20 ++++++++++++++++++-- 4 files changed, 75 insertions(+), 5 deletions(-)
include/linux/skmsg.h +8 -0
@@ -457,4 +457,12 @@ static inline void psock_progs_drop(struct sk_psock_progs *progs) psock_set_prog(&progs->skb_verdict, NULL); } +int sk_psock_tls_strp_read (struct sk_psock *psock,struct sk_buff *skb); + +static inline bool sk_psock_strp_enabled (struct sk_psock *psock) +{ +if (!psock) +return false; +return psock->parser.enabled; +}#endif /* _LINUX_SKMSG_H */
include/net/tls.h +9 -0
@@ -590,6 +590,15 @@ static inline bool tls_sw_has_ctx_tx(const struct sock *sk)return !!tls_sw_ctx_tx (ctx); } +static inline bool tls_sw_has_ctx_rx (const struct sock *sk) +{ +struct tls_context *ctx =tls_get_ctx (sk); + +if (!ctx) +return false; +return !!tls_sw_ctx_rx (ctx); +} +void tls_sw_write_space (struct sock *sk,struct tls_context *ctx);void tls_device_write_space (struct sock *sk,struct tls_context *ctx);
net/core/skmsg.c +40 -3
61 lines not on this page · raw message
net/tls/tls_sw.c +18 -2
@@ -1737,6 +1737,7 @@ int tls_sw_recvmsg(struct sock *sk,long timeo;bool is_kvec =iov_iter_is_kvec (&msg->msg_iter);bool is_peek = flags &MSG_PEEK ; +bool bpf_strp_enabled;int num_async =0 ;int pending;
@@ -1747,6 +1748,7 @@ int tls_sw_recvmsg(struct sock *sk, psock =sk_psock_get (sk);lock_sock (sk); + bpf_strp_enabled =sk_psock_strp_enabled (psock);/* Process pending decrypted records. It must be non-zero-copy */ err = process_rx_list(ctx, msg, &control, &cmsg, 0, len, false,
@@ -1800,11 +1802,12 @@ int tls_sw_recvmsg(struct sock *sk,if (to_decrypt <= len && !is_kvec && !is_peek && ctx->control ==TLS_RECORD_TYPE_DATA && - prot->version !=TLS_1_3_VERSION ) + prot->version !=TLS_1_3_VERSION && + !bpf_strp_enabled) zc = true;/* Do not use async mode if record is non-data */ -if (ctx->control ==TLS_RECORD_TYPE_DATA ) +if (ctx->control ==TLS_RECORD_TYPE_DATA && !bpf_strp_enabled) async_capable = ctx->async_capable;else async_capable = false;
@@ -1854,6 +1857,19 @@ int tls_sw_recvmsg(struct sock *sk, goto pick_next_record;if (!zc) { +if (bpf_strp_enabled) { + err =sk_psock_tls_strp_read (psock, skb); +if (err != __SK_PASS) { + rxm->offset = rxm->offset + rxm->full_len; + rxm->full_len =0 ; +if (err == __SK_DROP) +consume_skb (skb); + ctx->recv_pkt =NULL ; +__strp_unpause (&ctx->strp); +continue ; + } + } +if (rxm->full_len > len) { retain_skb = true; chunk = len;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 159/261 string.h: fix incompatibility between FORTIFY_SOURCE and KASAN
In reply to Greg Kroah-HartmanFrom: Daniel Axtens <[email protected]>
[ Upstream commit 47227d27e2fcb01a9e8f5958d8997cf47a820afc ]
The memcmp KASAN self-test fails on a kernel with both KASAN and FORTIFY_SOURCE.
When FORTIFY_SOURCE is on, a number of functions are replaced with fortified versions, which attempt to check the sizes of the operands. However, these functions often directly invoke __builtin_foo() once they have performed the fortify check. Using __builtins may bypass KASAN checks if the compiler decides to inline it's own implementation as sequence of instructions, rather than emit a function call that goes out to a KASAN-instrumented implementation.
Why is only memcmp affected?
============================
Of the string and string-like functions that kasan_test tests, only memcmp is replaced by an inline sequence of instructions in my testing on x86 with gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2).
I believe this is due to compiler heuristics. For example, if I annotate kmalloc calls with the alloc_size annotation (and disable some fortify compile-time checking!), the compiler will replace every memset except the one in kmalloc_uaf_memset with inline instructions. (I have some WIP patches to add this annotation.)
Does this affect other functions in string.h?
=============================================
Yes. Anything that uses __builtin_* rather than __real_* could be affected. This looks like:
- strncpy
- strcat
- strlen
- strlcpy maybe, under some circumstances?
- strncat under some circumstances
- memset
- memcpy
- memmove
- memcmp (as noted)
- memchr
- strcpy
Whether a function call is emitted always depends on the compiler. Most bugs should get caught by FORTIFY_SOURCE, but the missed memcmp test shows that this is not always the case.
Isn't FORTIFY_SOURCE disabled with KASAN?
========================================-
The string headers on all arches supporting KASAN disable fortify with kasan, but only when address sanitisation is _also_ disabled. For example from x86:
#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__) /*
* For files that are not instrumented (e.g. mm/slub.c) we
* should use not instrumented version of mem* functions. */
#define memcpy(dst, src, len) __memcpy(dst, src, len) #define memmove(dst, src, len) __memmove(dst, src, len) #define memset(s, c, n) __memset(s, c, n)
#ifndef __NO_FORTIFY
#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */ #endif
#endif
This comes from commit 6974f0c4555e ("include/linux/string.h: add the option of fortified string.h functions"), and doesn't work when KASAN is enabled and the file is supposed to be sanitised - as with test_kasan.c
I'm pretty sure this is not wrong, but not as expansive it should be:
* we shouldn't use __builtin_memcpy etc in files where we don't have instrumentation - it could devolve into a function call to memcpy, which will be instrumented. Rather, we should use __memcpy which by convention is not instrumented.
* we also shouldn't be using __builtin_memcpy when we have a KASAN instrumented file, because it could be replaced with inline asm that will not be instrumented.
What is correct behaviour?
==========================
Firstly, there is some overlap between fortification and KASAN: both provide some level of _runtime_ checking. Only fortify provides compile-time checking.
KASAN and fortify can pick up different things at runtime:
- Some fortify functions, notably the string functions, could easily be modified to consider sub-object sizes (e.g. members within a struct), and I have some WIP patches to do this. KASAN cannot detect these because it cannot insert poision between members of a struct.
- KASAN can detect many over-reads/over-writes when the sizes of both operands are unknown, which fortify cannot.
So there are a couple of options:
1) Flip the test: disable fortify in santised files and enable it in unsanitised files. This at least stops us missing KASAN checking, but we lose the fortify checking.
2) Make the fortify code always call out to real versions. Do this only for KASAN, for fear of losing the inlining opportunities we get from __builtin_*.
(We can't use kasan_check_{read,write}: because the fortify functions are _extern inline_, you can't include _static_ inline functions without a compiler warning. kasan_check_{read,write} are static inline so we can't use them even when they would otherwise be suitable.)
Take approach 2 and call out to real versions when KASAN is enabled.
Use __underlying_foo to distinguish from __real_foo: __real_foo always refers to the kernel's implementation of foo, __underlying_foo could be either the kernel implementation or the __builtin_foo implementation.
This is sometimes enough to make the memcmp test succeed with FORTIFY_SOURCE enabled. It is at least enough to get the function call into the module. One more fix is needed to make it reliable: see the next patch.
--- include/linux/string.h | 60 +++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-)
include/linux/string.h +48 -12
@@ -269,6 +269,31 @@ void __read_overflow3(void) __compiletime_error("detected read beyond size of ob void __write_overflow(void) __compiletime_error("detected write beyond size of object passed as 1st parameter");#if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE ) + +#ifdef CONFIG_KASAN +extern void *__underlying_memchr (const void *p,int c,__kernel_size_t size)__RENAME (memchr); +extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp); +extern void *__underlying_memcpy (void *p,const void *q,__kernel_size_t size)__RENAME (memcpy); +extern void *__underlying_memmove (void *p,const void *q,__kernel_size_t size)__RENAME (memmove); +extern void *__underlying_memset (void *p,int c,__kernel_size_t size)__RENAME (memset); +extern char *__underlying_strcat (char *p,const char *q)__RENAME (strcat); +extern char *__underlying_strcpy (char *p,const char *q)__RENAME (strcpy); +extern __kernel_size_t __underlying_strlen(const char *p) __RENAME(strlen); +extern char *__underlying_strncat (char *p,const char *q,__kernel_size_t count)__RENAME (strncat); +extern char *__underlying_strncpy (char *p,const char *q,__kernel_size_t size)__RENAME (strncpy); +#else +#define __underlying_memchr __builtin_memchr +#define __underlying_memcmp __builtin_memcmp +#define __underlying_memcpy __builtin_memcpy +#define __underlying_memmove __builtin_memmove +#define __underlying_memset __builtin_memset +#define __underlying_strcat __builtin_strcat +#define __underlying_strcpy __builtin_strcpy +#define __underlying_strlen __builtin_strlen +#define __underlying_strncat __builtin_strncat +#define __underlying_strncpy __builtin_strncpy +#endif + __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size) {size_t p_size =__builtin_object_size (p,0 );
@@ -276,14 +301,14 @@ __FORTIFY_INLINE char *strncpy(char *p, const char *q, __kernel_size_t size)__write_overflow ();if (p_size < size)fortify_panic (__func__); -return __builtin_strncpy (p, q, size); +return __underlying_strncpy (p, q, size); } __FORTIFY_INLINE char *strcat(char *p, const char *q) {size_t p_size =__builtin_object_size (p,0 );if (p_size == (size_t )-1 ) -return __builtin_strcat (p, q); +return __underlying_strcat (p, q);if (strlcat (p, q, p_size) >= p_size)fortify_panic (__func__);return p;
@@ -297,7 +322,7 @@ __FORTIFY_INLINE __kernel_size_t strlen(const char *p)/* Work around gcc excess stack consumption issue */ if (p_size == (size_t )-1 || (__builtin_constant_p (p[p_size -1 ]) && p[p_size -1 ] =='\0' )) -return __builtin_strlen (p); +return __underlying_strlen (p); ret =strnlen (p, p_size);if (p_size <= ret)fortify_panic (__func__);
@@ -330,7 +355,7 @@ __FORTIFY_INLINE size_t strlcpy(char *p, const char *q, size_t size)__write_overflow ();if (len >= p_size)fortify_panic (__func__); -__builtin_memcpy (p, q, len); +__underlying_memcpy (p, q, len); p[len] ='\0' ; }return ret;
@@ -343,12 +368,12 @@ __FORTIFY_INLINE char *strncat(char *p, const char *q, __kernel_size_t count)size_t p_size =__builtin_object_size (p,0 );size_t q_size =__builtin_object_size (q,0 );if (p_size == (size_t )-1 && q_size == (size_t )-1 ) -return __builtin_strncat (p, q, count); +return __underlying_strncat (p, q, count); p_len =strlen (p); copy_len =strnlen (q, count);if (p_size < p_len + copy_len +1 )fortify_panic (__func__); -__builtin_memcpy (p + p_len, q, copy_len); +__underlying_memcpy (p + p_len, q, copy_len); p[p_len + copy_len] ='\0' ;return p; }
@@ -360,7 +385,7 @@ __FORTIFY_INLINE void *memset(void *p, int c, __kernel_size_t size)__write_overflow ();if (p_size < size)fortify_panic (__func__); -return __builtin_memset (p, c, size); +return __underlying_memset (p, c, size); } __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size)
@@ -375,7 +400,7 @@ __FORTIFY_INLINE void *memcpy(void *p, const void *q, __kernel_size_t size) }if (p_size < size || q_size < size)fortify_panic (__func__); -return __builtin_memcpy (p, q, size); +return __underlying_memcpy (p, q, size); } __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size)
@@ -390,7 +415,7 @@ __FORTIFY_INLINE void *memmove(void *p, const void *q, __kernel_size_t size) }if (p_size < size || q_size < size)fortify_panic (__func__); -return __builtin_memmove (p, q, size); +return __underlying_memmove (p, q, size); }extern void *__real_memscan (void *,int ,__kernel_size_t )__RENAME (memscan);
@@ -416,7 +441,7 @@ __FORTIFY_INLINE int memcmp(const void *p, const void *q, __kernel_size_t size) }if (p_size < size || q_size < size)fortify_panic (__func__); -return __builtin_memcmp (p, q, size); +return __underlying_memcmp (p, q, size); } __FORTIFY_INLINE void *memchr(const void *p, int c, __kernel_size_t size)
@@ -426,7 +451,7 @@ __FORTIFY_INLINE void *memchr(const void *p, int c, __kernel_size_t size)__read_overflow ();if (p_size < size)fortify_panic (__func__); -return __builtin_memchr (p, c, size); +return __underlying_memchr (p, c, size); }void *__real_memchr_inv (const void *s,int c,size_t n)__RENAME (memchr_inv);
@@ -457,11 +482,22 @@ __FORTIFY_INLINE char *strcpy(char *p, const char *q)size_t p_size =__builtin_object_size (p,0 );size_t q_size =__builtin_object_size (q,0 );if (p_size == (size_t )-1 && q_size == (size_t )-1 ) -return __builtin_strcpy (p, q); +return __underlying_strcpy (p, q);memcpy (p, q,strlen (q) +1 ); return p; } +/* Don't use these outside the FORITFY_SOURCE implementation */ +#undef __underlying_memchr +#undef __underlying_memcmp +#undef __underlying_memcpy +#undef __underlying_memmove +#undef __underlying_memset +#undef __underlying_strcat +#undef __underlying_strcpy +#undef __underlying_strlen +#undef __underlying_strncat +#undef __underlying_strncpy#endif /**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 157/261 selftests/bpf, flow_dissector: Close TAP device FD after the test
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit b8215dce7dfd817ca38807f55165bf502146cd68 ]
test_flow_dissector leaves a TAP device after it's finished, potentially interfering with other tests that will run after it. Fix it by closing the TAP descriptor on cleanup.
--- tools/testing/selftests/bpf/prog_tests/flow_dissector.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/prog_tests/flow_dissector.c +1 -0
@@ -523,6 +523,7 @@ void test_flow_dissector(void)CHECK_ATTR (err, tests[i].name,"bpf_map_delete_elem %d\n" , err); } +close (tap_fd);bpf_prog_detach (prog_fd,BPF_FLOW_DISSECTOR );bpf_object__close (obj); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 153/261 libbpf: Fix perf_buffer__free() API for sparse allocs
In reply to Greg Kroah-HartmanFrom: Eelco Chaudron <[email protected]>
[ Upstream commit 601b05ca6edb0422bf6ce313fbfd55ec7bbbc0fd ]
In case the cpu_bufs are sparsely allocated they are not all free'ed. These changes will fix this.
--- tools/lib/bpf/libbpf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +4 -1
@@ -5358,9 +5358,12 @@ void perf_buffer__free(struct perf_buffer *pb)if (!pb)return ;if (pb->cpu_bufs) { -for (i =0 ; i < pb->cpu_cnt && pb->cpu_bufs[i]; i++) { +for (i =0 ; i < pb->cpu_cnt; i++) {struct perf_cpu_buf *cpu_buf = pb->cpu_bufs[i]; +if (!cpu_buf) +continue ; +bpf_map_delete_elem (pb->map_fd, &cpu_buf->map_key);perf_buffer__free_cpu_buf (pb, cpu_buf); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 187/261 PCI: Add ACS quirk for Intel Root Complex Integrated Endpoints
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
[ Upstream commit 3247bd10a4502a3075ce8e1c3c7d31ef76f193ce ]
All Intel platforms guarantee that all root complex implementations must send transactions up to IOMMU for address translations. Hence for Intel RCiEP devices, we can assume some ACS-type isolation even without an ACS capability.
Quoted 1 line
From the Intel VT-d spec, r3.1, sec 3.16 ("Root-Complex Peer to Peer
Considerations"):
When DMA remapping is enabled, peer-to-peer requests through the Root-Complex must be handled as follows:
- The input address in the request is translated (through first-level, second-level or nested translation) to a host physical address (HPA). The address decoding for peer addresses must be done only on the translated HPA. Hardware implementations are free to further limit peer-to-peer accesses to specific host physical address regions (or to completely disallow peer-forwarding of translated requests).
- Since address translation changes the contents (address field) of the PCI Express Transaction Layer Packet (TLP), for PCI Express peer-to-peer requests with ECRC, the Root-Complex hardware must use the new ECRC (re-computed with the translated address) if it decides to forward the TLP as a peer request.
- Root-ports, and multi-function root-complex integrated endpoints, may support additional peer-to-peer control features by supporting PCI Express Access Control Services (ACS) capability. Refer to ACS capability in PCI Express specifications for details.
Since Linux didn't give special treatment to allow this exception, certain RCiEP MFD devices were grouped in a single IOMMU group. This doesn't permit a single device to be assigned to a guest for instance.
In one vendor system: Device 14.x were grouped in a single IOMMU group.
/sys/kernel/iommu_groups/5/devices/0000:00:14.0
/sys/kernel/iommu_groups/5/devices/0000:00:14.2
/sys/kernel/iommu_groups/5/devices/0000:00:14.3
After this patch:
/sys/kernel/iommu_groups/5/devices/0000:00:14.0 /sys/kernel/iommu_groups/5/devices/0000:00:14.2 /sys/kernel/iommu_groups/6/devices/0000:00:14.3 <<< new group
14.0 and 14.2 are integrated devices, but legacy end points, whereas 14.3 was a PCIe-compliant RCiEP.
00:14.3 Network controller: Intel Corporation Device 9df0 (rev 30)
Capabilities: [40] Express (v2) Root Complex Integrated Endpoint, MSI 00
This permits assigning this device to a guest VM.
--- drivers/pci/quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/pci/quirks.c +15 -0
@@ -4683,6 +4683,20 @@ static int pci_quirk_mf_endpoint_acs(struct pci_dev *dev, u16 acs_flags) PCI_ACS_CR | PCI_ACS_UF | PCI_ACS_DT); } +static int pci_quirk_rciep_acs (struct pci_dev *dev,u16 acs_flags) +{ +/* +* Intel RCiEP's are required to allow p2p only on translated +* addresses. Refer to Intel VT-d specification, r3.1, sec 3.16, +* "Root-Complex Peer to Peer Considerations". +*/ +if (pci_pcie_type (dev) !=PCI_EXP_TYPE_RC_END ) +return -ENOTTY ; + +return pci_acs_ctrl_enabled (acs_flags, +PCI_ACS_SV |PCI_ACS_RR |PCI_ACS_CR |PCI_ACS_UF ); +} +static int pci_quirk_brcm_acs (struct pci_dev *dev,u16 acs_flags) {/*
@@ -4765,6 +4779,7 @@ static const struct pci_dev_acs_enabled {/* I219 */ { PCI_VENDOR_ID_INTEL, 0x15b7, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_INTEL, 0x15b8, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_rciep_acs },/* QCOM QDF2xxx root ports */ { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 196/261 e1000e: Disable TSO for buffer overrun workaround
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit f29801030ac67bf98b7a65d3aea67b30769d4f7c upstream.
Commit b10effb92e27 ("e1000e: fix buffer overrun while the I219 is processing DMA transactions") imposes roughly 30% performance penalty.
The commit log states that "Disabling TSO eliminates performance loss for TCP traffic without a noticeable impact on CPU performance", so let's disable TSO by default to regain the loss.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +4 -0
@@ -5289,6 +5289,10 @@ static void e1000_watchdog_task(struct w/* oops */ break ; } +if (hw->mac.type == e1000_pch_spt) { + netdev->features &= ~NETIF_F_TSO ; + netdev->features &= ~NETIF_F_TSO6 ; + } }/* enable transmits in the hardware, need to do this
Greg Kroah-Hartman
maintainerPATCH 198/261 carl9170: remove P2P_GO support
In reply to Greg Kroah-HartmanFrom: Christian Lamparter <[email protected]>
commit b14fba7ebd04082f7767a11daea7f12f3593de22 upstream.
This patch follows up on a bug-report by Frank Schäfer that discovered P2P GO wasn't working with wpa_supplicant. This patch removes part of the broken P2P GO support but keeps the vif switchover code in place.
--- drivers/net/wireless/ath/carl9170/fw.c | 4 +--- drivers/net/wireless/ath/carl9170/main.c | 21 ++++----------------- 2 files changed, 5 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/carl9170/fw.c +1 -3
@@ -338,9 +338,7 @@ static int carl9170_fw(struct ar9170 *ar ar->hw->wiphy->interface_modes |=BIT (NL80211_IFTYPE_ADHOC );if (SUPP (CARL9170FW_WLANTX_CAB )) { - if_comb_types |= -BIT (NL80211_IFTYPE_AP ) | -BIT (NL80211_IFTYPE_P2P_GO ); + if_comb_types |=BIT (NL80211_IFTYPE_AP );#ifdef CONFIG_MAC80211_MESH if_comb_types |=
drivers/net/wireless/ath/carl9170/main.c +4 -17
@@ -582,11 +582,10 @@ static int carl9170_init_interface(struc ar->disable_offload |= ((vif->type !=NL80211_IFTYPE_STATION ) && (vif->type !=NL80211_IFTYPE_AP )); -/* While the driver supports HW offload in a single -* P2P client configuration, it doesn't support HW -* offload in the favourit, concurrent P2P GO+CLIENT -* configuration. Hence, HW offload will always be -* disabled for P2P. +/* The driver used to have P2P GO+CLIENT support, +* but since this was dropped and we don't know if +* there are any gremlins lurking in the shadows, +* so best we keep HW offload disabled for P2P. */ ar->disable_offload |= vif->p2p;
@@ -639,18 +638,6 @@ static int carl9170_op_add_interface(strif (vif->type ==NL80211_IFTYPE_STATION )break ; -/* P2P GO [master] use-case -* Because the P2P GO station is selected dynamically -* by all participating peers of a WIFI Direct network, -* the driver has be able to change the main interface -* operating mode on the fly. -*/ -if (main_vif->p2p && vif->p2p && - vif->type ==NL80211_IFTYPE_AP ) { - old_main = main_vif; -break ; - } - err = -EBUSY ;rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 201/261 serial: 8250: Avoid error message on reprobe
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit e0a851fe6b9b619527bd928aa93caaddd003f70c upstream.
If the call to uart_add_one_port() in serial8250_register_8250_port() fails, a half-initialized entry in the serial_8250ports[] array is left behind.
A subsequent reprobe of the same serial port causes that entry to be reused. Because uart->port.dev is set, uart_remove_one_port() is called for the half-initialized entry and bails out with an error message:
bcm2835-aux-uart 3f215040.serial: Removing wrong port: (null) != (ptrval)
The same happens on failure of mctrl_gpio_init() since commit 4a96895f74c9 ("tty/serial/8250: use mctrl_gpio helpers").
Fix by zeroing the uart->port.dev pointer in the probe error path.
The bug was introduced in v2.6.10 by historical commit befff6f5bf5f ("[SERIAL] Add new port registration/unregistration functions."):
https://git.kernel.org/tglx/history/c/befff6f5bf5f
The commit added an unconditional call to uart_remove_one_port() in serial8250_register_port(). In v3.7, commit 835d844d1a28 ("8250_pnp:
do pnp probe before legacy probe") made that call conditional on uart->port.dev which allows me to fix the issue by zeroing that pointer in the error path. Thus, the present commit will fix the problem as far back as v3.7 whereas still older versions need to also cherry-pick 835d844d1a28.
--- drivers/tty/serial/8250/8250_core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_core.c +10 -4
@@ -1026,7 +1026,7 @@ int serial8250_register_8250_port(struct gpios =mctrl_gpio_init (&uart->port,0 );if (IS_ERR (gpios)) { ret =PTR_ERR (gpios); - goto out_unlock; + goto err; }else { uart->gpios = gpios; }
@@ -1075,8 +1075,10 @@ int serial8250_register_8250_port(structserial8250_apply_quirks (uart); ret =uart_add_one_port (&serial8250_reg, &uart->port); -if (ret ==0 ) - ret = uart->port.line; +if (ret) + goto err; + + ret = uart->port.line; }else { dev_info(uart->port.dev, "skipping CIR port at 0x%lx / 0x%llx, IRQ %d\n",
@@ -1098,10 +1100,14 @@ int serial8250_register_8250_port(struct } } -out_unlock:mutex_unlock (&serial_mutex);return ret; + +err: + uart->port.dev =NULL ; +mutex_unlock (&serial_mutex); +return ret; }EXPORT_SYMBOL (serial8250_register_8250_port);
Greg Kroah-Hartman
maintainerPATCH 200/261 media: cedrus: Program output format during each run
In reply to Greg Kroah-HartmanFrom: Samuel Holland <[email protected]>
commit a8876c22eab9a871834f85de83e98bbf7e6e264d upstream.
Previously, the output format was programmed as part of the ioctl() handler. However, this has two problems:
1) If there are multiple active streams with different output formats, the hardware will use whichever format was set last for both streams. Similarly, an ioctl() done in an inactive context will wrongly affect other active contexts.
2) The registers are written while the device is not actively streaming. To enable runtime PM tied to the streaming state, all hardware access needs to be moved inside cedrus_device_run().
The call to cedrus_dst_format_set() is now placed just before the codec-specific callback that programs the hardware.
--- drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 2 ++ drivers/staging/media/sunxi/cedrus/cedrus_video.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/media/sunxi/cedrus/cedrus_dec.c +2 -0
@@ -65,6 +65,8 @@ void cedrus_device_run(void *priv)v4l2_m2m_buf_copy_metadata (run.src, run.dst, true); +cedrus_dst_format_set (dev, &ctx->dst_fmt); + dev->dec_ops[ctx->current_codec]->setup (ctx, &run);/* Complete request(s) controls if needed. */
drivers/staging/media/sunxi/cedrus/cedrus_video.c +0 -3
@@ -286,7 +286,6 @@ static int cedrus_s_fmt_vid_cap(struct f struct v4l2_format *f) {struct cedrus_ctx *ctx =cedrus_file2ctx (file); -struct cedrus_dev *dev = ctx->dev;struct vb2_queue *vq;int ret;
@@ -300,8 +299,6 @@ static int cedrus_s_fmt_vid_cap(struct f ctx->dst_fmt = f->fmt.pix; -cedrus_dst_format_set (dev, &ctx->dst_fmt); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 203/261 b43legacy: Fix case where channel status is corrupted
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
commit ec4d3e3a054578de34cd0b587ab8a1ac36f629d9 upstream.
This patch fixes commit 75388acd0cd8 ("add mac80211-based driver for legacy BCM43xx devices")
In https://bugzilla.kernel.org/show_bug.cgi?id=207093, a defect in b43legacy is reported. Upon testing, thus problem exists on PPC and X86 platforms, is present in the oldest kernel tested (3.2), and has been present in the driver since it was first added to the kernel.
The problem is a corrupted channel status received from the device. Both the internal card in a PowerBook G4 and the PCMCIA version (Broadcom BCM4306 with PCI ID 14e4:4320) have the problem. Only Rev, 2 (revision 4 of the 802.11 core) of the chip has been tested. No other devices using b43legacy are available for testing.
Various sources of the problem were considered. Buffer overrun and other sources of corruption within the driver were rejected because the faulty channel status is always the same, not a random value. It was concluded that the faulty data is coming from the device, probably due to a firmware bug. As that source is not available, the driver must take appropriate action to recover.
At present, the driver reports the error, and them continues to process the bad packet. This is believed that to be a mistake, and the correct action is to drop the correpted packet.
Reported-and-tested by: F. Erhard <[email protected]>
--- drivers/net/wireless/broadcom/b43legacy/xmit.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/b43legacy/xmit.c +1 -0
@@ -558,6 +558,7 @@ void b43legacy_rx(struct b43legacy_wldevdefault :b43legacywarn (dev->wl,"Unexpected value for chanstat (0x%X)\n" , chanstat); + goto drop; }memcpy (IEEE80211_SKB_RXCB (skb), &status,sizeof (status));
Greg Kroah-Hartman
maintainerPATCH 188/261 PCI: vmd: Add device id for VMD device 8086:9A0B
In reply to Greg Kroah-HartmanFrom: Jon Derrick <[email protected]>
[ Upstream commit ec11e5c213cc20cac5e8310728b06793448b9f6d ]
This patch adds support for this VMD device which supports the bus restriction mode.
--- drivers/pci/controller/vmd.c | 2 ++ include/linux/pci_ids.h | 1 + 2 files changed, 3 insertions(+)
drivers/pci/controller/vmd.c +2 -0
@@ -854,6 +854,8 @@ static const struct pci_device_id vmd_ids[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_28C0), .driver_data =VMD_FEAT_HAS_MEMBAR_SHADOW | VMD_FEAT_HAS_BUS_RESTRICTIONS,}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_9A0B), + .driver_data = VMD_FEAT_HAS_BUS_RESTRICTIONS,}, {0,} };MODULE_DEVICE_TABLE (pci, vmd_ids);
include/linux/pci_ids.h +1 -0
@@ -3008,6 +3008,7 @@#define PCI_DEVICE_ID_INTEL_84460GX 0x84ea#define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 +#define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152#define PCI_VENDOR_ID_SCALEMP 0x8686
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 204/261 b43: Fix connection problem with WPA3
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
commit 75d057bda1fbca6ade21378aa45db712e5f7d962 upstream.
Since the driver was first introduced into the kernel, it has only handled the ciphers associated with WEP, WPA, and WPA2. It fails with WPA3 even though mac80211 can handle those additional ciphers in software, b43 did not report that it could handle them. By setting MFP_CAPABLE using ieee80211_set_hw(), the problem is fixed.
With this change, b43 will handle the ciphers it knows in hardware, and let mac80211 handle the others in software. It is not necessary to use the module parameter NOHWCRYPT to turn hardware encryption off. Although this change essentially eliminates that module parameter, I am choosing to keep it for cases where the hardware is broken, and software encryption is required for all ciphers.
--- drivers/net/wireless/broadcom/b43/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/main.c +1 -1
@@ -5569,7 +5569,7 @@ static struct b43_wl *b43_wireless_init(/* fill hw info */ ieee80211_hw_set (hw,RX_INCLUDES_FCS );ieee80211_hw_set (hw,SIGNAL_DBM ); - +ieee80211_hw_set (hw,MFP_CAPABLE ); hw->wiphy->interface_modes =BIT (NL80211_IFTYPE_AP ) | BIT(NL80211_IFTYPE_MESH_POINT) |
Greg Kroah-Hartman
maintainerPATCH 205/261 b43_legacy: Fix connection problem with WPA3
In reply to Greg Kroah-HartmanFrom: Larry Finger <[email protected]>
commit 6a29d134c04a8acebb7a95251acea7ad7abba106 upstream.
Since the driver was first introduced into the kernel, it has only handled the ciphers associated with WEP, WPA, and WPA2. It fails with WPA3 even though mac80211 can handle those additional ciphers in software, b43legacy did not report that it could handle them. By setting MFP_CAPABLE using ieee80211_set_hw(), the problem is fixed.
With this change, b43legacy will handle the ciphers it knows in hardware, and let mac80211 handle the others in software. It is not necessary to use the module parameter NOHWCRYPT to turn hardware encryption off. Although this change essentially eliminates that module parameter, I am choosing to keep it for cases where the hardware is broken, and software encryption is required for all ciphers.
--- drivers/net/wireless/broadcom/b43legacy/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/b43legacy/main.c +1 -0
@@ -3801,6 +3801,7 @@ static int b43legacy_wireless_init(struc/* fill hw info */ ieee80211_hw_set (hw,RX_INCLUDES_FCS );ieee80211_hw_set (hw,SIGNAL_DBM ); +ieee80211_hw_set (hw,MFP_CAPABLE );/* Allow WPA3 in software */ hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_AP) |
Greg Kroah-Hartman
maintainerPATCH 209/261 hwmon: (k10temp) Add AMD family 17h model 60h PCI match
In reply to Greg Kroah-HartmanFrom: Alexander Monakov <[email protected]>
commit 279f0b3a4b80660fba6faadc2ca2fa426bf3f7e9 upstream.
Add support for retrieving Tdie and Tctl on AMD Renoir (4000-series Ryzen CPUs).
It appears SMU offsets for reading current/voltage and CCD temperature have changed for this generation (reads from currently used offsets yield zeros), so those features cannot be enabled so trivially.
--- drivers/hwmon/k10temp.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/k10temp.c +1 -0
@@ -349,6 +349,7 @@ static const struct pci_device_id k10tem { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) }, { PCI_VDEVICE(HYGON, PCI_DEVICE_ID_AMD_17H_DF_F3) }, {}
Greg Kroah-Hartman
maintainerPATCH 208/261 igb: Report speed and duplex as unknown when device is runtime suspended
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit 165ae7a8feb53dc47fb041357e4b253bfc927cf9 upstream.
igb device gets runtime suspended when there's no link partner. We can't get correct speed under that state:
$ cat /sys/class/net/enp3s0/speed 1000
In addition to that, an error can also be spotted in dmesg:
[ 385.991957] igb 0000:03:00.0 enp3s0: PCIe link lost
Since device can only be runtime suspended when there's no link partner, we can skip reading register and let the following logic set speed and duplex with correct status.
The more generic approach will be wrap get_link_ksettings() with begin() and complete() callbacks. However, for this particular issue, begin() calls igb_runtime_resume() , which tries to rtnl_lock() while the lock is already hold by upper ethtool layer.
So let's take this approach until the igb_runtime_resume() no longer needs to hold rtnl_lock.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +2 -1
@@ -143,7 +143,8 @@ static int igb_get_link_ksettings(structu32 speed;u32 supported, advertising; - status =rd32 (E1000_STATUS ); + status =pm_runtime_suspended (&adapter->pdev->dev) ? +0 :rd32 (E1000_STATUS );if (hw->phy.media_type == e1000_media_type_copper) { supported = (SUPPORTED_10baseT_Half |
Greg Kroah-Hartman
maintainerPATCH 213/261 power: supply: core: fix memory leak in HWMON error path
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
commit 1d7a7128a2e9e1f137c99b0a44e94d70a77343e3 upstream.
In function power_supply_add_hwmon_sysfs(), psyhw->props is allocated by bitmap_zalloc(). But this pointer is not deallocated when devm_add_action fail, which lead to a memory leak bug. To fix this, we replace devm_add_action with devm_add_action_or_reset.
--- drivers/power/supply/power_supply_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/power_supply_hwmon.c +1 -1
@@ -304,7 +304,7 @@ int power_supply_add_hwmon_sysfs(struct goto error; } - ret =devm_add_action (dev, power_supply_hwmon_bitmap_free, + ret =devm_add_action_or_reset (dev, power_supply_hwmon_bitmap_free, psyhw->props);if (ret) goto error;
Greg Kroah-Hartman
maintainerPATCH 210/261 EDAC/amd64: Add AMD family 17h model 60h PCI IDs
In reply to Greg Kroah-HartmanFrom: Alexander Monakov <[email protected]>
commit b6bea24d41519e8c31e4798f1c1a3f67e540c5d0 upstream.
Add support for AMD Renoir (4000-series Ryzen CPUs).
--- drivers/edac/amd64_edac.c | 13 +++++++++++++ drivers/edac/amd64_edac.h | 3 +++ 2 files changed, 16 insertions(+)
drivers/edac/amd64_edac.c +13 -0
@@ -2317,6 +2317,15 @@ static struct amd64_family_type family_t .dbam_to_cs = f17_addr_mask_to_cs_size, } }, + [F17_M60H_CPUS] = { + .ctl_name = "F17h_M60h", + .f0_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F0, + .f6_id = PCI_DEVICE_ID_AMD_17H_M60H_DF_F6, + .ops = { + .early_channel_count = f17_early_channel_count, + .dbam_to_cs = f17_addr_mask_to_cs_size, + } + }, [F17_M70H_CPUS] = { .ctl_name = "F17h_M70h", .f0_id = PCI_DEVICE_ID_AMD_17H_M70H_DF_F0,
@@ -3366,6 +3375,10 @@ static struct amd64_family_type *per_fam fam_type = &family_types[F17_M30H_CPUS ]; pvt->ops = &family_types[F17_M30H_CPUS ].ops;break ; + }else if (pvt->model >=0x60 && pvt->model <=0x6f ) { + fam_type = &family_types[F17_M60H_CPUS ]; + pvt->ops = &family_types[F17_M60H_CPUS ].ops; +break ; }else if (pvt->model >=0x70 && pvt->model <=0x7f ) { fam_type = &family_types[F17_M70H_CPUS ]; pvt->ops = &family_types[F17_M70H_CPUS ].ops;
drivers/edac/amd64_edac.h +3 -0
@@ -120,6 +120,8 @@#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F6 0x15ee#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F0 0x1490#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F6 0x1496 +#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F0 0x1448 +#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F6 0x144e#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F0 0x1440#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F6 0x1446
@@ -291,6 +293,7 @@ enum amd_families {F17_CPUS ,F17_M10H_CPUS ,F17_M30H_CPUS , +F17_M60H_CPUS ,F17_M70H_CPUS , NUM_FAMILIES, };
Greg Kroah-Hartman
maintainerPATCH 211/261 power: vexpress: add suppress_bind_attrs to true
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
commit 73174acc9c75960af2daa7dcbdb9781fc0d135cb upstream.
Make sure that the POWER_RESET_VEXPRESS driver won't have bind/unbind attributes available via the sysfs, so lets be explicit here and use ".suppress_bind_attrs = true" to prevent userspace from doing something silly.
--- drivers/power/reset/vexpress-poweroff.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/reset/vexpress-poweroff.c +1 -0
@@ -143,6 +143,7 @@ static struct platform_driver vexpress_r .driver = { .name = "vexpress-reset", .of_match_table = vexpress_reset_of_match, + .suppress_bind_attrs = true, }, };
Greg Kroah-Hartman
maintainerPATCH 216/261 gnss: sirf: fix error return code in sirf_probe()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
commit 43d7ce70ae43dd8523754b17f567417e0e75dbce upstream.
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
This avoids a use-after-free in case the driver is later unbound.
--- drivers/gnss/sirf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gnss/sirf.c +6 -2
@@ -439,14 +439,18 @@ static int sirf_probe(struct serdev_devi data->on_off =devm_gpiod_get_optional (dev,"sirf,onoff" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->on_off)) +if (IS_ERR (data->on_off)) { + ret =PTR_ERR (data->on_off); goto err_put_device; + }if (data->on_off) { data->wakeup =devm_gpiod_get_optional (dev,"sirf,wakeup" ,GPIOD_IN ); -if (IS_ERR (data->wakeup)) +if (IS_ERR (data->wakeup)) { + ret =PTR_ERR (data->wakeup); goto err_put_device; + } ret =regulator_enable (data->vcc);if (ret)
Greg Kroah-Hartman
maintainerPATCH 217/261 sparc32: fix register window handling in genregs32_[gs]et()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit cf51e129b96847f969bfb8af1ee1516a01a70b39 upstream.
It needs access_process_vm() if the traced process does not share mm with the caller. Solution is similar to what sparc64 does. Note that genregs32_set() is only ever called with pos being 0 or 32 * sizeof(u32) (the latter - as part of PTRACE_SETREGS handling).
--- arch/sparc/kernel/ptrace_32.c | 230 ++++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 131 deletions(-)
arch/sparc/kernel/ptrace_32.c +99 -131
@@ -46,82 +46,79 @@ enum sparc_regset { REGSET_FP, }; +static int regwindow32_get (struct task_struct *target, +const struct pt_regs *regs, +u32 *uregs) +{ +unsigned long reg_window = regs->u_regs[UREG_I6 ]; +int size =16 *sizeof (u32); + +if (target == current) { +if (copy_from_user (uregs, (void __user *)reg_window, size)) +return -EFAULT ; + }else { +if (access_process_vm (target, reg_window, uregs, size, +FOLL_FORCE ) != size) +return -EFAULT ; + } +return 0 ; +} + +static int regwindow32_set (struct task_struct *target, +const struct pt_regs *regs, +u32 *uregs) +{ +unsigned long reg_window = regs->u_regs[UREG_I6 ]; +int size =16 *sizeof (u32); + +if (target == current) { +if (copy_to_user ((void __user *)reg_window, uregs, size)) +return -EFAULT ; + }else { +if (access_process_vm (target, reg_window, uregs, size, +FOLL_FORCE |FOLL_WRITE ) != size) +return -EFAULT ; + } +return 0 ; +} +static int genregs32_get (struct task_struct *target,const struct user_regset *regset,unsigned int pos,unsigned int count,void *kbuf,void __user *ubuf) {const struct pt_regs *regs = target->thread.kregs; -unsigned long __user *reg_window; -unsigned long *k = kbuf; -unsigned long __user *u = ubuf; -unsigned long reg; +u32 uregs[16 ]; +int ret;if (target == current)flush_user_windows (); - pos /=sizeof (reg); - count /=sizeof (reg); + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, + regs->u_regs, +0 ,16 *sizeof (u32)); +if (ret || !count) +return ret; -if (kbuf) { -for (; count >0 && pos <16 ; count--) - *k++ = regs->u_regs[pos++]; - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (get_user (*k++, ®_window[pos++])) -return -EFAULT ; - } - }else { -for (; count >0 && pos <16 ; count--) { -if (put_user (regs->u_regs[pos++], u++)) -return -EFAULT ; - } - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (get_user (reg, ®_window[pos++]) || -put_user (reg, u++)) -return -EFAULT ; - } - } -while (count >0 ) { -switch (pos) { -case 32 :/* PSR */ - reg = regs->psr; -break ; -case 33 :/* PC */ - reg = regs->pc; -break ; -case 34 :/* NPC */ - reg = regs->npc; -break ; -case 35 :/* Y */ - reg = regs->y; -break ; -case 36 :/* WIM */ -case 37 :/* TBR */ - reg =0 ; -break ; -default : - goto finish; - } - -if (kbuf) - *k++ = reg; -else if (put_user (reg, u++)) +if (pos <32 *sizeof (u32)) { +if (regwindow32_get (target, regs, uregs))return -EFAULT ; - pos++; - count--; + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, + uregs, +16 *sizeof (u32),32 *sizeof (u32)); +if (ret || !count) +return ret; } -finish: - pos *=sizeof (reg); - count *=sizeof (reg); -return user_regset_copyout_zero (&pos, &count, &kbuf, &ubuf, -38 *sizeof (reg),-1 ); + uregs[0 ] = regs->psr; + uregs[1 ] = regs->pc; + uregs[2 ] = regs->npc; + uregs[3 ] = regs->y; + uregs[4 ] =0 ;/* WIM */ + uregs[5 ] =0 ;/* TBR */ +return user_regset_copyout (&pos, &count, &kbuf, &ubuf, + uregs, +32 *sizeof (u32),38 *sizeof (u32)); } static int genregs32_set(struct task_struct *target,
@@ -130,82 +127,53 @@ static int genregs32_set(struct task_str const void *kbuf, const void __user *ubuf) { struct pt_regs *regs = target->thread.kregs; -unsigned long __user *reg_window; -const unsigned long *k = kbuf; -const unsigned long __user *u = ubuf; -unsigned long reg; +u32 uregs[16 ]; +u32 psr; +int ret;if (target == current)flush_user_windows (); - pos /=sizeof (reg); - count /=sizeof (reg); - -if (kbuf) { -for (; count >0 && pos <16 ; count--) - regs->u_regs[pos++] = *k++; - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (put_user (*k++, ®_window[pos++])) -return -EFAULT ; - } - }else { -for (; count >0 && pos <16 ; count--) { -if (get_user (reg, u++)) -return -EFAULT ; - regs->u_regs[pos++] = reg; - } - - reg_window = (unsigned long __user *) regs->u_regs[UREG_I6 ]; - reg_window -=16 ; -for (; count >0 && pos <32 ; count--) { -if (get_user (reg, u++) || -put_user (reg, ®_window[pos++])) -return -EFAULT ; - } - } -while (count >0 ) { -unsigned long psr; - -if (kbuf) - reg = *k++; -else if (get_user (reg, u++)) -return -EFAULT ; - -switch (pos) { -case 32 :/* PSR */ - psr = regs->psr; - psr &= ~(PSR_ICC |PSR_SYSCALL ); - psr |= (reg & (PSR_ICC |PSR_SYSCALL )); - regs->psr = psr; -break ; -case 33 :/* PC */ - regs->pc = reg; -break ; -case 34 :/* NPC */ - regs->npc = reg; -break ; -case 35 :/* Y */ - regs->y = reg; -break ; -case 36 :/* WIM */ -case 37 :/* TBR */ -break ; -default : - goto finish; - } + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + regs->u_regs, +0 ,16 *sizeof (u32)); +if (ret || !count) +return ret; - pos++; - count--; +if (pos <32 *sizeof (u32)) { +if (regwindow32_get (target, regs, uregs)) +return -EFAULT ; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + uregs, +16 *sizeof (u32),32 *sizeof (u32)); +if (ret) +return ret; +if (regwindow32_set (target, regs, uregs)) +return -EFAULT ; +if (!count) +return 0 ; } -finish: - pos *=sizeof (reg); - count *=sizeof (reg); - + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + &psr, +32 *sizeof (u32),33 *sizeof (u32)); +if (ret) +return ret; + regs->psr = (regs->psr & ~(PSR_ICC |PSR_SYSCALL )) | + (psr & (PSR_ICC |PSR_SYSCALL )); +if (!count) +return 0 ; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + ®s->pc, +33 *sizeof (u32),34 *sizeof (u32)); +if (ret || !count) +return ret; + ret =user_regset_copyin (&pos, &count, &kbuf, &ubuf, + ®s->y, +34 *sizeof (u32),35 *sizeof (u32)); +if (ret || !count) +return ret;return user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf, -38 *sizeof (reg),-1 ); +35 *sizeof (u32),38 *sizeof (u32)); } static int fpregs32_get(struct task_struct *target,
Greg Kroah-Hartman
maintainerPATCH 212/261 power: supply: core: fix HWMON temperature labels
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
commit 6b20464ad9fb5fd76ef6f219ce62156aa9639dcc upstream.
tempX_label files are swapped compared to what power_supply_hwmon_temp_to_property() uses. Make them match.
--- drivers/power/supply/power_supply_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/power_supply_hwmon.c +1 -1
@@ -144,7 +144,7 @@ static int power_supply_hwmon_read_strin u32 attr, int channel, const char **str) { - *str = channel ?"temp" :"temp ambient" ; + *str = channel ?"temp ambient" :"temp" ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 190/261 PCI: Add Loongson vendor ID
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 9acb9fe18d863aacc99948963f8d5d447dc311be ]
Add the Loongson vendor ID to pci_ids.h to be used by the controller driver in the future.
The Loongson vendor ID can be found at the following link:
https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/tree/pci.ids
--- include/linux/pci_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -148,6 +148,8 @@/* Vendors and devices. Sort key: vendor first, device next. */ +#define PCI_VENDOR_ID_LOONGSON 0x0014 +#define PCI_VENDOR_ID_TTTECH 0x0357#define PCI_DEVICE_ID_TTTECH_MC322 0x000a
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 214/261 pinctrl: samsung: Correct setting of eint wakeup mask on s5pv210
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
commit b577a279914085c6b657c33e9f39ef56d96a3302 upstream.
Commit a8be2af0218c ("pinctrl: samsung: Write external wakeup interrupt mask") started writing the eint wakeup mask from the pinctrl driver. Unfortunately, it made the assumption that the private retention data was always a regmap while in the case of s5pv210 it is a raw pointer to the clock base (as the eint wakeup mask not in the PMU as with newer Exynos platforms).
--- drivers/pinctrl/samsung/pinctrl-exynos.c | 73 ++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 24 deletions(-)
drivers/pinctrl/samsung/pinctrl-exynos.c +49 -24
@@ -40,6 +40,8 @@ struct exynos_irq_chip {u32 eint_pend;u32 eint_wake_mask_value;u32 eint_wake_mask_reg; +void (*set_eint_wakeup_mask)(struct samsung_pinctrl_drv_data *drvdata, +struct exynos_irq_chip *irq_chip); };static inline struct exynos_irq_chip *to_exynos_irq_chip (struct irq_chip *chip)
@@ -342,6 +344,47 @@ static int exynos_wkup_irq_set_wake(strureturn 0 ; } +static void +exynos_pinctrl_set_eint_wakeup_mask (struct samsung_pinctrl_drv_data *drvdata, +struct exynos_irq_chip *irq_chip) +{ +struct regmap *pmu_regs; + +if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { +dev_warn (drvdata->dev, +"No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n" ); +return ; + } + + pmu_regs = drvdata->retention_ctrl->priv; +dev_info (drvdata->dev, +"Setting external wakeup interrupt mask: 0x%x\n" , + irq_chip->eint_wake_mask_value); + +regmap_write (pmu_regs, irq_chip->eint_wake_mask_reg, + irq_chip->eint_wake_mask_value); +} + +static void +s5pv210_pinctrl_set_eint_wakeup_mask (struct samsung_pinctrl_drv_data *drvdata, +struct exynos_irq_chip *irq_chip) + +{ +void __iomem *clk_base; + +if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { +dev_warn (drvdata->dev, +"No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n" ); +return ; + } + + + clk_base = (void __iomem *) drvdata->retention_ctrl->priv; + +__raw_writel (irq_chip->eint_wake_mask_value, + clk_base + irq_chip->eint_wake_mask_reg); +} +/* * irq_chip for wakeup interrupts */
@@ -360,8 +403,9 @@ static const struct exynos_irq_chip s5pv .eint_mask = EXYNOS_WKUP_EMASK_OFFSET, .eint_pend = EXYNOS_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, - /* Only difference with exynos4210_wkup_irq_chip: */ + /* Only differences with exynos4210_wkup_irq_chip: */ .eint_wake_mask_reg = S5PV210_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = s5pv210_pinctrl_set_eint_wakeup_mask, };static const struct exynos_irq_chip exynos4210_wkup_irq_chip__initconst = {
@@ -380,6 +424,7 @@ static const struct exynos_irq_chip exyn .eint_pend = EXYNOS_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, .eint_wake_mask_reg = EXYNOS_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = exynos_pinctrl_set_eint_wakeup_mask, };static const struct exynos_irq_chip exynos7_wkup_irq_chip__initconst = {
@@ -398,6 +443,7 @@ static const struct exynos_irq_chip exyn .eint_pend = EXYNOS7_WKUP_EPEND_OFFSET, .eint_wake_mask_value = EXYNOS_EINT_WAKEUP_MASK_DISABLED, .eint_wake_mask_reg = EXYNOS5433_EINT_WAKEUP_MASK, + .set_eint_wakeup_mask = exynos_pinctrl_set_eint_wakeup_mask, };/* list of external wakeup controllers supported */
@@ -574,27 +620,6 @@ int exynos_eint_wkup_init(struct samsungreturn 0 ; } -static void -exynos_pinctrl_set_eint_wakeup_mask (struct samsung_pinctrl_drv_data *drvdata, -struct exynos_irq_chip *irq_chip) -{ -struct regmap *pmu_regs; - -if (!drvdata->retention_ctrl || !drvdata->retention_ctrl->priv) { -dev_warn (drvdata->dev, -"No retention data configured bank with external wakeup interrupt. Wake-up mask will not be set.\n" ); -return ; - } - - pmu_regs = drvdata->retention_ctrl->priv; -dev_info (drvdata->dev, -"Setting external wakeup interrupt mask: 0x%x\n" , - irq_chip->eint_wake_mask_value); - -regmap_write (pmu_regs, irq_chip->eint_wake_mask_reg, - irq_chip->eint_wake_mask_value); -} -static void exynos_pinctrl_suspend_bank (struct samsung_pinctrl_drv_data *drvdata,struct samsung_pin_bank *bank)
@@ -626,8 +651,8 @@ void exynos_pinctrl_suspend(struct samsuelse if (bank->eint_type ==EINT_TYPE_WKUP ) {if (!irq_chip) { irq_chip = bank->irq_chip; -exynos_pinctrl_set_eint_wakeup_mask (drvdata, - irq_chip); + irq_chip->set_eint_wakeup_mask (drvdata, + irq_chip); }else if (bank->irq_chip != irq_chip) { dev_warn(drvdata->dev, "More than one external wakeup interrupt chip configured (bank: %s). This is not supported by hardware nor by driver.\n",
Greg Kroah-Hartman
maintainerPATCH 192/261 x86/amd_nb: Add AMD family 17h model 60h PCI IDs
In reply to Greg Kroah-HartmanFrom: Alexander Monakov <[email protected]>
[ Upstream commit a4e91825d7e1252f7cba005f1451e5464b23c15d ]
Add PCI IDs for AMD Renoir (4000-series Ryzen CPUs). This is necessary to enable support for temperature sensors via the k10temp module.
--- arch/x86/kernel/amd_nb.c | 5 +++++ include/linux/pci_ids.h | 1 + 2 files changed, 6 insertions(+)
arch/x86/kernel/amd_nb.c +5 -0
@@ -18,9 +18,11 @@#define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450#define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0#define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480 +#define PCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630#define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494 +#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F4 0x144c#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F4 0x1444#define PCI_DEVICE_ID_AMD_19H_DF_F4 0x1654
@@ -33,6 +35,7 @@ static const struct pci_device_id amd_root_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_ROOT) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_ROOT) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_ROOT) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M60H_ROOT) }, {} };
@@ -51,6 +54,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F3) },
@@ -67,6 +71,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M60H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) },
include/linux/pci_ids.h +1 -0
@@ -550,6 +550,7 @@#define PCI_DEVICE_ID_AMD_17H_DF_F3 0x1463#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493 +#define PCI_DEVICE_ID_AMD_17H_M60H_DF_F3 0x144b#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443#define PCI_DEVICE_ID_AMD_19H_DF_F3 0x1653#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 189/261 x86/amd_nb: Add Family 19h PCI IDs
In reply to Greg Kroah-HartmanFrom: Yazen Ghannam <[email protected]>
[ Upstream commit b3f79ae45904ae987a7c06a9e8d6084d7b73e67f ]
Add the new PCI Device 18h IDs for AMD Family 19h systems. Note that Family 19h systems will not have a new PCI root device ID.
--- arch/x86/kernel/amd_nb.c | 3 +++ include/linux/pci_ids.h | 1 + 2 files changed, 4 insertions(+)
arch/x86/kernel/amd_nb.c +3 -0
@@ -22,6 +22,7 @@#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F4 0x1494#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F4 0x1444 +#define PCI_DEVICE_ID_AMD_19H_DF_F4 0x1654/* Protect the PCI config register pairs used for SMN and DF indirect access. */ static DEFINE_MUTEX (smn_mutex);
@@ -52,6 +53,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F3) }, {} };EXPORT_SYMBOL_GPL (amd_nb_misc_ids);
@@ -66,6 +68,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M10H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M30H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_M70H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, {} };
include/linux/pci_ids.h +1 -0
@@ -549,6 +549,7 @@#define PCI_DEVICE_ID_AMD_17H_M10H_DF_F3 0x15eb#define PCI_DEVICE_ID_AMD_17H_M30H_DF_F3 0x1493#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F3 0x1443 +#define PCI_DEVICE_ID_AMD_19H_DF_F3 0x1653#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 194/261 ima: Set again build_ima_appraise variable
In reply to Greg Kroah-HartmanFrom: Krzysztof Struczynski <[email protected]>
[ Upstream commit b59fda449cf07f2db3be3a67142e6c000f5e8d79 ]
After adding the new add_rule() function in commit c52657d93b05 ("ima: refactor ima_init_policy()"), all appraisal flags are added to the temp_ima_appraise variable. Revert to the previous behavior instead of removing build_ima_appraise, to benefit from the protection offered by __ro_after_init.
The mentioned commit introduced a bug, as it makes all the flags modifiable, while build_ima_appraise flags can be protected with __ro_after_init.
--- security/integrity/ima/ima_policy.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
security/integrity/ima/ima_policy.c +8 -2
@@ -590,8 +590,14 @@ static void add_rules(struct ima_rule_entry *entries, int count,list_add_tail (&entry->list, &ima_policy_rules); } -if (entries[i].action ==APPRAISE ) - temp_ima_appraise |=ima_appraise_flag (entries[i].func); +if (entries[i].action ==APPRAISE ) { +if (entries != build_appraise_rules) + temp_ima_appraise |= +ima_appraise_flag (entries[i].func); +else + build_ima_appraise |= +ima_appraise_flag (entries[i].func); + } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 229/261 ARM: dts: s5pv210: Set keep-power-in-suspend for SDHCI1 on Aries
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
commit 869d42e6eba821905e1a0950623aadafe1a6e6d3 upstream.
SDHCI1 is connected to a BCM4329 WiFi/BT chip which requires power to be kept over suspend. As the surrounding hardware supports this, mark it as such. This fixes WiFi after a suspend/resume cycle.
--- arch/arm/boot/dts/s5pv210-aries.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/s5pv210-aries.dtsi +1 -0
@@ -454,6 +454,7 @@ pinctrl-names = "default"; cap-sd-highspeed; cap-mmc-highspeed; + keep-power-in-suspend; mmc-pwrseq = <&wifi_pwrseq>; non-removable;
Greg Kroah-Hartman
maintainerPATCH 220/261 alpha: fix memory barriers so that they conform to the specification
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 54505a1e2083fc54cbe8779b97479f969cd30a00 upstream.
The commits cd0e00c10672 and 92d7223a7423 broke boot on the Alpha Avanti platform. The patches move memory barriers after a write before the write. The result is that if there's iowrite followed by ioread, there is no barrier between them.
The Alpha architecture allows reordering of the accesses to the I/O space, and the missing barrier between write and read causes hang with serial port and real time clock.
This patch makes barriers confiorm to the specification.
1. We add mb() before readX_relaxed and writeX_relaxed - memory-barriers.txt claims that these functions must be ordered w.r.t. each other. Alpha doesn't order them, so we need an explicit barrier.
2. We add mb() before reads from the I/O space - so that if there's a write followed by a read, there should be a barrier between them.
--- arch/alpha/include/asm/io.h | 74 +++++++++++++++++++++++++++++++++++--------- arch/alpha/kernel/io.c | 60 +++++++++++++++++++++++++++++++---- 2 files changed, 112 insertions(+), 22 deletions(-)
arch/alpha/include/asm/io.h +59 -15
@@ -322,14 +322,18 @@ static inline int __is_mmio(const volati#if IO_CONCAT (__IO_PREFIX,trivial_io_bw)extern inline unsigned int ioread8 (void __iomem *addr) { -unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr); +unsigned int ret; +mb (); + ret =IO_CONCAT (__IO_PREFIX,ioread8)(addr);mb ();return ret; }extern inline unsigned int ioread16 (void __iomem *addr) { -unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr); +unsigned int ret; +mb (); + ret =IO_CONCAT (__IO_PREFIX,ioread16)(addr);mb ();return ret; }
@@ -370,7 +374,9 @@ extern inline void outw(u16 b, unsigned#if IO_CONCAT (__IO_PREFIX,trivial_io_lq)extern inline unsigned int ioread32 (void __iomem *addr) { -unsigned int ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr); +unsigned int ret; +mb (); + ret =IO_CONCAT (__IO_PREFIX,ioread32)(addr);mb ();return ret; }
@@ -415,14 +421,18 @@ extern inline void __raw_writew(u16 b, vextern inline u8 readb (const volatile void __iomem *addr) { -u8 ret =__raw_readb (addr); +u8 ret; +mb (); + ret =__raw_readb (addr);mb ();return ret; }extern inline u16 readw (const volatile void __iomem *addr) { -u16 ret =__raw_readw (addr); +u16 ret; +mb (); + ret =__raw_readw (addr);mb ();return ret; }
@@ -463,14 +473,18 @@ extern inline void __raw_writeq(u64 b, vextern inline u32 readl (const volatile void __iomem *addr) { -u32 ret =__raw_readl (addr); +u32 ret; +mb (); + ret =__raw_readl (addr);mb ();return ret; }extern inline u64 readq (const volatile void __iomem *addr) { -u64 ret =__raw_readq (addr); +u64 ret; +mb (); + ret =__raw_readq (addr);mb ();return ret; }
@@ -499,14 +513,44 @@ extern inline void writeq(u64 b, volatil#define outb_p outb#define outw_p outw#define outl_p outl -#define readb_relaxed (addr) __raw_readb(addr) -#define readw_relaxed (addr) __raw_readw(addr) -#define readl_relaxed (addr) __raw_readl(addr) -#define readq_relaxed (addr) __raw_readq(addr) -#define writeb_relaxed (b, addr) __raw_writeb(b, addr) -#define writew_relaxed (b, addr) __raw_writew(b, addr) -#define writel_relaxed (b, addr) __raw_writel(b, addr) -#define writeq_relaxed (b, addr) __raw_writeq(b, addr) + +extern u8 readb_relaxed (const volatile void __iomem *addr); +extern u16 readw_relaxed (const volatile void __iomem *addr); +extern u32 readl_relaxed (const volatile void __iomem *addr); +extern u64 readq_relaxed (const volatile void __iomem *addr); + +#if IO_CONCAT (__IO_PREFIX,trivial_io_bw) +extern inline u8 readb_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readb (addr); +} + +extern inline u16 readw_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readw (addr); +} +#endif + +#if IO_CONCAT (__IO_PREFIX,trivial_io_lq) +extern inline u32 readl_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readl (addr); +} + +extern inline u64 readq_relaxed (const volatile void __iomem *addr) +{ +mb (); +return __raw_readq (addr); +} +#endif + +#define writeb_relaxed writeb +#define writew_relaxed writew +#define writel_relaxed writel +#define writeq_relaxed writeq/* * String version of IO memory access ops:
arch/alpha/kernel/io.c +53 -7
108 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 235/261 powerpc/64s: Dont let DT CPU features set FSCR_DSCR
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 993e3d96fd08c3ebf7566e43be9b8cd622063e6d upstream.
The device tree CPU features binding includes FSCR bit numbers which Linux is instructed to set by firmware.
Whether that's a good idea or not, in the case of the DSCR the Linux implementation has a hard requirement that the FSCR_DSCR bit not be set by default. We use it to track when a process reads/writes to DSCR, so it must be clear to begin with.
So if firmware tells us to set FSCR_DSCR we must ignore it.
Currently this does not cause a bug in our DSCR handling because the value of FSCR that the device tree CPU features code establishes is only used by swapper. All other tasks use the value hard coded in init_task.thread.fscr.
However we'd like to fix that in a future commit, at which point this will become necessary.
--- arch/powerpc/kernel/dt_cpu_ftrs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/powerpc/kernel/dt_cpu_ftrs.c +8 -0
@@ -346,6 +346,14 @@ static int __init feat_enable_dscr(struc {u64 lpcr; +/* +* Linux relies on FSCR[DSCR] being clear, so that we can take the +* facility unavailable interrupt and track the task's usage of DSCR. +* See facility_unavailable_exception(). +* Clear the bit here so that feat_enable() doesn't set it. +*/ + f->fscr_bit_nr =-1 ; +feat_enable (f); lpcr =mfspr (SPRN_LPCR );
Greg Kroah-Hartman
maintainerPATCH 221/261 powerpc/fadump: use static allocation for reserved memory ranges
In reply to Greg Kroah-HartmanFrom: Hari Bathini <[email protected]>
commit 02c04e374e176ae3a3f64a682f80702f8d2fb65d upstream.
At times, memory ranges have to be looked up during early boot, when kernel couldn't be initialized for dynamic memory allocation. In fact, reserved-ranges look up is needed during FADump memory reservation. Without accounting for reserved-ranges in reserving memory for FADump, MPIPL boot fails with memory corruption issues. So, extend memory ranges handling to support static allocation and populate reserved memory ranges during early boot.
--- arch/powerpc/include/asm/fadump-internal.h | 4 + arch/powerpc/kernel/fadump.c | 77 ++++++++++++++++------------- 2 files changed, 48 insertions(+), 33 deletions(-)
arch/powerpc/include/asm/fadump-internal.h +3 -1
@@ -64,12 +64,14 @@ struct fadump_memory_range { };/* fadump memory ranges info */ +#define RNG_NAME_SZ 16struct fadump_mrange_info { -char name[16 ]; +char name[RNG_NAME_SZ ];struct fadump_memory_range *mem_ranges;u32 mem_ranges_sz;u32 mem_range_cnt;u32 max_mem_ranges; +bool is_static; };/* Platform specific callback functions */
arch/powerpc/kernel/fadump.c +45 -32
134 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 234/261 powerpc/32: Disable KASAN with pages bigger than 16k
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 888468ce725a4cd56d72dc7e5096078f7a9251a0 upstream.
Mapping of early shadow area is implemented by using a single static page table having all entries pointing to the same early shadow page. The shadow area must therefore occupy full PGD entries.
The shadow area has a size of 128MB starting at 0xf8000000. With 4k pages, a PGD entry is 4MB
With 16k pages, a PGD entry is 64MB
With 64k pages, a PGD entry is 1GB which is too big.
Until we rework the early shadow mapping, disable KASAN when the page size is too big.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -171,7 +171,7 @@ config PPC select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU select HAVE_ARCH_JUMP_LABEL - select HAVE_ARCH_KASAN if PPC32 + select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14 select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
Greg Kroah-Hartman
maintainerPATCH 237/261 kbuild: force to build vmlinux if CONFIG_MODVERSION=y
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 4b50c8c4eaf06a825d1c005c0b1b4a8307087b83 upstream.
This code does not work as stated in the comment.
$(CONFIG_MODVERSIONS) is always empty because it is expanded before include/config/auto.conf is included. Hence, 'make modules' with CONFIG_MODVERSION=y cannot record the version CRCs.
This has been broken since 2003, commit ("kbuild: Enable modules to be build using the "make dir/" syntax"). [1]
--- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
Makefile +8 -5
@@ -587,12 +587,8 @@ KBUILD_MODULES := KBUILD_BUILTIN := 1 # If we have only "make modules", don't compile built-in objects. -# When we're building modules with modversions, we need to consider -# the built-in objects during the descend as well, in order to -# make sure the checksums are up to date before we record them. - ifeq ($(MAKECMDGOALS),modules) - KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) + KBUILD_BUILTIN := endif # If we have "make <whatever> modules", compile modules
@@ -1282,6 +1278,13 @@ ifdef CONFIG_MODULES all: modules +# When we're building modules with modversions, we need to consider +# the built-in objects during the descend as well, in order to +# make sure the checksums are up to date before we record them. +ifdef CONFIG_MODVERSIONS + KBUILD_BUILTIN := 1 +endif + # Build modules # # A module can be listed more than once in obj-m resulting in
Greg Kroah-Hartman
maintainerPATCH 241/261 mtd: rawnand: onfi: Fix redundancy detection check
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 1d5d08ee9b28cff907326b4ad5a2463fd2808be1 upstream.
During ONFI detection, the CRC derived from the parameter page and the CRC supposed to be at the end of the parameter page are compared. If they do not match, the second then the third copies of the page are tried.
The current implementation compares the newly derived CRC with the CRC contained in the first page only. So if this particular CRC area has been corrupted, then the detection will fail for a wrong reason.
Fix this issue by checking the derived CRC against the right one.
--- drivers/mtd/nand/raw/nand_onfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/nand_onfi.c +1 -1
@@ -173,7 +173,7 @@ int nand_onfi_detect(struct nand_chip *c }if (onfi_crc16 (ONFI_CRC_BASE , (u8 *)&p[i],254 ) == -le16_to_cpu (p->crc)) { +le16_to_cpu (p[i].crc)) {if (i)memcpy (p, &p[i],sizeof (*p));break ;
Greg Kroah-Hartman
maintainerPATCH 239/261 sunrpc: clean up properly in gss_mech_unregister()
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
commit 24c5efe41c29ee3e55bcf5a1c9f61ca8709622e8 upstream.
gss_mech_register() calls svcauth_gss_register_pseudoflavor() for each flavour, but gss_mech_unregister() does not call auth_domain_put(). This is unbalanced and makes it impossible to reload the module.
Change svcauth_gss_register_pseudoflavor() to return the registered auth_domain, and save it for later release.
--- include/linux/sunrpc/gss_api.h | 1 + include/linux/sunrpc/svcauth_gss.h | 3 ++- net/sunrpc/auth_gss/gss_mech_switch.c | 12 +++++++++--- net/sunrpc/auth_gss/svcauth_gss.c | 12 ++++++------ 4 files changed, 18 insertions(+), 10 deletions(-)
include/linux/sunrpc/gss_api.h +1 -0
@@ -85,6 +85,7 @@ struct pf_desc {u32 service;char *name;char *auth_domain_name; +struct auth_domain *domain;bool datatouch; };
include/linux/sunrpc/svcauth_gss.h +2 -1
@@ -21,7 +21,8 @@ int gss_svc_init(void);void gss_svc_shutdown (void );int gss_svc_init_net (struct net *net);void gss_svc_shutdown_net (struct net *net); -int svcauth_gss_register_pseudoflavor (u32 pseudoflavor,char * name); +struct auth_domain *svcauth_gss_register_pseudoflavor (u32 pseudoflavor, +char *name);u32 svcauth_gss_flavor (struct auth_domain *dom);#endif /* __KERNEL__ */
net/sunrpc/auth_gss/gss_mech_switch.c +9 -3
@@ -36,6 +36,8 @@ gss_mech_free(struct gss_api_mech *gm)for (i =0 ; i < gm->gm_pf_num; i++) { pf = &gm->gm_pfs[i]; +if (pf->domain) +auth_domain_put (pf->domain);kfree (pf->auth_domain_name); pf->auth_domain_name =NULL ; }
@@ -58,6 +60,7 @@ make_auth_domain_name(char *name)static int gss_mech_svc_setup (struct gss_api_mech *gm) { +struct auth_domain *dom;struct pf_desc *pf;int i, status;
@@ -67,10 +70,13 @@ gss_mech_svc_setup(struct gss_api_mech * status = -ENOMEM ;if (pf->auth_domain_name ==NULL ) goto out; - status =svcauth_gss_register_pseudoflavor (pf->pseudoflavor, - pf->auth_domain_name); -if (status) + dom =svcauth_gss_register_pseudoflavor ( + pf->pseudoflavor, pf->auth_domain_name); +if (IS_ERR (dom)) { + status =PTR_ERR (dom); goto out; + } + pf->domain = dom; }return 0 ; out:
net/sunrpc/auth_gss/svcauth_gss.c +6 -6
@@ -800,7 +800,7 @@ u32 svcauth_gss_flavor(struct auth_domaiEXPORT_SYMBOL_GPL (svcauth_gss_flavor); -int +struct auth_domain *svcauth_gss_register_pseudoflavor (u32 pseudoflavor,char * name) {struct gss_domain *new;
@@ -823,17 +823,17 @@ svcauth_gss_register_pseudoflavor(u32 ps name); stat = -EADDRINUSE ;auth_domain_put (test); -kfree (new->h.name); - goto out_free_dom; + goto out_free_name; } -return 0 ; +return test; +out_free_name: +kfree (new->h.name); out_free_dom:kfree (new); out: -return stat; +return ERR_PTR (stat); } -EXPORT_SYMBOL_GPL (svcauth_gss_register_pseudoflavor); static inline int
Greg Kroah-Hartman
maintainerPATCH 243/261 mtd: rawnand: diskonchip: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit c5be12e45940f1aa1b5dfa04db5d15ad24f7c896 upstream.
Not sure nand_cleanup() is the right function to call here but in any case it is not nand_release(). Indeed, even a comment says that calling nand_release() is a bit of a hack as there is no MTD device to unregister. So switch to nand_cleanup() for now and drop this comment.
There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if it did not intruce
any bug.
--- drivers/mtd/nand/raw/diskonchip.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/diskonchip.c +2 -5
@@ -1609,13 +1609,10 @@ static int __init doc_probe(unsigned lon numchips =doc2001_init (mtd);if ((ret =nand_scan (nand, numchips)) || (ret = doc->late_init (mtd))) { -/* DBB note: i believe nand_release is necessary here, as +/* DBB note: i believe nand_cleanup is necessary here, as buffers may have been allocated in nand_base. Check with Thomas. FIX ME! */ -/* nand_release will call mtd_device_unregister, but we -haven't yet added it. This is handled without incident by -mtd_device_unregister, as far as I can tell. */ -nand_release (nand); +nand_cleanup (nand); goto fail; }
Greg Kroah-Hartman
maintainerPATCH 245/261 mtd: rawnand: ingenic: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit de17cade0e034e9b721a6db9b488014effac1e5a upstream.
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. Hence, pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug makes sense.
--- drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +1 -1
@@ -376,7 +376,7 @@ static int ingenic_nand_init_chip(struct ret =mtd_device_register (mtd,NULL ,0 );if (ret) { -nand_release (chip); +nand_cleanup (chip);return ret; }
Greg Kroah-Hartman
maintainerPATCH 244/261 mtd: rawnand: sharpsl: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 0f44b3275b3798ccb97a2f51ac85871c30d6fbbc upstream.
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense.
--- drivers/mtd/nand/raw/sharpsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/sharpsl.c +1 -1
@@ -183,7 +183,7 @@ static int sharpsl_nand_probe(struct plareturn 0 ; err_add: -nand_release (this); +nand_cleanup (this); err_scan:iounmap (sharpsl->io);
Greg Kroah-Hartman
maintainerPATCH 246/261 mtd: rawnand: xway: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 34531be5e804a8e1abf314a6c3a19fe342e4a154 upstream.
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/raw/xway_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/xway_nand.c +1 -1
@@ -210,7 +210,7 @@ static int xway_nand_probe(struct platfo err =mtd_device_register (mtd,NULL ,0 );if (err) -nand_release (&data->chip); +nand_cleanup (&data->chip);return err; }
Greg Kroah-Hartman
maintainerPATCH 227/261 ARM: dts: exynos: Fix GPIO polarity for thr GalaxyS3 CM36651 sensors bus
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
commit 8807d356bfea92b0a8f04ce421800ed83400cd22 upstream.
GPIO lines for the CM36651 sensor I2C bus use the normal not the inverted polarity. This bug has been there since adding the CM36651 sensor by commit 85cb4e0bd229 ("ARM: dts: add cm36651 light/proximity sensor node for exynos4412-trats2"), but went unnoticed because the "i2c-gpio" driver ignored the GPIO polarity specified in the device-tree.
The recent conversion of "i2c-gpio" driver to the new, descriptor based GPIO API, automatically made it the DT-specified polarity aware, what broke the CM36651 sensor operation.
--- arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-galaxy-s3.dtsi +1 -1
@@ -68,7 +68,7 @@ i2c_cm36651: i2c-gpio-2 { compatible = "i2c-gpio"; - gpios = <&gpf0 0 GPIO_ACTIVE_LOW>, <&gpf0 1 GPIO_ACTIVE_LOW>; + gpios = <&gpf0 0 GPIO_ACTIVE_HIGH>, <&gpf0 1 GPIO_ACTIVE_HIGH>; i2c-gpio,delay-us = <2>; #address-cells = <1>; #size-cells = <0>;
Greg Kroah-Hartman
maintainerPATCH 226/261 soc/tegra: pmc: Select GENERIC_PINCONF
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
commit 5098e2b95e8e6f56266c2d5c180c75917090082a upstream.
I have hit the following build error:
armv7a-hardfloat-linux-gnueabi-ld: drivers/soc/tegra/pmc.o: in function `pinconf_generic_dt_node_to_map_pin':
pmc.c:(.text+0x500): undefined reference to pinconf_generic_dt_node_to_map' armv7a-hardfloat-linux-gnueabi-ld: drivers/soc/tegra/pmc.o:(.rodata+0x1f88): undefined reference to pinconf_generic_dt_free_map'
So SOC_TEGRA_PMC should select GENERIC_PINCONF.
--- drivers/soc/tegra/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/soc/tegra/Kconfig +1 -0
@@ -130,6 +130,7 @@ config SOC_TEGRA_FLOWCTRL config SOC_TEGRA_PMC bool + select GENERIC_PINCONF config SOC_TEGRA_POWERGATE_BPMP def_bool y
Greg Kroah-Hartman
maintainerPATCH 254/261 mtd: rawnand: tmio: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 75e9a330a9bd48f97a55a08000236084fe3dae56 upstream.
nand_release() is supposed be called after MTD device registration. Here, only nand_scan() happened, so use nand_cleanup() instead.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not introducing any bug.
--- drivers/mtd/nand/raw/tmio_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/tmio_nand.c +1 -1
@@ -448,7 +448,7 @@ static int tmio_probe(struct platform_deif (!retval)return retval; -nand_release (nand_chip); +nand_cleanup (nand_chip); err_irq:tmio_hw_stop (dev, tmio);
Greg Kroah-Hartman
maintainerPATCH 228/261 ARM: dts: at91: sama5d2_ptc_ek: fix vbus pin
In reply to Greg Kroah-HartmanFrom: Ludovic Desroches <[email protected]>
commit baa998aecb75c04d62be0a4ab6b724af6d73a0f9 upstream.
The gpio property for the vbus pin doesn't match the pinctrl and is not correct.
--- arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +1 -1
@@ -40,7 +40,7 @@ ahb { usb0: gadget@300000 { - atmel,vbus-gpio = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>; + atmel,vbus-gpio = <&pioA PIN_PB11 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usba_vbus>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 256/261 f2fs: fix checkpoint=disable:%u%%
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit 1ae18f71cb522684bac1718f5c188fb5e30eb23d upstream.
When parsing the mount option, we don't have sbi->user_block_count. Should do it after getting it.
--- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-)
fs/f2fs/f2fs.h +1 -0
@@ -138,6 +138,7 @@ struct f2fs_mount_info {int alloc_mode;/* segment allocation policy */ int fsync_mode;/* fsync policy */ bool test_dummy_encryption;/* test dummy encryption */ +block_t unusable_cap_perc;/* percentage for cap */ block_t unusable_cap;/* Amount of space allowed to be * unusable when disabling checkpoint */
fs/f2fs/super.c +19 -6
@@ -277,6 +277,22 @@ static inline void limit_reserve_root(st F2FS_OPTION(sbi).s_resgid)); } +static inline void adjust_unusable_cap_perc (struct f2fs_sb_info *sbi) +{ +if (!F2FS_OPTION (sbi).unusable_cap_perc) +return ; + +if (F2FS_OPTION (sbi).unusable_cap_perc ==100 ) +F2FS_OPTION (sbi).unusable_cap = sbi->user_block_count; +else +F2FS_OPTION (sbi).unusable_cap = (sbi->user_block_count /100 ) * +F2FS_OPTION (sbi).unusable_cap_perc; + +f2fs_info (sbi,"Adjust unusable cap for checkpoint=disable = %u / %u%%" , +F2FS_OPTION (sbi).unusable_cap, +F2FS_OPTION (sbi).unusable_cap_perc); +} +static void init_once (void *foo) {struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo;
@@ -790,12 +806,7 @@ static int parse_options(struct super_blreturn -EINVAL ;if (arg <0 || arg >100 )return -EINVAL ; -if (arg ==100 ) -F2FS_OPTION (sbi).unusable_cap = - sbi->user_block_count; -else -F2FS_OPTION (sbi).unusable_cap = - (sbi->user_block_count /100 ) * arg; +F2FS_OPTION (sbi).unusable_cap_perc = arg;set_opt (sbi,DISABLE_CHECKPOINT );break ;case Opt_checkpoint_disable_cap:
@@ -1735,6 +1746,7 @@ skip: (test_opt (sbi,POSIX_ACL ) ?SB_POSIXACL :0 );limit_reserve_root (sbi); +adjust_unusable_cap_perc (sbi); *flags = (*flags & ~SB_LAZYTIME ) | (sb->s_flags &SB_LAZYTIME );return 0 ; restore_gc:
@@ -3397,6 +3409,7 @@ try_onemore: sbi->reserved_blocks =0 ; sbi->current_reserved_blocks =0 ;limit_reserve_root (sbi); +adjust_unusable_cap_perc (sbi);for (i =0 ; i <NR_INODE_TYPE ; i++) {INIT_LIST_HEAD (&sbi->inode_list[i]);
Greg Kroah-Hartman
maintainerPATCH 259/261 perf probe: Check address correctness by map instead of _etext
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit 2ae5d0d7d8868df7c05c2013c0b9cddd4d40610e upstream.
Since commit 03db8b583d1c ("perf tools: Fix maps__find_symbol_by_name()") introduced map address range check in maps__find_symbol_by_name(), we can not get "_etext" from kernel map because _etext is placed on the edge of the kernel .text section (= kernel map in perf.)
To fix this issue, this checks the address correctness by map address range information (map->start and map->end) instead of using _etext address.
This can cause an error if the target inlined function is embedded in both __init function and normal function.
For exaample, request_resource() is a normal function but also embedded in __init reserve_setup(). In this case, the probe point in reserve_setup() must be skipped.
However, without this fix, it failes to setup all probe points:
# ./perf probe -v request_resource
probe-definition(0): request_resource
symbol:request_resource file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
Looking at the vmlinux_path (8 entries long)
Using /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux for symbols
Open Debuginfo file: /usr/lib/debug/lib/modules/5.5.17-200.fc31.x86_64/vmlinux
Try to find probe point from debuginfo.
Matched function: request_resource [15e29ad]
found inline addr: 0xffffffff82fbf892
Probe point found: reserve_setup+204
found inline addr: 0xffffffff810e9790
Probe point found: request_resource+0
Found 2 probe_trace_events.
Opening /sys/kernel/debug/tracing//kprobe_events write=1
Opening /sys/kernel/debug/tracing//README write=0
Writing event: p:probe/request_resource _text+33290386
Failed to write event: Invalid argument
Error: Failed to add events. Reason: Invalid argument (Code: -22)
#With this fix,
# ./perf probe request_resource
reserve_setup is out of .text, skip it.
Added new events:
(null):(null) (on request_resource)
probe:request_resource (on request_resource)You can now use it in all perf tools, such as:
perf record -e probe:request_resource -aR sleep 1
#
--- tools/perf/util/probe-event.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
tools/perf/util/probe-event.c +13 -12
@@ -236,21 +236,22 @@ static void clear_probe_trace_events(strstatic bool kprobe_blacklist__listed (unsigned long address);static bool kprobe_warn_out_range (const char *symbol,unsigned long address) { -u64 etext_addr =0 ; -int ret; +struct map *map; +bool ret = false; -/* Get the address of _etext for checking non-probable text symbol */ - ret =kernel_get_symbol_address_by_name ("_etext" , &etext_addr, - false, false); - -if (ret ==0 && etext_addr < address) -pr_warning ("%s is out of .text, skip it.\n" , symbol); -else if (kprobe_blacklist__listed (address)) + map =kernel_get_module_map (NULL ); +if (map) { + ret = address <= map->start || map->end < address; +if (ret) +pr_warning ("%s is out of .text, skip it.\n" , symbol); +map__put (map); + } +if (!ret &&kprobe_blacklist__listed (address)) {pr_warning ("%s is blacklisted function, skip it.\n" , symbol); -else -return false; + ret = true; + } -return true; +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 260/261 perf symbols: Fix debuginfo search for Ubuntu
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 85afd35575a3c1a3a905722dde5ee70b49282e70 upstream.
Reportedly, from 19.10 Ubuntu has begun mixing up the location of some debug symbol files, putting files expected to be in /usr/lib/debug/usr/lib into /usr/lib/debug/lib instead. Fix by adding another dso_binary_type.
Example on Ubuntu 20.04
Before:
$ perf record -e intel_pt//u uname
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.030 MB perf.data ]
$ perf script --call-trace | head -5
uname 14003 [005] 15321.764958566: cbr: 42 freq: 4219 MHz (156%)
uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4100
uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4df0
uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc4e18
uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) 7f1e71cc5128After:
$ perf script --call-trace | head -5
uname 14003 [005] 15321.764958566: cbr: 42 freq: 4219 MHz (156%)
uname 14003 [005] 15321.764958566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _start
uname 14003 [005] 15321.764961566: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start
uname 14003 [005] 15321.764961900: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start
uname 14003 [005] 15321.764963233: (/usr/lib/x86_64-linux-gnu/ld-2.31.so ) _dl_start--- tools/perf/util/dso.c | 16 ++++++++++++++++ tools/perf/util/dso.h | 1 + tools/perf/util/probe-finder.c | 1 + tools/perf/util/symbol.c | 2 ++ 4 files changed, 20 insertions(+)
tools/perf/util/dso.c +16 -0
@@ -47,6 +47,7 @@ char dso__symtab_origin(const struct dso [DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO] = 'D', [DSO_BINARY_TYPE__FEDORA_DEBUGINFO] = 'f', [DSO_BINARY_TYPE__UBUNTU_DEBUGINFO] = 'u', + [DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO] = 'x', [DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO] = 'o', [DSO_BINARY_TYPE__BUILDID_DEBUGINFO] = 'b', [DSO_BINARY_TYPE__SYSTEM_PATH_DSO] = 'd',
@@ -129,6 +130,21 @@ int dso__read_binary_type_filename(constsnprintf (filename + len, size - len,"%s" , dso->long_name);break ; +case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO : +/* +* Ubuntu can mixup /usr/lib with /lib, putting debuginfo in +* /usr/lib/debug/lib when it is expected to be in +* /usr/lib/debug/usr/lib +*/ +if (strlen (dso->long_name) <9 || +strncmp (dso->long_name,"/usr/lib/" ,9 )) { + ret =-1 ; +break ; + } + len =__symbol__join_symfs (filename, size,"/usr/lib/debug" ); +snprintf (filename + len, size - len,"%s" , dso->long_name +4 ); +break ; +case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO : {const char *last_slash;
tools/perf/util/dso.h +1 -0
@@ -30,6 +30,7 @@ enum dso_binary_type {DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO ,DSO_BINARY_TYPE__FEDORA_DEBUGINFO ,DSO_BINARY_TYPE__UBUNTU_DEBUGINFO , +DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO ,DSO_BINARY_TYPE__BUILDID_DEBUGINFO ,DSO_BINARY_TYPE__SYSTEM_PATH_DSO , DSO_BINARY_TYPE__GUEST_KMODULE,
tools/perf/util/probe-finder.c +1 -0
@@ -101,6 +101,7 @@ enum dso_binary_type distro_dwarf_types[DSO_BINARY_TYPE__UBUNTU_DEBUGINFO ,DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO ,DSO_BINARY_TYPE__BUILDID_DEBUGINFO , +DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO , DSO_BINARY_TYPE__NOT_FOUND, };
tools/perf/util/symbol.c +2 -0
@@ -79,6 +79,7 @@ static enum dso_binary_type binary_type_DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ,DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ,DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO , +DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO , DSO_BINARY_TYPE__NOT_FOUND, };
@@ -1530,6 +1531,7 @@ static bool dso__is_compatible_symtab_tycase DSO_BINARY_TYPE__SYSTEM_PATH_DSO :case DSO_BINARY_TYPE__FEDORA_DEBUGINFO :case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO : +case DSO_BINARY_TYPE__MIXEDUP_UBUNTU_DEBUGINFO :case DSO_BINARY_TYPE__BUILDID_DEBUGINFO :case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO :return !kmod && dso->kernel ==DSO_TYPE_USER ;
Greg Kroah-Hartman
maintainerPATCH 252/261 mtd: rawnand: pasemi: Fix the probe error path
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit f51466901c07e6930435d30b02a21f0841174f61 upstream.
nand_cleanup() is supposed to be called on error after a successful call to nand_scan() to free all NAND resources.
There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources") which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.
--- drivers/mtd/nand/raw/pasemi_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/pasemi_nand.c +3 -1
@@ -146,7 +146,7 @@ static int pasemi_nand_probe(struct platif (mtd_device_register (pasemi_nand_mtd,NULL ,0 )) {dev_err (dev,"Unable to register MTD device\n" ); err = -ENODEV ; - goto out_lpc; + goto out_cleanup_nand; } dev_info(dev, "PA Semi NAND flash at %pR, control at I/O %x\n", &res,
@@ -154,6 +154,8 @@ static int pasemi_nand_probe(struct platreturn 0 ; + out_cleanup_nand: +nand_cleanup (chip); out_lpc:release_region (lpcctl,4 ); out_ior:
Greg Kroah-Hartman
maintainerPATCH 225/261 ARM: tegra: Correct PL310 Auxiliary Control Register initialization
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit 35509737c8f958944e059d501255a0bf18361ba0 upstream.
The PL310 Auxiliary Control Register shouldn't have the "Full line of zero" optimization bit being set before L2 cache is enabled. The L2X0 driver takes care of enabling the optimization by itself.
This patch fixes a noisy error message on Tegra20 and Tegra30 telling that cache optimization is erroneously enabled without enabling it for the CPU:
L2C-310: enabling full line of zeros but not enabled in Cortex-A9
--- arch/arm/mach-tegra/tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/tegra.c +2 -2
@@ -106,8 +106,8 @@ static const char * const tegra_dt_board };DT_MACHINE_START (TEGRA_DT ,"NVIDIA Tegra SoC (Flattened Device Tree)" ) - .l2c_aux_val = 0x3c400001, - .l2c_aux_mask = 0xc20fc3fe, + .l2c_aux_val = 0x3c400000, + .l2c_aux_mask = 0xc20fc3ff, .smp = smp_ops(tegra_smp_ops), .map_io = tegra_map_common_io, .init_early = tegra_init_early,
Greg Kroah-Hartman
maintainerPATCH 186/261 PCI: Avoid FLR for AMD Starship USB 3.0
In reply to Greg Kroah-HartmanFrom: Kevin Buettner <[email protected]>
[ Upstream commit 5727043c73fdfe04597971b5f3f4850d879c1f4f ]
The AMD Starship USB 3.0 host controller advertises Function Level Reset support, but it apparently doesn't work. Add a quirk to prevent use of FLR on this device.
Without this quirk, when attempting to assign (pass through) an AMD Starship USB 3.0 host controller to a guest OS, the system becomes increasingly unresponsive over the course of several minutes, eventually requiring a hard reset. Shortly after attempting to start the guest, I see these messages:
vfio-pci 0000:05:00.3: not ready 1023ms after FLR; waiting vfio-pci 0000:05:00.3: not ready 2047ms after FLR; waiting vfio-pci 0000:05:00.3: not ready 4095ms after FLR; waiting vfio-pci 0000:05:00.3: not ready 8191ms after FLR; waiting
And then eventually:
vfio-pci 0000:05:00.3: not ready 65535ms after FLR; giving up
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 0.000 msecs
perf: interrupt took too long (642744 > 2500), lowering kernel.perf_event_max_sample_rate to 1000
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 82.270 msecs
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 680.608 msecs
INFO: NMI handler (perf_event_nmi_handler) took too long to run: 100.952 msecs
...
watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [qemu-system-x86:7487]
Tested on a Micro-Star International Co., Ltd. MS-7C59/Creator TRX40 motherboard with an AMD Ryzen Threadripper 3970X.
--- drivers/pci/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -5134,6 +5134,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap);* FLR may cause the following to devices to hang: * * AMD Starship/Matisse HD Audio Controller 0x1487 +* AMD Starship USB 3.0 Host Controller 0x148c * AMD Matisse USB 3.0 Host Controller 0x149c * Intel 82579LM Gigabit Ethernet Controller 0x1502 * Intel 82579V Gigabit Ethernet Controller 0x1503
@@ -5144,6 +5145,7 @@ static void quirk_no_flr(struct pci_dev *dev) dev->dev_flags |=PCI_DEV_FLAGS_NO_FLR_RESET ; }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x1487 , quirk_no_flr); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x148c , quirk_no_flr);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_AMD ,0x149c , quirk_no_flr);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1502 , quirk_no_flr);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1503 , quirk_no_flr);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 233/261 powerpc/kasan: Fix shadow pages allocation failure
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit d2a91cef9bbdeb87b7449fdab1a6be6000930210 upstream.
Doing kasan pages allocation in MMU_init is too early, kernel doesn't have access yet to the entire memory space and memblock_alloc() fails when the kernel is a bit big.
Do it from kasan_init() instead.
--- arch/powerpc/include/asm/kasan.h | 2 -- arch/powerpc/mm/init_32.c | 2 -- arch/powerpc/mm/kasan/kasan_init_32.c | 4 +++- 3 files changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/kasan.h +0 -2
@@ -27,11 +27,9 @@#ifdef CONFIG_KASAN void kasan_early_init (void ); -void kasan_mmu_init (void );void kasan_init (void );#else static inline void kasan_init (void ) { } -static inline void kasan_mmu_init (void ) { }#endif #endif /* __ASSEMBLY */
arch/powerpc/mm/init_32.c +0 -2
@@ -175,8 +175,6 @@ void __init MMU_init(void)btext_unmap ();#endif -kasan_mmu_init (); -setup_kup ();/* Shortly after that, the entire linear mapping will be available */
arch/powerpc/mm/kasan/kasan_init_32.c +3 -1
@@ -129,7 +129,7 @@ static void __init kasan_remap_early_shaflush_tlb_kernel_range (KASAN_SHADOW_START ,KASAN_SHADOW_END ); } -void __init kasan_mmu_init (void ) +static void __init kasan_mmu_init (void ) {int ret;struct memblock_region *reg;
@@ -156,6 +156,8 @@ void __init kasan_mmu_init(void)void __init kasan_init (void ) { +kasan_mmu_init (); +kasan_remap_early_shadow_ro ();clear_page (kasan_early_shadow_page);
Greg Kroah-Hartman
maintainerPATCH 257/261 perf probe: Do not show the skipped events
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit f41ebe9defacddeae96a872a33f0f22ced0bfcef upstream.
When a probe point is expanded to several places (like inlined) and if some of them are skipped because of blacklisted or __init function, those trace_events has no event name. It must be skipped while showing results.
Without this fix, you can see "(null):(null)" on the list,
# ./perf probe request_resource
reserve_setup is out of .text, skip it.
Added new events:
(null):(null) (on request_resource)
probe:request_resource (on request_resource)You can now use it in all perf tools, such as:
perf record -e probe:request_resource -aR sleep 1
#
With this fix, it is ignored:
# ./perf probe request_resource
reserve_setup is out of .text, skip it.
Added new events:
probe:request_resource (on request_resource)You can now use it in all perf tools, such as:
perf record -e probe:request_resource -aR sleep 1
#
--- tools/perf/builtin-probe.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-probe.c +3 -0
@@ -364,6 +364,9 @@ static int perf_add_probe_events(structfor (k =0 ; k < pev->ntevs; k++) {struct probe_trace_event *tev = &pev->tevs[k]; +/* Skipped events have no event name */ +if (!tev->event) +continue ;/* We use tev's name for showing new events */ show_perf_probe_event(tev->group, tev->event, pev,
Greg Kroah-Hartman
maintainerPATCH 255/261 w1: omap-hdq: cleanup to add missing newline for some dev_dbg
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
commit 5e02f3b31704e24537697bce54f8156bdb72b7a6 upstream.
Otherwise it will corrupt the console log during debugging.
--- drivers/w1/masters/omap_hdq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/w1/masters/omap_hdq.c +5 -5
@@ -176,7 +176,7 @@ static int hdq_write_byte(struct hdq_dat/* check irqstatus */ if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) {dev_dbg (hdq_data->dev,"timeout waiting for" -" TXCOMPLETE/RXCOMPLETE, %x" , *status); +" TXCOMPLETE/RXCOMPLETE, %x\n" , *status); ret = -ETIMEDOUT ; goto out; }
@@ -187,7 +187,7 @@ static int hdq_write_byte(struct hdq_dat OMAP_HDQ_FLAG_CLEAR, &tmp_status);if (ret) {dev_dbg (hdq_data->dev,"timeout waiting GO bit" -" return to zero, %x" , tmp_status); +" return to zero, %x\n" , tmp_status); } out:
@@ -203,7 +203,7 @@ static irqreturn_t hdq_isr(int irq, voidspin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); hdq_data->hdq_irqstatus =hdq_reg_in (hdq_data,OMAP_HDQ_INT_STATUS );spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); -dev_dbg (hdq_data->dev,"hdq_isr: %x" , hdq_data->hdq_irqstatus); +dev_dbg (hdq_data->dev,"hdq_isr: %x\n" , hdq_data->hdq_irqstatus); if (hdq_data->hdq_irqstatus & (OMAP_HDQ_INT_STATUS_TXCOMPLETE | OMAP_HDQ_INT_STATUS_RXCOMPLETE
@@ -311,7 +311,7 @@ static int omap_hdq_break(struct hdq_dat tmp_status = hdq_data->hdq_irqstatus;/* check irqstatus */ if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { -dev_dbg (hdq_data->dev,"timeout waiting for TIMEOUT, %x" , +dev_dbg (hdq_data->dev,"timeout waiting for TIMEOUT, %x\n" , tmp_status); ret = -ETIMEDOUT ; goto out;
@@ -338,7 +338,7 @@ static int omap_hdq_break(struct hdq_dat &tmp_status);if (ret)dev_dbg (hdq_data->dev,"timeout waiting INIT&GO bits" -" return to zero, %x" , tmp_status); +" return to zero, %x\n" , tmp_status); out:mutex_unlock (&hdq_data->hdq_mutex);