From patchwork Tue Jun 23 19:58:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56938C433E0 for ; Tue, 23 Jun 2020 20:57:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 257BC20656 for ; Tue, 23 Jun 2020 20:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945830; bh=eCIISwX8b9C15X9TqAuD6sELfLxLdfmbumORZ1Z8M3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xz6OPZ1m9VzjI7p5e1Dwn88ahkB9Jhf3+kcB/THK/qBGMvrlwL4oWJeUDAZBEYKAc N7EiS0WwgpnvtFhnVSnaBboytjuBs38vb/e0goY2TSDcykv099+sn/vElRniFGlcrw HEDXmsoMTvqju4wutr92Q9ZE+Rrj2YbjZJoTAR50= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388451AbgFWU5I (ORCPT ); Tue, 23 Jun 2020 16:57:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392469AbgFWUm7 (ORCPT ); Tue, 23 Jun 2020 16:42:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5471C218AC; Tue, 23 Jun 2020 20:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944979; bh=eCIISwX8b9C15X9TqAuD6sELfLxLdfmbumORZ1Z8M3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biNzA4/5iNKtLq/mTrEcIqrrBezllO1QUHhcu82qp6j0beJzrotfzbbOnkNjEXVeU 5a1SnF/DJ1x2FsdwofTWFQ7XexiMkvkh1bwTiWyorbQg4lESNEPi+piUsUe8siZUSf mIXti0z4BPt9Dzs3v/tiKnqAHIXIRumOa3qZpOtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Thomas Gleixner , Sasha Levin Subject: [PATCH 4.19 159/206] x86/idt: Keep spurious entries unset in system_vectors Date: Tue, 23 Jun 2020 21:58:07 +0200 Message-Id: <20200623195324.811460432@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195316.864547658@linuxfoundation.org> References: <20200623195316.864547658@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vitaly Kuznetsov [ Upstream commit 1f1fbc70c10e81f70e9fbe2102d439c883269811 ] With commit dc20b2d52653 ("x86/idt: Move interrupt gate initialization to IDT code") non assigned system vectors are also marked as used in 'used_vectors' (now 'system_vectors') bitmap. This makes checks in arch_show_interrupts() whether a particular system vector is allocated to always pass and e.g. 'Hyper-V reenlightenment interrupts' entry always shows up in /proc/interrupts. Another side effect of having all unassigned system vectors marked as used is that irq_matrix_debug_show() will wrongly count them among 'System' vectors. As it is now ensured that alloc_intr_gate() is not called after init, it is possible to leave unused entries in 'system_vectors' unset to fix these issues. Signed-off-by: Vitaly Kuznetsov Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20200428093824.1451532-4-vkuznets@redhat.com Signed-off-by: Sasha Levin --- arch/x86/kernel/idt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c index a7e0e975043fd..e1f9355307b81 100644 --- a/arch/x86/kernel/idt.c +++ b/arch/x86/kernel/idt.c @@ -320,7 +320,11 @@ void __init idt_setup_apic_and_irq_gates(void) #ifdef CONFIG_X86_LOCAL_APIC for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { - set_bit(i, system_vectors); + /* + * Don't set the non assigned system vectors in the + * system_vectors bitmap. Otherwise they show up in + * /proc/interrupts. + */ entry = spurious_entries_start + 8 * (i - FIRST_SYSTEM_VECTOR); set_intr_gate(i, entry); }