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 CADD6C433EF for ; Thu, 3 Feb 2022 16:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352375AbiBCQog (ORCPT ); Thu, 3 Feb 2022 11:44:36 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:54424 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352392AbiBCQoe (ORCPT ); Thu, 3 Feb 2022 11:44:34 -0500 Date: Thu, 3 Feb 2022 17:44:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643906673; 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=FYvZgFIClpGWgYjjDZmm3AR9Fk7V2vEytBiOzm8FV34=; b=XRQ6tO8YEuyEiC5XXUveL1cxECgQAHWZ7ea8c12k5Lf6EQxX9sSWZBDJCPgyzNzHQOgDdO Ol43709M0jrXs/nW3m2WPPUyGAyXYrDFjPmaAk0TuWAB/1gViOhkjqct6GYhk51NAvbugR BHKHtObOKWL6nJOzRVui97hQfkjkq1fM/abPFO+yyQDdKoTB/nbS5JDmQ1Oih32kIC1Z6V IDCxGqUlSbrdUx/RumkMrNz7hYKRzVfNirWYsRup17jLrz+0gjcIT0a+jAaF6TD6c+eDdq iWhfL/pimlIqUQgTgP73B9EwCRM86sROUj8lvb2wjFkFco92S6c7oCStMDLLiA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643906673; 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=FYvZgFIClpGWgYjjDZmm3AR9Fk7V2vEytBiOzm8FV34=; b=hz/xAWtsNus1jq+WmycwLafPNzQcgwt0HeAQtBpK+VJwgiJZM6o/rpCZOUOgwMqfCfNI6v vJmhoe3Ao3bC8TBg== From: Sebastian Andrzej Siewior To: Eric Dumazet Cc: bpf , netdev , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH net-next 3/4] net: dev: Makes sure netif_rx() can be invoked in any context. Message-ID: References: <20220202122848.647635-1-bigeasy@linutronix.de> <20220202122848.647635-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 2022-02-03 08:18:34 [-0800], Eric Dumazet wrote: > > So we still end up with two interfaces. Do I move a few callers like the > > one you already mentioned over to the __netif_rx() interface or will it > > be the one previously mentioned for now? > > > I would say vast majority of drivers would use netif_rx() > > Only the one we consider critical (loopback traffic) would use > __netif_rx(), after careful inspection. > > As we said modern/high performance NIC are using NAPI and GRO these days. > > Only virtual drivers might still use legacy netif_rx() and be in critical paths. Let me then update something to the documentation so it becomes obvious. > > static inline void local_bh_enable(void) > > { > > - __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); > > + if (unlikely(softirq_count() == SOFTIRQ_DISABLE_OFFSET)) { > > + __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET); > > + } else { > > + preempt_count_sub(SOFTIRQ_DISABLE_OFFSET); > > + barrier(); > > + } > > } > > > > #ifdef CONFIG_PREEMPT_RT > > > > lower the overhead to acceptable range? (I still need to sell this to > > peterz first). > > I guess the cost of the local_bh_enable()/local_bh_disable() pair > will be roughly the same, please measure it :) We would avoid that branch maybe that helps. Will measure. Sebastian