[PATCH RFC 2/4] trace/bpf: Add support for attach/detach of ftrace events to BPF

2019-07-10 Thread Joel Fernandes (Google)
Add a new bpf file to each trace event. The following commands can be written into it: attach: Attaches BPF prog fd to tracepoint detach: Detaches BPF prog fd to tracepoint Reading the bpf file will show all the attached programs to the tracepoint. Signed-off-by: Joel Fernandes (Google

[PATCH RFC 4/4] selftests/bpf: Add test for ftrace-based BPF attach/detach

2019-07-10 Thread Joel Fernandes (Google)
Here we add support for testing the attach and detach of a BPF program to a tracepoint through tracefs. Signed-off-by: Joel Fernandes (Google) --- .../raw_tp_writable_test_ftrace_run.c | 89 +++ 1 file changed, 89 insertions(+) create mode 100644 tools/testing

[PATCH RFC 1/4] Move bpf_raw_tracepoint functionality into bpf_trace.c

2019-07-10 Thread Joel Fernandes (Google)
In preparation to use raw tracepoints for BPF directly from ftrace, move the bpf_raw_tracepoint functionality into bpf_trace.c Signed-off-by: Joel Fernandes (Google) --- include/linux/bpf_trace.h | 10 ++ kernel/bpf/syscall.c| 69 ++--- kernel/trace

[PATCH RFC 3/4] lib/bpf: Add support for ftrace event attach and detach

2019-07-10 Thread Joel Fernandes (Google)
Add the needed library support in this commit. Signed-off-by: Joel Fernandes (Google) --- tools/lib/bpf/bpf.c | 53 tools/lib/bpf/bpf.h | 4 +++ tools/lib/bpf/libbpf.map | 2 ++ 3 files changed, 59 insertions(+) diff --git a/tools/lib/bpf

[PATCH -rcu dev 1/3] rcu/tree: tick_dep_set/clear_cpu should accept bits instead of masks

2019-08-15 Thread Joel Fernandes (Google)
This commit fixes the issue. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 0512de9ead20..322b1b57967c 100644 --- a/kernel/rcu/tree.c

[PATCH -rcu dev 2/3] rcu/tree: Fix issue where sometimes rcu_urgent_qs is not set on IPI

2019-08-15 Thread Joel Fernandes (Google)
Sometimes I see rcu_urgent_qs is not set. This could be when the last IPI was a long time ago, however, the grace period just started. Set rcu_urgent_qs so the tick can indeed be stopped. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH -rcu dev 3/3] RFC: rcu/tree: Read dynticks_nmi_nesting in advance

2019-08-15 Thread Joel Fernandes (Google)
I really cannot explain this patch, but without it, the "else if" block just doesn't execute thus causing the tick's dep mask to not be set and causes the tick to be turned off. I tried various _ONCE() macros but the only thing that works is this patch. Signed-off-by: Joel Fernand

[PATCH v2 -rcu dev 2/3] rcu/tree: Fix issue where sometimes rcu_urgent_qs is not set on IPI

2019-08-15 Thread Joel Fernandes (Google)
Sometimes I see rcu_urgent_qs is not set. This could be when the last IPI was a long time ago, however, the grace period just started. Set rcu_urgent_qs so the tick can indeed not be stopped. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 1 + 1 file changed, 1 insertion

[PATCH -rcu/dev] Please squash: fixup! rcu/tree: Add basic support for kfree_rcu() batching

2019-08-16 Thread Joel Fernandes (Google)
xchg() on a bool is causing issues on riscv and arm32. Please squash this into the -rcu dev branch to resolve the issue. Please squash this fix. Fixes: -rcu dev commit 3cbd3aa7d9c7bdf ("rcu/tree: Add basic support for kfree_rcu() batching") Signed-off-by: Joel Fernandes (Google) -

[RFC] rcu/tree: Try to invoke_rcu_core() if in_irq() during unlock

2019-08-18 Thread Joel Fernandes (Google)
the "else" block will run to do the irq_work stuff. This commit is based on a partial revert of d143b3d1cd89 ("rcu: Simplify rcu_read_unlock_special() deferred wakeups") with an additional in_irq() check added. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree_plug

[RFC v2] rcu/tree: Try to invoke_rcu_core() if in_irq() during unlock

2019-08-18 Thread Joel Fernandes (Google)
lse), then the "else" block will run to do the irq_work stuff. This commit is based on a partial revert of d143b3d1cd89 ("rcu: Simplify rcu_read_unlock_special() deferred wakeups") with an additional in_irq() check added. Signed-off-by: Joel Fernandes (Google) --- v1-&

[RFC 5/6] x86/pci: Pass lockdep condition to pcm_mmcfg_list iterator

2019-06-01 Thread Joel Fernandes (Google)
Fernandes (Google) --- arch/x86/pci/mmconfig-shared.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 7389db538c30..6fa42e9c4e6f 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig

[RFC 1/6] rcu: Add support for consolidated-RCU reader checking

2019-06-01 Thread Joel Fernandes (Google)
need to pass the optional fourth argument (cond) unless they are under some non-RCU protection and needs to make lockdep check pass. Signed-off-by: Joel Fernandes (Google) --- include/linux/rculist.h | 40 include/linux/rcupdate.h | 7 +++ kernel/rcu

[RFC 6/6] acpi: Use built-in RCU list checking for acpi_ioremaps list

2019-06-01 Thread Joel Fernandes (Google)
list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it for acpi_ioremaps list traversal. Signed-off-by: Joel Fernandes (Google) --- drivers/acpi/osl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index

[RFC 4/6] workqueue: Convert for_each_wq to use built-in list check

2019-06-01 Thread Joel Fernandes (Google)
list_for_each_entry_rcu now has support to check for RCU reader sections as well as lock. Just use the support in it, instead of explictly checking in the caller. Signed-off-by: Joel Fernandes (Google) --- kernel/workqueue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git

[RFC 2/6] ipv4: add lockdep condition to fix for_each_entry

2019-06-01 Thread Joel Fernandes (Google)
Signed-off-by: Joel Fernandes (Google) --- net/ipv4/fib_frontend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index b298255f6fdb..ef7c9f8e8682 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -127,7

[RFC 3/6] driver/core: Convert to use built-in RCU list checking

2019-06-01 Thread Joel Fernandes (Google)
list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it in driver core. Signed-off-by: Joel Fernandes (Google) --- drivers/base/base.h | 1 + drivers/base/core.c | 10 ++ drivers/base/power/runtime.c | 15 ++- 3 files changed, 21

[RFC 0/6] Harden list_for_each_entry_rcu() and family

2019-06-01 Thread Joel Fernandes (Google)
e code has a assert_rcu_or_wq_mutex() function which is called in for_each_wq(). This series replaces that in favor of the built-in one. Also in the future, we can extend these checks to list_entry_rcu() and other list macros as well. Joel Fernandes (Google) (6): rcu: Add support for consolidated-RCU reader checking

[PATCH v1 1/2] mm/page_idle: Add support for per-pid page_idle using virtual indexing

2019-07-22 Thread Joel Fernandes (Google)
, address space changes can occur between reading the pagemap and reading the bitmap. In virtual address indexing, the process's mmap_sem is held for the duration of the access. Cc: vdavydov@gmail.com Cc: Brendan Gregg Cc: kernel-t...@android.com Signed-off-by: Joel Fernandes (Google

[PATCH] pidfd: Add warning if exit_state is 0 during notification

2019-07-24 Thread Joel Fernandes (Google)
add a warning to catch it in the future. [1] https://lore.kernel.org/lkml/20190717172100.261204-1-j...@joelfernandes.org/ Signed-off-by: Joel Fernandes (Google) --- kernel/signal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/signal.c b/kernel/signal.c index 91b789dd6e72

[PATCH v4 -rcu 1/4] rcu/segcblist: Do not depend on rcl->len to store the segcb len during merge

2020-08-24 Thread Joel Fernandes (Google)
t;len field should be the length of the done segment and not just used as a temporarily variable. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c

[PATCH v4 -rcu 4/4] rcu/trace: Add tracing for how segcb list changes

2020-08-24 Thread Joel Fernandes (Google)
in the respective segment. Signed-off-by: Joel Fernandes (Google) --- include/trace/events/rcu.h | 25 + kernel/rcu/rcu_segcblist.c | 27 +++ kernel/rcu/rcu_segcblist.h | 7 +++ kernel/rcu/tree.c | 23 +++ 4 files changed, 82

[PATCH v4 -rcu 2/4] rcu/tree: Make rcu_do_batch count how many callbacks were executed

2020-08-24 Thread Joel Fernandes (Google)
n from 0 is confusing and error-prone IMHO. This commit therefore explicitly counts have many callbacks were executed in rcu_do_batch() itself, and uses that to update the per-CPU segcb list's len field, without relying on the negativity of rcl->len. Signed-off-by: Joel Fernandes (Google) --

[PATCH v4 -rcu 3/4] rcu/segcblist: Add counters to segcblist datastructure

2020-08-24 Thread Joel Fernandes (Google)
traces when segcblist counts updated. Signed-off-by: Joel Fernandes (Google) --- include/linux/rcu_segcblist.h | 2 + kernel/rcu/rcu_segcblist.c| 82 +-- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/include/linux/rcu_segcblist.h b/include

[PATCH v4 -rcu 0/4] Maintain the length of each segment in the segcblist

2020-08-24 Thread Joel Fernandes (Google)
rnel.org/lkml/20200719034210.2382053-1-j...@joelfernandes.org/) Joel Fernandes (Google) (4): rcu/segcblist: Do not depend on rcl->len to store the segcb len during merge rcu/tree: Make rcu_do_batch count how many callbacks were executed rcu/segcblist: Add counters to segcblist datastructure rcu/tr

[PATCH v4 1/5] rcu/tree: Add a warning if CPU being onlined did not report QS already

2020-08-07 Thread Joel Fernandes (Google)
l E. McKenney Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 65e1b5e92319..a49fa3b60faa 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3996,7 +3996

[PATCH v4 0/5] option-subject: RCU and CPU hotplug checks and docs

2020-08-07 Thread Joel Fernandes (Google)
This series improves/adds to RCU's warnings about CPU hotplug and adds documentation and testing. v3->v4: Minor cleanups. Joel Fernandes (Google) (5): rcu/tree: Add a warning if CPU being onlined did not report QS already rcu/tree: Clarify comments about FQS loop reporting quiescent states

[PATCH v4 5/5] docs: Update RCU's hotplug requirements with a bit about design

2020-08-07 Thread Joel Fernandes (Google)
is rather incomplete. This commit therefore continues the section by describing how RCU's design handles CPU hotplug in a deadlock-free way. Signed-off-by: Joel Fernandes (Google) --- .../RCU/Design/Requirements/Requirements.rst | 22 +++ 1 file changed, 22 insertions(+)

[PATCH v4 2/5] rcu/tree: Clarify comments about FQS loop reporting quiescent states

2020-08-07 Thread Joel Fernandes (Google)
At least since v4.19, the FQS loop no longer reports quiescent states for offline CPUs unless it is an emergency. This commit therefore fixes the comment in rcu_gp_init() to match the current code. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 8 +--- 1 file changed, 5

[PATCH v4 3/5] rcu/tree: Make FQS complaining about offline CPU more aggressive

2020-08-07 Thread Joel Fernandes (Google)
FQS loop scan happens and bring the problem to everyone's attention. Light testing with TREE03 and hotplug shows no warnings. Converted the warning as well to WARN_ON_ONCE() to reduce log spam. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 22 ++ 1 file changed,

[PATCH v4 4/5] rcutorture: Force synchronizing of RCU flavor from hotplug notifier

2020-08-07 Thread Joel Fernandes (Google)
synchronize callback. If anything locks up, we expect stall warnings and/or other splats. Obviously, we need not test for rcu_barrier from a notifier, since those are not allowed from notifiers. This fact is already detailed in the documentation as well. Signed-off-by: Joel Fernandes (Google

[PATCH RFC 12/12] sched/coresched: rq->core should be set only if not previously set

2020-08-15 Thread Joel Fernandes (Google)
e once it is set. Signed-off-by: Vineeth Pillai Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5da5b2317b21..464493f3a759

[PATCH RFC 09/12] sched/coresched: Use for_each_cpu(_wrap)_or for pick_next_task

2020-08-15 Thread Joel Fernandes (Google)
From: Vineeth Pillai During a CPU hotplug event, schedule would be called with the hotplugged CPU not in the cpumask. So use for_each_cpu(_wrap)_or to include the current cpu in the task pick loop. Signed-off-by: Vineeth Pillai Co-developed-by: Joel Fernandes (Google) Signed-off-by: Joel

[PATCH RFC 04/12] kernel/entry: Add support for core-wide protection of kernel-mode

2020-08-15 Thread Joel Fernandes (Google)
-by: Joel Fernandes (Google) --- include/linux/sched.h | 12 +++ kernel/entry/common.c | 88 +++--- kernel/sched/core.c | 205 ++ kernel/sched/sched.h | 3 + 4 files changed, 277 insertions(+), 31 deletions(-) diff --git a/include/linux

[PATCH RFC 05/12] entry/idle: Enter and exit kernel protection during idle entry and exit

2020-08-15 Thread Joel Fernandes (Google)
Make use of the generic_idle_{enter,exit} helper function added in earlier patches to enter and exit kernel protection. On exiting idle, protection will be reenabled. Signed-off-by: Joel Fernandes (Google) --- include/linux/entry-common.h | 6 ++ 1 file changed, 6 insertions(+) diff --git

[PATCH RFC 00/12] Core-sched v6+: kernel protection and hotplug fixes

2020-08-15 Thread Joel Fernandes (Google)
o worse than smtoff. Also a modified rcutorture was used to heavily stress the kernel to make sure there is not crash or instability. Joel Fernandes (Google) (5): irq_work: Add support to detect if work is pending entry/idle: Add a common function for activites during idle entry/exit arch/x86: Add a

[PATCH RFC 01/12] irq_work: Add support to detect if work is pending

2020-08-15 Thread Joel Fernandes (Google)
P1() { int r1; int r2 = 0; r1 = READ_ONCE(flag); if (r1) r2 = READ_ONCE(buf); } Cc: paul...@kernel.org Signed-off-by: Joel Fernandes (Google) --- include/linux/irq_work.h | 1 + kernel/irq_work.c|

[PATCH RFC 06/12] entry/kvm: Protect the kernel when entering from guest

2020-08-15 Thread Joel Fernandes (Google)
From: Vineeth Pillai Similar to how user to kernel mode transitions are protected in earlier patches, protect the entry into kernel from guest mode as well. Signed-off-by: Joel Fernandes (Google) --- arch/x86/kvm/x86.c| 3 +++ include/linux/entry-kvm.h | 12 kernel/entry

[PATCH RFC 10/12] sched/coresched: Make core_pick_seq per run-queue

2020-08-15 Thread Joel Fernandes (Google)
core_pick_seq per run-queue. Signed-off-by: Vineeth Pillai Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 19 ++- kernel/sched/sched.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3e9df8221c62

[PATCH RFC 07/12] bitops: Introduce find_next_or_bit

2020-08-15 Thread Joel Fernandes (Google)
From: Vineeth Pillai Hotplug fixes to core-scheduling require a new bitops API. Introduce a new API find_next_or_bit() which returns the bit number of the next set bit in OR-ed bit masks of the given bit masks. Signed-off-by: Vineeth Pillai Signed-off-by: Joel Fernandes (Google) --- include

[PATCH RFC 03/12] arch/x86: Add a new TIF flag for untrusted tasks

2020-08-15 Thread Joel Fernandes (Google)
. Signed-off-by: Joel Fernandes (Google) --- arch/x86/include/asm/thread_info.h | 2 ++ kernel/sched/sched.h | 6 ++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 267701ae3d86..42e63969acb3 100644 --- a/arch

[PATCH RFC 02/12] entry/idle: Add a common function for activites during idle entry/exit

2020-08-15 Thread Joel Fernandes (Google)
Currently only RCU hooks for idle entry/exit are called. In later patches, kernel-entry protection functionality will be added. Signed-off-by: Joel Fernandes (Google) --- include/linux/entry-common.h | 16 kernel/sched/idle.c | 17 + 2 files changed, 25

[PATCH RFC 08/12] cpumask: Introduce a new iterator for_each_cpu_wrap_or

2020-08-15 Thread Joel Fernandes (Google)
From: Vineeth Pillai Hotplug fixes to core-scheduling require a new cpumask iterator which iterates through all online cpus in both the given cpumasks. This patch introduces it. Signed-off-by: Vineeth Pillai Signed-off-by: Joel Fernandes (Google) --- include/linux/cpumask.h | 42

[PATCH RFC 11/12] sched/coresched: Check for dynamic changes in smt_mask

2020-08-15 Thread Joel Fernandes (Google)
logic if smt_mask changes between the loops. Reported-by: Joel Fernandes (Google) Signed-off-by: Vineeth Pillai Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel

[PATCH] perf: sched: Show start of latency as well

2020-09-25 Thread Joel Fernandes (Google)
spending a lot of time backtracking to the start of the latency in "perf sched script" which wastes a lot of time. This patch therefore adds a new column "Max delay start". Considering this, also rename "Maximum delay at" to "Max delay end" as its easier to un

[PATCH v6 0/4] Add support for length of each segment in the segcblist

2020-09-23 Thread Joel Fernandes (Google)
2053-1-j...@joelfernandes.org/) Joel Fernandes (Google) (4): rcu/tree: Make rcu_do_batch count how many callbacks were executed rcu/segcblist: Add counters to segcblist datastructure rcu/trace: Add tracing for how segcb list changes rcu/segcblist: Remove useless rcupdate.h include include

[PATCH v6 3/4] rcu/trace: Add tracing for how segcb list changes

2020-09-23 Thread Joel Fernandes (Google)
in the respective segment. Signed-off-by: Joel Fernandes (Google) --- include/trace/events/rcu.h | 25 + kernel/rcu/rcu_segcblist.c | 34 ++ kernel/rcu/rcu_segcblist.h | 5 + kernel/rcu/tree.c | 9 + 4 files changed, 73 insertions

[PATCH v6 2/4] rcu/segcblist: Add counters to segcblist datastructure

2020-09-23 Thread Joel Fernandes (Google)
related to using donecbs's ->len field as a temporary variable to save the segmented callback list's length. This cannot be done anymore and is not needed. Signed-off-by: Joel Fernandes (Google) --- include/linux/rcu_segcblist.h | 2 + kernel/rcu/rcu_segcblist.c|

[PATCH v6 4/4] rcu/segcblist: Remove useless rcupdate.h include

2020-09-23 Thread Joel Fernandes (Google)
Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c index df0f31e30947..b65ac8c85b56 100644 --- a/kernel/rcu/rcu_segcblist.c +++ b/kernel/rcu/rcu_segcblist.c @@ -10,7

[PATCH v6 1/4] rcu/tree: Make rcu_do_batch count how many callbacks were executed

2020-09-23 Thread Joel Fernandes (Google)
from 0 is confusing and error-prone IMHO. This commit therefore explicitly counts have many callbacks were executed in rcu_do_batch() itself, and uses that to update the per-CPU segcb list's ->len field, without relying on the negativity of rcl->len. Signed-off-by: Joel Fernandes (Google) ---

[PATCH] rcu/tree: nocb: Avoid raising softirq when CBs ready to execute

2020-09-28 Thread Joel Fernandes (Google)
-time jitter. Passed 30 minute tests of TREE01 through TREE09 each. Cc: neer...@codeaurora.org Cc: fweis...@gmail.com Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index

[PATCH v9 7/7] rcu/segcblist: Add additional comments to explain smp_mb()

2020-11-03 Thread Joel Fernandes (Google)
Memory barriers are needed when updating the full length of the segcblist, however it is not fully clearly why one is needed before and after. This patch therefore adds additional comments to the function header to explain it. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu

[PATCH v9 5/7] rcu/segcblist: Remove useless rcupdate.h include

2020-11-03 Thread Joel Fernandes (Google)
Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c index 2a03949d0b82..e9e72d72f7a6 100644 --- a/kernel/rcu/rcu_segcblist.c +++ b/kernel/rcu/rcu_segcblist.c @@ -10,7

[PATCH v9 3/7] srcu: Fix invoke_rcu_callbacks() segcb length adjustment

2020-11-03 Thread Joel Fernandes (Google)
Weisbecker Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/srcutree.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 0f23d20d485a..79b7081143a7 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1160,6

[PATCH v9 6/7] rcu/tree: segcblist: Remove redundant smp_mb()s

2020-11-03 Thread Joel Fernandes (Google)
This memory barrier is not needed as rcu_segcblist_add_len() already includes a memory barrier *before* and *after* the length of the list is updated. Same reasoning for rcu_segcblist_enqueue(). Reviewed-by: Frederic Weisbecker Signed-off-by: Joel Fernandes (Google) --- kernel/rcu

[PATCH v9 0/7] Add support for length of each segment in the segcblist

2020-11-03 Thread Joel Fernandes (Google)
el.org/lkml/20200719034210.2382053-1-joel@xxxxx/) Joel Fernandes (Google) (7): rcu/tree: Make rcu_do_batch count how many callbacks were executed rcu/segcblist: Add counters to segcblist datastructure srcu: Fix invoke_rcu_callbacks() segcb length adjustment rcu/trace: Add tracing for how

[PATCH v9 1/7] rcu/tree: Make rcu_do_batch count how many callbacks were executed

2020-11-03 Thread Joel Fernandes (Google)
d-by: Neeraj Upadhyay Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c | 2 +- kernel/rcu/rcu_segcblist.h | 1 + kernel/rcu/tree.c | 11 +-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcb

[PATCH v9 4/7] rcu/trace: Add tracing for how segcb list changes

2020-11-03 Thread Joel Fernandes (Google)
in the respective segment. Reviewed-by: Frederic Weisbecker Reviewed-by: Neeraj Upadhyay Signed-off-by: Joel Fernandes (Google) --- include/trace/events/rcu.h | 25 + kernel/rcu/rcu_segcblist.c | 34 ++ kernel/rcu/rcu_segcblist.h | 5 + kernel/rcu

[PATCH v9 2/7] rcu/segcblist: Add counters to segcblist datastructure

2020-11-03 Thread Joel Fernandes (Google)
related to using donecbs's ->len field as a temporary variable to save the segmented callback list's length. This cannot be done anymore and is not needed. Reviewed-by: Frederic Weisbecker Signed-off-by: Joel Fernandes (Google) --- include/linux/rcu_segcblist.h | 1 + kernel/

[PATCH 3/9] rcu/sync: Remove custom check for reader-section (v2)

2019-07-15 Thread Joel Fernandes (Google)
-off-by: Joel Fernandes (Google) --- include/linux/rcu_sync.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/rcu_sync.h b/include/linux/rcu_sync.h index 9b83865d24f9..0027d4c8087c 100644 --- a/include/linux/rcu_sync.h +++ b/include/linux/rcu_sync.h @@ -31,9

[PATCH 0/9] Harden list_for_each_entry_rcu() and family

2019-07-15 Thread Joel Fernandes (Google)
wq_mutex deleted (Daniel Jordan) Simplify rcu_read_lock_any_held() (Peter Zijlstra) Simplified rcu-sync logic (Oleg Nesterov) Updated documentation and rculist comments. Added GregKH ack. RFC->v1: Simplify list checking macro (Rasmus Villemo

[PATCH 9/9] doc: Update documentation about list_for_each_entry_rcu (v1)

2019-07-15 Thread Joel Fernandes (Google)
This patch updates the documentation with information about usage of lockdep with list_for_each_entry_rcu(). Signed-off-by: Joel Fernandes (Google) --- Documentation/RCU/lockdep.txt | 15 +++ Documentation/RCU/whatisRCU.txt | 9 - 2 files changed, 19 insertions(+), 5

[PATCH 5/9] driver/core: Convert to use built-in RCU list checking (v1)

2019-07-15 Thread Joel Fernandes (Google)
list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it in driver core. Acked-by: Greg Kroah-Hartman Signed-off-by: Joel Fernandes (Google) --- drivers/base/base.h | 1 + drivers/base/core.c | 10 ++ drivers/base/power/runtime.c | 15

[PATCH 8/9] acpi: Use built-in RCU list checking for acpi_ioremaps list (v1)

2019-07-15 Thread Joel Fernandes (Google)
list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it for acpi_ioremaps list traversal. Signed-off-by: Joel Fernandes (Google) --- drivers/acpi/osl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index

[PATCH 2/9] rcu: Add support for consolidated-RCU reader checking (v3)

2019-07-15 Thread Joel Fernandes (Google)
need to pass the optional fourth argument (cond) unless they are under some non-RCU protection and needs to make lockdep check pass. Signed-off-by: Joel Fernandes (Google) --- include/linux/rculist.h | 28 - include/linux/rcupdate.h | 7 +++ kernel/rcu/Kconfig.debug

[PATCH 7/9] x86/pci: Pass lockdep condition to pcm_mmcfg_list iterator (v1)

2019-07-15 Thread Joel Fernandes (Google)
Fernandes (Google) --- arch/x86/pci/mmconfig-shared.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 7389db538c30..6fa42e9c4e6f 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig

[PATCH 4/9] ipv4: add lockdep condition to fix for_each_entry (v1)

2019-07-15 Thread Joel Fernandes (Google)
Using the previous support added, use it for adding lockdep conditions to list usage here. Signed-off-by: Joel Fernandes (Google) --- net/ipv4/fib_frontend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index

[PATCH 6/9] workqueue: Convert for_each_wq to use built-in list check (v2)

2019-07-15 Thread Joel Fernandes (Google)
list_for_each_entry_rcu now has support to check for RCU reader sections as well as lock. Just use the support in it, instead of explictly checking in the caller. Signed-off-by: Joel Fernandes (Google) --- kernel/workqueue.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff

[PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-17 Thread Joel Fernandes (Google)
he waiting task is not notified again. A stress test continuously doing pidfd poll and process exits uncovered this bug, and the below patch fixes it. To fix this, we set tsk->exit_state before calling do_notify_pidfd. Cc: kernel-t...@android.com Signed-off-by: Suren Baghdasaryan Signed-off-by: Joel

[PATCH] sched/headers: Fix sched_setattr userspace compilation breakage

2020-05-28 Thread Joel Fernandes (Google)
can compile. Fixes: e2d1e2aec572a ("sched/headers: Move various ABI definitions to " Signed-off-by: Joel Fernandes (Google) --- include/uapi/linux/sched/types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/typ

[PATCH RFC v2] sched/headers: Fix sched_setattr userspace compilation issues

2020-05-22 Thread Joel Fernandes (Google)
with __KERNEL__ so that userspace and the kernel can both compile. Signed-off-by: Joel Fernandes (Google) --- v1->v2: With the chance that libc needs resolving something, I'm resending with libc-alpha added as suggested by Christian, and minor commit message fixes. include/uapi/linux/sched/types.h

[PATCH 1/2] rcuperf: Remove useless while loops around wait_event

2020-05-24 Thread Joel Fernandes (Google)
wait_event() already retries if the condition for the wake up is not satisifed after wake up. Remove them from the rcuperf test. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcuperf.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/kernel/rcu

[PATCH 2/2] refperf: Add a test to measure performance of read-side synchronization

2020-05-24 Thread Joel Fernandes (Google)
7 33 [3.347133] 18 34 Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/Kconfig.debug | 19 ++ kernel/rcu/Makefile | 1 + kernel/rcu/refperf.c | 558 +++ 3 files changed, 578 insertions(+) create mode 100644 kernel/rcu/refperf.c

[PATCH v1 2/6] ipv4: add lockdep condition to fix for_each_entry

2019-07-11 Thread Joel Fernandes (Google)
Signed-off-by: Joel Fernandes (Google) --- net/ipv4/fib_frontend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index b298255f6fdb..ef7c9f8e8682 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -127,7

[PATCH v1 5/6] x86/pci: Pass lockdep condition to pcm_mmcfg_list iterator

2019-07-11 Thread Joel Fernandes (Google)
Fernandes (Google) --- arch/x86/pci/mmconfig-shared.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 7389db538c30..6fa42e9c4e6f 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig

[PATCH v1 6/6] acpi: Use built-in RCU list checking for acpi_ioremaps list

2019-07-11 Thread Joel Fernandes (Google)
list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it for acpi_ioremaps list traversal. Signed-off-by: Joel Fernandes (Google) --- drivers/acpi/osl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index

[PATCH v1 0/6] Harden list_for_each_entry_rcu() and family

2019-07-11 Thread Joel Fernandes (Google)
r_wq_mutex() function which is called in for_each_wq(). This series replaces that in favor of the built-in check. Also in the future, we can extend these checks to list_entry_rcu() and other list macros as well, if needed. Joel Fernandes (Google) (6): rcu: Add support for consolidated-RCU reader checking

[PATCH v1 3/6] driver/core: Convert to use built-in RCU list checking

2019-07-11 Thread Joel Fernandes (Google)
list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it in driver core. Signed-off-by: Joel Fernandes (Google) --- drivers/base/base.h | 1 + drivers/base/core.c | 10 ++ drivers/base/power/runtime.c | 15 ++- 3 files changed, 21

[PATCH v1 1/6] rcu: Add support for consolidated-RCU reader checking

2019-07-11 Thread Joel Fernandes (Google)
need to pass the optional fourth argument (cond) unless they are under some non-RCU protection and needs to make lockdep check pass. Signed-off-by: Joel Fernandes (Google) --- include/linux/rculist.h | 29 - include/linux/rcupdate.h | 7 +++ kernel/rcu

[PATCH v1 4/6] workqueue: Convert for_each_wq to use built-in list check

2019-07-11 Thread Joel Fernandes (Google)
list_for_each_entry_rcu now has support to check for RCU reader sections as well as lock. Just use the support in it, instead of explictly checking in the caller. Signed-off-by: Joel Fernandes (Google) --- kernel/workqueue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git

[PATCH 0/9] Apply new rest conversion patches to /dev branch

2019-08-01 Thread Joel Fernandes (Google)
oc patches, and then applying them again. But in the re-application, we convert the documentation No manual fix ups were done in this process, other than to documentation. thanks, - Joel And in the process I learnt about get_user() and compiler barriers ;-) Joel Fernandes (Google) (8): Revert "rcu:

[PATCH 1/9] Revert "rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()"

2019-08-01 Thread Joel Fernandes (Google)
This reverts commit d6b9cd7dc8e041ee83cb1362fce59a3cdb1f2709. --- .../RCU/Design/Requirements/Requirements.html | 71 --- kernel/rcu/tree_plugin.h | 11 +++ 2 files changed, 11 insertions(+), 71 deletions(-) diff --git

[PATCH 2/9] Revert "rcu: Add support for consolidated-RCU reader checking"

2019-08-01 Thread Joel Fernandes (Google)
This reverts commit 50ad3f1f9b13c8a6f2ae79df4cecb2c21da1c7c8. --- include/linux/rculist.h | 32 include/linux/rcupdate.h | 7 - kernel/rcu/Kconfig.debug | 11 --- kernel/rcu/update.c | 65 ++-- 4 files changed, 27

[PATCH 5/9] docs: rcu: Correct links referring to titles

2019-08-01 Thread Joel Fernandes (Google)
Mauro's auto conversion broken these links, fix them. Signed-off-by: Joel Fernandes (Google) --- .../Tree-RCU-Memory-Ordering.rst | 17 ++-- .../RCU/Design/Requirements/Requirements.rst | 90 --- 2 files changed, 47 insertions(+), 60 deletions(-) diff --git

[PATCH 7/9] Revert "Revert "treewide: Rename rcu_dereference_raw_notrace() to _check()""

2019-08-01 Thread Joel Fernandes (Google)
This reverts commit 61d814760f1d2dffdc8db636f70bbef07c30acd5. --- Documentation/RCU/Design/Requirements/Requirements.rst | 2 +- arch/powerpc/include/asm/kvm_book3s_64.h | 2 +- include/linux/rculist.h| 6 +++--- include/linux/rcupdate.h

[PATCH 6/9] docs: rcu: Increase toctree to 3

2019-08-01 Thread Joel Fernandes (Google)
These documents are long and have various sections. Provide a good toc nesting level. Signed-off-by: Joel Fernandes (Google) --- Documentation/RCU/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RCU/index.rst b/Documentation/RCU/index.rst index

[PATCH 9/9] Revert "Revert "rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()""

2019-08-01 Thread Joel Fernandes (Google)
This reverts commit 43ddb98ebe7171ff1c6e11c1616fd03726d8e9bf while adding the documentation that the original commit added but in ReST format. --- .../RCU/Design/Requirements/Requirements.rst | 54 +++ kernel/rcu/tree_plugin.h | 11 2 files changed, 54

[PATCH 8/9] Revert "Revert "rcu: Add support for consolidated-RCU reader checking""

2019-08-01 Thread Joel Fernandes (Google)
This reverts commit 24be1727c524b5874d5dc7828cd392cf86c3341e. --- include/linux/rculist.h | 32 include/linux/rcupdate.h | 7 + kernel/rcu/Kconfig.debug | 11 +++ kernel/rcu/update.c | 65 ++-- 4 files changed, 88

[PATCH 3/9] Revert "treewide: Rename rcu_dereference_raw_notrace() to _check()"

2019-08-01 Thread Joel Fernandes (Google)
This reverts commit 355e9972da81e803bbb825b76106ae9b358caf8e. --- Documentation/RCU/Design/Requirements/Requirements.html | 2 +- arch/powerpc/include/asm/kvm_book3s_64.h| 2 +- include/linux/rculist.h | 6 +++--- include/linux/rcupdate.h

['PATCH v2' 1/7] Revert docs from "rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()"

2019-08-01 Thread Joel Fernandes (Google)
This reverts docs from commit d6b9cd7dc8e041ee83cb1362fce59a3cdb1f2709. --- .../RCU/Design/Requirements/Requirements.html | 71 --- 1 file changed, 71 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.html

['PATCH v2' 6/7] Restore docs "treewide: Rename rcu_dereference_raw_notrace() to _check()"

2019-08-01 Thread Joel Fernandes (Google)
This restores docs back in ReST format. --- Documentation/RCU/Design/Requirements/Requirements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Documentation/RCU/Design/Requirements/Requirements.rst index

[PATCH v2 0/7] Doc updates to /dev branch

2019-08-01 Thread Joel Fernandes (Google)
This series fixes the rcu/dev branch with the new ReST conversion patches. Only changes are to documentation. thanks, - Joel Joel Fernandes (Google) (6): Revert docs from "rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()" Revert docs from "t

['PATCH v2' 2/7] Revert docs from "treewide: Rename rcu_dereference_raw_notrace() to _check()"

2019-08-01 Thread Joel Fernandes (Google)
This reverts docs from commit 355e9972da81e803bbb825b76106ae9b358caf8e. --- Documentation/RCU/Design/Requirements/Requirements.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.html

['PATCH v2' 5/7] docs: rcu: Increase toctree to 3

2019-08-01 Thread Joel Fernandes (Google)
These documents are long and have various sections. Provide a good toc nesting level. Signed-off-by: Joel Fernandes (Google) --- Documentation/RCU/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RCU/index.rst b/Documentation/RCU/index.rst index

['PATCH v2' 7/7] Restore docs "rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()"

2019-08-01 Thread Joel Fernandes (Google)
This restores docs back in ReST format. --- .../RCU/Design/Requirements/Requirements.rst | 54 +++ 1 file changed, 54 insertions(+) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Documentation/RCU/Design/Requirements/Requirements.rst index

['PATCH v2' 4/7] docs: rcu: Correct links referring to titles

2019-08-01 Thread Joel Fernandes (Google)
Mauro's auto conversion broken these links, fix them. Signed-off-by: Joel Fernandes (Google) --- .../Tree-RCU-Memory-Ordering.rst | 17 ++-- .../RCU/Design/Requirements/Requirements.rst | 90 --- 2 files changed, 47 insertions(+), 60 deletions(-) diff --git

[PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-24 Thread Joel Fernandes (Google)
.@redhat.com Cc: mathieu.desnoy...@efficios.com Cc: wi...@infradead.org Cc: pet...@infradead.org Cc: will.dea...@arm.com Cc: paul...@linux.vnet.ibm.com Cc: elena.reshet...@intel.com Cc: keesc...@chromium.org Cc: kernel-t...@android.com Cc: kernel-harden...@lists.openwall.com Signed-off-by: Joel Fe

[PATCH] binder: Fix comment headers on binder_alloc_prepare_to_free()

2019-09-30 Thread Joel Fernandes (Google)
binder_alloc_buffer_lookup() doesn't exist and is named "binder_alloc_prepare_to_free()". Correct the code comments to reflect this. Signed-off-by: Joel Fernandes (Google) --- drivers/android/binder_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drive

[PATCH -rcu dev 2/2] rcu/dyntick-idle: Add better tracing

2019-08-30 Thread Joel Fernandes (Google)
on the previous patches to simplify rcu_dyntick counters [1] and with these traces, I have verified the counters are working properly. [1] Link: https://lore.kernel.org/patchwork/patch/1120021/ Link: https://lore.kernel.org/patchwork/patch/1120022/ Signed-off-by: Joel Fernandes (Google) --- incl

[PATCH -rcu dev 1/2] Revert b8c17e6664c4 ("rcu: Maintain special bits at bottom of ->dynticks counter")

2019-08-30 Thread Joel Fernandes (Google)
This code is unused and can be removed now. Revert was straightforward. Tested with light rcutorture. Link: http://lore.kernel.org/r/CALCETrWNPOOdTrFabTDd=h7+wc6xj9rjceg6ol1s0rtv5pf...@mail.gmail.com Suggested-by: Andy Lutomirski Signed-off-by: Joel Fernandes (Google) --- include/linux

<    1   2   3   4   5   6   >