Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp664902lqd; Wed, 24 Apr 2024 13:05:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtpUYf9+EQtm6t+DEIFLBUslZT7UX2Gwh1f6jBZl1EXTvKm8qbYygES5aZWEM3GrHu/WNnSHJTwLLW4aVGa//HXjZ3Pc6QH2KKUig1GQ== X-Google-Smtp-Source: AGHT+IHODfBDnKJm3dj23V4LFhI16iazQMwjRj+9fim01kBaxSBsqbZYv11fH/6nleeH8xKhq7BX X-Received: by 2002:a0c:d643:0:b0:699:419a:fb7 with SMTP id e3-20020a0cd643000000b00699419a0fb7mr3530174qvj.15.1713989135455; Wed, 24 Apr 2024 13:05:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713989135; cv=pass; d=google.com; s=arc-20160816; b=qJ6jksdEy8H/SVHplJGU6sWIiyHMfYiHbPhHRBZUYiYFbsKV8BsXvnt2DfOXLocwyB fNITj7ekkPDpFKFmLSSar2LLLDOpjG/hBCx+01PfSXT+TGokYz7PGhYNkQ31V/x+YXHg h03X5R22wBhGfKgv/I/5rjxVFmXhj3qp/Cjkp18J5+3w254STCha6wPidpzkN6tivS7U Yc4Z4suyznIDE+wP4lZjbbjv10WttJIpxdkpO5tXOA5qNDYGKVfkq56kKzTGqCrqhpOm ADC/USI9WrzFOzsxAL2pGrD1zp86eQaf4FyR0Mcyat5OkNhbVTyA01fHrI26ZIvMJ1/7 OsvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=PjzLpE1/cqs0qycpsxIJJenSTyqFNcqpEmV2e7YahJg=; fh=Xoeq/Ef1M+cxehd/rU6TTb8gm6vaLJpaRVSdfQ3BE0o=; b=UQjvJzCS4X5Aswl0Inj5NVGEuGI4hxFdg+IV/3SaI8vrOaPPjcus9MGl8l4h9DUW3U C4yCs4p/VqixTm6vc+gv15GJXOMD75vbJ3oF2k5eqnPElfWCE28BaPtJNbqLUVG81Zg9 ElW8701VvJb1rDwNXJxMRawVlFzsbCaxoF7jERH9fHvwjBYDfxzDMn4MBspBdcY6Wudy 6dh9z8k3Fcq59fcHc3eesS9k/V8xOCqHwc6n211tabsHmYnFCNtmRCuGTOANFe5fURRp ZlfaDmLNBFD3Zg3rPbsei5V+hvudsDhVnyll//r2H6AF6DJfE63i6XfySY0kc0X/rrgP Mzeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DkF1Gjnk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-157650-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157650-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gm8-20020a056214268800b006993a1f57a3si16731718qvb.151.2024.04.24.13.05.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157650-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DkF1Gjnk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-157650-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157650-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 33C5F1C2266D for ; Wed, 24 Apr 2024 20:05:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECDFF145322; Wed, 24 Apr 2024 20:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DkF1Gjnk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bDEGy2Ay" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BD40143C48; Wed, 24 Apr 2024 20:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713989056; cv=none; b=INEuHoTt+kCJboz0EDsWpRKlCSnrSzY+z7rgrpRiyrwJT7WNYQF5Owpc/ccWxJDDw023YoJp3/kKCPfs+FBQiwtKLitCQOX1dtAICpEHezW5raEO/gk8ETh+pg2ZwQKq/0vILCDN6mA8OAIzLTqesMlbtpdHz3qPEo50O5Domk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713989056; c=relaxed/simple; bh=nRrJjkRg9drFuw+i0mwrXAj2xhqmaRL/Kk4egBHMizk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ssoWMO15h5QlirZuLtgMMhExNSLAuT/miZhNS/6btreeGatIUqcHIBbyPK5VXpYSM8PU2q/ft3zRlIWUz+XeqKEMrzdm5QydCTe16BjHWs+i/Ql/tGhZy6hcNQoPBkOTb//XhTSwjbT5p5GARa21rh+EbYGbYKUeIkVQcoSX0a8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DkF1Gjnk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bDEGy2Ay; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 24 Apr 2024 20:04:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713989048; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PjzLpE1/cqs0qycpsxIJJenSTyqFNcqpEmV2e7YahJg=; b=DkF1GjnkQfEAfVa/kzDCFxHGFIHWlRQPa//jv1BV4Fd9BUxQSyPtzN9bhQJxW07rXOUJQw uaEdMK3LdxjcBFrlDmPoS/D22HWLKeNsSydZoeVENJwpQtQwkq9Skquot+Z9+gb+8X6Pmb ACj6Orhaz9vPjmDbx+kTRyTWVV6e+KqgMENDQLW4im4+2nsFQbuPhUMMykkJFKkSqHjF9a 8AqxzYKvoyNZoiwR7uE8BwH+GyL8NJdAAluWknB74/zNWOfLO1+ut0+rHRwzNIEjR4kSKR VbT7PmJLY9G1oWxzfNBKYm79sZGRtNYPMStfo9IQpI7UfgluLj0u+AAW8YmNPw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713989048; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PjzLpE1/cqs0qycpsxIJJenSTyqFNcqpEmV2e7YahJg=; b=bDEGy2Ayn6wIBxANmbWUNR7zUip48G2aGl6I5ObCw/yWVNzFi3TT2/usSXUqAOzsR0yoFT ZMxvocS3H5nGZvCg== From: "tip-bot2 for Dongli Zhang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] genirq/cpuhotplug: Retry with cpu_online_mask when migration fails Cc: Dongli Zhang , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20240423073413.79625-1-dongli.zhang@oracle.com> References: <20240423073413.79625-1-dongli.zhang@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171398904802.10875.14416916087679634264.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the irq/core branch of tip: Commit-ID: 88d724e2301a69c1ab805cd74fc27aa36ae529e0 Gitweb: https://git.kernel.org/tip/88d724e2301a69c1ab805cd74fc27aa36ae529e0 Author: Dongli Zhang AuthorDate: Tue, 23 Apr 2024 00:34:13 -07:00 Committer: Thomas Gleixner CommitterDate: Wed, 24 Apr 2024 20:42:57 +02:00 genirq/cpuhotplug: Retry with cpu_online_mask when migration fails When a CPU goes offline, the interrupts affine to that CPU are re-configured. Managed interrupts undergo either migration to other CPUs or shutdown if all CPUs listed in the affinity are offline. The migration of managed interrupts is guaranteed on x86 because there are interrupt vectors reserved. Regular interrupts are migrated to a still online CPU in the affinity mask or if there is no online CPU to any online CPU. This works as long as the still online CPUs in the affinity mask have interrupt vectors available, but in case that none of those CPUs has a vector available the migration fails and the device interrupt becomes stale. This is not any different from the case where the affinity mask does not contain any online CPU, but there is no fallback operation for this. Instead of giving up, retry the migration attempt with the online CPU mask if the interrupt is not managed, as managed interrupts cannot be affected by this problem. Signed-off-by: Dongli Zhang Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240423073413.79625-1-dongli.zhang@oracle.com --- kernel/irq/cpuhotplug.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 43340e0..75cadbc 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -130,6 +130,22 @@ static bool migrate_one_irq(struct irq_desc *desc) * CPU. */ err = irq_do_set_affinity(d, affinity, false); + + /* + * If there are online CPUs in the affinity mask, but they have no + * vectors left to make the migration work, try to break the + * affinity by migrating to any online CPU. + */ + if (err == -ENOSPC && !irqd_affinity_is_managed(d) && affinity != cpu_online_mask) { + pr_debug("IRQ%u: set affinity failed for %*pbl, re-try with online CPUs\n", + d->irq, cpumask_pr_args(affinity)); + + affinity = cpu_online_mask; + brokeaff = true; + + err = irq_do_set_affinity(d, affinity, false); + } + if (err) { pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", d->irq, err);