From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 C14B318B0A for ; Wed, 24 Dec 2025 14:47:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766587638; cv=none; b=l9uZqhUPBoiP4UphfSrv+B5cbr7m8rWEO5PGOPZhv0C133+7Juy34lj/HcxKrpmU/OKxY1fG1tzHdQv6Xk7Q+67QAk1i9dhcEIVqQ8i19MYBtWvg73WjFvBITsAAo0NsLp2zxcJxVpsBlCt0uUjfJmo5zhjWvi99DHwFkIpqfyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766587638; c=relaxed/simple; bh=wsDLNVAS4uyBuktyPF0lc55OHNNlmf3jtYNlWLhoTAg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cLxbLBaHQSktbf74PuV65vgXZNJlN+jNlGJtLRaLYIp9xR59caDqGhYzUu3m77x2LjCfjYnGX/ippXLdF7ZRnb0/oWKn2JO2iv/Xxsdl6tmkYSYlEiwzEgV6oXPXGtwENtqCOSs2mIhSsQICyx1IYvMyHVqnmMjpi6VJ2ziB0aw= 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=OQ4OyVu3; arc=none smtp.client-ip=209.85.221.53 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="OQ4OyVu3" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-430f2ee2f00so2920092f8f.3 for ; Wed, 24 Dec 2025 06:47:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1766587635; x=1767192435; 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=4t1E/MiUGXvLFw/kkXL4Czha6KPayCy2brE6GCYi5/M=; b=OQ4OyVu3q/+55t4xBKG94uQ9vVwWahLAbuAC1UavOrexaFgFjVdFFwjQ50qZ0PNXyT zUH7O4rxej6M/KAkGKHZegeMyOGoLP5NI8rGPhoRG/kbgJMP5unxwLu81MOK79jrqS+d aCzOyVv6DRe4qn0gQ0S00Y/P0Dy7Uj/exigpvB51eJjirvpsM+JveAAdRIjkLOxzn2Xc 6U0WNJf0KxrVFiRweTV07/vTkBcqDx1/jFniV9iVSbrltBcVFe2A89lTomdIMTOLdJMM 2dxqfl2Px27o+X2iQgreGjrTmYlaHACwtv57ALv791ULKaC1+bhI42ztbfeMHml7A8sr nDig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766587635; x=1767192435; 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=4t1E/MiUGXvLFw/kkXL4Czha6KPayCy2brE6GCYi5/M=; b=TEb2v/F7B4j2y9aOcQlffjoFTB2F6aiBY07Ese2sFnHeYUy4+TIrxdjO6Ec5v6rYzp 95YtktHwlB9koTltXu381fCjh1lPwx5xYOn6HL49+fRc/loWPYL1kHDS4IP++u7jOJ7u qqHZGWNmY73Gsv73gKfHNQhXhBwQSLARIyd+MwY4YfA2CSI+qilpNKLSCwqv/4XhlUOX VsfJPDg8S/GdkRfmCuJM0fogZh+YUouicnV70tnYUO/jOWQsv8S3NpzZ6bFSexhW8LGd TLIOciKg6Yj00P7HGZcp0zbfcy++hKPN92dlVY12i6BqfOTyzCebIsKD9gvzbCOin4cs 9LrQ== X-Gm-Message-State: AOJu0YzjtdKj0LURUFEPesrSf066ultjAlEfux6K/ZzUas7C7K959XMR HIYDNTHrRkPqvL37k7Ehfcp44o3VjH7vjhS8B2NVU0w81guqSWAKCCto3nbGktxXUWL6r053rZD T9Poa X-Gm-Gg: AY/fxX4VOk3pbhWsQL7SvXldRyZxaZWkXnHirNBc8u38vn/gl1MC2eU6mzwb+aAaszn NE1+hx4SQrp8ZagQbQaivt+iL+E741B6lnmRYk39gfpFuwIpJt+CG/wzPrb207j1ESyC+OkCfEd EBIRB/9VahRjTBZlzDid+HAXWaoh2R4aZlvuQH55BmTP3hywmTMh0ziBmZ72QpiAmD7wzxcQ8jb oKRCjT5+CCEZntz6wOpYR37hILkltMTrUNdchjH7ywYhDbAOmvZx5lzjvPLdhfBzA0HJ24+wtIT l0h8bDo4NAoeMYtBaTmYY0ISFMTwLDswDgJK4AyTwShRKYg5rPoViOXVAiJJumWFQwBA5wbWYsx dB/YnMj2N5qQVX5+HrNSFKrx3JQRpiZcjIfrgCsBnioHsmREiydw/4fjqGiuLdyojjNQWWTGPUQ 9H0gbQwk+X3EIPBpYhI+GWKgkVPSdFm/sznxA= X-Google-Smtp-Source: AGHT+IEKJeulhrpJLgbK9dpob+8IyJ1NCy1xxCMBiGm/xAEDmeBwBfPB175oOr0phJbTC6PTpIqLpw== X-Received: by 2002:adf:fd4d:0:b0:432:586f:2a9d with SMTP id ffacd0b85a97d-432586f2bbdmr11861326f8f.32.1766587634756; Wed, 24 Dec 2025 06:47:14 -0800 (PST) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43277b82a58sm1041109f8f.6.2025.12.24.06.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 06:47:14 -0800 (PST) From: Marco Crivellari To: linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Alex Deucher , Christian Konig , David Airlie , Simona Vetter , Philip Yang Subject: [PATCH v3 0/4] Replace old wq name and add WQ_PERCPU and WQ_UNBOUND to alloc_workqueue users Date: Wed, 24 Dec 2025 15:47:04 +0100 Message-ID: <20251224144708.61167-1-marco.crivellari@suse.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, === Current situation: problems === Let's consider a nohz_full system with isolated CPUs: wq_unbound_cpumask is set to the housekeeping CPUs, for !WQ_UNBOUND the local CPU is selected. This leads to different scenarios if a work item is scheduled on an isolated CPU where "delay" value is 0 or greater then 0: schedule_delayed_work(, 0); This will be handled by __queue_work() that will queue the work item on the current local (isolated) CPU, while: schedule_delayed_work(, 1); Will move the timer on an housekeeping CPU, and schedule the work there. Currently if a user enqueue a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND. This lack of consistency cannot be addressed without refactoring the API. === Recent changes to the WQ API === The following, address the recent changes in the Workqueue API: - commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") - commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") The old workqueues will be removed in a future release cycle. === Introduced Changes by this series === 1) [P 1-2] Replace uses of system_wq and system_unbound_wq system_wq is a per-CPU workqueue, but his name is not clear. system_unbound_wq is to be used when locality is not required. Because these specific workloads have no benefits from a per-cpu wq, both have been replaced with system_dfl_wq. 2) [P 3] WQ_UNBOUND added to alloc_workqueue (amdfk) This change make sure alloc_workqueue in amd/amdfkd is unbound, explicitly adding WQ_UNBOUND to the alloc_workqueue() user. 3) [P 4] WQ_PERCPU added to alloc_workqueue() This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue() to be per-cpu when WQ_UNBOUND has not been specified. Thanks! --- Changes in v3: - improved message commits - rebased on v6.19-rc2 Changes in v2: - system_wq replaced with system_dfl_wq instead of system_percpu_wq, because a per-cpu workload is not strictly needed. - use WQ_UNBOUND instead of WQ_PERCPU, because this workload will benefit from unbound work. - commits log integrated with commits about recent Workqueue API changes. - work rebased on v6.18-rc4 Marco Crivellari (4): drm/amdgpu: replace use of system_unbound_wq with system_dfl_wq drm/amdgpu: replace use of system_wq with system_dfl_wq amd/amdkfd: add WQ_UNBOUND to alloc_workqueue users drm/radeon: add WQ_PERCPU to alloc_workqueue users drivers/gpu/drm/amd/amdgpu/aldebaran.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 3 ++- drivers/gpu/drm/radeon/radeon_display.c | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) -- 2.52.0