Allow distinct setting and querying of interrupt and ithread affinities
Needs ReviewPublic

Authored by gallatin on Jul 7 2017, 9:54 PM.

Details

Summary
  • Give cpuset 2 new arguments, one for hard interrupts (X) and one for ithreads (I)
  • Allow CPU_WHICH_(INTRHANDLER|ITHREAD) in cpuset_which()
  • Fix a bug in intr_getaffinity() where we'll panic on a null pointer passed to cpuset_which.

Diff Detail

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 10782
Build 11177: arc lint + arc unit
gallatin created this revision.Jul 7 2017, 9:54 PM
jhb accepted this revision.Jul 31 2017, 7:45 PM
jhb added a subscriber: wblock.

Code wise it is fine with me, might be good to get some doc review for the mapage / usage.

sys/kern/kern_intr.c
477

Oof at both of these bugs.

usr.bin/cpuset/cpuset.1
51

Might want to ask a doc person like @wblock if this is the right way to format this (same for usage())

143–147

Maybe tweak the descriptions like so:

-x: Specifies all resources associated with an interrupt as the target of an operation.
-X: Specifies the hardware interrupt vector as the target of an operation.
-I: Specifies dedicated threads associated with an interrupt as the target of the operation.

(I would maybe say "uses" instead of "specifies" here, but the rest of the manpage uses "specifies")

This revision is now accepted and ready to land.Jul 31 2017, 7:45 PM
gallatin updated this revision to Diff 31427.Aug 1 2017, 2:35 PM
gallatin edited edge metadata.
  • Feedback from jbh regarding wording
This revision now requires review to proceed.Aug 1 2017, 2:35 PM
gallatin marked an inline comment as done.Aug 1 2017, 2:38 PM

Thanks for the feedback. I'll reach out to wblock about the doc changes. I'm quite weak in man page fu, and this is a slightly odd one at that..

sys/kern/kern_intr.c
477

Meh.. it is code that was never run. We all have bugs.

This is a bit confusing. The new -I and -X options take the same irq argument as the old -x?

This is a bit confusing. The new -I and -X options take the same irq argument as the old -x?

Yes. The gist is that currently cpuset -x $IRQ will bind $IRQs interrupt thread and low-level hardware interrupt. I've added a mechanism to bind just the ithread or just the interrupt vector using the new -I or -X flags.

I suck at man pages, so any sanity you can add to this would be very much appreciated. Thanks!

Drew

Added my probably-weak mdoc suggestions, and added brueffer as a reviewer.

usr.bin/cpuset/cpuset.1
51

The best I've done with this is like so:

.Op
.Fl j Ar jailid |
.Fl p Ar pid |
.Fl t Ar tid |
.Fl s Ar setid |
.Fl x Ar irq |
.Fl I Ar irq |
.Fl X Ar irq 
.Oc

This puts the additional options on the same line as [-l cpu-list]. Maybe not a big deal.

55
.Oo
.Fl d Ar domain |
.Fl j Ar jailid |
.Fl p Ar pid |
.Fl t Ar tid |
.Fl s Ar setid |
.Fl x Ar irq |
.Fl I Ar irq |
.Fl X Ar irq 
.Oc

Added my probably-weak mdoc suggestions, and added brueffer as a reviewer.

Thanks for both of those things, I will try your mdoc suggestion!

Drew