From mboxrd@z Thu Jan 1 00:00:00 1970 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.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 5BBD2C49ED7 for ; Sun, 22 Sep 2019 18:47:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A45921A4C for ; Sun, 22 Sep 2019 18:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178069; bh=CguQhBGjD/VMo7E6gLNngt9pIJo06htO8RE80jx/QE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZnPZwuEYaao8BIofFbU/HH4Zx0NEM/GqMqY0bDZH7bIGcV17tuaZgM5wEC/+28Iq7 syvJXGDqd0R6FCrxnPTgxC+dCWHDaTBgHpW2phNdK88uqBPVJ7LYf1d2wCnWYAU2oD Gr0DOVn5RuVLI7oPe7F8Eg+rUTuWKjuETAaWEoVM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391169AbfIVSrs (ORCPT ); Sun, 22 Sep 2019 14:47:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:44192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391097AbfIVSrm (ORCPT ); Sun, 22 Sep 2019 14:47:42 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C36B21907; Sun, 22 Sep 2019 18:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178062; bh=CguQhBGjD/VMo7E6gLNngt9pIJo06htO8RE80jx/QE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpKbgzt3vnk8vq7LM6DzNRKNgRMxWK92256XcwFc04MWxbmr0mZ2HFfq+9tZgPmks WJnkgc75jtsDHGVKE0gwauroYoHYJmaRnTPmL9CmLHpGOCXAyCvCHvEovBV8+ET4bN Zkm+o+b6dQeh+Q1ntd1dw4CNRgdsXjVLx5qHBJj0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Neil Horman , djuran@redhat.com, Thomas Gleixner , Sasha Levin Subject: [PATCH AUTOSEL 5.3 137/203] x86/apic/vector: Warn when vector space exhaustion breaks affinity Date: Sun, 22 Sep 2019 14:42:43 -0400 Message-Id: <20190922184350.30563-137-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184350.30563-1-sashal@kernel.org> References: <20190922184350.30563-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Neil Horman [ Upstream commit 743dac494d61d991967ebcfab92e4f80dc7583b3 ] On x86, CPUs are limited in the number of interrupts they can have affined to them as they only support 256 interrupt vectors per CPU. 32 vectors are reserved for the CPU and the kernel reserves another 22 for internal purposes. That leaves 202 vectors for assignement to devices. When an interrupt is set up or the affinity is changed by the kernel or the administrator, the vector assignment code attempts to honor the requested affinity mask. If the vector space on the CPUs in that affinity mask is exhausted the code falls back to a wider set of CPUs and assigns a vector on a CPU outside of the requested affinity mask silently. While the effective affinity is reflected in the corresponding /proc/irq/$N/effective_affinity* files the silent breakage of the requested affinity can lead to unexpected behaviour for administrators. Add a pr_warn() when this happens so that adminstrators get at least informed about it in the syslog. [ tglx: Massaged changelog and made the pr_warn() more informative ] Reported-by: djuran@redhat.com Signed-off-by: Neil Horman Signed-off-by: Thomas Gleixner Tested-by: djuran@redhat.com Link: https://lkml.kernel.org/r/20190822143421.9535-1-nhorman@tuxdriver.com Signed-off-by: Sasha Levin --- arch/x86/kernel/apic/vector.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index fdacb864c3dd4..2c5676b0a6e7f 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -398,6 +398,17 @@ static int activate_reserved(struct irq_data *irqd) if (!irqd_can_reserve(irqd)) apicd->can_reserve = false; } + + /* + * Check to ensure that the effective affinity mask is a subset + * the user supplied affinity mask, and warn the user if it is not + */ + if (!cpumask_subset(irq_data_get_effective_affinity_mask(irqd), + irq_data_get_affinity_mask(irqd))) { + pr_warn("irq %u: Affinity broken due to vector space exhaustion.\n", + irqd->irq); + } + return ret; } -- 2.20.1