From nobody Sun Dec 14 23:24:50 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 855D7217F2E for ; Thu, 6 Nov 2025 15:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762444725; cv=none; b=J01Vr0xBSXKB1Hv1ten1IbHl8QnbwP4ae0Oij12whAHLcvo2XPki2P+qXTGb/xBWKNTpOEv2WMzZhtGP9K9whhtSfnVSnmW4HLM0VfErwpREZ5hrBsiUwGcd/4BEjjBCNhukqOCW7cCugE6qwkw4imG+cMTMRwUZ56RCnlYXNAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762444725; c=relaxed/simple; bh=hQvedwNnbNGqs2P7mPVC6w/cg/PsfhX8mSlzj6QVXUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sIv642qZ+4ID34KfnkNzc0PtG5fOvH+eG9vddW35c/m+yYnsYH54zm0ra/wxc4M429YApeho9l2LY5O9RNA7PBAKkxcP0eObMeMjt2YelF5/edW94YLU89D6446ediN4vxMc6+cNUrm0TQs6lKqubWjzs07fZQfuqjbQWBSzTdg= 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=TVDREkOD; arc=none smtp.client-ip=209.85.128.51 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="TVDREkOD" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-47755de027eso8848745e9.0 for ; Thu, 06 Nov 2025 07:58:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1762444721; x=1763049521; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vTKQ/9KgyAcLZI3pm3L05sC2QlXoOYBGo9f5Rvs6qdU=; b=TVDREkODhHOpI1aGAXiB34m+SD7HZcFuaLCFvcIzqZWCyXKi8xSPrMoSL8gm3ZC67k J0yPrE6QTU+WlQMr35YAC8TI7fTAhds/K1ziGsvI4g/t24hQ+A1mW3nW0jhyA7PHxcA+ 7fvkZQ9H7YhO5uJMp9nTxemCcxsewjlPH0/xlm//QLrg+zxCKs3IUMeQrjnHOTlHInRz IcQA9uzMPnz0in4xceu/hKViXULJNUHGLgdPcUWNcZO98/fUSCNg3VtS4yuFE3+MkX14 6T61h4NuTSQTSY+USwpCT+BucBdcGOndGkPrrNYTE7Y5mHSZ4e2GZTQHTBFO/2xx00Hj 5EHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762444721; x=1763049521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vTKQ/9KgyAcLZI3pm3L05sC2QlXoOYBGo9f5Rvs6qdU=; b=toP9sKHVNQxxscCZ/6qwFikD7CtQtXQl08oOUYP/YqgbNvp282QZVLJw8UsQywfY5l H2S5KLZEIFOklKh402L3/BI2oyW+L6iZ4sVgAq1TJo+h0YEKq3GTiYL1KPzARr/rzw2U Dyucks28A6DF5gS0YuZNUkBYX3+K17v5IIswiTGXh8UicI/7dnmN1gXLODlKRjXcdtMW VOdvve98eCOJfDlCyrFagNHFn9hQ8XbodCypm49zjzcABLEfC4OS0GXV99YCvJhISlrx d1iH9mWNT7bIsf5HV62dFCzus3uVUwKw1sbkph8ZpYlxdAT8hhN4iFjv4Gd9X/UYs8aN yDdw== X-Gm-Message-State: AOJu0YyjkJZ4XMD78yhBt5aljNW3l6l6PT+Zs4PIhYTjWyE3dOu4m35V laJn/yR4SdCOKfmMTxFM2qRmUHiLq6wmcrTrGZzKIV4hFlLjFhzQzDufr3MB4wH843sckX/JEg1 k0447 X-Gm-Gg: ASbGnctGXwJP82Jy3HxIIvFyYPytBw/YUYubWkQDuRN/Yj9+HhT+4ppb3m9kW/MCJ3u x2H6f238V2FnQZJ+P3C412iYSpPJWanK21mzGh36KwXTmvTsme5ulMvPDfNGxIsMDL7ivJxg833 MR879901B9nKIx/gO2I/SKwg8GlJMxeu5ZA8KxbHcqLsy+vw2kHm41jlPpQww2b7WnJ8xv1VNxN n45jxfDjflRFSXJ3rtd0wCv84foJy2VtPqhruLJjCesz6UY8WRyTd3DwYrvNle7deLpoeuMmj48 3/8MSuzsYi/cx2dMngm9AaPC+4+bgVz5KqntsJfogTlQC2D3VOVXaUaGva+QuY0i7HhG2v7EcoB 7OUOye3T3MKL83kKOVf2kOI2bCwbLxoZSoyI6w7JMWaA2M0wW0/3vCkXqLB+k+btKGHDCURzaXt cWir3kJilGkla2r1b3kjMICFQ= X-Google-Smtp-Source: AGHT+IFMnkLTlhStdnpadBpL2HuGw+mkAPiYvwVjt6jcTNz2UFYHeUrdQTK+BluDsXkk7abaXQWnhg== X-Received: by 2002:a05:6000:420c:b0:429:cc5f:68a7 with SMTP id ffacd0b85a97d-429e330b919mr7123146f8f.44.1762444721404; Thu, 06 Nov 2025 07:58:41 -0800 (PST) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb403793sm5758966f8f.2.2025.11.06.07.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Nov 2025 07:58:40 -0800 (PST) From: Marco Crivellari To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko Subject: [PATCH 1/2] xen/events: replace use of system_wq with system_percpu_wq Date: Thu, 6 Nov 2025 16:58:30 +0100 Message-ID: <20251106155831.306248-2-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251106155831.306248-1-marco.crivellari@suse.com> References: <20251106155831.306248-1-marco.crivellari@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently if a user enqueues 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. This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") Switch to using system_percpu_wq because system_wq is going away as part of a workqueue restructuring. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari --- drivers/xen/events/events_base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_b= ase.c index 9478fae014e5..663df17776fd 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -581,7 +581,7 @@ static void lateeoi_list_add(struct irq_info *info) eoi_list); if (!elem || info->eoi_time < elem->eoi_time) { list_add(&info->eoi_list, &eoi->eoi_list); - mod_delayed_work_on(info->eoi_cpu, system_wq, + mod_delayed_work_on(info->eoi_cpu, system_percpu_wq, &eoi->delayed, delay); } else { list_for_each_entry_reverse(elem, &eoi->eoi_list, eoi_list) { @@ -666,7 +666,7 @@ static void xen_irq_lateeoi_worker(struct work_struct *= work) break; =20 if (now < info->eoi_time) { - mod_delayed_work_on(info->eoi_cpu, system_wq, + mod_delayed_work_on(info->eoi_cpu, system_percpu_wq, &eoi->delayed, info->eoi_time - now); break; @@ -782,7 +782,7 @@ static void xen_free_irq(struct irq_info *info) =20 WARN_ON(info->refcnt > 0); =20 - queue_rcu_work(system_wq, &info->rwork); + queue_rcu_work(system_percpu_wq, &info->rwork); } =20 /* Not called for lateeoi events. */ --=20 2.51.1 From nobody Sun Dec 14 23:24:50 2025 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 5C7AD26529A for ; Thu, 6 Nov 2025 15:58:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762444726; cv=none; b=lm5ADJgIMO5wUGnMOtGpRuOVXHvGhuruxWKmxOIneMJViGubGvXkN2xMukiNWhmR+jh31WvqxanBYFtua5Qz7hl/C2BTJ8f+/8iZj8YgyrWYpR5bDLCvwWw9aCXbR6d1SdDN4Kck1Aw/J7+NgVxI+/4JUD5SFBTBjqFobzLIUf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762444726; c=relaxed/simple; bh=yJwCZuSyp0AuHoYgUuuf5DA1yb3KZTt+mYtDCkhDEvA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rYx+anFVw/5xQlFSdFxc7O0OlZlqhIAJ/RCrzwVYu4YV9pB506YtI/RYwgiykuj7xURFqceHS12GkAkuip4f23rEdOi4LATCrrH+8MoTn09y1g03WZEhBjaZRuWUYJ900Dl8j8bKlKfgcBEBevrCayq+pEtn5nKZWpsgZVgwsB8= 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=WCfUAOA+; arc=none smtp.client-ip=209.85.128.47 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="WCfUAOA+" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4710a1f9e4cso9151685e9.0 for ; Thu, 06 Nov 2025 07:58:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1762444722; x=1763049522; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=53hexOkYyaqxhpOSn/nthNa2oVXwHIV4I+WyLFdMY9Y=; b=WCfUAOA+3WzBgQtCTK4wBW2N16++aTOVs0ZUrtLZDcJiDllaWqZ9Lw7J46r+/NOM6m H5CBTxrU8DNG8iNnwZgXPYyM5/mUPDhFjInhYstDICKhNOQYCzSzeyEg4JS+Z1uHUxt7 pB2zFM98bUa2t4zEsuKrtFxwEkQ6PQt+f1ZFfH4tUhNcp6uArdlr4O1geMCuj8PTgTfO +3vzM0Zz/aMwfkxFA0PxdGiS8kQrPveFxtOeICI5NpigGjrYqsb+Zw8NP9+40aUvAEmr GLpInDNryu7IHkQkJhoSKHTVUaxTXD7y9OG277zfXxi0qfk2fOTKx6UilcQdEgzTb7/i mifg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762444722; x=1763049522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=53hexOkYyaqxhpOSn/nthNa2oVXwHIV4I+WyLFdMY9Y=; b=ax7eAGYbwRSBAQYFnswVbGEiwHj4CpJA6IjOBBLXOs87UyBq8DYuBK9SdKgHMSwMX1 xI/Y8lLIF4hOaU4jf6R5FR9ZG/IkJXWu7WvbmM8lQjGmSYuxCk5r3SegpVtRVM/uJkOF /9LwcsA/HBdvrTs74CqGfeDbskgZgFtz8tjvco3WyWbBZoQY9tQj/ay7DiHrBqvZ4tXo 745OqiPwdTig3F5moO0v/mh4ECOdUaeHKR3Fd6d9oqEJbcMjZEIbAUuTgjdWv5TWXgEV 3CcxSj+SVbsnZc4GiNVOB4LRkxn1EHj2SHsGjlSolpKqeO1DoEFJT9ylBOJTMBIuUZvx RMcQ== X-Gm-Message-State: AOJu0Yyz5agnmit+P0axrq1oXVBjNiqgReVJ0G22iPeCkESdFu9b0lAG vvbTV7JDzWk8uB2q/dmG9isnmTSQgefmSOVXIWDyM+/Z135SgYcobkGv+TE4KM2XSLlhr6tzcJ6 vEXEm X-Gm-Gg: ASbGnctboLDfdWUfxvx/4z+QOZhTYNeoQ1QLxr3aI0MZiI0wtQC47d81PVp06pcL6qh Qg/zDg1Hi5+sfOVwmfnPovEB1QFnBBYoRkWQCr68iF5VLUAVLUASFRk5vH/bBxLbsC3e8iwBdcD 5INGjQpTpAC1RPdYpvBXzo/Gbak9D3u4Sz1iDU3KrpJ7YOsLtokLf+rTwscI1ZVQfcE7jT88Upu hx1zPkc9XGdN2rgUgNIVWEWhQgl9cVl2tnBEl5HK8ZEEmI45un2s0WjXXRcvk33pATbO+XReNv+ ZoIgpKybgq8FtFPLdJAHP7C0EA1hbiLTylFbWItwzV93fIwhE5jc5qh1QEC620Htmzf+5hw6qPK p1NAMHfm2sr3H+TjO/4hgiCrzYG0dJjHQ7UHIkvkzrRSelN046H1WrkIuJCpIMi0JLaghIgTWPy B2Jv7q0qCOoZO+U9zRU6/n4y8= X-Google-Smtp-Source: AGHT+IGsuM3JnBRPrLDis+cGJhcRI2m6z7HtbWMdfo50tweopR7jN9KNvup76xnxqkeK15q0yW/MHQ== X-Received: by 2002:a05:600c:4e13:b0:475:dd53:6c06 with SMTP id 5b1f17b1804b1-4775ce3b380mr76738075e9.40.1762444722455; Thu, 06 Nov 2025 07:58:42 -0800 (PST) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb403793sm5758966f8f.2.2025.11.06.07.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Nov 2025 07:58:42 -0800 (PST) From: Marco Crivellari To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko Subject: [PATCH 2/2] xen: privcmd: WQ_PERCPU added to alloc_workqueue users Date: Thu, 6 Nov 2025 16:58:31 +0100 Message-ID: <20251106155831.306248-3-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251106155831.306248-1-marco.crivellari@suse.com> References: <20251106155831.306248-1-marco.crivellari@suse.com> 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: quoted-printable 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 consistentcy cannot be addressed without refactoring the API. alloc_workqueue() treats all queues as per-CPU by default, while unbound workqueues must opt-in via WQ_UNBOUND. This default is suboptimal: most workloads benefit from unbound queues, allowing the scheduler to place worker threads where they=E2=80=99re needed= and reducing noise when CPUs are isolated. This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue= () to be per-cpu when WQ_UNBOUND has not been specified. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn=E2=80=99t explicitly specify WQ_UNB= OUND must now use WQ_PERCPU. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari --- drivers/xen/privcmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index f52a457b302d..402be080ad2c 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -1091,7 +1091,8 @@ static long privcmd_ioctl_irqfd(struct file *file, vo= id __user *udata) =20 static int privcmd_irqfd_init(void) { - irqfd_cleanup_wq =3D alloc_workqueue("privcmd-irqfd-cleanup", 0, 0); + irqfd_cleanup_wq =3D alloc_workqueue("privcmd-irqfd-cleanup", WQ_PERCPU, + 0); if (!irqfd_cleanup_wq) return -ENOMEM; =20 --=20 2.51.1