<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/rcu/tree_exp.h, branch linux-4.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-03-11T15:31:45Z</updated>
<entry>
<title>rcu: Suppress smp_processor_id() complaint in synchronize_rcu_expedited_wait()</title>
<updated>2023-03-11T15:31:45Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2022-12-16T23:55:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=83f20fa16909799082609830929ee3c067bcb098'/>
<id>urn:sha1:83f20fa16909799082609830929ee3c067bcb098</id>
<content type='text'>
[ Upstream commit 2d7f00b2f01301d6e41fd4a28030dab0442265be ]

The normal grace period's RCU CPU stall warnings are invoked from the
scheduling-clock interrupt handler, and can thus invoke smp_processor_id()
with impunity, which allows them to directly invoke dump_cpu_task().
In contrast, the expedited grace period's RCU CPU stall warnings are
invoked from process context, which causes the dump_cpu_task() function's
calls to smp_processor_id() to complain bitterly in debug kernels.

This commit therefore causes synchronize_rcu_expedited_wait() to disable
preemption around its call to dump_cpu_task().

Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>rcu: Fix missed wakeup of exp_wq waiters</title>
<updated>2021-09-26T11:39:46Z</updated>
<author>
<name>Neeraj Upadhyay</name>
</author>
<published>2019-11-19T03:17:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3226fb90cf5dc89611f742f122a33d4598076ad5'/>
<id>urn:sha1:3226fb90cf5dc89611f742f122a33d4598076ad5</id>
<content type='text'>
commit fd6bc19d7676a060a171d1cf3dcbf6fd797eb05f upstream.

Tasks waiting within exp_funnel_lock() for an expedited grace period to
elapse can be starved due to the following sequence of events:

1.	Tasks A and B both attempt to start an expedited grace
	period at about the same time.	This grace period will have
	completed when the lower four bits of the rcu_state structure's
	-&gt;expedited_sequence field are 0b'0100', for example, when the
	initial value of this counter is zero.	Task A wins, and thus
	does the actual work of starting the grace period, including
	acquiring the rcu_state structure's .exp_mutex and sets the
	counter to 0b'0001'.

2.	Because task B lost the race to start the grace period, it
	waits on -&gt;expedited_sequence to reach 0b'0100' inside of
	exp_funnel_lock(). This task therefore blocks on the rcu_node
	structure's -&gt;exp_wq[1] field, keeping in mind that the
	end-of-grace-period value of -&gt;expedited_sequence (0b'0100')
	is shifted down two bits before indexing the -&gt;exp_wq[] field.

3.	Task C attempts to start another expedited grace period,
	but blocks on -&gt;exp_mutex, which is still held by Task A.

4.	The aforementioned expedited grace period completes, so that
	-&gt;expedited_sequence now has the value 0b'0100'.  A kworker task
	therefore acquires the rcu_state structure's -&gt;exp_wake_mutex
	and starts awakening any tasks waiting for this grace period.

5.	One of the first tasks awakened happens to be Task A.  Task A
	therefore releases the rcu_state structure's -&gt;exp_mutex,
	which allows Task C to start the next expedited grace period,
	which causes the lower four bits of the rcu_state structure's
	-&gt;expedited_sequence field to become 0b'0101'.

6.	Task C's expedited grace period completes, so that the lower four
	bits of the rcu_state structure's -&gt;expedited_sequence field now
	become 0b'1000'.

7.	The kworker task from step 4 above continues its wakeups.
	Unfortunately, the wake_up_all() refetches the rcu_state
	structure's .expedited_sequence field:

	wake_up_all(&amp;rnp-&gt;exp_wq[rcu_seq_ctr(rcu_state.expedited_sequence) &amp; 0x3]);

	This results in the wakeup being applied to the rcu_node
	structure's -&gt;exp_wq[2] field, which is unfortunate given that
	Task B is instead waiting on -&gt;exp_wq[1].

On a busy system, no harm is done (or at least no permanent harm is done).
Some later expedited grace period will redo the wakeup.  But on a quiet
system, such as many embedded systems, it might be a good long time before
there was another expedited grace period.  On such embedded systems,
this situation could therefore result in a system hang.

This issue manifested as DPM device timeout during suspend (which
usually qualifies as a quiet time) due to a SCSI device being stuck in
_synchronize_rcu_expedited(), with the following stack trace:

	schedule()
	synchronize_rcu_expedited()
	synchronize_rcu()
	scsi_device_quiesce()
	scsi_bus_suspend()
	dpm_run_callback()
	__device_suspend()

This commit therefore prevents such delays, timeouts, and hangs by
making rcu_exp_wait_wake() use its "s" argument consistently instead of
refetching from rcu_state.expedited_sequence.

Fixes: 3b5f668e715b ("rcu: Overlap wakeups with next expedited grace period")
Signed-off-by: Neeraj Upadhyay &lt;neeraju@codeaurora.org&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Signed-off-by: David Chen &lt;david.chen@nutanix.com&gt;
Acked-by: Neeraj Upadhyay &lt;neeraju@codeaurora.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2018-08-13T18:25:07Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2018-08-13T18:25:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f7951c33f0fed14ee26651a70a46899a59a31e18'/>
<id>urn:sha1:f7951c33f0fed14ee26651a70a46899a59a31e18</id>
<content type='text'>
Pull scheduler updates from Thomas Gleixner:

 - Cleanup and improvement of NUMA balancing

 - Refactoring and improvements to the PELT (Per Entity Load Tracking)
   code

 - Watchdog simplification and related cleanups

 - The usual pile of small incremental fixes and improvements

* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (41 commits)
  watchdog: Reduce message verbosity
  stop_machine: Reflow cpu_stop_queue_two_works()
  sched/numa: Move task_numa_placement() closer to numa_migrate_preferred()
  sched/numa: Use group_weights to identify if migration degrades locality
  sched/numa: Update the scan period without holding the numa_group lock
  sched/numa: Remove numa_has_capacity()
  sched/numa: Modify migrate_swap() to accept additional parameters
  sched/numa: Remove unused task_capacity from 'struct numa_stats'
  sched/numa: Skip nodes that are at 'hoplimit'
  sched/debug: Reverse the order of printing faults
  sched/numa: Use task faults only if numa_group is not yet set up
  sched/numa: Set preferred_node based on best_cpu
  sched/numa: Simplify load_too_imbalanced()
  sched/numa: Evaluate move once per node
  sched/numa: Remove redundant field
  sched/debug: Show the sum wait time of a task group
  sched/fair: Remove #ifdefs from scale_rt_capacity()
  sched/core: Remove get_cpu() from sched_fork()
  sched/cpufreq: Clarify sugov_get_util()
  sched/sysctl: Remove unused sched_time_avg_ms sysctl
  ...
</content>
</entry>
<entry>
<title>rcu: Make expedited GPs handle CPU 0 being offline</title>
<updated>2018-07-12T19:36:06Z</updated>
<author>
<name>Boqun Feng</name>
</author>
<published>2018-06-15T19:06:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fcc63543650150629c8a873cbef3578770acecd9'/>
<id>urn:sha1:fcc63543650150629c8a873cbef3578770acecd9</id>
<content type='text'>
Currently, the parallelized initialization of expedited grace periods uses
the workqueue associated with each rcu_node structure's -&gt;grplo field.
This works fine unless that CPU is offline.  This commit therefore uses
the CPU corresponding to the lowest-numbered online CPU, or just queues
the work on WORK_CPU_UNBOUND if there are no online CPUs corresponding
to this rcu_node structure.

Note that this patch uses cpu_is_offline() instead of the usual approach
of checking bits in the rcu_node structure's -&gt;qsmaskinitnext field.  This
is safe because preemption is disabled across both the cpu_is_offline()
check and the call to queue_work_on().

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
[ paulmck: Disable preemption to close offline race window. ]
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
[ paulmck: Apply Peter Zijlstra feedback on CPU selection. ]
Tested-by: Aneesh Kumar K.V &lt;aneesh.kumar@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>rcu: Make expedited grace period use direct call on last leaf</title>
<updated>2018-06-25T18:25:41Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2018-04-24T18:03:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5257514d8885b2ebc11bf359ea1527282b47a5fd'/>
<id>urn:sha1:5257514d8885b2ebc11bf359ea1527282b47a5fd</id>
<content type='text'>
During expedited grace-period initialization, a work item is scheduled
for each leaf rcu_node structure.  However, that initialization code
is itself (normally) executing from a workqueue, so one of the leaf
rcu_node structures could just as well be handled by that pre-existing
workqueue, and with less overhead.  This commit therefore uses a
shiny new rcu_is_leaf_node() macro to execute the last leaf rcu_node
structure's initialization directly from the pre-existing workqueue.

Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>sched/swait: Rename to exclusive</title>
<updated>2018-06-20T09:35:56Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2018-06-12T08:34:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b3dae109fa89d67334bf3349babab3ad9b6f233f'/>
<id>urn:sha1:b3dae109fa89d67334bf3349babab3ad9b6f233f</id>
<content type='text'>
Since swait basically implemented exclusive waits only, make sure
the API reflects that.

  $ git grep -l -e "\&lt;swake_up\&gt;"
		-e "\&lt;swait_event[^ (]*"
		-e "\&lt;prepare_to_swait\&gt;" | while read file;
    do
	sed -i -e 's/\&lt;swake_up\&gt;/&amp;_one/g'
	       -e 's/\&lt;swait_event[^ (]*/&amp;_exclusive/g'
	       -e 's/\&lt;prepare_to_swait\&gt;/&amp;_exclusive/g' $file;
    done

With a few manual touch-ups.

Suggested-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: bigeasy@linutronix.de
Cc: oleg@redhat.com
Cc: paulmck@linux.vnet.ibm.com
Cc: pbonzini@redhat.com
Link: https://lkml.kernel.org/r/20180612083909.261946548@infradead.org

</content>
</entry>
<entry>
<title>Merge branches 'exp.2018.05.15a', 'fixes.2018.05.15a', 'lock.2018.05.15a' and 'torture.2018.05.15a' into HEAD</title>
<updated>2018-05-15T17:33:05Z</updated>
<author>
<name>Paul E. McKenney</name>
</author>
<published>2018-05-15T17:33:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=22df7316ac71dc1ac57415349938737d2a229c59'/>
<id>urn:sha1:22df7316ac71dc1ac57415349938737d2a229c59</id>
<content type='text'>
exp.2018.05.15a: Parallelize expedited grace-period initialization.
fixes.2018.05.15a: Miscellaneous fixes.
lock.2018.05.15a: Decrease lock contention on root rcu_node structure,
	which is a step towards merging RCU flavors.
torture.2018.05.15a: Torture-test updates.
</content>
</entry>
<entry>
<title>rcu: Remove deprecated RCU debugfs tracing code</title>
<updated>2018-05-15T17:27:23Z</updated>
<author>
<name>Byungchul Park</name>
</author>
<published>2018-03-02T07:39:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6fba2b3767ea6e3e1204855031492415cc4dce4f'/>
<id>urn:sha1:6fba2b3767ea6e3e1204855031492415cc4dce4f</id>
<content type='text'>
Commit ae91aa0adb14 ("rcu: Remove debugfs tracing") removed the
RCU debugfs tracing code, but did not remove the no-longer used
-&gt;exp_workdone{0,1,2,3} fields in the srcu_data structure.  This commit
therefore removes these fields along with the code that uselessly
updates them.

Signed-off-by: Byungchul Park &lt;byungchul.park@lge.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
</entry>
<entry>
<title>rcu: exp: Protect all sync_rcu_preempt_exp_done() with rcu_node lock</title>
<updated>2018-05-15T17:26:07Z</updated>
<author>
<name>Boqun Feng</name>
</author>
<published>2018-03-09T01:14:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=55ebfce0605a4dce35467dfb1dc1b3ad26fe9f86'/>
<id>urn:sha1:55ebfce0605a4dce35467dfb1dc1b3ad26fe9f86</id>
<content type='text'>
Currently some callsites of sync_rcu_preempt_exp_done() are not called
with the corresponding rcu_node's -&gt;lock held, which could introduces
bugs as per Paul:

o	CPU 0 in sync_rcu_preempt_exp_done() reads -&gt;exp_tasks and
	sees that it is NULL.

o	CPU 1 blocks within an RCU read-side critical section, so
	it enqueues the task and points -&gt;exp_tasks at it and
	clears CPU 1's bit in -&gt;expmask.

o	All other CPUs clear their bits in -&gt;expmask.

o	CPU 0 reads -&gt;expmask, sees that it is zero, so incorrectly
	concludes that all quiescent states have completed, despite
	the fact that -&gt;exp_tasks is non-NULL.

To fix this, sync_rcu_preempt_exp_unlocked() is introduced to replace
lockless callsites of sync_rcu_preempt_exp_done().

Further, a lockdep annotation is added into sync_rcu_preempt_exp_done()
to prevent mis-use in the future.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
</entry>
<entry>
<title>rcu: exp: Fix "must hold exp_mutex" comments for QS reporting functions</title>
<updated>2018-05-15T17:26:01Z</updated>
<author>
<name>Boqun Feng</name>
</author>
<published>2018-03-07T08:49:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7be8c56f8f8a58af92f8791c5a09d48e342d7101'/>
<id>urn:sha1:7be8c56f8f8a58af92f8791c5a09d48e342d7101</id>
<content type='text'>
Since commit d9a3da0699b2 ("rcu: Add expedited grace-period support
for preemptible RCU"), there are comments for some funtions in
rcu_report_exp_rnp()'s call-chain saying that exp_mutex or its
predecessors needs to be held.

However, exp_mutex and its predecessors were used only to synchronize
between GPs, and it is clear that all variables visited by those functions
are under the protection of rcu_node's -&gt;lock. Moreover, those functions
are currently called without held exp_mutex, and seems that doesn't
introduce any trouble.

So this patch fixes this problem by updating the comments to match the
current code.

Signed-off-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Fixes: d9a3da0699b2 ("rcu: Add expedited grace-period support for preemptible RCU")
Signed-off-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Tested-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
</content>
</entry>
</feed>
