5.16.3-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 934/1039 drm/vc4: Fix non-blocking commit getting stuck forever
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit 0c250c150c74a90db298bf2a8bcd0a1dabed2e2f upstream.
In some situation, we can end up being stuck on a non-blocking that went through properly.
The situation that seems to trigger it reliably is to first start a non-blocking commit, and then right after, and before we had any vblank interrupt), start a blocking commit.
This will lead to the first commit workqueue to be scheduled, setup the display, while the second commit is waiting for the first one to be completed.
The vblank interrupt will then be raised, vc4_crtc_handle_vblank() will run and will compare the active dlist in the HVS channel to the one associated with the crtc->state.
However, at that point, the second commit is waiting using drm_atomic_helper_wait_for_dependencies that occurs after drm_atomic_helper_swap_state has been called, so crtc->state points to the second commit state. vc4_crtc_handle_vblank() will compare the two dlist addresses and since they don't match will ignore the interrupt.
The vblank event will never be reported, and the first and second commit will wait for the first commit completion until they timeout.
The underlying reason is that it was never safe to do so. Indeed, accessing the ->state pointer access synchronization is based on ownership guarantees that can only occur within the functions and hooks defined as part of the KMS framework, and obviously the irq handler isn't one of them. The rework to move to generic helpers only uncovered the underlying issue.
However, since the code path between drm_atomic_helper_wait_for_dependencies() and drm_atomic_helper_wait_for_vblanks() is serialised and we can't get two commits in that path at the same time, we can work around this issue by setting a variable associated to struct drm_crtc to the dlist we expect, and then using it from the vc4_crtc_handle_vblank() function.
Since that state is shared with the modesetting path, we also need to introduce a spinlock to protect the code shared between the interrupt handler and the modesetting path, protecting only our new variable for now.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 5 ++++- drivers/gpu/drm/vc4/vc4_drv.h | 14 ++++++++++++++ drivers/gpu/drm/vc4/vc4_hvs.c | 7 +++++-- 3 files changed, 23 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +4 -1
@@ -713,8 +713,9 @@ static void vc4_crtc_handle_page_flip(stunsigned long flags;spin_lock_irqsave (&dev->event_lock, flags); +spin_lock (&vc4_crtc->irq_lock);if (vc4_crtc->event && - (vc4_state->mm.start ==HVS_READ (SCALER_DISPLACTX (chan)) || + (vc4_crtc->current_dlist ==HVS_READ (SCALER_DISPLACTX (chan)) || vc4_crtc->feeds_txp)) {drm_crtc_send_vblank_event (crtc, vc4_crtc->event); vc4_crtc->event =NULL ;
@@ -728,6 +729,7 @@ static void vc4_crtc_handle_page_flip(st*/ vc4_hvs_unmask_underrun (dev, chan); } +spin_unlock (&vc4_crtc->irq_lock);spin_unlock_irqrestore (&dev->event_lock, flags); }
@@ -1127,6 +1129,7 @@ int vc4_crtc_init(struct drm_device *drmreturn PTR_ERR (primary_plane); } +spin_lock_init (&vc4_crtc->irq_lock);drm_crtc_init_with_planes (drm, crtc, primary_plane,NULL , crtc_funcs,NULL );drm_crtc_helper_add (crtc, crtc_helper_funcs);
drivers/gpu/drm/vc4/vc4_drv.h +14 -0
@@ -500,6 +500,20 @@ struct vc4_crtc {* @feeds_txp: True if the CRTC feeds our writeback controller. */ bool feeds_txp; + +/** +* @irq_lock: Spinlock protecting the resources shared between +* the atomic code and our vblank handler. +*/ +spinlock_t irq_lock; + +/** +* @current_dlist: Start offset of the display list currently +* set in the HVS for that CRTC. Protected by @irq_lock, and +* copied in vc4_hvs_update_dlist() for the CRTC interrupt +* handler to have access to that value. +*/ +unsigned int current_dlist; }; static inline struct vc4_crtc *
drivers/gpu/drm/vc4/vc4_hvs.c +5 -2
@@ -365,10 +365,9 @@ static void vc4_hvs_update_dlist(structstruct vc4_dev *vc4 =to_vc4_dev (dev);struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc);struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc->state); +unsigned long flags;if (crtc->state->event) { -unsigned long flags; - crtc->state->event->pipe =drm_crtc_index (crtc);WARN_ON (drm_crtc_vblank_get (crtc) !=0 );
@@ -388,6 +387,10 @@ static void vc4_hvs_update_dlist(structHVS_WRITE (SCALER_DISPLISTX (vc4_state->assigned_channel), vc4_state->mm.start); } + +spin_lock_irqsave (&vc4_crtc->irq_lock, flags); + vc4_crtc->current_dlist = vc4_state->mm.start; +spin_unlock_irqrestore (&vc4_crtc->irq_lock, flags); } void vc4_hvs_atomic_enable(struct drm_crtc *crtc,
Greg Kroah-Hartman
maintainerPATCH 935/1039 drm/vc4: crtc: Copy assigned channel to the CRTC
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit eeb6ab4639590130d25670204ab7b6011333d685 upstream.
Accessing the crtc->state pointer from outside the modesetting context is not allowed. We thus need to copy whatever we need from the KMS state to our structure in order to access it.
In VC4, a number of users of that pointers have crept in over the years, and the previous commits removed them all but the HVS channel a CRTC has been assigned.
Let's move this channel in struct vc4_crtc at atomic_begin() time, drop it from our private state structure, and remove our use of crtc->state from our vblank handler entirely.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 4 ++-- drivers/gpu/drm/vc4/vc4_drv.h | 9 +++++++++ drivers/gpu/drm/vc4/vc4_hvs.c | 12 ++++++++++++ drivers/gpu/drm/vc4/vc4_txp.c | 1 + 4 files changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +2 -2
@@ -708,8 +708,7 @@ static void vc4_crtc_handle_page_flip(ststruct drm_crtc *crtc = &vc4_crtc->base;struct drm_device *dev = crtc->dev;struct vc4_dev *vc4 =to_vc4_dev (dev); -struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc->state); -u32 chan = vc4_state->assigned_channel; +u32 chan = vc4_crtc->current_hvs_channel;unsigned long flags;spin_lock_irqsave (&dev->event_lock, flags);
@@ -955,6 +954,7 @@ static const struct drm_crtc_funcs vc4_cstatic const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { .mode_valid = vc4_crtc_mode_valid, .atomic_check = vc4_crtc_atomic_check, + .atomic_begin = vc4_hvs_atomic_begin, .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_crtc_atomic_enable, .atomic_disable = vc4_crtc_atomic_disable,
drivers/gpu/drm/vc4/vc4_drv.h +9 -0
@@ -514,6 +514,14 @@ struct vc4_crtc {* handler to have access to that value. */ unsigned int current_dlist; + +/** +* @current_hvs_channel: HVS channel currently assigned to the +* CRTC. Protected by @irq_lock, and copied in +* vc4_hvs_atomic_begin() for the CRTC interrupt handler to have +* access to that value. +*/ +unsigned int current_hvs_channel; }; static inline struct vc4_crtc *
@@ -926,6 +934,7 @@ extern struct platform_driver vc4_hvs_drvoid vc4_hvs_stop_channel (struct drm_device *dev,unsigned int output);int vc4_hvs_get_fifo_from_output (struct drm_device *dev,unsigned int output);int vc4_hvs_atomic_check (struct drm_crtc *crtc,struct drm_atomic_state *state); +void vc4_hvs_atomic_begin (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_disable (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_flush (struct drm_crtc *crtc,struct drm_atomic_state *state);
drivers/gpu/drm/vc4/vc4_hvs.c +12 -0
@@ -393,6 +393,18 @@ static void vc4_hvs_update_dlist(structspin_unlock_irqrestore (&vc4_crtc->irq_lock, flags); } +void vc4_hvs_atomic_begin (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +struct vc4_crtc *vc4_crtc =to_vc4_crtc (crtc); +struct vc4_crtc_state *vc4_state =to_vc4_crtc_state (crtc->state); +unsigned long flags; + +spin_lock_irqsave (&vc4_crtc->irq_lock, flags); + vc4_crtc->current_hvs_channel = vc4_state->assigned_channel; +spin_unlock_irqrestore (&vc4_crtc->irq_lock, flags); +} +void vc4_hvs_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state) {
drivers/gpu/drm/vc4/vc4_txp.c +1 -0
@@ -435,6 +435,7 @@ static void vc4_txp_atomic_disable(strucstatic const struct drm_crtc_helper_funcs vc4_txp_crtc_helper_funcs = { .atomic_check = vc4_txp_atomic_check, + .atomic_begin = vc4_hvs_atomic_begin, .atomic_flush = vc4_hvs_atomic_flush, .atomic_enable = vc4_txp_atomic_enable, .atomic_disable = vc4_txp_atomic_disable,
Greg Kroah-Hartman
maintainerPATCH 936/1039 libbpf: Remove deprecation attribute from struct bpf_prog_prep_result
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
commit 5c5edcdebfcf3a95257b0d8ef27a60af0e0ea03a upstream.
This deprecation annotation has no effect because for struct deprecation attribute has to be declared after struct definition. But instead of moving it to the end of struct definition, remove it. When deprecation will go in effect at libbpf v0.7, this deprecation attribute will cause libbpf's own source code compilation to trigger deprecation warnings, which is unavoidable because libbpf still has to support that API.
So keep deprecation of APIs, but don't mark structs used in API as deprecated.
--- tools/lib/bpf/libbpf.h | 1 - 1 file changed, 1 deletion(-)
tools/lib/bpf/libbpf.h +0 -1
@@ -431,7 +431,6 @@ bpf_program__attach_iter(const struct bp* one instance. In this case bpf_program__fd(prog) is equal to * bpf_program__nth_fd(prog, 0). */ -LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_program__insns() for getting bpf_program instructions")struct bpf_prog_prep_result {/* * If not NULL, load new instruction array.
Greg Kroah-Hartman
maintainerPATCH 937/1039 arm64/bpf: Remove 128MB limit for BPF JIT programs
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
commit b89ddf4cca43f1269093942cf5c4e457fd45c335 upstream.
Commit 91fc957c9b1d ("arm64/bpf: don't allocate BPF JIT programs in module memory") restricts BPF JIT program allocation to a 128MB region to ensure BPF programs are still in branching range of each other. However this restriction should not apply to the aarch64 JIT, since BPF_JMP | BPF_CALL are implemented as a 64-bit move into a register and then a BLR instruction - which has the effect of being able to call anything without proximity limitation.
The practical reason to relax this restriction on JIT memory is that 128MB of JIT memory can be quickly exhausted, especially where PAGE_SIZE is 64KB - one page is needed per program. In cases where seccomp filters are applied to multiple VMs on VM launch - such filters are classic BPF but converted to BPF - this can severely limit the number of VMs that can be launched. In a world where we support BPF JIT always on, turning off the JIT isn't always an option either.
--- arch/arm64/include/asm/extable.h | 9 --------- arch/arm64/include/asm/memory.h | 5 +---- arch/arm64/kernel/traps.c | 2 +- arch/arm64/mm/ptdump.c | 2 -- arch/arm64/net/bpf_jit_comp.c | 7 ++----- 5 files changed, 4 insertions(+), 21 deletions(-)
arch/arm64/include/asm/extable.h +0 -9
@@ -33,15 +33,6 @@ do { \ (b)->data = (tmp).data; \ } while (0) -static inline bool in_bpf_jit(struct pt_regs *regs) -{ -if (!IS_ENABLED (CONFIG_BPF_JIT )) -return false; - -return regs->pc >=BPF_JIT_REGION_START && - regs->pc <BPF_JIT_REGION_END ; -} -#ifdef CONFIG_BPF_JIT bool ex_handler_bpf (const struct exception_table_entry *ex,struct pt_regs *regs);
arch/arm64/include/asm/memory.h +1 -4
@@ -44,11 +44,8 @@#define _PAGE_OFFSET (va) (-(UL(1) << (va)))#define PAGE_OFFSET (_PAGE_OFFSET(VA_BITS))#define KIMAGE_VADDR (MODULES_END) -#define BPF_JIT_REGION_START (_PAGE_END(VA_BITS_MIN)) -#define BPF_JIT_REGION_SIZE (SZ_128M) -#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE)#define MODULES_END (MODULES_VADDR + MODULES_VSIZE) -#define MODULES_VADDR (BPF_JIT_REGION_END) +#define MODULES_VADDR (_PAGE_END(VA_BITS_MIN))#define MODULES_VSIZE (SZ_128M)#define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT)))#define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE)
arch/arm64/kernel/traps.c +1 -1
@@ -994,7 +994,7 @@ static struct break_hook bug_break_hookstatic int reserved_fault_handler (struct pt_regs *regs,unsigned int esr) {pr_err ("%s generated an invalid instruction at %pS!\n" , -in_bpf_jit (regs) ?"BPF JIT" :"Kernel text patching" , +"Kernel text patching" , (void *)instruction_pointer (regs));/* We cannot handle this */
arch/arm64/mm/ptdump.c +0 -2
@@ -41,8 +41,6 @@ static struct addr_marker address_marker { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif - { BPF_JIT_REGION_START, "BPF start" }, - { BPF_JIT_REGION_END, "BPF end" }, { MODULES_VADDR, "Modules start" }, { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() area" },
arch/arm64/net/bpf_jit_comp.c +2 -5
@@ -1145,15 +1145,12 @@ out:u64 bpf_jit_alloc_exec_limit (void ) { -return BPF_JIT_REGION_SIZE ; +return VMALLOC_END -VMALLOC_START ; }void *bpf_jit_alloc_exec (unsigned long size) { -return __vmalloc_node_range (size,PAGE_SIZE ,BPF_JIT_REGION_START , -BPF_JIT_REGION_END ,GFP_KERNEL , -PAGE_KERNEL ,0 ,NUMA_NO_NODE , -__builtin_return_address (0 )); +return vmalloc (size); }void bpf_jit_free_exec (void *addr)
Greg Kroah-Hartman
maintainerPATCH 938/1039 bpftool: Remove inclusion of utilities.mak from Makefiles
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
commit 48f5aef4c458c19ab337eed8c95a6486cc014aa3 upstream.
Bpftool's Makefile, and the Makefile for its documentation, both include scripts/utilities.mak, but they use none of the items defined in this file. Remove the includes.
--- tools/bpf/bpftool/Documentation/Makefile | 1 - tools/bpf/bpftool/Makefile | 1 - 2 files changed, 2 deletions(-)
tools/bpf/bpftool/Documentation/Makefile +0 -1
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../../scripts/Makefile.include -include ../../../scripts/utilities.mak INSTALL ?= install RM ?= rm -f
tools/bpf/bpftool/Makefile +0 -1
@@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only include ../../scripts/Makefile.include -include ../../scripts/utilities.mak ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR)))
Greg Kroah-Hartman
maintainerPATCH 939/1039 bpftool: Fix indent in option lists in the documentation
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
commit 986dec18bbf41f50edc2e0aa4ac5ef8e0f64f328 upstream.
Mixed indentation levels in the lists of options in bpftool's documentation produces some unexpected results. For the "bpftool" man page, it prints a warning:
$ make -C bpftool.8
GEN bpftool.8
<stdin>:26: (ERROR/3) Unexpected indentation.For other pages, there is no warning, but it results in a line break appearing in the option lists in the generated man pages.
RST paragraphs should have a uniform indentation level. Let's fix it.
--- tools/bpf/bpftool/Documentation/bpftool-btf.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-cgroup.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-gen.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-link.rst | 2 +- tools/bpf/bpftool/Documentation/bpftool-map.rst | 6 +++--- tools/bpf/bpftool/Documentation/bpftool-prog.rst | 8 ++++---- tools/bpf/bpftool/Documentation/bpftool.rst | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-)
tools/bpf/bpftool/Documentation/bpftool-btf.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **btf** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | {**-d** | **--debug** } | - { **-B** | **--base-btf** } } + { **-B** | **--base-btf** } } *COMMANDS* := { **dump** | **help** }
tools/bpf/bpftool/Documentation/bpftool-cgroup.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **cgroup** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } } + { **-f** | **--bpffs** } } *COMMANDS* := { **show** | **list** | **tree** | **attach** | **detach** | **help** }
tools/bpf/bpftool/Documentation/bpftool-gen.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **gen** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-L** | **--use-loader** } } + { **-L** | **--use-loader** } } *COMMAND* := { **object** | **skeleton** | **help** }
tools/bpf/bpftool/Documentation/bpftool-link.rst +1 -1
@@ -13,7 +13,7 @@ SYNOPSIS **bpftool** [*OPTIONS*] **link** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-n** | **--nomount** } } + { **-f** | **--bpffs** } | { **-n** | **--nomount** } } *COMMANDS* := { **show** | **list** | **pin** | **help** }
tools/bpf/bpftool/Documentation/bpftool-map.rst +3 -3
@@ -13,11 +13,11 @@ SYNOPSIS **bpftool** [*OPTIONS*] **map** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-n** | **--nomount** } } + { **-f** | **--bpffs** } | { **-n** | **--nomount** } } *COMMANDS* := - { **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext** - | **delete** | **pin** | **help** } + { **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext** | + **delete** | **pin** | **help** } MAP COMMANDS =============
tools/bpf/bpftool/Documentation/bpftool-prog.rst +4 -4
@@ -13,12 +13,12 @@ SYNOPSIS **bpftool** [*OPTIONS*] **prog** *COMMAND* *OPTIONS* := { { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } | - { **-f** | **--bpffs** } | { **-m** | **--mapcompat** } | { **-n** | **--nomount** } | - { **-L** | **--use-loader** } } + { **-f** | **--bpffs** } | { **-m** | **--mapcompat** } | { **-n** | **--nomount** } | + { **-L** | **--use-loader** } } *COMMANDS* := - { **show** | **list** | **dump xlated** | **dump jited** | **pin** | **load** - | **loadall** | **help** } + { **show** | **list** | **dump xlated** | **dump jited** | **pin** | **load** | + **loadall** | **help** } PROG COMMANDS =============
tools/bpf/bpftool/Documentation/bpftool.rst +3 -3
@@ -19,14 +19,14 @@ SYNOPSIS *OBJECT* := { **map** | **program** | **cgroup** | **perf** | **net** | **feature** } *OPTIONS* := { { **-V** | **--version** } | - { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } } + { **-j** | **--json** } [{ **-p** | **--pretty** }] | { **-d** | **--debug** } } *MAP-COMMANDS* := { **show** | **list** | **create** | **dump** | **update** | **lookup** | **getnext** | - **delete** | **pin** | **event_pipe** | **help** } + **delete** | **pin** | **event_pipe** | **help** } *PROG-COMMANDS* := { **show** | **list** | **dump jited** | **dump xlated** | **pin** | - **load** | **attach** | **detach** | **help** } + **load** | **attach** | **detach** | **help** } *CGROUP-COMMANDS* := { **show** | **list** | **attach** | **detach** | **help** }
Greg Kroah-Hartman
maintainerPATCH 940/1039 xdp: check prog type before updating BPF link
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
commit 382778edc8262b7535f00523e9eb22edba1b9816 upstream.
The bpf_xdp_link_update() function didn't check the program type before updating the program, which made it possible to install any program type as an XDP program, which is obviously not good. Syzbot managed to trigger this by swapping in an LWT program on the XDP hook which would crash in a helper call.
Fix this by adding a check and bailing out if the types don't match.
--- net/core/dev.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/core/dev.c +6 -0
@@ -9656,6 +9656,12 @@ static int bpf_xdp_link_update(struct bp goto out_unlock; } old_prog = link->prog; +if (old_prog->type != new_prog->type || + old_prog->expected_attach_type != new_prog->expected_attach_type) { + err = -EINVAL ; + goto out_unlock; + } +if (old_prog == new_prog) {/* no-op, don't disturb drivers */ bpf_prog_put (new_prog);
Greg Kroah-Hartman
maintainerPATCH 941/1039 bpf: Fix mount source show for bpffs
In reply to Greg Kroah-HartmanFrom: Yafang Shao <[email protected]>
commit 1e9d74660d4df625b0889e77018f9e94727ceacd upstream.
We noticed our tc ebpf tools can't start after we upgrade our in-house kernel version from 4.19 to 5.10. That is because of the behaviour change in bpffs caused by commit d2935de7e4fd ("vfs: Convert bpf to use the new mount API").
In our tc ebpf tools, we do strict environment check. If the environment is not matched, we won't allow to start the ebpf progs. One of the check is whether bpffs is properly mounted. The mount information of bpffs in kernel-4.19 and kernel-5.10 are as follows:
- kernel 4.19
$ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf bpffs on /sys/fs/bpf type bpf (rw,relatime)
- kernel 5.10
$ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf none on /sys/fs/bpf type bpf (rw,relatime)
The device name in kernel-5.10 is displayed as none instead of bpffs, then our environment check fails. Currently we modify the tools to adopt to the kernel behaviour change, but I think we'd better change the kernel code to keep the behavior consistent.
After this change, the mount information will be displayed the same with the behavior in kernel-4.19, for example:
$ mount -t bpf bpffs /sys/fs/bpf $ mount -t bpf bpffs on /sys/fs/bpf type bpf (rw,relatime)
--- kernel/bpf/inode.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
kernel/bpf/inode.c +12 -2
@@ -648,12 +648,22 @@ static int bpf_parse_param(struct fs_conint opt; opt =fs_parse (fc, bpf_fs_parameters, param, &result); -if (opt <0 ) +if (opt <0 ) {/* We might like to report bad mount options here, but * traditionally we've ignored all mount options, so we'd * better continue to ignore non-existing options for bpf. */ -return opt == -ENOPARAM ?0 : opt; +if (opt == -ENOPARAM ) { + opt =vfs_parse_fs_param_source (fc, param); +if (opt != -ENOPARAM ) +return opt; + +return 0 ; + } + +if (opt <0 ) +return opt; + }switch (opt) {case OPT_MODE :
Greg Kroah-Hartman
maintainerPATCH 942/1039 bpf: Mark PTR_TO_FUNC register initially with zero offset
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit d400a6cf1c8a57cdf10f35220ead3284320d85ff upstream.
Similar as with other pointer types where we use ldimm64, clear the register content to zero first, and then populate the PTR_TO_FUNC type and subprogno number. Currently this is not done, and leads to reuse of stale register tracking data.
Given for special ldimm64 cases we always clear the register offset, make it common for all cases, so it won't be forgotten in future.
--- kernel/bpf/verifier.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/verifier.c +6 -3
@@ -9389,9 +9389,13 @@ static int check_ld_imm(struct bpf_verifreturn 0 ; } -if (insn->src_reg ==BPF_PSEUDO_BTF_ID ) { -mark_reg_known_zero (env, regs, insn->dst_reg); +/* All special src_reg cases are listed below. From this point onwards +* we either succeed and assign a corresponding dst_reg->type after +* zeroing the offset, or fail and reject the program. +*/ +mark_reg_known_zero (env, regs, insn->dst_reg); +if (insn->src_reg ==BPF_PSEUDO_BTF_ID ) { dst_reg->type = aux->btf_var.reg_type;switch (dst_reg->type) {case PTR_TO_MEM :
@@ -9429,7 +9433,6 @@ static int check_ld_imm(struct bpf_verif } map = env->used_maps[aux->map_index]; -mark_reg_known_zero (env, regs, insn->dst_reg); dst_reg->map_ptr = map; if (insn->src_reg == BPF_PSEUDO_MAP_VALUE ||
Greg Kroah-Hartman
maintainerPATCH 943/1039 perf evsel: Override attr->sample_period for non-libpfm4 events
In reply to Greg Kroah-HartmanFrom: German Gomez <[email protected]>
commit 3606c0e1a1050d397ad759a62607e419fd8b0ccb upstream.
A previous patch preventing "attr->sample_period" values from being overridden in pfm events changed a related behaviour in arm-spe.
Before said patch:
perf record -c 10000 -e arm_spe_0// -- sleep 1
Would yield an SPE event with period=10000. After the patch, the period in "-c 10000" was being ignored because the arm-spe code initializes sample_period to a non-zero value.
This patch restores the previous behaviour for non-libpfm4 events.
--- tools/perf/util/evsel.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
tools/perf/util/evsel.c +17 -8
@@ -1064,6 +1064,17 @@ void __weak arch_evsel__fixup_new_cycles { } +static void evsel__set_default_freq_period (struct record_opts *opts, +struct perf_event_attr *attr) +{ +if (opts->freq) { + attr->freq =1 ; + attr->sample_freq = opts->freq; + }else { + attr->sample_period = opts->default_interval; + } +} +/* * The enable_on_exec/disabled value strategy: *
@@ -1130,14 +1141,12 @@ void evsel__config(struct evsel *evsel,* We default some events to have a default interval. But keep * it a weak assumption overridable by the user. */ -if (!attr->sample_period) { -if (opts->freq) { - attr->freq =1 ; - attr->sample_freq = opts->freq; - }else { - attr->sample_period = opts->default_interval; - } - } +if ((evsel->is_libpfm_event && !attr->sample_period) || + (!evsel->is_libpfm_event && (!attr->sample_period || + opts->user_freq !=UINT_MAX || + opts->user_interval !=ULLONG_MAX ))) +evsel__set_default_freq_period (opts, attr); +/* * If attr->freq was set (here or earlier), ask for period * to be sampled.
Greg Kroah-Hartman
maintainerPATCH 944/1039 ipv4: update fib_info_cnt under spinlock protection
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 0a6e6b3c7db6c34e3d149f09cd714972f8753e3f upstream.
In the past, free_fib_info() was supposed to be called under RTNL protection.
This eventually was no longer the case.
Instead of enforcing RTNL it seems we simply can move fib_info_cnt changes to occur when fib_info_lock is held.
v2: David Laight suggested to update fib_info_cnt only when an entry is added/deleted to/from the hash table, as fib_info_cnt is used to make sure hash table size is optimal.
BUG: KCSAN: data-race in fib_create_info / free_fib_info
write to 0xffffffff86e243a0 of 4 bytes by task 26429 on cpu 0:
fib_create_info+0xe78/0x3440 net/ipv4/fib_semantics.c:1428 fib_table_insert+0x148/0x10c0 net/ipv4/fib_trie.c:1224 fib_magic+0x195/0x1e0 net/ipv4/fib_frontend.c:1087 fib_add_ifaddr+0xd0/0x2e0 net/ipv4/fib_frontend.c:1109 fib_netdev_event+0x178/0x510 net/ipv4/fib_frontend.c:1466 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x53/0xb0 kernel/notifier.c:391 __dev_notify_flags+0x1d3/0x3b0 dev_change_flags+0xa2/0xc0 net/core/dev.c:8872 do_setlink+0x810/0x2410 net/core/rtnetlink.c:2719 rtnl_group_changelink net/core/rtnetlink.c:3242 [inline] __rtnl_newlink net/core/rtnetlink.c:3396 [inline] rtnl_newlink+0xb10/0x13b0 net/core/rtnetlink.c:3506 rtnetlink_rcv_msg+0x745/0x7e0 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x14e/0x250 net/netlink/af_netlink.c:2496 rtnetlink_rcv+0x18/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x5fc/0x6c0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x726/0x840 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmsg+0x195/0x230 net/socket.c:2492 __do_sys_sendmsg net/socket.c:2501 [inline] __se_sys_sendmsg net/socket.c:2499 [inline] __x64_sys_sendmsg+0x42/0x50 net/socket.c:2499 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffffffff86e243a0 of 4 bytes by task 31505 on cpu 1:
free_fib_info+0x35/0x80 net/ipv4/fib_semantics.c:252 fib_info_put include/net/ip_fib.h:575 [inline] nsim_fib4_rt_destroy drivers/net/netdevsim/fib.c:294 [inline] nsim_fib4_rt_replace drivers/net/netdevsim/fib.c:403 [inline] nsim_fib4_rt_insert drivers/net/netdevsim/fib.c:431 [inline] nsim_fib4_event drivers/net/netdevsim/fib.c:461 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:881 [inline] nsim_fib_event_work+0x15ca/0x2cf0 drivers/net/netdevsim/fib.c:1477 process_one_work+0x3fc/0x980 kernel/workqueue.c:2298 process_scheduled_works kernel/workqueue.c:2361 [inline] worker_thread+0x7df/0xa70 kernel/workqueue.c:2447 kthread+0x2c7/0x2e0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30
value changed: 0x00000d2d -> 0x00000d2e
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 31505 Comm: kworker/1:21 Not tainted 5.16.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events nsim_fib_event_work
--- net/ipv4/fib_semantics.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/ipv4/fib_semantics.c +8 -3
@@ -249,7 +249,6 @@ void free_fib_info(struct fib_info *fi)pr_warn ("Freeing alive fib_info %p\n" , fi);return ; } - fib_info_cnt--;call_rcu (&fi->rcu, free_fib_info_rcu); }
@@ -260,6 +259,10 @@ void fib_release_info(struct fib_info *fspin_lock_bh (&fib_info_lock);if (fi &&refcount_dec_and_test (&fi->fib_treeref)) {hlist_del (&fi->fib_hash); + +/* Paired with READ_ONCE() in fib_create_info(). */ +WRITE_ONCE (fib_info_cnt, fib_info_cnt -1 ); +if (fi->fib_prefsrc)hlist_del (&fi->fib_lhash);if (fi->nh) {
@@ -1430,7 +1433,9 @@ struct fib_info *fib_create_info(struct#endif err = -ENOBUFS ; -if (fib_info_cnt >= fib_info_hash_size) { + +/* Paired with WRITE_ONCE() in fib_release_info() */ +if (READ_ONCE (fib_info_cnt) >= fib_info_hash_size) {unsigned int new_size = fib_info_hash_size <<1 ;struct hlist_head *new_info_hash;struct hlist_head *new_laddrhash;
@@ -1462,7 +1467,6 @@ struct fib_info *fib_create_info(structreturn ERR_PTR (err); } - fib_info_cnt++; fi->fib_net = net; fi->fib_protocol = cfg->fc_protocol; fi->fib_scope = cfg->fc_scope;
@@ -1589,6 +1593,7 @@ link_it:refcount_set (&fi->fib_treeref,1 );refcount_set (&fi->fib_clntref,1 );spin_lock_bh (&fib_info_lock); + fib_info_cnt++;hlist_add_head (&fi->fib_hash, &fib_info_hash[fib_info_hashfn (fi)]);if (fi->fib_prefsrc) {
Greg Kroah-Hartman
maintainerPATCH 945/1039 ipv4: avoid quadratic behavior in netns dismantle
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit d07418afea8f1d9896aaf9dc5ae47ac4f45b220c upstream.
net/ipv4/fib_semantics.c uses an hash table of 256 slots, keyed by device ifindexes: fib_info_devhash[DEVINDEX_HASHSIZE]
Problem is that with network namespaces, devices tend to use the same ifindex.
lo device for instance has a fixed ifindex of one, for all network namespaces.
This means that hosts with thousands of netns spend a lot of time looking at some hash buckets with thousands of elements, notably at netns dismantle.
Simply add a per netns perturbation (net_hash_mix()) to spread elements more uniformely.
Also change fib_devindex_hashfn() to use more entropy.
--- net/ipv4/fib_semantics.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-)
net/ipv4/fib_semantics.c +17 -19
@@ -29,6 +29,7 @@#include <linux/init.h> #include <linux/slab.h> #include <linux/netlink.h> +#include <linux/hash.h> #include <net/arp.h> #include <net/ip.h>
@@ -319,11 +320,15 @@ static inline int nh_comp(struct fib_infstatic inline unsigned int fib_devindex_hashfn (unsigned int val) { -unsigned int mask =DEVINDEX_HASHSIZE -1 ; +return hash_32 (val,DEVINDEX_HASHBITS ); +} + +static struct hlist_head * +fib_info_devhash_bucket (const struct net_device *dev) +{ +u32 val =net_hash_mix (dev_net (dev)) ^ dev->ifindex; -return (val ^ - (val >>DEVINDEX_HASHBITS ) ^ - (val >> (DEVINDEX_HASHBITS *2 ))) & mask; +return &fib_info_devhash[fib_devindex_hashfn (val)]; } static unsigned int fib_info_hashfn_1(int init_val, u8 protocol, u8 scope,
@@ -433,12 +438,11 @@ int ip_fib_check_default(__be32 gw, stru {struct hlist_head *head;struct fib_nh *nh; -unsigned int hash;spin_lock (&fib_info_lock); - hash =fib_devindex_hashfn (dev->ifindex); - head = &fib_info_devhash[hash]; + head =fib_info_devhash_bucket (dev); +hlist_for_each_entry (nh, head, nh_hash) { if (nh->fib_nh_dev == dev && nh->fib_nh_gw4 == gw &&
@@ -1607,12 +1611,10 @@ link_it: }else {change_nexthops (fi) {struct hlist_head *head; -unsigned int hash;if (!nexthop_nh->fib_nh_dev)continue ; - hash =fib_devindex_hashfn (nexthop_nh->fib_nh_dev->ifindex); - head = &fib_info_devhash[hash]; + head =fib_info_devhash_bucket (nexthop_nh->fib_nh_dev);hlist_add_head (&nexthop_nh->nh_hash, head); } endfor_nexthops(fi) }
@@ -1964,8 +1966,7 @@ void fib_nhc_update_mtu(struct fib_nh_covoid fib_sync_mtu (struct net_device *dev,u32 orig_mtu) { -unsigned int hash =fib_devindex_hashfn (dev->ifindex); -struct hlist_head *head = &fib_info_devhash[hash]; +struct hlist_head *head =fib_info_devhash_bucket (dev);struct fib_nh *nh;hlist_for_each_entry (nh, head, nh_hash) {
@@ -1984,12 +1985,11 @@ void fib_sync_mtu(struct net_device *dev*/ int fib_sync_down_dev (struct net_device *dev,unsigned long event,bool force) { -int ret =0 ; -int scope =RT_SCOPE_NOWHERE ; +struct hlist_head *head =fib_info_devhash_bucket (dev);struct fib_info *prev_fi =NULL ; -unsigned int hash =fib_devindex_hashfn (dev->ifindex); -struct hlist_head *head = &fib_info_devhash[hash]; +int scope =RT_SCOPE_NOWHERE ;struct fib_nh *nh; +int ret =0 ;if (force) scope =-1 ;
@@ -2134,7 +2134,6 @@ out:int fib_sync_up (struct net_device *dev,unsigned char nh_flags) {struct fib_info *prev_fi; -unsigned int hash;struct hlist_head *head;struct fib_nh *nh;int ret;
@@ -2150,8 +2149,7 @@ int fib_sync_up(struct net_device *dev, } prev_fi =NULL ; - hash =fib_devindex_hashfn (dev->ifindex); - head = &fib_info_devhash[hash]; + head =fib_info_devhash_bucket (dev); ret =0 ;hlist_for_each_entry (nh, head, nh_hash) {
Greg Kroah-Hartman
maintainerPATCH 946/1039 mlx5: Dont accidentally set RTO_ONLINK before mlx5e_route_lookup_ipv4_get()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit 48d67543e01d73292e0bb66d3f10fc422e79e031 upstream.
Mask the ECN bits before calling mlx5e_route_lookup_ipv4_get(). The tunnel key might have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope).
Found by code inspection, compile tested only.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +3 -2
@@ -1,6 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* Copyright (c) 2018 Mellanox Technologies. */ +#include <net/inet_ecn.h> #include <net/vxlan.h> #include <net/gre.h> #include <net/geneve.h>
@@ -235,7 +236,7 @@ int mlx5e_tc_tun_create_header_ipv4(struint err;/* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos; + attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK ; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl;
@@ -350,7 +351,7 @@ int mlx5e_tc_tun_update_header_ipv4(struint err;/* add the IP fields */ - attr.fl.fl4.flowi4_tos = tun_key->tos; + attr.fl.fl4.flowi4_tos = tun_key->tos & ~INET_ECN_MASK ; attr.fl.fl4.daddr = tun_key->u.ipv4.dst; attr.fl.fl4.saddr = tun_key->u.ipv4.src; attr.ttl = tun_key->ttl;
Greg Kroah-Hartman
maintainerPATCH 947/1039 net/fsl: xgmac_mdio: Add workaround for erratum A-009885
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
commit 6198c722019774d38018457a8bfb9ba3ed8c931e upstream.
Once an MDIO read transaction is initiated, we must read back the data register within 16 MDC cycles after the transaction completes. Outside of this window, reads may return corrupt data.
Therefore, disable local interrupts in the critical section, to maximize the probability that we can satisfy this requirement.
--- drivers/net/ethernet/freescale/xgmac_mdio.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/xgmac_mdio.c +19 -6
@@ -51,6 +51,7 @@ struct tgec_mdio_controller {struct mdio_fsl_priv {struct tgec_mdio_controller __iomem *mdio_base;bool is_little_endian; +bool has_a009885;bool has_a011043; };
@@ -186,10 +187,10 @@ static int xgmac_mdio_read(struct mii_bu {struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv;struct tgec_mdio_controller __iomem *regs = priv->mdio_base; +unsigned long flags;uint16_t dev_addr;uint32_t mdio_stat;uint32_t mdio_ctl; -uint16_t value;int ret;bool endian = priv->is_little_endian;
@@ -221,12 +222,18 @@ static int xgmac_mdio_read(struct mii_bureturn ret; } +if (priv->has_a009885) +/* Once the operation completes, i.e. MDIO_STAT_BSY clears, we +* must read back the data register within 16 MDC cycles. +*/ +local_irq_save (flags); +/* Initiate the read */ xgmac_write32 (mdio_ctl |MDIO_CTL_READ , ®s->mdio_ctl, endian); ret =xgmac_wait_until_done (&bus->dev, regs, endian);if (ret) -return ret; + goto irq_restore;/* Return all Fs if nothing was there */ if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
@@ -234,13 +241,17 @@ static int xgmac_mdio_read(struct mii_budev_dbg (&bus->dev,"Error while reading PHY%d reg at %d.%hhu\n" , phy_id, dev_addr, regnum); -return 0xffff ; + ret =0xffff ; + }else { + ret =xgmac_read32 (®s->mdio_data, endian) &0xffff ; +dev_dbg (&bus->dev,"read %04x\n" , ret); } - value =xgmac_read32 (®s->mdio_data, endian) &0xffff ; -dev_dbg (&bus->dev,"read %04x\n" , value); +irq_restore: +if (priv->has_a009885) +local_irq_restore (flags); -return value; +return ret; }static int xgmac_mdio_probe (struct platform_device *pdev)
@@ -287,6 +298,8 @@ static int xgmac_mdio_probe(struct platf priv->is_little_endian =device_property_read_bool (&pdev->dev,"little-endian" ); + priv->has_a009885 =device_property_read_bool (&pdev->dev, +"fsl,erratum-a009885" ); priv->has_a011043 =device_property_read_bool (&pdev->dev,"fsl,erratum-a011043" );
Greg Kroah-Hartman
maintainerPATCH 948/1039 net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
commit 3f7c239c7844d2044ed399399d97a5f1c6008e1b upstream.
As reported by sparse: In the remove path, the driver would attempt to unmap its own priv pointer - instead of the io memory that it mapped in probe.
--- drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/xgmac_mdio.c +2 -1
@@ -331,9 +331,10 @@ err_ioremap:static int xgmac_mdio_remove (struct platform_device *pdev) {struct mii_bus *bus =platform_get_drvdata (pdev); +struct mdio_fsl_priv *priv = bus->priv;mdiobus_unregister (bus); -iounmap (bus->priv); +iounmap (priv->mdio_base);mdiobus_free (bus);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 949/1039 parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit d24846a4246b6e61ecbd036880a4adf61681d241 upstream.
kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
--- drivers/parisc/pdc_stable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/parisc/pdc_stable.c +3 -1
@@ -979,8 +979,10 @@ pdcs_register_pathentries(void) entry->kobj.kset = paths_kset; err =kobject_init_and_add (&entry->kobj, &ktype_pdcspath,NULL ,"%s" , entry->name); -if (err) +if (err) { +kobject_put (&entry->kobj);return err; + }/* kobject is now registered */ write_lock (&entry->rw_lock);
Greg Kroah-Hartman
maintainerPATCH 950/1039 RISC-V: defconfigs: Set CONFIG_FB=y, for FB console
In reply to Greg Kroah-HartmanFrom: Palmer Dabbelt <[email protected]>
commit 3d12b634fe8206ea974c6061a3f3eea529ffbc48 upstream.
We have CONFIG_FRAMEBUFFER_CONSOLE=y in the defconfigs, but that depends on CONFIG_FB so it's not actually getting set. I'm assuming most users on real systems want a framebuffer console, so this enables CONFIG_FB to allow that to take effect.
--- arch/riscv/configs/defconfig | 1 + arch/riscv/configs/rv32_defconfig | 1 + 2 files changed, 2 insertions(+)
arch/riscv/configs/defconfig +1 -0
@@ -78,6 +78,7 @@ CONFIG_DRM=m CONFIG_DRM_RADEON=m CONFIG_DRM_NOUVEAU=m CONFIG_DRM_VIRTIO_GPU=m +CONFIG_FB=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y
arch/riscv/configs/rv32_defconfig +1 -0
@@ -73,6 +73,7 @@ CONFIG_POWER_RESET=y CONFIG_DRM=y CONFIG_DRM_RADEON=y CONFIG_DRM_VIRTIO_GPU=y +CONFIG_FB=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y
Greg Kroah-Hartman
maintainerPATCH 951/1039 riscv: dts: microchip: mpfs: Drop empty chosen node
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
commit 53ef07326ad0d6ae7fefded22bc53b427d542761 upstream.
It does not make sense to have an (empty) chosen node in an SoC-specific .dtsi, as chosen is meant for system-specific configuration. It is already provided in microchip-mpfs-icicle-kit.dts anyway.
--- arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +0 -3
@@ -9,9 +9,6 @@ model = "Microchip PolarFire SoC"; compatible = "microchip,mpfs"; - chosen { - }; - cpus { #address-cells = <1>; #size-cells = <0>;
Greg Kroah-Hartman
maintainerPATCH 952/1039 drm/vmwgfx: Remove explicit transparent hugepages support
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
commit bc701a28c74e78d7b5aa2b8628cb3608d4785d14 upstream.
Old versions of the svga device used to export virtual vram, handling of which was optimized on top of transparent hugepages support. Only very old devices (OpenGL 2.1 support and earlier) used this code and at this point performance differences are negligible.
Because the code requires very old hardware versions to run it has been largely untested and unused for a long time.
Furthermore removal of the ttm hugepages support in:
commit 0d979509539e ("drm/ttm: remove ttm_bo_vm_insert_huge()") broke the coherency mode in vmwgfx when running with hugepages.
--- drivers/gpu/drm/vmwgfx/Makefile | 1 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 5 drivers/gpu/drm/vmwgfx/vmwgfx_thp.c | 184 ------------------------------------ 4 files changed, 198 deletions(-) delete mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
drivers/gpu/drm/vmwgfx/Makefile +0 -1
@@ -12,6 +12,5 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr. vmwgfx_devcaps.o ttm_object.o ttm_memory.o vmwgfx_system_manager.o vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) += vmwgfx_fb.o -vmwgfx-$(CONFIG_TRANSPARENT_HUGEPAGE) += vmwgfx_thp.o obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -8
@@ -707,23 +707,15 @@ static int vmw_dma_masks(struct vmw_privstatic int vmw_vram_manager_init (struct vmw_private *dev_priv) {int ret; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - ret =vmw_thp_init (dev_priv); -#else ret =ttm_range_man_init (&dev_priv->bdev,TTM_PL_VRAM , false, dev_priv->vram_size >>PAGE_SHIFT ); -#endif ttm_resource_manager_set_used (ttm_manager_type (&dev_priv->bdev,TTM_PL_VRAM ), false);return ret; }static void vmw_vram_manager_fini (struct vmw_private *dev_priv) { -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -vmw_thp_fini (dev_priv); -#else ttm_range_man_fini (&dev_priv->bdev,TTM_PL_VRAM ); -#endif } static int vmw_setup_pci_resources(struct vmw_private *dev,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -5
@@ -1557,11 +1557,6 @@ void vmw_bo_dirty_unmap(struct vmw_buffevm_fault_t vmw_bo_vm_fault (struct vm_fault *vmf);vm_fault_t vmw_bo_vm_mkwrite (struct vm_fault *vmf); -/* Transparent hugepage support - vmwgfx_thp.c */ -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -extern int vmw_thp_init (struct vmw_private *dev_priv); -void vmw_thp_fini (struct vmw_private *dev_priv); -#endif /** * VMW_DEBUG_KMS - Debug output for kernel mode-setting
drivers/gpu/drm/vmwgfx/vmwgfx_thp.c deleted +0 -184
184 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 953/1039 drm/vmwgfx: Remove unused compile options
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
commit 50ca8cc7c0fdd9ab16b8b66ffb301fface101fac upstream.
Before the driver had screen targets support we had to disable explicit bringup of its infrastructure because it was breaking screen objects support.
Since the implementation of screen targets landed there hasn't been a reason to explicitly disable it and the options were never used. Remove of all that unused code.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 3 --- drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | 12 +++--------- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- 3 files changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -3
@@ -59,11 +59,8 @@#define VMWGFX_DRIVER_MINOR 19#define VMWGFX_DRIVER_PATCHLEVEL 0#define VMWGFX_FIFO_STATIC_SIZE (1024*1024) -#define VMWGFX_MAX_RELOCATIONS 2048 -#define VMWGFX_MAX_VALIDATIONS 2048#define VMWGFX_MAX_DISPLAYS 16#define VMWGFX_CMD_BOUNCE_INIT_SIZE 32768 -#define VMWGFX_ENABLE_SCREEN_TARGET_OTABLE 1#define VMWGFX_PCI_ID_SVGA2 0x0405#define VMWGFX_PCI_ID_SVGA3 0x0406
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +3 -9
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR MIT /************************************************************************** * -* Copyright 2012-2015 VMware, Inc., Palo Alto, CA., USA +* Copyright 2012-2021 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the
@@ -29,12 +29,6 @@#include "vmwgfx_drv.h" -/* -* If we set up the screen target otable, screen objects stop working. -*/ - -#define VMW_OTABLE_SETUP_SUB ((VMWGFX_ENABLE_SCREEN_TARGET_OTABLE ? 0 : 1)) -#ifdef CONFIG_64BIT #define VMW_PPN_SIZE 8#define VMW_MOBFMT_PTDEPTH_0 SVGA3D_MOBFMT_PT64_0
@@ -75,7 +69,7 @@ static const struct vmw_otable pre_dx_ta {VMWGFX_NUM_GB_CONTEXT * sizeof(SVGAOTableContextEntry), NULL, true}, {VMWGFX_NUM_GB_SHADER * sizeof(SVGAOTableShaderEntry), NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * sizeof(SVGAOTableScreenTargetEntry), - NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE} + NULL, true} }; static const struct vmw_otable dx_tables[] = {
@@ -84,7 +78,7 @@ static const struct vmw_otable dx_tables {VMWGFX_NUM_GB_CONTEXT * sizeof(SVGAOTableContextEntry), NULL, true}, {VMWGFX_NUM_GB_SHADER * sizeof(SVGAOTableShaderEntry), NULL, true}, {VMWGFX_NUM_GB_SCREEN_TARGET * sizeof(SVGAOTableScreenTargetEntry), - NULL, VMWGFX_ENABLE_SCREEN_TARGET_OTABLE}, + NULL, true}, {VMWGFX_NUM_DXCONTEXT * sizeof(SVGAOTableDXContextEntry), NULL, true}, };
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +2 -2
@@ -1872,8 +1872,8 @@ int vmw_kms_stdu_init_display(struct vmwint i, ret; -/* Do nothing if Screen Target support is turned off */ -if (!VMWGFX_ENABLE_SCREEN_TARGET_OTABLE || !dev_priv->has_mob) +/* Do nothing if there's no support for MOBs */ +if (!dev_priv->has_mob)return -ENOSYS ;if (!(dev_priv->capabilities &SVGA_CAP_GBOBJECTS ))
Greg Kroah-Hartman
maintainerPATCH 954/1039 f2fs: fix remove page failed in invalidate compress pages
In reply to Greg Kroah-HartmanFrom: Fengnan Chang <[email protected]>
commit d1917865a7906baf6b687e15e8e6195a295a3992 upstream.
Since compress inode not a regular file, generic_error_remove_page in f2fs_invalidate_compress_pages will always be failed, set compress inode as a regular file to fix it.
--- fs/f2fs/inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/f2fs/inode.c +5 -0
@@ -516,6 +516,11 @@ make_now: }else if (ino ==F2FS_COMPRESS_INO (sbi)) {#ifdef CONFIG_F2FS_FS_COMPRESSION inode->i_mapping->a_ops = &f2fs_compress_aops; +/* +* generic_error_remove_page only truncates pages of regular +* inode +*/ + inode->i_mode |=S_IFREG ;#endif mapping_set_gfp_mask (inode->i_mapping,GFP_NOFS | __GFP_HIGHMEM | __GFP_MOVABLE);
Greg Kroah-Hartman
maintainerPATCH 955/1039 f2fs: fix to avoid panic in is_alive() if metadata is inconsistent
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit f6db43076d190d9bf75559dec28e18b9d12e4ce5 upstream.
As report by Wenqing Liu in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=215231
If we enable CONFIG_F2FS_CHECK_FS config, and with fuzzed image attached in above link, we will encounter panic when executing below script:
1. mkdir mnt
2. mount -t f2fs tmp1.img mnt
3. touch tmp
F2FS-fs (loop11): mismatched blkaddr 5765 (source_blkaddr 1) in seg 3 kernel BUG at fs/f2fs/gc.c:1042!
do_garbage_collect+0x90f/0xa80 [f2fs] f2fs_gc+0x294/0x12a0 [f2fs] f2fs_balance_fs+0x2c5/0x7d0 [f2fs] f2fs_create+0x239/0xd90 [f2fs] lookup_open+0x45e/0xa90 open_last_lookups+0x203/0x670 path_openat+0xae/0x490 do_filp_open+0xbc/0x160 do_sys_openat2+0x2f1/0x500 do_sys_open+0x5e/0xa0 __x64_sys_openat+0x28/0x40
Previously, f2fs tries to catch data inconcistency exception in between SSA and SIT table during GC, however once the exception is caught, it will call f2fs_bug_on to hang kernel, it's not needed, instead, let's set SBI_NEED_FSCK flag and skip migrating current block.
--- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
@@ -1042,7 +1042,7 @@ static bool is_alive(struct f2fs_sb_infoif (!test_and_set_bit (segno,SIT_I (sbi)->invalid_segmap)) {f2fs_err (sbi,"mismatched blkaddr %u (source_blkaddr %u) in seg %u" , blkaddr, source_blkaddr, segno); -f2fs_bug_on (sbi,1 ); +set_sbi_flag (sbi,SBI_NEED_FSCK ); } }#endif
Greg Kroah-Hartman
maintainerPATCH 956/1039 f2fs: compress: fix potential deadlock of compress file
In reply to Greg Kroah-HartmanFrom: Hyeong-Jun Kim <[email protected]>
commit 7377e853967ba45bf409e3b5536624d2cbc99f21 upstream.
There is a potential deadlock between writeback process and a process performing write_begin() or write_cache_pages() while trying to write same compress file, but not compressable, as below:
[Process A] - doing checkpoint
[Process B] [Process C]f2fs_write_cache_pages()
- lock_page() [all pages in cluster, 0-31]
- f2fs_write_multi_pages()
- f2fs_write_raw_pages()
- f2fs_write_single_data_page()
- f2fs_do_write_data_page()
- return -EAGAIN [f2fs_trylock_op() failed]
- unlock_page(page) [e.g., page 0]
- generic_perform_write()
- f2fs_write_begin()
- f2fs_prepare_compress_overwrite()
- prepare_compress_overwrite()
- lock_page() [e.g., page 0]
- lock_page() [e.g., page 1]
- lock_page(page) [e.g., page 0]
Since there is no compress process, it is no longer necessary to hold locks on every pages in cluster within f2fs_write_raw_pages().
This patch changes f2fs_write_raw_pages() to release all locks first and then perform write same as the non-compress file in f2fs_write_cache_pages().
--- fs/f2fs/compress.c | 50 ++++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 28 deletions(-)
fs/f2fs/compress.c +22 -28
@@ -1468,25 +1468,38 @@ static int f2fs_write_raw_pages(struct c enum iostat_type io_type) {struct address_space *mapping = cc->inode->i_mapping; -int _submitted, compr_blocks, ret; -int i =-1 , err =0 ; +int _submitted, compr_blocks, ret, i; compr_blocks =f2fs_compressed_blocks (cc); -if (compr_blocks <0 ) { - err = compr_blocks; - goto out_err; + +for (i =0 ; i < cc->cluster_size; i++) { +if (!cc->rpages[i]) +continue ; + +redirty_page_for_writepage (wbc, cc->rpages[i]); +unlock_page (cc->rpages[i]); } +if (compr_blocks <0 ) +return compr_blocks; +for (i =0 ; i < cc->cluster_size; i++) {if (!cc->rpages[i])continue ; retry_write: +lock_page (cc->rpages[i]); +if (cc->rpages[i]->mapping != mapping) { +continue_unlock:unlock_page (cc->rpages[i]);continue ; } -BUG_ON (!PageLocked (cc->rpages[i])); +if (!PageDirty (cc->rpages[i])) + goto continue_unlock; + +if (!clear_page_dirty_for_io (cc->rpages[i])) + goto continue_unlock; ret = f2fs_write_single_data_page(cc->rpages[i], &_submitted, NULL, NULL, wbc, io_type,
@@ -1501,26 +1514,15 @@ retry_write:* avoid deadlock caused by cluster update race * from foreground operation. */ -if (IS_NOQUOTA (cc->inode)) { - err =0 ; - goto out_err; - } +if (IS_NOQUOTA (cc->inode)) +return 0 ; ret =0 ;cond_resched ();congestion_wait (BLK_RW_ASYNC ,DEFAULT_IO_TIMEOUT ); -lock_page (cc->rpages[i]); - -if (!PageDirty (cc->rpages[i])) { -unlock_page (cc->rpages[i]); -continue ; - } - -clear_page_dirty_for_io (cc->rpages[i]); goto retry_write; } - err = ret; - goto out_err; +return ret; } *submitted += _submitted;
@@ -1529,14 +1531,6 @@ retry_write:f2fs_balance_fs (F2FS_M_SB (mapping), true);return 0 ; -out_err: -for (++i; i < cc->cluster_size; i++) { -if (!cc->rpages[i]) -continue ; -redirty_page_for_writepage (wbc, cc->rpages[i]); -unlock_page (cc->rpages[i]); - } -return err; } int f2fs_write_multi_pages(struct compress_ctx *cc,
Greg Kroah-Hartman
maintainerPATCH 957/1039 f2fs: fix to reserve space for IO align feature
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 300a842937fbcfb5a189cea9ba15374fdb0b5c6b upstream.
https://bugzilla.kernel.org/show_bug.cgi?id=204137
With below script, we will hit panic during new segment allocation:
DISK=bingo.img
MOUNT_DIR=/mnt/f2fs
dd if=/dev/zero of=$DISK bs=1M count=105
mkfs.f2fe -a 1 -o 19 -t 1 -z 1 -f -q $DISK
mount -t f2fs $DISK $MOUNT_DIR -o "noinline_dentry,flush_merge,noextent_cache,mode=lfs,io_bits=7,fsync_mode=strict"
for (( i = 0; i < 4096; i++ )); do
name=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10` mkdir $MOUNT_DIR/$name
done
umount $MOUNT_DIR
rm $DISK
--- fs/f2fs/f2fs.h | 11 +++++++++++ fs/f2fs/segment.h | 3 ++- fs/f2fs/super.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ fs/f2fs/sysfs.c | 4 +++- 4 files changed, 60 insertions(+), 2 deletions(-)
fs/f2fs/f2fs.h +11 -0
@@ -1018,6 +1018,7 @@ struct f2fs_sm_info {unsigned int segment_count;/* total # of segments */ unsigned int main_segments;/* # of segments in main area */ unsigned int reserved_segments;/* # of reserved segments */ +unsigned int additional_reserved_segments;/* reserved segs for IO align feature */ unsigned int ovp_segments;/* # of overprovision segments */ /* a threshold to reclaim prefree segments */
@@ -2198,6 +2199,11 @@ static inline int inc_valid_block_count(if (!__allow_reserved_blocks (sbi, inode, true)) avail_user_block_count -=F2FS_OPTION (sbi).root_reserved_blocks; + +if (F2FS_IO_ALIGNED (sbi)) + avail_user_block_count -= sbi->blocks_per_seg * +SM_I (sbi)->additional_reserved_segments; +if (unlikely (is_sbi_flag_set (sbi,SBI_CP_DISABLED ))) {if (avail_user_block_count > sbi->unusable_block_count) avail_user_block_count -= sbi->unusable_block_count;
@@ -2444,6 +2450,11 @@ static inline int inc_valid_node_count(sif (!__allow_reserved_blocks (sbi, inode, false)) valid_block_count +=F2FS_OPTION (sbi).root_reserved_blocks; + +if (F2FS_IO_ALIGNED (sbi)) + valid_block_count += sbi->blocks_per_seg * +SM_I (sbi)->additional_reserved_segments; + user_block_count = sbi->user_block_count;if (unlikely (is_sbi_flag_set (sbi,SBI_CP_DISABLED ))) user_block_count -= sbi->unusable_block_count;
fs/f2fs/segment.h +2 -1
@@ -538,7 +538,8 @@ static inline unsigned int free_segmentsstatic inline unsigned int reserved_segments (struct f2fs_sb_info *sbi) { -return SM_I (sbi)->reserved_segments; +return SM_I (sbi)->reserved_segments + +SM_I (sbi)->additional_reserved_segments; }static inline unsigned int free_sections (struct f2fs_sb_info *sbi)
fs/f2fs/super.c +44 -0
56 lines not on this page · raw message
fs/f2fs/sysfs.c +3 -1
@@ -415,7 +415,9 @@ out:if (a->struct_type ==RESERVED_BLOCKS ) {spin_lock (&sbi->stat_lock);if (t > (unsigned long )(sbi->user_block_count - -F2FS_OPTION (sbi).root_reserved_blocks)) { +F2FS_OPTION (sbi).root_reserved_blocks - + sbi->blocks_per_seg * +SM_I (sbi)->additional_reserved_segments)) {spin_unlock (&sbi->stat_lock);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 958/1039 f2fs: fix to check available space of CP area correctly in update_ckpt_flags()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit b702c83e2eaa2fa2d72e957c55c0321535cc8b9f upstream.
Otherwise, nat_bit area may be persisted across boundary of CP area during nat_bit rebuilding.
--- fs/f2fs/checkpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/checkpoint.c +2 -2
@@ -1302,8 +1302,8 @@ static void update_ckpt_flags(struct f2funsigned long flags;if (cpc->reason &CP_UMOUNT ) { -if (le32_to_cpu (ckpt->cp_pack_total_block_count) > - sbi->blocks_per_seg -NM_I (sbi)->nat_bits_blocks) { +if (le32_to_cpu (ckpt->cp_pack_total_block_count) + +NM_I (sbi)->nat_bits_blocks > sbi->blocks_per_seg) {clear_ckpt_flags (sbi,CP_NAT_BITS_FLAG );f2fs_notice (sbi,"Disable nat_bits due to no space" ); } else if (!is_set_ckpt_flags(sbi, CP_NAT_BITS_FLAG) &&
Greg Kroah-Hartman
maintainerPATCH 959/1039 crypto: octeontx2 - uninitialized variable in kvf_limits_store()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 0ea275df84c389e910a3575a9233075118c173ee upstream.
If kstrtoint() fails then "lfs_num" is uninitialized and the warning doesn't make any sense. Just delete it.
--- drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptpf_main.c +4 -5
@@ -494,12 +494,11 @@ static ssize_t kvf_limits_store(struct d {struct otx2_cptpf_dev *cptpf =dev_get_drvdata (dev);int lfs_num; +int ret; -if (kstrtoint (buf,0 , &lfs_num)) { -dev_err (dev,"lfs count %d must be in range [1 - %d]\n" , - lfs_num,num_online_cpus ()); -return -EINVAL ; - } + ret =kstrtoint (buf,0 , &lfs_num); +if (ret) +return ret;if (lfs_num <1 || lfs_num >num_online_cpus ()) {dev_err (dev,"lfs count %d must be in range [1 - %d]\n" , lfs_num,num_online_cpus ());
Greg Kroah-Hartman
maintainerPATCH 960/1039 af_unix: annote lockless accesses to unix_tot_inflight & gc_in_progress
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 9d6d7f1cb67cdee15f1a0e85aacfb924e0e02435 upstream.
wait_for_unix_gc() reads unix_tot_inflight & gc_in_progress without synchronization.
Adds READ_ONCE()/WRITE_ONCE() and their associated comments to better document the intent.
BUG: KCSAN: data-race in unix_inflight / wait_for_unix_gc
write to 0xffffffff86e2b7c0 of 4 bytes by task 9380 on cpu 0:
unix_inflight+0x1e8/0x260 net/unix/scm.c:63 unix_attach_fds+0x10c/0x1e0 net/unix/scm.c:121 unix_scm_to_skb net/unix/af_unix.c:1674 [inline] unix_dgram_sendmsg+0x679/0x16b0 net/unix/af_unix.c:1817 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffffffff86e2b7c0 of 4 bytes by task 9375 on cpu 1:
wait_for_unix_gc+0x24/0x160 net/unix/garbage.c:196 unix_dgram_sendmsg+0x8e/0x16b0 net/unix/af_unix.c:1772 unix_seqpacket_sendmsg+0xcc/0x110 net/unix/af_unix.c:2258 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2549 __do_sys_sendmmsg net/socket.c:2578 [inline] __se_sys_sendmmsg net/socket.c:2575 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x00000002 -> 0x00000004
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 9375 Comm: syz-executor.1 Not tainted 5.16.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/unix/garbage.c | 14 +++++++++++--- net/unix/scm.c | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-)
net/unix/garbage.c +11 -3
@@ -192,8 +192,11 @@ void wait_for_unix_gc(void) {/* If number of inflight sockets is insane, * force a garbage collect right now. +* Paired with the WRITE_ONCE() in unix_inflight(), +* unix_notinflight() and gc_in_progress(). */ -if (unix_tot_inflight >UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) +if (READ_ONCE (unix_tot_inflight) >UNIX_INFLIGHT_TRIGGER_GC && + !READ_ONCE (gc_in_progress))unix_gc ();wait_event (unix_gc_wait, gc_in_progress == false); }
@@ -213,7 +216,9 @@ void unix_gc(void)if (gc_in_progress) goto out; - gc_in_progress = true; +/* Paired with READ_ONCE() in wait_for_unix_gc(). */ +WRITE_ONCE (gc_in_progress, true); +/* First, select candidates for garbage collection. Only * in-flight sockets are considered, and from those only ones * which don't have any external reference.
@@ -299,7 +304,10 @@ void unix_gc(void)/* All candidates should have been detached by now. */ BUG_ON (!list_empty (&gc_candidates)); - gc_in_progress = false; + +/* Paired with READ_ONCE() in wait_for_unix_gc(). */ +WRITE_ONCE (gc_in_progress, false); +wake_up (&unix_gc_wait); out:
net/unix/scm.c +4 -2
@@ -60,7 +60,8 @@ void unix_inflight(struct user_struct *u }else {BUG_ON (list_empty (&u->link)); } - unix_tot_inflight++; +/* Paired with READ_ONCE() in wait_for_unix_gc() */ +WRITE_ONCE (unix_tot_inflight, unix_tot_inflight +1 ); } user->unix_inflight++;spin_unlock (&unix_gc_lock);
@@ -80,7 +81,8 @@ void unix_notinflight(struct user_structif (atomic_long_dec_and_test (&u->inflight))list_del_init (&u->link); - unix_tot_inflight--; +/* Paired with READ_ONCE() in wait_for_unix_gc() */ +WRITE_ONCE (unix_tot_inflight, unix_tot_inflight -1 ); } user->unix_inflight--;spin_unlock (&unix_gc_lock);
Greg Kroah-Hartman
maintainerPATCH 961/1039 clk: Emit a stern warning with writable debugfs enabled
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
commit 489a71964f9d74e697a12cd0ace20ed829eb1f93 upstream.
We don't want vendors to be enabling this part of the clk code and shipping it to customers. Exposing the ability to change clk frequencies and parents via debugfs is potentially damaging to the system if folks don't know what they're doing. Emit a strong warning so that the message is clear: don't enable this outside of development systems.
--- drivers/clk/clk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/clk/clk.c +18 -0
@@ -3343,6 +3343,24 @@ static int __init clk_debug_init(void) {struct clk_core *core; +#ifdef CLOCK_ALLOW_WRITE_DEBUGFS +pr_warn ("\n" ); +pr_warn ("********************************************************************\n" ); +pr_warn ("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** This means that this kernel is built to expose clk operations **\n" ); +pr_warn ("** such as parent or rate setting, enabling, disabling, etc. **\n" ); +pr_warn ("** to userspace, which may compromise security on your system. **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** If you see this message and you are not debugging the **\n" ); +pr_warn ("** kernel, report this immediately to your vendor! **\n" ); +pr_warn ("** **\n" ); +pr_warn ("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n" ); +pr_warn ("********************************************************************\n" ); +#endif + rootdir =debugfs_create_dir ("clk" ,NULL ); debugfs_create_file("clk_summary", 0444, rootdir, &all_lists,
Greg Kroah-Hartman
maintainerPATCH 962/1039 clk: si5341: Fix clock HW provider cleanup
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 49a8f2bc8d88702783c7e163ec84374e9a022f71 upstream.
The call to of_clk_add_hw_provider was not undone on remove or on probe failure, which could cause an oops on a subsequent attempt to retrieve clocks for the removed device. Switch to the devm version of the function to avoid this issue.
--- drivers/clk/clk-si5341.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-si5341.c +1 -1
@@ -1740,7 +1740,7 @@ static int si5341_probe(struct i2c_clienclk_prepare (data->clk[i].hw.clk); } - err =of_clk_add_hw_provider (client->dev.of_node, of_clk_si5341_get, + err =devm_of_clk_add_hw_provider (&client->dev, of_clk_si5341_get, data);if (err) {dev_err (&client->dev,"unable to add clk provider\n" );
Greg Kroah-Hartman
maintainerPATCH 963/1039 pinctrl/rockchip: fix gpio device creation
In reply to Greg Kroah-HartmanFrom: John Keeping <[email protected]>
commit bceb6732f3fd2a55d8f2e518cced1c7555e216b6 upstream.
GPIO nodes are not themselves busses, so passing rockchip_bank_match here is wrong. Passing NULL instead uses the standard bus match table which is more appropriate.
devm_of_platform_populate() shows that this is the normal way to call of_platform_populate() from a device driver, so in order to match that more closely also add the pinctrl device as the parent for the newly created GPIO controllers.
Specifically, using the wrong match here can break dynamic GPIO hogs as marking the GPIO bank as a bus means that of_platform_notify() will set OF_POPULATED on new child nodes and if this happens before of_gpio_notify() is called then the new hog will be skipped as OF_POPULATED is already set.
--- drivers/pinctrl/pinctrl-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-rockchip.c +1 -1
@@ -2748,7 +2748,7 @@ static int rockchip_pinctrl_probe(structplatform_set_drvdata (pdev, info); - ret =of_platform_populate (np, rockchip_bank_match,NULL ,NULL ); + ret =of_platform_populate (np,NULL ,NULL , &pdev->dev);if (ret) {dev_err (&pdev->dev,"failed to register gpio device\n" );return ret;
Greg Kroah-Hartman
maintainerPATCH 964/1039 gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 0b39536cc699db6850c426db7f9cb45923de40c5 upstream.
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/gpio/gpio-mpc8xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mpc8xxx.c +2 -2
@@ -388,8 +388,8 @@ static int mpc8xxx_probe(struct platform } mpc8xxx_gc->irqn =platform_get_irq (pdev,0 ); -if (!mpc8xxx_gc->irqn) -return 0 ; +if (mpc8xxx_gc->irqn <0 ) +return mpc8xxx_gc->irqn; mpc8xxx_gc->irq = irq_domain_create_linear(fwnode, MPC8XXX_GPIO_PINS,
Greg Kroah-Hartman
maintainerPATCH 965/1039 gpio: idt3243x: Fix IRQ check in idt_gpio_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 30fee1d7462a446ade399c0819717a830cbdca69 upstream.
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/gpio/gpio-idt3243x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-idt3243x.c +2 -2
@@ -164,8 +164,8 @@ static int idt_gpio_probe(struct platforreturn PTR_ERR (ctrl->pic); parent_irq =platform_get_irq (pdev,0 ); -if (!parent_irq) -return -EINVAL ; +if (parent_irq <0 ) +return parent_irq; girq = &ctrl->gc.irq; girq->chip = &idt_gpio_irqchip;
Greg Kroah-Hartman
maintainerPATCH 966/1039 net/smc: Fix hung_task when removing SMC-R devices
In reply to Greg Kroah-HartmanFrom: Wen Gu <[email protected]>
commit 56d99e81ecbc997a5f984684d0eeb583992b2072 upstream.
A hung_task is observed when removing SMC-R devices. Suppose that a link group has two active links(lnk_A, lnk_B) associated with two different SMC-R devices(dev_A, dev_B). When dev_A is removed, the link group will be removed from smc_lgr_list and added into lgr_linkdown_list. lnk_A will be cleared and smcibdev(A)->lnk_cnt will reach to zero. However, when dev_B is removed then, the link group can't be found in smc_lgr_list and lnk_B won't be cleared, making smcibdev->lnk_cnt never reaches zero, which causes a hung_task.
This patch fixes this issue by restoring the implementation of smc_smcr_terminate_all() to what it was before commit 349d43127dac ("net/smc: fix kernel panic caused by race of smc_sock"). The original implementation also satisfies the intention that make sure QP destroy earlier than CQ destroy because we will always wait for smcibdev->lnk_cnt reaches zero, which guarantees QP has been destroyed.
--- net/smc/smc_core.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
net/smc/smc_core.c +1 -16
@@ -1459,16 +1459,11 @@ void smc_smcd_terminate_all(struct smcd_/* Called when an SMCR device is removed or the smc module is unloaded. * If smcibdev is given, all SMCR link groups using this device are terminated. * If smcibdev is NULL, all SMCR link groups are terminated. -* -* We must wait here for QPs been destroyed before we destroy the CQs, -* or we won't received any CQEs and cdc_pend_tx_wr cannot reach 0 thus -* smc_sock cannot be released. */ void smc_smcr_terminate_all (struct smc_ib_device *smcibdev) {struct smc_link_group *lgr, *lg;LIST_HEAD (lgr_free_list); -LIST_HEAD (lgr_linkdown_list);int i;spin_lock_bh (&smc_lgr_list.lock);
@@ -1480,7 +1475,7 @@ void smc_smcr_terminate_all(struct smc_ilist_for_each_entry_safe (lgr, lg, &smc_lgr_list.list, list) {for (i =0 ; i <SMC_LINKS_PER_LGR_MAX ; i++) {if (lgr->lnk[i].smcibdev == smcibdev) -list_move_tail (&lgr->list, &lgr_linkdown_list); +smcr_link_down_cond_sched (&lgr->lnk[i]); } } }
@@ -1492,16 +1487,6 @@ void smc_smcr_terminate_all(struct smc_i__smc_lgr_terminate (lgr, false); } -list_for_each_entry_safe (lgr, lg, &lgr_linkdown_list, list) { -for (i =0 ; i <SMC_LINKS_PER_LGR_MAX ; i++) { -if (lgr->lnk[i].smcibdev == smcibdev) { -mutex_lock (&lgr->llc_conf_mutex); -smcr_link_down_cond (&lgr->lnk[i]); -mutex_unlock (&lgr->llc_conf_mutex); - } - } - } -if (smcibdev) {if (atomic_read (&smcibdev->lnk_cnt)) wait_event(smcibdev->lnks_deleted,
Greg Kroah-Hartman
maintainerPATCH 967/1039 net: axienet: increase reset timeout
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 2e5644b1bab2ccea9cfc7a9520af95b94eb0dbf1 upstream.
The previous timeout of 1ms was too short to handle some cases where the core is reset just after the input clocks were started, which will be introduced in an upcoming patch. Increase the timeout to 50ms. Also simplify the reset timeout checking to use read_poll_timeout.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +9 -10
@@ -496,7 +496,8 @@ static void axienet_setoptions(struct nestatic int __axienet_device_reset (struct axienet_local *lp) { -u32 timeout; +u32 value; +int ret;/* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset * process of Axi DMA takes a while to complete as all pending
@@ -506,15 +507,13 @@ static int __axienet_device_reset(struct* they both reset the entire DMA core, so only one needs to be used. */ axienet_dma_out32 (lp,XAXIDMA_TX_CR_OFFSET ,XAXIDMA_CR_RESET_MASK ); - timeout =DELAY_OF_ONE_MILLISEC ; -while (axienet_dma_in32 (lp,XAXIDMA_TX_CR_OFFSET ) & -XAXIDMA_CR_RESET_MASK ) { -udelay (1 ); -if (--timeout ==0 ) { -netdev_err (lp->ndev,"%s: DMA reset timeout!\n" , - __func__); -return -ETIMEDOUT ; - } + ret =read_poll_timeout (axienet_dma_in32, value, + !(value &XAXIDMA_CR_RESET_MASK ), +DELAY_OF_ONE_MILLISEC ,50000 , false, lp, +XAXIDMA_TX_CR_OFFSET ); +if (ret) { +dev_err (lp->dev,"%s: DMA reset timeout!\n" , __func__); +return ret; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 968/1039 net: axienet: Wait for PhyRstCmplt after core reset
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit b400c2f4f4c53c86594dd57098970d97d488bfde upstream.
When resetting the device, wait for the PhyRstCmplt bit to be set in the interrupt status register before continuing initialization, to ensure that the core is actually ready. When using an external PHY, this also ensures we do not start trying to access the PHY while it is still in reset. The PHY reset is initiated by the core reset which is triggered just above, but remains asserted for 5ms after the core is reset according to the documentation.
The MgtRdy bit could also be waited for, but unfortunately when using 7-series devices, the bit does not appear to work as documented (it seems to behave as some sort of link state indication and not just an indication the transceiver is ready) so it can't really be relied on for this purpose.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +10 -0
@@ -516,6 +516,16 @@ static int __axienet_device_reset(structreturn ret; } +/* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ + ret =read_poll_timeout (axienet_ior, value, + value &XAE_INT_PHYRSTCMPLT_MASK , +DELAY_OF_ONE_MILLISEC ,50000 , false, lp, +XAE_IS_OFFSET ); +if (ret) { +dev_err (lp->dev,"%s: timeout waiting for PhyRstCmplt\n" , __func__); +return ret; + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 969/1039 net: axienet: reset core on initialization prior to MDIO access
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 04cc2da39698efd7eb2e30c112538922d26f848e upstream.
In some cases where the Xilinx Ethernet core was used in 1000Base-X or SGMII modes, which use the internal PCS/PMA PHY, and the MGT transceiver clock source for the PCS was not running at the time the FPGA logic was loaded, the core would come up in a state where the PCS could not be found on the MDIO bus. To fix this, the Ethernet core (including the PCS) should be reset after enabling the clocks, prior to attempting to access the PCS using of_mdio_find_device.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +5 -0
@@ -2089,6 +2089,11 @@ static int axienet_probe(struct platform lp->coalesce_count_rx =XAXIDMA_DFT_RX_THRESHOLD ; lp->coalesce_count_tx =XAXIDMA_DFT_TX_THRESHOLD ; +/* Reset core now that clocks are enabled, prior to accessing MDIO */ + ret =__axienet_device_reset (lp); +if (ret) + goto cleanup_clk; + lp->phy_node =of_parse_phandle (pdev->dev.of_node,"phy-handle" ,0 );if (lp->phy_node) { ret =axienet_mdio_setup (lp);
Greg Kroah-Hartman
maintainerPATCH 970/1039 net: axienet: add missing memory barriers
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 95978df6fa328df619c15312e65ece469c2be2d2 upstream.
This driver was missing some required memory barriers:
Use dma_rmb to ensure we see all updates to the descriptor after we see that an entry has been completed.
Use wmb and rmb to avoid stale descriptor status between the TX path and TX complete IRQ path.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +10 -1
@@ -632,6 +632,8 @@ static int axienet_free_tx_chain(structif (nr_bds ==-1 && !(status &XAXIDMA_BD_STS_COMPLETE_MASK ))break ; +/* Ensure we see complete descriptor update */ +dma_rmb (); phys =desc_get_phys_addr (lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, (cur_p->cntrl & XAXIDMA_BD_CTRL_LENGTH_MASK),
@@ -645,8 +647,10 @@ static int axienet_free_tx_chain(struct cur_p->app1 =0 ; cur_p->app2 =0 ; cur_p->app4 =0 ; - cur_p->status =0 ; cur_p->skb =NULL ; +/* ensure our transmit path and device don't prematurely see status cleared */ +wmb (); + cur_p->status =0 ;if (sizep) *sizep += status &XAXIDMA_BD_STS_ACTUAL_LEN_MASK ;
@@ -704,6 +708,9 @@ static inline int axienet_check_tx_bd_sp int num_frag) {struct axidma_bd *cur_p; + +/* Ensure we see all descriptor updates from device or TX IRQ path */ +rmb (); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num];if (cur_p->status &XAXIDMA_BD_STS_ALL_MASK )return NETDEV_TX_BUSY ;
@@ -843,6 +850,8 @@ static void axienet_recv(struct net_devi tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; +/* Ensure we see complete descriptor update */ +dma_rmb (); phys =desc_get_phys_addr (lp, cur_p);dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size,DMA_FROM_DEVICE );
Greg Kroah-Hartman
maintainerPATCH 971/1039 net: axienet: limit minimum TX ring size
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 70f5817deddbc6ef3faa35841cab83c280cc653a upstream.
The driver will not work properly if the TX ring size is set to below MAX_SKB_FRAGS + 1 since it needs to hold at least one full maximally fragmented packet in the TX ring. Limit setting the ring size to below this value.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +3 -1
@@ -43,6 +43,7 @@/* Descriptors defines for Tx and Rx DMA */ #define TX_BD_NUM_DEFAULT 64#define RX_BD_NUM_DEFAULT 1024 +#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1)#define TX_BD_NUM_MAX 4096#define RX_BD_NUM_MAX 4096
@@ -1364,7 +1365,8 @@ static int axienet_ethtools_set_ringparaif (ering->rx_pending >RX_BD_NUM_MAX || ering->rx_mini_pending || ering->rx_jumbo_pending || - ering->rx_pending >TX_BD_NUM_MAX ) + ering->tx_pending <TX_BD_NUM_MIN || + ering->tx_pending >TX_BD_NUM_MAX )return -EINVAL ;if (netif_running (ndev))
Greg Kroah-Hartman
maintainerPATCH 972/1039 net: axienet: Fix TX ring slot available check
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 996defd7f8b5dafc1d480b7585c7c62437f80c3c upstream.
The check for whether a TX ring slot was available was incorrect, since a slot which had been loaded with transmit data but the device had not started transmitting would be treated as available, potentially causing non-transmitted slots to be overwritten. The control field in the descriptor should be checked, rather than the status field (which may only be updated when the device completes the entry).
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -2
@@ -643,7 +643,6 @@ static int axienet_free_tx_chain(structif (cur_p->skb && (status &XAXIDMA_BD_STS_COMPLETE_MASK ))dev_consume_skb_irq (cur_p->skb); - cur_p->cntrl =0 ; cur_p->app0 =0 ; cur_p->app1 =0 ; cur_p->app2 =0 ;
@@ -651,6 +650,7 @@ static int axienet_free_tx_chain(struct cur_p->skb =NULL ;/* ensure our transmit path and device don't prematurely see status cleared */ wmb (); + cur_p->cntrl =0 ; cur_p->status =0 ;if (sizep)
@@ -713,7 +713,7 @@ static inline int axienet_check_tx_bd_sp/* Ensure we see all descriptor updates from device or TX IRQ path */ rmb (); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; -if (cur_p->status &XAXIDMA_BD_STS_ALL_MASK ) +if (cur_p->cntrl)return NETDEV_TX_BUSY ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 973/1039 net: axienet: fix number of TX ring slots for available check
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit aba57a823d2985a2cc8c74a2535f3a88e68d9424 upstream.
The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -2
@@ -747,7 +747,7 @@ axienet_start_xmit(struct sk_buff *skb, num_frag =skb_shinfo (skb)->nr_frags; cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; -if (axienet_check_tx_bd_space (lp, num_frag)) { +if (axienet_check_tx_bd_space (lp, num_frag +1 )) {if (netif_queue_stopped (ndev))return NETDEV_TX_BUSY ;
@@ -757,7 +757,7 @@ axienet_start_xmit(struct sk_buff *skb,smp_mb ();/* Space might have just been freed - check again */ -if (axienet_check_tx_bd_space (lp, num_frag)) +if (axienet_check_tx_bd_space (lp, num_frag +1 ))return NETDEV_TX_BUSY ;netif_wake_queue (ndev);
Greg Kroah-Hartman
maintainerPATCH 974/1039 net: axienet: fix for TX busy handling
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit bb193e3db8b86a63f26889c99e14fd30c9ebd72a upstream.
Network driver documentation indicates we should be avoiding returning NETDEV_TX_BUSY from ndo_start_xmit in normal cases, since it requires the packets to be requeued. Instead the queue should be stopped after a packet is added to the TX ring when there may not be enough room for an additional one. Also, when TX ring entries are completed, we should only wake the queue if we know there is room for another full maximally fragmented packet.
Print a warning if there is insufficient space at the start of start_xmit, since this should no longer happen.
Combined with increasing the default TX ring size (in a subsequent patch), this appears to recover the TX performance lost by previous changes to actually manage the TX ring state properly.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 86 ++++++++++++---------- 1 file changed, 47 insertions(+), 39 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +47 -39
@@ -661,6 +661,32 @@ static int axienet_free_tx_chain(struct }/** +* axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy +* @lp: Pointer to the axienet_local structure +* @num_frag: The number of BDs to check for +* +* Return: 0, on success +* NETDEV_TX_BUSY, if any of the descriptors are not free +* +* This function is invoked before BDs are allocated and transmission starts. +* This function returns 0 if a BD or group of BDs can be allocated for +* transmission. If the BD or any of the BDs are not free the function +* returns a busy status. This is invoked from axienet_start_xmit. +*/ +static inline int axienet_check_tx_bd_space (struct axienet_local *lp, +int num_frag) +{ +struct axidma_bd *cur_p; + +/* Ensure we see all descriptor updates from device or TX IRQ path */ +rmb (); + cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; +if (cur_p->cntrl) +return NETDEV_TX_BUSY ; +return 0 ; +} + +/** * axienet_start_xmit_done - Invoked once a transmit is completed by the * Axi DMA Tx channel. * @ndev: Pointer to the net_device structure
@@ -689,33 +715,8 @@ static void axienet_start_xmit_done(stru/* Matches barrier in axienet_start_xmit */ smp_mb (); -netif_wake_queue (ndev); -} - -/** -* axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy -* @lp: Pointer to the axienet_local structure -* @num_frag: The number of BDs to check for -* -* Return: 0, on success -* NETDEV_TX_BUSY, if any of the descriptors are not free -* -* This function is invoked before BDs are allocated and transmission starts. -* This function returns 0 if a BD or group of BDs can be allocated for -* transmission. If the BD or any of the BDs are not free the function -* returns a busy status. This is invoked from axienet_start_xmit. -*/ -static inline int axienet_check_tx_bd_space (struct axienet_local *lp, -int num_frag) -{ -struct axidma_bd *cur_p; - -/* Ensure we see all descriptor updates from device or TX IRQ path */ -rmb (); - cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; -if (cur_p->cntrl) -return NETDEV_TX_BUSY ; -return 0 ; +if (!axienet_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) +netif_wake_queue (ndev); }/**
@@ -748,19 +749,14 @@ axienet_start_xmit(struct sk_buff *skb, cur_p = &lp->tx_bd_v[lp->tx_bd_tail];if (axienet_check_tx_bd_space (lp, num_frag +1 )) { -if (netif_queue_stopped (ndev)) -return NETDEV_TX_BUSY ; - +/* Should not happen as last start_xmit call should have +* checked for sufficient space and queue should only be +* woken when sufficient space is available. +*/ netif_stop_queue (ndev); - -/* Matches barrier in axienet_start_xmit_done */ -smp_mb (); - -/* Space might have just been freed - check again */ -if (axienet_check_tx_bd_space (lp, num_frag +1 )) -return NETDEV_TX_BUSY ; - -netif_wake_queue (ndev); +if (net_ratelimit ()) +netdev_warn (ndev,"TX ring unexpectedly full\n" ); +return NETDEV_TX_BUSY ; }if (skb->ip_summed ==CHECKSUM_PARTIAL ) {
@@ -821,6 +817,18 @@ axienet_start_xmit(struct sk_buff *skb,if (++lp->tx_bd_tail >= lp->tx_bd_num) lp->tx_bd_tail =0 ; +/* Stop queue if next transmit may not have space */ +if (axienet_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) { +netif_stop_queue (ndev); + +/* Matches barrier in axienet_start_xmit_done */ +smp_mb (); + +/* Space might have just been freed - check again */ +if (!axienet_check_tx_bd_space (lp,MAX_SKB_FRAGS +1 )) +netif_wake_queue (ndev); + } +return NETDEV_TX_OK ; }
Greg Kroah-Hartman
maintainerPATCH 975/1039 net: axienet: increase default TX ring size to 128
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
commit 2d19c3fd80178160dd505ccd7fed1643831227a5 upstream.
With previous changes to make the driver handle the TX ring size more correctly, the default TX ring size of 64 appears to significantly bottleneck TX performance to around 600 Mbps on a 1 Gbps link on ZynqMP. Increasing this to 128 seems to bring performance up to near line rate and shouldn't cause excess bufferbloat (this driver doesn't yet support modern byte-based queue management).
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
@@ -41,7 +41,7 @@#include "xilinx_axienet.h" /* Descriptors defines for Tx and Rx DMA */ -#define TX_BD_NUM_DEFAULT 64 +#define TX_BD_NUM_DEFAULT 128#define RX_BD_NUM_DEFAULT 1024#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1)#define TX_BD_NUM_MAX 4096
Greg Kroah-Hartman
maintainerPATCH 976/1039 bitops: protect find_first_{,zero}_bit properly
In reply to Greg Kroah-HartmanFrom: Yury Norov <[email protected]>
commit b7ec62d7ee0f0b8af6ba190501dff7f9ee6545ca upstream.
find_first_bit() and find_first_zero_bit() are not protected with ifdefs as other functions in find.h. It causes build errors on some platforms if CONFIG_GENERIC_FIND_FIRST_BIT is enabled.
--- include/asm-generic/bitops/find.h | 5 +++++ 1 file changed, 5 insertions(+)
include/asm-generic/bitops/find.h +5 -0
@@ -97,6 +97,7 @@ unsigned long find_next_zero_bit(const u#ifdef CONFIG_GENERIC_FIND_FIRST_BIT +#ifndef find_first_bit/** * find_first_bit - find the first set bit in a memory region * @addr: The address to start the search at
@@ -116,7 +117,9 @@ unsigned long find_first_bit(const unsig return _find_first_bit(addr, size); } +#endif +#ifndef find_first_zero_bit/** * find_first_zero_bit - find the first cleared bit in a memory region * @addr: The address to start the search at
@@ -136,6 +139,8 @@ unsigned long find_first_zero_bit(const return _find_first_zero_bit(addr, size); } +#endif +#else /* CONFIG_GENERIC_FIND_FIRST_BIT */ #ifndef find_first_bit
Greg Kroah-Hartman
maintainerPATCH 977/1039 um: gitignore: Add kernel/capflags.c
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 4b86366fdfbedec42f8f7ee037775f2839921d34 upstream.
This file is generated, we should ignore it.
--- arch/um/.gitignore | 1 + 1 file changed, 1 insertion(+)
arch/um/.gitignore +1 -0
@@ -2,3 +2,4 @@ kernel/config.c kernel/config.tmp kernel/vmlinux.lds +kernel/capflags.c
Greg Kroah-Hartman
maintainerPATCH 978/1039 HID: vivaldi: fix handling devices not using numbered reports
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
commit 3fe6acd4dc922237b30e55473c9349c6ce0690f3 upstream.
Unfortunately details of USB HID transport bled into HID core and handling of numbered/unnumbered reports is quite a mess, with hid_report_len() calculating the length according to USB rules, and hid_hw_raw_request() adding report ID to the buffer for both numbered and unnumbered reports.
Untangling it all requres a lot of changes in HID, so for now let's handle this in the driver.
--- drivers/hid/hid-vivaldi.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/hid/hid-vivaldi.c +28 -6
@@ -74,10 +74,11 @@ static void vivaldi_feature_mapping(stru struct hid_usage *usage) {struct vivaldi_data *drvdata =hid_get_drvdata (hdev); +struct hid_report *report = field->report;int fn_key;int ret;u32 report_len; -u8 *buf; +u8 *report_data, *buf;if (field->logical !=HID_USAGE_FN_ROW_PHYSMAP || (usage->hid &HID_USAGE_PAGE ) !=HID_UP_ORDINAL )
@@ -89,12 +90,24 @@ static void vivaldi_feature_mapping(struif (fn_key > drvdata->max_function_row_key) drvdata->max_function_row_key = fn_key; - buf =hid_alloc_report_buf (field->report,GFP_KERNEL ); -if (!buf) + report_data = buf =hid_alloc_report_buf (report,GFP_KERNEL ); +if (!report_data)return ; - report_len =hid_report_len (field->report); - ret =hid_hw_raw_request (hdev, field->report->id, buf, + report_len =hid_report_len (report); +if (!report->id) { +/* +* hid_hw_raw_request() will stuff report ID (which will be 0) +* into the first byte of the buffer even for unnumbered +* reports, so we need to account for this to avoid getting +* -EOVERFLOW in return. +* Note that hid_alloc_report_buf() adds 7 bytes to the size +* so we can safely say that we have space for an extra byte. +*/ + report_len++; + } + + ret =hid_hw_raw_request (hdev, report->id, report_data, report_len,HID_FEATURE_REPORT ,HID_REQ_GET_REPORT );if (ret <0 ) {
@@ -103,7 +116,16 @@ static void vivaldi_feature_mapping(stru goto out; } - ret =hid_report_raw_event (hdev,HID_FEATURE_REPORT , buf, +if (!report->id) { +/* +* Undo the damage from hid_hw_raw_request() for unnumbered +* reports. +*/ + report_data++; + report_len--; + } + + ret =hid_report_raw_event (hdev,HID_FEATURE_REPORT , report_data, report_len,0 );if (ret) { dev_warn(&hdev->dev, "failed to report feature %d\n",
Greg Kroah-Hartman
maintainerPATCH 979/1039 mctp: test: zero out sockaddr
In reply to Greg Kroah-HartmanFrom: Matt Johnston <[email protected]>
commit 284a4d94e8e74fbd731ee67e29196656ca823423 upstream.
MCTP now requires that padding bytes are zero.
--- net/mctp/test/route-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mctp/test/route-test.c +1 -1
@@ -285,7 +285,7 @@ static void __mctp_route_test_init(strucstruct mctp_test_route **rtp, struct socket **sockp) { - struct sockaddr_mctp addr; + struct sockaddr_mctp addr = {0};struct mctp_test_route *rt;struct mctp_test_dev *dev;struct socket *sock;
Greg Kroah-Hartman
maintainerPATCH 980/1039 rtc: Move variable into switch case statement
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit ba52eac083e1598e748811ff58d259f77e4c5c4d upstream.
When building with automatic stack variable initialization, GCC 12 complains about variables defined outside of switch case statements. Move the variable into the case that uses it, which silences the warning:
drivers/rtc/dev.c: In function 'rtc_dev_ioctl':drivers/rtc/dev.c:394:30: warning: statement will never be executed [-Wswitch-unreachable]
394 | long offset;
| ^~~~~~
--- drivers/rtc/dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/rtc/dev.c +3 -3
@@ -391,14 +391,14 @@ static long rtc_dev_ioctl(struct file *f }switch (param.param) { -long offset;case RTC_PARAM_FEATURES :if (param.index !=0 ) err = -EINVAL ; param.uvalue = rtc->features[0 ];break ; -case RTC_PARAM_CORRECTION : +case RTC_PARAM_CORRECTION : { +long offset;mutex_unlock (&rtc->ops_lock);if (param.index !=0 )return -EINVAL ;
@@ -407,7 +407,7 @@ static long rtc_dev_ioctl(struct file *fif (err ==0 ) param.svalue = offset;break ; - + }default :if (rtc->ops->param_get) err = rtc->ops->param_get (rtc->dev.parent, ¶m);
Greg Kroah-Hartman
maintainerPATCH 981/1039 rtc: pxa: fix null pointer dereference
In reply to Greg Kroah-HartmanFrom: Laurence de Bruxelles <[email protected]>
commit 34127b3632b21e5c391756e724b1198eb9917981 upstream.
With the latest stable kernel versions the rtc on the PXA based Zaurus does not work, when booting I see the following kernel messages:
pxa-rtc pxa-rtc: failed to find rtc clock source pxa-rtc pxa-rtc: Unable to init SA1100 RTC sub-device
pxa-rtc: probe of pxa-rtc failed with error -2
hctosys: unable to open rtc device (rtc0)
I think this is because commit f2997775b111 ("rtc: sa1100: fix possible race condition") moved the allocation of the rtc_device struct out of sa1100_rtc_init and into sa1100_rtc_probe. This means that pxa_rtc_probe also needs to do allocation for the rtc_device struct, otherwise sa1100_rtc_init will try to dereference a null pointer. This patch adds that allocation by copying how sa1100_rtc_probe in drivers/rtc/rtc-sa1100.c does it; after the IRQs are set up a managed rtc_device is allocated.
I've tested this patch with qemu-system-arm -machine akita and with a real Zaurus SL-C1000 applied to 4.19, 5.4, and 5.10.
--- drivers/rtc/rtc-pxa.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rtc/rtc-pxa.c +4 -0
@@ -330,6 +330,10 @@ static int __init pxa_rtc_probe(struct pif (sa1100_rtc->irq_alarm <0 )return -ENXIO ; + sa1100_rtc->rtc =devm_rtc_allocate_device (&pdev->dev); +if (IS_ERR (sa1100_rtc->rtc)) +return PTR_ERR (sa1100_rtc->rtc); + pxa_rtc->base =devm_ioremap (dev, pxa_rtc->ress->start,resource_size (pxa_rtc->ress));if (!pxa_rtc->base) {
Greg Kroah-Hartman
maintainerPATCH 982/1039 vdpa/mlx5: Fix wrong configuration of virtio_version_1_0
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
commit 97143b70aa847f2b0a1f959dde126b76ff7b5376 upstream.
Remove overriding of virtio_version_1_0 which forced the virtqueue object to version 1.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 -- 1 file changed, 2 deletions(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +0 -2
@@ -876,8 +876,6 @@ static int create_virtqueue(struct mlx5_MLX5_SET (virtio_q, vq_ctx, umem_3_id, mvq->umem3.id);MLX5_SET (virtio_q, vq_ctx, umem_3_size, mvq->umem3.size);MLX5_SET (virtio_q, vq_ctx, pd, ndev->mvdev.res.pdn); -if (MLX5_CAP_DEV_VDPA_EMULATION (ndev->mvdev.mdev, eth_frame_offload_type)) -MLX5_SET (virtio_q, vq_ctx, virtio_version_1_0,1 ); err =mlx5_cmd_exec (ndev->mvdev.mdev, in, inlen, out,sizeof (out));if (err)
Greg Kroah-Hartman
maintainerPATCH 983/1039 virtio_ring: mark ring unused on error
In reply to Greg Kroah-HartmanFrom: Michael S. Tsirkin <[email protected]>
commit 1861ba626ae9b98136f3e504208cdef6b29cd3ec upstream.
A recently added error path does not mark ring unused when exiting on OOM, which will lead to BUG on the next entry in debug builds.
TODO: refactor code so we have START_USE and END_USE in the same function.
--- drivers/virtio/virtio_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +3 -1
@@ -1197,8 +1197,10 @@ static inline int virtqueue_add_packed(sif (virtqueue_use_indirect (_vq, total_sg)) { err =virtqueue_add_indirect_packed (vq, sgs, total_sg, out_sgs, in_sgs, data, gfp); -if (err != -ENOMEM ) +if (err != -ENOMEM ) { +END_USE (vq);return err; + }/* fall back on direct */ }
Greg Kroah-Hartman
maintainerPATCH 984/1039 taskstats: Cleanup the use of task->exit_code
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 1b5a42d9c85f0e731f01c8d1129001fd8531a8a0 upstream.
In the function bacct_add_task the code reading task->exit_code was introduced in commit f3cef7a99469 ("[PATCH] csa: basic accounting over taskstats"), and it is not entirely clear what the taskstats interface is trying to return as only returning the exit_code of the first task in a process doesn't make a lot of sense.
As best as I can figure the intent is to return task->exit_code after a task exits. The field is returned with per task fields, so the exit_code of the entire process is not wanted. Only the value of the first task is returned so this is not a useful way to get the per task ptrace stop code. The ordinary case of returning this value is returning after a task exits, which also precludes use for getting a ptrace value.
It is common to for the first task of a process to also be the last task of a process so this field may have done something reasonable by accident in testing.
Make ac_exitcode a reliable per task value by always returning it for every exited task.
Setting ac_exitcode in a sensible mannter makes it possible to continue to provide this value going forward.
--- kernel/tsacct.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/tsacct.c +3 -4
@@ -38,11 +38,10 @@ void bacct_add_tsk(struct user_namespace stats->ac_btime =clamp_t (time64_t, btime,0 ,U32_MAX ); stats->ac_btime64 = btime; -if (thread_group_leader (tsk)) { +if (tsk->flags &PF_EXITING ) stats->ac_exitcode = tsk->exit_code; -if (tsk->flags &PF_FORKNOEXEC ) - stats->ac_flag |=AFORK ; - } +if (thread_group_leader (tsk) && (tsk->flags &PF_FORKNOEXEC )) + stats->ac_flag |=AFORK ;if (tsk->flags &PF_SUPERPRIV ) stats->ac_flag |=ASU ;if (tsk->flags &PF_DUMPCORE )
Greg Kroah-Hartman
maintainerPATCH 985/1039 inet: frags: annotate races around fqdir->dead and fqdir->high_thresh
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 91341fa0003befd097e190ec2a4bf63ad957c49a upstream.
Both fields can be read/written without synchronization, add proper accessors and documentation.
--- include/net/inet_frag.h | 11 +++++++++-- include/net/ipv6_frag.h | 3 ++- net/ipv4/inet_fragment.c | 8 +++++--- net/ipv4/ip_fragment.c | 3 ++- 4 files changed, 18 insertions(+), 7 deletions(-)
include/net/inet_frag.h +9 -2
@@ -117,8 +117,15 @@ int fqdir_init(struct fqdir **fqdirp, ststatic inline void fqdir_pre_exit (struct fqdir *fqdir) { - fqdir->high_thresh =0 ;/* prevent creation of new frags */ - fqdir->dead = true; +/* Prevent creation of new frags. +* Pairs with READ_ONCE() in inet_frag_find(). +*/ +WRITE_ONCE (fqdir->high_thresh,0 ); + +/* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() +* and ip6frag_expire_frag_queue(). +*/ +WRITE_ONCE (fqdir->dead, true); }void fqdir_exit (struct fqdir *fqdir);
include/net/ipv6_frag.h +2 -1
@@ -67,7 +67,8 @@ ip6frag_expire_frag_queue(struct net *nestruct sk_buff *head;rcu_read_lock (); -if (fq->q.fqdir->dead) +/* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ +if (READ_ONCE (fq->q.fqdir->dead)) goto out_rcu_unlock;spin_lock (&fq->q.lock);
net/ipv4/inet_fragment.c +5 -3
@@ -235,9 +235,9 @@ void inet_frag_kill(struct inet_frag_que/* The RCU read lock provides a memory barrier * guaranteeing that if fqdir->dead is false then * the hash table destruction will not start until -* after we unlock. Paired with inet_frags_exit_net(). +* after we unlock. Paired with fqdir_pre_exit(). */ -if (!fqdir->dead) { +if (!READ_ONCE (fqdir->dead)) {rhashtable_remove_fast (&fqdir->rhashtable, &fq->node, fqdir->f->rhash_params);refcount_dec (&fq->refcnt);
@@ -352,9 +352,11 @@ static struct inet_frag_queue *inet_frag/* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */ struct inet_frag_queue *inet_frag_find (struct fqdir *fqdir,void *key) { +/* This pairs with WRITE_ONCE() in fqdir_pre_exit(). */ +long high_thresh =READ_ONCE (fqdir->high_thresh);struct inet_frag_queue *fq =NULL , *prev; -if (!fqdir->high_thresh ||frag_mem_limit (fqdir) > fqdir->high_thresh) +if (!high_thresh ||frag_mem_limit (fqdir) > high_thresh)return NULL ;rcu_read_lock ();
net/ipv4/ip_fragment.c +2 -1
@@ -144,7 +144,8 @@ static void ip_expire(struct timer_listrcu_read_lock (); -if (qp->q.fqdir->dead) +/* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ +if (READ_ONCE (qp->q.fqdir->dead)) goto out_rcu_unlock;spin_lock (&qp->q.lock);
Greg Kroah-Hartman
maintainerPATCH 986/1039 netns: add schedule point in ops_exit_list()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 2836615aa22de55b8fca5e32fe1b27a67cda625e upstream.
When under stress, cleanup_net() can have to dismantle netns in big numbers. ops_exit_list() currently calls many helpers [1] that have no schedule point, and we can end up with soft lockups, particularly on hosts with many cpus.
Even for moderate amount of netns processed by cleanup_net() this patch avoids latency spikes.
[1] Some of these helpers like fib_sync_up() and fib_sync_down_dev() are very slow because net/ipv4/fib_semantics.c uses host-wide hash tables, and ifindex is used as the only input of two hash functions. ifindexes tend to be the same for all netns (lo.ifindex==1 per instance) This will be fixed in a separate patch.
--- net/core/net_namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/net_namespace.c +3 -1
@@ -164,8 +164,10 @@ static void ops_exit_list(const struct p {struct net *net;if (ops->exit) { -list_for_each_entry (net, net_exit_list, exit_list) +list_for_each_entry (net, net_exit_list, exit_list) { ops->exit (net); +cond_resched (); + } }if (ops->exit_batch) ops->exit_batch (net_exit_list);
Greg Kroah-Hartman
maintainerPATCH 987/1039 iwlwifi: fix Bz NMI behaviour
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit fdfde0cb79264f88992e72b5a056a3a3284fcaad upstream.
Contrary to what was stated before, the hardware hasn't changed the bits here yet. In any case, the new CSR is also directly (lower 16 bits) connected to UREG_DOORBELL_TO_ISR6, so if it still changes the changes would be there. Adjust the code and comments accordingly.
--- drivers/net/wireless/intel/iwlwifi/iwl-csr.h | 5 +++-- drivers/net/wireless/intel/iwlwifi/iwl-io.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-csr.h +3 -2
@@ -105,9 +105,10 @@/* GIO Chicken Bits (PCI Express bus link power management) */ #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) -/* Doorbell NMI (since Bz) */ +/* Doorbell - since Bz +* connected to UREG_DOORBELL_TO_ISR6 (lower 16 bits only) +*/ #define CSR_DOORBELL_VECTOR (CSR_BASE + 0x130) -#define CSR_DOORBELL_VECTOR_NMI BIT(1)/* host chicken bits */ #define CSR_HOST_CHICKEN (CSR_BASE + 0x204)
drivers/net/wireless/intel/iwlwifi/iwl-io.c +1 -1
@@ -218,7 +218,7 @@ void iwl_force_nmi(struct iwl_trans *tra UREG_DOORBELL_TO_ISR6_NMI_BIT); elseiwl_write32 (trans ,CSR_DOORBELL_VECTOR , -CSR_DOORBELL_VECTOR_NMI ); +UREG_DOORBELL_TO_ISR6_NMI_BIT ); }IWL_EXPORT_SYMBOL (iwl_force_nmi);
Greg Kroah-Hartman
maintainerPATCH 988/1039 xfrm: Dont accidentally set RTO_ONLINK in decode_session4()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit 23e7b1bfed61e301853b5e35472820d919498278 upstream.
Similar to commit 94e2238969e8 ("xfrm4: strip ECN bits from tos field"), clear the ECN bits from iph->tos when setting ->flowi4_tos. This ensures that the last bit of ->flowi4_tos is cleared, so ip_route_output_key_hash() isn't going to restrict the scope of the route lookup.
Use ~INET_ECN_MASK instead of IPTOS_RT_MASK, because we have no reason to clear the high order bits.
Found by code inspection, compile tested only.
--- net/xfrm/xfrm_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/xfrm/xfrm_policy.c +2 -1
@@ -31,6 +31,7 @@#include <linux/if_tunnel.h> #include <net/dst.h> #include <net/flow.h> +#include <net/inet_ecn.h> #include <net/xfrm.h> #include <net/ip.h> #include <net/gre.h>
@@ -3295,7 +3296,7 @@ decode_session4(struct sk_buff *skb, str fl4->flowi4_proto = iph->protocol; fl4->daddr = reverse ? iph->saddr : iph->daddr; fl4->saddr = reverse ? iph->daddr : iph->saddr; - fl4->flowi4_tos = iph->tos; + fl4->flowi4_tos = iph->tos & ~INET_ECN_MASK ;if (!ip_is_fragment (iph)) {switch (iph->protocol) {
Greg Kroah-Hartman
maintainerPATCH 989/1039 vdpa/mlx5: Fix config_attr_mask assignment
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
commit e3137056e6dedee205fccd06da031a285c6e34f5 upstream.
Fix VDPA_ATTR_DEV_NET_CFG_MACADDR assignment to be explicit 64 bit assignment.
No issue was seen since the value is well below 64 bit max value. Nevertheless it needs to be fixed.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
@@ -2674,7 +2674,7 @@ static int mlx5v_probe(struct auxiliary_ mgtdev->mgtdev.ops = &mdev_ops; mgtdev->mgtdev.device = mdev->device; mgtdev->mgtdev.id_table = id_table; - mgtdev->mgtdev.config_attr_mask = (1 <<VDPA_ATTR_DEV_NET_CFG_MACADDR ); + mgtdev->mgtdev.config_attr_mask =BIT_ULL (VDPA_ATTR_DEV_NET_CFG_MACADDR ); mgtdev->madev = madev; err =vdpa_mgmtdev_register (&mgtdev->mgtdev);
Greg Kroah-Hartman
maintainerPATCH 990/1039 vdpa/mlx5: Restore cur_num_vqs in case of failure in change_num_qps()
In reply to Greg Kroah-HartmanFrom: Eli Cohen <[email protected]>
commit 37e07e705888e4c3502f204e9c6785c9c2d6d86a upstream.
Restore ndev->cur_num_vqs to the original value in case change_num_qps() fails.
--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +3 -1
@@ -1552,9 +1552,11 @@ static int change_num_qps(struct mlx5_vdreturn 0 ; clean_added: -for (--i; i >= cur_qps; --i) +for (--i; i >=2 * cur_qps; --i)teardown_vq (ndev, &ndev->vqs[i]); + ndev->cur_num_vqs =2 * cur_qps; +return err; }
Greg Kroah-Hartman
maintainerPATCH 991/1039 gre: Dont accidentally set RTO_ONLINK in gre_fill_metadata_dst()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit f7716b318568b22fbf0e3be99279a979e217cf71 upstream.
Mask the ECN bits before initialising ->flowi4_tos. The tunnel key may have the last ECN bit set, which will interfere with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope).
Found by code inspection, compile tested only.
--- net/ipv4/ip_gre.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +3 -2
@@ -604,8 +604,9 @@ static int gre_fill_metadata_dst(struct key = &info->key;ip_tunnel_init_flow (&fl4,IPPROTO_GRE , key->u.ipv4.dst, key->u.ipv4.src, -tunnel_id_to_key32 (key->tun_id), key->tos,0 , - skb->mark,skb_get_hash (skb)); +tunnel_id_to_key32 (key->tun_id), + key->tos & ~INET_ECN_MASK ,0 , skb->mark, +skb_get_hash (skb)); rt =ip_route_output_key (dev_net (dev), &fl4);if (IS_ERR (rt))return PTR_ERR (rt);
Greg Kroah-Hartman
maintainerPATCH 992/1039 libcxgb: Dont accidentally set RTO_ONLINK in cxgb_find_route()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit a915deaa9abe4fb3a440312c954253a6a733608e upstream.
Mask the ECN bits before calling ip_route_output_ports(). The tos variable might be passed directly from an IPv4 header, so it may have the last ECN bit set. This interferes with the route lookup process as ip_route_output_key_hash() interpretes this bit specially (to restrict the route scope).
Found by code inspection, compile tested only.
--- drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c +2 -1
@@ -32,6 +32,7 @@#include <linux/tcp.h> #include <linux/ipv6.h> +#include <net/inet_ecn.h> #include <net/route.h> #include <net/ip6_route.h>
@@ -99,7 +100,7 @@ cxgb_find_route(struct cxgb4_lld_info *l rt =ip_route_output_ports (&init_net, &fl4,NULL , peer_ip, local_ip, peer_port, local_port,IPPROTO_TCP , - tos,0 ); + tos & ~INET_ECN_MASK ,0 );if (IS_ERR (rt))return NULL ; n =dst_neigh_lookup (&rt->dst, &peer_ip);
Greg Kroah-Hartman
maintainerPATCH 993/1039 perf script: Fix hex dump character output
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 62942e9fda9fd1def10ffcbd5e1c025b3c9eec17 upstream.
Using grep -C with perf script -D can give erroneous results as grep loses lines due to non-printable characters, for example, below the 0020, 0060 and 0070 lines are missing:
$ perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........
0 0 0x450 [0x98]: PERF_RECORD_AUXTRACE_INFO type: 1
PMU Type 8
Time Shift 31
perf's isprint() is a custom implementation from the kernel, but the kernel's _ctype appears to include characters from Latin-1 Supplement which is not compatible with, for example, UTF-8. Fix by checking also isascii().
After:
$ tools/perf/perf script -D | grep -C10 AUX | head . 0010: 08 00 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 ................ . 0020: 03 84 32 2f 00 00 00 00 63 7c 4f d2 fa ff ff ff ..2/....c|O..... . 0030: 01 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 ................ . 0040: 00 08 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0050: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ . 0060: 00 02 00 00 00 00 00 00 00 c0 03 00 00 00 00 00 ................ . 0070: e2 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ . 0080: 02 00 00 00 00 00 00 00 1b 00 00 00 00 00 00 00 ................ . 0090: 00 00 00 00 00 00 00 00 ........
--- tools/perf/util/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/debug.c +1 -1
@@ -179,7 +179,7 @@ static int trace_event_printer(enum binabreak ;case BINARY_PRINT_CHAR_DATA : printed +=color_fprintf (fp, color,"%c" , -isprint (ch) ? ch :'.' ); +isprint (ch) &&isascii (ch) ? ch :'.' );break ;case BINARY_PRINT_CHAR_PAD : printed +=color_fprintf (fp, color," " );
Greg Kroah-Hartman
maintainerPATCH 994/1039 dmaengine: at_xdmac: Dont start transactions at tx_submit level
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit bccfb96b59179d4f96cbbd1ddff8fac6d335eae4 upstream.
tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending() to be called. issue_pending() must start the transfer, not tx_submit(), thus remove at_xdmac_start_xfer() from at_xdmac_tx_submit(). Clients of at_xdmac that assume that tx_submit() starts the transfer must be updated and call dma_async_issue_pending() if they miss to call it (one example is atmel_serial).
As the at_xdmac_start_xfer() is now called only from at_xdmac_advance_work() when !at_xdmac_chan_is_enabled(), the at_xdmac_chan_is_enabled() check is no longer needed in at_xdmac_start_xfer(), thus remove it.
--- drivers/dma/at_xdmac.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/dma/at_xdmac.c +0 -6
@@ -385,9 +385,6 @@ static void at_xdmac_start_xfer(struct adev_vdbg (chan2dev (&atchan->chan),"%s: desc 0x%p\n" , __func__, first); -if (at_xdmac_chan_is_enabled (atchan)) -return ; -/* Set transfer as active to not try to start it again. */ first->active_xfer = true;
@@ -479,9 +476,6 @@ static dma_cookie_t at_xdmac_tx_submit(sdev_vdbg (chan2dev (tx->chan),"%s: atchan 0x%p, add desc 0x%p to xfers_list\n" , __func__, atchan, desc);list_add_tail (&desc->xfer_node, &atchan->xfers_list); -if (list_is_singular (&atchan->xfers_list)) -at_xdmac_start_xfer (atchan, desc); -spin_unlock_irqrestore (&atchan->lock, irqflags);return cookie; }
Greg Kroah-Hartman
maintainerPATCH 995/1039 dmaengine: at_xdmac: Start transfer for cyclic channels in issue_pending
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit e6af9b05bec63cd4d1de2a33968cd0be2a91282a upstream.
Cyclic channels must too call issue_pending in order to start a transfer. Start the transfer in issue_pending regardless of the type of channel. This wrongly worked before, because in the past the transfer was started at tx_submit level when only a desc in the transfer list.
--- drivers/dma/at_xdmac.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/at_xdmac.c +3 -5
@@ -1778,11 +1778,9 @@ static void at_xdmac_issue_pending(strucdev_dbg (chan2dev (&atchan->chan),"%s\n" , __func__); -if (!at_xdmac_chan_is_cyclic (atchan)) { -spin_lock_irqsave (&atchan->lock, flags); -at_xdmac_advance_work (atchan); -spin_unlock_irqrestore (&atchan->lock, flags); - } +spin_lock_irqsave (&atchan->lock, flags); +at_xdmac_advance_work (atchan); +spin_unlock_irqrestore (&atchan->lock, flags);return ; }
Greg Kroah-Hartman
maintainerPATCH 996/1039 dmaengine: at_xdmac: Print debug message after realeasing the lock
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 5edc24ac876a928f36f407a0fcdb33b94a3a210f upstream.
It is desirable to do the prints without the lock held if possible, so move the print after the lock is released.
--- drivers/dma/at_xdmac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/at_xdmac.c +4 -2
@@ -473,10 +473,12 @@ static dma_cookie_t at_xdmac_tx_submit(sspin_lock_irqsave (&atchan->lock, irqflags); cookie =dma_cookie_assign (tx); -dev_vdbg (chan2dev (tx->chan),"%s: atchan 0x%p, add desc 0x%p to xfers_list\n" , - __func__, atchan, desc);list_add_tail (&desc->xfer_node, &atchan->xfers_list);spin_unlock_irqrestore (&atchan->lock, irqflags); + +dev_vdbg (chan2dev (tx->chan),"%s: atchan 0x%p, add desc 0x%p to xfers_list\n" , + __func__, atchan, desc); +return cookie; }
Greg Kroah-Hartman
maintainerPATCH 997/1039 dmaengine: at_xdmac: Fix concurrency over xfers_list
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 18deddea9184b62941395889ff7659529c877326 upstream.
Since tx_submit can be called from a hard IRQ, xfers_list must be protected with a lock to avoid concurency on the list's elements. Since at_xdmac_handle_cyclic() is called from a tasklet, spin_lock_irq is enough to protect from a hard IRQ.
--- drivers/dma/at_xdmac.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/dma/at_xdmac.c +10 -7
@@ -1619,14 +1619,17 @@ static void at_xdmac_handle_cyclic(strucstruct at_xdmac_desc *desc;struct dma_async_tx_descriptor *txd; -if (!list_empty (&atchan->xfers_list)) { - desc =list_first_entry (&atchan->xfers_list, - struct at_xdmac_desc, xfer_node); - txd = &desc->tx_dma_desc; - -if (txd->flags &DMA_PREP_INTERRUPT ) -dmaengine_desc_get_callback_invoke (txd,NULL ); +spin_lock_irq (&atchan->lock); +if (list_empty (&atchan->xfers_list)) { +spin_unlock_irq (&atchan->lock); +return ; } + desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, + xfer_node); +spin_unlock_irq (&atchan->lock); + txd = &desc->tx_dma_desc; +if (txd->flags &DMA_PREP_INTERRUPT ) +dmaengine_desc_get_callback_invoke (txd,NULL ); }static void at_xdmac_handle_error (struct at_xdmac_chan *atchan)
Greg Kroah-Hartman
maintainerPATCH 998/1039 dmaengine: at_xdmac: Fix lld view setting
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 1385eb4d14d447cc5d744bc2ac34f43be66c9963 upstream.
AT_XDMAC_CNDC_NDVIEW_NDV3 was set even for AT_XDMAC_MBR_UBC_NDV2, because of the wrong bit handling. Fix it.
--- drivers/dma/at_xdmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/at_xdmac.c +3 -1
@@ -99,6 +99,7 @@#define AT_XDMAC_CNDC_NDE (0x1 << 0)/* Channel x Next Descriptor Enable */ #define AT_XDMAC_CNDC_NDSUP (0x1 << 1)/* Channel x Next Descriptor Source Update */ #define AT_XDMAC_CNDC_NDDUP (0x1 << 2)/* Channel x Next Descriptor Destination Update */ +#define AT_XDMAC_CNDC_NDVIEW_MASK GENMASK(28, 27)#define AT_XDMAC_CNDC_NDVIEW_NDV0 (0x0 << 3)/* Channel x Next Descriptor View 0 */ #define AT_XDMAC_CNDC_NDVIEW_NDV1 (0x1 << 3)/* Channel x Next Descriptor View 1 */ #define AT_XDMAC_CNDC_NDVIEW_NDV2 (0x2 << 3)/* Channel x Next Descriptor View 2 */
@@ -402,7 +403,8 @@ static void at_xdmac_start_xfer(struct a*/ if (at_xdmac_chan_is_cyclic (atchan)) reg =AT_XDMAC_CNDC_NDVIEW_NDV1 ; -else if (first->lld.mbr_ubc &AT_XDMAC_MBR_UBC_NDV3 ) +else if ((first->lld.mbr_ubc & +AT_XDMAC_CNDC_NDVIEW_MASK ) ==AT_XDMAC_MBR_UBC_NDV3 ) reg =AT_XDMAC_CNDC_NDVIEW_NDV3 ;else reg =AT_XDMAC_CNDC_NDVIEW_NDV2 ;
Greg Kroah-Hartman
maintainerPATCH 999/1039 dmaengine: at_xdmac: Fix at_xdmac_lld struct definition
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 912f7c6f7fac273f40e621447cf17d14b50d6e5b upstream.
The hardware channel next descriptor view structure contains just fields of 32 bits, while dma_addr_t can be of type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to comply with what the hardware expects.
--- drivers/dma/at_xdmac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/dma/at_xdmac.c +9 -9
@@ -253,15 +253,15 @@ struct at_xdmac {/* Linked List Descriptor */ struct at_xdmac_lld { -dma_addr_t mbr_nda;/* Next Descriptor Member */ -u32 mbr_ubc;/* Microblock Control Member */ -dma_addr_t mbr_sa;/* Source Address Member */ -dma_addr_t mbr_da;/* Destination Address Member */ -u32 mbr_cfg;/* Configuration Register */ -u32 mbr_bc;/* Block Control Register */ -u32 mbr_ds;/* Data Stride Register */ -u32 mbr_sus;/* Source Microblock Stride Register */ -u32 mbr_dus;/* Destination Microblock Stride Register */ +u32 mbr_nda;/* Next Descriptor Member */ +u32 mbr_ubc;/* Microblock Control Member */ +u32 mbr_sa;/* Source Address Member */ +u32 mbr_da;/* Destination Address Member */ +u32 mbr_cfg;/* Configuration Register */ +u32 mbr_bc;/* Block Control Register */ +u32 mbr_ds;/* Data Stride Register */ +u32 mbr_sus;/* Source Microblock Stride Register */ +u32 mbr_dus;/* Destination Microblock Stride Register */ };/* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */
Greg Kroah-Hartman
maintainerPATCH 1000/1039 perf cputopo: Fix CPU topology reading on s/390
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
commit a6e62743621ea29bea461774c0bcc68e5de59068 upstream.
Commit fdf1e29b6118c18f ("perf expr: Add metric literals for topology.") fails on s390:
# ./perf test -Fv 7 ... # FAILED tests/expr.c:173 #num_dies >= #num_packages ---- end ---- Simple expression parser: FAILED! #
Investigating this issue leads to these functions:
build_cpu_topology()
+--> has_die_topology(void)
{
struct utsname uts;
if (uname(&uts) < 0)
return false;
if (strncmp(uts.machine, "x86_64", 6))
return false;
....
}which always returns false on s390. The caller build_cpu_topology() checks has_die_topology() return value. On false the
the struct cpu_topology::die_cpu_list is not contructed and has zero entries. This leads to the failing comparison: #num_dies >= #num_packages. s390 of course has a positive number of packages.
Fix this by adding s390 architecture to support CPU die list.
Output after:
# ./perf test -Fv 7 7: Simple expression parser : --- start --- division by zero syntax error ---- end ---- Simple expression parser: Ok #
--- tools/perf/util/cputopo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/cputopo.c +2 -1
@@ -165,7 +165,8 @@ static bool has_die_topology(void)if (uname (&uts) <0 )return false; -if (strncmp (uts.machine,"x86_64" ,6 )) +if (strncmp (uts.machine,"x86_64" ,6 ) && +strncmp (uts.machine,"s390x" ,5 ))return false; scnprintf(filename, MAXPATHLEN, DIE_CPUS_FMT,
Greg Kroah-Hartman
maintainerPATCH 1001/1039 perf tools: Drop requirement for libstdc++.so for libopencsd check
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
commit ed17b1914978eddb2b01f2d34577f1c82518c650 upstream.
It's possible to link against libopencsd_c_api without having libstdc++.so available, only libstdc++.so.6.0.28 (or whatever version is in use) needs to be available. The same holds true for libopencsd.so. When -lstdc++ (or -lopencsd) is explicitly passed to the linker however the .so file must be available.
So wrap adding the dependencies into a check for static linking that actually requires adding them all. The same construct is already used for some other tests in the same file to reduce dependencies in the dynamic linking case.
--- tools/perf/Makefile.config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +4 -1
@@ -143,7 +143,10 @@ FEATURE_CHECK_LDFLAGS-libcrypto = -lcryp ifdef CSINCLUDES LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) endif -OPENCSDLIBS := -lopencsd_c_api -lopencsd -lstdc++ +OPENCSDLIBS := -lopencsd_c_api +ifeq ($(findstring -static,${LDFLAGS}),-static) + OPENCSDLIBS += -lopencsd -lstdc++ +endif ifdef CSLIBS LIBOPENCSD_LDFLAGS := -L$(CSLIBS) endif
Greg Kroah-Hartman
maintainerPATCH 1002/1039 perf metricgroup: Fix use after free in metric__new()
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
commit e000ea0beffb5497425054b151369fe37a792ece upstream.
We shouldn't free() something that will be used in the next line, fix it.
Addresses-Coverity-ID: 1494000
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/metricgroup.c +1 -1
@@ -209,8 +209,8 @@ static struct metric *metric__new(const m->metric_name = pe->metric_name; m->modifier = modifier ?strdup (modifier) :NULL ;if (modifier && !m->modifier) { -free (m);expr__ctx_free (m->pctx); +free (m);return NULL ; } m->metric_expr = pe->metric_expr;
Greg Kroah-Hartman
maintainerPATCH 1003/1039 perf test: Enable system wide for metricgroups test
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
commit 0046686da0ef692a6381260c3aa44291187eafc9 upstream.
Uncore events as group leaders fail in per-thread mode causing exit errors. Enable system-wide for metricgroup testing. This fixes the HPC metric group when tested on skylakex.
--- tools/perf/tests/shell/stat_all_metricgroups.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/shell/stat_all_metricgroups.sh +1 -1
@@ -6,7 +6,7 @@ set -e for m in $(perf list --raw-dump metricgroups); do echo "Testing $m" - perf stat -M "$m" true + perf stat -M "$m" -a true done exit 0
Greg Kroah-Hartman
maintainerPATCH 1004/1039 perf probe: Fix ppc64 perf probe add events failed case
In reply to Greg Kroah-HartmanFrom: Zechuan Chen <[email protected]>
commit 4624f199327a704dd1069aca1c3cadb8f2a28c6f upstream.
Because of commit bf794bf52a80c627 ("powerpc/kprobes: Fix kallsyms lookup across powerpc ABIv1 and ABIv2"), in ppc64 ABIv1, our perf command eliminates the need to use the prefix "." at the symbol name.
But when the command "perf probe -a schedule" is executed on ppc64 ABIv1, it obtains two symbol address information through /proc/kallsyms, for example:
cat /proc/kallsyms | grep -w schedule
c000000000657020 T .schedule
c000000000d4fdb8 D schedule
The symbol "D schedule" is not a function symbol, and perf will print:
"p:probe/schedule _text+13958584"Failed to write event: Invalid argument
Therefore, when searching symbols from map and adding probe point for them, a symbol type check is added. If the type of symbol is not a function, skip it.
--- tools/perf/util/probe-event.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/probe-event.c +3 -0
@@ -3083,6 +3083,9 @@ static int find_probe_trace_events_from_for (j =0 ; j < num_matched_functions; j++) { sym = syms[j]; +if (sym->type !=STT_FUNC ) +continue ; +/* There can be duplicated symbols in the map */ for (i =0 ; i < j; i++)if (sym->start == syms[i]->start) {
Greg Kroah-Hartman
maintainerPATCH 1005/1039 perf metric: Fix metric_leader
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
commit d3e2bb4359f70c8b1d09a6f8e2f57240aab0da3f upstream.
Multiple events may have a metric_leader to aggregate into.
This happens for uncore events where, for example, uncore_imc is expanded into uncore_imc_0, uncore_imc_1, etc.
Such events all have the same metric_id and should aggregate into the first event.
The change introducing metric_ids had a bug where the metric_id was compared to itself, creating an always true condition.
Correct this by comparing the event in the metric_evlist and the metric_leader.
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/metricgroup.c +1 -1
@@ -314,7 +314,7 @@ static int setup_metric_events(struct ha*/ metric_id =evsel__metric_id (ev);evlist__for_each_entry_continue (metric_evlist, ev) { -if (!strcmp (evsel__metric_id (metric_events[i]), metric_id)) +if (!strcmp (evsel__metric_id (ev), metric_id)) ev->metric_leader = metric_events[i]; } }
Greg Kroah-Hartman
maintainerPATCH 1006/1039 devlink: Remove misleading internal_flags from health reporter dump
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
commit e9538f8270db24d272659e15841854c7ea11119e upstream.
DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET command doesn't have .doit callback and has no use in internal_flags at all. Remove this misleading assignment.
--- net/core/devlink.c | 2 -- 1 file changed, 2 deletions(-)
net/core/devlink.c +0 -2
@@ -8840,8 +8840,6 @@ static const struct genl_small_ops devli GENL_DONT_VALIDATE_DUMP_STRICT, .dumpit = devlink_nl_cmd_health_reporter_dump_get_dumpit, .flags = GENL_ADMIN_PERM, - .internal_flags =DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT | - DEVLINK_NL_FLAG_NO_LOCK, }, { .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
Greg Kroah-Hartman
maintainerPATCH 1007/1039 arm64: dts: qcom: msm8996: drop not documented adreno properties
In reply to Greg Kroah-HartmanFrom: David Heidelberg <[email protected]>
commit c41910f257a22dc406c60d8826b4a3b5398003a3 upstream.
These properties aren't documented nor implemented in the driver. Drop them.
Fixes warnings as:
$ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/msm/gpu.yaml ... arch/arm64/boot/dts/qcom/msm8996-mtp.dt.yaml: gpu@b00000: 'qcom,gpu-quirk-fault-detect-mask', 'qcom,gpu-quirk-two-pass-use-wfi' do not match any of the regexes: 'pinctrl-[0-9]+' From schema: Documentation/devicetree/bindings/display/msm/gpu.yaml ...
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/qcom/msm8996.dtsi +0 -3
@@ -987,9 +987,6 @@ nvmem-cells = <&speedbin_efuse>; nvmem-cell-names = "speed_bin"; - qcom,gpu-quirk-two-pass-use-wfi; - qcom,gpu-quirk-fault-detect-mask; - operating-points-v2 = <&gpu_opp_table>; status = "disabled";
Greg Kroah-Hartman
maintainerPATCH 1008/1039 net: fix sock_timestamping_bind_phc() to release device
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
commit 2a4d75bfe41232608f5596a6d1369f92ccb20817 upstream.
Don't forget to release the device in sock_timestamping_bind_phc() after it was used to get the vclock indices.
--- net/core/sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/sock.c +2 -0
@@ -843,6 +843,8 @@ static int sock_timestamping_bind_phc(st } num =ethtool_get_phc_vclocks (dev, &vclock_index); +dev_put (dev); +for (i =0 ; i < num; i++) {if (*(vclock_index + i) == phc_index) { match = true;
Greg Kroah-Hartman
maintainerPATCH 1009/1039 net: bonding: fix bond_xmit_broadcast return value error bug
In reply to Greg Kroah-HartmanFrom: Jie Wang <[email protected]>
commit 4e5bd03ae34652cd932ab4c91c71c511793df75c upstream.
In Linux bonding scenario, one packet is copied to several copies and sent by all slave device of bond0 in mode 3(broadcast mode). The mode 3 xmit function bond_xmit_broadcast() only ueses the last slave device's tx result as the final result. In this case, if the last slave device is down, then it always return NET_XMIT_DROP, even though the other slave devices xmit success. It may cause the tx statistics error, and cause the application (e.g. scp) consider the network is unreachable.
For example, use the following command to configure server A.
echo 3 > /sys/class/net/bond0/bonding/mode
ifconfig bond0 up
ifenslave bond0 eth0 eth1
ifconfig bond0 192.168.1.125
ifconfig eth0 up
ifconfig eth1 down
The slave device eth0 and eth1 are connected to server B(192.168.1.107). Run the ping 192.168.1.107 -c 3 -i 0.2 command, the following information is displayed.
PING 192.168.1.107 (192.168.1.107) 56(84) bytes of data. 64 bytes from 192.168.1.107: icmp_seq=1 ttl=64 time=0.077 ms 64 bytes from 192.168.1.107: icmp_seq=2 ttl=64 time=0.056 ms 64 bytes from 192.168.1.107: icmp_seq=3 ttl=64 time=0.051 ms
192.168.1.107 ping statistics
0 packets transmitted, 3 received
Actually, the slave device eth0 of the bond successfully sends three ICMP packets, but the result shows that 0 packets are transmitted.
Also if we use scp command to get remote files, the command end with the following printings.
ssh_exchange_identification: read: Connection timed out
So this patch modifies the bond_xmit_broadcast to return NET_XMIT_SUCCESS if one slave device in the bond sends packets successfully. If all slave devices send packets fail, the discarded packets stats is increased. The skb is released when there is no slave device in the bond or the last slave device is down.
--- drivers/net/bonding/bond_main.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_main.c +22 -8
@@ -4843,25 +4843,39 @@ static netdev_tx_t bond_xmit_broadcast(sstruct bonding *bond =netdev_priv (bond_dev);struct slave *slave =NULL ;struct list_head *iter; +bool xmit_suc = false; +bool skb_used = false;bond_for_each_slave_rcu (bond, slave, iter) { -if (bond_is_last_slave (bond, slave)) -break ; -if (bond_slave_is_up (slave) && slave->link ==BOND_LINK_UP ) { -struct sk_buff *skb2 =skb_clone (skb,GFP_ATOMIC ); +struct sk_buff *skb2; +if (!(bond_slave_is_up (slave) && slave->link ==BOND_LINK_UP )) +continue ; + +if (bond_is_last_slave (bond, slave)) { + skb2 = skb; + skb_used = true; + }else { + skb2 =skb_clone (skb,GFP_ATOMIC );if (!skb2) {net_err_ratelimited ("%s: Error: %s: skb_clone() failed\n" , bond_dev->name, __func__);continue ; } -bond_dev_queue_xmit (bond, skb2, slave->dev); } + +if (bond_dev_queue_xmit (bond, skb2, slave->dev) ==NETDEV_TX_OK ) + xmit_suc = true; } -if (slave &&bond_slave_is_up (slave) && slave->link ==BOND_LINK_UP ) -return bond_dev_queue_xmit (bond, skb, slave->dev); -return bond_tx_drop (bond_dev, skb); +if (!skb_used) +dev_kfree_skb_any (skb); + +if (xmit_suc) +return NETDEV_TX_OK ; + +atomic_long_inc (&bond_dev->tx_dropped); +return NET_XMIT_DROP ; }/*------------------------- Device initialization ---------------------------*/
Greg Kroah-Hartman
maintainerPATCH 1010/1039 net: ipa: fix atomic update in ipa_endpoint_replenish()
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
commit 6c0e3b5ce94947b311348c367db9e11dcb2ccc93 upstream.
In ipa_endpoint_replenish(), if an error occurs when attempting to replenish a receive buffer, we just quit and try again later. In that case we increment the backlog count to reflect that the attempt was unsuccessful. Then, if the add_one flag was true we increment the backlog again.
This second increment is not included in the backlog local variable though, and its value determines whether delayed work should be scheduled. This is a bug.
Fix this by determining whether 1 or 2 should be added to the backlog before adding it in a atomic_add_return() call.
--- drivers/net/ipa/ipa_endpoint.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ipa/ipa_endpoint.c +3 -4
@@ -1067,6 +1067,7 @@ static void ipa_endpoint_replenish(struc {struct gsi *gsi;u32 backlog; +int delta;if (!endpoint->replenish_enabled) {if (add_one)
@@ -1084,10 +1085,8 @@ static void ipa_endpoint_replenish(struc try_again_later:/* The last one didn't succeed, so fix the backlog */ - backlog =atomic_inc_return (&endpoint->replenish_backlog); - -if (add_one) -atomic_inc (&endpoint->replenish_backlog); + delta = add_one ?2 :1 ; + backlog =atomic_add_return (delta, &endpoint->replenish_backlog);/* Whenever a receive buffer transaction completes we'll try to * replenish again. It's unlikely, but if we fail to supply even
Greg Kroah-Hartman
maintainerPATCH 1011/1039 net_sched: restore "mpu xxx" handling
In reply to Greg Kroah-HartmanFrom: Kevin Bracey <[email protected]>
commit fb80445c438c78b40b547d12b8d56596ce4ccfeb upstream.
commit 56b765b79e9a ("htb: improved accuracy at high rates") broke "overhead X", "linklayer atm" and "mpu X" attributes.
"overhead X" and "linklayer atm" have already been fixed. This restores the "mpu X" handling, as might be used by DOCSIS or Ethernet shaping:
tc class add ... htb rate X overhead 4 mpu 64
The code being fixed is used by htb, tbf and act_police. Cake has its own mpu handling. qdisc_calculate_pkt_len still uses the size table containing values adjusted for mpu by user space.
iproute2 tc has always passed mpu into the kernel via a tc_ratespec structure, but the kernel never directly acted on it, merely stored it so that it could be read back by tc class show.
Rather, tc would generate length-to-time tables that included the mpu (and linklayer) in their construction, and the kernel used those tables.
Since v3.7, the tables were no longer used. Along with "mpu", this also broke "overhead" and "linklayer" which were fixed in 01cb71d2d47b ("net_sched: restore "overhead xxx" handling", v3.10) and 8a8e3d84b171 ("net_sched: restore "linklayer atm" handling", v3.11).
"overhead" was fixed by simply restoring use of tc_ratespec::overhead - this had originally been used by the kernel but was initially omitted from the new non-table-based calculations.
"linklayer" had been handled in the table like "mpu", but the mode was not originally passed in tc_ratespec. The new implementation was made to handle it by getting new versions of tc to pass the mode in an extended tc_ratespec, and for older versions of tc the table contents were analysed at load time to deduce linklayer.
As "mpu" has always been given to the kernel in tc_ratespec, accompanying the mpu-based table, we can restore system functionality with no userspace change by making the kernel act on the tc_ratespec value.
--- include/net/sch_generic.h | 5 +++++ net/sched/sch_generic.c | 1 + 2 files changed, 6 insertions(+)
include/net/sch_generic.h +5 -0
@@ -1244,6 +1244,7 @@ struct psched_ratecfg {u64 rate_bytes_ps;/* bytes per second */ u32 mult;u16 overhead; +u16 mpu;u8 linklayer;u8 shift; };
@@ -1253,6 +1254,9 @@ static inline u64 psched_l2t_ns(const st { len += r->overhead; +if (len < r->mpu) + len = r->mpu; +if (unlikely (r->linklayer ==TC_LINKLAYER_ATM ))return ((u64)(DIV_ROUND_UP (len,48 )*53 ) * r->mult) >> r->shift;
@@ -1275,6 +1279,7 @@ static inline void psched_ratecfg_getrat res->rate =min_t (u64, r->rate_bytes_ps, ~0U ); res->overhead = r->overhead; + res->mpu = r->mpu; res->linklayer = (r->linklayer &TC_LINKLAYER_MASK ); }
net/sched/sch_generic.c +1 -0
@@ -1474,6 +1474,7 @@ void psched_ratecfg_precompute(struct ps {memset (r,0 ,sizeof (*r)); r->overhead = conf->overhead; + r->mpu = conf->mpu; r->rate_bytes_ps =max_t (u64, conf->rate, rate64); r->linklayer = (conf->linklayer &TC_LINKLAYER_MASK );psched_ratecfg_precompute__ (r->rate_bytes_ps, &r->mult, &r->shift);
Greg Kroah-Hartman
maintainerPATCH 1012/1039 net: mscc: ocelot: dont let phylink re-enable TX PAUSE on the NPI port
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit 33cb0ff30cff104e753f7882c99e54cf67ea7903 upstream.
Since commit b39648079db4 ("net: mscc: ocelot: disable flow control on NPI interface"), flow control should be disabled on the DSA CPU port when used in NPI mode.
However, the commit blamed in the Fixes: tag below broke this, because it allowed felix_phylink_mac_link_up() to overwrite SYS_PAUSE_CFG_PAUSE_ENA for the DSA CPU port.
This issue became noticeable since the device tree update from commit 8fcea7be5736 ("arm64: dts: ls1028a: mark internal links between Felix and ENETC as capable of flow control").
The solution is to check whether this is the currently configured NPI port from ocelot_phylink_mac_link_up(), and to not modify the statically disabled PAUSE frame transmission if it is.
When the port is configured for lossless mode as opposed to tail drop mode, but the link partner (DSA master) doesn't observe the transmitted PAUSE frames, the switch termination throughput is much worse, as can be seen below.
Before:
root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 37504 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 28.4 MBytes 238 Mbits/sec 357 22.6 KBytes [ 5] 1.00-2.00 sec 33.6 MBytes 282 Mbits/sec 426 19.8 KBytes [ 5] 2.00-3.00 sec 34.0 MBytes 285 Mbits/sec 343 21.2 KBytes [ 5] 3.00-4.00 sec 32.9 MBytes 276 Mbits/sec 354 22.6 KBytes [ 5] 4.00-5.00 sec 32.3 MBytes 271 Mbits/sec 297 18.4 KBytes ^C[ 5] 5.00-5.06 sec 2.05 MBytes 270 Mbits/sec 45 19.8 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-5.06 sec 163 MBytes 271 Mbits/sec 1822 sender [ 5] 0.00-5.06 sec 0.00 Bytes 0.00 bits/sec receiver
After:
root@debian:~# iperf3 -c 192.168.100.2 Connecting to host 192.168.100.2, port 5201 [ 5] local 192.168.100.1 port 49470 connected to 192.168.100.2 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 112 MBytes 941 Mbits/sec 259 143 KBytes [ 5] 1.00-2.00 sec 110 MBytes 920 Mbits/sec 329 144 KBytes [ 5] 2.00-3.00 sec 112 MBytes 936 Mbits/sec 255 144 KBytes [ 5] 3.00-4.00 sec 110 MBytes 927 Mbits/sec 355 105 KBytes [ 5] 4.00-5.00 sec 110 MBytes 926 Mbits/sec 350 156 KBytes [ 5] 5.00-6.00 sec 110 MBytes 925 Mbits/sec 305 148 KBytes [ 5] 6.00-7.00 sec 110 MBytes 924 Mbits/sec 320 143 KBytes [ 5] 7.00-8.00 sec 110 MBytes 925 Mbits/sec 273 97.6 KBytes [ 5] 8.00-9.00 sec 109 MBytes 913 Mbits/sec 299 141 KBytes [ 5] 9.00-10.00 sec 110 MBytes 922 Mbits/sec 287 146 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.00 sec 1.08 GBytes 926 Mbits/sec 3032 sender [ 5] 0.00-10.00 sec 1.08 GBytes 925 Mbits/sec receiver
--- drivers/net/ethernet/mscc/ocelot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mscc/ocelot.c +4 -1
@@ -692,7 +692,10 @@ void ocelot_phylink_mac_link_up(struct oocelot_write_rix (ocelot,0 ,ANA_POL_FLOWC , port); -ocelot_fields_write (ocelot, port,SYS_PAUSE_CFG_PAUSE_ENA , tx_pause); +/* Don't attempt to send PAUSE frames on the NPI port, it's broken */ +if (port != ocelot->npi) +ocelot_fields_write (ocelot, port,SYS_PAUSE_CFG_PAUSE_ENA , + tx_pause);/* Undo the effects of ocelot_phylink_mac_link_down: * enable MAC module
Greg Kroah-Hartman
maintainerPATCH 1013/1039 bcmgenet: add WOL IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream.
The driver neglects to check the result of platform_get_irq_optional()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL. Stop calling devm_request_irq() with the invalid IRQ #s.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +6 -4
@@ -4020,10 +4020,12 @@ static int bcmgenet_probe(struct platfor/* Request the WOL interrupt and advertise suspend if available */ priv->wol_irq_disabled = true; - err =devm_request_irq (&pdev->dev, priv->wol_irq, bcmgenet_wol_isr,0 , - dev->name, priv); -if (!err) -device_set_wakeup_capable (&pdev->dev,1 ); +if (priv->wol_irq >0 ) { + err =devm_request_irq (&pdev->dev, priv->wol_irq, + bcmgenet_wol_isr,0 , dev->name, priv); +if (!err) +device_set_wakeup_capable (&pdev->dev,1 ); + }/* Set the needed headroom to account for any possible * features enabling/disabling at runtime
Greg Kroah-Hartman
maintainerPATCH 1014/1039 net: mscc: ocelot: dont dereference NULL pointers with shared tc filters
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit 80f15f3bef9e9c2cc29888a6773df44de0a0c65f upstream.
The following command sequence:
tc qdisc del dev swp0 clsact
tc qdisc add dev swp0 ingress_block 1 clsact
tc qdisc add dev swp1 ingress_block 1 clsact
tc filter add block 1 flower action drop
tc qdisc del dev swp0 clsact
produces the following NPD:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000014 pc : vcap_entry_set+0x14/0x70 lr : ocelot_vcap_filter_del+0x198/0x234 Call trace: vcap_entry_set+0x14/0x70 ocelot_vcap_filter_del+0x198/0x234 ocelot_cls_flower_destroy+0x94/0xe4 felix_cls_flower_del+0x70/0x84 dsa_slave_setup_tc_block_cb+0x13c/0x60c dsa_slave_setup_tc_block_cb_ig+0x20/0x30 tc_setup_cb_reoffload+0x44/0x120 fl_reoffload+0x280/0x320 tcf_block_playback_offloads+0x6c/0x184 tcf_block_unbind+0x80/0xe0 tcf_block_setup+0x174/0x214 tcf_block_offload_cmd.isra.0+0x100/0x13c tcf_block_offload_unbind+0x5c/0xa0 __tcf_block_put+0x54/0x174 tcf_block_put_ext+0x5c/0x74 clsact_destroy+0x40/0x60 qdisc_destroy+0x4c/0x150 qdisc_put+0x70/0x90 qdisc_graft+0x3f0/0x4c0 tc_get_qdisc+0x1cc/0x364 rtnetlink_rcv_msg+0x124/0x340
The reason is that the driver isn't prepared to receive two tc filters with the same cookie. It unconditionally creates a new struct ocelot_vcap_filter for each tc filter, and it adds all filters with the same identifier (cookie) to the ocelot_vcap_block.
The problem is here, in ocelot_vcap_filter_del():
/* Gets index of the filter */
index = ocelot_vcap_block_get_filter_index(block, filter);
if (index < 0)
return index;
/* Delete filter */
ocelot_vcap_block_remove_filter(ocelot, block, filter);
/* Move up all the blocks over the deleted filter */
for (i = index; i < block->count; i++) {
struct ocelot_vcap_filter *tmp;
tmp = ocelot_vcap_block_find_filter_by_index(block, i);
vcap_entry_set(ocelot, i, tmp);
}what will happen is ocelot_vcap_block_get_filter_index() will return the index (@index) of the first filter found with that cookie. This is _not_ the index of _this_ filter, but the other one with the same cookie, because ocelot_vcap_filter_equal() gets fooled.
Then later, ocelot_vcap_block_remove_filter() is coded to remove all filters that are ocelot_vcap_filter_equal() with the passed @filter. So unexpectedly, both filters get deleted from the list.
Then ocelot_vcap_filter_del() will attempt to move all the other filters up, again finding them by index (@i). The block count is 2, @index was 0, so it will attempt to move up filter @i=0 and @i=1. It assigns tmp = ocelot_vcap_block_find_filter_by_index(block, i), which is now a NULL pointer because ocelot_vcap_block_remove_filter() has removed more than one filter.
As far as I can see, this problem has been there since the introduction of tc offload support, however I cannot test beyond the blamed commit due to hardware availability. In any case, any fix cannot be backported that far, due to lots of changes to the code base.
Therefore, let's go for the correct solution, which is to not call ocelot_vcap_filter_add() and ocelot_vcap_filter_del(), unless the filter is actually unique and not shared. For the shared filters, we should just modify the ingress port mask and call ocelot_vcap_filter_replace(), a function introduced by commit 95706be13b9f ("net: mscc: ocelot: create a function that replaces an existing VCAP filter"). This way, block->rules will only contain filters with unique cookies, by design.
--- drivers/net/ethernet/mscc/ocelot_flower.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/net/ethernet/mscc/ocelot_flower.c +28 -1
@@ -763,13 +763,34 @@ int ocelot_cls_flower_replace(struct ocestruct netlink_ext_ack *extack = f->common.extack;struct ocelot_vcap_filter *filter;int chain = f->common.chain_index; -int ret; +int block_id, ret;if (chain && !ocelot_find_vcap_filter_that_points_at (ocelot, chain)) {NL_SET_ERR_MSG_MOD (extack,"No default GOTO action points to this chain" );return -EOPNOTSUPP ; } + block_id =ocelot_chain_to_block (chain, ingress); +if (block_id <0 ) { +NL_SET_ERR_MSG_MOD (extack,"Cannot offload to this chain" ); +return -EOPNOTSUPP ; + } + + filter =ocelot_vcap_block_find_filter_by_id (&ocelot->block[block_id], + f->cookie, true); +if (filter) { +/* Filter already exists on other ports */ +if (!ingress) { +NL_SET_ERR_MSG_MOD (extack,"VCAP ES0 does not support shared filters" ); +return -EOPNOTSUPP ; + } + + filter->ingress_port_mask |=BIT (port); + +return ocelot_vcap_filter_replace (ocelot, filter); + } + +/* Filter didn't exist, create it now */ filter =ocelot_vcap_filter_create (ocelot, port, ingress, f);if (!filter)return -ENOMEM ;
@@ -816,6 +837,12 @@ int ocelot_cls_flower_destroy(struct oceif (filter->type ==OCELOT_VCAP_FILTER_DUMMY )return ocelot_vcap_dummy_filter_del (ocelot, filter); +if (ingress) { + filter->ingress_port_mask &= ~BIT (port); +if (filter->ingress_port_mask) +return ocelot_vcap_filter_replace (ocelot, filter); + } +return ocelot_vcap_filter_del (ocelot, filter); }EXPORT_SYMBOL_GPL (ocelot_cls_flower_destroy);
Greg Kroah-Hartman
maintainerPATCH 1015/1039 net: wwan: Fix MRU mismatch issue which may lead to data connection lost
In reply to Greg Kroah-HartmanFrom: Slark Xiao <[email protected]>
commit f542cdfa3083a309e3caafbbdf41490c4935492a upstream.
In pci_generic.c there is a 'mru_default' in struct mhi_pci_dev_info.
This value shall be used for whole mhi if it's given a value for a specific product. But in function mhi_net_rx_refill_work(), it's still using hard code value MHI_DEFAULT_MRU. 'mru_default' shall have higher priority than MHI_DEFAULT_MRU.
And after checking, this change could help fix a data connection lost issue.
--- drivers/net/wwan/mhi_wwan_mbim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wwan/mhi_wwan_mbim.c +2 -2
@@ -385,13 +385,13 @@ static void mhi_net_rx_refill_work(strucint err;while (!mhi_queue_is_full (mdev,DMA_FROM_DEVICE )) { -struct sk_buff *skb =alloc_skb (MHI_DEFAULT_MRU ,GFP_KERNEL ); +struct sk_buff *skb =alloc_skb (mbim->mru,GFP_KERNEL );if (unlikely (!skb))break ; err =mhi_queue_skb (mdev,DMA_FROM_DEVICE , skb, -MHI_DEFAULT_MRU ,MHI_EOT ); + mbim->mru,MHI_EOT );if (unlikely (err)) {kfree_skb (skb);break ;
Greg Kroah-Hartman
maintainerPATCH 1016/1039 net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config()
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit 214b3369ab9b0a6f28d6c970220c209417edbc65 upstream.
Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates
to a garbage value
if (err)
^~~err is not initialized and only conditionally set. So intitialize err.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +1 -1
@@ -224,7 +224,7 @@ static void mtk_mac_config(struct phylin phylink_config);struct mtk_eth *eth = mac->hw;u32 mcr_cur, mcr_new, sid, i; -int val, ge_mode, err; +int val, ge_mode, err =0 ;/* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
Greg Kroah-Hartman
maintainerPATCH 1017/1039 net: ocelot: Fix the call to switchdev_bridge_port_offload
In reply to Greg Kroah-HartmanFrom: Horatiu Vultur <[email protected]>
commit c0b7f7d7e0ad44f35745c01964b3fa2833e298cb upstream.
In the blamed commit, the call to the function switchdev_bridge_port_offload was passing the wrong argument for atomic_nb. It was ocelot_netdevice_nb instead of ocelot_swtchdev_nb. This patch fixes this issue.
--- drivers/net/ethernet/mscc/ocelot_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mscc/ocelot_net.c +3 -3
@@ -1168,7 +1168,7 @@ static int ocelot_netdevice_bridge_join(ocelot_port_bridge_join (ocelot, port, bridge); err =switchdev_bridge_port_offload (brport_dev, dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb, false, extack);if (err)
@@ -1182,7 +1182,7 @@ static int ocelot_netdevice_bridge_join( err_switchdev_sync:switchdev_bridge_port_unoffload (brport_dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb); err_switchdev_offload:ocelot_port_bridge_leave (ocelot, port, bridge);
@@ -1195,7 +1195,7 @@ static void ocelot_netdevice_pre_bridge_struct ocelot_port_private *priv =netdev_priv (dev);switchdev_bridge_port_unoffload (brport_dev, priv, - &ocelot_netdevice_nb, + &ocelot_switchdev_nb, &ocelot_switchdev_blocking_nb); }
Greg Kroah-Hartman
maintainerPATCH 1018/1039 net: sfp: fix high power modules without diagnostic monitoring
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
commit 5765cee119bf5a36c94d20eceb37c445508934be upstream.
Commit 7cfa9c92d0a3 ("net: sfp: avoid power switch on address-change modules") unintetionally changed the semantics for high power modules without the digital diagnostics monitoring. We repeatedly attempt to read the power status from the non-existing 0xa2 address in a futile hope this failure is temporary:
[ 8.856051] sfp sfp-eth3: module NTT 0000000000000000 rev 0000 sn 0000000000000000 dc 160408 [ 8.865843] mvpp2 f4000000.ethernet eth3: switched to inband/1000base-x link mode [ 8.873469] sfp sfp-eth3: Failed to read EEPROM: -5 [ 8.983251] sfp sfp-eth3: Failed to read EEPROM: -5 [ 9.103250] sfp sfp-eth3: Failed to read EEPROM: -5
We previosuly assumed such modules were powered up in the correct mode, continuing without further configuration as long as the required power class was supported by the host.
Restore this behaviour, while preserving the intent of subsequent patches to avoid the "Address Change Sequence not supported" warning if we are not going to be accessing the DDM address.
--- drivers/net/phy/sfp.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/net/phy/sfp.c +21 -4
@@ -1641,17 +1641,20 @@ static int sfp_sm_probe_for_phy(struct sstatic int sfp_module_parse_power (struct sfp *sfp) {u32 power_mW =1000 ; +bool supports_a2;if (sfp->id.ext.options &cpu_to_be16 (SFP_OPTIONS_POWER_DECL )) power_mW =1500 ;if (sfp->id.ext.options &cpu_to_be16 (SFP_OPTIONS_HIGH_POWER_LEVEL )) power_mW =2000 ; + supports_a2 = sfp->id.ext.sff8472_compliance != +SFP_SFF8472_COMPLIANCE_NONE || + sfp->id.ext.diagmon &SFP_DIAGMON_DDM ; +if (power_mW > sfp->max_power_mW) {/* Module power specification exceeds the allowed maximum. */ -if (sfp->id.ext.sff8472_compliance == -SFP_SFF8472_COMPLIANCE_NONE && - !(sfp->id.ext.diagmon &SFP_DIAGMON_DDM )) { +if (!supports_a2) {/* The module appears not to implement bus address * 0xa2, so assume that the module powers up in the * indicated mode.
@@ -1668,11 +1671,25 @@ static int sfp_module_parse_power(struct } } +if (power_mW <=1000 ) { +/* Modules below 1W do not require a power change sequence */ + sfp->module_power_mW = power_mW; +return 0 ; + } + +if (!supports_a2) { +/* The module power level is below the host maximum and the +* module appears not to implement bus address 0xa2, so assume +* that the module powers up in the indicated mode. +*/ +return 0 ; + } +/* If the module requires a higher power mode, but also requires * an address change sequence, warn the user that the module may * not be functional. */ -if (sfp->id.ext.diagmon &SFP_DIAGMON_ADDRMODE && power_mW >1000 ) { +if (sfp->id.ext.diagmon &SFP_DIAGMON_ADDRMODE ) {dev_warn (sfp->dev,"Address Change Sequence not supported but module requires %u.%uW, module may not be functional\n" , power_mW /1000 , (power_mW /100 ) %10 );
Greg Kroah-Hartman
maintainerPATCH 1019/1039 net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit 1771afd47430f5e95c9c3a2e3a8a63e67402d3fe upstream.
Both versions of the CPSW driver declare a CPSW_HEADROOM_NA macro that takes NET_IP_ALIGN into account, but fail to use it appropriately when storing incoming packets in memory. This results in the IPv4 source and destination addresses to appear misaligned in memory, which causes aligment faults that need to be fixed up in software.
So let's switch from CPSW_HEADROOM to CPSW_HEADROOM_NA where needed. This gets rid of any alignment faults on the RX path on a Beaglebone White.
--- drivers/net/ethernet/ti/cpsw.c | 6 +++--- drivers/net/ethernet/ti/cpsw_new.c | 6 +++--- drivers/net/ethernet/ti/cpsw_priv.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/ti/cpsw.c +3 -3
@@ -349,7 +349,7 @@ static void cpsw_rx_handler(void *token,struct cpsw_common *cpsw =ndev_to_cpsw (xmeta->ndev);int pkt_size = cpsw->rx_packet_max;int ret =0 , port, ch = xmeta->ch; -int headroom =CPSW_HEADROOM ; +int headroom =CPSW_HEADROOM_NA ;struct net_device *ndev = xmeta->ndev;struct cpsw_priv *priv;struct page_pool *pool;
@@ -392,7 +392,7 @@ static void cpsw_rx_handler(void *token, }if (priv->xdp_prog) { -int headroom =CPSW_HEADROOM , size = len; +int size = len;xdp_init_buff (&xdp,PAGE_SIZE , &priv->xdp_rxq[ch]);if (status &CPDMA_RX_VLAN_ENCAP ) {
@@ -442,7 +442,7 @@ requeue: xmeta->ndev = ndev; xmeta->ch = ch; - dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM ; + dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM_NA ; ret =cpdma_chan_submit_mapped (cpsw->rxv[ch].ch, new_page, dma, pkt_size,0 );if (ret <0 ) {
drivers/net/ethernet/ti/cpsw_new.c +3 -3
@@ -283,7 +283,7 @@ static void cpsw_rx_handler(void *token, {struct page *new_page, *page = token;void *pa =page_address (page); -int headroom =CPSW_HEADROOM ; +int headroom =CPSW_HEADROOM_NA ;struct cpsw_meta_xdp *xmeta;struct cpsw_common *cpsw;struct net_device *ndev;
@@ -336,7 +336,7 @@ static void cpsw_rx_handler(void *token, }if (priv->xdp_prog) { -int headroom =CPSW_HEADROOM , size = len; +int size = len;xdp_init_buff (&xdp,PAGE_SIZE , &priv->xdp_rxq[ch]);if (status &CPDMA_RX_VLAN_ENCAP ) {
@@ -386,7 +386,7 @@ requeue: xmeta->ndev = ndev; xmeta->ch = ch; - dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM ; + dma =page_pool_get_dma_addr (new_page) +CPSW_HEADROOM_NA ; ret =cpdma_chan_submit_mapped (cpsw->rxv[ch].ch, new_page, dma, pkt_size,0 );if (ret <0 ) {
drivers/net/ethernet/ti/cpsw_priv.c +1 -1
@@ -1120,7 +1120,7 @@ int cpsw_fill_rx_channels(struct cpsw_pr xmeta->ndev = priv->ndev; xmeta->ch = ch; - dma =page_pool_get_dma_addr (page) +CPSW_HEADROOM ; + dma =page_pool_get_dma_addr (page) +CPSW_HEADROOM_NA ; ret = cpdma_chan_idle_submit_mapped(cpsw->rxv[ch].ch, page, dma, cpsw->rx_packet_max,
Greg Kroah-Hartman
maintainerPATCH 1020/1039 net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
commit f1131b9c23fb4a3540a774828ff49f421619f902 upstream.
On a setup with KSZ9131 and MACB drivers it happens on suspend path, from time to time, that the PHY interrupt arrives after PHY and MACB were suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this case the phy_read() at the beginning of kszphy_handle_interrupt() will fail (as MACB driver is suspended at this time) leading to phy_error() being called and a stack trace being displayed on console. To solve this .suspend/.resume functions for all KSZ devices implementing .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume() which disable/enable interrupt before/after calling genphy_suspend()/genphy_resume().
The fix has been adapted for all KSZ devices which implements .handle_interrupt but it has been tested only on KSZ9131.
--- drivers/net/phy/micrel.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/net/phy/micrel.c +18 -18
@@ -1630,8 +1630,8 @@ static struct phy_driver ksphy_driver[] .config_init = kszphy_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8021, .phy_id_mask = 0x00ffffff,
@@ -1645,8 +1645,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8031, .phy_id_mask = 0x00ffffff,
@@ -1660,8 +1660,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8041, .phy_id_mask = MICREL_PHY_ID_MASK,
@@ -1692,8 +1692,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .name = "Micrel KSZ8051", /* PHY_BASIC_FEATURES */
@@ -1706,8 +1706,8 @@ static struct phy_driver ksphy_driver[] .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, .match_phy_device = ksz8051_match_phy_device, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8001, .name = "Micrel KSZ8001 or KS8721",
@@ -1721,8 +1721,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8081, .name = "Micrel KSZ8081 or KSZ8091",
@@ -1752,8 +1752,8 @@ static struct phy_driver ksphy_driver[] .config_init = ksz8061_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ9021, .phy_id_mask = 0x000ffffe,
@@ -1768,8 +1768,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, }, {
@@ -1787,7 +1787,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, + .suspend = kszphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_LAN8814,
@@ -1829,7 +1829,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, + .suspend = kszphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8873MLL,
Greg Kroah-Hartman
maintainerPATCH 1021/1039 net: mscc: ocelot: fix using match before it is set
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit baa59504c1cd0cca7d41954a45ee0b3dc78e41a0 upstream.
Clang static analysis reports this issue ocelot_flower.c:563:8: warning: 1st function call argument
is an uninitialized value
!is_zero_ether_addr(match.mask->dst)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The variable match is used before it is set. So move the block.
--- drivers/net/ethernet/mscc/ocelot_flower.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/ethernet/mscc/ocelot_flower.c +8 -7
@@ -521,13 +521,6 @@ ocelot_flower_parse_key(struct ocelot *oreturn -EOPNOTSUPP ; } -if (filter->block_id ==VCAP_IS1 && - !is_zero_ether_addr (match.mask->dst)) { -NL_SET_ERR_MSG_MOD (extack, -"Key type S1_NORMAL cannot match on destination MAC" ); -return -EOPNOTSUPP ; - } -/* The hw support mac matches only for MAC_ETYPE key, * therefore if other matches(port, tcp flags, etc) are added * then just bail out
@@ -542,6 +535,14 @@ ocelot_flower_parse_key(struct ocelot *oreturn -EOPNOTSUPP ;flow_rule_match_eth_addrs (rule, &match); + +if (filter->block_id ==VCAP_IS1 && + !is_zero_ether_addr (match.mask->dst)) { +NL_SET_ERR_MSG_MOD (extack, +"Key type S1_NORMAL cannot match on destination MAC" ); +return -EOPNOTSUPP ; + } + filter->key_type =OCELOT_VCAP_KEY_ETYPE ;ether_addr_copy (filter->key.etype.dmac.value, match.key->dst);
Greg Kroah-Hartman
maintainerPATCH 1022/1039 dt-bindings: display: meson-dw-hdmi: add missing sound-name-prefix property
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
commit 22bf4047d26980807611b7e2030803db375afd87 upstream.
This is used in meson-gx and meson-g12. Add the property to the binding. This fixes the dtschema warning:
hdmi-tx@c883a000: 'sound-name-prefix' does not match any of the
regexes: 'pinctrl-[0-9]+'
--- Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml +5 -0
@@ -10,6 +10,9 @@ title: Amlogic specific extensions to th maintainers: - Neil Armstrong <[email protected]> +allOf: + - $ref: /schemas/sound/name-prefix.yaml# + description: | The Amlogic Meson Synopsys Designware Integration is composed of - A Synopsys DesignWare HDMI Controller IP
@@ -99,6 +102,8 @@ properties: "#sound-dai-cells": const: 0 + sound-name-prefix: true + required: - compatible - reg
Greg Kroah-Hartman
maintainerPATCH 1023/1039 dt-bindings: display: meson-vpu: Add missing amlogic,canvas property
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
commit 640f35b871d29cd685ce0ea0762636381beeb98a upstream.
This property was already mentioned in the old textual bindings amlogic,meson-vpu.txt, but got dropped during conversion. Adding it back similar to amlogic,gx-vdec.yaml.
--- Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +6 -0
@@ -78,6 +78,10 @@ properties: interrupts: maxItems: 1 + amlogic,canvas: + description: should point to a canvas provider node + $ref: /schemas/types.yaml#/definitions/phandle + power-domains: maxItems: 1 description: phandle to the associated power domain
@@ -106,6 +110,7 @@ required: - port@1 - "#address-cells" - "#size-cells" + - amlogic,canvas additionalProperties: false
@@ -118,6 +123,7 @@ examples: interrupts = <3>; #address-cells = <1>; #size-cells = <0>; + amlogic,canvas = <&canvas>; /* CVBS VDAC output port */ port@0 {
Greg Kroah-Hartman
maintainerPATCH 1024/1039 dt-bindings: watchdog: Require samsung,syscon-phandle for Exynos7
In reply to Greg Kroah-HartmanFrom: Sam Protsenko <[email protected]>
commit 33950f9a36aca55c2b1e6062d9b29f3e97f91c40 upstream.
Exynos7 watchdog driver is clearly indicating that its dts node must define syscon phandle property. That was probably forgotten, so add it.
--- Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml +3 -2
@@ -39,8 +39,8 @@ properties: samsung,syscon-phandle: $ref: /schemas/types.yaml#/definitions/phandle description: - Phandle to the PMU system controller node (in case of Exynos5250 - and Exynos5420). + Phandle to the PMU system controller node (in case of Exynos5250, + Exynos5420 and Exynos7). required: - compatible
@@ -58,6 +58,7 @@ allOf: enum: - samsung,exynos5250-wdt - samsung,exynos5420-wdt + - samsung,exynos7-wdt then: required: - samsung,syscon-phandle
Greg Kroah-Hartman
maintainerPATCH 1025/1039 sch_api: Dont skip qdisc attach on ingress
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
commit de2d807b294d3d2ce5e59043ae2634016765d076 upstream.
The attach callback of struct Qdisc_ops is used by only a few qdiscs:
mq, mqprio and htb. qdisc_graft() contains the following logic (pseudocode):
if (!qdisc->ops->attach) {
if (ingress)
do ingress stuff;
else
do egress stuff;
}
if (!ingress) {
...
if (qdisc->ops->attach)
qdisc->ops->attach(qdisc);
} else {
...
}As we see, the attach callback is not called if the qdisc is being attached to ingress (TC_H_INGRESS). That wasn't a problem for mq and mqprio, since they contain a check that they are attached to TC_H_ROOT, and they can't be attached to TC_H_INGRESS anyway.
However, the commit cited below added the attach callback to htb. It is needed for the hardware offload, but in the non-offload mode it simulates the "do egress stuff" part of the pseudocode above. The problem is that when htb is attached to ingress, neither "do ingress stuff" nor attach() is called. It results in an inconsistency, and the following message is printed to dmesg:
unregister_netdevice: waiting for lo to become free. Usage count = 2
This commit addresses the issue by running "do ingress stuff" in the ingress flow even in the attach callback is present, which is fine, because attach isn't going to be called afterwards.
The bug was found by syzbot and reported by Eric.
--- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_api.c +1 -1
@@ -1062,7 +1062,7 @@ static int qdisc_graft(struct net_deviceqdisc_offload_graft_root (dev, new, old, extack); -if (new && new->ops->attach) +if (new && new->ops->attach && !ingress) goto skip;for (i =0 ; i < num_q; i++) {
Greg Kroah-Hartman
maintainerPATCH 1026/1039 blk-mq: fix tag_get wait task cant be awakened
In reply to Greg Kroah-HartmanFrom: Laibin Qiu <[email protected]>
commit 180dccb0dba4f5e84a4a70c1be1d34cbb6528b32 upstream.
In case of shared tags, there might be more than one hctx which allocates from the same tags, and each hctx is limited to allocate at most:
hctx_max_depth = max((bt->sb.depth + users - 1) / users, 4U);
tag idle detection is lazy, and may be delayed for 30sec, so there could be just one real active hctx(queue) but all others are actually idle and still accounted as active because of the lazy idle detection. Then if wake_batch is > hctx_max_depth, driver tag allocation may wait forever on this real active hctx.
Fix this by recalculating wake_batch when inc or dec active_queues.
--- block/blk-mq-tag.c | 40 +++++++++++++++++++++++++++++++++------- include/linux/sbitmap.h | 11 +++++++++++ lib/sbitmap.c | 25 ++++++++++++++++++++++--- 3 files changed, 66 insertions(+), 10 deletions(-)
block/blk-mq-tag.c +33 -7
@@ -17,6 +17,21 @@#include "blk-mq-tag.h" /* +* Recalculate wakeup batch when tag is shared by hctx. +*/ +static void blk_mq_update_wake_batch (struct blk_mq_tags *tags, +unsigned int users) +{ +if (!users) +return ; + +sbitmap_queue_recalculate_wake_batch (&tags->bitmap_tags, + users); +sbitmap_queue_recalculate_wake_batch (&tags->breserved_tags, + users); +} + +/* * If a previously inactive queue goes active, bump the active user count. * We need to do this before try to allocate driver tag, then even if fail * to get tag when first time, the other shared-tag users could reserve
@@ -24,18 +39,26 @@*/ bool __blk_mq_tag_busy (struct blk_mq_hw_ctx *hctx) { +unsigned int users; +if (blk_mq_is_shared_tags (hctx->flags)) {struct request_queue *q = hctx->queue; -if (!test_bit (QUEUE_FLAG_HCTX_ACTIVE , &q->queue_flags) && - !test_and_set_bit (QUEUE_FLAG_HCTX_ACTIVE , &q->queue_flags)) -atomic_inc (&hctx->tags->active_queues); +if (test_bit (QUEUE_FLAG_HCTX_ACTIVE , &q->queue_flags) || +test_and_set_bit (QUEUE_FLAG_HCTX_ACTIVE , &q->queue_flags)) { +return true; + } }else { -if (!test_bit (BLK_MQ_S_TAG_ACTIVE , &hctx->state) && - !test_and_set_bit (BLK_MQ_S_TAG_ACTIVE , &hctx->state)) -atomic_inc (&hctx->tags->active_queues); +if (test_bit (BLK_MQ_S_TAG_ACTIVE , &hctx->state) || +test_and_set_bit (BLK_MQ_S_TAG_ACTIVE , &hctx->state)) { +return true; + } } + users =atomic_inc_return (&hctx->tags->active_queues); + +blk_mq_update_wake_batch (hctx->tags, users); +return true; }
@@ -56,6 +79,7 @@ void blk_mq_tag_wakeup_all(struct blk_mqvoid __blk_mq_tag_idle (struct blk_mq_hw_ctx *hctx) {struct blk_mq_tags *tags = hctx->tags; +unsigned int users;if (blk_mq_is_shared_tags (hctx->flags)) {struct request_queue *q = hctx->queue;
@@ -68,7 +92,9 @@ void __blk_mq_tag_idle(struct blk_mq_hw_return ; } -atomic_dec (&tags->active_queues); + users =atomic_dec_return (&tags->active_queues); + +blk_mq_update_wake_batch (tags, users);blk_mq_tag_wakeup_all (tags, false); }
include/linux/sbitmap.h +11 -0
@@ -416,6 +416,17 @@ static inline void sbitmap_queue_free(st }/** +* sbitmap_queue_recalculate_wake_batch() - Recalculate wake batch +* @sbq: Bitmap queue to recalculate wake batch. +* @users: Number of shares. +* +* Like sbitmap_queue_update_wake_batch(), this will calculate wake batch +* by depth. This interface is for HCTX shared tags or queue shared tags. +*/ +void sbitmap_queue_recalculate_wake_batch (struct sbitmap_queue *sbq, +unsigned int users); + +/** * sbitmap_queue_resize() - Resize a &struct sbitmap_queue. * @sbq: Bitmap queue to resize. * @depth: New number of bits to resize to.
lib/sbitmap.c +22 -3
@@ -457,10 +457,9 @@ int sbitmap_queue_init_node(struct sbitm }EXPORT_SYMBOL_GPL (sbitmap_queue_init_node); -static void sbitmap_queue_update_wake_batch (struct sbitmap_queue *sbq, -unsigned int depth) +static inline void __sbitmap_queue_update_wake_batch (struct sbitmap_queue *sbq, +unsigned int wake_batch) { -unsigned int wake_batch =sbq_calc_wake_batch (sbq, depth);int i;if (sbq->wake_batch != wake_batch) {
@@ -476,6 +475,26 @@ static void sbitmap_queue_update_wake_ba } } +static void sbitmap_queue_update_wake_batch (struct sbitmap_queue *sbq, +unsigned int depth) +{ +unsigned int wake_batch; + + wake_batch =sbq_calc_wake_batch (sbq, depth); +__sbitmap_queue_update_wake_batch (sbq, wake_batch); +} + +void sbitmap_queue_recalculate_wake_batch (struct sbitmap_queue *sbq, +unsigned int users) +{ +unsigned int wake_batch; + + wake_batch =clamp_val ((sbq->sb.depth + users -1 ) / + users,4 ,SBQ_WAKE_BATCH ); +__sbitmap_queue_update_wake_batch (sbq, wake_batch); +} +EXPORT_SYMBOL_GPL (sbitmap_queue_recalculate_wake_batch); +void sbitmap_queue_resize (struct sbitmap_queue *sbq,unsigned int depth) {sbitmap_queue_update_wake_batch (sbq, depth);
Re: [PATCH 5.16 1026/1039] blk-mq: fix tag_get wait task cant be awakened
Quoted 17 lines · Greg Kroah-Hartman
From: Laibin Qiu<[email protected]>
commit
180dccb0dba4f5e84a4a70c1be1d34cbb6528b32upstream.In case of shared tags, there might be more than one hctx which allocates from the same tags, and each hctx is limited to allocate at most:
hctx_max_depth = max((bt->sb.depth + users - 1) / users, 4U);tag idle detection is lazy, and may be delayed for 30sec, so there could be just one real active hctx(queue) but all others are actually idle and still accounted as active because of the lazy idle detection. Then if
wake_batchis >hctx_max_depth, driver tag allocation may wait forever on this real active hctx.Fix this by recalculating
wake_batchwhen inc or decactive_queues.
Quoted 8 lines
Fixes 0d2602ca30e41 ("blk-mq: improve support for shared tags maps")Suggested-by Ming Lei<[email protected]>Suggested-by John Garry<[email protected]>Signed-off-by Laibin Qiu<[email protected]>Reviewed-by Andy Shevchenko<[email protected]>Signed-off-by Jens Axboe<[email protected]>Signed-off-by Greg Kroah-Hartman<[email protected]>
JFYI, Somebody reported a hang with this commit:
https://lore.kernel.org/linux-block/[email protected]/T/#t
Thanks,
John
Greg Kroah-Hartman
maintainerRe: [PATCH 5.16 1026/1039] blk-mq: fix tag_get wait task cant be awakened
Quoted 27 lines · John Garry
Quoted 17 lines · Greg Kroah-Hartman
From: Laibin Qiu<[email protected]>
commit
180dccb0dba4f5e84a4a70c1be1d34cbb6528b32upstream.In case of shared tags, there might be more than one hctx which allocates from the same tags, and each hctx is limited to allocate at most:
hctx_max_depth = max((bt->sb.depth + users - 1) / users, 4U);tag idle detection is lazy, and may be delayed for 30sec, so there could be just one real active hctx(queue) but all others are actually idle and still accounted as active because of the lazy idle detection. Then if
wake_batchis >hctx_max_depth, driver tag allocation may wait forever on this real active hctx.Fix this by recalculating
wake_batchwhen inc or decactive_queues.Quoted 8 lines
Fixes 0d2602ca30e41 ("blk-mq: improve support for shared tags maps")Suggested-by Ming Lei<[email protected]>Suggested-by John Garry<[email protected]>Signed-off-by Laibin Qiu<[email protected]>Reviewed-by Andy Shevchenko<[email protected]>Signed-off-by Jens Axboe<[email protected]>Signed-off-by Greg Kroah-Hartman<[email protected]>
Quoted 2 lines
JFYI, Somebody reported a hang with this commit:
https://lore.kernel.org/linux-block/[email protected]/T/#t
Thanks for the report, I'll go drop this patch now.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 1027/1039 scripts/dtc: dtx_diff: remove broken example from help text
In reply to Greg Kroah-HartmanFrom: Matthias Schiffer <[email protected]>
commit d8adf5b92a9d2205620874d498c39923ecea8749 upstream.
dtx_diff suggests to use <(...) syntax to pipe two inputs into it, but this has never worked: The /proc/self/fds/... paths passed by the shell will fail the [ -f "${dtx}" ] && [ -r "${dtx}" ] check in compile_to_dts, but even with this check removed, the function cannot work: hexdump will eat up the DTB magic, making the subsequent dtc call fail, as a pipe cannot be rewound.
Simply remove this broken example, as there is already an alternative one that works fine.
--- scripts/dtc/dtx_diff | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
scripts/dtc/dtx_diff +2 -6
@@ -59,12 +59,8 @@ Otherwise DTx is treated as a dts source or '/include/' to be processed. If DTx_1 and DTx_2 are in different architectures, then this script - may not work since \${ARCH} is part of the include path. Two possible - workarounds: - - `basename $0` \\ - <(ARCH=arch_of_dtx_1 `basename $0` DTx_1) \\ - <(ARCH=arch_of_dtx_2 `basename $0` DTx_2) + may not work since \${ARCH} is part of the include path. The following + workaround can be used: `basename $0` ARCH=arch_of_dtx_1 DTx_1 >tmp_dtx_1.dts `basename $0` ARCH=arch_of_dtx_2 DTx_2 >tmp_dtx_2.dts
Greg Kroah-Hartman
maintainerPATCH 1028/1039 lib82596: Fix IRQ check in sni_82596_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 99218cbf81bf21355a3de61cd46a706d36e900e6 upstream.
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/net/ethernet/i825xx/sni_82596.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/i825xx/sni_82596.c +2 -1
@@ -117,9 +117,10 @@ static int sni_82596_probe(struct platfo netdevice->dev_addr[5 ] =readb (eth_addr +0x06 );iounmap (eth_addr); -if (!netdevice->irq) { +if (netdevice->irq <0 ) {printk (KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n" , __FILE__, netdevice->base_addr); + retval = netdevice->irq; goto probe_failed; }
Greg Kroah-Hartman
maintainerPATCH 1029/1039 mm/hmm.c: allow VM_MIXEDMAP to work with hmm_range_fault
In reply to Greg Kroah-HartmanFrom: Alistair Popple <[email protected]>
commit 87c01d57fa23de82fff593a7d070933d08755801 upstream.
hmm_range_fault() can be used instead of get_user_pages() for devices which allow faulting however unlike get_user_pages() it will return an error when used on a VM_MIXEDMAP range.
To make hmm_range_fault() more closely match get_user_pages() remove this restriction. This requires dealing with the !ARCH_HAS_PTE_SPECIAL case in hmm_vma_handle_pte(). Rather than replicating the logic of vm_normal_page() call it directly and do a check for the zero pfn similar to what get_user_pages() currently does.
Also add a test to hmm selftest to verify functionality.
--- lib/test_hmm.c | 24 ++++++++++++++++++ mm/hmm.c | 5 ++- tools/testing/selftests/vm/hmm-tests.c | 42 +++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-)
lib/test_hmm.c +24 -0
@@ -1086,9 +1086,33 @@ static long dmirror_fops_unlocked_ioctl(return 0 ; } +static int dmirror_fops_mmap (struct file *file,struct vm_area_struct *vma) +{ +unsigned long addr; + +for (addr = vma->vm_start; addr < vma->vm_end; addr +=PAGE_SIZE ) { +struct page *page; +int ret; + + page =alloc_page (GFP_KERNEL | __GFP_ZERO); +if (!page) +return -ENOMEM ; + + ret =vm_insert_page (vma, addr, page); +if (ret) { +__free_page (page); +return ret; + } +put_page (page); + } + +return 0 ; +} +static const struct file_operations dmirror_fops = { .open = dmirror_fops_open, .release = dmirror_fops_release, + .mmap = dmirror_fops_mmap, .unlocked_ioctl = dmirror_fops_unlocked_ioctl, .llseek = default_llseek, .owner =THIS_MODULE ,
mm/hmm.c +3 -2
@@ -300,7 +300,8 @@ static int hmm_vma_handle_pte(struct mm_* Since each architecture defines a struct page for the zero page, just * fall through and treat it like a normal page. */ -if (pte_special (pte) && !pte_devmap (pte) && +if (!vm_normal_page (walk->vma, addr, pte) && + !pte_devmap (pte) && !is_zero_pfn (pte_pfn (pte))) {if (hmm_pte_need_fault (hmm_vma_walk, pfn_req_flags,0 )) {pte_unmap (ptep);
@@ -518,7 +519,7 @@ static int hmm_vma_walk_test(unsigned lostruct hmm_range *range = hmm_vma_walk->range;struct vm_area_struct *vma = walk->vma; -if (!(vma->vm_flags & (VM_IO |VM_PFNMAP |VM_MIXEDMAP )) && +if (!(vma->vm_flags & (VM_IO |VM_PFNMAP )) && vma->vm_flags &VM_READ )return 0 ;
tools/testing/selftests/vm/hmm-tests.c +42 -0
48 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 1030/1039 bonding: Fix extraction of ports from the packet headers
In reply to Greg Kroah-HartmanFrom: Moshe Tal <[email protected]>
commit 429e3d123d9a50cc9882402e40e0ac912d88cfcf upstream.
Wrong hash sends single stream to multiple output interfaces.
The offset calculation was relative to skb->head, fix it to be relative to skb->data.
xdp_buff")
--- drivers/net/bonding/bond_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +2 -2
@@ -3872,8 +3872,8 @@ u32 bond_xmit_hash(struct bonding *bond, skb->l4_hash)return skb->hash; -return __bond_xmit_hash (bond, skb, skb->head, skb->protocol, - skb->mac_header, skb->network_header, +return __bond_xmit_hash (bond, skb, skb->data, skb->protocol, +skb_mac_offset (skb),skb_network_offset (skb),skb_headlen (skb)); }
Greg Kroah-Hartman
maintainerPATCH 1031/1039 lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test
In reply to Greg Kroah-HartmanFrom: Andrey Konovalov <[email protected]>
commit e073e5ef90298d2d6e5e7f04b545a0815e92110c upstream.
Make do_kmem_cache_size_bulk() destroy the cache it creates.
--- lib/test_meminit.c | 1 + 1 file changed, 1 insertion(+)
lib/test_meminit.c +1 -0
@@ -337,6 +337,7 @@ static int __init do_kmem_cache_size_bulif (num)kmem_cache_free_bulk (c, num, objects); } +kmem_cache_destroy (c); *total_failures += fail;return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 1032/1039 KVM: x86: Do runtime CPUID update before updating vcpu->arch.cpuid_entries
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
commit ee3a5f9e3d9bf94159f3cc80da542fbe83502dd8 upstream.
kvm_update_cpuid_runtime() mangles CPUID data coming from userspace VMM after updating 'vcpu->arch.cpuid_entries', this makes it impossible to compare an update with what was previously supplied. Introduce __kvm_update_cpuid_runtime() version which can be used to tweak the input before it goes to 'vcpu->arch.cpuid_entries' so the upcoming update check can compare tweaked data.
No functional change intended.
Message-Id: <[email protected]>
--- arch/x86/kvm/cpuid.c | 54 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 20 deletions(-)
arch/x86/kvm/cpuid.c +34 -20
@@ -125,14 +125,21 @@ static void kvm_update_kvm_cpuid_base(st } } -static struct kvm_cpuid_entry2 *kvm_find_kvm_cpuid_features (struct kvm_vcpu *vcpu) +static struct kvm_cpuid_entry2 *__kvm_find_kvm_cpuid_features (struct kvm_vcpu *vcpu, +struct kvm_cpuid_entry2 *entries,int nent) {u32 base = vcpu->arch.kvm_cpuid_base;if (!base)return NULL ; -return kvm_find_cpuid_entry (vcpu, base |KVM_CPUID_FEATURES ,0 ); +return cpuid_entry2_find (entries, nent, base |KVM_CPUID_FEATURES ,0 ); +} + +static struct kvm_cpuid_entry2 *kvm_find_kvm_cpuid_features (struct kvm_vcpu *vcpu) +{ +return __kvm_find_kvm_cpuid_features (vcpu, vcpu->arch.cpuid_entries, + vcpu->arch.cpuid_nent); }void kvm_update_pv_runtime (struct kvm_vcpu *vcpu)
@@ -147,11 +154,12 @@ void kvm_update_pv_runtime(struct kvm_vc vcpu->arch.pv_cpuid.features = best->eax; } -void kvm_update_cpuid_runtime (struct kvm_vcpu *vcpu) +static void __kvm_update_cpuid_runtime (struct kvm_vcpu *vcpu,struct kvm_cpuid_entry2 *entries, +int nent) {struct kvm_cpuid_entry2 *best; - best =kvm_find_cpuid_entry (vcpu,1 ,0 ); + best =cpuid_entry2_find (entries, nent,1 ,0 );if (best) {/* Update OSXSAVE bit */ if (boot_cpu_has (X86_FEATURE_XSAVE ))
@@ -162,33 +170,38 @@ void kvm_update_cpuid_runtime(struct kvm vcpu->arch.apic_base & MSR_IA32_APICBASE_ENABLE); } - best =kvm_find_cpuid_entry (vcpu,7 ,0 ); + best =cpuid_entry2_find (entries, nent,7 ,0 );if (best &&boot_cpu_has (X86_FEATURE_PKU ) && best->function ==0x7 )cpuid_entry_change (best,X86_FEATURE_OSPKE ,kvm_read_cr4_bits (vcpu,X86_CR4_PKE )); - best =kvm_find_cpuid_entry (vcpu,0xD ,0 ); + best =cpuid_entry2_find (entries, nent,0xD ,0 );if (best) best->ebx =xstate_required_size (vcpu->arch.xcr0, false); - best =kvm_find_cpuid_entry (vcpu,0xD ,1 ); + best =cpuid_entry2_find (entries, nent,0xD ,1 );if (best && (cpuid_entry_has (best,X86_FEATURE_XSAVES ) ||cpuid_entry_has (best,X86_FEATURE_XSAVEC ))) best->ebx =xstate_required_size (vcpu->arch.xcr0, true); - best =kvm_find_kvm_cpuid_features (vcpu); + best =__kvm_find_kvm_cpuid_features (vcpu, entries, nent);if (kvm_hlt_in_guest (vcpu->kvm) && best && (best->eax & (1 <<KVM_FEATURE_PV_UNHALT ))) best->eax &= ~(1 <<KVM_FEATURE_PV_UNHALT );if (!kvm_check_has_quirk (vcpu->kvm,KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT )) { - best =kvm_find_cpuid_entry (vcpu,0x1 ,0 ); + best =cpuid_entry2_find (entries, nent,0x1 ,0 );if (best)cpuid_entry_change (best,X86_FEATURE_MWAIT , vcpu->arch.ia32_misc_enable_msr &MSR_IA32_MISC_ENABLE_MWAIT ); } } + +void kvm_update_cpuid_runtime (struct kvm_vcpu *vcpu) +{ +__kvm_update_cpuid_runtime (vcpu, vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent); +}EXPORT_SYMBOL_GPL (kvm_update_cpuid_runtime);static void kvm_vcpu_after_set_cpuid (struct kvm_vcpu *vcpu)
@@ -276,21 +289,22 @@ u64 kvm_vcpu_reserved_gpa_bits_raw(strucstatic int kvm_set_cpuid (struct kvm_vcpu *vcpu,struct kvm_cpuid_entry2 *e2,int nent) { -int r; +int r; + +__kvm_update_cpuid_runtime (vcpu, e2, nent); - r =kvm_check_cpuid (e2, nent); -if (r) -return r; + r =kvm_check_cpuid (e2, nent); +if (r) +return r; -kvfree (vcpu->arch.cpuid_entries); - vcpu->arch.cpuid_entries = e2; - vcpu->arch.cpuid_nent = nent; +kvfree (vcpu->arch.cpuid_entries); + vcpu->arch.cpuid_entries = e2; + vcpu->arch.cpuid_nent = nent; -kvm_update_kvm_cpuid_base (vcpu); -kvm_update_cpuid_runtime (vcpu); -kvm_vcpu_after_set_cpuid (vcpu); +kvm_update_kvm_cpuid_base (vcpu); +kvm_vcpu_after_set_cpuid (vcpu); -return 0 ; +return 0 ; }/* when an old userspace process fills a new kernel module */
Greg Kroah-Hartman
maintainerPATCH 1033/1039 KVM: x86: Partially allow KVM_SET_CPUID{,2} after KVM_RUN
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
commit c6617c61e8fe44b9e9fdfede921f61cac6b5149d upstream.
Commit feb627e8d6f6 ("KVM: x86: Forbid KVM_SET_CPUID{,2} after KVM_RUN") forbade changing CPUID altogether but unfortunately this is not fully compatible with existing VMMs. In particular, QEMU reuses vCPU fds for CPU hotplug after unplug and it calls KVM_SET_CPUID2. Instead of full ban, check whether the supplied CPUID data is equal to what was previously set.
Message-Id: <[email protected]>
--- arch/x86/kvm/cpuid.c | 36 ++++++++++++++++++++++++++++++++++++ arch/x86/kvm/x86.c | 19 ------------------- 2 files changed, 36 insertions(+), 19 deletions(-)
arch/x86/kvm/cpuid.c +36 -0
@@ -99,6 +99,28 @@ static int kvm_check_cpuid(struct kvm_cpreturn 0 ; } +/* Check whether the supplied CPUID data is equal to what is already set for the vCPU. */ +static int kvm_cpuid_check_equal (struct kvm_vcpu *vcpu,struct kvm_cpuid_entry2 *e2, +int nent) +{ +struct kvm_cpuid_entry2 *orig; +int i; + +if (nent != vcpu->arch.cpuid_nent) +return -EINVAL ; + +for (i =0 ; i < nent; i++) { + orig = &vcpu->arch.cpuid_entries[i]; +if (e2[i].function != orig->function || + e2[i].index != orig->index || + e2[i].eax != orig->eax || e2[i].ebx != orig->ebx || + e2[i].ecx != orig->ecx || e2[i].edx != orig->edx) +return -EINVAL ; + } + +return 0 ; +} +static void kvm_update_kvm_cpuid_base (struct kvm_vcpu *vcpu) {u32 function;
@@ -293,6 +315,20 @@ static int kvm_set_cpuid(struct kvm_vcpu__kvm_update_cpuid_runtime (vcpu, e2, nent); +/* +* KVM does not correctly handle changing guest CPUID after KVM_RUN, as +* MAXPHYADDR, GBPAGES support, AMD reserved bit behavior, etc.. aren't +* tracked in kvm_mmu_page_role. As a result, KVM may miss guest page +* faults due to reusing SPs/SPTEs. In practice no sane VMM mucks with +* the core vCPU model on the fly. It would've been better to forbid any +* KVM_SET_CPUID{,2} calls after KVM_RUN altogether but unfortunately +* some VMMs (e.g. QEMU) reuse vCPU fds for CPU hotplug/unplug and do +* KVM_SET_CPUID{,2} again. To support this legacy behavior, check +* whether the supplied CPUID data is equal to what's already set. +*/ +if (vcpu->arch.last_vmentry_cpu !=-1 ) +return kvm_cpuid_check_equal (vcpu, e2, nent); + r =kvm_check_cpuid (e2, nent);if (r)return r;
arch/x86/kvm/x86.c +0 -19
@@ -5149,17 +5149,6 @@ long kvm_arch_vcpu_ioctl(struct file *fistruct kvm_cpuid __user *cpuid_arg = argp;struct kvm_cpuid cpuid; -/* -* KVM does not correctly handle changing guest CPUID after KVM_RUN, as -* MAXPHYADDR, GBPAGES support, AMD reserved bit behavior, etc.. aren't -* tracked in kvm_mmu_page_role. As a result, KVM may miss guest page -* faults due to reusing SPs/SPTEs. In practice no sane VMM mucks with -* the core vCPU model on the fly, so fail. -*/ - r = -EINVAL ; -if (vcpu->arch.last_vmentry_cpu !=-1 ) - goto out; - r = -EFAULT ;if (copy_from_user (&cpuid, cpuid_arg,sizeof (cpuid))) goto out;
@@ -5170,14 +5159,6 @@ long kvm_arch_vcpu_ioctl(struct file *fistruct kvm_cpuid2 __user *cpuid_arg = argp;struct kvm_cpuid2 cpuid; -/* -* KVM_SET_CPUID{,2} after KVM_RUN is forbidded, see the comment in -* KVM_SET_CPUID case above. -*/ - r = -EINVAL ; -if (vcpu->arch.last_vmentry_cpu !=-1 ) - goto out; - r = -EFAULT ;if (copy_from_user (&cpuid, cpuid_arg,sizeof (cpuid))) goto out;
Greg Kroah-Hartman
maintainerPATCH 1034/1039 KVM: selftests: Rename get_cpuid_test to cpuid_test
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
commit 9e6d484f9991176269607bb3c54a494e32eab27a upstream.
In preparation to reusing the existing 'get_cpuid_test' for testing "KVM_SET_CPUID{,2} after KVM_RUN" rename it to 'cpuid_test' to avoid the confusion.
No functional change intended.
Message-Id: <[email protected]>
---
tools/testing/selftests/kvm/.gitignore | 2 +-
tools/testing/selftests/kvm/Makefile | 4 ++--
.../selftests/kvm/x86_64/{get_cpuid_test.c => cpuid_test.c} | 0
tools/testing/selftests/kvm/.gitignore | 2
tools/testing/selftests/kvm/Makefile | 4
tools/testing/selftests/kvm/x86_64/cpuid_test.c | 179 ++++++++++++++++++++
tools/testing/selftests/kvm/x86_64/get_cpuid_test.c | 179 --------------------
4 files changed, 182 insertions(+), 182 deletions(-)
rename tools/testing/selftests/kvm/x86_64/{get_cpuid_test.c => cpuid_test.c} (100%)tools/testing/selftests/kvm/.gitignore +1 -1
@@ -7,11 +7,11 @@ /s390x/memop /s390x/resets /s390x/sync_regs_test +/x86_64/cpuid_test /x86_64/cr4_cpuid_sync_test /x86_64/debug_regs /x86_64/evmcs_test /x86_64/emulator_error_test -/x86_64/get_cpuid_test /x86_64/get_msr_index_features /x86_64/kvm_clock_test /x86_64/kvm_pv_test
tools/testing/selftests/kvm/Makefile +2 -2
@@ -38,11 +38,11 @@ LIBKVM_x86_64 = lib/x86_64/apic.c lib/x8 LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c lib/aarch64/handlers.S lib/aarch64/spinlock.c lib/aarch64/gic.c lib/aarch64/gic_v3.c lib/aarch64/vgic.c LIBKVM_s390x = lib/s390x/processor.c lib/s390x/ucall.c lib/s390x/diag318_test_handler.c -TEST_GEN_PROGS_x86_64 = x86_64/cr4_cpuid_sync_test +TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test +TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test TEST_GEN_PROGS_x86_64 += x86_64/emulator_error_test -TEST_GEN_PROGS_x86_64 += x86_64/get_cpuid_test TEST_GEN_PROGS_x86_64 += x86_64/hyperv_clock TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid TEST_GEN_PROGS_x86_64 += x86_64/hyperv_features
tools/testing/selftests/kvm/x86_64/cpuid_test.c new file +179 -0
179 lines not on this page · raw message
tools/testing/selftests/kvm/x86_64/get_cpuid_test.c deleted +0 -179
179 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 1035/1039 KVM: selftests: Test KVM_SET_CPUID2 after KVM_RUN
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
commit ecebb966acaab2466d9857d1cc435ee1fc9eee50 upstream.
KVM forbids KVM_SET_CPUID2 after KVM_RUN was performed on a vCPU unless the supplied CPUID data is equal to what was previously set. Test this.
Message-Id: <[email protected]>
--- tools/testing/selftests/kvm/include/x86_64/processor.h | 7 +++ tools/testing/selftests/kvm/lib/x86_64/processor.c | 33 ++++++++++++++--- tools/testing/selftests/kvm/x86_64/cpuid_test.c | 30 +++++++++++++++ 3 files changed, 66 insertions(+), 4 deletions(-)
tools/testing/selftests/kvm/include/x86_64/processor.h +7 -0
@@ -358,6 +358,8 @@ uint64_t kvm_get_feature_msr(uint64_t msstruct kvm_cpuid2 *kvm_get_supported_cpuid (void );struct kvm_cpuid2 *vcpu_get_cpuid (struct kvm_vm *vm,uint32_t vcpuid); +int __vcpu_set_cpuid (struct kvm_vm *vm,uint32_t vcpuid, +struct kvm_cpuid2 *cpuid);void vcpu_set_cpuid (struct kvm_vm *vm,uint32_t vcpuid,struct kvm_cpuid2 *cpuid);
@@ -402,6 +404,11 @@ void vm_set_page_table_entry(struct kvm_ uint64_t pte);/* +* get_cpuid() - find matching CPUID entry and return pointer to it. +*/ +struct kvm_cpuid_entry2 *get_cpuid (struct kvm_cpuid2 *cpuid,uint32_t function, +uint32_t index); +/* * set_cpuid() - overwrites a matching cpuid entry with the provided value. * matches based on ent->function && ent->index. returns true * if a match was found and successfully overwritten.
tools/testing/selftests/kvm/lib/x86_64/processor.c +29 -4
@@ -847,6 +847,17 @@ kvm_get_supported_cpuid_index(uint32_t freturn entry; } + +int __vcpu_set_cpuid (struct kvm_vm *vm,uint32_t vcpuid, +struct kvm_cpuid2 *cpuid) +{ +struct vcpu *vcpu =vcpu_find (vm, vcpuid); + +TEST_ASSERT (vcpu !=NULL ,"vcpu not found, vcpuid: %u" , vcpuid); + +return ioctl (vcpu->fd,KVM_SET_CPUID2 , cpuid); +} +/* * VM VCPU CPUID Set *
@@ -864,12 +875,9 @@ kvm_get_supported_cpuid_index(uint32_t fvoid vcpu_set_cpuid (struct kvm_vm *vm,uint32_t vcpuid,struct kvm_cpuid2 *cpuid) { -struct vcpu *vcpu =vcpu_find (vm, vcpuid);int rc; -TEST_ASSERT (vcpu !=NULL ,"vcpu not found, vcpuid: %u" , vcpuid); - - rc =ioctl (vcpu->fd,KVM_SET_CPUID2 , cpuid); + rc =__vcpu_set_cpuid (vm, vcpuid, cpuid);TEST_ASSERT (rc ==0 ,"KVM_SET_CPUID2 failed, rc: %i errno: %i" , rc, errno);
@@ -1337,6 +1345,23 @@ void assert_on_unhandled_exception(struc } } +struct kvm_cpuid_entry2 *get_cpuid (struct kvm_cpuid2 *cpuid,uint32_t function, +uint32_t index) +{ +int i; + +for (i =0 ; i < cpuid->nent; i++) { +struct kvm_cpuid_entry2 *cur = &cpuid->entries[i]; + +if (cur->function == function && cur->index == index) +return cur; + } + +TEST_FAIL ("CPUID function 0x%x index 0x%x not found " , function, index); + +return NULL ; +} +bool set_cpuid (struct kvm_cpuid2 *cpuid,struct kvm_cpuid_entry2 *ent) {
tools/testing/selftests/kvm/x86_64/cpuid_test.c +30 -0
@@ -154,6 +154,34 @@ struct kvm_cpuid2 *vcpu_alloc_cpuid(strureturn guest_cpuids; } +static void set_cpuid_after_run (struct kvm_vm *vm,struct kvm_cpuid2 *cpuid) +{ +struct kvm_cpuid_entry2 *ent; +int rc; +u32 eax, ebx, x; + +/* Setting unmodified CPUID is allowed */ + rc =__vcpu_set_cpuid (vm,VCPU_ID , cpuid); +TEST_ASSERT (!rc,"Setting unmodified CPUID after KVM_RUN failed: %d" , rc); + +/* Changing CPU features is forbidden */ + ent =get_cpuid (cpuid,0x7 ,0 ); + ebx = ent->ebx; + ent->ebx--; + rc =__vcpu_set_cpuid (vm,VCPU_ID , cpuid); +TEST_ASSERT (rc,"Changing CPU features should fail" ); + ent->ebx = ebx; + +/* Changing MAXPHYADDR is forbidden */ + ent =get_cpuid (cpuid,0x80000008 ,0 ); + eax = ent->eax; + x = eax &0xff ; + ent->eax = (eax & ~0xffu ) | (x -1 ); + rc =__vcpu_set_cpuid (vm,VCPU_ID , cpuid); +TEST_ASSERT (rc,"Changing MAXPHYADDR should fail" ); + ent->eax = eax; +} +int main (void ) {struct kvm_cpuid2 *supp_cpuid, *cpuid2;
@@ -175,5 +203,7 @@ int main(void)for (stage =0 ; stage <3 ; stage++)run_vcpu (vm,VCPU_ID , stage); +set_cpuid_after_run (vm, cpuid2); +kvm_vm_free (vm); }
Greg Kroah-Hartman
maintainerPATCH 1036/1039 ASoC: SOF: topology: remove sof_load_pipeline_ipc()
In reply to Greg Kroah-HartmanFrom: Ranjani Sridharan <[email protected]>
commit 7cc7b9ba21d4978d19f0e3edc2b00d44c9d66ff6 upstream.
Remove the function sof_load_pipeline_ipc() and directly send the IPC instead. The pipeline core is already enabled with the call to sof_pipeline_core_enable() in sof_widget_setup().
--- sound/soc/sof/sof-audio.c | 3 ++- sound/soc/sof/sof-audio.h | 4 ---- sound/soc/sof/topology.c | 17 ----------------- 3 files changed, 2 insertions(+), 22 deletions(-)
sound/soc/sof/sof-audio.c +2 -1
@@ -203,7 +203,8 @@ int sof_widget_setup(struct snd_sof_devbreak ;case snd_soc_dapm_scheduler: pipeline = swidget->private; - ret =sof_load_pipeline_ipc (sdev, pipeline, &r); + ret =sof_ipc_tx_message (sdev->ipc, pipeline->hdr.cmd, pipeline, +sizeof (*pipeline), &r,sizeof (r));break ;default : hdr = swidget->private;
sound/soc/sof/sof-audio.h +0 -4
@@ -184,10 +184,6 @@ void snd_sof_control_notify(struct snd_sint snd_sof_load_topology (struct snd_soc_component *scomp,const char *file);int snd_sof_complete_pipeline (struct snd_sof_dev *sdev,struct snd_sof_widget *swidget); - -int sof_load_pipeline_ipc (struct snd_sof_dev *sdev, -struct sof_ipc_pipe_new *pipeline, -struct sof_ipc_comp_reply *r);int sof_pipeline_core_enable (struct snd_sof_dev *sdev,const struct snd_sof_widget *swidget);
sound/soc/sof/topology.c +0 -17
@@ -1690,23 +1690,6 @@ err:/* * Pipeline Topology */ -int sof_load_pipeline_ipc (struct snd_sof_dev *sdev, -struct sof_ipc_pipe_new *pipeline, -struct sof_ipc_comp_reply *r) -{ -int ret =sof_core_enable (sdev, pipeline->core); - -if (ret <0 ) -return ret; - - ret =sof_ipc_tx_message (sdev->ipc, pipeline->hdr.cmd, pipeline, -sizeof (*pipeline), r,sizeof (*r)); -if (ret <0 ) -dev_err (sdev->dev,"error: load pipeline ipc failure\n" ); - -return ret; -} -static int sof_widget_load_pipeline (struct snd_soc_component *scomp,int index,struct snd_sof_widget *swidget,struct snd_soc_tplg_dapm_widget *tw)
Greg Kroah-Hartman
maintainerPATCH 1037/1039 ASoC: SOF: free widgets in sof_tear_down_pipelines() for static pipelines
In reply to Greg Kroah-HartmanFrom: Ranjani Sridharan <[email protected]>
commit b2ebcf42a48f4560862bb811f3268767d17ebdcd upstream.
Free widgets for static pipelines in sof_tear_down_pipelines(). But this feature is unavailable in older firmware with ABI < 3.19. Just reset widget use_count's for this case. This would ensure that the secondary cores enabled required for topology setup are powered down properly before the primary core is powered off during system suspend.
--- sound/soc/sof/sof-audio.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
sound/soc/sof/sof-audio.c +10 -3
@@ -665,11 +665,12 @@ int sof_set_up_pipelines(struct snd_sof_ }/* -* This function doesn't free widgets during suspend. It only resets the set up status for all -* routes and use_count for all widgets. +* For older firmware, this function doesn't free widgets for static pipelines during suspend. +* It only resets use_count for all widgets. */ int sof_tear_down_pipelines (struct snd_sof_dev *sdev,bool verify) { +struct sof_ipc_fw_version *v = &sdev->fw_ready.version;struct snd_sof_widget *swidget;struct snd_sof_route *sroute;int ret;
@@ -681,8 +682,14 @@ int sof_tear_down_pipelines(struct snd_s* loading the sound card unavailable to open PCMs. */ list_for_each_entry_reverse (swidget, &sdev->widget_list, list) { -if (!verify) { +if (swidget->dynamic_pipeline_widget) +continue ; + +/* Do not free widgets for static pipelines with FW ABI older than 3.19 */ +if (!verify && !swidget->dynamic_pipeline_widget && + v->abi_version <SOF_ABI_VER (3 ,19 ,0 )) { swidget->use_count =0 ; + swidget->complete =0 ;continue ; }
Greg Kroah-Hartman
maintainerPATCH 1038/1039 ASoC: SOF: sof-audio: setup sched widgets during pipeline complete step
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
commit 01429183f479c54c1b5d15453a8ce574ea43e525 upstream.
Older firmware prior to ABI 3.19 has a dependency where the scheduler widgets need to be setup last. Moving the call to sof_widget_setup() before the pipeline_complete() call also helps remove the need for the 'reverse' direction when walking through the widget list - this was only working because of the topology macros but the topology does not require any order.
--- sound/soc/sof/sof-audio.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
sound/soc/sof/sof-audio.c +17 -2
@@ -596,16 +596,25 @@ const struct sof_ipc_pipe_new *snd_sof_pint sof_set_up_pipelines (struct snd_sof_dev *sdev,bool verify) { +struct sof_ipc_fw_version *v = &sdev->fw_ready.version;struct snd_sof_widget *swidget;struct snd_sof_route *sroute;int ret;/* restore pipeline components */ -list_for_each_entry_reverse (swidget, &sdev->widget_list, list) { +list_for_each_entry (swidget, &sdev->widget_list, list) {/* only set up the widgets belonging to static pipelines */ if (!verify && swidget->dynamic_pipeline_widget)continue ; +/* +* For older firmware, skip scheduler widgets in this loop, +* sof_widget_setup() will be called in the 'complete pipeline' loop +*/ +if (v->abi_version <SOF_ABI_VER (3 ,19 ,0 ) && + swidget->id == snd_soc_dapm_scheduler) +continue ; +/* update DAI config. The IPC will be sent in sof_widget_setup() */ if (WIDGET_IS_DAI (swidget->id)) {struct snd_sof_dai *dai = swidget->private;
@@ -653,6 +662,12 @@ int sof_set_up_pipelines(struct snd_sof_if (!verify && swidget->dynamic_pipeline_widget)continue ; +if (v->abi_version <SOF_ABI_VER (3 ,19 ,0 )) { + ret =sof_widget_setup (sdev, swidget); +if (ret <0 ) +return ret; + } + swidget->complete =snd_sof_complete_pipeline (sdev, swidget);break ;
@@ -681,7 +696,7 @@ int sof_tear_down_pipelines(struct snd_s* sroute->setup because during suspend all streams are suspended and during topology * loading the sound card unavailable to open PCMs. */ -list_for_each_entry_reverse (swidget, &sdev->widget_list, list) { +list_for_each_entry (swidget, &sdev->widget_list, list) {if (swidget->dynamic_pipeline_widget)continue ;
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.3 release. There are 1039 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerPATCH 1039/1039 ASoC: SOF: handle paused streams during system suspend
In reply to Greg Kroah-HartmanFrom: Ranjani Sridharan <[email protected]>
commit 96da174024b9c63bd5d3358668d0bc12677be877 upstream.
During system suspend, paused streams do not get suspended. Therefore, we need to explicitly free these PCMs in the DSP and free the associated DAPM widgets so that they can be set up again during resume.
--- sound/soc/sof/pcm.c | 5 +-- sound/soc/sof/sof-audio.c | 74 ++++++++++++++++++++++++++++++++++++++++++++-- sound/soc/sof/sof-audio.h | 2 + 3 files changed, 76 insertions(+), 5 deletions(-)
sound/soc/sof/pcm.c +2 -3
@@ -100,9 +100,8 @@ void snd_sof_pcm_period_elapsed(struct s }EXPORT_SYMBOL (snd_sof_pcm_period_elapsed); -static int sof_pcm_dsp_pcm_free (struct snd_pcm_substream *substream, -struct snd_sof_dev *sdev, -struct snd_sof_pcm *spcm) +int sof_pcm_dsp_pcm_free (struct snd_pcm_substream *substream,struct snd_sof_dev *sdev, +struct snd_sof_pcm *spcm) {struct sof_ipc_stream stream;struct sof_ipc_reply reply;
sound/soc/sof/sof-audio.c +72 -2
98 lines not on this page · raw message
sound/soc/sof/sof-audio.h +2 -0
@@ -267,4 +267,6 @@ int sof_widget_free(struct snd_sof_dev */* PCM */ int sof_widget_list_setup (struct snd_sof_dev *sdev,struct snd_sof_pcm *spcm,int dir);int sof_widget_list_free (struct snd_sof_dev *sdev,struct snd_sof_pcm *spcm,int dir); +int sof_pcm_dsp_pcm_free (struct snd_pcm_substream *substream,struct snd_sof_dev *sdev, +struct snd_sof_pcm *spcm);#endif
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.3 release. There are 1039 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
BTW it does not look like the same CC list was used for this one and the other stable release candidates, can you copy the same list next time? Thanks!
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 35 lines · Greg Kroah-Hartman
Hi Greg,
Compiled and booted on my test system Lenovo P50s: Intel Core i7 No emergency and critical messages in the dmesg
I am going to be running perf bench sched from now on and I will report any regressions/perf bench sched all
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes runTotal time: 0.437 [sec]# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processesTotal time: 6.919 [sec] 6.919489 usecs/op 144519 ops/secTested-by Zan Aziz <[email protected]>Thanks
-Zan
This is the start of the stable review cycle for the 5.16.3 release. There are 1039 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Hi Greg,
Compiled and booted on my test system Lenovo P50s: Intel Core i7 No emergency and critical messages in the dmesg
I am going to be running perf bench sched from now on and I will report any regressions
/perf bench sched all
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.437 [sec]
# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes
Total time: 6.919 [sec]
6.919489 usecs/op
144519 ops/sec
Thanks,
-Zan
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.3 release. There are 1039 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Hi Greg,
Looking good.
Run tested on:
- Allwinner H6 (Tanix TX6)
- Intel Tiger Lake x86_64 (nuc11 i7-1165G7)
In addition: build tested on:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- NXP iMX6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos
--
Rudi
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.3 release. There are 1039 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 26 Jan 2022 18:39:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.16.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).