From owner-freebsd-arch@FreeBSD.ORG Mon Jan 31 03:41:20 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2940D1065672; Mon, 31 Jan 2011 03:41:20 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id AF6B18FC2A; Mon, 31 Jan 2011 03:41:19 +0000 (UTC) Received: by qwj9 with SMTP id 9so4917450qwj.13 for ; Sun, 30 Jan 2011 19:41:18 -0800 (PST) Received: by 10.224.135.232 with SMTP id o40mr5799884qat.392.1296445278050; Sun, 30 Jan 2011 19:41:18 -0800 (PST) Received: from [10.0.1.198] ([72.253.42.56]) by mx.google.com with ESMTPS id t7sm14503556qcs.4.2011.01.30.19.41.14 (version=SSLv3 cipher=RC4-MD5); Sun, 30 Jan 2011 19:41:16 -0800 (PST) Date: Sun, 30 Jan 2011 17:44:15 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Julian Elischer In-Reply-To: <4D4559A2.7040601@freebsd.org> Message-ID: References: <201101291032.35544.hselasky@c2i.net> <201101301016.55633.hselasky@c2i.net> <4D4559A2.7040601@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Daniel Eischen , Hans Petter Selasky , freebsd-arch@freebsd.org Subject: Re: ofed merge soon X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2011 03:41:20 -0000 On Sun, 30 Jan 2011, Julian Elischer wrote: > On 1/30/11 4:12 AM, Daniel Eischen wrote: >> On Sun, 30 Jan 2011, Hans Petter Selasky wrote: >> >>> On Sunday 30 January 2011 08:44:45 Jeff Roberson wrote: >>>> On Sat, 29 Jan 2011, Hans Petter Selasky wrote: >>>>> Hi, >>>>> >>>>> Just a comment: >>>>> >>>>> + >>>>> +#define DEFINE_MUTEX(lock) >>>>> \ >>>>> + mutex_t lock; >>>>> \ >>>>> + SX_SYSINIT_FLAGS(lock, &(lock).sx, "lnxmtx", SX_NOWITNESS) >>>>> + >>>>> +static inline void >>>>> +linux_mutex_init(mutex_t *m) >>>>> +{ >>>>> + >>>>> + memset(&m->sx, 0, sizeof(m->sx)); >>>>> + sx_init_flags(&m->sx, "lnxmtx", SX_NOWITNESS); >>>>> +} >>>>> + >>>>> +#define mutex_init linux_mutex_init >>>>> >>>>> I see you workaround the fact that Linux does not destroy any mutexes by >>>>> disabling witness. Do you have any plan to upgrade the Linux 3rd party >>>>> code to destroy mutexes? >>>> >>>> It introduces too many diffs that are difficult to maintain. I don't >>>> think it's viable. One option would be to tag the memory linux uses so >>>> that when it's freed we reclaim any locks in it. You could scan the >>>> witness tables for pointers within the free'd region fairly easily. It >>>> wouldn't be pretty though. >>> >>> How about requiring that Linux code, once imported, must destroy it's >>> mutexes? >> >> Or add a mutex_destroy for all OS's, and make it a noop >> for Linux. Then there are no diffs to maintain... > > the upstream source is linux only code and they do not accept non linux > patches. Julian's right. They won't accept anything. There is also the problem that their locks have no names and witness requires a name. We'd have to name them by address or something similarly hacky and this then leaves holes in what witness can discover. Fortunately, they have their own lock order test tool (lockdep) and do their own order validation. The places where they cross over into FreeBSD are few and well contained. If we can assume that they get the locks right on their own platform and we get our locks correctly it's not so hard to manage the places that they meet. Thanks, Jeff > > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" >