Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp3188949ybj; Mon, 23 Sep 2019 16:35:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRsi8gIAJZzqqT+6KMnH5KePHZjqNzqWZEIEpczyeHqkym7yRlZi6StkUK1GK2kJgBg4B/ X-Received: by 2002:a17:906:3543:: with SMTP id s3mr39898eja.240.1569281758114; Mon, 23 Sep 2019 16:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569281758; cv=none; d=google.com; s=arc-20160816; b=pjFcCydAhwi1mCU0ubf6s10T/Zy4RMfLrGSEAjhZeyi0QOS+js+UsHK/45jwmf2cqL 8Vg0uumdq5CFgt9bT9Yxh1S/pqVED056EvMhblxKfDnKV/EelDcFUr8M+9z24ZkwkQha LsTnmD4Bl1kjaLE8vo9IXbZP9y/OoNpjenpTSHpcXTBe6Id7PbS2gFfroaShDivwOVHV y8EhnMSxtdjhxIOfLpzUWzJ/E+ZDrwBrmQ2QYVoQoS02lyeLS4NKM4ep9H8vOBUdzOR5 T78GzA5FSrLF4WcmnYkkAdU/6tVif6gQI9CpTopCrYEQbDixZVbDdlSc2oJ/ADAGKbWb 72+Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yAMVK8xSPFdqJHy3Ty6kHscyB6OMO0YCDEbj4fgY3qc=; b=a9cIIIFi6yVIzpGmHCBGCGvKKEo28Zkr5S2z0i/dhDtAW7izAtGzV3G4Gx2XaTxRpL Nmnd1D+n41nUYIBDykkyDk5PbPcmdRlGyAB6hZRtb7A0M4w2Fe9ESZR3aTJZ7TMy7bxT +nuGbe54V8RUOV7XNKQggoz5SY2lt+pns7r8Wu6PA5MoCmhPp0niO8qSk1WtKOtW/p62 1PY0Tf6/Mw5puq9hP6keemcKjcJutMmwga+HuM5g1jJWKi4Z1lxnZwpj+SnmT66b+Otg QJws9TRfVXKpg0ay97OllGTUoPgCj7uNngOaRWfWaEmdJ8bQMmzIyTjMo0KeB89Ki0o0 sMfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bpKbgzt3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9si6028046ejh.263.2019.09.23.16.35.34; Mon, 23 Sep 2019 16:35:58 -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=bpKbgzt3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391158AbfIVSrs (ORCPT + 99 others); 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