Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1607707

Re: [tip:sched/urgent] sched/clock: Fix clear_sched_clock_stable() preempt wobbly

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [tip:sched/urgent] sched/clock: Fix clear_sched_clock_stable() preempt wobbly
Date Thu, 23 Mar 2017 18:00:02 +0100
Message-ID <toefE-4ZJ-9@gated-at.bofh.it> (permalink)
References <tkxAe-ys-27@gated-at.bofh.it> <to74u-bk-11@gated-at.bofh.it>
X-Original-To efault@gmx.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org
Reply-To paulmck@linux.vnet.ibm.com
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
X-Tm-As-Gconf 00
X-Cbid 17032316-0048-0000-0000-000001399CA8
X-Ibm-Spammodules-Versions BY=3.00006835; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00837866; UDB=6.00411950; IPR=6.00615628; BA=6.00005234; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014779; XFM=3.00000013; UTC=2017-03-23 16:52:47
X-Ibm-Av-Detection SAVI=unused REMOTE=unused XFE=unused
X-Cbparentid 17032316-0049-0000-0000-00003FED40A1
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2017-03-23_15:,, signatures=0
X-Proofpoint-Spam-Details rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703230148
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 79
Organization linux.* mail to news gateway
X-Original-Cc linux-tip-commits@vger.kernel.org
X-Original-Date Thu, 23 Mar 2017 09:52:44 -0700
X-Original-Message-ID <20170323165244.GF3637@linux.vnet.ibm.com>
X-Original-References <20170313124621.GA3328@twins.programming.kicks-ass.net> <tip-71fdb70eb48784c1f28cdf2e67c4c587dd7f2594@git.kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1607707

Show key headers only | View raw


On Thu, Mar 23, 2017 at 02:10:47AM -0700, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  71fdb70eb48784c1f28cdf2e67c4c587dd7f2594
> Gitweb:     http://git.kernel.org/tip/71fdb70eb48784c1f28cdf2e67c4c587dd7f2594
> Author:     Peter Zijlstra <peterz@infradead.org>
> AuthorDate: Mon, 13 Mar 2017 13:46:21 +0100
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Thu, 23 Mar 2017 07:31:48 +0100
> 
> sched/clock: Fix clear_sched_clock_stable() preempt wobbly
> 
> Paul reported a problems with clear_sched_clock_stable(). Since we run
> all of __clear_sched_clock_stable() from workqueue context, there's a
> preempt problem.
> 
> Solve it by only running the static_key_disable() from workqueue.
> 
> Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: fweisbec@gmail.com
> Link: http://lkml.kernel.org/r/20170313124621.GA3328@twins.programming.kicks-ass.net
> Signed-off-by: Ingo Molnar <mingo@kernel.org>

For whatever it is worth given that it is already in -tip:

Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> ---
>  kernel/sched/clock.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
> index a08795e..fec0f58 100644
> --- a/kernel/sched/clock.c
> +++ b/kernel/sched/clock.c
> @@ -141,7 +141,14 @@ static void __set_sched_clock_stable(void)
>  	tick_dep_clear(TICK_DEP_BIT_CLOCK_UNSTABLE);
>  }
> 
> -static void __clear_sched_clock_stable(struct work_struct *work)
> +static void __sched_clock_work(struct work_struct *work)
> +{
> +	static_branch_disable(&__sched_clock_stable);
> +}
> +
> +static DECLARE_WORK(sched_clock_work, __sched_clock_work);
> +
> +static void __clear_sched_clock_stable(void)
>  {
>  	struct sched_clock_data *scd = this_scd();
> 
> @@ -160,11 +167,11 @@ static void __clear_sched_clock_stable(struct work_struct *work)
>  			scd->tick_gtod, gtod_offset,
>  			scd->tick_raw,  raw_offset);
> 
> -	static_branch_disable(&__sched_clock_stable);
>  	tick_dep_set(TICK_DEP_BIT_CLOCK_UNSTABLE);
> -}
> 
> -static DECLARE_WORK(sched_clock_work, __clear_sched_clock_stable);
> +	if (sched_clock_stable())
> +		schedule_work(&sched_clock_work);
> +}
> 
>  void clear_sched_clock_stable(void)
>  {
> @@ -173,7 +180,7 @@ void clear_sched_clock_stable(void)
>  	smp_mb(); /* matches sched_clock_init_late() */
> 
>  	if (sched_clock_running == 2)
> -		schedule_work(&sched_clock_work);
> +		__clear_sched_clock_stable();
>  }
> 
>  void sched_clock_init_late(void)
> 

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[tip:sched/urgent] sched/clock: Fix clear_sched_clock_stable()  preempt wobbly tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2017-03-23 10:20 +0100
  Re: [tip:sched/urgent] sched/clock: Fix clear_sched_clock_stable()  preempt wobbly "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-03-23 18:00 +0100

csiph-web