Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp667583rwb; Thu, 18 Aug 2022 10:03:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5JmWk0AmJcwmi/p1sKZWEl+yLAlSGNyF2e+TSfW1tt2/nzI3cBlfsib5XJz8lwdQkZWQ8+ X-Received: by 2002:a05:6a00:1395:b0:52e:128a:23de with SMTP id t21-20020a056a00139500b0052e128a23demr3818677pfg.5.1660842210678; Thu, 18 Aug 2022 10:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660842210; cv=none; d=google.com; s=arc-20160816; b=Wl1n+UGJczdOcuzMk2nC7DztaWo2oxBU86VeeKJyIvJ+5Om5EVFlgGa31XWZqlaP+M mQUixRr0IiYWd3+pYjxqzzSOYKoXeV1CDuXIRinwvEkToZfu7+j1j9/QuSrycHuyZODk M5fDdMW0A8QIHZ0iamfDn89w1YvWi3D5LDyJPJJkDe/Tlbsf3CGYBYg2nbpzkxZy4owM UIIKFT61fLHeakpZ/ByCGHR7sgQfJqsH4e/EbUhsQa8iFz6upknGP9CBkXyMfEpQ9AiV 72KusKS0fS0SWfGZsPjJFKqRbxrLaC7UhOlIAG8u3KWmU9ZKmO0w3VEduMmTAhohmmlQ jhOw== 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:dkim-signature :dkim-signature:date; bh=PRTVq6FMPaQVH3R6PFr1y0wp2p0Fv7JQuFoG/1x21lI=; b=UovqkIuwKfBHv4vCU94VUNu1sK83jGLVB7nwHP0ISgfjDAnDEce/GhpmfNDaY77IZ2 MTBS8p3zvrRYxw2LuL8cK+o/iw4Fnlzg4a/iY5EcatLMrI9kWjKXGurUIXJWVle8Ugvf LsWZ690h62axM/lcR8x8WJ4c6CfNXYuz1uItZ8uX1a1lAsmCNKnB5dsEb25RWgvnkk1w +YAYaDtzh7krdLznlz7Zngktrk2jQWvcDu7H3TLDeMgLWYN8jrKXO9c6R3s++nDb1Zdb VqvCUsyg+aNKlDPZFemYFqPIH3Zg47mZNaPm6CIxQlu/LtLX8eanaOwQ2fw13kLE4u9X Hx7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pvLLxS8U; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020aa788d6000000b0052e068f159bsi1968567pff.145.2022.08.18.10.03.09; Thu, 18 Aug 2022 10:03:30 -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=@linutronix.de header.s=2020 header.b=pvLLxS8U; dkim=neutral (no key) header.i=@linutronix.de; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245280AbiHRQ2N (ORCPT + 99 others); Thu, 18 Aug 2022 12:28:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344786AbiHRQ2H (ORCPT ); Thu, 18 Aug 2022 12:28:07 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2883E0CE; Thu, 18 Aug 2022 09:28:06 -0700 (PDT) Date: Thu, 18 Aug 2022 18:28:02 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1660840084; 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=PRTVq6FMPaQVH3R6PFr1y0wp2p0Fv7JQuFoG/1x21lI=; b=pvLLxS8UByH12yyhGrZNKIX6Z4egm2GF22xXz6epuwdCY2eANFlBRxNYd2I++0XNHfyk6w rUGiNzWvO+FCAnx5+OqF0WevsL2fFnVLiV+lWCt4vJPyEksSZLXc6AP3LTlZZkDpwjwP1Z QMddf0H7+HqmhusyP7zzk9bOy2U17c/a1BOCA4YNI3kP9zvZvpkiI6sAXm1U7L4VQmC8bu kWRiV4PgZGCd5Mf1RnzdGKQlaf3Fpsie2NTjNdph9sa75LZP2HhyKuxfgkA/l2RtPTORG/ 2iEsbMHsiuVkMR7ZT9qHhNFoa8vg09tkZw7wBfQeCcGdslnw6IzNl9if8uPk6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1660840084; 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=PRTVq6FMPaQVH3R6PFr1y0wp2p0Fv7JQuFoG/1x21lI=; b=t/Hs/pi1zuC46GhSD96ccovmViwaYG7LaaKKKqn7cCcn97CMr7XEXNvfK+eJgZHP9fIvwW 6aG+yEmmbUl7QCDw== From: Sebastian Andrzej Siewior To: Schspa Shi Cc: rostedt@goodmis.org, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Subject: Re: [RFC PATCH] irq_work: wakeup irq_workd when queued first rt_lazy work Message-ID: References: <20220711172314.603717-1-schspa@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220711172314.603717-1-schspa@gmail.com> 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_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 2022-07-12 01:23:15 [+0800], Schspa Shi wrote: > I want to know if this difference is by design. Yes. type1 (LAZY) does not need immediate action but can't be scheduled regularly like a workqueue. > If this is by design, we have a problem that the irq_work of type2 > will not execute as quickly as expected, it may be delayed by the > irq_work of type1. > > Please consider the following scenarios: > > If the CPU queued a type1 irq_work A, and then a type2 irq_work B. > But we won't make B executed quickly, because we won't issue the IPI > interrupt to wakeup irq_workd (the llist_add call will return false). But those two are different lists. So adding type1 to list1 does not affect type2 with list2 > This PATCH will issue the IPI_IRQ_WORK to make B execute quickly. > > One thing that needs to be optimized is that we now have > lazy_list.node.llist and lazy_work_raised which need to be granted > to be atomicity, disabled the local CPU IRQ to make this atomic. > There should be a better way to make these two variants to be atomically > and I can go in deep if this little problem is not by design, and need > to be fixed. > > If these two types of irq_work should be the same with the priority. > maybe we should change. > > if (!lazy_work || tick_nohz_tick_stopped()) { > arch_irq_work_raise(); > } > > to > > if (!(lazy_work || rt_lazy_work) || tick_nohz_tick_stopped()) { > arch_irq_work_raise(); > } but we wait for the timer for the lazy-work. RT has more LAZY items compared to !RT. So if there is an error then it should be visible there, too. Is there a problem with this? Adding (as you call it) type1 item does not affect type2 items. They will will processed asap. Sebastian