mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
Revert "workqueue: Provide one lock class key per work_on_cpu() callsite"
This reverts commit f9d3ba62e8 which is
commit 265f3ed077036f053981f5eea0b5b43e7c5b39ff upstream.
It turns the work_on_cpu() function into an #define, which messes with
the systems that were previously depending on that abi symbol. As this
is a change only for when lockdep is enabled, which is NOT in any
running Android system, it is safe to revert for now.
Bug: 161946584
Change-Id: I5f117cccfb411efb742a4faf1cefcb4826faae15
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -228,16 +228,18 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
|
|||||||
* to generate better code.
|
* to generate better code.
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_LOCKDEP
|
#ifdef CONFIG_LOCKDEP
|
||||||
#define __INIT_WORK_KEY(_work, _func, _onstack, _key) \
|
#define __INIT_WORK(_work, _func, _onstack) \
|
||||||
do { \
|
do { \
|
||||||
|
static struct lock_class_key __key; \
|
||||||
|
\
|
||||||
__init_work((_work), _onstack); \
|
__init_work((_work), _onstack); \
|
||||||
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
|
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
|
||||||
lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, (_key), 0); \
|
lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \
|
||||||
INIT_LIST_HEAD(&(_work)->entry); \
|
INIT_LIST_HEAD(&(_work)->entry); \
|
||||||
(_work)->func = (_func); \
|
(_work)->func = (_func); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define __INIT_WORK_KEY(_work, _func, _onstack, _key) \
|
#define __INIT_WORK(_work, _func, _onstack) \
|
||||||
do { \
|
do { \
|
||||||
__init_work((_work), _onstack); \
|
__init_work((_work), _onstack); \
|
||||||
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
|
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
|
||||||
@@ -246,22 +248,12 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
|
|||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __INIT_WORK(_work, _func, _onstack) \
|
|
||||||
do { \
|
|
||||||
static __maybe_unused struct lock_class_key __key; \
|
|
||||||
\
|
|
||||||
__INIT_WORK_KEY(_work, _func, _onstack, &__key); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define INIT_WORK(_work, _func) \
|
#define INIT_WORK(_work, _func) \
|
||||||
__INIT_WORK((_work), (_func), 0)
|
__INIT_WORK((_work), (_func), 0)
|
||||||
|
|
||||||
#define INIT_WORK_ONSTACK(_work, _func) \
|
#define INIT_WORK_ONSTACK(_work, _func) \
|
||||||
__INIT_WORK((_work), (_func), 1)
|
__INIT_WORK((_work), (_func), 1)
|
||||||
|
|
||||||
#define INIT_WORK_ONSTACK_KEY(_work, _func, _key) \
|
|
||||||
__INIT_WORK_KEY((_work), (_func), 1, _key)
|
|
||||||
|
|
||||||
#define __INIT_DELAYED_WORK(_work, _func, _tflags) \
|
#define __INIT_DELAYED_WORK(_work, _func, _tflags) \
|
||||||
do { \
|
do { \
|
||||||
INIT_WORK(&(_work)->work, (_func)); \
|
INIT_WORK(&(_work)->work, (_func)); \
|
||||||
@@ -646,32 +638,8 @@ static inline long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
|
|||||||
return fn(arg);
|
return fn(arg);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
long work_on_cpu_key(int cpu, long (*fn)(void *),
|
long work_on_cpu(int cpu, long (*fn)(void *), void *arg);
|
||||||
void *arg, struct lock_class_key *key);
|
long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg);
|
||||||
/*
|
|
||||||
* A new key is defined for each caller to make sure the work
|
|
||||||
* associated with the function doesn't share its locking class.
|
|
||||||
*/
|
|
||||||
#define work_on_cpu(_cpu, _fn, _arg) \
|
|
||||||
({ \
|
|
||||||
static struct lock_class_key __key; \
|
|
||||||
\
|
|
||||||
work_on_cpu_key(_cpu, _fn, _arg, &__key); \
|
|
||||||
})
|
|
||||||
|
|
||||||
long work_on_cpu_safe_key(int cpu, long (*fn)(void *),
|
|
||||||
void *arg, struct lock_class_key *key);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A new key is defined for each caller to make sure the work
|
|
||||||
* associated with the function doesn't share its locking class.
|
|
||||||
*/
|
|
||||||
#define work_on_cpu_safe(_cpu, _fn, _arg) \
|
|
||||||
({ \
|
|
||||||
static struct lock_class_key __key; \
|
|
||||||
\
|
|
||||||
work_on_cpu_safe_key(_cpu, _fn, _arg, &__key); \
|
|
||||||
})
|
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
|
|
||||||
#ifdef CONFIG_FREEZER
|
#ifdef CONFIG_FREEZER
|
||||||
|
|||||||
@@ -5217,54 +5217,50 @@ static void work_for_cpu_fn(struct work_struct *work)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* work_on_cpu_key - run a function in thread context on a particular cpu
|
* work_on_cpu - run a function in thread context on a particular cpu
|
||||||
* @cpu: the cpu to run on
|
* @cpu: the cpu to run on
|
||||||
* @fn: the function to run
|
* @fn: the function to run
|
||||||
* @arg: the function arg
|
* @arg: the function arg
|
||||||
* @key: The lock class key for lock debugging purposes
|
|
||||||
*
|
*
|
||||||
* It is up to the caller to ensure that the cpu doesn't go offline.
|
* It is up to the caller to ensure that the cpu doesn't go offline.
|
||||||
* The caller must not hold any locks which would prevent @fn from completing.
|
* The caller must not hold any locks which would prevent @fn from completing.
|
||||||
*
|
*
|
||||||
* Return: The value @fn returns.
|
* Return: The value @fn returns.
|
||||||
*/
|
*/
|
||||||
long work_on_cpu_key(int cpu, long (*fn)(void *),
|
long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
|
||||||
void *arg, struct lock_class_key *key)
|
|
||||||
{
|
{
|
||||||
struct work_for_cpu wfc = { .fn = fn, .arg = arg };
|
struct work_for_cpu wfc = { .fn = fn, .arg = arg };
|
||||||
|
|
||||||
INIT_WORK_ONSTACK_KEY(&wfc.work, work_for_cpu_fn, key);
|
INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn);
|
||||||
schedule_work_on(cpu, &wfc.work);
|
schedule_work_on(cpu, &wfc.work);
|
||||||
flush_work(&wfc.work);
|
flush_work(&wfc.work);
|
||||||
destroy_work_on_stack(&wfc.work);
|
destroy_work_on_stack(&wfc.work);
|
||||||
return wfc.ret;
|
return wfc.ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(work_on_cpu_key);
|
EXPORT_SYMBOL_GPL(work_on_cpu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* work_on_cpu_safe_key - run a function in thread context on a particular cpu
|
* work_on_cpu_safe - run a function in thread context on a particular cpu
|
||||||
* @cpu: the cpu to run on
|
* @cpu: the cpu to run on
|
||||||
* @fn: the function to run
|
* @fn: the function to run
|
||||||
* @arg: the function argument
|
* @arg: the function argument
|
||||||
* @key: The lock class key for lock debugging purposes
|
|
||||||
*
|
*
|
||||||
* Disables CPU hotplug and calls work_on_cpu(). The caller must not hold
|
* Disables CPU hotplug and calls work_on_cpu(). The caller must not hold
|
||||||
* any locks which would prevent @fn from completing.
|
* any locks which would prevent @fn from completing.
|
||||||
*
|
*
|
||||||
* Return: The value @fn returns.
|
* Return: The value @fn returns.
|
||||||
*/
|
*/
|
||||||
long work_on_cpu_safe_key(int cpu, long (*fn)(void *),
|
long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
|
||||||
void *arg, struct lock_class_key *key)
|
|
||||||
{
|
{
|
||||||
long ret = -ENODEV;
|
long ret = -ENODEV;
|
||||||
|
|
||||||
cpus_read_lock();
|
cpus_read_lock();
|
||||||
if (cpu_online(cpu))
|
if (cpu_online(cpu))
|
||||||
ret = work_on_cpu_key(cpu, fn, arg, key);
|
ret = work_on_cpu(cpu, fn, arg);
|
||||||
cpus_read_unlock();
|
cpus_read_unlock();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(work_on_cpu_safe_key);
|
EXPORT_SYMBOL_GPL(work_on_cpu_safe);
|
||||||
#endif /* CONFIG_SMP */
|
#endif /* CONFIG_SMP */
|
||||||
|
|
||||||
#ifdef CONFIG_FREEZER
|
#ifdef CONFIG_FREEZER
|
||||||
|
|||||||
Reference in New Issue
Block a user