Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp638951pxv; Thu, 15 Jul 2021 12:10:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyyLEtYemvTeFIAu1iuUrICWvbYNJ9WKZfVGkteciMhDBqvc4LUaMitUU7gLQIe975c/s+ X-Received: by 2002:a05:6402:207b:: with SMTP id bd27mr8974766edb.195.1626376230299; Thu, 15 Jul 2021 12:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376230; cv=none; d=google.com; s=arc-20160816; b=anDkSaKBYT8ATRovo4XveRsceKcxR8ACiG8wBy3zm68RFNVTAhgQAiKgxBpiACN6ev bSa8VJtlcuzGUCc4/t+va7+Cxe2u4xIboIo5qTx9rmqKxPYybvkYmcx9R8DZGdcGWyQB eO/E4/8nwpun2OfadqdfTNbjIsRBI+6grsGxQtmpLifup0B29YgDzeYiCPpSscwCg65H P0l6uizyyFtaU3yiiMDVxt75yWBYMgRbTRWlr7YoZEjSS+UGwuMN+dtg299yF+CbhpA7 ju3Kmoxmmsp1Vj5PDKF8egbOuU3G6v7cSYiXY1WbGYccEh6tb2YHdE5QoCMTVDL30KSK SsNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7mgQ0NJSPl0rv4PU3Xq60z4Ew/GhK6s262DrIjpN8nQ=; b=anRklNmkx9ajR0j0088MWVB/4v9brDR2SggRSV//q2x7yIvgIVZvuwRbkVc8TTEyta S35x7uewDqh/ZGOdOKZca5K5r4ovS5wnLiKTgLF76w5NiLDp0wKp8a1Ebva3zGzptNVq Hl7kCE2D4nzwikOF9wiWynPVAZn+Dlo3pxlf+jo3eiv/Cy4LxZD4lh83ELWTF0xm8MpY prDhYoxspep1qkIgB4pL9YBmCbkgGpYoWZI6nXH1IjOfuc/q4p6SYHyaj2VvwUXsBuFs RjfvlLmGnlAlpssbDqCpmWLSJMswGuHHNZ45aWprzFlVG1vlAHdFBQNOvQN0Mqy+TBqg E0Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z+lbpSM3; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fl21si7587241ejc.563.2021.07.15.12.10.06; Thu, 15 Jul 2021 12:10:30 -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=@linuxfoundation.org header.s=korg header.b=z+lbpSM3; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239838AbhGOTHt (ORCPT + 99 others); Thu, 15 Jul 2021 15:07:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:34514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241795AbhGOS5W (ORCPT ); Thu, 15 Jul 2021 14:57:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B16A9601FE; Thu, 15 Jul 2021 18:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375268; bh=y0gRbwom6AqazrCT6MGLpInasUI5+N6SNnloQPIq5W4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z+lbpSM3oh0e6tsMIv+DRTTsy7aE9vElxN1hBhSRWshZuidy40RbulfRPLFv/B1hR sZi7C1vytGkvtDRndYEahe8jlMqGss3H5cFocfq2Mi20J4G2Y+Mh7AUbLuguWmPAnZ doYpg4KBWXoS+/eCKyJJwDTWJyz48OZPjBO8tANA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juri Lelli , Sebastian Andrzej Siewior , Thomas Gleixner , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 016/242] net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT Date: Thu, 15 Jul 2021 20:36:18 +0200 Message-Id: <20210715182554.605930481@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior [ Upstream commit 8380c81d5c4fced6f4397795a5ae65758272bbfd ] __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 Reviewed-by: Thomas Gleixner Reviewed-by: Juri Lelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 963194474058..a8c89cad1ca4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6472,11 +6472,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); -- 2.30.2