From e27ad1d21124c25259911574775fafb5f60bb53e Mon Sep 17 00:00:00 2001 From: liuhailong Date: Tue, 10 May 2022 16:58:17 +0800 Subject: [PATCH 01/55] ANDROID: signal: Add vendor hook for memory reaping Since commit 3bcdb496f496 ("ANDROID: signal: Add vendor hook for memory reaping"), but *current* does not need. Add another hook here to determine killed process need be reaped. (e.g. get_mm_counter) Bug: 232062955 Change-Id: Ide13d3a2e8c199b063f41e071a2bf2fd60a91b04 Signed-off-by: liuhailong --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/signal.h | 3 +++ kernel/signal.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index eb50db428e8c..1ca42b0dfd4d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -99,6 +99,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_restore_priority); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wakeup_ilocked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_send_sig_info); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_killed); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_killed_process); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_finished); diff --git a/include/trace/hooks/signal.h b/include/trace/hooks/signal.h index a0db2e8cf77d..ee36ea1de283 100644 --- a/include/trace/hooks/signal.h +++ b/include/trace/hooks/signal.h @@ -15,6 +15,9 @@ DECLARE_HOOK(android_vh_do_send_sig_info, DECLARE_HOOK(android_vh_process_killed, TP_PROTO(struct task_struct *task, bool *reap), TP_ARGS(task, reap)); +DECLARE_HOOK(android_vh_killed_process, + TP_PROTO(struct task_struct *killer, struct task_struct *dst, bool *reap), + TP_ARGS(killer, dst, reap)); #endif /* _TRACE_HOOK_SIGNAL_H */ /* This part must be outside protection */ #include diff --git a/kernel/signal.c b/kernel/signal.c index 7814560f8637..6fff4a9788ac 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1420,6 +1420,7 @@ int group_send_sig_info(int sig, struct kernel_siginfo *info, bool reap = false; trace_android_vh_process_killed(current, &reap); + trace_android_vh_killed_process(current, p, &reap); if (reap) add_to_oom_reaper(p); } From 73f609894121ebf2b1a62a62ce6cac08560edb9b Mon Sep 17 00:00:00 2001 From: Jiri Bohac Date: Wed, 19 Jan 2022 10:22:53 +0100 Subject: [PATCH 02/55] UPSTREAM: xfrm: fix MTU regression commit 6596a0229541270fb8d38d989f91b78838e5e9da upstream. Commit 749439bfac6e1a2932c582e2699f91d329658196 ("ipv6: fix udpv6 sendmsg crash caused by too small MTU") breaks PMTU for xfrm. A Packet Too Big ICMPv6 message received in response to an ESP packet will prevent all further communication through the tunnel if the reported MTU minus the ESP overhead is smaller than 1280. E.g. in a case of a tunnel-mode ESP with sha256/aes the overhead is 92 bytes. Receiving a PTB with MTU of 1371 or less will result in all further packets in the tunnel dropped. A ping through the tunnel fails with "ping: sendmsg: Invalid argument". Apparently the MTU on the xfrm route is smaller than 1280 and fails the check inside ip6_setup_cork() added by 749439bf. We found this by debugging USGv6/ipv6ready failures. Failing tests are: "Phase-2 Interoperability Test Scenario IPsec" / 5.3.11 and 5.4.11 (Tunnel Mode: Fragmentation). Commit b515d2637276a3810d6595e10ab02c13bfd0b63a ("xfrm: xfrm_state_mtu should return at least 1280 for ipv6") attempted to fix this but caused another regression in TCP MSS calculations and had to be reverted. The patch below fixes the situation by dropping the MTU check and instead checking for the underflows described in the 749439bf commit message. Bug: 232198720 Signed-off-by: Jiri Bohac Fixes: 749439bfac6e ("ipv6: fix udpv6 sendmsg crash caused by too small MTU") Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Change-Id: I8cd20af2f9074d177907c4ae69486ed125e74238 Signed-off-by: Lina Wang --- net/ipv6/ip6_output.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 54cabf1c2ae1..d6f2126f4618 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1432,8 +1432,6 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, if (np->frag_size) mtu = np->frag_size; } - if (mtu < IPV6_MIN_MTU) - return -EINVAL; cork->base.fragsize = mtu; cork->base.gso_size = ipc6->gso_size; cork->base.tx_flags = 0; @@ -1495,8 +1493,6 @@ static int __ip6_append_data(struct sock *sk, fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + (opt ? opt->opt_nflen : 0); - maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - - sizeof(struct frag_hdr); headersize = sizeof(struct ipv6hdr) + (opt ? opt->opt_flen + opt->opt_nflen : 0) + @@ -1504,6 +1500,13 @@ static int __ip6_append_data(struct sock *sk, sizeof(struct frag_hdr) : 0) + rt->rt6i_nfheader_len; + if (mtu < fragheaderlen || + ((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr)) + goto emsgsize; + + maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - + sizeof(struct frag_hdr); + /* as per RFC 7112 section 5, the entire IPv6 Header Chain must fit * the first fragment */ From 393be9a064599b0add7338c2c4c4a32c27d7f6d9 Mon Sep 17 00:00:00 2001 From: Jiri Bohac Date: Wed, 26 Jan 2022 16:00:18 +0100 Subject: [PATCH 03/55] UPSTREAM: Revert "xfrm: xfrm_state_mtu should return at least 1280 for ipv6" commit a6d95c5a628a09be129f25d5663a7e9db8261f51 upstream. This reverts commit b515d2637276a3810d6595e10ab02c13bfd0b63a. Commit b515d2637276a3810d6595e10ab02c13bfd0b63a ("xfrm: xfrm_state_mtu should return at least 1280 for ipv6") in v5.14 breaks the TCP MSS calculation in ipsec transport mode, resulting complete stalls of TCP connections. This happens when the (P)MTU is 1280 or slighly larger. The desired formula for the MSS is: MSS = (MTU - ESP_overhead) - IP header - TCP header However, the above commit clamps the (MTU - ESP_overhead) to a minimum of 1280, turning the formula into MSS = max(MTU - ESP overhead, 1280) - IP header - TCP header With the (P)MTU near 1280, the calculated MSS is too large and the resulting TCP packets never make it to the destination because they are over the actual PMTU. The above commit also causes suboptimal double fragmentation in xfrm tunnel mode, as described in https://lore.kernel.org/netdev/20210429202529.codhwpc7w6kbudug@dwarf.suse.cz/ The original problem the above commit was trying to fix is now fixed by commit 6596a0229541270fb8d38d989f91b78838e5e9da ("xfrm: fix MTU regression"). Bug: 232198719 Signed-off-by: Jiri Bohac Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Change-Id: If9f9f1015f1a494775f79efe7e84a37b63e48d3c Signed-off-by: Lina Wang --- include/net/xfrm.h | 1 - net/ipv4/esp4.c | 2 +- net/ipv6/esp6.c | 2 +- net/xfrm/xfrm_state.c | 14 ++------------ 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 737ac722410f..ae5d84492538 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1546,7 +1546,6 @@ void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); int xfrm_init_replay(struct xfrm_state *x); -u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu); u32 xfrm_state_mtu(struct xfrm_state *x, int mtu); int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload); int xfrm_init_state(struct xfrm_state *x); diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 61dfb64e7256..a3271ec3e162 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -673,7 +673,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); u32 padto; - padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached)); + padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); if (skb->len < padto) esp.tfclen = padto - skb->len; } diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 33524fe2a159..0158b0163ca8 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -708,7 +708,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); u32 padto; - padto = min(x->tfcpad, __xfrm_state_mtu(x, dst->child_mtu_cached)); + padto = min(x->tfcpad, xfrm_state_mtu(x, dst->child_mtu_cached)); if (skb->len < padto) esp.tfclen = padto - skb->len; } diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 6cbbe81a8b4c..fb3cd935330b 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -2519,7 +2519,7 @@ void xfrm_state_delete_tunnel(struct xfrm_state *x) } EXPORT_SYMBOL(xfrm_state_delete_tunnel); -u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu) +u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) { const struct xfrm_type *type = READ_ONCE(x->type); struct crypto_aead *aead; @@ -2550,17 +2550,7 @@ u32 __xfrm_state_mtu(struct xfrm_state *x, int mtu) return ((mtu - x->props.header_len - crypto_aead_authsize(aead) - net_adj) & ~(blksize - 1)) + net_adj - 2; } -EXPORT_SYMBOL_GPL(__xfrm_state_mtu); - -u32 xfrm_state_mtu(struct xfrm_state *x, int mtu) -{ - mtu = __xfrm_state_mtu(x, mtu); - - if (x->props.family == AF_INET6 && mtu < IPV6_MIN_MTU) - return IPV6_MIN_MTU; - - return mtu; -} +EXPORT_SYMBOL_GPL(xfrm_state_mtu); int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload) { From 66f0c91b2fe573daaf009ab358d5122386dec4e8 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 12 May 2022 16:13:22 -0700 Subject: [PATCH 04/55] ANDROID: Fix the drain_all_pages default condition broken by a hook The condition introduced by a patch adding a vendor hook to skip drain_all_pages is invalid and changes the default behavior for CMA allocations. Fix the condition to restore default behavior. Fixes: a2485b8abd57 ("ANDROID: vendor_hooks: Add hooks to for alloc_contig_range") Bug: 232357688 Reported-by: Yong-Taek Lee Signed-off-by: Suren Baghdasaryan Change-Id: I686ad9dff57f604557f79cf4dc12cde55474e533 --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 30f52cc94948..a02506f0bfbd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8772,7 +8772,7 @@ int alloc_contig_range(unsigned long start, unsigned long end, trace_android_vh_cma_drain_all_pages_bypass(migratetype, &skip_drain_all_pages); - if (skip_drain_all_pages) + if (!skip_drain_all_pages) drain_all_pages(cc.zone); /* From 3e71aa523eca0c44dace473b23f135c72c96a808 Mon Sep 17 00:00:00 2001 From: Steffen Klassert Date: Mon, 7 Mar 2022 13:11:39 +0100 Subject: [PATCH 05/55] BACKPORT: esp: Fix possible buffer overflow in ESP transformation commit ebe48d368e97d007bfeb76fcb065d6cfc4c96645 upstream. The maximum message size that can be send is bigger than the maximum site that skb_page_frag_refill can allocate. So it is possible to write beyond the allocated buffer. Fix this by doing a fallback to COW in that case. v2: Avoid get get_order() costs as suggested by Linus Torvalds. Bug: 227452856 Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible") Fixes: 03e2a30f6a27 ("esp6: Avoid skb_cow_data whenever possible") Reported-by: valis Signed-off-by: Steffen Klassert Signed-off-by: Tadeusz Struk Signed-off-by: Greg Kroah-Hartman Change-Id: I2c7f97914138271e7788adfcebbd0b2b8b43cdcb Signed-off-by: Lee Jones --- include/net/esp.h | 2 ++ include/net/sock.h | 1 + net/ipv4/esp4.c | 5 +++++ net/ipv6/esp6.c | 5 +++++ 4 files changed, 13 insertions(+) diff --git a/include/net/esp.h b/include/net/esp.h index 9c5637d41d95..90cd02ff77ef 100644 --- a/include/net/esp.h +++ b/include/net/esp.h @@ -4,6 +4,8 @@ #include +#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER) + struct ip_esp_hdr; static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) diff --git a/include/net/sock.h b/include/net/sock.h index 738981f7b565..eb64ca0f01f3 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2691,6 +2691,7 @@ extern int sysctl_optmem_max; extern __u32 sysctl_wmem_default; extern __u32 sysctl_rmem_default; +#define SKB_FRAG_PAGE_ORDER get_order(32768) DECLARE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key); static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto) diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index a3271ec3e162..d76af5ba5cc2 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -448,6 +448,7 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info * struct page *page; struct sk_buff *trailer; int tailen = esp->tailen; + unsigned int allocsz; /* this is non-NULL only with TCP/UDP Encapsulation */ if (x->encap) { @@ -457,6 +458,10 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info * return err; } + allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) + goto cow; + if (!skb_cloned(skb)) { if (tailen <= skb_tailroom(skb)) { nfrags = 1; diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 0158b0163ca8..f5d40fabad0b 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -483,6 +483,11 @@ int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info struct page *page; struct sk_buff *trailer; int tailen = esp->tailen; + unsigned int allocsz; + + allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) + goto cow; if (x->encap) { int err = esp6_output_encap(x, skb, esp); From 76c90b9959c97a55641582cc348bb90f5a2fb841 Mon Sep 17 00:00:00 2001 From: Alistair Delva Date: Wed, 19 Jan 2022 23:21:39 +0000 Subject: [PATCH 06/55] UPSTREAM: remoteproc: Fix count check in rproc_coredump_write() commit f89672cc3681952f2d06314981a6b45f8b0045d1 upstream. Check count for 0, to avoid a potential underflow. Make the check the same as the one in rproc_recovery_write(). Fixes: 3afdc59e4390 ("remoteproc: Add coredump debugfs entry") Signed-off-by: Alistair Delva Cc: Rishabh Bhatnagar Cc: stable@vger.kernel.org Cc: Ohad Ben-Cohen Cc: Bjorn Andersson Cc: Mathieu Poirier Cc: Sibi Sankar Cc: linux-remoteproc@vger.kernel.org Cc: kernel-team@android.com Reviewed-by: Bjorn Andersson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220119232139.1125908-1-adelva@google.com Signed-off-by: Greg Kroah-Hartman Bug: 227408567 Signed-off-by: Chunhui Li Change-Id: I57eb3dd2a7487e57f460cc9cce0097f139ed9da7 --- drivers/remoteproc/remoteproc_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index b5a1e3b697d9..581930483ef8 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -76,7 +76,7 @@ static ssize_t rproc_coredump_write(struct file *filp, int ret, err = 0; char buf[20]; - if (count > sizeof(buf)) + if (count < 1 || count > sizeof(buf)) return -EINVAL; ret = copy_from_user(buf, user_buf, count); From 59735a7d31c9f8c2dec917067063766723b0f9d5 Mon Sep 17 00:00:00 2001 From: liuhailong Date: Fri, 13 May 2022 01:20:49 +0800 Subject: [PATCH 07/55] ANDROID: oplus: Update the ABI xml and symbol list Leaf changes summary: 2 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable 1 Added function: [A] 'function int __traceiter_android_vh_killed_process(void*, task_struct*, task_struct*, bool*)' 1 Added variable: [A] 'tracepoint __tracepoint_android_vh_killed_process' Bug: 232062955 Change-Id: I46a611d0afbc4313a94106389229c3d2e24a3b6b Signed-off-by: liuhailong --- android/abi_gki_aarch64.xml | 628 +++++++++++++++++----------------- android/abi_gki_aarch64_oplus | 2 + 2 files changed, 321 insertions(+), 309 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index e5b5a17b490b..f0aa75858449 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -482,6 +482,7 @@ + @@ -6241,6 +6242,7 @@ + @@ -7856,7 +7858,7 @@ - + @@ -24166,42 +24168,42 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -33855,60 +33857,60 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -39882,7 +39884,7 @@ - + @@ -50670,18 +50672,18 @@ - + - + - + - + - + @@ -57304,390 +57306,390 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -67027,7 +67029,7 @@ - + @@ -75603,15 +75605,15 @@ - + - + - + - + @@ -98443,46 +98445,46 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -115085,10 +115087,10 @@ - - - - + + + + @@ -115781,8 +115783,8 @@ - - + + @@ -117166,6 +117168,13 @@ + + + + + + + @@ -118386,6 +118395,7 @@ + @@ -119182,12 +119192,12 @@ - - - - - - + + + + + + @@ -121293,10 +121303,10 @@ - - - - + + + + @@ -124827,16 +124837,16 @@ - - + + - - + + - - + + @@ -124848,16 +124858,16 @@ - - + + - - + + - - + + @@ -127538,10 +127548,10 @@ - - - - + + + + @@ -131651,9 +131661,9 @@ - - - + + + @@ -131748,10 +131758,10 @@ - - - - + + + + @@ -132413,8 +132423,8 @@ - - + + @@ -133516,16 +133526,16 @@ - - + + - - + + - - + + @@ -139190,16 +139200,16 @@ - - - - + + + + - - - - + + + + @@ -139728,10 +139738,10 @@ - - - - + + + + @@ -139875,8 +139885,8 @@ - - + + @@ -139886,9 +139896,9 @@ - - - + + + @@ -139936,9 +139946,9 @@ - - - + + + @@ -139952,10 +139962,10 @@ - - - - + + + + @@ -140016,11 +140026,11 @@ - - - - - + + + + + @@ -140028,9 +140038,9 @@ - - - + + + @@ -142535,11 +142545,11 @@ - - - - - + + + + + @@ -143610,12 +143620,12 @@ - - + + - - + + @@ -143626,15 +143636,15 @@ - - - - + + + + - - - + + + @@ -143748,16 +143758,16 @@ - - + + - - + + - - + + @@ -144040,10 +144050,10 @@ - - - - + + + + @@ -144151,9 +144161,9 @@ - - - + + + @@ -144254,9 +144264,9 @@ - - - + + + @@ -144333,8 +144343,8 @@ - - + + @@ -144535,9 +144545,9 @@ - - - + + + @@ -146160,14 +146170,14 @@ - - - + + + - - - + + + diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 72015e048a60..080c7d19c0fa 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -2812,6 +2812,7 @@ __traceiter_android_vh_prepare_update_load_avg_se __traceiter_android_vh_printk_hotplug __traceiter_android_vh_process_killed + __traceiter_android_vh_killed_process __traceiter_android_vh_revert_creds __traceiter_android_vh_rmqueue __traceiter_android_vh_rwsem_init @@ -3019,6 +3020,7 @@ __tracepoint_android_vh_prepare_update_load_avg_se __tracepoint_android_vh_printk_hotplug __tracepoint_android_vh_process_killed + __tracepoint_android_vh_killed_process __tracepoint_android_vh_revert_creds __tracepoint_android_vh_rmqueue __tracepoint_android_vh_rwsem_init From 82a3c7ee8d075d64c0651eebdc28b190e43cdfef Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 13 May 2022 14:34:05 +0800 Subject: [PATCH 08/55] ANDROID: GKI: Update symbols to symbol list Update symbols to symbol list from oppo 8 Added functions: [A] 'function int register_tcf_proto_ops(tcf_proto_ops*)' [A] 'function int tcf_action_exec(sk_buff*, tc_action**, int, tcf_result*)' [A] 'function void tcf_exts_destroy(tcf_exts*)' [A] 'function int tcf_exts_dump(sk_buff*, tcf_exts*)' [A] 'function int tcf_exts_dump_stats(sk_buff*, tcf_exts*)' [A] 'function int tcf_exts_validate(net*, tcf_proto*, nlattr**, nlattr*, tcf_exts*, bool, bool, netlink_ext_ack*)' [A] 'function bool tcf_queue_work(rcu_work*, work_func_t)' [A] 'function int unregister_tcf_proto_ops(tcf_proto_ops*)' Bug: 193384408 Signed-off-by: Wei Liu Change-Id: Ie958341612c6f99cf71661d7ff971483e92c4c00 --- android/abi_gki_aarch64.xml | 396 +++++++++++++++++++++++++++++++++- android/abi_gki_aarch64_oplus | 8 + 2 files changed, 400 insertions(+), 4 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index f0aa75858449..ff1200899808 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -4291,6 +4291,7 @@ + @@ -5167,6 +5168,12 @@ + + + + + + @@ -5466,6 +5473,7 @@ + @@ -9113,6 +9121,10 @@ + + + + @@ -13482,6 +13494,12 @@ + + + + + + @@ -14189,6 +14207,7 @@ + @@ -14589,6 +14608,7 @@ + @@ -16069,6 +16089,20 @@ + + + + + + + + + + + + + + @@ -24646,6 +24680,15 @@ + + + + + + + + + @@ -25283,6 +25326,7 @@ + @@ -26314,6 +26358,7 @@ + @@ -30570,6 +30615,7 @@ + @@ -36780,6 +36826,12 @@ + + + + + + @@ -43543,6 +43595,7 @@ + @@ -44895,6 +44948,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -49344,6 +49423,7 @@ + @@ -50040,6 +50120,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -50122,6 +50222,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50378,6 +50525,7 @@ + @@ -50901,6 +51049,7 @@ + @@ -55276,6 +55425,12 @@ + + + + + + @@ -56467,6 +56622,7 @@ + @@ -56758,6 +56914,7 @@ + @@ -57903,6 +58060,17 @@ + + + + + + + + + + + @@ -58997,6 +59165,7 @@ + @@ -59333,6 +59502,7 @@ + @@ -61941,6 +62111,7 @@ + @@ -63364,6 +63535,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -63398,6 +63637,15 @@ + + + + + + + + + @@ -63405,6 +63653,7 @@ + @@ -63606,6 +63855,17 @@ + + + + + + + + + + + @@ -64800,7 +65060,7 @@ - + @@ -67282,6 +67542,7 @@ + @@ -68427,7 +68688,26 @@ - + + + + + + + + + + + + + + + + + + + + @@ -71897,6 +72177,7 @@ + @@ -72520,6 +72801,7 @@ + @@ -73003,6 +73285,7 @@ + @@ -76620,6 +76903,7 @@ + @@ -79018,7 +79302,15 @@ + + + + + + + + @@ -79136,6 +79428,7 @@ + @@ -81303,6 +81596,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -85212,6 +85525,7 @@ + @@ -89989,6 +90303,7 @@ + @@ -100176,6 +100491,19 @@ + + + + + + + + + + + + + @@ -101120,8 +101448,8 @@ - - + + @@ -105320,6 +105648,10 @@ + + + + @@ -105846,6 +106178,11 @@ + + + + + @@ -109765,6 +110102,11 @@ + + + + + @@ -112333,6 +112675,7 @@ + @@ -137505,6 +137848,10 @@ + + + + @@ -142089,6 +142436,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -143604,6 +143988,10 @@ + + + + diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 080c7d19c0fa..5f50e47ef58a 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -2130,6 +2130,7 @@ register_shrinker register_syscore_ops register_sysctl_table + register_tcf_proto_ops register_virtio_device register_virtio_driver regmap_bulk_read @@ -2629,6 +2630,12 @@ __task_pid_nr_ns __task_rq_lock task_rq_lock + tcf_action_exec + tcf_exts_destroy + tcf_exts_dump + tcf_exts_dump_stats + tcf_exts_validate + tcf_queue_work tcp_hashinfo tcp_parse_options thaw_bdev @@ -3211,6 +3218,7 @@ unregister_shrinker unregister_syscore_ops unregister_sysctl_table + unregister_tcf_proto_ops unregister_virtio_device unregister_virtio_driver up From 1292f517889e560101515ba02c26a904e4ee6964 Mon Sep 17 00:00:00 2001 From: Hangyu Hua Date: Fri, 11 Mar 2022 16:06:14 +0800 Subject: [PATCH 09/55] BACKPORT: can: usb_8dev: usb_8dev_start_xmit(): fix double dev_kfree_skb() in error path commit 3d3925ff6433f98992685a9679613a2cc97f3ce2 upstream. There is no need to call dev_kfree_skb() when usb_submit_urb() fails because can_put_echo_skb() deletes original skb and can_free_echo_skb() deletes the cloned skb. Bug: 228694483 Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from 8 devices") Link: https://lore.kernel.org/all/20220311080614.45229-1-hbh25y@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Hangyu Hua Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lee Jones Change-Id: I3c9191dd936d82e7c692fad33919b766e69ed7b5 --- drivers/net/can/usb/usb_8dev.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index ca7c55d6a41d..985e00aee4ee 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c @@ -670,9 +670,20 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb, atomic_inc(&priv->active_tx_urbs); err = usb_submit_urb(urb, GFP_ATOMIC); - if (unlikely(err)) - goto failed; - else if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) + if (unlikely(err)) { + can_free_echo_skb(netdev, context->echo_index); + + usb_unanchor_urb(urb); + usb_free_coherent(priv->udev, size, buf, urb->transfer_dma); + + atomic_dec(&priv->active_tx_urbs); + + if (err == -ENODEV) + netif_device_detach(netdev); + else + netdev_warn(netdev, "failed tx_urb %d\n", err); + stats->tx_dropped++; + } else if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) /* Slow down tx path */ netif_stop_queue(netdev); @@ -691,19 +702,6 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb, return NETDEV_TX_BUSY; -failed: - can_free_echo_skb(netdev, context->echo_index); - - usb_unanchor_urb(urb); - usb_free_coherent(priv->udev, size, buf, urb->transfer_dma); - - atomic_dec(&priv->active_tx_urbs); - - if (err == -ENODEV) - netif_device_detach(netdev); - else - netdev_warn(netdev, "failed tx_urb %d\n", err); - nomembuf: usb_free_urb(urb); From a27d9caa6a44ae798e8291f287149536753f93bb Mon Sep 17 00:00:00 2001 From: Hangyu Hua Date: Mon, 28 Feb 2022 16:36:39 +0800 Subject: [PATCH 10/55] BACKPORT: can: ems_usb: ems_usb_start_xmit(): fix double dev_kfree_skb() in error path commit c70222752228a62135cee3409dccefd494a24646 upstream. There is no need to call dev_kfree_skb() when usb_submit_urb() fails beacause can_put_echo_skb() deletes the original skb and can_free_echo_skb() deletes the cloned skb. Bug: 228694391 Link: https://lore.kernel.org/all/20220228083639.38183-1-hbh25y@gmail.com Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface") Cc: stable@vger.kernel.org Cc: Sebastian Haas Signed-off-by: Hangyu Hua Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lee Jones Change-Id: Ia678a0b249eae6e80823461f18eb315ec5385eab --- drivers/net/can/usb/ems_usb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 249d2fba28c7..6458da9c13b9 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -823,7 +823,6 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne usb_unanchor_urb(urb); usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); - dev_kfree_skb(skb); atomic_dec(&dev->active_tx_urbs); From 8c3ac02bcaf8c2167ad5acd18e6a3c23de361763 Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Fri, 20 May 2022 10:57:27 +0800 Subject: [PATCH 11/55] ANDROID: vendor_hooks: Add hooks for mutex Due to the existence of optimistic spin, we need to sense whether the owner of the lock has changed in the loop, so as to do priority inheritance on the owner more accurately, trace_android_vh_mutex_wait_start does not meet our needs. Bug: 231647361 Change-Id: Iab2832fd3c352d8c1229348a5e7befced70ee92e Signed-off-by: Liujie Xie --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/dtask.h | 3 +++ kernel/locking/mutex.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 1ca42b0dfd4d..271df56a34ed 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -243,6 +243,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_start_check_new_owner); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_undefinstr); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_ptrauth_fault); diff --git a/include/trace/hooks/dtask.h b/include/trace/hooks/dtask.h index 675634238fbd..7053563e2e8f 100644 --- a/include/trace/hooks/dtask.h +++ b/include/trace/hooks/dtask.h @@ -57,6 +57,9 @@ DECLARE_HOOK(android_vh_mutex_unlock_slowpath, DECLARE_HOOK(android_vh_mutex_unlock_slowpath_end, TP_PROTO(struct mutex *lock, struct task_struct *next), TP_ARGS(lock, next)); +DECLARE_HOOK(android_vh_mutex_start_check_new_owner, + TP_PROTO(struct mutex *lock), + TP_ARGS(lock)); /* macro versions of hooks are no longer required */ diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index fac88b1e134e..6d4f413264d2 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -1049,6 +1049,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, goto err; } + trace_android_vh_mutex_start_check_new_owner(lock); spin_unlock(&lock->wait_lock); schedule_preempt_disabled(); From 9efe21cd8f3f99cb32088ae3729c87fd64cc22de Mon Sep 17 00:00:00 2001 From: Sachin Gupta Date: Wed, 25 May 2022 16:13:19 +0530 Subject: [PATCH 12/55] ANDROID: Update QCOM symbol list for __reset_control_get synchronize QCOM symbol list in android/abi_gki_aarch64_qcom for __reset_control_get. Leaf changes summary: 1 artifact changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 1 Added function: [A] 'function reset_control* __reset_control_get(device*, const char*, int, bool, bool, bool)' Bug: 231930187 Change-Id: Ie13669175150b17d63c56a42e579cbde87bc49a6 Signed-off-by: Sachin Gupta --- android/abi_gki_aarch64.xml | 10 ++++++++++ android/abi_gki_aarch64_qcom | 1 + 2 files changed, 11 insertions(+) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index d8df9cb04d3d..6b7544d173c9 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -247,6 +247,7 @@ + @@ -115950,6 +115951,15 @@ + + + + + + + + + diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index fe1688823b24..34770c16c5b8 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -2034,6 +2034,7 @@ resched_curr reset_control_assert reset_control_deassert + __reset_control_get reset_control_put reset_control_reset resume_cpus From 6a15abd604272645d204a166b5b92452efa4b8f9 Mon Sep 17 00:00:00 2001 From: Mark-PK Tsai Date: Fri, 22 Apr 2022 14:24:35 +0800 Subject: [PATCH 13/55] FROMLIST: dma-mapping: Add dma_release_coherent_memory to DMA API Add dma_release_coherent_memory to DMA API to allow dma user call it to release dev->dma_mem when the device is removed. Signed-off-by: Mark-PK Tsai Bug: 233721768 Link: https://lore.kernel.org/lkml/20220422062436.14384-2-mark-pk.tsai@mediatek.com/ Change-Id: Ief72cf5bbe18a977bae76a1e5799ebc06b46d791 Signed-off-by: Mark-PK Tsai (cherry picked from commit 137066946c448e67c4b5b344949ab0c3aec62dfa) --- include/linux/dma-map-ops.h | 3 +++ kernel/dma/coherent.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h index 84c14dbcdb66..b9a8549f9a7f 100644 --- a/include/linux/dma-map-ops.h +++ b/include/linux/dma-map-ops.h @@ -171,6 +171,7 @@ static inline void dma_pernuma_cma_reserve(void) { } #ifdef CONFIG_DMA_DECLARE_COHERENT int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, dma_addr_t device_addr, size_t size); +void dma_release_coherent_memory(struct device *dev); int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle, void **ret); int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr); @@ -189,6 +190,8 @@ static inline int dma_declare_coherent_memory(struct device *dev, { return -ENOSYS; } + +#define dma_release_coherent_memory(dev) (0) #define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0) #define dma_release_from_dev_coherent(dev, order, vaddr) (0) #define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0) diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c index 5b5b6c7ec7f2..b79d8d0433dd 100644 --- a/kernel/dma/coherent.c +++ b/kernel/dma/coherent.c @@ -84,7 +84,7 @@ static int dma_init_coherent_memory(phys_addr_t phys_addr, return ret; } -static void dma_release_coherent_memory(struct dma_coherent_mem *mem) +static void _dma_release_coherent_memory(struct dma_coherent_mem *mem) { if (!mem) return; @@ -136,10 +136,16 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, ret = dma_assign_coherent_memory(dev, mem); if (ret) - dma_release_coherent_memory(mem); + _dma_release_coherent_memory(mem); return ret; } +void dma_release_coherent_memory(struct device *dev) +{ + if (dev) + _dma_release_coherent_memory(dev->dma_mem); +} + static void *__dma_alloc_from_coherent(struct device *dev, struct dma_coherent_mem *mem, ssize_t size, dma_addr_t *dma_handle) From 0f771294166446c55eb8f14413eea2d84474d3f1 Mon Sep 17 00:00:00 2001 From: Mark-PK Tsai Date: Fri, 22 Apr 2022 14:24:36 +0800 Subject: [PATCH 14/55] FROMLIST: remoteproc: Fix dma_mem leak after rproc_shutdown Release dma coherent memory before rvdev is free in rproc_rvdev_release(). Below is the kmemleak report: unreferenced object 0xffffff8051c1a980 (size 128): comm "sh", pid 4895, jiffies 4295026604 (age 15481.896s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000003a0f3ec0>] dma_declare_coherent_memory+0x44/0x11c [<00000000ad243164>] rproc_add_virtio_dev+0xb8/0x20c [<00000000d219c8e9>] rproc_vdev_do_start+0x18/0x24 [<00000000e694b468>] rproc_start+0x22c/0x3e0 [<000000000b938941>] rproc_boot+0x4a4/0x860 [<000000003c4dc532>] state_store.52856+0x10c/0x1b8 [<00000000df2297ac>] dev_attr_store+0x34/0x84 [<0000000083a53bdb>] sysfs_kf_write+0x60/0xbc [<000000008ed830df>] kernfs_fop_write+0x198/0x458 [<0000000072b9ad06>] __vfs_write+0x50/0x210 [<00000000377d7469>] vfs_write+0xe4/0x1a8 [<00000000c3fc594e>] ksys_write+0x78/0x144 [<000000009aef6f4b>] __arm64_sys_write+0x1c/0x28 [<0000000003496a98>] el0_svc_common+0xc8/0x22c [<00000000ea3fe7a3>] el0_svc_compat_handler+0x1c/0x28 [<00000000d1a85a4e>] el0_svc_compat+0x8/0x24 Signed-off-by: Mark-PK Tsai Bug: 233721768 Link: https://lore.kernel.org/lkml/20220422062436.14384-3-mark-pk.tsai@mediatek.com/ Change-Id: I77ba09a8cb86d90f6498e6a9e9747aa5c155c7da Signed-off-by: Mark-PK Tsai (cherry picked from commit 5eee510aa3aa92fd8409cfcc29bda06cc9e4fe37) --- drivers/remoteproc/remoteproc_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 8dd8b9138789..83cd040a2993 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -461,6 +461,7 @@ static void rproc_rvdev_release(struct device *dev) struct rproc_vdev *rvdev = container_of(dev, struct rproc_vdev, dev); of_reserved_mem_device_release(dev); + dma_release_coherent_memory(dev); kfree(rvdev); } From 95e278bdc87adbc5aa3aeb960a78ac85de1fe160 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 16 May 2022 23:05:51 +0200 Subject: [PATCH 15/55] UPSTREAM: io_uring: always use original task when preparing req identity If the ring is setup with IORING_SETUP_IOPOLL and we have more than one task doing submissions on a ring, we can up in a situation where we assign the context from the current task rather than the request originator. Always use req->task rather than assume it's the same as current. No upstream patch exists for this issue, as only older kernels with the non-native workers have this problem. Bug: 233078742 Reported-by: Kyle Zeng Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Signed-off-by: Akilesh Kailash (cherry picked from commit 29f077d070519a88a793fbc70f1e6484dc6d9e35 from linux-5.10.y stable branch) Change-Id: I4cc543950a95e1df201fa9867c5e9c272fd54b6f --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 5959b0359524..af4295673613 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1156,7 +1156,7 @@ static inline void __io_req_init_async(struct io_kiocb *req) */ static inline void io_req_init_async(struct io_kiocb *req) { - struct io_uring_task *tctx = current->io_uring; + struct io_uring_task *tctx = req->task->io_uring; if (req->flags & REQ_F_WORK_INITIALIZED) return; From 07b78bf6d055d37008c712aac3536a2ad40c125e Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 13 Apr 2022 10:35:41 -0700 Subject: [PATCH 16/55] BACKPORT: net/sched: cls_u32: fix netns refcount changes in u32_change() commit 3db09e762dc79584a69c10d74a6b98f89a9979f8 upstream. We are now able to detect extra put_net() at the moment they happen, instead of much later in correct code paths. u32_init_knode() / tcf_exts_init() populates the ->exts.net pointer, but as mentioned in tcf_exts_init(), the refcount on netns has not been elevated yet. The refcount is taken only once tcf_exts_get_net() is called. So the two u32_destroy_key() calls from u32_change() are attempting to release an invalid reference on the netns. syzbot report: refcount_t: decrement hit 0; leaking memory. WARNING: CPU: 0 PID: 21708 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31 Modules linked in: CPU: 0 PID: 21708 Comm: syz-executor.5 Not tainted 5.18.0-rc2-next-20220412-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31 Code: 1d 14 b6 b2 09 31 ff 89 de e8 6d e9 89 fd 84 db 75 e0 e8 84 e5 89 fd 48 c7 c7 40 aa 26 8a c6 05 f4 b5 b2 09 01 e8 e5 81 2e 05 <0f> 0b eb c4 e8 68 e5 89 fd 0f b6 1d e3 b5 b2 09 31 ff 89 de e8 38 RSP: 0018:ffffc900051af1b0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000040000 RSI: ffffffff8160a0c8 RDI: fffff52000a35e28 RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff81604a9e R11: 0000000000000000 R12: 1ffff92000a35e3b R13: 00000000ffffffef R14: ffff8880211a0194 R15: ffff8880577d0a00 FS: 00007f25d183e700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f19c859c028 CR3: 0000000051009000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __refcount_dec include/linux/refcount.h:344 [inline] refcount_dec include/linux/refcount.h:359 [inline] ref_tracker_free+0x535/0x6b0 lib/ref_tracker.c:118 netns_tracker_free include/net/net_namespace.h:327 [inline] put_net_track include/net/net_namespace.h:341 [inline] tcf_exts_put_net include/net/pkt_cls.h:255 [inline] u32_destroy_key.isra.0+0xa7/0x2b0 net/sched/cls_u32.c:394 u32_change+0xe01/0x3140 net/sched/cls_u32.c:909 tc_new_tfilter+0x98d/0x2200 net/sched/cls_api.c:2148 rtnetlink_rcv_msg+0x80d/0xb80 net/core/rtnetlink.c:6016 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2495 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 ____sys_sendmsg+0x6e2/0x800 net/socket.c:2413 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f25d0689049 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f25d183e168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f25d079c030 RCX: 00007f25d0689049 RDX: 0000000000000000 RSI: 0000000020000340 RDI: 0000000000000005 RBP: 00007f25d06e308d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd0b752e3f R14: 00007f25d183e300 R15: 0000000000022000 Bug: 233075473 Fixes: 35c55fc156d8 ("cls_u32: use tcf_exts_get_net() before call_rcu()") Signed-off-by: Eric Dumazet Reported-by: syzbot Cc: Cong Wang Cc: Jiri Pirko Acked-by: Jamal Hadi Salim Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lee Jones Change-Id: I7b19da654a2615bf602d692fe0f5f91e3d33c371 --- net/sched/cls_u32.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 54209a18d7fe..b61db335c49d 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -386,14 +386,19 @@ static int u32_init(struct tcf_proto *tp) return 0; } -static int u32_destroy_key(struct tc_u_knode *n, bool free_pf) +static void __u32_destroy_key(struct tc_u_knode *n) { struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); tcf_exts_destroy(&n->exts); - tcf_exts_put_net(&n->exts); if (ht && --ht->refcnt == 0) kfree(ht); + kfree(n); +} + +static void u32_destroy_key(struct tc_u_knode *n, bool free_pf) +{ + tcf_exts_put_net(&n->exts); #ifdef CONFIG_CLS_U32_PERF if (free_pf) free_percpu(n->pf); @@ -402,8 +407,7 @@ static int u32_destroy_key(struct tc_u_knode *n, bool free_pf) if (free_pf) free_percpu(n->pcpu_success); #endif - kfree(n); - return 0; + __u32_destroy_key(n); } /* u32_delete_key_rcu should be called when free'ing a copied @@ -898,13 +902,13 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, tca[TCA_RATE], ovr, extack); if (err) { - u32_destroy_key(new, false); + __u32_destroy_key(new); return err; } err = u32_replace_hw_knode(tp, new, flags, extack); if (err) { - u32_destroy_key(new, false); + __u32_destroy_key(new); return err; } From fefdf99a969ea68597b8e64b44c73b8813d12e58 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 8 Apr 2022 11:08:58 -0600 Subject: [PATCH 17/55] BACKPORT: io_uring: fix race between timeout flush and removal commit e677edbcabee849bfdd43f1602bccbecf736a646 upstream. io_flush_timeouts() assumes the timeout isn't in progress of triggering or being removed/canceled, so it unconditionally removes it from the timeout list and attempts to cancel it. Leave it on the list and let the normal timeout cancelation take care of it. Bug: 231494876 Cc: stable@vger.kernel.org # 5.5+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lee Jones Change-Id: Ie7dba41da32732391f8a85526fe20168bd431be8 --- fs/io_uring.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index af4295673613..b9e9046777db 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1556,6 +1556,7 @@ static void __io_queue_deferred(struct io_ring_ctx *ctx) static void io_flush_timeouts(struct io_ring_ctx *ctx) { + struct io_kiocb *req, *tmp; u32 seq; if (list_empty(&ctx->timeout_list)) @@ -1563,10 +1564,8 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx) seq = ctx->cached_cq_tail - atomic_read(&ctx->cq_timeouts); - do { + list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) { u32 events_needed, events_got; - struct io_kiocb *req = list_first_entry(&ctx->timeout_list, - struct io_kiocb, timeout.list); if (io_is_timeout_noseq(req)) break; @@ -1583,9 +1582,8 @@ static void io_flush_timeouts(struct io_ring_ctx *ctx) if (events_got < events_needed) break; - list_del_init(&req->timeout.list); io_kill_timeout(req, 0); - } while (!list_empty(&ctx->timeout_list)); + } ctx->cq_last_tm_flush = seq; } @@ -5639,6 +5637,7 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe, else data->mode = HRTIMER_MODE_REL; + INIT_LIST_HEAD(&req->timeout.list); hrtimer_init(&data->timer, CLOCK_MONOTONIC, data->mode); return 0; } @@ -6282,12 +6281,12 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer) if (!list_empty(&req->link_list)) { prev = list_entry(req->link_list.prev, struct io_kiocb, link_list); - if (refcount_inc_not_zero(&prev->refs)) - list_del_init(&req->link_list); - else + list_del_init(&req->link_list); + if (!refcount_inc_not_zero(&prev->refs)) prev = NULL; } + list_del(&req->timeout.list); spin_unlock_irqrestore(&ctx->completion_lock, flags); if (prev) { From db16bd36e8d6c50a4fad17400e254e123e8b7662 Mon Sep 17 00:00:00 2001 From: Roger Quadros Date: Mon, 24 Jan 2022 08:01:50 -0800 Subject: [PATCH 18/55] UPSTREAM: usb: gadget: f_mass_storage: Make CD-ROM emulation work with Mac OS-X Mac OS-X expects CD-ROM TOC in raw format (i.e. format:2). It also sends the READ_TOC CDB in old style SFF8020i format. i.e. 2 format bits are encoded in MSBs of CDB byte 9. This patch will enable CD-ROM emulation to work with Mac OS-X. Tested on Mac OS X v10.6.3. Acked-by: Alan Stern Signed-off-by: Roger Quadros Signed-off-by: Jack Pham Link: https://lore.kernel.org/r/20220124160150.19499-1-quic_jackp@quicinc.com Signed-off-by: Greg Kroah-Hartman Bug: 235304500 (cherry picked from commit 89ada0fe669a7abf8777b793b874202a0767a24f) Change-Id: Ibc4b89260f3ca788edae401d60e1392322e785a0 --- drivers/usb/gadget/function/f_mass_storage.c | 70 ++++++++++++++++---- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 03db2d6b2dba..12fe0be35528 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -1188,6 +1188,8 @@ static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh) int msf = common->cmnd[1] & 0x02; int start_track = common->cmnd[6]; u8 *buf = (u8 *)bh->buf; + u8 format; + int i, len; if ((common->cmnd[1] & ~0x02) != 0 || /* Mask away MSF */ start_track > 1) { @@ -1195,18 +1197,62 @@ static int do_read_toc(struct fsg_common *common, struct fsg_buffhd *bh) return -EINVAL; } - memset(buf, 0, 20); - buf[1] = (20-2); /* TOC data length */ - buf[2] = 1; /* First track number */ - buf[3] = 1; /* Last track number */ - buf[5] = 0x16; /* Data track, copying allowed */ - buf[6] = 0x01; /* Only track is number 1 */ - store_cdrom_address(&buf[8], msf, 0); + format = common->cmnd[2] & 0xf; + /* + * Check if CDB is old style SFF-8020i + * i.e. format is in 2 MSBs of byte 9 + * Mac OS-X host sends us this. + */ + if (format == 0) + format = (common->cmnd[9] >> 6) & 0x3; - buf[13] = 0x16; /* Lead-out track is data */ - buf[14] = 0xAA; /* Lead-out track number */ - store_cdrom_address(&buf[16], msf, curlun->num_sectors); - return 20; + switch (format) { + case 0: + /* Formatted TOC */ + len = 4 + 2*8; /* 4 byte header + 2 descriptors */ + memset(buf, 0, len); + buf[1] = len - 2; /* TOC Length excludes length field */ + buf[2] = 1; /* First track number */ + buf[3] = 1; /* Last track number */ + buf[5] = 0x16; /* Data track, copying allowed */ + buf[6] = 0x01; /* Only track is number 1 */ + store_cdrom_address(&buf[8], msf, 0); + + buf[13] = 0x16; /* Lead-out track is data */ + buf[14] = 0xAA; /* Lead-out track number */ + store_cdrom_address(&buf[16], msf, curlun->num_sectors); + return len; + + case 2: + /* Raw TOC */ + len = 4 + 3*11; /* 4 byte header + 3 descriptors */ + memset(buf, 0, len); /* Header + A0, A1 & A2 descriptors */ + buf[1] = len - 2; /* TOC Length excludes length field */ + buf[2] = 1; /* First complete session */ + buf[3] = 1; /* Last complete session */ + + buf += 4; + /* fill in A0, A1 and A2 points */ + for (i = 0; i < 3; i++) { + buf[0] = 1; /* Session number */ + buf[1] = 0x16; /* Data track, copying allowed */ + /* 2 - Track number 0 -> TOC */ + buf[3] = 0xA0 + i; /* A0, A1, A2 point */ + /* 4, 5, 6 - Min, sec, frame is zero */ + buf[8] = 1; /* Pmin: last track number */ + buf += 11; /* go to next track descriptor */ + } + buf -= 11; /* go back to A2 descriptor */ + + /* For A2, 7, 8, 9, 10 - zero, Pmin, Psec, Pframe of Lead out */ + store_cdrom_address(&buf[7], msf, curlun->num_sectors); + return len; + + default: + /* Multi-session, PMA, ATIP, CD-TEXT not supported/required */ + curlun->sense_data = SS_INVALID_FIELD_IN_CDB; + return -EINVAL; + } } static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh) @@ -1933,7 +1979,7 @@ static int do_scsi_command(struct fsg_common *common) common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]); reply = check_command(common, 10, DATA_DIR_TO_HOST, - (7<<6) | (1<<1), 1, + (0xf<<6) | (3<<1), 1, "READ TOC"); if (reply == 0) reply = do_read_toc(common, bh); From 59d057a3f98414038591e5a9c18ba5ccafc1e345 Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Mon, 13 Jun 2022 16:38:19 +0800 Subject: [PATCH 19/55] ANDROID: GKI: Add tracing_is_on interface into symbol list The tracing_is_on interface has been exported, add it to the symbol table so that we can use it in the external module. Leaf changes summary: 1 artifact changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 1 Added function: [A] 'function int tracing_is_on()' Bug: 193384408 Signed-off-by: xieliujie Change-Id: If9f923850ab1db76214240efd8337211972d3a67 --- android/abi_gki_aarch64.xml | 198 +++++++++++++++++++++++----------- android/abi_gki_aarch64_oplus | 1 + 2 files changed, 139 insertions(+), 60 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 6b7544d173c9..3bb015de931b 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -5255,6 +5255,7 @@ + @@ -10276,6 +10277,7 @@ + @@ -18390,6 +18392,7 @@ + @@ -18819,6 +18822,12 @@ + + + + + + @@ -32328,6 +32337,7 @@ + @@ -61783,6 +61793,12 @@ + + + + + + @@ -70624,6 +70640,11 @@ + + + + + @@ -72774,6 +72795,12 @@ + + + + + + @@ -75605,6 +75632,13 @@ + + + + + + + @@ -79061,6 +79095,7 @@ + @@ -87225,7 +87260,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -101577,6 +101643,13 @@ + + + + + + + @@ -105588,6 +105661,7 @@ + @@ -113336,6 +113410,7 @@ + @@ -124344,17 +124419,17 @@ - - - + + + - - - - - - + + + + + + @@ -138555,30 +138630,30 @@ - - + + - - - + + + - - - + + + - - - - - - + + + + + + - - + + @@ -138620,8 +138695,8 @@ - - + + @@ -138649,57 +138724,57 @@ - - + + - - + + - - + + - - - - - - - - - + + + + + + + + + - - - - + + + + - - + + - - - + + + - - - + + + - - - + + + - - + + @@ -142829,6 +142904,9 @@ + + + diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 5f50e47ef58a..5b208407c2a5 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -3103,6 +3103,7 @@ trace_raw_output_prep trace_seq_printf trace_seq_putc + tracing_is_on tracing_off truncate_inode_pages_range truncate_pagecache_range From b92ac325368e1afa927b500b36b4c5cd2a247167 Mon Sep 17 00:00:00 2001 From: Michael Grzeschik Date: Mon, 30 May 2022 00:38:46 +0200 Subject: [PATCH 20/55] FROMGIT: usb: gadget: uvc: calculate the number of request depending on framesize The current limitation of possible number of requests being handled is dependent on the gadget speed. It makes more sense to depend on the typical frame size when calculating the number of requests. This patch is changing this and is using the previous limits as boundaries for reasonable minimum and maximum number of requests. For a 1080p jpeg encoded video stream with a maximum imagesize of e.g. 800kB with a maxburst of 8 and an multiplier of 1 the resulting number of requests is calculated to 49. 800768 1 nreqs = ------ * -------------- ~= 49 2 (1024 * 8 * 1) Tested-by: Dan Vacura Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220529223848.105914-2-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman Bug: 234757296 (cherry picked from commit 87d76b5f1d8eeb49efa16e2018e188864cbb9401 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Change-Id: I0228cbaa56d4e75bed33e1ef721ae3127d779faf Signed-off-by: Dan Vacura --- drivers/usb/gadget/function/uvc_queue.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/uvc_queue.c b/drivers/usb/gadget/function/uvc_queue.c index 51c83eea8318..a76eed073dfe 100644 --- a/drivers/usb/gadget/function/uvc_queue.c +++ b/drivers/usb/gadget/function/uvc_queue.c @@ -43,7 +43,8 @@ static int uvc_queue_setup(struct vb2_queue *vq, { struct uvc_video_queue *queue = vb2_get_drv_priv(vq); struct uvc_video *video = container_of(queue, struct uvc_video, queue); - struct usb_composite_dev *cdev = video->uvc->func.config->cdev; + unsigned int req_size; + unsigned int nreq; if (*nbuffers > UVC_MAX_VIDEO_BUFFERS) *nbuffers = UVC_MAX_VIDEO_BUFFERS; @@ -52,10 +53,16 @@ static int uvc_queue_setup(struct vb2_queue *vq, sizes[0] = video->imagesize; - if (cdev->gadget->speed < USB_SPEED_SUPER) - video->uvc_num_requests = 4; - else - video->uvc_num_requests = 64; + req_size = video->ep->maxpacket + * max_t(unsigned int, video->ep->maxburst, 1) + * (video->ep->mult); + + /* We divide by two, to increase the chance to run + * into fewer requests for smaller framesizes. + */ + nreq = DIV_ROUND_UP(DIV_ROUND_UP(sizes[0], 2), req_size); + nreq = clamp(nreq, 4U, 64U); + video->uvc_num_requests = nreq; return 0; } From 47fa973d9e2e0c48d0bd8decd38aea12289bf4d7 Mon Sep 17 00:00:00 2001 From: Mukesh Ojha Date: Wed, 6 Apr 2022 10:03:40 +0530 Subject: [PATCH 21/55] FROMLIST: devcoredump : Serialize devcd_del work In following scenario(diagram), when one thread X running dev_coredumpm() adds devcd device to the framework which sends uevent notification to userspace and another thread Y reads this uevent and call to devcd_data_write() which eventually try to delete the queued timer that is not initialized/queued yet. So, debug object reports some warning and in the meantime, timer is initialized and queued from X path. and from Y path, it gets reinitialized again and timer->entry.pprev=NULL and try_to_grab_pending() stucks. To fix this, introduce mutex and a boolean flag to serialize the behaviour. cpu0(X) cpu1(Y) dev_coredump() uevent sent to user space device_add() ======================> user space process Y reads the uevents writes to devcd fd which results into writes to devcd_data_write() mod_delayed_work() try_to_grab_pending() del_timer() debug_assert_init() INIT_DELAYED_WORK() schedule_delayed_work() debug_object_fixup() timer_fixup_assert_init() timer_setup() do_init_timer() /* Above call reinitializes the timer to timer->entry.pprev=NULL and this will be checked later in timer_pending() call. */ timer_pending() !hlist_unhashed_lockless(&timer->entry) !h->pprev /* del_timer() checks h->pprev and finds it to be NULL due to which try_to_grab_pending() stucks. */ Bug: 235577024 Change-Id: I5e86abf72e8dff6952ba493fd9f43a26b2b40352 Link: https://lore.kernel.org/lkml/2e1f81e2-428c-f11f-ce92-eb11048cb271@quicinc.com/ Link: https://lore.kernel.org/lkml/1653660220-19197-1-git-send-email-quic_mojha@quicinc.com/ Signed-off-by: Mukesh Ojha --- drivers/base/devcoredump.c | 83 +++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c index 9243468e2c99..ef23c1c33eb2 100644 --- a/drivers/base/devcoredump.c +++ b/drivers/base/devcoredump.c @@ -29,6 +29,47 @@ struct devcd_entry { struct device devcd_dev; void *data; size_t datalen; + /* + * Here, mutex is required to serialize the calls to del_wk work between + * user/kernel space which happens when devcd is added with device_add() + * and that sends uevent to user space. User space reads the uevents, + * and calls to devcd_data_write() which try to modify the work which is + * not even initialized/queued from devcoredump. + * + * + * + * cpu0(X) cpu1(Y) + * + * dev_coredump() uevent sent to user space + * device_add() ======================> user space process Y reads the + * uevents writes to devcd fd + * which results into writes to + * + * devcd_data_write() + * mod_delayed_work() + * try_to_grab_pending() + * del_timer() + * debug_assert_init() + * INIT_DELAYED_WORK() + * schedule_delayed_work() + * + * + * Also, mutex alone would not be enough to avoid scheduling of + * del_wk work after it get flush from a call to devcd_free() + * mentioned as below. + * + * disabled_store() + * devcd_free() + * mutex_lock() devcd_data_write() + * flush_delayed_work() + * mutex_unlock() + * mutex_lock() + * mod_delayed_work() + * mutex_unlock() + * So, delete_work flag is required. + */ + struct mutex mutex; + bool delete_work; struct module *owner; ssize_t (*read)(char *buffer, loff_t offset, size_t count, void *data, size_t datalen); @@ -88,7 +129,12 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, struct device *dev = kobj_to_dev(kobj); struct devcd_entry *devcd = dev_to_devcd(dev); - mod_delayed_work(system_wq, &devcd->del_wk, 0); + mutex_lock(&devcd->mutex); + if (!devcd->delete_work) { + devcd->delete_work = true; + mod_delayed_work(system_wq, &devcd->del_wk, 0); + } + mutex_unlock(&devcd->mutex); return count; } @@ -116,7 +162,12 @@ static int devcd_free(struct device *dev, void *data) { struct devcd_entry *devcd = dev_to_devcd(dev); + mutex_lock(&devcd->mutex); + if (!devcd->delete_work) + devcd->delete_work = true; + flush_delayed_work(&devcd->del_wk); + mutex_unlock(&devcd->mutex); return 0; } @@ -126,6 +177,30 @@ static ssize_t disabled_show(struct class *class, struct class_attribute *attr, return sysfs_emit(buf, "%d\n", devcd_disabled); } +/* + * + * disabled_store() worker() + * class_for_each_device(&devcd_class, + * NULL, NULL, devcd_free) + * ... + * ... + * while ((dev = class_dev_iter_next(&iter)) + * devcd_del() + * device_del() + * put_device() <- last reference + * error = fn(dev, data) devcd_dev_release() + * devcd_free(dev, data) kfree(devcd) + * mutex_lock(&devcd->mutex); + * + * + * In the above diagram, It looks like disabled_store() would be racing with parallely + * running devcd_del() and result in memory abort while acquiring devcd->mutex which + * is called after kfree of devcd memory after dropping its last reference with + * put_device(). However, this will not happens as fn(dev, data) runs + * with its own reference to device via klist_node so it is not its last reference. + * so, above situation would not occur. + */ + static ssize_t disabled_store(struct class *class, struct class_attribute *attr, const char *buf, size_t count) { @@ -282,13 +357,16 @@ void dev_coredumpm(struct device *dev, struct module *owner, devcd->read = read; devcd->free = free; devcd->failing_dev = get_device(dev); + devcd->delete_work = false; + mutex_init(&devcd->mutex); device_initialize(&devcd->devcd_dev); dev_set_name(&devcd->devcd_dev, "devcd%d", atomic_inc_return(&devcd_count)); devcd->devcd_dev.class = &devcd_class; + mutex_lock(&devcd->mutex); if (device_add(&devcd->devcd_dev)) goto put_device; @@ -302,10 +380,11 @@ void dev_coredumpm(struct device *dev, struct module *owner, INIT_DELAYED_WORK(&devcd->del_wk, devcd_del); schedule_delayed_work(&devcd->del_wk, DEVCD_TIMEOUT); - + mutex_unlock(&devcd->mutex); return; put_device: put_device(&devcd->devcd_dev); + mutex_unlock(&devcd->mutex); put_module: module_put(owner); free: From 74769685e442cd58050874342c154f700ed24516 Mon Sep 17 00:00:00 2001 From: Hyeongseok Kim Date: Mon, 15 Mar 2021 13:12:55 +0900 Subject: [PATCH 22/55] BACKPORT: exfat: improve write performance when dirsync enabled Degradation of write speed caused by frequent disk access for cluster bitmap update on every cluster allocation could be improved by selective syncing bitmap buffer. Change to flush bitmap buffer only for the directory related operations. Signed-off-by: Hyeongseok Kim Acked-by: Sungjong Seo Signed-off-by: Namjae Jeon Change-Id: I660931d6da488880337a33dd03b48cb0be0bb26c Signed-off-by: Howard Chen (cherry picked from commit 23befe490ba885bdf757d40b2489134315fef690) Bug: 233712676 --- fs/exfat/balloc.c | 4 ++-- fs/exfat/dir.c | 2 +- fs/exfat/exfat_fs.h | 4 ++-- fs/exfat/fatent.c | 4 ++-- fs/exfat/inode.c | 3 ++- fs/exfat/namei.c | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/exfat/balloc.c b/fs/exfat/balloc.c index 579c10f57c2b..75ab43905f73 100644 --- a/fs/exfat/balloc.c +++ b/fs/exfat/balloc.c @@ -141,7 +141,7 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi) kfree(sbi->vol_amap); } -int exfat_set_bitmap(struct inode *inode, unsigned int clu) +int exfat_set_bitmap(struct inode *inode, unsigned int clu, bool sync) { int i, b; unsigned int ent_idx; @@ -154,7 +154,7 @@ int exfat_set_bitmap(struct inode *inode, unsigned int clu) b = BITMAP_OFFSET_BIT_IN_SECTOR(sb, ent_idx); set_bit_le(b, sbi->vol_amap[i]->b_data); - exfat_update_bh(sbi->vol_amap[i], IS_DIRSYNC(inode)); + exfat_update_bh(sbi->vol_amap[i], sync); return 0; } diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index dedbc55cd48f..09514bf42e76 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -317,7 +317,7 @@ int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu) exfat_chain_set(clu, EXFAT_EOF_CLUSTER, 0, ALLOC_NO_FAT_CHAIN); - ret = exfat_alloc_cluster(inode, 1, clu); + ret = exfat_alloc_cluster(inode, 1, clu, IS_DIRSYNC(inode)); if (ret) return ret; diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index b8f0e829ecbd..c5d370990d39 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -388,7 +388,7 @@ int exfat_clear_volume_dirty(struct super_block *sb); #define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu) int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, - struct exfat_chain *p_chain); + struct exfat_chain *p_chain, bool sync_bmap); int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain); int exfat_ent_get(struct super_block *sb, unsigned int loc, unsigned int *content); @@ -407,7 +407,7 @@ int exfat_count_num_clusters(struct super_block *sb, /* balloc.c */ int exfat_load_bitmap(struct super_block *sb); void exfat_free_bitmap(struct exfat_sb_info *sbi); -int exfat_set_bitmap(struct inode *inode, unsigned int clu); +int exfat_set_bitmap(struct inode *inode, unsigned int clu, bool sync); void exfat_clear_bitmap(struct inode *inode, unsigned int clu); unsigned int exfat_find_free_bitmap(struct super_block *sb, unsigned int clu); int exfat_count_used_clusters(struct super_block *sb, unsigned int *ret_count); diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index c3c9afee7418..6078cbfdfe8a 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -277,7 +277,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned int clu) } int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, - struct exfat_chain *p_chain) + struct exfat_chain *p_chain, bool sync_bmap) { int ret = -ENOSPC; unsigned int num_clusters = 0, total_cnt; @@ -339,7 +339,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, } /* update allocation bitmap */ - if (exfat_set_bitmap(inode, new_clu)) { + if (exfat_set_bitmap(inode, new_clu, sync_bmap)) { ret = -EIO; goto free_cluster; } diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index 2a9f6a80584e..842cdf5e8b9c 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -178,7 +178,8 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset, return -EIO; } - ret = exfat_alloc_cluster(inode, num_to_be_allocated, &new_clu); + ret = exfat_alloc_cluster(inode, num_to_be_allocated, &new_clu, + inode_needs_sync(inode)); if (ret) return ret; diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index 935f60050900..7bafc82d4dc7 100644 --- a/fs/exfat/namei.c +++ b/fs/exfat/namei.c @@ -340,7 +340,7 @@ static int exfat_find_empty_entry(struct inode *inode, exfat_chain_set(&clu, last_clu + 1, 0, p_dir->flags); /* allocate a cluster */ - ret = exfat_alloc_cluster(inode, 1, &clu); + ret = exfat_alloc_cluster(inode, 1, &clu, IS_DIRSYNC(inode)); if (ret) return ret; From d41cf0b55b8520de183aa6f1adf0c1552112a323 Mon Sep 17 00:00:00 2001 From: Dan Vacura Date: Wed, 15 Jun 2022 17:51:14 -0500 Subject: [PATCH 23/55] BACKPORT: FROMLIST: usb: gadget: uvc: fix list double add in uvcg_video_pump A panic can occur if the endpoint becomes disabled and the uvcg_video_pump adds the request back to the req_free list after it has already been queued to the endpoint. The endpoint complete will add the request back to the req_free list. Invalidate the local request handle once it's been queued. <6>[ 246.796704][T13726] configfs-gadget gadget: uvc: uvc_function_set_alt(1, 0) <3>[ 246.797078][ T26] list_add double add: new=ffffff878bee5c40, prev=ffffff878bee5c40, next=ffffff878b0f0a90. <6>[ 246.797213][ T26] ------------[ cut here ]------------ <2>[ 246.797224][ T26] kernel BUG at lib/list_debug.c:31! <6>[ 246.807073][ T26] Call trace: <6>[ 246.807180][ T26] uvcg_video_pump+0x364/0x38c <6>[ 246.807366][ T26] process_one_work+0x2a4/0x544 <6>[ 246.807394][ T26] worker_thread+0x350/0x784 <6>[ 246.807442][ T26] kthread+0x2ac/0x320 Fixes: f9897ec0f6d3 ("usb: gadget: uvc: only pump video data if necessary") Cc: stable@vger.kernel.org Signed-off-by: Dan Vacura Reviewed-by: Laurent Pinchart Bug: 236299719 Link: https://lore.kernel.org/all/20220617163154.16621-1-w36195@motorola.com/ Change-Id: Ie36696d51e0199fc4befca58032842137dece886 Signed-off-by: Dan Vacura --- drivers/usb/gadget/function/uvc_video.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index e5e2c2bae3b9..be555c612b9c 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -302,6 +302,9 @@ static void uvcg_video_pump(struct work_struct *work) uvcg_queue_cancel(queue, 0); break; } + + /* Endpoint now owns the request */ + req = NULL; } if (!req) From 564ba930506ef0035eaecfbae96849512ef7eeb1 Mon Sep 17 00:00:00 2001 From: Prashanth K Date: Fri, 27 May 2022 12:19:06 +0530 Subject: [PATCH 24/55] FROMGIT: usb: common: usb-conn-gpio: Allow wakeup from system suspend Currently the VBUS/ID detection interrupts are disabled during system suspend. So the USB cable connect/disconnect event can't wakeup the system from low power mode. To allow this, we keep these interrupts enabled and configure them as wakeup capable. This behavior can be controlled through device wakeup source policy by the user space. This was tested and verified on a target. (cherry picked from commit 7afe69ad9221a77dc782b81f49cd7f99987740ed https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next) Bug: 234808630 Link: https://lore.kernel.org/r/1653634146-12215-1-git-send-email-quic_prashk@quicinc.com Signed-off-by: Prashanth K Signed-off-by: Greg Kroah-Hartman Change-Id: I8767f91aa78805984856334821072e0c7986eea0 --- drivers/usb/common/usb-conn-gpio.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c index c9545a4eff66..068cd2c20bf7 100644 --- a/drivers/usb/common/usb-conn-gpio.c +++ b/drivers/usb/common/usb-conn-gpio.c @@ -275,6 +275,7 @@ static int usb_conn_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, info); + device_set_wakeup_capable(&pdev->dev, true); /* Perform initial detection */ usb_conn_queue_dwork(info, 0); @@ -304,6 +305,14 @@ static int __maybe_unused usb_conn_suspend(struct device *dev) { struct usb_conn_info *info = dev_get_drvdata(dev); + if (device_may_wakeup(dev)) { + if (info->id_gpiod) + enable_irq_wake(info->id_irq); + if (info->vbus_gpiod) + enable_irq_wake(info->vbus_irq); + return 0; + } + if (info->id_gpiod) disable_irq(info->id_irq); if (info->vbus_gpiod) @@ -318,6 +327,14 @@ static int __maybe_unused usb_conn_resume(struct device *dev) { struct usb_conn_info *info = dev_get_drvdata(dev); + if (device_may_wakeup(dev)) { + if (info->id_gpiod) + disable_irq_wake(info->id_irq); + if (info->vbus_gpiod) + disable_irq_wake(info->vbus_irq); + return 0; + } + pinctrl_pm_select_default_state(dev); if (info->id_gpiod) From 5146690a6c99a2cb1b0594ceb5f6e20b13ca2dd2 Mon Sep 17 00:00:00 2001 From: Yunfei Wang Date: Fri, 17 Jun 2022 16:46:01 +0800 Subject: [PATCH 25/55] ANDROID: dma/debug: fix warning of check_sync check_sync() checks for whether device driver DMA sync sg list entry count equals to map sg list entry count, but in struct dma_buf_ops, there has below interface: int (*begin_cpu_access_partial) int (*end_cpu_access_partial) When vendor implement these interface in dma heap to support dma-buf partial cache sync for performance improvement, in dma_buf_ops of heap, we copy a sgtable from orginal sgtable but with necessary nents, it will less then nents used in map attachment, in the way, the following warning had occurred: DMA-API: device_xxx: device driver syncs DMA sg list with different entry count [map count=5] [sync count=1] Call trace: check_sync+0x6d8/0xb40 debug_dma_sync_sg_for_cpu+0x114/0x16c dma_sync_sg_for_cpu+0xa0/0xe4 So need change check conditation in check_sync to support dma-buf partial cache sync. Bug: 236343688 Signed-off-by: Mingyuan Ma Signed-off-by: Yunfei Wang Change-Id: I2f4db3b156e752eeb022927957f77a3fa534a573 (cherry picked from commit d61fe3ad4bab3f4bc040e7ac0c7ec919b50e8a43) --- kernel/dma/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index f8ae54679865..6bca5077ee71 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -1147,10 +1147,11 @@ static void check_sync(struct device *dev, dir2name[entry->direction], dir2name[ref->direction]); + /* sg list count can be less than map count when partial cache sync */ if (ref->sg_call_ents && ref->type == dma_debug_sg && - ref->sg_call_ents != entry->sg_call_ents) { + ref->sg_call_ents > entry->sg_call_ents) { err_printk(ref->dev, entry, "device driver syncs " - "DMA sg list with different entry count " + "DMA sg list count larger than map count " "[map count=%d] [sync count=%d]\n", entry->sg_call_ents, ref->sg_call_ents); } From 583c0f7c1c9175a829d1c4dd1cc66a062efc0d68 Mon Sep 17 00:00:00 2001 From: Seiya Wang Date: Wed, 20 Apr 2022 17:21:13 +0800 Subject: [PATCH 26/55] ANDROID: Update symbol list for mtk Leaf changes summary: 15 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 14 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable 14 Added functions: [A] 'function void _snd_pcm_hw_params_any(snd_pcm_hw_params*)' [A] 'function int copy_to_user_fromio(void*, const volatile void*, size_t)' [A] 'function void debugfs_create_file_size(const char*, umode_t, dentry*, void*, const file_operations*, loff_t)' [A] 'function int devm_regmap_field_bulk_alloc(device*, regmap*, regmap_field**, reg_field*, int)' [A] 'function void ktime_get_coarse_ts64(timespec64*)' [A] 'function unsigned int linear_range_get_max_value(const linear_range*)' [A] 'function int linear_range_get_value(const linear_range*, unsigned int, unsigned int*)' [A] 'function int platform_irqchip_probe(platform_device*)' [A] 'function int snd_pcm_kernel_ioctl(snd_pcm_substream*, unsigned int, void*)' [A] 'function int snd_pcm_open_substream(snd_pcm*, int, file*, snd_pcm_substream**)' [A] 'function int snd_pcm_stop(snd_pcm_substream*, snd_pcm_state_t)' [A] 'function long int strnlen_user(const char*, long int)' [A] 'function int thermal_zone_unbind_cooling_device(thermal_zone_device*, int, thermal_cooling_device*)' [A] 'function usb_role usb_role_switch_get_role(usb_role_switch*)' 1 Added variable: [A] 'void* high_memory' BUG: 236925084 Signed-off-by: Seiya Wang Change-Id: I8b434e2ca09bc202105e51d746815f7651679673 --- android/abi_gki_aarch64.xml | 97 ++++++ android/abi_gki_aarch64_mtk | 620 ++++++++++++++++++++++++++++++++++++ 2 files changed, 717 insertions(+) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 3bb015de931b..9021a3ecb335 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -723,6 +723,7 @@ + @@ -1162,6 +1163,7 @@ + @@ -1358,6 +1360,7 @@ + @@ -1660,6 +1663,7 @@ + @@ -3233,6 +3237,7 @@ + @@ -3266,6 +3271,8 @@ + + @@ -4067,6 +4074,7 @@ + @@ -4861,6 +4869,7 @@ + @@ -4869,12 +4878,14 @@ + + @@ -5098,6 +5109,7 @@ + @@ -5215,6 +5227,7 @@ + @@ -5620,6 +5633,7 @@ + @@ -6499,6 +6513,7 @@ + @@ -7907,6 +7922,7 @@ + @@ -54376,6 +54392,7 @@ + @@ -90439,6 +90456,7 @@ + @@ -119328,6 +119346,10 @@ + + + + @@ -121727,6 +121749,12 @@ + + + + + + @@ -122712,6 +122740,15 @@ + + + + + + + + + @@ -124342,6 +124379,14 @@ + + + + + + + + @@ -130048,6 +130093,7 @@ + @@ -132572,6 +132618,10 @@ + + + + @@ -132716,6 +132766,16 @@ + + + + + + + + + + @@ -136802,6 +136862,10 @@ + + + + @@ -140856,6 +140920,12 @@ + + + + + + @@ -140905,6 +140975,13 @@ + + + + + + + @@ -140937,6 +141014,11 @@ + + + + + @@ -142106,6 +142188,11 @@ + + + + + @@ -142689,6 +142776,12 @@ + + + + + + @@ -144697,6 +144790,10 @@ + + + + diff --git a/android/abi_gki_aarch64_mtk b/android/abi_gki_aarch64_mtk index 137ee9d40680..807be584e15b 100644 --- a/android/abi_gki_aarch64_mtk +++ b/android/abi_gki_aarch64_mtk @@ -158,6 +158,7 @@ clk_set_parent clk_set_rate clk_unprepare + clockevents_config_and_register clocks_calc_mult_shift __close_fd cma_alloc @@ -180,12 +181,14 @@ config_group_init_type_name console_drivers console_suspend_enabled + console_unlock __const_udelay consume_skb contig_page_data _copy_from_iter copy_from_kernel_nofault _copy_to_iter + copy_to_user_fromio __cpu_active_mask cpu_all_bits cpu_bit_bitmap @@ -195,6 +198,7 @@ cpufreq_disable_fast_switch cpufreq_driver_fast_switch cpufreq_driver_resolve_freq + cpufreq_driver_target __cpufreq_driver_target cpufreq_enable_fast_switch cpufreq_frequency_table_get_index @@ -205,12 +209,14 @@ cpufreq_quick_get cpufreq_register_driver cpufreq_register_governor + cpufreq_register_notifier cpufreq_remove_update_util_hook cpufreq_table_index_unsorted cpufreq_this_cpu_can_update cpufreq_unregister_driver cpufreq_unregister_governor cpufreq_update_limits + cpufreq_update_policy cpufreq_update_util_data cpu_hotplug_disable cpu_hotplug_enable @@ -283,6 +289,7 @@ debugfs_create_devm_seqfile debugfs_create_dir debugfs_create_file + debugfs_create_file_size debugfs_create_regset32 debugfs_create_symlink debugfs_create_u16 @@ -349,6 +356,7 @@ device_init_wakeup device_link_add device_link_remove + device_node_to_regmap device_property_present device_property_read_string device_property_read_u32_array @@ -416,6 +424,7 @@ devm_phy_get devm_pinctrl_get devm_pinctrl_put + devm_pinctrl_register devm_pinctrl_register_and_init devm_platform_get_and_ioremap_resource devm_platform_ioremap_resource @@ -426,6 +435,7 @@ devm_rc_register_device devm_regmap_add_irq_chip devm_regmap_field_alloc + devm_regmap_field_bulk_alloc __devm_regmap_init __devm_regmap_init_i2c __devm_regmap_init_mmio_clk @@ -447,27 +457,37 @@ devm_usb_get_phy devm_watchdog_register_device _dev_notice + dev_pm_domain_attach dev_pm_domain_attach_by_id dev_pm_domain_attach_by_name dev_pm_domain_detach dev_pm_genpd_add_notifier dev_pm_genpd_set_performance_state dev_pm_opp_add + dev_pm_opp_adjust_voltage + dev_pm_opp_disable + dev_pm_opp_enable dev_pm_opp_find_freq_ceil dev_pm_opp_find_freq_ceil_by_volt dev_pm_opp_find_freq_exact dev_pm_opp_find_freq_floor + dev_pm_opp_free_cpufreq_table dev_pm_opp_get_freq dev_pm_opp_get_level dev_pm_opp_get_opp_count dev_pm_opp_get_opp_table dev_pm_opp_get_voltage + dev_pm_opp_init_cpufreq_table dev_pm_opp_of_add_table dev_pm_opp_of_add_table_indexed + dev_pm_opp_of_cpumask_add_table + dev_pm_opp_of_cpumask_remove_table + dev_pm_opp_of_get_sharing_cpus dev_pm_opp_of_remove_table dev_pm_opp_put dev_pm_opp_put_opp_table dev_pm_opp_put_regulators + dev_pm_opp_register_notifier dev_pm_opp_remove_all_dynamic dev_pm_opp_set_regulators dev_pm_qos_update_request @@ -606,6 +626,7 @@ drm_connector_attach_encoder drm_connector_cleanup drm_connector_init + drm_connector_set_panel_orientation drm_connector_update_edid_property drm_crtc_cleanup drm_crtc_handle_vblank @@ -832,10 +853,12 @@ gov_attr_set_put governor_sysfs_ops gpiochip_add_data_with_key + gpiochip_add_pin_range gpiochip_generic_free gpiochip_generic_request gpiochip_get_data gpiochip_lock_as_irq + gpiochip_remove gpiochip_unlock_as_irq gpiod_direction_input gpiod_direction_output @@ -860,6 +883,7 @@ have_governor_per_policy hex_asc hex_to_bin + high_memory hrtimer_active hrtimer_cancel hrtimer_forward @@ -965,15 +989,25 @@ iounmap iput ipv6_skip_exthdr + irq_chip_eoi_parent + irq_chip_mask_parent + irq_chip_retrigger_hierarchy + irq_chip_set_affinity_parent + irq_chip_unmask_parent irq_create_mapping_affinity irq_create_of_mapping irq_dispose_mapping __irq_domain_add + irq_domain_alloc_irqs_parent + irq_domain_create_hierarchy + irq_domain_free_irqs_common irq_domain_remove + irq_domain_set_hwirq_and_chip irq_domain_simple_ops irq_domain_xlate_onetwocell irq_domain_xlate_twocell irq_find_mapping + irq_find_matching_fwspec irq_get_irqchip_state irq_get_irq_data irq_modify_status @@ -1085,6 +1119,7 @@ kthread_stop kthread_worker_fn ktime_get + ktime_get_coarse_ts64 ktime_get_coarse_with_offset ktime_get_mono_fast_ns ktime_get_raw @@ -1107,6 +1142,8 @@ led_trigger_remove led_update_brightness led_update_flash_brightness + linear_range_get_max_value + linear_range_get_value __list_add_valid __list_del_entry_valid list_sort @@ -1160,6 +1197,7 @@ __memcpy_fromio __memcpy_toio memdup_user + memdup_user_nul memmove memory_read_from_buffer memparse @@ -1177,7 +1215,9 @@ mii_link_ok mii_nway_restart mipi_dsi_attach + mipi_dsi_dcs_enter_sleep_mode mipi_dsi_dcs_read + mipi_dsi_dcs_set_display_off mipi_dsi_dcs_write mipi_dsi_dcs_write_buffer mipi_dsi_detach @@ -1235,6 +1275,7 @@ napi_gro_receive __napi_schedule napi_schedule_prep + __ndelay nd_tbl neigh_destroy neigh_lookup @@ -1274,6 +1315,7 @@ __nlmsg_put no_llseek nonseekable_open + noop_llseek nr_cpu_ids nsecs_to_jiffies ns_to_timespec64 @@ -1308,6 +1350,7 @@ of_dma_xlate_by_chan_id of_drm_find_bridge of_drm_find_panel + of_drm_get_panel_orientation of_find_backlight_by_node of_find_compatible_node of_find_device_by_node @@ -1398,6 +1441,7 @@ param_set_uint param_set_ulong pause_cpus + pci_bus_type PDE_DATA __per_cpu_offset perf_event_create_kernel_counter @@ -1439,6 +1483,7 @@ pinctrl_pm_select_sleep_state pinctrl_put pinctrl_select_state + pinctrl_unregister pinctrl_utils_add_map_configs pinctrl_utils_free_map pinctrl_utils_reserve_map @@ -1464,6 +1509,7 @@ platform_get_irq_optional platform_get_resource platform_get_resource_byname + platform_irqchip_probe __platform_register_drivers platform_unregister_drivers pm_genpd_add_device @@ -1551,6 +1597,7 @@ _raw_spin_lock_irq _raw_spin_lock_irqsave _raw_spin_trylock + _raw_spin_trylock_bh _raw_spin_unlock _raw_spin_unlock_bh _raw_spin_unlock_irq @@ -1609,6 +1656,7 @@ regmap_field_update_bits_base __regmap_init regmap_irq_get_domain + regmap_multi_reg_write regmap_raw_read regmap_raw_write regmap_read @@ -1654,8 +1702,10 @@ remove_proc_entry remove_proc_subtree remove_wait_queue + report_iommu_fault request_firmware request_firmware_nowait + __request_module __request_percpu_irq __request_region request_threaded_irq @@ -1679,6 +1729,7 @@ __rht_bucket_nested rht_bucket_nested rht_bucket_nested_insert + root_task_group round_jiffies round_jiffies_relative round_jiffies_up @@ -1726,6 +1777,8 @@ sched_uclamp_used schedule schedule_timeout + schedule_timeout_interruptible + schedutil_cpu_util scmi_driver_register scmi_driver_unregister scmi_protocol_register @@ -1763,6 +1816,7 @@ sdio_writel sdio_writesb send_sig + send_sig_info seq_hex_dump seq_lseek seq_open @@ -1842,6 +1896,8 @@ smp_call_function_single snd_card_add_dev_attr snd_ctl_boolean_mono_info + snd_dma_alloc_pages + snd_dma_free_pages snd_jack_set_key snd_pcm_format_physical_width snd_pcm_format_width @@ -1850,12 +1906,17 @@ snd_pcm_hw_constraint_mask64 snd_pcm_hw_constraint_minmax snd_pcm_hw_constraint_step + _snd_pcm_hw_params_any + snd_pcm_kernel_ioctl snd_pcm_lib_free_pages snd_pcm_lib_malloc_pages snd_pcm_lib_preallocate_free_for_all snd_pcm_lib_preallocate_pages_for_all + snd_pcm_open_substream snd_pcm_period_elapsed + snd_pcm_release_substream snd_pcm_set_ops + snd_pcm_stop snd_soc_add_component_controls snd_soc_bytes_info_ext snd_soc_bytes_tlv_callback @@ -1866,6 +1927,7 @@ snd_soc_component_set_jack snd_soc_component_update_bits snd_soc_component_write + snd_soc_dai_active snd_soc_dai_set_sysclk snd_soc_dapm_add_routes snd_soc_dapm_disable_pin @@ -1873,20 +1935,25 @@ snd_soc_dapm_get_enum_double snd_soc_dapm_get_pin_switch snd_soc_dapm_get_volsw + snd_soc_dapm_ignore_suspend snd_soc_dapm_info_pin_switch + snd_soc_dapm_kcontrol_dapm snd_soc_dapm_new_controls snd_soc_dapm_new_widgets snd_soc_dapm_put_enum_double snd_soc_dapm_put_pin_switch snd_soc_dapm_put_volsw snd_soc_dapm_sync + snd_soc_dpcm_get_substream snd_soc_find_dai + snd_soc_get_pcm_runtime snd_soc_get_volsw snd_soc_info_enum_double snd_soc_info_volsw snd_soc_jack_report snd_soc_new_compress snd_soc_of_get_dai_link_codecs + snd_soc_pm_ops snd_soc_poweroff snd_soc_put_volsw snd_soc_register_component @@ -1951,6 +2018,7 @@ strncpy strncpy_from_user strnlen + strnlen_user strnstr strrchr strreplace @@ -2000,18 +2068,26 @@ tasklet_kill __tasklet_schedule tasklet_setup + tasklist_lock task_may_not_preempt __task_pid_nr_ns __task_rq_lock task_sched_runtime + thermal_cooling_device_register thermal_cooling_device_unregister thermal_of_cooling_device_register + thermal_zone_bind_cooling_device + thermal_zone_device_enable + thermal_zone_device_register + thermal_zone_device_unregister thermal_zone_device_update thermal_zone_get_temp thermal_zone_get_zone_by_name + thermal_zone_unbind_cooling_device tick_nohz_get_idle_calls_cpu timecounter_init timecounter_read + timer_of_init timer_unstable_counter_workaround topology_set_thermal_pressure _totalram_pages @@ -2042,6 +2118,7 @@ __traceiter_android_rvh_setscheduler __traceiter_android_rvh_set_user_nice __traceiter_android_rvh_tick_entry + __traceiter_android_rvh_uclamp_eff_get __traceiter_android_rvh_update_cpu_capacity __traceiter_android_rvh_v4l2subdev_set_fmt __traceiter_android_rvh_v4l2subdev_set_frame_interval @@ -2125,6 +2202,7 @@ __tracepoint_android_rvh_setscheduler __tracepoint_android_rvh_set_user_nice __tracepoint_android_rvh_tick_entry + __tracepoint_android_rvh_uclamp_eff_get __tracepoint_android_rvh_update_cpu_capacity __tracepoint_android_rvh_v4l2subdev_set_fmt __tracepoint_android_rvh_v4l2subdev_set_frame_interval @@ -2193,6 +2271,7 @@ __tracepoint_xhci_urb_giveback trace_print_array_seq trace_print_flags_seq + trace_print_hex_seq trace_print_symbols_seq __trace_puts trace_raw_output_prep @@ -2281,6 +2360,7 @@ unregister_reboot_notifier unregister_rpmsg_driver unregister_shrinker + unregister_syscore_ops unregister_sysctl_table unregister_virtio_device unregister_virtio_driver @@ -2377,6 +2457,7 @@ usb_remove_phy usb_role_switch_get usb_role_switch_get_drvdata + usb_role_switch_get_role usb_role_switch_register usb_role_switch_set_role usb_role_switch_unregister @@ -2580,70 +2661,609 @@ zlib_deflate_workspacesize # preserved by --additions-only + alloc_etherdev_mqs + alloc_pages_exact + all_vm_events + arp_tbl + async_schedule_node + atomic_notifier_call_chain + autoremove_wake_function + __bitmap_andnot + __bitmap_equal + bitmap_find_free_region + bitmap_free + __bitmap_or + bitmap_release_region + bitmap_to_arr32 + bitmap_zalloc blk_insert_cloned_request + bpf_trace_run12 class_create_file_ns + class_for_each_device class_remove_file_ns + clk_bulk_put_all + cma_alloc + cma_release + complete_all + completion_done + config_ep_by_speed + config_group_init_type_name console_unlock + _copy_from_iter + _copy_to_iter + cpu_all_bits + cpufreq_add_update_util_hook + cpufreq_disable_fast_switch + cpufreq_driver_fast_switch + cpufreq_driver_resolve_freq + __cpufreq_driver_target + cpufreq_enable_fast_switch + cpufreq_frequency_table_get_index + cpufreq_policy_transition_delay_us + cpufreq_register_governor + cpufreq_remove_update_util_hook + cpufreq_this_cpu_can_update + cpufreq_unregister_governor + cpufreq_update_limits + cpufreq_update_util_data + cpu_pm_register_notifier + cpu_pm_unregister_notifier + dapm_clock_event + dapm_regulator_event + debugfs_create_blob + debugfs_create_devm_seqfile + debugfs_create_symlink + debugfs_create_u16 + debugfs_create_u8 + debugfs_create_x32 debug_locks_off + desc_to_gpio + dev_base_lock dev_change_flags + devfreq_get_devfreq_by_phandle + dev_get_by_name + dev_get_stats + device_create_bin_file + device_for_each_child + device_property_read_string + device_remove_bin_file + device_set_of_node_from_dev + device_set_wakeup_capable + device_show_bool + device_store_bool + __devm_alloc_percpu + devm_clk_bulk_get_optional + devm_devfreq_add_device + devm_devfreq_register_notifier + devm_devfreq_remove_device + devm_devfreq_unregister_notifier + devm_gpiod_get_index + devm_gpio_free + devm_ioremap_wc + devm_iounmap + devm_memremap + devm_nvmem_cell_get devm_of_pwm_get + devm_pinctrl_register_and_init + devm_rc_allocate_device + devm_rc_register_device + devm_regmap_add_irq_chip + devm_usb_get_phy + dev_pm_domain_attach_by_id + dev_pm_domain_attach_by_name + dev_pm_opp_add + dev_pm_opp_find_freq_ceil_by_volt + dev_pm_opp_get_opp_table + dev_pm_opp_of_add_table_indexed + dev_pm_opp_put_opp_table + dev_pm_opp_remove_all_dynamic + dev_pm_qos_update_request + dev_set_mac_address + disable_percpu_irq + dma_fence_array_ops + dma_fence_enable_sw_signaling + dma_heap_buffer_free + dma_map_resource + dma_unmap_resource + do_wait_intr_irq + drain_workqueue drm_gem_private_object_init + drm_get_format_name + drm_mode_equal + enable_percpu_irq + eth_header + eth_header_cache + eth_header_cache_update + eth_header_parse + frame_vector_create + frame_vector_destroy + frame_vector_to_pages + frame_vector_to_pfns + free_pages_exact + free_percpu_irq + fwnode_device_is_available + fwnode_get_name + fwnode_graph_get_next_endpoint + fwnode_graph_get_port_parent + fwnode_graph_get_remote_endpoint + fwnode_graph_get_remote_port_parent + fwnode_graph_parse_endpoint + fwnode_property_get_reference_args + fwnode_property_read_u64_array + gen_pool_dma_alloc_align + gen_pool_has_addr + getboottime64 + get_governor_parent_kobj + get_task_exe_file + get_vaddr_frames + get_zeroed_page + gov_attr_set_get + gov_attr_set_init + gov_attr_set_put + governor_sysfs_ops + gpiod_direction_output + gpiod_get_optional + gpiod_get_value + gpiod_set_raw_value_cansleep + gpio_request hashlen_string + have_governor_per_policy hci_alloc_dev hci_free_dev hci_recv_frame hci_register_dev hci_unregister_dev hex_dump_to_buffer + hex_to_bin + i2c_get_adapter + ida_alloc_range + ida_destroy + ida_free + idr_preload + idr_replace + iio_channel_release + iio_get_channel_type + input_free_device + input_mt_init_slots + input_mt_report_slot_state + iommu_map + iommu_map_sg + iommu_unmap + ioremap_cache + ipv6_skip_exthdr + irq_work_queue + irq_work_run + irq_work_sync + jiffies_64_to_clock_t + kill_pid + kobject_init_and_add kset_find_obj + ksize + kstrtoint_from_user + kstrtol_from_user + kthread_bind_mask + kthread_cancel_delayed_work_sync + kthread_cancel_work_sync + kthread_create_worker + kthread_delayed_work_timer_fn + kthread_destroy_worker + kthread_flush_work + kthread_flush_worker + kthread_freezable_should_stop + __kthread_init_worker + kthread_queue_delayed_work + kthread_queue_work + kthread_worker_fn + led_classdev_flash_register_ext + led_classdev_flash_unregister led_classdev_unregister + loops_per_jiffy match_hex match_int + match_string match_token + media_create_intf_link + media_create_pad_link + media_device_cleanup + media_devnode_create + media_devnode_remove + media_entity_remote_pad + media_entity_remove_links + __media_entity_setup_link + media_graph_walk_next + media_graph_walk_start + media_pipeline_start + media_pipeline_stop + media_request_get_by_fd + media_request_object_complete + media_request_put + memblock_end_of_DRAM + memory_read_from_buffer + memunmap + migrate_swap + mipi_dsi_generic_read + mipi_dsi_generic_write + mmc_cmdq_disable + mmc_cmdq_enable + mmc_get_card + mmc_hw_reset + mmc_put_card + mmc_set_data_timeout + mmc_switch + mmc_wait_for_req + napi_disable + napi_gro_flush + __napi_schedule + napi_schedule_prep + nd_tbl + neigh_destroy + neigh_lookup + netdev_alloc_frag + netif_napi_add + net_namespace_list + nf_register_net_hooks + nf_unregister_net_hooks nla_put_nohdr + of_find_i2c_device_by_node + of_get_parent + of_irq_to_resource_table + of_property_read_u64_index + of_reserved_mem_device_init_by_idx + of_root + of_thermal_get_trip_points + of_translate_address + param_get_bool + param_ops_long + param_ops_string + param_set_bool + param_set_int + pause_cpus + perf_num_counters + pinctrl_enable + pinctrl_put + pin_user_pages pin_user_pages_remote + platform_device_add_data + platform_device_add_resources + platform_device_del + __platform_driver_probe + platform_find_device_by_driver + pm_wq + power_supply_is_system_supplied + power_supply_unreg_notifier + prepare_to_wait + printk_deferred + proc_create_seq_private + proc_create_single_data + proc_dointvec_minmax + put_vaddr_frames + register_netdev + register_pernet_subsys + register_sysctl_table + register_virtio_device + register_virtio_driver + regmap_irq_get_domain + regulator_get_mode + regulator_set_load + regulator_set_voltage_time + regulator_sync_voltage + release_pages + __request_percpu_irq + resume_cpus root_task_group + rpmsg_send + rproc_put + rps_needed + sched_feat_names + sched_set_fifo + sched_setscheduler_nocheck schedutil_cpu_util + scsi_autopm_get_device + scsi_autopm_put_device + scsi_print_sense_hdr send_sig_info + seq_hex_dump + seq_vprintf + sg_copy_from_buffer + sg_copy_to_buffer + sg_miter_next + sg_miter_start + sg_miter_stop + shmem_file_setup + si_mem_available + si_meminfo + simple_strtol skb_pull_rcsum + skb_realloc_headroom + snd_card_add_dev_attr + snd_pcm_format_physical_width + snd_pcm_hw_constraint_list + snd_pcm_hw_constraint_mask64 + snd_soc_component_exit_regmap + snd_soc_component_read + snd_soc_component_set_jack snd_soc_component_test_bits + snd_soc_component_update_bits + snd_soc_component_write + snd_soc_dai_set_sysclk + snd_soc_dapm_disable_pin + snd_soc_dapm_enable_pin + snd_soc_dapm_get_pin_switch + snd_soc_dapm_info_pin_switch + snd_soc_dapm_put_pin_switch + snd_soc_dapm_sync + snd_soc_find_dai + snd_soc_new_compress + snd_soc_of_get_dai_link_codecs + snd_soc_poweroff + snd_soc_resume + spi_bus_type + __spi_register_driver + spi_setup + spi_sync + split_page + sprint_symbol + sprint_symbol_no_offset + static_key_disable_cpuslocked + static_key_enable_cpuslocked + strcasecmp + strlcat strpbrk + strrchr + strreplace strspn + synchronize_srcu syscore_resume syscore_suspend + sysctl_sched_features + sysfs_create_bin_file + sysfs_merge_group + sysfs_notify + sysfs_remove_bin_file + system_highpri_wq + system_long_wq + __tasklet_hi_schedule tasklist_lock + task_may_not_preempt + __task_rq_lock + thermal_zone_device_update + tick_nohz_get_idle_calls_cpu + __trace_bputs + __traceiter_android_rvh_dequeue_task_fair + __traceiter_android_rvh_enqueue_task_fair + __traceiter_android_rvh_finish_prio_fork + __traceiter_android_rvh_media_device_setup_link + __traceiter_android_rvh_new_task_stats + __traceiter_android_rvh_prepare_prio_fork + __traceiter_android_rvh_rtmutex_prepare_setprio __traceiter_android_rvh_sched_rebalance_domains + __traceiter_android_rvh_select_task_rq_fair + __traceiter_android_rvh_select_task_rq_rt + __traceiter_android_rvh_setscheduler + __traceiter_android_rvh_set_user_nice __traceiter_android_rvh_uclamp_eff_get + __traceiter_android_rvh_v4l2subdev_set_fmt + __traceiter_android_rvh_v4l2subdev_set_frame_interval + __traceiter_android_rvh_v4l2subdev_set_selection + __traceiter_android_vh_alter_futex_plist_add + __traceiter_android_vh_alter_rwsem_list_add + __traceiter_android_vh_arch_set_freq_scale + __traceiter_android_vh_binder_restore_priority + __traceiter_android_vh_binder_set_priority + __traceiter_android_vh_binder_transaction_init + __traceiter_android_vh_cgroup_set_task + __traceiter_android_vh_clear_mask_adjust + __traceiter_android_vh_clear_reserved_fmt_fields __traceiter_android_vh_em_cpu_energy + __traceiter_android_vh_fill_ext_fmtdesc + __traceiter_android_vh_finish_update_load_avg_se + __traceiter_android_vh_freq_qos_add_request __traceiter_android_vh_freq_qos_remove_request + __traceiter_android_vh_freq_qos_update_request __traceiter_android_vh_iommu_alloc_iova __traceiter_android_vh_iommu_free_iova + __traceiter_android_vh_iommu_iovad_alloc_iova + __traceiter_android_vh_iommu_iovad_free_iova + __traceiter_android_vh_ipv6_gen_linklocal_addr __traceiter_android_vh_media_device_setup_link + __traceiter_android_vh_prepare_update_load_avg_se + __traceiter_android_vh_rwsem_init + __traceiter_android_vh_rwsem_wake + __traceiter_android_vh_rwsem_write_finished __traceiter_android_vh_scmi_timeout_sync + __traceiter_android_vh_show_resume_epoch_val + __traceiter_android_vh_show_suspend_epoch_val + __traceiter_android_vh_snd_compr_use_pause_in_drain __traceiter_android_vh_snd_soc_card_get_comp_chain + __traceiter_android_vh_sound_usb_support_cpu_suspend + __traceiter_android_vh_syscall_prctl_finished __traceiter_android_vh_v4l2subdev_set_fmt __traceiter_android_vh_v4l2subdev_set_frame_interval __traceiter_android_vh_v4l2subdev_set_selection + __traceiter_cpu_frequency + __traceiter_sched_update_nr_running_tp + __tracepoint_android_rvh_dequeue_task_fair + __tracepoint_android_rvh_enqueue_task_fair + __tracepoint_android_rvh_finish_prio_fork + __tracepoint_android_rvh_media_device_setup_link + __tracepoint_android_rvh_new_task_stats + __tracepoint_android_rvh_prepare_prio_fork + __tracepoint_android_rvh_rtmutex_prepare_setprio __tracepoint_android_rvh_sched_rebalance_domains + __tracepoint_android_rvh_select_task_rq_fair + __tracepoint_android_rvh_select_task_rq_rt + __tracepoint_android_rvh_setscheduler + __tracepoint_android_rvh_set_user_nice + __tracepoint_android_rvh_v4l2subdev_set_fmt + __tracepoint_android_rvh_v4l2subdev_set_frame_interval + __tracepoint_android_rvh_v4l2subdev_set_selection __tracepoint_android_rvh_uclamp_eff_get + __tracepoint_android_vh_alter_futex_plist_add + __tracepoint_android_vh_alter_rwsem_list_add + __tracepoint_android_vh_arch_set_freq_scale + __tracepoint_android_vh_binder_restore_priority + __tracepoint_android_vh_binder_set_priority + __tracepoint_android_vh_binder_transaction_init + __tracepoint_android_vh_cgroup_set_task + __tracepoint_android_vh_clear_mask_adjust + __tracepoint_android_vh_clear_reserved_fmt_fields __tracepoint_android_vh_em_cpu_energy + __tracepoint_android_vh_fill_ext_fmtdesc + __tracepoint_android_vh_finish_update_load_avg_se + __tracepoint_android_vh_freq_qos_add_request __tracepoint_android_vh_freq_qos_remove_request + __tracepoint_android_vh_freq_qos_update_request __tracepoint_android_vh_iommu_alloc_iova __tracepoint_android_vh_iommu_free_iova + __tracepoint_android_vh_iommu_iovad_alloc_iova + __tracepoint_android_vh_iommu_iovad_free_iova + __tracepoint_android_vh_ipv6_gen_linklocal_addr __tracepoint_android_vh_media_device_setup_link + __tracepoint_android_vh_prepare_update_load_avg_se + __tracepoint_android_vh_rwsem_init + __tracepoint_android_vh_rwsem_wake + __tracepoint_android_vh_rwsem_write_finished __tracepoint_android_vh_scmi_timeout_sync + __tracepoint_android_vh_show_resume_epoch_val + __tracepoint_android_vh_show_suspend_epoch_val + __tracepoint_android_vh_snd_compr_use_pause_in_drain __tracepoint_android_vh_snd_soc_card_get_comp_chain + __tracepoint_android_vh_sound_usb_support_cpu_suspend + __tracepoint_android_vh_syscall_prctl_finished __tracepoint_android_vh_ufs_update_sdev __tracepoint_android_vh_v4l2subdev_set_fmt __tracepoint_android_vh_v4l2subdev_set_frame_interval __tracepoint_android_vh_v4l2subdev_set_selection + __tracepoint_cpu_frequency + __tracepoint_sched_update_nr_running_tp + tracepoint_srcu trace_print_hex_seq + trace_set_clr_event + tracing_off typec_get_drvdata + typec_mux_get_drvdata + typec_mux_register + typec_mux_set + typec_mux_unregister + typec_partner_set_identity + typec_register_partner + typec_register_port + typec_set_data_role + typec_set_orientation + typec_set_pwr_opmode + typec_set_pwr_role + typec_set_vconn_role + typec_switch_get_drvdata + typec_switch_register + typec_switch_unregister + typec_unregister_partner + typec_unregister_port ufshcd_auto_hibern8_update + ufshcd_read_desc_param ufshcd_shutdown + unpin_user_page + unregister_netdev + unregister_pernet_subsys unregister_syscore_ops + unregister_sysctl_table + unregister_virtio_device + unregister_virtio_driver + update_devfreq + usb_add_phy_dev + usb_assign_descriptors + usb_copy_descriptors + usb_ep_alloc_request + usb_ep_autoconfig + usb_ep_disable + usb_ep_enable + usb_ep_free_request + usb_ep_queue + usb_free_all_descriptors + usb_function_register + usb_function_unregister + usb_gstrings_attach + usb_hcd_check_unlink_urb + usb_hcd_giveback_urb + usb_hcd_link_urb_to_ep + usb_hcd_resume_root_hub + usb_hcd_unlink_urb_from_ep + usb_hcd_unmap_urb_for_dma + usb_interface_id + usb_os_desc_prepare_interf_dir + usb_otg_state_string + usb_phy_set_charger_current + usb_remove_phy + v4l2_async_notifier_add_subdev + v4l2_async_notifier_cleanup + v4l2_async_subdev_notifier_register + v4l2_compat_ioctl32 + v4l2_ctrl_find + v4l2_ctrl_g_ctrl + v4l2_ctrl_g_ctrl_int64 + __v4l2_ctrl_modify_range + v4l2_ctrl_new_std_menu_items + v4l2_ctrl_request_complete + v4l2_ctrl_request_setup + __v4l2_ctrl_s_ctrl_compound + v4l2_ctrl_subdev_subscribe_event + v4l2_device_register_subdev + v4l2_event_queue + v4l2_event_subdev_unsubscribe + v4l2_fh_open + __v4l2_find_nearest_size + v4l2_format_info + v4l2_m2m_buf_copy_metadata v4l2_m2m_buf_remove_by_buf + v4l2_m2m_register_media_controller + v4l2_m2m_request_queue + v4l2_m2m_unregister_media_controller + v4l2_pipeline_link_notify + v4l2_subdev_call_wrappers + v4l2_subdev_link_validate + v4l2_subdev_link_validate_default + vb2_common_vm_ops + vb2_create_framevec + vb2_destroy_framevec + vb2_fop_mmap + vb2_fop_poll + vb2_fop_release + vb2_ioctl_create_bufs + vb2_ioctl_dqbuf + vb2_ioctl_expbuf + vb2_ioctl_prepare_buf + vb2_ioctl_qbuf + vb2_ioctl_querybuf + vb2_ioctl_reqbufs + vb2_ioctl_streamoff + vb2_ioctl_streamon + vb2_request_object_is_buffer + vb2_request_queue + vb2_request_validate + video_device_release_empty + virtqueue_add_inbuf + virtqueue_add_outbuf + virtqueue_detach_unused_buf + virtqueue_get_buf + virtqueue_get_vring_size virtqueue_kick + virtqueue_kick_prepare + virtqueue_notify + vmalloc_to_page + vmf_insert_mixed + vm_get_page_prot + vm_insert_page + vm_map_ram + vm_unmap_ram + vprintk + vring_del_virtqueue + vring_interrupt + vring_new_virtqueue + vsscanf + wait_for_completion_killable + wait_for_completion_killable_timeout + wakeup_source_destroy + wakeup_source_remove wireless_send_event + work_busy ww_mutex_lock ww_mutex_lock_interruptible From 1590a0e8e12357d5d1a8007c977c0f498b4c7baf Mon Sep 17 00:00:00 2001 From: Giuliano Procida Date: Wed, 15 Jun 2022 15:33:31 +0100 Subject: [PATCH 27/55] ANDROID: GKI: include more type definitions in vendor hooks The following types are now fully defined in ABI XML. * `struct binder_transaction_data` * `struct blk_mq_alloc_data` * `struct media_link_desc` * `struct packet_type` * `struct printk_record` * `struct printk_ringbuffer` Bug: 233047575 Change-Id: Ib7a096c937cfa9facca89b8a26edd2f4b00416a1 Signed-off-by: Giuliano Procida --- android/abi_gki_aarch64.xml | 3875 ++++++++++++++------------- include/trace/hooks/binder.h | 21 +- include/trace/hooks/block.h | 11 +- include/trace/hooks/cgroup.h | 13 +- include/trace/hooks/cpuidle.h | 5 + include/trace/hooks/cpuidle_psci.h | 5 + include/trace/hooks/creds.h | 7 + include/trace/hooks/debug.h | 5 + include/trace/hooks/dtask.h | 17 +- include/trace/hooks/fault.h | 5 + include/trace/hooks/fips140.h | 5 + include/trace/hooks/fpsimd.h | 5 + include/trace/hooks/gic_v3.h | 9 +- include/trace/hooks/iommu.h | 7 +- include/trace/hooks/logbuf.h | 7 +- include/trace/hooks/mm.h | 23 +- include/trace/hooks/mmc_core.h | 13 +- include/trace/hooks/module.h | 5 + include/trace/hooks/net.h | 11 +- include/trace/hooks/pm_domain.h | 5 + include/trace/hooks/power.h | 13 +- include/trace/hooks/psi.h | 7 +- include/trace/hooks/remoteproc.h | 5 + include/trace/hooks/rwsem.h | 5 + include/trace/hooks/sched.h | 28 +- include/trace/hooks/shmem_fs.h | 5 + include/trace/hooks/signal.h | 5 + include/trace/hooks/softlockup.h | 5 + include/trace/hooks/sys.h | 5 + include/trace/hooks/syscall_check.h | 7 + include/trace/hooks/thermal.h | 7 +- include/trace/hooks/traps.h | 5 + include/trace/hooks/typec.h | 7 +- include/trace/hooks/ufshcd.h | 15 +- include/trace/hooks/v4l2core.h | 21 +- include/trace/hooks/v4l2mc.h | 7 + 36 files changed, 2348 insertions(+), 1853 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 9021a3ecb335..251da9a8b3dc 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -6927,7 +6927,7 @@ - + @@ -8273,7 +8273,7 @@ - + @@ -8370,6 +8370,7 @@ + @@ -9686,21 +9687,21 @@ - + - + - + - + - + - + @@ -11751,42 +11752,42 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -14705,18 +14706,18 @@ - + - + - + - + - + @@ -14785,7 +14786,47 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -16006,18 +16047,18 @@ - + - + - + - + - + @@ -17293,6 +17334,7 @@ + @@ -19351,51 +19393,51 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -19416,39 +19458,39 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -22228,6 +22270,7 @@ + @@ -27274,36 +27317,36 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -28436,6 +28479,13 @@ + + + + + + + @@ -31081,27 +31131,27 @@ - + - + - + - + - + - + - + - + @@ -32586,7 +32636,20 @@ - + + + + + + + + + + + + + + @@ -33530,7 +33593,7 @@ - + @@ -38207,24 +38270,24 @@ - + - + - + - + - + - + - + @@ -39330,18 +39393,18 @@ - + - + - + - + - + @@ -40411,24 +40474,24 @@ - + - + - + - + - + - + - + @@ -40827,6 +40890,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -48256,7 +48345,17 @@ - + + + + + + + + + + + @@ -48273,6 +48372,14 @@ + + + + + + + + @@ -50293,18 +50400,18 @@ - + - + - + - + - + @@ -50707,12 +50814,12 @@ - + - + - + @@ -52853,6 +52960,14 @@ + + + + + + + + @@ -56451,18 +56566,18 @@ - + - + - + - + - + @@ -58026,7 +58141,7 @@ - + @@ -60416,12 +60531,12 @@ - + - + - + @@ -62589,7 +62704,7 @@ - + @@ -65232,15 +65347,15 @@ - + - + - + - + @@ -65361,7 +65476,35 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -65979,72 +66122,72 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -66624,6 +66767,12 @@ + + + + + + @@ -66800,6 +66949,20 @@ + + + + + + + + + + + + + + @@ -67087,18 +67250,18 @@ - + - + - + - + - + @@ -68781,6 +68944,7 @@ + @@ -69018,12 +69182,12 @@ - + - + - + @@ -71552,7 +71716,7 @@ - + @@ -73366,54 +73530,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -75630,7 +75794,7 @@ - + @@ -75791,7 +75955,7 @@ - + @@ -75959,54 +76123,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -77852,6 +78016,7 @@ + @@ -78039,7 +78204,26 @@ - + + + + + + + + + + + + + + + + + + + + @@ -79113,6 +79297,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -82194,54 +82398,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -82526,12 +82730,12 @@ - + - + - + @@ -82893,12 +83097,12 @@ - + - + - + @@ -83126,15 +83330,15 @@ - + - + - + - + @@ -83229,7 +83433,7 @@ - + @@ -84328,291 +84532,291 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -84830,6 +85034,14 @@ + + + + + + + + @@ -86388,7 +86600,7 @@ - + @@ -88352,6 +88564,20 @@ + + + + + + + + + + + + + + @@ -89093,6 +89319,14 @@ + + + + + + + + @@ -90802,10 +91036,19 @@ + + + + + + + + + @@ -99063,7 +99306,17 @@ - + + + + + + + + + + + @@ -99766,12 +100019,12 @@ - + - + - + @@ -102096,7 +102349,7 @@ - + @@ -104238,21 +104491,21 @@ - + - + - + - + - + - + @@ -104858,6 +105111,11 @@ + + + + + @@ -105773,48 +106031,48 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -106262,66 +106520,66 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -107210,24 +107468,24 @@ - + - + - + - + - + - + - + @@ -107383,87 +107641,87 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -111321,7 +111579,7 @@ - + @@ -112120,99 +112378,99 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -112453,6 +112711,7 @@ + @@ -116311,96 +116570,96 @@ - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - - + + + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + @@ -116408,153 +116667,153 @@ - - - - + + + + - - - - + + + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - + + + + + - - - - - - + + + + + - - - + + + + + - - - - - - + + + + + + + - - - - + + + + + + - - - - - + + + + + + - - - - - + + + + - - - - - + + + - - - - - - - + + + - - - - - - + + + - - - - - - + + + - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -116569,25 +116828,25 @@ - - - - - + + + + + - - - - - - - + + + + + + + - - - + + + @@ -116597,24 +116856,24 @@ - - - - - + + + + + - - - - - - + + + + + + - - - + + + @@ -116629,19 +116888,19 @@ - - - + + + - - - - - - - - + + + + + + + + @@ -116651,113 +116910,113 @@ - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + - - - + + + - - - - - + + + + + + - - - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -116765,49 +117024,49 @@ - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - + + + @@ -116816,154 +117075,154 @@ - + + + + + + + + + + + - + - - - + + + - - - + + + + + - - - + + + + + + - - - - - + + + + + + + - - - - - - + + + - - - - - - - + + + + - - - + + + + - - - - + + + + + + - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + + - - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + - - - - - - + + + + + - - - + + + + + + - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -116973,19 +117232,19 @@ - - - - - - + + + + + + - - - - - + + + + + @@ -116996,200 +117255,200 @@ - - - - - + + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + - - - - + + + + + + + + - - - - - + + + + + + + + - - - - + + + + - - - - - - + + + + + + - - - - + + + + - - - - - - - - + + + + - - - - - - - - + + + + + - - - - + + + + - - - - - - + + + + + + - - - - + + + - - - - + + + + + - - - - - + + + + + - - - - + + + + + - - - - - - + + + + + + - - - + + + - - - - - + + + + - - - - - + + + + - - - - - + + + + + - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -117204,55 +117463,55 @@ - - - - + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + @@ -117288,63 +117547,63 @@ - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + @@ -117353,71 +117612,71 @@ - - - - + + + + - - - - + + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + - - - - - - - + + + + + + + - - - + + + - - - - + + + + @@ -117459,11 +117718,11 @@ - - - - - + + + + + @@ -117477,51 +117736,51 @@ - - - - - + + + + + - - - - - - - - - - - - - - + - - - - - - + + + + - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + @@ -117530,151 +117789,151 @@ - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - - + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + - - - - - + + + - - - - + + + - - - - - - - - - - - - - + + + @@ -117683,10 +117942,10 @@ - - - - + + + + @@ -117697,25 +117956,25 @@ - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + @@ -117723,92 +117982,92 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + - - - - + + + + - - - - - + + + + - - - - + + + + + - - - + + + + + + + + + @@ -117816,15 +118075,15 @@ - - - + + + - - - - + + + + @@ -117880,35 +118139,35 @@ - - - + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - - - - + + + + + + @@ -117917,10 +118176,10 @@ - - - - + + + + @@ -117928,10 +118187,10 @@ - - - - + + + + @@ -117973,22 +118232,22 @@ - - - - + + + + - - - - + + + + - - - - + + + + @@ -118003,12 +118262,12 @@ - - - - - - + + + + + + @@ -118027,107 +118286,107 @@ - - - - - - - - - - - - - - - + - - - - - - + + + - - - - - + + + + + - + - - + + + + + + - - - - + + + + + - - - - - - + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + - - - - + + + + + + - - - - - + + + + + + - - - - - + + + + - - - + + + + + - - - + + + + + + + + + + + + + + + @@ -118149,27 +118408,27 @@ - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + @@ -118570,186 +118829,186 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + @@ -118757,78 +119016,78 @@ - + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -118838,57 +119097,57 @@ - - - - - - + + + + + + - + - + - - - - + + + + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - + + + + + @@ -128839,32 +129098,32 @@ - - - + + + - - - - + + + + - - - - + + + + - - - + + + - - - - + + + + diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index a5c090f38388..2b9e7e09a13d 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -11,13 +11,26 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ -struct binder_transaction; -struct task_struct; +#ifdef __GENKSYMS__ struct binder_alloc; struct binder_proc; struct binder_thread; -struct binder_transaction_data; +struct binder_transaction; +struct task_struct; struct seq_file; +struct binder_transaction_data; +#else +/* struct binder_alloc */ +#include <../drivers/android/binder_alloc.h> +/* struct binder_proc, struct binder_thread, struct binder_transaction */ +#include <../drivers/android/binder_internal.h> +/* struct task_struct */ +#include +/* struct seq_file */ +#include +/* struct binder_transaction_data */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_binder_transaction_init, TP_PROTO(struct binder_transaction *t), TP_ARGS(t)); @@ -30,8 +43,6 @@ DECLARE_HOOK(android_vh_binder_set_priority, DECLARE_HOOK(android_vh_binder_restore_priority, TP_PROTO(struct binder_transaction *t, struct task_struct *task), TP_ARGS(t, task)); -struct binder_proc; -struct binder_thread; DECLARE_HOOK(android_vh_binder_wakeup_ilocked, TP_PROTO(struct task_struct *task, bool sync, struct binder_proc *proc), TP_ARGS(task, sync, proc)); diff --git a/include/trace/hooks/block.h b/include/trace/hooks/block.h index 0d9d7db39968..964fff355602 100644 --- a/include/trace/hooks/block.h +++ b/include/trace/hooks/block.h @@ -10,9 +10,18 @@ #include #include -struct blk_mq_tag_set; +#ifdef __GENKSYMS__ struct blk_mq_tags; struct blk_mq_alloc_data; +struct blk_mq_tag_set; +#else +/* struct blk_mq_tags */ +#include <../block/blk-mq-tag.h> +/* struct blk_mq_alloc_data */ +#include <../block/blk-mq.h> +/* struct blk_mq_tag_set */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_blk_alloc_rqs, TP_PROTO(size_t *rq_size, struct blk_mq_tag_set *set, diff --git a/include/trace/hooks/cgroup.h b/include/trace/hooks/cgroup.h index 6b6d7918c518..8d838c389703 100644 --- a/include/trace/hooks/cgroup.h +++ b/include/trace/hooks/cgroup.h @@ -8,7 +8,18 @@ #include #include +#ifdef __GENKSYMS__ +struct cgroup_taskset; +struct cgroup_subsys; struct task_struct; +#else +/* struct cgroup_taskset */ +#include <../kernel/cgroup/cgroup-internal.h> +/* struct cgroup_subsys */ +#include +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_cgroup_set_task, TP_PROTO(int ret, struct task_struct *task), TP_ARGS(ret, task)); @@ -22,8 +33,6 @@ DECLARE_RESTRICTED_HOOK(android_rvh_refrigerator, TP_PROTO(bool f), TP_ARGS(f), 1); -struct cgroup_subsys; -struct cgroup_taskset; DECLARE_HOOK(android_vh_cgroup_attach, TP_PROTO(struct cgroup_subsys *ss, struct cgroup_taskset *tset), TP_ARGS(ss, tset)) diff --git a/include/trace/hooks/cpuidle.h b/include/trace/hooks/cpuidle.h index 6d1f4bf7f1ed..8d1e83cdc436 100644 --- a/include/trace/hooks/cpuidle.h +++ b/include/trace/hooks/cpuidle.h @@ -10,7 +10,12 @@ #include #include +#ifdef __GENKSYMS__ struct cpuidle_device; +#else +/* struct cpuidle_device */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_cpu_idle_enter, TP_PROTO(int *state, struct cpuidle_device *dev), diff --git a/include/trace/hooks/cpuidle_psci.h b/include/trace/hooks/cpuidle_psci.h index 94b01eba0b4e..994e76b3db1b 100644 --- a/include/trace/hooks/cpuidle_psci.h +++ b/include/trace/hooks/cpuidle_psci.h @@ -11,7 +11,12 @@ * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct cpuidle_device; +#else +/* struct cpuidle_device */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_cpuidle_psci_enter, TP_PROTO(struct cpuidle_device *dev, bool s2idle), TP_ARGS(dev, s2idle)); diff --git a/include/trace/hooks/creds.h b/include/trace/hooks/creds.h index dd877e3a1f3e..a3042e0ffd4d 100644 --- a/include/trace/hooks/creds.h +++ b/include/trace/hooks/creds.h @@ -11,8 +11,15 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct cred; struct task_struct; +#else +/* struct cred */ +#include +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_commit_creds, TP_PROTO(const struct task_struct *task, const struct cred *new), TP_ARGS(task, new)); diff --git a/include/trace/hooks/debug.h b/include/trace/hooks/debug.h index ac006d7fdd0a..3ed574dbfaeb 100644 --- a/include/trace/hooks/debug.h +++ b/include/trace/hooks/debug.h @@ -11,7 +11,12 @@ #include #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) +#ifdef __GENKSYMS__ struct pt_regs; +#else +/* struct pt_regs */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_ipi_stop, TP_PROTO(struct pt_regs *regs), diff --git a/include/trace/hooks/dtask.h b/include/trace/hooks/dtask.h index 7053563e2e8f..9890bfe5c41d 100644 --- a/include/trace/hooks/dtask.h +++ b/include/trace/hooks/dtask.h @@ -11,7 +11,21 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct mutex; +struct rt_mutex; +struct rw_semaphore; +struct task_struct; +#else +/* struct mutex */ +#include +/* struct rt_mutex */ +#include +/* struct rw_semaphore */ +#include +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_mutex_wait_start, TP_PROTO(struct mutex *lock), TP_ARGS(lock)); @@ -19,7 +33,6 @@ DECLARE_HOOK(android_vh_mutex_wait_finish, TP_PROTO(struct mutex *lock), TP_ARGS(lock)); -struct rt_mutex; DECLARE_HOOK(android_vh_rtmutex_wait_start, TP_PROTO(struct rt_mutex *lock), TP_ARGS(lock)); @@ -27,7 +40,6 @@ DECLARE_HOOK(android_vh_rtmutex_wait_finish, TP_PROTO(struct rt_mutex *lock), TP_ARGS(lock)); -struct rw_semaphore; DECLARE_HOOK(android_vh_rwsem_read_wait_start, TP_PROTO(struct rw_semaphore *sem), TP_ARGS(sem)); @@ -41,7 +53,6 @@ DECLARE_HOOK(android_vh_rwsem_write_wait_finish, TP_PROTO(struct rw_semaphore *sem), TP_ARGS(sem)); -struct task_struct; DECLARE_HOOK(android_vh_sched_show_task, TP_PROTO(struct task_struct *task), TP_ARGS(task)); diff --git a/include/trace/hooks/fault.h b/include/trace/hooks/fault.h index 2c4176001ead..de66a1ca33c7 100644 --- a/include/trace/hooks/fault.h +++ b/include/trace/hooks/fault.h @@ -11,7 +11,12 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct pt_regs; +#else +/* struct pt_regs */ +#include +#endif /* __GENKSYMS__ */ DECLARE_RESTRICTED_HOOK(android_rvh_die_kernel_fault, TP_PROTO(struct pt_regs *regs, unsigned int esr, unsigned long addr, const char *msg), TP_ARGS(regs, esr, addr, msg), 1); diff --git a/include/trace/hooks/fips140.h b/include/trace/hooks/fips140.h index 3aebf6168791..02283a1b126f 100644 --- a/include/trace/hooks/fips140.h +++ b/include/trace/hooks/fips140.h @@ -8,7 +8,12 @@ #include #include +#ifdef __GENKSYMS__ struct crypto_aes_ctx; +#else +/* struct crypto_aes_ctx */ +#include +#endif /* __GENKSYMS__ */ /* * These hooks exist only for the benefit of the FIPS140 crypto module, which diff --git a/include/trace/hooks/fpsimd.h b/include/trace/hooks/fpsimd.h index a4a3ce228fff..ab7c34ce64f8 100644 --- a/include/trace/hooks/fpsimd.h +++ b/include/trace/hooks/fpsimd.h @@ -10,7 +10,12 @@ #include #include +#ifdef __GENKSYMS__ struct task_struct; +#else +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_is_fpsimd_save, TP_PROTO(struct task_struct *prev, struct task_struct *next), diff --git a/include/trace/hooks/gic_v3.h b/include/trace/hooks/gic_v3.h index 42e0bb934570..6b649fd865b1 100644 --- a/include/trace/hooks/gic_v3.h +++ b/include/trace/hooks/gic_v3.h @@ -10,8 +10,15 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ -struct irq_data; +#ifdef __GENKSYMS__ struct cpumask; +struct irq_data; +#else +/* struct cpumask */ +#include +/* struct irq_data */ +#include +#endif /* __GENKSYMS__ */ DECLARE_RESTRICTED_HOOK(android_rvh_gic_v3_set_affinity, TP_PROTO(struct irq_data *d, const struct cpumask *mask_val, u64 *affinity, bool force, void __iomem *base), diff --git a/include/trace/hooks/iommu.h b/include/trace/hooks/iommu.h index e818b90e482c..28bd0a3929ed 100644 --- a/include/trace/hooks/iommu.h +++ b/include/trace/hooks/iommu.h @@ -12,6 +12,12 @@ #include #include +#ifdef __GENKSYMS__ +struct iova_domain; +#else +/* struct iova_domain */ +#include +#endif /* __GENKSYMS__ */ DECLARE_RESTRICTED_HOOK(android_rvh_iommu_setup_dma_ops, TP_PROTO(struct device *dev, u64 dma_base, u64 size), TP_ARGS(dev, dma_base, size), 1); @@ -24,7 +30,6 @@ DECLARE_HOOK(android_vh_iommu_alloc_iova, TP_PROTO(struct device *dev, dma_addr_t iova, size_t size), TP_ARGS(dev, iova, size)); -struct iova_domain; DECLARE_HOOK(android_vh_iommu_iovad_alloc_iova, TP_PROTO(struct device *dev, struct iova_domain *iovad, dma_addr_t iova, size_t size), diff --git a/include/trace/hooks/logbuf.h b/include/trace/hooks/logbuf.h index f73ad597fc64..6aeb10a4661b 100644 --- a/include/trace/hooks/logbuf.h +++ b/include/trace/hooks/logbuf.h @@ -10,8 +10,13 @@ #include #include -struct printk_ringbuffer; +#ifdef __GENKSYMS__ struct printk_record; +struct printk_ringbuffer; +#else +/* struct printk_record, struct printk_ringbuffer */ +#include <../kernel/printk/printk_ringbuffer.h> +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_logbuf, TP_PROTO(struct printk_ringbuffer *rb, struct printk_record *r), diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 4af456345aa4..11073388847b 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -14,6 +14,24 @@ #include #include +#ifdef __GENKSYMS__ +struct slabinfo; +struct cgroup_subsys_state; +struct device; +struct mem_cgroup; +struct readahead_control; +#else +/* struct slabinfo */ +#include <../mm/slab.h> +/* struct cgroup_subsys_state */ +#include +/* struct device */ +#include +/* struct mem_cgroup */ +#include +/* struct readahead_control */ +#include +#endif /* __GENKSYMS__ */ struct cma; DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags, @@ -68,7 +86,6 @@ DECLARE_HOOK(android_vh_include_reserved_zone, DECLARE_HOOK(android_vh_show_mem, TP_PROTO(unsigned int filter, nodemask_t *nodemask), TP_ARGS(filter, nodemask)); -struct slabinfo; struct dirty_throttle_control; DECLARE_HOOK(android_vh_mm_dirty_limits, TP_PROTO(struct dirty_throttle_control *const gdtc, bool strictlimit, @@ -88,7 +105,6 @@ DECLARE_HOOK(android_vh_show_stack_hash, DECLARE_HOOK(android_vh_save_track_hash, TP_PROTO(bool alloc, unsigned long p), TP_ARGS(alloc, p)); -struct mem_cgroup; DECLARE_HOOK(android_vh_vmpressure, TP_PROTO(struct mem_cgroup *memcg, bool *bypass), TP_ARGS(memcg, bypass)); @@ -101,7 +117,6 @@ DECLARE_HOOK(android_vh_mem_cgroup_free, DECLARE_HOOK(android_vh_mem_cgroup_id_remove, TP_PROTO(struct mem_cgroup *memcg), TP_ARGS(memcg)); -struct cgroup_subsys_state; DECLARE_HOOK(android_vh_mem_cgroup_css_online, TP_PROTO(struct cgroup_subsys_state *css, struct mem_cgroup *memcg), TP_ARGS(css, memcg)); @@ -128,11 +143,9 @@ DECLARE_HOOK(android_vh_cma_drain_all_pages_bypass, DECLARE_HOOK(android_vh_pcplist_add_cma_pages_bypass, TP_PROTO(int migratetype, bool *bypass), TP_ARGS(migratetype, bypass)); -struct device; DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, TP_PROTO(bool *allow_subpage_alloc, struct device *dev, size_t *size), TP_ARGS(allow_subpage_alloc, dev, size)); -struct readahead_control; DECLARE_HOOK(android_vh_ra_tuning_max_page, TP_PROTO(struct readahead_control *ractl, unsigned long *max_page), TP_ARGS(ractl, max_page)); diff --git a/include/trace/hooks/mmc_core.h b/include/trace/hooks/mmc_core.h index ad367782d59f..b4b93b2f4c9e 100644 --- a/include/trace/hooks/mmc_core.h +++ b/include/trace/hooks/mmc_core.h @@ -10,9 +10,18 @@ #include #include -struct mmc_host; -struct mmc_card; +#ifdef __GENKSYMS__ struct sdhci_host; +struct mmc_card; +struct mmc_host; +#else +/* struct sdhci_host */ +#include <../drivers/mmc/host/sdhci.h> +/* struct mmc_card */ +#include +/* struct mmc_host */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_mmc_blk_reset, TP_PROTO(struct mmc_host *host, int err, bool *allow), diff --git a/include/trace/hooks/module.h b/include/trace/hooks/module.h index 281cb0d37c12..3c552945e92e 100644 --- a/include/trace/hooks/module.h +++ b/include/trace/hooks/module.h @@ -11,7 +11,12 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct module; +#else +/* struct module */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_set_module_permit_before_init, TP_PROTO(const struct module *mod), TP_ARGS(mod)); diff --git a/include/trace/hooks/net.h b/include/trace/hooks/net.h index acb2fd2c7e07..f5347e393f5f 100644 --- a/include/trace/hooks/net.h +++ b/include/trace/hooks/net.h @@ -9,9 +9,18 @@ #include #include +#ifdef __GENKSYMS__ struct packet_type; -struct list_head; struct sk_buff; +struct list_head; +#else +/* struct packet_type */ +#include +/* struct sk_buff */ +#include +/* struct list_head */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_ptype_head, TP_PROTO(const struct packet_type *pt, struct list_head *vendor_pt), TP_ARGS(pt, vendor_pt)); diff --git a/include/trace/hooks/pm_domain.h b/include/trace/hooks/pm_domain.h index 548e350e8090..7021850865ff 100644 --- a/include/trace/hooks/pm_domain.h +++ b/include/trace/hooks/pm_domain.h @@ -11,7 +11,12 @@ #include #include +#ifdef __GENKSYMS__ struct generic_pm_domain; +#else +/* struct generic_pm_domain */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_allow_domain_state, TP_PROTO(struct generic_pm_domain *genpd, uint32_t idx, bool *allow), TP_ARGS(genpd, idx, allow)) diff --git a/include/trace/hooks/power.h b/include/trace/hooks/power.h index 149ea08580b8..de747ac98472 100644 --- a/include/trace/hooks/power.h +++ b/include/trace/hooks/power.h @@ -11,7 +11,17 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ +enum freq_qos_req_type; +struct freq_constraints; +struct freq_qos_request; struct task_struct; +#else +/* enum freq_qos_req_type, struct freq_constraints, struct freq_qos_request */ +#include +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_try_to_freeze_todo, TP_PROTO(unsigned int todo, unsigned int elapsed_msecs, bool wq_busy), TP_ARGS(todo, elapsed_msecs, wq_busy)); @@ -20,9 +30,6 @@ DECLARE_HOOK(android_vh_try_to_freeze_todo_unfrozen, TP_PROTO(struct task_struct *p), TP_ARGS(p)); -enum freq_qos_req_type; -struct freq_qos_request; -struct freq_constraints; DECLARE_HOOK(android_vh_freq_qos_add_request, TP_PROTO(struct freq_constraints *qos, struct freq_qos_request *req, diff --git a/include/trace/hooks/psi.h b/include/trace/hooks/psi.h index 62d1a0ee7b63..3842118af3c3 100644 --- a/include/trace/hooks/psi.h +++ b/include/trace/hooks/psi.h @@ -12,8 +12,13 @@ #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) -struct psi_trigger; +#ifdef __GENKSYMS__ struct psi_group; +struct psi_trigger; +#else +/* struct psi_group, struct psi_trigger */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_psi_event, TP_PROTO(struct psi_trigger *t), TP_ARGS(t)); diff --git a/include/trace/hooks/remoteproc.h b/include/trace/hooks/remoteproc.h index c39c2c1bffb3..e596d7c3b37f 100644 --- a/include/trace/hooks/remoteproc.h +++ b/include/trace/hooks/remoteproc.h @@ -10,7 +10,12 @@ #include #include +#ifdef __GENKSYMS__ struct rproc; +#else +/* struct rproc */ +#include +#endif /* __GENKSYMS__ */ /* When recovery succeeds */ DECLARE_HOOK(android_vh_rproc_recovery, diff --git a/include/trace/hooks/rwsem.h b/include/trace/hooks/rwsem.h index c8e445216910..ed9daf91f133 100644 --- a/include/trace/hooks/rwsem.h +++ b/include/trace/hooks/rwsem.h @@ -10,8 +10,13 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct rw_semaphore; struct rwsem_waiter; +#else +/* struct rw_semaphore, struct rwsem_waiter */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_rwsem_init, TP_PROTO(struct rw_semaphore *sem), TP_ARGS(sem)); diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 55fc6c3a1a89..891c89fa8262 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -10,7 +10,27 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ +struct cgroup_taskset; +struct cgroup_subsys_state; +struct cpufreq_policy; +struct em_perf_domain; +enum uclamp_id; +struct sched_entity; struct task_struct; +struct uclamp_se; +#else +/* struct cgroup_taskset */ +#include <../kernel/cgroup/cgroup-internal.h> +/* struct cgroup_subsys_state */ +#include +/* struct cpufreq_policy */ +#include +/* struct em_perf_domain */ +#include +/* enum uclamp_id, struct sched_entity, struct task_struct, struct uclamp_se */ +#include +#endif /* __GENKSYMS__ */ DECLARE_RESTRICTED_HOOK(android_rvh_select_task_rq_fair, TP_PROTO(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags, int *new_cpu), TP_ARGS(p, prev_cpu, sd_flag, wake_flags, new_cpu), 1); @@ -178,7 +198,6 @@ DECLARE_RESTRICTED_HOOK(android_rvh_account_irq, TP_PROTO(struct task_struct *curr, int cpu, s64 delta), TP_ARGS(curr, cpu, delta), 1); -struct sched_entity; DECLARE_RESTRICTED_HOOK(android_rvh_place_entity, TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial, u64 vruntime), TP_ARGS(cfs_rq, se, initial, vruntime), 1); @@ -195,7 +214,6 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_misfit_status, TP_PROTO(struct task_struct *p, struct rq *rq, bool *need_update), TP_ARGS(p, rq, need_update), 1); -struct cgroup_taskset; DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_attach, TP_PROTO(struct cgroup_taskset *tset), TP_ARGS(tset), 1); @@ -204,7 +222,6 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_can_attach, TP_PROTO(struct cgroup_taskset *tset, int *retval), TP_ARGS(tset, retval), 1); -struct cgroup_subsys_state; DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_online, TP_PROTO(struct cgroup_subsys_state *css), TP_ARGS(css), 1); @@ -225,14 +242,12 @@ DECLARE_RESTRICTED_HOOK(android_rvh_sched_exec, TP_PROTO(bool *cond), TP_ARGS(cond), 1); -struct cpufreq_policy; DECLARE_HOOK(android_vh_map_util_freq, TP_PROTO(unsigned long util, unsigned long freq, unsigned long cap, unsigned long *next_freq, struct cpufreq_policy *policy, bool *need_freq_update), TP_ARGS(util, freq, cap, next_freq, policy, need_freq_update)); -struct em_perf_domain; DECLARE_HOOK(android_vh_em_cpu_energy, TP_PROTO(struct em_perf_domain *pd, unsigned long max_util, unsigned long sum_util, @@ -268,8 +283,6 @@ DECLARE_HOOK(android_vh_set_wake_flags, TP_PROTO(int *wake_flags, unsigned int *mode), TP_ARGS(wake_flags, mode)); -enum uclamp_id; -struct uclamp_se; DECLARE_RESTRICTED_HOOK(android_rvh_uclamp_eff_get, TP_PROTO(struct task_struct *p, enum uclamp_id clamp_id, struct uclamp_se *uclamp_max, struct uclamp_se *uclamp_eff, int *ret), @@ -329,7 +342,6 @@ DECLARE_RESTRICTED_HOOK(android_rvh_after_dequeue_task, TP_ARGS(rq, p), 1); struct cfs_rq; -struct sched_entity; struct rq_flags; DECLARE_RESTRICTED_HOOK(android_rvh_enqueue_entity, TP_PROTO(struct cfs_rq *cfs, struct sched_entity *se), diff --git a/include/trace/hooks/shmem_fs.h b/include/trace/hooks/shmem_fs.h index 08e63033070e..617bc69f3d06 100644 --- a/include/trace/hooks/shmem_fs.h +++ b/include/trace/hooks/shmem_fs.h @@ -8,7 +8,12 @@ #include #include +#ifdef __GENKSYMS__ struct page; +#else +/* struct page */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_shmem_alloc_page, TP_PROTO(struct page **page), TP_ARGS(page)); diff --git a/include/trace/hooks/signal.h b/include/trace/hooks/signal.h index ee36ea1de283..1bb556e728c8 100644 --- a/include/trace/hooks/signal.h +++ b/include/trace/hooks/signal.h @@ -8,7 +8,12 @@ #include #include +#ifdef __GENKSYMS__ struct task_struct; +#else +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_do_send_sig_info, TP_PROTO(int sig, struct task_struct *killer, struct task_struct *dst), TP_ARGS(sig, killer, dst)); diff --git a/include/trace/hooks/softlockup.h b/include/trace/hooks/softlockup.h index 9294913f91df..cfa899f5de11 100644 --- a/include/trace/hooks/softlockup.h +++ b/include/trace/hooks/softlockup.h @@ -11,7 +11,12 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct pt_regs; +#else +/* struct pt_regs */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_watchdog_timer_softlockup, TP_PROTO(int duration, struct pt_regs *regs, bool is_panic), TP_ARGS(duration, regs, is_panic)); diff --git a/include/trace/hooks/sys.h b/include/trace/hooks/sys.h index 9e5d7a5cb2cf..adcf9eaa7716 100644 --- a/include/trace/hooks/sys.h +++ b/include/trace/hooks/sys.h @@ -8,7 +8,12 @@ #include #include +#ifdef __GENKSYMS__ struct task_struct; +#else +/* struct task_struct */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_syscall_prctl_finished, TP_PROTO(int option, struct task_struct *task), TP_ARGS(option, task)); diff --git a/include/trace/hooks/syscall_check.h b/include/trace/hooks/syscall_check.h index d39802aa4a1e..54720d10cde8 100644 --- a/include/trace/hooks/syscall_check.h +++ b/include/trace/hooks/syscall_check.h @@ -11,8 +11,15 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct file; union bpf_attr; +#else +/* struct file */ +#include +/* union bpf_attr */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_check_mmap_file, TP_PROTO(const struct file *file, unsigned long prot, unsigned long flag, unsigned long ret), diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h index 944454ca0e48..5e61ecd38425 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -10,11 +10,16 @@ #include #include +#ifdef __GENKSYMS__ +struct thermal_zone_device; +#else +/* struct thermal_zone_device */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_enable_thermal_genl_check, TP_PROTO(int event, int tz_id, int *enable_thermal_genl), TP_ARGS(event, tz_id, enable_thermal_genl)); -struct thermal_zone_device; DECLARE_HOOK(android_vh_thermal_pm_notify_suspend, TP_PROTO(struct thermal_zone_device *tz, int *irq_wakeable), TP_ARGS(tz, irq_wakeable)); diff --git a/include/trace/hooks/traps.h b/include/trace/hooks/traps.h index d1ceb632c1d5..116c49b73dc7 100644 --- a/include/trace/hooks/traps.h +++ b/include/trace/hooks/traps.h @@ -11,7 +11,12 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct pt_regs; +#else +/* struct pt_regs */ +#include +#endif /* __GENKSYMS__ */ DECLARE_RESTRICTED_HOOK(android_rvh_do_undefinstr, TP_PROTO(struct pt_regs *regs, bool user), TP_ARGS(regs, user), diff --git a/include/trace/hooks/typec.h b/include/trace/hooks/typec.h index f87151124075..db06fb8c30e9 100644 --- a/include/trace/hooks/typec.h +++ b/include/trace/hooks/typec.h @@ -11,8 +11,13 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ -struct tcpci; +#ifdef __GENKSYMS__ struct tcpci_data; +#else +/* struct tcpci_data */ +#include <../drivers/usb/typec/tcpm/tcpci.h> +#endif /* __GENKSYMS__ */ +struct tcpci; struct tcpm_port; #ifndef TYPEC_TIMER diff --git a/include/trace/hooks/ufshcd.h b/include/trace/hooks/ufshcd.h index 744a1db41631..8483dc966c6c 100644 --- a/include/trace/hooks/ufshcd.h +++ b/include/trace/hooks/ufshcd.h @@ -10,9 +10,20 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ +#ifdef __GENKSYMS__ struct ufs_hba; -struct request; struct ufshcd_lrb; +struct uic_command; +struct request; +struct scsi_device; +#else +/* struct ufs_hba, struct ufshcd_lrb, struct uic_command */ +#include <../drivers/scsi/ufs/ufshcd.h> +/* struct request */ +#include +/* struct scsi_device */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_ufs_fill_prdt, TP_PROTO(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, @@ -44,7 +55,6 @@ DECLARE_HOOK(android_vh_ufs_compl_command, TP_PROTO(struct ufs_hba *hba, struct ufshcd_lrb *lrbp), TP_ARGS(hba, lrbp)); -struct uic_command; DECLARE_HOOK(android_vh_ufs_send_uic_command, TP_PROTO(struct ufs_hba *hba, struct uic_command *ucmd, const char *str), @@ -58,7 +68,6 @@ DECLARE_HOOK(android_vh_ufs_check_int_errors, TP_PROTO(struct ufs_hba *hba, bool queue_eh_work), TP_ARGS(hba, queue_eh_work)); -struct scsi_device; DECLARE_HOOK(android_vh_ufs_update_sdev, TP_PROTO(struct scsi_device *sdev), TP_ARGS(sdev)); diff --git a/include/trace/hooks/v4l2core.h b/include/trace/hooks/v4l2core.h index 7207810a7e37..bb53021a7796 100644 --- a/include/trace/hooks/v4l2core.h +++ b/include/trace/hooks/v4l2core.h @@ -10,12 +10,26 @@ #include #include +#ifdef __GENKSYMS__ +struct v4l2_subdev; +struct v4l2_subdev_pad_config; +struct v4l2_subdev_format; +struct v4l2_subdev_frame_interval; +struct v4l2_subdev_selection; +struct v4l2_fmtdesc; struct v4l2_format; +#else +/* struct v4l2_subdev, struct v4l2_subdev_pad_config */ +#include +/* struct v4l2_subdev_format, struct v4l2_subdev_frame_interval, struct v4l2_subdev_selection */ +#include +/* struct v4l2_fmtdesc, struct v4l2_format */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_clear_reserved_fmt_fields, TP_PROTO(struct v4l2_format *fmt, int *ret), TP_ARGS(fmt, ret)); -struct v4l2_fmtdesc; DECLARE_HOOK(android_vh_fill_ext_fmtdesc, TP_PROTO(struct v4l2_fmtdesc *fmtd, const char **descr), TP_ARGS(fmtd, descr)); @@ -24,21 +38,16 @@ DECLARE_HOOK(android_vh_clear_mask_adjust, TP_PROTO(unsigned int ctrl, int *n), TP_ARGS(ctrl, n)); -struct v4l2_subdev; -struct v4l2_subdev_pad_config; -struct v4l2_subdev_selection; DECLARE_HOOK(android_vh_v4l2subdev_set_selection, TP_PROTO(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *pad, struct v4l2_subdev_selection *sel, int *ret), TP_ARGS(sd, pad, sel, ret)); -struct v4l2_subdev_format; DECLARE_HOOK(android_vh_v4l2subdev_set_fmt, TP_PROTO(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *pad, struct v4l2_subdev_format *format, int *ret), TP_ARGS(sd, pad, format, ret)); -struct v4l2_subdev_frame_interval; DECLARE_HOOK(android_vh_v4l2subdev_set_frame_interval, TP_PROTO(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *fi, int *ret), diff --git a/include/trace/hooks/v4l2mc.h b/include/trace/hooks/v4l2mc.h index 0f60515bb8e2..1f4edc658616 100644 --- a/include/trace/hooks/v4l2mc.h +++ b/include/trace/hooks/v4l2mc.h @@ -10,8 +10,15 @@ #include #include +#ifdef __GENKSYMS__ struct media_link; struct media_link_desc; +#else +/* struct media_link */ +#include +/* struct media_link_desc */ +#include +#endif /* __GENKSYMS__ */ DECLARE_HOOK(android_vh_media_device_setup_link, TP_PROTO(struct media_link *link, struct media_link_desc *linkd, int *ret), TP_ARGS(link, linkd, ret)); From 8d6d335851a10c6b352d63801c2a0f9370e3bfc6 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 21 Jun 2022 09:33:55 -0700 Subject: [PATCH 28/55] ANDROID: Fix build error with CONFIG_UCLAMP_TASK disabled After 7b26719a77c4 ("ANDROID: GKI: use internal type definitions in vendor hooks") we stopped providing a forward declaration of 'struct uclamp_se' and instead relied on pulling its definition from linux/sched.h. the 'uclamp_se' structure is conditionally defined based upon CONFIG_UCLAMP_TASK therefore causing a build error to show up for the android_rvh_uclamp_eff_get trace point. Fix this by providing a forward declaration of 'struct uclamp_se' like before. Fixes: 7b26719a77c4 ("ANDROID: GKI: use internal type definitions in vendor hooks") Signed-off-by: Florian Fainelli Change-Id: Iaa803d149150c1703435f9cfa52ea1406a9521fd --- include/trace/hooks/sched.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 891c89fa8262..c3fc9bf6f8e9 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -283,6 +283,8 @@ DECLARE_HOOK(android_vh_set_wake_flags, TP_PROTO(int *wake_flags, unsigned int *mode), TP_ARGS(wake_flags, mode)); +/* Conditionally defined upon CONFIG_UCLAMP_TASK */ +struct uclamp_se; DECLARE_RESTRICTED_HOOK(android_rvh_uclamp_eff_get, TP_PROTO(struct task_struct *p, enum uclamp_id clamp_id, struct uclamp_se *uclamp_max, struct uclamp_se *uclamp_eff, int *ret), From abb407e9ff95013b31f99b475be09f782717e141 Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Sun, 26 Jun 2022 02:59:44 +0000 Subject: [PATCH 29/55] ANDROID: GKI: forward declare struct cgroup_taskset in vendor hooks The inclusion of the internal kernel/cgroup/cgroup-internal.h header broke some androidci builds. Bug: 233047575 Fixes: 1590a0e8e123 ("ANDROID: GKI: include more type definitions in vendor hooks") Signed-off-by: Todd Kjos Change-Id: I3139b63e5bea277c6687ce1c3c69db35059f3825 --- include/trace/hooks/cgroup.h | 4 +--- include/trace/hooks/sched.h | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/trace/hooks/cgroup.h b/include/trace/hooks/cgroup.h index 8d838c389703..68818ad29600 100644 --- a/include/trace/hooks/cgroup.h +++ b/include/trace/hooks/cgroup.h @@ -8,13 +8,11 @@ #include #include -#ifdef __GENKSYMS__ struct cgroup_taskset; +#ifdef __GENKSYMS__ struct cgroup_subsys; struct task_struct; #else -/* struct cgroup_taskset */ -#include <../kernel/cgroup/cgroup-internal.h> /* struct cgroup_subsys */ #include /* struct task_struct */ diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index c3fc9bf6f8e9..9f16fffd89e4 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -10,8 +10,8 @@ * Following tracepoints are not exported in tracefs and provide a * mechanism for vendor modules to hook and extend functionality */ -#ifdef __GENKSYMS__ struct cgroup_taskset; +#ifdef __GENKSYMS__ struct cgroup_subsys_state; struct cpufreq_policy; struct em_perf_domain; @@ -20,8 +20,6 @@ struct sched_entity; struct task_struct; struct uclamp_se; #else -/* struct cgroup_taskset */ -#include <../kernel/cgroup/cgroup-internal.h> /* struct cgroup_subsys_state */ #include /* struct cpufreq_policy */ From 7d2bd28eae452c8756f9c3d68ec471455a57fff2 Mon Sep 17 00:00:00 2001 From: Krishna Kurapati Date: Tue, 28 Jun 2022 00:03:39 +0530 Subject: [PATCH 30/55] FROMGIT: usb: gadget: f_fs: change ep->status safe in ffs_epfile_io() If a task read/write data in blocking mode, it will wait the completion in ffs_epfile_io(), if function unbind occurs, ffs_func_unbind() will kfree ffs ep, once the task wake up, it still dereference the ffs ep to obtain the request status. Fix it by moving the request status to io_data which is stack-safe. Cc: # 5.15 Reported-by: Michael Wu Tested-by: Michael Wu Reviewed-by: John Keeping Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1654863478-26228-2-git-send-email-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit fb1f16d74e263baa4ad11e31e28b68f144aa55ed https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next) Bug: 237482099 Change-Id: I439b94c4fbc56416c3339ada5f066aa606fd81bd Signed-off-by: Krishna Kurapati --- drivers/usb/gadget/function/f_fs.c | 34 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index bb0d92837f67..dde62805dda3 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -122,8 +122,6 @@ struct ffs_ep { struct usb_endpoint_descriptor *descs[3]; u8 num; - - int status; /* P: epfile->mutex */ }; struct ffs_epfile { @@ -227,6 +225,9 @@ struct ffs_io_data { bool use_sg; struct ffs_data *ffs; + + int status; + struct completion done; }; struct ffs_desc_helper { @@ -705,12 +706,15 @@ static const struct file_operations ffs_ep0_operations = { static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request *req) { + struct ffs_io_data *io_data = req->context; + ENTER(); - if (likely(req->context)) { - struct ffs_ep *ep = _ep->driver_data; - ep->status = req->status ? req->status : req->actual; - complete(req->context); - } + if (req->status) + io_data->status = req->status; + else + io_data->status = req->actual; + + complete(&io_data->done); } static ssize_t ffs_copy_to_iter(void *data, int data_len, struct iov_iter *iter) @@ -1048,7 +1052,6 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) WARN(1, "%s: data_len == -EINVAL\n", __func__); ret = -EINVAL; } else if (!io_data->aio) { - DECLARE_COMPLETION_ONSTACK(done); bool interrupted = false; req = ep->req; @@ -1064,7 +1067,8 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) io_data->buf = data; - req->context = &done; + init_completion(&io_data->done); + req->context = io_data; req->complete = ffs_epfile_io_complete; ret = usb_ep_queue(ep->ep, req, GFP_ATOMIC); @@ -1073,7 +1077,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) spin_unlock_irq(&epfile->ffs->eps_lock); - if (unlikely(wait_for_completion_interruptible(&done))) { + if (unlikely(wait_for_completion_interruptible(&io_data->done))) { /* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check @@ -1081,17 +1085,17 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) * condition with req->complete callback. */ usb_ep_dequeue(ep->ep, req); - wait_for_completion(&done); - interrupted = ep->status < 0; + wait_for_completion(&io_data->done); + interrupted = io_data->status < 0; } if (interrupted) ret = -EINTR; - else if (io_data->read && ep->status > 0) - ret = __ffs_epfile_read_data(epfile, data, ep->status, + else if (io_data->read && io_data->status > 0) + ret = __ffs_epfile_read_data(epfile, data, io_data->status, &io_data->data); else - ret = ep->status; + ret = io_data->status; goto error_mutex; } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_ATOMIC))) { ret = -ENOMEM; From bb9c8f52568677be994d09ec9e0ce9f9df376cef Mon Sep 17 00:00:00 2001 From: Krishna Kurapati Date: Tue, 28 Jun 2022 00:15:34 +0530 Subject: [PATCH 31/55] FROMGIT: usb: gadget: f_fs: change ep->ep safe in ffs_epfile_io() In ffs_epfile_io(), when read/write data in blocking mode, it will wait the completion in interruptible mode, if task receive a signal, it will terminate the wait, at same time, if function unbind occurs, ffs_func_unbind() will kfree all eps, ffs_epfile_io() still try to dequeue request by dereferencing ep which may become invalid. Fix it by add ep spinlock and will not dereference ep if it is not valid. Cc: # 5.15 Reported-by: Michael Wu Tested-by: Michael Wu Reviewed-by: John Keeping Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1654863478-26228-3-git-send-email-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 0698f0209d8032e8869525aeb68f65ee7fde12ad https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next) Bug: 237482099 Change-Id: I796c819a855241186058359a13c57c802e35ccbb Signed-off-by: Krishna Kurapati --- drivers/usb/gadget/function/f_fs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index dde62805dda3..ecf298bc49ed 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1078,6 +1078,11 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) spin_unlock_irq(&epfile->ffs->eps_lock); if (unlikely(wait_for_completion_interruptible(&io_data->done))) { + spin_lock_irq(&epfile->ffs->eps_lock); + if (epfile->ep != ep) { + ret = -ESHUTDOWN; + goto error_lock; + } /* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check @@ -1085,6 +1090,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) * condition with req->complete callback. */ usb_ep_dequeue(ep->ep, req); + spin_unlock_irq(&epfile->ffs->eps_lock); wait_for_completion(&io_data->done); interrupted = io_data->status < 0; } From 6b04959511314a1ed370a21b83aaec24ca9c20bd Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 14:06:14 +0800 Subject: [PATCH 32/55] ANDROID: vendor_hook: Add hook in inactive_is_low() Provide a vendor hook android_vh_inactive_is_low to replace the calculation process of inactive_ratio. The alternative calculation algorithm takes into account the difference between file pages and anonymous pages. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I6cf9c47fbc440852cc36e04f49d644146eb2c6af --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 4 ++++ mm/vmscan.c | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 271df56a34ed..ed90b0476eb8 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,3 +407,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index 7b4d222301af..e1c2c5b4fe9e 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -34,6 +34,10 @@ DECLARE_HOOK(android_vh_shrink_node_memcgs, DECLARE_HOOK(android_vh_tune_memcg_scan_type, TP_PROTO(struct mem_cgroup *memcg, char *scan_type), TP_ARGS(memcg, scan_type)); +DECLARE_HOOK(android_vh_inactive_is_low, + TP_PROTO(unsigned long gb, unsigned long *inactive_ratio, + enum lru_list inactive_lru, bool *skip), + TP_ARGS(gb, inactive_ratio, inactive_lru, skip)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index 0c47c99b4cdb..2dd501e78e1f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2270,11 +2270,16 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru) unsigned long inactive, active; unsigned long inactive_ratio; unsigned long gb; + bool skip = false; inactive = lruvec_page_state(lruvec, NR_LRU_BASE + inactive_lru); active = lruvec_page_state(lruvec, NR_LRU_BASE + active_lru); gb = (inactive + active) >> (30 - PAGE_SHIFT); + trace_android_vh_inactive_is_low(gb, &inactive_ratio, inactive_lru, &skip); + if (skip) + goto out; + if (gb) inactive_ratio = int_sqrt(10 * gb); else @@ -2282,6 +2287,7 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru) trace_android_vh_tune_inactive_ratio(&inactive_ratio, is_file_lru(inactive_lru)); +out: return inactive * inactive_ratio < active; } From 6b7243da5edaa8b4713d24ca4ddee5001af176aa Mon Sep 17 00:00:00 2001 From: Bing Han Date: Thu, 9 Jun 2022 17:57:36 +0800 Subject: [PATCH 33/55] ANDROID: vendor_hook: Add hook in snapshot_refaults() Provide a vendor hook android_vh_snapshot_refaults to record the refault statistics of WORKINGSET_RESTORE_ANON; Bug: 234214858 Signed-off-by: Bing Han Change-Id: I20eb5ea99bf21fa8ba34b45e87d2ab9e9cdca167 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 3 +++ mm/vmscan.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ed90b0476eb8..16772e72e2c5 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -408,3 +408,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index e1c2c5b4fe9e..4f1d6ab9f498 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -38,6 +38,9 @@ DECLARE_HOOK(android_vh_inactive_is_low, TP_PROTO(unsigned long gb, unsigned long *inactive_ratio, enum lru_list inactive_lru, bool *skip), TP_ARGS(gb, inactive_ratio, inactive_lru, skip)); +DECLARE_HOOK(android_vh_snapshot_refaults, + TP_PROTO(struct lruvec *target_lruvec), + TP_ARGS(target_lruvec)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index 2dd501e78e1f..24b0c38c2c5c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3085,6 +3085,7 @@ static void snapshot_refaults(struct mem_cgroup *target_memcg, pg_data_t *pgdat) target_lruvec->refaults[0] = refaults; refaults = lruvec_page_state(target_lruvec, WORKINGSET_ACTIVATE_FILE); target_lruvec->refaults[1] = refaults; + trace_android_vh_snapshot_refaults(target_lruvec); } /* From e3f469befbe09245787226ff1e15929c5f0a2896 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 14:34:16 +0800 Subject: [PATCH 34/55] ANDROID: vendor_hooks: Add hooks to madvise_cold_or_pageout_pte_range() Provide a vendor hook android_vh_page_isolated_for_reclaim to process whether the page should be reclaimed to a specified swap(i.e., the expanded memory). This strategy will take into account the state of the current process/application, resource usage, and other information. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Id80a377c87bea13922e7b23963b050ab37ba0cb0 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/madvise.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 16772e72e2c5..63acb55e9642 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,5 +407,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 11073388847b..37f09cdeba9a 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -149,6 +149,9 @@ DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, DECLARE_HOOK(android_vh_ra_tuning_max_page, TP_PROTO(struct readahead_control *ractl, unsigned long *max_page), TP_ARGS(ractl, max_page)); +DECLARE_HOOK(android_vh_page_isolated_for_reclaim, + TP_PROTO(struct mm_struct *mm, struct page *page), + TP_ARGS(mm, page)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/madvise.c b/mm/madvise.c index e54da6abda9f..db54a747d6f3 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -462,8 +463,10 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, if (!isolate_lru_page(page)) { if (PageUnevictable(page)) putback_lru_page(page); - else + else { list_add(&page->lru, &page_list); + trace_android_vh_page_isolated_for_reclaim(mm, page); + } } } else deactivate_page(page); From 9d4b553252eae4c6e4853695a639cb32a4a61400 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 14:42:44 +0800 Subject: [PATCH 35/55] ANDROID: vendor_hook: Add hook in wp_page_copy() android_vh_cow_user_page: when copy a page to a new page, set the status that whether the new page should be reclaimed to a specified swap location, according to the information of vm_fault. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ie445c7b034ca176ec1e8fd1cd67c88581bf9ddf4 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/memory.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 63acb55e9642..ab0cad1ce365 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,6 +407,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 37f09cdeba9a..68999767a530 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -149,6 +149,9 @@ DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, DECLARE_HOOK(android_vh_ra_tuning_max_page, TP_PROTO(struct readahead_control *ractl, unsigned long *max_page), TP_ARGS(ractl, max_page)); +DECLARE_HOOK(android_vh_cow_user_page, + TP_PROTO(struct vm_fault *vmf, struct page *page), + TP_ARGS(vmf, page)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/memory.c b/mm/memory.c index 5243236f018b..df32008d7c16 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -86,6 +86,7 @@ #include "pgalloc-track.h" #include "internal.h" +#include #define CREATE_TRACE_POINTS #include @@ -3141,6 +3142,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) put_page(old_page); return 0; } + trace_android_vh_cow_user_page(vmf, new_page); } if (mem_cgroup_charge(new_page, mm, GFP_KERNEL)) From 50148ce2498ac7749ac692e7beae2c4224b45a1e Mon Sep 17 00:00:00 2001 From: Bing Han Date: Tue, 28 Jun 2022 13:59:34 +0800 Subject: [PATCH 36/55] ANDROID: vendor_hook: Add hook in do_swap_page() android_vh_swapin_add_anon_rmap: after add pte mapping to an anonymous page durning do_swap_page, update the status that whether this page need to be reclaimed to a swap location, according to the information of vm_fault. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I8a2d603102c315323817e6c9366db9b0da878344 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/memory.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ab0cad1ce365..956e8594bf3d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -408,6 +408,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 68999767a530..6b4d778ad2de 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -152,6 +152,9 @@ DECLARE_HOOK(android_vh_ra_tuning_max_page, DECLARE_HOOK(android_vh_cow_user_page, TP_PROTO(struct vm_fault *vmf, struct page *page), TP_ARGS(vmf, page)); +DECLARE_HOOK(android_vh_swapin_add_anon_rmap, + TP_PROTO(struct vm_fault *vmf, struct page *page), + TP_ARGS(vmf, page)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/memory.c b/mm/memory.c index df32008d7c16..6ba58a781626 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3784,6 +3784,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) do_page_add_anon_rmap(page, vma, vmf->address, exclusive); } + trace_android_vh_swapin_add_anon_rmap(vmf, page); swap_free(entry); if (mem_cgroup_swap_full(page) || (vmf->vma_flags & VM_LOCKED) || PageMlocked(page)) From f7c932399ef129df1ab7ff55eadaa5139a1c5be3 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Tue, 28 Jun 2022 14:07:25 +0800 Subject: [PATCH 37/55] ANDROID: vendor_hook: Add hook in handle_pte_fault() android_vh_handle_pte_fault_end: after handle_pte_fault, update the information that whether this page need to be reclaimed to a swap location. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I0ceb02422fc858ed96fbb47e220bf96bdc8fa68c --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/memory.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 956e8594bf3d..c0855cc0692e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,6 +407,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_pte_fault_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 6b4d778ad2de..3d4bcd79cd34 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -149,6 +149,9 @@ DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, DECLARE_HOOK(android_vh_ra_tuning_max_page, TP_PROTO(struct readahead_control *ractl, unsigned long *max_page), TP_ARGS(ractl, max_page)); +DECLARE_HOOK(android_vh_handle_pte_fault_end, + TP_PROTO(struct vm_fault *vmf, unsigned long highest_memmap_pfn), + TP_ARGS(vmf, highest_memmap_pfn)); DECLARE_HOOK(android_vh_cow_user_page, TP_PROTO(struct vm_fault *vmf, struct page *page), TP_ARGS(vmf, page)); diff --git a/mm/memory.c b/mm/memory.c index 6ba58a781626..7d70acf494d4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4763,6 +4763,7 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf) if (vmf->flags & FAULT_FLAG_WRITE) flush_tlb_fix_spurious_fault(vmf->vma, vmf->address); } + trace_android_vh_handle_pte_fault_end(vmf, highest_memmap_pfn); unlock: pte_unmap_unlock(vmf->pte, vmf->ptl); return ret; From 89a247a6384bf98144ef5588e1cdedee2973c5a4 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 14:54:16 +0800 Subject: [PATCH 38/55] ANDROID: vendor_hook: Add hook in __migration_entry_wait() android_vh_waiting_for_page_migration: provide a vendor hook to force not to reclaim the page under migration to a specified swap location, until the migration is finished. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Iceeae91cbd912d9c44d7eac25f1299bbff547388 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/migrate.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c0855cc0692e..c581527d0397 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -410,6 +410,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_pte_fault_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_waiting_for_page_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 3d4bcd79cd34..9433497b3c7c 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -158,6 +158,9 @@ DECLARE_HOOK(android_vh_cow_user_page, DECLARE_HOOK(android_vh_swapin_add_anon_rmap, TP_PROTO(struct vm_fault *vmf, struct page *page), TP_ARGS(vmf, page)); +DECLARE_HOOK(android_vh_waiting_for_page_migration, + TP_PROTO(struct page *page), + TP_ARGS(page)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/migrate.c b/mm/migrate.c index 26f8595de076..a3cf3d624694 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -54,6 +54,8 @@ #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include #include "internal.h" @@ -311,6 +313,7 @@ void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, if (!get_page_unless_zero(page)) goto out; pte_unmap_unlock(ptep, ptl); + trace_android_vh_waiting_for_page_migration(page); put_and_wait_on_page_locked(page); return; out: From 5bc9b10c45dcb6b8424d9c53cffabe808659e701 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 13:38:38 +0800 Subject: [PATCH 39/55] ANDROID: vendor_hook: Add hook in migrate_page_states() Provide a vendor hook to copy the status whether the page need to be reclaimed to a specified swap location. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I1a451b40407718900b56de6ed17b7fd5ef56da01 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/migrate.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c581527d0397..2d7bed528a89 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -411,6 +411,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_pte_fault_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_waiting_for_page_migration); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_migrate_page_states); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 9433497b3c7c..8e65846d821a 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -161,6 +161,9 @@ DECLARE_HOOK(android_vh_swapin_add_anon_rmap, DECLARE_HOOK(android_vh_waiting_for_page_migration, TP_PROTO(struct page *page), TP_ARGS(page)); +DECLARE_HOOK(android_vh_migrate_page_states, + TP_PROTO(struct page *page, struct page *newpage), + TP_ARGS(page, newpage)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/migrate.c b/mm/migrate.c index a3cf3d624694..6d09285f3c1a 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -587,6 +587,8 @@ void migrate_page_states(struct page *newpage, struct page *page) { int cpupid; + trace_android_vh_migrate_page_states(page, newpage); + if (PageError(page)) SetPageError(newpage); if (PageReferenced(page)) From 851672a4b20e813c5e4f226bf1232645c03c4975 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 15:03:52 +0800 Subject: [PATCH 40/55] ANDROID: vendor_hooks: Add hooks to record the I/O statistics of swap: android_vh_count_pswpin, Update the write I/O statistics of the swap; android_vh_count_pswpout, Update the read I/O statistics of the swap; android_vh_count_swpout_vm_event, Replace count_swpout_vm_event with adding updating the I/O statistics of the swap; Bug: 234214858 Signed-off-by: Bing Han Change-Id: I4eb69db59fe2d822555a508c2f0c6cd5ca9083d1 --- drivers/android/vendor_hooks.c | 3 +++ include/trace/hooks/mm.h | 9 +++++++++ mm/page_io.c | 17 ++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 2d7bed528a89..b013d648356b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -412,6 +412,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_waiting_for_page_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_migrate_page_states); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 8e65846d821a..2b75c4e46f6a 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -164,6 +164,15 @@ DECLARE_HOOK(android_vh_waiting_for_page_migration, DECLARE_HOOK(android_vh_migrate_page_states, TP_PROTO(struct page *page, struct page *newpage), TP_ARGS(page, newpage)); +DECLARE_HOOK(android_vh_count_pswpin, + TP_PROTO(struct swap_info_struct *sis), + TP_ARGS(sis)); +DECLARE_HOOK(android_vh_count_pswpout, + TP_PROTO(struct swap_info_struct *sis), + TP_ARGS(sis)); +DECLARE_HOOK(android_vh_count_swpout_vm_event, + TP_PROTO(struct swap_info_struct *sis, struct page *page, bool *skip), + TP_ARGS(sis, page, skip)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/page_io.c b/mm/page_io.c index d5efe9558b8a..04b3a7ebfe9e 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -25,6 +25,7 @@ #include #include #include +#include static struct bio *get_swap_bio(gfp_t gfp_flags, struct page *page, bio_end_io_t end_io) @@ -256,6 +257,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, struct bio *bio; int ret; struct swap_info_struct *sis = page_swap_info(page); + bool skip = false; VM_BUG_ON_PAGE(!PageSwapCache(page), page); if (data_race(sis->flags & SWP_FS_OPS)) { @@ -277,6 +279,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, unlock_page(page); ret = mapping->a_ops->direct_IO(&kiocb, &from); if (ret == PAGE_SIZE) { + trace_android_vh_count_pswpout(sis); count_vm_event(PSWPOUT); ret = 0; } else { @@ -301,7 +304,9 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc); if (!ret) { - count_swpout_vm_event(page); + trace_android_vh_count_swpout_vm_event(sis, page, &skip); + if (!skip) + count_swpout_vm_event(page); return 0; } @@ -313,7 +318,9 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, } bio->bi_opf = REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc); bio_associate_blkg_from_page(bio, page); - count_swpout_vm_event(page); + trace_android_vh_count_swpout_vm_event(sis, page, &skip); + if (!skip) + count_swpout_vm_event(page); set_page_writeback(page); unlock_page(page); submit_bio(bio); @@ -352,14 +359,17 @@ int swap_readpage(struct page *page, bool synchronous) struct address_space *mapping = swap_file->f_mapping; ret = mapping->a_ops->readpage(swap_file, page); - if (!ret) + if (!ret) { + trace_android_vh_count_pswpin(sis); count_vm_event(PSWPIN); + } goto out; } if (sis->flags & SWP_SYNCHRONOUS_IO) { ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); if (!ret) { + trace_android_vh_count_pswpin(sis); count_vm_event(PSWPIN); goto out; } @@ -383,6 +393,7 @@ int swap_readpage(struct page *page, bool synchronous) get_task_struct(current); bio->bi_private = current; } + trace_android_vh_count_pswpin(sis); count_vm_event(PSWPIN); bio_get(bio); qc = submit_bio(bio); From 1aa26f0017f18e085fb83c582ed27aa9da708c6b Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 15:09:17 +0800 Subject: [PATCH 41/55] ANDROID: vendor_hook: Add hook in page_referenced_one() Add android_vh_page_referenced_one_end at the end of function page_referenced_one to update the status that whether the page need to be reclaimed to a specified swap location. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ia06a229956328ef776da5d163708dcb011a327fb --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/rmap.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b013d648356b..e340569dd60b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -412,6 +412,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_waiting_for_page_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_migrate_page_states); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_one_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 2b75c4e46f6a..66953b1a950f 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -164,6 +164,9 @@ DECLARE_HOOK(android_vh_waiting_for_page_migration, DECLARE_HOOK(android_vh_migrate_page_states, TP_PROTO(struct page *page, struct page *newpage), TP_ARGS(page, newpage)); +DECLARE_HOOK(android_vh_page_referenced_one_end, + TP_PROTO(struct vm_area_struct *vma, struct page *page, int referenced), + TP_ARGS(vma, page, referenced)); DECLARE_HOOK(android_vh_count_pswpin, TP_PROTO(struct swap_info_struct *sis), TP_ARGS(sis)); diff --git a/mm/rmap.c b/mm/rmap.c index 22464daf02d6..1a0a75d8b4ce 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -819,6 +819,7 @@ static bool page_referenced_one(struct page *page, struct vm_area_struct *vma, pra->vm_flags |= vma->vm_flags; } + trace_android_vh_page_referenced_one_end(vma, page, referenced); if (!pra->mapcount) return false; /* To break the loop */ From d2fea0ba9a0827a6731ee454592e3af9514abf5b Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 16:00:22 +0800 Subject: [PATCH 42/55] ANDROID: vendor_hook: Add hook to update nr_swap_pages and total_swap_pages The specified swap is regarded as reserved extended memory. So nr_swap_pages and total_swap_pages should not be affected by the specified swap. Provide a vendor hook android_vh_account_swap_pages to replace the updating process of nr_swap_pages and total_swap_pages. When the page is swapped to the specified swap location, nr_swap_pages and total_swap_pages should not be updated. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ib8dfb355d190399a037b9d9eda478a81c436e224 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/swapfile.c | 29 ++++++++++++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index e340569dd60b..2aa6618d10ae 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -419,3 +419,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 66953b1a950f..dd040e1d1ced 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -179,6 +179,9 @@ DECLARE_HOOK(android_vh_count_swpout_vm_event, DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); +DECLARE_HOOK(android_vh_account_swap_pages, + TP_PROTO(struct swap_info_struct *si, bool *skip), + TP_ARGS(si, skip)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/swapfile.c b/mm/swapfile.c index 646145953eeb..d04aca85d426 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -43,6 +43,7 @@ #include #include #include +#include static bool swap_count_continued(struct swap_info_struct *, pgoff_t, unsigned char); @@ -712,6 +713,7 @@ static void swap_range_free(struct swap_info_struct *si, unsigned long offset, unsigned long begin = offset; unsigned long end = offset + nr_entries - 1; void (*swap_slot_free_notify)(struct block_device *, unsigned long); + bool skip = false; if (offset < si->lowest_bit) si->lowest_bit = offset; @@ -722,7 +724,9 @@ static void swap_range_free(struct swap_info_struct *si, unsigned long offset, if (was_full && (si->flags & SWP_WRITEOK)) add_to_avail_list(si); } - atomic_long_add(nr_entries, &nr_swap_pages); + trace_android_vh_account_swap_pages(si, &skip); + if (!skip) + atomic_long_add(nr_entries, &nr_swap_pages); si->inuse_pages -= nr_entries; if (si->flags & SWP_BLKDEV) swap_slot_free_notify = @@ -1137,6 +1141,7 @@ swp_entry_t get_swap_page_of_type(int type) { struct swap_info_struct *si = swap_type_to_swap_info(type); pgoff_t offset; + bool skip = false; if (!si) goto fail; @@ -1146,7 +1151,9 @@ swp_entry_t get_swap_page_of_type(int type) /* This is called for allocating swap entry, not cache */ offset = scan_swap_map(si, 1); if (offset) { - atomic_long_dec(&nr_swap_pages); + trace_android_vh_account_swap_pages(si, &skip); + if (!skip) + atomic_long_dec(&nr_swap_pages); spin_unlock(&si->lock); return swp_entry(type, offset); } @@ -2499,10 +2506,14 @@ static void setup_swap_info(struct swap_info_struct *p, int prio, static void _enable_swap_info(struct swap_info_struct *p) { - p->flags |= SWP_WRITEOK | SWP_VALID; - atomic_long_add(p->pages, &nr_swap_pages); - total_swap_pages += p->pages; + bool skip = false; + p->flags |= SWP_WRITEOK | SWP_VALID; + trace_android_vh_account_swap_pages(p, &skip); + if (!skip) { + atomic_long_add(p->pages, &nr_swap_pages); + total_swap_pages += p->pages; + } assert_spin_locked(&swap_lock); /* * both lists are plists, and thus priority ordered. @@ -2574,6 +2585,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) struct filename *pathname; int err, found = 0; unsigned int old_block_size; + bool skip = false; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -2628,8 +2640,11 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) least_priority++; } plist_del(&p->list, &swap_active_head); - atomic_long_sub(p->pages, &nr_swap_pages); - total_swap_pages -= p->pages; + trace_android_vh_account_swap_pages(p, &skip); + if (!skip) { + atomic_long_sub(p->pages, &nr_swap_pages); + total_swap_pages -= p->pages; + } p->flags &= ~SWP_WRITEOK; spin_unlock(&p->lock); spin_unlock(&swap_lock); From 7222a0b29b2a530921486bdff962b93b2f02b916 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 18:45:31 +0800 Subject: [PATCH 43/55] ANDROID: vendor_hook: Add hooks in free_swap_slot() Provide a vendor hook to replace the function free_swap_slot, adding the free_swap_slot process of pages swapped to the specified swap location(i.e., the reserved expended memory) Bug: 234214858 Signed-off-by: Bing Han Change-Id: Idd6d0007e64d56d556d1234a8b931fce06031809 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/swap_slots.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 2aa6618d10ae..ade852aa0f9c 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -416,6 +416,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_one_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_swap_slot); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index dd040e1d1ced..a33a701e8ee4 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -176,6 +176,9 @@ DECLARE_HOOK(android_vh_count_pswpout, DECLARE_HOOK(android_vh_count_swpout_vm_event, TP_PROTO(struct swap_info_struct *sis, struct page *page, bool *skip), TP_ARGS(sis, page, skip)); +DECLARE_HOOK(android_vh_free_swap_slot, + TP_PROTO(swp_entry_t entry, struct swap_slots_cache *cache, bool *skip), + TP_ARGS(entry, cache, skip)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 0357fbe70645..25b5f0c6d44b 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -274,8 +274,12 @@ static int refill_swap_slots_cache(struct swap_slots_cache *cache) int free_swap_slot(swp_entry_t entry) { struct swap_slots_cache *cache; + bool skip = false; cache = raw_cpu_ptr(&swp_slots); + trace_android_vh_free_swap_slot(entry, cache, &skip); + if (skip) + return 0; if (likely(use_swap_slot_cache && cache->slots_ret)) { spin_lock_irq(&cache->free_lock); /* Swap slots cache may be deactivated before acquiring lock */ From bc4c73c1820570e4b131a2adb8d2b4ebc84fdeec Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 18:53:44 +0800 Subject: [PATCH 44/55] ANDROID: vendor_hook: Add hooks in unuse_pte_range() and try_to_unuse() When the page is unused, a vendor hook android_vh_unuse_swap_page should be called to specify that the page should not be swapped to the specified swap location any more. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I3fc3675020517f7cc69c76a06150dfb2380dae21 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/swapfile.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ade852aa0f9c..f897daea3aea 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -421,3 +421,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index a33a701e8ee4..6f385db5813b 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -185,6 +185,9 @@ DECLARE_HOOK(android_vh_page_isolated_for_reclaim, DECLARE_HOOK(android_vh_account_swap_pages, TP_PROTO(struct swap_info_struct *si, bool *skip), TP_ARGS(si, skip)); +DECLARE_HOOK(android_vh_unuse_swap_page, + TP_PROTO(struct swap_info_struct *si, struct page *page), + TP_ARGS(si, page)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/swapfile.c b/mm/swapfile.c index d04aca85d426..7d7e9096fec8 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2014,6 +2014,7 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd, } try_to_free_swap(page); + trace_android_vh_unuse_swap_page(si, page); unlock_page(page); put_page(page); @@ -2252,6 +2253,7 @@ int try_to_unuse(unsigned int type, bool frontswap, lock_page(page); wait_on_page_writeback(page); try_to_free_swap(page); + trace_android_vh_unuse_swap_page(si, page); unlock_page(page); put_page(page); From 667f0d71dc08e25bf013cafa617adf6789fe5b93 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 19:00:02 +0800 Subject: [PATCH 45/55] ANDROID: vendor_hooks: Add hooks to extend the struct swap_info_struct Two vendor hooks are added to extend the struct swap_info_struct: android_vh_alloc_si, extend the allocation of struct swap_info_struct, adding data to record the information of specified reclaimed location; android_vh_init_swap_info_struct, adding initializing the extension of struct swap_info_struct; Bug: 234214858 Signed-off-by: Bing Han Change-Id: I0e1d8e38ba7dfd52b609b1c14eb78f8b0ef0f9e6 --- drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/mm.h | 6 ++++++ mm/swapfile.c | 8 ++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index f897daea3aea..6409da002b43 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -422,3 +422,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 6f385db5813b..d05e3bef5e2b 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -188,6 +188,12 @@ DECLARE_HOOK(android_vh_account_swap_pages, DECLARE_HOOK(android_vh_unuse_swap_page, TP_PROTO(struct swap_info_struct *si, struct page *page), TP_ARGS(si, page)); +DECLARE_HOOK(android_vh_init_swap_info_struct, + TP_PROTO(struct swap_info_struct *p, struct plist_head *swap_avail_heads), + TP_ARGS(p, swap_avail_heads)); +DECLARE_HOOK(android_vh_alloc_si, + TP_PROTO(struct swap_info_struct **p, bool *skip), + TP_ARGS(p, skip)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/swapfile.c b/mm/swapfile.c index 7d7e9096fec8..4a41956f1ad1 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2898,12 +2898,15 @@ late_initcall(max_swapfiles_check); static struct swap_info_struct *alloc_swap_info(void) { - struct swap_info_struct *p; + struct swap_info_struct *p = NULL; struct swap_info_struct *defer = NULL; unsigned int type; int i; + bool skip = false; - p = kvzalloc(struct_size(p, avail_lists, nr_node_ids), GFP_KERNEL); + trace_android_vh_alloc_si(&p, &skip); + if (!skip) + p = kvzalloc(struct_size(p, avail_lists, nr_node_ids), GFP_KERNEL); if (!p) return ERR_PTR(-ENOMEM); @@ -3386,6 +3389,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) (swap_flags & SWAP_FLAG_PRIO_MASK) >> SWAP_FLAG_PRIO_SHIFT; enable_swap_info(p, prio, swap_map, cluster_info, frontswap_map); + trace_android_vh_init_swap_info_struct(p, swap_avail_heads); pr_info("Adding %uk swap on %s. Priority:%d extents:%d across:%lluk %s%s%s%s%s\n", p->pages<<(PAGE_SHIFT-10), name->name, p->prio, nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10), From ed2b11d639fabae87d33a9f2c10b15e87b0f4281 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 19:06:18 +0800 Subject: [PATCH 46/55] ANDROID: vendor_hook: Add hook in si_swapinfo() Provide a vendor hook android_vh_si_swapinf to replace the process of updating nr_to_be_unused. When the page is swapped to a specified swap location, nr_to_be_unused should not be updated. Because the specified swap is regarded as a reserved extended memory. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ie41caec345658589bf908fb0f96d038d1fba21f3 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/swapfile.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 6409da002b43..40c0a4d8c41a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -423,4 +423,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_swapinfo); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index d05e3bef5e2b..faab6883a579 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -191,6 +191,9 @@ DECLARE_HOOK(android_vh_unuse_swap_page, DECLARE_HOOK(android_vh_init_swap_info_struct, TP_PROTO(struct swap_info_struct *p, struct plist_head *swap_avail_heads), TP_ARGS(p, swap_avail_heads)); +DECLARE_HOOK(android_vh_si_swapinfo, + TP_PROTO(struct swap_info_struct *si, bool *skip), + TP_ARGS(si, skip)); DECLARE_HOOK(android_vh_alloc_si, TP_PROTO(struct swap_info_struct **p, bool *skip), TP_ARGS(p, skip)); diff --git a/mm/swapfile.c b/mm/swapfile.c index 4a41956f1ad1..2bf47ed376cb 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3454,8 +3454,10 @@ void si_swapinfo(struct sysinfo *val) spin_lock(&swap_lock); for (type = 0; type < nr_swapfiles; type++) { struct swap_info_struct *si = swap_info[type]; + bool skip = false; - if ((si->flags & SWP_USED) && !(si->flags & SWP_WRITEOK)) + trace_android_vh_si_swapinfo(si, &skip); + if (!skip && (si->flags & SWP_USED) && !(si->flags & SWP_WRITEOK)) nr_to_be_unused += si->inuse_pages; } val->freeswap = atomic_long_read(&nr_swap_pages) + nr_to_be_unused; From 4506bcbba5ec78d8d694fbb43e964cfefe900887 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 19:29:05 +0800 Subject: [PATCH 47/55] ANDROID: mm: export swap_type_to_swap_info The function swap_type_to_swap_info is exported to access the swap_info_struct of the specified swap, which is regarded as reserved extended memory. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I0107e7d561150f1945a4c161e886e9e03383fff6 --- mm/swapfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 2bf47ed376cb..3deff9d469e5 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -99,7 +99,7 @@ static atomic_t proc_poll_event = ATOMIC_INIT(0); atomic_t nr_rotate_swap = ATOMIC_INIT(0); -static struct swap_info_struct *swap_type_to_swap_info(int type) +struct swap_info_struct *swap_type_to_swap_info(int type) { if (type >= READ_ONCE(nr_swapfiles)) return NULL; @@ -107,6 +107,7 @@ static struct swap_info_struct *swap_type_to_swap_info(int type) smp_rmb(); /* Pairs with smp_wmb in alloc_swap_info. */ return READ_ONCE(swap_info[type]); } +EXPORT_SYMBOL_GPL(swap_type_to_swap_info); static inline unsigned char swap_count(unsigned char ent) { From d4eef93a9dbf860c43e813be8412ceb01958fcd5 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 16:28:05 +0800 Subject: [PATCH 48/55] ANDROID: vendor_hooks: Add hooks to extend struct swap_slots_cache Three vendor hooks are provided to extend struct swap_slots_cache. The extended data are used to record the information of the specified reclaimed swap location: 1) android_vh_alloc_swap_slot_cache, replace the function alloc_swap_slot_cache adding allocation of the extension of struct swap_slots_cache; 2) android_vh_drain_slots_cache_cpu, replace the function drain_slots_cache_cpu adding the initialization of the extension of struct swap_slots_cache; 3) android_vh_get_swap_page, replace the function get_swap_page, according to the reclaimed location information of the page, get the the swap page from the specified swap location; Bug: 234214858 Signed-off-by: Bing Han Change-Id: I3bce6e8cf255df1d879b7c4022d54981cce7c273 --- drivers/android/vendor_hooks.c | 3 +++ include/trace/hooks/mm.h | 12 ++++++++++++ mm/swap_slots.c | 18 +++++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 40c0a4d8c41a..1f30d49f345b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -416,7 +416,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_one_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drain_slots_cache_cpu); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_swap_slot_cache); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_swap_slot); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_swap_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index faab6883a579..c6f0f726392c 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -33,6 +33,7 @@ struct readahead_control; #include #endif /* __GENKSYMS__ */ struct cma; +struct swap_slots_cache; DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags, TP_PROTO(gfp_t *flags), @@ -176,9 +177,20 @@ DECLARE_HOOK(android_vh_count_pswpout, DECLARE_HOOK(android_vh_count_swpout_vm_event, TP_PROTO(struct swap_info_struct *sis, struct page *page, bool *skip), TP_ARGS(sis, page, skip)); +DECLARE_HOOK(android_vh_drain_slots_cache_cpu, + TP_PROTO(struct swap_slots_cache *cache, unsigned int type, + bool free_slots, bool *skip), + TP_ARGS(cache, type, free_slots, skip)); +DECLARE_HOOK(android_vh_alloc_swap_slot_cache, + TP_PROTO(struct swap_slots_cache *cache, int *ret, bool *skip), + TP_ARGS(cache, ret, skip)); DECLARE_HOOK(android_vh_free_swap_slot, TP_PROTO(swp_entry_t entry, struct swap_slots_cache *cache, bool *skip), TP_ARGS(entry, cache, skip)); +DECLARE_HOOK(android_vh_get_swap_page, + TP_PROTO(struct page *page, swp_entry_t *entry, + struct swap_slots_cache *cache, bool *found), + TP_ARGS(page, entry, cache, found)); DECLARE_HOOK(android_vh_page_isolated_for_reclaim, TP_PROTO(struct mm_struct *mm, struct page *page), TP_ARGS(mm, page)); diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 25b5f0c6d44b..eee97a5f445b 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -33,6 +33,7 @@ #include #include #include +#include static DEFINE_PER_CPU(struct swap_slots_cache, swp_slots); static bool swap_slot_cache_active; @@ -115,12 +116,18 @@ static int alloc_swap_slot_cache(unsigned int cpu) { struct swap_slots_cache *cache; swp_entry_t *slots, *slots_ret; + bool skip = false; + int ret = 0; /* * Do allocation outside swap_slots_cache_mutex * as kvzalloc could trigger reclaim and get_swap_page, * which can lock swap_slots_cache_mutex. */ + trace_android_vh_alloc_swap_slot_cache(&per_cpu(swp_slots, cpu), + &ret, &skip); + if (skip) + return ret; slots = kvcalloc(SWAP_SLOTS_CACHE_SIZE, sizeof(swp_entry_t), GFP_KERNEL); if (!slots) @@ -171,8 +178,13 @@ static void drain_slots_cache_cpu(unsigned int cpu, unsigned int type, { struct swap_slots_cache *cache; swp_entry_t *slots = NULL; + bool skip = false; cache = &per_cpu(swp_slots, cpu); + trace_android_vh_drain_slots_cache_cpu(cache, type, + free_slots, &skip); + if (skip) + return; if ((type & SLOTS_CACHE) && cache->slots) { mutex_lock(&cache->alloc_lock); swapcache_free_entries(cache->slots + cache->cur, cache->nr); @@ -311,9 +323,13 @@ swp_entry_t get_swap_page(struct page *page) { swp_entry_t entry; struct swap_slots_cache *cache; - + bool found = false; entry.val = 0; + trace_android_vh_get_swap_page(page, &entry, raw_cpu_ptr(&swp_slots), &found); + if (found) + goto out; + if (PageTransHuge(page)) { if (IS_ENABLED(CONFIG_THP_SWAP)) get_swap_pages(1, &entry, HPAGE_PMD_NR); From 06c2766cbc9923d67d45fc191c467b5e2685175d Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 19:40:35 +0800 Subject: [PATCH 49/55] ANDROID: mm: export symbols used in vendor hook android_vh_get_swap_page() 3 symbols are exported to be used in vendor hook android_vh_get_swap_page: 1)check_cache_active, used to get swap page from the specified swap location, it's usage is similar to the usage in get_swap_page 2)scan_swap_map_slots, used to get swap page from the specified swap, it's usage is similar to get_swap_pages 3)swap_alloc_cluster, used to get swap page from the specified swap, it's usage is similar to get_swap_pages Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ie24c5d32a16c7cb87905d034095ec8fb070dbe0f --- mm/swap_slots.c | 3 ++- mm/swapfile.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/swap_slots.c b/mm/swap_slots.c index eee97a5f445b..365493578163 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -90,7 +90,7 @@ void reenable_swap_slots_cache_unlock(void) mutex_unlock(&swap_slots_cache_enable_mutex); } -static bool check_cache_active(void) +bool check_cache_active(void) { long pages; @@ -111,6 +111,7 @@ static bool check_cache_active(void) out: return swap_slot_cache_active; } +EXPORT_SYMBOL_GPL(check_cache_active); static int alloc_swap_slot_cache(unsigned int cpu) { diff --git a/mm/swapfile.c b/mm/swapfile.c index 3deff9d469e5..c06259a5b3bd 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -772,7 +772,7 @@ static void set_cluster_next(struct swap_info_struct *si, unsigned long next) this_cpu_write(*si->cluster_next_cpu, next); } -static int scan_swap_map_slots(struct swap_info_struct *si, +int scan_swap_map_slots(struct swap_info_struct *si, unsigned char usage, int nr, swp_entry_t slots[]) { @@ -988,8 +988,9 @@ static int scan_swap_map_slots(struct swap_info_struct *si, si->flags -= SWP_SCANNING; return n_ret; } +EXPORT_SYMBOL_GPL(scan_swap_map_slots); -static int swap_alloc_cluster(struct swap_info_struct *si, swp_entry_t *slot) +int swap_alloc_cluster(struct swap_info_struct *si, swp_entry_t *slot) { unsigned long idx; struct swap_cluster_info *ci; @@ -1023,6 +1024,7 @@ static int swap_alloc_cluster(struct swap_info_struct *si, swp_entry_t *slot) return 1; } +EXPORT_SYMBOL_GPL(swap_alloc_cluster); static void swap_free_cluster(struct swap_info_struct *si, unsigned long idx) { From 034877c19535441fb26f9004c1d3e5820eb8d350 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 20:01:01 +0800 Subject: [PATCH 50/55] ANDROID: mm: export swapcache_free_entries Export swapcache_free_entries to be used in the alternative function android_vh_drain_slots_cache_cpu to swap entries in swap slot cache, it's usage is similar to the usage in drain_slots_cache_cpu. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ia89b1728d540c5cc8995a939a918e12c23057266 --- mm/swapfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/swapfile.c b/mm/swapfile.c index c06259a5b3bd..677f235806c2 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1488,6 +1488,7 @@ void swapcache_free_entries(swp_entry_t *entries, int n) if (p) spin_unlock(&p->lock); } +EXPORT_SYMBOL_GPL(swapcache_free_entries); /* * How many references to page are currently swapped out? From f6f18f7ffab8097bbc72ba2b555327ddfc115066 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Sat, 11 Jun 2022 16:06:16 +0800 Subject: [PATCH 51/55] ANDROID: vendor_hook: Add hook in swap_slots Provide a vendor hook android_vh_swap_slot_cache_active to pass the active status of swap_slots_cache. This status will be used in the process of reclaiming the pages that is required to be reclaimed to a specified swap location. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I8211760e0f37fe4a514f6ceaae9993925da8cd6d --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/swap_slots.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 1f30d49f345b..b35324b886c0 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -416,6 +416,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_one_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swap_slot_cache_active); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drain_slots_cache_cpu); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_swap_slot_cache); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_swap_slot); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index c6f0f726392c..ae93f1916273 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -177,6 +177,9 @@ DECLARE_HOOK(android_vh_count_pswpout, DECLARE_HOOK(android_vh_count_swpout_vm_event, TP_PROTO(struct swap_info_struct *sis, struct page *page, bool *skip), TP_ARGS(sis, page, skip)); +DECLARE_HOOK(android_vh_swap_slot_cache_active, + TP_PROTO(bool swap_slot_cache_active), + TP_ARGS(swap_slot_cache_active)); DECLARE_HOOK(android_vh_drain_slots_cache_cpu, TP_PROTO(struct swap_slots_cache *cache, unsigned int type, bool free_slots, bool *skip), diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 365493578163..a200aafc0a36 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -55,6 +55,7 @@ static void deactivate_swap_slots_cache(void) { mutex_lock(&swap_slots_cache_mutex); swap_slot_cache_active = false; + trace_android_vh_swap_slot_cache_active(false); __drain_swap_slots_cache(SLOTS_CACHE|SLOTS_CACHE_RET); mutex_unlock(&swap_slots_cache_mutex); } @@ -63,6 +64,7 @@ static void reactivate_swap_slots_cache(void) { mutex_lock(&swap_slots_cache_mutex); swap_slot_cache_active = true; + trace_android_vh_swap_slot_cache_active(true); mutex_unlock(&swap_slots_cache_mutex); } From e064059673798b931f95f724c7e377fa8cd15df7 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 16:39:40 +0800 Subject: [PATCH 52/55] ANDROID: create and export is_swap_slot_cache_enabled Create and export a function is_swap_slot_cache_enabled to check whether the swap slot cache can be used. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Iaca9519b838e0c3c8c06acbec83003f8309aa363 --- mm/swap_slots.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/swap_slots.c b/mm/swap_slots.c index a200aafc0a36..1392649a4d9a 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -92,6 +92,12 @@ void reenable_swap_slots_cache_unlock(void) mutex_unlock(&swap_slots_cache_enable_mutex); } +bool is_swap_slot_cache_enabled(void) +{ + return swap_slot_cache_enabled; +} +EXPORT_SYMBOL_GPL(is_swap_slot_cache_enabled); + bool check_cache_active(void) { long pages; From 01680ae117e650bbc7b4c2714165218e019efebe Mon Sep 17 00:00:00 2001 From: Bing Han Date: Sat, 11 Jun 2022 18:24:07 +0800 Subject: [PATCH 53/55] ANDROID: vendor_hook: Add hook in __free_pages() Provide a vendor hook android_vh_free_pages to clear the information in struct page_ext, when the page is freed. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Iac8e3a72f59f8d3ae16dbc93d94034fe4b627d61 --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/page_alloc.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b35324b886c0..a6c589b266da 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -429,3 +429,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_swapinfo); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index ae93f1916273..91d9172c6b4a 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -212,6 +212,9 @@ DECLARE_HOOK(android_vh_si_swapinfo, DECLARE_HOOK(android_vh_alloc_si, TP_PROTO(struct swap_info_struct **p, bool *skip), TP_ARGS(p, skip)); +DECLARE_HOOK(android_vh_free_pages, + TP_PROTO(struct page *page, unsigned int order), + TP_ARGS(page, order)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9209be35258a..27b18887bf5f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5180,6 +5180,7 @@ static inline void free_the_page(struct page *page, unsigned int order) void __free_pages(struct page *page, unsigned int order) { + trace_android_vh_free_pages(page, order); if (put_page_testzero(page)) free_the_page(page, order); else if (!PageHead(page)) From 5b696d45bf3c9f18fd719a4ed6ba904ca3c337b1 Mon Sep 17 00:00:00 2001 From: Duoming Zhou Date: Fri, 29 Apr 2022 20:45:51 +0800 Subject: [PATCH 54/55] BACKPORT: nfc: nfcmrvl: main: reorder destructive operations in nfcmrvl_nci_unregister_dev to avoid bugs commit d270453a0d9ec10bb8a802a142fb1b3601a83098 upstream. There are destructive operations such as nfcmrvl_fw_dnld_abort and gpio_free in nfcmrvl_nci_unregister_dev. The resources such as firmware, gpio and so on could be destructed while the upper layer functions such as nfcmrvl_fw_dnld_start and nfcmrvl_nci_recv_frame is executing, which leads to double-free, use-after-free and null-ptr-deref bugs. There are three situations that could lead to double-free bugs. The first situation is shown below: (Thread 1) | (Thread 2) nfcmrvl_fw_dnld_start | ... | nfcmrvl_nci_unregister_dev release_firmware() | nfcmrvl_fw_dnld_abort kfree(fw) //(1) | fw_dnld_over | release_firmware ... | kfree(fw) //(2) | ... The second situation is shown below: (Thread 1) | (Thread 2) nfcmrvl_fw_dnld_start | ... | mod_timer | (wait a time) | fw_dnld_timeout | nfcmrvl_nci_unregister_dev fw_dnld_over | nfcmrvl_fw_dnld_abort release_firmware | fw_dnld_over kfree(fw) //(1) | release_firmware ... | kfree(fw) //(2) The third situation is shown below: (Thread 1) | (Thread 2) nfcmrvl_nci_recv_frame | if(..->fw_download_in_progress)| nfcmrvl_fw_dnld_recv_frame | queue_work | | fw_dnld_rx_work | nfcmrvl_nci_unregister_dev fw_dnld_over | nfcmrvl_fw_dnld_abort release_firmware | fw_dnld_over kfree(fw) //(1) | release_firmware | kfree(fw) //(2) The firmware struct is deallocated in position (1) and deallocated in position (2) again. The crash trace triggered by POC is like below: BUG: KASAN: double-free or invalid-free in fw_dnld_over Call Trace: kfree fw_dnld_over nfcmrvl_nci_unregister_dev nci_uart_tty_close tty_ldisc_kill tty_ldisc_hangup __tty_hangup.part.0 tty_release ... What's more, there are also use-after-free and null-ptr-deref bugs in nfcmrvl_fw_dnld_start. If we deallocate firmware struct, gpio or set null to the members of priv->fw_dnld in nfcmrvl_nci_unregister_dev, then, we dereference firmware, gpio or the members of priv->fw_dnld in nfcmrvl_fw_dnld_start, the UAF or NPD bugs will happen. This patch reorders destructive operations after nci_unregister_device in order to synchronize between cleanup routine and firmware download routine. The nci_unregister_device is well synchronized. If the device is detaching, the firmware download routine will goto error. If firmware download routine is executing, nci_unregister_device will wait until firmware download routine is finished. Bug: 234690530 Fixes: 3194c6870158 ("NFC: nfcmrvl: add firmware download support") Signed-off-by: Duoming Zhou Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Signed-off-by: Lee Jones Change-Id: I8cc1f6450c7fecf5f5994033931da1d23a522282 --- drivers/nfc/nfcmrvl/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index 529be35ac178..54d228acc0f5 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -194,6 +194,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) { struct nci_dev *ndev = priv->ndev; + nci_unregister_device(ndev); if (priv->ndev->nfc_dev->fw_download_in_progress) nfcmrvl_fw_dnld_abort(priv); @@ -202,7 +203,6 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) if (gpio_is_valid(priv->config.reset_n_io)) gpio_free(priv->config.reset_n_io); - nci_unregister_device(ndev); nci_free_device(ndev); kfree(priv); } From b3898383081097524bf3fdd905f96ffc97d0f8ee Mon Sep 17 00:00:00 2001 From: Bing Han Date: Thu, 30 Jun 2022 14:54:37 +0800 Subject: [PATCH 55/55] ANDROID: GKI: Add symbols to abi_gki_aarch64_transsion In order to make better use of the limited memory resources, we develop a memory expansion solution to expand the memory size avaliable to the system. Need add some symbols to abi_gki_aarch64_transsion. Leaf changes summary: 7 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 7 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 7 Added functions: [A] 'function bool check_cache_active()' [A] 'function mem_cgroup* get_mem_cgroup_from_mm(mm_struct*)' [A] 'function bool is_swap_slot_cache_enabled()' [A] 'function int scan_swap_map_slots(swap_info_struct*, unsigned char, int, swp_entry_t*)' [A] 'function int swap_alloc_cluster(swap_info_struct*, swp_entry_t*)' [A] 'function swap_info_struct* swap_type_to_swap_info(int)' [A] 'function void swapcache_free_entries(swp_entry_t*, int)' Bug: 234214858 Signed-off-by: Bing Han Change-Id: I9cafdf1ee646becff7431014452866b0bfa14eb4 --- android/abi_gki_aarch64.xml | 1360 ++++++++++++++--------------- android/abi_gki_aarch64_transsion | 8 + build.config.gki.aarch64 | 1 + 3 files changed, 688 insertions(+), 681 deletions(-) create mode 100644 android/abi_gki_aarch64_transsion diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 251da9a8b3dc..fbbcdb424bf5 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -1052,6 +1052,7 @@ + @@ -2615,6 +2616,7 @@ + @@ -3101,6 +3103,7 @@ + @@ -4515,6 +4518,7 @@ + @@ -5124,6 +5128,9 @@ + + + @@ -40273,6 +40280,7 @@ + @@ -92016,20 +92024,7 @@ - - - - - - - - - - - - - - + @@ -106762,35 +106757,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -116083,12 +116050,12 @@ - - + + - - + + @@ -116570,11 +116537,11 @@ - - - - - + + + + + @@ -116597,23 +116564,23 @@ - - - + + + - - - - - + + + + + - - - - - + + + + + @@ -116627,39 +116594,39 @@ - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + @@ -116667,10 +116634,10 @@ - - - - + + + + @@ -116679,11 +116646,11 @@ - - - - - + + + + + @@ -116728,11 +116695,11 @@ - - - - - + + + + + @@ -116742,36 +116709,36 @@ - - - - - + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -116780,14 +116747,14 @@ - - - + + + - - - + + + @@ -116835,18 +116802,18 @@ - - - - - - - + + + + + + + - - - + + + @@ -116856,19 +116823,19 @@ - - - - - + + + + + - - - - - - + + + + + + @@ -116888,9 +116855,9 @@ - - - + + + @@ -116910,113 +116877,113 @@ - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - + + + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + @@ -117030,43 +116997,43 @@ - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - - - - + + + + + - - - + + + @@ -117075,24 +117042,24 @@ - - - + + + - - - + + + - - - + + + - - - + + + @@ -117130,25 +117097,25 @@ - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + @@ -117182,9 +117149,9 @@ - - - + + + @@ -117419,16 +117386,16 @@ - - - - + + + + - - - - + + + + @@ -117475,25 +117442,25 @@ - - - - - - - - + + + + + + + + - - - + + + - - - - + + + + @@ -117566,37 +117533,37 @@ - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + @@ -117612,10 +117579,10 @@ - - - - + + + + @@ -117624,22 +117591,22 @@ - - - + + + - - - - + + + + - - - - - + + + + + @@ -117718,11 +117685,11 @@ - - - - - + + + + + @@ -117736,11 +117703,11 @@ - - - - - + + + + + @@ -117795,9 +117762,9 @@ - - - + + + @@ -117812,11 +117779,11 @@ - - - - - + + + + + @@ -117831,14 +117798,14 @@ - - - - - - - - + + + + + + + + @@ -117848,52 +117815,52 @@ - - - + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - - + + + + @@ -117956,19 +117923,19 @@ - - - - - - - + + + + + + + - - - - + + + + @@ -118000,14 +117967,14 @@ - - - - - - - - + + + + + + + + @@ -118040,16 +118007,16 @@ - - - - + + + + - - - - + + + + @@ -118065,9 +118032,9 @@ - - - + + + @@ -118149,10 +118116,10 @@ - - - - + + + + @@ -118176,10 +118143,10 @@ - - - - + + + + @@ -118187,10 +118154,10 @@ - - - - + + + + @@ -118262,12 +118229,12 @@ - - - - - - + + + + + + @@ -118829,27 +118796,27 @@ - + - - - + + + - - - - - + + + + + - + - + - + @@ -118858,15 +118825,15 @@ - + - - - - + + + + - - + + @@ -118874,52 +118841,52 @@ - - + + - - + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - + + + + @@ -118927,14 +118894,14 @@ - - - + + + - + @@ -118968,8 +118935,8 @@ - - + + @@ -118977,9 +118944,9 @@ - - - + + + @@ -118991,18 +118958,18 @@ - - - + + + - + - + - - - + + + @@ -119016,11 +118983,11 @@ - + - + @@ -119030,22 +118997,22 @@ - + - + - + - - - - - - - - + + + + + + + + @@ -119054,11 +119021,11 @@ - + - - + + @@ -119066,7 +119033,7 @@ - + @@ -119079,12 +119046,12 @@ - - + + - + @@ -119099,21 +119066,21 @@ - + - + - + - + @@ -119121,7 +119088,7 @@ - + @@ -119146,7 +119113,7 @@ - + @@ -119619,12 +119586,12 @@ - - - - - - + + + + + + @@ -119663,11 +119630,11 @@ - - - - - + + + + + @@ -119709,9 +119676,9 @@ - - - + + + @@ -119828,9 +119795,9 @@ - - - + + + @@ -121083,11 +121050,11 @@ - - - - - + + + + + @@ -121412,6 +121379,9 @@ + + + @@ -123208,21 +123178,21 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + @@ -128798,10 +128768,10 @@ - - - - + + + + @@ -128852,14 +128822,14 @@ - - - + + + - - - + + + @@ -129661,6 +129631,10 @@ + + + + @@ -130352,7 +130326,7 @@ - + @@ -132144,6 +132118,9 @@ + + + @@ -133560,30 +133537,30 @@ - - - + + + - - - - - + + + + + - - - + + + - - - - - - - + + + + + + + @@ -133787,11 +133764,11 @@ - - - - - + + + + + @@ -135585,8 +135562,8 @@ - - + + @@ -137693,8 +137670,8 @@ - - + + @@ -138595,12 +138572,12 @@ - - - - - - + + + + + + @@ -139296,6 +139273,13 @@ + + + + + + + @@ -140414,15 +140398,15 @@ - + - - + + - - + + @@ -141179,7 +141163,7 @@ - + @@ -141234,11 +141218,11 @@ - - - - - + + + + + @@ -142517,14 +142501,28 @@ + + + + + + + + + + + + + + - - + + @@ -143301,11 +143299,11 @@ - - - - - + + + + + @@ -144221,11 +144219,11 @@ - - - - - + + + + + @@ -146523,22 +146521,22 @@ - - - - + + + + - - - - + + + + - - - - + + + + @@ -146609,23 +146607,23 @@ - - - - + + + + - - - - + + + + - - - - - + + + + + diff --git a/android/abi_gki_aarch64_transsion b/android/abi_gki_aarch64_transsion new file mode 100644 index 000000000000..7538d32cf51b --- /dev/null +++ b/android/abi_gki_aarch64_transsion @@ -0,0 +1,8 @@ +[abi_symbol_list] + get_mem_cgroup_from_mm + is_swap_slot_cache_enabled + swapcache_free_entries + swap_type_to_swap_info + scan_swap_map_slots + swap_alloc_cluster + check_cache_active diff --git a/build.config.gki.aarch64 b/build.config.gki.aarch64 index 37a8271fd178..9e70748400a1 100644 --- a/build.config.gki.aarch64 +++ b/build.config.gki.aarch64 @@ -29,6 +29,7 @@ android/abi_gki_aarch64_virtual_device android/abi_gki_aarch64_vivo android/abi_gki_aarch64_xiaomi android/abi_gki_aarch64_asus +android/abi_gki_aarch64_transsion " FILES="${FILES}