Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5473475ybl; Tue, 10 Dec 2019 06:39:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx4mtKQxpdUUFjg8KoY7BD3K69q7Y5cqYSqLN9pQ4/mNkJ4dmJrhW+khWdQIxUM68v/37/9 X-Received: by 2002:a54:4085:: with SMTP id i5mr4229453oii.17.1575988770238; Tue, 10 Dec 2019 06:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575988770; cv=none; d=google.com; s=arc-20160816; b=DtKYlXG3EvGGNS8Stn/xlG3oWLnSu8MLuIy0bH7ES5AYgDkZfk2uPDEnB+9dOboVSO YbZQ+hInDnw1QfHyzbSeExvWvhA2PnUDUt7xIqFWZT4rbkN4c0y+stWdk1G9UMzKzuyC X1KzPpN7/cBGcoAWPQ5PHJYHdlLMnUrVaNfh1I/eaaeb757A1MQSrT+G0x8GSBK1G77g 26WYcrRDt9UrMlboF4tACawr3cYFg6iYzB3TFz/XU7N23SXlZNF9z/eElF6myqJMy3S6 f6NoFPP7jfFfPBuB8oQnz+WEgl4VPwmiluic12XPxRtIB7gK/XFTsO+q//XUfiPwuGns mJCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nDCHPQReBntofdAnn2O3tHEDWDHTESE5vX9R+bp/+qE=; b=lfqGXKb8Rf70dsGa05K6/w4akrn3co/3uydNGs1Ff/TQ063jhRM+TL7Jq6n3WeYHlf v3eH6i2u3t3PpQQiJb4XIMN/xZyPYVx64Rvl6bA+G/h9M7oJ4zALDunZ74uur8h8UDAE RY51U8wnDEO9Faful7QQ7nzbZTyIvDV1NPGv39OX8xQPjGb2VzCQhQA3xgi4u4I8Ftrv tsv4Vj9KM6HHuS2uImctZkRLQL6e4a31FZOW2Fee2Y8ioSSbJalDnUVB5ROR2qikmT95 yC00cWQMtYsIQxQhjdJeqLFe58TAmCtMnARl5uZiDv25IyZqQpL+z8kImmKePZAwFTmK gifA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uOlWfbUx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k130si1648625oih.135.2019.12.10.06.39.11; Tue, 10 Dec 2019 06:39:30 -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; dkim=pass header.i=@linaro.org header.s=google header.b=uOlWfbUx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727504AbfLJOin (ORCPT + 99 others); Tue, 10 Dec 2019 09:38:43 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:34983 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727420AbfLJOim (ORCPT ); Tue, 10 Dec 2019 09:38:42 -0500 Received: by mail-lj1-f194.google.com with SMTP id j6so20193848lja.2 for ; Tue, 10 Dec 2019 06:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nDCHPQReBntofdAnn2O3tHEDWDHTESE5vX9R+bp/+qE=; b=uOlWfbUxA5UXwqcXYedV/SuV2axkuGm9xKU7ABK6lTkUT4fyN74FMpSrJFptS5tqZW RLWgkIyqU+SQx6MAd/po4ZrUvxRQWurd8JxdtHrRu5Za8TCfjoYfsQ9Zsnduf57G8v5d dR5HC/PopNRnLxx/SY3ZRVt/z+FiBctLn2l3tMlFxeLMSyz6TTSkhIHPLyQ8UV1BSlX8 kyJHuyhWbXVF6iwIwk+Il69xb+nyzdXMw+aw8dLBAwvgvPlRyIgHuVoNFnYNTwrCcral nE/xSk7+i2i/8dFW5QUTq3Va5CsAAbuxQE1aPbgWDJgAjKc9KMJCleTCeEpa9m5ZE7L9 GzqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nDCHPQReBntofdAnn2O3tHEDWDHTESE5vX9R+bp/+qE=; b=XzFAi+t6lekCqDoFfFdatJa6HYTkrZ0wRWII9f/fJhUjSxUul9NUfTj+ls5e+HWPV+ w1u+yhkLh+mx0N5dugPWm0wAQHRHxD9CyCklmad/vOQkHmUzeDNmOF+aJhOYPT3u5Thc zEoxiPcjSSPQYehuNDYFXoyFB41foD350Qxov7hS8vCzhQYAjd/Ck0JupeDqKwP3EF2k jUQY1D+lZyG7JjuWftaE2kcHxncex0usdJRAIu7pGxp9AmP7VwzrRtIYIRDrOCyavpw1 jkg0gsOTSkkpaYbH2sizxBk+ihoFW2uhFDUjrjyL3YxQHMHCF7A+RLNmL5YTSH1MJZmi kWPA== X-Gm-Message-State: APjAAAXRvAQHoOof3MsFQWRCMqo8d8DBibzTEoQGZ7JotQmpa2Nr+sb+ iM1ypZnGClwX3KpvDzFXxmPuB2SULSaVGeY+2ZVAUg== X-Received: by 2002:a2e:2c0a:: with SMTP id s10mr20007991ljs.193.1575988719912; Tue, 10 Dec 2019 06:38:39 -0800 (PST) MIME-Version: 1.0 References: <157558502272.10278.8718685637610645781.stgit@warthog.procyon.org.uk> <20191206135604.GB2734@twin.jikos.cz> In-Reply-To: From: Vincent Guittot Date: Tue, 10 Dec 2019 15:38:28 +0100 Message-ID: Subject: Re: [PATCH 0/2] pipe: Fixes [ver #2] To: Linus Torvalds Cc: DJ Delorie , David Sterba , David Howells , Eric Biggers , Al Viro , linux-fsdevel , Linux Kernel Mailing List , Peter Zijlstra , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Dec 2019 at 18:48, Linus Torvalds wrote: > > [ Added DJ to the participants, since he seems to be the Fedora make > maintainer - DJ, any chance that this absolutely horrid 'make' buf can > be fixed in older versions too, not just rawhide? The bugfix is two > and a half years old by now, and the bug looks real and very serious ] > > On Mon, Dec 9, 2019 at 1:54 AM Vincent Guittot > wrote: > > > > Which version of make should I use to reproduce the problem ? > > So the problematic one is "make-4.2.1-13.fc30.x86_64" in Fedora 30. > I'm assuming it's fairly plain 4.2.1, but I didn't try to look into > the source rpm or anything like that. I'm using Debian buster and the make package is version: 4.2.1-1.2 for arm64. It doesn't have the commit you mentioned below but I don't see the problem on my platform and all 8 cpus are used with -j 16 or even -j 9 > > The working one for me was just the top of -git from > > https://git.savannah.gnu.org/git/make.git > > which is 4.2.92 right now. > > The fix is presumably commit b552b05 ("[SV 51159] Use a non-blocking > read with pselect to avoid hangs") as per Akemi. That is indeed after > 4.2.1, and it looks real. > > Before that commit the buggy jobserver code basically does > > (1) use pselect() to wait for readable and see child deaths atomically > (2) use blocking read to get the token > > and while (1) is atomic, if the child death happens between the two, > it goes into the blocking read and has SIGCHLD blocked, so it will try > to read the token from the token pipe, but it will never react to the > child death - and the child death is what is going to _release_ a > token. > > So what seems to happen is that when the right timing triggers, you That can explain why I can't see the problem on my platform > end up with a lot of sub-makes waiting for a token, but they are also > all supposed to _release_ a token. So you don't have enough tokens to > go around. In the worst case, _everybody_ who has a token is also not > releasing it, and then you end up triggering the timeout code (after > one second), which will make things really go into a crawl. > > And by a crawl I mean that worst-case you really end up with just one > job per second per sub-make. It will take _hours_ to compile the > kernel at that speed, when it normally finishes in 15 minutes on my > machine even when I do a from-scratch allmodconfig build. > > It does seem to be a major bug in the jobserver code. In particular > with the trial fair and exclusive wakeup patch that I sent out in the > other thread, it seems to be _reliably_ much worse and triggers 100% > of the time for me. > > It's possible that my trial patch is buggy, but everything else looks > fine, and with a fixed make the trial patch works for me. > > I'll include the trial patch here too, I think I cc'd you on the other > thread too, but hey.. > > Anyway, it looks like the sync wakeup thing is more of a "get timing > right by luck" thing than anything else. Possibly it actually causes > the reverse order of reader wakeups more often (ie the most _recent_ > reader is most likely to get woken up synchronously) and that may be > what really ends up masking the jobserver problem, since apparently > doing wakeups in the fair and proper order makes things much worse.. > > What a horrible pain that pipe rework ended up being. But I think > we're in better shape now than we used to be, it just had very > unfortunate timing issues and several real bugs. > > But sadly, there's no way I can push that fair pipe wakeup thing as > long as this horribly buggy version of make is widespread. > > Linus