ANDROID: fix ABI breakage caused by percpu_rw_semaphore changes

percpu_rw_semaphore changes to allow calling percpu_free_rwsem in atomic
context cause ABI breakage. Introduce percpu_free_rwsem_atomic wrapper
and change percpu_rwsem_destroy to use it in order to keep
percpu_rw_semaphore struct intact and fix ABI breakage.

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I198a6381fb48059f2aaa2ec38b8c1e5e5e936bb0
This commit is contained in:
Suren Baghdasaryan
2021-11-24 07:43:12 -08:00
parent 6971350406
commit a4d26b9a4b
5 changed files with 20 additions and 21 deletions

View File

@@ -13,20 +13,18 @@ struct percpu_rw_semaphore {
struct rcu_sync rss;
unsigned int __percpu *read_count;
struct rcuwait writer;
/*
* destroy_list_entry is used during object destruction when waiters
* can't be used, therefore reusing the same space.
*/
union {
wait_queue_head_t waiters;
struct list_head destroy_list_entry;
};
wait_queue_head_t waiters;
atomic_t block;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lockdep_map dep_map;
#endif
};
struct percpu_rw_semaphore_atomic {
struct percpu_rw_semaphore rw_sem;
struct list_head destroy_list_entry;
};
#ifdef CONFIG_DEBUG_LOCK_ALLOC
#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname },
#else
@@ -138,7 +136,7 @@ extern int __percpu_init_rwsem(struct percpu_rw_semaphore *,
extern void percpu_free_rwsem(struct percpu_rw_semaphore *);
/* Invokes percpu_free_rwsem and frees the semaphore from a worker thread. */
extern void percpu_rwsem_async_destroy(struct percpu_rw_semaphore *sem);
extern void percpu_rwsem_async_destroy(struct percpu_rw_semaphore_atomic *sem);
#define percpu_init_rwsem(sem) \
({ \