Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6063565imm; Wed, 27 Jun 2018 01:21:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKa12mx8TWCqToWYW6ehwHd2GE0fhW22rzPm07skUM3ISNbFU3e3Si+vz+6c5sAvNCAhKZR X-Received: by 2002:a17:902:5942:: with SMTP id e2-v6mr5221452plj.64.1530087710309; Wed, 27 Jun 2018 01:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530087710; cv=none; d=google.com; s=arc-20160816; b=b+duCoUPEQbBCGX21nY9Qtr5HdQDQ0QcSQizAisp8PABshU73vl1G/8oj3HbGAsdy4 nX9GjTs1fkmBbXXqImFQ4Fqtab8cejTXZklSUAtW1Gl1RAcjRfztrzHTjKHB1wcfzeIz Vq2NWG0Ol90GTE7BzecsK1v44mFEaSOzgxDrKoEK/Vwk3528qdk6jMTLaQPUXUkXAN09 KsZz65bfLSPyvWTiCejiRu1cbRkxXcLdHISr+dXJsIdPotrNyK52bUG9/a09Egua8X3K 8iS90Lxl0hsP6XzH8gVlNmwiNCK7zYlm5Si1xLEbQFVEtUa8OU7m64s26rmVsdDzaxIT PJ+A== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=M55nv/AwhhS97X5i8YxlgQjnA5claV4JAgN18icyS58=; b=aj1yBZ/a0Cr+eMxA0KpUc3KDPnJi8O/vhX276stLf+kfiFWcjTkH0wf72/kDVy3MSg xcUL4WGsm3s6BpW7T4Y9InMUo0cSeqxMjDCik3XlPYUSjgN2PbKCuUcgn8sDwDUH78Bq PStcH5DLzBwWqlsOAaSEVvBI6cjo5qIe7cc5UUaSktpk3hYR/Dwl0QVGCFB2rmvUbdg8 7eUYzNBqY5ndgId84b1eK+hvPb0TcJqtFl5DogKGBFSeE+G9Wjr/rVgi6hzRNNVM0u1C /e0yZSbtOHOCahh00IuZ4s95RZ4HbbEU0XOAIbmZrz+laID9z2GOMCL9uWBY6kWAFObZ WqZA== ARC-Authentication-Results: i=1; mx.google.com; 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 v18-v6si3333670pff.248.2018.06.27.01.21.33; Wed, 27 Jun 2018 01:21:50 -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; 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 S1752690AbeF0HPg (ORCPT + 99 others); Wed, 27 Jun 2018 03:15:36 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51498 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbeF0HPf (ORCPT ); Wed, 27 Jun 2018 03:15:35 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1fY4fo-00007x-IV; Wed, 27 Jun 2018 09:15:28 +0200 Date: Wed, 27 Jun 2018 09:15:28 +0200 From: Sebastian Andrzej Siewior To: "Isaac J. Manjarres" Cc: peterz@infradead.org, matt@codeblueprint.co.uk, mingo@kernel.org, tglx@linutronix.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, psodagud@codeaurora.org Subject: Re: [PATCH] stop_machine: Remove cpu swap from stop_two_cpus Message-ID: <20180627071527.hvrndkz436yeqwpq@linutronix.de> References: <1530048506-21393-1-git-send-email-isaacm@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1530048506-21393-1-git-send-email-isaacm@codeaurora.org> User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-06-26 14:28:26 [-0700], Isaac J. Manjarres wrote: > Remove CPU ID swapping in stop_two_cpus() so that the > source CPU's stopper thread is added to the wake queue last, > so that the source CPU's stopper thread is woken up last, > ensuring that all other threads that it depends on are woken > up before it runs. You can't do that because you could deadlock while locking the stoper lock. Couldn't you swap cpu1+cpu2 and work1+work2? > diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c > index f89014a..d10d633 100644 > --- a/kernel/stop_machine.c > +++ b/kernel/stop_machine.c > @@ -307,8 +307,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void * > cpu_stop_init_done(&done, 2); > set_state(&msdata, MULTI_STOP_PREPARE); > > - if (cpu1 > cpu2) > - swap(cpu1, cpu2); > if (cpu_stop_queue_two_works(cpu1, &work1, cpu2, &work2)) > return -ENOENT; > Sebastian