Page MenuHomeFreeBSD

Extend cpuset_get/setaffinity() APIs
ClosedPublic

Authored by cem on May 3 2017, 3:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 17, 1:20 AM
Unknown Object (File)
Sep 24 2024, 5:23 AM
Unknown Object (File)
Sep 19 2024, 6:30 AM
Unknown Object (File)
Sep 16 2024, 4:30 PM
Unknown Object (File)
Sep 8 2024, 4:32 AM
Unknown Object (File)
Sep 6 2024, 4:05 AM
Unknown Object (File)
Sep 2 2024, 12:52 AM
Unknown Object (File)
Sep 1 2024, 10:10 PM

Details

Summary

Add IRQ placement-only and ithread-only API variants. intr_event_bind
has been extended with sibling methods, as it has many more callsites in
existing code.

Test Plan

(I moved the mutually unobjectionable part of D10435 to its own review.)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This is just the API and not any cpuset changes. Guess we can do the userland side of it later!

This revision is now accepted and ready to land.May 3 2017, 3:51 PM

This is just the API and not any cpuset changes. Guess we can do the userland side of it later!

Can you imagine the bikeshed over new cpuset(1) argument letters? :-D

Yes I can. Sure, commit it, I'll uhm, "do" the cpuset bikeshed. :)

Overall it is fine, see some trivial nits inline.

sys/kern/kern_intr.c
294 ↗(On Diff #27979)

Use bool for boolean arguments ?

344 ↗(On Diff #27979)

This is racy beyond any tolerance. Two parallel setaffinity or one set and one get are not supposed to work correctly, it seems. I believe a low-tech but sufficient solution is to add global perhaps sleepable (sx) lock around both intr_setaffinity and intr_getaffinity.

This is a subject for a separate patch, of course.

sys/sys/cpuset.h
86 ↗(On Diff #27979)

I suggest CPU_WHICH_INTRHANDLER or similar name. IRQ_ONLY is puzzling.

sys/kern/kern_intr.c
294 ↗(On Diff #27979)

I just used the prevailing style in the file. It would be fine to start using bool, but I don't want to convert all of the other uses of int-as-bool in this file.

sys/sys/cpuset.h
86 ↗(On Diff #27979)

Ok.

cem edited edge metadata.
cem marked 4 inline comments as done.
  • Use bool for boolean values
  • Change name from IRQ_ONLY to INTRHANDLER
This revision now requires review to proceed.May 3 2017, 5:53 PM

Later, you would want to update cpuset(2).

sys/kern/kern_intr.c
328 ↗(On Diff #27986)

If you write this as

if (error != 0 && bindithread) {

you can de-indent the body by one level.

This revision is now accepted and ready to land.May 3 2017, 6:29 PM
sys/kern/kern_intr.c
328 ↗(On Diff #27986)

Sort of. The return (error) still needs to happen if error != 0 && !bindithread. So that would have to change into an } else if () {. And there's no compelling reason yet — none of the extra indented lines wrap.

I'll leave it as-is for now.

This revision was automatically updated to reflect the committed changes.
sys/kern/kern_intr.c
328 ↗(On Diff #27986)

If would be

if (error != 0 && !bindithread) {
...
}
if (error != 0)
  return (error);

Ok.