lkml.org 
[lkml]   [2003]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: idt change in a running kernel? what locking?
Catalin BOIE wrote:
> > 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?

Yes, it disables preemption.
Taking any spinlock will do it too.

> > 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?

on_each_cpu() will call a function on each CPU. Be careful that the
function is safe in the contexts in which it will be called.

If you just want to force you code to run on one cpu, that is
automatic if you are holding a spinlock (but then you can't schedule,
return to userspace etc.)

In general you can fix a task to a cpu using set_cpus_allowed().

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

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.062 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site