lkml.org 
[lkml]   [2021]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch 22/63] locking/spinlock: Split the lock types header
Date
On 7/30/21 9:50 AM, Thomas Gleixner wrote:
> From: Thomas Gleixner <tglx@linutronix.de>
>
> Move raw_spinlock into its own file. Prepare for RT 'sleeping spinlocks' to
> avoid header recursion as RT locks require rtmutex.h which in turn requires
> the raw spinlock types.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> include/linux/rwlock_types.h | 4 ++
> include/linux/spinlock.h | 4 ++
> include/linux/spinlock_types.h | 19 ----------
> include/linux/spinlock_types_raw.h | 65 +++++++++++++++++++++++++++++++++++++
> 4 files changed, 74 insertions(+), 18 deletions(-)
> create mode 100644 include/linux/spinlock_types_raw.h
> ---
> --- a/include/linux/rwlock_types.h
> +++ b/include/linux/rwlock_types.h
> @@ -1,6 +1,10 @@
> #ifndef __LINUX_RWLOCK_TYPES_H
> #define __LINUX_RWLOCK_TYPES_H
>
> +#if !defined(__LINUX_SPINLOCK_TYPES_H)
> +# error "Do not include directly, include spinlock_types.h"
> +#endif
> +
> /*
> * include/linux/rwlock_types.h - generic rwlock type definitions
> * and initializers
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
> @@ -12,6 +12,8 @@
> * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the
> * initializers
> *
> + * linux/spinlock_types_raw:
> + * The raw types and initializers
> * linux/spinlock_types.h:
> * defines the generic type and initializers
> *
> @@ -31,6 +33,8 @@
> * contains the generic, simplified UP spinlock type.
> * (which is an empty structure on non-debug builds)
> *
> + * linux/spinlock_types_raw:
> + * The raw RT types and initializers
> * linux/spinlock_types.h:
> * defines the generic type and initializers
> *
> --- a/include/linux/spinlock_types.h
> +++ b/include/linux/spinlock_types.h
> @@ -9,24 +9,7 @@
> * Released under the General Public License (GPL).
> */
>
> -#if defined(CONFIG_SMP)
> -# include <asm/spinlock_types.h>
> -#else
> -# include <linux/spinlock_types_up.h>
> -#endif
> -
> -#include <linux/lockdep_types.h>
> -
> -typedef struct raw_spinlock {
> - arch_spinlock_t raw_lock;
> -#ifdef CONFIG_DEBUG_SPINLOCK
> - unsigned int magic, owner_cpu;
> - void *owner;
> -#endif
> -#ifdef CONFIG_DEBUG_LOCK_ALLOC
> - struct lockdep_map dep_map;
> -#endif
> -} raw_spinlock_t;
> +#include <linux/spinlock_types_raw.h>
>
> #define SPINLOCK_MAGIC 0xdead4ead
>

Most of the code in spinlock_types.h are moved into
spinlock_types_raw.h. However, macros like SPINLOCK_MAGIC and those that
followed are not removed from spinlock_types.h in this patch leading to
the same set of macro definitions in two different files. Should we
eliminate the duplicate macro definitions either from spinlock_types.h
or from spinlock_types_raw.h?

Cheers,
Longman

\
 
 \ /
  Last update: 2021-08-04 23:18    [W:0.424 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site