Features Download
From: Alexander Kabaev <kabaev <at> gmail.com>
Subject: Re: Linux kernel compatability
Newsgroups: gmane.os.freebsd.architechture
Date: Tuesday 4th January 2011 13:22:52 UTC (over 7 years ago)
On Mon, 3 Jan 2011 19:03:01 -1000 (HST)
Jeff Roberson  wrote:

> On Mon, 3 Jan 2011, Alexander Kabaev wrote:
> > On Mon, 3 Jan 2011 10:31:24 -1000 (HST)
> > Jeff Roberson  wrote:
> >
> >> Hello Folks,
> >>
> >> Some of you may have seen my infiniband work proceed in svn.  It is
> >> coming to a close soon and I will be integrating it into current.
> >> I have a few patches to the kernel to send for review but I wanted
> >> to bring up the KPI wrapper itself for discussion.
> >>
> >> The infiniband port has been done by creating a 10,000 line KPI
> >> compatability layer.  With this layer the vast majority of the
> >> driver code runs unmodified.  The exceptions are anything that
> >> interfaces with skbs and most of the code that deals with network
> >> interfaces.
> >>
> >> Some examples of things supported by the wrapper:
> >>
> >> atomics, types, bitops, byte order conversion, character devices,
> >> pci devices, dma, non-device files, idr tables, interrupts,
> >> ioremap, hashes, kobjects, radix trees, lists, modules, notifier
> >> blocks, rbtrees, rwlock, rwsem, semaphore, schedule, spinlocks,
> >> kalloc, wait queues, workqueues, timers, etc.
> >>
> >> Obviously a complete wrapper is impossible and I only implemented
> >> the features that I needed.  The build is accomplished by pointing
> >> the linux compatible code at sys/ofed/include/ which has a
> >> simulated linux kernel include tree.  There are some config(8)
> >> changes to help this along as well.
> >>
> >> I have seen that some attempt at similar wrappers has been made
> >> elsewhere. I wonder if instead of making each one tailored to
> >> individual components, which mostly seem to be filesystems so far,
> >> should we put this in a central place under compat somewhere?  Is
> >> this project doomed to be tied to a single consumer by the specific
> >> nature of it?
> >>
> >> Other comments or concerns?
> >>
> >> Thanks,
> >> Jeff
> >
> >
> > This probably will go against popular opinion here, but having 10k
> > linux emulation layer that _almost_ work in the tree will be an
> > unfortunate event and will do more damage to FreeBSD as a platform
> > than good in the long run. I would rather see this code never hit
> > main repository.
> I would argue that the layer works very well for infiniband.  Much
> better than almost.  It is only almost complete in that there is no
> need for me to implement features that we're not using.
> I am interested in hearing your other concerns however.
> Thanks,
> Jeff

The considerations are simple enough. First, we do not have many IB
users of FreeBSD in the wild and those that we have (Isilon) seem to be
perfectly capable of managing the IB stack out of the tree, without
dumping the thousands of lines of the code into the base. If they had
the stack before, but were not willing/capable to provide adequate care
for it in the past, there is no reason to expect things to change with
second stack, which now will rot in our tree instead of theirs. 

Second, semi-complete Linux compat layer in kernel will have the
same effect as linuxulator in userland - we do have some vendors still
trying to bother with FreeBSD drivers for their hardware now and we
will have none after we provide the possibility to hack their Linux
code to run somewhat stably on top of Linux compat layer. Due to
intentional fluidity of Linux kAPI, our shims will never quite walk and
quack like their original implementation in Linux kernel and combined
result will always be lees stable than native Linux linux drivers in
Linux kernel.

Alexander Kabaev
CD: 3ms