Re: synchronisation question

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

 



On 8/28/05, Hemant Mohapatra <hemant.mohapatra@xxxxxxxxx> wrote:
> > For some esoteric feature that I'm trying to implement, I need to be able to
> > modify the IDT from within a kernel module.
> 
> I am assuming you know this is essentially a "hack" and should be done
> for educational purposes only.
> 
> > Is a sti() / cli() enough to protect a critical section? Or should I use a
> > synchronization primitive exposed by the kernel?
> 
> cli/sti() interfaces are now outdated as they disable the interrupts
> on _all_ processors (unless you are using it in interrupt context,
> where it'll disable interrupts on the local CPU).

Are you sure of it that cli()/sti() disable the interrupts on all
processors, i think it only disables the interrupts on local CPU. Well
the cli() function is defined as follows in include/linux/interrupt.h

64 static inline void __deprecated cli(void)
65 {
66         local_irq_disable();
67 }

and local_irq_disable() just calls the assembly instruction cli, which
actually just clears the interrupts flag in EFLAG register, disabling
the interrupts on local CPU. Above definition is defined for UP
kernels, can you point out if the same function is also defined for
SMP kernels as well, I cud not find it in code.

regards,
-Gaurav

> 
> ./h
> --
> Operating Systems and Computer Architecture Research  - University of Cincinnati
> http://www.ececs.uc.edu/~mohapth
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

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