public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Duncan Sands <baldrick@wanadoo.fr>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Use of sti in entry.S question
Date: 22 May 2003 10:28:33 +0200	[thread overview]
Message-ID: <p73ptmb8jwu.fsf@oldwotan.suse.de> (raw)
In-Reply-To: <200305220939.13619.baldrick@wanadoo.fr.suse.lists.linux.kernel>

Duncan Sands <baldrick@wanadoo.fr> writes:

> 2.5/arch/i386/kernel/entry.S:
> 
> In work_resched, schedule may be called with
> interrupts off:
> 
> work_resched:
>         call schedule
>         cli                             # make sure we don't miss an interrupt
>                                         # setting need_resched or sigpending
>                                         # between sampling and the iret
>         movl TI_FLAGS(%ebp), %ecx
>         andl $_TIF_WORK_MASK, %ecx      # is there any work to be done other
>                                         # than syscall tracing?
>         jz restore_all
>         testb $_TIF_NEED_RESCHED, %cl
>         jnz work_resched <====== schedule with interrupts disabled
> 
> Is this a mistake or an optimization?  Elsewhere in entry.S, interrupts
> are turned on before calling schedule:

It's a mistake, but a harmless one. The scheduler turns off interrupts
soon itself and the instructions it executes before that don't care.
The only reason it's not recommended to call schedule with interrupts
off is that the scheduler will turn them on again, usually breaking
your critical section. In this case it's ok because the next
instrution is a cli again.

-Andi

       reply	other threads:[~2003-05-22  8:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200305220939.13619.baldrick@wanadoo.fr.suse.lists.linux.kernel>
2003-05-22  8:28 ` Andi Kleen [this message]
2003-05-22 20:48   ` Use of sti in entry.S question Duncan Sands
2003-05-22  7:39 Duncan Sands

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=p73ptmb8jwu.fsf@oldwotan.suse.de \
    --to=ak@suse.de \
    --cc=baldrick@wanadoo.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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