diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--x86\344\270\255\346\226\255\345\210\235\345\247\213\345\214\226.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--x86\344\270\255\346\226\255\345\210\235\345\247\213\345\214\226.md" new file mode 100755 index 0000000..e69de29 diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\344\270\255\346\226\255\345\217\267\346\230\240\345\260\204.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\344\270\255\346\226\255\345\217\267\346\230\240\345\260\204.md" new file mode 100755 index 0000000..a38b002 --- /dev/null +++ "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\344\270\255\346\226\255\345\217\267\346\230\240\345\260\204.md" @@ -0,0 +1 @@ +# hwirq 和 irq 的映射 \ No newline at end of file diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\345\210\235\345\247\213\345\214\226.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\345\210\235\345\247\213\345\214\226.md" index 22dd85d..e2edf9d 100755 --- "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\345\210\235\345\247\213\345\214\226.md" +++ "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\347\241\254\344\270\255\346\226\255--\345\210\235\345\247\213\345\214\226.md" @@ -2,6 +2,7 @@ kernel/irq/irqdesc.c: early_trap_init arch/arm/kernel/irq.c: init_IRQ ```c +// 非稀疏irq int __init early_irq_init(void) { int count, i, node = first_online_node; @@ -26,10 +27,54 @@ int __init early_irq_init(void) raw_spin_lock_init(&desc[i].lock); /* 设置中断描述符的锁所属的类, 此类用于防止死锁 */ lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); - /* 一些变量的初始化 */ + /* 描述符初始化 */ desc_set_defaults(i, &desc[i], node, NULL); } return arch_early_irq_init(); } + + /* 描述符初始化 */ +static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node, + struct module *owner) +{ + int cpu; + + /* 中断号 */ + desc->irq_data.irq = irq; + /* 中断描述符的中断控制器芯片为 no_irq_chip */ + desc->irq_data.chip = &no_irq_chip; + /* 中断控制器的私有数据为空 */ + desc->irq_data.chip_data = NULL; + desc->irq_data.handler_data = NULL; + desc->irq_data.msi_desc = NULL; + /* 设置中断状态 desc->status_use_accessors 为初始化状态_IRQ_DEFAULT_INIT_FLAGS */ + irq_settings_clr_and_set(desc, ~0, _IRQ_DEFAULT_INIT_FLAGS); + /* 中断默认被禁止, 设置 desc->irq_data->state_use_accessors = IRQD_IRQ_DISABLED */ + irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED); + /* 设置中断处理回调函数为 handle_bad_irq, handle_bad_irq 作为默认的回调函数, 此函数中基本上不做什么处理, 就是在屏幕上打印此中断信息, 并且 desc->kstat_irqs++ */ + desc->handle_irq = handle_bad_irq; + /* 嵌套深度为 1, 表示被禁止 1 次 */ + desc->depth = 1; + /* 初始化此中断发送次数为 0 */ + desc->irq_count = 0; + /* 无法处理的中断次数为 0 */ + desc->irqs_unhandled = 0; + /* 在/proc/interrupts 所显名字为空 */ + desc->name = NULL; + /* owner 为空 */ + desc->owner = owner; + + /* 初始化 kstat_irqs 中每个 CPU 项都为 0 */ + for_each_possible_cpu(cpu) + *per_cpu_ptr(desc->kstat_irqs, cpu) = 0; + + /* SMP 系统才使用的初始化, 设置 + * desc->irq_data.node = first_online_node + * desc->irq_data.affinity = irq_default_affinity + * 清除 desc->pending_mask + */ + desc_smp_init(desc, node); +} + ``` \ No newline at end of file diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__do_softirq.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__do_softirq.md" index 6f5d873..99cf343 100755 --- "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__do_softirq.md" +++ "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__do_softirq.md" @@ -7,7 +7,7 @@ tags: enum { HI_SOFTIRQ=0, //用于实现tasklet - TIMER_SOFTIRQ, //TIMER_SOFTIRQ和HRTIMER_SOFTIRQ用于实现定时器 + TIMER_SOFTIRQ, //TIMER_SOFTIRQ和HRTIMER_SOFTIRQ用于实现定时器 NET_TX_SOFTIRQ, NET_RX_SOFTIRQ, BLOCK_SOFTIRQ, diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__raise_softirq.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__raise_softirq.md" index 74c7446..0140f30 100755 --- "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__raise_softirq.md" +++ "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--__raise_softirq.md" @@ -8,7 +8,7 @@ tags: ```c #ifndef local_softirq_pending_ref -#define local_softirq_pending_ref irq_stat.__softirq_pending //软中断挂起位图,每bit代表一种软中断 +#define local_softirq_pending_ref irq_stat.__softirq_pending //软中断挂起位图,每bit代表一种软中断 #endif #define local_softirq_pending() (__this_cpu_read(local_softirq_pending_ref)) diff --git "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--ksoftirqd.md" "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--ksoftirqd.md" index 70fba79..fb3937a 100755 --- "a/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--ksoftirqd.md" +++ "b/linux/\345\206\205\346\240\270-\351\251\261\345\212\250/\344\270\255\346\226\255/\350\275\257\344\270\255\346\226\255--ksoftirqd.md" @@ -26,7 +26,7 @@ static void run_ksoftirqd(unsigned int cpu) cond_resched(); return; } - ksoftirqd_run_end(); // 开启cpu 中断响应 + ksoftirqd_run_end(); // 开启cpu 中断响应 } ```