From owner-freebsd-arch@FreeBSD.ORG Sun Nov 25 20:14:45 2012 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E236C46 for ; Sun, 25 Nov 2012 20:14:45 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [88.198.91.248]) by mx1.freebsd.org (Postfix) with ESMTP id 9E3518FC0C for ; Sun, 25 Nov 2012 20:14:44 +0000 (UTC) Received: from [207.6.254.8] (helo=[192.168.1.67]) by id.bluezbox.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1TcibA-0009hM-6l; Sun, 25 Nov 2012 12:14:41 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: Porting linux drivers [was: Re: [RFC] sema_wait_sig] From: Oleksandr Tymoshenko In-Reply-To: <1353871135.69940.77.camel@revolution.hippie.lan> Date: Sun, 25 Nov 2012 12:14:21 -0800 Content-Transfer-Encoding: 7bit Message-Id: <672A2D77-2BF7-41E1-8CAB-F199B8C8A5C1@bluezbox.com> References: <1353871135.69940.77.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1499) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: On 2012-11-25, at 11:18 AM, Ian Lepore wrote: > On Thu, 2012-11-22 at 22:12 -0800, Oleksandr Tymoshenko wrote: >> Hello, >> >> Is there any particular reason FreeBSD does not have sema_wait_sig >> function? It seems to be easily implementable using cv_wait_sig >> function. >> >> The reason I'm asking is that I'm getting some Linux drivers >> ported to FreeBSD and the code in question relies on semaphores >> and there is no obvious alternative to down_interruptible function. >> I realize that not all approaches to driver development are easily >> mappable from OS to OS but in this case lack of cv_wait_sig seems >> like gap in API. Unless of course there is strong rationale behind it. > > As if this thread weren't contentious enough already, it seems to me to > be the perfect lead-in to a question I've long wondered about... > > Given that linux drivers are pretty much universally GPL licensed, > what's the legality of "porting" them (whatever that means) to freebsd? > Just how much can you cobble from a GPL'd linux driver in creating a > BSD-licensed freebsd driver? > > I've done my best to avoid EVER looking at linux driver code when > working on freebsd drivers, because I don't know the legalistic answers > to such questions. I know the "what feels right to my moral sense" > answer, which is if you study the linux driver and then write > essentially the same driver for freebsd, it doesn't matter if you've > re-typed the code with different variable names, you've copied it. > > I've peeked at the linux code from time to time, mostly to confirm my > understanding of poorly-written chip datasheets, or to find the meaning > of some status register bit that doesn't seem to be documented > elsewhere. But it would be nice to know where the proper lines are that > should not be crossed. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 20:14:45 -0000 On 2012-11-25, at 11:18 AM, Ian Lepore wrote: > On Thu, 2012-11-22 at 22:12 -0800, Oleksandr Tymoshenko wrote: >> Hello, >> >> Is there any particular reason FreeBSD does not have sema_wait_sig >> function? It seems to be easily implementable using cv_wait_sig >> function. >> >> The reason I'm asking is that I'm getting some Linux drivers >> ported to FreeBSD and the code in question relies on semaphores >> and there is no obvious alternative to down_interruptible function. >> I realize that not all approaches to driver development are easily >> mappable from OS to OS but in this case lack of cv_wait_sig seems >> like gap in API. Unless of course there is strong rationale behind it. > > As if this thread weren't contentious enough already, it seems to me to > be the perfect lead-in to a question I've long wondered about... > > Given that linux drivers are pretty much universally GPL licensed, > what's the legality of "porting" them (whatever that means) to freebsd? > Just how much can you cobble from a GPL'd linux driver in creating a > BSD-licensed freebsd driver? > > I've done my best to avoid EVER looking at linux driver code when > working on freebsd drivers, because I don't know the legalistic answers > to such questions. I know the "what feels right to my moral sense" > answer, which is if you study the linux driver and then write > essentially the same driver for freebsd, it doesn't matter if you've > re-typed the code with different variable names, you've copied it. > > I've peeked at the linux code from time to time, mostly to confirm my > understanding of poorly-written chip datasheets, or to find the meaning > of some status register bit that doesn't seem to be documented > elsewhere. But it would be nice to know where the proper lines are that > should not be crossed. Just to be clear - the drivers in question are going to be relicensed to BSD (actually, double-licensed) by upstream. And if it's not happening FreeBSD version will remain GPL.