From owner-freebsd-current@FreeBSD.ORG Sun Nov 20 18:27:33 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40046106566C; Sun, 20 Nov 2011 18:27:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CD13E8FC14; Sun, 20 Nov 2011 18:27:32 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pAKIRJab052186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Nov 2011 20:27:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pAKIRJ8X031294; Sun, 20 Nov 2011 20:27:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pAKIRIpi031293; Sun, 20 Nov 2011 20:27:18 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 20 Nov 2011 20:27:18 +0200 From: Kostik Belousov To: Attilio Rao Message-ID: <20111120182718.GZ50300@deviant.kiev.zoral.com.ua> References: <20111107193516.GA50300@deviant.kiev.zoral.com.ua> <20111116084542.GY50300@deviant.kiev.zoral.com.ua> <20111118105224.GB50300@deviant.kiev.zoral.com.ua> <20111120173855.GX50300@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eoFns4BmSIo9TYbW" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: mdf@freebsd.org, "K. Macy" , Alan Cox , Andriy Gapon , freebsd-current@freebsd.org, Benjamin Kaduk , Penta Upa Subject: Re: vm_page_t related KBI [Was: Re: panic at vm_page_wire with FreeBSD 9.0 Beta 3] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Nov 2011 18:27:33 -0000 --eoFns4BmSIo9TYbW Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 20, 2011 at 07:02:14PM +0100, Attilio Rao wrote: > 2011/11/20 Kostik Belousov : > > +#define =9A =9A =9A =9Avm_page_lock_assert(m, a) =9A =9A =9A \ > > + =9A =9Avm_page_lock_assert_KBI((m), (a), LOCK_FILE, LOCK_LINE) >=20 > I think you should put the "\" in the last tab and also, for > consistency, you may want to use __FILE__ and __LINE__ for assert (or > maybe I should also switch mutex.h to use LOCK_FILE and LOCK_LINE at > some point?). I never saw the requirement for the backslash. I am consistent with PA_UNLOCK_COND() several lines above. Changed assert to use __FILE/LINE__. >=20 > > +#else > > +#define =9A =9A =9A =9Avm_page_lock_assert(m, a) > > +#endif > > +#else =9A/* KLD_MODULE */ >=20 > This should be /* !KLD_MODULE */, I guess? Changed. >=20 > > =9A#define =9A =9A =9A =9Avm_page_lockptr(m) >=20 > This is not defined for the KLD_MODULE case? Yes, explicitely. This was discussed. http://lists.freebsd.org/pipermail/freebsd-current/2011-November/029009.html diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index d592ac0..74e5126 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2843,6 +2843,34 @@ vm_page_test_dirty(vm_page_t m) vm_page_dirty(m); } =20 +void +vm_page_lock_KBI(vm_page_t m, const char *file, int line) +{ + + mtx_lock_flags_(vm_page_lockptr(m), 0, file, line); +} + +void +vm_page_unlock_KBI(vm_page_t m, const char *file, int line) +{ + + mtx_unlock_flags_(vm_page_lockptr(m), 0, file, line); +} + +int +vm_page_trylock_KBI(vm_page_t m, const char *file, int line) +{ + + return (mtx_trylock_flags_(vm_page_lockptr(m), 0, file, line)); +} + +void +vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line) +{ + + mtx_assert_(vm_page_lockptr(m), a, file, line); +} + int so_zerocp_fullpage =3D 0; =20 /* diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 151710d..1fab735 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -218,11 +218,23 @@ extern struct vpglocks pa_lock[]; =20 #define PA_LOCK_ASSERT(pa, a) mtx_assert(PA_LOCKPTR(pa), (a)) =20 +#ifdef KLD_MODULE +#define vm_page_lock(m) vm_page_lock_KBI((m), LOCK_FILE, LOCK_LINE) +#define vm_page_unlock(m) vm_page_unlock_KBI((m), LOCK_FILE, LOCK_LINE) +#define vm_page_trylock(m) vm_page_trylock_KBI((m), LOCK_FILE, LOCK_LINE) +#ifdef INVARIANTS +#define vm_page_lock_assert(m, a) \ + vm_page_lock_assert_KBI((m), (a), __FILE__, __LINE__) +#else +#define vm_page_lock_assert(m, a) +#endif +#else /* !KLD_MODULE */ #define vm_page_lockptr(m) (PA_LOCKPTR(VM_PAGE_TO_PHYS((m)))) #define vm_page_lock(m) mtx_lock(vm_page_lockptr((m))) #define vm_page_unlock(m) mtx_unlock(vm_page_lockptr((m))) #define vm_page_trylock(m) mtx_trylock(vm_page_lockptr((m))) #define vm_page_lock_assert(m, a) mtx_assert(vm_page_lockptr((m)), (a)) +#endif =20 #define vm_page_queue_free_mtx vm_page_queue_free_lock.data /* @@ -405,6 +417,11 @@ void vm_page_cowfault (vm_page_t); int vm_page_cowsetup(vm_page_t); void vm_page_cowclear (vm_page_t); =20 +void vm_page_lock_KBI(vm_page_t m, const char *file, int line); +void vm_page_unlock_KBI(vm_page_t m, const char *file, int line); +int vm_page_trylock_KBI(vm_page_t m, const char *file, int line); +void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int lin= e); + #ifdef INVARIANTS void vm_page_object_lock_assert(vm_page_t m); #define VM_PAGE_OBJECT_LOCK_ASSERT(m) vm_page_object_lock_assert(m) --eoFns4BmSIo9TYbW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7JRoYACgkQC3+MBN1Mb4gNzQCfXcbpjm+LNuYdfAhveL1NJ3m2 ZO8AoM/3mlTavKgFNvzmNP4gmgAJLTfd =eXxZ -----END PGP SIGNATURE----- --eoFns4BmSIo9TYbW--