2017-12-11 19:05:19

by Corey Minyard

[permalink] [raw]
Subject: Re: [ANNOUNCE] 4.1.46-rt52

On 11/29/2017 05:13 PM, Julia Cartwright wrote:
> Hello RT Folks!
>
> I'm pleased to announce the 4.1.46-rt52 stable release.
>
> You can get this release via the git tree at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git
>
> branch: v4.1-rt
> Head SHA1: 6e737a91c1ce923d4e10db831e14cfef9a2459cc
>
> Or to build 4.1.46-rt52 directly, the following patches should be applied:
>
> http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.1.tar.xz
>
> http://www.kernel.org/pub/linux/kernel/v4.x/patch-4.1.46.xz
>
> http://www.kernel.org/pub/linux/kernel/projects/rt/4.1/patch-4.1.46-rt52.patch.xz
>
>
> You can also build from 4.1.46-rt51 by applying the incremental patch:
>
> http://www.kernel.org/pub/linux/kernel/projects/rt/4.1/incr/patch-4.1.46-rt51-rt52.patch.xz
>
> Enjoy!
> Julia
>
> Changes from v4.1.46-rt51:
> ---
> Julia Cartwright (2):
> workqueue: fixup rcu check for RT
> Linux 4.1.46-rt52
>
> Sebastian Andrzej Siewior (2):
> PM / CPU: replace raw_notifier with atomic_notifier (fixup)

This change breaks the compile of 4.1 on ARM (and other things using
kernel/cpu_pm.c).

rcu_irq_enter_irqson() and friends doesn't exist in 4.1. In fact,
rcu_irq_enter() doesn't even exist.

Sorry I didn't get to testing this earlier, I've been focused on other things.

-corey


> kernel/hrtimer: migrate deferred timer on CPU down
>
> ---
> kernel/cpu_pm.c | 7 +++++++
> kernel/time/hrtimer.c | 5 +++++
> kernel/workqueue.c | 2 +-
> localversion-rt | 2 +-
> 4 files changed, 14 insertions(+), 2 deletions(-)
> ---
> diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c
> index 9da42f83ee03..d1d1c3961553 100644
> --- a/kernel/cpu_pm.c
> +++ b/kernel/cpu_pm.c
> @@ -28,8 +28,15 @@ static int cpu_pm_notify(enum cpu_pm_event event, int nr_to_call, int *nr_calls)
> {
> int ret;
>
> + /*
> + * __atomic_notifier_call_chain has a RCU read critical section, which
> + * could be disfunctional in cpu idle. Copy RCU_NONIDLE code to let
> + * RCU know this.
> + */
> + rcu_irq_enter_irqson();
> ret = __atomic_notifier_call_chain(&cpu_pm_notifier_chain, event, NULL,
> nr_to_call, nr_calls);
> + rcu_irq_exit_irqson();
>
> return notifier_to_errno(ret);
> }
> diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
> index 2c6be169bdc7..75c990b00525 100644
> --- a/kernel/time/hrtimer.c
> +++ b/kernel/time/hrtimer.c
> @@ -1951,6 +1951,11 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
> /* Clear the migration state bit */
> timer->state &= ~HRTIMER_STATE_MIGRATE;
> }
> +#ifdef CONFIG_PREEMPT_RT_BASE
> + list_splice_tail(&old_base->expired, &new_base->expired);
> + if (!list_empty(&new_base->expired))
> + raise_softirq_irqoff(HRTIMER_SOFTIRQ);
> +#endif
> }
>
> static void migrate_hrtimers(int scpu)
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 6bdcab98501c..90e261c8811e 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -363,7 +363,7 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq);
> "RCU or wq->mutex should be held")
>
> #define assert_rcu_or_wq_mutex_or_pool_mutex(wq) \
> - rcu_lockdep_assert(rcu_read_lock_sched_held() || \
> + rcu_lockdep_assert(rcu_read_lock_held() || \
> lockdep_is_held(&wq->mutex) || \
> lockdep_is_held(&wq_pool_mutex), \
> "sched RCU, wq->mutex or wq_pool_mutex should be held")
> diff --git a/localversion-rt b/localversion-rt
> index 75493460c41f..66a5ed8bf3d7 100644
> --- a/localversion-rt
> +++ b/localversion-rt
> @@ -1 +1 @@
> --rt51
> +-rt52
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html



2017-12-11 20:20:49

by Julia Cartwright

[permalink] [raw]
Subject: Re: [ANNOUNCE] 4.1.46-rt52

On Mon, Dec 11, 2017 at 01:04:58PM -0600, Corey Minyard wrote:
> On 11/29/2017 05:13 PM, Julia Cartwright wrote:
> > Hello RT Folks!
> >
> > I'm pleased to announce the 4.1.46-rt52 stable release.
> >
> > You can get this release via the git tree at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git
> >
> > branch: v4.1-rt
> > Head SHA1: 6e737a91c1ce923d4e10db831e14cfef9a2459cc
> >
> > Or to build 4.1.46-rt52 directly, the following patches should be applied:
> >
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_v4.x_linux-2D4.1.tar.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=tGmSNpZKEKvhTpeVu_ktmD4I5PIXfIJhZ79DxwbCjtQ&e=
> >
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_v4.x_patch-2D4.1.46.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=hx9pHgRy7tWhUeeiJhPOH0T8qdDrhtZvWxOWuIBZZgs&e=
> >
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_projects_rt_4.1_patch-2D4.1.46-2Drt52.patch.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=Pm8ed_xvW1drpPxNkt035bj6ILvSImuN9vvgEAt8IiM&e=
> >
> >
> > You can also build from 4.1.46-rt51 by applying the incremental patch:
> >
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_projects_rt_4.1_incr_patch-2D4.1.46-2Drt51-2Drt52.patch.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=ZM64-JCd0WNFQgFlB3wbCfn8Jtf9rq5QyCO2-GJsC2Q&e=
> >
> > Enjoy!
> > Julia
> >
> > Changes from v4.1.46-rt51:
> > ---
> > Julia Cartwright (2):
> > workqueue: fixup rcu check for RT
> > Linux 4.1.46-rt52
> >
> > Sebastian Andrzej Siewior (2):
> > PM / CPU: replace raw_notifier with atomic_notifier (fixup)
>
> This change breaks the compile of 4.1 on ARM (and other things using
> kernel/cpu_pm.c).
>
> rcu_irq_enter_irqson() and friends doesn't exist in 4.1. In fact,
> rcu_irq_enter() doesn't even exist.
>
> Sorry I didn't get to testing this earlier, I've been focused on other things.

Thanks! My current builds apparently don't currently cover CPU_PM
builds, so I didn't see this :(. Thanks for the report.

v4.1 does contain rcu_irq_enter(), and it looks like what we should be
using in 4.1 instead.

I'm thinking the below should be okay; I'll be standing up a proper cpu
hotplugging test to give it some runtime.

Thanks,
Julia

-- 8< --
Subject: [PATCH] PM / CPU: replace usage of rcu_irq_{enter,exit}_irqson()

Commit c50243950f97e ("PM / CPU: replace raw_notifier with
atomic_notifier (fixup)") intended to fix up RCU usage in idle, by
telling RCU to pay attention.

However, the cherry-pick back from rt-devel included the invocation of
the _irqson() variants of rcu_irq_{enter,exit}() API which doesn't exist
in 4.1.

For 4.1, just simply drop the _irqson() variant, and instead use
rcu_irq_{enter,exit}() directly instead. This is safe, because in 4.1,
these functions internally disable interrupts.

Reported-by: Corey Minyard <[email protected]>
Signed-off-by: Julia Cartwright <[email protected]
---
kernel/cpu_pm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c
index d1d1c3961553..eeff3c382793 100644
--- a/kernel/cpu_pm.c
+++ b/kernel/cpu_pm.c
@@ -33,10 +33,10 @@ static int cpu_pm_notify(enum cpu_pm_event event, int nr_to_call, int *nr_calls)
* could be disfunctional in cpu idle. Copy RCU_NONIDLE code to let
* RCU know this.
*/
- rcu_irq_enter_irqson();
+ rcu_irq_enter();
ret = __atomic_notifier_call_chain(&cpu_pm_notifier_chain, event, NULL,
nr_to_call, nr_calls);
- rcu_irq_exit_irqson();
+ rcu_irq_exit();

return notifier_to_errno(ret);
}
--
2.14.2

2017-12-11 21:01:45

by Corey Minyard

[permalink] [raw]
Subject: Re: [ANNOUNCE] 4.1.46-rt52

On 12/11/2017 02:20 PM, Julia Cartwright wrote:
> On Mon, Dec 11, 2017 at 01:04:58PM -0600, Corey Minyard wrote:
>> On 11/29/2017 05:13 PM, Julia Cartwright wrote:
>>> Hello RT Folks!
>>>
>>> I'm pleased to announce the 4.1.46-rt52 stable release.
>>>
>>> You can get this release via the git tree at:
>>>
>>> git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git
>>>
>>> branch: v4.1-rt
>>> Head SHA1: 6e737a91c1ce923d4e10db831e14cfef9a2459cc
>>>
>>> Or to build 4.1.46-rt52 directly, the following patches should be applied:
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_v4.x_linux-2D4.1.tar.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=tGmSNpZKEKvhTpeVu_ktmD4I5PIXfIJhZ79DxwbCjtQ&e=
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_v4.x_patch-2D4.1.46.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=hx9pHgRy7tWhUeeiJhPOH0T8qdDrhtZvWxOWuIBZZgs&e=
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_projects_rt_4.1_patch-2D4.1.46-2Drt52.patch.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=Pm8ed_xvW1drpPxNkt035bj6ILvSImuN9vvgEAt8IiM&e=
>>>
>>>
>>> You can also build from 4.1.46-rt51 by applying the incremental patch:
>>>
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kernel.org_pub_linux_kernel_projects_rt_4.1_incr_patch-2D4.1.46-2Drt51-2Drt52.patch.xz&d=DwICaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=cAXq_8W9Othb2h8ZcWv8Vw&m=a5KTpX9A0-pHwmQkOOLr5_xeWPavI-lgN7Z0Goes2So&s=ZM64-JCd0WNFQgFlB3wbCfn8Jtf9rq5QyCO2-GJsC2Q&e=
>>>
>>> Enjoy!
>>> Julia
>>>
>>> Changes from v4.1.46-rt51:
>>> ---
>>> Julia Cartwright (2):
>>> workqueue: fixup rcu check for RT
>>> Linux 4.1.46-rt52
>>>
>>> Sebastian Andrzej Siewior (2):
>>> PM / CPU: replace raw_notifier with atomic_notifier (fixup)
>> This change breaks the compile of 4.1 on ARM (and other things using
>> kernel/cpu_pm.c).
>>
>> rcu_irq_enter_irqson() and friends doesn't exist in 4.1. In fact,
>> rcu_irq_enter() doesn't even exist.
>>
>> Sorry I didn't get to testing this earlier, I've been focused on other things.
> Thanks! My current builds apparently don't currently cover CPU_PM
> builds, so I didn't see this :(. Thanks for the report.
>
> v4.1 does contain rcu_irq_enter(), and it looks like what we should be
> using in 4.1 instead.

Ah, it does, I looked in the wrong place.

> I'm thinking the below should be okay; I'll be standing up a proper cpu
> hotplugging test to give it some runtime.

The below should work.  You'll need an ARM64, ARM or MIPS system with
the proper
config settings to exercise this code, though.

-corey

> Thanks,
> Julia
>
> -- 8< --
> Subject: [PATCH] PM / CPU: replace usage of rcu_irq_{enter,exit}_irqson()
>
> Commit c50243950f97e ("PM / CPU: replace raw_notifier with
> atomic_notifier (fixup)") intended to fix up RCU usage in idle, by
> telling RCU to pay attention.
>
> However, the cherry-pick back from rt-devel included the invocation of
> the _irqson() variants of rcu_irq_{enter,exit}() API which doesn't exist
> in 4.1.
>
> For 4.1, just simply drop the _irqson() variant, and instead use
> rcu_irq_{enter,exit}() directly instead. This is safe, because in 4.1,
> these functions internally disable interrupts.
>
> Reported-by: Corey Minyard <[email protected]>
> Signed-off-by: Julia Cartwright <[email protected]
> ---
> kernel/cpu_pm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c
> index d1d1c3961553..eeff3c382793 100644
> --- a/kernel/cpu_pm.c
> +++ b/kernel/cpu_pm.c
> @@ -33,10 +33,10 @@ static int cpu_pm_notify(enum cpu_pm_event event, int nr_to_call, int *nr_calls)
> * could be disfunctional in cpu idle. Copy RCU_NONIDLE code to let
> * RCU know this.
> */
> - rcu_irq_enter_irqson();
> + rcu_irq_enter();
> ret = __atomic_notifier_call_chain(&cpu_pm_notifier_chain, event, NULL,
> nr_to_call, nr_calls);
> - rcu_irq_exit_irqson();
> + rcu_irq_exit();
>
> return notifier_to_errno(ret);
> }


2017-12-11 21:24:25

by Julia Cartwright

[permalink] [raw]
Subject: Re: [ANNOUNCE] 4.1.46-rt52

On Mon, Dec 11, 2017 at 03:01:39PM -0600, Corey Minyard wrote:
> On 12/11/2017 02:20 PM, Julia Cartwright wrote:
> > On Mon, Dec 11, 2017 at 01:04:58PM -0600, Corey Minyard wrote:
[..]
> > > >
> > > > Sebastian Andrzej Siewior (2):
> > > > PM / CPU: replace raw_notifier with atomic_notifier (fixup)
> > > This change breaks the compile of 4.1 on ARM (and other things using
> > > kernel/cpu_pm.c).
> > >
> > > rcu_irq_enter_irqson() and friends doesn't exist in 4.1. In fact,
> > > rcu_irq_enter() doesn't even exist.
> > >
> > > Sorry I didn't get to testing this earlier, I've been focused on other things.
> > Thanks! My current builds apparently don't currently cover CPU_PM
> > builds, so I didn't see this :(. Thanks for the report.
> >
> > v4.1 does contain rcu_irq_enter(), and it looks like what we should be
> > using in 4.1 instead.
>
> Ah, it does, I looked in the wrong place.
>
> > I'm thinking the below should be okay; I'll be standing up a proper cpu
> > hotplugging test to give it some runtime.
>
> The below should work.? You'll need an ARM64, ARM or MIPS system with
> the proper config settings to exercise this code, though.

Shouldn't be a problem, I've got an ARM64 board that I've been meaning
to integrate into my testing anyway.

Thanks,
Julia