From owner-p4-projects@FreeBSD.ORG Sun Feb 11 14:18:36 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C50BE16A408; Sun, 11 Feb 2007 14:18:36 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 76A3C16A407 for ; Sun, 11 Feb 2007 14:18:36 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 65BAD13C4B4 for ; Sun, 11 Feb 2007 14:18:36 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l1BEIaki085053 for ; Sun, 11 Feb 2007 14:18:36 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l1BEIa37085050 for perforce@freebsd.org; Sun, 11 Feb 2007 14:18:36 GMT (envelope-from rdivacky@FreeBSD.org) Date: Sun, 11 Feb 2007 14:18:36 GMT Message-Id: <200702111418.l1BEIa37085050@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 114387 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Feb 2007 14:18:37 -0000 http://perforce.freebsd.org/chv.cgi?CH=114387 Change 114387 by rdivacky@rdivacky_witten on 2007/02/11 14:18:34 Change emul_shared_lock back to an sx. We need sleepable lock because we need to hold this lock while doing pfind() which results in a LOR caused by rw -> sx -> mutex locking order. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysvec.c#10 edit .. //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#36 edit .. //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.h#10 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_sysvec.c#5 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_sysvec.c#10 (text+ko) ==== @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -1080,7 +1079,7 @@ SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF); - rw_init(&emul_shared_lock, "emuldata->shared lock"); + sx_init(&emul_shared_lock, "emuldata->shared lock"); LIST_INIT(&futex_list); sx_init(&futex_sx, "futex protection lock"); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, @@ -1111,7 +1110,7 @@ SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); mtx_destroy(&emul_lock); - rw_destroy(&emul_shared_lock); + sx_destroy(&emul_shared_lock); sx_destroy(&futex_sx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag); ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.c#36 (text+ko) ==== @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -56,7 +55,7 @@ #include #endif -struct rwlock emul_shared_lock; +struct sx emul_shared_lock; struct mtx emul_lock; /* this returns locked reference to the emuldata entry (if found) */ ==== //depot/projects/linuxolator/src/sys/compat/linux/linux_emul.h#10 (text+ko) ==== @@ -60,10 +60,10 @@ #define EMUL_LOCK(l) mtx_lock(l) #define EMUL_UNLOCK(l) mtx_unlock(l) -#define EMUL_SHARED_RLOCK(l) rw_rlock(l) -#define EMUL_SHARED_RUNLOCK(l) rw_runlock(l) -#define EMUL_SHARED_WLOCK(l) rw_wlock(l) -#define EMUL_SHARED_WUNLOCK(l) rw_wunlock(l) +#define EMUL_SHARED_RLOCK(l) sx_slock(l) +#define EMUL_SHARED_RUNLOCK(l) sx_sunlock(l) +#define EMUL_SHARED_WLOCK(l) sx_xlock(l) +#define EMUL_SHARED_WUNLOCK(l) sx_xunlock(l) /* for em_find use */ #define EMUL_DOLOCK 1 @@ -74,7 +74,7 @@ void linux_schedtail(void *, struct proc *); void linux_proc_exec(void *, struct proc *, struct image_params *); -extern struct rwlock emul_shared_lock; +extern struct sx emul_shared_lock; extern struct mtx emul_lock; #endif /* !_LINUX_EMUL_H_ */ ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_sysvec.c#5 (text+ko) ==== @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -919,7 +918,7 @@ SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF); - rw_init(&emul_shared_lock, "emuldata->shared lock"); + sx_init(&emul_shared_lock, "emuldata->shared lock"); LIST_INIT(&futex_list); sx_init(&futex_sx, "futex protection lock"); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, @@ -950,7 +949,7 @@ SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); mtx_destroy(&emul_lock); - rw_destroy(&emul_shared_lock); + sx_destroy(&emul_shared_lock); sx_destroy(&futex_sx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);