From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39C17C433F5 for ; Fri, 4 Feb 2022 08:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348616AbiBDIT1 (ORCPT ); Fri, 4 Feb 2022 03:19:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238253AbiBDIT0 (ORCPT ); Fri, 4 Feb 2022 03:19:26 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7295BC061714 for ; Fri, 4 Feb 2022 00:19:26 -0800 (PST) Date: Fri, 4 Feb 2022 09:19:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643962763; 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=0EVqzfBHngLFj0WvMsDBX7PUceCV7lBGA4L5jVwG7vw=; b=Cxlpr/2qIhsE/fte7cb1HgHCTd2elrrQ9z/+c9sV3QsODR+qhGxM5NgvwepE2+4t2G4irY CrREhnCYrzent8bqZykgmQtLBaw6hreji4QaB2wsE5xV48IVPm50Lwge8ZJxKsPesFBYmh KSz+XULro99j2YNm9QKZ55s1d+/4aYU9GasBFga1eVvHRT5OEofwxkgqTmo4DmYPK9sMpg CBhlFw5JpDUQOb+z6FOpasOkCSmCVIUM5KMNN7N6pzEG8iP4TS9nJZZhdetZmE2PhW0rR9 HqDbHP32exFiD+WhEo+LaD3k4W2BjL2mZjWDBY0FTASOAhWUhJdXjGXtdj3bSQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643962763; 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=0EVqzfBHngLFj0WvMsDBX7PUceCV7lBGA4L5jVwG7vw=; b=rtbuQpOJgwEmcbJ11r4HTYRHQFSOsYovnsuXf+wpmWA/+nkNQU0fKuKpn5Gzv1z/oueNKd 9Kx2fcZWkNLEpzAw== From: Sebastian Andrzej Siewior To: Jakub Kicinski Cc: Yannick Vignon , Eric Dumazet , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Maxime Coquelin , Antoine Tenart , Alexander Lobakin , Paolo Abeni , Wei Wang , Kumar Kartikeya Dwivedi , Yunsheng Lin , Arnd Bergmann , netdev , Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , sebastien.laveze@nxp.com, Yannick Vignon Subject: Re: [PATCH net-next 1/2] net: napi: wake up ksoftirqd if needed after scheduling NAPI Message-ID: References: <20220203184031.1074008-1-yannick.vignon@oss.nxp.com> <0ad1a438-8e29-4613-df46-f913e76a1770@oss.nxp.com> <20220203170901.52ccfd09@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220203170901.52ccfd09@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2022-02-03 17:09:01 [-0800], Jakub Kicinski wrote: > Let's be clear that the problem only exists when switching to threaded > IRQs on _non_ PREEMPT_RT kernel (or old kernels). We already have a > check in __napi_schedule_irqoff() which should handle your problem on > PREEMPT_RT. It does not. The problem is the missing bh-off/on around the call. The forced-threaded handler has this. His explicit threaded-handler does not and needs it. > We should slap a lockdep warning for non-irq contexts in > ____napi_schedule(), I think, it was proposed by got lost. Something like this perhaps?: diff --git a/net/core/dev.c b/net/core/dev.c index 1baab07820f65..11c5f003d1591 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4217,6 +4217,9 @@ static inline void ____napi_schedule(struct softnet_data *sd, { struct task_struct *thread; + lockdep_assert_once(hardirq_count() | softirq_count()); + lockdep_assert_irqs_disabled(); + if (test_bit(NAPI_STATE_THREADED, &napi->state)) { /* Paired with smp_mb__before_atomic() in * napi_enable()/dev_set_threaded(). Be aware that this (the first assert) will trigger in dev_cpu_dead() and needs a bh-off/on around. I should have something in my RT tree :) Sebastian