Re: cli() / sti()

Linus Torvalds (torvalds@transmeta.com)
22 Jun 1997 00:26:44 GMT


In article <19970621111600.16909.qmail@bigred.inka.de>,
Olaf Titz <olaf@bigred.inka.de> wrote:
>> _may_ become a per-device serialization in the future, but as a driver
>> writer you should more-or-less be able to depend on one particular
>> driver start_xmit() entrypoint always being serialized).

[ Let me clarify this, as somebody already asked: I should say that in
the future we may be doing per-DEVICE serialization, and probably not
per-driver. There is a difference: if the same driver handles
multiple devices, some day that single driver may have to be
re-entrant wrt any global data. On the other hand any global data is
obviously bad - the driver should use per-device data structures
anyway ].

>Thanks. I'll code according to that. Btw., another driver with useless
>internal serialization is new_tunnel.c (if that matters anything
>except for a few cycles in cli mode).

I think most of the drivers have the useless serialization code. I
think I removed it only from the loopback driver because for the
loopback driver it actually makes a difference (for most other drivers
the hardware itself is the main bottle-neck, with the loopback driver
the serialization actually showed up on latency charts).

If somebody wants to clean up drivers, fell free to do so and send me
patches (but don't do them all at once: send small patches that are
easier to verify for correctness). There are other issues than just the
unnecessary serialization: some drivers still have vestiges of the time
when the normal interrupt primitives didn't support IRQ sharing, so the
drivers have cruft that do it on a per-driver basis.

(I _think_ I got rid of all the "irq_to_dev[]" mappings, but maybe that
particular horridness still exists hidden in some corner too).

Linus