RE: Any standard kernel API to dynamically allocate/free per-cpu vectors on x86?

From: Dexuan Cui
Date: Wed Apr 04 2018 - 19:31:02 EST


> From: Thomas Gleixner
> > I'm wondering if there is such a standard kernel API on x86.
> > As I skimmed through the code, I haven't found it yet, if any.
> >
> We don't have a simple way to do such allocations because they involve IDT
> entry manipulation.

Hi tglx,
Thanks for the quick detailed reply!

> If there is no hard requirement that this stuff runs through an direct
> vector, then we could simply make these interrupts go through the normal
> interrupt path. That means you have to request them like regular device
> interrupts and the handling path is slightly longer than the direct vector
> mode. You'd get virtual interrupt numbers per cpu which also show up in
> /proc/interrupts as separate lines.
>
> That needs a very simple and minimal virtual interrupt controller driver
> which is mostly a dummy implementation except for the activation function
> which would allow you to retrieve the vector number and store it in the
> MSR.

Can you please give a little more guidance? e.g. is there any similar driver,
any pointer to the required APIs, etc.
I guess I need to dig into stuff like
struct irq_domain_ops x86_vector_domain_ops and request_percpu_irq().
Your quick pointer would help a lot!

> There are a few details to be hashed out vs. CPU hotplug, but we have all
> the infrastructure in place to deal with that.
Sounds great!

BTW, so far, Hyper-V doesn't support CPU hotplug, but it supports dynamic
CPU online/offline . I guess I must also consider CPU online/offline here.

Thanks
-- Dexuan