OpenBSD Journal

n2k14 Hackathon Report: guenther@ on threading, time_t cleanup and more

Contributed by pitrh on from the ever hack a kiwi? dept.

Philip Guenther (guenther@) was the first to write in with a report from the n2k14 hackathon in Dunedin, New Zealand:

I had come to Dunedin with a possible fix for an annoying threading bug in the kernel ptracing code. It's a bit complicated in the locking of the single-threading logic, and I wanted to see what kettenis@ thought about it. I noted a second problem (tsleep being called recursively) which was "easy to fix", so I started on that and discovered that it was, of course, much more complicated then I expected. Trying to work out how to fix *that* led to the subtle tangle which is exit1(). So I worked on simplifying the exit logic so that exiting threads in multi-threaded processes completely skip the zombie and wait logic. Most of that went in early; as I write this there's one last change to remove the "alternate exit signal" support for Linux compat, as it's unused by modern programs.
With that so frustrating, I flipped for a while over to understanding the ACPI requiremnts on C-state transitions. I had added support back in the fall for using the MWAIT instruction on i386 and amd64 in the idle loop and want to have it use the higher C-states (C2, C3, etc) when available. mlarkin@ however had pointed out that you should only request those states from MWAIT if the ACPI _CST table said to do so, so I dumped that info on a few laptops and poked at the documentation of the format. I'm now trying to decide how best to pass the information from the acpicpu driver down to the MD idle loop code. Once I settle on that I'll float a diff and we'll see which machines it barfs on.

kettenis@ had recently completed the transition of the C startup code (csu) and ld.so to passing the ld.so cleanup function in the ABI specified fashion. With that done, the next advance is to have ld.so and csu handle the allocation and initialization of the initial thread's Thread Control Block (TCB). I had already sketched out what I desired of the layout of this, with the pthread_t structured placed in the same allocation, so I spent a day working through the necessary code to do this, with enough transition code in libpthread to work both ways. That needs a lot more testing as there are MD changes in the cerror ASM so it's not going to make the release 5.5, but it should enable some simplifications and is a step towards support for the __thread storage specifier.

In discussions about structure padding we realized that there was some dangling work from the big-time_t change: some of the syscalls that passed timevals and timespecs could carry data in the padding between processes or from the kernel to userspace, so I worked through the various system calls and changed several to zero fill the structures and copy the time structures memberwise to avoid copying out data in padding. Other sundry changes: manpage tweaks discussed with schwarze@ and others, an rusage accumulation missing that tedu@ reported, a gcc temp file cleanup bug seen in release builds, and more assertions in the kernel synchronization code.

Many thanks to Jim Cheetham and the University of Otago for hosting us again, despite knowing what to expect!

Thank you, Philip, for the good work and for submitting this report!

We hear there are more n2k14 reports incoming, watch this space for more!

(Comments are closed)


Comments
  1. By Anonymous Coward (63.231.28.164) on

    The dates shown for this hackathon are January 18-25.
    This write-up was posted 2:20pm GMT January 24.
    Mr. Guenther packin' bags a little bit early?
    I'm not criticizing; guenther@'s name has shown up quite a bit over the years, and I appreciate the volunteer efforts shown by so many people. I'm just wondering if these hackathon dates typically include a couple of days for tearing down?

    Comments
    1. By Philip Guenther (162.112.38.5) on

      > The dates shown for this hackathon are January 18-25.
      > This write-up was posted 2:20pm GMT January 24.
      > Mr. Guenther packin' bags a little bit early?

      Nah, just wanted to get it written up before I forget the grotty bits in transit. At least for me, the last partial day of a hackathon is generally less focused as I review pending and in-progress diffs, respond to email, try to wind down in-progress work, settle travel or tramping arrangements, etc. Tear down took about 5 minutes for me.

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