Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp681089ybv; Fri, 7 Feb 2020 06:38:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxFfnKfZI+bD4tsRDRigFiYv/OOI6xGNK2zgZKxCNjrf3MXXK172v2vIAqUi/WyvJmAB9sN X-Received: by 2002:a05:6830:43:: with SMTP id d3mr3021591otp.259.1581086335117; Fri, 07 Feb 2020 06:38:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581086335; cv=none; d=google.com; s=arc-20160816; b=B5AJ3C4te3QG/BeOFsE80iv3/X7T7c+k4cAZK4AAQNAF7BoWMjoSGcTpeC3NrtTdPM DdkKPuLCmGD+DSinbwMdo3NVkpHlIge/6fSNOAgFaCwpAIcEYyqdZHDY/9uWKXnS8awu ZDenrcswCaBI1aMgKXnf8clYkR+7pMKWTV/r9ZzPMQmXw87uvCA8bX3yd64gaiC1d6bt UmoDQ2HhyuCI0LqOZ3Y+0RwdJX55HG+f1/Bo/hySCzg/OV+wceyZDLjEoNAUhuiqkdbg HsNPM6mCreWcuJud1tyL3mAq0ChAA23bC3HFUhP2S0jBibRCJvtXGQ2WuBUyr/08CUuy c2xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=3CmRXnMR/zdVAveB27n2IHnp1qhNq2kJLxdsqBfRuTk=; b=buXkQM2Pv2zTrxkhfvpquRAzdhqNX8ZjHKJ/dVUN2xg9HqSz4GUzwuix7plWelEYSN JnGV1P4HbJc5b5GkvvgHRaM0rIa96xq/AlYCORQD3ld34VsadBjm9wC23+lcYTvaR64k KqA1hTZBqZz5yQbLzdM3mCmx0xt9i40eGn9LJ9vS7c6zRnTdWDeSKTYiDTPqA1oiqYXp 1/qhPnHk19xiPCTG9iBLykM6zdkpBH2RGcDeO/VagGEmR7eHXt5XS/C94HOJN4aE9cL/ LytLwr1jG16tQKoI1potw0cQnlLApbrslHywdJhfR8RvJB9JjPtFZEwPPB5tn/Qx4gQF yCog== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i23si1623469oto.206.2020.02.07.06.38.43; Fri, 07 Feb 2020 06:38:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727381AbgBGOha (ORCPT + 99 others); Fri, 7 Feb 2020 09:37:30 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:40983 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbgBGOha (ORCPT ); Fri, 7 Feb 2020 09:37:30 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j04l3-0005Ho-QT; Fri, 07 Feb 2020 15:37:25 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 676671C1A0E; Fri, 7 Feb 2020 15:37:25 +0100 (CET) Date: Fri, 07 Feb 2020 14:37:25 -0000 From: "tip-bot2 for Tony W Wang-oc" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/apic: Mask IOAPIC entries when disabling the local APIC Cc: "Tony W Wang-oc" , Thomas Gleixner , x86 , LKML In-Reply-To: <1579076539-7267-1-git-send-email-TonyWWang-oc@zhaoxin.com> References: <1579076539-7267-1-git-send-email-TonyWWang-oc@zhaoxin.com> MIME-Version: 1.0 Message-ID: <158108624517.411.12215803760859503260.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 0f378d73d429d5f73fe2f00be4c9a15dbe9779ee Gitweb: https://git.kernel.org/tip/0f378d73d429d5f73fe2f00be4c9a15dbe9779ee Author: Tony W Wang-oc AuthorDate: Wed, 15 Jan 2020 16:22:19 +08:00 Committer: Thomas Gleixner CommitterDate: Fri, 07 Feb 2020 15:32:16 +01:00 x86/apic: Mask IOAPIC entries when disabling the local APIC When a system suspends, the local APIC is disabled in the suspend sequence, but the IOAPIC is left in the current state. This means unmasked interrupt lines stay unmasked. This is usually the case for IOAPIC pin 9 to which the ACPI interrupt is connected. That means that in suspended state the IOAPIC can respond to an external interrupt, e.g. the wakeup via keyboard/RTC/ACPI, but the interrupt message cannot be handled by the disabled local APIC. As a consequence the Remote IRR bit is set, but the local APIC does not send an EOI to acknowledge it. This causes the affected interrupt line to become stale and the stale Remote IRR bit will cause a hang when __synchronize_hardirq() is invoked for that interrupt line. To prevent this, mask all IOAPIC entries before disabling the local APIC. The resume code already has the unmask operation inside. [ tglx: Massaged changelog ] Signed-off-by: Tony W Wang-oc Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/1579076539-7267-1-git-send-email-TonyWWang-oc@zhaoxin.com --- arch/x86/kernel/apic/apic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 4b0f911..5f973fe 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2639,6 +2639,13 @@ static int lapic_suspend(void) #endif local_irq_save(flags); + + /* + * Mask IOAPIC before disabling the local APIC to prevent stale IRR + * entries on some implementations. + */ + mask_ioapic_entries(); + disable_local_APIC(); irq_remapping_disable();