Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp686482pxb; Tue, 12 Apr 2022 10:42:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGSa9FNYl+ctwfR30r9PCyvTeW+yf7vckIyxWCFI6NbvdH0rCZVYzijAEgPO+forfptxGZ X-Received: by 2002:a17:90b:4cc5:b0:1cb:ba0f:9623 with SMTP id nd5-20020a17090b4cc500b001cbba0f9623mr6169979pjb.85.1649785365211; Tue, 12 Apr 2022 10:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649785365; cv=none; d=google.com; s=arc-20160816; b=WijTZvL7UYX4Y8cfwIhi5j566Pe38ya2Yyyv2ne0vr/dVXnchXbZ33wxVgig81OlMz g+DDnM7cNO29cGc3IyqmbbS44YrfaeSd5mpfhXpmE8aKWejBm75Mmhza4xJsrY1JvjE+ 2TqpdCmJHrbgTpbgyrYxnNFYJ6Gbr15vefrIXUaxpA1p9K2Q5Vz6DOqKqQtEWt/d1VEY 5aoF5x03ce6YyMCVjZWHYjDoPDG8IceRx1P3CguZTk4/6UKcq9kjAMKYFeMEmfbwRheH YXGfRXZvHaaluXp3pfDLIyol95dit5HiN/2EKaw1omwRvwCdKKnRux7ZismUW82pXBPw Xc6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=lgNaYQOZDZrYXzopZbAPdhOPlBXFs/fNvReQ9xctjZk=; b=OdUEdOCkmliApfM7koDKoVO9deweOBdjdS3/g5UDPxwb1eCaFfKbfykOp2SmEh5ZX9 XKEmj/zGsmt1NdPBS/7iUsBWTf0Ltj/jj/gGxaM/eEOlL795deeQ5ee2qyaGwEHzU+Ye Xfog76n6VcEORSdVCibVdyuAcBS3dbtA04WpbnGk4n0m0osb9J69AtI/2y6OXk+sNZ+l USkq22kBlYKE/YYxoGuf9W0seicGh+nK7t4lUjrLztk7HAJEF4OX/l4B5mCKkr4pPt0q yjyW35OBSh1xZIO3ASmKe12dfLhgPk0p8j3WT10dhMvexyxNOXKEeG+Q8esb92JByIDR 9V5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=HOL3aJ+6; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a170903244500b001588a10836bsi2389292pls.9.2022.04.12.10.42.28; Tue, 12 Apr 2022 10:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=HOL3aJ+6; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243014AbiDJMvv (ORCPT + 99 others); Sun, 10 Apr 2022 08:51:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbiDJMvt (ORCPT ); Sun, 10 Apr 2022 08:51:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D5C563BD6; Sun, 10 Apr 2022 05:49:38 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649594977; 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=lgNaYQOZDZrYXzopZbAPdhOPlBXFs/fNvReQ9xctjZk=; b=HOL3aJ+6jPVAgjwp2KAXHc8AewtgSbf/UBgjnuXMyhTyavjUhWPP2EjjQ7whqONUW9TeYR c8NS4rwPvOXlFdT9ab3zfE4m7HWhj8iEc7uhBOzSkLCu658ji/endviGmHULRZz0xwwHRj AILf19WdjVa/M3C7AQIRHiXVfj1Yv+dmBtVrDRJZ54TgjUJx0U+VaBDvidwX9k28YJWfgh 8gp6rVehuOvMZuX7dxSLd322yxjCYxcIi+T/iCiHodwfUvJQXDdjbwDgAM6GRGLYuUDbuB bIMA9E0+eB1AO8pUNlj5Pb6XLDPLaYkdDZrlNaUSLKL4q+YrtrzEjwaTS1qSLA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649594977; 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=lgNaYQOZDZrYXzopZbAPdhOPlBXFs/fNvReQ9xctjZk=; b=txJVi4mQU4gdNFwZ/0mv52AODIpImaCKYYSbk7L3SUBW5SyRI+GfBizOeETt3PMI5UN/Qx TfYOabsLucfzc4BA== To: Christoph Hellwig Cc: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Peter Zijlstra , Greg Kroah-Hartman , Andrew Morton Subject: [PATCH V2] lib/irq_poll: Add local_bh_disable() in irq_poll_cpu_dead() In-Reply-To: <87o819glbf.ffs@tglx> References: <87o819glbf.ffs@tglx> Date: Sun, 10 Apr 2022 14:49:36 +0200 Message-ID: <87k0bxgl27.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior 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 --- V2: Updated changelog and comment --- lib/irq_poll.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- 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; }