Module Name: src Committed By: riastradh Date: Sun Dec 19 12:11:36 UTC 2021
Modified Files: src/sys/external/bsd/common/linux: linux_work.c Log Message: linux: Make flush_workqueue a noop if run from the workqueue. I think this matches Linux semantics but this is very much not clear and not written down anywhere obvious and why is this such a semantically incoherent mess. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/external/bsd/common/linux/linux_work.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/common/linux/linux_work.c diff -u src/sys/external/bsd/common/linux/linux_work.c:1.57 src/sys/external/bsd/common/linux/linux_work.c:1.58 --- src/sys/external/bsd/common/linux/linux_work.c:1.57 Sun Dec 19 12:11:28 2021 +++ src/sys/external/bsd/common/linux/linux_work.c Sun Dec 19 12:11:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_work.c,v 1.57 2021/12/19 12:11:28 riastradh Exp $ */ +/* $NetBSD: linux_work.c,v 1.58 2021/12/19 12:11:36 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.57 2021/12/19 12:11:28 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.58 2021/12/19 12:11:36 riastradh Exp $"); #include <sys/types.h> #include <sys/atomic.h> @@ -1457,6 +1457,12 @@ flush_workqueue(struct workqueue_struct { struct flush_work fw; + if (lwp_getspecific(workqueue_key) == wq) { + printf("%s: running from workqueue %s\n", __func__, + wq->wq_name); + return; + } + mutex_init(&fw.fw_lock, MUTEX_DEFAULT, IPL_VM); cv_init(&fw.fw_cv, "lxwqflsh"); INIT_WORK(&fw.fw_work, &flush_work_cb);