Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1136133rwi; Mon, 31 Oct 2022 11:50:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6u4CfKMeon93Mf9E98OFVDrpQH8OnZMWWHfo0cWB7sHVl/VJRaqN+wpqDg+s8/5jnt9Dd7 X-Received: by 2002:a17:90b:394:b0:212:19d7:9072 with SMTP id ga20-20020a17090b039400b0021219d79072mr33031296pjb.69.1667242208402; Mon, 31 Oct 2022 11:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667242208; cv=none; d=google.com; s=arc-20160816; b=RVOCrNtls7z3oSEMKa8a7Mg0all7aqzRYAR1qLjgfbgNSNKbAhF7Kp2Yd+0W0s58dB x+boYFUpNjnwVlaAnUXyfOXIp+xR9PB225oPeF7aN8IGfxV0XOzLgmEKw/pHHETpbCMf Im6kzeKvxYZrhfbbqFWq03g+w8smg6JZEQppF2Ed0jXYc3/XPZjaj+WyKi1cY7DZATB4 wK+M4U+o+ydHUgWwayjMZvmW1Bz2TmS2UGHCCZah2QZ4oHhPr56YOJ9IIeFYSBnI8wUP NkXqyuaXv4K7uxE+3nTGcQ4dOvWNx9tABngYGIvzcxV7c+GtVR8cRTX8xbQKmE4mkx9B nS9w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EESE7Qk6RD3HsvrbKWsjg2fpvxN09XKBO8g4pTk9Zqc=; b=GLnbdwRDAzPOulh3c+Hkhid8gmgB/4ydegPzIMWOF65xOmynjUcszC7j5e+PSX5x/o e40bWus1x1uil9gsb/RwzKGSY7giP6KnCZmRVMPvZk/krp0oX2Uq/rCFUaGHFPPklqun xm3mNOo19m+Q14ouZJ5Nwgs6f5CZSl7tCtEzl136hHYitZMEPoH+Sc+NyQfUh+w4v/k9 laskSAsaSXosvjBfMl6ubMpi6GK/DEGmIo/yUeUooCbFMMOj+WAqw46WbsD8qA43dTsh 88G/5yQq0gfOJj877WtnB/gp1GiDF5kempki8NxTRjwhTnYR+L96MnZc+Q0c1SDCoEjf FCqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=aS1lzemX; 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 l14-20020a170903120e00b0017811e3927bsi10513448plh.622.2022.10.31.11.49.54; Mon, 31 Oct 2022 11:50:08 -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=@joelfernandes.org header.s=google header.b=aS1lzemX; 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 S229562AbiJaSAj (ORCPT + 98 others); Mon, 31 Oct 2022 14:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiJaSAg (ORCPT ); Mon, 31 Oct 2022 14:00:36 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB386423 for ; Mon, 31 Oct 2022 11:00:34 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id fz10so2210016qtb.3 for ; Mon, 31 Oct 2022 11:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=EESE7Qk6RD3HsvrbKWsjg2fpvxN09XKBO8g4pTk9Zqc=; b=aS1lzemXQZpkfQM3ZRNpeWXBq9ad6z/ulZOwAp7Ve7KVMrHtE1PxeZTDeRbaoRnG5z 13xbG3qUxDGi4PO3bejle5EMuLIOEi7uwnC0lGMvNj0NwEjugAykCDqI5aR5GLmb+5AG Rg8YJv29s/scDENhkhvGCepRtBBwHE0GR4KZA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EESE7Qk6RD3HsvrbKWsjg2fpvxN09XKBO8g4pTk9Zqc=; b=Gifvr7TvcbW3mEo9P4MVqT0bjHNDL3xKF6I4ha95IQ1TOGgJslne73INOoVNdjVs6g SFgMl8pJWZhvdyys4pWmCvbu5bL5flJmocqy+pt1GKeUtrZFkS1uePO8sxO2kSk+fySR S2neC4JjKU4Fj/Q9xLZEl2TrotqTygrzNCreZeA+Y32BaNvVw8mTHxGAHjPTskwjFpQu yo14AXTGuwN3s4WoAl8rXIbH7NpMit3AFFJPniPGKd2h5bM3OJroFFHskk/dKcF5mnsS akglyWW648dWc2Dl0jiXptpVbuQ1M6vmPu15Yzn1OwOIBGQY7EZtSfnu0E+C9rdWPTWz 7FUw== X-Gm-Message-State: ACrzQf1Tl64UbVd3NMFwWO5WqLnr7ozvOiuIItxuY3iMT3Orqw7lAogu Utm6kZIIu1HJN35YFjbvTDKttQ== X-Received: by 2002:a05:622a:1826:b0:3a4:ae8c:6eb4 with SMTP id t38-20020a05622a182600b003a4ae8c6eb4mr11705178qtc.210.1667239232970; Mon, 31 Oct 2022 11:00:32 -0700 (PDT) Received: from localhost (48.230.85.34.bc.googleusercontent.com. [34.85.230.48]) by smtp.gmail.com with ESMTPSA id br18-20020a05620a461200b006b953a7929csm5048243qkb.73.2022.10.31.11.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 11:00:31 -0700 (PDT) Date: Mon, 31 Oct 2022 18:00:30 +0000 From: Joel Fernandes To: Dietmar Eggemann Cc: Connor O'Brien , linux-kernel@vger.kernel.org, kernel-team@android.com, John Stultz , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" Subject: Re: [RFC PATCH 07/11] sched: Add proxy execution Message-ID: References: <34B2D8B9-A0C1-4280-944D-17224FB24339@joelfernandes.org> <4e396924-c3be-1932-91a3-5f458cc843fe@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4e396924-c3be-1932-91a3-5f458cc843fe@arm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Mon, Oct 31, 2022 at 05:39:45PM +0100, Dietmar Eggemann wrote: > On 29/10/2022 05:31, Joel Fernandes wrote: > > Hello Dietmar, > > > >> On Oct 24, 2022, at 6:13 AM, Dietmar Eggemann wrote: > >> > >> On 03/10/2022 23:44, Connor O'Brien wrote: > >>> From: Peter Zijlstra > > [...] > > >>> + put_prev_task(rq, next); > >>> + if (curr_in_chain) { > >>> + rq->proxy = rq->idle; > >>> + set_tsk_need_resched(rq->idle); > >>> + /* > >>> + * XXX [juril] don't we still need to migrate @next to > >>> + * @owner's CPU? > >>> + */ > >>> + return rq->idle; > >>> + } > >> > >> --> (1) > > > > Sorry but what has this got to do with your comment below? > > This was the place where fake_task was used in: > > https://lkml.kernel.org/r/20181009092434.26221-6-juri.lelli@redhat.com > > +migrate_task: > ... > + } > + rq->proxy = &fake_task; <-- !!! > + > + for (; p; p = p->blocked_task) { > > >>> + rq->proxy = rq->idle; > > We use `rq->idle` now, I see. I need to research that, but a comment below: > [...] > > >>> + rq_unpin_lock(rq, rf); > >>> + raw_spin_rq_unlock(rq); > >> > >> Don't we run into rq_pin_lock()'s: > >> > >> SCHED_WARN_ON(rq->balance_callback && rq->balance_callback != > >> &balance_push_callback) > >> > >> by releasing rq lock between queue_balance_callback(, push_rt/dl_tasks) > >> and __balance_callbacks()? > > > > Apologies, I’m a bit lost here. The code you are responding to inline does not call rq_pin_lock, it calls rq_unpin_lock. So what scenario does the warning trigger according to you? > > True, but the code which sneaks in between proxy()'s > raw_spin_rq_unlock(rq) and raw_spin_rq_lock(rq) does. > Got it now, thanks a lot for clarifying. Can this be fixed by do a __balance_callbacks() at: > __schedule() > > rq->proxy = next = pick_next_task() > > __pick_next_task() > > pick_next_task_rt() > > set_next_task_rt() > > rt_queue_push_tasks() > > queue_balance_callback(..., push_rt_tasks); <-- queue rt cb > > proxy() > ... here, before doing the following unlock? > raw_spin_rq_unlock(rq) > > ... <-- other thread does rq_lock_XXX(rq) > raw_spin_rq_lock_XXX(rq) > rq_pin_lock(rq) > > raw_spin_rq_lock(rq) > > context_switch() > > finish_task_switch() > > finish_lock_switch() > > __balance_callbacks(rq) <-- run rt cb here > > __balance_callbacks(rq)() <-- or run rt cb here Hmm also Connor, does locktorture do hotplug? Maybe it should to reproduce the balance issues. thanks, - Joel