From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 2EBC92DC77B for ; Tue, 4 Nov 2025 10:48:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762253309; cv=none; b=I16DuR5SyJT0PO4ysUbXtFeKES3+rQgqfuxUy7luaN2RACsNbPSGWhjtGVDczAiXhViH/18CV2Y9qvf2XizDdBiIQ/2KEM8N+mBvQZ6xUn9dizc1Ntm6pErefzN90YWIrGcLHUUCrTBeC0h6rfc5TtKOP6JQdTxkRmVerxDnRQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762253309; c=relaxed/simple; bh=QALkyxUo4vlsaGfb7TqfuSjMRAP6/BbRPtz3U1gFr30=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IxiAcbql7D5Kr+yqmDL4J1Una2n4oUNdnjyk56xZBvwTRNnDu7gzH0VLXZ34yMsYkTxoMhDcHiQKMEl7kkwllAFMlsvb6XFm+NG2h8AvHKvcNj8k6rndnFAaL2TRpYGVkRDng3WxMyKUOtGDwoAbS3gqPmLKjTvsv7kUh1Ai2ok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CAbK5Uym; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CAbK5Uym" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762253307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pEEsV4HzPVCzizcX4X8wBM+UgzVmamMpT+/hNG5roFo=; b=CAbK5Uym4KMVqi8caITuzx3S8kydhGUaxuSibdDy7KW8I/41qrbpOzj6iIRIqadPhPWrCQ 0/FLeJGboV8NZ1FKj2C2TdkOvB8y5DcwFE+msburkU3BEbvG0TelbllP07CO1BcOwg7B5i M9g0Yk6bDEszjCa5i+3Nsh/nXb95t9A= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134--wmmJW3ZPGytBxy2P06TFA-1; Tue, 04 Nov 2025 05:48:25 -0500 X-MC-Unique: -wmmJW3ZPGytBxy2P06TFA-1 X-Mimecast-MFC-AGG-ID: -wmmJW3ZPGytBxy2P06TFA_1762253304 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CFEAA195608F; Tue, 4 Nov 2025 10:48:24 +0000 (UTC) Received: from eda-pc.redhat.com (unknown [10.45.224.83]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2258918004D8; Tue, 4 Nov 2025 10:48:21 +0000 (UTC) From: Gabriele Monaco To: linux-kernel@vger.kernel.org, Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Waiman Long Cc: Gabriele Monaco , Waiman Long Subject: [PATCH v14 5/7] sched/isolation: Force housekeeping if isolcpus and nohz_full don't leave any Date: Tue, 4 Nov 2025 11:47:37 +0100 Message-ID: <20251104104740.70512-6-gmonaco@redhat.com> In-Reply-To: <20251104104740.70512-1-gmonaco@redhat.com> References: <20251104104740.70512-1-gmonaco@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Currently the user can set up isolcpus and nohz_full in such a way that leaves no housekeeping CPU (i.e. no CPU that is neither domain isolated nor nohz full). This can be a problem for other subsystems (e.g. the timer wheel imgration). Prevent this configuration by invalidating the last setting in case the union of isolcpus (domain) and nohz_full covers all CPUs. Reviewed-by: Waiman Long Reviewed-by: Frederic Weisbecker Signed-off-by: Gabriele Monaco --- kernel/sched/isolation.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index a4cf17b1fab06..3ad0d6df6a0a2 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -167,6 +167,29 @@ static int __init housekeeping_setup(char *str, unsigned long flags) } } + /* + * Check the combination of nohz_full and isolcpus=domain, + * necessary to avoid problems with the timer migration + * hierarchy. managed_irq is ignored by this check since it + * isn't considered in the timer migration logic. + */ + iter_flags = housekeeping.flags & (HK_FLAG_KERNEL_NOISE | HK_FLAG_DOMAIN); + type = find_first_bit(&iter_flags, HK_TYPE_MAX); + /* + * Pass the check if none of these flags were previously set or + * are not in the current selection. + */ + iter_flags = flags & (HK_FLAG_KERNEL_NOISE | HK_FLAG_DOMAIN); + first_cpu = (type == HK_TYPE_MAX || !iter_flags) ? 0 : + cpumask_first_and_and(cpu_present_mask, + housekeeping_staging, housekeeping.cpumasks[type]); + if (first_cpu >= min(nr_cpu_ids, setup_max_cpus)) { + pr_warn("Housekeeping: must include one present CPU " + "neither in nohz_full= nor in isolcpus=domain, " + "ignoring setting %s\n", str); + goto free_housekeeping_staging; + } + iter_flags = flags & ~housekeeping.flags; for_each_set_bit(type, &iter_flags, HK_TYPE_MAX) -- 2.43.0