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.129.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 09A15246770 for ; Thu, 27 Aug 2026 19:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787859496; cv=none; b=T1cKpD4n3nYUznbDfagY5nRZOOvXej3w1YxtWViHpHYYpo3tnCXJZItQo1sgp28MHOrW42gQ4Nh9tQeY/RCplBEGWuheH4M3dyFlhUX1WEwhX5nfUU7U5EqvgoqG1+xsgjrCL31iaXvJU2JbJWn95GHownOyod6z9eVlwbvXu0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787859496; c=relaxed/simple; bh=Cc+DvbiYY/ooLehhxSq3Bx4qgnUQVzZhgaXdBIvk2yc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D0/jsSRapz188aHQ5rLRXU/eLriw/b+3l8j2SB5y+hZlqgifLlAAVLRKRaxC1lko7YZIbdSShfq6tCq8Hwqbu13cx+tCprj/QNtKLFNqqy1RuNSWEpwYchpALAmHgY3zYEvIWsRBV2zM9vIpw7lH/4tLw1nlspgec1YZGgHrHfM= 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=TuYVqiMq; arc=none smtp.client-ip=170.10.129.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="TuYVqiMq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787859493; 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; bh=Kt0iMpDBFlmiHQAy/q1M3G998Q+sldYNRt9UNMrTIzg=; b=TuYVqiMqV0A5lOlJomytMuJOvKne6/09tPa3HVIW1oUhSldmwt0VffAwsQ1lWv7aX0Sifi B/qyEZF4dufq+YDnYuZHE1Wp/nUGSsHIJQWXLL3oqhO8mZozHrGvQNTtgZVt29pyPcGGLJ ohr2TzXSjMWTgSkpa16pdXjyjFM1gGQ= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-DSgbXbAIMnu3mYMVbwhzjA-1; Thu, 27 Aug 2026 15:38:09 -0400 X-MC-Unique: DSgbXbAIMnu3mYMVbwhzjA-1 X-Mimecast-MFC-AGG-ID: DSgbXbAIMnu3mYMVbwhzjA_1787859488 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 114E91801356; Thu, 27 Aug 2026 19:38:08 +0000 (UTC) Received: from llong-thinkpadp16vgen1.rmtusnh.csb (headnet03.pony-001.prod.iad2.dc.redhat.com [10.2.32.114]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C40F1800640; Thu, 27 Aug 2026 19:38:06 +0000 (UTC) From: Waiman Long To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Saurabh Sengar , Michael Kelley Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH v3] Drivers: hv: Avoid infinite retry loop in init_vp_index() Date: Thu, 27 Aug 2026 15:37:50 -0400 Message-ID: <20260827193750.662623-1-longman@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.111 There is a retry loop in init_vp_index() where the CPUs from a certain node are stripped out if they have already been in the allocated cpumask or not in HK_TYPE_MANAGED_IRQ housekeeping cpumask. If there is no CPU left, the allocated cpumask is ignored and the process is retried again. However, if the HK_TYPE_MANAGED_IRQ housekeeping cpumask turns out not to contain any CPU in that particular node, that will become an infinite retry loop. This particular problem was reported by sashiko [1]. This should rarely happen, but we still need to guard against this. Fix this infinite loop problem by also skipping NUMA node that has no housekeeping CPU in the inner while loop of init_vp_index(). As the outer for loop will only be reached if the housekeeping cpumask isn't empty, a NUMA node with housekeeping CPUs will eventually be found. Link: https://sashiko.dev/#/message/20260422030903.E1BFCC2BCB0%40smtp.kernel.org [1] Fixes: 6640b5df1a38 ("Drivers: hv: vmbus: Don't assign VMbus channel interrupts to isolated CPUs") Signed-off-by: Waiman Long --- drivers/hv/channel_mgmt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 89d214dda360..ed121d74d73f 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -752,6 +752,7 @@ static void init_vp_index(struct vmbus_channel *channel) u32 i, ncpu = num_online_cpus(); cpumask_var_t available_mask; struct cpumask *allocated_mask; + const struct cpumask *node_mask; const struct cpumask *hk_mask = housekeeping_cpumask(HK_TYPE_MANAGED_IRQ); u32 target_cpu; int numa_node; @@ -780,14 +781,16 @@ static void init_vp_index(struct vmbus_channel *channel) next_numa_node_id = 0; continue; } - if (cpumask_empty(cpumask_of_node(numa_node))) + node_mask = cpumask_of_node(numa_node); + if (cpumask_empty(node_mask) || + !cpumask_intersects(node_mask, hk_mask)) continue; break; } allocated_mask = &hv_context.hv_numa_map[numa_node]; retry: - cpumask_xor(available_mask, allocated_mask, cpumask_of_node(numa_node)); + cpumask_xor(available_mask, allocated_mask, node_mask); cpumask_and(available_mask, available_mask, hk_mask); if (cpumask_empty(available_mask)) { -- 2.55.0