Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935006Ab3DKNqw (ORCPT ); Thu, 11 Apr 2013 09:46:52 -0400 Received: from www.linutronix.de ([62.245.132.108]:43423 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752497Ab3DKNqv (ORCPT ); Thu, 11 Apr 2013 09:46:51 -0400 Date: Thu, 11 Apr 2013 15:46:45 +0200 (CEST) From: Thomas Gleixner To: "Srivatsa S. Bhat" cc: Dave Hansen , Borislav Petkov , LKML , Dave Jones , dhillf@gmail.com, Peter Zijlstra , Ingo Molnar Subject: Re: [PATCH] kthread: Prevent unpark race which puts threads on the wrong cpu In-Reply-To: <51669510.2040200@linux.vnet.ibm.com> Message-ID: References: <515F457E.5050505@sr71.net> <515FCAC6.8090806@linux.vnet.ibm.com> <20130407095025.GA31307@pd.tnic> <20130408115553.GA4395@pd.tnic> <516439DF.3050901@sr71.net> <51647C30.3050109@sr71.net> <5165C087.4060404@sr71.net> <51669510.2040200@linux.vnet.ibm.com> User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1145 Lines: 22 On Thu, 11 Apr 2013, Srivatsa S. Bhat wrote: > The reason why we can't get rid of the bind in the unpark code is because, > the threads are parked during CPU offline *after* calling CPU_DOWN_PREPARE. > And during CPU_DOWN_PREPARE, the scheduler removes the CPU from the cpu_active_mask. > So on any subsequent wakeup of these threads before they are parked, the scheduler > will force migrate them to some other CPU (but alas it wont print this event > because of the p->mm != NULL check in select_fallback_rq()). So during unpark > during the next online operation we need to bind it again. But that's fine, IMHO. No, it's not fine. If we do not have TASK_PARKED a wakeup which happens after onlining the task and races with the unpark code will cause the task to end up on the wrong CPU. Borislav showed traces which prove that with ksoftirqd. So no, TASK_PARKED is going to stay. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/