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 X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A4CC433B4 for ; Thu, 13 May 2021 05:12:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05EFA6142E for ; Thu, 13 May 2021 05:12:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbhEMFNo (ORCPT ); Thu, 13 May 2021 01:13:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60150 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhEMFNm (ORCPT ); Thu, 13 May 2021 01:13:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620882752; 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=TcOAwivDbtlARJpFLH0Y1M7raCC9tMpEn3jc2In1UFc=; b=O3esowxvWsGayw+vXRjqWYHVvfRwZwZx/kjhw8gE+anH5eevVOiUDVzcdGFSIYF0LgY0HS JsDQWQmfzNhRxQzTxQjpdkiDngb7gsfby6R9QbLFsMygFudi8Ku5xLg/VnN+CwIUUuYqu6 /fuqgS/1ZMzMy17rg7l7Ak3rllw6e68= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-AwAMhSXVPxq8AzcubOABmA-1; Thu, 13 May 2021 01:12:20 -0400 X-MC-Unique: AwAMhSXVPxq8AzcubOABmA-1 Received: by mail-wm1-f69.google.com with SMTP id g17-20020a05600c0011b029014399f816a3so1765082wmc.7 for ; Wed, 12 May 2021 22:12:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TcOAwivDbtlARJpFLH0Y1M7raCC9tMpEn3jc2In1UFc=; b=mWtztYoFbx3cEOb/iKuUVNrMp+y2tf1LfYMRgbsxTbeycHjP6LRYrnwSRwk754vfPB Pduvr4mtNolUvv6Gs5gdPgclH+LPBD96dMDGq7f7xvqvgq57tpG4mKAl4Qh+K7/j8/4Q X5XZ4ylo8ngRBF/zzX2AhueD8gOhLCzimcYO6P2LpqfCgrZ8btk9D8fe1ye+905T0GnW veu+nWLcsoFHFnigrbUV7PS+qNtrS4WkzvxnOW7Ywwt7Q2cVU9Ze09YtEu1v2qFewcnD hsyfs4GflxYsHSp+s0g5tsy8LaV6za4scAnpzudObUdORz+fuXhvf17r3aqiaukw3wPt t0UA== X-Gm-Message-State: AOAM530s+g1ikIqOwhY+rRgJQSc4Tcvb3v32591uhwtIJn7dOREIF+pl vw/EWuisi6YasIEfL/PULtXPneuYySg52bAics11vd+dHkVV4LC+JtMxPbDaBCl7+GRZ2LvDjeX 9yBGKJjLgkghFvu1JEtfnxisyKbU= X-Received: by 2002:a05:600c:19cd:: with SMTP id u13mr301611wmq.171.1620882738821; Wed, 12 May 2021 22:12:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz65HKJoTtlBrckxiBt2p5AvxqrwBotMCpCfUgNmO1jclonTBYcuH40MjWiQGDIMS8yJH2Sgw== X-Received: by 2002:a05:600c:19cd:: with SMTP id u13mr301592wmq.171.1620882738557; Wed, 12 May 2021 22:12:18 -0700 (PDT) Received: from localhost.localdomain ([151.29.91.215]) by smtp.gmail.com with ESMTPSA id c15sm1734122wro.21.2021.05.12.22.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 22:12:18 -0700 (PDT) Date: Thu, 13 May 2021 07:12:16 +0200 From: Juri Lelli To: Sebastian Andrzej Siewior Cc: netdev@vger.kernel.org, Thomas Gleixner , linux-rt-users , Steven Rostedt , LKML , sassmann@redhat.com, "David S. Miller" , Jakub Kicinski Subject: Re: [PATCH net-next] net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT Message-ID: References: <20210512214324.hiaiw3e2tzmsygcz@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210512214324.hiaiw3e2tzmsygcz@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Hi, On 12/05/21 23:43, Sebastian Andrzej Siewior wrote: > __napi_schedule_irqoff() is an optimized version of __napi_schedule() > which can be used where it is known that interrupts are disabled, > e.g. in interrupt-handlers, spin_lock_irq() sections or hrtimer > callbacks. > > On PREEMPT_RT enabled kernels this assumptions is not true. Force- > threaded interrupt handlers and spinlocks are not disabling interrupts > and the NAPI hrtimer callback is forced into softirq context which runs > with interrupts enabled as well. > > Chasing all usage sites of __napi_schedule_irqoff() is a whack-a-mole > game so make __napi_schedule_irqoff() invoke __napi_schedule() for > PREEMPT_RT kernels. > > The callers of ____napi_schedule() in the networking core have been > audited and are correct on PREEMPT_RT kernels as well. > > Reported-by: Juri Lelli > Signed-off-by: Sebastian Andrzej Siewior > --- > Alternatively __napi_schedule_irqoff() could be #ifdef'ed out on RT and > an inline provided which invokes __napi_schedule(). > > This was not chosen as it creates #ifdeffery all over the place and with > the proposed solution the code reflects the documentation consistently > and in one obvious place. > > net/core/dev.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/net/core/dev.c b/net/core/dev.c > index 222b1d322c969..febb23708184e 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -6501,11 +6501,18 @@ EXPORT_SYMBOL(napi_schedule_prep); > * __napi_schedule_irqoff - schedule for receive > * @n: entry to schedule > * > - * Variant of __napi_schedule() assuming hard irqs are masked > + * Variant of __napi_schedule() assuming hard irqs are masked. > + * > + * On PREEMPT_RT enabled kernels this maps to __napi_schedule() > + * because the interrupt disabled assumption might not be true > + * due to force-threaded interrupts and spinlock substitution. > */ > void __napi_schedule_irqoff(struct napi_struct *n) > { > - ____napi_schedule(this_cpu_ptr(&softnet_data), n); > + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > + ____napi_schedule(this_cpu_ptr(&softnet_data), n); > + else > + __napi_schedule(n); > } > EXPORT_SYMBOL(__napi_schedule_irqoff); Thanks for the patch! Reviewed-by: Juri Lelli Best, Juri