Re: vm_page_t related KBI [Was: Re: panic at vm_page_wire with FreeBSD 9.0 Beta 3]

From: Attilio Rao <attilio_at_freebsd.org>
Date: Sun, 20 Nov 2011 19:02:14 +0100
2011/11/20 Kostik Belousov <kostikbel_at_gmail.com>:
> On Sun, Nov 20, 2011 at 05:37:33PM +0100, Attilio Rao wrote:
>> 2011/11/18 Attilio Rao <attilio_at_freebsd.org>:
>> > 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
> _at__at_ -2843,6 +2843,34 _at__at_ vm_page_test_dirty(vm_page_t m)
>                vm_page_dirty(m);
>  }
>
> +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 = 0;
>
>  /*
> 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
> _at__at_ -218,11 +218,23 _at__at_ extern struct vpglocks pa_lock[];
>
>  #define        PA_LOCK_ASSERT(pa, a)   mtx_assert(PA_LOCKPTR(pa), (a))
>
> +#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), 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        vm_page_lock_assert(m, a)
> +#endif
> +#else  /* KLD_MODULE */

This should be /* !KLD_MODULE */, I guess?

>  #define        vm_page_lockptr(m)

This is not defined for the KLD_MODULE case?

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
Received on Sun Nov 20 2011 - 17:02:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:20 UTC