Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: remove __mp_release_all_but_one()
To:
tech@openbsd.org
Date:
Tue, 2 Jul 2024 09:54:35 +0200

Download raw body.

Thread
On Tue, Jul 02, 2024 at 05:25:26PM +1000, Jonathan Gray wrote:
> unused since sched_bsd.c rev 1.92

Go for it. If we ever need to get it back we can grab it from the attic.
OK claudio@
 
> diff --git sys/arch/alpha/alpha/lock_machdep.c sys/arch/alpha/alpha/lock_machdep.c
> index 6f949985856..ea17b4dbe2a 100644
> --- sys/arch/alpha/alpha/lock_machdep.c
> +++ sys/arch/alpha/alpha/lock_machdep.c
> @@ -162,22 +162,6 @@ __mp_release_all(struct __mp_lock *mpl)
>  	return (rv);
>  }
>  
> -int
> -__mp_release_all_but_one(struct __mp_lock *mpl)
> -{
> -	int rv = mpl->mpl_count - 2;
> -#ifdef MP_LOCKDEBUG
> -	if (mpl->mpl_cpu != curcpu()) {
> -		db_printf("__mp_release_all_but_one(%p): not held lock\n", mpl);
> -		db_enter();
> -	}
> -#endif
> -
> -	mpl->mpl_count = 2;
> -
> -	return (rv);
> -}
> -
>  void
>  __mp_acquire_count(struct __mp_lock *mpl, int count)
>  {
> diff --git sys/arch/alpha/include/mplock.h sys/arch/alpha/include/mplock.h
> index 664e9430b9e..24bded5c62e 100644
> --- sys/arch/alpha/include/mplock.h
> +++ sys/arch/alpha/include/mplock.h
> @@ -43,7 +43,6 @@ void __mp_lock_init(struct __mp_lock *);
>  void __mp_lock(struct __mp_lock *);
>  void __mp_unlock(struct __mp_lock *);
>  int __mp_release_all(struct __mp_lock *);
> -int __mp_release_all_but_one(struct __mp_lock *);
>  void __mp_acquire_count(struct __mp_lock *, int);
>  int __mp_lock_held(struct __mp_lock *, struct cpu_info *);
>  
> diff --git sys/arch/hppa/hppa/lock_machdep.c sys/arch/hppa/hppa/lock_machdep.c
> index 44c9dda7fb4..71d40db361e 100644
> --- sys/arch/hppa/hppa/lock_machdep.c
> +++ sys/arch/hppa/hppa/lock_machdep.c
> @@ -191,32 +191,6 @@ __mp_release_all(struct __mp_lock *mpl)
>  	return (rv);
>  }
>  
> -int
> -__mp_release_all_but_one(struct __mp_lock *mpl)
> -{
> -	int rv = mpl->mpl_count - 2;
> -#ifdef WITNESS
> -	int i;
> -#endif
> -
> -#ifdef MP_LOCKDEBUG
> -	if (mpl->mpl_cpu != curcpu()) {
> -		db_printf("__mp_release_all_but_one(%p): lock not held - "
> -		    "%p != %p\n", mpl, mpl->mpl_cpu, curcpu());
> -		db_enter();
> -	}
> -#endif
> -
> -#ifdef WITNESS
> -	for (i = 0; i < rv; i++)
> -		WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE);
> -#endif
> -
> -	mpl->mpl_count = 2;
> -
> -	return (rv);
> -}
> -
>  void
>  __mp_acquire_count(struct __mp_lock *mpl, int count)
>  {
> diff --git sys/arch/hppa/include/mplock.h sys/arch/hppa/include/mplock.h
> index b0c2d7299e2..cd9871566fa 100644
> --- sys/arch/hppa/include/mplock.h
> +++ sys/arch/hppa/include/mplock.h
> @@ -50,7 +50,6 @@ void	___mp_lock_init(struct __mp_lock *);
>  void	__mp_lock(struct __mp_lock *);
>  void	__mp_unlock(struct __mp_lock *);
>  int	__mp_release_all(struct __mp_lock *);
> -int	__mp_release_all_but_one(struct __mp_lock *);
>  void	__mp_acquire_count(struct __mp_lock *, int);
>  int	__mp_lock_held(struct __mp_lock *, struct cpu_info *);
>  
> diff --git sys/kern/kern_lock.c sys/kern/kern_lock.c
> index fb38210927d..79a91b0312e 100644
> --- sys/kern/kern_lock.c
> +++ sys/kern/kern_lock.c
> @@ -194,30 +194,6 @@ __mp_release_all(struct __mp_lock *mpl)
>  	return (rv);
>  }
>  
> -int
> -__mp_release_all_but_one(struct __mp_lock *mpl)
> -{
> -	struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[cpu_number()];
> -	int rv = cpu->mplc_depth - 1;
> -#ifdef WITNESS
> -	int i;
> -
> -	for (i = 0; i < rv; i++)
> -		WITNESS_UNLOCK(&mpl->mpl_lock_obj, LOP_EXCLUSIVE);
> -#endif
> -
> -#ifdef MP_LOCKDEBUG
> -	if (!__mp_lock_held(mpl, curcpu())) {
> -		db_printf("__mp_release_all_but_one(%p): not held lock\n", mpl);
> -		db_enter();
> -	}
> -#endif
> -
> -	cpu->mplc_depth = 1;
> -
> -	return (rv);
> -}
> -
>  void
>  __mp_acquire_count(struct __mp_lock *mpl, int count)
>  {
> diff --git sys/sys/mplock.h sys/sys/mplock.h
> index 34f2f97c97b..ebcc50948f2 100644
> --- sys/sys/mplock.h
> +++ sys/sys/mplock.h
> @@ -51,7 +51,6 @@ void	___mp_lock_init(struct __mp_lock *, const struct lock_type *);
>  void	__mp_lock(struct __mp_lock *);
>  void	__mp_unlock(struct __mp_lock *);
>  int	__mp_release_all(struct __mp_lock *);
> -int	__mp_release_all_but_one(struct __mp_lock *);
>  void	__mp_acquire_count(struct __mp_lock *, int);
>  int	__mp_lock_held(struct __mp_lock *, struct cpu_info *);
>  
> 

-- 
:wq Claudio