User: Password:
|
|
Subscribe / Log in / New account

That's why people attempt abstraction

That's why people attempt abstraction

Posted Aug 12, 2011 22:54 UTC (Fri) by JoeBuck (guest, #2330)
In reply to: Avoiding the OS abstraction trap by thedevil
Parent article: Avoiding the OS abstraction trap

A device manufacturer typically wants to support not only Linux, but also BSD (e.g. Darwin/MacOSX) and Windows (various flavors), without writing three completely different drivers. Abstraction has its costs, but so does the approach outlined in the article.


(Log in to post comments)

That's why people attempt abstraction

Posted Aug 12, 2011 23:27 UTC (Fri) by djbw (subscriber, #78104) [Link]

Teams can collaborate and maybe find some highest-common-factor code to share, but at the end of day each environment has it nuances that need special attention. The cost of getting the abstraction wrong is high, the chance of getting abstractions layers right is low (for non-trivial drivers).

That's why people attempt abstraction

Posted Aug 13, 2011 3:00 UTC (Sat) by quotemstr (subscriber, #45331) [Link]

Yet, somehow, nvidia successfully develops its hugely complex drivers on top of an abstraction layer. In fact, these drivers often work better on Linux than bespoke drivers for other graphics hardware. I find it difficult to accept that writing a platform-specific driver for every platform is really the optimal approach.

That's why people attempt abstraction

Posted Aug 13, 2011 3:14 UTC (Sat) by mjg59 (subscriber, #23239) [Link]

nvidia benefit hugely from the fact that opengl is already a pretty effective abstraction layer, and the vast majority of their driver is devoted to turning opengl commands into the card's internal format. On the other hand, their lack of integration with the rest of Linux does carry costs. Their driver fails in a variety of situations where nouveau succeeds (handling multi-GPU laptops, systems where the EDID has to be obtained via ACPI, thermal monitoring, backlight control, integration with xrandr) because nouveau is able to take advantage of the infrastructure present in Linux. And nouveau's 2D performance is massively better than the nvidia blob, because nvidia have nothing to abstract 2D operations between Windows and Linux.

So it depends. If you want to do nothing but run 3D applications then their approach is successful, and if you want to do anything else their approach is dreadful.

That's why people attempt abstraction

Posted Aug 14, 2011 19:16 UTC (Sun) by mlankhorst (subscriber, #52260) [Link]

there are tales of horror in the nvidia glue code, look up os_smp_*_barrier in the glue code. Or their shotgun approach to cache flushing, wbinvd instead of a bunch of clflush calls. ;)

That's why people attempt abstraction

Posted Aug 13, 2011 19:18 UTC (Sat) by cpeterso (guest, #305) [Link]

Perhaps some platform-specific abstraction layers can be avoided if the driver design is inverted: have a cross-platform core that is called *from* the platform-specific code. The core can use event callbacks to invoke platform code.

The abstraction layers described in the article sound like they are focused on implementation details instead of capturing a higher-level "domain model". Admittedly, designing a platform-independent domain model for a kernel driver manipulating hardware sounds challenging.

https://secure.wikimedia.org/wikipedia/en/wiki/Domain-dri...

That's why people attempt abstraction

Posted Aug 16, 2011 21:01 UTC (Tue) by michaeljt (subscriber, #39183) [Link]

> Teams can collaborate and maybe find some highest-common-factor code to share, but at the end of day each environment has it nuances that need special attention. The cost of getting the abstraction wrong is high, the chance of getting abstractions layers right is low (for non-trivial drivers).

I could potentially imagine the review process of an "abstraction layer-based driver" going along the lines of "this abstraction is acceptable, this one is not, this one could be acceptable if it were changed a bit". You might then end up with things like some code which is generic for all other supported OSes (or most other? You might find that one or two other target OSes also benefit from having their own implementations) being re-implemented for Linux, but still keep your somewhat refactored core code OS-independent. And of course, like the Linux kernel API, your abstraction layer need not be set in stone and "right the first time". It can be refactored as problems are found or new needs appear.

I wonder though more generally whether it would be acceptable to the Linux kernel community to have code files in the kernel for which kernel.org is not the "primary" site? Otherwise there is little chance of a driver in the upstream kernel having any sort of shared core with other OSes.

That's why people attempt abstraction

Posted Aug 16, 2011 21:05 UTC (Tue) by dlang (subscriber, #313) [Link]

there is already code in the kernel that is primarily developed and maintained elsewhere.

however, the kernel developers don't feel much need to respect the idea of 'this code is read-only on kernel.org', if they make an interface change in the kernel, they will make that change even on these drivers that have their 'primary source' external to the kernel, and it's up to that external source to pick up the changes so that they don't break with the next merge request.

That's why people attempt abstraction

Posted Aug 18, 2011 20:34 UTC (Thu) by michaeljt (subscriber, #39183) [Link]

> there is already code in the kernel that is primarily developed and maintained elsewhere.
>
> however, the kernel developers don't feel much need to respect the idea of 'this code is read-only on kernel.org', if they make an interface change in the kernel, they will make that change even on these drivers that have their 'primary source' external to the kernel, and it's up to that external source to pick up the changes so that they don't break with the next merge request.

I suppose the easiest way around that would be to make sure that the code parts which are "kernel-external" only interface to other parts in the driver, and not to anything outside. Without letting those other parts become too much of a simple abstraction layer, see above. Another problem that I see though is coding style - having code shared between the kernel and something else in this way forces that something else to adopt the kernel coding style, which is likely not to be the same as their preferred style.

That's why people attempt abstraction

Posted Aug 13, 2011 11:44 UTC (Sat) by justincormack (subscriber, #70439) [Link]

Iscsi is not a device though, so that argument does not really apply.

That's why people attempt abstraction

Posted Aug 13, 2011 12:42 UTC (Sat) by ftc (subscriber, #2378) [Link]

The article is not about an iSCSI (SCSI over IP) driver, it's about the Intel C600 series chipset SAS controller, which goes by the somewhat unfortunate name of isci (with only one "s").

isc(s)i

Posted Aug 15, 2011 20:08 UTC (Mon) by wilck (guest, #29844) [Link]

> the somewhat unfortunate name of isci ...
... indeed. This name has caused more confusion than any other driver name I encountered. It's sort of a running gag already.

That's why people attempt abstraction

Posted Aug 15, 2011 4:04 UTC (Mon) by broonie (subscriber, #7078) [Link]

The problem you end up with is that you get a cross platform driver that doesn't work particularly well on any of the platforms; it ends up being non-idiomatic and often reimplementing the wheel.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds