[PATCH 0/2] x86/entry: simplify RESTORE_CR3

2020-05-25 Thread Lai Jiangshan
ize RESTORE_CR3") for User CR3. Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Link: https://lore.kernel.org/lkml/20200525145102.122557-1-la...@linux.alibaba.com Lai Jiangshan (2): x86/entry: Don't write to CR3 when restoring to kernel CR3 x86/entry: a

[PATCH 2/2] x86/entry: always flush user CR3 in RESTORE_CR3

2020-05-25 Thread Lai Jiangshan
RESTORE_CR3 is called when CPL==0 or #DF, it is unlikely CPL==0==userCR3 and #DF itself is unlikely case. There is no much overhead to always flush userCR3. Signed-off-by: Lai Jiangshan --- arch/x86/entry/calling.h | 27 ++- arch/x86/entry/entry_64.S | 6 +++--- 2

[PATCH 1/2] x86/entry: Don't write to CR3 when restoring to kernel CR3

2020-05-25 Thread Lai Jiangshan
Skip resuming KERNEL pages since it is already KERNEL CR3 Signed-off-by: Lai Jiangshan --- arch/x86/entry/calling.h | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index 1c7f13bb6728..505246185624 100644

Re: [RFC PATCH V2 4/7] x86/hw_breakpoint: Prevent data breakpoints on user_pcid_flush_mask

2020-05-25 Thread Lai Jiangshan
On Tue, May 26, 2020 at 12:21 PM Andy Lutomirski wrote: > > On Mon, May 25, 2020 at 6:42 PM Lai Jiangshan wrote: > > > > The percpu user_pcid_flush_mask is used for CPU entry > > If a data breakpoint on it, it will cause an unwanted #DB. > > Protect the full cpu

Re: [RFC PATCH 0/5] x86/hw_breakpoint: protects more cpu entry data

2020-05-25 Thread Lai Jiangshan
On Mon, May 25, 2020 at 11:27 PM Peter Zijlstra wrote: > > On Mon, May 25, 2020 at 02:50:57PM +0000, Lai Jiangshan wrote: > > Hello > > > > The patchset is based on (tag: entry-v9-the-rest, tglx-devel/x86/entry). > > And it is complement of 3ea11ac991d > &g

[RFC PATCH V2 4/7] x86/hw_breakpoint: Prevent data breakpoints on user_pcid_flush_mask

2020-05-25 Thread Lai Jiangshan
(espfix_waddr, espfix_stack). Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86

[RFC PATCH V2 2/7] x86/hw_breakpoint: Prevent data breakpoints on direct GDT

2020-05-25 Thread Lai Jiangshan
...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index c149c7b29ac3..f859095c1b6c 100644 --- a/arch/x86/kernel

[RFC PATCH V2 7/7] x86/entry: remove DB1 stack and DB2 hole from cpu entry area

2020-05-25 Thread Lai Jiangshan
IST-shift code is removed from entry code, #DB will stick to DB stack only. So we remove the DB1 stack and the DB2 hole. Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/include/asm/cpu_entry_area.h | 12

[RFC PATCH V2 6/7] x86/entry: is_debug_stack() don't check of DB1 stack

2020-05-25 Thread Lai Jiangshan
IST-shift code is removed from entry code, #DB will not at DB1 stack. So we remove the check of DB1 stack in is_debug_stack(). Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/nmi.c | 7 +-- 1 file

[RFC PATCH V2 1/7] x86/hw_breakpoint: add within_area() to check data breakpoints

2020-05-25 Thread Lai Jiangshan
: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 9ddf441ccaa8..c149c7b29ac3 100644 --- a/arch/x86/kernel

[RFC PATCH V2 5/7] x86/entry: don't shift stack on #DB

2020-05-25 Thread Lai Jiangshan
debug_enter() will disable #DB, there should be no recursive #DB. Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/entry/entry_64.S| 17 - arch/x86/kernel/asm-offsets_64.c | 1 - 2 files

[RFC PATCH V2 0/7] x86/DB: protects more cpu entry data and

2020-05-25 Thread Lai Jiangshan
structure to be sure. Suggested by Peter. Drop the last patch of the V1 because debug_idt_table is removed in Peter's patchset[3]. remove IST-shifting Lai Jiangshan (7): x86/hw_breakpoint: add within_area() to check data breakpoints x86/hw_breakpoint: Prevent data breakpoints on

[RFC PATCH V2 3/7] x86/hw_breakpoint: Prevent data breakpoints on per_cpu cpu_tss_rw

2020-05-25 Thread Lai Jiangshan
-shifting, is done). Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel

[RFC PATCH 1/5] x86/hw_breakpoint: add within_area() to check data breakpoints

2020-05-25 Thread Lai Jiangshan
: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 9ddf441ccaa8..c149c7b29ac3 100644 --- a/arch/x86/kernel

[RFC PATCH 4/5] x86/hw_breakpoint: Prevent data breakpoints on user_pcid_flush_mask

2020-05-25 Thread Lai Jiangshan
rigger #DB (espfix related). Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/

[RFC PATCH 5/5] x86/hw_breakpoint: Prevent data breakpoints on debug_idt_table

2020-05-25 Thread Lai Jiangshan
...@kernel.org Signed-off-by: Lai Jiangshan --- Please drop this patch when Peter's work to remove debug_idt_table is merged. arch/x86/kernel/hw_breakpoint.c | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 9579bd6fb589

[RFC PATCH 2/5] x86/hw_breakpoint: Prevent data breakpoints on direct GDT

2020-05-25 Thread Lai Jiangshan
...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index c149c7b29ac3..f859095c1b6c 100644 --- a/arch/x86/kernel

[RFC PATCH 3/5] x86/hw_breakpoint: Prevent data breakpoints on per_cpu cpu_tss_rw

2020-05-25 Thread Lai Jiangshan
-shifting, is done). Cc: Andy Lutomirski Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: x...@kernel.org Signed-off-by: Lai Jiangshan --- arch/x86/kernel/hw_breakpoint.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel

[RFC PATCH 0/5] x86/hw_breakpoint: protects more cpu entry data

2020-05-25 Thread Lai Jiangshan
ise it may cause dangerous/recursive/unwanted #DB. Lai Jiangshan (5): x86/hw_breakpoint: add within_area() to check data breakpoints x86/hw_breakpoint: Prevent data breakpoints on direct GDT x86/hw_breakpoint: Prevent data breakpoints on per_cpu cpu_tss_rw x86/hw_breakpoint: Prevent data b

Re: [patch V6 00/37] x86/entry: Rework leftovers and merge plan

2020-05-22 Thread Lai Jiangshan
On Tue, May 19, 2020 at 5:04 PM Peter Zijlstra wrote: > +#ifdef CONFIG_DEBUG_ENTRY > /* Begin/end of an instrumentation safe region */ > -#define instrumentation_begin() ({ > \ > +#define instrumentation_begin() ({

Re: [PATCH V2 1/2] rbtree_latch: quit searching when reaching to maximum depth

2020-05-22 Thread Lai Jiangshan
On Sat, May 16, 2020 at 12:01 AM Lai Jiangshan wrote: > > lib/rbtree.c has ensured that there is not possible to > inadvertently cause (temporary) loops in the tree structure > as seen in program order of the modifier. But loop is still > possible to be seen in searcher due to C

Re: [PATCH V2 2/2] rbtree_latch: don't need to check seq when it found a node

2020-05-15 Thread Lai Jiangshan
On Sat, May 16, 2020 at 12:28 PM Michel Lespinasse wrote: > > On Fri, May 15, 2020 at 03:59:09PM +0000, Lai Jiangshan wrote: > > latch_tree_find() should be protected by caller via RCU or so. > > When it find a node in an attempt, the node must be a valid one > > in RC

[PATCH V2 1/2] rbtree_latch: quit searching when reaching to maximum depth

2020-05-15 Thread Lai Jiangshan
parent->rb_right The long loop won't stop until the modifer's CPU flushes its writes. Too avoid it, we should limit the searching depth. There are no more than (1< Cc: Paul E. McKenney Cc: Oleg Nesterov Cc: Michel Lespinasse Cc: Andrea Arcangeli Cc: Rik van Riel Cc: Mathieu Desnoyers

[PATCH V2 2/2] rbtree_latch: don't need to check seq when it found a node

2020-05-15 Thread Lai Jiangshan
Nesterov Cc: Michel Lespinasse Cc: Andrea Arcangeli Cc: Rik van Riel Cc: Mathieu Desnoyers Acked-by: Peter Zijlstra (Intel) Signed-off-by: Lai Jiangshan --- include/linux/rbtree_latch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/rbtree_latch.h b/include

Re: [PATCH 1/2] rbtree_latch: quit searching when reaching to maximum depth

2020-05-15 Thread Lai Jiangshan
On Fri, May 15, 2020 at 9:04 PM Peter Zijlstra wrote: > > On Fri, May 15, 2020 at 12:47:06PM +0000, Lai Jiangshan wrote: > > lib/rbtree.c has ensured that there is not possible to > > inadvertently cause (temporary) loops in the tree structure > > as seen in progr

[PATCH 2/2] rbtree_latch: don't need to check seq when it found a node

2020-05-15 Thread Lai Jiangshan
Signed-off-by: Lai Jiangshan --- include/linux/rbtree_latch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/rbtree_latch.h b/include/linux/rbtree_latch.h index b012bd95eabf..09a3c05d1c5b 100644 --- a/include/linux/rbtree_latch.h +++ b/include/linux/rbtree_latch.h

[PATCH 1/2] rbtree_latch: quit searching when reaching to maximum depth

2020-05-15 Thread Lai Jiangshan
Cc: Mathieu Desnoyers Signed-off-by: Lai Jiangshan --- include/linux/rbtree_latch.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/rbtree_latch.h b/include/linux/rbtree_latch.h index 7d012faa509a..b012bd95eabf 100644 --- a/include/linux/rbtree_latch.h +++

[tip: core/rcu] rcu: Remove unused ->rcu_read_unlock_special.b.deferred_qs field

2020-05-11 Thread tip-bot2 for Lai Jiangshan
The following commit has been merged into the core/rcu branch of tip: Commit-ID: f0bdf6d473cf12a488a78422e15aafdfe77cf853 Gitweb: https://git.kernel.org/tip/f0bdf6d473cf12a488a78422e15aafdfe77cf853 Author:Lai Jiangshan AuthorDate:Sat, 15 Feb 2020 14:52:32 -08:00 Committer

[tip: core/rcu] rcu: Don't set nesting depth negative in rcu_preempt_deferred_qs()

2020-05-11 Thread tip-bot2 for Lai Jiangshan
The following commit has been merged into the core/rcu branch of tip: Commit-ID: 07b4a930fc44a537efecf73c1fd2b4937f64caaa Gitweb: https://git.kernel.org/tip/07b4a930fc44a537efecf73c1fd2b4937f64caaa Author:Lai Jiangshan AuthorDate:Sat, 15 Feb 2020 14:37:26 -08:00 Committer

[tip: core/rcu] rcu: Don't use negative nesting depth in __rcu_read_unlock()

2020-05-11 Thread tip-bot2 for Lai Jiangshan
The following commit has been merged into the core/rcu branch of tip: Commit-ID: 5f5fa7ea89dc82d34ed458f4d7a8634e8e9eefce Gitweb: https://git.kernel.org/tip/5f5fa7ea89dc82d34ed458f4d7a8634e8e9eefce Author:Lai Jiangshan AuthorDate:Sat, 15 Feb 2020 15:23:26 -08:00 Committer

Re: [patch V4 part 5 13/31] x86/irq: Convey vector as argument and not in ptregs

2020-05-11 Thread Lai Jiangshan
Hello On Mon, May 11, 2020 at 10:35 PM Thomas Gleixner wrote: > > Lai, > > Lai Jiangshan writes: > > On Tue, May 5, 2020 at 10:23 PM Thomas Gleixner wrote: > >> +SYM_CODE_START(irq_entries_start) > >> +vector=FIRST_EXTERNAL_VECTOR

Re: [PATCH RFC tip/core/rcu 09/16] rcu-tasks: Add an RCU-tasks rude variant

2020-05-10 Thread Lai Jiangshan
On Sun, May 10, 2020 at 11:49 PM Paul E. McKenney wrote: > > On Sun, May 10, 2020 at 05:59:27PM +0800, Lai Jiangshan wrote: > > On Tue, Mar 17, 2020 at 6:03 AM Steven Rostedt wrote: > > > > > > On Mon, 16 Mar 2020 17:45:40 -0400 > > > Joel Fernandes

Re: [PATCH] workqueue: Fix an use after free in init_rescuer()

2020-05-10 Thread Lai Jiangshan
Reviewed-by: Lai Jiangshan On Fri, May 8, 2020 at 11:07 PM Dan Carpenter wrote: > > We need to preserve error code before freeing "rescuer". > > Fixes: f187b6974f6df ("workqueue: Use IS_ERR and PTR_ERR instead of > PTR_ERR_OR_ZERO.") > Signed-off-by: Dan C

Re: [PATCH RFC tip/core/rcu 09/16] rcu-tasks: Add an RCU-tasks rude variant

2020-05-10 Thread Lai Jiangshan
On Tue, Mar 17, 2020 at 6:03 AM Steven Rostedt wrote: > > On Mon, 16 Mar 2020 17:45:40 -0400 > Joel Fernandes wrote: > > > > > > > Same for the function side (if not even more so). This would require > > > adding > > > a srcu_read_lock() to all functions that can be traced! That would be a > >

Re: [PATCH v4 tip/core/rcu 05/38] rcu-tasks: Move Tasks RCU to its own file

2020-05-10 Thread Lai Jiangshan
On Thu, Apr 16, 2020 at 2:19 AM wrote: > > From: "Paul E. McKenney" > > This code-movement-only commit is in preparation for adding an additional > flavor of Tasks RCU, which relies on workqueues to detect grace periods. > > Signed-off-by: Paul E. McKenney > --- > kernel/rcu/tasks.h | 370 >

Re: [patch V4 part 5 02/31] x86/entry: Provide helpers for execute on irqstack

2020-05-09 Thread Lai Jiangshan
On Tue, May 5, 2020 at 10:19 PM Thomas Gleixner wrote: > > Device interrupt handlers and system vector handlers are executed on the > interrupt stack. The stack switch happens in the low level assembly entry > code. This conflicts with the efforts to consolidate the exit code in C to > ensure

Re: [patch V4 part 5 13/31] x86/irq: Convey vector as argument and not in ptregs

2020-05-09 Thread Lai Jiangshan
On Tue, May 5, 2020 at 10:23 PM Thomas Gleixner wrote: > +/* > + * ASM code to emit the common vector entry stubs where each stub is > + * packed into 8 bytes. > + * > + * Note, that the 'pushq imm8' is emitted via '.byte 0x6a, vector' because > + * GCC treats the local vector variable as

Re: [patch V4 part 1 02/36] x86/hw_breakpoint: Prevent data breakpoints on cpu_entry_area

2020-05-09 Thread Lai Jiangshan
On Tue, May 5, 2020 at 10:15 PM Thomas Gleixner wrote: > > From: Andy Lutomirski > > A data breakpoint near the top of an IST stack will cause unresoverable > recursion. A data breakpoint on the GDT, IDT, or TSS is terrifying. > Prevent either of these from happening. > What happen when a data

Re: [patch V4 part 1 02/36] x86/hw_breakpoint: Prevent data breakpoints on cpu_entry_area

2020-05-09 Thread Lai Jiangshan
(CPU_ENTRY_AREA_ARRAY_SIZE + PAGE_SIZE) ^ sizeof PER_CPU ^ RO_IDT Reviewed-by: Lai Jiangshan > + > static int arch_build_bp_info(struct perf_event *bp, > const struct perf_event_attr *attr, >

[tip: x86/entry] x86/entry/64: Remove unneeded kernel CR3 switching

2020-05-07 Thread tip-bot2 for Lai Jiangshan
The following commit has been merged into the x86/entry branch of tip: Commit-ID: f642aebc9d2a51775d86eaa79da9d90aa5dff0f7 Gitweb: https://git.kernel.org/tip/f642aebc9d2a51775d86eaa79da9d90aa5dff0f7 Author:Lai Jiangshan AuthorDate:Sun, 19 Apr 2020 14:40:47 Committer

[tip: x86/entry] x86/entry/64: Remove an unused label

2020-05-07 Thread tip-bot2 for Lai Jiangshan
The following commit has been merged into the x86/entry branch of tip: Commit-ID: 4446d96d7ba7eaac54f9ef968bbe858097441d50 Gitweb: https://git.kernel.org/tip/4446d96d7ba7eaac54f9ef968bbe858097441d50 Author:Lai Jiangshan AuthorDate:Sun, 19 Apr 2020 14:40:49 Committer

[tip: x86/entry] x86/idt: Remove address operator on function machine_check()

2020-05-07 Thread tip-bot2 for Lai Jiangshan
The following commit has been merged into the x86/entry branch of tip: Commit-ID: 3dcdb8e0c83b9502f669106e17bfa795f19f8d9b Gitweb: https://git.kernel.org/tip/3dcdb8e0c83b9502f669106e17bfa795f19f8d9b Author:Lai Jiangshan AuthorDate:Sun, 19 Apr 2020 14:40:48 Committer

Re: [PATCH 6/7] rcu: rename some CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU

2019-10-16 Thread Lai Jiangshan
On 2019/10/16 11:54 上午, Paul E. McKenney wrote: On Tue, Oct 15, 2019 at 10:28:48AM +, Lai Jiangshan wrote: CONFIG_PREEMPTION and CONFIG_PREEMPT_RCU are always identical, but some code depends on CONFIG_PREEMPTION to access to rcu_preempt functionalitis. This patch changes

Re: [PATCH 2/7] rcu: fix tracepoint string when RCU CPU kthread runs

2019-10-15 Thread Lai Jiangshan
On 2019/10/16 11:38 上午, Paul E. McKenney wrote: On Tue, Oct 15, 2019 at 10:23:57AM +, Lai Jiangshan wrote: "rcu_wait" is incorrct here, use "rcu_run" instead. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu/tree.c | 4 ++-- 1 file c

[PATCH 5/7] rcu: move gp_state_names[] and gp_state_getname() to tree_stall.h

2019-10-15 Thread Lai Jiangshan
Only tree_stall.h needs to get name from GP state. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu/tree.c | 10 -- kernel/rcu/tree.h | 12 kernel/rcu/tree_stall.h | 22 ++ 3 files changed, 22 insertions(+), 22

[PATCH 4/7] rcu: remove the declaration of call_rcu() in tree.h

2019-10-15 Thread Lai Jiangshan
call_rcu() is external RCU API declared in include/linux/, and doesn't need to be (re-)declared in internal files again. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu/tree.h | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h

[PATCH 6/7] rcu: rename some CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU

2019-10-15 Thread Lai Jiangshan
CONFIG_PREEMPTION and CONFIG_PREEMPT_RCU are always identical, but some code depends on CONFIG_PREEMPTION to access to rcu_preempt functionalitis. This patch changes CONFIG_PREEMPTION to CONFIG_PREEMPT_RCU in these cases. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu

[PATCH 7/7] rcu: splite tasks_rcu to tasks.c

2019-10-15 Thread Lai Jiangshan
declaration and call-site are also (forced) changed. Nothing else is changed. ./scripts/checkpatch.pl gives four warnings, but they don't need to be fixed. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu/Makefile | 1 + kernel/rcu/tasks.c | 395

[PATCH 3/7] rcu: trace_rcu_utilization() paired

2019-10-15 Thread Lai Jiangshan
The notations include "Start" and "End", it is better when there are paired. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.

[PATCH 2/7] rcu: fix tracepoint string when RCU CPU kthread runs

2019-10-15 Thread Lai Jiangshan
"rcu_wait" is incorrct here, use "rcu_run" instead. Signed-off-by: Lai Jiangshan Signed-off-by: Lai Jiangshan --- kernel/rcu/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 278798e58698..c351fc280945

[PATCH 1/7] rcu: fix incorrect conditional compilation

2019-10-15 Thread Lai Jiangshan
wrongly used, which are always non-defined, which makes "!defined(TINY_RCU)" always true, which means the code block is always inclued, and the included code block doesn't cause any compilation error so far when CONFIG_TINY_RCU. It is also the reason this change doesn't need for stable. Signed

[PATCH 0/7] rcu: cleanups

2019-10-15 Thread Lai Jiangshan
All are minimal independent cleanups, expect that patch 3 depends on patch 2. Lai Jiangshan (7): rcu: fix incorrect conditional compilation rcu: fix tracepoint string when RCU CPU kthread runs rcu: trace_rcu_utilization() paired rcu: remove the declaration of call_rcu() in tree.h rcu

Re: [PATCH] rcu: make PREEMPT_RCU to be a decoration of TREE_RCU

2019-10-14 Thread Lai Jiangshan
On 2019/10/15 10:45 上午, Lai Jiangshan wrote: On 2019/10/15 10:00 上午, Paul E. McKenney wrote: On Tue, Oct 15, 2019 at 09:50:21AM +0800, Lai Jiangshan wrote: On Tue, Oct 15, 2019 at 9:46 AM Paul E. McKenney wrote: On Mon, Oct 14, 2019 at 02:48:32PM -0400, Joel Fernandes wrote: On Sun

[PATCH v2] rcu: make PREEMPT_RCU to be a decoration of TREE_RCU

2019-10-14 Thread Lai Jiangshan
Currently PREEMPT_RCU and TREE_RCU are "contrary" configs when they can't be both on. But PREEMPT_RCU is actually a kind of TREE_RCU in the implementation. It seams to be appropriate to make PREEMPT_RCU to be a decorative option of TREE_RCU. Signed-off-by: Lai Jiangshan Signed-o

Re: [PATCH] rcu: make PREEMPT_RCU to be a decoration of TREE_RCU

2019-10-14 Thread Lai Jiangshan
On 2019/10/15 10:00 上午, Paul E. McKenney wrote: On Tue, Oct 15, 2019 at 09:50:21AM +0800, Lai Jiangshan wrote: On Tue, Oct 15, 2019 at 9:46 AM Paul E. McKenney wrote: On Mon, Oct 14, 2019 at 02:48:32PM -0400, Joel Fernandes wrote: On Sun, Oct 13, 2019 at 12:59:57PM +, Lai Jiangshan

Re: [PATCH] rcu: make PREEMPT_RCU to be a decoration of TREE_RCU

2019-10-14 Thread Lai Jiangshan
On Tue, Oct 15, 2019 at 9:46 AM Paul E. McKenney wrote: > > On Mon, Oct 14, 2019 at 02:48:32PM -0400, Joel Fernandes wrote: > > On Sun, Oct 13, 2019 at 12:59:57PM +, Lai Jiangshan wrote: > > > Currently PREEMPT_RCU and TREE_RCU are "contrary" config

[PATCH] rcu: make PREEMPT_RCU to be a decoration of TREE_RCU

2019-10-13 Thread Lai Jiangshan
Currently PREEMPT_RCU and TREE_RCU are "contrary" configs when they can't be both on. But PREEMPT_RCU is actually a kind of TREE_RCU in the implementation. It seams to be appropriate to make PREEMPT_RCU to be a decorative option of TREE_RCU. Signed-off-by: Lai Jiangshan Signed-o

Re: [PATCH] workqueue: Fix spurious sanity check failures in destroy_workqueue()

2019-09-18 Thread Lai Jiangshan
""" And document "/* MD: rescue worker */" might be better than current "/* I: rescue worker */", although ->rescuer can be accessed without wq_mayday_lock lock in some code. Reviewed-by: Lai Jiangshan On Thu, Sep 19, 2019 at 9:43 AM Tejun Heo wrote: > > Before

Re: [PATCH v2] signal: add procfd_signal() syscall

2018-12-24 Thread Lai Jiangshan
On Tue, Dec 25, 2018 at 1:32 PM Lai Jiangshan wrote: > > Is it possible to avoid adding any syscall? > > Since holding /proc/pid/reg_file can also hold the pid. > With this guarantee, /proc/pid/uuid (universally unique identifier ) can be > introduced to identify tasks, th

Re: [PATCH v2] signal: add procfd_signal() syscall

2018-12-24 Thread Lai Jiangshan
Is it possible to avoid adding any syscall? Since holding /proc/pid/reg_file can also hold the pid. With this guarantee, /proc/pid/uuid (universally unique identifier ) can be introduced to identify tasks, the kernel generates a uuid for every task when created.

Re: [PATCH] workqueue: combine judgments in the loop ofmaybe_create_worker

2018-09-12 Thread Lai Jiangshan
On Thu, Sep 13, 2018 at 9:51 AM wrote: > > >> From: Liu Song > >> > >> Although the 'need_to_create_worker' has been determined to be > >> true before entering the function. However, adjusting the order > >> of judgment can combine two judgments in the loop. Also improve > >> the matching

Re: [PATCH] workqueue: combine judgments in the loop ofmaybe_create_worker

2018-09-12 Thread Lai Jiangshan
On Thu, Sep 13, 2018 at 9:51 AM wrote: > > >> From: Liu Song > >> > >> Although the 'need_to_create_worker' has been determined to be > >> true before entering the function. However, adjusting the order > >> of judgment can combine two judgments in the loop. Also improve > >> the matching

Re: Consolidating RCU-bh, RCU-preempt, and RCU-sched

2018-07-12 Thread Lai Jiangshan
On Fri, Jul 13, 2018 at 8:02 AM, Paul E. McKenney wrote: > Hello! > > I now have a semi-reasonable prototype of changes consolidating the > RCU-bh, RCU-preempt, and RCU-sched update-side APIs in my -rcu tree. > There are likely still bugs to be fixed and probably other issues as well, > but a

Re: Consolidating RCU-bh, RCU-preempt, and RCU-sched

2018-07-12 Thread Lai Jiangshan
On Fri, Jul 13, 2018 at 8:02 AM, Paul E. McKenney wrote: > Hello! > > I now have a semi-reasonable prototype of changes consolidating the > RCU-bh, RCU-preempt, and RCU-sched update-side APIs in my -rcu tree. > There are likely still bugs to be fixed and probably other issues as well, > but a

Re: [PATCH 3/6] workqueue: Make worker_attach/detach_pool() update worker->pool

2018-05-19 Thread Lai Jiangshan
On Thu, May 17, 2018 at 12:34 PM, Tejun Heo wrote: > For historical reasons, the worker attach/detach functions don't > currently manage worker->pool and the callers are manually and > inconsistently updating it. > > This patch moves worker->pool updates into the worker

Re: [PATCH 3/6] workqueue: Make worker_attach/detach_pool() update worker->pool

2018-05-19 Thread Lai Jiangshan
On Thu, May 17, 2018 at 12:34 PM, Tejun Heo wrote: > For historical reasons, the worker attach/detach functions don't > currently manage worker->pool and the callers are manually and > inconsistently updating it. > > This patch moves worker->pool updates into the worker attach/detach > functions.

Re: [PATCH 6/8] RCU, workqueue: Implement rcu_work

2018-03-20 Thread Lai Jiangshan
On Tue, Mar 20, 2018 at 12:45 AM, Tejun Heo <t...@kernel.org> wrote: > Hello, Lai. > > On Fri, Mar 16, 2018 at 02:01:35PM +0800, Lai Jiangshan wrote: >> > +bool flush_rcu_work(struct rcu_work *rwork) >> > +{ >> > + if (test_bit(WORK_STRU

Re: [PATCH 6/8] RCU, workqueue: Implement rcu_work

2018-03-20 Thread Lai Jiangshan
On Tue, Mar 20, 2018 at 12:45 AM, Tejun Heo wrote: > Hello, Lai. > > On Fri, Mar 16, 2018 at 02:01:35PM +0800, Lai Jiangshan wrote: >> > +bool flush_rcu_work(struct rcu_work *rwork) >> > +{ >> > + if (test_bit(WORK_STRUCT_PEN

[PATCH] workqueue: remove the comment about the old manager_arb mutex

2018-03-20 Thread Lai Jiangshan
The manager_arb mutex doesn't exist any more. Signed-off-by: Lai Jiangshan <jiangshan...@gmail.com> --- kernel/workqueue.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 19785a092026..698b6f1ecddd 100644 --- a/kernel/workqueue.c +++ b/

[PATCH] workqueue: remove the comment about the old manager_arb mutex

2018-03-20 Thread Lai Jiangshan
The manager_arb mutex doesn't exist any more. Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 19785a092026..698b6f1ecddd 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -165,7 +165,6

[PATCH] workqueue: fix the comments of nr_idle

2018-03-20 Thread Lai Jiangshan
Since the worker rebinding behavior was refactored, there is no idle worker off the idle_list now. The comment is outdated and can be just removed. It also groups nr_workers and nr_idle together. Signed-off-by: Lai Jiangshan <jiangshan...@gmail.com> --- kernel/workqueue.c | 5 ++---

[PATCH] workqueue: fix the comments of nr_idle

2018-03-20 Thread Lai Jiangshan
Since the worker rebinding behavior was refactored, there is no idle worker off the idle_list now. The comment is outdated and can be just removed. It also groups nr_workers and nr_idle together. Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 5 ++--- 1 file changed, 2 insertions(+), 3

[PATCH] workqueue: make manage_workers() and pool destruction exclusive

2018-03-19 Thread Lai Jiangshan
refcount of the pool in manage_workers(). "indirect" means it gets a refcount of the first involved pwq which holds a refcount of the pool. This refcount can prevent the pool from being destroyed. The original synchronization mechanism (wq_manager_wait) is also removed. Signed-off-by: Lai

[PATCH] workqueue: make manage_workers() and pool destruction exclusive

2018-03-19 Thread Lai Jiangshan
refcount of the pool in manage_workers(). "indirect" means it gets a refcount of the first involved pwq which holds a refcount of the pool. This refcount can prevent the pool from being destroyed. The original synchronization mechanism (wq_manager_wait) is also removed. Signed-off-by: Lai

Re: [PATCH 6/8] RCU, workqueue: Implement rcu_work

2018-03-16 Thread Lai Jiangshan
n __queue_work() */ > + local_irq_disable(); > + __queue_work(WORK_CPU_UNBOUND, rwork->wq, >work); > + local_irq_enable(); > +} > + > +/** > + * queue_rcu_work - queue work after a RCU grace period > + * @wq: workqueue to use > + * @rwork: work to queue

Re: [PATCH 6/8] RCU, workqueue: Implement rcu_work

2018-03-16 Thread Lai Jiangshan
k); > + local_irq_enable(); > +} > + > +/** > + * queue_rcu_work - queue work after a RCU grace period > + * @wq: workqueue to use > + * @rwork: work to queue > + * > + * Return: %false if @rwork was already pending, %true otherwise. Note > + * that a full R

[tip:smp/hotplug] cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states

2018-03-14 Thread tip-bot for Lai Jiangshan
Commit-ID: 17a2f1ced0280068897990b0dd25ce70555b8ac7 Gitweb: https://git.kernel.org/tip/17a2f1ced0280068897990b0dd25ce70555b8ac7 Author: Lai Jiangshan <jiangshan...@gmail.com> AuthorDate: Fri, 1 Dec 2017 21:50:05 +0800 Committer: Thomas Gleixner <t...@linutronix.de> CommitD

[tip:smp/hotplug] cpu/hotplug: Merge cpuhp_bp_states and cpuhp_ap_states

2018-03-14 Thread tip-bot for Lai Jiangshan
Commit-ID: 17a2f1ced0280068897990b0dd25ce70555b8ac7 Gitweb: https://git.kernel.org/tip/17a2f1ced0280068897990b0dd25ce70555b8ac7 Author: Lai Jiangshan AuthorDate: Fri, 1 Dec 2017 21:50:05 +0800 Committer: Thomas Gleixner CommitDate: Wed, 14 Mar 2018 16:38:43 +0100 cpu/hotplug: Merge

Re: Simplifying our RCU models

2018-03-09 Thread Lai Jiangshan
On Tue, Mar 6, 2018 at 12:14 AM, Paul E. McKenney wrote: > On Mon, Mar 05, 2018 at 08:33:20AM -0600, Eric W. Biederman wrote: >> >> Moving this discussion to a public list as discussing how to reduce the >> number of rcu variants does not make sense in private. We

Re: Simplifying our RCU models

2018-03-09 Thread Lai Jiangshan
On Tue, Mar 6, 2018 at 12:14 AM, Paul E. McKenney wrote: > On Mon, Mar 05, 2018 at 08:33:20AM -0600, Eric W. Biederman wrote: >> >> Moving this discussion to a public list as discussing how to reduce the >> number of rcu variants does not make sense in private. We should have >> an archive of

Re: [PATCH 7/7] RCU, workqueue: Implement rcu_work

2018-03-07 Thread Lai Jiangshan
On Wed, Mar 7, 2018 at 10:54 PM, Paul E. McKenney <paul...@linux.vnet.ibm.com> wrote: > On Wed, Mar 07, 2018 at 10:49:49AM +0800, Lai Jiangshan wrote: >> On Wed, Mar 7, 2018 at 1:33 AM, Tejun Heo <t...@kernel.org> wrote: >> >> > +/** >> > + * queue_r

Re: [PATCH 7/7] RCU, workqueue: Implement rcu_work

2018-03-07 Thread Lai Jiangshan
On Wed, Mar 7, 2018 at 10:54 PM, Paul E. McKenney wrote: > On Wed, Mar 07, 2018 at 10:49:49AM +0800, Lai Jiangshan wrote: >> On Wed, Mar 7, 2018 at 1:33 AM, Tejun Heo wrote: >> >> > +/** >> > + * queue_rcu_work_on - queue work on specific CPU after a RCU grace

Re: [PATCH 7/7] RCU, workqueue: Implement rcu_work

2018-03-06 Thread Lai Jiangshan
On Wed, Mar 7, 2018 at 1:33 AM, Tejun Heo wrote: > +/** > + * queue_rcu_work_on - queue work on specific CPU after a RCU grace period > + * @cpu: CPU number to execute work on > + * @wq: workqueue to use > + * @rwork: work to queue For many people, "RCU grace period" is clear

Re: [PATCH 7/7] RCU, workqueue: Implement rcu_work

2018-03-06 Thread Lai Jiangshan
On Wed, Mar 7, 2018 at 1:33 AM, Tejun Heo wrote: > +/** > + * queue_rcu_work_on - queue work on specific CPU after a RCU grace period > + * @cpu: CPU number to execute work on > + * @wq: workqueue to use > + * @rwork: work to queue For many people, "RCU grace period" is clear enough, but not

Re: [PATCH RFC 01/16] prcu: Add PRCU implementation

2018-01-29 Thread Lai Jiangshan
On Tue, Jan 23, 2018 at 3:59 PM, wrote: > From: Heng Zhang > > This RCU implementation (PRCU) is based on a fast consensus protocol > published in the following paper: > > Fast Consensus Using Bounded Staleness for Scalable Read-mostly >

Re: [PATCH RFC 01/16] prcu: Add PRCU implementation

2018-01-29 Thread Lai Jiangshan
On Tue, Jan 23, 2018 at 3:59 PM, wrote: > From: Heng Zhang > > This RCU implementation (PRCU) is based on a fast consensus protocol > published in the following paper: > > Fast Consensus Using Bounded Staleness for Scalable Read-mostly > Synchronization. > Haibo Chen, Heng Zhang, Ran Liu,

Re: [RFC PATCH V5 5/5] workqueue: introduce a way to set workqueue's scheduler

2018-01-28 Thread Lai Jiangshan
On Mon, Jan 29, 2018 at 12:41 PM, Mike Galbraith <efa...@gmx.de> wrote: > On Mon, 2018-01-29 at 12:15 +0800, Lai Jiangshan wrote: >> I think adding priority boost to workqueue(flush_work()) is the best >> way to fix the problem. > > I disagree, priority boosting is

Re: [RFC PATCH V5 5/5] workqueue: introduce a way to set workqueue's scheduler

2018-01-28 Thread Lai Jiangshan
On Mon, Jan 29, 2018 at 12:41 PM, Mike Galbraith wrote: > On Mon, 2018-01-29 at 12:15 +0800, Lai Jiangshan wrote: >> I think adding priority boost to workqueue(flush_work()) is the best >> way to fix the problem. > > I disagree, priority boosting is needlessly invasi

Re: [RFC PATCH V5 5/5] workqueue: introduce a way to set workqueue's scheduler

2018-01-28 Thread Lai Jiangshan
policy=1 prio=1 nice=0 > # cat /sys/devices/virtual/workqueue/system_percpu_highpri/sched_attr > policy=0 prio=0 nice=-20 > # echo "policy=1 prio=2 nice=0" > > /sys/devices/virtual/workqueue/system_percpu_highpri/s

Re: [RFC PATCH V5 5/5] workqueue: introduce a way to set workqueue's scheduler

2018-01-28 Thread Lai Jiangshan
al/workqueue/system_percpu/sched_attr > policy=0 prio=0 nice=0 > # echo "policy=1 prio=1 nice=0" > > /sys/devices/virtual/workqueue/system_percpu/sched_attr > # cat /sys/devices/virtual/workqueue/system_percpu/sched_attr > policy=1 prio=1 nice=0 >

Re: [PATCH] workqueue: Handle race between wake up and rebind

2018-01-17 Thread Lai Jiangshan
On Wed, Jan 17, 2018 at 4:08 AM, Neeraj Upadhyay wrote: > > > On 01/16/2018 11:05 PM, Tejun Heo wrote: >> >> Hello, Neeraj. >> >> On Mon, Jan 15, 2018 at 02:08:12PM +0530, Neeraj Upadhyay wrote: >>> >>> - kworker/0:0 gets chance to run on cpu1; while processing >>>a

Re: [PATCH] workqueue: Handle race between wake up and rebind

2018-01-17 Thread Lai Jiangshan
On Wed, Jan 17, 2018 at 4:08 AM, Neeraj Upadhyay wrote: > > > On 01/16/2018 11:05 PM, Tejun Heo wrote: >> >> Hello, Neeraj. >> >> On Mon, Jan 15, 2018 at 02:08:12PM +0530, Neeraj Upadhyay wrote: >>> >>> - kworker/0:0 gets chance to run on cpu1; while processing >>>a work, it goes to sleep.

Re: [PATCH] cpu/hotplug: merge cpuhp_bp_states_ap_states as cpuhp_hp_states

2017-12-03 Thread Lai Jiangshan
On Sun, Dec 3, 2017 at 2:33 PM, Paul E. McKenney <paul...@linux.vnet.ibm.com> wrote: > On Fri, Dec 01, 2017 at 09:50:05PM +0800, Lai Jiangshan wrote: >> cpuhp_bp_states_ap_states have diffent set of steps >> without any conflicting configed steps, so that they can >> be

Re: [PATCH] cpu/hotplug: merge cpuhp_bp_states_ap_states as cpuhp_hp_states

2017-12-03 Thread Lai Jiangshan
On Sun, Dec 3, 2017 at 2:33 PM, Paul E. McKenney wrote: > On Fri, Dec 01, 2017 at 09:50:05PM +0800, Lai Jiangshan wrote: >> cpuhp_bp_states_ap_states have diffent set of steps >> without any conflicting configed steps, so that they can >> be merged. >> >>

Re: [PATCH tip/core/rcu 2/6] srcu: Change printk() %p to %pK

2017-12-01 Thread Lai Jiangshan
but it doesn't hurt to > change it and doing so avoids script-generated noise. > > Reported-by: Tobin C. Harding <m...@tobin.cc> > Signed-off-by: Paul E. McKenney <paul...@linux.vnet.ibm.com> Reviewed-by: Lai Jiangshan <jiangshan...@gmail.com> > --- > kernel/r

Re: [PATCH tip/core/rcu 2/6] srcu: Change printk() %p to %pK

2017-12-01 Thread Lai Jiangshan
it and doing so avoids script-generated noise. > > Reported-by: Tobin C. Harding > Signed-off-by: Paul E. McKenney Reviewed-by: Lai Jiangshan > --- > kernel/rcu/srcutree.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/rcu/srcutr

Re: [PATCH tip/core/rcu 05/10] workqueue: Eliminate cond_resched_rcu_qs() in favor of cond_resched()

2017-12-01 Thread Lai Jiangshan
aul E. McKenney <paul...@linux.vnet.ibm.com> > Cc: Tejun Heo <t...@kernel.org> > Cc: Lai Jiangshan <jiangshan...@gmail.com> Reviewed-by: Lai Jiangshan <jiangshan...@gmail.com> > --- > kernel/workqueue.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH tip/core/rcu 05/10] workqueue: Eliminate cond_resched_rcu_qs() in favor of cond_resched()

2017-12-01 Thread Lai Jiangshan
jun Heo > Cc: Lai Jiangshan Reviewed-by: Lai Jiangshan > --- > kernel/workqueue.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 8fdb710bfdd7..aee7eaab05cb 100644 > --- a/kernel/workqueue.c >

[PATCH] workqueue/hotplug: remove the workaround in rebind_workers()

2017-12-01 Thread Lai Jiangshan
Sine the cpu/hotplug refactor is done, the hotplug callbacks are called properly. So the workaround is useless. Signed-off-by: Lai Jiangshan <jiangshan...@gmail.com> --- kernel/workqueue.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workq

[PATCH] workqueue/hotplug: remove the workaround in rebind_workers()

2017-12-01 Thread Lai Jiangshan
Sine the cpu/hotplug refactor is done, the hotplug callbacks are called properly. So the workaround is useless. Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 5c99beb8577d

<    1   2   3   4   5   6   7   8   9   10   >