Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1262618pxb; Fri, 1 Apr 2022 08:41:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC+A2wkU5wEv3HMicMUJJYmKG/ulgjw/etk72r7GaGMi4XzCg8bL9OgJ0YNCg39eWfPp6h X-Received: by 2002:a17:902:7c02:b0:155:f634:5f35 with SMTP id x2-20020a1709027c0200b00155f6345f35mr26510549pll.134.1648827691858; Fri, 01 Apr 2022 08:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648827691; cv=none; d=google.com; s=arc-20160816; b=qgLs/CCCgo7fXiMAqob4maExsiZNrzLlT1kNZOCqEeqdKbNdMWqznnAvXwaV6O4cO+ 2fx9dhbtMzAYEqHwzVjCqqDW5/Kg/ikYYSwcWSuE3+S54Y3xz/BFgE8u7v44GAvjbBX/ L3N1+x8BWuAsWp1/zWoYoVA/E5eJwqNWJ7NAYV10RkaTuoaVhhReOBsi2pAfrQFdLYUl tru8hw+t4LEP0mbP9tuTNyFDRF0zykHQpNl5M4jU3Ws9/ivf1cIxzx5giu0wtoys4Q0X YQp0RuAo+Im7+WKov2E0+isOwGKAc9qKwLTGnPNXhMUFJHQzS3C7vUxYakTspuCS3VzM VpAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OZFs7F262Q8FQ0CV6Jac14Udq9DNIeDRc8Lf3Vk/b6g=; b=hs/GJh2Ovfz/J+5izI2Qr0aEEx2WDNtBg1eWrYRofwkWM/0nfw1auzdSG0zo9igcWA ONlFMBtVJm5d2b77qirF+vyuojLiiXQFvjedZE2a+oT5WpuGbCJuc94ExFR+bLVqJOAg ZoVOlfx2LkDq8YCruYVc8Z5KasaqDaZvqwVdwkB9Thtf1cTEEeDdyccwR1+eKDTopCYc 5E+niCLriJvYq5mO9FYsu3+NloP3Tw/Cy/ge/FTofKD32jQmRBw8QnKh3F2Y8H6II/NE +TF65lv3a1oApM9ynXFmsZkZmpKfWA+s97n+ft66QD5ePHpayqCRZdHVWOKUqrdVj9gW dIiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=s8F+bYxx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a637e04000000b003816043f0e4si2699201pgc.729.2022.04.01.08.41.18; Fri, 01 Apr 2022 08:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=s8F+bYxx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239257AbiDALs2 (ORCPT + 99 others); Fri, 1 Apr 2022 07:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbiDALs1 (ORCPT ); Fri, 1 Apr 2022 07:48:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 562DF105AAE for ; Fri, 1 Apr 2022 04:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=OZFs7F262Q8FQ0CV6Jac14Udq9DNIeDRc8Lf3Vk/b6g=; b=s8F+bYxxN4swSiGTmh1gY6FZRh azmBXlsL5bv1zKEOPbljlegcsa3hcQnx5N/X9OS5a2dS0Bh6NjpJ7Mm2MC1Si87WNHUm78HWS+XWk XeJUZxoW/80bZEGek1z9R1qNRKqaI2zJeWuMKMgE9P2ofZCyAXHZH+0fYYeIoibN6i+K3h09jCHmY CzFgfQz4prznBRuK9iaPjMZdg85dsxh8NZAp5nMWDghUJ4fnhIZd+PHp5sPim+wWYE8Do3ZchcsSJ eIPokJeBGJa3mZROqlcjbbBzr2QqOx1LrMp4DWZfWS4Ezo0igrMM+t0J7pwlklJGl8mm+Of/KeM73 StS/poHw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1naFjP-00398p-TR; Fri, 01 Apr 2022 11:46:20 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 4AF5D300212; Fri, 1 Apr 2022 13:46:18 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 33AB12007DF3D; Fri, 1 Apr 2022 13:46:18 +0200 (CEST) Date: Fri, 1 Apr 2022 13:46:18 +0200 From: Peter Zijlstra To: Joel Fernandes Cc: Ingo Molnar , Steven Rostedt , Vincent Guittot , LKML , Thomas Gleixner , Sebastian Andrzej Siewior , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Guenter Roeck Subject: Re: [PATCH] sched/core: Fix forceidle balancing Message-ID: References: <20220330160535.GN8939@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 31, 2022 at 03:00:40PM -0400, Joel Fernandes wrote: > Hi, > > By the way, might be slightly related - we still see crashes with > pick_task_fair() in our kernel even with this change: > https://lkml.org/lkml/2020/11/17/2137 Please as to not use lkml.org. Please use something with a MsgID in like lore. > Is it possible that when doing pick_task_fair() especially on a remote > CPU, both the "cfs_rq->curr" and the rbtree's "left" be NULL with core > scheduling? In this case, se will be NULL and can cause crashes right? > I think the code assumes this can never happen. > > +Guenter Roeck kindly debugged pick_task_fair() in a crash as > follows. Copying some details he mentioned in a bug report: > > Assembler/source: > > 25: e8 4f 11 00 00 call 0x1179 ; se = > pick_next_entity(cfs_rq, curr); > 2a:* 48 8b 98 60 01 00 00 mov 0x160(%rax),%rbx ; trapping > instruction [cfs_rq = group_cfs_rq(se);] > 31: 48 85 db test %rbx,%rbx > 34: 75 d1 jne 0x7 > 36: 48 89 c7 mov %rax,%rdi > > At 2a: RAX = se == NULL after pick_next_entity(). Looking closely into > pick_next_entity(), it can indeed return NULL if curr is NULL and if > left in pick_next_entity() is NULL. Per line 7:, curr is in %r14 and > indeed 0. > > Thoughts? It is possible for ->curr and ->leftmost to be NULL, but then we should also be having ->nr_running == 0 and not call pick in the first place. Because picking a task from no tasks doesn't make much sense.