开发者

What's the bottom half for a driver that doesn't actually have a corresponding hardware?

This question is inspired from this answer,

what does the bottom half do for a driver that doesn't have a开发者_如何学Pythonctual hardware device?


The bottom half concept is only useful when you are servicing a hardware interrupt in your driver. A hardware interrupt service routing will mask lower priority interrupts, so you want to get out of the hardware isr as quickly as possible. Bottom halves, whether tasklets or work queues, get treated like a soft interrupt, so they typically do not mask anything.

As far as task segregation goes, you don't want to make any calls that may get blocked, in the hardware isr. The best practice is to save your data in the top half, then do any processing/system calls/kmalloc/etc in the bottom half.


That looks like more of a conceptual division than an actual division, i.e.:

  • bottom half -- sends and receives messages to and from device
  • top half -- talks to the platform

In a driver without an actual device, the "bottom half" does whatever the driver is supposed to do. For example, if it's a RAM disk, it manages blocks of memory.


That answer uses a metaphor to explain device drivers. There isn't necessarily a division of two halves, in which the bottom one controls the hardware.

In any case, the answer could be that that "bottom half" simulates some hardware instead, like a virtual CD-ROM drive or something like that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜