Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp980032rwi; Mon, 31 Oct 2022 09:44:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tUDLI3DkVwXMYcYa3KauNqBKhz8lfHWnHh0UziJ94w6ezFnGMOl/dbsRygTysiPe7EBLu X-Received: by 2002:a50:d5d5:0:b0:461:a30b:67a2 with SMTP id g21-20020a50d5d5000000b00461a30b67a2mr14839133edj.104.1667234653202; Mon, 31 Oct 2022 09:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667234653; cv=none; d=google.com; s=arc-20160816; b=Hd7kz08dSR+Lg08zILP3+Il55oQMOZnamus0UhjVVI8HjcIGbZc/cPtPWJ4TiPUxAU z4Mu7b/k/GDwrFbV5DcztMm+2u6cL3NKPEkU9HKTIMN4519rg5g2+2kiwFAs2jaEmRZa hmrU93juAQ0bgfZm5vGk8xxrOnO7QdAyqCwQ6GdMpVfP06QSSlK3EM1yYcmKwf90GfID 4gzAGT2sD+5coUMJhuf8yFwNfsz14lUKE7HSboF1dmxFuy15uk6KO7amsywTvuGgikZm 1bSCnC/hrl1i01lloQ4xtXk03UjA2CCn7/xP5DQrj0v6Z6OPe1iJjMjXOVf3nj1OHQwG 7Piw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=iyz++H++BwxzjXNQF73cZt3WiWZfwXLsM3Nh+u2r3o4=; b=N9CIPqcuDyJ4DlK7w4/RWJkw9hZk2aixkoSf6Ohyz5a9lKUbMjf7C5htfDOU4eJm0t Ab5FwfXfvY08UQRQDZQXQcFugCDg9jhYaTjQYTQQJV4LAPufpQOihaUgsi4wyz/xPiNL uLq17kuvTkG49I1N/WMbb/Rqi53hiv1kccmN14S7MvIF8NYT6cVm3vdOawOuskFdzRsX N6x0vHjhReD9hdj82YLzOFu62JfZcJrDdieCP1/iriT2o4vxvK5HYJ1YZRmekCjVlwX3 +zkmUrKl96Px/WTBh90FpS4g1DvVfgB/DPCoqIXCLPAmZUErYYUC7EH8j1E+3FVU4EG8 fl7w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv10-20020a17090760ca00b0078cbe9d08c6si10743956ejc.197.2022.10.31.09.43.47; Mon, 31 Oct 2022 09:44:13 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231902AbiJaQkB (ORCPT + 99 others); Mon, 31 Oct 2022 12:40:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbiJaQj7 (ORCPT ); Mon, 31 Oct 2022 12:39:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CFBE92BC3 for ; Mon, 31 Oct 2022 09:39:58 -0700 (PDT) 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 D8B501FB; Mon, 31 Oct 2022 09:40:04 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 258FE3F703; Mon, 31 Oct 2022 09:39:51 -0700 (PDT) Message-ID: <4e396924-c3be-1932-91a3-5f458cc843fe@arm.com> Date: Mon, 31 Oct 2022 17:39:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC PATCH 07/11] sched: Add proxy execution Content-Language: en-US To: Joel Fernandes Cc: Connor O'Brien , linux-kernel@vger.kernel.org, kernel-team@android.com, John Stultz , Joel Fernandes , 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" References: <34B2D8B9-A0C1-4280-944D-17224FB24339@joelfernandes.org> From: Dietmar Eggemann In-Reply-To: <34B2D8B9-A0C1-4280-944D-17224FB24339@joelfernandes.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 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, [...] >>> + 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. __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() 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