Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1135261ybx; Tue, 5 Nov 2019 10:57:20 -0800 (PST) X-Google-Smtp-Source: APXvYqya0fTTns8e4ODRZobENECYOSCerWXfkxl8ISa6SFglo+ekv2+BLrDP8WCFmgN5Y+5uzBGb X-Received: by 2002:a50:f096:: with SMTP id v22mr38171469edl.149.1572980240178; Tue, 05 Nov 2019 10:57:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572980240; cv=none; d=google.com; s=arc-20160816; b=N6hyz8z/FflLKPVA+mFQ8xgC9xICkayOQany8VeRTUe5xGnla9XE+F/ZPwRCC/AoAq //+GcxldjHMvwy8+Cpf9LpI19q5/hmOKfwLelGvQlPfoiQ9sMV3Lm2LClI1bT31TZCmw kl3KqDG/44Sa8X2EpH3dT8m6poMCR3FP8U9z5sjYj1bhHM9MI9oiFf7PK/cIlKlODqu0 Ul0+GJMnX51QCXrMieUKBTDG0lWX0IyLuBxsOKGWEEKZr1aL6eEgPHAqHA5nceo3N6w8 NQtIdJ1qhOn6/BVW0c2LaBnY2xSnFiw4RNUh9BQrm99cEqg5Gwuhu4M/J4IHB3rMJaaO BOYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=CBkp8uqx8SQ531ta6Db0VhlgWt1FBCQ6bbXgQtmYzlI=; b=sT0saw6TWUgUvgiJpVaDqSAhBME/H4Jk/7LucgogIN0bB5jXq/eoM7/XGc5l4K7izp AAKqPP8OqxuYIpLZ8F0BEHivyZPLEzpy3ASI1NIhZxo9Ouf3d1XuHThQPXtaBQskJLL8 9ew3akEZkWmoW9cs+qRy6fK/h1+IAuPVkGL9ZMoVn5VCelLilQ/BRgyDMdvIa8waZCej UE4jm+36j2blt9vY+HEsHbvJbAidXqVlxxrjat3eKTn2kSgtlx5Cw03OlAfsoJ4o8Xlp SrpElZPBUd25rQ/+DWt6zdJLN0NatD+pO1tPcxUxS9mtOmgzo42scNpw/eF+M5hbhC73 5UQQ== 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 en18si8098105ejb.200.2019.11.05.10.56.56; Tue, 05 Nov 2019 10:57:20 -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 S2390851AbfKES4J (ORCPT + 99 others); Tue, 5 Nov 2019 13:56:09 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:42364 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390651AbfKES4J (ORCPT ); Tue, 5 Nov 2019 13:56:09 -0500 Received: from p5b06da22.dip0.t-ipconnect.de ([91.6.218.34] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iS3zm-0002DU-Un; Tue, 05 Nov 2019 19:56:03 +0100 Date: Tue, 5 Nov 2019 19:56:01 +0100 (CET) From: Thomas Gleixner To: Oleg Nesterov cc: Florian Weimer , Shawn Landden , libc-alpha@sourceware.org, linux-api@vger.kernel.org, LKML , Arnd Bergmann , Deepa Dinamani , Andrew Morton , Catalin Marinas , Keith Packard , Peter Zijlstra Subject: Re: handle_exit_race && PF_EXITING In-Reply-To: Message-ID: References: <20191104002909.25783-1-shawn@git.icu> <87woceslfs.fsf@oldenburg2.str.redhat.com> <20191105152728.GA5666@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Nov 2019, Thomas Gleixner wrote: > On Tue, 5 Nov 2019, Thomas Gleixner wrote: > > On Tue, 5 Nov 2019, Oleg Nesterov wrote: > > > On 11/05, Thomas Gleixner wrote: > > > > > > > > Out of curiosity, what's the race issue vs. robust list which you are > > > > trying to solve? > > > > > > Off-topic, but this reminds me... > > > > > > #include > > > #include > > > #include > > > #include > > > > > > #define FUTEX_LOCK_PI 6 > > > > > > int main(void) > > > { > > > struct sched_param sp = {}; > > > > > > sp.sched_priority = 2; > > > assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0); > > > > > > int lock = vfork(); > > > if (!lock) { > > > sp.sched_priority = 1; > > > assert(sched_setscheduler(0, SCHED_FIFO, &sp) == 0); > > > _exit(0); > > > } > > > > > > syscall(__NR_futex, &lock, FUTEX_LOCK_PI, 0,0,0); > > > return 0; > > > } > > > > > > this creates the unkillable RT process spinning in futex_lock_pi() on > > > a single CPU machine (or you can use taskset). > > > > Uuurgh. > > But staring more at it. That's a scheduler bug. > > parent child > > set FIFO prio 2 > > fork() -> set FIFO prio 1 > sched_setscheduler(...) > return from syscall <= BUG > > _exit() > > When the child lowers its priority from 2 to 1, then the parent _must_ > preempt the child simply because the parent is now the top priority task on > that CPU. Child should never reach exit before the parent blocks on the > futex. I'm a moron. It's vfork() not fork() so the behaviour is expected. Staring more at the trace which shows me where this goes down the drain. Thanks, tglx