Re: hppa mutex ipl diff

2014-01-30 Thread Mark Kettenis
> From: David Gwynne 
> Date: Thu, 30 Jan 2014 09:59:15 +1000
> 
> is there anything in particular you're supposed to look for to see if it is 
> or isnt working?
> 
> either it locks up the machine (deadlock) or doesnt?

Something like that.

> On 29 Jan 2014, at 8:06 pm, Mark Kettenis  wrote:
> 
> > Here is a diff that makes mutexes raise their ipl to the highest level
> > that has interrupts that take the kernel lock.  This is necessary for
> > the work dlg@ has been doing on making subsystems run without the
> > kernel lock.
> > 
> > This needs to be tested on an MP system, and unfortunately that's
> > something I cannot do.
> > 
> > 
> > Index: include/mutex.h
> > ===
> > RCS file: /cvs/src/sys/arch/hppa/include/mutex.h,v
> > retrieving revision 1.4
> > diff -u -p -r1.4 mutex.h
> > --- include/mutex.h 10 Jan 2010 04:07:18 -  1.4
> > +++ include/mutex.h 29 Jan 2014 10:01:52 -
> > @@ -39,9 +39,24 @@ struct mutex {
> > void *mtx_owner;
> > };
> > 
> > -void mtx_init(struct mutex *, int);
> > +/*
> > + * To prevent lock ordering problems with the kernel lock, we need to
> > + * make sure we block all interrupts that can grab the kernel lock.
> > + * The simplest way to achieve this is to make sure mutexes always
> > + * raise the interrupt priority level to the highest level that has
> > + * interrupts that grab the kernel lock.
> > + */
> > +#ifdef MULTIPROCESSOR
> > +#define __MUTEX_IPL(ipl) \
> > +(((ipl) > IPL_NONE && (ipl) < IPL_AUDIO) ? IPL_AUDIO : (ipl))
> > +#else
> > +#define __MUTEX_IPL(ipl) (ipl)
> > +#endif
> > 
> > -#define MUTEX_INITIALIZER(ipl) { MUTEX_UNLOCKED, (ipl), 0, NULL }
> > +#define MUTEX_INITIALIZER(ipl) { MUTEX_UNLOCKED, __MUTEX_IPL((ipl)), 0, 
> > NULL }
> > +
> > +void __mtx_init(struct mutex *, int);
> > +#define mtx_init(mtx, ipl) __mtx_init((mtx), __MUTEX_IPL((ipl)))
> > 
> > #ifdef DIAGNOSTIC
> > #define MUTEX_ASSERT_LOCKED(mtx) do {   
> > \
> > Index: hppa/mutex.c
> > ===
> > RCS file: /cvs/src/sys/arch/hppa/hppa/mutex.c,v
> > retrieving revision 1.11
> > diff -u -p -r1.11 mutex.c
> > --- hppa/mutex.c20 Apr 2011 16:10:53 -  1.11
> > +++ hppa/mutex.c29 Jan 2014 10:01:52 -
> > @@ -50,7 +50,7 @@ try_lock(struct mutex *mtx)
> > }
> > 
> > void
> > -mtx_init(struct mutex *mtx, int wantipl)
> > +__mtx_init(struct mutex *mtx, int wantipl)
> > {
> > mtx->mtx_lock[0] = 1;
> > mtx->mtx_lock[1] = 1;
> > 
> 
> 
> 



Re: rm reference to obsolete functions

2014-01-30 Thread Mark Kettenis
> Date: Thu, 30 Jan 2014 15:41:11 +0100
> From: Jan Klemkow 
> 
> On Thu, Jan 30, 2014 at 09:21:52AM +0001, Jason McIntyre wrote:
> > On Wed, Jan 29, 2014 at 08:44:05PM +0100, Jan Klemkow wrote:
> > > Hi,
> > > 
> > > I've made a little diff to clean up some manpages with references to the
> > > obsoleted functions usleep(1), alarm(3).
> > > 
> > > bye,
> > > Jan
> > > 
> > 
> > stuff like alarm are still part of posix, as far as i know. not sure if
> > that should have any bearing on this or not.
> 
> These functions are removed from the standard:
> http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html

That doesn't necessarily mean we have to drop them as well.  And
alarm(3) is still there.

> > > Index: bin/sleep/sleep.1
> > > ===
> > > RCS file: /cvs/src/bin/sleep/sleep.1,v
> > > retrieving revision 1.19
> > > diff -u -p -r1.19 sleep.1
> > > --- bin/sleep/sleep.1 3 Sep 2010 09:53:20 -   1.19
> > > +++ bin/sleep/sleep.1 29 Jan 2014 19:39:14 -
> > > @@ -109,9 +109,7 @@ done
> > >  .Xr at 1 ,
> > >  .Xr nanosleep 2 ,
> > >  .Xr setitimer 2 ,
> > > -.Xr alarm 3 ,
> > > -.Xr sleep 3 ,
> > > -.Xr usleep 3
> > > +.Xr sleep 3
> > >  .Sh STANDARDS
> > >  The
> > >  .Nm
> > > Index: lib/libc/gen/sleep.3
> > > ===
> > > RCS file: /cvs/src/lib/libc/gen/sleep.3,v
> > > retrieving revision 1.14
> > > diff -u -p -r1.14 sleep.3
> > > --- lib/libc/gen/sleep.3  18 Jul 2013 10:14:49 -  1.14
> > > +++ lib/libc/gen/sleep.3  29 Jan 2014 19:39:31 -
> > > @@ -70,7 +70,7 @@ slept) in seconds.
> > >  .Sh SEE ALSO
> > >  .Xr sleep 1 ,
> > >  .Xr nanosleep 2 ,
> > > -.Xr usleep 3
> > > +.Xr setitimer 2
> > >  .Sh STANDARDS
> > >  The
> > >  .Fn sleep
> > > 
> > 
> 
> 



Re: rm reference to obsolete functions

2014-01-30 Thread Jan Klemkow
On Thu, Jan 30, 2014 at 09:21:52AM +0001, Jason McIntyre wrote:
> On Wed, Jan 29, 2014 at 08:44:05PM +0100, Jan Klemkow wrote:
> > Hi,
> > 
> > I've made a little diff to clean up some manpages with references to the
> > obsoleted functions usleep(1), alarm(3).
> > 
> > bye,
> > Jan
> > 
> 
> stuff like alarm are still part of posix, as far as i know. not sure if
> that should have any bearing on this or not.

These functions are removed from the standard:
http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html

> 
> anyway, can someone who knows this stuff take it please?
> jmc
> 
> > Index: bin/sleep/sleep.1
> > ===
> > RCS file: /cvs/src/bin/sleep/sleep.1,v
> > retrieving revision 1.19
> > diff -u -p -r1.19 sleep.1
> > --- bin/sleep/sleep.1   3 Sep 2010 09:53:20 -   1.19
> > +++ bin/sleep/sleep.1   29 Jan 2014 19:39:14 -
> > @@ -109,9 +109,7 @@ done
> >  .Xr at 1 ,
> >  .Xr nanosleep 2 ,
> >  .Xr setitimer 2 ,
> > -.Xr alarm 3 ,
> > -.Xr sleep 3 ,
> > -.Xr usleep 3
> > +.Xr sleep 3
> >  .Sh STANDARDS
> >  The
> >  .Nm
> > Index: lib/libc/gen/sleep.3
> > ===
> > RCS file: /cvs/src/lib/libc/gen/sleep.3,v
> > retrieving revision 1.14
> > diff -u -p -r1.14 sleep.3
> > --- lib/libc/gen/sleep.318 Jul 2013 10:14:49 -  1.14
> > +++ lib/libc/gen/sleep.329 Jan 2014 19:39:31 -
> > @@ -70,7 +70,7 @@ slept) in seconds.
> >  .Sh SEE ALSO
> >  .Xr sleep 1 ,
> >  .Xr nanosleep 2 ,
> > -.Xr usleep 3
> > +.Xr setitimer 2
> >  .Sh STANDARDS
> >  The
> >  .Fn sleep
> > 
> 



Re: rm reference to obsolete functions

2014-01-30 Thread Jason McIntyre
On Wed, Jan 29, 2014 at 08:44:05PM +0100, Jan Klemkow wrote:
> Hi,
> 
> I've made a little diff to clean up some manpages with references to the
> obsoleted functions usleep(1), alarm(3).
> 
> bye,
> Jan
> 

stuff like alarm are still part of posix, as far as i know. not sure if
that should have any bearing on this or not.

anyway, can someone who knows this stuff take it please?
jmc

> Index: bin/sleep/sleep.1
> ===
> RCS file: /cvs/src/bin/sleep/sleep.1,v
> retrieving revision 1.19
> diff -u -p -r1.19 sleep.1
> --- bin/sleep/sleep.1 3 Sep 2010 09:53:20 -   1.19
> +++ bin/sleep/sleep.1 29 Jan 2014 19:39:14 -
> @@ -109,9 +109,7 @@ done
>  .Xr at 1 ,
>  .Xr nanosleep 2 ,
>  .Xr setitimer 2 ,
> -.Xr alarm 3 ,
> -.Xr sleep 3 ,
> -.Xr usleep 3
> +.Xr sleep 3
>  .Sh STANDARDS
>  The
>  .Nm
> Index: lib/libc/gen/sleep.3
> ===
> RCS file: /cvs/src/lib/libc/gen/sleep.3,v
> retrieving revision 1.14
> diff -u -p -r1.14 sleep.3
> --- lib/libc/gen/sleep.3  18 Jul 2013 10:14:49 -  1.14
> +++ lib/libc/gen/sleep.3  29 Jan 2014 19:39:31 -
> @@ -70,7 +70,7 @@ slept) in seconds.
>  .Sh SEE ALSO
>  .Xr sleep 1 ,
>  .Xr nanosleep 2 ,
> -.Xr usleep 3
> +.Xr setitimer 2
>  .Sh STANDARDS
>  The
>  .Fn sleep
>