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)
Jan 21 2024, 9:08 AM
Unknown Object (File)
Dec 20 2023, 3:22 AM
Unknown Object (File)
Dec 2 2023, 4:34 AM
Unknown Object (File)
Dec 1 2023, 3:11 AM
Unknown Object (File)
Oct 7 2023, 8:42 AM
Unknown Object (File)
Jul 24 2023, 4:28 AM
Unknown Object (File)
Jun 26 2023, 10:20 AM
Unknown Object (File)
Jun 19 2023, 10:53 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.