IO调度器(二) IO的中断返回

IO的中断返回也是相当让人激动的一件事情:

28470  1)               |        handle_irq() {
 28471  1)   0.237 us    |          irq_to_desc();
 28472  1)               |          handle_edge_irq() {
 28473  1)   0.060 us    |            _raw_spin_lock();
 28474  1)               |            ack_apic_edge() {
 28475  1)   0.051 us    |              irq_complete_move();
 28476  1)   0.044 us    |              irq_move_irq();
 28477  1)   1.288 us    |            }
 28478  1)               |            handle_irq_event() {
 28479  1)   0.045 us    |              _raw_spin_unlock();
 28480  1)               |              handle_irq_event_percpu() {
 28481  1)               |                ahci_interrupt [libahci]() {
 28482  1)   0.046 us    |                  _raw_spin_lock();
 28483  1)               |                  ahci_handle_port_interrupt [libahci]() {
 28484  1)               |                    ata_qc_complete_multiple() {        // qc = ata_qc_from_tag(ap, tag); (会得到最终的command)
 28485  1)               |                      ata_qc_complete() {
 28486  1)               |                        __ata_qc_complete() {
 28487  1)   0.321 us    |                          ata_sg_clean();
 28488  1)               |                          ata_scsi_qc_complete() {
 28489  1)               |                            scsi_done() {
 28490  1)               |                              blk_complete_request() {
 28491  1)               |                                __blk_complete_request() {
 28492  1)   0.046 us    |                                  cpus_share_cache();
 28493  1)   0.588 us    |                                }
 28494  1)   0.961 us    |                              }
 28495  1)   1.342 us    |                            }
 28496  1)   0.051 us    |                            ata_qc_free();
 28497  1)   2.146 us    |                          }
 28498  1)   3.

上面是我lenovo笔记本上ATA硬盘中断返回的代码, 其中断处理函数是ata_qc_complete,

发现, 环环相扣的结构体,从中断的scsi指令,我们能追溯到block层封装的request, 然后把这个request放到软中断中去了, 然后该赢中断平安返回,

下面就是软中断处理主场了!

 28512  1)               |        irq_exit() {
 28513  1)               |          __do_softirq() {
 28514  1)   0.044 us    |            msecs_to_jiffies();
 28515  1)               |            blk_done_softirq() {
 28516  1)               |              scsi_softirq_done() {
 28517  1)               |                scsi_decide_disposition() {
 28518  1)   0.125 us    |                  scsi_handle_queue_ramp_up();
 28519  1)   0.563 us    |                }
 28520  1)   0.070 us    |                scsi_log_completion();
 28521  1)               |                scsi_finish_command() {
 28522  1)               |                  scsi_device_unbusy() {
 28523  1)   0.044 us    |                    _raw_spin_lock_irqsave();
 28524  1)   0.042 us    |                    _raw_spin_unlock();
 28525  1)   0.049 us    |                    _raw_spin_lock();
 28526  1)   0.059 us    |                    _raw_spin_unlock_irqrestore();
 28527  1)   1.474 us    |                  }
 28528  1)   0.086 us    |                  sd_done();
 28529  1)               |                  scsi_io_completion() {
 28530  1)               |                    blk_end_request() {
 28531  1)               |                      blk_end_bidi_request() {
 28532  1)               |                        blk_update_bidi_request() {
 28533  1)               |                          blk_update_request() {
 28534  1)   0.154 us    |                            blk_account_io_completion();
 28535  1)   0.132 us    |                            bio_advance();
 28536  1)               |                            bio_endio() {