From owner-freebsd-current@FreeBSD.ORG Sun Nov 20 18:02:16 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 54C5E1065670; Sun, 20 Nov 2011 18:02:16 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 47D4B8FC19; Sun, 20 Nov 2011 18:02:15 +0000 (UTC) Received: by wwg14 with SMTP id 14so8367927wwg.31 for ; Sun, 20 Nov 2011 10:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GmRzrdYzy+Fv91ZSrRGOu2e+u25/5CApCdj7miotze8=; b=YppTZE6bFshTc7hBmqQwdSqLPsoN+VkK1KeQ8xubO6HVZGDTBoAZiW+pN2JkYkOjZr 36JtoXtZ8Mxqihi3dxs4LolIECKf0NBuZ+2s0MwtloDZZGDlr2STi/duXefWOvvDYN1i 2XFcs2uqw3QUUPU8/M7GlMR5r3qMw10kK9t2o= MIME-Version: 1.0 Received: by 10.227.205.79 with SMTP id fp15mr7088021wbb.20.1321812134198; Sun, 20 Nov 2011 10:02:14 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.216.85.8 with HTTP; Sun, 20 Nov 2011 10:02:14 -0800 (PST) In-Reply-To: <20111120173855.GX50300@deviant.kiev.zoral.com.ua> References: <20111106124331.GP50300@deviant.kiev.zoral.com.ua> <4EB81942.70501@rice.edu> <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> Date: Sun, 20 Nov 2011 19:02:14 +0100 X-Google-Sender-Auth: zhiDUk_IsvO9UXGcnDuCgtraeG0 Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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:02:16 -0000 2011/11/20 Kostik Belousov : > On Sun, Nov 20, 2011 at 05:37:33PM +0100, Attilio Rao wrote: >> 2011/11/18 Attilio Rao : >> > Please consider: >> > http://www.freebsd.org/~attilio/mutexfileline2.patch >> >> This is now committed as r227758,227759, you can update your patch now. > Here is it. > > 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) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_dirty(m); > =C2=A0} > > +void > +vm_page_lock_KBI(vm_page_t m, const char *file, int line) > +{ > + > + =C2=A0 =C2=A0 =C2=A0 mtx_lock_flags_(vm_page_lockptr(m), 0, file, line)= ; > +} > + > +void > +vm_page_unlock_KBI(vm_page_t m, const char *file, int line) > +{ > + > + =C2=A0 =C2=A0 =C2=A0 mtx_unlock_flags_(vm_page_lockptr(m), 0, file, lin= e); > +} > + > +int > +vm_page_trylock_KBI(vm_page_t m, const char *file, int line) > +{ > + > + =C2=A0 =C2=A0 =C2=A0 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) > +{ > + > + =C2=A0 =C2=A0 =C2=A0 mtx_assert_(vm_page_lockptr(m), a, file, line); > +} > + > =C2=A0int so_zerocp_fullpage =3D 0; > > =C2=A0/* > diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h > index 151710d..fe0295b 100644 > --- a/sys/vm/vm_page.h > +++ b/sys/vm/vm_page.h > @@ -218,11 +218,23 @@ extern struct vpglocks pa_lock[]; > > =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0PA_LOCK_ASSERT(pa, a) =C2=A0 mtx= _assert(PA_LOCKPTR(pa), (a)) > > +#ifdef KLD_MODULE > +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lock(m) =C2=A0 =C2=A0 =C2=A0 = =C2=A0 vm_page_lock_KBI((m), LOCK_FILE, LOCK_LINE) > +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_unlock(m) =C2=A0 =C2=A0 =C2= =A0 vm_page_unlock_KBI((m), LOCK_FILE, LOCK_LINE) > +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_trylock(m) =C2=A0 =C2=A0 =C2= =A0vm_page_trylock_KBI((m), LOCK_FILE, LOCK_LINE) > +#ifdef INVARIANTS > +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lock_assert(m, a) =C2=A0 =C2= =A0 =C2=A0 \ > + =C2=A0 =C2=A0vm_page_lock_assert_KBI((m), (a), LOCK_FILE, LOCK_LINE) 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?). > +#else > +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lock_assert(m, a) > +#endif > +#else =C2=A0/* KLD_MODULE */ This should be /* !KLD_MODULE */, I guess? > =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lockptr(m) This is not defined for the KLD_MODULE case? Attilio --=20 Peace can only be achieved by understanding - A. Einstein