Re: Spinlocks

From: Pete Zaitcev (OTID3) (oted3354ac022639a1_at_comcast.net)
Date: 10/19/05


Date: Tue, 18 Oct 2005 15:33:08 -0700

On Tue, 18 Oct 2005 00:13:30 -0700, brankok wrote:

> from concurrent access, so I decided to use spinlock mechanism. I've
> read about functions that work with spinlocks and I decided to use
> _irqsave versions of the premitives both in the interrupt and in the
> noninterrupt code. Now I'm wondering if I should have used spinlocks at
> all. Couldn't I have just disable interrupts in in the noninterrupt
> code, do the critical section and then enable interrupts? What am I not
> getting?

An interrupt can happen on other CPU (or core, in multi-core CPUs)
while interrupts are disabled in your current CPU.

Disabling interrupts across all CPUs requires cross-calls, which
are very expensive when compared with local interrupt disabling.

-- Pete



Relevant Pages

  • Re: 2.6.27-rc6 xen soft lockup
    ... device interrupts are bound to vcpu 0 and there's nothing much else to ... During the time of the lockup the cpu load, as measured with cacti, was about 4% ... So I would say mostly idle ... # Device Drivers ...
    (Linux-Kernel)
  • Re: [parisc-linux] [patch 15/23] Add cmpxchg_local to parisc
    ... non-SMP-safe counter that protects updates against interrupts. ... could be vastely used in the kernel. ... "Local atomic operations only guarantee variable modification atomicity ... that only one CPU writes to the local_t data. ...
    (Linux-Kernel)
  • Re: [PATCH] kexec: force x86_64 arches to boot kdump kernels on boot cpu
    ... Thats what I'm doing at the moment. ... unicast interrupts delivered accross the ht bus to a single cpu, ... that that broadcast bit was set. ...
    (Linux-Kernel)
  • Re: program runs almost twice as slow on 2 CPU machine when 1 CPU
    ... As I said, from the system management tool's perspective, the term 'CPU ... load' means system and user threads vs idle thread - interrupts and DPC ... interrupts - only port and miniport drivers do it. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: how can i disble irq15 through C/assembly programming.
    ... Well, these machines do not run Windows, do they? ... This condition is enforced by the CPU itself, ... interrupts as a whole, but the OP wants to disable interrupts only for ... disable interrupts on CPU Y..... ...
    (microsoft.public.win32.programmer.kernel)