Re: [GIT PULL] RCU fix for v6.12

2024-10-11 Thread pr-tracker-bot
The pull request you sent on Fri, 11 Oct 2024 23:50:23 +0530:

> git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git 
> tags/rcu.fixes.6.12-rc3

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/a1029768f3931b31aa52790f1dde0c7d6a6552eb

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html



[GIT PULL] RCU fix for v6.12

2024-10-11 Thread Neeraj Upadhyay
Hi Linus,

The following changes since commit 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b:

  Linux 6.12-rc2 (2024-10-06 15:32:27 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git 
tags/rcu.fixes.6.12-rc3

for you to fetch changes up to f7345ccc62a4b880cf76458db5f320725f28e400:

  rcu/nocb: Fix rcuog wake-up from offline softirq (2024-10-10 22:18:19 +0530)


RCU fix for v6.12

Fix rcuog kthread wakeup invocation from softirq context on a CPU
which has been marked offline. This can happen when new callbacks
are enqueued from a softirq on an offline CPU before it calls
rcutree_report_cpu_dead(). When this happens on NOCB configuration,
the rcuog wake-up is deferred through an IPI to an online CPU.
This is done to avoid call into the scheduler which can risk
arming the RT-bandwidth after hrtimers have been migrated out
and disabled. However, doing IPI call from softirq is not allowed
Fix this by forcing deferred rcuog wakeup through the NOCB timer
when the CPU is offline.


Frederic Weisbecker (1):
  rcu/nocb: Fix rcuog wake-up from offline softirq

 kernel/rcu/tree_nocb.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)



[GIT PULL] RCU fix

2015-09-17 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: 31409c97640ff5f1a49e34ac7f3c82097bf57bec Merge branch 'for-mingo' of 
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/urgent

Fix a false positive warning.

 Thanks,

Ingo

-->
Paul E. McKenney (1):
  security/device_cgroup: Fix RCU_LOCKDEP_WARN() condition


 security/device_cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 73455089feef..03c1652c9a1f 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -401,7 +401,7 @@ static bool verify_new_ex(struct dev_cgroup *dev_cgroup,
bool match = false;
 
RCU_LOCKDEP_WARN(!rcu_read_lock_held() &&
-lockdep_is_held(&devcgroup_mutex),
+!lockdep_is_held(&devcgroup_mutex),
 "device_cgroup:verify_new_ex called without proper 
synchronization");
 
if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] RCU fix

2015-05-06 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: cb0f3f320d64831afb39940863c5927d6af25514 Merge branch 'for-mingo' of 
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/urgent

An RCU Kconfig fix that eliminates an annoying interactive kconfig 
question for CONFIG_RCU_TORTURE_TEST_SLOW_INIT.

 Thanks,

Ingo

-->
Paul E. McKenney (1):
  rcu: Control grace-period delays directly from value


 kernel/rcu/tree.c | 16 +---
 lib/Kconfig.debug |  1 +
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 233165da782f..8cf7304b2867 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -162,11 +162,14 @@ static void invoke_rcu_callbacks(struct rcu_state *rsp, 
struct rcu_data *rdp);
 static int kthread_prio = CONFIG_RCU_KTHREAD_PRIO;
 module_param(kthread_prio, int, 0644);
 
-/* Delay in jiffies for grace-period initialization delays. */
-static int gp_init_delay = IS_ENABLED(CONFIG_RCU_TORTURE_TEST_SLOW_INIT)
-   ? CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY
-   : 0;
+/* Delay in jiffies for grace-period initialization delays, debug only. */
+#ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT
+static int gp_init_delay = CONFIG_RCU_TORTURE_TEST_SLOW_INIT_DELAY;
 module_param(gp_init_delay, int, 0644);
+#else /* #ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT */
+static const int gp_init_delay;
+#endif /* #else #ifdef CONFIG_RCU_TORTURE_TEST_SLOW_INIT */
+#define PER_RCU_NODE_PERIOD 10 /* Number of grace periods between delays. */
 
 /*
  * Track the rcutorture test sequence number and the update version
@@ -1843,9 +1846,8 @@ static int rcu_gp_init(struct rcu_state *rsp)
raw_spin_unlock_irq(&rnp->lock);
cond_resched_rcu_qs();
ACCESS_ONCE(rsp->gp_activity) = jiffies;
-   if (IS_ENABLED(CONFIG_RCU_TORTURE_TEST_SLOW_INIT) &&
-   gp_init_delay > 0 &&
-   !(rsp->gpnum % (rcu_num_nodes * 10)))
+   if (gp_init_delay > 0 &&
+   !(rsp->gpnum % (rcu_num_nodes * PER_RCU_NODE_PERIOD)))
schedule_timeout_uninterruptible(gp_init_delay);
}
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 93967e634a1e..7815ddd5ae56 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1281,6 +1281,7 @@ config RCU_TORTURE_TEST_SLOW_INIT_DELAY
int "How much to slow down RCU grace-period initialization"
range 0 5
default 3
+   depends on RCU_TORTURE_TEST_SLOW_INIT
help
  This option specifies the number of jiffies to wait between
  each rcu_node structure initialization.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] RCU fix

2015-02-20 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: 3b3336d4fed58ea5a019a8a1d00fa741be492716 Merge branch 'rcu/next' of 
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/urgent

Fix a bug that caused an RCU warning splat.

 Thanks,

Ingo

-->
Paul E. McKenney (1):
  rcu: Clear need_qs flag to prevent splat


 kernel/rcu/tree_plugin.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 2e850a51bb8f..bca28b00f7e6 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -327,6 +327,7 @@ void rcu_read_unlock_special(struct task_struct *t)
special = t->rcu_read_unlock_special;
if (special.b.need_qs) {
rcu_preempt_qs();
+   t->rcu_read_unlock_special.b.need_qs = false;
if (!t->rcu_read_unlock_special.s) {
local_irq_restore(flags);
return;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] RCU fix

2014-09-07 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   # HEAD: 651bc1a474ad5f3a94587117cf509d7fa9247f69 Merge branch 'rcu/urgent' 
of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into 
core/urgent

A boot hang fix for the offloaded callback RCU model 
(RCU_NOCB_CPU=y && (TREE_CPU=y || TREE_PREEMPT_RC))
in certain bootup scenarios.

 Thanks,

Ingo

-->
Pranith Kumar (1):
  rcu: Make nocb leader kthreads process pending callbacks after spawning


 kernel/rcu/tree.h|  2 +-
 kernel/rcu/tree_plugin.h | 22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 71e64c718f75..6a86eb7bac45 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -358,7 +358,7 @@ struct rcu_data {
struct rcu_head **nocb_gp_tail;
long nocb_gp_count;
long nocb_gp_count_lazy;
-   bool nocb_leader_wake;  /* Is the nocb leader thread awake? */
+   bool nocb_leader_sleep; /* Is the nocb leader thread asleep? */
struct rcu_data *nocb_next_follower;
/* Next follower in wakeup chain. */
 
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 00dc411e9676..a7997e272564 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2074,9 +2074,9 @@ static void wake_nocb_leader(struct rcu_data *rdp, bool 
force)
 
if (!ACCESS_ONCE(rdp_leader->nocb_kthread))
return;
-   if (!ACCESS_ONCE(rdp_leader->nocb_leader_wake) || force) {
+   if (ACCESS_ONCE(rdp_leader->nocb_leader_sleep) || force) {
/* Prior xchg orders against prior callback enqueue. */
-   ACCESS_ONCE(rdp_leader->nocb_leader_wake) = true;
+   ACCESS_ONCE(rdp_leader->nocb_leader_sleep) = false;
wake_up(&rdp_leader->nocb_wq);
}
 }
@@ -2253,7 +2253,7 @@ static void nocb_leader_wait(struct rcu_data *my_rdp)
if (!rcu_nocb_poll) {
trace_rcu_nocb_wake(my_rdp->rsp->name, my_rdp->cpu, "Sleep");
wait_event_interruptible(my_rdp->nocb_wq,
-ACCESS_ONCE(my_rdp->nocb_leader_wake));
+   !ACCESS_ONCE(my_rdp->nocb_leader_sleep));
/* Memory barrier handled by smp_mb() calls below and repoll. */
} else if (firsttime) {
firsttime = false; /* Don't drown trace log with "Poll"! */
@@ -2292,12 +2292,12 @@ static void nocb_leader_wait(struct rcu_data *my_rdp)
schedule_timeout_interruptible(1);
 
/* Rescan in case we were a victim of memory ordering. */
-   my_rdp->nocb_leader_wake = false;
-   smp_mb();  /* Ensure _wake false before scan. */
+   my_rdp->nocb_leader_sleep = true;
+   smp_mb();  /* Ensure _sleep true before scan. */
for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_follower)
if (ACCESS_ONCE(rdp->nocb_head)) {
/* Found CB, so short-circuit next wait. */
-   my_rdp->nocb_leader_wake = true;
+   my_rdp->nocb_leader_sleep = false;
break;
}
goto wait_again;
@@ -2307,17 +2307,17 @@ static void nocb_leader_wait(struct rcu_data *my_rdp)
rcu_nocb_wait_gp(my_rdp);
 
/*
-* We left ->nocb_leader_wake set to reduce cache thrashing.
-* We clear it now, but recheck for new callbacks while
+* We left ->nocb_leader_sleep unset to reduce cache thrashing.
+* We set it now, but recheck for new callbacks while
 * traversing our follower list.
 */
-   my_rdp->nocb_leader_wake = false;
-   smp_mb(); /* Ensure _wake false before scan of ->nocb_head. */
+   my_rdp->nocb_leader_sleep = true;
+   smp_mb(); /* Ensure _sleep true before scan of ->nocb_head. */
 
/* Each pass through the following loop wakes a follower, if needed. */
for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_follower) {
if (ACCESS_ONCE(rdp->nocb_head))
-   my_rdp->nocb_leader_wake = true; /* No need to wait. */
+   my_rdp->nocb_leader_sleep = false;/* No need to sleep.*/
if (!rdp->nocb_gp_head)
continue; /* No CBs, so no need to wake follower. */
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] RCU fix

2012-12-01 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   HEAD: 745040347d7e8e7b47e3790de76423d9eab474eb Merge branch 'rcu/urgent' of 
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/urgent

Fix leaking RCU extended quiescent state, which might trigger 
warnings and mess up the extended quiescent state tracking logic 
into thinking that we are in "RCU user mode" while we aren't.

 Thanks,

Ingo

-->
Frederic Weisbecker (1):
  rcu: Fix unrecovered RCU user mode in syscall_trace_leave()


 arch/x86/kernel/ptrace.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index b00b33a..eff5b8c 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1511,6 +1511,13 @@ void syscall_trace_leave(struct pt_regs *regs)
 {
bool step;
 
+   /*
+* We may come here right after calling schedule_user()
+* or do_notify_resume(), in which case we can be in RCU
+* user mode.
+*/
+   rcu_user_exit();
+
audit_syscall_exit(regs);
 
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] RCU fix

2012-07-14 Thread Ingo Molnar
Linus,

Please pull the latest core-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
core-urgent-for-linus

   HEAD: 40b3c43f042c2ba8915aff5c63708207ed7639cb Merge branch 'rcu/urgent' of 
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/urgent

 Thanks,

Ingo

-->
Paul E. McKenney (1):
  Revert "rcu: Move PREEMPT_RCU preemption to switch_to() invocation"


 arch/um/drivers/mconsole_kern.c |1 -
 include/linux/rcupdate.h|1 -
 include/linux/rcutiny.h |6 ++
 include/linux/sched.h   |   10 --
 kernel/rcutree.c|1 +
 kernel/rcutree.h|1 +
 kernel/rcutree_plugin.h |   14 +++---
 kernel/sched/core.c |1 -
 8 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 88e466b..43b39d6 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -705,7 +705,6 @@ static void stack_proc(void *arg)
struct task_struct *from = current, *to = arg;
 
to->thread.saved_task = from;
-   rcu_switch_from(from);
switch_to(from, to, from);
 }
 
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 26d1a47..9cac722 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -184,7 +184,6 @@ static inline int rcu_preempt_depth(void)
 /* Internal to kernel */
 extern void rcu_sched_qs(int cpu);
 extern void rcu_bh_qs(int cpu);
-extern void rcu_preempt_note_context_switch(void);
 extern void rcu_check_callbacks(int cpu, int user);
 struct notifier_block;
 extern void rcu_idle_enter(void);
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 854dc4c..4e56a9c 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -87,6 +87,10 @@ static inline void kfree_call_rcu(struct rcu_head *head,
 
 #ifdef CONFIG_TINY_RCU
 
+static inline void rcu_preempt_note_context_switch(void)
+{
+}
+
 static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
 {
*delta_jiffies = ULONG_MAX;
@@ -95,6 +99,7 @@ static inline int rcu_needs_cpu(int cpu, unsigned long 
*delta_jiffies)
 
 #else /* #ifdef CONFIG_TINY_RCU */
 
+void rcu_preempt_note_context_switch(void);
 int rcu_preempt_needs_cpu(void);
 
 static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
@@ -108,6 +113,7 @@ static inline int rcu_needs_cpu(int cpu, unsigned long 
*delta_jiffies)
 static inline void rcu_note_context_switch(int cpu)
 {
rcu_sched_qs(cpu);
+   rcu_preempt_note_context_switch();
 }
 
 /*
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4059c0f..06a4c5f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1871,22 +1871,12 @@ static inline void rcu_copy_process(struct task_struct 
*p)
INIT_LIST_HEAD(&p->rcu_node_entry);
 }
 
-static inline void rcu_switch_from(struct task_struct *prev)
-{
-   if (prev->rcu_read_lock_nesting != 0)
-   rcu_preempt_note_context_switch();
-}
-
 #else
 
 static inline void rcu_copy_process(struct task_struct *p)
 {
 }
 
-static inline void rcu_switch_from(struct task_struct *prev)
-{
-}
-
 #endif
 
 #ifdef CONFIG_SMP
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 38ecdda..4b97bba 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -201,6 +201,7 @@ void rcu_note_context_switch(int cpu)
 {
trace_rcu_utilization("Start context switch");
rcu_sched_qs(cpu);
+   rcu_preempt_note_context_switch(cpu);
trace_rcu_utilization("End context switch");
 }
 EXPORT_SYMBOL_GPL(rcu_note_context_switch);
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index ea05649..19b61ac 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -444,6 +444,7 @@ DECLARE_PER_CPU(char, rcu_cpu_has_work);
 /* Forward declarations for rcutree_plugin.h */
 static void rcu_bootup_announce(void);
 long rcu_batches_completed(void);
+static void rcu_preempt_note_context_switch(int cpu);
 static int rcu_preempt_blocked_readers_cgp(struct rcu_node *rnp);
 #ifdef CONFIG_HOTPLUG_CPU
 static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp,
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 5271a02..3e48994 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -153,7 +153,7 @@ static void rcu_preempt_qs(int cpu)
  *
  * Caller must disable preemption.
  */
-void rcu_preempt_note_context_switch(void)
+static void rcu_preempt_note_context_switch(int cpu)
 {
struct task_struct *t = current;
unsigned long flags;
@@ -164,7 +164,7 @@ void rcu_preempt_note_context_switch(void)
(t->rcu_read_unlock_special & RCU_READ_UNLOCK_BLOCKED) == 0) {
 
/* Possibly blocking in an RCU read-side critical section. */
-   rdp = __this_cpu_ptr(rcu_preempt_state.rda);
+   rdp = per_cpu_ptr(rcu_