Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 29 Jun 2018 20:52:37 -0000 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fZ0Ng-0007K3-9T for speck@linutronix.de; Fri, 29 Jun 2018 22:52:36 +0200 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B0EC87A81 for ; Fri, 29 Jun 2018 20:52:29 +0000 (UTC) Received: from treble (ovpn-120-185.rdu2.redhat.com [10.10.120.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A7BE2026D68 for ; Fri, 29 Jun 2018 20:52:29 +0000 (UTC) Date: Fri, 29 Jun 2018 15:52:27 -0500 From: Josh Poimboeuf Subject: [MODERATED] Re: [patch 2/2] cpu/hotplug: Boot HT siblings at least once Message-ID: <20180629205227.5fce7ybsumfgqrxm@treble> References: <20180629140546.075961202@linutronix.de> <20180629140611.033996006@linutronix.de> <20180629191357.nfgiqd3dpf6imrb6@treble> <20180629202522.nu6u5mwmdla2lfgw@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180629202522.nu6u5mwmdla2lfgw@treble> To: speck@linutronix.de List-ID: On Fri, Jun 29, 2018 at 03:25:22PM -0500, Josh Poimboeuf wrote: > On Fri, Jun 29, 2018 at 02:13:57PM -0500, Josh Poimboeuf wrote: > > On Fri, Jun 29, 2018 at 04:05:48PM +0200, speck for Thomas Gleixner wrote: > > > @@ -422,6 +454,16 @@ static int bringup_wait_for_ap(unsigned > > > stop_machine_unpark(cpu); > > > kthread_unpark(st->thread); > > > > > > + /* > > > + * SMT soft disabling on X86 requires to bring the CPU out of the > > > + * BIOS 'wait for SIPI' state in order to set the CR4.MCE bit. The > > > + * CPU marked itself as booted_once in cpu_notify_starting() so the > > > + * cpu_smt_allowed() check will now return false if this is not the > > > + * primary sibling. > > > + */ > > > + if (!cpu_smt_allowed(cpu)) > > > + return -ECANCELED; > > > + > > > > Shouldn't this be checked *before* unparking the kthreads? Or does > > ECANCELED magically re-park them somehow? > > Oh, I think I see it now. Looks like the state machine will call > takedown_cpu() in the CPUHP_TEARDOWN_CPU state on the way down. A short > comment to that effect would help neophyte code readers like myself. But... this code unparks both threads, whereas takedown_cpu() only re-parks the cpuhp thread. So it looks like the stopper thread never gets re-parked? It also looks like the hotplug thread gets unparked twice on the way up: once in bringup_wait_for_ap() and once in smpboot_unpark_threads(). Maybe that's harmless though. > I suppose the 'WARN_ON_ONCE((!cpu_online(cpu)))' check+return should > also be done after unparking the threads, to prevent "double parking" in > the error path? -- Josh