debuggers.hg

annotate xen/common/softirq.c @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents 0b88ccf6332d
children
rev   line source
kaf24@1020 1 /******************************************************************************
kaf24@1020 2 * common/softirq.c
kaf24@1020 3 *
kaf24@1543 4 * Softirqs in Xen are only executed in an outermost activation (e.g., never
kaf24@1543 5 * within an interrupt activation). This simplifies some things and generally
kaf24@1543 6 * seems a good thing.
kaf24@1020 7 *
kaf24@1020 8 * Copyright (c) 2003, K A Fraser
kaf24@1543 9 * Copyright (c) 1992, Linus Torvalds
iap10@274 10 */
iap10@274 11
kaf24@1248 12 #include <xen/config.h>
kaf24@1544 13 #include <xen/init.h>
kaf24@1248 14 #include <xen/mm.h>
keir@22446 15 #include <xen/preempt.h>
kaf24@1248 16 #include <xen/sched.h>
kaf24@13686 17 #include <xen/rcupdate.h>
kaf24@1544 18 #include <xen/softirq.h>
iap10@274 19
kaf24@3515 20 #ifndef __ARCH_IRQ_STAT
iap10@274 21 irq_cpustat_t irq_stat[NR_CPUS];
kaf24@3515 22 #endif
iap10@274 23
kaf24@3113 24 static softirq_handler softirq_handlers[NR_SOFTIRQS];
iap10@274 25
keir@20760 26 static void __do_softirq(unsigned long ignore_mask)
iap10@274 27 {
kfraser@10603 28 unsigned int i, cpu;
kaf24@9537 29 unsigned long pending;
iap10@274 30
kfraser@10603 31 for ( ; ; )
kfraser@10603 32 {
kfraser@10603 33 /*
kfraser@10603 34 * Initialise @cpu on every iteration: SCHEDULE_SOFTIRQ may move
kfraser@10603 35 * us to another processor.
kfraser@10603 36 */
kfraser@10603 37 cpu = smp_processor_id();
kaf24@13686 38
kaf24@13686 39 if ( rcu_pending(cpu) )
kaf24@13686 40 rcu_check_callbacks(cpu);
kaf24@13686 41
keir@21434 42 if ( ((pending = (softirq_pending(cpu) & ~ignore_mask)) == 0)
keir@21434 43 || cpu_is_offline(cpu) )
kfraser@10603 44 break;
kaf24@2852 45
kaf24@2842 46 i = find_first_set_bit(pending);
kaf24@2842 47 clear_bit(i, &softirq_pending(cpu));
kaf24@2842 48 (*softirq_handlers[i])();
kfraser@10603 49 }
iap10@274 50 }
iap10@274 51
keir@20760 52 void process_pending_softirqs(void)
keir@20760 53 {
keir@20760 54 ASSERT(!in_irq() && local_irq_is_enabled());
keir@20760 55 /* Do not enter scheduler as it can preempt the calling context. */
keir@20760 56 __do_softirq(1ul<<SCHEDULE_SOFTIRQ);
keir@20760 57 }
keir@20760 58
keir@20760 59 asmlinkage void do_softirq(void)
keir@20760 60 {
keir@22441 61 ASSERT(!in_atomic());
keir@20760 62 __do_softirq(0);
keir@20760 63 }
keir@20760 64
kaf24@1543 65 void open_softirq(int nr, softirq_handler handler)
iap10@274 66 {
keir@18435 67 ASSERT(nr < NR_SOFTIRQS);
kaf24@1543 68 softirq_handlers[nr] = handler;
iap10@274 69 }
kaf24@3952 70
keir@20026 71 void cpumask_raise_softirq(cpumask_t mask, unsigned int nr)
keir@20026 72 {
keir@20026 73 int cpu;
keir@20026 74
keir@20026 75 for_each_cpu_mask(cpu, mask)
keir@20026 76 if ( test_and_set_bit(nr, &softirq_pending(cpu)) )
keir@20026 77 cpu_clear(cpu, mask);
keir@20026 78
keir@20026 79 smp_send_event_check_mask(&mask);
keir@20026 80 }
keir@20026 81
keir@20026 82 void cpu_raise_softirq(unsigned int cpu, unsigned int nr)
keir@20026 83 {
keir@21211 84 if ( !test_and_set_bit(nr, &softirq_pending(cpu))
keir@21211 85 && (cpu != smp_processor_id()) )
keir@20026 86 smp_send_event_check_cpu(cpu);
keir@20026 87 }
keir@20026 88
keir@20026 89 void raise_softirq(unsigned int nr)
keir@20026 90 {
keir@20026 91 set_bit(nr, &softirq_pending(smp_processor_id()));
keir@20026 92 }
keir@20026 93
keir@17480 94 void __init softirq_init(void)
keir@17480 95 {
keir@17480 96 }
keir@17480 97
kaf24@3952 98 /*
kaf24@3952 99 * Local variables:
kaf24@3952 100 * mode: C
kaf24@3952 101 * c-set-style: "BSD"
kaf24@3952 102 * c-basic-offset: 4
kaf24@3952 103 * tab-width: 4
kaf24@3952 104 * indent-tabs-mode: nil
kaf24@4026 105 * End:
kaf24@3952 106 */