Subject: Re: kern/36673 (dubious code is sysmon_envsys)
To: None <gnats-bugs@NetBSD.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 07/25/2007 20:44:52
> The following reply was made to PR kern/36673; it has been noted by GNATS.
> 
> From: Juan RP <juan@xtrarom.org>
> To: yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
> Cc: gnats-bugs@NetBSD.org
> Subject: Re: kern/36673 (dubious code is sysmon_envsys)
> Date: Wed, 25 Jul 2007 12:58:12 +0200
> 
>  On Wed, 25 Jul 2007 09:15:38 +0900 (JST)
>  yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
>  
>  > > On Mon, 23 Jul 2007 23:20:03 +0000 (UTC)
>  > > yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
>  > > 
>  > > >  the usages of these mutexes are not obvious or documented.
>  > > >  
>  > > >  for example,
>  > > >  - i can't understand why sysmon_envsys_createplist acquires
>  > > >   sme_mtx in the loop.
>  > > 
>  > > I wanted to protect the sme_gtredata function callback, this one
>  > > is executed in the driver to refresh data in the sensors.
>  > 
>  > protect from what?
>  
>  Protect from retrieve sensor data from multiple threads.

is it visible from other threads at this point?

>  > > One thing that is not clear to me is if I can allocate/deallocate
>  > > memory with a mutex held, can you please answer?
>  > 
>  > as i already answered, it depends.
>  > don't do it if you are not sure.
>  
>  I'm not doing it on my code, but I would like to have more details than
>  "it depends". Depends of what? depends if is it a spin mutex or an
>  adaptive mutex?

it's unsafe if it can interfere pagedaemon, for example.

YAMAMOTO Takashi