user198729
user198729

Reputation: 63636

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 actual hardware device?

Upvotes: 1

Views: 702

Answers (3)

armguy
armguy

Reputation: 121

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.

Upvotes: 2

Jakob Borg
Jakob Borg

Reputation: 24435

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.

Upvotes: 1

zildjohn01
zildjohn01

Reputation: 11515

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.

Upvotes: 1

Related Questions