From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753031AbdCPX1T (ORCPT ); Thu, 16 Mar 2017 19:27:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48650 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbdCPX1Q (ORCPT ); Thu, 16 Mar 2017 19:27:16 -0400 Date: Thu, 16 Mar 2017 14:00:02 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, fweisbec@gmail.com Subject: Re: [PATCH] clock: Fix smp_processor_id() in preemptible bug Reply-To: paulmck@linux.vnet.ibm.com References: <20170308215306.GA8776@linux.vnet.ibm.com> <20170309152420.GC3343@twins.programming.kicks-ass.net> <20170309153114.GU30506@linux.vnet.ibm.com> <20170309183732.GB13748@linux.vnet.ibm.com> <20170313124621.GA3328@twins.programming.kicks-ass.net> <20170315225817.GA14170@linux.vnet.ibm.com> <20170316155310.afq6zfzkzrnsqm5n@hirez.programming.kicks-ass.net> <20170316165748.GL3637@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170316165748.GL3637@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17031621-0052-0000-0000-000001AB1B68 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006794; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00834804; UDB=6.00410006; IPR=6.00612459; BA=6.00005215; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014678; XFM=3.00000013; UTC=2017-03-16 21:00:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031621-0053-0000-0000-00004F338AE0 Message-Id: <20170316210002.GA29977@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-16_16:,, 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-1703160162 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 16, 2017 at 09:57:48AM -0700, Paul E. McKenney wrote: > On Thu, Mar 16, 2017 at 04:53:10PM +0100, Peter Zijlstra wrote: > > On Wed, Mar 15, 2017 at 03:58:17PM -0700, Paul E. McKenney wrote: > > > On Mon, Mar 13, 2017 at 01:46:21PM +0100, Peter Zijlstra wrote: > > > > On Thu, Mar 09, 2017 at 10:37:32AM -0800, Paul E. McKenney wrote: > > > > > And it does pass light testing. I will hammer it harder this evening. > > > > > > > > > > So please send a formal patch! > > > > > > > > Changed it a bit... > > > > > > > > --- > > > > Subject: sched/clock: Some clear_sched_clock_stable() vs hotplug wobbles > > > > > > > > Paul reported two independent problems with clear_sched_clock_stable(). > > > > > > > > - if we tickle it during hotplug (even though the sched_clock was > > > > already marked unstable) we'll attempt to schedule_work() and > > > > this explodes because RCU isn't watching the new CPU quite yet. > > > > > > > > - since we run all of __clear_sched_clock_stable() from workqueue > > > > context, there's a preempt problem. > > > > > > > > Cure both by only doing the static_branch_disable() from a workqueue, > > > > and only when it's still stable. > > > > > > > > This leaves the problem what to do about hotplug actually wrecking TSC > > > > though, because if it was stable and now isn't, then we will want to run > > > > that work, which then will prod RCU the wrong way. Bloody hotplug. > > > > > > Would it help to do the same trick tglx applied to the hot-unplug path, > > > that is IPIing some other CPU to schedule the workqueue? > > > > So I've been looking again; and I don't think its a problem anymore. > > > > The problem you reported here: > > > > https://lkml.kernel.org/r/20170308221656.GA11949@linux.vnet.ibm.com > > > > Should not happen after commit: > > > > f94c8d116997 ("sched/clock, x86/tsc: Rework the x86 'unstable' sched_clock() interface") > > > > which landed around 4.11-rc2; so _after_ your kernel (which reported > > itself as -rc1). > > Very good! I am re-runnning rcutorture on -rc2 (without your patch) > and will let you know how it goes. And -rc2 works just fine on rcutorture, thank you again! Thanx, Paul > > Because since that commit we'll never call clear_sched_clock_stable() if > > tsc_unstable is set. > > > > So I'll have to amend the Changelog somewhat. > > Sounds good! > > Thanx, Paul