Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp49595pxj; Wed, 12 May 2021 22:14:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdbnV0BHzKV12lvyfMLLyXLyQ3sWtaNySjFL0w7eiwMsOleEIlMMqbI+xbITLlB8MAnxEF X-Received: by 2002:a05:6e02:1488:: with SMTP id n8mr36602010ilk.158.1620882843797; Wed, 12 May 2021 22:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620882843; cv=none; d=google.com; s=arc-20160816; b=Dep9mwI7CPE6S0twqh78W+QILDUYLJdq0E1ZjDq/dUsNLXw8LH4IN58mqJ/qQhMuCY VEsxKowvY1Qcp3Ab4XDXEluS3yUoEHTqZElDSLRiQdwhwHQxgfILQP95cZrXAWphj8+T l6cffneSkHbKBoj/HACkQ+0BUB5rDXkmA29nHFixpAtZLSF9ptgNM94TE5nHLnm2s60P 46XjHAZGPTF0X90z7XA64pnakoFgg8iegxx2FIWjCfs5VvWKGFXT9/wxwIcEWtt6xUeD b+ouTJma7JpCoTPHocDy+/SiAuL3xiwxcPYagxb9K6mTbOmAxfy9gz0cA489H/pL3NtL iTVw== 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:date:dkim-signature; bh=TcOAwivDbtlARJpFLH0Y1M7raCC9tMpEn3jc2In1UFc=; b=IZ8N2s+zvG9kpHRdnKN0wPidvnfHTvmxd47O0IiLO06Q7WuTOAl/ZPt0k6KdD2EJhj 71uIWOqW5zFr5D90aoeaphNFp//4ocGZ41n8ngdwbFH9kVGG6RZv6AwEXdK0WdILoG6A 7preAsuCuFgraTO5yC99gF/y8aL082k2EJMGKp3AaDR5AzBqq81RRjrj+EvDojp5hCwu K1IbCldfy0fJqzlnwhpCRzDori3TB25yzvYDl/dyGEUjdgoWN3HP1z6a8+XOxUTm6qmU IOHJtJy4HDLOzrzVI80EFY6vjpRMkS3Rw5MCkDP0/znB5moaOjWdTHiU7yQwm/+HckIE L2hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G6OnDE8d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si2510696ilg.93.2021.05.12.22.13.51; Wed, 12 May 2021 22:14:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G6OnDE8d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbhEMFNo (ORCPT + 99 others); Thu, 13 May 2021 01:13:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46422 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbhEMFNm (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=1620882753; 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=G6OnDE8dk/ncnHW5Uju3p//FLcz0QlF60iqC8Io+VMo6R/teLZOaDgDFAodRT8GUDlUOq4 eTjDLhy3KFx/IcDv3a7yhzM6kvxvAjAwdknWpoYE09IC2lDrqTL3aKZBLHhPQo+HgfBrpk hBbaY8VPJSmmFPmlS7vGzzTM0fcbq4I= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-38-5Vy5Dw7JOsighCEIfwMbiw-1; Thu, 13 May 2021 01:12:20 -0400 X-MC-Unique: 5Vy5Dw7JOsighCEIfwMbiw-1 Received: by mail-wm1-f70.google.com with SMTP id g206-20020a1c39d70000b029016ac627fbe9so1183005wma.9 for ; Wed, 12 May 2021 22:12:20 -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=LDknAszNzeMNHPh7UHnAB7D4hU38g+CDkOvZEJtAxyP0vzgdPLpCwkpoV9o30DMKW2 ftYtmfgy1Q0A0zGMpfNtkKVNtj/WTeHU0fnJHB6mnN35Lz2X6A/FmvSRooQxCRMVNM2y swgNlCCZmNHUgTxlaunN3OefyuQtMgsQU1Q22JkNgml8zRkMAUqT83lXTmLXw75g4A5v M20VxKuCDXRIcLd/d2nCrOXvI9s4pNvdpr4fQhl8kOVcRSLMzHJBLvzex2byPh9LIopu gpEMip3sgLDt9g6o/scdmuaDcW1z4TkVtKreEINVNN9bWro8ZM7A3pl7t/5iQ6H99yRV q9EQ== X-Gm-Message-State: AOAM530x/5z2m2ZtVFE2aBFd84K2NEz+l7hVQtvseFRjlhdsaAD/nkjd X+1d6bdY3rga+2598/MWDGErEkOZ3BofMgbPXE7JhcWFJicE5AcBBv6+5jzILCDgnUZf7IjXezj 1nCBCqThZ8itWJ3esvZACnpIt X-Received: by 2002:a05:600c:19cd:: with SMTP id u13mr301610wmq.171.1620882738821; Wed, 12 May 2021 22:12:18 -0700 (PDT) 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-kernel@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