Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Randolph Chung <tausq@debian.org>
Cc: John David Anglin <dave@hiauly1.hia.nrc.ca>,
	carlos@baldric.uwo.ca, parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] Re: Trap handler
Date: Mon, 9 Dec 2002 12:54:16 +0000	[thread overview]
Message-ID: <20021209125416.F20336@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20021209061913.GM21187@tausq.org>; from tausq@debian.org on Sun, Dec 08, 2002 at 10:19:13PM -0800

On Sun, Dec 08, 2002 at 10:19:13PM -0800, Randolph Chung wrote:
> the fix has to do with where we should return to after handling an
> interruption. in pre-2.4.20 code we used to return to intr_return. Grant
> thinks that is incorrect and changed it to intr_restore (basically just
> doing the rfi). the -pa12 patch changes it back so it will handle
> pending signals. The items that remain not handled are restoring I-bit,
> softirqs (and irqstats) and rescheduling. We are not sure if those bits
> are needed for interruptions....  can you guys shed some light on this?

Well, let's look at the reference platform (ie x86):

ENTRY(page_fault)
        pushl $do_page_fault
        jmp error_code

error_code:
(blah blah blah.  sets up stuff & calls the address on the stack)
        call *%edi
        addl $8, %esp
        jmp ret_from_exception

ret_from_exception:
        preempt_stop
ret_from_intr:
        GET_THREAD_INFO(%ebx)
        movl EFLAGS(%esp), %eax         # mix EFLAGS and CS
        movb CS(%esp), %al
        testl $(VM_MASK | 3), %eax
        jz resume_kernel                # returning to kernel or vm86-space
ENTRY(resume_userspace)
        cli                             # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret
        movl TI_FLAGS(%ebx), %ecx
        andl $_TIF_WORK_MASK, %ecx      # is there any work to be done on
                                        # int/exception return?
        jne work_pending
        jmp restore_all

(with preemption disabled, resume_kernel == restore_all)

restore_all:
        RESTORE_ALL

        # perform work that needs to be done immediately before resumption
        ALIGN
work_pending:
        testb $_TIF_NEED_RESCHED, %cl
        jz work_notifysig
work_resched:

So x86 will potentially reschedule on successfully handling a page
fault.  softirqs seem to only get run if we're returning to userspace,
unless we're switching tasks.  That might be a bug in the x86 code.
Judging from the use of cli & sti in the x86 asm, I would venture to
suggest that the I bit should be cleared.  It makes sense anyway --
you can't expect interrupts to be disabled over a page fault.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

  reply	other threads:[~2002-12-09 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20021208232601.GH21187@tausq.org>
2002-12-08 23:55 ` [parisc-linux] Re: Trap handler John David Anglin
2002-12-09  5:12   ` Randolph Chung
2002-12-09  6:19     ` Randolph Chung
2002-12-09 12:54       ` Matthew Wilcox [this message]
2002-12-09 18:03         ` Grant Grundler
2002-12-09 18:20           ` Matthew Wilcox
2002-12-09 18:41             ` Grant Grundler
2002-12-09 18:55               ` Matthew Wilcox
2002-12-09 16:18       ` John David Anglin
2002-12-09 16:31         ` John David Anglin

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=20021209125416.F20336@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=carlos@baldric.uwo.ca \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=tausq@debian.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