Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2011 19:31:22 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        mdf@freebsd.org, "K. Macy" <kmacy@freebsd.org>, Alan Cox <alc@rice.edu>, Andriy Gapon <avg@freebsd.org>, freebsd-current@freebsd.org, Benjamin Kaduk <kaduk@mit.edu>, Penta Upa <bsdboot@gmail.com>
Subject:   Re: vm_page_t related KBI [Was: Re: panic at vm_page_wire with FreeBSD 9.0 Beta 3]
Message-ID:  <CAJ-FndCsJFfrDBP-4jm5KPbPFNgxW%2Bn7Bw7MW4ufeuL14AtuDA@mail.gmail.com>
In-Reply-To: <20111120182718.GZ50300@deviant.kiev.zoral.com.ua>
References:  <20111107193516.GA50300@deviant.kiev.zoral.com.ua> <CAJ-FndDsrVk7EjjtE=QuhaJE1_k7Q1BvQ%2BxriJPnGzLXJQr1sg@mail.gmail.com> <20111116084542.GY50300@deviant.kiev.zoral.com.ua> <CAJ-FndAwWzFJgpCdaaE=YkipZSCtE6Vb8-LEK2_qS=bVhRM3OQ@mail.gmail.com> <20111118105224.GB50300@deviant.kiev.zoral.com.ua> <CAJ-FndAULb9r-FVaBparSJVtoSEQuX7%2BwhCoBNdQi7n%2B=UpEdA@mail.gmail.com> <CAJ-FndCZqwvbi2N=f=5TxkHH3gaKAGxipPoHBCFLqF=sLOTqdQ@mail.gmail.com> <CAJ-FndD%2Bj6WKmsLW9Kv2nDKEJePe=js3xmmj6m6NW3eS1RZD-w@mail.gmail.com> <20111120173855.GX50300@deviant.kiev.zoral.com.ua> <CAJ-FndCz_77A_uVjCiUKvaqfUk%2Byo3zuy5uf85AGZCNRP-yyqw@mail.gmail.com> <20111120182718.GZ50300@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
It looks good to me.

Attilio

2011/11/20 Kostik Belousov <kostikbel@gmail.com>:
> On Sun, Nov 20, 2011 at 07:02:14PM +0100, Attilio Rao wrote:
>> 2011/11/20 Kostik Belousov <kostikbel@gmail.com>:
>> > +#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?).
> I never saw the requirement for the backslash. I am consistent with
> PA_UNLOCK_COND() several lines above.
>
> Changed assert to use __FILE/LINE__.
>
>>
>> > +#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?
> Changed.
>
>>
>> > =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lockptr(m)
>>
>> This is not defined for the KLD_MODULE case?
> Yes, explicitely. This was discussed.
> http://lists.freebsd.org/pipermail/freebsd-current/2011-November/029009.h=
tml
>
> 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..1fab735 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=A0 =C2=A0 =C2=A0 \
> + =C2=A0 =C2=A0vm_page_lock_assert_KBI((m), (a), __FILE__, __LINE__)
> +#else
> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lock_assert(m, a)
> +#endif
> +#else =C2=A0/* !KLD_MODULE */
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lockptr(m) =C2=A0 =C2=A0=
 =C2=A0(PA_LOCKPTR(VM_PAGE_TO_PHYS((m))))
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lock(m) =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 mtx_lock(vm_page_lockptr((m)))
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_unlock(m) =C2=A0 =C2=A0 =
=C2=A0 mtx_unlock(vm_page_lockptr((m)))
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_trylock(m) =C2=A0 =C2=A0=
 =C2=A0mtx_trylock(vm_page_lockptr((m)))
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_lock_assert(m, a) =C2=A0=
 =C2=A0 =C2=A0 mtx_assert(vm_page_lockptr((m)), (a))
> +#endif
>
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0vm_page_queue_free_mtx =C2=A0vm_=
page_queue_free_lock.data
> =C2=A0/*
> @@ -405,6 +417,11 @@ void vm_page_cowfault (vm_page_t);
> =C2=A0int vm_page_cowsetup(vm_page_t);
> =C2=A0void vm_page_cowclear (vm_page_t);
>
> +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 l=
ine);
> +
> =C2=A0#ifdef INVARIANTS
> =C2=A0void vm_page_object_lock_assert(vm_page_t m);
> =C2=A0#define =C2=A0 =C2=A0 =C2=A0 =C2=A0VM_PAGE_OBJECT_LOCK_ASSERT(m) =
=C2=A0 vm_page_object_lock_assert(m)
>



--=20
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-FndCsJFfrDBP-4jm5KPbPFNgxW%2Bn7Bw7MW4ufeuL14AtuDA>