Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2359597lqp; Sun, 24 Mar 2024 15:38:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKmabpaISl5e0T/Z/baxHwLRvrpVXp5sVzEOJsBqr36aljX4Q6HqaQiYGkq01whCaqvBTDSCmFvN4YyRWgDvdJMP7+TMDaaFNryS1DyA== X-Google-Smtp-Source: AGHT+IFJcnTit7ep47YyWpY2pswbxp374JnKo3refnCwIQitCNCL3AhCMTmQUy8zm9B6oEFs4fNm X-Received: by 2002:a17:906:f892:b0:a47:38c0:fb4e with SMTP id lg18-20020a170906f89200b00a4738c0fb4emr3742838ejb.19.1711319889740; Sun, 24 Mar 2024 15:38:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711319889; cv=pass; d=google.com; s=arc-20160816; b=U+kM/Qv7NSAr3SHVRZaG4SQZPja8ELGxXa0hMD/KkHEHBVAZ5PFR7UFqL59LLkeyXT Yf06CpR7/MaFywEUCXW5GDC/IywsDDWHo5JfTjYXd1fx/ht2Q7F/bxUeYwUrmO3mBMlp LYPYBr1ukPQuZhQw0xBBInY4yswjK1WNVTbBa1MKu+h+lqM7klwQn+dAriTPrrayAf2T P7rIbD9hgJmRKOnPhvTPh8lw8/7iVpi+pCTvF+DYy3fWVwfvp9sBMYLM5zsgMZRBTUOx KvUJvcNeZOBPuew0HQldXevR0QSmOsSKmFUEML8yfcBJMXy8moiKMqHtzJxQoSpdLgXM syNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xEoANxMqff0XZs9eHKEmyMRH9SU/ldQ7/iniAgikJOs=; fh=dNXf8WZojBuHGe9DihhuEDz4FlANXzXqYeahQLxxJcc=; b=kh8KBiIWEkzjNYMJ7we92eEB7pQWDPBD2UlB+070Qb3+mn32v53XI0whIqWhRPJWTD HjAhbguhTfuVZIGlSefCjN9Gt/KsUxzHSnaua23nwwubdK8vXk61sFq54UZtM5lM5vex CacjzNAFWinPCA06bhZmU9nGfSSWAT5fxmXWpOHwSmmICmg1KotPuQYNT8R+N7AhcJiy ViTZzR0MsZ/TD5gJtq3zicq2Yk330i8m/giliUkh+tEKiQfTSAVVpXkT6VnjoFHuJwpb n7KS0lcYTgnY6/gi86QpBFLHVErzpKuqrzNVFhSTsiA5/TXGgzbpy7GQIYGNJn1nKAFs oemg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p0Ya6EQH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112898-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gq16-20020a170906e25000b00a46baa64a43si1922095ejb.815.2024.03.24.15.38.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 15:38:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p0Ya6EQH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112898-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 79A221F215CB for ; Sun, 24 Mar 2024 22:38:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0835446BF; Sun, 24 Mar 2024 22:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p0Ya6EQH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E3F165381B; Sun, 24 Mar 2024 22:35:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319709; cv=none; b=bRm9qiSK1v9UeXx/4cFqz+BBAv6ZOogAc/FKKMb2EEBab9zMrAfJlPz27PJ5cz+4NqIwyvlUs3lAyxapUZO0l2jLWGjyUZOtqE9sqIllsohaBe1XAjm4mnV7eS+Bfcf1CZqPN5SNaDOQBklugxcEluGr/EVbViX2U6NTN3DSGY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319709; c=relaxed/simple; bh=WDc2CdjJwHVoN79rGTJFg+3uVuux82aXT82wcc+F104=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aLEVFuxBMsvWzyo8ExBKDztqrHOlVGuUGiI0sMr4oAL3yv3/vNaOA1JXnqnRYbqU7GZ4WN95NxR+pTIe72dreuQ7p/BvpgkZksG94TO66uP6dgk1JyXzK1los2xjtXktr1QF5MFsyhwWm8bKucED9WdoYu5nrDbqghHq0xjA2vQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p0Ya6EQH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A568FC43399; Sun, 24 Mar 2024 22:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319708; bh=WDc2CdjJwHVoN79rGTJFg+3uVuux82aXT82wcc+F104=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0Ya6EQH2C4Jkol610Y/ZJT/WcZ/g08bzDzgcYVCkuEhINKGGgxg7kt+Kq3mKNzJy 42CfyLVjw0fEI3SSGjlS15jI9G8uUvaLBk8LTdRKTKcrZdIQ3aFgHcb3GxumY2jjnu iiBekV/OL9KahUOdqBkPy9R47uAoGIwXxrOS0xBl8JZD6k7eQm3B4sksK0+Z7SVurf K9K1s9BQmDqfon2MS5aLCgzuyzEGZqC5ae0PP3MPruBlBqkoHpDcTr1Ixo/URCRZ9y dE+BG+Q+45sReCvcs1bmoJovlLlPWkJf6P4xmgmW8UDpva990oHCiNYVTp0/dHW3u4 0A9WZR+JekC2w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tejun Heo , Marek Szyprowski , Nathan Chancellor , Sasha Levin Subject: [PATCH 6.8 011/715] workqueue: Don't call cpumask_test_cpu() with -1 CPU in wq_update_node_max_active() Date: Sun, 24 Mar 2024 18:23:10 -0400 Message-ID: <20240324223455.1342824-12-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Tejun Heo [ Upstream commit 15930da42f8981dc42c19038042947b475b19f47 ] For wq_update_node_max_active(), @off_cpu of -1 indicates that no CPU is going down. The function was incorrectly calling cpumask_test_cpu() with -1 CPU leading to oopses like the following on some archs: Unable to handle kernel paging request at virtual address ffff0002100296e0 .. pc : wq_update_node_max_active+0x50/0x1fc lr : wq_update_node_max_active+0x1f0/0x1fc ... Call trace: wq_update_node_max_active+0x50/0x1fc apply_wqattrs_commit+0xf0/0x114 apply_workqueue_attrs_locked+0x58/0xa0 alloc_workqueue+0x5ac/0x774 workqueue_init_early+0x460/0x540 start_kernel+0x258/0x684 __primary_switched+0xb8/0xc0 Code: 9100a273 35000d01 53067f00 d0016dc1 (f8607a60) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: Attempted to kill the idle task! ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- Fix it. Signed-off-by: Tejun Heo Reported-by: Marek Szyprowski Reported-by: Nathan Chancellor Tested-by: Nathan Chancellor Link: http://lkml.kernel.org/r/91eacde0-df99-4d5c-a980-91046f66e612@samsung.com Fixes: 5797b1c18919 ("workqueue: Implement system-wide nr_active enforcement for unbound workqueues") Signed-off-by: Sasha Levin --- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 4f3425ed62ed9..ed8ebc9776016 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1506,7 +1506,7 @@ static void wq_update_node_max_active(struct workqueue_struct *wq, int off_cpu) lockdep_assert_held(&wq->mutex); - if (!cpumask_test_cpu(off_cpu, effective)) + if (off_cpu >= 0 && !cpumask_test_cpu(off_cpu, effective)) off_cpu = -1; total_cpus = cpumask_weight_and(effective, cpu_online_mask); -- 2.43.0