Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp1083296ima; Wed, 6 Feb 2019 13:26:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IaSLOP9ruUMQxLUCdNkgEaPagKOHLSRJwe4Auu38ilt2eETWco7l9aAhrIWeZOiXQEoj4Fd X-Received: by 2002:a63:e445:: with SMTP id i5mr11543962pgk.307.1549488412556; Wed, 06 Feb 2019 13:26:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549488412; cv=none; d=google.com; s=arc-20160816; b=0dYtJXLEfZ4X5x+4QA683fML4mcPx/fany5yFrJdVXxat5pfwS952KkcQ1L25pI8lW y/H5mPrxgRLseRvEnfE9xIdR2ujhEmZMPLTnXm40/YAQLg9MXFpeFefW+E5kBcMeIkoK G4OLqf9WZcB1mKX7FEu5ICd+EXEPtB03gV6ODUCaoqlHAer7QFU0IBRpto9bccNyNjAq VbBPGWUEIvcNJzqzElfoqtZ4p4higKwPyMXTLvaWYueH7naznywWjmxuIfzh43NJFL2y wPAGbrrQ7qVA1kNv0KMR0KJgv8ubJ+rBtlhujZO2T3iqxyzFUwCYPvMXEDkEuKF15/jY vy7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=JrNw4LMUXoV5bNmzO3Z3kHAxB3IFhhhiN3XDNZOZWk8=; b=SKH3gR0fEVjtA9JKQAI7bVbMJG0z0sUUjhlNbfro4KW96BUyc/0wW5jBUZ4+hRq+9+ NOuJ44oinn4637xO1rB5ozoehDX0YQmS2Tta2chHEzmLMPrfNLC0g8zZaZ7NOKMMnI6M e+vtoQkGCGrVLMvrtOXRFCw6c6CjhpZP0f3KbgfyfJxXGa/4GuUh5bLEyAfHEEpSUkXK wXZ2+X3HbCBhuu/01rSGaU2LMCuIXPo84AooLj72Qq1iRsDiC+MAAaphOXKrOwHKfyal c/t+EqEf0vZ0+sb3hvSX5hlZ2jTe3t7yEnyRI7h8kR+lybB5ioSiK8FZxkcHxAXRDVHw K0eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b13si3088402plm.63.2019.02.06.13.26.37; Wed, 06 Feb 2019 13:26:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbfBFV0Y (ORCPT + 99 others); Wed, 6 Feb 2019 16:26:24 -0500 Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:36914 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfBFV0Y (ORCPT ); Wed, 6 Feb 2019 16:26:24 -0500 Received: from localhost.localdomain (85-76-102-43-nat.elisa-mobile.fi [85.76.102.43]) by emh01.mail.saunalahti.fi (Postfix) with ESMTP id 1C13E20055; Wed, 6 Feb 2019 23:26:21 +0200 (EET) From: Aaro Koskinen To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, tomli@tomli.me, "Rafael J. Wysocki" , Aaro Koskinen Subject: [PATCH] irqchip/i8259: fix shutdown order by moving syscore_ops registration Date: Wed, 6 Feb 2019 23:26:08 +0200 Message-Id: <20190206212608.27189-1-aaro.koskinen@iki.fi> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using cpufreq on Loongson 2F MIPS platform, "poweroff" command gets frequently stuck in syscore_shutdown(). The reason is that i8259A_shutdown() gets called before cpufreq_suspend(), and if we have pending work then irq_work_sync() in cpufreq_dbs_governor_stop() gets stuck forever as we have all interrupts masked already. irq-i8259 is registering syscore_ops using device_initcall(), while cpufreq uses core_initcall(). Fix the shutdown order simply by registering the irq syscore_ops during the early IRQ init instead of using a separate initcall at later stage. Signed-off-by: Aaro Koskinen --- drivers/irqchip/irq-i8259.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c index b0d4aab1a58c..d000870d9b6b 100644 --- a/drivers/irqchip/irq-i8259.c +++ b/drivers/irqchip/irq-i8259.c @@ -225,14 +225,6 @@ static struct syscore_ops i8259_syscore_ops = { .shutdown = i8259A_shutdown, }; -static int __init i8259A_init_sysfs(void) -{ - register_syscore_ops(&i8259_syscore_ops); - return 0; -} - -device_initcall(i8259A_init_sysfs); - static void init_8259A(int auto_eoi) { unsigned long flags; @@ -332,6 +324,7 @@ struct irq_domain * __init __init_i8259_irqs(struct device_node *node) panic("Failed to add i8259 IRQ domain"); setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2); + register_syscore_ops(&i8259_syscore_ops); return domain; } -- 2.17.0