OpenBSD Journal

p2k18 Hackathon report: Paul Irofti (pirofti@) on semaphores development, wifi stack progress and ports work

Contributed by Peter N. M. Hansteen on from the Puffy, pass the wifi semaphores dept.

Next up in our series of p2k18 hackathon reports is from Paul Irofti (pirofti@), who writes:

I joined the hackathon with plenty on my todo list and to my surprise managed to finish or at least narrow down a plan for most items.

A recent problem I encountered when trying to update lang/mono is with threads synchronization. There are a few quirks to fix in our tree, but the obvious one was regarding signals and semaphores.

After a long discussion with Martin (mpi@), Philip (guenther@) and Robert (robert@), we managed to pin-point the problems which lead to two diffs from me. The first fixed the existing semaphore implementation to respect signals marked with SA_RESTART and also performed timespec validation. As a side-benefit, Robert also ported posixtestsuite to OpenBSD which was soon taken over by Alexander (bluhm@).

The second, and much more exciting one, is a new implementation that makes sem_post(3) async-signal-safe (i.e. you can call it from a signal handler without deadlocking). This should also be faster as it uses atomic operations and futexes to mitigate locking.

As often happens, this effort uncovered other problems in the tree which I and others have started investigating and fixing.

An itch I wanted to scratch for a long time is WiFi network scanning. It always bothered me that I have to wait for a long time when running ifconfig scan and, if that was not enough, the entire network stack was blocked during the operation.

Fortunately (or perhaps intentionally), I was sharing a table with Martin and Stefan (stsp@) so I started nagging them about it. A first attempt at fixing things fast and dirty was to push down and remove the network lock around the ieee80211 stack. This turned out to be not sufficient as the lock was still taken and the network still froze during scan. On the bright side I pushed down the network lock and my commit seemed to have motivated Theo (tb@) to push it even further down.

Next, we tried to do this right(tm). The discussion between Stefan, Martin, and me about the issue reached the table across where Theo (deraadt@) was sitting and he jumped in enthusiastically (as always) and soon enough a plan was laid out: turn the SCAN ioctl into a nop and always store nwid credentials independent of the hardware underneath.

Soon enough I already had a diff for the first part and it has since hit the tree. Tip: you can now run ifconfig scan without doas(1). Credential storage will be a longer process and fortunately Peter (phessler@) had an old diff lying around that implemented the first bits.

My work in the wireless stack quickly lead me to another topic of interest: the device and stack computation of the received signal strength indication (RSSI). First off, I dislike that we present signal strength in either percentage or dBm. It should be unified across the stack. Second, some devices mis-calculate or even mis-interpret the numbers that the hardware presents. So I finally took the time to read the documentation and to check what other operating systems are doing to settle this mess. Unless life decides otherwise, you should start seeing diffs from me about this soon enough.

Between the cracks I managed to slip in a couple of ports diffs and update almost all the ports I maintain. I still have not built up the courage to go for math/suitespare.

Overall this has been a very productive hackathon with lots of collaborations in a very pleasant location! A big thank you to Gilles, Theo and the OpenBSD Foundation for making this possible!

My only regret is that I did not get the chance to bother Martin about yet another topic that I had naive diffs for: fuse (buffer passing) optimization.

Bisou pour tous les machines,

Thanks for the report, Paul! We're looking forward to further developments!

(Comments are closed)

  1. By Adam P (adamrt) on

    Thanks for the write up. The wifi changes are exciting.

Latest Articles


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]