Re: idt change in a running kernel? what locking?

From: Catalin BOIE
Date: Fri Oct 03 2003 - 01:54:31 EST


On Fri, 3 Oct 2003, Jamie Lokier wrote:

> Catalin BOIE wrote:
> > What may happen if I modify idt on a running kernel?
> > It's lock_kernel enough?
>
> lock_kernel won't help at all. It doesn't disable interrupts.
>
> It's more likely, you want to use get_cpu()/put_cpu() to prevent the
> current kernel thread from being pre-empted to a different CPU.
get_cpu locks the thread on a CPU until put_cpu?

> > Of course that the new location contain a valid idt table.
>
> If the new table has the same entries as the old one for all
> interrupts which are enabled it should be fine. "lidt" is an atomic
> operation with respect to interrupts.
Great.

> If you are intending to change idt on all CPUs, you'll need something
> more complicated.

Hm. I realized that on a SMP it's a little hard to do it.
How can I change that on all cpus?
There is something to use that i can force my code to run on a specific
cpu?

>
> -- Jamie

Thank you very much, Jamie!

---
Catalin(ux) BOIE
catab@xxxxxxxxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/