Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp545593ybl; Fri, 13 Dec 2019 00:15:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxwnZMH/DtXzw7YOeZ75WM9i4LzWVyn2ALK+Bsq92AXAPjPJ7BX5BWi0SfQhwx4faN8l8tN X-Received: by 2002:a05:6830:87:: with SMTP id a7mr12944265oto.314.1576224928271; Fri, 13 Dec 2019 00:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576224928; cv=none; d=google.com; s=arc-20160816; b=Ke4MtAQTFg53JXrNPg6HyuCkGbJq4inxCBC70INTEn1R4D4mHOOz9U1nq1iOAo7DXY ZnmGTBlT0vSOsAeCZIfCXSFFQHcpNnjPKDPLi40G37ImndBa8lnysxRQWUMQprHnL/GM EDbYLmviI8wW4KpxjkstnuA7rUNIT000wVIEmuWvhQlcxfCuwSheitHZJMCVlwBTAwDz chDVdfTUIl8RDbQrGu+L/dWA8O16IeoOW0Z2df1w0AXqW+2rs9IHkAYa095eCWdyWIFA drf2xsIOpPWJqemUwRhtHiqNbENHvxTDxNKpMc6wxwWYkafRHwtBsG0RvFd0MzUhz4gk rnhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pMzWrBvlzJuCAxsy06usFnkBxmzgWwc/HN5teMGzcLY=; b=G6Y8oofF5vG0rql/fqg8snxBIo8Ytu56KKelDN4kgrzSGpJNMqt0EZgRSrtx7h4i74 FEwqLzLqc4uHfyBuSysOTBU+8wrRkj9oijOk5anwRLnSQ2fMo2NWHhdfzgcIw7DdoP+L fEQYbU9cUxlUpJLa9+RvZwwpPieZIYpxEN8IlJCmv9/7H7oXN5TCs1mBjNXNK9MrOnuN l1X46rHd1Iez5eXsctQmcRb1PKvFB65fEM+IYMgx4aDN9eLgJrwp/JEhohu3E84ZEMlJ uOF6/Y4GmHbKLnl9ghyAtBgAyl/nFwiTpzNbJz7WKpB/YWCzLH/UMC7vy7U/smi4h+uH 2h3w== 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 w197si4801037oif.150.2019.12.13.00.15.16; Fri, 13 Dec 2019 00:15:28 -0800 (PST) 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 S1726368AbfLMIOc convert rfc822-to-8bit (ORCPT + 99 others); Fri, 13 Dec 2019 03:14:32 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:47565 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbfLMIOc (ORCPT ); Fri, 13 Dec 2019 03:14:32 -0500 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1ifg5k-0006op-LD; Fri, 13 Dec 2019 09:14:28 +0100 Date: Fri, 13 Dec 2019 09:14:28 +0100 From: Sebastian Andrzej Siewior To: Scott Wood Cc: LKML , linux-rt-users , Steven Rostedt , Thomas Gleixner Subject: Re: [PATCH RT] sched: migrate_enable: Busy loop until the migration request is completed Message-ID: <20191213081428.mw6bqjg6m7djwhby@linutronix.de> References: <20191212112717.2tzoqbe3xeknoyvs@linutronix.de> <30ab713901ef0e1f23c1ca387373788a4a73639f.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <30ab713901ef0e1f23c1ca387373788a4a73639f.camel@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-12-13 00:44:22 [-0600], Scott Wood wrote: > > @@ -8239,7 +8239,10 @@ void migrate_enable(void) > > stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, > > &arg, &work); > > __schedule(true); > > - WARN_ON_ONCE(!arg.done && !work.disabled); > > + if (!work.disabled) { > > + while (!arg.done) > > + cpu_relax(); > > + } > > We should enable preemption while spinning -- besides the general badness > of spinning with it disabled, there could be deadlock scenarios if > multiple CPUs are spinning in such a loop. Long term maybe have a way to > dequeue the no-longer-needed work instead of waiting. Hmm. My plan was to use per-CPU memory and spin before the request is enqueued if the previous isn't done yet (which should not happen™). Then we could remove __schedule() here and rely on preempt_enable() doing that. With that change we wouldn't care about migrate-disable level vs preempt-disable level and could drop the hacks we have in futex code for instance (where we have an extra migrate_disable() in advance so they are later balanced). > -Scott Sebastian