From nobody Sat Jul 22 13:09:48 2023 X-Original-To: dev-commits-doc-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 4R7Rbc5bKpz4pHnx for ; Sat, 22 Jul 2023 13:09:48 +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 4R7Rbc54Q5z4XmQ; Sat, 22 Jul 2023 13:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690031388; 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=q/yKKPPiVtLSU6b9xp6ubgdghsnVoyixi19bSEOsldI=; b=p1wKgtYbeE8NwAOhj6HxdS8i7gvuLNElMg1V1OG9CRjJTbUxcIvHqxLk7QtG0vKvgzXSN9 Q8HNVrfkvbUnf/15Lxiw6hGwP1SJigeqb922EWUoxsUQJ8LLrfk1y5bCMDguanlSzvv3wa 6jyJLRRUL/CvJJUXBl3fZY/rpWGH1cXP7JkzOU4oI/b0o84EEL3+dQguYZbjHBbGR21E2F dpuZEQRXBTSzAXLeiy7vpmojHlHadi6oEXXNCSCmiF3yKv0a8Nx3qSmzKYXD47iEdZagiY pSvS4wSVBXgq4b8VteWLFXojRPO3/JnHhqgfhYM+8HjUDSJ0Blup+5/M6TRTag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690031388; 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=q/yKKPPiVtLSU6b9xp6ubgdghsnVoyixi19bSEOsldI=; b=t5zzavDkIlGaO9xFPsuMZBBMLsgHgTa0T5cI55a7gSxIpdafvndM/PYjOk/3fHxuBw8is8 r+0WODATTrmffGHj/mXUuikcf5nbr8GzWC2xVq2o08qAJj2J8iqTjR+3RRLSHx6ecfjahk KjnQROuz/PSVo57OVK70c2JC7p/abANBhcW1Orxx8YLx7ByTICa9vGbYdjv0vXnWKKeAFi o2m2vuznzKvyNpAGzNcGTzjf+7jPU6zJsYFNXLwLAhaqv6RdpxdPtbdD9/dMy+/8B4xJfv MarFoqbTzUlz42UstxmRjTBxPAvALsTtCVdnAFmDGCXomjCy6SmurWl5xn2LuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690031388; a=rsa-sha256; cv=none; b=qZqHS1czVTMERr9toV+I7V8LxGJM38I2Fhd2FfCj74BoX4zkNQml56OusvCzr4FbvQLTGZ jcrjcUa5PIodChNRqaigOp05GzieUZUd0/EEyw2R1YMo5dDZfgf/3iJrg8ydffylwIkZic UQnH3UZxtVHUyRMGeWdGlO2ASgARGpZfODc0jnItFCxq/Dm8EDtDeEpdtBe8c1QNZE6Cfs +7XMZK1uagqPeW05EkGLxDTQ8Fz1r2zy62uFiYTXXZxphuYKB32V9onSZN5MEO5sv3ne0H mAAWQAILBBt8cgwI8j6Vr7K5kTcG6dG4a/ttj8+UsyZ9MFp6QvySICo4VQXSgQ== 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 4R7Rbc497gzw5F; Sat, 22 Jul 2023 13:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36MD9mLY048143; Sat, 22 Jul 2023 13:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36MD9mrL048142; Sat, 22 Jul 2023 13:09:48 GMT (envelope-from git) Date: Sat, 22 Jul 2023 13:09:48 GMT Message-Id: <202307221309.36MD9mrL048142@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: Lorenzo Salvadore Subject: git: af4c6c1fd5 - main - Status/2023Q2/epoch-netgraph.adoc: Add report List-Id: Commit messages for all branches of the doc repository List-Archive: https://lists.freebsd.org/archives/dev-commits-doc-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-doc-all@freebsd.org X-BeenThere: dev-commits-doc-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: salvadore X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af4c6c1fd57ff93e10cb979391be171119b5ab90 Auto-Submitted: auto-generated The branch main has been updated by salvadore: URL: https://cgit.FreeBSD.org/doc/commit/?id=af4c6c1fd57ff93e10cb979391be171119b5ab90 commit af4c6c1fd57ff93e10cb979391be171119b5ab90 Author: Zain Khan AuthorDate: 2023-07-22 12:56:21 +0000 Commit: Lorenzo Salvadore CommitDate: 2023-07-22 13:09:02 +0000 Status/2023Q2/epoch-netgraph.adoc: Add report Approved by: dbaio (mentor, implicit) Pull Request: https://github.com/freebsd/freebsd-doc/pull/230 --- .../report-2023-04-2023-06/epoch-netgraph.adoc | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/website/content/en/status/report-2023-04-2023-06/epoch-netgraph.adoc b/website/content/en/status/report-2023-04-2023-06/epoch-netgraph.adoc new file mode 100644 index 0000000000..786d2bc164 --- /dev/null +++ b/website/content/en/status/report-2023-04-2023-06/epoch-netgraph.adoc @@ -0,0 +1,32 @@ +=== Making Netgraph Lock-Free + +Links: + +link:https://wiki.freebsd.org/SummerOfCode2023Projects/LocklessSynchronizationBetweenNodesInNetgraph[Wiki Page] URL: link:https://wiki.freebsd.org/SummerOfCode2023Projects/LocklessSynchronizationBetweenNodesInNetgraph[] + +link:https://github.com/zinh88/epoch-netgraph[Repo] URL: link:https://github.com/zinh88/epoch-netgraph[] + +Contact: Zain Khan + +Netgraph helps us implement custom or complex networking functions by letting us arrange kernel objects called nodes in a graph connected using hooks. +Nodes may perform a well-defined set of actions on incoming packets, and may send the output to another connected node. +To 'send' a packet to a neighbour can also be seen as calling a function on that neighbouring node. + +Now in a pre-SMP world, a thread (or *the* thread) would always see nodes as idle (not busy), so that their functions can immediately be called. +Concurrency introduced the possibility of a busy node. +Moreover, a journey of a packet also needs to take heed of changes in the structure of the graph, for example: the addressed node's path may not remain intact due to no-longer-existing hooks or nodes in between, which may lead to cases such as referring to an object that has been freed. +To counter such disasters, the existing source code uses a topology read-write mutex which protects data flow from restructuring events (and restructuring events from other restructuring events). + +We want to regain the same smooth flow for data which existed when concurrent cpus were not a thing. +That is, data should simply never wait every time there is a restructuring event. +At the same time we also obviously do not want to give the kernel reasons to panic. + +FreeBSD has its own set of concurrency-safe data structures and mechanisms. +One of these mechanisms is Epoch. +Epoch-based reclamation involves waiting for existing read-side critical sections to finish before the data structures need to be modified or reclaimed. + +Because the base system is being modified, this is also going to affect the design choices made before, such as queuing on messages, reference counting. + +This project involves a lot of testing. +For now, some topology protection locks have been removed, and only simple graphs have been tested (with FreeBSD running on a VM). +The real tests should be run on hardware with at least 4 CPU cores, I will do that when I get my hands on one. + +Sponsor: The Google Summer of Code '23 program