Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3650642ybg; Mon, 28 Oct 2019 16:36:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfMmDLnZIYT31WfRdQ+ZkGEwdhgC2r5r5bBhTChEF6l5NtpNKFcuHwcxvWRBqkzEN0lJA9 X-Received: by 2002:a17:906:f181:: with SMTP id gs1mr443537ejb.13.1572305795644; Mon, 28 Oct 2019 16:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572305795; cv=none; d=google.com; s=arc-20160816; b=i4Uf4NQrLQePNiolNWbr7HVLiwk3NXrX36uHPP3T+wyRMps+MoyT/K5QQ9s5Vfcxpy uBuPdJef8NP0V5eMSSSd4JaI1rEaCzvo7A7Lh7LPzP0J69YtcFv4Xr19jvc0Xfncuiav o9iZf6Q579wufnx5ut2CKwliogGc6nHnc9qLekRAVTLksG+uzFrd/MLi6fe3fN/n6zqx zx6yOSiUjkUem0EEA0PWMxxN4lOA8jdUa35/UKmWvqjfyPAD2GlCGspfdyfVmHx9DxOa 1IYSzDSIZvk4Uu518uVR7bgpUc3gzOxVO+ivoa6Dl1ndY1JcQZwG0SM33jbs/JNdY3wC Y+8A== 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=Y+3ByL1NFha0OQHrVmcEx+qAYWBPgvk/yuNuappc9Ak=; b=SRnZOGwtvHl9yyp/jOk5SULAfCpo0bTKwsCNdzOdX3c1tnjeyKElR7WZZektsYnkBf EgiImciXUbhktu8Nf+azHoErPkQ6HUHHpS74RqXzwT9GknhIy6RysLdbGax5M41L5clq HzfhT7QNB4rQNkn42sdX7lIZ0503pBBjJ/3CK/P9ahu/anZhW56DGqfNFwLTSwh4jlPs yTz9YBLSE2aF6VneHF9wYi76uBX5NTFE7xBuKvoKrl6p7wY2/sBLkRUT3T7QVV122F1w TyFwbReH4AceKFPBqEDgTT5AhO3G1sBqikrnqMgfg51xItbFTOZgpETFLdKGzkTpAQyH QihQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=F46ev0SL; 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 v26si7083198ejg.55.2019.10.28.16.36.12; Mon, 28 Oct 2019 16:36:35 -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=F46ev0SL; 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 S1732853AbfJ1VtZ (ORCPT + 99 others); Mon, 28 Oct 2019 17:49:25 -0400 Received: from merlin.infradead.org ([205.233.59.134]:34352 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731303AbfJ1VtY (ORCPT ); Mon, 28 Oct 2019 17:49:24 -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=Y+3ByL1NFha0OQHrVmcEx+qAYWBPgvk/yuNuappc9Ak=; b=F46ev0SLhQ+6Z3YQU9gYJSRJz rGczGjUNX0n9PVm/PhvXfhzbgbr1/7tMohcOIESobf+14rPpueFB4bCTUpMPJZ7V7rQVDAP5pU1P6 KN7Iqoem1dS2yhyRHmJ1rmNVsn67ySmjemMucAsDBhODlNcjONujxdQ0vT2sNBXFWoGeLcLvhppZT ll8BovQ0O9R4MdLbkbvE73yqyOFkVQ5r3OV5mlI1w7rA+WV1EqPwOcbyu1K9IMRzS0VjizGj0pyVo 88/HXIa6MzwwnxKziASWykcIqkncpX8fwejERCkNe79Gmc9XlHsXA4jiGNvNdBr897hcMwu1YA60l 4tGd5qBrQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iPCsr-0004WY-K4; Mon, 28 Oct 2019 21:49:05 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 5D2B1980D8F; Mon, 28 Oct 2019 22:49:02 +0100 (CET) Date: Mon, 28 Oct 2019 22:49:02 +0100 From: Peter Zijlstra To: Quentin Perret Cc: linux-kernel@vger.kernel.org, aaron.lwe@gmail.com, valentin.schneider@arm.com, mingo@kernel.org, pauld@redhat.com, jdesfossez@digitalocean.com, naravamudan@digitalocean.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, juri.lelli@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, kernel-team@android.com, john.stultz@linaro.org Subject: Re: NULL pointer dereference in pick_next_task_fair Message-ID: <20191028214902.GN4643@worktop.programming.kicks-ass.net> References: <20191028174603.GA246917@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191028174603.GA246917@google.com> 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 Mon, Oct 28, 2019 at 05:46:03PM +0000, Quentin Perret wrote: > The issue is very transient and relatively hard to reproduce. > > After digging a bit, the offending commit seems to be: > > 67692435c411 ("sched: Rework pick_next_task() slow-path") > > By 'offending' I mean that reverting it makes the issue go away. The > issue comes from the fact that pick_next_entity() returns a NULL se in > the 'simple' path of pick_next_task_fair(), which causes obvious > problems in the subsequent call to set_next_entity(). > > I'll dig more, but if anybody understands the issue in the meatime feel > free to send me a patch to try out :) The only way for pick_next_entity() to return NULL is if the tree is empty and !cfs_rq->curr. But in that case, cfs_rq->nr_running _should_ be 0 and or it's related se should not be enqueued in the parent cfs_rq. Now for the root cfs_rq we check nr_running this and jump to the idle path, however if this occurs in the middle of the hierarchy, we're up a creek without no paddles. This is something that really should not happen (because empty cfs_rq should not be enqueued) Also, if we take the simple patch, as you say, then we'll have done a put_prev_task(), regardless of how we got there, so we know cfs_rq->curr must be NULL. Which, with the above, means the tree really is empty. And as stated above, when the tree is empty and !cfs_rq->curr, the cfs_rq's se should not be enqueued in the parent cfs_rq so we should not be getting here. Clearly something is buggered with the cgroup state. What is your cgroup setup, are you using cpu-bandwidth?