Reapply "ANDROID: Add a vendor hook that allow a module to modify the wake flag"

This reverts commit e4bd522969.
Symbol is still needed in vendor.

Bug: 361733032
Change-Id: I4542ad4263bf587115485e6579b7efb478485b68
Signed-off-by: Zhou Jian <quic_jianzhou@quicinc.com>
This commit is contained in:
Zhou Jian
2024-08-22 23:04:56 -07:00
committed by Treehugger Robot
parent 8cc7a9020f
commit ec0684d250
4 changed files with 27 additions and 2 deletions
+8
View File
@@ -241,6 +241,14 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_thermal_stats,
TP_PROTO(int cpu),
TP_ARGS(cpu), 1);
DECLARE_HOOK(android_vh_do_wake_up_sync,
TP_PROTO(struct wait_queue_head *wq_head, int *done, struct sock *sk),
TP_ARGS(wq_head, done, sk));
DECLARE_HOOK(android_vh_set_wake_flags,
TP_PROTO(int *wake_flags, unsigned int *mode),
TP_ARGS(wake_flags, mode));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */
+2
View File
@@ -64,3 +64,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_schedule_bug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_exec);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_thermal_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags);
+5 -1
View File
@@ -4,6 +4,7 @@
*
* (C) 2004 Nadia Yvette Chambers, Oracle
*/
#include <trace/hooks/sched.h>
void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *key)
{
@@ -167,10 +168,13 @@ EXPORT_SYMBOL_GPL(__wake_up_locked_key);
void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode,
void *key)
{
int wake_flags = WF_SYNC;
if (unlikely(!wq_head))
return;
__wake_up_common_lock(wq_head, mode, 1, WF_SYNC, key);
trace_android_vh_set_wake_flags(&wake_flags, &mode);
__wake_up_common_lock(wq_head, mode, 1, wake_flags, key);
}
EXPORT_SYMBOL_GPL(__wake_up_sync_key);
+12 -1
View File
@@ -140,6 +140,7 @@
#include <net/bpf_sk_storage.h>
#include <trace/events/sock.h>
#include <trace/hooks/sched.h>
#include <net/tcp.h>
#include <net/busy_poll.h>
@@ -3370,9 +3371,19 @@ void sock_def_readable(struct sock *sk)
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
if (skwq_has_sleeper(wq)) {
int done = 0;
trace_android_vh_do_wake_up_sync(&wq->wait, &done, sk);
if (done)
goto out;
wake_up_interruptible_sync_poll(&wq->wait, EPOLLIN | EPOLLPRI |
EPOLLRDNORM | EPOLLRDBAND);
}
out:
sk_wake_async_rcu(sk, SOCK_WAKE_WAITD, POLL_IN);
rcu_read_unlock();
}