Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1196653rdh; Mon, 25 Sep 2023 06:10:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGABwPBygTOmkwiUB0pf+Xwt0hwnnEFpmlyhu5CPr7bHWzFkSZkMnmqO5QVcJjcnn5x4aGO X-Received: by 2002:a17:90b:1bce:b0:26c:f6d2:2694 with SMTP id oa14-20020a17090b1bce00b0026cf6d22694mr4244402pjb.12.1695647459249; Mon, 25 Sep 2023 06:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695647459; cv=none; d=google.com; s=arc-20160816; b=A34p4EAIc6TLY+JuGKg3VrfVgzs1JkRbjySa+v2B1Py2wjq6z8NtFX5kLNPkZwZSeN Ibod6OS0GuNteKR+Dfv7K5NACy8fPZCtR/lwQoyln3UqJnRzhz6SLoJ4Kjx+OSXLvuAf MeWhsTDfLf7ZoiWLQ7qcmvz9Ic2kt4uDd7c46BML3HkvaYvRjXNRJaDuRz54nxQItpw9 6YOjxAoXLr9dw/LBP9af2XZEk4FWYzvkqsHQxh9fSAPsGmagvuxLTmINq9X6pSAT71yf adwal7tW8DZOa8lGjSG3zgY5heHrwzZgYqlDOoovCuamBEGQZN3eMP4D+S2KSNm4r7DU /5XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=RMv39o9lijlSjESvhBhV0+AG780iiHA17nAzBVo3xpc=; fh=vR4BenrcHvvaqLQuK5VkbzNORD31ui1xanJEIaN7oBw=; b=Zz6qi8icUuEEeQHiyGyxcUKARwcC/Ut5M7HFqVZx1HfT3yAsmJl8AlKuCEmPNKIf8U LNC/q1QmjZyJSaDMO7DkAgmwVhQIxOtvgXl273g9Km098X3hltCQBE9Qmv5n6wFMwOV0 kaX0wXGQsznIogwypdkkKsNE/YtWWl4CxZPqFvuXCvaWcMdQf81NXipaWtC748Yo2gfu 2ceBl7na/2nDvmzDcIvadAkwk+8v8J6WROFnxgiJfZ8ybuuoCuzYfMB9HlCaojCOU0qJ Ppan3w40VXpbH3jBrxlT/6PqK7A9K8a7iRHex9u83IBrKpCA+RajfWna7a9CcSZXruV9 QAtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXG4h1OF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id h23-20020a17090aa89700b00274cf8042b6si8616471pjq.102.2023.09.25.06.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 06:10:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXG4h1OF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id C680A8216E5F; Mon, 25 Sep 2023 05:09:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231309AbjIYMJz (ORCPT + 99 others); Mon, 25 Sep 2023 08:09:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbjIYMJy (ORCPT ); Mon, 25 Sep 2023 08:09:54 -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 6FF2713A for ; Mon, 25 Sep 2023 05:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643746; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RMv39o9lijlSjESvhBhV0+AG780iiHA17nAzBVo3xpc=; b=YXG4h1OF/kbT83bahAE5MRlzf164h4fmgWfdvXZ4qAjR2UPvNyqb1MK2jV6zYQaCs+gvbt 8ImxG3Qm4p/cIfSfcHjOtXcINTysu1X6y5ci/ndWlOESNN9IYrAYA4UnuuxSYLN8OrZVXm B2eU/kPEYCp7UIOAw4Uxbjnb9eEcn/M= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-BVc3j_W-NviDriw3qRD5gA-1; Mon, 25 Sep 2023 08:09:04 -0400 X-MC-Unique: BVc3j_W-NviDriw3qRD5gA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4052d1b19f8so54203585e9.0 for ; Mon, 25 Sep 2023 05:09:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695643743; x=1696248543; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RMv39o9lijlSjESvhBhV0+AG780iiHA17nAzBVo3xpc=; b=KnahZbn2aD+Q/aUYZn0PN3L0A5H8juGpYTCMw86cZ/wufseS5D0B2DXIYWiVxMldr1 tNODr7o0bK3/wyEPq8PnS40SqWmhjsq+QQzl1htLqIUEzFqGWctK7LFShSnyoeW4HMfv maAG14ng6gkQQfHhZM68MzgcG5BnFRJ27Y4ApZCDdePIxicE+QAMjaRqgwwgDUYgkPbX exX0tm19PRhFtqhGla3UJoo/wzTJM5Ha89AwDusN7NjWA+P8BDW5YKBh5qRkXycTgVbR Wj/4458L8KhUSmcwfK3aIL2X+67b/Q4PytZr3QA5neFUChg2Vpd0LXH8L24e6qaWrkiw FfSw== X-Gm-Message-State: AOJu0YyzpSCmNibksuwkCTRbuo0hx2d58ex5uN1/pYnrEcUV67WXvmfA 4dt48FIcVs0pBfMK2e49lmfwS/UP/E09XZmISAO+Fd41JntPWeq+SqN2j6ikQzaaivrAR3nE1uA ROP+7quVAvR5es8TUW0zvtHg9 X-Received: by 2002:a7b:ca56:0:b0:3fb:df34:176e with SMTP id m22-20020a7bca56000000b003fbdf34176emr5482636wml.31.1695643743657; Mon, 25 Sep 2023 05:09:03 -0700 (PDT) X-Received: by 2002:a7b:ca56:0:b0:3fb:df34:176e with SMTP id m22-20020a7bca56000000b003fbdf34176emr5482615wml.31.1695643743304; Mon, 25 Sep 2023 05:09:03 -0700 (PDT) Received: from vschneid.remote.csb ([80.214.159.242]) by smtp.gmail.com with ESMTPSA id n6-20020a1c7206000000b003fe4ca8decdsm14943110wmc.31.2023.09.25.05.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 05:09:02 -0700 (PDT) From: Valentin Schneider To: Ingo Molnar , Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Daniel Bristot de Oliveira , Dietmar Eggemann , Ingo Molnar , Juri Lelli , Peter Zijlstra , Steven Rostedt , Vincent Guittot , Thomas Gleixner Subject: Re: [PATCH] sched/rt: Make rt_rq->pushable_tasks updates drive rto_mask In-Reply-To: References: <20230811112044.3302588-1-vschneid@redhat.com> <20230815142121.MoZplZUr@linutronix.de> Date: Mon, 25 Sep 2023 14:09:00 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 05:09:54 -0700 (PDT) On 25/09/23 10:27, Ingo Molnar wrote: > * Sebastian Andrzej Siewior wrote: > >> On 2023-08-11 12:20:44 [+0100], Valentin Schneider wrote: >> > Sebastian noted that the rto_push_work IRQ work can be queued for a CPU >> > that has an empty pushable_tasks list, which means nothing useful will= be >> > done in the IPI other than queue the work for the next CPU on the rto_= mask. >> >=20 >> > rto_push_irq_work_func() only operates on tasks in the pushable_tasks = list, >> > but the conditions for that irq_work to be queued (and for a CPU to be >> > added to the rto_mask) rely on rq_rt->nr_migratory instead. >> >=20 >> > nr_migratory is increased whenever an RT task entity is enqueued and i= t has >> > nr_cpus_allowed > 1. Unlike the pushable_tasks list, nr_migratory incl= udes a >> > rt_rq's current task. This means a rt_rq can have a migratible current= , N >> > non-migratible queued tasks, and be flagged as overloaded / have its C= PU >> > set in the rto_mask, despite having an empty pushable_tasks list. >> >=20 >> > Make an rt_rq's overload logic be driven by {enqueue,dequeue}_pushable= _task(). >> > Since rt_rq->{rt_nr_migratory,rt_nr_total} become unused, remove them. >> >=20 >> > Note that the case where the current task is pushed away to make way f= or a >> > migration-disabled task remains unchanged: the migration-disabled task= has >> > to be in the pushable_tasks list in the first place, which means it has >> > nr_cpus_allowed > 1. >> >=20 >> > Link: http://lore.kernel.org/r/20230801152648._y603AS_@linutronix.de >> > Reported-by: Sebastian Andrzej Siewior >> > Signed-off-by: Valentin Schneider >> > --- >> > This is lightly tested, this looks to be working OK but I don't have n= or am >> > I aware of a test case for RT balancing, I suppose we want something t= hat >> > asserts we always run the N highest prio tasks for N CPUs, with a small >> > margin for migrations? >>=20 >> I don't see the storm of IPIs I saw before. So as far that goes: >> Tested-by: Sebastian Andrzej Siewior > > I've applied Valentin's initial fix to tip:sched/core, for an eventual > v6.7 merge, as it addresses the IPI storm bug. Let me know if merging > this is not desirable for some reason. > >> What I still observe is: >> - CPU0 is idle. CPU0 gets a task assigned from CPU1. That task receives >> a wakeup. CPU0 returns from idle and schedules the task. >> pull_rt_task() on CPU1 and sometimes on other CPU observe this, too. >> CPU1 sends irq_work to CPU0 while at the time rto_next_cpu() sees that >> has_pushable_tasks() return 0. That bit was cleared earlier (as per >> tracing). >>=20 >> - CPU0 is idle. CPU0 gets a task assigned from CPU1. The task on CPU0 is >> woken up without an IPI (yay). But then pull_rt_task() decides that >> send irq_work and has_pushable_tasks() said that is has tasks left >> so=E2=80=A6. >> Now: rto_push_irq_work_func() run once once on CPU0, does nothing, >> rto_next_cpu() return CPU0 again and enqueues itself again on CPU0. >> Usually after the second or third round the scheduler on CPU0 makes >> enough progress to remove the task/ clear the CPU from mask. > > Just curious, any progress on solving this? > On my side not really, I need to stop getting distracted and probably get this to reproduce on a system so I can understand-by-tracing > Thanks, > > Ingo