[PATCH -tip 16/32] irq_work: Cleanup

2020-11-17 Thread Joel Fernandes (Google)
-off-by: Joel Fernandes (Google) --- drivers/gpu/drm/i915/i915_request.c | 4 ++-- include/linux/irq_work.h| 33 ++--- include/linux/irqflags.h| 4 ++-- kernel/bpf/stackmap.c | 2 +- kernel/irq_work.c | 18

[PATCH -tip 04/32] sched: Core-wide rq->lock

2020-11-17 Thread Joel Fernandes (Google)
From: Peter Zijlstra Introduce the basic infrastructure to have a core wide rq->lock. Tested-by: Julien Desfossez Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Julien Desfossez Signed-off-by: Vineeth Remanan Pillai Signed-off-by: Joel Fernandes (Google) --- kernel/Kconfig.pree

[PATCH -tip 22/32] sched: Split the cookie and setup per-task cookie on fork

2020-11-17 Thread Joel Fernandes (Google)
APIs and support. Reviewed-by: Josh Don Tested-by: Julien Desfossez Signed-off-by: Joel Fernandes (Google) --- include/linux/sched.h | 2 + kernel/sched/core.c | 241 -- kernel/sched/debug.c | 4 + 3 files changed, 236 insertions(+), 11 deletions

[PATCH -tip 20/32] entry/kvm: Protect the kernel when entering from guest

2020-11-17 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. Tested-by: Julien Desfossez Reviewed-by: Joel Fernandes (Google) Reviewed-by: Alexandre Chartre Signed-off-by: Vineeth Pillai Signed

[PATCH -tip 25/32] sched: Refactor core cookie into struct

2020-11-17 Thread Joel Fernandes (Google)
of existing core cookies so that multiple tasks may share the same core_cookie. This will be especially useful in the next patch, where the concept of cookie color is introduced. Reviewed-by: Joel Fernandes (Google) Signed-off-by: Josh Don Signed-off-by: Joel Fernandes (Google) --- kernel

[PATCH -tip 23/32] sched: Add a per-thread core scheduling interface

2020-11-17 Thread Joel Fernandes (Google)
Add a per-thread core scheduling interface which allows a thread to share a core with another thread, or have a core exclusively for itself. ChromeOS uses core-scheduling to securely enable hyperthreading. This cuts down the keypress latency in Google docs from 150ms to 50ms while improving

[PATCH -tip 14/32] sched: migration changes for core scheduling

2020-11-17 Thread Joel Fernandes (Google)
-by: Tim Chen Signed-off-by: Vineeth Remanan Pillai Signed-off-by: Joel Fernandes (Google) --- kernel/sched/fair.c | 64 kernel/sched/sched.h | 29 2 files changed, 88 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b

[PATCH -tip 05/32] sched/fair: Add a few assertions

2020-11-17 Thread Joel Fernandes (Google)
From: Peter Zijlstra Tested-by: Julien Desfossez Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Joel Fernandes (Google) --- kernel/sched/fair.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 51483a00a755

[PATCH -tip 27/32] sched/debug: Add CGroup node for printing group cookie if SCHED_DEBUG

2020-11-17 Thread Joel Fernandes (Google)
This will be used by kselftest to verify the CGroup cookie value that is set by the CGroup interface. Reviewed-by: Josh Don Tested-by: Julien Desfossez Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 31 +++ 1 file changed, 31 insertions(+) diff

[PATCH -tip 07/32] sched: Add core wide task selection and scheduling.

2020-11-17 Thread Joel Fernandes (Google)
From: Peter Zijlstra Instead of only selecting a local task, select a task for all SMT siblings for every reschedule on the core (irrespective which logical CPU does the reschedule). Tested-by: Julien Desfossez Reviewed-by: Joel Fernandes (Google) Signed-off-by: Peter Zijlstra (Intel) Signed

[PATCH -tip 18/32] kernel/entry: Add support for core-wide protection of kernel-mode

2020-11-17 Thread Joel Fernandes (Google)
-by: Vineeth Pillai Signed-off-by: Vineeth Pillai Signed-off-by: Joel Fernandes (Google) --- .../admin-guide/kernel-parameters.txt | 11 + include/linux/entry-common.h | 12 +- include/linux/sched.h | 12 + kernel/entry/common.c

[PATCH -tip 24/32] sched: Release references to the per-task cookie on exit

2020-11-17 Thread Joel Fernandes (Google)
Fernandes (Google) --- include/linux/sched.h | 3 +++ kernel/fork.c | 1 + kernel/sched/core.c | 8 3 files changed, 12 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index 79d76c78cc8e..6fbdb1a204bf 100644 --- a/include/linux/sched.h +++ b/include/linux

[PATCH -tip 12/32] sched: Simplify the core pick loop for optimized case

2020-11-17 Thread Joel Fernandes (Google)
in case anyone reports an issue with it. Testing shows it to be working for me. Reviewed-by: Vineeth Pillai Suggested-by: Peter Zijlstra (Intel) Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 73 - 1 file changed, 26 insertions

[PATCH -tip 26/32] sched: Add a second-level tag for nested CGroup usecase

2020-11-17 Thread Joel Fernandes (Google)
From: Josh Don Google has a usecase where the first level tag to tag a CGroup is not sufficient. So, a patch is carried for years where a second tag is added which is writeable by unprivileged users. Google uses DAC controls to make the 'tag' possible to set only by root while the second-level

[PATCH -tip 28/32] kselftest: Add tests for core-sched interface

2020-11-17 Thread Joel Fernandes (Google)
Add a kselftest test to ensure that the core-sched interface is working correctly. Tested-by: Julien Desfossez Reviewed-by: Josh Don Signed-off-by: Joel Fernandes (Google) --- tools/testing/selftests/sched/.gitignore | 1 + tools/testing/selftests/sched/Makefile| 14 + tools

[PATCH -tip 03/32] sched/fair: Fix pick_task_fair crashes due to empty rbtree

2020-11-17 Thread Joel Fernandes (Google)
ime. Suggested-by: Vineeth Remanan Pillai Signed-off-by: Peter Zijlstra Signed-off-by: Joel Fernandes (Google) --- kernel/sched/fair.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 12cf068eeec8..51483a00a755 100

[PATCH -tip 13/32] sched: Trivial forced-newidle balancer

2020-11-17 Thread Joel Fernandes (Google)
Desfossez Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Joel Fernandes (Google) --- include/linux/sched.h | 1 + kernel/sched/core.c | 130 +- kernel/sched/idle.c | 1 + kernel/sched/sched.h | 6 ++ 4 files changed, 137 insertions(+), 1

[PATCH -tip 29/32] sched: Move core-scheduler interfacing code to a new file

2020-11-17 Thread Joel Fernandes (Google)
-by: Julien Desfossez Reviewed-by: Chris Hyser Signed-off-by: Chris Hyser Signed-off-by: Joel Fernandes (Google) --- kernel/sched/Makefile | 1 + kernel/sched/core.c| 809 +--- kernel/sched/coretag.c | 819 + kernel

[PATCH -tip 30/32] Documentation: Add core scheduling documentation

2020-11-17 Thread Joel Fernandes (Google)
Document the usecases, design and interfaces for core scheduling. Co-developed-by: Vineeth Pillai Signed-off-by: Vineeth Pillai Tested-by: Julien Desfossez Reviewed-by: Randy Dunlap Signed-off-by: Joel Fernandes (Google) --- .../admin-guide/hw-vuln/core-scheduling.rst | 330

[PATCH -tip 32/32] sched: Debug bits...

2020-11-17 Thread Joel Fernandes (Google)
Tested-by: Julien Desfossez Not-Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/core.c | 35 ++- kernel/sched/fair.c | 9 + 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index

[PATCH -tip 31/32] sched: Add a coresched command line option

2020-11-17 Thread Joel Fernandes (Google)
Fernandes (Google) --- .../admin-guide/kernel-parameters.txt | 14 ++ arch/x86/kernel/cpu/bugs.c| 19 include/linux/cpu.h | 1 + include/linux/sched/smt.h | 4 ++ kernel/cpu.c

[PATCH -tip 21/32] sched: CGroup tagging interface for core scheduling

2020-11-17 Thread Joel Fernandes (Google)
Pillai Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 183 +-- kernel/sched/sched.h | 4 + 2 files changed, 181 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7f807a84cc30..b99a7493d590

[PATCH -tip 15/32] sched: Improve snapshotting of min_vruntime for CGroups

2020-11-17 Thread Joel Fernandes (Google)
. Reviewed-by: Vineeth Pillai Suggested-by: Peter Zijlstra (Intel) Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 61 + kernel/sched/fair.c | 80 kernel/sched/sched.h | 7 +++- 3 files changed, 97

[PATCH -tip 08/32] sched/fair: Fix forced idle sibling starvation corner case

2020-11-17 Thread Joel Fernandes (Google)
to schedule. Tested-by: Julien Desfossez Reviewed-by: Joel Fernandes (Google) Signed-off-by: Vineeth Pillai Signed-off-by: Julien Desfossez Signed-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 15 --- kernel/sched/fair.c | 40

[PATCH -tip 19/32] entry/idle: Enter and exit kernel protection during idle entry and exit

2020-11-17 Thread Joel Fernandes (Google)
Add a generic_idle_{enter,exit} helper function to enter and exit kernel protection when entering and exiting idle, respectively. While at it, remove a stale RCU comment. Reviewed-by: Alexandre Chartre Tested-by: Julien Desfossez Signed-off-by: Joel Fernandes (Google) --- include/linux/entry

[PATCH -tip 09/32] sched/fair: Snapshot the min_vruntime of CPUs on force idle

2020-11-17 Thread Joel Fernandes (Google)
-off-by: Joel Fernandes (Google) --- kernel/sched/core.c | 33 - kernel/sched/fair.c | 40 kernel/sched/sched.h | 5 + 3 files changed, 65 insertions(+), 13 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched

[PATCH] rcu/segcblist: Add debug check for whether seglen is 0 for empty list

2020-11-18 Thread Joel Fernandes (Google)
After rcu_do_batch(), add a check for whether the seglen counts went to zero if the list was indeed empty. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c | 12 kernel/rcu/rcu_segcblist.h | 3 +++ kernel/rcu/tree.c | 1 + 3 files changed, 16

[PATCH v2] rcu/segcblist: Add debug checks for segment lengths

2020-11-18 Thread Joel Fernandes (Google)
After rcu_do_batch(), add a check for whether the seglen counts went to zero if the list was indeed empty. Signed-off-by: Joel Fernandes (Google) --- v1->v2: Added more debug checks. kernel/rcu/rcu_segcblist.c | 12 kernel/rcu/rcu_segcblist.h | 3 +++ kernel/rcu/tre

[PATCH] mm: emit tracepoint when RSS changes by threshold

2019-09-03 Thread Joel Fernandes (Google)
by mm_struct. o Keep overhead low by checking if tracing is enabled. o Add some noise reduction and lower overhead by emitting only on threshold changes. Co-developed-by: Tim Murray Signed-off-by: Tim Murray Signed-off-by: Joel Fernandes (Google) --- Cc: carmenjack...@google.com Cc: mayankgu

[PATCH v2] mm: emit tracepoint when RSS changes by threshold

2019-09-03 Thread Joel Fernandes (Google)
Fernandes (Google) --- v1->v2: Added more commit message. Cc: carmenjack...@google.com Cc: mayankgu...@google.com Cc: dan...@google.com Cc: rost...@goodmis.org Cc: minc...@kernel.org Cc: a...@linux-foundation.org Cc: kernel-t...@android.com include/linux/mm.h |

[RFC v1 1/2] rcu/tree: Clean up dynticks counter usage

2019-08-26 Thread Joel Fernandes (Google)
do cheaper comparisons with zero instead for the code that keeps the tick on in rcu_nmi_enter_common(). In the next patch, both of the concerns of (2) will be addressed and then we can get rid of dynticks_nmi_nesting, however one step at a time. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/r

[PATCH RFC v1 1/2] rcu/tree: Add basic support for kfree_rcu batching

2019-08-06 Thread Joel Fernandes (Google)
ail.com Cc: byungchul.p...@lge.com Cc: kernel-t...@android.com Cc: kernel-t...@lge.com Co-developed-by: Byungchul Park Signed-off-by: Byungchul Park Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 198 -- 1 file changed, 193 insert

[PATCH RFC v1 2/2] rcuperf: Add kfree_rcu performance Tests

2019-08-06 Thread Joel Fernandes (Google)
Fernandes (Google) --- kernel/rcu/rcuperf.c | 169 ++- 1 file changed, 168 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c index 7a6890b23c5f..34658760da5e 100644 --- a/kernel/rcu/rcuperf.c +++ b/kernel/rcu/rcuperf.c

[PATCH RFC 0/4] Add support to directly attach BPF program to ftrace

2019-07-10 Thread Joel Fernandes (Google)
bpf file to /sys/kernel/debug/tracing/events/X/Y/bpf 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. Joel Fernandes (Google) (4

[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)
derstand. Signed-off-by: Joel Fernandes (Google) --- A sample output can be seen after applying patch: https://hastebin.com/raw/ivinimaler tools/perf/builtin-sched.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-sched.c b/tools

[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@x/) 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)
es) Joel Fernandes (Google) (9): rcu/update: Remove useless check for debug_locks (v1) rcu: Add support for consolidated-RCU reader checking (v3) rcu/sync: Remove custom check for reader-section (v2) ipv4: add lockdep condition to fix for_each_entry (v1) driver/core: Convert to use built-in RCU list chec

[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

<    5   6   7   8   9   10   11   12   13   14   >