From patchwork Mon Jan 16 16:27:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 44263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1286698wrn; Mon, 16 Jan 2023 08:40:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXsneAiqkwWNQ7uz5Ac4P1RDuV7/ZIq+wZtFFBxzF7ZtScgi/u5rMXRVsbA50syjCXDI1Aul X-Received: by 2002:a17:90b:897:b0:226:3a7c:f248 with SMTP id bj23-20020a17090b089700b002263a7cf248mr23422932pjb.24.1673887201253; Mon, 16 Jan 2023 08:40:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673887201; cv=none; d=google.com; s=arc-20160816; b=zprllXZJSHkXbItbmkSmAHFaa60ifB4MDitK/BRva0llxdJpKL2AJuSRQtxPtOgswl QcrOalTGZh32qWkcpMn1+nty1s3EYCs5570Nde0uQI3MbEy+jm+I/HS3xBbwLNN7nZCh DJZDgov9wCTDDCMDRQ18QNI74mvCDrEVWY/gfJl847flO461MzbLKLYCMhfhLIxZCU9W faB3FQF3awMxmxaNMG1YXOOUjzoThcy4NPRdqhs7P3FeXVq6BOKmBfm+szUoueB6psDa seOFlF9sqQivbmH/jwP/a1T/OY8wqvjG68K5HIGpTJmZJMZ+0JK+tnPj9wOaW17gPbDF lDTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=pQQL6K9+g3nFmYTxhhPBdAWY0ZIqAkC6J7tK4XIrDaU=; b=0sk3gwc+xYu0vN8DDySbDU1uJGTT0L49efRlVUaS2RJBIc4yD+/Yw2ZyTXT/SVHyM7 Mfio47DrjX2/0auzpkXtwqlYldSIqiZHXNlEjAN+iWy0jkWKTdDZvaEnmTOtchV3KuVg fkNBEAGLN0yEKNYIGtlYCxHEXzbhvflNXpiGJF++U5bfyumX/Cf5dMPjAAVfnURtV/iE gUfdYrl7oHd/UKByQrarLKkKAiuX+kaE8wL/GHVMYvM85kAS+QVzVFE0htNRLqvquiR4 ECR1iwMlVy4Qv0W+/K1RZJIf3h6EX1H8PFRdHZnWzIIcepiL4XFRDtBVjSDqpOedQsIy DA2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4u6LSUXN; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a17090ad99700b0022915b6dd7asi12082652pjv.145.2023.01.16.08.39.49; Mon, 16 Jan 2023 08:40:01 -0800 (PST) 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=4u6LSUXN; 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 S233631AbjAPQjl (ORCPT + 99 others); Mon, 16 Jan 2023 11:39:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233633AbjAPQjU (ORCPT ); Mon, 16 Jan 2023 11:39:20 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C34452C650; Mon, 16 Jan 2023 08:27:52 -0800 (PST) Date: Mon, 16 Jan 2023 16:27:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673886470; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pQQL6K9+g3nFmYTxhhPBdAWY0ZIqAkC6J7tK4XIrDaU=; b=4u6LSUXNyZSxsGSltzZE00kMT/aUmQ+VxdSsJ4DfrJUjWUwti00Yh60m/MD0HDMhouXc+4 4/jsDYItlUPEgpzN447amyAKlEW3CtjeV/FBzJyq3mMimdh2OXjIK1eQwhvkMvgQl75pqC 3nKQZD+J/1cpDX1IIU/qkt1KAE+YIYCGdze5SE1a56Z0QFnSVOwlhCf6CAilmA4g6dxM25 RP6jsAIP//uumxjvV+vOAamJGuWM61sxOD/d13sgdLpXrkUfu8KvBBIiYhrdZ+7ZQJJyA+ 1Lr6wOYgiRJbrFleUBVOFIgUQFWrlaYzShpXUahw7tpclwTpTMun/bIPKPmTRw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673886470; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pQQL6K9+g3nFmYTxhhPBdAWY0ZIqAkC6J7tK4XIrDaU=; b=sgeWZOaocyIlaAYRTu9ifRlcpmZvVtfxIx7xVVr5adfXPXKlhAl4gx/4lB5+qBfKHpHGU3 Sn4I8c7cqemL0FDg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/i8259: Mark legacy PIC interrupts with IRQ_LEVEL Cc: Baoquan He , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <87mt6rjrra.ffs@tglx> References: <87mt6rjrra.ffs@tglx> MIME-Version: 1.0 Message-ID: <167388646935.4906.13609836242653190947.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755197945544442903?= X-GMAIL-MSGID: =?utf-8?q?1755197945544442903?= The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 5fa55950729d0762a787451dc52862c3f850f859 Gitweb: https://git.kernel.org/tip/5fa55950729d0762a787451dc52862c3f850f859 Author: Thomas Gleixner AuthorDate: Mon, 09 Jan 2023 22:57:13 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 16 Jan 2023 17:24:56 +01:00 x86/i8259: Mark legacy PIC interrupts with IRQ_LEVEL Baoquan reported that after triggering a crash the subsequent crash-kernel fails to boot about half of the time. It triggers a NULL pointer dereference in the periodic tick code. This happens because the legacy timer interrupt (IRQ0) is resent in software which happens in soft interrupt (tasklet) context. In this context get_irq_regs() returns NULL which leads to the NULL pointer dereference. The reason for the resend is a spurious APIC interrupt on the IRQ0 vector which is captured and leads to a resend when the legacy timer interrupt is enabled. This is wrong because the legacy PIC interrupts are level triggered and therefore should never be resent in software, but nothing ever sets the IRQ_LEVEL flag on those interrupts, so the core code does not know about their trigger type. Ensure that IRQ_LEVEL is set when the legacy PCI interrupts are set up. Fixes: a4633adcdbc1 ("[PATCH] genirq: add genirq sw IRQ-retrigger") Reported-by: Baoquan He Signed-off-by: Thomas Gleixner Tested-by: Baoquan He Link: https://lore.kernel.org/r/87mt6rjrra.ffs@tglx --- arch/x86/kernel/i8259.c | 1 + arch/x86/kernel/irqinit.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 3aa5304..4d8aff0 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c @@ -114,6 +114,7 @@ static void make_8259A_irq(unsigned int irq) disable_irq_nosync(irq); io_apic_irqs &= ~(1<init(0); - for (i = 0; i < nr_legacy_irqs(); i++) + for (i = 0; i < nr_legacy_irqs(); i++) { irq_set_chip_and_handler(i, chip, handle_level_irq); + irq_set_status_flags(i, IRQ_LEVEL); + } } void __init init_IRQ(void)