All of lore.kernel.org
 help / color / mirror / Atom feed
* SPARC32 SMP IRQ15 question
@ 2010-12-16 14:24 Daniel Hellstrom
  2010-12-21 21:02 ` David Miller
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: Daniel Hellstrom @ 2010-12-16 14:24 UTC (permalink / raw)
  To: sparclinux

Hello Dave,

I have an architectural question about the SPARC32 port regarding how 
IRQ15 is used for cross calls.

Why is IRQ15, the non-maskable IRQ, used for cross calls? Would it not 
be safer to use IRQ14?

Since IRQ15 is non-maskable it will even interrupt spin_lock_irqsave() 
protected reqions. I assume it is safe as long as the cross call 
function run in IRQ context does not try to take the same spinlock, for 
that would create a dead lock I believe. For example atomic_add() on 
SPARC32 below is implemented using one of four global spinlocks, does 
that mean that we can not use atomic functions at all from within a 
cross call function?

#define atomic_add(i, v)    ((void)__atomic_add_return( (int)(i), (v)))

#define ATOMIC_HASH_SIZE    4
#define ATOMIC_HASH(a)    (&__atomic_hash[(((unsigned long)a)>>8) & 
(ATOMIC_HASH_SIZE-1)])

spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
    [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
};

int __atomic_add_return(int i, atomic_t *v)
{
    int ret;
    unsigned long flags;
    spin_lock_irqsave(ATOMIC_HASH(v), flags);

    ret = (v->counter += i);

    spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
    return ret;
}


This particular case is interesting since atomic instructions are used 
by drain_local_pages() helper functions, which is scheduled as a cross 
call in drain_all_pages():

#0   0xf02cb884   0xf14b97a0   _raw_spin_lock_irqsave + 0x54
#1   0xf0195024   0xf14b9800   __atomic_add_return + 0x18  (via 
zone_page_state_add() include/linux/vmstat.h: 145)
#2   0xf007dfa8   0xf14b9860   __mod_zone_page_state + 0x64   
(mm/vmstat.c: 165)
#3   0xf006f9cc   0xf14b98c0   free_pcppages_bulk + 0x340  
(mm/page_alloc.c: 586)
#4   0xf006fb58   0xf14b9938   drain_local_pages + 0x64
#5   0xf001cb00   0xf14b9998   leon_cross_call_irq + 0x3c

/*
 * Spill all the per-cpu pages from all CPUs back into the buddy allocator
 */
void drain_all_pages(void)
{
    on_each_cpu(drain_local_pages, NULL, 1);
}


Best Regards,

Daniel Hellstrom
Aeroflex Gaisler

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-01-26 21:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 14:24 SPARC32 SMP IRQ15 question Daniel Hellstrom
2010-12-21 21:02 ` David Miller
2010-12-21 22:44 ` Jiri Gaisler
2010-12-22  3:54 ` David Miller
2010-12-22  9:19 ` Alex Buell
2010-12-22  9:51 ` Jiri Gaisler
2010-12-22 12:27 ` Daniel Hellstrom
2010-12-22 19:53 ` David Miller
2010-12-22 19:56 ` David Miller
2010-12-22 20:23 ` Alex Buell
2010-12-22 22:28 ` David Miller
2010-12-26 12:34 ` Kjetil Oftedal
2010-12-26 14:44 ` Jiri Gaisler
2010-12-27  1:55 ` David Miller
2010-12-27 17:28 ` crn
2011-01-03 14:14 ` Daniel Hellstrom
2011-01-03 14:19 ` Daniel Hellstrom
2011-01-26 17:02 ` Daniel Hellstrom
2011-01-26 19:52 ` David Miller
2011-01-26 21:28 ` daniel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.