Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1932469rdb; Mon, 9 Oct 2023 07:28:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG696PziM6PLkomOSMBXM2BuvxsXxT1zAUPc4cj/Y4T0Md99dsBM5U2W7oJ5zUSunS5NGi2 X-Received: by 2002:a17:90a:ce8c:b0:268:fc26:73a9 with SMTP id g12-20020a17090ace8c00b00268fc2673a9mr11378246pju.40.1696861723443; Mon, 09 Oct 2023 07:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696861723; cv=none; d=google.com; s=arc-20160816; b=I27dRHtuhE8yR2mcG3GwTvOy3z4T7JZjaSdQnuVtRlejxYnah/HaTwj/2FxaIJJYDh 2ADWKwpgIJiwFEIfx6moeIuu7QVSKkFcEkJ5HieWIlS1qCMzO2158FaD5BQ8qG9nUI/M uMi+prM5nepWZ7Mmilm916xA275L/O2xxS0v++VsC0wCMlf8LVEjsiOrqhgCtaM2EJif JSLciqS3WKahM81QXxClxojcVtNKOeweUtAqfI5apZFm5IDtD072DhrqRvehTjgGfZX6 JyHHNk++qmkeKuESFGXsg7YlXYyg76cehMMeO1Opq4lPWe7DChKohWj7ow1olH1kCyaL htYw== 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=iydLHg+u5KMfVoyhVtA2QOCHk3nf/DZIegZMvg91+cQ=; fh=VgvL4Sj5w+UYu7fnl+SFKJDFiXxTdry3nNLql4Sejw8=; b=ChBAjf9o+8G8zdogDQszp2KXlquAlmd2A3W0ne6KEuOSRJ3zyQRV8eXiSisUrNWyr0 F/DNS/TWjVLL5bWGZHGFJnN22rJfYejHE1kbf4PPOYyNy0a91P2PvMXlkgwt/dxQL8x/ VzC5OT1j9cg0jo4FLaWWqaE6y6vYds2Qsq/Fi4iDUwu8WOXx8FvdEBK1hzv8cT/RAZ8n E8Q/ALHOaHApN/35cHmDMGZKapRQpk4SbMdZaWj8oK1z58E1fB+W8gDZYzbuim6T6kyP KCJ+TaiBrs9lgRMcuaJzCy9eynxfq3XcXNdhLfNy415gXctghgyHgn7Iw4IFBoXKyrrT lExg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ipt0xixq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t14-20020a17090a950e00b0027367e0c931si11738643pjo.129.2023.10.09.07.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 07:28:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ipt0xixq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 79FFB80267CE; Mon, 9 Oct 2023 07:28:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376944AbjJIO2k (ORCPT + 99 others); Mon, 9 Oct 2023 10:28:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbjJIO2j (ORCPT ); Mon, 9 Oct 2023 10:28:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C25CF99 for ; Mon, 9 Oct 2023 07:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696861675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iydLHg+u5KMfVoyhVtA2QOCHk3nf/DZIegZMvg91+cQ=; b=ipt0xixqJGiP6yBhIhAoTZteYwp8sYd7vlS6n4m+cy+aKRdrCy1GQiNQfo0dq3lY2zsmom BcPix2MJZ7HOdv0redAiuPnCBsrSu0eua1czV7NDJa+yuigyJTZlKf1r9Zqkq928gaK+j/ YOzKEfwiEhHiOelRSJCF36xxRyo8eLU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-7EpCVosjNFiWlV8YVwkTrw-1; Mon, 09 Oct 2023 10:27:52 -0400 X-MC-Unique: 7EpCVosjNFiWlV8YVwkTrw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1EDE1811E98; Mon, 9 Oct 2023 14:27:51 +0000 (UTC) Received: from lorien.usersys.redhat.com (unknown [10.39.194.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6657A40C6EA8; Mon, 9 Oct 2023 14:27:43 +0000 (UTC) Date: Mon, 9 Oct 2023 10:27:40 -0400 From: Phil Auld To: Chen Yu Cc: Biju Das , Peter Zijlstra , Mike Galbraith , Marek Szyprowski , "bsegall@google.com" , "bristot@redhat.com" , "chris.hyser@oracle.com" , "corbet@lwn.net" , "dietmar.eggemann@arm.com" , "gregkh@linuxfoundation.org" , "joel@joelfernandes.org" , "joshdon@google.com" , "juri.lelli@redhat.com" , "kprateek.nayak@amd.com" , "linux-kernel@vger.kernel.org" , "mingo@kernel.org" , "patrick.bellasi@matbug.net" , Pavel Machek , "pjt@google.com" , "qperret@google.com" , "qyousef@layalina.io" , "rostedt@goodmis.org" , "tglx@linutronix.de" , "tim.c.chen@linux.intel.com" , "timj@gnu.org" , "vincent.guittot@linaro.org" , "youssefesmat@chromium.org" , "mgorman@suse.de" , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH] sched/fair: fix pick_eevdf to always find the correct se Message-ID: <20231009142740.GA437913@lorien.usersys.redhat.com> References: <553e2ee4-ab3a-4635-a74f-0ba4cc03f3f9@samsung.com> <867f5121d7d010cacf938c293f862b0cea560ec2.camel@gmx.de> <20231006140042.GG36277@noisy.programming.kicks-ass.net> <20231006155501.GH36277@noisy.programming.kicks-ass.net> <20231006192445.GE743@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 07:28:42 -0700 (PDT) On Sat, Oct 07, 2023 at 02:42:10PM +0800 Chen Yu wrote: > Hi Biju, > > On 2023-10-07 at 06:26:05 +0000, Biju Das wrote: > > Hi Chen Yu, > > > > > Subject: Re: [PATCH] sched/fair: fix pick_eevdf to always find the correct > > > se > > > > > > On 2023-10-06 at 21:24:45 +0200, Peter Zijlstra wrote: > > > > On Fri, Oct 06, 2023 at 05:55:01PM +0200, Peter Zijlstra wrote: > > > > > > > > > And yeah, min_deadline is hosed somehow. > > > > > > > > > > migration/28-185 [028] d..2. 70.264274: validate_cfs_rq: --- / > > > > > migration/28-185 [028] d..2. 70.264277: __print_se: > > > ffff88845cf48080 w: 1024 ve: -58857638 lag: 870381 vd: -55861854 vmd: - > > > 66302085 E (11372/tr) > > > > > migration/28-185 [028] d..2. 70.264280: __print_se: > > > ffff88810d165800 w: 25 ve: -80323686 lag: 22336429 vd: -41496434 vmd: - > > > 66302085 E (-1//autogroup-31) > > > > > migration/28-185 [028] d..2. 70.264282: __print_se: > > > ffff888108379000 w: 25 ve: 0 lag: -57987257 vd: 114632828 vmd: 114632828 N > > > (-1//autogroup-33) > > > > > migration/28-185 [028] d..2. 70.264283: validate_cfs_rq: > > > min_deadline: -55861854 avg_vruntime: -62278313462 / 1074 = -57987256 > > > > > > > > > > I need to go make dinner (kids hungry), but I'll see if I can figure > > > > > out how this happens... > > > > > > > > *sigh*, does the below help? > > > > > > > > --- > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index > > > > 04fbcbda97d5..6a670f119efa 100644 > > > > --- a/kernel/sched/fair.c > > > > +++ b/kernel/sched/fair.c > > > > @@ -3632,6 +3747,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, > > > struct sched_entity *se, > > > > */ > > > > deadline = div_s64(deadline * old_weight, weight); > > > > se->deadline = se->vruntime + deadline; > > > > + min_deadline_cb_propagate(&se->run_node, NULL); > > > > } > > > > > > > > #ifdef CONFIG_SMP > > > > > > Is it because without this patch, the se->deadline is not always synced > > > with se->min_deadline, then in pick_eevdf() the following condition could > > > not be met, thus we get a NULL candidate and has to pick the leftmost one? > > > if (se->deadline == se->min_deadline) > > > > > > Regarding the circular locking warning triggered by printk, does it mean we > > > should not get a NULL candidate from __pick_eevdf() in theory? And besides, > > > we should not use printk with rq lock hold? > > > > Is it not a useful error log? At least from the initial report Marek Szyprowski doesn't see "EEVDF scheduling fail, picking leftmost" but seen only warning triggered by this in the logs. > > > > Yes, it is a useful log. I was trying to figure out the safe scenario to use > printk. > You should not use printk with a rq lock held as some console implementations (framebuffer etc) call schedule_work() which loops back into the scheduler and bad things happen. Some places in the scheduler use printk_deferred() when needed. I think this will be better when the RT printk stuff is fully merged. Cheers, Phil > thanks, > Chenyu > --