Authentication-Results: name.execsw.org; dkim=pass (1024-bit key) header.d=netbsd.org header.i=@netbsd.org header.b=ofCMJGrL; dkim=fail reason="signature verification failed" (1024-bit key) header.d=netbsd.org header.i=@netbsd.org header.b=MdsML8xi Received: by mail.netbsd.org (Postfix, from userid 605) id 44EBF84F23; Thu, 18 Apr 2024 15:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1713455498; bh=ARyJYQg695cN7cYczrKARdrcHQuQ4SC6W33jK5QZXDo=; h=Date:From:Subject:To:List-Id:Reply-To:List-Unsubscribe; b=ofCMJGrL6FpT6ZUF14FSO3XIU5sIvugUkULHGlLu7gasu+vDZEe6mg2/kSVO16tZH SE4JE1V2BzHJy8wBTyMvaEL25k4Nlhvlizph1HBFaeSRzLY2VnXHTp6VotUoyB7gEE 8WKvD4BjAYMiyZ6qawXc65tOarGpG2bTEWX05ehQ= Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 28FA584F26 for ; Thu, 18 Apr 2024 15:51:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Authentication-Results: mail.netbsd.org (amavisd-new); dkim=pass (1024-bit key) header.d=netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id w162Nx3E4J0X for ; Thu, 18 Apr 2024 15:51:36 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 73F1B84D2D for ; Thu, 18 Apr 2024 15:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1713455496; bh=ARyJYQg695cN7cYczrKARdrcHQuQ4SC6W33jK5QZXDo=; h=Date:From:Subject:To:Reply-To; b=MdsML8xiL7ISuElrE4o65B0tbxk2UP9lJFoHendOPcGCCYfvQwl1Gxf4NezZzf3xb h+V+gkhNQMvLee/JNBlDRVUr+rjtWkFkYYBzkd6/059VBnSjDR7aFETJJMs2b0+cYb ZVMYh1ZtkjlRgsRLpvH9MkQg8RVOUmHQRFepnzmY= Received: by cvs.NetBSD.org (Postfix, from userid 500) id 67091FA2C; Thu, 18 Apr 2024 15:51:36 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Thu, 18 Apr 2024 15:51:36 +0000 From: "Martin Husemann" Subject: CVS commit: [netbsd-9] src To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20240418155136.67091FA2C@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Martin Husemann" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: martin Date: Thu Apr 18 15:51:36 UTC 2024 Modified Files: src/share/man/man9 [netbsd-9]: workqueue.9 src/sys/kern [netbsd-9]: subr_workqueue.c src/tests/rump/kernspace [netbsd-9]: kernspace.h workqueue.c src/tests/rump/rumpkern [netbsd-9]: Makefile t_workqueue.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #1830): sys/kern/subr_workqueue.c: revision 1.40 sys/kern/subr_workqueue.c: revision 1.41 sys/kern/subr_workqueue.c: revision 1.42 sys/kern/subr_workqueue.c: revision 1.43 sys/kern/subr_workqueue.c: revision 1.44 sys/kern/subr_workqueue.c: revision 1.45 sys/kern/subr_workqueue.c: revision 1.46 tests/rump/kernspace/workqueue.c: revision 1.7 sys/kern/subr_workqueue.c: revision 1.47 tests/rump/kernspace/workqueue.c: revision 1.8 tests/rump/kernspace/workqueue.c: revision 1.9 tests/rump/rumpkern/t_workqueue.c: revision 1.3 tests/rump/rumpkern/t_workqueue.c: revision 1.4 tests/rump/kernspace/kernspace.h: revision 1.9 tests/rump/rumpkern/Makefile: revision 1.20 sys/kern/subr_workqueue.c: revision 1.39 share/man/man9/workqueue.9: revision 1.15 (all via patch) workqueue: Lift unnecessary restriction on workqueue_wait. Allow multiple concurrent waits at a time, and allow enqueueing work at the same time (as long as it's not the work we're waiting for). This way multiple users can use a shared global workqueue and safely wait for individual work items concurrently, while the workqueue is still in use for other items (e.g., wg(4) peers). This has the side effect of taking away a diagnostic measure, but I think allowing the diagnostic's false positives instead of rejecting them is worth it. We could cheaply add it back with some false negatives if it's important. workqueue(9): workqueue_wait and workqueue_destroy may sleep. But might not, so assert sleepable up front. workqueue(9): Sprinkle dtrace probes. tests/rump/rumpkern: Use PROGDPLIBS, not explicit -L/-l. This way we relink the t_* test programs whenever changes under tests/rump/kernspace change libkernspace.a. workqueue(9) tests: Nix trailing whitespace. workqueue(9) tests: Destroy struct work immediately on entry. workqueue(9) tests: Add test for PR kern/57574. workqueue(9): Avoid touching running work items in workqueue_wait. As soon as the workqueue function has called, it is forbidden to touch the struct work passed to it -- the function might free or reuse the data structure it is embedded in. So workqueue_wait is forbidden to search the queue for the batch of running work items. Instead, use a generation number which is odd while the thread is processing a batch of work and even when not. There's still a small optimization available with the struct work pointer to wait for: if we find the work item in one of the per-CPU _pending_ queues, then after we wait for a batch of work to complete on that CPU, we don't need to wait for work on any other CPUs. PR kern/57574 workqueue(9): Sprinkle dtrace probes for workqueue_wait edge cases. Let's make it easy to find out whether these are hit. workqueue(9): Stop violating queue(3) internals. workqueue(9): Avoid unnecessary mutex_exit/enter cycle each loop. workqueue(9): Sort includes. No functional change intended. workqueue(9): Factor out wq->wq_flags & WQ_FPU in workqueue_worker. No functional change intended. Makes it clearer that s is initialized when used. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.6.1 src/share/man/man9/workqueue.9 cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/kern/subr_workqueue.c cvs rdiff -u -r1.8 -r1.8.2.1 src/tests/rump/kernspace/kernspace.h cvs rdiff -u -r1.6 -r1.6.8.1 src/tests/rump/kernspace/workqueue.c cvs rdiff -u -r1.18 -r1.18.2.1 src/tests/rump/rumpkern/Makefile cvs rdiff -u -r1.2 -r1.2.8.1 src/tests/rump/rumpkern/t_workqueue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.