public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Catalin BOIE <util@deuroconsult.ro>
Cc: linux-kernel@vger.kernel.org
Subject: Re: idt change in a running kernel? what locking?
Date: Fri, 3 Oct 2003 18:02:10 +0100	[thread overview]
Message-ID: <20031003170210.GA18415@mail.shareable.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0310030945050.10930@hosting.rdsbv.ro>

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

  reply	other threads:[~2003-10-03 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-03  5:52 idt change in a running kernel? what locking? Catalin BOIE
2003-10-03  6:34 ` Jamie Lokier
2003-10-03  6:52   ` Catalin BOIE
2003-10-03 17:02     ` Jamie Lokier [this message]
2003-10-06  5:12       ` Catalin BOIE
2003-10-06 17:07         ` Jamie Lokier
2003-10-07  4:35           ` Catalin BOIE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031003170210.GA18415@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=util@deuroconsult.ro \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox