Commit 09d6ddd1 authored by 你宁可空转也不愿被我抢占's avatar 你宁可空转也不愿被我抢占
Browse files

[Update/doc]添加irq_desc结构体分析

parent 899bd6bf
No related merge requests found
Showing with 58 additions and 2 deletions
+58 -2
......@@ -12,4 +12,60 @@
- `long unsigned int thread_flags`: 中断线程的标志。这些标志用于管理中断线程的行为。
- `long unsigned int thread_mask`: 中断线程掩码,决定了哪些CPU可以运行这个中断线程。
- `const char *name`: 指向中断名称的指针,通常是与该中断关联的设备名称。
- `struct proc_dir_entry *dir`: 指向proc文件系统中表示此中断信息的目录的指针。这用于在/proc/irq/下创建有关这个中断的信息文件。
\ No newline at end of file
- `struct proc_dir_entry *dir`: 指向proc文件系统中表示此中断信息的目录的指针。这用于在/proc/irq/下创建有关这个中断的信息文件。
# struct irq_desc
```c
struct irq_desc {
struct irq_common_data irq_common_data; // 包含IRQ的通用信息
struct irq_data irq_data; // 包含特定于该IRQ的数据
unsigned int __percpu *kstat_irqs; // 每个CPU的中断计数
irq_flow_handler_t handle_irq; // 中断流程处理函数
struct irqaction *action; /* IRQ处理函数链表 */
unsigned int status_use_accessors; // 通过访问函数使用的状态
unsigned int core_internal_state__do_not_mess_with_it; // 核心内部状态,外部不应该修改
unsigned int depth; // 中断禁用的嵌套深度
unsigned int wake_depth; // 唤醒使能的嵌套深度
unsigned int tot_count; // 该中断的总触发次数
unsigned int irq_count; // 检测到的中断触发次数(用于检测坏掉的IRQ)
unsigned long last_unhandled; // 未处理计数的老化计时器
unsigned int irqs_unhandled; // 未处理的中断计数
atomic_t threads_handled; // 正在处理此IRQ的线程数
int threads_handled_last; // 上一次处理此IRQ的线程数
raw_spinlock_t lock; // 保护此结构体的自旋锁
struct cpumask *percpu_enabled; // 每个CPU是否启用了此中断
const struct cpumask *percpu_affinity; // 每个CPU的亲和性掩码
#ifdef CONFIG_SMP
const struct cpumask *affinity_hint; // 亲和性提示
struct irq_affinity_notify *affinity_notify; // 亲和性变更通知
#ifdef CONFIG_GENERIC_PENDING_IRQ
cpumask_var_t pending_mask; // 待处理的CPU掩码
#endif
#endif
unsigned long threads_oneshot; // 一次性处理此IRQ的线程
atomic_t threads_active; // 活跃的处理线程数
wait_queue_head_t wait_for_threads; // 等待处理线程完成的等待队列
#ifdef CONFIG_PM_SLEEP
unsigned int nr_actions; // 此IRQ的action数
unsigned int no_suspend_depth; // 不挂起的深度
unsigned int cond_suspend_depth; // 有条件挂起的深度
unsigned int force_resume_depth; // 强制恢复的深度
#endif
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *dir; // 对应的/proc文件系统入口
#endif
#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
struct dentry *debugfs_file; // 对应的debugfs文件
const char *dev_name; // 设备名
#endif
#ifdef CONFIG_SPARSE_IRQ
struct rcu_head rcu; // 用于RCU的头
struct kobject kobj; // 对应的内核对象
#endif
struct mutex request_mutex; // 申请或释放IRQ时使用的互斥锁
int parent_irq; // 父IRQ编号,用于级联中断
struct module *owner; // 拥有此中断的模块
const char *name; // IRQ的名字
} ____cacheline_internodealigned_in_smp; // 确保结构体在SMP环境中按缓存行对齐
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment