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 0795DC43334 for ; Sun, 5 Jun 2022 13:53:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344266AbiFENx5 (ORCPT ); Sun, 5 Jun 2022 09:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344204AbiFENxg (ORCPT ); Sun, 5 Jun 2022 09:53:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDFCA2BF6; Sun, 5 Jun 2022 06:53:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4433460F9C; Sun, 5 Jun 2022 13:53:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F698C385A5; Sun, 5 Jun 2022 13:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654437213; bh=h4il9NEwlDhRClIoY7hNjlMkV92f7fL2oN4YkoUeJsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mi6RothSZ188jMLN+4Qearm4mJ7zlaQCHJsbQqcJ5BNGqdSFuQ/v/Zja4Kw2j7vLP KL4AvbCQeGIJB6ZDWnu5zPmqyzgUTkOteUEDcOYx/paWHJ4s+AMnxneWlE1e/nyO9+ QmbH+QH0QHPl/Vd8sDAVzC/7LITXuY04ubZH4fXXIm0b7txiTsnBZXLDfh31Yom/xW lVAIPQoBqsL9kGRMidR8FZc4hM7gUVFllVmPGty9E3c8BYHuQZa4LXKavIcwY5bti5 q1EP2D10au7BmHcIw4Lb3aamiBnSkesC9is0q/T7kpvFC0Xxc7RbpMWQ0GG6UADsei i0vEMhpLAl2tw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sebastian Andrzej Siewior , Thomas Gleixner , Sasha Levin Subject: [PATCH MANUALSEL 5.18 5/7] lib/irq_poll: Prevent softirq pending leak in irq_poll_cpu_dead() Date: Sun, 5 Jun 2022 09:53:13 -0400 Message-Id: <20220605135320.61247-5-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220605135320.61247-1-sashal@kernel.org> References: <20220605135320.61247-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior [ Upstream commit 75d8cce128c516fe6cf4b8683e8fe1a59e919902 ] irq_poll_cpu_dead() pulls the blk_cpu_iopoll backlog from the dead CPU and raises the POLL softirq with __raise_softirq_irqoff() on the CPU it is running on. That just sets the bit in the pending softirq mask. This means the handling of the softirq is delayed until the next interrupt or a local_bh_disable/enable() pair. As a consequence the CPU on which this code runs can reach idle with the POLL softirq pending, which triggers a warning in the NOHZ idle code. Add a local_bh_disable/enable() pair around the interrupts disabled section in irq_poll_cpu_dead(). local_bh_enable will handle the pending softirq. [tglx: Massaged changelog and comment] Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/87k0bxgl27.ffs@tglx Signed-off-by: Sasha Levin --- lib/irq_poll.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/irq_poll.c b/lib/irq_poll.c index 2f17b488d58e..2d5329a42105 100644 --- a/lib/irq_poll.c +++ b/lib/irq_poll.c @@ -188,14 +188,18 @@ EXPORT_SYMBOL(irq_poll_init); static int irq_poll_cpu_dead(unsigned int cpu) { /* - * If a CPU goes away, splice its entries to the current CPU - * and trigger a run of the softirq + * If a CPU goes away, splice its entries to the current CPU and + * set the POLL softirq bit. The local_bh_disable()/enable() pair + * ensures that it is handled. Otherwise the current CPU could + * reach idle with the POLL softirq pending. */ + local_bh_disable(); local_irq_disable(); list_splice_init(&per_cpu(blk_cpu_iopoll, cpu), this_cpu_ptr(&blk_cpu_iopoll)); __raise_softirq_irqoff(IRQ_POLL_SOFTIRQ); local_irq_enable(); + local_bh_enable(); return 0; } -- 2.35.1