Re: Re: kernel preemption while returning from interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/1/06, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
> Hello
>
> > > Why dont we consider preemption while returning from interrupts or
> > > exceptions ??
> >
> > i think we are considering this case, AFAIK you can register an
> > interrupt handler and specify whether this interrupt handler runs
> > with interrupts enabled or disabled. so we are just considering
> > preemption of the interrupt context just if the interrupts where
> > enabled while executing the interrupt handler
>
> Gaurav, maybe you can check how exception handler is called and see
> whether IF is cleared or set there before pushed into kernel stack. I
> am not sure why exception needs a condition where interrupt is masked
> (or disabled?).

Hi Mulyadi,

As far as I know, exceptions (CPU on occurence of exception) do not
disable the interrupts and nor even the exception handlers. I dont
know why the check for interrupts being disabled (IF flag pushed on to
stack) is done here. I am not able to figure out any case where this
check is useful. May be somebody else on this mailing list be able to
help us in understanding this.

If anybody knows, please put some light on this.

>
> Why kernel preemption is disabled during exception? IMHO, because

I dont think, kernel preemption is disabled while exception handling.
Here is one of the exception code and there is no disabling of
preemption.

403 ENTRY(coprocessor_error)
404         pushl $0
405         pushl $do_coprocessor_error
406         jmp error_code

379 error_code:
380         pushl %ds
381         pushl %eax
382         xorl %eax, %eax
383         pushl %ebp
384         pushl %edi
385         pushl %esi
386         pushl %edx
387         decl %eax                       # eax = -1
388         pushl %ecx
389         pushl %ebx
390         cld
391         movl %es, %ecx
392         movl ES(%esp), %edi             # get the function address
393         movl ORIG_EAX(%esp), %edx       # get the error code
394         movl %eax, ORIG_EAX(%esp)
395         movl %ecx, ES(%esp)
396         movl $(__USER_DS), %ecx
397         movl %ecx, %ds
398         movl %ecx, %es
399         movl %esp,%eax                  # pt_regs pointer
400         call *%edi
401         jmp ret_from_exception

> whenever exception arises, that means something critical happens and it
> needs to be handled ASAP. If interrupt is enabled to during this
> handler thus opening the possibility to be interleaved by other
> interrupt handler, there is a chance it introduces another exception
> that might lead to system crash

I also dont think that interrupts are disabled while handling
exceptions. I think an interrupt can occur while we are in exception
handler. Correct me if I am wrong.

-Guarav

>
> Just my 2 cents idea...
>
> regards,
>
> Mulyadi
>
>
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux