From nobody Sun Aug 14 09:22:40 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M5BlN5b1Gz20Wm8; Sun, 14 Aug 2022 09:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M5BlN54jzz3p5r; Sun, 14 Aug 2022 09:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660468960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DY83WK5L2+VltUq2aoh9g2DW9Qa8B30rBhI7rLzceEU=; b=JuvMj+72C7iKHxIgWO8i0b7Qd+3joY8KhzXtk+FooIOXp2PqxKFgKoZypIAS8ZMyuhi6Y8 dV5J75nwL1nIALtDPOy5pLhkoOyS6lGKjyWcVy62kmaulUXZRqam8dUz4yxtY1e7i4eXO6 OmQgSbK3Rg5ch7Xa97+BOuvEwwexPe1jvKh7/7IRo1/udSd3TOc2MYNvCYW78iIdj85BE2 VfP2pzSBtPQeWu+Azun7DjTqyN6Vmd0An22r9taRWjGKNuM1pcpHu/ahHBrzra4ckXdCAK /lHGuZoBAcfBSsTrianYCszIoAb+5lvDEwD6eKvMbi97id8ppWkIsYfj4mBqKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M5BlN47VwzlYT; Sun, 14 Aug 2022 09:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27E9MevA097767; Sun, 14 Aug 2022 09:22:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27E9Mewk097766; Sun, 14 Aug 2022 09:22:40 GMT (envelope-from git) Date: Sun, 14 Aug 2022 09:22:40 GMT Message-Id: <202208140922.27E9Mewk097766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 9b967bd65de6 - main - domains: allow domains to be unloaded List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b967bd65de6647aed68a141dc34f9b223a2593c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660468960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DY83WK5L2+VltUq2aoh9g2DW9Qa8B30rBhI7rLzceEU=; b=IA1Jnqr/E+rgT1ycYzT00E3o85QUIV7J8cKDeM5HnEEjKrMTqHD4DOcGFpYtA9PDd5TNTI k6DDpl14HpydpI3zzOfwaIYOs0Wvozds9j5W1IfneS2BxeKw6kub38QSjxKiQ+Q9CStNi4 X1RVydhgNnakPUdrRxuX+ezATV9i8VP5ROUAD3K7/t09/rI9dWJuIIThDwePA9kjGABUC0 baDwrXiHeDnScV+HxpvX99+7DhRAek40lvfggJUL9V24lFIBVsncF4VdOfjvS6Ktjewrcv D28simo5wKMM8wDl5O7pweXWMx4UTSJ9rMH6ZYdqb2xD1IFaKzWCJfflnz5l6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660468960; a=rsa-sha256; cv=none; b=V47+UUMDFIsW3aMVdPqAqXqOl50K54QTt34w5+phLgMe8ta+ogqOkYB7BocjSgztQnkG64 EERbPdVGmGOmDUhsR5V5F+Dobh4pMyg4Vpxo6kcWcP4wWJ+gNgLohSM+6pjBIrc3vYS15w rOePige8wuLaDqGs7Tg4kvtUYxJBC2S0B3zGtC/eihmPjPxSIyaajruzCAocjxuoD27x8U gNSEbPXNgi6bBDcfq8lozPbq5MfDq/WtZoTxJM/j/Bw57y93GH3EYEXslnzkbKxUV2/8XP GlPcQpQBjtgoCRX+6uz/Zyhf83p0x309NifnAVm2+fjliV0LarSJfiu3tiuAyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9b967bd65de6647aed68a141dc34f9b223a2593c commit 9b967bd65de6647aed68a141dc34f9b223a2593c Author: Alexander V. Chernikov AuthorDate: 2022-08-12 13:36:53 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-08-14 09:22:33 +0000 domains: allow domains to be unloaded Add domain_remove() SYSUNINT callback that removes the domain from the domain list if it has DOMF_UNLOADABLE flag set. This change is required to support netlink ( D36002 ). Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D36173 --- sys/kern/uipc_domain.c | 23 +++++++++++++++++++++++ sys/sys/domain.h | 4 ++++ 2 files changed, 27 insertions(+) diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index c70b3150cbf0..2cae08be089a 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -239,6 +239,29 @@ domain_add(void *data) mtx_unlock(&dom_mtx); } +void +domain_remove(void *data) +{ + struct domain *dp = (struct domain *)data; + + if ((dp->dom_flags & DOMF_UNLOADABLE) == 0) + return; + + mtx_lock(&dom_mtx); + if (domains == dp) { + domains = dp->dom_next; + } else { + struct domain *curr; + for (curr = domains; curr != NULL; curr = curr->dom_next) { + if (curr->dom_next == dp) { + curr->dom_next = dp->dom_next; + break; + } + } + } + mtx_unlock(&dom_mtx); +} + /* ARGSUSED*/ static void domaininit(void *dummy) diff --git a/sys/sys/domain.h b/sys/sys/domain.h index 409372e91915..3a1c30e163ed 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -71,11 +71,13 @@ struct domain { /* dom_flags */ #define DOMF_SUPPORTED 0x0001 /* System supports this domain. */ #define DOMF_INITED 0x0002 /* Initialized in the default vnet. */ +#define DOMF_UNLOADABLE 0x0004 /* Can be unloaded */ #ifdef _KERNEL extern int domain_init_status; extern struct domain *domains; void domain_add(void *); +void domain_remove(void *); void domain_init(void *); #ifdef VIMAGE void vnet_domain_init(void *); @@ -85,6 +87,8 @@ void vnet_domain_uninit(void *); #define DOMAIN_SET(name) \ SYSINIT(domain_add_ ## name, SI_SUB_PROTO_DOMAIN, \ SI_ORDER_FIRST, domain_add, & name ## domain); \ + SYSUNINIT(domain_remove_ ## name, SI_SUB_PROTO_DOMAIN, \ + SI_ORDER_FIRST, domain_remove, & name ## domain); \ SYSINIT(domain_init_ ## name, SI_SUB_PROTO_DOMAIN, \ SI_ORDER_SECOND, domain_init, & name ## domain); #endif /* _KERNEL */