Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1891706imm; Thu, 2 Aug 2018 02:50:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmhpr4XadhAA1/qJq6lDLxpyrUkJT6C0Nd/4IEibvkmNvSrvIPErorw1P2TImSGuYsceBH X-Received: by 2002:a62:23c2:: with SMTP id q63-v6mr2162652pfj.91.1533203451538; Thu, 02 Aug 2018 02:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533203451; cv=none; d=google.com; s=arc-20160816; b=f3i/tLcNhf+LPvhwZdwge+NB5M80MIJS4IKolXFpzd68zL6UouEb2zmMSlRHoPFM9c iRih21OC6H1ASH/vD2rv+rTdiUCBLpn6E2yLPY+isAhuj4Uyz821bEj8PlQyui7/kp3P aQP6C/p8rCF747+I3sv6a5byVmOoKyvb/sRF4P6HQ2dcC6nLEcThHxw2dC4m/0jlFdgy IfuraBFEFKd5KY2N/H8NnXIh8R/zlG2Uezh4OhWF8xjW9XPLWP5sJOraoofgr3B4WxTB IWmN499YQoyoVwXY4aia2GxZSYFdI9GxCg6SDF1PmRVSO3QBLM+yIbzyWZLiTngbAz5P //rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=OY9bAezH3+xlruTxmagsjPO9lowgAkQHrIyeRVbPLNU=; b=txUhkmp3vNgnuTvz0eQU1Mn4sxRjdGayNcc/UXbHC5Y482ylrkDp6Y7DB1V2w2fVFx 1pdU1Jk1Md+bRxu7KkOqJRzsz//KC3vvNngXgXf5b0duiua+Tb/JpVZXVAmwafQmGDDe IAKUjJkl1JQ+YguGq1CwOWUWKJU5vpOBCIcG6AmZJoBvgJ382FNGFAku1hRBTOkIU0xF xp9tWuSErp4ZV3rJqLksLF9JbBVdtRwJQbKwnvVvz3iljLBP+UPfBcWjCYPi8LFS7T0F e8wDU4LqjVlz2muVnkSCE4+4My4T0ZdYtnU5rHrKti4PeEbmaGqj1ip+frG8Qf11iSIt CJ1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Cy0tV2Fb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n88-v6si1503921pfi.360.2018.08.02.02.50.36; Thu, 02 Aug 2018 02:50:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Cy0tV2Fb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731986AbeHBLjk (ORCPT + 99 others); Thu, 2 Aug 2018 07:39:40 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56340 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbeHBLjj (ORCPT ); Thu, 2 Aug 2018 07:39:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OY9bAezH3+xlruTxmagsjPO9lowgAkQHrIyeRVbPLNU=; b=Cy0tV2FbV8BoVIH7RaxPdD8dJt J5OkUDF3d6/qxSi2iQq2Rd/5YHp+YB9PVcZOssg+xzbRo2cCqkjExiinTiIaQ5AOIrJ1RRZwv64o+ LMNa1cDWKUwkbl5Lzo+sssjrlyE26BLEzkicfnAhD7tnJ24K3DgvjJsqxomtLs1B25rdrrdvAR+1Q txWRrWFo6UMLy47sCixiMj29k6pyLgup6e2JFmrjvf4S3QRSHkebxLWfupXcCABUuGsWDgoKBY3x/ P0Oj2jBtv/52DVSQX1dRpNl7x15SMVpr3o4w8qiP1aCa96Y2wuielUHQE0Yuw4jzrHtnpGC1e5bsj m9Y/LmHA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1flAEK-0004KS-JF; Thu, 02 Aug 2018 09:49:12 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 94C0820267E4D; Thu, 2 Aug 2018 11:49:08 +0200 (CEST) Date: Thu, 2 Aug 2018 11:49:08 +0200 From: Peter Zijlstra To: Sodagudi Prasad Cc: mingo@kernel.org, gregkh@linuxfoundation.org, bigeasy@linutronix.de, tglx@linutronix.de, isaacm@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: cpu stopper threads and setaffinity leads to deadlock Message-ID: <20180802094908.GK2494@hirez.programming.kicks-ass.net> References: <24eebe1d874cb8e3b9a18087554544fa@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <24eebe1d874cb8e3b9a18087554544fa@codeaurora.org> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 01, 2018 at 06:34:40PM -0700, Sodagudi Prasad wrote: > Due to cross migration of tasks between cpu7 and cpu3, migration/7 has > started executing and waits for the migration/3 task, so that they can > proceed within the multi cpu stop state machine together. > Unfortunately stress-ng-affin is affine to cpu7, and since migration 7 has > started running, and has monopolized cpu7’s execution, stress-ng will never > run on cpu7, and cpu3’s migration task is never woken up. > diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c > index e190d1e..f932e1e 100644 > --- a/kernel/stop_machine.c > +++ b/kernel/stop_machine.c > @@ -87,9 +87,9 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct > cpu_stop_work *work) > __cpu_stop_queue_work(stopper, work, &wakeq); > else if (work->done) > cpu_stop_signal_done(work->done); > - raw_spin_unlock_irqrestore(&stopper->lock, flags); > > wake_up_q(&wakeq); > + raw_spin_unlock_irqrestore(&stopper->lock, flags); > So why didn't you do the 'obvious' parallel to what you did for cpu_stop_queue_two_works(), namely: --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -81,6 +81,7 @@ static bool cpu_stop_queue_work(unsigned unsigned long flags; bool enabled; + preempt_disable(); raw_spin_lock_irqsave(&stopper->lock, flags); enabled = stopper->enabled; if (enabled) @@ -90,6 +91,7 @@ static bool cpu_stop_queue_work(unsigned raw_spin_unlock_irqrestore(&stopper->lock, flags); wake_up_q(&wakeq); + preempt_enable(); return enabled; }