From owner-freebsd-arch@FreeBSD.ORG Sun Jan 30 12:44:32 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 E99051065670; Sun, 30 Jan 2011 12:44:32 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id A3B638FC16; Sun, 30 Jan 2011 12:44:32 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p0UCTKnm037762 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 30 Jan 2011 04:29:31 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4D4559A2.7040601@freebsd.org> Date: Sun, 30 Jan 2011 04:29:22 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Daniel Eischen References: <201101291032.35544.hselasky@c2i.net> <201101301016.55633.hselasky@c2i.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-arch@freebsd.org, Hans Petter Selasky 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: Sun, 30 Jan 2011 12:44:33 -0000 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.