From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5E31A6801 for ; Fri, 29 May 2026 13:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780060018; cv=none; b=TIC8Ec4Hhj2n8wE+ZEXpWqXQLEQawaGHzl/7F4Libt2xsp0jP0TpuVPcFslTAoobWZuNP9zMS6bsXKzrKklDjcOn+LGV5T41uRVxzPXWgqzFqKnpxiMDT4v1q1EJtUyeYT+CMhhYlVjzq0QTwITYpnBYGnc6JvI63MxS+DT5R2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780060018; c=relaxed/simple; bh=LTZky/BodxusmyN6Oe66ZMg+2i5GN5lP899FwGaOme0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SC0qtdwqKAYO5yOwaudB3ip9RyQLudqBDdOtJ8IhlGRB3EHZS+Zkv1Kf2KcsU0RAdq49cT9nNIPR9WnFuN7J34jeUYm1fFBXI9rE+P96lKZzvVrR6iH42VIdu9LOwzmt6D4TbRlwfIFic2rsanFKYmcvvZqRarBmgVTsnV8pHJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Vj+REwFd; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Vj+REwFd" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-45e8a834cc2so8613190f8f.1 for ; Fri, 29 May 2026 06:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780060015; x=1780664815; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jXWphrK5Cqbi1UwQ6FIlaRHFztaNym58hSLNluxMQRY=; b=Vj+REwFdz6ccyJYmSSnWma0JQhhN7PU/e9DMf4Tl9DgKTxbtu5yBzbeVvoy4T/5Dg7 z8HUqEuxXIFrbGe8udrZNdJ/ADPdL9KcxOAuC82Xe/ifyH8oZqCxbJmoEc0e5oKgtbjG uvy6Oim9UHbVaXDMDRtwoqv77+yCaV8UvhnMHqqidvCFXQqJ77G6375s4w83IpM3FYx5 z7b+ivHUhHVqt2kWHheQfRijOle6cOxUX/8WwfZHwBTb8zyfJyMHnaydq6CHJpRFb0/i cuOqm62a3L/98DMwxydmoq7A2UnoJVqW+4likw2If0HzHUVFHex+bPGmaeUDOEoVKgqQ rrTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780060015; x=1780664815; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jXWphrK5Cqbi1UwQ6FIlaRHFztaNym58hSLNluxMQRY=; b=lYvvp6lkOipLocBN00YgxmK3JNwL98BaH4QghZrFBPKKR0hkzY9L5Uns7Bi29j7PNk gdmcI1YsrnzYSy7t6S3D33hMQB+AK3AiIJbTRDEol7aWZFiWl2n5T7S8gvXTbYqx3+tI +r6jASZog4X1rl548A8Qq1Eqr6lEnMWfG06gxl2W2N2Ed1HUScL8IO3DbtsKiwIH/4t+ yJYPbde/deifiO08T1iZ2bnznM9kiLGQWRNmJdlqS5GkyuzikKidT++4BMgfg+Zx6z8t h5RQrcQz4E2CozjhtRJMA0aRiyz1PgehfD1jTJEgdERyEk/v7fI+rvLftf1R8M8I/iZO Jf8g== X-Gm-Message-State: AOJu0YwxSpavvkbC40rfEt4RmCIzufORIIGTB0V1QPMP14m0E2fiIDFG 0KNZSjNznqiTespqnGQJPyPMy8zcSu+nj0e9U6E3jXYQ+L34rUXH7vBBB8qdCidn/J1WF2O6ndd PEljcYH4= X-Gm-Gg: Acq92OF/l0sLKYTP1znu9/Vu8mlTRWhAS8HsQHzxVpD68wGRdAyh4+OPCU62nNuQcw4 jt1dFLvWRMhjEBRcQTTPkhQ7HKrtPlnZGWU4P522R609dX62Qqomt1PgROnkpB5ieMz8cMJePlZ wrF9xMFQvOepnDhWN+1BqlyWlFTG25H5T6YE0mPP1Wlr4abrqbke66iCZMSuhUQDCoiP8sSKIcG wCGRbrfvmaS5uXIr8Bhl+kU1aEByNN1hGz4LYGUuSSntQy947GvJi3440JmgiAOYIYaPB+Y61Yw VAAIGVeJfU2PxAqEUgElk22l+0OAiuZIsU5hIw+TZTC0mvKbfJh+aEtaQykCzevw/qnFrcjsoLr u+/1Oig7SGbWlXQ1qtuzIsL7oeS7HbPouKLiA5iFDL0cayUtBvAph694VERrvRN742UHws/5Ay9 BYMyqN+28/tLcvnqndbiv2qoCjzBG/EsfekRr+nztJiAFK0sOXaw== X-Received: by 2002:a05:6000:250e:b0:453:f951:4e5b with SMTP id ffacd0b85a97d-45ef141afc1mr6006767f8f.13.1780060015582; Fri, 29 May 2026 06:06:55 -0700 (PDT) Received: from linux.fritz.box ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45ef34a037fsm3408549f8f.4.2026.05.29.06.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 06:06:55 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Breno Leitao Subject: [PATCH v4 0/2] workqueue: Add warnings and check WQ flags usage Date: Fri, 29 May 2026 15:06:38 +0200 Message-ID: <20260529130640.220328-1-marco.crivellari@suse.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, Currently system_wq and system_unbound_wq can still be used and no message is printed. To avoid further use of them, add a warning. The detection of deprecated workqueue is done using a new internal flag, called __WQ_DEPRECATED. Similar scenario for WQ_PERCPU and WQ_UNBOUND. Currently there are still users that use alloc_workqueue(,0,). To avoid such situations, a couple of checks have been added: - if neither of the flag is present, set WQ_PERCPU - if both are present, remove WQ_PERCPU Along with these, WARN_ONCE() is used. Thanks! Marco Crivellari (2): workqueue: Add warnings and fallback if system_{unbound}_wq is used workqueue: Add warnings and ensure one among WQ_PERCPU or WQ_UNBOUND is present include/linux/workqueue.h | 1 + kernel/workqueue.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) --- Changes in v4: - P2: instead of pr_warn_once() use WARN_ONCE() Link to v3: https://lore.kernel.org/all/20260528160159.471265-1-marco.crivellari@suse.com/ Changes in v3: - system_wq / system_unbond_wq not routed to the newer. The warnings have been simpliified keeping only one of them inside __queue_work() printing the work function. - the deprecated status is detected using a new internal flag, called __WQ_DEPRECATED. Link to v2: https://lore.kernel.org/all/20260526150041.365392-1-marco.crivellari@suse.com/ Changes in v2: - rebased on v7.1-rc5 - fixed typo in the text - cleared WQ_PERCPU when wq_pwer_efficient flag is set, to avoid triggering a warning - if statement to route old workqueue to newer also added in queue_rcu_work() Link to v1: https://lore.kernel.org/all/20260514092354.125149-1-marco.crivellari@suse.com/ -- 2.54.0