Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp580058yba; Wed, 24 Apr 2019 06:21:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg7AqIY6vPLA5bGCW95Br1frwuCihaD6RSA7z6+s5ZWHLRaRGxwQ7QTF7sSI3g6k4Dl0dx X-Received: by 2002:a63:1d4f:: with SMTP id d15mr29735569pgm.347.1556112102870; Wed, 24 Apr 2019 06:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556112102; cv=none; d=google.com; s=arc-20160816; b=eB/6FrbwvIkqPxm9tRxWLBSIgI+tlyzvgZA3UlXVHc2iAgI8MYDwcliIBhmIylmaHl oEfu672AjIzKr/CRWLMI5mAGsDvYSmSxfiqsav1+813IT5LFWLn9S8C7jKNZkaHi208Q V0rigLn/FIDPTAmqaSFEr8EAR3QxFWYUA7s8ayy+WgxQ7DFxff853sJCOV3w/99tALc5 Egc2tpJpv8FfhwwR9dpNi3mazqF2JQs6fISZBWX334B1XkJu4LbITOZco/uODQPUCvGp MvJYdOob3fhYXXpzY13J4JMIwvvMGuKpSDOSS8NNUWbm8wW0KdBkrp2uy+lxWLHQTgky sSEg== 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:dkim-signature; bh=ut/AT5NZIvtj4Y0/qt7/Ac2TRDj3IJ2+OkiJo7N7EIM=; b=MhAHox85DoJM1Q1QlOu0LVZ6EYdsHoajEzeOgNXaeyef3XVj5YEP2V8TjRTHmFuR3C dxnuLoEy6OgAbs2+R9KhKCEGbE9Jb7QRLHKlqsZI/UicD+vsYqpvQqySUsYIT9h+eE6G U620T6EU7p+5Y0lykC2Nd1vvNlyzbzO+r/aByz5Lm+5hHlWNuTkXuVE66j4qaDQ3GLgP Xo4Hv1yHeO4wydmIRFF2pCrxAb4DmxfO9W4GIZS2v5M067JVvEZDzmPEikWWI+E2B4TZ I2AYJYHoSmPCCEE8xROyhj6DtjQkDFBPoGSNUXX4nhsej+jBC2k007EbadBUkUTDX7ju baOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=OePZTCgl; 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 d25si17455188pgb.229.2019.04.24.06.21.26; Wed, 24 Apr 2019 06:21:42 -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=OePZTCgl; 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 S1730410AbfDXNUT (ORCPT + 99 others); Wed, 24 Apr 2019 09:20:19 -0400 Received: from merlin.infradead.org ([205.233.59.134]:34914 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729315AbfDXNUS (ORCPT ); Wed, 24 Apr 2019 09:20:18 -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-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=ut/AT5NZIvtj4Y0/qt7/Ac2TRDj3IJ2+OkiJo7N7EIM=; b=OePZTCglximpG/ZiJ0hTxlF54 6/Z3ukz4p4TTpYMb99FexnNzEKTYpzELUZt9gTYt7NhgcyYif5sV5o+sUAsNK7vaMSddJLuQMOngG fZ05H3HwtYrAXkpo6N6IJPI/Y+fhlkqAabD0adg6biG1fHZ531zz4/7MqD60yRu+/E6CjAg9R78hf /AEEUzSF+5iMWJ1DniXZKcZ26Txyg3X89BkgB9z8QtZyKfD9T3+QLFjx+V6QgP242dqslIspy8UEh C1fwDsy64UrJWmw3EJImP2Rvx5EhRlUNx3IFJhfgQm07q3qqcTOPEQHQOVHiJOGNF+uEIUagdjXRc 4+ezh6JNw==; 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 1hJHoa-0003Tq-4J; Wed, 24 Apr 2019 13:19:56 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 95BA029BD4886; Wed, 24 Apr 2019 15:19:54 +0200 (CEST) Date: Wed, 24 Apr 2019 15:19:54 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Waiman Long , Ingo Molnar , Will Deacon , Thomas Gleixner , Linux List Kernel Mailing , the arch/x86 maintainers , Davidlohr Bueso , Tim Chen , huang ying , Roman Gushchin , Alexei Starovoitov , Daniel Borkmann Subject: Re: [PATCH] bpf: Fix preempt_enable_no_resched() abuse Message-ID: <20190424131954.GZ14281@hirez.programming.kicks-ass.net> References: <57620139-92a3-4a21-56bd-5d6fff23214f@redhat.com> <7b1bfc26-6e90-bd65-ab46-08413acd80e9@redhat.com> <20190423141714.GO11158@hirez.programming.kicks-ass.net> <4f62d7f2-e5f6-500e-3e70-b1d1978f7140@redhat.com> <20190423193435.GX4038@hirez.programming.kicks-ass.net> <88ba7be0-9ec5-941e-1b3f-80fbe05fe3a0@redhat.com> <20190423195559.GY4038@hirez.programming.kicks-ass.net> <20190423203512.GB4038@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190423203512.GB4038@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 23, 2019 at 10:35:12PM +0200, Peter Zijlstra wrote: > On Tue, Apr 23, 2019 at 01:27:29PM -0700, Linus Torvalds wrote: > > On Tue, Apr 23, 2019 at 12:56 PM Peter Zijlstra wrote: > > > > > > Unless the very next line is schedule(), or implies it, one must not use > > > preempt_enable_no_resched(). It can cause a preemption to go missing and > > > thereby cause arbitrary delays, breaking the PREEMPT=y invariant. > > > > That language may be a bit strong, or m,aybe the "implies it" might at > > least be extended on. > > > > It doesn't need to be "schedule()" per se, it can be any of the things > > that check if we _need_ to be scheduled. > > I'll try and word-smith that tomorrow, brain is fried. But yes, > something that ends up in schedule() 'soon'. I've made that: Unless there is a call into schedule() in the immediate (deterministic) future, one must not use preempt_enable_no_resched(). It can cause a preemption to go missing and thereby cause arbitrary delays, breaking the PREEMPT=y invariant.