Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1148452ybl; Tue, 3 Dec 2019 02:31:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzmciv+bn2bHqvcYmWTfZbsPwVO7Ahel7YAtUMZYVKiR1yFro1pBnHBdGmu04h/zdFNUaob X-Received: by 2002:a9d:313:: with SMTP id 19mr2625223otv.197.1575369094680; Tue, 03 Dec 2019 02:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575369094; cv=none; d=google.com; s=arc-20160816; b=cuP2rbMiF9S6qWXjBpEi7ZKiWN8PObyRx7JpXPKpEXY+BLnzzINLTdhDOz8NBlrbPQ TzsNvpWkuMsy4W1cOWSL9/1XQAP5mhF7JuZ5S9mLUZa774QGoANclkxva2j1PmPvHtID y6c+a2rZzPPFjJZfWNAh5NrinhPXLjlW6Ggs1Yy84NRgiPZSBIKH/lOs5w3F4dCjrMsP vMNSaLFfrSDEzjMdnCVie/og36JIQ9QrVdvsjQjuh/A0W4P261ldFK+P5ruhgyjQMwFC I3LqdO/kEItIh1kdzzfN28V+25+Vqfz4t/sJgogo2L/OvrJUIbGWtYvPbkJ4oM2v06DT Luqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=/MHvmPLPWieUfUsLCWS7YDBDguJ92o64q5wer5s1xSw=; b=FiEiNsoBLyNiTd+ycCFbt+dBuvgLdIO9yJJWGqUYf+ix7CXKxU/bTlF0Ag9HbPnnBM TmsPhivpvKkUuDgYUPH69KqDbUVpQflqQkGo4VHpzLuMNnzez3Cf/KzMuBJpUw6gkQFQ DIAUren+CGwJbb8yyP3nWrlP2ec3nz0yHzmX+zV1sdoQurhb33tIDYGjCZkzVtSQfmTd 2gcPcho7w4YR8dCXhrQ+0cBQuf5LSnWGDY6iThi4c4lLGWra0f3pYRj7PLjzI3IaBiL7 2xNYV39psifVtxy5tLutyPEG7GSRpgmvcOFsVkaE4GEoFb8HEUhuKUks7Ws1wSA+otxw //ag== 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 j24si1083956oie.176.2019.12.03.02.31.22; Tue, 03 Dec 2019 02:31:34 -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 S1725957AbfLCKap (ORCPT + 99 others); Tue, 3 Dec 2019 05:30:45 -0500 Received: from foss.arm.com ([217.140.110.172]:40176 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfLCKap (ORCPT ); Tue, 3 Dec 2019 05:30:45 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BE3C930E; Tue, 3 Dec 2019 02:30:44 -0800 (PST) Received: from [10.1.194.37] (e113632-lin.cambridge.arm.com [10.1.194.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 31B9F3F68E; Tue, 3 Dec 2019 02:30:44 -0800 (PST) Subject: Re: Crash in fair scheduler To: "Schmid, Carsten" , "mingo@redhat.com" , "peterz@infradead.org" , "linux-kernel@vger.kernel.org" References: <1575364273836.74450@mentor.com> From: Valentin Schneider Message-ID: <564e45cb-8230-9c3d-24a8-b58e6e88349f@arm.com> Date: Tue, 3 Dec 2019 10:30:26 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1575364273836.74450@mentor.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/12/2019 09:11, Schmid, Carsten wrote: [...] > set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) > { > /* 'current' is not kept within the tree. */ > if (se->on_rq) { <<<<<<< crash here > > set_next_entity is called from within pick_next_task_fair, from the following piece of code: > static struct task_struct * > pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) > { > struct cfs_rq *cfs_rq = &rq->cfs; > struct sched_entity *se; > struct task_struct *p; > int new_tasks; > > again: > if (!cfs_rq->nr_running) // this is 1, so we are not going to idle > goto idle; > > #ifdef CONFIG_FAIR_GROUP_SCHED > if (prev->sched_class != &fair_sched_class) <<<<< this is true: > crash> p &fair_sched_class > $1 = (const struct sched_class *) 0xffffffffaaa10cc0 <<<< > crash> $prev=ffff99a97895a580 > crash> gdb set $prev=(struct task_struct *)0xffff99a97895a580 > crash> p $prev->sched_class > $2 = (const struct sched_class *) 0xffffffffaaa10b40 <<<< > goto simple; <<<< so we go to simple > .... > (Line 6360, Kernel 4.14.86; Line 6820 Kernel v5.4-rc2) > simple: > #endif > > put_prev_task(rq, prev); > > do { > se = pick_next_entity(cfs_rq, NULL); <<<< this returns se=NULL > set_next_entity(cfs_rq, se); <<<<<<<< here we crash > cfs_rq = group_cfs_rq(se); > } while (cfs_rq); > > So why is se = NULL returned? That looks a lot like a recent issue we've had, see https://lore.kernel.org/lkml/20191108131909.428842459@infradead.org/ The issue is caused by 67692435c411 ("sched: Rework pick_next_task() slow-path") which 5.4-rc2 has (without the fix which landed in -rc7) but 4.14 really shouldn't, unless the kernel you're using has had core scheduling somehow backported to it? I've only scraped the surface but I'd like to first ask: can you reproduce the issue on v5.4 final ? > Best regards > Carsten >