Addressing an IO Device

team bbl


Addressing an I/O Device

Memory-mapped I/O today is considered the de facto standard that is utilized by a CPU to address an I/O device. In such a design, portions of the virtual address space are assigned to I/O devices. Simple read() and write() operations from or to these addresses cause data to be transferred. Some portion of the virtual address space is further assigned to actually control the devices. Commands such as load and store operations to a device represent access operations to that particular range of address space. Interrupt-driven I/O allows a CPU to work on a thread that is in a runnable state, while I/O operations are serviced for other threads.

In most contemporary systems, DMA hardware enables data transfers without any CPU intervention. A DMA module is defined as a specialized processor that transfers data between the memory subsystem and an I/O device while the CPU is servicing other tasks. A DMA module is always external to a CPU and acts as a bus master.

The first step in a DMA transfer consists of a CPU setting up the DMA registers that contain a memory address and the number of bytes to be transferred. After the DMA transfer is complete, the DMA controller interrupts the CPU, increasing the intelligence of the DMA device by utilizing I/O controllersenabling the CPU to service even more tasks. The operating system typically generates a queue of I/O control blocks that contain the data, source, and destination locations, as well as the data size. The I/O controller processes all the requests, and after the tasks are completed, it sends a single interrupt to the CPU. This scenario economizes on the number of interrupts encountered on the system; therefore, it might increase aggregate throughput performance.

The Linux file systems submit I/O requests by utilizing submit_bio(). This function submits requests by utilizing the request function as specified during queue creation. Technically, device drivers do not have to use the I/O scheduler; however, all SCSI devices utilize the scheduler by virtue of the SCSI midlayer. The scsi_alloc_queue() function calls blk_init_queue(), which sets the request function to scsi_request_fn(). The scsi_request_fn() function takes requests from the I/O scheduler on dequeue and passes them to the device driver.

    team bbl



    Performance Tuning for Linux Servers
    Performance Tuning for Linux Servers
    ISBN: 0137136285
    EAN: 2147483647
    Year: 2006
    Pages: 254

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net