Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp64909ybp; Thu, 3 Oct 2019 10:13:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwo/A6VKE2R2KNfWLCpSzDRkZWKYul2q5fbHYoIprKdLMt1U7uUzif88i3PKWDeUQub8Q0+ X-Received: by 2002:a17:907:2126:: with SMTP id qo6mr8850599ejb.256.1570122835017; Thu, 03 Oct 2019 10:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570122835; cv=none; d=google.com; s=arc-20160816; b=WD1uIqSybE6QtVP+72ZGMqOw2pSJ/gkQgm1EHJRAGL4soiS8u5d8RCoTMOhKWPy60v EzOvpiwZMw4NYulC8qjmPLbq1dWN00Wekxz9Z+LjCBgcL/2d01P0uM5Trsp+GxFM0L8v iJy+S6oP0JsEcXTxKsevo39+cMBGdx20ir7PhrcxmNvynJq4ztmcT7qGh2PAuxhnUCKb tUZDfqYaCZ4K460QEtVjmGyLH3LL1SKAvQZqecVaoMby+l3OTa6ByqTIFCrHfYc5XsXZ 8wAbE6Mk5T0dWSPvKlh1DikKX+hHcJtY+Y86Z+KpOLYP9Tr817TlsnFHDTEg/W3PoNZ+ w72w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yAMVK8xSPFdqJHy3Ty6kHscyB6OMO0YCDEbj4fgY3qc=; b=zcIwhigY06AA3AIGmPKEu4R6iGIv1u8K6t+qD8GC+C9rE2OTdrvFQ6uBKFCLCfJ/7J mf2uhZuN+FvrCAiU3tN2bGGIHMe4ocvjK62pGdp5HL0L+YbWIfU3sDKnoCP9GXSdm8+I EasIWarDHR1KwP1ZAaGK1hEu3fcyVjbXK0EiwWYDeMywKvmL8d7Xa2ORAS9gB0R6IfS2 QGTKEvrkAWQwsPKuE1tSa3o92eRUaSH7tM8geoay0uPuOhznSswi0HcvjTVdqVGX7uUC +XOsxfat5+WHaLcRJaws40jREsI2SeVIPDvAuW/VH4cez+eVBn4M5a6isPWCNcToZPrw drhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ReGOkp5p; 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 k32si1757848ede.244.2019.10.03.10.13.30; Thu, 03 Oct 2019 10:13:55 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ReGOkp5p; 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 S2404204AbfJCRMC (ORCPT + 99 others); Thu, 3 Oct 2019 13:12:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:37522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391821AbfJCQa6 (ORCPT ); Thu, 3 Oct 2019 12:30:58 -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 F32C42070B; Thu, 3 Oct 2019 16:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120257; bh=CguQhBGjD/VMo7E6gLNngt9pIJo06htO8RE80jx/QE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ReGOkp5pkkQFbzZEeB6zTaU7HvLlg6MV1bo0Hup6Gg6TvP99D7v+HvGAtT6qOt0uG Eb9V+IwtYTr1lwoMBYDIeRR0AbrNdQfvQDy3lHRyQbPCNAwjkYHpt7mPATvskVGRdd GE1J7lpmwyTk/KfN6+iOcQcPrOsUj/0h8sKpbTX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, djuran@redhat.com, Neil Horman , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.2 154/313] x86/apic/vector: Warn when vector space exhaustion breaks affinity Date: Thu, 3 Oct 2019 17:52:12 +0200 Message-Id: <20191003154548.088944970@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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