Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp911599ybi; Tue, 16 Jul 2019 07:01:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw546Taw0HWuU6bapmJs29eOoLjbAqJLPN144fZnO0TxsgnufOUl0g0N5F/T4hBRVlSqJzL X-Received: by 2002:a65:60d3:: with SMTP id r19mr8821969pgv.91.1563285670799; Tue, 16 Jul 2019 07:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563285670; cv=none; d=google.com; s=arc-20160816; b=v9eymYDhtJkMDnQMGVIeSnG9dCd8cZZoR20l+71Upe/R4Owb5tombwI8Pm6JsRHTbK Ee43uuTiNFqGaQxu3smKlBpDVT23jQKWLEOFZWx/xYPdGw9XrfKSz52PrD1O0P1XNyet TNBhgOTY9JH3lJzSqDOPvUOv7twFa+RIxr3/Bzk+jnsMa22TkMcDhIDpfNhxV1YskD0T Aq0jUsidz09YKIzR31aBdbZy/xMmQXB5v+4qC7Emf5JXC1/mMa2KRwj/BJER5hAbAoW4 K/XiAGag9x+5o296LTW9XgZRVqN78H6KWAcGgDrkb3v3NS6WFqXnGawsHKZdpa5HkNg7 rB0Q== 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:mime-version :message-id:date:subject:cc:to:from; bh=JqeeP29HvkLeNyM3BG8n9jTfybX+lz31KQ0roSqveUQ=; b=DbH6J2CvtvMpKDTVg++GCUQiTwrAQ+Dj7I1L23yoak/s2N1Qrf5f/CQ+Wj/5M09eKM ynLEddahkoS0cTLLUzfQupMYgjRIXx45Yi1Q/w2N+W83buUh7zhKOesjf7z/e7baCLpF tmnhQreve6grfUxCSXD2Ws2GBO5jGVai34BI/TPVAs9h1WcXjce/XuUOGdQM0t6T3BSJ CFRiGxVUaQjamFqxxYAGEx9J9DUX/Usf6DnMWn7bfGVHDh/3KVNl1fRyFoUEB2eitKFQ 8HMCgp1DorB2vLRcBMKwY5YAiVKr0T3sz9DHKZkWG9WkVJfAsh5h6Brz4odw41oftQsK cWJg== 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 f32si19058972pje.70.2019.07.16.07.00.53; Tue, 16 Jul 2019 07:01:10 -0700 (PDT) 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 S2387800AbfGPN7y (ORCPT + 99 others); Tue, 16 Jul 2019 09:59:54 -0400 Received: from charlotte.tuxdriver.com ([70.61.120.58]:39016 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387782AbfGPN7x (ORCPT ); Tue, 16 Jul 2019 09:59:53 -0400 Received: from cpe-2606-a000-111b-405a-0-0-0-162e.dyn6.twc.com ([2606:a000:111b:405a::162e] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1hnNzg-0000nK-29; Tue, 16 Jul 2019 09:59:50 -0400 From: Neil Horman To: linux-kernel@vger.kernel.org Cc: Neil Horman , djuran@redhat.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org Subject: [PATCH] x86: Add irq spillover warning Date: Tue, 16 Jul 2019 09:59:17 -0400 Message-Id: <20190716135917.15525-1-nhorman@tuxdriver.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.9 (--) X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Intel hardware, cpus are limited in the number of irqs they can have affined to them (currently 240), based on section 10.5.2 of: https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf If a cpu has more than this number of interrupts affined to it, they will spill over to other cpus, which potentially may be outside of their affinity mask. Given that this might cause unexpected behavior on performance sensitive systems, warn the user should this condition occur so that corrective action can be taken Signed-off-by: Neil Horman Reported-by: djuran@redhat.com CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: x86@kernel.org --- arch/x86/kernel/irq.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 9b68b5b00ac9..ac7ed32de3d5 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -244,6 +244,14 @@ __visible unsigned int __irq_entry do_IRQ(struct pt_regs *regs) desc = __this_cpu_read(vector_irq[vector]); + /* + * Intel processors are limited in the number of irqs they can address. If we affine + * too many irqs to a given cpu, they can silently spill to another cpu outside of + * their affinity mask. Warn the user when this occurs + */ + if (unlikely(!cpumask_test_cpu(smp_processor_id(), &desc->irq_common_data.affinity))) + pr_emerg_ratelimited("%s: %d.%d handled outside of affinity mask\n"); + if (!handle_irq(desc, regs)) { ack_APIC_irq(); -- 2.21.0