[libc-commits] [PATCH] D150365: [libc][NFC] Simplifly inbox and outbox state handling

Jon Chesterfield via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 11 08:35:32 PDT 2023


JonChesterfield added a comment.

Different definitions of simple in play here.

If

- one reasons in terms of the values in the underlined memory
- focuses on the differences between client and server
- prefers code duplication

Then this is a reasonable way to go.

The direction I'm trying to take this in is different.

- move atomic ops and fences out of client/server
- concurrency logic in process is the same for either instance
- client/server only work with concepts libc cares about

That has the advantage that the code in process covers all the subtle concurrency hazards and can be tested in isolation, notably stress tested under thread sanitisers with both sides running on x64. It also means the libc send/recv stuff can evolve over time more easily as it doesn't have to worry about breaking the concurrency model.

It also has the advantage that inbox and outbox always mean exactly the same thing, on client or server or process, which I find far easier to reason about than keeping track of which is the root of a given function call.

I'm ok with not thinking about whether a given block of memory underlying a mailbox has particular numbers written into it, in exchange for thinking about the states the machine is in.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150365/new/

https://reviews.llvm.org/D150365



More information about the libc-commits mailing list