Skip to content

balloons: IRQ CPU affinity controls - #722

Open
askervin wants to merge 5 commits into
containers:mainfrom
askervin:5iH-balloon-irq
Open

balloons: IRQ CPU affinity controls#722
askervin wants to merge 5 commits into
containers:mainfrom
askervin:5iH-balloon-irq

Conversation

@askervin

Copy link
Copy Markdown
Collaborator

Control IRQ CPU affinities using new irqClaim and irqMode balloon type options.

For each IRQ, the logic is:

  1. Find balloons that want exactly this IRQ (irqClaim matches) and set IRQ's CPU affinity to union of their CPUs.
  2. If no balloon claimed the IRQ, then find balloons that want all IRQs (irqMode: sink), and set CPU affinity to union of sink balloons' CPUs.
  3. With no claims and sinks around for the IRQ, find balloons that do not want any IRQs (irqMode: isolate), and set CPU affinity to all the remaining CPUs.
  4. If no irqClaim and irqMode options are present in existing balloon instances, but they are used in some balloon types, let IRQs run on all CPUs.
  5. If no irqClaim and irqMode options are present in any balloon types, do not touch IRQ CPU affinities in the system.

Combining irqClaim with "irqMode: isolate" in the same balloon type creates balloons that handle only claimed IRQs and no others.

Add pkg/irq for reading interrupts from /proc/interrupts and reading
and writing CPU affinities through /proc/irq/NUMBER/smp_affinity_list.
Wire the proc root to the plugin host root and mount the host proc
filesystem into the balloons daemonset so that affinities of host IRQs
can be updated (write access needed).

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
@askervin
askervin requested review from kad and klihub July 23, 2026 14:21
Comment thread cmd/plugins/balloons/policy/balloons-policy.go Outdated
p.BlockMeters()
defer p.UnblockMeters()
defer p.commitCpuClasses()
defer p.applyIrqAffinities()

@klihub klihub Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to configuration and reconfiguration: is my understanding correct that an irqMode: sink, irqClaim: [ $IRQ_CLAIMS ] is not sensible/meaningful combination for any single balloon type. If it is, should we verify against it in pkg/apis/config/*/resmgr/policy/balloons.Config.Validate() ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the most obscure combination.

On the other hand, if almost all balloon types would require isolation from IRQs, declaring the few non-sensitive balloon types as IRQ sinks might be more convenient than declaring all latency-sensitive-tailored balloon types isolated from IRQs. Under these circumstances it could be that a non-sensitive balloon type would also want to claim a certain IRQ, yet still being ok to participate in balancing all other IRQs, too.

In other words, a sink+claim balloon among other sink balloons would make equally sense than (plain) claim balloon among dont-care balloons when many isolated balloons are present.

Therefore, I wouldn't add a verification against this configuration. I hope that sink/isolate/claim semantics would be clear enough (and documented clearly enough) for users to understand what happens in this case.

Comment thread cmd/plugins/balloons/policy/balloons-policy.go

@klihub klihub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few minor questions and comments.

@klihub klihub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more minor nit.

@klihub
klihub requested a review from fmuyassarov July 29, 2026 07:58
Add the balloon type options irqClaim and irqMode to the balloons
policy configuration.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
askervin added 3 commits July 29, 2026 18:24
Set CPU affinities of system IRQs according to the irqClaim and
irqMode balloon type options.

For each IRQ, the logic is: find balloons that want exactly this
IRQ (irqClaim). If nobody, then find balloons that want all unclaimed
IRQs (irqMode: sink). If no volunteers, then list balloons that do not
want any IRQs (irqMode: isolate), and set IRQs affinity to all those
who do not care. The default is nobody cares (no irq options present),
meaning that the balloons policy will not touch IRQ CPU affinities at
all, keeping the original behavior. Affinities are updated after
balloon changes.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
Add an end-to-end test that verifies irqClaim, irqMode sink and
irqMode isolate by inspecting /proc/irq affinities on the test VM.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
Describe the irqClaim and irqMode balloon type options and their common
use cases.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
@askervin
askervin requested a review from klihub July 29, 2026 15:26
@fmuyassarov

Copy link
Copy Markdown
Collaborator

Thanks @askervin . This is a very useful addition and actually something that we have been thinking about, but more on the topology-aware plugin. I will take my time tomorrow and go through the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants