OpenBSD Journal

c2k15: guenther@ on C-states, kbind, misc improvements

Contributed by pitrh on from the tame, wait, bind, grind dept.

Our next c2k15 report comes from Philip Guenther (guenther@), who writes,

I went to Calgary expecting to do some low-level x86 improvements and fix some issues turned up in the C-state work I had committed back in June...and that's actually what I did! Weird...

First came some a diff to move the grabbing of the kernel lock for soft-interrupts from the ASM stubs to the C routine so that mere mortals can actually push it around further to reduce locking. Then I did some further work on a diff to add support for setting GS.base (the offset of the %gs segment) for userspace threads. The issue there is making sure this won't significantly affect the performance of threads not using the feature, as there are only a few programs out there that would make use of it. I'm mostly happy with my diff, but need to run performace tests on a few more machines before I'm satisfied.

On C-states, a couple developers had reported that my C-state code didn't like their machine's C1 state, resulting in higher latency during normal operation. While their boxes' AML was indeed bogus, it's *always* safe on x86 to use the HLT instruction for C1, so I fixed the code to add a fallback C1 state doing that, and their boxes became happier. (Since the hackathon, Theo, Mike Larkin (mlarkin@), and I fixed a couple other issues, including some suspend-restore bit handling that probably fixes some problems seen after resuming, and code to suppress old-style C2/C3 states on boxes where the LAPIC will stop, which fixes at least one AMD box.)

Then Theo and kettenis@ kicked me some and said "when were you planning on committing your kbind work?" (c.f. my talk at eurobsdcon2014). A quick refresh and some test runs and the kernel side went in. Then I went to work on refreshing the ld.so and csu bits, including more gcc constraint fixes on the ASM and extending it to work on more archs. Then miod@ started heckling^Wgiving me feedback, particularly on the archs I don't actually have, and things started to move faster. The userland parts aren't in yet, but I expect they'll start going in shortly after unlock...

Spent a *lot* of time trying to simplify and make convincing a set of changes to the kernel's UNIX-domain socket garbage collector. Did a round of close review and whiteboarding with claudio@ which located a couple bugs and am now working on test cases for those.

Random bits:

  • reviewed random libressl diffs
  • fixed a socketpair() bug introduced by the SOCK_CLOEXEC support, and then misled jca@ on another problem until bluhm@ saved the day
  • taught ktrace and kdump to handle lseek()'s return code correctly on ILP32 archs
  • stubbed in support for limiting symbols exported by libraries
  • experimented with using mwait when spinning on the kernel lock (results vary wildly, perhaps related to number of CPU packages)
  • a few tame() tweaks but much more discussion
  • practiced making hipster coffee with afresh1@'s wonderful gear

Calgary was great (first time for me) and the hackroom setup was excellent. Many thanks to Nayden, the foundation, and all involved in the setup and logistics!

A varied collection of useful work indeed. Thanks for the work and the report, Philip!

(Comments are closed)


Comments
  1. By Anonymous Coward (92.40.248.156) on

    tyop in article: s/Guenthter/Guenther/

Credits

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 deadly.org 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.]