From 997e6b3f6a219013a180c38dcac18a27bd045c5a Mon Sep 17 00:00:00 2001 From: Will McVicker Date: Thu, 30 May 2024 13:00:52 -0700 Subject: [PATCH 01/93] Revert "crypto: api - Disallow identical driver names" This reverts commit 680eb0a99336f7b21ff149bc57579d059421c5de which is commit 27016f75f5ed47e2d8e0ca75a8ff1f40bc1a5e27 upstream. This breaks for devices that use the downstream fips140 module. Bug: 335718233 Bug: 335830134 Signed-off-by: Will McVicker (cherry picked from https://android-review.googlesource.com/q/commit:0cf5cecba66e91b69268fd87ded20e755bee1938) Merged-In: Ie465403c40fe75fee5934ea160b86a4c77ef8f17 Change-Id: Ie465403c40fe75fee5934ea160b86a4c77ef8f17 --- crypto/algapi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/crypto/algapi.c b/crypto/algapi.c index 05a39b80aabe..60b98d2c400e 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -329,7 +329,6 @@ __crypto_register_alg(struct crypto_alg *alg, struct list_head *algs_to_put) } if (!strcmp(q->cra_driver_name, alg->cra_name) || - !strcmp(q->cra_driver_name, alg->cra_driver_name) || !strcmp(q->cra_name, alg->cra_driver_name)) goto err; } From bd2bcb81d4ebcffd4e56bb8dfe3e3d4c871928f5 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 28 May 2024 11:43:53 +0000 Subject: [PATCH 02/93] BACKPORT: net: fix __dst_negative_advice() race __dst_negative_advice() does not enforce proper RCU rules when sk->dst_cache must be cleared, leading to possible UAF. RCU rules are that we must first clear sk->sk_dst_cache, then call dst_release(old_dst). Note that sk_dst_reset(sk) is implementing this protocol correctly, while __dst_negative_advice() uses the wrong order. Given that ip6_negative_advice() has special logic against RTF_CACHE, this means each of the three ->negative_advice() existing methods must perform the sk_dst_reset() themselves. Note the check against NULL dst is centralized in __dst_negative_advice(), there is no need to duplicate it in various callbacks. Many thanks to Clement Lecigne for tracking this issue. This old bug became visible after the blamed commit, using UDP sockets. Bug: 343727534 Fixes: a87cb3e48ee8 ("net: Facility to report route quality of connected sockets") Reported-by: Clement Lecigne Diagnosed-by: Clement Lecigne Signed-off-by: Eric Dumazet Cc: Tom Herbert Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20240528114353.1794151-1-edumazet@google.com Signed-off-by: Jakub Kicinski (cherry picked from commit 92f1655aa2b2294d0b49925f3b875a634bd3b59e) [Lee: Trivial/unrelated conflict - no change to the patch] Signed-off-by: Lee Jones Change-Id: I293734dca1b81fcb712e1de294f51e96a405f7e4 Signed-off-by: Greg Kroah-Hartman --- include/net/dst_ops.h | 2 +- include/net/sock.h | 13 +++---------- net/ipv4/route.c | 22 ++++++++-------------- net/ipv6/route.c | 29 +++++++++++++++-------------- net/xfrm/xfrm_policy.c | 11 +++-------- 5 files changed, 30 insertions(+), 47 deletions(-) diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index 88ff7bb2bb9b..dd7c0b37da38 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h @@ -24,7 +24,7 @@ struct dst_ops { void (*destroy)(struct dst_entry *); void (*ifdown)(struct dst_entry *, struct net_device *dev, int how); - struct dst_entry * (*negative_advice)(struct dst_entry *); + void (*negative_advice)(struct sock *sk, struct dst_entry *); void (*link_failure)(struct sk_buff *); void (*update_pmtu)(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu, diff --git a/include/net/sock.h b/include/net/sock.h index 239c15f28c97..7f9d5c974e79 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2215,17 +2215,10 @@ sk_dst_get(struct sock *sk) static inline void __dst_negative_advice(struct sock *sk) { - struct dst_entry *ndst, *dst = __sk_dst_get(sk); + struct dst_entry *dst = __sk_dst_get(sk); - if (dst && dst->ops->negative_advice) { - ndst = dst->ops->negative_advice(dst); - - if (ndst != dst) { - rcu_assign_pointer(sk->sk_dst_cache, ndst); - sk_tx_queue_clear(sk); - WRITE_ONCE(sk->sk_dst_pending_confirm, 0); - } - } + if (dst && dst->ops->negative_advice) + dst->ops->negative_advice(sk, dst); } static inline void dst_negative_advice(struct sock *sk) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 474f391fab35..abd866109896 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -132,7 +132,8 @@ struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); static unsigned int ipv4_default_advmss(const struct dst_entry *dst); INDIRECT_CALLABLE_SCOPE unsigned int ipv4_mtu(const struct dst_entry *dst); -static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); +static void ipv4_negative_advice(struct sock *sk, + struct dst_entry *dst); static void ipv4_link_failure(struct sk_buff *skb); static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu, @@ -837,22 +838,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf __ip_do_redirect(rt, skb, &fl4, true); } -static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) +static void ipv4_negative_advice(struct sock *sk, + struct dst_entry *dst) { struct rtable *rt = (struct rtable *)dst; - struct dst_entry *ret = dst; - if (rt) { - if (dst->obsolete > 0) { - ip_rt_put(rt); - ret = NULL; - } else if ((rt->rt_flags & RTCF_REDIRECTED) || - rt->dst.expires) { - ip_rt_put(rt); - ret = NULL; - } - } - return ret; + if ((dst->obsolete > 0) || + (rt->rt_flags & RTCF_REDIRECTED) || + rt->dst.expires) + sk_dst_reset(sk); } /* diff --git a/net/ipv6/route.c b/net/ipv6/route.c index af4fe30f8574..8d88b46e3963 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -87,7 +87,8 @@ struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); static unsigned int ip6_default_advmss(const struct dst_entry *dst); INDIRECT_CALLABLE_SCOPE unsigned int ip6_mtu(const struct dst_entry *dst); -static struct dst_entry *ip6_negative_advice(struct dst_entry *); +static void ip6_negative_advice(struct sock *sk, + struct dst_entry *dst); static void ip6_dst_destroy(struct dst_entry *); static void ip6_dst_ifdown(struct dst_entry *, struct net_device *dev, int how); @@ -2762,24 +2763,24 @@ INDIRECT_CALLABLE_SCOPE struct dst_entry *ip6_dst_check(struct dst_entry *dst, } EXPORT_INDIRECT_CALLABLE(ip6_dst_check); -static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) +static void ip6_negative_advice(struct sock *sk, + struct dst_entry *dst) { struct rt6_info *rt = (struct rt6_info *) dst; - if (rt) { - if (rt->rt6i_flags & RTF_CACHE) { - rcu_read_lock(); - if (rt6_check_expired(rt)) { - rt6_remove_exception_rt(rt); - dst = NULL; - } - rcu_read_unlock(); - } else { - dst_release(dst); - dst = NULL; + if (rt->rt6i_flags & RTF_CACHE) { + rcu_read_lock(); + if (rt6_check_expired(rt)) { + /* counteract the dst_release() in sk_dst_reset() */ + dst_hold(dst); + sk_dst_reset(sk); + + rt6_remove_exception_rt(rt); } + rcu_read_unlock(); + return; } - return dst; + sk_dst_reset(sk); } static void ip6_link_failure(struct sk_buff *skb) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 1adfb277e246..e0ac3962224d 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -3774,15 +3774,10 @@ static void xfrm_link_failure(struct sk_buff *skb) /* Impossible. Such dst must be popped before reaches point of failure. */ } -static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst) +static void xfrm_negative_advice(struct sock *sk, struct dst_entry *dst) { - if (dst) { - if (dst->obsolete) { - dst_release(dst); - dst = NULL; - } - } - return dst; + if (dst->obsolete) + sk_dst_reset(sk); } static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr) From a7462d7032e5ed971980180c6a5aadc8ad700331 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 1 Jun 2024 09:33:51 +0000 Subject: [PATCH 03/93] ANDROID: ABI fixup for abi break in struct dst_ops In commit 92f1655aa2b2 ("net: fix __dst_negative_advice() race") the struct dst_ops callback negative_advice is callback changes function parameters. But as this pointer is part of a structure that is tracked in the ABI checker, the tool triggers when this is changed. However, the callback pointer is internal to the networking stack, so changing the function type is safe, so needing to preserve this is not required. To do so, switch the function pointer type back to the old one so that the checking tools pass, AND then do a hard cast of the function pointer to the new type when assigning and calling the function. [6.1.y backport note, work around --Werror=cast-function-type issue by abusing void * for function pointer types, despite its best effort, C still let's us shoot our foot off if we really want to!] Bug: 343727534 Fixes: 92f1655aa2b2 ("net: fix __dst_negative_advice() race") Change-Id: I48d4ab4bbd29f8edc8fbd7923828b7f78a23e12e Signed-off-by: Greg Kroah-Hartman --- include/net/dst_ops.h | 12 +++++++++++- include/net/sock.h | 14 ++++++++++++-- net/ipv4/route.c | 2 +- net/ipv6/route.c | 2 +- net/xfrm/xfrm_policy.c | 2 +- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index dd7c0b37da38..382af5f36e7f 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h @@ -12,6 +12,16 @@ struct sk_buff; struct sock; struct net; +/* *** ANDROID FIXUP *** + * These typedefs are used to help fixup the ABI break caused by commit + * 92f1655aa2b2 ("net: fix __dst_negative_advice() race") where the + * negative_advice callback changed function signatures. + * See b/343727534 for more details. + * *** ANDROID FIXUP *** + */ +typedef void (*android_dst_ops_negative_advice_new_t)(struct sock *sk, struct dst_entry *); +typedef struct dst_entry * (*android_dst_ops_negative_advice_old_t)(struct dst_entry *); + struct dst_ops { unsigned short family; unsigned int gc_thresh; @@ -24,7 +34,7 @@ struct dst_ops { void (*destroy)(struct dst_entry *); void (*ifdown)(struct dst_entry *, struct net_device *dev, int how); - void (*negative_advice)(struct sock *sk, struct dst_entry *); + struct dst_entry * (*negative_advice)(struct dst_entry *); void (*link_failure)(struct sk_buff *); void (*update_pmtu)(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, u32 mtu, diff --git a/include/net/sock.h b/include/net/sock.h index 7f9d5c974e79..104128387226 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2215,10 +2215,20 @@ sk_dst_get(struct sock *sk) static inline void __dst_negative_advice(struct sock *sk) { + /* *** ANDROID FIXUP *** + * See b/343727534 for more details why this typedef is needed here. + * *** ANDROID FIXUP *** + */ + android_dst_ops_negative_advice_new_t negative_advice; + void *c_is_fun; /* Work around --Werror=cast-function-type */ + struct dst_entry *dst = __sk_dst_get(sk); - if (dst && dst->ops->negative_advice) - dst->ops->negative_advice(sk, dst); + if (dst && dst->ops->negative_advice) { + c_is_fun = dst->ops->negative_advice; + negative_advice = c_is_fun; + negative_advice(sk, dst); + } } static inline void dst_negative_advice(struct sock *sk) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index abd866109896..82a2c4db8f14 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -160,7 +160,7 @@ static struct dst_ops ipv4_dst_ops = { .mtu = ipv4_mtu, .cow_metrics = ipv4_cow_metrics, .destroy = ipv4_dst_destroy, - .negative_advice = ipv4_negative_advice, + .negative_advice = (void *)ipv4_negative_advice, .link_failure = ipv4_link_failure, .update_pmtu = ip_rt_update_pmtu, .redirect = ip_do_redirect, diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8d88b46e3963..1c00695a97af 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -258,7 +258,7 @@ static struct dst_ops ip6_dst_ops_template = { .cow_metrics = dst_cow_metrics_generic, .destroy = ip6_dst_destroy, .ifdown = ip6_dst_ifdown, - .negative_advice = ip6_negative_advice, + .negative_advice = (void *)ip6_negative_advice, .link_failure = ip6_link_failure, .update_pmtu = ip6_rt_update_pmtu, .redirect = rt6_do_redirect, diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index e0ac3962224d..3c42dd426a5b 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -3945,7 +3945,7 @@ int xfrm_policy_register_afinfo(const struct xfrm_policy_afinfo *afinfo, int fam if (likely(dst_ops->mtu == NULL)) dst_ops->mtu = xfrm_mtu; if (likely(dst_ops->negative_advice == NULL)) - dst_ops->negative_advice = xfrm_negative_advice; + dst_ops->negative_advice = (void *)xfrm_negative_advice; if (likely(dst_ops->link_failure == NULL)) dst_ops->link_failure = xfrm_link_failure; if (likely(dst_ops->neigh_lookup == NULL)) From c36abc6d421299349517e171acd36a5a5e8bdc83 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Mon, 5 Jun 2023 21:59:39 -0300 Subject: [PATCH 04/93] BACKPORT: iommu: Have __iommu_probe_device() check for already probed devices This is a step toward making __iommu_probe_device() self contained. It should, under proper locking, check if the device is already associated with an iommu driver and resolve parallel probes. All but one of the callers open code this test using two different means, but they all rely on dev->iommu_group. Currently the bus_iommu_probe()/probe_iommu_group() and probe_acpi_namespace_devices() rejects already probed devices with an unlocked read of dev->iommu_group. The OF and ACPI "replay" functions use device_iommu_mapped() which is the same read without the pointless refcount. Move this test into __iommu_probe_device() and put it under the iommu_probe_device_lock. The store to dev->iommu_group is in iommu_group_add_device() which is also called under this lock for iommu driver devices, making it properly locked. The only path that didn't have this check is the hotplug path triggered by BUS_NOTIFY_ADD_DEVICE. The only way to get dev->iommu_group assigned outside the probe path is via iommu_group_add_device(). Today the only caller is VFIO no-iommu which never associates with an iommu driver. Thus adding this additional check is safe. Bug: 337990354 Reviewed-by: Kevin Tian Reviewed-by: Lu Baolu Acked-by: Rafael J. Wysocki Signed-off-by: Jason Gunthorpe Link: https://lore.kernel.org/r/1-v3-328044aa278c+45e49-iommu_probe_jgg@nvidia.com Signed-off-by: Joerg Roedel (cherry picked from commit 6eb4da8cf54537992fc9843be8b2af4f83f717e0) Change-Id: I079ee5467e96367a5e1aa2ae5f0d5f6837df597c [quic_nprakash: Resolved conflicts in drivers/iommu/iommu.c] Signed-off-by: Nikhil V --- drivers/acpi/scan.c | 2 +- drivers/iommu/intel/iommu.c | 7 ------- drivers/iommu/iommu.c | 19 +++++++++---------- drivers/iommu/of_iommu.c | 2 +- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 94154a849a3e..a3f2af72b9b8 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1584,7 +1584,7 @@ static const struct iommu_ops *acpi_iommu_configure_id(struct device *dev, * If we have reason to believe the IOMMU driver missed the initial * iommu_probe_device() call for dev, replay it to get things in order. */ - if (!err && dev->bus && !device_iommu_mapped(dev)) + if (!err && dev->bus) err = iommu_probe_device(dev); /* Ignore all other errors apart from EPROBE_DEFER */ diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 820ad242a23c..442ed4246f2e 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3893,7 +3893,6 @@ static int __init probe_acpi_namespace_devices(void) for_each_active_dev_scope(drhd->devices, drhd->devices_cnt, i, dev) { struct acpi_device_physical_node *pn; - struct iommu_group *group; struct acpi_device *adev; if (dev->bus != &acpi_bus_type) @@ -3903,12 +3902,6 @@ static int __init probe_acpi_namespace_devices(void) mutex_lock(&adev->physical_node_lock); list_for_each_entry(pn, &adev->physical_node_list, node) { - group = iommu_group_get(pn->dev); - if (group) { - iommu_group_put(group); - continue; - } - ret = iommu_probe_device(pn->dev); if (ret) break; diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 5ce7ec724a40..343482649b24 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -327,9 +327,16 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list * but for now enforcing a simple global ordering is fine. */ lockdep_assert_held(&iommu_probe_device_lock); + + /* Device is probed already if in a group */ + if (dev->iommu_group) { + ret = 0; + goto out_unlock; + } + if (!dev_iommu_get(dev)) { ret = -ENOMEM; - goto err_out; + goto out_unlock; } if (!try_module_get(ops->owner)) { @@ -372,7 +379,7 @@ out_module_put: err_free: dev_iommu_free(dev); -err_out: +out_unlock: return ret; } @@ -1706,16 +1713,8 @@ struct iommu_domain *iommu_group_default_domain(struct iommu_group *group) static int probe_iommu_group(struct device *dev, void *data) { struct list_head *group_list = data; - struct iommu_group *group; int ret; - /* Device is probed already if in a group */ - group = iommu_group_get(dev); - if (group) { - iommu_group_put(group); - return 0; - } - mutex_lock(&iommu_probe_device_lock); ret = __iommu_probe_device(dev, group_list); mutex_unlock(&iommu_probe_device_lock); diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 47bf96fc0c45..e5057c464f9c 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -166,7 +166,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, * If we have reason to believe the IOMMU driver missed the initial * probe for dev, replay it to get things in order. */ - if (!err && dev->bus && !device_iommu_mapped(dev)) + if (!err && dev->bus) err = iommu_probe_device(dev); /* Ignore all other errors apart from EPROBE_DEFER */ From c5abb61725163f04b21dc6bf36d926aa75d67115 Mon Sep 17 00:00:00 2001 From: Seiya Wang Date: Tue, 4 Jun 2024 15:20:18 +0800 Subject: [PATCH 05/93] ANDROID: GKI: Update symbol list for mtk 10 function symbol(s) added 'struct fwnode_handle* fwnode_get_next_available_child_node(const struct fwnode_handle*, struct fwnode_handle*)' 'int genphy_c45_aneg_done(struct phy_device*)' 'int genphy_c45_pma_read_abilities(struct phy_device*)' 'int genphy_c45_read_lpa(struct phy_device*)' 'int genphy_read_master_slave(struct phy_device*)' 'unsigned int linear_range_get_max_value(const struct linear_range*)' 'int linear_range_get_selector_high(const struct linear_range*, unsigned int, unsigned int*, bool*)' 'int phy_get_c45_ids(struct phy_device*)' 'int regulator_get_bypass_regmap(struct regulator_dev*, bool*)' 'int regulator_set_bypass_regmap(struct regulator_dev*, bool)' Bug: 344729193 Change-Id: I2c3a565d9693baa19224cc4d0dd633ae14b2a38e Signed-off-by: Seiya Wang --- android/abi_gki_aarch64.stg | 113 ++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_mtk | 12 ++++ 2 files changed, 125 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 184a3b5106ba..5d63dac8a63e 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -312127,6 +312127,14 @@ function { parameter_id: 0x24265283 parameter_id: 0x00c72527 } +function { + id: 0x91508dc4 + return_type_id: 0x6720d32f + parameter_id: 0x37030053 + parameter_id: 0x4585663f + parameter_id: 0x1bf16028 + parameter_id: 0x11cfee5a +} function { id: 0x9150cafb return_type_id: 0x6720d32f @@ -335205,6 +335213,11 @@ function { parameter_id: 0x0258f96e parameter_id: 0x4585663f } +function { + id: 0xc31bbeef + return_type_id: 0x4585663f + parameter_id: 0x37030053 +} function { id: 0xc3320c3e return_type_id: 0x4585663f @@ -369532,6 +369545,15 @@ elf_symbol { type_id: 0x361bd1c4 full_name: "fwnode_get_named_child_node" } +elf_symbol { + id: 0xbf494c6d + name: "fwnode_get_next_available_child_node" + is_defined: true + symbol_type: FUNCTION + crc: 0x1193babb + type_id: 0x36f1d1fd + full_name: "fwnode_get_next_available_child_node" +} elf_symbol { id: 0x55d636ec name: "fwnode_get_next_child_node" @@ -370342,6 +370364,15 @@ elf_symbol { type_id: 0x91dd4b0e full_name: "genphy_c45_an_config_aneg" } +elf_symbol { + id: 0x5106e385 + name: "genphy_c45_aneg_done" + is_defined: true + symbol_type: FUNCTION + crc: 0x4e3d8f63 + type_id: 0x91dd4b0e + full_name: "genphy_c45_aneg_done" +} elf_symbol { id: 0x084b19b7 name: "genphy_c45_check_and_restart_aneg" @@ -370360,6 +370391,15 @@ elf_symbol { type_id: 0x9068b671 full_name: "genphy_c45_fast_retrain" } +elf_symbol { + id: 0xb0dc66ba + name: "genphy_c45_pma_read_abilities" + is_defined: true + symbol_type: FUNCTION + crc: 0xbf06f92c + type_id: 0x91dd4b0e + full_name: "genphy_c45_pma_read_abilities" +} elf_symbol { id: 0xd99708c7 name: "genphy_c45_pma_setup_forced" @@ -370369,6 +370409,15 @@ elf_symbol { type_id: 0x91dd4b0e full_name: "genphy_c45_pma_setup_forced" } +elf_symbol { + id: 0x8dcdde77 + name: "genphy_c45_read_lpa" + is_defined: true + symbol_type: FUNCTION + crc: 0x5a8145ef + type_id: 0x91dd4b0e + full_name: "genphy_c45_read_lpa" +} elf_symbol { id: 0xa3a0e5a9 name: "genphy_c45_read_status" @@ -370414,6 +370463,15 @@ elf_symbol { type_id: 0x91dd4b0e full_name: "genphy_read_lpa" } +elf_symbol { + id: 0x0331e2f2 + name: "genphy_read_master_slave" + is_defined: true + symbol_type: FUNCTION + crc: 0x879dd522 + type_id: 0x91dd4b0e + full_name: "genphy_read_master_slave" +} elf_symbol { id: 0xbaba47ed name: "genphy_read_mmd_unsupported" @@ -378581,6 +378639,24 @@ elf_symbol { type_id: 0x92811dff full_name: "led_update_flash_brightness" } +elf_symbol { + id: 0xe30546d3 + name: "linear_range_get_max_value" + is_defined: true + symbol_type: FUNCTION + crc: 0xd5301b2c + type_id: 0xc31bbeef + full_name: "linear_range_get_max_value" +} +elf_symbol { + id: 0xb514ffaf + name: "linear_range_get_selector_high" + is_defined: true + symbol_type: FUNCTION + crc: 0x69ee2220 + type_id: 0x91508dc4 + full_name: "linear_range_get_selector_high" +} elf_symbol { id: 0x7d03c60e name: "linear_range_get_selector_within" @@ -385924,6 +386000,15 @@ elf_symbol { type_id: 0x1154b37f full_name: "phy_get" } +elf_symbol { + id: 0xa1f2194b + name: "phy_get_c45_ids" + is_defined: true + symbol_type: FUNCTION + crc: 0x5a859e47 + type_id: 0x91dd4b0e + full_name: "phy_get_c45_ids" +} elf_symbol { id: 0x7de90fab name: "phy_get_pause" @@ -390352,6 +390437,15 @@ elf_symbol { type_id: 0x8556217d full_name: "regulator_get" } +elf_symbol { + id: 0x0fbaa7b3 + name: "regulator_get_bypass_regmap" + is_defined: true + symbol_type: FUNCTION + crc: 0x1f7e03b8 + type_id: 0x9e19cd45 + full_name: "regulator_get_bypass_regmap" +} elf_symbol { id: 0x90e2334a name: "regulator_get_current_limit" @@ -390577,6 +390671,15 @@ elf_symbol { type_id: 0x9feb0f83 full_name: "regulator_set_active_discharge_regmap" } +elf_symbol { + id: 0xc9c5804a + name: "regulator_set_bypass_regmap" + is_defined: true + symbol_type: FUNCTION + crc: 0x8e1fe459 + type_id: 0x9feb0f83 + full_name: "regulator_set_bypass_regmap" +} elf_symbol { id: 0xce959ab5 name: "regulator_set_current_limit" @@ -412806,6 +412909,7 @@ interface { symbol_id: 0xc9ddb79e symbol_id: 0x11780300 symbol_id: 0x183013c2 + symbol_id: 0xbf494c6d symbol_id: 0x55d636ec symbol_id: 0xff713254 symbol_id: 0x02e45228 @@ -412896,14 +413000,18 @@ interface { symbol_id: 0xa0c0d25f symbol_id: 0xb87c5ff6 symbol_id: 0xd1e108fe + symbol_id: 0x5106e385 symbol_id: 0x084b19b7 symbol_id: 0x607c937c + symbol_id: 0xb0dc66ba symbol_id: 0xd99708c7 + symbol_id: 0x8dcdde77 symbol_id: 0xa3a0e5a9 symbol_id: 0x07b1add0 symbol_id: 0x618539bc symbol_id: 0xe00705b3 symbol_id: 0xcaf802e6 + symbol_id: 0x0331e2f2 symbol_id: 0xbaba47ed symbol_id: 0x67f44b83 symbol_id: 0x97ef6102 @@ -413811,6 +413919,8 @@ interface { symbol_id: 0x61d92429 symbol_id: 0xf4949824 symbol_id: 0xf48c4979 + symbol_id: 0xe30546d3 + symbol_id: 0xb514ffaf symbol_id: 0x7d03c60e symbol_id: 0x6149caff symbol_id: 0x91e9c466 @@ -414627,6 +414737,7 @@ interface { symbol_id: 0x6cf83bd0 symbol_id: 0xd23d219e symbol_id: 0x0dfe21ad + symbol_id: 0xa1f2194b symbol_id: 0x7de90fab symbol_id: 0x30e87de6 symbol_id: 0x6fc1e83f @@ -415119,6 +415230,7 @@ interface { symbol_id: 0xc91eefc6 symbol_id: 0x7511baca symbol_id: 0x29553efc + symbol_id: 0x0fbaa7b3 symbol_id: 0x90e2334a symbol_id: 0xfd198070 symbol_id: 0x4a781b7f @@ -415144,6 +415256,7 @@ interface { symbol_id: 0xfd977d86 symbol_id: 0xddb9ed35 symbol_id: 0x21d8367b + symbol_id: 0xc9c5804a symbol_id: 0xce959ab5 symbol_id: 0x41f70cdb symbol_id: 0x805d1994 diff --git a/android/abi_gki_aarch64_mtk b/android/abi_gki_aarch64_mtk index b836bc579e1a..bb18c96d361e 100644 --- a/android/abi_gki_aarch64_mtk +++ b/android/abi_gki_aarch64_mtk @@ -985,6 +985,7 @@ fsg_config_from_params fwnode_device_is_available fwnode_get_name + fwnode_get_next_available_child_node fwnode_graph_get_next_endpoint fwnode_graph_get_port_parent fwnode_graph_get_remote_endpoint @@ -1009,7 +1010,11 @@ genlmsg_put genl_register_family genl_unregister_family + genphy_c45_aneg_done + genphy_c45_pma_read_abilities + genphy_c45_read_lpa __genphy_config_aneg + genphy_read_master_slave genphy_read_status genphy_resume genphy_soft_reset @@ -1448,6 +1453,8 @@ led_trigger_unregister led_update_brightness led_update_flash_brightness + linear_range_get_max_value + linear_range_get_selector_high linear_range_get_selector_within linear_range_get_value linkwatch_fire_event @@ -1904,6 +1911,7 @@ phy_exit phy_find_first phy_get + phy_get_c45_ids phy_get_pause phy_init phy_init_eee @@ -2184,6 +2192,7 @@ regulator_enable regulator_enable_regmap regulator_get + regulator_get_bypass_regmap regulator_get_current_limit_regmap regulator_get_mode regulator_get_optional @@ -2201,6 +2210,7 @@ regulator_notifier_call_chain regulator_put regulator_set_active_discharge_regmap + regulator_set_bypass_regmap regulator_set_current_limit regulator_set_current_limit_regmap regulator_set_load @@ -3107,6 +3117,7 @@ usb_debug_root usb_del_gadget_udc usb_deregister + usb_deregister_device_driver usb_disabled usb_driver_claim_interface usb_driver_release_interface @@ -3173,6 +3184,7 @@ usb_put_hcd usb_put_intf usb_queue_reset_device + usb_register_device_driver usb_register_driver usb_remove_function usb_remove_hcd From e2c5ee3d15086f6e9f8e0f6990f38c5bace8f07d Mon Sep 17 00:00:00 2001 From: Udipto Goswami Date: Tue, 4 Jun 2024 13:51:03 +0530 Subject: [PATCH 06/93] ANDROID: ABI: Add usb_gadget_connect & usb_gadget_disconnect symbol Add the usb gadget connect/disconnect symbols to ABI to be used by vendor driver: usb_gadget_connect usb_gadget_disconnect Bug: 344835325 Change-Id: I506d142ed863e6ce0d21b7a0e31c1721f6bdba93 Signed-off-by: Udipto Goswami --- android/abi_gki_aarch64_qcom | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index ba3c1dfb35ff..bec840c8b61d 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -3837,6 +3837,8 @@ usb_free_urb usb_function_register usb_function_unregister + usb_gadget_connect + usb_gadget_disconnect usb_gadget_wakeup usb_get_dev usb_get_from_anchor From 9fcc2459efcdfef478ebda39ec8e2e18de090fa3 Mon Sep 17 00:00:00 2001 From: Xin Deng Date: Fri, 26 Apr 2024 02:25:01 -0700 Subject: [PATCH 07/93] UPSTREAM: wifi: cfg80211: Clear mlo_links info when STA disconnects wdev->valid_links is not cleared when upper layer disconnect from a wdev->AP MLD. It has been observed that this would prevent offchannel operations like remain-on-channel which would be needed for user space operations with Public Action frame. Clear the wdev->valid_links when STA disconnects. Signed-off-by: Xin Deng Link: https://msgid.link/20240426092501.8592-1-quic_deng@quicinc.com Signed-off-by: Johannes Berg Bug: 344476904 Change-Id: Ie84dda35e26d2792ed39f50d0c3f959682730d89 (cherry picked from commit 9f6d4b8d149af8dc3f9a1e3000168b99ca576390) Signed-off-by: Xin Deng --- net/wireless/sme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 73be3d0e995a..ef56d2dd115a 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -1351,6 +1351,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, return; cfg80211_wdev_release_bsses(wdev); + wdev->valid_links = 0; wdev->connected = false; wdev->u.client.ssid_len = 0; wdev->conn_owner_nlportid = 0; From 3c19f7015ee303dd2171755eb764a33e63970f07 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 31 May 2024 16:51:18 -0700 Subject: [PATCH 08/93] ANDROID: set rewrite_absolute_paths_in_config for GKI aarch64. For GKI targets with kmi_symbol_list set, also set rewrite_absolute_paths_in_config to True so that CONFIG_UNUSED_KSYMS_WHITELIST is not an absolute path any more, increasing reproducibility on different machines. This is made possible with c6427490abb1 "Revert^2 "BACKPORT: FROMGIT: module: allow UNUSED_KSYMS_WHITELIST to be relative against objtree."" so that Kbuild recognizes relative paths by searching $(objtree) first. This does not change x86 builds because it doesn't have kmi_symbol_list set. This change does not affect device builds like db845c, rockpi and fips140. Adding the attribute to these targets would be okay, but it is not covered by this change. Bug: 333769605 Bug: 342390208 Change-Id: I844c251979bae5277474837eaa055f1346b0afa2 Signed-off-by: Yifan Hong --- BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index 36dd531b3295..33677cee37d8 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -134,6 +134,7 @@ define_common_kernels(target_configs = { "kmi_symbol_list_strict_mode": True, "module_implicit_outs": get_gki_modules_list("arm64"), "kmi_symbol_list": "android/abi_gki_aarch64", + "rewrite_absolute_paths_in_config": True, "kmi_symbol_list_add_only": True, "additional_kmi_symbol_lists": [":aarch64_additional_kmi_symbol_lists"], "protected_exports_list": "android/abi_gki_protected_exports_aarch64", @@ -149,6 +150,7 @@ define_common_kernels(target_configs = { "kmi_symbol_list_strict_mode": False, "module_implicit_outs": get_gki_modules_list("arm64"), "kmi_symbol_list": "android/abi_gki_aarch64", + "rewrite_absolute_paths_in_config": True, "kmi_symbol_list_add_only": True, "additional_kmi_symbol_lists": [":aarch64_additional_kmi_symbol_lists"], "protected_exports_list": "android/abi_gki_protected_exports_aarch64", From 163070bc796e86affbdedf8d5648cb361db14f43 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Thu, 24 Nov 2022 17:04:28 +0000 Subject: [PATCH 09/93] UPSTREAM: usb: gadget: f_fs: use io_data->status consistently Commit fb1f16d74e26 ("usb: gadget: f_fs: change ep->status safe in ffs_epfile_io()") added a new ffs_io_data::status field to fix lifetime issues in synchronous requests. While there are no similar lifetime issues for asynchronous requests (the separate ep member in ffs_io_data avoids them) using the status field means the USB request can be freed earlier and that there is more consistency between the synchronous and asynchronous I/O paths. Cc: Linyu Yuan Signed-off-by: John Keeping Reviewed-by: Linyu Yuan Link: https://lore.kernel.org/r/20221124170430.3998755-1-john@metanate.com Signed-off-by: Greg Kroah-Hartman Bug: 334976932 (cherry picked from commit b566d38857fcb6777f25b674b90a831eec0817a2) Change-Id: I8cd4d95ff6ec694adac3881da80eff23f6c679d4 Signed-off-by: Prashanth K --- drivers/usb/gadget/function/f_fs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 3e59055aa504..0caa97b34c04 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -830,8 +830,7 @@ static void ffs_user_copy_worker(struct work_struct *work) { struct ffs_io_data *io_data = container_of(work, struct ffs_io_data, work); - int ret = io_data->req->status ? io_data->req->status : - io_data->req->actual; + int ret = io_data->status; bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; if (io_data->read && ret > 0) { @@ -845,8 +844,6 @@ static void ffs_user_copy_worker(struct work_struct *work) if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) eventfd_signal(io_data->ffs->ffs_eventfd, 1); - usb_ep_free_request(io_data->ep, io_data->req); - if (io_data->read) kfree(io_data->to_free); ffs_free_buffer(io_data); @@ -861,6 +858,9 @@ static void ffs_epfile_async_io_complete(struct usb_ep *_ep, ENTER(); + io_data->status = req->status ? req->status : req->actual; + usb_ep_free_request(_ep, req); + INIT_WORK(&io_data->work, ffs_user_copy_worker); queue_work(ffs->io_completion_wq, &io_data->work); } From 986fffb5900457d03e49604faf376cc0c6cef39c Mon Sep 17 00:00:00 2001 From: Wesley Cheng Date: Mon, 8 Apr 2024 18:40:59 -0700 Subject: [PATCH 10/93] UPSTREAM: usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete FFS based applications can utilize the aio_cancel() callback to dequeue pending USB requests submitted to the UDC. There is a scenario where the FFS application issues an AIO cancel call, while the UDC is handling a soft disconnect. For a DWC3 based implementation, the callstack looks like the following: DWC3 Gadget FFS Application dwc3_gadget_soft_disconnect() ... --> dwc3_stop_active_transfers() --> dwc3_gadget_giveback(-ESHUTDOWN) --> ffs_epfile_async_io_complete() ffs_aio_cancel() --> usb_ep_free_request() --> usb_ep_dequeue() There is currently no locking implemented between the AIO completion handler and AIO cancel, so the issue occurs if the completion routine is running in parallel to an AIO cancel call coming from the FFS application. As the completion call frees the USB request (io_data->req) the FFS application is also referencing it for the usb_ep_dequeue() call. This can lead to accessing a stale/hanging pointer. commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently") relocated the usb_ep_free_request() into ffs_epfile_async_io_complete(). However, in order to properly implement locking to mitigate this issue, the spinlock can't be added to ffs_epfile_async_io_complete(), as usb_ep_dequeue() (if successfully dequeuing a USB request) will call the function driver's completion handler in the same context. Hence, leading into a deadlock. Fix this issue by moving the usb_ep_free_request() back to ffs_user_copy_worker(), and ensuring that it explicitly sets io_data->req to NULL after freeing it within the ffs->eps_lock. This resolves the race condition above, as the ffs_aio_cancel() routine will not continue attempting to dequeue a request that has already been freed, or the ffs_user_copy_work() not freeing the USB request until the AIO cancel is done referencing it. This fix depends on commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently") Fixes: 2e4c7553cd6f ("usb: gadget: f_fs: add aio support") Cc: stable # b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently") Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/20240409014059.6740-1-quic_wcheng@quicinc.com Signed-off-by: Greg Kroah-Hartman Bug: 334976932 (cherry picked from commit 24729b307eefcd7c476065cd7351c1a018082c19) Change-Id: I56f6b9d24c239e73edff94e1f9f33ab41a9bd37b Signed-off-by: Prashanth K --- drivers/usb/gadget/function/f_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 0caa97b34c04..f2b92bce3c4a 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -832,6 +832,7 @@ static void ffs_user_copy_worker(struct work_struct *work) work); int ret = io_data->status; bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD; + unsigned long flags; if (io_data->read && ret > 0) { kthread_use_mm(io_data->mm); @@ -844,6 +845,11 @@ static void ffs_user_copy_worker(struct work_struct *work) if (io_data->ffs->ffs_eventfd && !kiocb_has_eventfd) eventfd_signal(io_data->ffs->ffs_eventfd, 1); + spin_lock_irqsave(&io_data->ffs->eps_lock, flags); + usb_ep_free_request(io_data->ep, io_data->req); + io_data->req = NULL; + spin_unlock_irqrestore(&io_data->ffs->eps_lock, flags); + if (io_data->read) kfree(io_data->to_free); ffs_free_buffer(io_data); @@ -859,7 +865,6 @@ static void ffs_epfile_async_io_complete(struct usb_ep *_ep, ENTER(); io_data->status = req->status ? req->status : req->actual; - usb_ep_free_request(_ep, req); INIT_WORK(&io_data->work, ffs_user_copy_worker); queue_work(ffs->io_completion_wq, &io_data->work); From f601b06a7e9082a1fee0e777c031985d4055dcdc Mon Sep 17 00:00:00 2001 From: Bian Jin chen Date: Wed, 5 Jun 2024 19:53:31 +0800 Subject: [PATCH 11/93] ANDROID: GKI: Update rockchip symbols for snd multi dais. 2 function symbol(s) added 'void snd_pcm_stream_lock_irq(struct snd_pcm_substream*)' 'void snd_pcm_stream_unlock_irq(struct snd_pcm_substream*)' Bug: 300024866 Signed-off-by: Bian Jin chen Change-Id: Ic35b2fc03132b0fb7edd5df3e4393109d7b47302 --- android/abi_gki_aarch64.stg | 20 ++++++++++++++++++++ android/abi_gki_aarch64_rockchip | 16 +++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 5d63dac8a63e..efea1ee7ab36 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -395919,6 +395919,24 @@ elf_symbol { type_id: 0x98aeb261 full_name: "snd_pcm_stop_xrun" } +elf_symbol { + id: 0x058fca14 + name: "snd_pcm_stream_lock_irq" + is_defined: true + symbol_type: FUNCTION + crc: 0xd42f1f6f + type_id: 0x15b600dd + full_name: "snd_pcm_stream_lock_irq" +} +elf_symbol { + id: 0x13b4eef8 + name: "snd_pcm_stream_unlock_irq" + is_defined: true + symbol_type: FUNCTION + crc: 0x6db54e0d + type_id: 0x15b600dd + full_name: "snd_pcm_stream_unlock_irq" +} elf_symbol { id: 0x1fcc9eb7 name: "snd_pcm_suspend_all" @@ -415839,6 +415857,8 @@ interface { symbol_id: 0xb2f7eb17 symbol_id: 0x8eb5b50d symbol_id: 0xc26d0753 + symbol_id: 0x058fca14 + symbol_id: 0x13b4eef8 symbol_id: 0x1fcc9eb7 symbol_id: 0x1f5649eb symbol_id: 0x31ef5894 diff --git a/android/abi_gki_aarch64_rockchip b/android/abi_gki_aarch64_rockchip index 5c3c52b7b61c..2fc8bb160328 100644 --- a/android/abi_gki_aarch64_rockchip +++ b/android/abi_gki_aarch64_rockchip @@ -1115,6 +1115,7 @@ snd_soc_daifmt_parse_clock_provider_raw snd_soc_daifmt_parse_format snd_soc_dai_set_sysclk + snd_soc_dai_set_tdm_slot snd_soc_dapm_add_routes snd_soc_dapm_disable_pin_unlocked snd_soc_dapm_force_enable_pin_unlocked @@ -1138,6 +1139,7 @@ snd_soc_pm_ops snd_soc_put_enum_double snd_soc_put_volsw + snd_soc_set_runtime_hwparams snd_soc_unregister_component snprintf sort @@ -2708,6 +2710,19 @@ # required by snd-soc-rockchip-hdmi.ko snd_soc_dapm_new_widgets +# required by snd-soc-rockchip-multi-dais.ko + dma_get_slave_caps + snd_hwparams_to_dma_slave_config + snd_pcm_lib_free_pages + snd_pcm_lib_ioctl + snd_pcm_lib_malloc_pages + snd_pcm_lib_preallocate_pages + snd_pcm_stream_lock_irq + snd_pcm_stream_unlock_irq + snd_soc_dai_set_fmt + snd_soc_find_dai_with_mutex + snd_soc_rtdcom_lookup + # required by snd-soc-rockchip-multicodecs.ko snd_soc_dapm_get_pin_switch snd_soc_dapm_info_pin_switch @@ -2745,7 +2760,6 @@ snd_pcm_hw_constraint_minmax snd_soc_component_set_sysclk snd_soc_dai_active - snd_soc_dai_set_tdm_slot snd_soc_of_parse_audio_simple_widgets snd_soc_of_parse_pin_switches snd_soc_runtime_calc_hw From e4622d460ed869bf74116c281c7612e8d9968306 Mon Sep 17 00:00:00 2001 From: Bian Jin chen Date: Wed, 5 Jun 2024 20:07:50 +0800 Subject: [PATCH 12/93] ANDROID: GKI: Update rockchip symbols for rndis_host. 3 function symbol(s) added 'void usbnet_cdc_unbind(struct usbnet*, struct usb_interface*)' 'int usbnet_cdc_zte_rx_fixup(struct usbnet*, struct sk_buff*)' 'int usbnet_generic_cdc_bind(struct usbnet*, struct usb_interface*)' Bug: 300024866 Signed-off-by: Bian Jin chen Change-Id: Ibd1798bc17f99767507eec2fb8ca7e1608e16488 --- android/abi_gki_aarch64.stg | 30 ++++++++++++++++++++++++++++++ android/abi_gki_aarch64_rockchip | 3 +++ 2 files changed, 33 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index efea1ee7ab36..ddb15937378d 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -404922,6 +404922,24 @@ elf_symbol { type_id: 0x12d17df8 full_name: "usb_wakeup_notification" } +elf_symbol { + id: 0x1227900d + name: "usbnet_cdc_unbind" + is_defined: true + symbol_type: FUNCTION + crc: 0x2e5cd3da + type_id: 0x136e318e + full_name: "usbnet_cdc_unbind" +} +elf_symbol { + id: 0x8189acd0 + name: "usbnet_cdc_zte_rx_fixup" + is_defined: true + symbol_type: FUNCTION + crc: 0xc11ed7fa + type_id: 0x9ee7a4e9 + full_name: "usbnet_cdc_zte_rx_fixup" +} elf_symbol { id: 0xbbf007f4 name: "usbnet_change_mtu" @@ -404949,6 +404967,15 @@ elf_symbol { type_id: 0x18d9f669 full_name: "usbnet_disconnect" } +elf_symbol { + id: 0xe395160a + name: "usbnet_generic_cdc_bind" + is_defined: true + symbol_type: FUNCTION + crc: 0xb379792d + type_id: 0x9e768332 + full_name: "usbnet_generic_cdc_bind" +} elf_symbol { id: 0x8f0c866d name: "usbnet_get_drvinfo" @@ -416858,9 +416885,12 @@ interface { symbol_id: 0xcac8f190 symbol_id: 0x9ea1c58f symbol_id: 0x140d9164 + symbol_id: 0x1227900d + symbol_id: 0x8189acd0 symbol_id: 0xbbf007f4 symbol_id: 0xd28057f3 symbol_id: 0x580c56b8 + symbol_id: 0xe395160a symbol_id: 0x8f0c866d symbol_id: 0x52816b1c symbol_id: 0x4f4e9353 diff --git a/android/abi_gki_aarch64_rockchip b/android/abi_gki_aarch64_rockchip index 2fc8bb160328..96cf93d04fbb 100644 --- a/android/abi_gki_aarch64_rockchip +++ b/android/abi_gki_aarch64_rockchip @@ -1248,9 +1248,12 @@ usb_hcd_resume_root_hub usb_hcd_unlink_urb_from_ep usb_hid_driver + usbnet_cdc_unbind + usbnet_cdc_zte_rx_fixup usbnet_change_mtu usbnet_defer_kevent usbnet_disconnect + usbnet_generic_cdc_bind usbnet_get_drvinfo usbnet_get_endpoints usbnet_get_link From cf4893eb9563703e691118e6ed6d4eb7cb9bbbd0 Mon Sep 17 00:00:00 2001 From: Qais Yousef Date: Fri, 23 Feb 2024 15:57:48 +0000 Subject: [PATCH 13/93] BACKPORT: sched: Add a new function to compare if two cpus have the same capacity The new helper function is needed to help blk-mq check if it needs to dispatch the softirq on another CPU to match the performance level the IO requester is running at. This is important on HMP systems where not all CPUs have the same compute capacity. Bug: 341551538 Signed-off-by: Qais Yousef Reviewed-by: Bart Van Assche Link: https://lore.kernel.org/r/20240223155749.2958009-2-qyousef@layalina.io Signed-off-by: Jens Axboe (cherry picked from commit b361c9027b4e4159e7bcca4eb64fd26507c19994) [Trivial clash due to some code shuffling between versions] Signed-off-by: Qais Yousef (cherry picked from https://android-review.googlesource.com/q/commit:ee8168e00c6e4fb04bea953bacb61ff017a39f63) Merged-In: I58f3f3e3560f4800b5c73b3c85bbfdf628e9764e Change-Id: I58f3f3e3560f4800b5c73b3c85bbfdf628e9764e --- include/linux/sched/topology.h | 6 ++++++ kernel/sched/core.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index d51e2645bc47..f5e5e045ed72 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -186,6 +186,7 @@ extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], cpumask_var_t *alloc_sched_domains(unsigned int ndoms); void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); +bool cpus_equal_capacity(int this_cpu, int that_cpu); bool cpus_share_cache(int this_cpu, int that_cpu); typedef const struct cpumask *(*sched_domain_mask_f)(int cpu); @@ -235,6 +236,11 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], { } +static inline bool cpus_equal_capacity(int this_cpu, int that_cpu) +{ + return true; +} + static inline bool cpus_share_cache(int this_cpu, int that_cpu) { return true; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 1e5dc0964c7b..6f1d576c28bd 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3959,6 +3959,17 @@ out: } EXPORT_SYMBOL_GPL(wake_up_if_idle); +bool cpus_equal_capacity(int this_cpu, int that_cpu) +{ + if (!sched_asym_cpucap_active()) + return true; + + if (this_cpu == that_cpu) + return true; + + return arch_scale_cpu_capacity(this_cpu) == arch_scale_cpu_capacity(that_cpu); +} + bool cpus_share_cache(int this_cpu, int that_cpu) { if (this_cpu == that_cpu) From bfacfd198eca12125d8b39682c70c8c16caf55f5 Mon Sep 17 00:00:00 2001 From: Qais Yousef Date: Fri, 23 Feb 2024 15:57:49 +0000 Subject: [PATCH 14/93] UPSTREAM: block/blk-mq: Don't complete locally if capacities are different The logic in blk_mq_complete_need_ipi() assumes SMP systems where all CPUs have equal compute capacities and only LLC cache can make a different on perceived performance. But this assumption falls apart on HMP systems where LLC is shared, but the CPUs have different capacities. Staying local then can have a big performance impact if the IO request was done from a CPU with higher capacity but the interrupt is serviced on a lower capacity CPU. Use the new cpus_equal_capacity() function to check if we need to send an IPI. Without the patch I see the BLOCK softirq always running on little cores (where the hardirq is serviced). With it I can see it running on all cores. This was noticed after the topology change [1] where now on a big.LITTLE we truly get that the LLC is shared between all cores where as in the past it was being misrepresented for historical reasons. The logic exposed a missing dependency on capacities for such systems where there can be a big performance difference between the CPUs. This of course introduced a noticeable change in behavior depending on how the topology is presented. Leading to regressions in some workloads as the performance of the BLOCK softirq on littles can be noticeably worse on some platforms. Worth noting that we could have checked for capacities being greater than or equal instead for equality. This will lead to favouring higher performance always. But opted for equality instead to match the performance of the requester without making an assumption that can lead to power trade-offs which these systems tend to be sensitive about. If the requester would like to run faster, it's better to rely on the scheduler to give the IO requester via some facility to run on a faster core; and then if the interrupt triggered on a CPU with different capacity we'll make sure to match the performance the requester is supposed to run at. [1] https://lpc.events/event/16/contributions/1342/attachments/962/1883/LPC-2022-Android-MC-Phantom-Domains.pdf Bug: 341551538 Signed-off-by: Qais Yousef Reviewed-by: Bart Van Assche Link: https://lore.kernel.org/r/20240223155749.2958009-3-qyousef@layalina.io Signed-off-by: Jens Axboe (cherry picked from commit af550e4c968294398fc76b075f12d51c76caf753) Signed-off-by: Qais Yousef (cherry picked from https://android-review.googlesource.com/q/commit:d01dc1c7d020f49f31194254a89694bd23ad3dd5) Merged-In: Iefed6a19b9d25102642e264118431f5e12e23fea Change-Id: Iefed6a19b9d25102642e264118431f5e12e23fea --- block/blk-mq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index b47d0c2c8f07..467423944444 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1145,10 +1145,11 @@ static inline bool blk_mq_complete_need_ipi(struct request *rq) if (force_irqthreads()) return false; - /* same CPU or cache domain? Complete locally */ + /* same CPU or cache domain and capacity? Complete locally */ if (cpu == rq->mq_ctx->cpu || (!test_bit(QUEUE_FLAG_SAME_FORCE, &rq->q->queue_flags) && - cpus_share_cache(cpu, rq->mq_ctx->cpu))) + cpus_share_cache(cpu, rq->mq_ctx->cpu) && + cpus_equal_capacity(cpu, rq->mq_ctx->cpu))) return false; /* don't try to IPI to an offline CPU */ From 62a4d78ddaf114c0a367cceb4d0ebf2149239681 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 6 Jun 2024 16:16:11 +0800 Subject: [PATCH 15/93] ANDROID: GKI: Update oplus symbol list 17 function symbol(s) added 'void __netif_schedule(struct Qdisc*)' 'void __qdisc_calculate_pkt_len(struct sk_buff*, const struct qdisc_size_table*)' 'void gnet_stats_add_queue(struct gnet_stats_queue*, const struct gnet_stats_queue*, const struct gnet_stats_queue*)' 'int gnet_stats_copy_basic(struct gnet_dump*, struct gnet_stats_basic_sync*, struct gnet_stats_basic_sync*, bool)' 'int gnet_stats_copy_queue(struct gnet_dump*, struct gnet_stats_queue*, struct gnet_stats_queue*, __u32)' 'void psched_ratecfg_precompute(struct psched_ratecfg*, const struct tc_ratespec*, u64)' 'struct Qdisc* qdisc_create_dflt(struct netdev_queue*, const struct Qdisc_ops*, unsigned int, struct netlink_ext_ack*)' 'void qdisc_hash_add(struct Qdisc*, bool)' 'void qdisc_put(struct Qdisc*)' 'void qdisc_reset(struct Qdisc*)' 'void qdisc_tree_reduce_backlog(struct Qdisc*, int, int)' 'void qdisc_watchdog_cancel(struct qdisc_watchdog*)' 'void qdisc_watchdog_init(struct qdisc_watchdog*, struct Qdisc*)' 'void qdisc_watchdog_schedule_range_ns(struct qdisc_watchdog*, u64, u64)' 'int tcf_block_get(struct tcf_block**, struct tcf_proto**, struct Qdisc*, struct netlink_ext_ack*)' 'void tcf_block_put(struct tcf_block*)' 'int tcf_classify(struct sk_buff*, const struct tcf_block*, const struct tcf_proto*, struct tcf_result*, bool)' 2 variable symbol(s) added 'struct Qdisc noop_qdisc' 'struct Qdisc_ops pfifo_qdisc_ops' Bug: 344702684 Change-Id: I42fa44b9e95c24b0ef3347f837561e79913878b9 Signed-off-by: Wei Liu --- android/abi_gki_aarch64.stg | 468 ++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_oplus | 19 ++ 2 files changed, 487 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index ddb15937378d..6c85162d6f01 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -1108,6 +1108,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x3a432334 } +pointer_reference { + id: 0x0400f624 + kind: POINTER + pointee_type_id: 0x3a433e0e +} pointer_reference { id: 0x0407035c kind: POINTER @@ -1608,6 +1613,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x3cd7d077 } +pointer_reference { + id: 0x05ad89df + kind: POINTER + pointee_type_id: 0x3cf6c1e1 +} pointer_reference { id: 0x05b572ab kind: POINTER @@ -2413,6 +2423,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x0942f1ca } +pointer_reference { + id: 0x08c17d81 + kind: POINTER + pointee_type_id: 0x09451098 +} pointer_reference { id: 0x08c420f1 kind: POINTER @@ -23303,6 +23318,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xec0943ba } +pointer_reference { + id: 0x31a08325 + kind: POINTER + pointee_type_id: 0xecc2ea0b +} pointer_reference { id: 0x31a2d17a kind: POINTER @@ -24973,6 +24993,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xfe66bdb7 } +pointer_reference { + id: 0x350a2844 + kind: POINTER + pointee_type_id: 0xfe68478f +} pointer_reference { id: 0x350dc3e7 kind: POINTER @@ -26178,6 +26203,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xf7e2e2fa } +pointer_reference { + id: 0x376c23c8 + kind: POINTER + pointee_type_id: 0xf7f069bd +} pointer_reference { id: 0x376c8705 kind: POINTER @@ -28363,6 +28393,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xdb7fbc17 } +pointer_reference { + id: 0x3c5162c0 + kind: POINTER + pointee_type_id: 0xdb056d9e +} pointer_reference { id: 0x3c5315c3 kind: POINTER @@ -29083,6 +29118,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xdd9f6a40 } +pointer_reference { + id: 0x3df8f8c1 + kind: POINTER + pointee_type_id: 0xdda3059a +} pointer_reference { id: 0x3df9bbb6 kind: POINTER @@ -33733,6 +33773,11 @@ qualified { qualifier: CONST qualified_type_id: 0x1b3398cc } +qualified { + id: 0xdb056d9e + qualifier: CONST + qualified_type_id: 0x1c5200f3 +} qualified { id: 0xdb0cb193 qualifier: CONST @@ -34793,6 +34838,11 @@ qualified { qualifier: CONST qualified_type_id: 0xc2d2c0ac } +qualified { + id: 0xecc2ea0b + qualifier: CONST + qualified_type_id: 0xc34c1ea7 +} qualified { id: 0xeccba377 qualifier: CONST @@ -35333,6 +35383,11 @@ qualified { qualifier: CONST qualified_type_id: 0xae5a9933 } +qualified { + id: 0xf7f069bd + qualifier: CONST + qualified_type_id: 0xaf86107e +} qualified { id: 0xf7f2fa8a qualifier: CONST @@ -35723,6 +35778,11 @@ qualified { qualifier: CONST qualified_type_id: 0x89c605e5 } +qualified { + id: 0xfe68478f + qualifier: CONST + qualified_type_id: 0x89e6a8b6 +} qualified { id: 0xfe9b2205 qualifier: CONST @@ -60501,6 +60561,12 @@ member { type_id: 0xb3e7bac9 offset: 48 } +member { + id: 0xb12bacce + name: "cell_align" + type_id: 0xb0312d5a + offset: 32 +} member { id: 0xb12baf4b name: "cell_align" @@ -116199,6 +116265,11 @@ member { type_id: 0x92233392 offset: 832 } +member { + id: 0xc458e799 + name: "last_expires" + type_id: 0x92233392 +} member { id: 0x5e91924a name: "last_fifo_depth" @@ -119008,6 +119079,18 @@ member { type_id: 0x4585663f offset: 64 } +member { + id: 0x3860f036 + name: "linklayer" + type_id: 0x295c7202 + offset: 128 +} +member { + id: 0x38fa49da + name: "linklayer" + type_id: 0xb3e7bac9 + offset: 8 +} member { id: 0x3459027f name: "links" @@ -131074,6 +131157,18 @@ member { type_id: 0x4585663f offset: 96 } +member { + id: 0x62aaf19a + name: "mpu" + type_id: 0xc93e017b + offset: 48 +} +member { + id: 0x62f28228 + name: "mpu" + type_id: 0x914dbfdc + offset: 112 +} member { id: 0x31ca3c6f name: "mq_ctx" @@ -131961,6 +132056,12 @@ member { offset: 416 bitsize: 2 } +member { + id: 0x662d72be + name: "mult" + type_id: 0xc9082b19 + offset: 64 +} member { id: 0x662d77cd name: "mult" @@ -145141,6 +145242,18 @@ member { type_id: 0x18bd6530 offset: 8000 } +member { + id: 0x4c21e36f + name: "overhead" + type_id: 0xc93e017b + offset: 16 +} +member { + id: 0x4c7997ec + name: "overhead" + type_id: 0x914dbfdc + offset: 96 +} member { id: 0x4c799d4b name: "overhead" @@ -158774,6 +158887,12 @@ member { type_id: 0x2e8d5f05 offset: 64 } +member { + id: 0x3d7cfa6f + name: "qdisc" + type_id: 0x2e8d5f05 + offset: 640 +} member { id: 0x9cb0c470 name: "qdisc_hash" @@ -160250,6 +160369,12 @@ member { type_id: 0xc9082b19 offset: 64 } +member { + id: 0x5f3478a0 + name: "rate" + type_id: 0xe62ebf07 + offset: 64 +} member { id: 0x5f61bea2 name: "rate" @@ -160310,6 +160435,11 @@ member { type_id: 0x92233392 offset: 64 } +member { + id: 0x945697e1 + name: "rate_bytes_ps" + type_id: 0x92233392 +} member { id: 0x8d8ea53b name: "rate_clk_single" @@ -179200,6 +179330,12 @@ member { type_id: 0xb3e7bac9 offset: 64 } +member { + id: 0x3218941b + name: "shift" + type_id: 0x295c7202 + offset: 136 +} member { id: 0x32189a75 name: "shift" @@ -194218,6 +194354,12 @@ member { type_id: 0xcd7704bf offset: 2240 } +member { + id: 0x1dce6a6f + name: "timer" + type_id: 0xcd7704bf + offset: 64 +} member { id: 0x1dce6e25 name: "timer" @@ -252596,6 +252738,20 @@ struct_union { member_id: 0x95daceb0 } } +struct_union { + id: 0x3cf6c1e1 + kind: STRUCT + name: "psched_ratecfg" + definition { + bytesize: 24 + member_id: 0x945697e1 + member_id: 0x662d72be + member_id: 0x4c7997ec + member_id: 0x62f28228 + member_id: 0x3860f036 + member_id: 0x3218941b + } +} struct_union { id: 0x9972ab36 kind: STRUCT @@ -253226,6 +253382,17 @@ struct_union { member_id: 0xf7b8ccd5 } } +struct_union { + id: 0xdda3059a + kind: STRUCT + name: "qdisc_watchdog" + definition { + bytesize: 88 + member_id: 0xc458e799 + member_id: 0x1dce6a6f + member_id: 0x3d7cfa6f + } +} struct_union { id: 0xed946547 kind: STRUCT @@ -262868,6 +263035,20 @@ struct_union { member_id: 0x95dac0b5 } } +struct_union { + id: 0x89e6a8b6 + kind: STRUCT + name: "tc_ratespec" + definition { + bytesize: 12 + member_id: 0x60842ca1 + member_id: 0x38fa49da + member_id: 0x4c21e36f + member_id: 0xb12bacce + member_id: 0x62aaf19a + member_id: 0x5f3478a0 + } +} struct_union { id: 0xd78aa293 kind: STRUCT @@ -293916,6 +294097,13 @@ function { parameter_id: 0x4585663f parameter_id: 0x6d7f5ff6 } +function { + id: 0x11039389 + return_type_id: 0x48b5725f + parameter_id: 0x05ad89df + parameter_id: 0x350a2844 + parameter_id: 0x92233392 +} function { id: 0x1103b2cc return_type_id: 0x48b5725f @@ -293967,6 +294155,12 @@ function { parameter_id: 0x391f15ea parameter_id: 0xf435685e } +function { + id: 0x11163b5a + return_type_id: 0x48b5725f + parameter_id: 0x054f691a + parameter_id: 0x376c23c8 +} function { id: 0x111b6c97 return_type_id: 0x48b5725f @@ -295436,6 +295630,13 @@ function { return_type_id: 0x48b5725f parameter_id: 0x0e7d50ff } +function { + id: 0x13072e26 + return_type_id: 0x48b5725f + parameter_id: 0x0d84b99b + parameter_id: 0x3c5162c0 + parameter_id: 0x3c5162c0 +} function { id: 0x130de2cb return_type_id: 0x48b5725f @@ -300162,6 +300363,12 @@ function { return_type_id: 0x48b5725f parameter_id: 0x2859d899 } +function { + id: 0x1a8efb2d + return_type_id: 0x48b5725f + parameter_id: 0x2e8d5f05 + parameter_id: 0x6d7f5ff6 +} function { id: 0x1a8f9ccc return_type_id: 0x48b5725f @@ -300281,6 +300488,13 @@ function { parameter_id: 0x2efe8065 parameter_id: 0x6720d32f } +function { + id: 0x1abe4d2a + return_type_id: 0x48b5725f + parameter_id: 0x2e8d5f05 + parameter_id: 0x6720d32f + parameter_id: 0x6720d32f +} function { id: 0x1abe6e05 return_type_id: 0x48b5725f @@ -302286,6 +302500,13 @@ function { parameter_id: 0x3e10b518 parameter_id: 0xa52a0930 } +function { + id: 0x1d8a6ba1 + return_type_id: 0x48b5725f + parameter_id: 0x3df8f8c1 + parameter_id: 0x92233392 + parameter_id: 0x92233392 +} function { id: 0x1d8c491d return_type_id: 0x1b8590a8 @@ -302566,6 +302787,11 @@ function { parameter_id: 0x36f998d3 parameter_id: 0xc9082b19 } +function { + id: 0x1e089e10 + return_type_id: 0x48b5725f + parameter_id: 0x3a433e0e +} function { id: 0x1e091eac return_type_id: 0x48b5725f @@ -303970,6 +304196,12 @@ function { return_type_id: 0x48b5725f parameter_id: 0x3f0ff1b1 } +function { + id: 0x1f5c5adf + return_type_id: 0x48b5725f + parameter_id: 0x3df8f8c1 + parameter_id: 0x2e8d5f05 +} function { id: 0x1f5d7673 return_type_id: 0xd5cc9c9a @@ -304398,6 +304630,11 @@ function { return_type_id: 0x48b5725f parameter_id: 0x3df0a7d3 } +function { + id: 0x1fe66fa3 + return_type_id: 0x48b5725f + parameter_id: 0x3df8f8c1 +} function { id: 0x1fe91863 return_type_id: 0x48b5725f @@ -311616,6 +311853,14 @@ function { parameter_id: 0x347303b4 parameter_id: 0x18cdf247 } +function { + id: 0x91009915 + return_type_id: 0x6720d32f + parameter_id: 0x32da4522 + parameter_id: 0x0d84b99b + parameter_id: 0x0d84b99b + parameter_id: 0xe62ebf07 +} function { id: 0x9100a08e return_type_id: 0x6720d32f @@ -311934,6 +312179,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x32c23ae3 } +function { + id: 0x9130c8a4 + return_type_id: 0x6720d32f + parameter_id: 0x32da4522 + parameter_id: 0x01de2d7a + parameter_id: 0x01de2d7a + parameter_id: 0x6d7f5ff6 +} function { id: 0x913248e6 return_type_id: 0x6720d32f @@ -327478,6 +327731,15 @@ function { parameter_id: 0x30da8694 parameter_id: 0x29b2544e } +function { + id: 0x9c1a5eb1 + return_type_id: 0x6720d32f + parameter_id: 0x054f691a + parameter_id: 0x31a08325 + parameter_id: 0x3d610880 + parameter_id: 0x29b2544e + parameter_id: 0x6d7f5ff6 +} function { id: 0x9c1c39d4 return_type_id: 0x6720d32f @@ -328305,6 +328567,14 @@ function { parameter_id: 0x04f7a60d parameter_id: 0x054f691a } +function { + id: 0x9ca86774 + return_type_id: 0x6720d32f + parameter_id: 0x0400f624 + parameter_id: 0x08c17d81 + parameter_id: 0x2e8d5f05 + parameter_id: 0x07dcdbe1 +} function { id: 0x9cab723c return_type_id: 0x6720d32f @@ -336848,6 +337118,14 @@ function { parameter_id: 0x2b7be833 parameter_id: 0xf1a6dfed } +function { + id: 0xef5d0a73 + return_type_id: 0x2e8d5f05 + parameter_id: 0x1a7122b5 + parameter_id: 0x30cae1c6 + parameter_id: 0x4585663f + parameter_id: 0x07dcdbe1 +} function { id: 0xefaef687 return_type_id: 0x3ada60b4 @@ -341023,6 +341301,15 @@ elf_symbol { type_id: 0x9cd33969 full_name: "__netif_rx" } +elf_symbol { + id: 0x6a2324da + name: "__netif_schedule" + is_defined: true + symbol_type: FUNCTION + crc: 0xd72f3ec4 + type_id: 0x1b3b0652 + full_name: "__netif_schedule" +} elf_symbol { id: 0x6337b091 name: "__netif_set_xps_queue" @@ -341401,6 +341688,15 @@ elf_symbol { type_id: 0x17de3be6 full_name: "__put_task_struct" } +elf_symbol { + id: 0x1f2378cf + name: "__qdisc_calculate_pkt_len" + is_defined: true + symbol_type: FUNCTION + crc: 0x8a450fad + type_id: 0x11163b5a + full_name: "__qdisc_calculate_pkt_len" +} elf_symbol { id: 0xf29639bc name: "__rb_erase_color" @@ -371240,6 +371536,33 @@ elf_symbol { type_id: 0xf1d83496 full_name: "glob_match" } +elf_symbol { + id: 0x7990bc50 + name: "gnet_stats_add_queue" + is_defined: true + symbol_type: FUNCTION + crc: 0x61b840f6 + type_id: 0x13072e26 + full_name: "gnet_stats_add_queue" +} +elf_symbol { + id: 0x8a6e138f + name: "gnet_stats_copy_basic" + is_defined: true + symbol_type: FUNCTION + crc: 0x0c808b5e + type_id: 0x9130c8a4 + full_name: "gnet_stats_copy_basic" +} +elf_symbol { + id: 0x0ace9404 + name: "gnet_stats_copy_queue" + is_defined: true + symbol_type: FUNCTION + crc: 0x2eeb875b + type_id: 0x91009915 + full_name: "gnet_stats_copy_queue" +} elf_symbol { id: 0x64b49555 name: "gov_attr_set_get" @@ -382145,6 +382468,15 @@ elf_symbol { type_id: 0x2d64ae3e full_name: "noop_llseek" } +elf_symbol { + id: 0x20409f45 + name: "noop_qdisc" + is_defined: true + symbol_type: OBJECT + crc: 0x7b25c4b9 + type_id: 0x90759a8b + full_name: "noop_qdisc" +} elf_symbol { id: 0x16059afd name: "notify_change" @@ -385748,6 +386080,15 @@ elf_symbol { type_id: 0x1732fd5e full_name: "perf_trace_run_bpf_submit" } +elf_symbol { + id: 0x1e700c22 + name: "pfifo_qdisc_ops" + is_defined: true + symbol_type: OBJECT + crc: 0x471b8e88 + type_id: 0xd5ea309d + full_name: "pfifo_qdisc_ops" +} elf_symbol { id: 0xba681a1a name: "pfn_is_map_memory" @@ -388583,6 +388924,15 @@ elf_symbol { type_id: 0x9936d341 full_name: "ps2_sliced_command" } +elf_symbol { + id: 0x8df36ef2 + name: "psched_ratecfg_precompute" + is_defined: true + symbol_type: FUNCTION + crc: 0xb6e36ce2 + type_id: 0x11039389 + full_name: "psched_ratecfg_precompute" +} elf_symbol { id: 0x9dc0e748 name: "pskb_expand_head" @@ -389015,6 +389365,78 @@ elf_symbol { type_id: 0x9ea02907 full_name: "qcom_smem_state_update_bits" } +elf_symbol { + id: 0xce0252f1 + name: "qdisc_create_dflt" + is_defined: true + symbol_type: FUNCTION + crc: 0x5e36ab08 + type_id: 0xef5d0a73 + full_name: "qdisc_create_dflt" +} +elf_symbol { + id: 0xa637f7b7 + name: "qdisc_hash_add" + is_defined: true + symbol_type: FUNCTION + crc: 0xc691be8d + type_id: 0x1a8efb2d + full_name: "qdisc_hash_add" +} +elf_symbol { + id: 0x78f8d020 + name: "qdisc_put" + is_defined: true + symbol_type: FUNCTION + crc: 0xe0dbcc3b + type_id: 0x1b3b0652 + full_name: "qdisc_put" +} +elf_symbol { + id: 0xae1b45d2 + name: "qdisc_reset" + is_defined: true + symbol_type: FUNCTION + crc: 0xf6d26a5f + type_id: 0x1b3b0652 + full_name: "qdisc_reset" +} +elf_symbol { + id: 0x788eb5c1 + name: "qdisc_tree_reduce_backlog" + is_defined: true + symbol_type: FUNCTION + crc: 0x31ef7b2e + type_id: 0x1abe4d2a + full_name: "qdisc_tree_reduce_backlog" +} +elf_symbol { + id: 0xdc29efa5 + name: "qdisc_watchdog_cancel" + is_defined: true + symbol_type: FUNCTION + crc: 0x5a1b49a4 + type_id: 0x1fe66fa3 + full_name: "qdisc_watchdog_cancel" +} +elf_symbol { + id: 0x9928a695 + name: "qdisc_watchdog_init" + is_defined: true + symbol_type: FUNCTION + crc: 0x2400ca2d + type_id: 0x1f5c5adf + full_name: "qdisc_watchdog_init" +} +elf_symbol { + id: 0x7d9c9dda + name: "qdisc_watchdog_schedule_range_ns" + is_defined: true + symbol_type: FUNCTION + crc: 0x075fc620 + type_id: 0x1d8a6ba1 + full_name: "qdisc_watchdog_schedule_range_ns" +} elf_symbol { id: 0x2721b297 name: "queue_delayed_work_on" @@ -399387,6 +399809,24 @@ elf_symbol { type_id: 0x1d1ccc70 full_name: "tcf_action_update_stats" } +elf_symbol { + id: 0x5c71ae40 + name: "tcf_block_get" + is_defined: true + symbol_type: FUNCTION + crc: 0x43573c5b + type_id: 0x9ca86774 + full_name: "tcf_block_get" +} +elf_symbol { + id: 0x71532d43 + name: "tcf_block_put" + is_defined: true + symbol_type: FUNCTION + crc: 0xc8e17cf6 + type_id: 0x1e089e10 + full_name: "tcf_block_put" +} elf_symbol { id: 0xcda1c9b0 name: "tcf_chain_put_by_act" @@ -399396,6 +399836,15 @@ elf_symbol { type_id: 0x163a90aa full_name: "tcf_chain_put_by_act" } +elf_symbol { + id: 0xef103e2f + name: "tcf_classify" + is_defined: true + symbol_type: FUNCTION + crc: 0xba35414b + type_id: 0x9c1a5eb1 + full_name: "tcf_classify" +} elf_symbol { id: 0xc924b9c3 name: "tcf_exts_destroy" @@ -409786,6 +410235,7 @@ interface { symbol_id: 0x6793e03f symbol_id: 0x17112d4d symbol_id: 0xe6b5218e + symbol_id: 0x6a2324da symbol_id: 0x6337b091 symbol_id: 0x4fc5d8fb symbol_id: 0x45dc2e90 @@ -409828,6 +410278,7 @@ interface { symbol_id: 0xf00cbe99 symbol_id: 0x36fb0a8e symbol_id: 0x45993ba3 + symbol_id: 0x1f2378cf symbol_id: 0xf29639bc symbol_id: 0x431cc4ee symbol_id: 0x56eb7c27 @@ -413142,6 +413593,9 @@ interface { symbol_id: 0x390427e4 symbol_id: 0x53ba530f symbol_id: 0x365c2930 + symbol_id: 0x7990bc50 + symbol_id: 0x8a6e138f + symbol_id: 0x0ace9404 symbol_id: 0x64b49555 symbol_id: 0xbfc46f3e symbol_id: 0x53579c80 @@ -414354,6 +414808,7 @@ interface { symbol_id: 0x39787440 symbol_id: 0x7f258c4e symbol_id: 0x64e6aa0b + symbol_id: 0x20409f45 symbol_id: 0x16059afd symbol_id: 0x1560f116 symbol_id: 0x1cfcf940 @@ -414754,6 +415209,7 @@ interface { symbol_id: 0xc2bb86d6 symbol_id: 0x1dad348b symbol_id: 0xd50beffc + symbol_id: 0x1e700c22 symbol_id: 0xba681a1a symbol_id: 0x5fa10488 symbol_id: 0x9db95d0c @@ -415069,6 +415525,7 @@ interface { symbol_id: 0xafb47c9f symbol_id: 0x408f4567 symbol_id: 0x7fc27c29 + symbol_id: 0x8df36ef2 symbol_id: 0x9dc0e748 symbol_id: 0x2251af59 symbol_id: 0x3758c51f @@ -415117,6 +415574,14 @@ interface { symbol_id: 0x6a663d57 symbol_id: 0xbed674f6 symbol_id: 0x0ca915af + symbol_id: 0xce0252f1 + symbol_id: 0xa637f7b7 + symbol_id: 0x78f8d020 + symbol_id: 0xae1b45d2 + symbol_id: 0x788eb5c1 + symbol_id: 0xdc29efa5 + symbol_id: 0x9928a695 + symbol_id: 0x7d9c9dda symbol_id: 0x2721b297 symbol_id: 0xf60ed3ec symbol_id: 0x1f556538 @@ -416270,7 +416735,10 @@ interface { symbol_id: 0x2d797653 symbol_id: 0xd4d51230 symbol_id: 0x2fba8b59 + symbol_id: 0x5c71ae40 + symbol_id: 0x71532d43 symbol_id: 0xcda1c9b0 + symbol_id: 0xef103e2f symbol_id: 0xc924b9c3 symbol_id: 0x2c53af12 symbol_id: 0xa4bb7174 diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 610e9fcf22f7..7d87ba364e9f 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -27,6 +27,9 @@ freq_qos_add_notifier freq_qos_remove_notifier get_wchan + gnet_stats_add_queue + gnet_stats_copy_basic + gnet_stats_copy_queue gov_attr_set_get gpiod_to_chip have_governor_per_policy @@ -55,24 +58,37 @@ __mod_zone_page_state neigh_xmit netif_receive_skb_core + __netif_schedule nf_ct_attach nf_ct_delete nf_register_net_hook nf_register_net_hooks nf_unregister_net_hook nf_unregister_net_hooks + noop_qdisc nr_running of_css osq_lock osq_unlock __page_file_index __page_mapcount + pfifo_qdisc_ops pm_get_active_wakeup_sources __printk_ratelimit prepare_to_wait_exclusive proc_symlink + psched_ratecfg_precompute public_key_verify_signature put_pages_list + __qdisc_calculate_pkt_len + qdisc_create_dflt + qdisc_hash_add + qdisc_put + qdisc_reset + qdisc_tree_reduce_backlog + qdisc_watchdog_cancel + qdisc_watchdog_init + qdisc_watchdog_schedule_range_ns radix_tree_lookup_slot radix_tree_replace_slot _raw_write_trylock @@ -102,6 +118,9 @@ stpcpy task_rq_lock tcf_action_exec + tcf_block_get + tcf_block_put + tcf_classify tcf_exts_destroy tcf_exts_dump tcf_exts_dump_stats From 222a79a1bb3345d329806e7cd7ccc7d227638516 Mon Sep 17 00:00:00 2001 From: Anshuman Khandual Date: Mon, 28 Nov 2022 08:24:49 +0530 Subject: [PATCH 16/93] UPSTREAM: arm64/perf: Replace PMU version number '0' with ID_AA64DFR0_EL1_PMUVer_NI __armv8pmu_probe_pmu() returns if detected PMU is either not implemented or implementation defined. Extracted ID_AA64DFR0_EL1_PMUVer value, when PMU is not implemented is '0' which can be replaced with ID_AA64DFR0_EL1_PMUVer_NI defined as '0b0000'. Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: linux-perf-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Change-Id: I1d3b7e35313b967b19fb4370fde4ad3392f28db2 Signed-off-by: Anshuman Khandual Acked-by: Mark Rutland Link: https://lore.kernel.org/r/20221128025449.39085-1-anshuman.khandual@arm.com Signed-off-by: Will Deacon (cherry picked from commit cc91b9481605b1f62f947857231050c747ceda16) Signed-off-by: Danesh Petigara --- arch/arm64/kernel/perf_event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 214b1805e536..6979d45dde01 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -1150,7 +1150,8 @@ static void __armv8pmu_probe_pmu(void *info) dfr0 = read_sysreg(id_aa64dfr0_el1); pmuver = cpuid_feature_extract_unsigned_field(dfr0, ID_AA64DFR0_EL1_PMUVer_SHIFT); - if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF || pmuver == 0) + if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF || + pmuver == ID_AA64DFR0_EL1_PMUVer_NI) return; cpu_pmu->pmuver = pmuver; From 278e973f01d6f82dcdcef6e48430d3c68777d4be Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Fri, 17 Mar 2023 15:50:20 -0400 Subject: [PATCH 17/93] UPSTREAM: arm64: perf: Move PMUv3 driver to drivers/perf Having the ARM PMUv3 driver sitting in arch/arm64/kernel is getting in the way of being able to use perf on ARMv8 cores running a 32bit kernel, such as 32bit KVM guests. This patch moves it into drivers/perf/arm_pmuv3.c, with an include file in include/linux/perf/arm_pmuv3.h. The only thing left in arch/arm64 is some mundane perf stuff. Change-Id: I1928ceb684a107ef991401175458f2ea6c711826 Signed-off-by: Marc Zyngier Signed-off-by: Zaid Al-Bassam Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-2-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit 7755cec63adeecea3cbbf4032047812c37cf7cc3) Signed-off-by: Danesh Petigara --- arch/arm64/include/asm/perf_event.h | 249 ----------------- arch/arm64/kernel/Makefile | 1 - drivers/perf/Kconfig | 11 + drivers/perf/Makefile | 1 + .../perf_event.c => drivers/perf/arm_pmuv3.c | 1 + include/kvm/arm_pmu.h | 2 +- include/linux/perf/arm_pmuv3.h | 258 ++++++++++++++++++ 7 files changed, 272 insertions(+), 251 deletions(-) rename arch/arm64/kernel/perf_event.c => drivers/perf/arm_pmuv3.c (99%) create mode 100644 include/linux/perf/arm_pmuv3.h diff --git a/arch/arm64/include/asm/perf_event.h b/arch/arm64/include/asm/perf_event.h index 3eaf462f5752..eb7071c9eb34 100644 --- a/arch/arm64/include/asm/perf_event.h +++ b/arch/arm64/include/asm/perf_event.h @@ -9,255 +9,6 @@ #include #include -#define ARMV8_PMU_MAX_COUNTERS 32 -#define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) - -/* - * Common architectural and microarchitectural event numbers. - */ -#define ARMV8_PMUV3_PERFCTR_SW_INCR 0x0000 -#define ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL 0x0001 -#define ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL 0x0002 -#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_REFILL 0x0003 -#define ARMV8_PMUV3_PERFCTR_L1D_CACHE 0x0004 -#define ARMV8_PMUV3_PERFCTR_L1D_TLB_REFILL 0x0005 -#define ARMV8_PMUV3_PERFCTR_LD_RETIRED 0x0006 -#define ARMV8_PMUV3_PERFCTR_ST_RETIRED 0x0007 -#define ARMV8_PMUV3_PERFCTR_INST_RETIRED 0x0008 -#define ARMV8_PMUV3_PERFCTR_EXC_TAKEN 0x0009 -#define ARMV8_PMUV3_PERFCTR_EXC_RETURN 0x000A -#define ARMV8_PMUV3_PERFCTR_CID_WRITE_RETIRED 0x000B -#define ARMV8_PMUV3_PERFCTR_PC_WRITE_RETIRED 0x000C -#define ARMV8_PMUV3_PERFCTR_BR_IMMED_RETIRED 0x000D -#define ARMV8_PMUV3_PERFCTR_BR_RETURN_RETIRED 0x000E -#define ARMV8_PMUV3_PERFCTR_UNALIGNED_LDST_RETIRED 0x000F -#define ARMV8_PMUV3_PERFCTR_BR_MIS_PRED 0x0010 -#define ARMV8_PMUV3_PERFCTR_CPU_CYCLES 0x0011 -#define ARMV8_PMUV3_PERFCTR_BR_PRED 0x0012 -#define ARMV8_PMUV3_PERFCTR_MEM_ACCESS 0x0013 -#define ARMV8_PMUV3_PERFCTR_L1I_CACHE 0x0014 -#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_WB 0x0015 -#define ARMV8_PMUV3_PERFCTR_L2D_CACHE 0x0016 -#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL 0x0017 -#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_WB 0x0018 -#define ARMV8_PMUV3_PERFCTR_BUS_ACCESS 0x0019 -#define ARMV8_PMUV3_PERFCTR_MEMORY_ERROR 0x001A -#define ARMV8_PMUV3_PERFCTR_INST_SPEC 0x001B -#define ARMV8_PMUV3_PERFCTR_TTBR_WRITE_RETIRED 0x001C -#define ARMV8_PMUV3_PERFCTR_BUS_CYCLES 0x001D -#define ARMV8_PMUV3_PERFCTR_CHAIN 0x001E -#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_ALLOCATE 0x001F -#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_ALLOCATE 0x0020 -#define ARMV8_PMUV3_PERFCTR_BR_RETIRED 0x0021 -#define ARMV8_PMUV3_PERFCTR_BR_MIS_PRED_RETIRED 0x0022 -#define ARMV8_PMUV3_PERFCTR_STALL_FRONTEND 0x0023 -#define ARMV8_PMUV3_PERFCTR_STALL_BACKEND 0x0024 -#define ARMV8_PMUV3_PERFCTR_L1D_TLB 0x0025 -#define ARMV8_PMUV3_PERFCTR_L1I_TLB 0x0026 -#define ARMV8_PMUV3_PERFCTR_L2I_CACHE 0x0027 -#define ARMV8_PMUV3_PERFCTR_L2I_CACHE_REFILL 0x0028 -#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_ALLOCATE 0x0029 -#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_REFILL 0x002A -#define ARMV8_PMUV3_PERFCTR_L3D_CACHE 0x002B -#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_WB 0x002C -#define ARMV8_PMUV3_PERFCTR_L2D_TLB_REFILL 0x002D -#define ARMV8_PMUV3_PERFCTR_L2I_TLB_REFILL 0x002E -#define ARMV8_PMUV3_PERFCTR_L2D_TLB 0x002F -#define ARMV8_PMUV3_PERFCTR_L2I_TLB 0x0030 -#define ARMV8_PMUV3_PERFCTR_REMOTE_ACCESS 0x0031 -#define ARMV8_PMUV3_PERFCTR_LL_CACHE 0x0032 -#define ARMV8_PMUV3_PERFCTR_LL_CACHE_MISS 0x0033 -#define ARMV8_PMUV3_PERFCTR_DTLB_WALK 0x0034 -#define ARMV8_PMUV3_PERFCTR_ITLB_WALK 0x0035 -#define ARMV8_PMUV3_PERFCTR_LL_CACHE_RD 0x0036 -#define ARMV8_PMUV3_PERFCTR_LL_CACHE_MISS_RD 0x0037 -#define ARMV8_PMUV3_PERFCTR_REMOTE_ACCESS_RD 0x0038 -#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_LMISS_RD 0x0039 -#define ARMV8_PMUV3_PERFCTR_OP_RETIRED 0x003A -#define ARMV8_PMUV3_PERFCTR_OP_SPEC 0x003B -#define ARMV8_PMUV3_PERFCTR_STALL 0x003C -#define ARMV8_PMUV3_PERFCTR_STALL_SLOT_BACKEND 0x003D -#define ARMV8_PMUV3_PERFCTR_STALL_SLOT_FRONTEND 0x003E -#define ARMV8_PMUV3_PERFCTR_STALL_SLOT 0x003F - -/* Statistical profiling extension microarchitectural events */ -#define ARMV8_SPE_PERFCTR_SAMPLE_POP 0x4000 -#define ARMV8_SPE_PERFCTR_SAMPLE_FEED 0x4001 -#define ARMV8_SPE_PERFCTR_SAMPLE_FILTRATE 0x4002 -#define ARMV8_SPE_PERFCTR_SAMPLE_COLLISION 0x4003 - -/* AMUv1 architecture events */ -#define ARMV8_AMU_PERFCTR_CNT_CYCLES 0x4004 -#define ARMV8_AMU_PERFCTR_STALL_BACKEND_MEM 0x4005 - -/* long-latency read miss events */ -#define ARMV8_PMUV3_PERFCTR_L1I_CACHE_LMISS 0x4006 -#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_LMISS_RD 0x4009 -#define ARMV8_PMUV3_PERFCTR_L2I_CACHE_LMISS 0x400A -#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_LMISS_RD 0x400B - -/* Trace buffer events */ -#define ARMV8_PMUV3_PERFCTR_TRB_WRAP 0x400C -#define ARMV8_PMUV3_PERFCTR_TRB_TRIG 0x400E - -/* Trace unit events */ -#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT0 0x4010 -#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT1 0x4011 -#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT2 0x4012 -#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT3 0x4013 -#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT4 0x4018 -#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT5 0x4019 -#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT6 0x401A -#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT7 0x401B - -/* additional latency from alignment events */ -#define ARMV8_PMUV3_PERFCTR_LDST_ALIGN_LAT 0x4020 -#define ARMV8_PMUV3_PERFCTR_LD_ALIGN_LAT 0x4021 -#define ARMV8_PMUV3_PERFCTR_ST_ALIGN_LAT 0x4022 - -/* Armv8.5 Memory Tagging Extension events */ -#define ARMV8_MTE_PERFCTR_MEM_ACCESS_CHECKED 0x4024 -#define ARMV8_MTE_PERFCTR_MEM_ACCESS_CHECKED_RD 0x4025 -#define ARMV8_MTE_PERFCTR_MEM_ACCESS_CHECKED_WR 0x4026 - -/* ARMv8 recommended implementation defined event types */ -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_RD 0x0040 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WR 0x0041 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_RD 0x0042 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_WR 0x0043 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_INNER 0x0044 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_OUTER 0x0045 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WB_VICTIM 0x0046 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WB_CLEAN 0x0047 -#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_INVAL 0x0048 - -#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_REFILL_RD 0x004C -#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_REFILL_WR 0x004D -#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_RD 0x004E -#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_WR 0x004F -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_RD 0x0050 -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_WR 0x0051 -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_REFILL_RD 0x0052 -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_REFILL_WR 0x0053 - -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_WB_VICTIM 0x0056 -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_WB_CLEAN 0x0057 -#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_INVAL 0x0058 - -#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_REFILL_RD 0x005C -#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_REFILL_WR 0x005D -#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_RD 0x005E -#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_WR 0x005F -#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_RD 0x0060 -#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_WR 0x0061 -#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_SHARED 0x0062 -#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_NOT_SHARED 0x0063 -#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_NORMAL 0x0064 -#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_PERIPH 0x0065 -#define ARMV8_IMPDEF_PERFCTR_MEM_ACCESS_RD 0x0066 -#define ARMV8_IMPDEF_PERFCTR_MEM_ACCESS_WR 0x0067 -#define ARMV8_IMPDEF_PERFCTR_UNALIGNED_LD_SPEC 0x0068 -#define ARMV8_IMPDEF_PERFCTR_UNALIGNED_ST_SPEC 0x0069 -#define ARMV8_IMPDEF_PERFCTR_UNALIGNED_LDST_SPEC 0x006A - -#define ARMV8_IMPDEF_PERFCTR_LDREX_SPEC 0x006C -#define ARMV8_IMPDEF_PERFCTR_STREX_PASS_SPEC 0x006D -#define ARMV8_IMPDEF_PERFCTR_STREX_FAIL_SPEC 0x006E -#define ARMV8_IMPDEF_PERFCTR_STREX_SPEC 0x006F -#define ARMV8_IMPDEF_PERFCTR_LD_SPEC 0x0070 -#define ARMV8_IMPDEF_PERFCTR_ST_SPEC 0x0071 -#define ARMV8_IMPDEF_PERFCTR_LDST_SPEC 0x0072 -#define ARMV8_IMPDEF_PERFCTR_DP_SPEC 0x0073 -#define ARMV8_IMPDEF_PERFCTR_ASE_SPEC 0x0074 -#define ARMV8_IMPDEF_PERFCTR_VFP_SPEC 0x0075 -#define ARMV8_IMPDEF_PERFCTR_PC_WRITE_SPEC 0x0076 -#define ARMV8_IMPDEF_PERFCTR_CRYPTO_SPEC 0x0077 -#define ARMV8_IMPDEF_PERFCTR_BR_IMMED_SPEC 0x0078 -#define ARMV8_IMPDEF_PERFCTR_BR_RETURN_SPEC 0x0079 -#define ARMV8_IMPDEF_PERFCTR_BR_INDIRECT_SPEC 0x007A - -#define ARMV8_IMPDEF_PERFCTR_ISB_SPEC 0x007C -#define ARMV8_IMPDEF_PERFCTR_DSB_SPEC 0x007D -#define ARMV8_IMPDEF_PERFCTR_DMB_SPEC 0x007E - -#define ARMV8_IMPDEF_PERFCTR_EXC_UNDEF 0x0081 -#define ARMV8_IMPDEF_PERFCTR_EXC_SVC 0x0082 -#define ARMV8_IMPDEF_PERFCTR_EXC_PABORT 0x0083 -#define ARMV8_IMPDEF_PERFCTR_EXC_DABORT 0x0084 - -#define ARMV8_IMPDEF_PERFCTR_EXC_IRQ 0x0086 -#define ARMV8_IMPDEF_PERFCTR_EXC_FIQ 0x0087 -#define ARMV8_IMPDEF_PERFCTR_EXC_SMC 0x0088 - -#define ARMV8_IMPDEF_PERFCTR_EXC_HVC 0x008A -#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_PABORT 0x008B -#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_DABORT 0x008C -#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_OTHER 0x008D -#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_IRQ 0x008E -#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_FIQ 0x008F -#define ARMV8_IMPDEF_PERFCTR_RC_LD_SPEC 0x0090 -#define ARMV8_IMPDEF_PERFCTR_RC_ST_SPEC 0x0091 - -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_RD 0x00A0 -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_WR 0x00A1 -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_REFILL_RD 0x00A2 -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_REFILL_WR 0x00A3 - -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_WB_VICTIM 0x00A6 -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_WB_CLEAN 0x00A7 -#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_INVAL 0x00A8 - -/* - * Per-CPU PMCR: config reg - */ -#define ARMV8_PMU_PMCR_E (1 << 0) /* Enable all counters */ -#define ARMV8_PMU_PMCR_P (1 << 1) /* Reset all counters */ -#define ARMV8_PMU_PMCR_C (1 << 2) /* Cycle counter reset */ -#define ARMV8_PMU_PMCR_D (1 << 3) /* CCNT counts every 64th cpu cycle */ -#define ARMV8_PMU_PMCR_X (1 << 4) /* Export to ETM */ -#define ARMV8_PMU_PMCR_DP (1 << 5) /* Disable CCNT if non-invasive debug*/ -#define ARMV8_PMU_PMCR_LC (1 << 6) /* Overflow on 64 bit cycle counter */ -#define ARMV8_PMU_PMCR_LP (1 << 7) /* Long event counter enable */ -#define ARMV8_PMU_PMCR_N_SHIFT 11 /* Number of counters supported */ -#define ARMV8_PMU_PMCR_N_MASK 0x1f -#define ARMV8_PMU_PMCR_MASK 0xff /* Mask for writable bits */ - -/* - * PMOVSR: counters overflow flag status reg - */ -#define ARMV8_PMU_OVSR_MASK 0xffffffff /* Mask for writable bits */ -#define ARMV8_PMU_OVERFLOWED_MASK ARMV8_PMU_OVSR_MASK - -/* - * PMXEVTYPER: Event selection reg - */ -#define ARMV8_PMU_EVTYPE_MASK 0xc800ffff /* Mask for writable bits */ -#define ARMV8_PMU_EVTYPE_EVENT 0xffff /* Mask for EVENT bits */ - -/* - * Event filters for PMUv3 - */ -#define ARMV8_PMU_EXCLUDE_EL1 (1U << 31) -#define ARMV8_PMU_EXCLUDE_EL0 (1U << 30) -#define ARMV8_PMU_INCLUDE_EL2 (1U << 27) - -/* - * PMUSERENR: user enable reg - */ -#define ARMV8_PMU_USERENR_MASK 0xf /* Mask for writable bits */ -#define ARMV8_PMU_USERENR_EN (1 << 0) /* PMU regs can be accessed at EL0 */ -#define ARMV8_PMU_USERENR_SW (1 << 1) /* PMSWINC can be written at EL0 */ -#define ARMV8_PMU_USERENR_CR (1 << 2) /* Cycle counter can be read at EL0 */ -#define ARMV8_PMU_USERENR_ER (1 << 3) /* Event counter can be read at EL0 */ - -/* PMMIR_EL1.SLOTS mask */ -#define ARMV8_PMU_SLOTS_MASK 0xff - -#define ARMV8_PMU_BUS_SLOTS_SHIFT 8 -#define ARMV8_PMU_BUS_SLOTS_MASK 0xff -#define ARMV8_PMU_BUS_WIDTH_SHIFT 16 -#define ARMV8_PMU_BUS_WIDTH_MASK 0xf - #ifdef CONFIG_PERF_EVENTS struct pt_regs; extern unsigned long perf_instruction_pointer(struct pt_regs *regs); diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index b96cc503ea04..3e38b269487a 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -51,7 +51,6 @@ obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o -obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_CPU_PM) += sleep.o suspend.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig index 341010f20b77..b1c064a49984 100644 --- a/drivers/perf/Kconfig +++ b/drivers/perf/Kconfig @@ -100,6 +100,17 @@ config ARM_SMMU_V3_PMU through the SMMU and allow the resulting information to be filtered based on the Stream ID of the corresponding master. +config ARM_PMUV3 + depends on HW_PERF_EVENTS && ARM64 + bool "ARM PMUv3 support" if !ARM64 + default y + help + Say y if you want to use the ARM performance monitor unit (PMU) + version 3. The PMUv3 is the CPU performance monitors on ARMv8 + (aarch32 and aarch64) systems that implement the PMUv3 + architecture. + Currently, PMUv3 is only supported on aarch64 (arm64) + config ARM_DSU_PMU tristate "ARM DynamIQ Shared Unit (DSU) PMU" depends on ARM64 diff --git a/drivers/perf/Makefile b/drivers/perf/Makefile index 050d04ee19dd..27804e603e7b 100644 --- a/drivers/perf/Makefile +++ b/drivers/perf/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_ARM_CMN) += arm-cmn.o obj-$(CONFIG_ARM_DSU_PMU) += arm_dsu_pmu.o obj-$(CONFIG_ARM_PMU) += arm_pmu.o arm_pmu_platform.o obj-$(CONFIG_ARM_PMU_ACPI) += arm_pmu_acpi.o +obj-$(CONFIG_ARM_PMUV3) += arm_pmuv3.o obj-$(CONFIG_ARM_SMMU_V3_PMU) += arm_smmuv3_pmu.o obj-$(CONFIG_FSL_IMX8_DDR_PMU) += fsl_imx8_ddr_perf.o obj-$(CONFIG_HISI_PMU) += hisilicon/ diff --git a/arch/arm64/kernel/perf_event.c b/drivers/perf/arm_pmuv3.c similarity index 99% rename from arch/arm64/kernel/perf_event.c rename to drivers/perf/arm_pmuv3.c index 6979d45dde01..a6e0c015f55e 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/drivers/perf/arm_pmuv3.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/include/kvm/arm_pmu.h b/include/kvm/arm_pmu.h index 96b192139a23..10fa1f494fb5 100644 --- a/include/kvm/arm_pmu.h +++ b/include/kvm/arm_pmu.h @@ -8,7 +8,7 @@ #define __ASM_ARM_KVM_PMU_H #include -#include +#include #define ARMV8_PMU_CYCLE_IDX (ARMV8_PMU_MAX_COUNTERS - 1) diff --git a/include/linux/perf/arm_pmuv3.h b/include/linux/perf/arm_pmuv3.h new file mode 100644 index 000000000000..53173abfc022 --- /dev/null +++ b/include/linux/perf/arm_pmuv3.h @@ -0,0 +1,258 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2012 ARM Ltd. + */ + +#ifndef __PERF_ARM_PMUV3_H +#define __PERF_ARM_PMUV3_H + +#define ARMV8_PMU_MAX_COUNTERS 32 +#define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) + +/* + * Common architectural and microarchitectural event numbers. + */ +#define ARMV8_PMUV3_PERFCTR_SW_INCR 0x0000 +#define ARMV8_PMUV3_PERFCTR_L1I_CACHE_REFILL 0x0001 +#define ARMV8_PMUV3_PERFCTR_L1I_TLB_REFILL 0x0002 +#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_REFILL 0x0003 +#define ARMV8_PMUV3_PERFCTR_L1D_CACHE 0x0004 +#define ARMV8_PMUV3_PERFCTR_L1D_TLB_REFILL 0x0005 +#define ARMV8_PMUV3_PERFCTR_LD_RETIRED 0x0006 +#define ARMV8_PMUV3_PERFCTR_ST_RETIRED 0x0007 +#define ARMV8_PMUV3_PERFCTR_INST_RETIRED 0x0008 +#define ARMV8_PMUV3_PERFCTR_EXC_TAKEN 0x0009 +#define ARMV8_PMUV3_PERFCTR_EXC_RETURN 0x000A +#define ARMV8_PMUV3_PERFCTR_CID_WRITE_RETIRED 0x000B +#define ARMV8_PMUV3_PERFCTR_PC_WRITE_RETIRED 0x000C +#define ARMV8_PMUV3_PERFCTR_BR_IMMED_RETIRED 0x000D +#define ARMV8_PMUV3_PERFCTR_BR_RETURN_RETIRED 0x000E +#define ARMV8_PMUV3_PERFCTR_UNALIGNED_LDST_RETIRED 0x000F +#define ARMV8_PMUV3_PERFCTR_BR_MIS_PRED 0x0010 +#define ARMV8_PMUV3_PERFCTR_CPU_CYCLES 0x0011 +#define ARMV8_PMUV3_PERFCTR_BR_PRED 0x0012 +#define ARMV8_PMUV3_PERFCTR_MEM_ACCESS 0x0013 +#define ARMV8_PMUV3_PERFCTR_L1I_CACHE 0x0014 +#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_WB 0x0015 +#define ARMV8_PMUV3_PERFCTR_L2D_CACHE 0x0016 +#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_REFILL 0x0017 +#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_WB 0x0018 +#define ARMV8_PMUV3_PERFCTR_BUS_ACCESS 0x0019 +#define ARMV8_PMUV3_PERFCTR_MEMORY_ERROR 0x001A +#define ARMV8_PMUV3_PERFCTR_INST_SPEC 0x001B +#define ARMV8_PMUV3_PERFCTR_TTBR_WRITE_RETIRED 0x001C +#define ARMV8_PMUV3_PERFCTR_BUS_CYCLES 0x001D +#define ARMV8_PMUV3_PERFCTR_CHAIN 0x001E +#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_ALLOCATE 0x001F +#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_ALLOCATE 0x0020 +#define ARMV8_PMUV3_PERFCTR_BR_RETIRED 0x0021 +#define ARMV8_PMUV3_PERFCTR_BR_MIS_PRED_RETIRED 0x0022 +#define ARMV8_PMUV3_PERFCTR_STALL_FRONTEND 0x0023 +#define ARMV8_PMUV3_PERFCTR_STALL_BACKEND 0x0024 +#define ARMV8_PMUV3_PERFCTR_L1D_TLB 0x0025 +#define ARMV8_PMUV3_PERFCTR_L1I_TLB 0x0026 +#define ARMV8_PMUV3_PERFCTR_L2I_CACHE 0x0027 +#define ARMV8_PMUV3_PERFCTR_L2I_CACHE_REFILL 0x0028 +#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_ALLOCATE 0x0029 +#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_REFILL 0x002A +#define ARMV8_PMUV3_PERFCTR_L3D_CACHE 0x002B +#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_WB 0x002C +#define ARMV8_PMUV3_PERFCTR_L2D_TLB_REFILL 0x002D +#define ARMV8_PMUV3_PERFCTR_L2I_TLB_REFILL 0x002E +#define ARMV8_PMUV3_PERFCTR_L2D_TLB 0x002F +#define ARMV8_PMUV3_PERFCTR_L2I_TLB 0x0030 +#define ARMV8_PMUV3_PERFCTR_REMOTE_ACCESS 0x0031 +#define ARMV8_PMUV3_PERFCTR_LL_CACHE 0x0032 +#define ARMV8_PMUV3_PERFCTR_LL_CACHE_MISS 0x0033 +#define ARMV8_PMUV3_PERFCTR_DTLB_WALK 0x0034 +#define ARMV8_PMUV3_PERFCTR_ITLB_WALK 0x0035 +#define ARMV8_PMUV3_PERFCTR_LL_CACHE_RD 0x0036 +#define ARMV8_PMUV3_PERFCTR_LL_CACHE_MISS_RD 0x0037 +#define ARMV8_PMUV3_PERFCTR_REMOTE_ACCESS_RD 0x0038 +#define ARMV8_PMUV3_PERFCTR_L1D_CACHE_LMISS_RD 0x0039 +#define ARMV8_PMUV3_PERFCTR_OP_RETIRED 0x003A +#define ARMV8_PMUV3_PERFCTR_OP_SPEC 0x003B +#define ARMV8_PMUV3_PERFCTR_STALL 0x003C +#define ARMV8_PMUV3_PERFCTR_STALL_SLOT_BACKEND 0x003D +#define ARMV8_PMUV3_PERFCTR_STALL_SLOT_FRONTEND 0x003E +#define ARMV8_PMUV3_PERFCTR_STALL_SLOT 0x003F + +/* Statistical profiling extension microarchitectural events */ +#define ARMV8_SPE_PERFCTR_SAMPLE_POP 0x4000 +#define ARMV8_SPE_PERFCTR_SAMPLE_FEED 0x4001 +#define ARMV8_SPE_PERFCTR_SAMPLE_FILTRATE 0x4002 +#define ARMV8_SPE_PERFCTR_SAMPLE_COLLISION 0x4003 + +/* AMUv1 architecture events */ +#define ARMV8_AMU_PERFCTR_CNT_CYCLES 0x4004 +#define ARMV8_AMU_PERFCTR_STALL_BACKEND_MEM 0x4005 + +/* long-latency read miss events */ +#define ARMV8_PMUV3_PERFCTR_L1I_CACHE_LMISS 0x4006 +#define ARMV8_PMUV3_PERFCTR_L2D_CACHE_LMISS_RD 0x4009 +#define ARMV8_PMUV3_PERFCTR_L2I_CACHE_LMISS 0x400A +#define ARMV8_PMUV3_PERFCTR_L3D_CACHE_LMISS_RD 0x400B + +/* Trace buffer events */ +#define ARMV8_PMUV3_PERFCTR_TRB_WRAP 0x400C +#define ARMV8_PMUV3_PERFCTR_TRB_TRIG 0x400E + +/* Trace unit events */ +#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT0 0x4010 +#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT1 0x4011 +#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT2 0x4012 +#define ARMV8_PMUV3_PERFCTR_TRCEXTOUT3 0x4013 +#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT4 0x4018 +#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT5 0x4019 +#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT6 0x401A +#define ARMV8_PMUV3_PERFCTR_CTI_TRIGOUT7 0x401B + +/* additional latency from alignment events */ +#define ARMV8_PMUV3_PERFCTR_LDST_ALIGN_LAT 0x4020 +#define ARMV8_PMUV3_PERFCTR_LD_ALIGN_LAT 0x4021 +#define ARMV8_PMUV3_PERFCTR_ST_ALIGN_LAT 0x4022 + +/* Armv8.5 Memory Tagging Extension events */ +#define ARMV8_MTE_PERFCTR_MEM_ACCESS_CHECKED 0x4024 +#define ARMV8_MTE_PERFCTR_MEM_ACCESS_CHECKED_RD 0x4025 +#define ARMV8_MTE_PERFCTR_MEM_ACCESS_CHECKED_WR 0x4026 + +/* ARMv8 recommended implementation defined event types */ +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_RD 0x0040 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WR 0x0041 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_RD 0x0042 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_WR 0x0043 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_INNER 0x0044 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_REFILL_OUTER 0x0045 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WB_VICTIM 0x0046 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_WB_CLEAN 0x0047 +#define ARMV8_IMPDEF_PERFCTR_L1D_CACHE_INVAL 0x0048 + +#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_REFILL_RD 0x004C +#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_REFILL_WR 0x004D +#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_RD 0x004E +#define ARMV8_IMPDEF_PERFCTR_L1D_TLB_WR 0x004F +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_RD 0x0050 +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_WR 0x0051 +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_REFILL_RD 0x0052 +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_REFILL_WR 0x0053 + +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_WB_VICTIM 0x0056 +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_WB_CLEAN 0x0057 +#define ARMV8_IMPDEF_PERFCTR_L2D_CACHE_INVAL 0x0058 + +#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_REFILL_RD 0x005C +#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_REFILL_WR 0x005D +#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_RD 0x005E +#define ARMV8_IMPDEF_PERFCTR_L2D_TLB_WR 0x005F +#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_RD 0x0060 +#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_WR 0x0061 +#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_SHARED 0x0062 +#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_NOT_SHARED 0x0063 +#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_NORMAL 0x0064 +#define ARMV8_IMPDEF_PERFCTR_BUS_ACCESS_PERIPH 0x0065 +#define ARMV8_IMPDEF_PERFCTR_MEM_ACCESS_RD 0x0066 +#define ARMV8_IMPDEF_PERFCTR_MEM_ACCESS_WR 0x0067 +#define ARMV8_IMPDEF_PERFCTR_UNALIGNED_LD_SPEC 0x0068 +#define ARMV8_IMPDEF_PERFCTR_UNALIGNED_ST_SPEC 0x0069 +#define ARMV8_IMPDEF_PERFCTR_UNALIGNED_LDST_SPEC 0x006A + +#define ARMV8_IMPDEF_PERFCTR_LDREX_SPEC 0x006C +#define ARMV8_IMPDEF_PERFCTR_STREX_PASS_SPEC 0x006D +#define ARMV8_IMPDEF_PERFCTR_STREX_FAIL_SPEC 0x006E +#define ARMV8_IMPDEF_PERFCTR_STREX_SPEC 0x006F +#define ARMV8_IMPDEF_PERFCTR_LD_SPEC 0x0070 +#define ARMV8_IMPDEF_PERFCTR_ST_SPEC 0x0071 +#define ARMV8_IMPDEF_PERFCTR_LDST_SPEC 0x0072 +#define ARMV8_IMPDEF_PERFCTR_DP_SPEC 0x0073 +#define ARMV8_IMPDEF_PERFCTR_ASE_SPEC 0x0074 +#define ARMV8_IMPDEF_PERFCTR_VFP_SPEC 0x0075 +#define ARMV8_IMPDEF_PERFCTR_PC_WRITE_SPEC 0x0076 +#define ARMV8_IMPDEF_PERFCTR_CRYPTO_SPEC 0x0077 +#define ARMV8_IMPDEF_PERFCTR_BR_IMMED_SPEC 0x0078 +#define ARMV8_IMPDEF_PERFCTR_BR_RETURN_SPEC 0x0079 +#define ARMV8_IMPDEF_PERFCTR_BR_INDIRECT_SPEC 0x007A + +#define ARMV8_IMPDEF_PERFCTR_ISB_SPEC 0x007C +#define ARMV8_IMPDEF_PERFCTR_DSB_SPEC 0x007D +#define ARMV8_IMPDEF_PERFCTR_DMB_SPEC 0x007E + +#define ARMV8_IMPDEF_PERFCTR_EXC_UNDEF 0x0081 +#define ARMV8_IMPDEF_PERFCTR_EXC_SVC 0x0082 +#define ARMV8_IMPDEF_PERFCTR_EXC_PABORT 0x0083 +#define ARMV8_IMPDEF_PERFCTR_EXC_DABORT 0x0084 + +#define ARMV8_IMPDEF_PERFCTR_EXC_IRQ 0x0086 +#define ARMV8_IMPDEF_PERFCTR_EXC_FIQ 0x0087 +#define ARMV8_IMPDEF_PERFCTR_EXC_SMC 0x0088 + +#define ARMV8_IMPDEF_PERFCTR_EXC_HVC 0x008A +#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_PABORT 0x008B +#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_DABORT 0x008C +#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_OTHER 0x008D +#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_IRQ 0x008E +#define ARMV8_IMPDEF_PERFCTR_EXC_TRAP_FIQ 0x008F +#define ARMV8_IMPDEF_PERFCTR_RC_LD_SPEC 0x0090 +#define ARMV8_IMPDEF_PERFCTR_RC_ST_SPEC 0x0091 + +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_RD 0x00A0 +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_WR 0x00A1 +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_REFILL_RD 0x00A2 +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_REFILL_WR 0x00A3 + +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_WB_VICTIM 0x00A6 +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_WB_CLEAN 0x00A7 +#define ARMV8_IMPDEF_PERFCTR_L3D_CACHE_INVAL 0x00A8 + +/* + * Per-CPU PMCR: config reg + */ +#define ARMV8_PMU_PMCR_E (1 << 0) /* Enable all counters */ +#define ARMV8_PMU_PMCR_P (1 << 1) /* Reset all counters */ +#define ARMV8_PMU_PMCR_C (1 << 2) /* Cycle counter reset */ +#define ARMV8_PMU_PMCR_D (1 << 3) /* CCNT counts every 64th cpu cycle */ +#define ARMV8_PMU_PMCR_X (1 << 4) /* Export to ETM */ +#define ARMV8_PMU_PMCR_DP (1 << 5) /* Disable CCNT if non-invasive debug*/ +#define ARMV8_PMU_PMCR_LC (1 << 6) /* Overflow on 64 bit cycle counter */ +#define ARMV8_PMU_PMCR_LP (1 << 7) /* Long event counter enable */ +#define ARMV8_PMU_PMCR_N_SHIFT 11 /* Number of counters supported */ +#define ARMV8_PMU_PMCR_N_MASK 0x1f +#define ARMV8_PMU_PMCR_MASK 0xff /* Mask for writable bits */ + +/* + * PMOVSR: counters overflow flag status reg + */ +#define ARMV8_PMU_OVSR_MASK 0xffffffff /* Mask for writable bits */ +#define ARMV8_PMU_OVERFLOWED_MASK ARMV8_PMU_OVSR_MASK + +/* + * PMXEVTYPER: Event selection reg + */ +#define ARMV8_PMU_EVTYPE_MASK 0xc800ffff /* Mask for writable bits */ +#define ARMV8_PMU_EVTYPE_EVENT 0xffff /* Mask for EVENT bits */ + +/* + * Event filters for PMUv3 + */ +#define ARMV8_PMU_EXCLUDE_EL1 (1U << 31) +#define ARMV8_PMU_EXCLUDE_EL0 (1U << 30) +#define ARMV8_PMU_INCLUDE_EL2 (1U << 27) + +/* + * PMUSERENR: user enable reg + */ +#define ARMV8_PMU_USERENR_MASK 0xf /* Mask for writable bits */ +#define ARMV8_PMU_USERENR_EN (1 << 0) /* PMU regs can be accessed at EL0 */ +#define ARMV8_PMU_USERENR_SW (1 << 1) /* PMSWINC can be written at EL0 */ +#define ARMV8_PMU_USERENR_CR (1 << 2) /* Cycle counter can be read at EL0 */ +#define ARMV8_PMU_USERENR_ER (1 << 3) /* Event counter can be read at EL0 */ + +/* PMMIR_EL1.SLOTS mask */ +#define ARMV8_PMU_SLOTS_MASK 0xff + +#define ARMV8_PMU_BUS_SLOTS_SHIFT 8 +#define ARMV8_PMU_BUS_SLOTS_MASK 0xff +#define ARMV8_PMU_BUS_WIDTH_SHIFT 16 +#define ARMV8_PMU_BUS_WIDTH_MASK 0xf + +#endif From 55cfecdaaad71d280b179444f0da007d49ba63b4 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Fri, 17 Mar 2023 15:50:21 -0400 Subject: [PATCH 18/93] UPSTREAM: arm64: perf: Abstract system register accesses away As we want to enable 32bit support, we need to distanciate the PMUv3 driver from the AArch64 system register names. This patch moves all system register accesses to an architecture specific include file, allowing the 32bit counterpart to be slotted in at a later time. Change-Id: Ib5c22a45d2b0ed844ee7d03cb7a7fa855230fcca Signed-off-by: Marc Zyngier Co-developed-by: Zaid Al-Bassam Signed-off-by: Zaid Al-Bassam Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-3-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit df29ddf4f04b00cf60669686dc7f534c3ed7c433) Signed-off-by: Danesh Petigara --- arch/arm64/include/asm/arm_pmuv3.h | 137 +++++++++++++++++++++++++++++ drivers/perf/arm_pmuv3.c | 115 +++++------------------- include/linux/perf/arm_pmuv3.h | 45 ++++++++++ 3 files changed, 205 insertions(+), 92 deletions(-) create mode 100644 arch/arm64/include/asm/arm_pmuv3.h diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h new file mode 100644 index 000000000000..c444cbfb3acd --- /dev/null +++ b/arch/arm64/include/asm/arm_pmuv3.h @@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2012 ARM Ltd. + */ + +#ifndef __ASM_PMUV3_H +#define __ASM_PMUV3_H + +#include +#include + +#define RETURN_READ_PMEVCNTRN(n) \ + return read_sysreg(pmevcntr##n##_el0) +static unsigned long read_pmevcntrn(int n) +{ + PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN); + return 0; +} + +#define WRITE_PMEVCNTRN(n) \ + write_sysreg(val, pmevcntr##n##_el0) +static void write_pmevcntrn(int n, unsigned long val) +{ + PMEVN_SWITCH(n, WRITE_PMEVCNTRN); +} + +#define WRITE_PMEVTYPERN(n) \ + write_sysreg(val, pmevtyper##n##_el0) +static void write_pmevtypern(int n, unsigned long val) +{ + PMEVN_SWITCH(n, WRITE_PMEVTYPERN); +} + +static inline unsigned long read_pmmir(void) +{ + return read_cpuid(PMMIR_EL1); +} + +static inline u32 read_pmuver(void) +{ + u64 dfr0 = read_sysreg(id_aa64dfr0_el1); + + return cpuid_feature_extract_unsigned_field(dfr0, + ID_AA64DFR0_EL1_PMUVer_SHIFT); +} + +static inline void write_pmcr(u32 val) +{ + write_sysreg(val, pmcr_el0); +} + +static inline u32 read_pmcr(void) +{ + return read_sysreg(pmcr_el0); +} + +static inline void write_pmselr(u32 val) +{ + write_sysreg(val, pmselr_el0); +} + +static inline void write_pmccntr(u64 val) +{ + write_sysreg(val, pmccntr_el0); +} + +static inline u64 read_pmccntr(void) +{ + return read_sysreg(pmccntr_el0); +} + +static inline void write_pmxevcntr(u32 val) +{ + write_sysreg(val, pmxevcntr_el0); +} + +static inline u32 read_pmxevcntr(void) +{ + return read_sysreg(pmxevcntr_el0); +} + +static inline void write_pmxevtyper(u32 val) +{ + write_sysreg(val, pmxevtyper_el0); +} + +static inline void write_pmcntenset(u32 val) +{ + write_sysreg(val, pmcntenset_el0); +} + +static inline void write_pmcntenclr(u32 val) +{ + write_sysreg(val, pmcntenclr_el0); +} + +static inline void write_pmintenset(u32 val) +{ + write_sysreg(val, pmintenset_el1); +} + +static inline void write_pmintenclr(u32 val) +{ + write_sysreg(val, pmintenclr_el1); +} + +static inline void write_pmccfiltr(u32 val) +{ + write_sysreg(val, pmccfiltr_el0); +} + +static inline void write_pmovsclr(u32 val) +{ + write_sysreg(val, pmovsclr_el0); +} + +static inline u32 read_pmovsclr(void) +{ + return read_sysreg(pmovsclr_el0); +} + +static inline void write_pmuserenr(u32 val) +{ + write_sysreg(val, pmuserenr_el0); +} + +static inline u32 read_pmceid0(void) +{ + return read_sysreg(pmceid0_el0); +} + +static inline u32 read_pmceid1(void) +{ + return read_sysreg(pmceid1_el0); +} + +#endif diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index a6e0c015f55e..4f3a5dc316ed 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -25,6 +24,8 @@ #include #include +#include + /* ARMv8 Cortex-A53 specific event types. */ #define ARMV8_A53_PERFCTR_PREF_LINEFILL 0xC2 @@ -429,83 +430,16 @@ static inline bool armv8pmu_event_is_chained(struct perf_event *event) #define ARMV8_IDX_TO_COUNTER(x) \ (((x) - ARMV8_IDX_COUNTER0) & ARMV8_PMU_COUNTER_MASK) -/* - * This code is really good - */ - -#define PMEVN_CASE(n, case_macro) \ - case n: case_macro(n); break - -#define PMEVN_SWITCH(x, case_macro) \ - do { \ - switch (x) { \ - PMEVN_CASE(0, case_macro); \ - PMEVN_CASE(1, case_macro); \ - PMEVN_CASE(2, case_macro); \ - PMEVN_CASE(3, case_macro); \ - PMEVN_CASE(4, case_macro); \ - PMEVN_CASE(5, case_macro); \ - PMEVN_CASE(6, case_macro); \ - PMEVN_CASE(7, case_macro); \ - PMEVN_CASE(8, case_macro); \ - PMEVN_CASE(9, case_macro); \ - PMEVN_CASE(10, case_macro); \ - PMEVN_CASE(11, case_macro); \ - PMEVN_CASE(12, case_macro); \ - PMEVN_CASE(13, case_macro); \ - PMEVN_CASE(14, case_macro); \ - PMEVN_CASE(15, case_macro); \ - PMEVN_CASE(16, case_macro); \ - PMEVN_CASE(17, case_macro); \ - PMEVN_CASE(18, case_macro); \ - PMEVN_CASE(19, case_macro); \ - PMEVN_CASE(20, case_macro); \ - PMEVN_CASE(21, case_macro); \ - PMEVN_CASE(22, case_macro); \ - PMEVN_CASE(23, case_macro); \ - PMEVN_CASE(24, case_macro); \ - PMEVN_CASE(25, case_macro); \ - PMEVN_CASE(26, case_macro); \ - PMEVN_CASE(27, case_macro); \ - PMEVN_CASE(28, case_macro); \ - PMEVN_CASE(29, case_macro); \ - PMEVN_CASE(30, case_macro); \ - default: WARN(1, "Invalid PMEV* index\n"); \ - } \ - } while (0) - -#define RETURN_READ_PMEVCNTRN(n) \ - return read_sysreg(pmevcntr##n##_el0) -static unsigned long read_pmevcntrn(int n) -{ - PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN); - return 0; -} - -#define WRITE_PMEVCNTRN(n) \ - write_sysreg(val, pmevcntr##n##_el0) -static void write_pmevcntrn(int n, unsigned long val) -{ - PMEVN_SWITCH(n, WRITE_PMEVCNTRN); -} - -#define WRITE_PMEVTYPERN(n) \ - write_sysreg(val, pmevtyper##n##_el0) -static void write_pmevtypern(int n, unsigned long val) -{ - PMEVN_SWITCH(n, WRITE_PMEVTYPERN); -} - static inline u32 armv8pmu_pmcr_read(void) { - return read_sysreg(pmcr_el0); + return read_pmcr(); } static inline void armv8pmu_pmcr_write(u32 val) { val &= ARMV8_PMU_PMCR_MASK; isb(); - write_sysreg(val, pmcr_el0); + write_pmcr(val); } static inline int armv8pmu_has_overflowed(u32 pmovsr) @@ -580,7 +514,7 @@ static u64 armv8pmu_read_counter(struct perf_event *event) u64 value; if (idx == ARMV8_IDX_CYCLE_COUNTER) - value = read_sysreg(pmccntr_el0); + value = read_pmccntr(); else value = armv8pmu_read_hw_counter(event); @@ -615,7 +549,7 @@ static void armv8pmu_write_counter(struct perf_event *event, u64 value) value = armv8pmu_bias_long_counter(event, value); if (idx == ARMV8_IDX_CYCLE_COUNTER) - write_sysreg(value, pmccntr_el0); + write_pmccntr(value); else armv8pmu_write_hw_counter(event, value); } @@ -646,7 +580,7 @@ static inline void armv8pmu_write_event_type(struct perf_event *event) armv8pmu_write_evtype(idx, chain_evt); } else { if (idx == ARMV8_IDX_CYCLE_COUNTER) - write_sysreg(hwc->config_base, pmccfiltr_el0); + write_pmccfiltr(hwc->config_base); else armv8pmu_write_evtype(idx, hwc->config_base); } @@ -669,7 +603,7 @@ static inline void armv8pmu_enable_counter(u32 mask) * enable the counter. * */ isb(); - write_sysreg(mask, pmcntenset_el0); + write_pmcntenset(mask); } static inline void armv8pmu_enable_event_counter(struct perf_event *event) @@ -686,7 +620,7 @@ static inline void armv8pmu_enable_event_counter(struct perf_event *event) static inline void armv8pmu_disable_counter(u32 mask) { - write_sysreg(mask, pmcntenclr_el0); + write_pmcntenclr(mask); /* * Make sure the effects of disabling the counter are visible before we * start configuring the event. @@ -708,7 +642,7 @@ static inline void armv8pmu_disable_event_counter(struct perf_event *event) static inline void armv8pmu_enable_intens(u32 mask) { - write_sysreg(mask, pmintenset_el1); + write_pmintenset(mask); } static inline void armv8pmu_enable_event_irq(struct perf_event *event) @@ -719,10 +653,10 @@ static inline void armv8pmu_enable_event_irq(struct perf_event *event) static inline void armv8pmu_disable_intens(u32 mask) { - write_sysreg(mask, pmintenclr_el1); + write_pmintenclr(mask); isb(); /* Clear the overflow flag in case an interrupt is pending. */ - write_sysreg(mask, pmovsclr_el0); + write_pmovsclr(mask); isb(); } @@ -737,18 +671,18 @@ static inline u32 armv8pmu_getreset_flags(void) u32 value; /* Read */ - value = read_sysreg(pmovsclr_el0); + value = read_pmovsclr(); /* Write to clear flags */ value &= ARMV8_PMU_OVSR_MASK; - write_sysreg(value, pmovsclr_el0); + write_pmovsclr(value); return value; } static void armv8pmu_disable_user_access(void) { - write_sysreg(0, pmuserenr_el0); + write_pmuserenr(0); } static void armv8pmu_enable_user_access(struct arm_pmu *cpu_pmu) @@ -759,13 +693,13 @@ static void armv8pmu_enable_user_access(struct arm_pmu *cpu_pmu) /* Clear any unused counters to avoid leaking their contents */ for_each_clear_bit(i, cpuc->used_mask, cpu_pmu->num_events) { if (i == ARMV8_IDX_CYCLE_COUNTER) - write_sysreg(0, pmccntr_el0); + write_pmccntr(0); else armv8pmu_write_evcntr(i, 0); } - write_sysreg(0, pmuserenr_el0); - write_sysreg(ARMV8_PMU_USERENR_ER | ARMV8_PMU_USERENR_CR, pmuserenr_el0); + write_pmuserenr(0); + write_pmuserenr(ARMV8_PMU_USERENR_ER | ARMV8_PMU_USERENR_CR); } static void armv8pmu_enable_event(struct perf_event *event) @@ -1143,14 +1077,11 @@ static void __armv8pmu_probe_pmu(void *info) { struct armv8pmu_probe_info *probe = info; struct arm_pmu *cpu_pmu = probe->pmu; - u64 dfr0; u64 pmceid_raw[2]; u32 pmceid[2]; int pmuver; - dfr0 = read_sysreg(id_aa64dfr0_el1); - pmuver = cpuid_feature_extract_unsigned_field(dfr0, - ID_AA64DFR0_EL1_PMUVer_SHIFT); + pmuver = read_pmuver(); if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF || pmuver == ID_AA64DFR0_EL1_PMUVer_NI) return; @@ -1165,8 +1096,8 @@ static void __armv8pmu_probe_pmu(void *info) /* Add the CPU cycles counter */ cpu_pmu->num_events += 1; - pmceid[0] = pmceid_raw[0] = read_sysreg(pmceid0_el0); - pmceid[1] = pmceid_raw[1] = read_sysreg(pmceid1_el0); + pmceid[0] = pmceid_raw[0] = read_pmceid0(); + pmceid[1] = pmceid_raw[1] = read_pmceid1(); bitmap_from_arr32(cpu_pmu->pmceid_bitmap, pmceid, ARMV8_PMUV3_MAX_COMMON_EVENTS); @@ -1177,9 +1108,9 @@ static void __armv8pmu_probe_pmu(void *info) bitmap_from_arr32(cpu_pmu->pmceid_ext_bitmap, pmceid, ARMV8_PMUV3_MAX_COMMON_EVENTS); - /* store PMMIR_EL1 register for sysfs */ + /* store PMMIR register for sysfs */ if (pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4 && (pmceid_raw[1] & BIT(31))) - cpu_pmu->reg_pmmir = read_cpuid(PMMIR_EL1); + cpu_pmu->reg_pmmir = read_pmmir(); else cpu_pmu->reg_pmmir = 0; } diff --git a/include/linux/perf/arm_pmuv3.h b/include/linux/perf/arm_pmuv3.h index 53173abfc022..e3899bd77f5c 100644 --- a/include/linux/perf/arm_pmuv3.h +++ b/include/linux/perf/arm_pmuv3.h @@ -255,4 +255,49 @@ #define ARMV8_PMU_BUS_WIDTH_SHIFT 16 #define ARMV8_PMU_BUS_WIDTH_MASK 0xf +/* + * This code is really good + */ + +#define PMEVN_CASE(n, case_macro) \ + case n: case_macro(n); break + +#define PMEVN_SWITCH(x, case_macro) \ + do { \ + switch (x) { \ + PMEVN_CASE(0, case_macro); \ + PMEVN_CASE(1, case_macro); \ + PMEVN_CASE(2, case_macro); \ + PMEVN_CASE(3, case_macro); \ + PMEVN_CASE(4, case_macro); \ + PMEVN_CASE(5, case_macro); \ + PMEVN_CASE(6, case_macro); \ + PMEVN_CASE(7, case_macro); \ + PMEVN_CASE(8, case_macro); \ + PMEVN_CASE(9, case_macro); \ + PMEVN_CASE(10, case_macro); \ + PMEVN_CASE(11, case_macro); \ + PMEVN_CASE(12, case_macro); \ + PMEVN_CASE(13, case_macro); \ + PMEVN_CASE(14, case_macro); \ + PMEVN_CASE(15, case_macro); \ + PMEVN_CASE(16, case_macro); \ + PMEVN_CASE(17, case_macro); \ + PMEVN_CASE(18, case_macro); \ + PMEVN_CASE(19, case_macro); \ + PMEVN_CASE(20, case_macro); \ + PMEVN_CASE(21, case_macro); \ + PMEVN_CASE(22, case_macro); \ + PMEVN_CASE(23, case_macro); \ + PMEVN_CASE(24, case_macro); \ + PMEVN_CASE(25, case_macro); \ + PMEVN_CASE(26, case_macro); \ + PMEVN_CASE(27, case_macro); \ + PMEVN_CASE(28, case_macro); \ + PMEVN_CASE(29, case_macro); \ + PMEVN_CASE(30, case_macro); \ + default: WARN(1, "Invalid PMEV* index\n"); \ + } \ + } while (0) + #endif From 3e7e6fa4da7c6f39974ba774e2536354b367c1a6 Mon Sep 17 00:00:00 2001 From: Zaid Al-Bassam Date: Fri, 17 Mar 2023 15:50:22 -0400 Subject: [PATCH 19/93] UPSTREAM: perf: pmuv3: Abstract PMU version checks The current PMU version definitions are available for arm64 only, As we want to add PMUv3 support to arm (32-bit), abstracts these definitions by using arch-specific helpers. Change-Id: I4d487c354c5b1384d2e8c95d097c0d3864907787 Signed-off-by: Zaid Al-Bassam Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-4-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit 711432770f78e5a9ae235a1a55decfb71993c958) Signed-off-by: Danesh Petigara --- arch/arm64/include/asm/arm_pmuv3.h | 16 ++++++++++++++++ drivers/perf/arm_pmuv3.c | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h index c444cbfb3acd..80cdfa4c3e88 100644 --- a/arch/arm64/include/asm/arm_pmuv3.h +++ b/arch/arm64/include/asm/arm_pmuv3.h @@ -134,4 +134,20 @@ static inline u32 read_pmceid1(void) return read_sysreg(pmceid1_el0); } +static inline bool pmuv3_implemented(int pmuver) +{ + return !(pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF || + pmuver == ID_AA64DFR0_EL1_PMUVer_NI); +} + +static inline bool is_pmuv3p4(int pmuver) +{ + return pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4; +} + +static inline bool is_pmuv3p5(int pmuver) +{ + return pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P5; +} + #endif diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 4f3a5dc316ed..e7e0309d0dc8 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -396,7 +396,7 @@ static const struct attribute_group armv8_pmuv3_caps_attr_group = { */ static bool armv8pmu_has_long_event(struct arm_pmu *cpu_pmu) { - return (cpu_pmu->pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P5); + return (is_pmuv3p5(cpu_pmu->pmuver)); } static inline bool armv8pmu_event_has_user_read(struct perf_event *event) @@ -1082,8 +1082,7 @@ static void __armv8pmu_probe_pmu(void *info) int pmuver; pmuver = read_pmuver(); - if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF || - pmuver == ID_AA64DFR0_EL1_PMUVer_NI) + if (!pmuv3_implemented(pmuver)) return; cpu_pmu->pmuver = pmuver; @@ -1109,7 +1108,7 @@ static void __armv8pmu_probe_pmu(void *info) pmceid, ARMV8_PMUV3_MAX_COMMON_EVENTS); /* store PMMIR register for sysfs */ - if (pmuver >= ID_AA64DFR0_EL1_PMUVer_V3P4 && (pmceid_raw[1] & BIT(31))) + if (is_pmuv3p4(pmuver) && (pmceid_raw[1] & BIT(31))) cpu_pmu->reg_pmmir = read_pmmir(); else cpu_pmu->reg_pmmir = 0; From ab26945ffd60d8b63dd820c5088c4d3a40ec169d Mon Sep 17 00:00:00 2001 From: Zaid Al-Bassam Date: Fri, 17 Mar 2023 15:50:23 -0400 Subject: [PATCH 20/93] UPSTREAM: perf: pmuv3: Move inclusion of kvm_host.h to the arch-specific helper KVM host support is available only on arm64. By moving the inclusion of kvm_host.h to an arm64-specific file, the 32bit architecture will be able to implement dummy helpers. Change-Id: I219958c7d95fa89b3fadcfaa73eec7392717a534 Signed-off-by: Zaid Al-Bassam Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-5-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit 11fba29a8a1f2fca08f301426b15c62d8a0b8040) Signed-off-by: Danesh Petigara --- arch/arm64/include/asm/arm_pmuv3.h | 2 ++ drivers/perf/arm_pmuv3.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h index 80cdfa4c3e88..d6b51deb7bf0 100644 --- a/arch/arm64/include/asm/arm_pmuv3.h +++ b/arch/arm64/include/asm/arm_pmuv3.h @@ -6,6 +6,8 @@ #ifndef __ASM_PMUV3_H #define __ASM_PMUV3_H +#include + #include #include diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index e7e0309d0dc8..f96ec4c9f268 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -16,7 +16,6 @@ #include #include -#include #include #include #include From 9d0a91c9934fa12a7e1c07d12168bb0e58992f65 Mon Sep 17 00:00:00 2001 From: Zaid Al-Bassam Date: Fri, 17 Mar 2023 15:50:24 -0400 Subject: [PATCH 21/93] UPSTREAM: perf: pmuv3: Change GENMASK to GENMASK_ULL GENMASK macro uses "unsigned long" (32-bit wide on arm and 64-bit on arm64), This causes build issues when enabling PMUv3 on arm as it tries to access bits > 31. This patch switches the GENMASK to GENMASK_ULL, which uses "unsigned long long" (64-bit on both arm and arm64). Change-Id: I44e30f5326202a4e691bf70ce15ac5c946cca19a Signed-off-by: Zaid Al-Bassam Acked-by: Marc Zyngier Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-6-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit b3a070869f39be4fad9ea4d99f2c8fab1fb7eead) Signed-off-by: Danesh Petigara --- drivers/perf/arm_pmuv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index f96ec4c9f268..ba576a3f2770 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -493,7 +493,7 @@ static bool armv8pmu_event_needs_bias(struct perf_event *event) static u64 armv8pmu_bias_long_counter(struct perf_event *event, u64 value) { if (armv8pmu_event_needs_bias(event)) - value |= GENMASK(63, 32); + value |= GENMASK_ULL(63, 32); return value; } @@ -501,7 +501,7 @@ static u64 armv8pmu_bias_long_counter(struct perf_event *event, u64 value) static u64 armv8pmu_unbias_long_counter(struct perf_event *event, u64 value) { if (armv8pmu_event_needs_bias(event)) - value &= ~GENMASK(63, 32); + value &= ~GENMASK_ULL(63, 32); return value; } From 393be9f6d0dd9cb9a6407e71830b57c0bd4d9372 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Fri, 17 Mar 2023 15:50:25 -0400 Subject: [PATCH 22/93] UPSTREAM: ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations ARMv8 is a superset of ARMv7, and all the ARMv8 features are discoverable with a set of ID registers. It means that we can use CPU_V7 to guard ARMv8 features at compile time. This commit simply amends the CPU_V7 configuration symbol comment to reflect that CPU_V7 also covers ARMv8. Change-Id: Ibfa141b7fcf77619cea6f95d562b8ddf959187a3 Signed-off-by: Marc Zyngier Signed-off-by: Zaid Al-Bassam Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-7-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit 252309adc81f529d42c8c90a4965866ec82cb6ad) Signed-off-by: Danesh Petigara --- arch/arm/mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index fc439c2c16f8..c03e79abc391 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -403,7 +403,7 @@ config CPU_V6K select CPU_THUMB_CAPABLE select CPU_TLB_V6 if MMU -# ARMv7 +# ARMv7 and ARMv8 architectures config CPU_V7 bool select CPU_32v6K From bf3022d3c3f5f7000b04c37430056be62d13b2e4 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Fri, 17 Mar 2023 15:50:26 -0400 Subject: [PATCH 23/93] UPSTREAM: ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM The only thing stopping the PMUv3 driver from compiling on 32bit is the lack of defined system registers names and the handful of required helpers. This is easily solved by providing the sysreg accessors and updating the Kconfig entry. Change-Id: I3f7f46feaeac69bb7d20c86b013e4a3091fb4bce Signed-off-by: Marc Zyngier Co-developed-by: Zaid Al-Bassam Signed-off-by: Zaid Al-Bassam Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20230317195027.3746949-8-zalbassam@google.com Signed-off-by: Will Deacon (cherry picked from commit 009d6dc87a568db62290b8dc0a517b612217b6da) Signed-off-by: Danesh Petigara --- arch/arm/include/asm/arm_pmuv3.h | 247 +++++++++++++++++++++++++++++++ drivers/perf/Kconfig | 5 +- drivers/perf/arm_pmuv3.c | 5 +- 3 files changed, 253 insertions(+), 4 deletions(-) create mode 100644 arch/arm/include/asm/arm_pmuv3.h diff --git a/arch/arm/include/asm/arm_pmuv3.h b/arch/arm/include/asm/arm_pmuv3.h new file mode 100644 index 000000000000..78d3d4b82c6c --- /dev/null +++ b/arch/arm/include/asm/arm_pmuv3.h @@ -0,0 +1,247 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2012 ARM Ltd. + */ + +#ifndef __ASM_PMUV3_H +#define __ASM_PMUV3_H + +#include +#include + +#define PMCCNTR __ACCESS_CP15_64(0, c9) + +#define PMCR __ACCESS_CP15(c9, 0, c12, 0) +#define PMCNTENSET __ACCESS_CP15(c9, 0, c12, 1) +#define PMCNTENCLR __ACCESS_CP15(c9, 0, c12, 2) +#define PMOVSR __ACCESS_CP15(c9, 0, c12, 3) +#define PMSELR __ACCESS_CP15(c9, 0, c12, 5) +#define PMCEID0 __ACCESS_CP15(c9, 0, c12, 6) +#define PMCEID1 __ACCESS_CP15(c9, 0, c12, 7) +#define PMXEVTYPER __ACCESS_CP15(c9, 0, c13, 1) +#define PMXEVCNTR __ACCESS_CP15(c9, 0, c13, 2) +#define PMUSERENR __ACCESS_CP15(c9, 0, c14, 0) +#define PMINTENSET __ACCESS_CP15(c9, 0, c14, 1) +#define PMINTENCLR __ACCESS_CP15(c9, 0, c14, 2) +#define PMMIR __ACCESS_CP15(c9, 0, c14, 6) +#define PMCCFILTR __ACCESS_CP15(c14, 0, c15, 7) + +#define PMEVCNTR0 __ACCESS_CP15(c14, 0, c8, 0) +#define PMEVCNTR1 __ACCESS_CP15(c14, 0, c8, 1) +#define PMEVCNTR2 __ACCESS_CP15(c14, 0, c8, 2) +#define PMEVCNTR3 __ACCESS_CP15(c14, 0, c8, 3) +#define PMEVCNTR4 __ACCESS_CP15(c14, 0, c8, 4) +#define PMEVCNTR5 __ACCESS_CP15(c14, 0, c8, 5) +#define PMEVCNTR6 __ACCESS_CP15(c14, 0, c8, 6) +#define PMEVCNTR7 __ACCESS_CP15(c14, 0, c8, 7) +#define PMEVCNTR8 __ACCESS_CP15(c14, 0, c9, 0) +#define PMEVCNTR9 __ACCESS_CP15(c14, 0, c9, 1) +#define PMEVCNTR10 __ACCESS_CP15(c14, 0, c9, 2) +#define PMEVCNTR11 __ACCESS_CP15(c14, 0, c9, 3) +#define PMEVCNTR12 __ACCESS_CP15(c14, 0, c9, 4) +#define PMEVCNTR13 __ACCESS_CP15(c14, 0, c9, 5) +#define PMEVCNTR14 __ACCESS_CP15(c14, 0, c9, 6) +#define PMEVCNTR15 __ACCESS_CP15(c14, 0, c9, 7) +#define PMEVCNTR16 __ACCESS_CP15(c14, 0, c10, 0) +#define PMEVCNTR17 __ACCESS_CP15(c14, 0, c10, 1) +#define PMEVCNTR18 __ACCESS_CP15(c14, 0, c10, 2) +#define PMEVCNTR19 __ACCESS_CP15(c14, 0, c10, 3) +#define PMEVCNTR20 __ACCESS_CP15(c14, 0, c10, 4) +#define PMEVCNTR21 __ACCESS_CP15(c14, 0, c10, 5) +#define PMEVCNTR22 __ACCESS_CP15(c14, 0, c10, 6) +#define PMEVCNTR23 __ACCESS_CP15(c14, 0, c10, 7) +#define PMEVCNTR24 __ACCESS_CP15(c14, 0, c11, 0) +#define PMEVCNTR25 __ACCESS_CP15(c14, 0, c11, 1) +#define PMEVCNTR26 __ACCESS_CP15(c14, 0, c11, 2) +#define PMEVCNTR27 __ACCESS_CP15(c14, 0, c11, 3) +#define PMEVCNTR28 __ACCESS_CP15(c14, 0, c11, 4) +#define PMEVCNTR29 __ACCESS_CP15(c14, 0, c11, 5) +#define PMEVCNTR30 __ACCESS_CP15(c14, 0, c11, 6) + +#define PMEVTYPER0 __ACCESS_CP15(c14, 0, c12, 0) +#define PMEVTYPER1 __ACCESS_CP15(c14, 0, c12, 1) +#define PMEVTYPER2 __ACCESS_CP15(c14, 0, c12, 2) +#define PMEVTYPER3 __ACCESS_CP15(c14, 0, c12, 3) +#define PMEVTYPER4 __ACCESS_CP15(c14, 0, c12, 4) +#define PMEVTYPER5 __ACCESS_CP15(c14, 0, c12, 5) +#define PMEVTYPER6 __ACCESS_CP15(c14, 0, c12, 6) +#define PMEVTYPER7 __ACCESS_CP15(c14, 0, c12, 7) +#define PMEVTYPER8 __ACCESS_CP15(c14, 0, c13, 0) +#define PMEVTYPER9 __ACCESS_CP15(c14, 0, c13, 1) +#define PMEVTYPER10 __ACCESS_CP15(c14, 0, c13, 2) +#define PMEVTYPER11 __ACCESS_CP15(c14, 0, c13, 3) +#define PMEVTYPER12 __ACCESS_CP15(c14, 0, c13, 4) +#define PMEVTYPER13 __ACCESS_CP15(c14, 0, c13, 5) +#define PMEVTYPER14 __ACCESS_CP15(c14, 0, c13, 6) +#define PMEVTYPER15 __ACCESS_CP15(c14, 0, c13, 7) +#define PMEVTYPER16 __ACCESS_CP15(c14, 0, c14, 0) +#define PMEVTYPER17 __ACCESS_CP15(c14, 0, c14, 1) +#define PMEVTYPER18 __ACCESS_CP15(c14, 0, c14, 2) +#define PMEVTYPER19 __ACCESS_CP15(c14, 0, c14, 3) +#define PMEVTYPER20 __ACCESS_CP15(c14, 0, c14, 4) +#define PMEVTYPER21 __ACCESS_CP15(c14, 0, c14, 5) +#define PMEVTYPER22 __ACCESS_CP15(c14, 0, c14, 6) +#define PMEVTYPER23 __ACCESS_CP15(c14, 0, c14, 7) +#define PMEVTYPER24 __ACCESS_CP15(c14, 0, c15, 0) +#define PMEVTYPER25 __ACCESS_CP15(c14, 0, c15, 1) +#define PMEVTYPER26 __ACCESS_CP15(c14, 0, c15, 2) +#define PMEVTYPER27 __ACCESS_CP15(c14, 0, c15, 3) +#define PMEVTYPER28 __ACCESS_CP15(c14, 0, c15, 4) +#define PMEVTYPER29 __ACCESS_CP15(c14, 0, c15, 5) +#define PMEVTYPER30 __ACCESS_CP15(c14, 0, c15, 6) + +#define RETURN_READ_PMEVCNTRN(n) \ + return read_sysreg(PMEVCNTR##n) +static unsigned long read_pmevcntrn(int n) +{ + PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN); + return 0; +} + +#define WRITE_PMEVCNTRN(n) \ + write_sysreg(val, PMEVCNTR##n) +static void write_pmevcntrn(int n, unsigned long val) +{ + PMEVN_SWITCH(n, WRITE_PMEVCNTRN); +} + +#define WRITE_PMEVTYPERN(n) \ + write_sysreg(val, PMEVTYPER##n) +static void write_pmevtypern(int n, unsigned long val) +{ + PMEVN_SWITCH(n, WRITE_PMEVTYPERN); +} + +static inline unsigned long read_pmmir(void) +{ + return read_sysreg(PMMIR); +} + +static inline u32 read_pmuver(void) +{ + /* PMUVers is not a signed field */ + u32 dfr0 = read_cpuid_ext(CPUID_EXT_DFR0); + + return (dfr0 >> 24) & 0xf; +} + +static inline void write_pmcr(u32 val) +{ + write_sysreg(val, PMCR); +} + +static inline u32 read_pmcr(void) +{ + return read_sysreg(PMCR); +} + +static inline void write_pmselr(u32 val) +{ + write_sysreg(val, PMSELR); +} + +static inline void write_pmccntr(u64 val) +{ + write_sysreg(val, PMCCNTR); +} + +static inline u64 read_pmccntr(void) +{ + return read_sysreg(PMCCNTR); +} + +static inline void write_pmxevcntr(u32 val) +{ + write_sysreg(val, PMXEVCNTR); +} + +static inline u32 read_pmxevcntr(void) +{ + return read_sysreg(PMXEVCNTR); +} + +static inline void write_pmxevtyper(u32 val) +{ + write_sysreg(val, PMXEVTYPER); +} + +static inline void write_pmcntenset(u32 val) +{ + write_sysreg(val, PMCNTENSET); +} + +static inline void write_pmcntenclr(u32 val) +{ + write_sysreg(val, PMCNTENCLR); +} + +static inline void write_pmintenset(u32 val) +{ + write_sysreg(val, PMINTENSET); +} + +static inline void write_pmintenclr(u32 val) +{ + write_sysreg(val, PMINTENCLR); +} + +static inline void write_pmccfiltr(u32 val) +{ + write_sysreg(val, PMCCFILTR); +} + +static inline void write_pmovsclr(u32 val) +{ + write_sysreg(val, PMOVSR); +} + +static inline u32 read_pmovsclr(void) +{ + return read_sysreg(PMOVSR); +} + +static inline void write_pmuserenr(u32 val) +{ + write_sysreg(val, PMUSERENR); +} + +static inline u32 read_pmceid0(void) +{ + return read_sysreg(PMCEID0); +} + +static inline u32 read_pmceid1(void) +{ + return read_sysreg(PMCEID1); +} + +static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {} +static inline void kvm_clr_pmu_events(u32 clr) {} +static inline bool kvm_pmu_counter_deferred(struct perf_event_attr *attr) +{ + return false; +} + +/* PMU Version in DFR Register */ +#define ARMV8_PMU_DFR_VER_NI 0 +#define ARMV8_PMU_DFR_VER_V3P4 0x5 +#define ARMV8_PMU_DFR_VER_V3P5 0x6 +#define ARMV8_PMU_DFR_VER_IMP_DEF 0xF + +static inline bool pmuv3_implemented(int pmuver) +{ + return !(pmuver == ARMV8_PMU_DFR_VER_IMP_DEF || + pmuver == ARMV8_PMU_DFR_VER_NI); +} + +static inline bool is_pmuv3p4(int pmuver) +{ + return pmuver >= ARMV8_PMU_DFR_VER_V3P4; +} + +static inline bool is_pmuv3p5(int pmuver) +{ + return pmuver >= ARMV8_PMU_DFR_VER_V3P5; +} + +#endif diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig index b1c064a49984..2cfd196ea597 100644 --- a/drivers/perf/Kconfig +++ b/drivers/perf/Kconfig @@ -101,15 +101,14 @@ config ARM_SMMU_V3_PMU based on the Stream ID of the corresponding master. config ARM_PMUV3 - depends on HW_PERF_EVENTS && ARM64 + depends on HW_PERF_EVENTS && ((ARM && CPU_V7) || ARM64) bool "ARM PMUv3 support" if !ARM64 - default y + default ARM64 help Say y if you want to use the ARM performance monitor unit (PMU) version 3. The PMUv3 is the CPU performance monitors on ARMv8 (aarch32 and aarch64) systems that implement the PMUv3 architecture. - Currently, PMUv3 is only supported on aarch64 (arm64) config ARM_DSU_PMU tristate "ARM DynamIQ Shared Unit (DSU) PMU" diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index ba576a3f2770..3cfe47a73ac4 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -392,10 +392,13 @@ static const struct attribute_group armv8_pmuv3_caps_attr_group = { * We unconditionally enable ARMv8.5-PMU long event counter support * (64-bit events) where supported. Indicate if this arm_pmu has long * event counter support. + * + * On AArch32, long counters make no sense (you can't access the top + * bits), so we only enable this on AArch64. */ static bool armv8pmu_has_long_event(struct arm_pmu *cpu_pmu) { - return (is_pmuv3p5(cpu_pmu->pmuver)); + return (IS_ENABLED(CONFIG_ARM64) && is_pmuv3p5(cpu_pmu->pmuver)); } static inline bool armv8pmu_event_has_user_read(struct perf_event *event) From 6d7eea37f72b8f70610ca1efde263e5fde7b1507 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Fri, 16 Jun 2023 12:48:31 +0100 Subject: [PATCH 24/93] UPSTREAM: perf/core: Drop __weak attribute from arch_perf_update_userpage() prototype Reiji reports that the arm64 implementation of arch_perf_update_userpage() is now ignored and replaced by the dummy stub in core code. This seems to happen since the PMUv3 driver was moved to driver/perf. As it turns out, dropping the __weak attribute from the *prototype* of the function solves the problem. You're right, this doesn't seem to make much sense. And yet... It appears that both symbols get flagged as weak, and that the first one to appear in the link order wins: $ nm drivers/perf/arm_pmuv3.o|grep arch_perf_update_userpage 0000000000001db0 W arch_perf_update_userpage Dropping the attribute from the prototype restores the expected behaviour, and arm64 is able to enjoy arch_perf_update_userpage() again. Fixes: 7755cec63ade ("arm64: perf: Move PMUv3 driver to drivers/perf") Fixes: f1ec3a517b43 ("kernel/events: Add a missing prototype for arch_perf_update_userpage()") Reported-by: Reiji Watanabe Change-Id: I497041999776e66ac77c3fccdd09ce47aae544e9 Signed-off-by: Marc Zyngier Signed-off-by: Peter Zijlstra (Intel) Acked-by: Mark Rutland Tested-by: Reiji Watanabe Link: https://lkml.kernel.org/r/20230616114831.3186980-1-maz@kernel.org (cherry picked from commit b50f26a44887f3f71ff5457135ee1d5f1d542d7d) Signed-off-by: Danesh Petigara --- include/linux/perf_event.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 19e7b77ef0cf..92d866352f35 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1719,9 +1719,9 @@ int perf_event_exit_cpu(unsigned int cpu); #define perf_event_exit_cpu NULL #endif -extern void __weak arch_perf_update_userpage(struct perf_event *event, - struct perf_event_mmap_page *userpg, - u64 now); +extern void arch_perf_update_userpage(struct perf_event *event, + struct perf_event_mmap_page *userpg, + u64 now); #ifdef CONFIG_MMU extern __weak u64 arch_perf_get_page_size(struct mm_struct *mm, unsigned long addr); From f5e0452e91c77138123e716006e2d69def50ac22 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 8 May 2023 18:05:19 +0200 Subject: [PATCH 25/93] UPSTREAM: arm64: perf: Mark all accessor functions inline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When just including : arch/arm64/include/asm/arm_pmuv3.h:31:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function] 31 | static void write_pmevtypern(int n, unsigned long val) | ^~~~~~~~~~~~~~~~ arch/arm64/include/asm/arm_pmuv3.h:24:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function] 24 | static void write_pmevcntrn(int n, unsigned long val) | ^~~~~~~~~~~~~~~ arch/arm64/include/asm/arm_pmuv3.h:16:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function] 16 | static unsigned long read_pmevcntrn(int n) | ^~~~~~~~~~~~~~ Fix this by adding the missing "inline" keywords to the three accessor functions that lack them. Fixes: df29ddf4f04b ("arm64: perf: Abstract system register accesses away") Change-Id: I36e1360fc3b187b5e68619386ae9c142a9dda3c6 Signed-off-by: Geert Uytterhoeven Reviewed-by: Marc Zyngier Acked-by: Mark Rutland Link: https://lore.kernel.org/r/d53a19043c0c3bd25f6c203e73a2fb08a9661824.1683561482.git.geert+renesas@glider.be Signed-off-by: Will Deacon (cherry picked from commit 3bc879e355da4ff925e9d82278a829547d9d54bf) Signed-off-by: Danesh Petigara --- arch/arm64/include/asm/arm_pmuv3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h index d6b51deb7bf0..18dc2fb3d7b7 100644 --- a/arch/arm64/include/asm/arm_pmuv3.h +++ b/arch/arm64/include/asm/arm_pmuv3.h @@ -13,7 +13,7 @@ #define RETURN_READ_PMEVCNTRN(n) \ return read_sysreg(pmevcntr##n##_el0) -static unsigned long read_pmevcntrn(int n) +static inline unsigned long read_pmevcntrn(int n) { PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN); return 0; @@ -21,14 +21,14 @@ static unsigned long read_pmevcntrn(int n) #define WRITE_PMEVCNTRN(n) \ write_sysreg(val, pmevcntr##n##_el0) -static void write_pmevcntrn(int n, unsigned long val) +static inline void write_pmevcntrn(int n, unsigned long val) { PMEVN_SWITCH(n, WRITE_PMEVCNTRN); } #define WRITE_PMEVTYPERN(n) \ write_sysreg(val, pmevtyper##n##_el0) -static void write_pmevtypern(int n, unsigned long val) +static inline void write_pmevtypern(int n, unsigned long val) { PMEVN_SWITCH(n, WRITE_PMEVTYPERN); } From 7c09ddbf94fc78d3f56148a1bf0efc4c45745411 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 8 May 2023 18:05:18 +0200 Subject: [PATCH 26/93] UPSTREAM: ARM: perf: Mark all accessor functions inline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When just including : arch/arm/include/asm/arm_pmuv3.h:110:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function] 110 | static void write_pmevtypern(int n, unsigned long val) | ^~~~~~~~~~~~~~~~ arch/arm/include/asm/arm_pmuv3.h:103:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function] 103 | static void write_pmevcntrn(int n, unsigned long val) | ^~~~~~~~~~~~~~~ arch/arm/include/asm/arm_pmuv3.h:95:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function] 95 | static unsigned long read_pmevcntrn(int n) | ^~~~~~~~~~~~~~ Fix this by adding the missing "inline" keywords to the three accessor functions that lack them. Fixes: 009d6dc87a56 ("ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM") Change-Id: I0877fa9d337a59857c8480a219515e2c641cfc55 Signed-off-by: Geert Uytterhoeven Acked-by: Mark Rutland Reviewed-by: Marc Zyngier Link: https://lore.kernel.org/r/3a7d9bc7470aa2d85696ee9765c74f8c03fb5454.1683561482.git.geert+renesas@glider.be Signed-off-by: Will Deacon (cherry picked from commit 68e3f61eb9f58798e28b18152cd38cb269eebc34) Signed-off-by: Danesh Petigara --- arch/arm/include/asm/arm_pmuv3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/arm_pmuv3.h b/arch/arm/include/asm/arm_pmuv3.h index 78d3d4b82c6c..f4db3e75d75f 100644 --- a/arch/arm/include/asm/arm_pmuv3.h +++ b/arch/arm/include/asm/arm_pmuv3.h @@ -92,7 +92,7 @@ #define RETURN_READ_PMEVCNTRN(n) \ return read_sysreg(PMEVCNTR##n) -static unsigned long read_pmevcntrn(int n) +static inline unsigned long read_pmevcntrn(int n) { PMEVN_SWITCH(n, RETURN_READ_PMEVCNTRN); return 0; @@ -100,14 +100,14 @@ static unsigned long read_pmevcntrn(int n) #define WRITE_PMEVCNTRN(n) \ write_sysreg(val, PMEVCNTR##n) -static void write_pmevcntrn(int n, unsigned long val) +static inline void write_pmevcntrn(int n, unsigned long val) { PMEVN_SWITCH(n, WRITE_PMEVCNTRN); } #define WRITE_PMEVTYPERN(n) \ write_sysreg(val, PMEVTYPER##n) -static void write_pmevtypern(int n, unsigned long val) +static inline void write_pmevtypern(int n, unsigned long val) { PMEVN_SWITCH(n, WRITE_PMEVTYPERN); } From ad62d386c8bc914778d2d842d49604ca2601e8eb Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 11 May 2023 10:21:08 -0700 Subject: [PATCH 27/93] BACKPORT: net: phy: Allow drivers to always call into ->suspend() A few PHY drivers are currently attempting to not suspend the PHY when Wake-on-LAN is enabled, however that code is not currently executing at all due to an early check in phy_suspend(). This prevents PHY drivers from making an appropriate decisions and put the hardware into a low power state if desired. In order to allow the PHY drivers to opt into getting their ->suspend routine to be called, add a PHY_ALWAYS_CALL_SUSPEND bit which can be set. A boolean that tracks whether the PHY or the attached MAC has Wake-on-LAN enabled is also provided for convenience. If phydev::wol_enabled then the PHY shall not prevent its own Wake-on-LAN detection logic from working and shall not prevent the Ethernet MAC from receiving packets for matching. Reviewed-by: Simon Horman Reviewed-by: Andrew Lunn Change-Id: I9077fe16d2515b60a2cb58753e6914be95a6923a Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller (cherry picked from commit a7e3448086d580abadccff399316c6eb5ecdedbf) [danesh: Moved phydev->wol_enabled to avoid KMI-break] Signed-off-by: Danesh Petigara --- drivers/net/phy/phy_device.c | 6 ++++-- include/linux/phy.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 944f76e6fc8e..a0d86df0dc40 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1803,14 +1803,16 @@ int phy_suspend(struct phy_device *phydev) struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; struct net_device *netdev = phydev->attached_dev; struct phy_driver *phydrv = phydev->drv; + bool wol_enabled = false; int ret; if (phydev->suspended) return 0; - /* If the device has WOL enabled, we cannot suspend the PHY */ phy_ethtool_get_wol(phydev, &wol); - if (wol.wolopts || (netdev && netdev->wol_enabled)) + wol_enabled = wol.wolopts || (netdev && netdev->wol_enabled); + /* If the device has WOL enabled, we cannot suspend the PHY */ + if (wol_enabled && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND)) return -EBUSY; if (!phydrv || !phydrv->suspend) diff --git a/include/linux/phy.h b/include/linux/phy.h index 7b1a3084a288..169dfdbad8d2 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -81,6 +81,7 @@ extern const int phy_10gbit_features_array[1]; #define PHY_IS_INTERNAL 0x00000001 #define PHY_RST_AFTER_CLK_EN 0x00000002 #define PHY_POLL_CABLE_TEST 0x00000004 +#define PHY_ALWAYS_CALL_SUSPEND 0x00000008 #define MDIO_DEVICE_IS_PHY 0x80000000 /** From 5c4b00b73ee0840598e655e9d77f7098fb9cefbb Mon Sep 17 00:00:00 2001 From: Ilkka Koskinen Date: Thu, 2 Nov 2023 11:30:12 -0700 Subject: [PATCH 28/93] UPSTREAM: arm64/arm: arm_pmuv3: perf: Don't truncate 64-bit registers The driver used to truncate several 64-bit registers such as PMCEID[n] registers used to describe whether architectural and microarchitectural events in range 0x4000-0x401f exist. Due to discarding the bits, the driver made the events invisible, even if they existed. Moreover, PMCCFILTR and PMCR registers have additional bits in the upper 32 bits. This patch makes them available although they aren't currently used. Finally, functions handling PMXEVCNTR and PMXEVTYPER registers are removed as they not being used at all. Fixes: df29ddf4f04b ("arm64: perf: Abstract system register accesses away") Reported-by: Carl Worth Change-Id: Ic2ec717caa2fdda2456c560a82490e374565eb2d Signed-off-by: Ilkka Koskinen Acked-by: Will Deacon Closes: https://lore.kernel.org/.. Reviewed-by: Anshuman Khandual Link: https://lore.kernel.org/r/20231102183012.1251410-1-ilkka@os.amperecomputing.com Signed-off-by: Catalin Marinas (cherry picked from commit 403edfa436286b21f5ffe6856ae5b36396e8966c) Signed-off-by: Danesh Petigara --- arch/arm/include/asm/arm_pmuv3.h | 48 ++++++++++++++---------------- arch/arm64/include/asm/arm_pmuv3.h | 25 ++++------------ drivers/perf/arm_pmuv3.c | 6 ++-- 3 files changed, 31 insertions(+), 48 deletions(-) diff --git a/arch/arm/include/asm/arm_pmuv3.h b/arch/arm/include/asm/arm_pmuv3.h index f4db3e75d75f..94b18f119813 100644 --- a/arch/arm/include/asm/arm_pmuv3.h +++ b/arch/arm/include/asm/arm_pmuv3.h @@ -23,6 +23,8 @@ #define PMUSERENR __ACCESS_CP15(c9, 0, c14, 0) #define PMINTENSET __ACCESS_CP15(c9, 0, c14, 1) #define PMINTENCLR __ACCESS_CP15(c9, 0, c14, 2) +#define PMCEID2 __ACCESS_CP15(c9, 0, c14, 4) +#define PMCEID3 __ACCESS_CP15(c9, 0, c14, 5) #define PMMIR __ACCESS_CP15(c9, 0, c14, 6) #define PMCCFILTR __ACCESS_CP15(c14, 0, c15, 7) @@ -150,21 +152,6 @@ static inline u64 read_pmccntr(void) return read_sysreg(PMCCNTR); } -static inline void write_pmxevcntr(u32 val) -{ - write_sysreg(val, PMXEVCNTR); -} - -static inline u32 read_pmxevcntr(void) -{ - return read_sysreg(PMXEVCNTR); -} - -static inline void write_pmxevtyper(u32 val) -{ - write_sysreg(val, PMXEVTYPER); -} - static inline void write_pmcntenset(u32 val) { write_sysreg(val, PMCNTENSET); @@ -205,16 +192,6 @@ static inline void write_pmuserenr(u32 val) write_sysreg(val, PMUSERENR); } -static inline u32 read_pmceid0(void) -{ - return read_sysreg(PMCEID0); -} - -static inline u32 read_pmceid1(void) -{ - return read_sysreg(PMCEID1); -} - static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {} static inline void kvm_clr_pmu_events(u32 clr) {} static inline bool kvm_pmu_counter_deferred(struct perf_event_attr *attr) @@ -224,6 +201,7 @@ static inline bool kvm_pmu_counter_deferred(struct perf_event_attr *attr) /* PMU Version in DFR Register */ #define ARMV8_PMU_DFR_VER_NI 0 +#define ARMV8_PMU_DFR_VER_V3P1 0x4 #define ARMV8_PMU_DFR_VER_V3P4 0x5 #define ARMV8_PMU_DFR_VER_V3P5 0x6 #define ARMV8_PMU_DFR_VER_IMP_DEF 0xF @@ -244,4 +222,24 @@ static inline bool is_pmuv3p5(int pmuver) return pmuver >= ARMV8_PMU_DFR_VER_V3P5; } +static inline u64 read_pmceid0(void) +{ + u64 val = read_sysreg(PMCEID0); + + if (read_pmuver() >= ARMV8_PMU_DFR_VER_V3P1) + val |= (u64)read_sysreg(PMCEID2) << 32; + + return val; +} + +static inline u64 read_pmceid1(void) +{ + u64 val = read_sysreg(PMCEID1); + + if (read_pmuver() >= ARMV8_PMU_DFR_VER_V3P1) + val |= (u64)read_sysreg(PMCEID3) << 32; + + return val; +} + #endif diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h index 18dc2fb3d7b7..c27404fa4418 100644 --- a/arch/arm64/include/asm/arm_pmuv3.h +++ b/arch/arm64/include/asm/arm_pmuv3.h @@ -46,12 +46,12 @@ static inline u32 read_pmuver(void) ID_AA64DFR0_EL1_PMUVer_SHIFT); } -static inline void write_pmcr(u32 val) +static inline void write_pmcr(u64 val) { write_sysreg(val, pmcr_el0); } -static inline u32 read_pmcr(void) +static inline u64 read_pmcr(void) { return read_sysreg(pmcr_el0); } @@ -71,21 +71,6 @@ static inline u64 read_pmccntr(void) return read_sysreg(pmccntr_el0); } -static inline void write_pmxevcntr(u32 val) -{ - write_sysreg(val, pmxevcntr_el0); -} - -static inline u32 read_pmxevcntr(void) -{ - return read_sysreg(pmxevcntr_el0); -} - -static inline void write_pmxevtyper(u32 val) -{ - write_sysreg(val, pmxevtyper_el0); -} - static inline void write_pmcntenset(u32 val) { write_sysreg(val, pmcntenset_el0); @@ -106,7 +91,7 @@ static inline void write_pmintenclr(u32 val) write_sysreg(val, pmintenclr_el1); } -static inline void write_pmccfiltr(u32 val) +static inline void write_pmccfiltr(u64 val) { write_sysreg(val, pmccfiltr_el0); } @@ -126,12 +111,12 @@ static inline void write_pmuserenr(u32 val) write_sysreg(val, pmuserenr_el0); } -static inline u32 read_pmceid0(void) +static inline u64 read_pmceid0(void) { return read_sysreg(pmceid0_el0); } -static inline u32 read_pmceid1(void) +static inline u64 read_pmceid1(void) { return read_sysreg(pmceid1_el0); } diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c index 3cfe47a73ac4..7ee52489b024 100644 --- a/drivers/perf/arm_pmuv3.c +++ b/drivers/perf/arm_pmuv3.c @@ -432,12 +432,12 @@ static inline bool armv8pmu_event_is_chained(struct perf_event *event) #define ARMV8_IDX_TO_COUNTER(x) \ (((x) - ARMV8_IDX_COUNTER0) & ARMV8_PMU_COUNTER_MASK) -static inline u32 armv8pmu_pmcr_read(void) +static inline u64 armv8pmu_pmcr_read(void) { return read_pmcr(); } -static inline void armv8pmu_pmcr_write(u32 val) +static inline void armv8pmu_pmcr_write(u64 val) { val &= ARMV8_PMU_PMCR_MASK; isb(); @@ -969,7 +969,7 @@ static int armv8pmu_filter_match(struct perf_event *event) static void armv8pmu_reset(void *info) { struct arm_pmu *cpu_pmu = (struct arm_pmu *)info; - u32 pmcr; + u64 pmcr; /* The counter and interrupt enable registers are unknown at reset. */ armv8pmu_disable_counter(U32_MAX); From d385f8f23f6880c88ce94405967187cdcc2bd6b7 Mon Sep 17 00:00:00 2001 From: Jorge Ramirez-Ortiz Date: Wed, 3 Jan 2024 12:29:11 +0100 Subject: [PATCH 29/93] UPSTREAM: mmc: core: Do not force a retune before RPMB switch Requesting a retune before switching to the RPMB partition has been observed to cause CRC errors on the RPMB reads (-EILSEQ). Since RPMB reads can not be retried, the clients would be directly affected by the errors. This commit disables the retune request prior to switching to the RPMB partition: mmc_retune_pause() no longer triggers a retune before the pause period begins. This was verified with the sdhci-of-arasan driver (ZynqMP) configured for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both cases, the error was easy to reproduce triggering every few tenths of reads. With this commit, systems that were utilizing OP-TEE to access RPMB variables will experience an enhanced performance. Specifically, when OP-TEE is configured to employ RPMB as a secure storage solution, it not only writes the data but also the secure filesystem within the partition. As a result, retrieving any variable involves multiple RPMB reads, typically around five. For context, on ZynqMP, each retune request consumed approximately 8ms. Consequently, reading any RPMB variable used to take at the very minimum 40ms. After droping the need to retune before switching to the RPMB partition, this is no longer the case. Change-Id: I2320a38436b05b435ac528c6656b621a1e2eaeb7 Signed-off-by: Jorge Ramirez-Ortiz Acked-by: Avri Altman Acked-by: Adrian Hunter Link: https://lore.kernel.org/r/20240103112911.2954632-1-jorge@foundries.io Signed-off-by: Ulf Hansson (cherry picked from commit 67380251e8bbd3302c64fea07f95c31971b91c22) Signed-off-by: Danesh Petigara --- drivers/mmc/core/host.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 2a47f08f41aa..c48556ef7597 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -119,13 +119,12 @@ void mmc_retune_enable(struct mmc_host *host) /* * Pause re-tuning for a small set of operations. The pause begins after the - * next command and after first doing re-tuning. + * next command. */ void mmc_retune_pause(struct mmc_host *host) { if (!host->retune_paused) { host->retune_paused = 1; - mmc_retune_needed(host); mmc_retune_hold(host); } } From b164ce27faf0ed1654573da8ca2f024203adf4ef Mon Sep 17 00:00:00 2001 From: Danesh Petigara Date: Mon, 30 Jan 2023 11:41:26 -0800 Subject: [PATCH 30/93] ANDROID: gki_defconfig: Enable Broadcom STB SoCs Enable configs required for Broadcom Set Top Box SoCs. Also explicitly disable the Broadcom Set Top Box SoC drivers that we wish to build as loadable modules. Bug: 343006993 Change-Id: Ia3e542d0eeb519539aba2990fb4eb4eb2970a867 Signed-off-by: Danesh Petigara --- arch/arm64/configs/gki_defconfig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index 7b4e76e57af5..05b3b181215b 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -46,6 +46,8 @@ CONFIG_KALLSYMS_ALL=y CONFIG_EMBEDDED=y CONFIG_PROFILING=y CONFIG_ARCH_SUNXI=y +CONFIG_ARCH_BCM=y +CONFIG_ARCH_BRCMSTB=y CONFIG_ARCH_HISI=y CONFIG_ARCH_QCOM=y CONFIG_ARCH_TEGRA=y @@ -83,6 +85,7 @@ CONFIG_CPU_FREQ_TIMES=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y CONFIG_ARM_SCPI_CPUFREQ=y +# CONFIG_ARM_BRCMSTB_AVS_CPUFREQ is not set CONFIG_ARM_SCMI_CPUFREQ=y CONFIG_VIRTUALIZATION=y CONFIG_KVM=y @@ -299,12 +302,14 @@ CONFIG_PCIEAER=y CONFIG_PCI_IOV=y # CONFIG_VGA_ARB is not set CONFIG_PCI_HOST_GENERIC=y +# CONFIG_PCIE_BRCMSTB is not set CONFIG_PCIE_DW_PLAT_EP=y CONFIG_PCIE_QCOM=y CONFIG_PCIE_KIRIN=y CONFIG_PCI_ENDPOINT=y CONFIG_FW_LOADER_USER_HELPER=y # CONFIG_FW_CACHE is not set +# CONFIG_BRCMSTB_GISB_ARB is not set # CONFIG_SUN50I_DE2_BUS is not set # CONFIG_SUNXI_RSB is not set CONFIG_ARM_SCMI_PROTOCOL=y @@ -396,6 +401,7 @@ CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_NR_UARTS=32 CONFIG_SERIAL_8250_RUNTIME_UARTS=0 CONFIG_SERIAL_8250_DW=y +# CONFIG_SERIAL_8250_BCM7271 is not set CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SERIAL_AMBA_PL011=y CONFIG_SERIAL_AMBA_PL011_CONSOLE=y @@ -414,10 +420,12 @@ CONFIG_HW_RANDOM=y # CONFIG_DEVPORT is not set # CONFIG_I2C_COMPAT is not set # CONFIG_I2C_HELPER_AUTO is not set +# CONFIG_I2C_BRCMSTB is not set CONFIG_I3C=y CONFIG_SPI=y CONFIG_SPI_MEM=y # CONFIG_SPMI_MSM_PMIC_ARB is not set +# CONFIG_PINCTRL_BCM2835 is not set # CONFIG_PINCTRL_SUN8I_H3_R is not set # CONFIG_PINCTRL_SUN50I_A64 is not set # CONFIG_PINCTRL_SUN50I_A64_R is not set @@ -428,7 +436,9 @@ CONFIG_SPI_MEM=y # CONFIG_PINCTRL_SUN50I_H6_R is not set # CONFIG_PINCTRL_SUN50I_H616 is not set # CONFIG_PINCTRL_SUN50I_H616_R is not set +# CONFIG_GPIO_BRCMSTB is not set CONFIG_GPIO_GENERIC_PLATFORM=y +# CONFIG_POWER_RESET_BRCMSTB is not set CONFIG_POWER_RESET_HISI=y CONFIG_POWER_RESET_SYSCON=y # CONFIG_HWMON is not set @@ -512,6 +522,7 @@ CONFIG_USB_DWC3=y CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_FTDI_SIO=m CONFIG_USB_GADGET=y +# CONFIG_USB_BDC_UDC is not set CONFIG_USB_CONFIGFS=y CONFIG_USB_CONFIGFS_UEVENT=y CONFIG_USB_CONFIGFS_SERIAL=y @@ -538,6 +549,7 @@ CONFIG_MMC=y CONFIG_MMC_CRYPTO=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_SDHCI_BRCMSTB is not set CONFIG_SCSI_UFSHCD=y CONFIG_SCSI_UFS_BSG=y CONFIG_SCSI_UFS_CRYPTO=y @@ -551,6 +563,7 @@ CONFIG_LEDS_TRIGGER_TIMER=y CONFIG_LEDS_TRIGGER_TRANSIENT=y CONFIG_EDAC=y CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_BRCMSTB is not set CONFIG_RTC_DRV_PL030=y CONFIG_RTC_DRV_PL031=y CONFIG_DMABUF_HEAPS=y @@ -569,6 +582,7 @@ CONFIG_VHOST_VSOCK=y CONFIG_STAGING=y CONFIG_ASHMEM=y CONFIG_COMMON_CLK_SCPI=y +# CONFIG_CLK_BCM2835 is not set # CONFIG_SUNXI_CCU is not set CONFIG_HWSPINLOCK=y # CONFIG_SUN50I_ERRATUM_UNKNOWN1 is not set @@ -576,6 +590,8 @@ CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y CONFIG_REMOTEPROC=y CONFIG_REMOTEPROC_CDEV=y CONFIG_RPMSG_CHAR=y +CONFIG_SOC_BRCMSTB=y +# CONFIG_BRCMSTB_PM is not set CONFIG_QCOM_GENI_SE=y CONFIG_ARCH_TEGRA_234_SOC=y CONFIG_DEVFREQ_GOV_PERFORMANCE=y @@ -588,6 +604,12 @@ CONFIG_IIO=y CONFIG_IIO_BUFFER=y CONFIG_IIO_TRIGGER=y CONFIG_PWM=y +# CONFIG_BCM7038_L1_IRQ is not set +# CONFIG_BCM7120_L2_IRQ is not set +# CONFIG_BRCMSTB_L2_IRQ is not set +# CONFIG_RESET_BRCMSTB is not set +# CONFIG_RESET_BRCMSTB_RESCAL is not set +# CONFIG_PHY_BRCM_USB is not set CONFIG_POWERCAP=y CONFIG_IDLE_INJECT=y CONFIG_ANDROID_BINDER_IPC=y From ac9706483e98b63ce12c448c7f1104b239b90a0b Mon Sep 17 00:00:00 2001 From: Pierre Couillaud Date: Thu, 9 May 2024 07:30:53 -0700 Subject: [PATCH 31/93] ANDROID: GKI: Add initial symbol list for bcmstb Add initial symbol list for the bcmstb target that represents the Broadcom Set Top Box SoCs. INFO: 32 function symbol(s) added 'u32 brcmstb_get_family_id()' 'u32 brcmstb_get_product_id()' 'int clk_hw_register_clkdev(struct clk_hw*, const char*, const char*)' 'int device_get_ethdev_address(struct device*, struct net_device*)' 'int ehci_resume(struct usb_hcd*, bool)' 'int ehci_suspend(struct usb_hcd*, bool)' 'int fixed_phy_set_link_update(struct phy_device*, int(*)(struct net_device*, struct fixed_phy_status*))' 'int generic_access_phys(struct vm_area_struct*, unsigned long, void*, int, int)' 'struct gpio_desc* gpiochip_request_own_desc(struct gpio_chip*, unsigned int, const char*, enum gpio_lookup_flags, enum gpiod_flags)' 'void irq_gc_mask_disable_reg(struct irq_data*)' 'void irq_gc_noop(struct irq_data*)' 'void irq_gc_unmask_enable_reg(struct irq_data*)' 'void netdev_crit(const struct net_device*, const char*, ...)' 'bool of_device_is_big_endian(const struct device_node*)' 'struct net_device* of_find_net_device_by_node(struct device_node*)' 'int of_get_ethdev_address(struct device_node*, struct net_device*)' 'const char* pci_speed_string(enum pci_bus_speed)' 'struct phy_device* phy_attach(struct net_device*, const char*, phy_interface_t)' 'int phy_resume(struct phy_device*)' 'void phy_start_machine(struct phy_device*)' 'bool phy_validate_pause(struct phy_device*, struct ethtool_pauseparam*)' 'pgprot_t phys_mem_access_prot(struct file*, unsigned long, unsigned long, pgprot_t)' 'const char* pinctrl_dev_get_devname(struct pinctrl_dev*)' 'void recalc_sigpending()' 'int restore_online_page_callback(online_page_callback_t)' 'u16 sdhci_calc_clk(struct sdhci_host*, unsigned int, unsigned int*)' 'int sdhci_pltfm_resume(struct device*)' 'int sdhci_pltfm_suspend(struct device*)' 'int serial8250_handle_irq(struct uart_port*, unsigned int)' 'int set_online_page_callback(online_page_callback_t)' 'int spi_split_transfers_maxsize(struct spi_controller*, struct spi_message*, size_t, gfp_t)' 'void vm_unmap_aliases()' 4 variable symbol(s) added 'unsigned long empty_zero_page[512]' 'const unsigned char pcie_link_speed[16]' 'unsigned long phy_basic_features[2]' 'unsigned long phy_gbit_features[2]' Bug: 343006993 Change-Id: Ia094cd3f5444ea60b273415990bceb7a523cfee8 Signed-off-by: Pierre Couillaud Signed-off-by: Danesh Petigara --- BUILD.bazel | 1 + android/abi_gki_aarch64.stg | 525 ++++++++++ android/abi_gki_aarch64_bcmstb | 1761 ++++++++++++++++++++++++++++++++ 3 files changed, 2287 insertions(+) create mode 100644 android/abi_gki_aarch64_bcmstb diff --git a/BUILD.bazel b/BUILD.bazel index 33677cee37d8..1652ff9eb857 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -101,6 +101,7 @@ filegroup( # keep sorted "android/abi_gki_aarch64_asr", "android/abi_gki_aarch64_asus", + "android/abi_gki_aarch64_bcmstb", "android/abi_gki_aarch64_db845c", "android/abi_gki_aarch64_exynos", "android/abi_gki_aarch64_exynosauto", diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 6c85162d6f01..9d31b0ad5595 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -6378,6 +6378,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1028489f } +pointer_reference { + id: 0x0e9b9d4c + kind: POINTER + pointee_type_id: 0x102e93ac +} pointer_reference { id: 0x0e9bc1a8 kind: POINTER @@ -20953,6 +20958,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x91f8d8a0 } +pointer_reference { + id: 0x2eeef3e3 + kind: POINTER + pointee_type_id: 0x91fb2911 +} pointer_reference { id: 0x2eef767c kind: POINTER @@ -31333,6 +31343,11 @@ typedef { name: "old_time32_t" referred_type_id: 0xd41e888f } +typedef { + id: 0xcc070c7b + name: "online_page_callback_t" + referred_type_id: 0x0e9b9d4c +} typedef { id: 0x58545d97 name: "p4d_t" @@ -37712,6 +37727,11 @@ array { number_of_elements: 2 element_type_id: 0x49a73111 } +array { + id: 0x7eefaca3 + number_of_elements: 16 + element_type_id: 0xcb71b8cb +} array { id: 0x7eefbee1 number_of_elements: 16 @@ -38542,6 +38562,11 @@ array { number_of_elements: 6 element_type_id: 0x69318e08 } +array { + id: 0xbd4ac7e4 + number_of_elements: 512 + element_type_id: 0x33756485 +} array { id: 0xbd62e703 number_of_elements: 12 @@ -282668,6 +282693,50 @@ enumeration { } } } +enumeration { + id: 0x6a318929 + name: "gpio_lookup_flags" + definition { + underlying_type_id: 0x4585663f + enumerator { + name: "GPIO_ACTIVE_HIGH" + } + enumerator { + name: "GPIO_ACTIVE_LOW" + value: 1 + } + enumerator { + name: "GPIO_OPEN_DRAIN" + value: 2 + } + enumerator { + name: "GPIO_OPEN_SOURCE" + value: 4 + } + enumerator { + name: "GPIO_PERSISTENT" + } + enumerator { + name: "GPIO_TRANSITORY" + value: 8 + } + enumerator { + name: "GPIO_PULL_UP" + value: 16 + } + enumerator { + name: "GPIO_PULL_DOWN" + value: 32 + } + enumerator { + name: "GPIO_PULL_DISABLE" + value: 64 + } + enumerator { + name: "GPIO_LOOKUP_FLAGS_DEFAULT" + } + } +} enumeration { id: 0x285cedbe name: "gpiod_flags" @@ -292942,6 +293011,13 @@ function { parameter_id: 0x7b64642a parameter_id: 0x1e2ffa47 } +function { + id: 0x0e64805a + return_type_id: 0x914dbfdc + parameter_id: 0x397d00ab + parameter_id: 0x4585663f + parameter_id: 0x1bf16028 +} function { id: 0x0ea86f7f return_type_id: 0x28136e4b @@ -307772,6 +307848,15 @@ function { parameter_id: 0x056cf603 parameter_id: 0x6720d32f } +function { + id: 0x5862e60a + return_type_id: 0x2560a232 + parameter_id: 0x18e64f74 + parameter_id: 0x4585663f + parameter_id: 0x3e10b518 + parameter_id: 0x6a318929 + parameter_id: 0x285cedbe +} function { id: 0x58c67df5 return_type_id: 0x18bd6530 @@ -311184,6 +311269,12 @@ function { parameter_id: 0x6720d32f parameter_id: 0x31c8b544 } +function { + id: 0x9056bb4d + return_type_id: 0x6720d32f + parameter_id: 0x347303b4 + parameter_id: 0x32a623d7 +} function { id: 0x90580076 return_type_id: 0x6720d32f @@ -312500,6 +312591,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3399c453 } +function { + id: 0x9166f0c1 + return_type_id: 0x6720d32f + parameter_id: 0x3176a085 + parameter_id: 0x2eeef3e3 +} function { id: 0x91698a42 return_type_id: 0x6720d32f @@ -313658,6 +313755,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x31e58fe0 } +function { + id: 0x91fb2911 + return_type_id: 0x6720d32f + parameter_id: 0x32a623d7 + parameter_id: 0x3490b2d2 +} function { id: 0x91fbb3ce return_type_id: 0x6720d32f @@ -316841,6 +316944,11 @@ function { parameter_id: 0x2060db23 parameter_id: 0x4585663f } +function { + id: 0x94917d9f + return_type_id: 0x3e10b518 + parameter_id: 0x1b55a8f2 +} function { id: 0x9492906d return_type_id: 0x6720d32f @@ -328651,6 +328759,12 @@ function { parameter_id: 0x0d107c2b parameter_id: 0xc9082b19 } +function { + id: 0x9cbb13a8 + return_type_id: 0x6720d32f + parameter_id: 0x00b7947f + parameter_id: 0x4585663f +} function { id: 0x9cbbbdfe return_type_id: 0x6720d32f @@ -329091,6 +329205,14 @@ function { parameter_id: 0x0258f96e parameter_id: 0x074f1a14 } +function { + id: 0x9d0e31e2 + return_type_id: 0x6720d32f + parameter_id: 0x00dd92af + parameter_id: 0x21df69d0 + parameter_id: 0xf435685e + parameter_id: 0xf1a6dfed +} function { id: 0x9d0e7bae return_type_id: 0x6720d32f @@ -333525,6 +333647,13 @@ function { parameter_id: 0x38df6aa0 parameter_id: 0x4585663f } +function { + id: 0x9fce0d67 + return_type_id: 0x6720d32f + parameter_id: 0x0ae4a2c7 + parameter_id: 0x3e10b518 + parameter_id: 0x3e10b518 +} function { id: 0x9fce4cfe return_type_id: 0x6720d32f @@ -334675,6 +334804,11 @@ function { parameter_id: 0x6d7f5ff6 parameter_id: 0x33756485 } +function { + id: 0xae812031 + return_type_id: 0x6720d32f + parameter_id: 0xcc070c7b +} function { id: 0xae88a13d return_type_id: 0xfc0e1dbd @@ -335055,6 +335189,11 @@ function { parameter_id: 0x33756485 parameter_id: 0x6720d32f } +function { + id: 0xba0eb204 + return_type_id: 0x3e10b518 + parameter_id: 0xa12a969e +} function { id: 0xba11bc6a return_type_id: 0x06835e9c @@ -335284,6 +335423,13 @@ function { parameter_id: 0xc9082b19 parameter_id: 0xeeed68e6 } +function { + id: 0xbfb42928 + return_type_id: 0x3176a085 + parameter_id: 0x32a623d7 + parameter_id: 0x3e10b518 + parameter_id: 0xeeed68e6 +} function { id: 0xbfc82229 return_type_id: 0x0e5eb556 @@ -336897,6 +337043,14 @@ function { parameter_id: 0x126479b8 parameter_id: 0x33756485 } +function { + id: 0xe66d986c + return_type_id: 0x9cf21ab5 + parameter_id: 0x18ea6ae3 + parameter_id: 0x33756485 + parameter_id: 0x33756485 + parameter_id: 0x9cf21ab5 +} function { id: 0xe6b0ea6f return_type_id: 0x2e8ad82b @@ -337354,6 +337508,11 @@ function { return_type_id: 0x1b36c7a2 parameter_id: 0x1d19a9d5 } +function { + id: 0xf16f4d10 + return_type_id: 0x32a623d7 + parameter_id: 0x347303b4 +} function { id: 0xf1736137 return_type_id: 0x6d7f5ff6 @@ -337571,6 +337730,12 @@ function { return_type_id: 0x6d7f5ff6 parameter_id: 0x33756485 } +function { + id: 0xf28c97f2 + return_type_id: 0x6d7f5ff6 + parameter_id: 0x3176a085 + parameter_id: 0x1d5935e7 +} function { id: 0xf2bde902 return_type_id: 0x6d7f5ff6 @@ -354313,6 +354478,24 @@ elf_symbol { type_id: 0x1ccd91f4 full_name: "bpf_warn_invalid_xdp_action" } +elf_symbol { + id: 0x324980b6 + name: "brcmstb_get_family_id" + is_defined: true + symbol_type: FUNCTION + crc: 0x9ed7c847 + type_id: 0x45f82b62 + full_name: "brcmstb_get_family_id" +} +elf_symbol { + id: 0x8b16f0da + name: "brcmstb_get_product_id" + is_defined: true + symbol_type: FUNCTION + crc: 0x2ab2ee91 + type_id: 0x45f82b62 + full_name: "brcmstb_get_product_id" +} elf_symbol { id: 0xae106411 name: "bsearch" @@ -355947,6 +356130,15 @@ elf_symbol { type_id: 0x9d3d4fff full_name: "clk_hw_register" } +elf_symbol { + id: 0xd69134fa + name: "clk_hw_register_clkdev" + is_defined: true + symbol_type: FUNCTION + crc: 0x3f51d3cc + type_id: 0x9fce0d67 + full_name: "clk_hw_register_clkdev" +} elf_symbol { id: 0x4adcbe96 name: "clk_hw_register_composite" @@ -360344,6 +360536,15 @@ elf_symbol { type_id: 0x167dac02 full_name: "device_get_dma_attr" } +elf_symbol { + id: 0x92a490c5 + name: "device_get_ethdev_address" + is_defined: true + symbol_type: FUNCTION + crc: 0xd3568ef0 + type_id: 0x9ddc45fb + full_name: "device_get_ethdev_address" +} elf_symbol { id: 0x96346c6f name: "device_get_mac_address" @@ -368212,6 +368413,15 @@ elf_symbol { type_id: 0x14fbfe19 full_name: "ehci_init_driver" } +elf_symbol { + id: 0xbb8dbeda + name: "ehci_resume" + is_defined: true + symbol_type: FUNCTION + crc: 0xd88f50a7 + type_id: 0x956b1688 + full_name: "ehci_resume" +} elf_symbol { id: 0xc670de95 name: "ehci_setup" @@ -368221,6 +368431,15 @@ elf_symbol { type_id: 0x94deebf7 full_name: "ehci_setup" } +elf_symbol { + id: 0x560a114d + name: "ehci_suspend" + is_defined: true + symbol_type: FUNCTION + crc: 0x1f7e0097 + type_id: 0x956b1688 + full_name: "ehci_suspend" +} elf_symbol { id: 0x6f76a9a4 name: "elevator_alloc" @@ -368347,6 +368566,15 @@ elf_symbol { type_id: 0x10985193 full_name: "emergency_restart" } +elf_symbol { + id: 0x483e9e6a + name: "empty_zero_page" + is_defined: true + symbol_type: OBJECT + crc: 0x815f2897 + type_id: 0xbd4ac7e4 + full_name: "empty_zero_page" +} elf_symbol { id: 0x8f99729e name: "enable_irq" @@ -369184,6 +369412,15 @@ elf_symbol { type_id: 0xa2605fd7 full_name: "fixed_phy_register" } +elf_symbol { + id: 0x726b2fa8 + name: "fixed_phy_set_link_update" + is_defined: true + symbol_type: FUNCTION + crc: 0x3d497687 + type_id: 0x9166f0c1 + full_name: "fixed_phy_set_link_update" +} elf_symbol { id: 0x53f6e0dd name: "fixed_phy_unregister" @@ -370201,6 +370438,15 @@ elf_symbol { type_id: 0x17e44aa0 full_name: "generate_random_uuid" } +elf_symbol { + id: 0x69ea6230 + name: "generic_access_phys" + is_defined: true + symbol_type: FUNCTION + crc: 0x3fd072d9 + type_id: 0x9fce4cfe + full_name: "generic_access_phys" +} elf_symbol { id: 0x0c22ac35 name: "generic_block_bmap" @@ -371815,6 +372061,15 @@ elf_symbol { type_id: 0x9aaf656a full_name: "gpiochip_reqres_irq" } +elf_symbol { + id: 0xa7604fd3 + name: "gpiochip_request_own_desc" + is_defined: true + symbol_type: FUNCTION + crc: 0x3d6089df + type_id: 0x5862e60a + full_name: "gpiochip_request_own_desc" +} elf_symbol { id: 0x77a0ab63 name: "gpiochip_unlock_as_irq" @@ -376495,6 +376750,15 @@ elf_symbol { type_id: 0x1247424a full_name: "irq_gc_mask_clr_bit" } +elf_symbol { + id: 0xc86ecf8a + name: "irq_gc_mask_disable_reg" + is_defined: true + symbol_type: FUNCTION + crc: 0x5f75cdc2 + type_id: 0x1247424a + full_name: "irq_gc_mask_disable_reg" +} elf_symbol { id: 0x01f6343f name: "irq_gc_mask_set_bit" @@ -376504,6 +376768,15 @@ elf_symbol { type_id: 0x1247424a full_name: "irq_gc_mask_set_bit" } +elf_symbol { + id: 0xb1886c4f + name: "irq_gc_noop" + is_defined: true + symbol_type: FUNCTION + crc: 0xea1b27c6 + type_id: 0x1247424a + full_name: "irq_gc_noop" +} elf_symbol { id: 0x508904bc name: "irq_gc_set_wake" @@ -376513,6 +376786,15 @@ elf_symbol { type_id: 0x9e49e56e full_name: "irq_gc_set_wake" } +elf_symbol { + id: 0x8a553541 + name: "irq_gc_unmask_enable_reg" + is_defined: true + symbol_type: FUNCTION + crc: 0xd0e2a0a9 + type_id: 0x1247424a + full_name: "irq_gc_unmask_enable_reg" +} elf_symbol { id: 0xe8b2d7a6 name: "irq_generic_chip_ops" @@ -381469,6 +381751,15 @@ elf_symbol { type_id: 0x9286ca40 full_name: "netdev_core_stats_alloc" } +elf_symbol { + id: 0x2ebee953 + name: "netdev_crit" + is_defined: true + symbol_type: FUNCTION + crc: 0x1e48cd12 + type_id: 0x1caf28d1 + full_name: "netdev_crit" +} elf_symbol { id: 0xfac0e8e6 name: "netdev_err" @@ -382972,6 +383263,15 @@ elf_symbol { type_id: 0xf22f7816 full_name: "of_device_is_available" } +elf_symbol { + id: 0x4f555551 + name: "of_device_is_big_endian" + is_defined: true + symbol_type: FUNCTION + crc: 0x6971fa5d + type_id: 0xf22f7816 + full_name: "of_device_is_big_endian" +} elf_symbol { id: 0x490e6dfe name: "of_device_is_compatible" @@ -383161,6 +383461,15 @@ elf_symbol { type_id: 0x2c313d32 full_name: "of_find_mipi_dsi_host_by_node" } +elf_symbol { + id: 0x0f547e7d + name: "of_find_net_device_by_node" + is_defined: true + symbol_type: FUNCTION + crc: 0x23dd1a69 + type_id: 0xf16f4d10 + full_name: "of_find_net_device_by_node" +} elf_symbol { id: 0x27d7263a name: "of_find_node_by_name" @@ -383341,6 +383650,15 @@ elf_symbol { type_id: 0x9039ecdf full_name: "of_get_drm_panel_display_mode" } +elf_symbol { + id: 0x71228b96 + name: "of_get_ethdev_address" + is_defined: true + symbol_type: FUNCTION + crc: 0x5b540bf0 + type_id: 0x9056bb4d + full_name: "of_get_ethdev_address" +} elf_symbol { id: 0xe3de7018 name: "of_get_i2c_adapter_by_node" @@ -385621,6 +385939,15 @@ elf_symbol { type_id: 0x998196f8 full_name: "pci_set_power_state" } +elf_symbol { + id: 0x18c6be42 + name: "pci_speed_string" + is_defined: true + symbol_type: FUNCTION + crc: 0xb1fc1782 + type_id: 0xba0eb204 + full_name: "pci_speed_string" +} elf_symbol { id: 0xab90cbbb name: "pci_sriov_set_totalvfs" @@ -385792,6 +386119,15 @@ elf_symbol { type_id: 0x2ec04b91 full_name: "pcie_get_speed_cap" } +elf_symbol { + id: 0xc0468e7f + name: "pcie_link_speed" + is_defined: true + symbol_type: OBJECT + crc: 0xe4b064f9 + type_id: 0x7eefaca3 + full_name: "pcie_link_speed" +} elf_symbol { id: 0xffa3ecd1 name: "pcie_set_mps" @@ -386098,6 +386434,15 @@ elf_symbol { type_id: 0x915dba0e full_name: "pfn_is_map_memory" } +elf_symbol { + id: 0xaefcb61a + name: "phy_attach" + is_defined: true + symbol_type: FUNCTION + crc: 0xa9c01c0e + type_id: 0xbfb42928 + full_name: "phy_attach" +} elf_symbol { id: 0x5fa10488 name: "phy_attached_info" @@ -386107,6 +386452,15 @@ elf_symbol { type_id: 0x1cc5f9b2 full_name: "phy_attached_info" } +elf_symbol { + id: 0xf7731514 + name: "phy_basic_features" + is_defined: true + symbol_type: OBJECT + crc: 0xf515821d + type_id: 0x607419c2 + full_name: "phy_basic_features" +} elf_symbol { id: 0x9db95d0c name: "phy_basic_t1_features" @@ -386323,6 +386677,15 @@ elf_symbol { type_id: 0xbeab1c63 full_name: "phy_find_first" } +elf_symbol { + id: 0x553833cf + name: "phy_gbit_features" + is_defined: true + symbol_type: OBJECT + crc: 0xaa971d3a + type_id: 0x607419c2 + full_name: "phy_gbit_features" +} elf_symbol { id: 0xd23d219e name: "phy_gbit_fibre_features" @@ -386638,6 +387001,15 @@ elf_symbol { type_id: 0x90580076 full_name: "phy_restore_page" } +elf_symbol { + id: 0x75723369 + name: "phy_resume" + is_defined: true + symbol_type: FUNCTION + crc: 0x9539fb97 + type_id: 0x91dd4b0e + full_name: "phy_resume" +} elf_symbol { id: 0x16bb21a4 name: "phy_save_page" @@ -386728,6 +387100,15 @@ elf_symbol { type_id: 0x91dd4b0e full_name: "phy_start_aneg" } +elf_symbol { + id: 0x94a5496d + name: "phy_start_machine" + is_defined: true + symbol_type: FUNCTION + crc: 0x4124d07d + type_id: 0x1cc5f9b2 + full_name: "phy_start_machine" +} elf_symbol { id: 0x7a9c49cb name: "phy_stop" @@ -386791,6 +387172,15 @@ elf_symbol { type_id: 0x9cca37a5 full_name: "phy_validate" } +elf_symbol { + id: 0x3ec9e498 + name: "phy_validate_pause" + is_defined: true + symbol_type: FUNCTION + crc: 0x2947467b + type_id: 0xf28c97f2 + full_name: "phy_validate_pause" +} elf_symbol { id: 0x32988703 name: "phy_write_mmd" @@ -387070,6 +387460,15 @@ elf_symbol { type_id: 0x1e85155c full_name: "phylink_suspend" } +elf_symbol { + id: 0x8721302c + name: "phys_mem_access_prot" + is_defined: true + symbol_type: FUNCTION + crc: 0xe20113e3 + type_id: 0xe66d986c + full_name: "phys_mem_access_prot" +} elf_symbol { id: 0xfa197680 name: "pick_highest_pushable_task" @@ -387178,6 +387577,15 @@ elf_symbol { type_id: 0x165d386a full_name: "pinctrl_add_gpio_range" } +elf_symbol { + id: 0xeb84b3b6 + name: "pinctrl_dev_get_devname" + is_defined: true + symbol_type: FUNCTION + crc: 0x1471ff1a + type_id: 0x94917d9f + full_name: "pinctrl_dev_get_devname" +} elf_symbol { id: 0x740c134e name: "pinctrl_dev_get_drvdata" @@ -390022,6 +390430,15 @@ elf_symbol { type_id: 0x10985193 full_name: "rebuild_sched_domains" } +elf_symbol { + id: 0xa0aae193 + name: "recalc_sigpending" + is_defined: true + symbol_type: FUNCTION + crc: 0xfb6af58d + type_id: 0x10985193 + full_name: "recalc_sigpending" +} elf_symbol { id: 0x91579542 name: "reciprocal_value" @@ -391525,6 +391942,15 @@ elf_symbol { type_id: 0x18213096 full_name: "reset_controller_unregister" } +elf_symbol { + id: 0xaca7b406 + name: "restore_online_page_callback" + is_defined: true + symbol_type: FUNCTION + crc: 0xe0794234 + type_id: 0xae812031 + full_name: "restore_online_page_callback" +} elf_symbol { id: 0x1d945826 name: "return_address" @@ -393307,6 +393733,15 @@ elf_symbol { type_id: 0x1ecc6a5d full_name: "sdhci_adma_write_desc" } +elf_symbol { + id: 0xd038fff0 + name: "sdhci_calc_clk" + is_defined: true + symbol_type: FUNCTION + crc: 0xcc5a0d79 + type_id: 0x0e64805a + full_name: "sdhci_calc_clk" +} elf_symbol { id: 0x05840f35 name: "sdhci_cleanup_host" @@ -393424,6 +393859,24 @@ elf_symbol { type_id: 0xb019e307 full_name: "sdhci_pltfm_init" } +elf_symbol { + id: 0x33cb4e8f + name: "sdhci_pltfm_resume" + is_defined: true + symbol_type: FUNCTION + crc: 0x8fe800f6 + type_id: 0x9d16dd74 + full_name: "sdhci_pltfm_resume" +} +elf_symbol { + id: 0x558963b2 + name: "sdhci_pltfm_suspend" + is_defined: true + symbol_type: FUNCTION + crc: 0x1b67be70 + type_id: 0x9d16dd74 + full_name: "sdhci_pltfm_suspend" +} elf_symbol { id: 0x9f8a16f0 name: "sdhci_pltfm_unregister" @@ -394189,6 +394642,15 @@ elf_symbol { type_id: 0x56706cd5 full_name: "serial8250_get_port" } +elf_symbol { + id: 0x53281d0f + name: "serial8250_handle_irq" + is_defined: true + symbol_type: FUNCTION + crc: 0x678af31b + type_id: 0x9cbb13a8 + full_name: "serial8250_handle_irq" +} elf_symbol { id: 0x970aca32 name: "serial8250_register_8250_port" @@ -394423,6 +394885,15 @@ elf_symbol { type_id: 0x13b77375 full_name: "set_normalized_timespec64" } +elf_symbol { + id: 0x497a1428 + name: "set_online_page_callback" + is_defined: true + symbol_type: FUNCTION + crc: 0x4ce23806 + type_id: 0xae812031 + full_name: "set_online_page_callback" +} elf_symbol { id: 0x455375fa name: "set_page_dirty" @@ -398276,6 +398747,15 @@ elf_symbol { type_id: 0x9930cdbf full_name: "spi_setup" } +elf_symbol { + id: 0x7e451d2e + name: "spi_split_transfers_maxsize" + is_defined: true + symbol_type: FUNCTION + crc: 0x851ad269 + type_id: 0x9d0e31e2 + full_name: "spi_split_transfers_maxsize" +} elf_symbol { id: 0xdaf3a27e name: "spi_sync" @@ -408278,6 +408758,15 @@ elf_symbol { type_id: 0xfc37fa4b full_name: "vm_node_stat" } +elf_symbol { + id: 0xacc76406 + name: "vm_unmap_aliases" + is_defined: true + symbol_type: FUNCTION + crc: 0xc22a3091 + type_id: 0x10985193 + full_name: "vm_unmap_aliases" +} elf_symbol { id: 0xef2c49d1 name: "vm_unmap_ram" @@ -411681,6 +412170,8 @@ interface { symbol_id: 0x28d17942 symbol_id: 0xef91c650 symbol_id: 0xac82dbbd + symbol_id: 0x324980b6 + symbol_id: 0x8b16f0da symbol_id: 0xae106411 symbol_id: 0x53eb107b symbol_id: 0x9f7a08f8 @@ -411863,6 +412354,7 @@ interface { symbol_id: 0x3ad97d2a symbol_id: 0x82573917 symbol_id: 0x879dc57b + symbol_id: 0xd69134fa symbol_id: 0x4adcbe96 symbol_id: 0xee305d87 symbol_id: 0x3d3dfc90 @@ -412352,6 +412844,7 @@ interface { symbol_id: 0x3b013a69 symbol_id: 0x0576df29 symbol_id: 0x7fca902b + symbol_id: 0x92a490c5 symbol_id: 0x96346c6f symbol_id: 0xce223563 symbol_id: 0x239ee8e4 @@ -413224,7 +413717,9 @@ interface { symbol_id: 0x03c26bf9 symbol_id: 0x5d5a2134 symbol_id: 0x53a8b40e + symbol_id: 0xbb8dbeda symbol_id: 0xc670de95 + symbol_id: 0x560a114d symbol_id: 0x6f76a9a4 symbol_id: 0x14d9b2ac symbol_id: 0x5d0ca5c4 @@ -413239,6 +413734,7 @@ interface { symbol_id: 0xfa137f83 symbol_id: 0x109abab4 symbol_id: 0x2935539f + symbol_id: 0x483e9e6a symbol_id: 0x8f99729e symbol_id: 0xb6a9c6f8 symbol_id: 0x309cb0fd @@ -413332,6 +413828,7 @@ interface { symbol_id: 0x2e62a121 symbol_id: 0x24954a6b symbol_id: 0x95cbf27f + symbol_id: 0x726b2fa8 symbol_id: 0x53f6e0dd symbol_id: 0xbbba9aad symbol_id: 0xd211b195 @@ -413445,6 +413942,7 @@ interface { symbol_id: 0xc5fee33e symbol_id: 0x7419d447 symbol_id: 0xb7f431e8 + symbol_id: 0x69ea6230 symbol_id: 0x0c22ac35 symbol_id: 0x1b6a5b31 symbol_id: 0x30828743 @@ -413624,6 +414122,7 @@ interface { symbol_id: 0x14b7a009 symbol_id: 0x7dd9e61e symbol_id: 0x30903940 + symbol_id: 0xa7604fd3 symbol_id: 0x77a0ab63 symbol_id: 0x4825b485 symbol_id: 0xa448ac51 @@ -414144,8 +414643,11 @@ interface { symbol_id: 0xc6121864 symbol_id: 0x9ed1af8c symbol_id: 0xf030b866 + symbol_id: 0xc86ecf8a symbol_id: 0x01f6343f + symbol_id: 0xb1886c4f symbol_id: 0x508904bc + symbol_id: 0x8a553541 symbol_id: 0xe8b2d7a6 symbol_id: 0x2ed6bfeb symbol_id: 0xa9c80d6c @@ -414697,6 +415199,7 @@ interface { symbol_id: 0xed606b4f symbol_id: 0x2a20c876 symbol_id: 0x6c72efe1 + symbol_id: 0x2ebee953 symbol_id: 0xfac0e8e6 symbol_id: 0xeb2d9bd2 symbol_id: 0x1a34a34f @@ -414864,6 +415367,7 @@ interface { symbol_id: 0xccbb9f00 symbol_id: 0x99c34b67 symbol_id: 0x5bbd22c3 + symbol_id: 0x4f555551 symbol_id: 0x490e6dfe symbol_id: 0xa4bda7eb symbol_id: 0xa388be0c @@ -414885,6 +415389,7 @@ interface { symbol_id: 0x5a17d8da symbol_id: 0xdf129c81 symbol_id: 0x94b29523 + symbol_id: 0x0f547e7d symbol_id: 0x27d7263a symbol_id: 0x19ba4c41 symbol_id: 0xc9e82455 @@ -414905,6 +415410,7 @@ interface { symbol_id: 0x824695bc symbol_id: 0x05a46d27 symbol_id: 0xcb1195f1 + symbol_id: 0x71228b96 symbol_id: 0xe3de7018 symbol_id: 0x26fb2401 symbol_id: 0xec79392b @@ -415158,6 +415664,7 @@ interface { symbol_id: 0x9595d229 symbol_id: 0xfc86cde9 symbol_id: 0xe770d8d1 + symbol_id: 0x18c6be42 symbol_id: 0xab90cbbb symbol_id: 0xa321b388 symbol_id: 0x958eb206 @@ -415177,6 +415684,7 @@ interface { symbol_id: 0x1070f731 symbol_id: 0xb7c9d0b8 symbol_id: 0x8897c24a + symbol_id: 0xc0468e7f symbol_id: 0xffa3ecd1 symbol_id: 0x42595f98 symbol_id: 0xd085753f @@ -415211,7 +415719,9 @@ interface { symbol_id: 0xd50beffc symbol_id: 0x1e700c22 symbol_id: 0xba681a1a + symbol_id: 0xaefcb61a symbol_id: 0x5fa10488 + symbol_id: 0xf7731514 symbol_id: 0x9db95d0c symbol_id: 0x81e2991f symbol_id: 0x4219bd3e @@ -415236,6 +415746,7 @@ interface { symbol_id: 0xcd9e585e symbol_id: 0x69eeb51b symbol_id: 0x6cf83bd0 + symbol_id: 0x553833cf symbol_id: 0xd23d219e symbol_id: 0x0dfe21ad symbol_id: 0xa1f2194b @@ -415271,6 +415782,7 @@ interface { symbol_id: 0x61290d1f symbol_id: 0x509ad286 symbol_id: 0x409cd326 + symbol_id: 0x75723369 symbol_id: 0x16bb21a4 symbol_id: 0x0ccd2ae9 symbol_id: 0x14a69275 @@ -415281,6 +415793,7 @@ interface { symbol_id: 0xe1cb7751 symbol_id: 0x6e315775 symbol_id: 0x10d51eda + symbol_id: 0x94a5496d symbol_id: 0x7a9c49cb symbol_id: 0x6d95635a symbol_id: 0xf1503ace @@ -415288,6 +415801,7 @@ interface { symbol_id: 0xa3314c5c symbol_id: 0xde204c0c symbol_id: 0xe7bafb12 + symbol_id: 0x3ec9e498 symbol_id: 0x32988703 symbol_id: 0x39bc463d symbol_id: 0xe8c3a46c @@ -415319,6 +415833,7 @@ interface { symbol_id: 0x69dcbd79 symbol_id: 0x14fb1d7f symbol_id: 0xae5a377c + symbol_id: 0x8721302c symbol_id: 0xfa197680 symbol_id: 0x4ef078c0 symbol_id: 0x634946e6 @@ -415331,6 +415846,7 @@ interface { symbol_id: 0x56ffdefe symbol_id: 0xd6e8532d symbol_id: 0x9df74c73 + symbol_id: 0xeb84b3b6 symbol_id: 0x740c134e symbol_id: 0xacd66e9e symbol_id: 0x35b1ed7b @@ -415647,6 +416163,7 @@ interface { symbol_id: 0x2886690b symbol_id: 0x46082c90 symbol_id: 0x590d247f + symbol_id: 0xa0aae193 symbol_id: 0x91579542 symbol_id: 0x2a59e35c symbol_id: 0x8fe1956e @@ -415814,6 +416331,7 @@ interface { symbol_id: 0x48fc2cb6 symbol_id: 0xd41c441b symbol_id: 0x8607d899 + symbol_id: 0xaca7b406 symbol_id: 0x1d945826 symbol_id: 0x7f13df64 symbol_id: 0xd8c7c137 @@ -416012,6 +416530,7 @@ interface { symbol_id: 0x771aea1d symbol_id: 0x8d3c4841 symbol_id: 0xf399cd48 + symbol_id: 0xd038fff0 symbol_id: 0x05840f35 symbol_id: 0xa6141872 symbol_id: 0x56b779c5 @@ -416025,6 +416544,8 @@ interface { symbol_id: 0x15f1b772 symbol_id: 0x38940a34 symbol_id: 0x322ca1cc + symbol_id: 0x33cb4e8f + symbol_id: 0x558963b2 symbol_id: 0x9f8a16f0 symbol_id: 0xad3b5931 symbol_id: 0xdc85b8be @@ -416110,6 +416631,7 @@ interface { symbol_id: 0x4bb58367 symbol_id: 0x63762e51 symbol_id: 0x3e462ca5 + symbol_id: 0x53281d0f symbol_id: 0x970aca32 symbol_id: 0x7e56f1cb symbol_id: 0xb28c2541 @@ -416136,6 +416658,7 @@ interface { symbol_id: 0x19ed5e1a symbol_id: 0x7e3fb039 symbol_id: 0xaae00157 + symbol_id: 0x497a1428 symbol_id: 0x455375fa symbol_id: 0xc1ea8aaa symbol_id: 0x500f328c @@ -416564,6 +417087,7 @@ interface { symbol_id: 0x680976a6 symbol_id: 0xc98f6928 symbol_id: 0x042377cd + symbol_id: 0x7e451d2e symbol_id: 0xdaf3a27e symbol_id: 0xbe2a8422 symbol_id: 0x38ac4651 @@ -417676,6 +418200,7 @@ interface { symbol_id: 0xdc09fb10 symbol_id: 0x5849ff8e symbol_id: 0xaf85c216 + symbol_id: 0xacc76406 symbol_id: 0xef2c49d1 symbol_id: 0xca7f93d5 symbol_id: 0xac972f8d diff --git a/android/abi_gki_aarch64_bcmstb b/android/abi_gki_aarch64_bcmstb new file mode 100644 index 000000000000..bb130e302c70 --- /dev/null +++ b/android/abi_gki_aarch64_bcmstb @@ -0,0 +1,1761 @@ +[abi_symbol_list] +# commonly used symbols + add_wait_queue + add_wait_queue_exclusive + alloc_etherdev_mqs + alloc_netdev_mqs + __alloc_pages + __alloc_percpu + __alloc_percpu_gfp + __alloc_skb + alloc_workqueue + alt_cb_patch_nops + __arch_copy_from_user + __arch_copy_to_user + arm64_use_ng_mappings + __arm_smccc_hvc + atomic_notifier_chain_register + bcmp + bpf_trace_run1 + bpf_trace_run2 + bpf_trace_run3 + bpf_trace_run4 + bus_unregister + call_rcu + cancel_delayed_work + cancel_delayed_work_sync + cancel_work_sync + capable + cdc_parse_cdc_header + __check_object_size + __class_create + class_destroy + class_dev_iter_exit + class_dev_iter_init + class_dev_iter_next + class_find_device + __class_register + class_unregister + clk_disable + clk_enable + clk_get_rate + clk_prepare + clk_set_rate + clk_unprepare + compat_ptr_ioctl + complete + __const_udelay + consume_skb + _copy_from_iter + _copy_to_iter + __cpuhp_remove_state + __cpuhp_setup_state + cpu_hwcaps + cpu_number + __cpu_online_mask + __cpu_possible_mask + crc32_le + crypto_aead_decrypt + crypto_aead_encrypt + crypto_aead_setauthsize + crypto_aead_setkey + crypto_alloc_aead + crypto_alloc_shash + crypto_destroy_tfm + crypto_has_alg + _ctype + datagram_poll + debugfs_create_dir + debugfs_create_file + debugfs_create_u32 + debugfs_create_u64 + debugfs_create_u8 + debugfs_remove + default_llseek + default_wake_function + delayed_work_timer_fn + del_timer + del_timer_sync + destroy_workqueue + dev_add_pack + dev_addr_mod + __dev_change_net_namespace + dev_driver_string + _dev_err + dev_err_probe + __dev_get_by_index + dev_get_by_index + dev_get_by_name + dev_get_tstats64 + device_add + device_create + device_create_file + device_del + device_destroy + device_get_match_data + device_initialize + device_move + device_property_present + device_property_read_string + device_property_read_u32_array + device_register + device_remove_file + device_rename + device_set_wakeup_capable + device_set_wakeup_enable + device_unregister + device_wakeup_enable + _dev_info + __dev_kfree_skb_any + __dev_kfree_skb_irq + devm_add_action + devm_clk_get + devm_clk_get_optional + devm_free_irq + devm_gpiod_get_optional + devm_ioremap + devm_ioremap_resource + devm_kasprintf + devm_kfree + devm_kmalloc + __devm_of_phy_provider_register + devm_phy_create + devm_platform_ioremap_resource + devm_platform_ioremap_resource_byname + devm_request_threaded_irq + __devm_reset_control_get + devm_reset_controller_register + __devm_spi_alloc_controller + devm_thermal_of_zone_register + __dev_queue_xmit + dev_remove_pack + devres_add + __devres_alloc_node + devres_free + devres_open_group + devres_release_group + devres_remove_group + dev_set_mac_address + dev_set_name + _dev_warn + disable_irq + disable_irq_nosync + dma_alloc_attrs + dma_free_attrs + dmam_alloc_attrs + dma_map_page_attrs + dma_map_sg_attrs + dma_set_coherent_mask + dma_set_mask + dma_unmap_page_attrs + dma_unmap_sg_attrs + do_trace_netlink_extack + down_read + down_write + driver_unregister + dst_release + enable_irq + eth_mac_addr + eth_platform_get_mac_address + ethtool_convert_legacy_u32_to_link_mode + ethtool_op_get_link + ethtool_op_get_ts_info + eth_type_trans + eth_validate_addr + _find_next_bit + finish_wait + firmware_request_nowarn + flush_dcache_page + flush_work + __flush_workqueue + __folio_put + fortify_panic + fput + free_irq + free_netdev + __free_pages + free_pages + free_percpu + generic_handle_domain_irq + genlmsg_put + genl_register_family + genl_unregister_family + __genphy_config_aneg + genphy_read_status + genphy_resume + genphy_soft_reset + get_device + get_net_ns_by_fd + get_net_ns_by_pid + get_random_bytes + gic_nonsecure_priorities + gpiochip_add_data_with_key + gpiochip_find + gpiochip_get_data + gpiochip_remove + gpiod_get_value_cansleep + gpiod_set_value + gpiod_to_irq + gpio_to_desc + handle_edge_irq + handle_level_irq + hrtimer_active + hrtimer_cancel + hrtimer_init + hrtimer_start_range_ns + i2c_add_adapter + i2c_del_adapter + ida_alloc_range + ida_free + idr_alloc + idr_destroy + idr_find + idr_get_next + idr_remove + init_net + __init_rwsem + __init_swait_queue_head + init_timer_key + init_uts_ns + init_wait_entry + __init_waitqueue_head + input_event + input_register_device + ioremap_prot + iounmap + iov_iter_kvec + iov_iter_revert + ip_route_output_flow + __ipv6_addr_type + __irq_alloc_domain_generic_chips + irq_create_mapping_affinity + irq_dispose_mapping + __irq_domain_add + irq_domain_remove + irq_gc_set_wake + irq_generic_chip_ops + irq_get_domain_generic_chip + irq_get_irq_data + irq_of_parse_and_map + __irq_resolve_mapping + irq_set_chained_handler_and_data + irq_set_chip_and_handler_name + irq_set_chip_data + irq_set_irq_wake + is_vmalloc_addr + jiffies + jiffies_to_msecs + kasan_flag_enabled + kernel_accept + kernel_bind + kernel_connect + kernel_listen + kernel_sendmsg + kernel_sock_shutdown + __kfifo_out + kfree + kfree_sensitive + kfree_skb_reason + kimage_voffset + __kmalloc + kmalloc_caches + kmalloc_large + kmalloc_trace + kmem_cache_alloc + kmem_cache_create + kmem_cache_destroy + kmem_cache_free + kmemdup + kobject_uevent_env + kstrdup + kstrtobool + kstrtoint + kstrtoll + kstrtouint + kstrtoull + kthread_create_on_node + ktime_get + ktime_get_mono_fast_ns + ktime_get_with_offset + kvfree_call_rcu + __list_add_valid + __list_del_entry_valid + __local_bh_enable_ip + lock_sock_nested + log_post_read_mmio + log_post_write_mmio + log_read_mmio + log_write_mmio + mdiobus_alloc_size + mdiobus_free + __mdiobus_read + mdiobus_read + mdiobus_unregister + __mdiobus_write + mdiobus_write + memchr + memcpy + memmove + memset + memstart_addr + misc_deregister + misc_register + mod_timer + __module_get + module_layout + module_put + __msecs_to_jiffies + msleep + __mutex_init + mutex_lock + mutex_trylock + mutex_unlock + __napi_alloc_skb + napi_complete_done + napi_disable + napi_enable + napi_gro_receive + __napi_schedule + __napi_schedule_irqoff + napi_schedule_prep + __netdev_alloc_skb + netdev_err + netdev_info + netdev_notice + netdev_printk + netdev_warn + netif_carrier_off + netif_carrier_on + netif_device_attach + netif_device_detach + netif_napi_add_weight + __netif_napi_del + netif_receive_skb + netif_rx + netif_set_tso_max_size + netif_tx_lock + netif_tx_unlock + netif_tx_wake_queue + netlink_broadcast + netlink_register_notifier + netlink_unicast + netlink_unregister_notifier + net_ratelimit + nf_conntrack_destroy + nla_memcpy + __nla_parse + nla_put + nla_put_64bit + nla_strscpy + __nla_validate + __nlmsg_put + noop_llseek + nr_cpu_ids + ns_capable + of_address_to_resource + of_alias_get_id + of_clk_get_by_name + of_device_get_match_data + of_device_is_available + of_device_is_big_endian + of_device_is_compatible + of_find_compatible_node + of_find_device_by_node + of_find_node_by_name + of_find_node_opts_by_path + of_find_property + of_get_mac_address + of_get_next_available_child + of_get_next_child + of_get_phy_mode + of_get_property + of_iomap + of_match_node + __of_parse_phandle_with_args + of_phy_connect + of_phy_deregister_fixed_link + of_phy_is_fixed_link + of_phy_register_fixed_link + of_property_read_string + of_property_read_string_helper + of_property_read_u32_index + of_property_read_variable_u32_array + of_prop_next_u32 + page_pinner_inited + __page_pinner_put_page + panic_notifier_list + param_ops_bool + param_ops_int + param_ops_uint + pci_bus_type + __per_cpu_offset + perf_trace_buf_alloc + perf_trace_run_bpf_submit + phy_disconnect + phy_do_ioctl_running + phy_drivers_register + phy_drivers_unregister + phy_error + phy_ethtool_get_eee + phy_ethtool_get_link_ksettings + phy_ethtool_get_wol + phy_ethtool_nway_reset + phy_ethtool_set_eee + phy_ethtool_set_link_ksettings + phy_exit + phy_init + phy_init_eee + phy_mac_interrupt + phy_modify + phy_power_off + phy_power_on + phy_print_status + phy_start + phy_stop + phy_trigger_machine + platform_device_register_full + platform_device_unregister + __platform_driver_probe + __platform_driver_register + platform_driver_unregister + platform_get_irq + platform_get_irq_byname + platform_get_irq_byname_optional + platform_get_irq_optional + platform_get_resource + platform_get_resource_byname + platform_irqchip_probe + __pm_runtime_disable + pm_runtime_enable + __pm_runtime_idle + __pm_runtime_resume + __pm_runtime_set_status + pm_wakeup_dev_event + preempt_schedule + preempt_schedule_notrace + prepare_to_wait_event + _printk + __printk_ratelimit + proc_create_data + proc_create_net_data + proc_create_net_single + proc_create_seq_private + proc_doulongvec_minmax + _proc_mkdir + proc_remove + proto_register + proto_unregister + __pskb_copy_fclone + pskb_expand_head + __pskb_pull_tail + put_cmsg + put_device + __put_net + __put_task_struct + pwmchip_add + pwmchip_remove + queue_delayed_work_on + queue_work_on + ___ratelimit + _raw_read_lock + _raw_read_lock_bh + _raw_read_unlock + _raw_read_unlock_bh + _raw_spin_lock + _raw_spin_lock_bh + _raw_spin_lock_irq + _raw_spin_lock_irqsave + _raw_spin_unlock + _raw_spin_unlock_bh + _raw_spin_unlock_irq + _raw_spin_unlock_irqrestore + _raw_write_lock + _raw_write_lock_bh + _raw_write_unlock + _raw_write_unlock_bh + rb_erase + rb_first + rb_insert_color + rb_next + rcu_barrier + __rcu_read_lock + __rcu_read_unlock + refcount_warn_saturate + __register_chrdev + register_die_notifier + register_netdev + register_netdevice + register_netdevice_notifier + register_net_sysctl + register_pernet_device + register_pernet_subsys + register_pm_notifier + register_syscore_ops + regulator_bulk_disable + regulator_bulk_enable + release_firmware + release_sock + remove_proc_entry + remove_wait_queue + request_firmware + __request_module + request_threaded_irq + reset_control_assert + reset_control_deassert + reset_control_rearm + reset_control_reset + round_jiffies_relative + rtnl_is_locked + rtnl_link_register + rtnl_link_unregister + rtnl_lock + rtnl_unlock + schedule + schedule_timeout + schedule_timeout_uninterruptible + scmi_driver_register + scmi_driver_unregister + scnprintf + security_sk_clone + security_sock_graft + seq_lseek + seq_printf + seq_putc + seq_puts + seq_read + setup_udp_tunnel_sock + set_user_nice + sg_init_one + sg_init_table + sg_next + simple_read_from_buffer + simple_strtoul + single_open + single_release + sk_alloc + skb_add_rx_frag + skb_checksum_help + skb_clone + skb_copy + skb_copy_bits + skb_copy_datagram_iter + skb_copy_expand + skb_dequeue + skb_free_datagram + skb_pull + skb_push + skb_put + skb_queue_head + skb_queue_purge + skb_queue_tail + skb_realloc_headroom + skb_recv_datagram + skb_trim + skb_tstamp_tx + skb_unlink + sk_error_report + sk_free + snprintf + sock_alloc_send_pskb + sock_create_kern + sock_efree + sockfd_lookup + sock_gettstamp + sock_i_ino + sock_init_data + sock_i_uid + sock_no_accept + sock_no_bind + sock_no_connect + sock_no_getname + sock_no_listen + sock_no_mmap + sock_no_recvmsg + sock_no_sendmsg + sock_no_sendpage + sock_no_shutdown + sock_no_socketpair + sock_queue_rcv_skb_reason + __sock_recv_cmsgs + __sock_recv_timestamp + __sock_recv_wifi_status + sock_register + sock_release + sock_unregister + sort + spi_register_controller + spi_unregister_controller + sprintf + sscanf + __stack_chk_fail + strchr + strcmp + strcpy + stream_open + strlen + strncasecmp + strncmp + strncpy + strnlen + strscpy + strstr + __sw_hweight32 + synchronize_net + synchronize_rcu + sysfs_create_group + sysfs_emit + sysfs_remove_group + sysfs_streq + system_long_wq + system_power_efficient_wq + system_wq + tasklet_kill + __tasklet_schedule + tasklet_setup + tasklet_unlock_wait + thermal_zone_device_update + trace_event_buffer_commit + trace_event_buffer_reserve + trace_event_printf + trace_event_raw_init + trace_event_reg + trace_handle_return + trace_output_call + trace_print_symbols_seq + trace_raw_output_prep + __trace_trigger_soft_disabled + try_module_get + __tty_alloc_driver + tty_driver_kref_put + tty_flip_buffer_push + __tty_insert_flip_char + tty_insert_flip_string_fixed_flag + tty_kref_put + tty_port_close + tty_port_hangup + tty_port_init + tty_port_open + tty_port_put + tty_port_register_device + tty_port_tty_get + tty_port_tty_hangup + tty_port_tty_wakeup + tty_register_driver + tty_register_ldisc + tty_standard_install + tty_std_termios + tty_termios_baud_rate + tty_unregister_device + tty_unregister_driver + tty_unregister_ldisc + tty_vhangup + udp_sock_create4 + udp_sock_create6 + __unregister_chrdev + unregister_netdev + unregister_netdevice_many + unregister_netdevice_notifier + unregister_netdevice_queue + unregister_net_sysctl_table + unregister_pernet_device + unregister_pernet_subsys + unregister_pm_notifier + up_read + up_write + usb_alloc_urb + usb_anchor_urb + usb_autopm_get_interface + usb_autopm_get_interface_async + usb_autopm_get_interface_no_resume + usb_autopm_put_interface + usb_autopm_put_interface_async + usb_clear_halt + usb_control_msg + usb_control_msg_recv + usb_deregister + usb_disabled + usb_driver_claim_interface + usb_driver_release_interface + usb_find_common_endpoints + usb_free_urb + usb_get_from_anchor + usb_get_intf + usb_ifnum_to_if + usb_kill_urb + usb_poison_urb + usb_put_intf + usb_register_driver + usb_set_interface + usb_submit_urb + usb_unlink_urb + usb_unpoison_urb + usleep_range_state + vfree + vmalloc + vscnprintf + vzalloc + wait_for_completion_timeout + wait_woken + __wake_up + wake_up_bit + wake_up_process + __warn_printk + woken_wake_function + +# required by 6lowpan.ko + addrconf_add_linklocal + addrconf_prefix_rcv_add_addr + __ndisc_fill_addr_option + +# required by 8021q.ko + call_netdevice_notifiers + dev_change_flags + dev_close_many + __dev_get_by_name + dev_get_flags + dev_get_stats + dev_mc_sync + dev_mc_unsync + dev_set_allmulti + dev_set_mtu + dev_set_promiscuity + dev_uc_add + dev_uc_del + dev_uc_sync + dev_uc_unsync + ether_setup + eth_header_parse + __ethtool_get_link_ksettings + linkwatch_fire_event + netdev_update_features + netdev_upper_dev_link + netdev_upper_dev_unlink + netif_inherit_tso_max + netif_stacked_transfer_operstate + proc_create_single_data + strscpy_pad + vlan_dev_vlan_id + vlan_filter_drop_vids + vlan_filter_push_vids + vlan_ioctl_set + vlan_uses_dev + vlan_vid_add + vlan_vid_del + +# required by 8250_bcm7271.ko + serial8250_do_set_termios + serial8250_do_shutdown + serial8250_do_startup + serial8250_get_port + serial8250_handle_irq + serial8250_register_8250_port + serial8250_resume_port + serial8250_suspend_port + serial8250_unregister_port + uart_write_wakeup + +# required by ahci_brcm.ko + phy_calibrate + +# required by aqc111.ko + usb_driver_set_configuration + usb_reset_configuration + +# required by asix.ko + mdiobus_get_phy + __mdiobus_register + net_selftest + net_selftest_get_count + net_selftest_get_strings + phy_attached_info + phy_connect + phylink_connect_phy + phylink_create + phylink_destroy + phylink_disconnect_phy + phylink_ethtool_get_pauseparam + phylink_ethtool_set_pauseparam + phylink_generic_validate + phylink_resume + phylink_start + phylink_stop + phylink_suspend + phy_suspend + +# required by bbsi.ko + spi_sync + spi_write_then_read + +# required by bcm-asp.ko + completion_done + devm_clk_get_optional_enabled + dma_sync_single_for_cpu + of_get_ethdev_address + of_platform_populate + __skb_pad + synchronize_irq + +# required by bcm-phy-lib.ko + ethnl_cable_test_fault_length + ethnl_cable_test_result + phy_read_mmd + phy_write_mmd + +# required by bcm6802.ko + __spi_register_driver + +# required by bcm7038_wdt.ko + devm_watchdog_register_device + +# required by bcm7xxx.ko + genphy_restart_aneg + +# required by bdc.ko + devm_of_phy_get_by_index + dma_pool_alloc + dma_pool_create + dma_pool_destroy + dma_pool_free + of_count_phandle_with_args + usb_add_gadget_udc + usb_del_gadget_udc + usb_ep_set_maxpacket_limit + usb_gadget_giveback_request + usb_gadget_map_request + usb_gadget_set_state + usb_gadget_unmap_request + +# required by bluetooth.ko + aes_encrypt + aes_expandkey + bit_wait + crc16 + crypto_alloc_kpp + crypto_ecdh_encode_key + crypto_ecdh_key_len + __crypto_memneq + crypto_shash_setkey + crypto_shash_tfm_digest + debugfs_attr_read + debugfs_attr_write + debugfs_create_u16 + dev_fwnode + device_find_child + drain_workqueue + fwnode_property_read_u8_array + __get_random_u32_below + __get_task_comm + kfree_const + kstrtobool_from_user + kvasprintf_const + kvfree + kvmalloc_node + memcpy_and_pad + ns_to_kernel_old_timeval + out_of_line_wait_on_bit + radix_tree_tagged + seq_hlist_next + seq_hlist_start_head + simple_attr_open + simple_attr_release + simple_open + skb_pull_data + sk_capable + sk_filter_trim_cap + __sock_queue_rcv_skb + vsnprintf + vsprintf + wait_for_completion + +# required by bmoca.ko + get_user_pages + of_find_net_device_by_node + of_find_node_by_phandle + +# required by brcmstb-proc-info.ko + find_get_pid + generic_file_open + get_pid_task + +# required by brcmstb-usb-pinmap.ko + devm_gpiod_get_index + gpiod_get_value + +# required by brcmstb_dpfe.ko + _dev_emerg + sysfs_create_groups + sysfs_remove_groups + +# required by brcmstb_gisb.ko + __sw_hweight64 + +# required by brcmstb_memc.ko + of_match_device + +# required by broadcom.ko + devm_gpiod_get + genphy_c37_config_aneg + genphy_c37_read_status + genphy_suspend + +# required by btbcm.ko + efi + +# required by btsdio.ko + sdio_claim_host + sdio_claim_irq + sdio_disable_func + sdio_enable_func + sdio_readb + sdio_readsb + sdio_register_driver + sdio_release_host + sdio_release_irq + sdio_unregister_driver + sdio_writeb + sdio_writesb + +# required by can-bcm.ko + dev_get_by_index_rcu + hrtimer_forward + +# required by can-dev.ko + of_get_child_by_name + +# required by can-gw.ko + netlink_capable + rtnl_register_module + rtnl_unregister + rtnl_unregister_all + +# required by can-raw.ko + __kmalloc_node_track_caller + sock_cmsg_send + sock_recv_errqueue + __sock_tx_timestamp + +# required by can.ko + round_jiffies + +# required by cdc-acm.ko + krealloc + tty_get_char_size + usb_alloc_coherent + usb_free_coherent + +# required by cdc_ncm.ko + usb_altnum_to_altsetting + +# required by cfg80211.ko + bpf_trace_run10 + bpf_trace_run5 + bpf_trace_run6 + bpf_trace_run7 + bpf_trace_run8 + csum_partial + debugfs_rename + dev_close + flush_delayed_work + gcd + genlmsg_multicast_allns + inet_csk_get_port + key_create_or_update + key_put + keyring_alloc + ktime_get_coarse_with_offset + memcmp + mod_delayed_work_on + net_ns_type_operations + nla_find + nla_reserve + param_ops_charp + request_firmware_nowait + __sock_create + __sw_hweight16 + __sw_hweight8 + sysfs_create_link + sysfs_remove_link + system_unbound_wq + trace_print_array_seq + verify_pkcs7_signature + wireless_nlevent_flush + +# required by clk-scmi.ko + clk_hw_set_rate_range + devm_clk_hw_register + devm_of_clk_add_hw_provider + of_clk_hw_onecell_get + +# required by cqhci.ko + devm_blk_crypto_profile_init + dmam_free_coherent + mmc_cqe_request_done + +# required by diag.ko + __netlink_dump_start + sock_diag_register + sock_diag_save_cookie + sock_diag_unregister + +# required by dvfs.ko + debugfs_create_x32 + debugfs_create_x64 + scmi_protocol_register + scmi_protocol_unregister + simple_write_to_buffer + strspn + +# required by ehci-brcm.ko + devm_platform_get_and_ioremap_resource + ehci_hub_control + ehci_init_driver + ehci_resume + ehci_setup + ehci_suspend + usb_add_hcd + usb_create_hcd + usb_hcd_platform_shutdown + usb_put_hcd + usb_remove_hcd + +# required by ethsw.ko + panic + phy_basic_features + phy_gbit_features + seq_release + +# required by extcon-brcmstb-hdmi-hpd.ko + devm_extcon_dev_allocate + devm_extcon_dev_register + extcon_set_state_sync + +# required by fb.ko + console_lock + console_unlock + fb_mode_option + ignore_console_lock_warning + is_console_locked + __memcpy_fromio + __memcpy_toio + oops_in_progress + simple_strtol + vm_get_page_prot + vm_iomap_memory + +# required by fb_notify.ko + blocking_notifier_call_chain + blocking_notifier_chain_register + blocking_notifier_chain_unregister + +# required by ftdi_sio.ko + __bitmap_complement + _find_first_bit + kstrtou8 + tty_encode_baud_rate + +# required by genet.ko + device_get_ethdev_address + device_get_phy_mode + dql_completed + dql_reset + fixed_phy_register + fixed_phy_set_link_update + kasprintf + netdev_crit + netif_schedule_queue + netif_set_real_num_rx_queues + netif_set_real_num_tx_queues + of_get_compatible_child + of_phy_find_device + phy_attach + phy_connect_direct + phy_ethtool_ksettings_get + phy_ethtool_ksettings_set + phy_ethtool_set_wol + phy_get_pause + phy_init_hw + phy_resume + phy_set_max_speed + phy_start_aneg + phy_start_machine + phy_validate_pause + platform_device_add + platform_device_add_data + platform_device_add_resources + platform_device_alloc + platform_device_put + softnet_data + +# required by gpio-brcmstb.ko + bgpio_init + irq_domain_xlate_twocell + irq_modify_status + of_property_count_elems_of_size + +# required by gpio.ko + gpiod_to_chip + gpio_free + gpio_request + +# required by gpio_keys_polled.ko + device_get_child_node_count + device_get_next_child_node + devm_fwnode_gpiod_get_index + devm_gpio_request_one + devm_input_allocate_device + fwnode_handle_put + fwnode_property_present + fwnode_property_read_string + fwnode_property_read_u32_array + input_set_abs_params + input_set_capability + input_set_poll_interval + input_setup_polling + +# required by gzvm.ko + add_wait_queue_priority + alloc_pages_exact + anon_inode_getfd + eventfd_ctx_do_read + eventfd_ctx_fdget + eventfd_ctx_fileget + eventfd_ctx_put + eventfd_ctx_remove_wait_queue + eventfd_signal + __fdget + free_pages_exact + get_user_pages_fast_only + get_user_pages_unlocked + init_srcu_struct + __mmap_lock_do_trace_acquire_returned + __mmap_lock_do_trace_released + __mmap_lock_do_trace_start_locking + mtree_load + pin_user_pages + __srcu_read_lock + __srcu_read_unlock + synchronize_srcu + __traceiter_mmap_lock_acquire_returned + __traceiter_mmap_lock_released + __traceiter_mmap_lock_start_locking + __tracepoint_mmap_lock_acquire_returned + __tracepoint_mmap_lock_released + __tracepoint_mmap_lock_start_locking + unpin_user_pages_dirty_lock + +# required by hci_uart.ko + bit_wait_timeout + clk_is_match + debugfs_create_bool + dev_coredumpv + device_property_read_u8_array + device_wakeup_disable + devm_clk_put + devm_regulator_bulk_get + gpiod_set_value_cansleep + n_tty_ioctl_helper + nvmem_cell_get + nvmem_cell_put + nvmem_cell_read + of_irq_get_byname + out_of_line_wait_on_bit_timeout + __percpu_down_read + percpu_down_write + percpu_free_rwsem + __percpu_init_rwsem + percpu_up_write + pm_runtime_set_autosuspend_delay + __pm_runtime_suspend + __pm_runtime_use_autosuspend + rcuwait_wake_up + regulator_set_load + serdev_device_close + __serdev_device_driver_register + serdev_device_get_tiocm + serdev_device_open + serdev_device_set_baudrate + serdev_device_set_flow_control + serdev_device_set_tiocm + serdev_device_wait_until_sent + serdev_device_write_buf + serdev_device_write_flush + _trace_android_vh_record_pcpu_rwsem_starttime + _trace_android_vh_record_pcpu_rwsem_time_early + tty_driver_flush_buffer + tty_ldisc_flush + tty_set_termios + tty_termios_encode_baud_rate + tty_unthrottle + +# required by hidp.ko + hid_add_device + hid_allocate_device + hid_destroy_device + hid_ignore + hid_input_report + hid_parse_report + input_allocate_device + input_unregister_device + memdup_user + memscan + __module_put_and_kthread_exit + mutex_lock_interruptible + +# required by hwmon.ko + devm_kstrdup + devres_release + strpbrk + sysfs_notify + +# required by i2c-bcm2835.ko + __clk_get_name + clk_hw_register_clkdev + clk_rate_exclusive_put + clk_set_rate_exclusive + devm_clk_register + +# required by i2c-brcmstb.ko + devm_iounmap + +# required by ieee802154.ko + class_for_each_device + device_match_name + +# required by ieee802154_6lowpan.ko + fqdir_exit + fqdir_init + inet_frag_destroy + inet_frag_find + inet_frag_kill + inet_frag_queue_insert + inet_frag_reasm_finish + inet_frag_reasm_prepare + inet_frags_fini + inet_frags_init + init_user_ns + nd_tbl + neigh_destroy + neigh_lookup + proc_dointvec_jiffies + +# required by ieee802154_socket.ko + dev_getbyhwaddr_rcu + dev_getfirstbyhwtype + dev_load + get_user_ifreq + put_user_ifreq + sk_common_release + sock_common_getsockopt + sock_common_recvmsg + sock_common_setsockopt + +# required by irq-bcm7038-l1.ko + irq_domain_xlate_onecell + +# required by irq-bcm7120-l2.ko + irq_gc_mask_clr_bit + irq_gc_mask_set_bit + irq_gc_noop + platform_irq_count + +# required by irq-brcmstb-l2.ko + handle_bad_irq + irq_gc_ack_set_bit + irq_gc_mask_disable_reg + irq_gc_unmask_enable_reg + +# required by irq.ko + irq_create_fwspec_mapping + irq_find_matching_fwspec + of_irq_get + +# required by kheaders.ko + kernel_kobj + sysfs_create_bin_file + sysfs_remove_bin_file + +# required by l2tp_core.ko + idr_alloc_u32 + idr_get_next_ul + idr_replace + inet6_csk_xmit + ip_queue_xmit + udp6_set_csum + udp_set_csum + +# required by l2tp_ppp.ko + sock_wmalloc + +# required by libahci_platform.ko + clk_bulk_disable + clk_bulk_enable + clk_bulk_prepare + clk_bulk_unprepare + devm_clk_bulk_get_all + devm_of_phy_get + devm_regulator_get + devm_reset_control_array_get + of_platform_device_create + phy_set_mode_ext + regulator_disable + regulator_enable + regulator_get + regulator_put + +# required by libata.ko + add_timer + async_schedule_node + async_synchronize_cookie + attribute_container_register + attribute_container_unregister + autoremove_wake_function + blk_abort_request + blk_queue_max_hw_sectors + blk_queue_max_segments + blk_queue_update_dma_alignment + blk_queue_update_dma_pad + device_link_add + device_link_remove + _dev_printk + glob_match + param_ops_string + pci_disable_device + pcim_enable_device + pcim_iomap_regions + pcim_iomap_table + pcim_pin_device + pci_read_config_byte + pci_read_config_dword + pci_read_config_word + pci_restore_state + pci_save_state + pci_set_master + pci_set_power_state + pm_runtime_forbid + prepare_to_wait + print_hex_dump + __scsi_add_device + scsi_add_host_with_dma + scsi_build_sense + scsi_change_queue_depth + scsi_check_sense + scsi_command_size_tbl + scsi_device_get + scsi_device_put + scsi_device_set_state + scsi_done + scsi_eh_finish_cmd + scsi_eh_flush_done_q + scsi_execute_cmd + __scsi_format_command + scsi_host_alloc + scsi_host_put + scsi_remove_device + scsi_remove_host + scsi_rescan_device + scsi_schedule_eh + scsi_sense_desc_find + scsi_set_sense_field_pointer + scsi_set_sense_information + sdev_evt_send_simple + sg_copy_from_buffer + sg_copy_to_buffer + sg_miter_next + sg_miter_start + sg_miter_stop + stpcpy + strcasecmp + strim + system_entering_hibernation + system_state + trace_seq_printf + trace_seq_putc + transport_add_device + transport_class_register + transport_class_unregister + transport_configure_device + transport_destroy_device + transport_remove_device + transport_setup_device + +# required by mac802154.ko + crc_ccitt + crypto_alloc_sync_skcipher + crypto_skcipher_decrypt + crypto_skcipher_encrypt + crypto_skcipher_setkey + dev_alloc_name + +# required by mdio-bcm-unimac.ko + __of_mdiobus_register + +# required by memory.ko + high_memory + memremap + memunmap + of_n_addr_cells + of_n_size_cells + set_online_page_callback + vm_unmap_aliases + +# required by mii.ko + ethtool_convert_link_mode_to_legacy_u32 + +# required by nfc.ko + sock_no_ioctl + +# required by pcie-brcmstb.ko + atomic_notifier_chain_unregister + bitmap_find_free_region + bitmap_release_region + devm_pci_alloc_host_bridge + irq_chip_ack_parent + irq_domain_get_irq_data + irq_domain_set_info + of_pci_get_max_link_speed + of_property_read_variable_u64_array + pcie_link_speed + pci_generic_config_read + pci_generic_config_read32 + pci_generic_config_write + pci_generic_config_write32 + pci_host_probe + pci_msi_create_irq_domain + pci_msi_enabled + pci_msi_mask_irq + pci_msi_unmask_irq + pci_remove_root_bus + pci_speed_string + pci_stop_root_bus + pci_walk_bus + pm_suspend_global_flags + regulator_bulk_free + regulator_bulk_get + unregister_die_notifier + +# required by phy-brcm-sata.ko + of_phy_simple_xlate + +# required by phy-brcm-usb-dvr.ko + brcmstb_get_family_id + brcmstb_get_product_id + clk_get + regmap_update_bits_base + syscon_regmap_lookup_by_phandle + +# required by pinctrl-bcm2835.ko + devm_pinctrl_register + gpiochip_add_pin_range + gpiochip_disable_irq + gpiochip_enable_irq + gpiochip_generic_config + gpiochip_generic_free + gpiochip_generic_request + gpiochip_irq_relres + gpiochip_irq_reqres + of_pinctrl_get + pinconf_generic_dt_node_to_map + pinctrl_add_gpio_range + pinctrl_dev_get_devname + pinctrl_dev_get_drvdata + pinctrl_remove_gpio_range + +# required by pm-common.ko + proc_mkdir + +# required by pm-psci.ko + arm_smccc_1_1_get_conduit + __arm_smccc_smc + firmware_kobj + kobject_create_and_add + kobject_del + kobject_put + pm_power_off + register_restart_handler + sysfs_create_files + +# required by ppp_deflate.ko + zlib_deflate + zlib_deflateEnd + zlib_deflateInit2 + zlib_deflateReset + zlib_deflate_workspacesize + zlib_inflate + zlib_inflateIncomp + zlib_inflateInit2 + zlib_inflateReset + zlib_inflate_workspacesize + +# required by ppp_generic.ko + fget + iov_iter_init + netdev_name_in_use + skb_pull_rcsum + skb_scrub_packet + +# required by ppp_mppe.ko + crypto_has_ahash + crypto_shash_final + crypto_shash_update + +# required by pptp.ko + _find_next_zero_bit + gre_add_protocol + gre_del_protocol + ip_local_out + __ip_select_ident + ip_send_check + security_sk_classify_flow + skb_set_owner_w + __sk_receive_skb + sk_setup_caps + +# required by pwm-brcmstb.ko + mul_u64_u64_div_u64 + +# required by r8152.ko + crypto_shash_digest + csum_ipv6_magic + kmalloc_large_node + kmalloc_node_trace + __skb_gso_segment + usb_deregister_device_driver + usb_enable_lpm + usb_queue_reset_device + usb_register_device_driver + usb_reset_device + usb_set_configuration + work_busy + +# required by rfcomm.ko + kthread_should_stop + kthread_stop + tty_port_install + tty_wakeup + +# required by rfkill.ko + add_uevent_var + kobject_uevent + led_trigger_event + led_trigger_register + led_trigger_unregister + +# required by rtc-brcmstb-waketimer.ko + devm_rtc_allocate_device + __devm_rtc_register_device + register_reboot_notifier + rtc_time64_to_tm + rtc_tm_to_time64 + rtc_update_irq + unregister_reboot_notifier + +# required by rtl8150.ko + usb_control_msg_send + +# required by scmi-regulator.ko + devm_regulator_register + rdev_get_drvdata + regulator_list_voltage_linear + regulator_list_voltage_table + regulator_map_voltage_iterate + regulator_map_voltage_linear + +# required by scmi_pm_domain.ko + of_genpd_add_provider_onecell + of_genpd_del_provider + pm_genpd_init + pm_genpd_remove + +# required by sdhci-brcmstb.ko + mmc_of_parse + __sdhci_add_host + sdhci_add_host + sdhci_calc_clk + sdhci_cleanup_host + sdhci_cqe_disable + sdhci_cqe_enable + sdhci_cqe_irq + sdhci_dumpregs + sdhci_enable_clk + sdhci_get_property + sdhci_pltfm_free + sdhci_pltfm_init + sdhci_pltfm_resume + sdhci_pltfm_suspend + sdhci_pltfm_unregister + sdhci_reset + sdhci_set_bus_width + sdhci_set_clock + sdhci_set_uhs_signaling + sdhci_setup_host + +# required by slcan.ko + hex_asc_upper + hex_to_bin + tty_mode_ioctl + +# required by spi-bcm-qspi.ko + spi_controller_resume + spi_controller_suspend + +# required by spi-bcm2835.ko + dma_get_slave_caps + dma_release_channel + dma_request_chan + dma_sync_single_for_device + empty_zero_page + gpiochip_request_own_desc + __of_get_address + spi_finalize_current_transfer + spi_split_transfers_maxsize + +# required by tipc.ko + bin2hex + crypto_default_rng + crypto_get_default_rng + crypto_put_default_rng + dev_nit_active + dst_cache_destroy + dst_cache_get + dst_cache_init + dst_cache_set_ip4 + dst_cache_set_ip6 + get_random_u32 + in6addr_any + ip6_dst_hoplimit + __ip_dev_find + ip_mc_join_group + ipv6_dev_find + ipv6_stub + jiffies_to_usecs + kfree_skb_partial + list_sort + netlink_net_capable + net_namespace_list + overflowuid + proc_dointvec_minmax + pskb_put + ___pskb_trim + _raw_spin_trylock_bh + __rb_erase_color + rb_first_postorder + __rb_insert_augmented + rb_next_postorder + refcount_dec_if_one + rhashtable_destroy + rhashtable_init + rhashtable_insert_slow + rhashtable_walk_enter + rhashtable_walk_exit + rhashtable_walk_next + rhashtable_walk_start_check + rhashtable_walk_stop + __rht_bucket_nested + rht_bucket_nested + rht_bucket_nested_insert + skb_cow_data + skb_to_sgvec + skb_try_coalesce + sk_reset_timer + sk_stop_timer + sock_recvmsg + sock_rfree + strrchr + sysctl_vals + udp_tunnel6_xmit_skb + udp_tunnel_sock_release + udp_tunnel_xmit_skb + __wake_up_sync_key + +# required by usbnet.ko + hex2bin + usb_check_bulk_endpoints + usb_get_urb + usb_string + +# required by usbserial.ko + bus_register + driver_attach + driver_register + __kfifo_alloc + __kfifo_free + __kfifo_in + schedule_timeout_interruptible + tty_hangup + tty_ldisc_deref + tty_ldisc_ref + tty_port_destroy + tty_termios_copy_hw + usb_get_dev + usb_match_id + usb_match_one_id + usb_put_dev + usb_show_dynids + usb_store_new_id + +# required by wwan.ko + device_find_child_by_name + device_for_each_child + _find_first_zero_bit + get_zeroed_page + rtnl_configure_link + rtnl_create_link + +# required by zram.ko + bdev_end_io_acct + bdev_start_io_acct + bio_endio + bio_end_io_acct_remapped + bio_start_io_acct + __blk_alloc_disk + blk_queue_flag_clear + blk_queue_flag_set + blk_queue_io_min + blk_queue_io_opt + blk_queue_logical_block_size + blk_queue_max_discard_sectors + blk_queue_max_write_zeroes_sectors + blk_queue_physical_block_size + __cpuhp_state_add_instance + __cpuhp_state_remove_instance + crypto_alloc_base + crypto_comp_compress + crypto_comp_decompress + del_gendisk + device_add_disk + __get_free_pages + idr_for_each + kstrtou16 + memparse + memset64 + mutex_is_locked + __num_online_cpus + page_endio + put_disk + __register_blkdev + set_capacity + set_capacity_and_notify + sync_blockdev + unregister_blkdev + +# required by zsmalloc.ko + __ClearPageMovable + dec_zone_page_state + folio_wait_bit + inc_zone_page_state + register_shrinker + __SetPageMovable + unlock_page + unregister_shrinker + +# TODO: external drivers + +# required by nexusmem.ko + restore_online_page_callback + +# required by nexus.ko + recalc_sigpending + +# required by bstm.ko + phys_mem_access_prot + generic_access_phys From ec795e4eaa8adbfe6655dafdc1e2c8e60bf05d60 Mon Sep 17 00:00:00 2001 From: Giuliano Procida Date: Thu, 6 Jun 2024 13:11:36 +0100 Subject: [PATCH 32/93] ANDROID: arm64: vdso32: support user-supplied flags This introduces a new environment variable, KCPPFLAGS_COMPAT. One use-case is to ensure -ffile-prefix-map is passed to the arm32 compiler to normalise compilation directory and make the ELF build ID reproducible. Bug: 345452375 Change-Id: I6ae1df58172f4dadeac1dbbee2e3241b704a9256 Signed-off-by: Giuliano Procida --- Documentation/kbuild/kbuild.rst | 5 +++++ arch/arm64/kernel/vdso32/Makefile | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst index 08f575e6236c..1afb6424f310 100644 --- a/Documentation/kbuild/kbuild.rst +++ b/Documentation/kbuild/kbuild.rst @@ -32,6 +32,11 @@ Additional options to pass when preprocessing. The preprocessing options will be used in all cases where kbuild does preprocessing including building C files and assembler files. +KCPPFLAGS_COMPAT +---------------- +Additional options to pass to $(CC_COMPAT) when preprocessing C and assembler +files. + KAFLAGS ------- Additional options to the assembler (for built-in and modules). diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 36c8f66cad25..93d05dbaa286 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -106,6 +106,10 @@ VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096 VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1 VDSO_LDFLAGS += --orphan-handling=warn +# Add user-supplied KCPPFLAGS_COMPAT as the last assignments +VDSO_CFLAGS += $(KCPPFLAGS_COMPAT) +VDSO_AFLAGS += $(KCPPFLAGS_COMPAT) + # Borrow vdsomunge.c from the arm vDSO # We have to use a relative path because scripts/Makefile.host prefixes From 65aed0e2f75859cb95757d8839c2c4e78a1bac4e Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Mon, 3 Jun 2024 16:41:03 -0700 Subject: [PATCH 33/93] ANDROID: 16K: Avoid and document padding madvise lock warning Usually to modify vm_flags we need to take exclusive mmap_lock but here only have the lock in read mode, to avoid all DONTNEED/DONTNEED_LOCKED calls needing the write lock. A race to the flags update can only happen with another MADV_DONTNEED on the same process and same range (VMA). In practice, this specific scenario is not possible because the action that could cause it is usually performed at most once per VMA and only by the dynamic linker. Forego protection for this case, to avoid penalties in the common cases. Bug: 344634072 Change-Id: I54ac1f204e0445291f3df3872fbaa16b37722812 Signed-off-by: Kalesh Singh --- mm/pgsize_migration.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mm/pgsize_migration.c b/mm/pgsize_migration.c index a972b9ba921c..c436d3bae319 100644 --- a/mm/pgsize_migration.c +++ b/mm/pgsize_migration.c @@ -116,8 +116,22 @@ void vma_set_pad_pages(struct vm_area_struct *vma, if (!is_pgsize_migration_enabled()) return; - vm_flags_clear(vma, VM_PAD_MASK); - vm_flags_set(vma, nr_pages << VM_PAD_SHIFT); + /* + * Usually to modify vm_flags we need to take exclusive mmap_lock but here + * only have the lock in read mode, to avoid all DONTNEED/DONTNEED_LOCKED + * calls needing the write lock. + * + * A race to the flags update can only happen with another MADV_DONTNEED on + * the same process and same range (VMA). + * + * In practice, this specific scenario is not possible because the action that + * could cause it is usually performed at most once per VMA and only by the + * dynamic linker. + * + * Forego protection for this case, to avoid penalties in the common cases. + */ + __vm_flags_mod(vma, 0, VM_PAD_MASK); + __vm_flags_mod(vma, nr_pages << VM_PAD_SHIFT, 0); } unsigned long vma_pad_pages(struct vm_area_struct *vma) From dda68b1657b1307381a21cf86485d48ed23f6215 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Tue, 11 Jun 2024 15:28:24 -0700 Subject: [PATCH 34/93] ANDROID: 16K: Only check basename of linker context Depending on the platform binary being executed, the linker (interpreter) requested can be one of: 1) /system/bin/bootstrap/linker64 2) /system/bin/linker64 3) /apex/com.android.runtime/bin/linker64 Relax the check to the basename (linker64), instead of the path. Bug: 330767927 Bug: 335584973 Change-Id: I4a1f95b7cecd126f85ad8cefd9ff10d272947f9e Signed-off-by: Kalesh Singh --- mm/pgsize_migration.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mm/pgsize_migration.c b/mm/pgsize_migration.c index c436d3bae319..ebdf1077d2d3 100644 --- a/mm/pgsize_migration.c +++ b/mm/pgsize_migration.c @@ -18,6 +18,7 @@ #include #include #include +#include #include typedef void (*show_pad_maps_fn) (struct seq_file *m, struct vm_area_struct *vma); @@ -196,7 +197,15 @@ static inline bool linker_ctx(void) memset(buf, 0, bufsize); path = d_path(&file->f_path, buf, bufsize); - if (!strcmp(path, "/system/bin/linker64")) + /* + * Depending on interpreter requested, valid paths could be any of: + * 1. /system/bin/bootstrap/linker64 + * 2. /system/bin/linker64 + * 3. /apex/com.android.runtime/bin/linker64 + * + * Check the base name (linker64). + */ + if (!strcmp(kbasename(path), "linker64")) return true; } From 002be199aacf543d88126d03a94b05ee564714c2 Mon Sep 17 00:00:00 2001 From: Zhiguo Niu Date: Wed, 29 May 2024 17:47:00 +0800 Subject: [PATCH 35/93] FROMGIT: f2fs: fix to avoid use SSR allocate when do defragment SSR allocate mode will be used when doing file defragment if ATGC is working at the same time, that is because set_page_private_gcing may make CURSEG_ALL_DATA_ATGC segment type got in f2fs_allocate_data_block when defragment page is writeback, which may cause file fragmentation is worse. A file with 2 fragmentations is changed as following after defragment: ----------------file info------------------- sensorsdata : -------------------------------------------- dev [254:48] ino [0x 3029 : 12329] mode [0x 81b0 : 33200] nlink [0x 1 : 1] uid [0x 27e6 : 10214] gid [0x 27e6 : 10214] size [0x 242000 : 2367488] blksize [0x 1000 : 4096] blocks [0x 1210 : 4624] -------------------------------------------- file_pos start_blk end_blk blks 0 11361121 11361207 87 356352 11361215 11361216 2 364544 11361218 11361218 1 368640 11361220 11361221 2 376832 11361224 11361225 2 385024 11361227 11361238 12 434176 11361240 11361252 13 487424 11361254 11361254 1 491520 11361271 11361279 9 528384 3681794 3681795 2 536576 3681797 3681797 1 540672 3681799 3681799 1 544768 3681803 3681803 1 548864 3681805 3681805 1 552960 3681807 3681807 1 557056 3681809 3681809 1 Signed-off-by: Zhiguo Niu Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Bug: 345273844 (cherry picked from commit 9e2fc0b6f2cd47f4bbed67c2828d67149b96039f https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test) Change-Id: I1c68e1d2c289482db31c7e882e4300423d4c97f3 Signed-off-by: Daeho Jeong --- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index fe0329050490..427703622c17 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3248,7 +3248,8 @@ static int __get_segment_type_6(struct f2fs_io_info *fio) if (page_private_gcing(fio->page)) { if (fio->sbi->am.atgc_enabled && (fio->io_type == FS_DATA_IO) && - (fio->sbi->gc_mode != GC_URGENT_HIGH)) + (fio->sbi->gc_mode != GC_URGENT_HIGH) && + !is_inode_flag_set(inode, FI_OPU_WRITE)) return CURSEG_ALL_DATA_ATGC; else return CURSEG_COLD_DATA; From 1331956fb57661696bf57445ad87ec5d03e29bc1 Mon Sep 17 00:00:00 2001 From: Danesh Petigara Date: Tue, 11 Jun 2024 08:27:02 -0700 Subject: [PATCH 36/93] ANDROID: gki_defconfig: Disable CONFIG_BRCMSTB_DPFE and CONFIG_BRCMSTB_MEMC Recent changes to gki_defconfig enable CONFIG_MEMORY which results in CONFIG_BRCMSTB_DPFE and CONFIG_BRCMSTB_MEMC being enabled as builtin modules. Disable the two drivers as the Broadcom STB SoCs expect them to be configured as loadable modules. Bug: 346510475 Fixes: 974a6f430e0a ("ANDROID: gki_defconfig: Enable Tegra SoCs") Change-Id: I80bf0ce419992d947468b7054327ba80f611d316 Signed-off-by: Danesh Petigara Signed-off-by: Pierre Couillaud --- arch/arm64/configs/gki_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index 05b3b181215b..13a85324afbb 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -600,6 +600,8 @@ CONFIG_DEVFREQ_GOV_USERSPACE=y CONFIG_DEVFREQ_GOV_PASSIVE=y CONFIG_PM_DEVFREQ_EVENT=y CONFIG_MEMORY=y +# CONFIG_BRCMSTB_DPFE is not set +# CONFIG_BRCMSTB_MEMC is not set CONFIG_IIO=y CONFIG_IIO_BUFFER=y CONFIG_IIO_TRIGGER=y From b22d7c4ca0d33f856cd0c209e2123086cd033e82 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 28 May 2024 15:51:30 -0700 Subject: [PATCH 37/93] FROMGIT: arm64: mte: Make mte_check_tfsr_*() conditional on KASAN instead of MTE The check in mte_check_tfsr_el1() is only necessary if HW tag based KASAN is enabled. However, we were also executing the check if MTE is enabled and KASAN is enabled at build time but disabled at runtime. This turned out to cause a measurable increase in power consumption on a specific microarchitecture after enabling MTE. Moreover, on the same system, an increase in invalid syscall latency (as measured by [1]) of around 20-30% (depending on the cluster) was observed after enabling MTE; this almost entirely goes away after removing this check. Therefore, make the check conditional on whether KASAN is enabled rather than on whether MTE is enabled. [1] https://lore.kernel.org/all/CAMn1gO4MwRV8bmFJ_SeY5tsYNPn2ZP56LjAhafygjFaKuu5ouw@mail.gmail.com/ Bug: 331979504 (cherry picked from commit 26ca4423604f15930d96088dc5238f29dc11d5bc https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mte) Signed-off-by: Peter Collingbourne Change-Id: I22d98d1483dd400a95595946552b769a5a1ad7bd Link: https://linux-review.googlesource.com/id/I22d98d1483dd400a95595946552b769a5a1ad7bd Reviewed-by: Alexandru Elisei Link: https://lore.kernel.org/r/20240528225131.3577704-1-pcc@google.com Signed-off-by: Catalin Marinas --- arch/arm64/include/asm/mte.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h index 9341cc2452a3..a47218f556fb 100644 --- a/arch/arm64/include/asm/mte.h +++ b/arch/arm64/include/asm/mte.h @@ -149,7 +149,7 @@ void mte_check_tfsr_el1(void); static inline void mte_check_tfsr_entry(void) { - if (!system_supports_mte()) + if (!kasan_hw_tags_enabled()) return; mte_check_tfsr_el1(); @@ -157,7 +157,7 @@ static inline void mte_check_tfsr_entry(void) static inline void mte_check_tfsr_exit(void) { - if (!system_supports_mte()) + if (!kasan_hw_tags_enabled()) return; /* From 7c734edeaafdb668b1fa91d119f0010e1f41f764 Mon Sep 17 00:00:00 2001 From: Ajit Singh Raghav Date: Wed, 12 Jun 2024 16:15:15 +0530 Subject: [PATCH 38/93] ANDROID: GKI: Add symbol list for exynosauto dev_forward_skb dev_mc_sync dev_pre_changeaddr_notify dev_set_allmulti dev_uc_sync ip6_route_input_lookup ip_route_input_noref netdev_is_rx_handler_busy register_inet6addr_validator_notifier register_inetaddr_validator_notifier unregister_inet6addr_validator_notifier unregister_inetaddr_validator_notifier These symbols are required so that our vendor can use IPVLAN and IP_NF_TARGET_TTL modules. These are not custom modules and are already part of android. 9 function symbol(s) added 'int dev_forward_skb(struct net_device*, struct sk_buff*)' 'int dev_pre_changeaddr_notify(struct net_device*, const char*, struct netlink_ext_ack*)' 'struct dst_entry* ip6_route_input_lookup(struct net*, struct net_device*, struct flowi6*, const struct sk_buff*, int)' 'int ip_route_input_noref(struct sk_buff*, __be32, __be32, u8, struct net_device*)' 'bool netdev_is_rx_handler_busy(struct net_device*)' 'int register_inet6addr_validator_notifier(struct notifier_block*)' 'int register_inetaddr_validator_notifier(struct notifier_block*)' 'int unregister_inet6addr_validator_notifier(struct notifier_block*)' 'int unregister_inetaddr_validator_notifier(struct notifier_block*)' Bug: 345881188 Change-Id: I2d129c0174844e692b1eb4dbbe54f4790fdeda40 Signed-off-by: Ajit Singh Raghav --- android/abi_gki_aarch64.stg | 115 +++++++++++++++++++++++++++++ android/abi_gki_aarch64_exynosauto | 12 +++ 2 files changed, 127 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 9d31b0ad5595..ce87dd3fe896 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -313387,6 +313387,13 @@ function { parameter_id: 0xf435685e parameter_id: 0x11cfee5a } +function { + id: 0x91d0de38 + return_type_id: 0x6720d32f + parameter_id: 0x32a623d7 + parameter_id: 0x3e10b518 + parameter_id: 0x07dcdbe1 +} function { id: 0x91d0f233 return_type_id: 0x6720d32f @@ -333043,6 +333050,15 @@ function { return_type_id: 0x6720d32f parameter_id: 0x0b7c4f67 } +function { + id: 0x9f62d7ad + return_type_id: 0x6720d32f + parameter_id: 0x054f691a + parameter_id: 0xe276adef + parameter_id: 0xe276adef + parameter_id: 0x295c7202 + parameter_id: 0x32a623d7 +} function { id: 0x9f63513c return_type_id: 0x6720d32f @@ -333989,6 +334005,15 @@ function { return_type_id: 0x6720d32f parameter_id: 0xf1a6dfed } +function { + id: 0xa2004386 + return_type_id: 0x1259e377 + parameter_id: 0x0ca27481 + parameter_id: 0x32a623d7 + parameter_id: 0x270c2906 + parameter_id: 0x3e6396e0 + parameter_id: 0x6720d32f +} function { id: 0xa21fd62f return_type_id: 0x0a1edf98 @@ -359366,6 +359391,15 @@ elf_symbol { type_id: 0x10290027 full_name: "dev_fetch_sw_netstats" } +elf_symbol { + id: 0x1d58b81b + name: "dev_forward_skb" + is_defined: true + symbol_type: FUNCTION + crc: 0x7d0161f1 + type_id: 0x913c567e + full_name: "dev_forward_skb" +} elf_symbol { id: 0x9e546df6 name: "dev_fwnode" @@ -360032,6 +360066,15 @@ elf_symbol { type_id: 0x9c8a5e38 full_name: "dev_pm_set_wake_irq" } +elf_symbol { + id: 0xb5c7c024 + name: "dev_pre_changeaddr_notify" + is_defined: true + symbol_type: FUNCTION + crc: 0x741875eb + type_id: 0x91d0de38 + full_name: "dev_pre_changeaddr_notify" +} elf_symbol { id: 0xd084c59b name: "dev_printk_emit" @@ -376201,6 +376244,15 @@ elf_symbol { type_id: 0x9edc3d1c full_name: "ip6_local_out" } +elf_symbol { + id: 0x3157a75a + name: "ip6_route_input_lookup" + is_defined: true + symbol_type: FUNCTION + crc: 0x00f2c64c + type_id: 0xa2004386 + full_name: "ip6_route_input_lookup" +} elf_symbol { id: 0x7837fb7f name: "ip6_route_me_harder" @@ -376264,6 +376316,15 @@ elf_symbol { type_id: 0x9ac293c4 full_name: "ip_queue_xmit" } +elf_symbol { + id: 0x082ef978 + name: "ip_route_input_noref" + is_defined: true + symbol_type: FUNCTION + crc: 0x0f9f827a + type_id: 0x9f62d7ad + full_name: "ip_route_input_noref" +} elf_symbol { id: 0xc86b3dec name: "ip_route_me_harder" @@ -381796,6 +381857,15 @@ elf_symbol { type_id: 0x1caf28d1 full_name: "netdev_info" } +elf_symbol { + id: 0x5635039f + name: "netdev_is_rx_handler_busy" + is_defined: true + symbol_type: FUNCTION + crc: 0x2d5ec5fc + type_id: 0xf20dd3f1 + full_name: "netdev_is_rx_handler_busy" +} elf_symbol { id: 0x5a4e487e name: "netdev_lower_state_changed" @@ -390637,6 +390707,15 @@ elf_symbol { type_id: 0x9b6d4a33 full_name: "register_inet6addr_notifier" } +elf_symbol { + id: 0x0254b054 + name: "register_inet6addr_validator_notifier" + is_defined: true + symbol_type: FUNCTION + crc: 0xa77bfd29 + type_id: 0x9b6d4a33 + full_name: "register_inet6addr_validator_notifier" +} elf_symbol { id: 0xa36bcd31 name: "register_inetaddr_notifier" @@ -390646,6 +390725,15 @@ elf_symbol { type_id: 0x9b6d4a33 full_name: "register_inetaddr_notifier" } +elf_symbol { + id: 0xeb0ba05f + name: "register_inetaddr_validator_notifier" + is_defined: true + symbol_type: FUNCTION + crc: 0xc32c71af + type_id: 0x9b6d4a33 + full_name: "register_inetaddr_validator_notifier" +} elf_symbol { id: 0x6c1eddbc name: "register_kernel_break_hook" @@ -403709,6 +403797,15 @@ elf_symbol { type_id: 0x9b6d4a33 full_name: "unregister_inet6addr_notifier" } +elf_symbol { + id: 0xf1d1ecdb + name: "unregister_inet6addr_validator_notifier" + is_defined: true + symbol_type: FUNCTION + crc: 0x47c65bfc + type_id: 0x9b6d4a33 + full_name: "unregister_inet6addr_validator_notifier" +} elf_symbol { id: 0x4615e3af name: "unregister_inetaddr_notifier" @@ -403718,6 +403815,15 @@ elf_symbol { type_id: 0x9b6d4a33 full_name: "unregister_inetaddr_notifier" } +elf_symbol { + id: 0x5a71926f + name: "unregister_inetaddr_validator_notifier" + is_defined: true + symbol_type: FUNCTION + crc: 0xab63baa5 + type_id: 0x9b6d4a33 + full_name: "unregister_inetaddr_validator_notifier" +} elf_symbol { id: 0x31dfbba5 name: "unregister_key_type" @@ -412714,6 +412820,7 @@ interface { symbol_id: 0x641371dc symbol_id: 0x5a345cb5 symbol_id: 0x1df78429 + symbol_id: 0x1d58b81b symbol_id: 0x9e546df6 symbol_id: 0x95b2cfdd symbol_id: 0xaa3567d8 @@ -412788,6 +412895,7 @@ interface { symbol_id: 0xb6e3e4d8 symbol_id: 0xcbc295b7 symbol_id: 0x52122b68 + symbol_id: 0xb5c7c024 symbol_id: 0xd084c59b symbol_id: 0x51d93b3b symbol_id: 0x13f867b3 @@ -414582,6 +414690,7 @@ interface { symbol_id: 0x1be0f35f symbol_id: 0xd9fe9b1d symbol_id: 0x5a7fbd45 + symbol_id: 0x3157a75a symbol_id: 0x7837fb7f symbol_id: 0x807f9d22 symbol_id: 0x6cd920cf @@ -414589,6 +414698,7 @@ interface { symbol_id: 0x5234b1b5 symbol_id: 0xaed020d7 symbol_id: 0xc1d5ac06 + symbol_id: 0x082ef978 symbol_id: 0xc86b3dec symbol_id: 0x6bd8b5b5 symbol_id: 0x5b9fac73 @@ -415204,6 +415314,7 @@ interface { symbol_id: 0xeb2d9bd2 symbol_id: 0x1a34a34f symbol_id: 0x06bf2dbd + symbol_id: 0x5635039f symbol_id: 0x5a4e487e symbol_id: 0x178677d3 symbol_id: 0xb4ca02f0 @@ -416186,7 +416297,9 @@ interface { symbol_id: 0x0695a248 symbol_id: 0x7165409e symbol_id: 0x2c5e821c + symbol_id: 0x0254b054 symbol_id: 0xa36bcd31 + symbol_id: 0xeb0ba05f symbol_id: 0x6c1eddbc symbol_id: 0x5d077441 symbol_id: 0xba3fffd9 @@ -417639,7 +417752,9 @@ interface { symbol_id: 0xe1be38c3 symbol_id: 0x6e1b5152 symbol_id: 0x4144b792 + symbol_id: 0xf1d1ecdb symbol_id: 0x4615e3af + symbol_id: 0x5a71926f symbol_id: 0x31dfbba5 symbol_id: 0x4bd3e4fd symbol_id: 0x67d5fb19 diff --git a/android/abi_gki_aarch64_exynosauto b/android/abi_gki_aarch64_exynosauto index e8f11ba430b5..8b17937b623d 100644 --- a/android/abi_gki_aarch64_exynosauto +++ b/android/abi_gki_aarch64_exynosauto @@ -77,6 +77,11 @@ _dev_err dev_err_probe dev_fwnode + dev_forward_skb + dev_mc_sync + dev_pre_changeaddr_notify + dev_set_allmulti + dev_uc_sync device_create device_create_file device_destroy @@ -332,6 +337,8 @@ iommu_unregister_device_fault_handler ioremap_prot iounmap + ip6_route_input_lookup + ip_route_input_noref __irq_apply_affinity_hint irq_chip_ack_parent irq_chip_mask_parent @@ -432,6 +439,7 @@ mutex_unlock netdev_err netdev_info + netdev_is_rx_handler_busy netdev_warn noop_llseek nr_cpu_ids @@ -571,6 +579,8 @@ __register_chrdev register_chrdev_region register_console + register_inet6addr_validator_notifier + register_inetaddr_validator_notifier register_pm_notifier register_reboot_notifier register_syscore_ops @@ -677,6 +687,8 @@ __udelay __unregister_chrdev unregister_chrdev_region + unregister_inet6addr_validator_notifier + unregister_inetaddr_validator_notifier unregister_pm_notifier up up_write From 4c45e2f3408977b435ef57129829400386198eab Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Fri, 5 Apr 2024 01:15:42 +0000 Subject: [PATCH 39/93] UPSTREAM: f2fs: clear writeback when compression failed Let's stop issuing compressed writes and clear their writeback flags. Bug: 345273844 Reviewed-by: Daeho Jeong Reviewed-by: Chao Yu Change-Id: I69835bbcf0ac993cc03b11bcd7bdcfa2ff2bbd4a Signed-off-by: Jaegeuk Kim (cherry picked from commit 2174035a7f1148a52f5a3f371f04224168b5b00a) --- fs/f2fs/compress.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 3bd4d7d9844d..c4e4497f9269 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1029,6 +1029,31 @@ static void set_cluster_writeback(struct compress_ctx *cc) } } +static void cancel_cluster_writeback(struct compress_ctx *cc, + struct compress_io_ctx *cic, int submitted) +{ + int i; + + /* Wait for submitted IOs. */ + if (submitted > 1) { + f2fs_submit_merged_write(F2FS_I_SB(cc->inode), DATA); + while (atomic_read(&cic->pending_pages) != + (cc->valid_nr_cpages - submitted + 1)) + f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT); + } + + /* Cancel writeback and stay locked. */ + for (i = 0; i < cc->cluster_size; i++) { + if (i < submitted) { + inode_inc_dirty_pages(cc->inode); + lock_page(cc->rpages[i]); + } + clear_page_private_gcing(cc->rpages[i]); + if (folio_test_writeback(page_folio(cc->rpages[i]))) + end_page_writeback(cc->rpages[i]); + } +} + static void set_cluster_dirty(struct compress_ctx *cc) { int i; @@ -1230,7 +1255,6 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc, .page = NULL, .encrypted_page = NULL, .compressed_page = NULL, - .submitted = 0, .io_type = io_type, .io_wbc = wbc, .encrypted = fscrypt_inode_uses_fs_layer_crypto(cc->inode) ? @@ -1356,7 +1380,16 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc, fio.compressed_page = cc->cpages[i - 1]; cc->cpages[i - 1] = NULL; + fio.submitted = 0; f2fs_outplace_write_data(&dn, &fio); + if (unlikely(!fio.submitted)) { + cancel_cluster_writeback(cc, cic, i); + + /* To call fscrypt_finalize_bounce_page */ + i = cc->valid_nr_cpages; + *submitted = 0; + goto out_destroy_crypt; + } (*submitted)++; unlock_continue: inode_dec_dirty_pages(cc->inode); @@ -1392,8 +1425,11 @@ unlock_continue: out_destroy_crypt: page_array_free(cc->inode, cic->rpages, cc->cluster_size); - for (--i; i >= 0; i--) + for (--i; i >= 0; i--) { + if (!cc->cpages[i]) + continue; fscrypt_finalize_bounce_page(&cc->cpages[i]); + } out_put_cic: kmem_cache_free(cic_entry_slab, cic); out_put_dnode: From 25216be1ac5ec485d9c384016a50045eacb63c92 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 6 Jun 2024 15:19:58 -0700 Subject: [PATCH 40/93] ANDROID: Delete obsolete 16k_gki.fragment. The correct fragment is the one in build/kernel, enabled by --page_size or kernel_build.page_size. This fragment: - Does not correctly enable incremental FS - Does not correctly clear LOCALVERSION that has 4k for the 4k build. Bug: 347036722 Bug: 340631213 Bug: 338659380 Change-Id: I31cb004ca639d8ec3dd6201112391c7214971eba Signed-off-by: Yifan Hong --- arch/arm64/configs/16k_gki.fragment | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 arch/arm64/configs/16k_gki.fragment diff --git a/arch/arm64/configs/16k_gki.fragment b/arch/arm64/configs/16k_gki.fragment deleted file mode 100644 index b923493edf18..000000000000 --- a/arch/arm64/configs/16k_gki.fragment +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_ARM64_16K_PAGES=y -# b/241785095 -# CONFIG_INCREMENTAL_FS is not set From c0618d182a9cfbcfb4435de7c37ed32c44051216 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Sun, 16 Jun 2024 07:08:25 -0700 Subject: [PATCH 41/93] Revert "f2fs: fix to tag gcing flag on page during block migration" This reverts commit 7c972c89457511007dfc933814c06786905e515c. [ 146.693904][ T8878] WARNING: CPU: 2 PID: 8878 at fs/f2fs/segment.c:3335 f2fs_allocate_data_block+0x130/0xd08 panic in: f2fs_write_data_pages -> f2fs_write_multi_pages -> f2fs_write_single_data_page -> f2fs_do_write_data_page -> f2fs_outplace_write_data -> do_write_page -> f2fs_allocate_data_block if (from_gc) { f2fs_bug_on(sbi, GET_SEGNO(sbi, old_blkaddr) == NULL_SEGNO); se = get_seg_entry(sbi, GET_SEGNO(sbi, old_blkaddr)); sanity_check_seg_type(sbi, se->type); f2fs_bug_on(sbi, IS_NODESEG(se->type)); } Bug: 345273844 Change-Id: I62732bbcb37a7864588886b862b590a463b4d1d9 Signed-off-by: Jaegeuk Kim --- fs/f2fs/compress.c | 4 +--- fs/f2fs/file.c | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index c4e4497f9269..78780b605968 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1059,10 +1059,8 @@ static void set_cluster_dirty(struct compress_ctx *cc) int i; for (i = 0; i < cc->cluster_size; i++) - if (cc->rpages[i]) { + if (cc->rpages[i]) set_page_dirty(cc->rpages[i]); - set_page_private_gcing(cc->rpages[i]); - } } static int prepare_compress_overwrite(struct compress_ctx *cc, diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index d124d070d556..0989b09a2119 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1327,7 +1327,6 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, } memcpy_page(pdst, 0, psrc, 0, PAGE_SIZE); set_page_dirty(pdst); - set_page_private_gcing(pdst); f2fs_put_page(pdst, 1); f2fs_put_page(psrc, 1); @@ -4061,7 +4060,6 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) f2fs_bug_on(F2FS_I_SB(inode), !page); set_page_dirty(page); - set_page_private_gcing(page); f2fs_put_page(page, 1); f2fs_put_page(page, 0); } From 30d168eb06cd8bd51d5cbf9c374b8bc6b667d7f6 Mon Sep 17 00:00:00 2001 From: Kuniyuki Iwashima Date: Fri, 5 Apr 2024 15:10:57 -0700 Subject: [PATCH 42/93] UPSTREAM: af_unix: Clear stale u->oob_skb. [ Upstream commit b46f4eaa4f0ec38909fb0072eea3aeddb32f954e ] syzkaller started to report deadlock of unix_gc_lock after commit 4090fa373f0e ("af_unix: Replace garbage collection algorithm."), but it just uncovers the bug that has been there since commit 314001f0bf92 ("af_unix: Add OOB support"). The repro basically does the following. from socket import * from array import array c1, c2 = socketpair(AF_UNIX, SOCK_STREAM) c1.sendmsg([b'a'], [(SOL_SOCKET, SCM_RIGHTS, array("i", [c2.fileno()]))], MSG_OOB) c2.recv(1) # blocked as no normal data in recv queue c2.close() # done async and unblock recv() c1.close() # done async and trigger GC A socket sends its file descriptor to itself as OOB data and tries to receive normal data, but finally recv() fails due to async close(). The problem here is wrong handling of OOB skb in manage_oob(). When recvmsg() is called without MSG_OOB, manage_oob() is called to check if the peeked skb is OOB skb. In such a case, manage_oob() pops it out of the receive queue but does not clear unix_sock(sk)->oob_skb. This is wrong in terms of uAPI. Let's say we send "hello" with MSG_OOB, and "world" without MSG_OOB. The 'o' is handled as OOB data. When recv() is called twice without MSG_OOB, the OOB data should be lost. >>> from socket import * >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM, 0) >>> c1.send(b'hello', MSG_OOB) # 'o' is OOB data 5 >>> c1.send(b'world') 5 >>> c2.recv(5) # OOB data is not received b'hell' >>> c2.recv(5) # OOB date is skipped b'world' >>> c2.recv(5, MSG_OOB) # This should return an error b'o' In the same situation, TCP actually returns -EINVAL for the last recv(). Also, if we do not clear unix_sk(sk)->oob_skb, unix_poll() always set EPOLLPRI even though the data has passed through by previous recv(). To avoid these issues, we must clear unix_sk(sk)->oob_skb when dequeuing it from recv queue. The reason why the old GC did not trigger the deadlock is because the old GC relied on the receive queue to detect the loop. When it is triggered, the socket with OOB data is marked as GC candidate because file refcount == inflight count (1). However, after traversing all inflight sockets, the socket still has a positive inflight count (1), thus the socket is excluded from candidates. Then, the old GC lose the chance to garbage-collect the socket. With the old GC, the repro continues to create true garbage that will never be freed nor detected by kmemleak as it's linked to the global inflight list. That's why we couldn't even notice the issue. Bug: 342490466 Fixes: 314001f0bf92 ("af_unix: Add OOB support") Reported-by: syzbot+7f7f201cc2668a8fd169@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7f7f201cc2668a8fd169 Signed-off-by: Kuniyuki Iwashima Reviewed-by: Eric Dumazet Link: https://lore.kernel.org/r/20240405221057.2406-1-kuniyu@amazon.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin (cherry picked from commit 601a89ea24d05089debfa2dc896ea9f5937ac7a6) Signed-off-by: Lee Jones Change-Id: Ib4a11eed6b5710d9934d4f31cd29dfd4c7b3658f --- net/unix/af_unix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 7d1c2fc4476a..f07fafd873bc 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2679,7 +2679,9 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, } } else if (!(flags & MSG_PEEK)) { skb_unlink(skb, &sk->sk_receive_queue); - consume_skb(skb); + WRITE_ONCE(u->oob_skb, NULL); + if (!WARN_ON_ONCE(skb_unref(skb))) + kfree_skb(skb); skb = skb_peek(&sk->sk_receive_queue); } } From 0e9ee9221f28d842f9d764cf4ce1e600a62470a7 Mon Sep 17 00:00:00 2001 From: Kuniyuki Iwashima Date: Wed, 10 Apr 2024 10:10:16 -0700 Subject: [PATCH 43/93] UPSTREAM: af_unix: Don't peek OOB data without MSG_OOB. [ Upstream commit 22dd70eb2c3d754862964377a75abafd3167346b ] Currently, we can read OOB data without MSG_OOB by using MSG_PEEK when OOB data is sitting on the front row, which is apparently wrong. >>> from socket import * >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM) >>> c1.send(b'a', MSG_OOB) 1 >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT) b'a' If manage_oob() is called when no data has been copied, we only check if the socket enables SO_OOBINLINE or MSG_PEEK is not used. Otherwise, the skb is returned as is. However, here we should return NULL if MSG_PEEK is set and no data has been copied. Also, in such a case, we should not jump to the redo label because we will be caught in the loop and hog the CPU until normal data comes in. Then, we need to handle skb == NULL case with the if-clause below the manage_oob() block. With this patch: >>> from socket import * >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM) >>> c1.send(b'a', MSG_OOB) 1 >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT) Traceback (most recent call last): File "", line 1, in BlockingIOError: [Errno 11] Resource temporarily unavailable Bug: 342490466 Fixes: 314001f0bf92 ("af_unix: Add OOB support") Signed-off-by: Kuniyuki Iwashima Link: https://lore.kernel.org/r/20240410171016.7621-3-kuniyu@amazon.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin (cherry picked from commit 022d81a709cd553bbe2db8675f8e824f4aee6284) Signed-off-by: Lee Jones Change-Id: I4728977f8f908c19dfa5c861c7381a50499b7fe0 --- net/unix/af_unix.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index f07fafd873bc..4130f34b3a84 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2677,7 +2677,9 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, WRITE_ONCE(u->oob_skb, NULL); consume_skb(skb); } - } else if (!(flags & MSG_PEEK)) { + } else if (flags & MSG_PEEK) { + skb = NULL; + } else { skb_unlink(skb, &sk->sk_receive_queue); WRITE_ONCE(u->oob_skb, NULL); if (!WARN_ON_ONCE(skb_unref(skb))) @@ -2758,11 +2760,9 @@ redo: #if IS_ENABLED(CONFIG_AF_UNIX_OOB) if (skb) { skb = manage_oob(skb, sk, flags, copied); - if (!skb) { + if (!skb && copied) { unix_state_unlock(sk); - if (copied) - break; - goto redo; + break; } } #endif From de6fb073c606c19695893b874c005741fa4c0f06 Mon Sep 17 00:00:00 2001 From: Kuniyuki Iwashima Date: Thu, 16 May 2024 22:48:35 +0900 Subject: [PATCH 44/93] UPSTREAM: af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock. [ Upstream commit 9841991a446c87f90f66f4b9fee6fe934c1336a2 ] Billy Jheng Bing-Jhong reported a race between __unix_gc() and queue_oob(). __unix_gc() tries to garbage-collect close()d inflight sockets, and then if the socket has MSG_OOB in unix_sk(sk)->oob_skb, GC will drop the reference and set NULL to it locklessly. However, the peer socket still can send MSG_OOB message and queue_oob() can update unix_sk(sk)->oob_skb concurrently, leading NULL pointer dereference. [0] To fix the issue, let's update unix_sk(sk)->oob_skb under the sk_receive_queue's lock and take it everywhere we touch oob_skb. Note that we defer kfree_skb() in manage_oob() to silence lockdep false-positive (See [1]). [0]: BUG: kernel NULL pointer dereference, address: 0000000000000008 PF: supervisor write access in kernel mode PF: error_code(0x0002) - not-present page PGD 8000000009f5e067 P4D 8000000009f5e067 PUD 9f5d067 PMD 0 Oops: 0002 [#1] PREEMPT SMP PTI CPU: 3 PID: 50 Comm: kworker/3:1 Not tainted 6.9.0-rc5-00191-gd091e579b864 #110 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Workqueue: events delayed_fput RIP: 0010:skb_dequeue (./include/linux/skbuff.h:2386 ./include/linux/skbuff.h:2402 net/core/skbuff.c:3847) Code: 39 e3 74 3e 8b 43 10 48 89 ef 83 e8 01 89 43 10 49 8b 44 24 08 49 c7 44 24 08 00 00 00 00 49 8b 14 24 49 c7 04 24 00 00 00 00 <48> 89 42 08 48 89 10 e8 e7 c5 42 00 4c 89 e0 5b 5d 41 5c c3 cc cc RSP: 0018:ffffc900001bfd48 EFLAGS: 00000002 RAX: 0000000000000000 RBX: ffff8880088f5ae8 RCX: 00000000361289f9 RDX: 0000000000000000 RSI: 0000000000000206 RDI: ffff8880088f5b00 RBP: ffff8880088f5b00 R08: 0000000000080000 R09: 0000000000000001 R10: 0000000000000003 R11: 0000000000000001 R12: ffff8880056b6a00 R13: ffff8880088f5280 R14: 0000000000000001 R15: ffff8880088f5a80 FS: 0000000000000000(0000) GS:ffff88807dd80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000008 CR3: 0000000006314000 CR4: 00000000007506f0 PKRU: 55555554 Call Trace: unix_release_sock (net/unix/af_unix.c:654) unix_release (net/unix/af_unix.c:1050) __sock_release (net/socket.c:660) sock_close (net/socket.c:1423) __fput (fs/file_table.c:423) delayed_fput (fs/file_table.c:444 (discriminator 3)) process_one_work (kernel/workqueue.c:3259) worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416) kthread (kernel/kthread.c:388) ret_from_fork (arch/x86/kernel/process.c:153) ret_from_fork_asm (arch/x86/entry/entry_64.S:257) Modules linked in: CR2: 0000000000000008 Bug: 342490466 Link: https://lore.kernel.org/netdev/a00d3993-c461-43f2-be6d-07259c98509a@rbox.co/ [1] Fixes: 1279f9d9dec2 ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.") Reported-by: Billy Jheng Bing-Jhong Signed-off-by: Kuniyuki Iwashima Link: https://lore.kernel.org/r/20240516134835.8332-1-kuniyu@amazon.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin (cherry picked from commit 518a994aa0b87d96f1bc6678a7035df5d1fcd7a1) Signed-off-by: Lee Jones Change-Id: Ibf78b113496b5388a63207e7e582f77ddda8dec5 --- net/unix/af_unix.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 4130f34b3a84..46f48d5ec12b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2139,13 +2139,15 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other maybe_add_creds(skb, sock, other); skb_get(skb); + scm_stat_add(other, skb); + + spin_lock(&other->sk_receive_queue.lock); if (ousk->oob_skb) consume_skb(ousk->oob_skb); - WRITE_ONCE(ousk->oob_skb, skb); + __skb_queue_tail(&other->sk_receive_queue, skb); + spin_unlock(&other->sk_receive_queue.lock); - scm_stat_add(other, skb); - skb_queue_tail(&other->sk_receive_queue, skb); sk_send_sigurg(other); unix_state_unlock(other); other->sk_data_ready(other); @@ -2628,8 +2630,10 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state) mutex_lock(&u->iolock); unix_state_lock(sk); + spin_lock(&sk->sk_receive_queue.lock); if (sock_flag(sk, SOCK_URGINLINE) || !u->oob_skb) { + spin_unlock(&sk->sk_receive_queue.lock); unix_state_unlock(sk); mutex_unlock(&u->iolock); return -EINVAL; @@ -2641,6 +2645,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state) WRITE_ONCE(u->oob_skb, NULL); else skb_get(oob_skb); + + spin_unlock(&sk->sk_receive_queue.lock); unix_state_unlock(sk); chunk = state->recv_actor(oob_skb, 0, chunk, state); @@ -2669,6 +2675,10 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, consume_skb(skb); skb = NULL; } else { + struct sk_buff *unlinked_skb = NULL; + + spin_lock(&sk->sk_receive_queue.lock); + if (skb == u->oob_skb) { if (copied) { skb = NULL; @@ -2680,13 +2690,19 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, } else if (flags & MSG_PEEK) { skb = NULL; } else { - skb_unlink(skb, &sk->sk_receive_queue); + __skb_unlink(skb, &sk->sk_receive_queue); WRITE_ONCE(u->oob_skb, NULL); - if (!WARN_ON_ONCE(skb_unref(skb))) - kfree_skb(skb); + unlinked_skb = skb; skb = skb_peek(&sk->sk_receive_queue); } } + + spin_unlock(&sk->sk_receive_queue.lock); + + if (unlinked_skb) { + WARN_ON_ONCE(skb_unref(unlinked_skb)); + kfree_skb(unlinked_skb); + } } return skb; } From fd5c2e1399bfd3239b784185deee568e15070e40 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Thu, 26 Jan 2023 11:06:04 -0800 Subject: [PATCH 45/93] UPSTREAM: objtool: Install libsubcmd in build Including from tools/lib can create inadvertent dependencies. Install libsubcmd in the objtool build and then include the headers from there. Signed-off-by: Ian Rogers Link: https://lore.kernel.org/r/20230126190606.40739-2-irogers@google.com Signed-off-by: Josh Poimboeuf Bug: 336872347 Bug: 335829879 Test: build x86_64 kernel with glibc 2.38 Change-Id: Id09c5b222519073214dbc01e151e59b18afb1ea8 (cherry picked from commit bdb8bf7d56afd1d22c12c61455d732d3baff2bde) Signed-off-by: Yifan Hong --- tools/objtool/.gitignore | 1 + tools/objtool/Build | 2 -- tools/objtool/Makefile | 31 +++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/tools/objtool/.gitignore b/tools/objtool/.gitignore index 14236db3677f..4faa4dd72f35 100644 --- a/tools/objtool/.gitignore +++ b/tools/objtool/.gitignore @@ -2,3 +2,4 @@ arch/x86/lib/inat-tables.c /objtool fixdep +libsubcmd/ diff --git a/tools/objtool/Build b/tools/objtool/Build index 33f2ee5a46d3..a3cdf8af6635 100644 --- a/tools/objtool/Build +++ b/tools/objtool/Build @@ -16,8 +16,6 @@ objtool-y += libctype.o objtool-y += str_error_r.o objtool-y += librbtree.o -CFLAGS += -I$(srctree)/tools/lib - $(OUTPUT)libstring.o: ../lib/string.c FORCE $(call rule_mkdir) $(call if_changed_dep,cc_o_c) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index a3a9cc24e0e3..3505ae4b0e36 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -12,9 +12,13 @@ srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif -SUBCMD_SRCDIR = $(srctree)/tools/lib/subcmd/ -LIBSUBCMD_OUTPUT = $(or $(OUTPUT),$(CURDIR)/) -LIBSUBCMD = $(LIBSUBCMD_OUTPUT)libsubcmd.a +LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/ +ifneq ($(OUTPUT),) + LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd +else + LIBSUBCMD_OUTPUT = $(CURDIR)/libsubcmd +endif +LIBSUBCMD = $(LIBSUBCMD_OUTPUT)/libsubcmd.a OBJTOOL := $(OUTPUT)objtool OBJTOOL_IN := $(OBJTOOL)-in.o @@ -28,7 +32,8 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \ -I$(srctree)/tools/arch/$(SRCARCH)/include \ -I$(srctree)/tools/objtool/include \ - -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include + -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \ + -I$(LIBSUBCMD_OUTPUT)/include WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) @@ -38,6 +43,7 @@ elfshdr := $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -x c -E - CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) AWK = awk +MKDIR = mkdir BUILD_ORC := n @@ -57,13 +63,22 @@ $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ -$(LIBSUBCMD): fixdep FORCE - $(Q)$(MAKE) -C $(SUBCMD_SRCDIR) OUTPUT=$(LIBSUBCMD_OUTPUT) +$(LIBSUBCMD_OUTPUT): + @$(MKDIR) -p $@ -clean: +$(LIBSUBCMD): fixdep $(LIBSUBCMD_OUTPUT) FORCE + @$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ + DESTDIR=$(LIBSUBCMD_OUTPUT) prefix= subdir= \ + $@ install_headers + +$(LIBSUBCMD)-clean: + $(call QUIET_CLEAN, libsubcmd) + $(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT) + +clean: $(LIBSUBCMD)-clean $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete - $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep $(LIBSUBCMD) + $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep FORCE: From b5164fdc98bd58fd2dea4198ef299c6951c97f3d Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Thu, 26 Jan 2023 11:06:05 -0800 Subject: [PATCH 46/93] UPSTREAM: objtool: Properly support make V=1 The Q variable was being used but never correctly set up. Add the setting up and use in place of @. Signed-off-by: Ian Rogers Link: https://lore.kernel.org/r/20230126190606.40739-3-irogers@google.com Signed-off-by: Josh Poimboeuf Bug: 336872347 Bug: 335829879 Test: build x86_64 kernel with glibc 2.38 Change-Id: I2ac9a1d0c3a56c6109375e92b3d46e08fd5a71cd (cherry picked from commit 8c4526ca6a45e7ff915c2b33b54db6b773291fac) Signed-off-by: Yifan Hong --- tools/objtool/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 3505ae4b0e36..d54b66986627 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -45,6 +45,12 @@ CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) AWK = awk MKDIR = mkdir +ifeq ($(V),1) + Q = +else + Q = @ +endif + BUILD_ORC := n ifeq ($(SRCARCH),x86) @@ -56,18 +62,18 @@ export srctree OUTPUT CFLAGS SRCARCH AWK include $(srctree)/tools/build/Makefile.include $(OBJTOOL_IN): fixdep FORCE - @$(CONFIG_SHELL) ./sync-check.sh - @$(MAKE) $(build)=objtool + $(Q)$(CONFIG_SHELL) ./sync-check.sh + $(Q)$(MAKE) $(build)=objtool $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ $(LIBSUBCMD_OUTPUT): - @$(MKDIR) -p $@ + $(Q)$(MKDIR) -p $@ $(LIBSUBCMD): fixdep $(LIBSUBCMD_OUTPUT) FORCE - @$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ + $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ DESTDIR=$(LIBSUBCMD_OUTPUT) prefix= subdir= \ $@ install_headers From bda57805ab9f3020f98cc6b95987f8326683c30e Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Thu, 26 Jan 2023 11:06:06 -0800 Subject: [PATCH 47/93] UPSTREAM: objtool: Fix HOSTCC flag usage HOSTCC is always wanted when building objtool. Setting CC to HOSTCC happens after tools/scripts/Makefile.include is included, meaning flags (like CFLAGS) are set assuming say CC is gcc, but then it can be later set to HOSTCC which may be clang. tools/scripts/Makefile.include is needed for host set up and common macros in objtool's Makefile. Rather than override the CC variable to HOSTCC, just pass CC as HOSTCC to the sub-makes of Makefile.build, the libsubcmd builds and also to the linkage step. Signed-off-by: Ian Rogers Link: https://lore.kernel.org/r/20230126190606.40739-4-irogers@google.com Signed-off-by: Josh Poimboeuf Bug: 336872347 Bug: 335829879 Test: build x86_64 kernel with glibc 2.38 Change-Id: I1d672d0bb64f72d3fc571537de5f75d4068e79cc (cherry picked from commit cd955bdd6aa5ec54cdef622a142f8899a64b5446) Signed-off-by: Yifan Hong --- tools/objtool/Makefile | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index d54b66986627..83b100c1e7f6 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -2,11 +2,6 @@ include ../scripts/Makefile.include include ../scripts/Makefile.arch -# always use the host compiler -AR = $(HOSTAR) -CC = $(HOSTCC) -LD = $(HOSTLD) - ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) @@ -34,13 +29,18 @@ INCLUDES := -I$(srctree)/tools/include \ -I$(srctree)/tools/objtool/include \ -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include \ -I$(LIBSUBCMD_OUTPUT)/include +# Note, EXTRA_WARNINGS here was determined for CC and not HOSTCC, it +# is passed here to match a legacy behavior. WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs -CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) -LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) +OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS) +OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS) # Allow old libelf to be used: -elfshdr := $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) -CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) +elfshdr := $(shell echo '$(pound)include ' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - | grep elf_getshdr) +OBJTOOL_CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) + +# Always want host compilation. +HOST_OVERRIDES := CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" AWK = awk MKDIR = mkdir @@ -61,12 +61,14 @@ export BUILD_ORC export srctree OUTPUT CFLAGS SRCARCH AWK include $(srctree)/tools/build/Makefile.include -$(OBJTOOL_IN): fixdep FORCE +$(OBJTOOL_IN): fixdep $(LIBSUBCMD) FORCE $(Q)$(CONFIG_SHELL) ./sync-check.sh - $(Q)$(MAKE) $(build)=objtool + $(Q)$(MAKE) $(build)=objtool $(HOST_OVERRIDES) CFLAGS="$(OBJTOOL_CFLAGS)" \ + LDFLAGS="$(OBJTOOL_LDFLAGS)" + $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN) - $(QUIET_LINK)$(CC) $(OBJTOOL_IN) $(LDFLAGS) -o $@ + $(QUIET_LINK)$(HOSTCC) $(OBJTOOL_IN) $(OBJTOOL_LDFLAGS) -o $@ $(LIBSUBCMD_OUTPUT): @@ -75,6 +77,7 @@ $(LIBSUBCMD_OUTPUT): $(LIBSUBCMD): fixdep $(LIBSUBCMD_OUTPUT) FORCE $(Q)$(MAKE) -C $(LIBSUBCMD_DIR) O=$(LIBSUBCMD_OUTPUT) \ DESTDIR=$(LIBSUBCMD_OUTPUT) prefix= subdir= \ + $(HOST_OVERRIDES) EXTRA_CFLAGS="$(OBJTOOL_CFLAGS)" \ $@ install_headers $(LIBSUBCMD)-clean: From 12709c5c1ed21a2710c8deca6c0902e9556f35c4 Mon Sep 17 00:00:00 2001 From: luoyongjie Date: Tue, 18 Jun 2024 16:54:36 +0800 Subject: [PATCH 48/93] ANDROID: GKI: add symbol list for meizu INFO: 4 function symbol(s) added 'int clk_set_duty_cycle(struct clk*, unsigned int, unsigned int)' 'void console_verbose()' 'int gpiod_get_direction(struct gpio_desc*)' 'int register_sysrq_key(int, const struct sysrq_key_op*)' Bug: 347789958 Change-Id: I4d05058f0be53b26fece99bbb843a9aa1a438294 Signed-off-by: luoyongjie --- android/abi_gki_aarch64.stg | 103 ++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_meizu | 10 ++++ 2 files changed, 113 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index ce87dd3fe896..b60ff8cf4e63 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -28998,6 +28998,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xdd568ae3 } +pointer_reference { + id: 0x3dcaad69 + kind: POINTER + pointee_type_id: 0xdd6a5339 +} pointer_reference { id: 0x3dcae1c0 kind: POINTER @@ -33983,6 +33988,11 @@ qualified { qualifier: CONST qualified_type_id: 0x051d9d04 } +qualified { + id: 0xdd6a5339 + qualifier: CONST + qualified_type_id: 0x05eefa6d +} qualified { id: 0xdd6b619e qualifier: CONST @@ -34023,6 +34033,11 @@ qualified { qualifier: CONST qualified_type_id: 0x08726260 } +qualified { + id: 0xde20e59e + qualifier: CONST + qualified_type_id: 0x08c420f1 +} qualified { id: 0xde3bc780 qualifier: CONST @@ -44122,6 +44137,12 @@ member { type_id: 0x04b89667 offset: 384 } +member { + id: 0x81060995 + name: "action_msg" + type_id: 0xd395c0e4 + offset: 128 +} member { id: 0xf964a830 name: "action_refcnt" @@ -83560,6 +83581,12 @@ member { type_id: 0x6d7f5ff6 offset: 1632 } +member { + id: 0x494e8b0a + name: "enable_mask" + type_id: 0xc5d9d969 + offset: 192 +} member { id: 0x49ced59b name: "enable_mask" @@ -100181,6 +100208,11 @@ member { type_id: 0xd92b1d75 offset: 256 } +member { + id: 0xf9843b80 + name: "handler" + type_id: 0xde20e59e +} member { id: 0xf9ca6e5d name: "handler" @@ -102024,6 +102056,12 @@ member { type_id: 0x2de25c2c offset: 768 } +member { + id: 0xa49c2766 + name: "help_msg" + type_id: 0xd395c0e4 + offset: 64 +} member { id: 0x48bac8e6 name: "helper" @@ -262531,6 +262569,18 @@ struct_union { member_id: 0x3d20f367 } } +struct_union { + id: 0x05eefa6d + kind: STRUCT + name: "sysrq_key_op" + definition { + bytesize: 32 + member_id: 0xf9843b80 + member_id: 0xa49c2766 + member_id: 0x81060995 + member_id: 0x494e8b0a + } +} struct_union { id: 0x67e29bf0 kind: STRUCT @@ -310187,6 +310237,12 @@ function { parameter_id: 0x3e10b518 parameter_id: 0xa52a0930 } +function { + id: 0x84bffd51 + return_type_id: 0x6720d32f + parameter_id: 0x6720d32f + parameter_id: 0x3dcaad69 +} function { id: 0x84c7bf9c return_type_id: 0x6720d32f @@ -316389,6 +316445,13 @@ function { return_type_id: 0x6720d32f parameter_id: 0x39cdf888 } +function { + id: 0x93f42df9 + return_type_id: 0x6720d32f + parameter_id: 0x3dcee85d + parameter_id: 0x4585663f + parameter_id: 0x4585663f +} function { id: 0x93f6a75b return_type_id: 0x6720d32f @@ -356407,6 +356470,15 @@ elf_symbol { type_id: 0x9d80e32f full_name: "clk_save_context" } +elf_symbol { + id: 0x7a8f92d4 + name: "clk_set_duty_cycle" + is_defined: true + symbol_type: FUNCTION + crc: 0x665e92a0 + type_id: 0x93f42df9 + full_name: "clk_set_duty_cycle" +} elf_symbol { id: 0x2b1e3d59 name: "clk_set_parent" @@ -356947,6 +357019,15 @@ elf_symbol { type_id: 0x10985193 full_name: "console_unlock" } +elf_symbol { + id: 0x06f42cb2 + name: "console_verbose" + is_defined: true + symbol_type: FUNCTION + crc: 0x04c8aebf + type_id: 0x10985193 + full_name: "console_verbose" +} elf_symbol { id: 0xca337eb1 name: "consume_skb" @@ -372176,6 +372257,15 @@ elf_symbol { type_id: 0x5f272d07 full_name: "gpiod_get" } +elf_symbol { + id: 0x80497778 + name: "gpiod_get_direction" + is_defined: true + symbol_type: FUNCTION + crc: 0x6c49dce2 + type_id: 0x94d8cba3 + full_name: "gpiod_get_direction" +} elf_symbol { id: 0x226f81df name: "gpiod_get_index_optional" @@ -390941,6 +391031,15 @@ elf_symbol { type_id: 0x034f6ce3 full_name: "register_sysctl_table" } +elf_symbol { + id: 0x86f4ae0e + name: "register_sysrq_key" + is_defined: true + symbol_type: FUNCTION + crc: 0xb868ac5c + type_id: 0x84bffd51 + full_name: "register_sysrq_key" +} elf_symbol { id: 0xf62fefe0 name: "register_tcf_proto_ops" @@ -412488,6 +412587,7 @@ interface { symbol_id: 0xffe637ce symbol_id: 0xd84adb21 symbol_id: 0xed719736 + symbol_id: 0x7a8f92d4 symbol_id: 0x2b1e3d59 symbol_id: 0x98850f9d symbol_id: 0x495f0223 @@ -412548,6 +412648,7 @@ interface { symbol_id: 0x85d79e5f symbol_id: 0xf9f01d9c symbol_id: 0x5a70b6f0 + symbol_id: 0x06f42cb2 symbol_id: 0xca337eb1 symbol_id: 0x9e7d8d76 symbol_id: 0x610edc84 @@ -414238,6 +414339,7 @@ interface { symbol_id: 0xad2ad56b symbol_id: 0xfc326378 symbol_id: 0x652eb3f5 + symbol_id: 0x80497778 symbol_id: 0x226f81df symbol_id: 0x4950fc9e symbol_id: 0x74240b4d @@ -416323,6 +416425,7 @@ interface { symbol_id: 0x4268401e symbol_id: 0xb02bf4aa symbol_id: 0x2b900c73 + symbol_id: 0x86f4ae0e symbol_id: 0xf62fefe0 symbol_id: 0x49b7d4e1 symbol_id: 0x3e36e803 diff --git a/android/abi_gki_aarch64_meizu b/android/abi_gki_aarch64_meizu index 32c666766bd9..1e7236710050 100644 --- a/android/abi_gki_aarch64_meizu +++ b/android/abi_gki_aarch64_meizu @@ -11,4 +11,14 @@ __tracepoint_android_vh_tune_swappiness __tracepoint_android_vh_tune_scan_type __tracepoint_android_vh_alloc_pages_slowpath + cgroup_add_legacy_cftypes + clk_set_duty_cycle + console_verbose + gpiod_get_direction + end_buffer_write_sync + mem_cgroup_from_id + register_sysrq_key + try_to_free_mem_cgroup_pages + timespec64_to_jiffies + ufshcd_read_desc_param From f9840ee562986f2023d485f3fd3146289c2edd86 Mon Sep 17 00:00:00 2001 From: nischaljain Date: Wed, 19 Jun 2024 06:28:35 +0000 Subject: [PATCH 49/93] ANDROID: Update the ABI symbol list Adding the following symbols: - dev_pm_opp_remove_all_dynamic - devm_devfreq_add_device - devm_devfreq_remove_device Bug: 347848156 Change-Id: I917b23e4a3d84e7779e4443aa7ee450d44cf4585 Signed-off-by: nischaljain --- android/abi_gki_aarch64_pixel | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/abi_gki_aarch64_pixel b/android/abi_gki_aarch64_pixel index 3606c97de5ff..db80f3bfcd89 100644 --- a/android/abi_gki_aarch64_pixel +++ b/android/abi_gki_aarch64_pixel @@ -425,6 +425,8 @@ devm_clk_get devm_clk_get_optional devm_clk_put + devm_devfreq_add_device + devm_devfreq_remove_device devm_device_add_group devm_device_add_groups devm_device_remove_group @@ -518,6 +520,7 @@ dev_pm_opp_of_register_em dev_pm_opp_of_remove_table dev_pm_opp_put + dev_pm_opp_remove_all_dynamic dev_pm_opp_set_config dev_pm_qos_add_notifier dev_pm_qos_add_request From 40f3c9d658a5017a7063eb09cb8f0193c42aa29e Mon Sep 17 00:00:00 2001 From: liliangliang Date: Sun, 7 Apr 2024 15:19:02 +0800 Subject: [PATCH 50/93] ANDROID: vendor_hooks: add vendor hooks for fuse request Add hooks to fuse queue request and request end so we can do boost to those background tasks which block the UX related task. Bug: 333220630 Change-Id: I9be59ed88675c5102c57ba9cbd26cf4df3d2fd7f Signed-off-by: liliangliang (cherry picked from commit e520c2932df0d1bbf83ae45c82ac01fd41655d77) --- drivers/android/vendor_hooks.c | 3 +++ fs/fuse/dev.c | 4 ++++ include/trace/hooks/fuse.h | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 include/trace/hooks/fuse.h diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index a45022e569e2..9c7a0383c73d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -73,6 +73,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -417,3 +418,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_hibernate_save_cmp_len); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_read_lazy_flag); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_tsk_need_resched_lazy); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_read_fault); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_queue_request_and_unlock); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_fuse_request_end); diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 90c8fd9b805f..c9ddc97e4782 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -23,6 +23,8 @@ #include #include +#include + MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); @@ -234,6 +236,7 @@ __releases(fiq->lock) fuse_len_args(req->args->in_numargs, (struct fuse_arg *) req->args->in_args); list_add_tail(&req->list, &fiq->pending); + trace_android_vh_queue_request_and_unlock(&fiq->waitq, sync); fiq->ops->wake_pending_and_unlock(fiq, sync); } @@ -331,6 +334,7 @@ void fuse_request_end(struct fuse_req *req) } else { /* Wake up waiter sleeping in request_wait_answer() */ wake_up(&req->waitq); + trace_android_vh_fuse_request_end(current); } if (test_bit(FR_ASYNC, &req->flags)) diff --git a/include/trace/hooks/fuse.h b/include/trace/hooks/fuse.h new file mode 100644 index 000000000000..a4267b47d5c0 --- /dev/null +++ b/include/trace/hooks/fuse.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fuse +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH trace/hooks +#if !defined(_TRACE_HOOK_FUSE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_FUSE_H +#include +/* + * Following tracepoints are not exported in tracefs and provide a + * mechanism for vendor modules to hook and extend functionality + */ + +struct wait_queue_head; +DECLARE_HOOK(android_vh_queue_request_and_unlock, + TP_PROTO(struct wait_queue_head *wq_head, bool sync), + TP_ARGS(wq_head, sync)); +DECLARE_HOOK(android_vh_fuse_request_end, + TP_PROTO(struct task_struct *self), + TP_ARGS(self)); + +#endif /* _TRACE_HOOK_FUSE_H */ +/* This part must be outside protection */ +#include From cd89d4fa07227cb724e58c0b5fe2ad801b8bd7b7 Mon Sep 17 00:00:00 2001 From: liliangliang Date: Wed, 19 Jun 2024 15:25:49 +0800 Subject: [PATCH 51/93] ANDROID: GKI: Update symbol list for vivo update vivo symbol list for adding hooks for fuse request 2 function symbol(s) added 'int __traceiter_android_vh_fuse_request_end(void*, struct task_struct*)' 'int __traceiter_android_vh_queue_request_and_unlock(void*, struct wait_queue_head*, bool)' 2 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_fuse_request_end' 'struct tracepoint __tracepoint_android_vh_queue_request_and_unlock' Bug: 348109269 Change-Id: I8d2b08b7afbca85f4b766bbe658005aa740b6285 Signed-off-by: liliangliang --- android/abi_gki_aarch64.stg | 47 ++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 4 +++ 2 files changed, 51 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index b60ff8cf4e63..59c9c686c209 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -327529,6 +327529,13 @@ function { parameter_id: 0x384c5795 parameter_id: 0xf435685e } +function { + id: 0x9be844aa + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x172847a8 + parameter_id: 0x6d7f5ff6 +} function { id: 0x9be885da return_type_id: 0x6720d32f @@ -344794,6 +344801,15 @@ elf_symbol { type_id: 0x9b661c0a full_name: "__traceiter_android_vh_ftrace_size_check" } +elf_symbol { + id: 0x39120fb0 + name: "__traceiter_android_vh_fuse_request_end" + is_defined: true + symbol_type: FUNCTION + crc: 0x92b2ef2e + type_id: 0x9bdbdcc4 + full_name: "__traceiter_android_vh_fuse_request_end" +} elf_symbol { id: 0x494c2e7a name: "__traceiter_android_vh_futex_sleep_start" @@ -345397,6 +345413,15 @@ elf_symbol { type_id: 0x9b49a977 full_name: "__traceiter_android_vh_ptype_head" } +elf_symbol { + id: 0x2c963d28 + name: "__traceiter_android_vh_queue_request_and_unlock" + is_defined: true + symbol_type: FUNCTION + crc: 0xbc65933d + type_id: 0x9be844aa + full_name: "__traceiter_android_vh_queue_request_and_unlock" +} elf_symbol { id: 0x3a545b61 name: "__traceiter_android_vh_ra_tuning_max_page" @@ -349123,6 +349148,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_ftrace_size_check" } +elf_symbol { + id: 0x50b14cbe + name: "__tracepoint_android_vh_fuse_request_end" + is_defined: true + symbol_type: OBJECT + crc: 0x45b385a6 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_fuse_request_end" +} elf_symbol { id: 0xef0379f8 name: "__tracepoint_android_vh_futex_sleep_start" @@ -349726,6 +349760,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_ptype_head" } +elf_symbol { + id: 0xf04b1c62 + name: "__tracepoint_android_vh_queue_request_and_unlock" + is_defined: true + symbol_type: OBJECT + crc: 0x49b10a90 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_queue_request_and_unlock" +} elf_symbol { id: 0x811d5fab name: "__tracepoint_android_vh_ra_tuning_max_page" @@ -411289,6 +411332,7 @@ interface { symbol_id: 0xfcf37c56 symbol_id: 0x9eec9c93 symbol_id: 0xf9ce3d98 + symbol_id: 0x39120fb0 symbol_id: 0x494c2e7a symbol_id: 0x79670e34 symbol_id: 0x4f81fc38 @@ -411356,6 +411400,7 @@ interface { symbol_id: 0x574e7b58 symbol_id: 0xf2c39651 symbol_id: 0x93303c51 + symbol_id: 0x2c963d28 symbol_id: 0x3a545b61 symbol_id: 0x96662dde symbol_id: 0xb35da0ec @@ -411770,6 +411815,7 @@ interface { symbol_id: 0xaa012cfc symbol_id: 0x44d76aa5 symbol_id: 0x6b0eca0a + symbol_id: 0x50b14cbe symbol_id: 0xef0379f8 symbol_id: 0x08e2cf92 symbol_id: 0x6d73379a @@ -411837,6 +411883,7 @@ interface { symbol_id: 0x61f8c8ae symbol_id: 0x0e92ee53 symbol_id: 0xb0c197a3 + symbol_id: 0xf04b1c62 symbol_id: 0x811d5fab symbol_id: 0x2d9a331c symbol_id: 0x9fc2933e diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index 679c37e8b995..a554e90e9b0d 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -393,6 +393,7 @@ __traceiter_android_vh_ftrace_oops_enter __traceiter_android_vh_ftrace_oops_exit __traceiter_android_vh_ftrace_size_check + __traceiter_android_vh_fuse_request_end __traceiter_android_vh_ignore_dmabuf_vmap_bounds __traceiter_android_vh_ipi_stop __traceiter_android_vh_is_fpsimd_save @@ -401,6 +402,7 @@ __traceiter_android_vh_mutex_wait_finish __traceiter_android_vh_mutex_wait_start __traceiter_android_vh_printk_hotplug + __traceiter_android_vh_queue_request_and_unlock __traceiter_android_vh_rproc_recovery __traceiter_android_vh_rproc_recovery_set __traceiter_android_vh_rtmutex_wait_finish @@ -563,6 +565,7 @@ __tracepoint_android_vh_ftrace_oops_enter __tracepoint_android_vh_ftrace_oops_exit __tracepoint_android_vh_ftrace_size_check + __tracepoint_android_vh_fuse_request_end __tracepoint_android_vh_ignore_dmabuf_vmap_bounds __tracepoint_android_vh_ipi_stop __tracepoint_android_vh_is_fpsimd_save @@ -571,6 +574,7 @@ __tracepoint_android_vh_mutex_wait_finish __tracepoint_android_vh_mutex_wait_start __tracepoint_android_vh_printk_hotplug + __tracepoint_android_vh_queue_request_and_unlock __tracepoint_android_vh_rproc_recovery __tracepoint_android_vh_rproc_recovery_set __tracepoint_android_vh_rtmutex_wait_finish From 1a72e2f692ac431f98e13d30ff78bf70b6d9a8d9 Mon Sep 17 00:00:00 2001 From: sunshijie Date: Thu, 20 Jun 2024 11:36:20 +0800 Subject: [PATCH 52/93] ANDROID: GKI: update symbol list file for xiaomi 1 function symbol(s) added 'struct folio* __filemap_get_folio(struct address_space*, unsigned long, int, gfp_t)' Bug: 348207246 Change-Id: Ic2e06000526b4274496c3a4c931f18397c7cc682 Signed-off-by: sunshijie --- android/abi_gki_aarch64.stg | 18 ++++++++++++++++++ android/abi_gki_aarch64_xiaomi | 1 + 2 files changed, 19 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 59c9c686c209..0ef23f077f23 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -308024,6 +308024,14 @@ function { return_type_id: 0x1d5bae2a parameter_id: 0xc93e017b } +function { + id: 0x59f4df41 + return_type_id: 0x2170d06d + parameter_id: 0x1582ab06 + parameter_id: 0x33756485 + parameter_id: 0x6720d32f + parameter_id: 0xf1a6dfed +} function { id: 0x59fab064 return_type_id: 0x391f15ea @@ -340579,6 +340587,15 @@ elf_symbol { type_id: 0x20cd94dc full_name: "__fdget" } +elf_symbol { + id: 0x68fbcad4 + name: "__filemap_get_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0xc7966b47 + type_id: 0x59f4df41 + full_name: "__filemap_get_folio" +} elf_symbol { id: 0x6036d483 name: "__filemap_set_wb_err" @@ -410863,6 +410880,7 @@ interface { symbol_id: 0x80f1cf36 symbol_id: 0x3e32c80e symbol_id: 0x5298aa39 + symbol_id: 0x68fbcad4 symbol_id: 0x6036d483 symbol_id: 0xaf8ee687 symbol_id: 0x746a66fc diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index 02f24786a457..2b67f0010af1 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -455,3 +455,4 @@ __break_lease __d_lookup_unhash_wake __fs_parse + __filemap_get_folio From e270773646d71762ea59d49a957a9b71c1103df9 Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Tue, 23 Apr 2024 21:50:15 +0800 Subject: [PATCH 53/93] ANDROID: vendor_hooks: add hooks in rwsem read trylock When the lock is owned by readers and there is no RWSEM_FLAG_HANDOFF set, we allow some specific new readers to acquire the lock immediately in this hook, event if there are some writer tasks in the wait_list. This features can optimize the priority inversion problem caused by rwsem and improve system responsiveness and performance. Bug: 348699619 Bug: 336506800 Change-Id: I7e8fded73579933d1f61faa9fb6e5f300ffd71bf Signed-off-by: zhujingpeng [jstultz: rebased, resolved collision] Signed-off-by: John Stultz --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/rwsem.h | 3 +++ kernel/locking/rwsem.c | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9c7a0383c73d..3be1ccdb9cb6 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -420,3 +420,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_tsk_need_resched_lazy); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_read_fault); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_queue_request_and_unlock); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_fuse_request_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_read_trylock_failed); diff --git a/include/trace/hooks/rwsem.h b/include/trace/hooks/rwsem.h index 4ed664556e8c..6c1e36468271 100644 --- a/include/trace/hooks/rwsem.h +++ b/include/trace/hooks/rwsem.h @@ -34,6 +34,9 @@ DECLARE_HOOK(android_vh_rwsem_direct_rsteal, DECLARE_HOOK(android_vh_rwsem_optimistic_rspin, TP_PROTO(struct rw_semaphore *sem, long *adjustment, bool *rspin), TP_ARGS(sem, adjustment, rspin)); +DECLARE_HOOK(android_vh_rwsem_read_trylock_failed, + TP_PROTO(struct rw_semaphore *sem, long *cntp, int *ret), + TP_ARGS(sem, cntp, ret)); #endif /* _TRACE_HOOK_RWSEM_H */ /* This part must be outside protection */ #include diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index a36788e0aa16..c847167f536f 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -242,6 +242,8 @@ static inline void rwsem_set_nonspinnable(struct rw_semaphore *sem) static inline bool rwsem_read_trylock(struct rw_semaphore *sem, long *cntp) { + int ret = 0; + *cntp = atomic_long_add_return_acquire(RWSEM_READER_BIAS, &sem->count); if (WARN_ON_ONCE(*cntp < 0)) @@ -253,6 +255,13 @@ static inline bool rwsem_read_trylock(struct rw_semaphore *sem, long *cntp) return true; } + trace_android_vh_rwsem_read_trylock_failed(sem, cntp, &ret); + if (ret) { + rwsem_set_reader_owned(sem); + trace_android_vh_record_rwsem_lock_starttime(current, jiffies); + return true; + } + return false; } @@ -1354,6 +1363,15 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) break; } } + + if (!ret) { + trace_android_vh_rwsem_read_trylock_failed(sem, NULL, &ret); + if (ret) { + rwsem_set_reader_owned(sem); + trace_android_vh_record_rwsem_lock_starttime(current, jiffies); + } + } + preempt_enable(); return ret; } From d682bd3b2f18d498441027cd8c62809839080da1 Mon Sep 17 00:00:00 2001 From: wang qiankun Date: Sat, 22 Jun 2024 18:47:33 +0800 Subject: [PATCH 54/93] ANDROID: GKI: Update symbol list for xiaomi 1 function symbol(s) added 'int __traceiter_android_vh_rwsem_read_trylock_failed(void*, struct rw_semaphore*, long*, int*)' 1 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_rwsem_read_trylock_failed' Bug: 348699619 Change-Id: If1c0ff19a6fac2885912d8b406d1a0ceb4406f41 Signed-off-by: wang qiankun --- android/abi_gki_aarch64.stg | 28 ++++++++++++++++++++++++++++ android/abi_gki_aarch64_xiaomi | 2 ++ 2 files changed, 30 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 0ef23f077f23..34f726715fa4 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -325750,6 +325750,14 @@ function { parameter_id: 0x92233392 parameter_id: 0x4585663f } +function { + id: 0x9ba06ae6 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x00be4281 + parameter_id: 0x3593bec8 + parameter_id: 0x13580d6c +} function { id: 0x9ba1d628 return_type_id: 0x6720d32f @@ -345664,6 +345672,15 @@ elf_symbol { type_id: 0x9ba060b9 full_name: "__traceiter_android_vh_rwsem_optimistic_rspin" } +elf_symbol { + id: 0xc710ea63 + name: "__traceiter_android_vh_rwsem_read_trylock_failed" + is_defined: true + symbol_type: FUNCTION + crc: 0x5bcf1a52 + type_id: 0x9ba06ae6 + full_name: "__traceiter_android_vh_rwsem_read_trylock_failed" +} elf_symbol { id: 0xbffefc2b name: "__traceiter_android_vh_rwsem_read_wait_finish" @@ -350011,6 +350028,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_rwsem_optimistic_rspin" } +elf_symbol { + id: 0xf58571d5 + name: "__tracepoint_android_vh_rwsem_read_trylock_failed" + is_defined: true + symbol_type: OBJECT + crc: 0x4e8fd56e + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_rwsem_read_trylock_failed" +} elf_symbol { id: 0xe7ef7059 name: "__tracepoint_android_vh_rwsem_read_wait_finish" @@ -411444,6 +411470,7 @@ interface { symbol_id: 0x958d8cdb symbol_id: 0xfde8086a symbol_id: 0x66c7c5f3 + symbol_id: 0xc710ea63 symbol_id: 0xbffefc2b symbol_id: 0x3d83999a symbol_id: 0xf7bca936 @@ -411927,6 +411954,7 @@ interface { symbol_id: 0x8d0ce77d symbol_id: 0x50ab483c symbol_id: 0x8866a3b9 + symbol_id: 0xf58571d5 symbol_id: 0xe7ef7059 symbol_id: 0xf2d006c8 symbol_id: 0x85a885d0 diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index 2b67f0010af1..7914087866d4 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -233,6 +233,7 @@ __traceiter_android_vh_sched_setaffinity_early __traceiter_android_rvh_set_cpus_allowed_comm __traceiter_android_rvh_dequeue_task + __traceiter_android_vh_rwsem_read_trylock_failed __tracepoint_android_vh_rwsem_read_wait_start __tracepoint_android_vh_rwsem_write_wait_start __tracepoint_android_vh_mutex_wait_start @@ -241,6 +242,7 @@ __tracepoint_android_vh_sched_setaffinity_early __tracepoint_android_rvh_set_cpus_allowed_comm __tracepoint_android_rvh_dequeue_task + __tracepoint_android_vh_rwsem_read_trylock_failed cpuset_cpus_allowed cpufreq_update_policy From caa8ffe476165054fa94afccb9c8a2482cea57ec Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Wed, 8 May 2024 17:36:57 +0800 Subject: [PATCH 55/93] BACKPORT: scsi: ufs: core: Fix handling of lrbp->cmd ufshcd_queuecommand() may be called two times in a row for a SCSI command before it is completed. Hence make the following changes: - In the functions that submit a command, do not check the old value of lrbp->cmd nor clear lrbp->cmd in error paths. - In ufshcd_release_scsi_cmd(), do not clear lrbp->cmd. See also scsi_send_eh_cmnd(). This commit prevents that the following appears if a command times out: WARNING: at drivers/ufs/core/ufshcd.c:2965 ufshcd_queuecommand+0x6f8/0x9a8 Call trace: ufshcd_queuecommand+0x6f8/0x9a8 scsi_send_eh_cmnd+0x2c0/0x960 scsi_eh_test_devices+0x100/0x314 scsi_eh_ready_devs+0xd90/0x114c scsi_error_handler+0x2b4/0xb70 kthread+0x16c/0x1e0 Fixes: 5a0b0cb9bee7 ("[SCSI] ufs: Add support for sending NOP OUT UPIU") Change-Id: Iebc077bc8ae8d8004519ebfc93a1c76a4807b6f2 Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20230524203659.1394307-3-bvanassche@acm.org Acked-by: Adrian Hunter Signed-off-by: Martin K. Petersen (cherry picked from commit 549e91a9bbaa0ee480f59357868421a61d369770) [Peter: Resolved minor conflict in drivers/ufs/core/ufshcd.c ] Signed-off-by: Peter Wang --- drivers/ufs/core/ufshcd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index f2eea7945f5b..8182c492f525 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2967,7 +2967,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) (hba->clk_gating.state != CLKS_ON)); lrbp = &hba->lrb[tag]; - WARN_ON(lrbp->cmd); lrbp->cmd = cmd; lrbp->task_tag = tag; lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); @@ -2991,7 +2990,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) err = ufshcd_map_sg(hba, lrbp); if (err) { - lrbp->cmd = NULL; ufshcd_release(hba); goto out; } @@ -3256,7 +3254,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, down_read(&hba->clk_scaling_lock); lrbp = &hba->lrb[tag]; - WARN_ON(lrbp->cmd); + lrbp->cmd = NULL; err = ufshcd_compose_dev_cmd(hba, lrbp, cmd_type, tag); if (unlikely(err)) goto out; @@ -5503,7 +5501,6 @@ void ufshcd_release_scsi_cmd(struct ufs_hba *hba, scsi_dma_unmap(cmd); ufshcd_crypto_clear_prdt(hba, lrbp); - lrbp->cmd = NULL; /* Mark the command as completed. */ ufshcd_release(hba); ufshcd_clk_scaling_update_busy(hba); } @@ -7208,7 +7205,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, down_read(&hba->clk_scaling_lock); lrbp = &hba->lrb[tag]; - WARN_ON(lrbp->cmd); lrbp->cmd = NULL; lrbp->task_tag = tag; lrbp->lun = 0; @@ -7380,7 +7376,6 @@ int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *r down_read(&hba->clk_scaling_lock); lrbp = &hba->lrb[tag]; - WARN_ON(lrbp->cmd); lrbp->cmd = NULL; lrbp->task_tag = tag; lrbp->lun = UFS_UPIU_RPMB_WLUN; From a8b3ebe7f90afe0ad0d9a8b0b90f266da06a7007 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Tue, 18 Jun 2024 00:10:48 +0000 Subject: [PATCH 56/93] ANDROID: 16K: Avoid mmap lock assertions for padding VMAs The padding VMA is never inserted into the VMA tree; therefore we don't need to have the mmap lock in exclusive mode to modify it. Test: v2/android-gki/ack_platform_integration_main_cf_arm64_boot_test on kernel_virt_debug_aarch64 Bug: 346741763 Change-Id: I4ca3ed22dab45b6bb895cb41c5c6792344188b61 Signed-off-by: Kalesh Singh --- mm/pgsize_migration.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/pgsize_migration.c b/mm/pgsize_migration.c index ebdf1077d2d3..bca3c4aca982 100644 --- a/mm/pgsize_migration.c +++ b/mm/pgsize_migration.c @@ -294,11 +294,14 @@ struct vm_area_struct *get_pad_vma(struct vm_area_struct *vma) /* Adjust the start to begin at the start of the padding section */ pad->vm_start = VMA_PAD_START(pad); + /* + * The below modifications to vm_flags don't need mmap write lock, + * since, pad does not belong to the VMA tree. + */ /* Make the pad vma PROT_NONE */ - vm_flags_clear(pad, VM_READ|VM_WRITE|VM_EXEC); - + __vm_flags_mod(pad, 0, VM_READ|VM_WRITE|VM_EXEC); /* Remove padding bits */ - vm_flags_clear(pad, VM_PAD_MASK); + __vm_flags_mod(pad, 0, VM_PAD_MASK); return pad; } From 91f4830fbacaec9d65fc99c4a946f32e417b28bf Mon Sep 17 00:00:00 2001 From: Bian Jin chen Date: Tue, 25 Jun 2024 15:00:49 +0800 Subject: [PATCH 57/93] ANDROID: GKI: Update rockchip symbols for bcmdhd sdio wifi. 4 function symbol(s) added 'void sdio_retune_crc_disable(struct sdio_func*)' 'void sdio_retune_crc_enable(struct sdio_func*)' 'void sdio_retune_hold_now(struct sdio_func*)' 'void sdio_retune_release(struct sdio_func*)' Bug: 300024866 Signed-off-by: Bian Jin chen Change-Id: Ic0b236833490779901b027b3d0225c4fb79459ba --- android/abi_gki_aarch64.stg | 40 ++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_rockchip | 4 ++++ 2 files changed, 44 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 34f726715fa4..d4eff355602a 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -394438,6 +394438,42 @@ elf_symbol { type_id: 0x991a5468 full_name: "sdio_release_irq" } +elf_symbol { + id: 0x21e1299c + name: "sdio_retune_crc_disable" + is_defined: true + symbol_type: FUNCTION + crc: 0xaed85956 + type_id: 0x1402e6d4 + full_name: "sdio_retune_crc_disable" +} +elf_symbol { + id: 0x2b415769 + name: "sdio_retune_crc_enable" + is_defined: true + symbol_type: FUNCTION + crc: 0xb62a4fbf + type_id: 0x1402e6d4 + full_name: "sdio_retune_crc_enable" +} +elf_symbol { + id: 0xb491923e + name: "sdio_retune_hold_now" + is_defined: true + symbol_type: FUNCTION + crc: 0xdcd4e949 + type_id: 0x1402e6d4 + full_name: "sdio_retune_hold_now" +} +elf_symbol { + id: 0xff5be1b5 + name: "sdio_retune_release" + is_defined: true + symbol_type: FUNCTION + crc: 0x5711d0b5 + type_id: 0x1402e6d4 + full_name: "sdio_retune_release" +} elf_symbol { id: 0xc3a3db62 name: "sdio_set_block_size" @@ -416887,6 +416923,10 @@ interface { symbol_id: 0x3003f174 symbol_id: 0xf85ae22f symbol_id: 0xcca4d1a0 + symbol_id: 0x21e1299c + symbol_id: 0x2b415769 + symbol_id: 0xb491923e + symbol_id: 0xff5be1b5 symbol_id: 0xc3a3db62 symbol_id: 0xc472be84 symbol_id: 0x842bd7b1 diff --git a/android/abi_gki_aarch64_rockchip b/android/abi_gki_aarch64_rockchip index 96cf93d04fbb..6de47833231f 100644 --- a/android/abi_gki_aarch64_rockchip +++ b/android/abi_gki_aarch64_rockchip @@ -1449,6 +1449,10 @@ sdio_readw sdio_register_driver sdio_release_host + sdio_retune_crc_disable + sdio_retune_crc_enable + sdio_retune_hold_now + sdio_retune_release sdio_set_block_size sdio_set_host_pm_flags sdio_unregister_driver From a3fb83b3f56a7b77b3a651aa12ae06984209e226 Mon Sep 17 00:00:00 2001 From: Yue Hu Date: Mon, 15 May 2023 17:57:58 +0800 Subject: [PATCH 58/93] BACKPORT: erofs: avoid pcpubuf.c inclusion if CONFIG_EROFS_FS_ZIP is off The function of pcpubuf.c is just for low-latency decompression algorithms (e.g. lz4). Bug: 348591003 Change-Id: I15651e5b7d66b6072ffb3f9985f7a828e0cad37e Signed-off-by: Yue Hu Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230515095758.10391-1-zbestahu@gmail.com Signed-off-by: Gao Xiang (cherry picked from commit 285d0f85dae6510aea31416c72670ded54fc4b0c) [Chunhai: Resolved minor conflict in fs/erofs/internal.h] Signed-off-by: Chunhai Guo --- fs/erofs/Makefile | 4 ++-- fs/erofs/internal.h | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/erofs/Makefile b/fs/erofs/Makefile index 99bbc597a3e9..a3a98fc3e481 100644 --- a/fs/erofs/Makefile +++ b/fs/erofs/Makefile @@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_EROFS_FS) += erofs.o -erofs-objs := super.o inode.o data.o namei.o dir.o utils.o pcpubuf.o sysfs.o +erofs-objs := super.o inode.o data.o namei.o dir.o utils.o sysfs.o erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o -erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o +erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 44d2907478aa..f0d07ae75e50 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -430,6 +430,11 @@ int z_erofs_fill_inode(struct inode *inode); int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map, int flags); +void *erofs_get_pcpubuf(unsigned int requiredpages); +void erofs_put_pcpubuf(void *ptr); +int erofs_pcpubuf_growsize(unsigned int nrpages); +void erofs_pcpubuf_init(void); +void erofs_pcpubuf_exit(void); #else static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; } static inline int z_erofs_map_blocks_iter(struct inode *inode, @@ -438,6 +443,8 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode, { return -EOPNOTSUPP; } +static inline void erofs_pcpubuf_init(void) {} +static inline void erofs_pcpubuf_exit(void) {} #endif /* !CONFIG_EROFS_FS_ZIP */ struct erofs_map_dev { @@ -507,13 +514,6 @@ static inline void *erofs_vm_map_ram(struct page **pages, unsigned int count) return NULL; } -/* pcpubuf.c */ -void *erofs_get_pcpubuf(unsigned int requiredpages); -void erofs_put_pcpubuf(void *ptr); -int erofs_pcpubuf_growsize(unsigned int nrpages); -void erofs_pcpubuf_init(void); -void erofs_pcpubuf_exit(void); - /* sysfs.c */ int erofs_register_sysfs(struct super_block *sb); void erofs_unregister_sysfs(struct super_block *sb); From bab4765e5f60112f0e67ec71e420d6e16cbb5f68 Mon Sep 17 00:00:00 2001 From: Chunhai Guo Date: Fri, 26 Jan 2024 22:01:42 +0800 Subject: [PATCH 59/93] BACKPORT: erofs: relaxed temporary buffers allocation on readahead Even with inplace decompression, sometimes very few temporary buffers may be still needed for a single decompression shot (e.g. 16 pages for 64k sliding window or 4 pages for 16k sliding window). In low-memory scenarios, it would be better to try to allocate with GFP_NOWAIT on readahead first. That can help reduce the time spent on page allocation under durative memory pressure. Here are detailed performance numbers under multi-app launch benchmark workload [1] on ARM64 Android devices (8-core CPU and 8GB of memory) running a 5.15 LTS kernel with EROFS of 4k pclusters: +----------------------------------------------+ | LZ4 | vanilla | patched | diff | |----------------+---------+---------+---------| | Average (ms) | 3364 | 2684 | -20.21% | [64k sliding window] |----------------+---------+---------+---------| | Average (ms) | 2079 | 1610 | -22.56% | [16k sliding window] +----------------------------------------------+ The total size of system images for 4k pclusters is almost unchanged: (64k sliding window) 9,117,044 KB (16k sliding window) 9,113,096 KB Therefore, in addition to switch the sliding window from 64k to 16k, after applying this patch, it can eventually save 52.14% (3364 -> 1610) on average with no memory reservation. That is particularly useful for embedded devices with limited resources. [1] https://lore.kernel.org/r/20240109074143.4138783-1-guochunhai@vivo.com Suggested-by: Gao Xiang Signed-off-by: Chunhai Guo Signed-off-by: Gao Xiang Reviewed-by: Yue Hu Link: https://lore.kernel.org/r/20240126140142.201718-1-hsiangkao@linux.alibaba.com Bug: 348591003 Change-Id: I84cf5b5dbccbd707b6f4339e525ca52efbcf167f (cherry picked from commit d9281660ff3ffb4a05302b485cc59a87e709aefc) [Chunhai: Resolved minor conflict in fs/erofs/zdata.c and remove modification on fs/erofs/decompressor_deflate.c as it is not existed in 6.1 kernel ] Signed-off-by: Chunhai Guo --- fs/erofs/compress.h | 5 ++--- fs/erofs/decompressor.c | 5 +++-- fs/erofs/decompressor_lzma.c | 17 ++++++++++++----- fs/erofs/zdata.c | 16 ++++++++++++---- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/fs/erofs/compress.h b/fs/erofs/compress.h index b1b846504027..6490d2d3d248 100644 --- a/fs/erofs/compress.h +++ b/fs/erofs/compress.h @@ -11,13 +11,12 @@ struct z_erofs_decompress_req { struct super_block *sb; struct page **in, **out; - unsigned short pageofs_in, pageofs_out; unsigned int inputsize, outputsize; - /* indicate the algorithm will be used for decompression */ - unsigned int alg; + unsigned int alg; /* the algorithm for decompression */ bool inplace_io, partial_decoding, fillgaps; + gfp_t gfp; /* allocation flags for extra temporary buffers */ }; struct z_erofs_decompressor { diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 38c7f9c96c68..40be7428a9bc 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -112,8 +112,9 @@ static int z_erofs_lz4_prepare_dstpages(struct z_erofs_lz4_decompress_ctx *ctx, victim = availables[--top]; get_page(victim); } else { - victim = erofs_allocpage(pagepool, - GFP_KERNEL | __GFP_NOFAIL); + victim = erofs_allocpage(pagepool, rq->gfp); + if (!victim) + return -ENOMEM; set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE); } rq->out[i] = victim; diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c index 42ef0dc8736d..3b0f16faa190 100644 --- a/fs/erofs/decompressor_lzma.c +++ b/fs/erofs/decompressor_lzma.c @@ -151,7 +151,7 @@ again: } int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq, - struct page **pagepool) + struct page **pgpl) { const unsigned int nrpages_out = PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT; @@ -218,8 +218,11 @@ again: PAGE_SIZE - pageofs); outlen -= strm->buf.out_size; if (!rq->out[no] && rq->fillgaps) { /* deduped */ - rq->out[no] = erofs_allocpage(pagepool, - GFP_KERNEL | __GFP_NOFAIL); + rq->out[no] = erofs_allocpage(pgpl, rq->gfp); + if (!rq->out[no]) { + err = -ENOMEM; + break; + } set_page_private(rq->out[no], Z_EROFS_SHORTLIVED_PAGE); } @@ -261,8 +264,11 @@ again: DBG_BUGON(erofs_page_is_managed(EROFS_SB(rq->sb), rq->in[j])); - tmppage = erofs_allocpage(pagepool, - GFP_KERNEL | __GFP_NOFAIL); + tmppage = erofs_allocpage(pgpl, rq->gfp); + if (!tmppage) { + err = -ENOMEM; + goto failed; + } set_page_private(tmppage, Z_EROFS_SHORTLIVED_PAGE); copy_highpage(tmppage, rq->in[j]); rq->in[j] = tmppage; @@ -280,6 +286,7 @@ again: break; } } +failed: if (no < nrpages_out && strm->buf.out) kunmap(rq->out[no]); if (ni < nrpages_in) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 98e1c5713e37..25511f0ae3aa 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -83,6 +83,9 @@ struct z_erofs_pcluster { /* L: indicate several pageofs_outs or not */ bool multibases; + /* L: whether extra buffer allocations are best-effort */ + bool besteffort; + /* A: compressed bvecs (can be cached or inplaced pages) */ struct z_erofs_bvec compressed_bvecs[]; }; @@ -972,7 +975,7 @@ static int z_erofs_read_fragment(struct super_block *sb, struct page *page, } static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, - struct page *page) + struct page *page, bool ra) { struct inode *const inode = fe->inode; struct erofs_map_blocks *const map = &fe->map; @@ -1023,6 +1026,7 @@ repeat: err = z_erofs_pcluster_begin(fe); if (err) goto out; + fe->pcl->besteffort |= !ra; } /* @@ -1305,6 +1309,9 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be, .inplace_io = overlapped, .partial_decoding = pcl->partial, .fillgaps = pcl->multibases, + .gfp = pcl->besteffort ? + GFP_KERNEL | __GFP_NOFAIL : + GFP_NOWAIT | __GFP_NORETRY }, be->pagepool); out: @@ -1350,6 +1357,7 @@ out: pcl->length = 0; pcl->partial = true; pcl->multibases = false; + pcl->besteffort = false; pcl->bvset.nextpage = NULL; pcl->vcnt = 0; @@ -1815,7 +1823,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, if (PageUptodate(page)) { unlock_page(page); } else { - err = z_erofs_do_read_page(f, page); + err = z_erofs_do_read_page(f, page, !!rac); if (err) erofs_err(inode->i_sb, "readmore error at page %lu @ nid %llu", @@ -1842,7 +1850,7 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio) f.headoffset = (erofs_off_t)page->index << PAGE_SHIFT; z_erofs_pcluster_readmore(&f, NULL, true); - err = z_erofs_do_read_page(&f, page); + err = z_erofs_do_read_page(&f, page, false); z_erofs_pcluster_readmore(&f, NULL, false); z_erofs_pcluster_end(&f); @@ -1883,7 +1891,7 @@ static void z_erofs_readahead(struct readahead_control *rac) /* traversal in reverse order */ head = (void *)page_private(page); - err = z_erofs_do_read_page(&f, page); + err = z_erofs_do_read_page(&f, page, true); if (err) erofs_err(inode->i_sb, "readahead error at page %lu @ nid %llu", From bb687ee6b6ec5bc889e565167aeec34e7bee324f Mon Sep 17 00:00:00 2001 From: Chunhai Guo Date: Mon, 1 Apr 2024 07:55:50 -0600 Subject: [PATCH 60/93] BACKPORT: erofs: rename utils.c to zutil.c Currently, utils.c is only useful if CONFIG_EROFS_FS_ZIP is on. So let's rename it to zutil.c as well as avoid its inclusion if CONFIG_EROFS_FS_ZIP is explicitly disabled. Signed-off-by: Chunhai Guo Reviewed-by: Gao Xiang Link: https://lore.kernel.org/r/20240401135550.2550043-1-guochunhai@vivo.com Signed-off-by: Gao Xiang Bug: 348591003 Change-Id: Iace477719fb803084955218a3e5ace74338f5ec8 (cherry picked from commit cacd5b04e24c74a813c694ec7b26a1a370b5d666) [Chunhai: Resolved minor conflict in fs/erofs/Makefile and fs/erofs/utils.c ] Signed-off-by: Chunhai Guo --- fs/erofs/Makefile | 4 ++-- fs/erofs/{utils.c => zutil.c} | 25 ++++++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) rename fs/erofs/{utils.c => zutil.c} (96%) diff --git a/fs/erofs/Makefile b/fs/erofs/Makefile index a3a98fc3e481..41b371b5fece 100644 --- a/fs/erofs/Makefile +++ b/fs/erofs/Makefile @@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_EROFS_FS) += erofs.o -erofs-objs := super.o inode.o data.o namei.o dir.o utils.o sysfs.o +erofs-objs := super.o inode.o data.o namei.o dir.o sysfs.o erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o -erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o +erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o zutil.o erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o diff --git a/fs/erofs/utils.c b/fs/erofs/zutil.c similarity index 96% rename from fs/erofs/utils.c rename to fs/erofs/zutil.c index 46627cb69abe..b76ea41e521d 100644 --- a/fs/erofs/utils.c +++ b/fs/erofs/zutil.c @@ -6,6 +6,14 @@ #include "internal.h" #include +static atomic_long_t erofs_global_shrink_cnt; /* for all mounted instances */ +/* protected by 'erofs_sb_list_lock' */ +static unsigned int shrinker_run_no; + +/* protects the mounted 'erofs_sb_list' */ +static DEFINE_SPINLOCK(erofs_sb_list_lock); +static LIST_HEAD(erofs_sb_list); + struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp) { struct page *page = *pagepool; @@ -13,10 +21,9 @@ struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp) if (page) { DBG_BUGON(page_ref_count(page) != 1); *pagepool = (struct page *)page_private(page); - } else { - page = alloc_page(gfp); + return page; } - return page; + return alloc_page(gfp); } void erofs_release_pages(struct page **pagepool) @@ -29,10 +36,6 @@ void erofs_release_pages(struct page **pagepool) } } -#ifdef CONFIG_EROFS_FS_ZIP -/* global shrink count (for all mounted EROFS instances) */ -static atomic_long_t erofs_global_shrink_cnt; - static int erofs_workgroup_get(struct erofs_workgroup *grp) { int o; @@ -181,13 +184,6 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi, return freed; } -/* protected by 'erofs_sb_list_lock' */ -static unsigned int shrinker_run_no; - -/* protects the mounted 'erofs_sb_list' */ -static DEFINE_SPINLOCK(erofs_sb_list_lock); -static LIST_HEAD(erofs_sb_list); - void erofs_shrinker_register(struct super_block *sb) { struct erofs_sb_info *sbi = EROFS_SB(sb); @@ -289,4 +285,3 @@ void erofs_exit_shrinker(void) { unregister_shrinker(&erofs_shrinker_info); } -#endif /* !CONFIG_EROFS_FS_ZIP */ From 2a23d59fd9d3198e858b0f84fd735d8134b8a152 Mon Sep 17 00:00:00 2001 From: Chunhai Guo Date: Tue, 2 Apr 2024 04:00:36 -0600 Subject: [PATCH 61/93] BACKPORT: erofs: rename per-CPU buffers to global buffer pool and make it configurable It will cost more time if compressed buffers are allocated on demand for low-latency algorithms (like lz4) so EROFS uses per-CPU buffers to keep compressed data if in-place decompression is unfulfilled. While it is kind of wasteful of memory for a device with hundreds of CPUs, and only a small number of CPUs concurrently decompress most of the time. This patch renames it as 'global buffer pool' and makes it configurable. This allows two or more CPUs to share a common buffer to reduce memory occupation. Suggested-by: Gao Xiang Reviewed-by: Gao Xiang Signed-off-by: Chunhai Guo Link: https://lore.kernel.org/r/20240402100036.2673604-1-guochunhai@vivo.com Signed-off-by: Sandeep Dhavale Link: https://lore.kernel.org/r/20240408215231.3376659-1-dhavale@google.com Signed-off-by: Gao Xiang Bug: 348591003 Change-Id: I319248d41ce346e840bd292a80b0a0a6bb2a7359 (cherry picked from commit f36f3010f67611a45d66e773bc91e4c66a9abab5) [Chunhai: Resolved minor conflict in fs/erofs/Makefile, fs/erofs/internal.h, fs/erofs/super.c, and fs/erofs/zutil.c ] Signed-off-by: Chunhai Guo --- fs/erofs/Makefile | 2 +- fs/erofs/decompressor.c | 6 +- fs/erofs/internal.h | 14 ++-- fs/erofs/pcpubuf.c | 148 ---------------------------------------- fs/erofs/super.c | 9 ++- fs/erofs/zutil.c | 148 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 166 insertions(+), 161 deletions(-) delete mode 100644 fs/erofs/pcpubuf.c diff --git a/fs/erofs/Makefile b/fs/erofs/Makefile index 41b371b5fece..3af1b5e81313 100644 --- a/fs/erofs/Makefile +++ b/fs/erofs/Makefile @@ -3,6 +3,6 @@ obj-$(CONFIG_EROFS_FS) += erofs.o erofs-objs := super.o inode.o data.o namei.o dir.o sysfs.o erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o -erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o zutil.o +erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o zutil.o erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 40be7428a9bc..7487ef65fdea 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -55,7 +55,7 @@ int z_erofs_load_lz4_config(struct super_block *sb, sbi->lz4.max_distance_pages = distance ? DIV_ROUND_UP(distance, PAGE_SIZE) + 1 : LZ4_MAX_DISTANCE_PAGES; - return erofs_pcpubuf_growsize(sbi->lz4.max_pclusterblks); + return z_erofs_gbuf_growsize(sbi->lz4.max_pclusterblks); } /* @@ -160,7 +160,7 @@ static void *z_erofs_lz4_handle_overlap(struct z_erofs_lz4_decompress_ctx *ctx, docopy: /* Or copy compressed data which can be overlapped to per-CPU buffer */ in = rq->in; - src = erofs_get_pcpubuf(ctx->inpages); + src = z_erofs_get_gbuf(ctx->inpages); if (!src) { DBG_BUGON(1); kunmap_local(inpage); @@ -267,7 +267,7 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx, } else if (maptype == 1) { vm_unmap_ram(src, ctx->inpages); } else if (maptype == 2) { - erofs_put_pcpubuf(src); + z_erofs_put_gbuf(src); } else if (maptype != 3) { DBG_BUGON(1); return -EFAULT; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index f0d07ae75e50..4603d5fade8c 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -430,11 +430,11 @@ int z_erofs_fill_inode(struct inode *inode); int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map, int flags); -void *erofs_get_pcpubuf(unsigned int requiredpages); -void erofs_put_pcpubuf(void *ptr); -int erofs_pcpubuf_growsize(unsigned int nrpages); -void erofs_pcpubuf_init(void); -void erofs_pcpubuf_exit(void); +void *z_erofs_get_gbuf(unsigned int requiredpages); +void z_erofs_put_gbuf(void *ptr); +int z_erofs_gbuf_growsize(unsigned int nrpages); +int __init z_erofs_gbuf_init(void); +void z_erofs_gbuf_exit(void); #else static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; } static inline int z_erofs_map_blocks_iter(struct inode *inode, @@ -443,8 +443,8 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode, { return -EOPNOTSUPP; } -static inline void erofs_pcpubuf_init(void) {} -static inline void erofs_pcpubuf_exit(void) {} +static inline int z_erofs_gbuf_init(void) { return 0; } +static inline void z_erofs_gbuf_exit(void) {} #endif /* !CONFIG_EROFS_FS_ZIP */ struct erofs_map_dev { diff --git a/fs/erofs/pcpubuf.c b/fs/erofs/pcpubuf.c deleted file mode 100644 index a2efd833d1b6..000000000000 --- a/fs/erofs/pcpubuf.c +++ /dev/null @@ -1,148 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (C) Gao Xiang - * - * For low-latency decompression algorithms (e.g. lz4), reserve consecutive - * per-CPU virtual memory (in pages) in advance to store such inplace I/O - * data if inplace decompression is failed (due to unmet inplace margin for - * example). - */ -#include "internal.h" - -struct erofs_pcpubuf { - raw_spinlock_t lock; - void *ptr; - struct page **pages; - unsigned int nrpages; -}; - -static DEFINE_PER_CPU(struct erofs_pcpubuf, erofs_pcb); - -void *erofs_get_pcpubuf(unsigned int requiredpages) - __acquires(pcb->lock) -{ - struct erofs_pcpubuf *pcb = &get_cpu_var(erofs_pcb); - - raw_spin_lock(&pcb->lock); - /* check if the per-CPU buffer is too small */ - if (requiredpages > pcb->nrpages) { - raw_spin_unlock(&pcb->lock); - put_cpu_var(erofs_pcb); - /* (for sparse checker) pretend pcb->lock is still taken */ - __acquire(pcb->lock); - return NULL; - } - return pcb->ptr; -} - -void erofs_put_pcpubuf(void *ptr) __releases(pcb->lock) -{ - struct erofs_pcpubuf *pcb = &per_cpu(erofs_pcb, smp_processor_id()); - - DBG_BUGON(pcb->ptr != ptr); - raw_spin_unlock(&pcb->lock); - put_cpu_var(erofs_pcb); -} - -/* the next step: support per-CPU page buffers hotplug */ -int erofs_pcpubuf_growsize(unsigned int nrpages) -{ - static DEFINE_MUTEX(pcb_resize_mutex); - static unsigned int pcb_nrpages; - struct page *pagepool = NULL; - int delta, cpu, ret, i; - - mutex_lock(&pcb_resize_mutex); - delta = nrpages - pcb_nrpages; - ret = 0; - /* avoid shrinking pcpubuf, since no idea how many fses rely on */ - if (delta <= 0) - goto out; - - for_each_possible_cpu(cpu) { - struct erofs_pcpubuf *pcb = &per_cpu(erofs_pcb, cpu); - struct page **pages, **oldpages; - void *ptr, *old_ptr; - - pages = kmalloc_array(nrpages, sizeof(*pages), GFP_KERNEL); - if (!pages) { - ret = -ENOMEM; - break; - } - - for (i = 0; i < nrpages; ++i) { - pages[i] = erofs_allocpage(&pagepool, GFP_KERNEL); - if (!pages[i]) { - ret = -ENOMEM; - oldpages = pages; - goto free_pagearray; - } - } - ptr = vmap(pages, nrpages, VM_MAP, PAGE_KERNEL); - if (!ptr) { - ret = -ENOMEM; - oldpages = pages; - goto free_pagearray; - } - raw_spin_lock(&pcb->lock); - old_ptr = pcb->ptr; - pcb->ptr = ptr; - oldpages = pcb->pages; - pcb->pages = pages; - i = pcb->nrpages; - pcb->nrpages = nrpages; - raw_spin_unlock(&pcb->lock); - - if (!oldpages) { - DBG_BUGON(old_ptr); - continue; - } - - if (old_ptr) - vunmap(old_ptr); -free_pagearray: - while (i) - erofs_pagepool_add(&pagepool, oldpages[--i]); - kfree(oldpages); - if (ret) - break; - } - pcb_nrpages = nrpages; - erofs_release_pages(&pagepool); -out: - mutex_unlock(&pcb_resize_mutex); - return ret; -} - -void erofs_pcpubuf_init(void) -{ - int cpu; - - for_each_possible_cpu(cpu) { - struct erofs_pcpubuf *pcb = &per_cpu(erofs_pcb, cpu); - - raw_spin_lock_init(&pcb->lock); - } -} - -void erofs_pcpubuf_exit(void) -{ - int cpu, i; - - for_each_possible_cpu(cpu) { - struct erofs_pcpubuf *pcb = &per_cpu(erofs_pcb, cpu); - - if (pcb->ptr) { - vunmap(pcb->ptr); - pcb->ptr = NULL; - } - if (!pcb->pages) - continue; - - for (i = 0; i < pcb->nrpages; ++i) - if (pcb->pages[i]) - put_page(pcb->pages[i]); - kfree(pcb->pages); - pcb->pages = NULL; - } -} diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 19af9bbcb8f1..5433289f83eb 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -960,7 +960,10 @@ static int __init erofs_module_init(void) if (err) goto lzma_err; - erofs_pcpubuf_init(); + err = z_erofs_gbuf_init(); + if (err) + goto gbuf_err; + err = z_erofs_init_zip_subsystem(); if (err) goto zip_err; @@ -980,6 +983,8 @@ fs_err: sysfs_err: z_erofs_exit_zip_subsystem(); zip_err: + z_erofs_gbuf_exit(); +gbuf_err: z_erofs_lzma_exit(); lzma_err: erofs_exit_shrinker(); @@ -1001,7 +1006,7 @@ static void __exit erofs_module_exit(void) z_erofs_lzma_exit(); erofs_exit_shrinker(); kmem_cache_destroy(erofs_inode_cachep); - erofs_pcpubuf_exit(); + z_erofs_gbuf_exit(); } /* get filesystem statistics */ diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index b76ea41e521d..26ff13d949ad 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -6,6 +6,18 @@ #include "internal.h" #include +struct z_erofs_gbuf { + spinlock_t lock; + void *ptr; + struct page **pages; + unsigned int nrpages; +}; + +static struct z_erofs_gbuf *z_erofs_gbufpool; +static unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages; + +module_param_named(global_buffers, z_erofs_gbuf_count, uint, 0444); + static atomic_long_t erofs_global_shrink_cnt; /* for all mounted instances */ /* protected by 'erofs_sb_list_lock' */ static unsigned int shrinker_run_no; @@ -14,6 +26,142 @@ static unsigned int shrinker_run_no; static DEFINE_SPINLOCK(erofs_sb_list_lock); static LIST_HEAD(erofs_sb_list); +static unsigned int z_erofs_gbuf_id(void) +{ + return raw_smp_processor_id() % z_erofs_gbuf_count; +} + +void *z_erofs_get_gbuf(unsigned int requiredpages) + __acquires(gbuf->lock) +{ + struct z_erofs_gbuf *gbuf; + + gbuf = &z_erofs_gbufpool[z_erofs_gbuf_id()]; + spin_lock(&gbuf->lock); + /* check if the buffer is too small */ + if (requiredpages > gbuf->nrpages) { + spin_unlock(&gbuf->lock); + /* (for sparse checker) pretend gbuf->lock is still taken */ + __acquire(gbuf->lock); + return NULL; + } + return gbuf->ptr; +} + +void z_erofs_put_gbuf(void *ptr) __releases(gbuf->lock) +{ + struct z_erofs_gbuf *gbuf; + + gbuf = &z_erofs_gbufpool[z_erofs_gbuf_id()]; + DBG_BUGON(gbuf->ptr != ptr); + spin_unlock(&gbuf->lock); +} + +int z_erofs_gbuf_growsize(unsigned int nrpages) +{ + static DEFINE_MUTEX(gbuf_resize_mutex); + struct page *pagepool = NULL; + int delta, ret, i, j; + + mutex_lock(&gbuf_resize_mutex); + delta = nrpages - z_erofs_gbuf_nrpages; + ret = 0; + /* avoid shrinking gbufs, since no idea how many fses rely on */ + if (delta <= 0) + goto out; + + for (i = 0; i < z_erofs_gbuf_count; ++i) { + struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; + struct page **pages, **tmp_pages; + void *ptr, *old_ptr = NULL; + + ret = -ENOMEM; + tmp_pages = kcalloc(nrpages, sizeof(*tmp_pages), GFP_KERNEL); + if (!tmp_pages) + break; + for (j = 0; j < nrpages; ++j) { + tmp_pages[j] = erofs_allocpage(&pagepool, GFP_KERNEL); + if (!tmp_pages[j]) + goto free_pagearray; + } + ptr = vmap(tmp_pages, nrpages, VM_MAP, PAGE_KERNEL); + if (!ptr) + goto free_pagearray; + + pages = tmp_pages; + spin_lock(&gbuf->lock); + old_ptr = gbuf->ptr; + gbuf->ptr = ptr; + tmp_pages = gbuf->pages; + gbuf->pages = pages; + j = gbuf->nrpages; + gbuf->nrpages = nrpages; + spin_unlock(&gbuf->lock); + ret = 0; + if (!tmp_pages) { + DBG_BUGON(old_ptr); + continue; + } + + if (old_ptr) + vunmap(old_ptr); +free_pagearray: + while (j) + erofs_pagepool_add(&pagepool, tmp_pages[--j]); + kfree(tmp_pages); + if (ret) + break; + } + z_erofs_gbuf_nrpages = nrpages; + erofs_release_pages(&pagepool); +out: + mutex_unlock(&gbuf_resize_mutex); + return ret; +} + +int __init z_erofs_gbuf_init(void) +{ + unsigned int i = num_possible_cpus(); + + if (!z_erofs_gbuf_count) + z_erofs_gbuf_count = i; + else + z_erofs_gbuf_count = min(z_erofs_gbuf_count, i); + + z_erofs_gbufpool = kcalloc(z_erofs_gbuf_count, + sizeof(*z_erofs_gbufpool), GFP_KERNEL); + if (!z_erofs_gbufpool) + return -ENOMEM; + + for (i = 0; i < z_erofs_gbuf_count; ++i) + spin_lock_init(&z_erofs_gbufpool[i].lock); + return 0; +} + +void z_erofs_gbuf_exit(void) +{ + int i; + + for (i = 0; i < z_erofs_gbuf_count; ++i) { + struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; + + if (gbuf->ptr) { + vunmap(gbuf->ptr); + gbuf->ptr = NULL; + } + + if (!gbuf->pages) + continue; + + for (i = 0; i < gbuf->nrpages; ++i) + if (gbuf->pages[i]) + put_page(gbuf->pages[i]); + kfree(gbuf->pages); + gbuf->pages = NULL; + } + kfree(z_erofs_gbufpool); +} + struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp) { struct page *page = *pagepool; From a35a90635c95cc71f7632b9534791afb93442e5b Mon Sep 17 00:00:00 2001 From: Chunhai Guo Date: Tue, 2 Apr 2024 03:27:57 -0600 Subject: [PATCH 62/93] BACKPORT: erofs: do not use pagepool in z_erofs_gbuf_growsize() Let's use alloc_pages_bulk_array() for simplicity and get rid of unnecessary pagepool. Signed-off-by: Chunhai Guo Reviewed-by: Gao Xiang Link: https://lore.kernel.org/r/20240402092757.2635257-1-guochunhai@vivo.com Signed-off-by: Gao Xiang Bug: 348591003 Change-Id: Ib286b3331cb032e21bdf4dc12514ec85b6a979c7 (cherry picked from commit d6db47e571dcaecaeaafa8840d00ae849ae3907b) Signed-off-by: Chunhai Guo --- fs/erofs/zutil.c | 67 ++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index 26ff13d949ad..21da939d737e 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -60,63 +60,58 @@ void z_erofs_put_gbuf(void *ptr) __releases(gbuf->lock) int z_erofs_gbuf_growsize(unsigned int nrpages) { static DEFINE_MUTEX(gbuf_resize_mutex); - struct page *pagepool = NULL; - int delta, ret, i, j; + struct page **tmp_pages = NULL; + struct z_erofs_gbuf *gbuf; + void *ptr, *old_ptr; + int last, i, j; mutex_lock(&gbuf_resize_mutex); - delta = nrpages - z_erofs_gbuf_nrpages; - ret = 0; /* avoid shrinking gbufs, since no idea how many fses rely on */ - if (delta <= 0) - goto out; + if (nrpages <= z_erofs_gbuf_nrpages) { + mutex_unlock(&gbuf_resize_mutex); + return 0; + } for (i = 0; i < z_erofs_gbuf_count; ++i) { - struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; - struct page **pages, **tmp_pages; - void *ptr, *old_ptr = NULL; - - ret = -ENOMEM; + gbuf = &z_erofs_gbufpool[i]; tmp_pages = kcalloc(nrpages, sizeof(*tmp_pages), GFP_KERNEL); if (!tmp_pages) - break; - for (j = 0; j < nrpages; ++j) { - tmp_pages[j] = erofs_allocpage(&pagepool, GFP_KERNEL); - if (!tmp_pages[j]) - goto free_pagearray; - } + goto out; + + for (j = 0; j < gbuf->nrpages; ++j) + tmp_pages[j] = gbuf->pages[j]; + do { + last = j; + j = alloc_pages_bulk_array(GFP_KERNEL, nrpages, + tmp_pages); + if (last == j) + goto out; + } while (j != nrpages); + ptr = vmap(tmp_pages, nrpages, VM_MAP, PAGE_KERNEL); if (!ptr) - goto free_pagearray; + goto out; - pages = tmp_pages; spin_lock(&gbuf->lock); + kfree(gbuf->pages); + gbuf->pages = tmp_pages; old_ptr = gbuf->ptr; gbuf->ptr = ptr; - tmp_pages = gbuf->pages; - gbuf->pages = pages; - j = gbuf->nrpages; gbuf->nrpages = nrpages; spin_unlock(&gbuf->lock); - ret = 0; - if (!tmp_pages) { - DBG_BUGON(old_ptr); - continue; - } - if (old_ptr) vunmap(old_ptr); -free_pagearray: - while (j) - erofs_pagepool_add(&pagepool, tmp_pages[--j]); - kfree(tmp_pages); - if (ret) - break; } z_erofs_gbuf_nrpages = nrpages; - erofs_release_pages(&pagepool); out: + if (i < z_erofs_gbuf_count && tmp_pages) { + for (j = 0; j < nrpages; ++j) + if (tmp_pages[j] && tmp_pages[j] != gbuf->pages[j]) + __free_page(tmp_pages[j]); + kfree(tmp_pages); + } mutex_unlock(&gbuf_resize_mutex); - return ret; + return i < z_erofs_gbuf_count ? -ENOMEM : 0; } int __init z_erofs_gbuf_init(void) From 0013c5547499e257ababc06cd649ef10f857cd0b Mon Sep 17 00:00:00 2001 From: Chunhai Guo Date: Tue, 2 Apr 2024 07:15:23 -0600 Subject: [PATCH 63/93] BACKPORT: erofs: add a reserved buffer pool for lz4 decompression This adds a special global buffer pool (in the end) for reserved pages. Using a reserved pool for LZ4 decompression significantly reduces the time spent on extra temporary page allocation for the extreme cases in low memory scenarios. The table below shows the reduction in time spent on page allocation for LZ4 decompression when using a reserved pool. The results were obtained from multi-app launch benchmarks on ARM64 Android devices running the 5.15 kernel with an 8-core CPU and 8GB of memory. In the benchmark, we launched 16 frequently-used apps, and the camera app was the last one in each round. The data in the table is the average time of camera app for each round. After using the reserved pool, there was an average improvement of 150ms in the overall launch time of our camera app, which was obtained from the systrace log. +--------------+---------------+--------------+---------+ | | w/o page pool | w/ page pool | diff | +--------------+---------------+--------------+---------+ | Average (ms) | 3434 | 21 | -99.38% | +--------------+---------------+--------------+---------+ Based on the benchmark logs, 64 pages are sufficient for 95% of scenarios. This value can be adjusted with a module parameter `reserved_pages`. The default value is 0. This pool is currently only used for the LZ4 decompressor, but it can be applied to more decompressors if needed. Signed-off-by: Chunhai Guo Reviewed-by: Gao Xiang Link: https://lore.kernel.org/r/20240402131523.2703948-1-guochunhai@vivo.com Signed-off-by: Gao Xiang Bug: 348591003 Change-Id: I5ed7fe7de3f8dbf20c555b25129120ecc0f6fb54 (cherry picked from commit 0f6273ab46375b62c8dd5c987ce7c15877602831) [Chunhai: Resolved minor conflict in fs/erofs/internal.h ] Signed-off-by: Chunhai Guo --- fs/erofs/decompressor.c | 2 +- fs/erofs/internal.h | 6 +++- fs/erofs/zutil.c | 61 +++++++++++++++++++++++++++++++---------- 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 7487ef65fdea..05cef0282882 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -112,7 +112,7 @@ static int z_erofs_lz4_prepare_dstpages(struct z_erofs_lz4_decompress_ctx *ctx, victim = availables[--top]; get_page(victim); } else { - victim = erofs_allocpage(pagepool, rq->gfp); + victim = __erofs_allocpage(pagepool, rq->gfp, true); if (!victim) return -ENOMEM; set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE); diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 4603d5fade8c..95ff41892404 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -521,7 +521,11 @@ int __init erofs_init_sysfs(void); void erofs_exit_sysfs(void); /* utils.c / zdata.c */ -struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp); +struct page *__erofs_allocpage(struct page **pagepool, gfp_t gfp, bool tryrsv); +static inline struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp) +{ + return __erofs_allocpage(pagepool, gfp, false); +} static inline void erofs_pagepool_add(struct page **pagepool, struct page *page) { diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index 21da939d737e..7da63cfa8af3 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -13,10 +13,12 @@ struct z_erofs_gbuf { unsigned int nrpages; }; -static struct z_erofs_gbuf *z_erofs_gbufpool; -static unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages; +static struct z_erofs_gbuf *z_erofs_gbufpool, *z_erofs_rsvbuf; +static unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages, + z_erofs_rsv_nrpages; module_param_named(global_buffers, z_erofs_gbuf_count, uint, 0444); +module_param_named(reserved_pages, z_erofs_rsv_nrpages, uint, 0444); static atomic_long_t erofs_global_shrink_cnt; /* for all mounted instances */ /* protected by 'erofs_sb_list_lock' */ @@ -116,19 +118,30 @@ out: int __init z_erofs_gbuf_init(void) { - unsigned int i = num_possible_cpus(); + unsigned int i, total = num_possible_cpus(); - if (!z_erofs_gbuf_count) - z_erofs_gbuf_count = i; - else - z_erofs_gbuf_count = min(z_erofs_gbuf_count, i); + if (z_erofs_gbuf_count) + total = min(z_erofs_gbuf_count, total); + z_erofs_gbuf_count = total; - z_erofs_gbufpool = kcalloc(z_erofs_gbuf_count, - sizeof(*z_erofs_gbufpool), GFP_KERNEL); + /* The last (special) global buffer is the reserved buffer */ + total += !!z_erofs_rsv_nrpages; + + z_erofs_gbufpool = kcalloc(total, sizeof(*z_erofs_gbufpool), + GFP_KERNEL); if (!z_erofs_gbufpool) return -ENOMEM; - for (i = 0; i < z_erofs_gbuf_count; ++i) + if (z_erofs_rsv_nrpages) { + z_erofs_rsvbuf = &z_erofs_gbufpool[total - 1]; + z_erofs_rsvbuf->pages = kcalloc(z_erofs_rsv_nrpages, + sizeof(*z_erofs_rsvbuf->pages), GFP_KERNEL); + if (!z_erofs_rsvbuf->pages) { + z_erofs_rsvbuf = NULL; + z_erofs_rsv_nrpages = 0; + } + } + for (i = 0; i < total; ++i) spin_lock_init(&z_erofs_gbufpool[i].lock); return 0; } @@ -137,7 +150,7 @@ void z_erofs_gbuf_exit(void) { int i; - for (i = 0; i < z_erofs_gbuf_count; ++i) { + for (i = 0; i < z_erofs_gbuf_count + (!!z_erofs_rsvbuf); ++i) { struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; if (gbuf->ptr) { @@ -157,16 +170,22 @@ void z_erofs_gbuf_exit(void) kfree(z_erofs_gbufpool); } -struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp) +struct page *__erofs_allocpage(struct page **pagepool, gfp_t gfp, bool tryrsv) { struct page *page = *pagepool; if (page) { - DBG_BUGON(page_ref_count(page) != 1); *pagepool = (struct page *)page_private(page); - return page; + } else if (tryrsv && z_erofs_rsvbuf && z_erofs_rsvbuf->nrpages) { + spin_lock(&z_erofs_rsvbuf->lock); + if (z_erofs_rsvbuf->nrpages) + page = z_erofs_rsvbuf->pages[--z_erofs_rsvbuf->nrpages]; + spin_unlock(&z_erofs_rsvbuf->lock); } - return alloc_page(gfp); + if (!page) + page = alloc_page(gfp); + DBG_BUGON(page && page_ref_count(page) != 1); + return page; } void erofs_release_pages(struct page **pagepool) @@ -175,6 +194,18 @@ void erofs_release_pages(struct page **pagepool) struct page *page = *pagepool; *pagepool = (struct page *)page_private(page); + /* try to fill reserved global pool first */ + if (z_erofs_rsvbuf && z_erofs_rsvbuf->nrpages < + z_erofs_rsv_nrpages) { + spin_lock(&z_erofs_rsvbuf->lock); + if (z_erofs_rsvbuf->nrpages < z_erofs_rsv_nrpages) { + z_erofs_rsvbuf->pages[z_erofs_rsvbuf->nrpages++] + = page; + spin_unlock(&z_erofs_rsvbuf->lock); + continue; + } + spin_unlock(&z_erofs_rsvbuf->lock); + } put_page(page); } } From 49203a2850961ee5795f3ee5a1998689b3ea9bad Mon Sep 17 00:00:00 2001 From: Sandeep Dhavale Date: Mon, 24 Jun 2024 15:02:05 -0700 Subject: [PATCH 64/93] FROMGIT: erofs: fix possible memory leak in z_erofs_gbuf_exit() Because we incorrectly reused of variable `i` in `z_erofs_gbuf_exit()` for inner loop, we may exit early from outer loop resulting in memory leak. Fix this by using separate variable for iterating through inner loop. Bug: 348591003 Change-Id: I70b4301a80b5282d1167e09de866c3764fd0f8d4 Fixes: f36f3010f676 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable") Signed-off-by: Sandeep Dhavale Reviewed-by: Gao Xiang Link: https://lore.kernel.org/r/20240624220206.3373197-1-dhavale@google.com Signed-off-by: Gao Xiang (cherry picked from commit e41f107428237224fd51d99a4dc4358aba3b7d5f https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test) Signed-off-by: Chunhai Guo --- fs/erofs/zutil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index 7da63cfa8af3..86ff23db6084 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -148,7 +148,7 @@ int __init z_erofs_gbuf_init(void) void z_erofs_gbuf_exit(void) { - int i; + int i, j; for (i = 0; i < z_erofs_gbuf_count + (!!z_erofs_rsvbuf); ++i) { struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; @@ -161,9 +161,9 @@ void z_erofs_gbuf_exit(void) if (!gbuf->pages) continue; - for (i = 0; i < gbuf->nrpages; ++i) - if (gbuf->pages[i]) - put_page(gbuf->pages[i]); + for (j = 0; j < gbuf->nrpages; ++j) + if (gbuf->pages[j]) + put_page(gbuf->pages[j]); kfree(gbuf->pages); gbuf->pages = NULL; } From 2870c7853029fda4a34cb2172604d713e6502c04 Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Mon, 15 Apr 2024 21:22:50 +0800 Subject: [PATCH 65/93] ANDROID: GKI: add percpu_rwsem vendor hooks When a writer has set sem->block and is waiting for active readers to complete, we still allow some specific new readers to entry the critical section, which can help prevent priority inversion from impacting system responsiveness and performance. Bug: 334851707 Change-Id: I9e2a7df1efb326763487423d64bcf74d8dec23f8 Signed-off-by: zhujingpeng (cherry picked from commit 458cdb59f7719f81504d392daa95a8c99c30c276) --- drivers/android/vendor_hooks.c | 3 +++ include/trace/hooks/dtask.h | 9 +++++++++ kernel/locking/percpu-rwsem.c | 14 +++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 3be1ccdb9cb6..3a317c513c87 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -421,3 +421,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_read_fault); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_queue_request_and_unlock); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_fuse_request_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_read_trylock_failed); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_down_read); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_up_write); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_percpu_rwsem_wait_complete); diff --git a/include/trace/hooks/dtask.h b/include/trace/hooks/dtask.h index ecf3f4b03ab7..08a1ba96413c 100644 --- a/include/trace/hooks/dtask.h +++ b/include/trace/hooks/dtask.h @@ -90,6 +90,15 @@ DECLARE_HOOK(android_vh_record_pcpu_rwsem_time_early, DECLARE_HOOK(android_vh_percpu_rwsem_wq_add, TP_PROTO(struct percpu_rw_semaphore *sem, bool reader), TP_ARGS(sem, reader)); +DECLARE_HOOK(android_vh_percpu_rwsem_down_read, + TP_PROTO(struct percpu_rw_semaphore *sem, bool try, bool *ret), + TP_ARGS(sem, try, ret)); +DECLARE_HOOK(android_vh_percpu_rwsem_up_write, + TP_PROTO(struct percpu_rw_semaphore *sem), + TP_ARGS(sem)); +DECLARE_RESTRICTED_HOOK(android_rvh_percpu_rwsem_wait_complete, + TP_PROTO(struct percpu_rw_semaphore *sem, long state, bool *complete), + TP_ARGS(sem, state, complete), 1); struct mutex_waiter; DECLARE_HOOK(android_vh_alter_mutex_list_add, diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c index 549da829c954..37f5f1f58ea4 100644 --- a/kernel/locking/percpu-rwsem.c +++ b/kernel/locking/percpu-rwsem.c @@ -196,9 +196,15 @@ static void percpu_rwsem_wait(struct percpu_rw_semaphore *sem, bool reader) bool __sched __percpu_down_read(struct percpu_rw_semaphore *sem, bool try) { + bool ret = false; + if (__percpu_down_read_trylock(sem)) return true; + trace_android_vh_percpu_rwsem_down_read(sem, try, &ret); + if (ret) + return true; + if (try) return false; @@ -253,6 +259,8 @@ static bool readers_active_check(struct percpu_rw_semaphore *sem) void __sched percpu_down_write(struct percpu_rw_semaphore *sem) { + bool complete = false; + might_sleep(); rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); trace_contention_begin(sem, LCB_F_PERCPU | LCB_F_WRITE); @@ -278,7 +286,9 @@ void __sched percpu_down_write(struct percpu_rw_semaphore *sem) */ /* Wait for all active readers to complete. */ - rcuwait_wait_event(&sem->writer, readers_active_check(sem), TASK_UNINTERRUPTIBLE); + trace_android_rvh_percpu_rwsem_wait_complete(sem, TASK_UNINTERRUPTIBLE, &complete); + if (!complete) + rcuwait_wait_event(&sem->writer, readers_active_check(sem), TASK_UNINTERRUPTIBLE); trace_contention_end(sem, 0); trace_android_vh_record_pcpu_rwsem_starttime(current, jiffies); } @@ -288,6 +298,8 @@ void percpu_up_write(struct percpu_rw_semaphore *sem) { rwsem_release(&sem->dep_map, _RET_IP_); + trace_android_vh_percpu_rwsem_up_write(sem); + /* * Signal the writer is done, no fast path yet. * From a7daeb4de85e54509318c6be3d1223cc166d8be2 Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Sat, 22 Jun 2024 15:32:32 +0800 Subject: [PATCH 66/93] ANDROID: GKI: Update symbol list for vivo update vivo symbol list for adding hooks for percpu_rwsem 3 function symbol(s) added 'int __traceiter_android_rvh_percpu_rwsem_wait_complete(void*, struct percpu_rw_semaphore*, long, bool*)' 'int __traceiter_android_vh_percpu_rwsem_down_read(void*, struct percpu_rw_semaphore*, bool, bool*)' 'int __traceiter_android_vh_percpu_rwsem_up_write(void*, struct percpu_rw_semaphore*)' 3 variable symbol(s) added 'struct tracepoint __tracepoint_android_rvh_percpu_rwsem_wait_complete' 'struct tracepoint __tracepoint_android_vh_percpu_rwsem_down_read' 'struct tracepoint __tracepoint_android_vh_percpu_rwsem_up_write' Bug: 348699616 Change-Id: I854f8080e527fd144539dda9859d333537c2db89 Signed-off-by: zhujingpeng --- android/abi_gki_aarch64.stg | 82 ++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 6 +++ 2 files changed, 88 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index d4eff355602a..ac74aa1b5d59 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -326979,6 +326979,14 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x3a5262d4 } +function { + id: 0x9bd62b1f + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x11b57133 + parameter_id: 0xfc0e1dbd + parameter_id: 0x11cfee5a +} function { id: 0x9bd67f28 return_type_id: 0x6720d32f @@ -327565,6 +327573,12 @@ function { parameter_id: 0x10673339 parameter_id: 0x0258f96e } +function { + id: 0x9be96fa7 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x11b57133 +} function { id: 0x9beaa8bf return_type_id: 0x6720d32f @@ -327624,6 +327638,14 @@ function { parameter_id: 0x18ea6ae3 parameter_id: 0x120540d1 } +function { + id: 0x9bf2774f + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x11b57133 + parameter_id: 0x6d7f5ff6 + parameter_id: 0x11cfee5a +} function { id: 0x9bf2ff2c return_type_id: 0x6720d32f @@ -343206,6 +343228,15 @@ elf_symbol { type_id: 0x9ba47b26 full_name: "__traceiter_android_rvh_panic_unhandled" } +elf_symbol { + id: 0x21c681ad + name: "__traceiter_android_rvh_percpu_rwsem_wait_complete" + is_defined: true + symbol_type: FUNCTION + crc: 0xfab64db4 + type_id: 0x9bd62b1f + full_name: "__traceiter_android_rvh_percpu_rwsem_wait_complete" +} elf_symbol { id: 0x88e9b222 name: "__traceiter_android_rvh_pick_next_entity" @@ -345357,6 +345388,24 @@ elf_symbol { type_id: 0x9bb7fe1c full_name: "__traceiter_android_vh_page_add_new_anon_rmap" } +elf_symbol { + id: 0x13b0736e + name: "__traceiter_android_vh_percpu_rwsem_down_read" + is_defined: true + symbol_type: FUNCTION + crc: 0x0f1df9a6 + type_id: 0x9bf2774f + full_name: "__traceiter_android_vh_percpu_rwsem_down_read" +} +elf_symbol { + id: 0xc72f2012 + name: "__traceiter_android_vh_percpu_rwsem_up_write" + is_defined: true + symbol_type: FUNCTION + crc: 0x31ad37c3 + type_id: 0x9be96fa7 + full_name: "__traceiter_android_vh_percpu_rwsem_up_write" +} elf_symbol { id: 0xd14f3adb name: "__traceiter_android_vh_percpu_rwsem_wq_add" @@ -347562,6 +347611,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_rvh_panic_unhandled" } +elf_symbol { + id: 0xee3719e3 + name: "__tracepoint_android_rvh_percpu_rwsem_wait_complete" + is_defined: true + symbol_type: OBJECT + crc: 0xf5edaa25 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_rvh_percpu_rwsem_wait_complete" +} elf_symbol { id: 0x18752990 name: "__tracepoint_android_rvh_pick_next_entity" @@ -349713,6 +349771,24 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_page_add_new_anon_rmap" } +elf_symbol { + id: 0xa4c454d8 + name: "__tracepoint_android_vh_percpu_rwsem_down_read" + is_defined: true + symbol_type: OBJECT + crc: 0x4d43e945 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_percpu_rwsem_down_read" +} +elf_symbol { + id: 0x7d42b7c8 + name: "__tracepoint_android_vh_percpu_rwsem_up_write" + is_defined: true + symbol_type: OBJECT + crc: 0x474a7c7a + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_percpu_rwsem_up_write" +} elf_symbol { id: 0x3d63616d name: "__tracepoint_android_vh_percpu_rwsem_wq_add" @@ -411232,6 +411308,7 @@ interface { symbol_id: 0x0d22882d symbol_id: 0xb51338de symbol_id: 0xc463ba81 + symbol_id: 0x21c681ad symbol_id: 0x88e9b222 symbol_id: 0x097e467e symbol_id: 0xfad1d9f5 @@ -411471,6 +411548,8 @@ interface { symbol_id: 0xe17999f4 symbol_id: 0x721b87b7 symbol_id: 0xacaadcc9 + symbol_id: 0x13b0736e + symbol_id: 0xc72f2012 symbol_id: 0xd14f3adb symbol_id: 0x5983841b symbol_id: 0x7d499dab @@ -411716,6 +411795,7 @@ interface { symbol_id: 0x62726c6f symbol_id: 0xdf21a7cc symbol_id: 0xeea6bf23 + symbol_id: 0xee3719e3 symbol_id: 0x18752990 symbol_id: 0x448fc4e4 symbol_id: 0x121537db @@ -411955,6 +412035,8 @@ interface { symbol_id: 0x76e879b6 symbol_id: 0xae5bbde9 symbol_id: 0x20d2ceb3 + symbol_id: 0xa4c454d8 + symbol_id: 0x7d42b7c8 symbol_id: 0x3d63616d symbol_id: 0xab37fc55 symbol_id: 0x49b95a49 diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index a554e90e9b0d..4b0e2f8cc6fa 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -328,6 +328,7 @@ __traceiter_android_rvh_migrate_queued_task __traceiter_android_rvh_new_task_stats __traceiter_android_rvh_panic_unhandled + __traceiter_android_rvh_percpu_rwsem_wait_complete __traceiter_android_rvh_pick_next_entity __traceiter_android_rvh_place_entity __traceiter_android_rvh_prepare_prio_fork @@ -401,6 +402,8 @@ __traceiter_android_vh_mmap_region __traceiter_android_vh_mutex_wait_finish __traceiter_android_vh_mutex_wait_start + __traceiter_android_vh_percpu_rwsem_down_read + __traceiter_android_vh_percpu_rwsem_up_write __traceiter_android_vh_printk_hotplug __traceiter_android_vh_queue_request_and_unlock __traceiter_android_vh_rproc_recovery @@ -500,6 +503,7 @@ __tracepoint_android_rvh_migrate_queued_task __tracepoint_android_rvh_new_task_stats __tracepoint_android_rvh_panic_unhandled + __tracepoint_android_rvh_percpu_rwsem_wait_complete __tracepoint_android_rvh_pick_next_entity __tracepoint_android_rvh_place_entity __tracepoint_android_rvh_prepare_prio_fork @@ -573,6 +577,8 @@ __tracepoint_android_vh_mmap_region __tracepoint_android_vh_mutex_wait_finish __tracepoint_android_vh_mutex_wait_start + __tracepoint_android_vh_percpu_rwsem_down_read + __tracepoint_android_vh_percpu_rwsem_up_write __tracepoint_android_vh_printk_hotplug __tracepoint_android_vh_queue_request_and_unlock __tracepoint_android_vh_rproc_recovery From 5747d79ab0b7f24db788196258437441f4cf413e Mon Sep 17 00:00:00 2001 From: Hsiu-Chang Chen Date: Mon, 24 Jun 2024 19:29:01 +0800 Subject: [PATCH 67/93] ANDROID: Update the ABI symbol list wlan vendor propose a feature to check the refcnt of netdev when interface register/unregister. Add `netdev_refcnt_read` into symbol list. Adding the following symbols: - netdev_refcnt_read Bug: 340118509 Change-Id: I6a2ad4bbfa13d01011729b764dfe92f4945a829e Signed-off-by: Hsiu-Chang Chen (cherry picked from commit 51cc4ca4989a9e3283a295d13d8bacbbd3181e9f) --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_pixel | 1 + 2 files changed, 11 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index ac74aa1b5d59..af7bb05d1065 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -382181,6 +382181,15 @@ elf_symbol { type_id: 0x1fdf0b41 full_name: "netdev_printk" } +elf_symbol { + id: 0x36e00d6e + name: "netdev_refcnt_read" + is_defined: true + symbol_type: FUNCTION + crc: 0x075dba6b + type_id: 0x9166923b + full_name: "netdev_refcnt_read" +} elf_symbol { id: 0x6c3e8f78 name: "netdev_reset_tc" @@ -415635,6 +415644,7 @@ interface { symbol_id: 0xd5ed1a09 symbol_id: 0xd78c295f symbol_id: 0xe42df14f + symbol_id: 0x36e00d6e symbol_id: 0x6c3e8f78 symbol_id: 0x22c60050 symbol_id: 0x7a3d8713 diff --git a/android/abi_gki_aarch64_pixel b/android/abi_gki_aarch64_pixel index db80f3bfcd89..61830b15a69e 100644 --- a/android/abi_gki_aarch64_pixel +++ b/android/abi_gki_aarch64_pixel @@ -1432,6 +1432,7 @@ __netdev_alloc_skb netdev_err netdev_info + netdev_refcnt_read netdev_set_default_ethtool_ops netdev_state_change netdev_update_features From 1df05952a145791a588f39b6d0e4fa7fde7b9aa9 Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Thu, 18 Apr 2024 00:57:11 +0800 Subject: [PATCH 68/93] ANDROID: vendor_hooks: add hooks in rwsem these hooks are required by the following features: 1.For rwsem readers, currently only the latest reader will be recorded in sem->owner. We add hooks to record all readers which have acquired the lock, once there are UX threads blocked in the rwsem waiting list, these read_owners will be given high priority in scheduling. 2.For rwsem writer, when a writer acquires the lock, we check whether there are UX threads blocked in the rwsem wait list. If so, we give this writer a high priority in scheduling so that it can release the lock as soon as possible. Both of these features can optimize the priority inversion problem caused by rwsem and improve system responsiveness and performance. Bug: 335408185 Change-Id: I82a6fbb6acd2ce05d049e686b61e34e4d3b39a5e Signed-off-by: zhujingpeng [jstultz: Rebased and resolved minor conflict] Signed-off-by: John Stultz (cherry picked from commit 188c41744ddcccef6daf6dcd4d6a444dabdc2f94) --- drivers/android/vendor_hooks.c | 4 ++++ include/trace/hooks/rwsem.h | 13 +++++++++++++ kernel/locking/rwsem.c | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 3a317c513c87..12111662e56d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -424,3 +424,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_read_trylock_failed); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_down_read); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_up_write); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_percpu_rwsem_wait_complete); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rwsem_reader_owned); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_clear_rwsem_reader_owned); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rwsem_writer_owned); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_clear_rwsem_writer_owned); diff --git a/include/trace/hooks/rwsem.h b/include/trace/hooks/rwsem.h index 6c1e36468271..1e2257c3e84e 100644 --- a/include/trace/hooks/rwsem.h +++ b/include/trace/hooks/rwsem.h @@ -37,6 +37,19 @@ DECLARE_HOOK(android_vh_rwsem_optimistic_rspin, DECLARE_HOOK(android_vh_rwsem_read_trylock_failed, TP_PROTO(struct rw_semaphore *sem, long *cntp, int *ret), TP_ARGS(sem, cntp, ret)); +DECLARE_HOOK(android_vh_record_rwsem_reader_owned, + TP_PROTO(struct rw_semaphore *sem, + struct list_head *wlist), + TP_ARGS(sem, wlist)); +DECLARE_HOOK(android_vh_clear_rwsem_reader_owned, + TP_PROTO(struct rw_semaphore *sem), + TP_ARGS(sem)); +DECLARE_HOOK(android_vh_record_rwsem_writer_owned, + TP_PROTO(struct rw_semaphore *sem), + TP_ARGS(sem)); +DECLARE_HOOK(android_vh_clear_rwsem_writer_owned, + TP_PROTO(struct rw_semaphore *sem), + TP_ARGS(sem)); #endif /* _TRACE_HOOK_RWSEM_H */ /* This part must be outside protection */ #include diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index c847167f536f..98ee3906ee8a 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -143,12 +143,14 @@ static inline void rwsem_set_owner(struct rw_semaphore *sem) { lockdep_assert_preemption_disabled(); atomic_long_set(&sem->owner, (long)current); + trace_android_vh_record_rwsem_writer_owned(sem); } static inline void rwsem_clear_owner(struct rw_semaphore *sem) { lockdep_assert_preemption_disabled(); atomic_long_set(&sem->owner, 0); + trace_android_vh_clear_rwsem_writer_owned(sem); } /* @@ -181,6 +183,7 @@ static inline void __rwsem_set_reader_owned(struct rw_semaphore *sem, static inline void rwsem_set_reader_owned(struct rw_semaphore *sem) { __rwsem_set_reader_owned(sem, current); + trace_android_vh_record_rwsem_reader_owned(sem, NULL); } /* @@ -211,6 +214,7 @@ static inline void rwsem_clear_reader_owned(struct rw_semaphore *sem) { unsigned long val = atomic_long_read(&sem->owner); + trace_android_vh_clear_rwsem_reader_owned(sem); while ((val & ~RWSEM_OWNER_FLAGS_MASK) == (unsigned long)current) { if (atomic_long_try_cmpxchg(&sem->owner, &val, val & RWSEM_OWNER_FLAGS_MASK)) @@ -220,6 +224,7 @@ static inline void rwsem_clear_reader_owned(struct rw_semaphore *sem) #else static inline void rwsem_clear_reader_owned(struct rw_semaphore *sem) { + trace_android_vh_clear_rwsem_reader_owned(sem); } #endif @@ -561,6 +566,7 @@ static void rwsem_mark_wake(struct rw_semaphore *sem, if (adjustment) atomic_long_add(adjustment, &sem->count); + trace_android_vh_record_rwsem_reader_owned(sem, &wlist); /* 2nd pass */ list_for_each_entry_safe(waiter, tmp, &wlist, list) { From 74a3c59c8087bea691011dc213c0aeac6b37e286 Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Wed, 26 Jun 2024 14:25:00 +0800 Subject: [PATCH 69/93] ANDROID: GKI: Update symbol list for vivo update vivo symbol list for adding hooks for rwsem 4 function symbol(s) added 'int __traceiter_android_vh_clear_rwsem_reader_owned(void*, struct rw_semaphore*)' 'int __traceiter_android_vh_clear_rwsem_writer_owned(void*, struct rw_semaphore*)' 'int __traceiter_android_vh_record_rwsem_reader_owned(void*, struct rw_semaphore*, struct list_head*)' 'int __traceiter_android_vh_record_rwsem_writer_owned(void*, struct rw_semaphore*)' 4 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_clear_rwsem_reader_owned' 'struct tracepoint __tracepoint_android_vh_clear_rwsem_writer_owned' 'struct tracepoint __tracepoint_android_vh_record_rwsem_reader_owned' 'struct tracepoint __tracepoint_android_vh_record_rwsem_writer_owned' Bug: 349494518 Change-Id: I0580e16d4c70d923ec5d8269f5b8fead952979d3 Signed-off-by: zhujingpeng --- android/abi_gki_aarch64.stg | 87 ++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 8 ++++ 2 files changed, 95 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index af7bb05d1065..2c04d3b04a39 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -325798,6 +325798,13 @@ function { parameter_id: 0x24373219 parameter_id: 0x1c3dbe5a } +function { + id: 0x9ba2dbe7 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x00be4281 + parameter_id: 0x3e6239e1 +} function { id: 0x9ba2e939 return_type_id: 0x6720d32f @@ -344470,6 +344477,24 @@ elf_symbol { type_id: 0x9b63bb96 full_name: "__traceiter_android_vh_cleanup_old_buffers_bypass" } +elf_symbol { + id: 0xaed0a325 + name: "__traceiter_android_vh_clear_rwsem_reader_owned" + is_defined: true + symbol_type: FUNCTION + crc: 0xb73d50d1 + type_id: 0x9bad4369 + full_name: "__traceiter_android_vh_clear_rwsem_reader_owned" +} +elf_symbol { + id: 0xc308efa9 + name: "__traceiter_android_vh_clear_rwsem_writer_owned" + is_defined: true + symbol_type: FUNCTION + crc: 0xf8b0514c + type_id: 0x9bad4369 + full_name: "__traceiter_android_vh_clear_rwsem_writer_owned" +} elf_symbol { id: 0xa4527895 name: "__traceiter_android_vh_compaction_exit" @@ -345568,6 +345593,24 @@ elf_symbol { type_id: 0x9bd7019d full_name: "__traceiter_android_vh_record_rwsem_lock_starttime" } +elf_symbol { + id: 0xbb291efa + name: "__traceiter_android_vh_record_rwsem_reader_owned" + is_defined: true + symbol_type: FUNCTION + crc: 0x5c144caf + type_id: 0x9ba2dbe7 + full_name: "__traceiter_android_vh_record_rwsem_reader_owned" +} +elf_symbol { + id: 0xf2957eae + name: "__traceiter_android_vh_record_rwsem_writer_owned" + is_defined: true + symbol_type: FUNCTION + crc: 0x48a061e3 + type_id: 0x9bad4369 + full_name: "__traceiter_android_vh_record_rwsem_writer_owned" +} elf_symbol { id: 0xe2d75052 name: "__traceiter_android_vh_regmap_update" @@ -348853,6 +348896,24 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_cleanup_old_buffers_bypass" } +elf_symbol { + id: 0xbbfbc9db + name: "__tracepoint_android_vh_clear_rwsem_reader_owned" + is_defined: true + symbol_type: OBJECT + crc: 0x4a37a0e4 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_clear_rwsem_reader_owned" +} +elf_symbol { + id: 0x36fc8313 + name: "__tracepoint_android_vh_clear_rwsem_writer_owned" + is_defined: true + symbol_type: OBJECT + crc: 0x6b66275c + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_clear_rwsem_writer_owned" +} elf_symbol { id: 0x9d49459f name: "__tracepoint_android_vh_compaction_exit" @@ -349951,6 +350012,24 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_record_rwsem_lock_starttime" } +elf_symbol { + id: 0x1fe1da5c + name: "__tracepoint_android_vh_record_rwsem_reader_owned" + is_defined: true + symbol_type: OBJECT + crc: 0xf686c98d + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_record_rwsem_reader_owned" +} +elf_symbol { + id: 0x57c5897c + name: "__tracepoint_android_vh_record_rwsem_writer_owned" + is_defined: true + symbol_type: OBJECT + crc: 0xd7d74e35 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_record_rwsem_writer_owned" +} elf_symbol { id: 0x13b2fb38 name: "__tracepoint_android_vh_regmap_update" @@ -411455,6 +411534,8 @@ interface { symbol_id: 0x005c7625 symbol_id: 0xf3accb84 symbol_id: 0xef7737f8 + symbol_id: 0xaed0a325 + symbol_id: 0xc308efa9 symbol_id: 0xa4527895 symbol_id: 0x3644fdcd symbol_id: 0x63b166c2 @@ -411577,6 +411658,8 @@ interface { symbol_id: 0x1a91ec8c symbol_id: 0x92518ec5 symbol_id: 0x9792c22e + symbol_id: 0xbb291efa + symbol_id: 0xf2957eae symbol_id: 0xe2d75052 symbol_id: 0xf10ce16f symbol_id: 0xa8cef421 @@ -411942,6 +412025,8 @@ interface { symbol_id: 0x5cc4ca5b symbol_id: 0x607a7f0a symbol_id: 0xca10f06e + symbol_id: 0xbbfbc9db + symbol_id: 0x36fc8313 symbol_id: 0x9d49459f symbol_id: 0x759240ef symbol_id: 0xe054bfe0 @@ -412064,6 +412149,8 @@ interface { symbol_id: 0x158c4cfa symbol_id: 0x4568ff8f symbol_id: 0xe918e2ec + symbol_id: 0x1fe1da5c + symbol_id: 0x57c5897c symbol_id: 0x13b2fb38 symbol_id: 0xd6904c6d symbol_id: 0xcad24ea3 diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index 4b0e2f8cc6fa..1d2c97fec2a5 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -378,6 +378,8 @@ __traceiter_android_vh_build_sched_domains __traceiter_android_vh_check_uninterrupt_tasks __traceiter_android_vh_check_uninterrupt_tasks_done + __traceiter_android_vh_clear_rwsem_reader_owned + __traceiter_android_vh_clear_rwsem_writer_owned __traceiter_android_vh_cpu_idle_enter __traceiter_android_vh_cpu_idle_exit __traceiter_android_vh_cpufreq_fast_switch @@ -406,6 +408,8 @@ __traceiter_android_vh_percpu_rwsem_up_write __traceiter_android_vh_printk_hotplug __traceiter_android_vh_queue_request_and_unlock + __traceiter_android_vh_record_rwsem_reader_owned + __traceiter_android_vh_record_rwsem_writer_owned __traceiter_android_vh_rproc_recovery __traceiter_android_vh_rproc_recovery_set __traceiter_android_vh_rtmutex_wait_finish @@ -553,6 +557,8 @@ __tracepoint_android_vh_build_sched_domains __tracepoint_android_vh_check_uninterrupt_tasks __tracepoint_android_vh_check_uninterrupt_tasks_done + __tracepoint_android_vh_clear_rwsem_reader_owned + __tracepoint_android_vh_clear_rwsem_writer_owned __tracepoint_android_vh_cpu_idle_enter __tracepoint_android_vh_cpu_idle_exit __tracepoint_android_vh_cpufreq_fast_switch @@ -581,6 +587,8 @@ __tracepoint_android_vh_percpu_rwsem_up_write __tracepoint_android_vh_printk_hotplug __tracepoint_android_vh_queue_request_and_unlock + __tracepoint_android_vh_record_rwsem_reader_owned + __tracepoint_android_vh_record_rwsem_writer_owned __tracepoint_android_vh_rproc_recovery __tracepoint_android_vh_rproc_recovery_set __tracepoint_android_vh_rtmutex_wait_finish From 616650627d1300af0f2ef56caf30901379ef5597 Mon Sep 17 00:00:00 2001 From: Norihiko Hama Date: Mon, 29 May 2023 16:54:58 +0900 Subject: [PATCH 70/93] ANDROID: gki_defconfig: enable CONFIG_SYN_COOKIES Enable CONFIG_SYN_COOKIES to support SYN cookies against attack "SYN flooding". This also makes GKI on arm64 consistent with GKI on x86. According to kernel dev-team, this does not affect the KMI. Bug: 349649090 Bug: 278043288 Change-Id: If43951b0ce3028e65799f9b6e68106ca98ee980e Signed-off-by: Norihiko Hama --- arch/arm64/configs/gki_defconfig | 1 + arch/x86/configs/gki_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index 13a85324afbb..b216e097b27e 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -151,6 +151,7 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_NET_IPIP=y CONFIG_NET_IPGRE_DEMUX=y CONFIG_NET_IPGRE=y +CONFIG_SYN_COOKIES=y CONFIG_NET_IPVTI=y CONFIG_INET_ESP=y CONFIG_INET_UDP_DIAG=y diff --git a/arch/x86/configs/gki_defconfig b/arch/x86/configs/gki_defconfig index debf9895c937..696d631131ab 100644 --- a/arch/x86/configs/gki_defconfig +++ b/arch/x86/configs/gki_defconfig @@ -141,6 +141,7 @@ CONFIG_IP_MULTIPLE_TABLES=y CONFIG_NET_IPIP=y CONFIG_NET_IPGRE_DEMUX=y CONFIG_NET_IPGRE=y +CONFIG_SYN_COOKIES=y CONFIG_NET_IPVTI=y CONFIG_INET_ESP=y CONFIG_INET_UDP_DIAG=y From a5329424ea9255f10099904f8228467022632bca Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Sat, 11 May 2024 11:45:36 +0800 Subject: [PATCH 71/93] ANDROID: GKI: export sys_exit tracepoint This patch export a sys_exit tracepoint for task state-tracking and performance tuning. Bug: 339912146 Change-Id: I951ac6034e80691f092c0ba41b6af1fdaf8be49c Signed-off-by: zhujingpeng (cherry picked from commit 53c7feb8b4829376b678b7cb8d501f48b2b47286) --- arch/arm64/kernel/ptrace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index e1f6366b7ccd..a9e727bb1543 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -43,6 +43,8 @@ #define CREATE_TRACE_POINTS #include +EXPORT_TRACEPOINT_SYMBOL_GPL(sys_exit); + struct pt_regs_offset { const char *name; int offset; From 724b50f143e0279da03adc51613d577845eb7cab Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Thu, 27 Jun 2024 16:09:07 +0800 Subject: [PATCH 72/93] ANDROID: GKI: Update symbol list for vivo 1 function symbol(s) added 'int __traceiter_sys_exit(void*, struct pt_regs*, long)' 1 variable symbol(s) added 'struct tracepoint __tracepoint_sys_exit' Bug: 349739225 Change-Id: Ie95f7c4b3bd2879dddee188bff5845bcac84484f Signed-off-by: zhujingpeng --- android/abi_gki_aarch64.stg | 27 +++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 2 ++ 2 files changed, 29 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 2c04d3b04a39..801b566e6b2d 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -325612,6 +325612,13 @@ function { parameter_id: 0x2a670b41 parameter_id: 0x0db25a6d } +function { + id: 0x9b943159 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x01222f7d + parameter_id: 0xfc0e1dbd +} function { id: 0x9b94dad5 return_type_id: 0x6720d32f @@ -347042,6 +347049,15 @@ elf_symbol { type_id: 0x9b4f857e full_name: "__traceiter_suspend_resume" } +elf_symbol { + id: 0x313b4348 + name: "__traceiter_sys_exit" + is_defined: true + symbol_type: FUNCTION + crc: 0x28f80de0 + type_id: 0x9b943159 + full_name: "__traceiter_sys_exit" +} elf_symbol { id: 0xcac5a7d5 name: "__traceiter_task_newtask" @@ -351461,6 +351477,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_suspend_resume" } +elf_symbol { + id: 0x9deae602 + name: "__tracepoint_sys_exit" + is_defined: true + symbol_type: OBJECT + crc: 0x2d3d9e52 + type_id: 0x18ccbd2c + full_name: "__tracepoint_sys_exit" +} elf_symbol { id: 0xe91cdbb3 name: "__tracepoint_task_newtask" @@ -411819,6 +411844,7 @@ interface { symbol_id: 0x62a42e92 symbol_id: 0xa7ccbbf5 symbol_id: 0x863777a0 + symbol_id: 0x313b4348 symbol_id: 0xcac5a7d5 symbol_id: 0x2dc83a86 symbol_id: 0x961fbab2 @@ -412310,6 +412336,7 @@ interface { symbol_id: 0x9a65f074 symbol_id: 0x158cc323 symbol_id: 0x5b327cd6 + symbol_id: 0x9deae602 symbol_id: 0xe91cdbb3 symbol_id: 0x4f1ffabc symbol_id: 0x1a51f8cc diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index 1d2c97fec2a5..a081f1912994 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -463,6 +463,7 @@ __traceiter_sched_overutilized_tp __traceiter_sched_switch __traceiter_suspend_resume + __traceiter_sys_exit __traceiter_workqueue_execute_start __traceiter_xdp_exception __tracepoint_android_rvh_account_irq @@ -642,6 +643,7 @@ __tracepoint_sched_overutilized_tp __tracepoint_sched_switch __tracepoint_suspend_resume + __tracepoint_sys_exit __tracepoint_workqueue_execute_start __tracepoint_xdp_exception __tty_alloc_driver From 85a0c4bef628f784821f775bac5c27709eef550f Mon Sep 17 00:00:00 2001 From: Xiaofeng Yuan Date: Tue, 25 Jun 2024 19:51:30 +0800 Subject: [PATCH 73/93] ANDROID: GKI: Add pageflags for OEM Add PG_oem_reserved_x pageflags for OEM on 64-bit platform. These new flags can be used to indicate different states of page. For example, we can use these pageflags to identify anonymous pages at different ZRAM compression rates. These flags will be used in conjunction with different Android application states. Therefore, I think this is not a generic modification for all Linux devices and is not suitable for upstream submission. Bug: 336964184 Change-Id: Ie68087248866af63ac516d96e3af85222e7a0b50 Signed-off-by: Xiaofeng Yuan --- include/linux/page-flags.h | 6 ++++++ include/trace/events/mmflags.h | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 59314d228ec3..1a0148236c66 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -137,6 +137,12 @@ enum pageflags { #endif #ifdef CONFIG_KASAN_HW_TAGS PG_skip_kasan_poison, +#endif +#ifdef CONFIG_64BIT + PG_oem_reserved_1, + PG_oem_reserved_2, + PG_oem_reserved_3, + PG_oem_reserved_4, #endif __NR_PAGEFLAGS, diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 3e06b3fe81a6..bfe8d11ce749 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -104,6 +104,12 @@ #define IF_HAVE_PG_SKIP_KASAN_POISON(flag,string) #endif +#ifdef CONFIG_64BIT +#define IF_HAVE_PG_OEM_RESERVED(_name) ,{1UL << PG_##_name, __stringify(_name)} +#else +#define IF_HAVE_PG_OEM_RESERVED(_name) +#endif + #define __def_pageflag_names \ {1UL << PG_locked, "locked" }, \ {1UL << PG_waiters, "waiters" }, \ @@ -132,6 +138,10 @@ IF_HAVE_PG_HWPOISON(PG_hwpoison, "hwpoison" ) \ IF_HAVE_PG_IDLE(PG_young, "young" ) \ IF_HAVE_PG_IDLE(PG_idle, "idle" ) \ IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) \ +IF_HAVE_PG_OEM_RESERVED(oem_reserved_1) \ +IF_HAVE_PG_OEM_RESERVED(oem_reserved_2) \ +IF_HAVE_PG_OEM_RESERVED(oem_reserved_3) \ +IF_HAVE_PG_OEM_RESERVED(oem_reserved_4) \ IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison") #define show_page_flags(flags) \ From 88b8a0c173aadcd330ed6fb63baa372e2cda1c05 Mon Sep 17 00:00:00 2001 From: Xiaofeng Yuan Date: Tue, 25 Jun 2024 19:56:31 +0800 Subject: [PATCH 74/93] ANDROID: vendor_hooks: add hooks to modify pageflags These hooks are designed to set or clear OEM reserved pageflags when the memory state may change. Bug: 336964184 Change-Id: I9cb288ef6eef7a719d4f4748d6b71010645b7d50 Signed-off-by: Xiaofeng Yuan --- drivers/android/vendor_hooks.c | 5 +++++ include/trace/hooks/mm.h | 16 ++++++++++++++++ kernel/events/uprobes.c | 4 ++++ mm/memory.c | 6 ++++++ mm/shmem.c | 1 + 5 files changed, 32 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 12111662e56d..9d4ee2802caf 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -421,6 +421,11 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_read_fault); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_queue_request_and_unlock); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_fuse_request_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_read_trylock_failed); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shmem_swapin_folio); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wp_page); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_swap_page); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_anonymous_page); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_uprobes_replace_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_down_read); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_percpu_rwsem_up_write); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_percpu_rwsem_wait_complete); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index e13159239923..4b0da560a4f0 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -224,6 +224,22 @@ DECLARE_HOOK(android_vh_kmalloc_large_alloced, DECLARE_HOOK(android_vh_tune_fault_around_bytes, TP_PROTO(unsigned long *fault_around_bytes), TP_ARGS(fault_around_bytes)); +DECLARE_HOOK(android_vh_do_anonymous_page, + TP_PROTO(struct vm_area_struct *vma, struct page *page), + TP_ARGS(vma, page)); +DECLARE_HOOK(android_vh_do_swap_page, + TP_PROTO(struct folio *folio, pte_t *pte, struct vm_fault *vmf, + swp_entry_t entry), + TP_ARGS(folio, pte, vmf, entry)); +DECLARE_HOOK(android_vh_do_wp_page, + TP_PROTO(struct folio *folio), + TP_ARGS(folio)); +DECLARE_HOOK(android_vh_uprobes_replace_page, + TP_PROTO(struct folio *new_folio, struct folio *old_folio), + TP_ARGS(new_folio, old_folio)); +DECLARE_HOOK(android_vh_shmem_swapin_folio, + TP_PROTO(struct folio *folio), + TP_ARGS(folio)); #endif /* _TRACE_HOOK_MM_H */ /* This part must be outside protection */ diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index d9e357b7e17c..003cb6cd74aa 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -30,6 +30,9 @@ #include +#undef CREATE_TRACE_POINTS +#include + #define UINSNS_PER_PAGE (PAGE_SIZE/UPROBE_XOL_SLOT_BYTES) #define MAX_UPROBE_XOL_SLOTS UINSNS_PER_PAGE @@ -184,6 +187,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, folio_get(new_folio); page_add_new_anon_rmap(new_page, vma, addr); folio_add_lru_vma(new_folio, vma); + trace_android_vh_uprobes_replace_page(new_folio, old_folio); } else /* no new page, just dec_mm_counter for old_page */ dec_mm_counter(mm, MM_ANONPAGES); diff --git a/mm/memory.c b/mm/memory.c index 68634e96c175..57b9fda3c069 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -82,6 +82,9 @@ #include +#undef CREATE_TRACE_POINTS +#include + #include #include #include @@ -3494,6 +3497,7 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) * not dirty accountable. */ folio = page_folio(vmf->page); + trace_android_vh_do_wp_page(folio); if (folio_test_anon(folio)) { /* * If the page is exclusive to this process we must reuse the @@ -4077,6 +4081,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES); dec_mm_counter_fast(vma->vm_mm, MM_SWAPENTS); pte = mk_pte(page, vma->vm_page_prot); + trace_android_vh_do_swap_page(folio, &pte, vmf, entry); /* * Same logic as in do_wp_page(); however, optimize for pages that are @@ -4232,6 +4237,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) */ __SetPageUptodate(page); + trace_android_vh_do_anonymous_page(vma, page); entry = mk_pte(page, vma->vm_page_prot); entry = pte_sw_mkyoung(entry); if (vma->vm_flags & VM_WRITE) diff --git a/mm/shmem.c b/mm/shmem.c index 1c5a63771012..1bf06946e7a8 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1792,6 +1792,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index, /* We have to do this with folio locked to prevent races */ folio_lock(folio); + trace_android_vh_shmem_swapin_folio(folio); if (!folio_test_swapcache(folio) || folio_swap_entry(folio).val != swap.val || !shmem_confirm_swap(mapping, index, swap)) { From 681c91500cd65f9162d8a50dfe17177dbf190cf7 Mon Sep 17 00:00:00 2001 From: Xiaofeng Yuan Date: Tue, 25 Jun 2024 20:19:10 +0800 Subject: [PATCH 75/93] ANDROID: GKI: Add symbol to symbol list for vivo. 5 function symbol(s) added 'int __traceiter_android_vh_do_anonymous_page(void*, struct vm_area_struct*, struct page*)' 'int __traceiter_android_vh_do_swap_page(void*, struct folio*, pte_t*, struct vm_fault*, swp_entry_t)' 'int __traceiter_android_vh_do_wp_page(void*, struct folio*)' 'int __traceiter_android_vh_shmem_swapin_folio(void*, struct folio*)' 'int __traceiter_android_vh_uprobes_replace_page(void*, struct folio*, struct folio*)' 5 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_do_anonymous_page' 'struct tracepoint __tracepoint_android_vh_do_swap_page' 'struct tracepoint __tracepoint_android_vh_do_wp_page' 'struct tracepoint __tracepoint_android_vh_shmem_swapin_folio' 'struct tracepoint __tracepoint_android_vh_uprobes_replace_page' Bug: 336964184 Change-Id: Ie2364fba2569d2514e77eb4fc450c343d8cd4a94 Signed-off-by: Xiaofeng Yuan --- android/abi_gki_aarch64.stg | 122 +++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 10 +++ 2 files changed, 132 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 801b566e6b2d..717a7bca831f 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -323866,6 +323866,15 @@ function { parameter_id: 0x3e10b518 parameter_id: 0x6720d32f } +function { + id: 0x9b2612dc + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x2170d06d + parameter_id: 0x32bee099 + parameter_id: 0x3360dff4 + parameter_id: 0x27162aac +} function { id: 0x9b263487 return_type_id: 0x6720d32f @@ -323920,6 +323929,12 @@ function { parameter_id: 0x27162aac parameter_id: 0x6720d32f } +function { + id: 0x9b2a7922 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x2170d06d +} function { id: 0x9b2aae3f return_type_id: 0x6720d32f @@ -325436,6 +325451,13 @@ function { parameter_id: 0x1bf16028 parameter_id: 0x29f042bf } +function { + id: 0x9b8657b1 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x0a134144 + parameter_id: 0x06835e9c +} function { id: 0x9b8743c4 return_type_id: 0x6720d32f @@ -344619,6 +344641,15 @@ elf_symbol { type_id: 0x9b661c0a full_name: "__traceiter_android_vh_dm_bufio_shrink_scan_bypass" } +elf_symbol { + id: 0x5e9ed424 + name: "__traceiter_android_vh_do_anonymous_page" + is_defined: true + symbol_type: FUNCTION + crc: 0xad36669c + type_id: 0x9b8657b1 + full_name: "__traceiter_android_vh_do_anonymous_page" +} elf_symbol { id: 0xd593b3ef name: "__traceiter_android_vh_do_futex" @@ -344646,6 +344677,15 @@ elf_symbol { type_id: 0x9b3c0938 full_name: "__traceiter_android_vh_do_shrink_slab" } +elf_symbol { + id: 0x54bc5972 + name: "__traceiter_android_vh_do_swap_page" + is_defined: true + symbol_type: FUNCTION + crc: 0x08a3d6cf + type_id: 0x9b2612dc + full_name: "__traceiter_android_vh_do_swap_page" +} elf_symbol { id: 0x9dbd7b92 name: "__traceiter_android_vh_do_wake_up_sync" @@ -344655,6 +344695,15 @@ elf_symbol { type_id: 0x9bf7b86e full_name: "__traceiter_android_vh_do_wake_up_sync" } +elf_symbol { + id: 0x2576f1c7 + name: "__traceiter_android_vh_do_wp_page" + is_defined: true + symbol_type: FUNCTION + crc: 0x2ab96426 + type_id: 0x9b2a7922 + full_name: "__traceiter_android_vh_do_wp_page" +} elf_symbol { id: 0x42312ccc name: "__traceiter_android_vh_dump_throttled_rt_tasks" @@ -345960,6 +346009,15 @@ elf_symbol { type_id: 0x9b42dae7 full_name: "__traceiter_android_vh_sha256" } +elf_symbol { + id: 0x70e34072 + name: "__traceiter_android_vh_shmem_swapin_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0x1dd6852d + type_id: 0x9b2a7922 + full_name: "__traceiter_android_vh_shmem_swapin_folio" +} elf_symbol { id: 0x53263f73 name: "__traceiter_android_vh_should_alloc_pages_retry" @@ -346437,6 +346495,15 @@ elf_symbol { type_id: 0x9bcd4ff7 full_name: "__traceiter_android_vh_update_topology_flags_workfn" } +elf_symbol { + id: 0x0266a7bc + name: "__traceiter_android_vh_uprobes_replace_page" + is_defined: true + symbol_type: FUNCTION + crc: 0xcfef8a41 + type_id: 0x9b222516 + full_name: "__traceiter_android_vh_uprobes_replace_page" +} elf_symbol { id: 0xd0e4682b name: "__traceiter_android_vh_usb_dev_resume" @@ -349047,6 +349114,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_dm_bufio_shrink_scan_bypass" } +elf_symbol { + id: 0x325e746a + name: "__tracepoint_android_vh_do_anonymous_page" + is_defined: true + symbol_type: OBJECT + crc: 0x971a6b77 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_do_anonymous_page" +} elf_symbol { id: 0x9fe99d05 name: "__tracepoint_android_vh_do_futex" @@ -349074,6 +349150,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_do_shrink_slab" } +elf_symbol { + id: 0xeb9f1c78 + name: "__tracepoint_android_vh_do_swap_page" + is_defined: true + symbol_type: OBJECT + crc: 0x319f64d9 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_do_swap_page" +} elf_symbol { id: 0xe2d7542c name: "__tracepoint_android_vh_do_wake_up_sync" @@ -349083,6 +349168,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_do_wake_up_sync" } +elf_symbol { + id: 0x15374b6d + name: "__tracepoint_android_vh_do_wp_page" + is_defined: true + symbol_type: OBJECT + crc: 0xed1c0eea + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_do_wp_page" +} elf_symbol { id: 0x988719fa name: "__tracepoint_android_vh_dump_throttled_rt_tasks" @@ -350388,6 +350482,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_sha256" } +elf_symbol { + id: 0x6ed615c4 + name: "__tracepoint_android_vh_shmem_swapin_folio" + is_defined: true + symbol_type: OBJECT + crc: 0xd1f79933 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_shmem_swapin_folio" +} elf_symbol { id: 0xd860c719 name: "__tracepoint_android_vh_should_alloc_pages_retry" @@ -350865,6 +350968,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_update_topology_flags_workfn" } +elf_symbol { + id: 0x7d0336a2 + name: "__tracepoint_android_vh_uprobes_replace_page" + is_defined: true + symbol_type: OBJECT + crc: 0xb0c9132a + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_uprobes_replace_page" +} elf_symbol { id: 0x990b2371 name: "__tracepoint_android_vh_usb_dev_resume" @@ -411574,10 +411686,13 @@ interface { symbol_id: 0x9f47ed94 symbol_id: 0x0bf2f5bb symbol_id: 0x5c382938 + symbol_id: 0x5e9ed424 symbol_id: 0xd593b3ef symbol_id: 0x1cc3aec5 symbol_id: 0xb12728da + symbol_id: 0x54bc5972 symbol_id: 0x9dbd7b92 + symbol_id: 0x2576f1c7 symbol_id: 0x42312ccc symbol_id: 0xf432d1c9 symbol_id: 0x02c8f91b @@ -411723,6 +411838,7 @@ interface { symbol_id: 0xaa3f6a65 symbol_id: 0xa2fe718f symbol_id: 0x98a943de + symbol_id: 0x70e34072 symbol_id: 0x53263f73 symbol_id: 0xe828d15b symbol_id: 0x4d31a413 @@ -411776,6 +411892,7 @@ interface { symbol_id: 0xcb4d15f3 symbol_id: 0x46e1dbde symbol_id: 0x6a8145ff + symbol_id: 0x0266a7bc symbol_id: 0xd0e4682b symbol_id: 0x08824ed3 symbol_id: 0xcbec9d66 @@ -412066,10 +412183,13 @@ interface { symbol_id: 0xc44d61e6 symbol_id: 0x1ddb60ad symbol_id: 0x0ae2ee16 + symbol_id: 0x325e746a symbol_id: 0x9fe99d05 symbol_id: 0x82ce823f symbol_id: 0x474d211c + symbol_id: 0xeb9f1c78 symbol_id: 0xe2d7542c + symbol_id: 0x15374b6d symbol_id: 0x988719fa symbol_id: 0x732a182b symbol_id: 0xe5deb919 @@ -412215,6 +412335,7 @@ interface { symbol_id: 0xd7ceb15f symbol_id: 0x923147c1 symbol_id: 0x5cfdecb8 + symbol_id: 0x6ed615c4 symbol_id: 0xd860c719 symbol_id: 0x5b6bc3a9 symbol_id: 0x823654f5 @@ -412268,6 +412389,7 @@ interface { symbol_id: 0x743ea36d symbol_id: 0xd309f564 symbol_id: 0xc09d36c9 + symbol_id: 0x7d0336a2 symbol_id: 0x990b2371 symbol_id: 0xe100c3ad symbol_id: 0x55476a7c diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index a081f1912994..00b99700014f 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -388,7 +388,10 @@ __traceiter_android_vh_cpuidle_psci_enter __traceiter_android_vh_cpuidle_psci_exit __traceiter_android_vh_disable_thermal_cooling_stats + __traceiter_android_vh_do_anonymous_page + __traceiter_android_vh_do_swap_page __traceiter_android_vh_do_wake_up_sync + __traceiter_android_vh_do_wp_page __traceiter_android_vh_dump_throttled_rt_tasks __traceiter_android_vh_free_task __traceiter_android_vh_ftrace_dump_buffer @@ -421,6 +424,7 @@ __traceiter_android_vh_sched_show_task __traceiter_android_vh_scheduler_tick __traceiter_android_vh_setscheduler_uclamp + __traceiter_android_vh_shmem_swapin_folio __traceiter_android_vh_show_resume_epoch_val __traceiter_android_vh_show_suspend_epoch_val __traceiter_android_vh_sysrq_crash @@ -440,6 +444,7 @@ __traceiter_android_vh_ufs_update_sdev __traceiter_android_vh_ufs_update_sysfs __traceiter_android_vh_update_topology_flags_workfn + __traceiter_android_vh_uprobes_replace_page __traceiter_android_vh_watchdog_timer_softlockup __traceiter_binder_transaction_received __traceiter_block_rq_insert @@ -568,7 +573,10 @@ __tracepoint_android_vh_cpuidle_psci_enter __tracepoint_android_vh_cpuidle_psci_exit __tracepoint_android_vh_disable_thermal_cooling_stats + __tracepoint_android_vh_do_anonymous_page + __tracepoint_android_vh_do_swap_page __tracepoint_android_vh_do_wake_up_sync + __tracepoint_android_vh_do_wp_page __tracepoint_android_vh_dump_throttled_rt_tasks __tracepoint_android_vh_free_task __tracepoint_android_vh_ftrace_dump_buffer @@ -601,6 +609,7 @@ __tracepoint_android_vh_sched_show_task __tracepoint_android_vh_scheduler_tick __tracepoint_android_vh_setscheduler_uclamp + __tracepoint_android_vh_shmem_swapin_folio __tracepoint_android_vh_show_resume_epoch_val __tracepoint_android_vh_show_suspend_epoch_val __tracepoint_android_vh_sysrq_crash @@ -620,6 +629,7 @@ __tracepoint_android_vh_ufs_update_sdev __tracepoint_android_vh_ufs_update_sysfs __tracepoint_android_vh_update_topology_flags_workfn + __tracepoint_android_vh_uprobes_replace_page __tracepoint_android_vh_watchdog_timer_softlockup __tracepoint_binder_transaction_received __tracepoint_block_rq_insert From 7682e638eb1783903a292dadc73184ec2fc22474 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 26 Jun 2024 21:45:11 +0000 Subject: [PATCH 76/93] ANDROID: fips140: remove unnecessary no_sanitize(cfi) gcc segfaults when compiling fips140-module.c because it doesn't like __attribute__((__no_sanitize__("cfi"))) on fips140_init(). But since Linux's CFI now uses the kcfi sanitizer instead of cfi, this no attribute longer did anything anyway. Remove it. fips140_init() does work with kcfi, though this relies on the initcall function pointers being typed correctly. They were correct, but for futureproofing also make it use initcall_t from . Bug: 349612732 Change-Id: Ic5cfaef177b58abf21f1737579d75b4df4d0d09c Signed-off-by: Eric Biggers --- crypto/fips140-module.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/crypto/fips140-module.c b/crypto/fips140-module.c index 3886b3cce62b..06d87a3b323b 100644 --- a/crypto/fips140-module.c +++ b/crypto/fips140-module.c @@ -581,18 +581,8 @@ static bool update_fips140_library_routines(void) return ret == 0; } -/* - * Initialize the FIPS 140 module. - * - * Note: this routine iterates over the contents of the initcall section, which - * consists of an array of function pointers that was emitted by the linker - * rather than the compiler. This means that these function pointers lack the - * usual CFI stubs that the compiler emits when CFI codegen is enabled. So - * let's disable CFI locally when handling the initcall array, to avoid - * surpises. - */ -static int __init __attribute__((__no_sanitize__("cfi"))) -fips140_init(void) +/* Initialize the FIPS 140 module */ +static int __init fips140_init(void) { const u32 *initcall; @@ -605,7 +595,7 @@ fips140_init(void) for (initcall = __initcall_start + 1; initcall < &__initcall_end_marker; initcall++) { - int (*init)(void) = offset_to_ptr(initcall); + initcall_t init = offset_to_ptr(initcall); int err = init(); /* From 6aaa06c15d9bf60c96547384e17198c13c87c646 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Fri, 5 Apr 2024 11:05:16 -0700 Subject: [PATCH 77/93] FROMLIST: locking/rwsem: Add __always_inline annotation to __down_write_common() and inlined callers Apparently despite it being marked inline, the compiler may not inline __down_write_common() which makes it difficult to identify the cause of lock contention, as the wchan of the blocked function will always be listed as __down_write_common(). So add __always_inline annotation to the common function (as well as the inlined helper callers) to force it to be inlined so a more useful blocking function will be listed (via wchan). This mirrors commit 92cc5d00a431 ("locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers") which did the same for __down_read_common. I sort of worry that I'm playing wack-a-mole here, and talking with compiler people, they tell me inline means nothing, which makes me want to cry a little. So I'm wondering if we need to replace all the inlines with __always_inline, or remove them because either we mean something by it, or not. Cc: Tim Murray Cc: Nick Desaulniers Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: kernel-team@android.com Fixes: c995e638ccbb ("locking/rwsem: Fold __down_{read,write}*()") Reported-by: Tim Murray Acked-by: Waiman Long Change-Id: I72b273149577b8125ea3a5053befbd5cf66bf8ad Signed-off-by: John Stultz Link: https://lore.kernel.org/lkml/20240620174204.1802235-1-jstultz@google.com/ Bug: 332722989 --- v2: * Add ack tags & minor tweaks to commit message --- kernel/locking/rwsem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index 98ee3906ee8a..15ebac9c85fb 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -1385,7 +1385,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) /* * lock for writing */ -static inline int __down_write_common(struct rw_semaphore *sem, int state) +static __always_inline int __down_write_common(struct rw_semaphore *sem, int state) { if (unlikely(!rwsem_write_trylock(sem))) { if (IS_ERR(rwsem_down_write_slowpath(sem, state))) @@ -1395,12 +1395,12 @@ static inline int __down_write_common(struct rw_semaphore *sem, int state) return 0; } -static inline void __down_write(struct rw_semaphore *sem) +static __always_inline void __down_write(struct rw_semaphore *sem) { __down_write_common(sem, TASK_UNINTERRUPTIBLE); } -static inline int __down_write_killable(struct rw_semaphore *sem) +static __always_inline int __down_write_killable(struct rw_semaphore *sem) { return __down_write_common(sem, TASK_KILLABLE); } From a1926c3f2b72e53335c71d36a0670aceba8ddcca Mon Sep 17 00:00:00 2001 From: Anton Altaparmakov Date: Fri, 28 Jun 2024 21:08:17 +0100 Subject: [PATCH 78/93] ANDROID: GKI: Extend Tuxera symbol list This list covers Tuxera HFS+ file system driver. 16 function symbol(s) added 'int _atomic_dec_and_lock(atomic_t*, spinlock_t*)' 'int blkdev_issue_zeroout(struct block_device*, sector_t, sector_t, gfp_t, unsigned int)' 'int cont_write_begin(struct file*, struct address_space*, loff_t, unsigned int, struct page**, void**, get_block_t*, loff_t*)' 'void fileattr_fill_flags(struct fileattr*, u32)' 'bool filemap_release_folio(struct folio*, gfp_t)' 'int generic_cont_expand_simple(struct inode*, loff_t)' 'struct inode* iget_locked(struct super_block*, unsigned long)' 'void inode_add_bytes(struct inode*, loff_t)' 'struct timespec64 inode_set_ctime_current(struct inode*)' 'int match_octal(substring_t*, int*)' 'char* match_strdup(const substring_t*)' 'int migrate_folio(struct address_space*, struct folio*, struct folio*, enum migrate_mode)' 'const char* page_get_link(struct dentry*, struct inode*, struct delayed_call*)' 'int page_symlink(struct inode*, const char*, int)' 'bool try_to_free_buffers(struct folio*)' 'int utf32_to_utf8(unicode_t, u8*, int)' 1 variable symbol(s) added 'unsigned int dirty_writeback_interval' Bug: 349994203 Change-Id: Idd44e7c08a223772312d63a0c814616361b15437 Signed-off-by: Anton Altaparmakov --- android/abi_gki_aarch64.stg | 238 +++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_tuxera | 27 ++++ 2 files changed, 265 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 717a7bca831f..e3dcae824609 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -27988,6 +27988,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xc71311d1 } +pointer_reference { + id: 0x3b5513a7 + kind: POINTER + pointee_type_id: 0xc714a800 +} pointer_reference { id: 0x3b55ca81 kind: POINTER @@ -32698,6 +32703,11 @@ qualified { qualifier: CONST qualified_type_id: 0x6bab1e44 } +qualified { + id: 0xc714a800 + qualifier: CONST + qualified_type_id: 0x6c15168b +} qualified { id: 0xc717cc99 qualifier: CONST @@ -299664,6 +299674,12 @@ function { parameter_id: 0x3e10b518 parameter_id: 0x1b44744f } +function { + id: 0x18bf3935 + return_type_id: 0x48b5725f + parameter_id: 0x2c0d2028 + parameter_id: 0xc9082b19 +} function { id: 0x18c46588 return_type_id: 0x48b5725f @@ -305521,6 +305537,11 @@ function { return_type_id: 0x17dabdcd parameter_id: 0xc93e017b } +function { + id: 0x30eb4522 + return_type_id: 0x0483e6f8 + parameter_id: 0x3b5513a7 +} function { id: 0x30f59213 return_type_id: 0x33756485 @@ -320484,6 +320505,12 @@ function { return_type_id: 0x3e10b518 parameter_id: 0x2bae2afe } +function { + id: 0x98b09788 + return_type_id: 0x6720d32f + parameter_id: 0x17a49e9b + parameter_id: 0x3654c061 +} function { id: 0x98b3c900 return_type_id: 0x6720d32f @@ -325351,6 +325378,13 @@ function { parameter_id: 0x14b9453b parameter_id: 0xf435685e } +function { + id: 0x9b800de5 + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x3e10b518 + parameter_id: 0x6720d32f +} function { id: 0x9b8019c6 return_type_id: 0x6720d32f @@ -327527,6 +327561,18 @@ function { parameter_id: 0x0b30ee00 parameter_id: 0x0cbf60eb } +function { + id: 0x9be48e2a + return_type_id: 0x6720d32f + parameter_id: 0x18ea6ae3 + parameter_id: 0x1582ab06 + parameter_id: 0x27a7c613 + parameter_id: 0x4585663f + parameter_id: 0x0b30ee00 + parameter_id: 0x0cbf60eb + parameter_id: 0x2cacacc0 + parameter_id: 0x0379c823 +} function { id: 0x9be49da2 return_type_id: 0x6720d32f @@ -327817,6 +327863,12 @@ function { parameter_id: 0x6720d32f parameter_id: 0x6720d32f } +function { + id: 0x9bff181d + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x27a7c613 +} function { id: 0x9bff5408 return_type_id: 0x6720d32f @@ -331396,6 +331448,15 @@ function { parameter_id: 0xf1a6dfed parameter_id: 0x0ff8f9af } +function { + id: 0x9dfe50e2 + return_type_id: 0x6720d32f + parameter_id: 0x0c2e195c + parameter_id: 0xd0b3a203 + parameter_id: 0xd0b3a203 + parameter_id: 0xf1a6dfed + parameter_id: 0x4585663f +} function { id: 0x9dff0bbb return_type_id: 0x6720d32f @@ -332109,6 +332170,13 @@ function { parameter_id: 0x33e53462 parameter_id: 0x4585663f } +function { + id: 0x9e76c5ad + return_type_id: 0x6720d32f + parameter_id: 0x0fb3c889 + parameter_id: 0x00c72527 + parameter_id: 0x6720d32f +} function { id: 0x9e789129 return_type_id: 0x6720d32f @@ -351985,6 +352053,15 @@ elf_symbol { type_id: 0x10605221 full_name: "__xfrm_state_destroy" } +elf_symbol { + id: 0x70022f4d + name: "_atomic_dec_and_lock" + is_defined: true + symbol_type: FUNCTION + crc: 0xcf4fdd4d + type_id: 0x98b09788 + full_name: "_atomic_dec_and_lock" +} elf_symbol { id: 0xda249832 name: "_bcd2bin" @@ -354584,6 +354661,15 @@ elf_symbol { type_id: 0x9e8b6578 full_name: "blkdev_issue_flush" } +elf_symbol { + id: 0x8c705d8e + name: "blkdev_issue_zeroout" + is_defined: true + symbol_type: FUNCTION + crc: 0x6df92619 + type_id: 0x9dfe50e2 + full_name: "blkdev_issue_zeroout" +} elf_symbol { id: 0x57e1cd01 name: "blkdev_put" @@ -357415,6 +357501,15 @@ elf_symbol { type_id: 0x11cb8bd5 full_name: "consume_skb" } +elf_symbol { + id: 0x2a36ed7a + name: "cont_write_begin" + is_defined: true + symbol_type: FUNCTION + crc: 0xea89523c + type_id: 0x9be48e2a + full_name: "cont_write_begin" +} elf_symbol { id: 0x9e7d8d76 name: "contig_page_data" @@ -363045,6 +363140,15 @@ elf_symbol { type_id: 0x106c9a5c full_name: "devres_remove_group" } +elf_symbol { + id: 0x6bac3701 + name: "dirty_writeback_interval" + is_defined: true + symbol_type: OBJECT + crc: 0x41814cb8 + type_id: 0x4585663f + full_name: "dirty_writeback_interval" +} elf_symbol { id: 0x30dd6796 name: "disable_hardirq" @@ -369671,6 +369775,15 @@ elf_symbol { type_id: 0x9b2d0f7e full_name: "file_write_and_wait_range" } +elf_symbol { + id: 0x5b67fea4 + name: "fileattr_fill_flags" + is_defined: true + symbol_type: FUNCTION + crc: 0x9c86b9ab + type_id: 0x18bf3935 + full_name: "fileattr_fill_flags" +} elf_symbol { id: 0xbe28ee32 name: "filemap_add_folio" @@ -369752,6 +369865,15 @@ elf_symbol { type_id: 0xce25f646 full_name: "filemap_map_pages" } +elf_symbol { + id: 0xa307bbf4 + name: "filemap_release_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0x3f3e2f5f + type_id: 0xf53ef460 + full_name: "filemap_release_folio" +} elf_symbol { id: 0xc7c68a05 name: "filemap_write_and_wait_range" @@ -370958,6 +371080,15 @@ elf_symbol { type_id: 0xaf2275d4 full_name: "generic_block_bmap" } +elf_symbol { + id: 0xc5e4d583 + name: "generic_cont_expand_simple" + is_defined: true + symbol_type: FUNCTION + crc: 0x82f19601 + type_id: 0x9bff181d + full_name: "generic_cont_expand_simple" +} elf_symbol { id: 0x1b6a5b31 name: "generic_copy_file_range" @@ -374849,6 +374980,15 @@ elf_symbol { type_id: 0x167935b9 full_name: "iget_failed" } +elf_symbol { + id: 0xeff109db + name: "iget_locked" + is_defined: true + symbol_type: FUNCTION + crc: 0x2c29b448 + type_id: 0x121b62af + full_name: "iget_locked" +} elf_symbol { id: 0x4a5f3d41 name: "ignore_console_lock_warning" @@ -375605,6 +375745,15 @@ elf_symbol { type_id: 0x1378736d full_name: "init_wait_var_entry" } +elf_symbol { + id: 0x77f61a26 + name: "inode_add_bytes" + is_defined: true + symbol_type: FUNCTION + crc: 0x60c8da80 + type_id: 0x16e7aaa1 + full_name: "inode_add_bytes" +} elf_symbol { id: 0x7a805e08 name: "inode_dio_wait" @@ -375686,6 +375835,15 @@ elf_symbol { type_id: 0x16e7aaa1 full_name: "inode_set_bytes" } +elf_symbol { + id: 0x90d2e1dd + name: "inode_set_ctime_current" + is_defined: true + symbol_type: FUNCTION + crc: 0x36689e12 + type_id: 0xb166862a + full_name: "inode_set_ctime_current" +} elf_symbol { id: 0x2b7e86c2 name: "inode_set_flags" @@ -380160,6 +380318,24 @@ elf_symbol { type_id: 0x99a8dc1b full_name: "match_int" } +elf_symbol { + id: 0xf5708e8d + name: "match_octal" + is_defined: true + symbol_type: FUNCTION + crc: 0x815b5dd4 + type_id: 0x99a8dc1b + full_name: "match_octal" +} +elf_symbol { + id: 0x44791e62 + name: "match_strdup" + is_defined: true + symbol_type: FUNCTION + crc: 0xacf4d843 + type_id: 0x30eb4522 + full_name: "match_strdup" +} elf_symbol { id: 0x97e555df name: "match_string" @@ -380966,6 +381142,15 @@ elf_symbol { type_id: 0x100e6fc8 full_name: "mfd_remove_devices" } +elf_symbol { + id: 0x99c9c9c0 + name: "migrate_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0xaf4584aa + type_id: 0x986ccce1 + full_name: "migrate_folio" +} elf_symbol { id: 0x89c6398f name: "migrate_pages" @@ -385234,6 +385419,15 @@ elf_symbol { type_id: 0x16b708df full_name: "page_frag_free" } +elf_symbol { + id: 0xbf668081 + name: "page_get_link" + is_defined: true + symbol_type: FUNCTION + crc: 0x8e25e14e + type_id: 0x96a3f292 + full_name: "page_get_link" +} elf_symbol { id: 0xc2b69854 name: "page_is_ram" @@ -385352,6 +385546,15 @@ elf_symbol { type_id: 0x19658c89 full_name: "page_reporting_unregister" } +elf_symbol { + id: 0xb681e6bc + name: "page_symlink" + is_defined: true + symbol_type: FUNCTION + crc: 0x72ad9fb8 + type_id: 0x9b800de5 + full_name: "page_symlink" +} elf_symbol { id: 0x4271852e name: "page_zero_new_buffers" @@ -402078,6 +402281,15 @@ elf_symbol { type_id: 0x920d63ce full_name: "try_to_del_timer_sync" } +elf_symbol { + id: 0x68605044 + name: "try_to_free_buffers" + is_defined: true + symbol_type: FUNCTION + crc: 0xdb7a9cae + type_id: 0xf6f86f1f + full_name: "try_to_free_buffers" +} elf_symbol { id: 0x8814f5b8 name: "try_to_free_mem_cgroup_pages" @@ -406785,6 +406997,15 @@ elf_symbol { type_id: 0x937ab4d8 full_name: "utf16s_to_utf8s" } +elf_symbol { + id: 0xb058e6a6 + name: "utf32_to_utf8" + is_defined: true + symbol_type: FUNCTION + crc: 0x2875a315 + type_id: 0x9e76c5ad + full_name: "utf32_to_utf8" +} elf_symbol { id: 0xa459c02b name: "utf8_data_table" @@ -412502,6 +412723,7 @@ interface { symbol_id: 0x52069d2d symbol_id: 0x640280c1 symbol_id: 0xb3b57b4d + symbol_id: 0x70022f4d symbol_id: 0xda249832 symbol_id: 0x206fe2ef symbol_id: 0x5693f2df @@ -412791,6 +413013,7 @@ interface { symbol_id: 0xc0201123 symbol_id: 0x4d722bb5 symbol_id: 0x2a322266 + symbol_id: 0x8c705d8e symbol_id: 0x57e1cd01 symbol_id: 0xf0581d11 symbol_id: 0x35eb35db @@ -413106,6 +413329,7 @@ interface { symbol_id: 0x5a70b6f0 symbol_id: 0x06f42cb2 symbol_id: 0xca337eb1 + symbol_id: 0x2a36ed7a symbol_id: 0x9e7d8d76 symbol_id: 0x610edc84 symbol_id: 0xd71898b4 @@ -413732,6 +413956,7 @@ interface { symbol_id: 0xabe60a33 symbol_id: 0x7ae5eeb4 symbol_id: 0x317870a4 + symbol_id: 0x6bac3701 symbol_id: 0x30dd6796 symbol_id: 0x573e2956 symbol_id: 0xe5bfa8c8 @@ -414466,6 +414691,7 @@ interface { symbol_id: 0x99b0f07b symbol_id: 0xffbe24f4 symbol_id: 0x46b6e531 + symbol_id: 0x5b67fea4 symbol_id: 0xbe28ee32 symbol_id: 0x4927c9f3 symbol_id: 0x50a5072e @@ -414475,6 +414701,7 @@ interface { symbol_id: 0x7c937fc2 symbol_id: 0xa6f98003 symbol_id: 0x70cbb212 + symbol_id: 0xa307bbf4 symbol_id: 0xc7c68a05 symbol_id: 0xb9dc79d0 symbol_id: 0x8bbdb127 @@ -414609,6 +414836,7 @@ interface { symbol_id: 0xb7f431e8 symbol_id: 0x69ea6230 symbol_id: 0x0c22ac35 + symbol_id: 0xc5e4d583 symbol_id: 0x1b6a5b31 symbol_id: 0x30828743 symbol_id: 0xe21d8d05 @@ -415041,6 +415269,7 @@ interface { symbol_id: 0x841218b7 symbol_id: 0xb9f64e9d symbol_id: 0x3477c5c1 + symbol_id: 0xeff109db symbol_id: 0x4a5f3d41 symbol_id: 0x4292b79d symbol_id: 0xb779176d @@ -415125,6 +415354,7 @@ interface { symbol_id: 0x5eecacc4 symbol_id: 0x215b5641 symbol_id: 0xbf6470f2 + symbol_id: 0x77f61a26 symbol_id: 0x7a805e08 symbol_id: 0xf7ff5427 symbol_id: 0x318d9226 @@ -415134,6 +415364,7 @@ interface { symbol_id: 0xf4ae7c22 symbol_id: 0x4ff0f410 symbol_id: 0x1bb1212e + symbol_id: 0x90d2e1dd symbol_id: 0x2b7e86c2 symbol_id: 0x471295fc symbol_id: 0x18eeb52f @@ -415631,6 +415862,8 @@ interface { symbol_id: 0x602510fe symbol_id: 0x304a5133 symbol_id: 0xcc9bd833 + symbol_id: 0xf5708e8d + symbol_id: 0x44791e62 symbol_id: 0x97e555df symbol_id: 0x61c53930 symbol_id: 0xfe698851 @@ -415721,6 +415954,7 @@ interface { symbol_id: 0xbc9af04b symbol_id: 0x78495fd8 symbol_id: 0xa208d2dc + symbol_id: 0x99c9c9c0 symbol_id: 0x89c6398f symbol_id: 0xbad16ab3 symbol_id: 0x68c3a63b @@ -416195,6 +416429,7 @@ interface { symbol_id: 0xff029108 symbol_id: 0xd723c668 symbol_id: 0x13dfcd3d + symbol_id: 0xbf668081 symbol_id: 0xc2b69854 symbol_id: 0x4f3e5356 symbol_id: 0x8cc91d1b @@ -416208,6 +416443,7 @@ interface { symbol_id: 0x3c537500 symbol_id: 0x1b814fa6 symbol_id: 0x9ca2e070 + symbol_id: 0xb681e6bc symbol_id: 0x4271852e symbol_id: 0x0fe80546 symbol_id: 0x9b003f99 @@ -418067,6 +418303,7 @@ interface { symbol_id: 0x44cd0751 symbol_id: 0x3d986fb5 symbol_id: 0x2f855953 + symbol_id: 0x68605044 symbol_id: 0x8814f5b8 symbol_id: 0x8fa1e478 symbol_id: 0xe54aec5b @@ -418590,6 +418827,7 @@ interface { symbol_id: 0x22e80038 symbol_id: 0xb5437ef4 symbol_id: 0x1473720a + symbol_id: 0xb058e6a6 symbol_id: 0xa459c02b symbol_id: 0x4b0dcba7 symbol_id: 0xa040d5a9 diff --git a/android/abi_gki_aarch64_tuxera b/android/abi_gki_aarch64_tuxera index cbffd3f1685f..f72f916bd48d 100644 --- a/android/abi_gki_aarch64_tuxera +++ b/android/abi_gki_aarch64_tuxera @@ -2,6 +2,7 @@ alt_cb_patch_nops __arch_copy_from_user __arch_copy_to_user + _atomic_dec_and_lock autoremove_wake_function balance_dirty_pages_ratelimited bcmp @@ -14,12 +15,14 @@ bit_waitqueue blkdev_issue_discard blkdev_issue_flush + blkdev_issue_zeroout blk_finish_plug blk_start_plug __blockdev_direct_IO block_dirty_folio block_invalidate_folio block_is_partially_uptodate + block_write_full_page __breadahead __bread_gfp __brelse @@ -30,8 +33,10 @@ __check_object_size clean_bdev_aliases clear_inode + clear_nlink clear_page clear_page_dirty_for_io + cont_write_begin copy_page_from_iter_atomic cpu_hwcaps create_empty_buffers @@ -39,6 +44,7 @@ d_add d_add_ci d_instantiate + dirty_writeback_interval d_make_root d_obtain_alias down_read @@ -57,6 +63,7 @@ fget fiemap_fill_next_extent fiemap_prep + fileattr_fill_flags file_check_and_advance_wb_err filemap_add_folio filemap_dirty_folio @@ -65,6 +72,7 @@ filemap_fdatawrite filemap_fdatawrite_range filemap_flush + filemap_release_folio __filemap_set_wb_err filemap_write_and_wait_range file_remove_privs @@ -83,6 +91,7 @@ freezer_active freezing_slow_path fs_bio_set + generic_cont_expand_simple generic_error_remove_page generic_file_direct_write generic_file_llseek @@ -90,14 +99,17 @@ generic_file_open generic_file_read_iter generic_file_splice_read + generic_file_write_iter generic_fillattr generic_perform_write generic_read_dir generic_write_checks + generic_write_end __getblk_gfp gic_nonsecure_priorities grab_cache_page_write_begin iget5_locked + iget_locked igrab ihold ilookup5 @@ -107,11 +119,15 @@ init_special_inode init_wait_entry __init_waitqueue_head + inode_add_bytes inode_dio_wait + inode_get_bytes inode_init_once inode_init_owner inode_maybe_inc_iversion inode_newsize_ok + inode_set_bytes + inode_set_ctime_current inode_set_flags __insert_inode_hash invalidate_bdev @@ -158,16 +174,20 @@ mark_buffer_write_io_error __mark_inode_dirty mark_page_accessed + match_octal + match_strdup memcmp memcpy memmove memset + migrate_folio mktime64 mnt_drop_write_file mnt_want_write_file mount_bdev mpage_readahead mpage_read_folio + mpage_writepages __msecs_to_jiffies __mutex_init mutex_lock @@ -178,8 +198,10 @@ pagecache_get_page page_cache_next_miss page_cache_prev_miss + page_get_link page_pinner_inited __page_pinner_put_page + page_symlink pagevec_lookup_range_tag __pagevec_release page_zero_new_buffers @@ -217,7 +239,9 @@ schedule_timeout schedule_timeout_interruptible security_inode_init_security + seq_escape_mem seq_printf + setattr_copy setattr_prepare set_freezable set_nlink @@ -257,6 +281,7 @@ truncate_inode_pages_final truncate_pagecache truncate_setsize + try_to_free_buffers try_to_writeback_inodes_sb unload_nls unlock_buffer @@ -265,6 +290,8 @@ unregister_filesystem up_read up_write + utf32_to_utf8 + utf8_to_utf32 vfree vfs_fsync_range __vmalloc From 8bffcfee7a34f8cc207e7bb9455606fb12d6cd3f Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Wed, 6 Dec 2023 10:00:43 +0100 Subject: [PATCH 79/93] UPSTREAM: sched/fair: Use all little CPUs for CPU-bound workloads Running N CPU-bound tasks on an N CPUs platform: - with asymmetric CPU capacity - not being a DynamIq system (i.e. having a PKG level sched domain without the SD_SHARE_PKG_RESOURCES flag set) .. might result in a task placement where two tasks run on a big CPU and none on a little CPU. This placement could be more optimal by using all CPUs. Testing platform: Juno-r2: - 2 big CPUs (1-2), maximum capacity of 1024 - 4 little CPUs (0,3-5), maximum capacity of 383 Testing workload ([1]): Spawn 6 CPU-bound tasks. During the first 100ms (step 1), each tasks is affine to a CPU, except for: - one little CPU which is left idle. - one big CPU which has 2 tasks affine. After the 100ms (step 2), remove the cpumask affinity. Behavior before the patch: During step 2, the load balancer running from the idle CPU tags sched domains as: - little CPUs: 'group_has_spare'. Cf. group_has_capacity() and group_is_overloaded(), 3 CPU-bound tasks run on a 4 CPUs sched-domain, and the idle CPU provides enough spare capacity regarding the imbalance_pct - big CPUs: 'group_overloaded'. Indeed, 3 tasks run on a 2 CPUs sched-domain, so the following path is used: group_is_overloaded() \-if (sgs->sum_nr_running <= sgs->group_weight) return true; The following path which would change the migration type to 'migrate_task' is not taken: calculate_imbalance() \-if (env->idle != CPU_NOT_IDLE && env->imbalance == 0) as the local group has some spare capacity, so the imbalance is not 0. The migration type requested is 'migrate_util' and the busiest runqueue is the big CPU's runqueue having 2 tasks (each having a utilization of 512). The idle little CPU cannot pull one of these task as its capacity is too small for the task. The following path is used: detach_tasks() \-case migrate_util: \-if (util > env->imbalance) goto next; After the patch: As the number of failed balancing attempts grows (with 'nr_balance_failed'), progressively make it easier to migrate a big task to the idling little CPU. A similar mechanism is used for the 'migrate_load' migration type. Improvement: Running the testing workload [1] with the step 2 representing a ~10s load for a big CPU: Before patch: ~19.3s After patch: ~18s (-6.7%) Similar issue reported at: https://lore.kernel.org/lkml/20230716014125.139577-1-qyousef@layalina.io/ Suggested-by: Vincent Guittot Signed-off-by: Pierre Gondois Signed-off-by: Ingo Molnar Reviewed-by: Vincent Guittot Reviewed-by: Dietmar Eggemann Acked-by: Qais Yousef Link: https://lore.kernel.org/r/20231206090043.634697-1-pierre.gondois@arm.com (cherry picked from commit 3af7524b14198f5159a86692d57a9f28ec9375ce) Change-Id: I916aa7e56af6addf0eb3a78ec77119324172d9d9 Signed-off-by: John Stultz --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3eeb4e7db055..a1d5157a57c4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8626,7 +8626,7 @@ static int detach_tasks(struct lb_env *env) case migrate_util: util = task_util_est(p); - if (util > env->imbalance) + if (shr_bound(util, env->sd->nr_balance_failed) > env->imbalance) goto next; env->imbalance -= util; From c2dad37627f93d4f361ad32fb736fe815176104b Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Fri, 28 Jun 2024 21:41:16 +0000 Subject: [PATCH 80/93] ANDROID: fix kernelci GCC builds of fips140.ko GCC builds of fips140.ko all fail with these errors. This causes allmodconfig builds to fail in kernelci. aarch64-linux-gnu-objcopy: crypto/fips140.ko: can't dump section '.rela.rodata' - it does not exist: file format not recognized Since the Android use-cases for fips140 are clang only, suppress fips140.ko builds for GCC Bug: 350087876 Signed-off-by: Todd Kjos Change-Id: I742d19bc5172d43a19acd48a248bc2a194f67ca2 --- crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/Kconfig b/crypto/Kconfig index a537398bc27b..b93b403ca74f 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -57,6 +57,7 @@ config CRYPTO_FIPS_VERSION config CRYPTO_FIPS140_MOD tristate "Enable FIPS 140 cryptographic module" depends on ARM64 && ARM64_MODULE_PLTS + depends on CC_IS_CLANG depends on m select CRYPTO_FIPS140_MERGE_MOD_SECTIONS help From 76d91af9daec9090bcfc91a5ffdcbd1ba42b0587 Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Sat, 29 Jun 2024 18:17:25 +0000 Subject: [PATCH 81/93] ANDROID: fix kernelci build breaks due to hid/uhid cyclic dependency An android-only patch to work around frozen KMI for android14 kernels allows a dependency between hid and uhid if both modules are enabled: if (IS_ENABLED(CONFIG_UHID) && parser->device->ll_driver == &uhid_hid_driver) max_buffer_size = UHID_DATA_MAX; For allmodconfig builds, both hid and uhid are modules so this creates a cyclic dependancy and we see this error in kernelci tests: ERROR: Cycle detected: hid -> uhid -> hid Fix by changeing to IS_BUILTIN() instead of IS_ENABLED() since Android builds always build uhid into the core kernel. Fixes: 7668cef28386 ("ANDROID: HID: Only utilise UHID provided exports if UHID is enabled") Signed-off-by: Todd Kjos Change-Id: I622466a42ad94e3606820cf506188bd679078cbf --- drivers/hid/hid-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index f017b457f222..24c00a16276e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -293,7 +293,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign offset = report->size; report->size += parser->global.report_size * parser->global.report_count; - if (IS_ENABLED(CONFIG_UHID) && parser->device->ll_driver == &uhid_hid_driver) + if (IS_BUILTIN(CONFIG_UHID) && parser->device->ll_driver == &uhid_hid_driver) max_buffer_size = UHID_DATA_MAX; /* Total size check: Allow for possible report index byte */ @@ -1987,7 +1987,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 * rsize = hid_compute_report_size(report); - if (IS_ENABLED(CONFIG_UHID) && hid->ll_driver == &uhid_hid_driver) + if (IS_BUILTIN(CONFIG_UHID) && hid->ll_driver == &uhid_hid_driver) max_buffer_size = UHID_DATA_MAX; if (report_enum->numbered && rsize >= max_buffer_size) @@ -2398,7 +2398,7 @@ int hid_hw_raw_request(struct hid_device *hdev, { unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE; - if (IS_ENABLED(CONFIG_UHID) && hdev->ll_driver == &uhid_hid_driver) + if (IS_BUILTIN(CONFIG_UHID) && hdev->ll_driver == &uhid_hid_driver) max_buffer_size = UHID_DATA_MAX; if (len < 1 || len > max_buffer_size || !buf) @@ -2422,7 +2422,7 @@ int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len) { unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE; - if (IS_ENABLED(CONFIG_UHID) && hdev->ll_driver == &uhid_hid_driver) + if (IS_BUILTIN(CONFIG_UHID) && hdev->ll_driver == &uhid_hid_driver) max_buffer_size = UHID_DATA_MAX; if (len < 1 || len > max_buffer_size || !buf) From aa8621e0027085f20ef2662e508e7a9f8cc64256 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Mon, 1 Jul 2024 20:00:00 +0000 Subject: [PATCH 82/93] ANDROID: Update the ABI symbol list: set_normalized_timespec64 Adding the following symbols: - set_normalized_timespec64 Bug: 350541515 Change-Id: Idf7de820d163d4aef5797a5ef3bb07fcbe81e1c1 Signed-off-by: Todd Poynor --- android/abi_gki_aarch64_pixel | 1 + 1 file changed, 1 insertion(+) diff --git a/android/abi_gki_aarch64_pixel b/android/abi_gki_aarch64_pixel index 61830b15a69e..d5ca9215f400 100644 --- a/android/abi_gki_aarch64_pixel +++ b/android/abi_gki_aarch64_pixel @@ -2004,6 +2004,7 @@ set_capacity_and_notify set_cpus_allowed_ptr set_freezable + set_normalized_timespec64 set_page_dirty set_page_dirty_lock __SetPageMovable From 81e9f0610c730e2ce7e735fab86c987a06ff25c2 Mon Sep 17 00:00:00 2001 From: Nikhil V Date: Thu, 13 Jul 2023 12:37:57 +0530 Subject: [PATCH 83/93] UPSTREAM: arm64: mm: Make hibernation aware of KFENCE In the restore path, swsusp_arch_suspend_exit uses copy_page() to over-write memory. However, with features like KFENCE enabled, there could be situations where it may have marked some pages as not valid, due to which it could be reported as invalid accesses. Consider a situation where page 'P' was part of the hibernation image. Now, when the resume kernel tries to restore the pages, the same page 'P' is already in use in the resume kernel and is kfence protected, due to which its mapping is removed from linear map. Since restoring pages happens with the resume kernel page tables, we would end up accessing 'P' during copy and results in kernel pagefault. The proposed fix tries to solve this issue by marking PTE as valid for such kfence protected pages. Bug: 350428411 Co-developed-by: Pavankumar Kondeti Signed-off-by: Pavankumar Kondeti Signed-off-by: Nikhil V Link: https://lore.kernel.org/r/20230713070757.4093-1-quic_nprakash@quicinc.com Signed-off-by: Will Deacon (cherry picked from commit a8bd38dbc57c2fe074df2c9e549b9c2ad3183c83) Change-Id: Ib1458808f6fc4b0cb4bcee62231425197cd6b448 Signed-off-by: Nikhil V --- arch/arm64/mm/trans_pgd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c index 4ea2eefbc053..e9ad391fc8ea 100644 --- a/arch/arm64/mm/trans_pgd.c +++ b/arch/arm64/mm/trans_pgd.c @@ -24,6 +24,7 @@ #include #include #include +#include static void *trans_alloc(struct trans_pgd_info *info) { @@ -41,7 +42,8 @@ static void _copy_pte(pte_t *dst_ptep, pte_t *src_ptep, unsigned long addr) * the temporary mappings we use during restore. */ set_pte(dst_ptep, pte_mkwrite(pte)); - } else if (debug_pagealloc_enabled() && !pte_none(pte)) { + } else if ((debug_pagealloc_enabled() || + is_kfence_address((void *)addr)) && !pte_none(pte)) { /* * debug_pagealloc will removed the PTE_VALID bit if * the page isn't in use by the resume kernel. It may have From 04685279357fb894d1dda3ab734c9052ecb2051a Mon Sep 17 00:00:00 2001 From: Jiewen Wang Date: Wed, 3 Jul 2024 10:42:02 +0800 Subject: [PATCH 84/93] ANDROID: GKI: Update symbols list for vivo 1 function symbol(s) added 'char* next_arg(char*, char**, char**)' Bug: 335745207 Change-Id: I4fb57db677682da5b3aa04ae9e299f2aa877a43c Signed-off-by: Jiewen Wang --- android/abi_gki_aarch64.stg | 17 +++++++++++++++++ android/abi_gki_aarch64_vivo | 3 +++ 2 files changed, 20 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 37c8ab54360e..b963b30304f2 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -306428,6 +306428,13 @@ function { parameter_id: 0x391f15ea parameter_id: 0xf435685e } +function { + id: 0x3f32d745 + return_type_id: 0x0483e6f8 + parameter_id: 0x0483e6f8 + parameter_id: 0x0bb0c019 + parameter_id: 0x0bb0c019 +} function { id: 0x3f83d490 return_type_id: 0x33756485 @@ -382962,6 +382969,15 @@ elf_symbol { type_id: 0x12d6b73d full_name: "new_inode" } +elf_symbol { + id: 0x57a41824 + name: "next_arg" + is_defined: true + symbol_type: FUNCTION + crc: 0xa033d747 + type_id: 0x3f32d745 + full_name: "next_arg" +} elf_symbol { id: 0xc8ea3547 name: "nf_conntrack_destroy" @@ -416159,6 +416175,7 @@ interface { symbol_id: 0xeb19d9f6 symbol_id: 0xbbd2a0ab symbol_id: 0x57abe80f + symbol_id: 0x57a41824 symbol_id: 0xc8ea3547 symbol_id: 0x8b0d44a9 symbol_id: 0xb2e54d47 diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index 00b99700014f..117e9aea3d0d 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -1205,6 +1205,7 @@ crypto_put_default_rng crypto_register_aead crypto_register_ahash + crypto_register_alg crypto_register_rng crypto_register_rngs crypto_register_shash @@ -1221,6 +1222,7 @@ crypto_skcipher_setkey crypto_unregister_aead crypto_unregister_ahash + crypto_unregister_alg crypto_unregister_rng crypto_unregister_rngs crypto_unregister_shash @@ -3050,6 +3052,7 @@ netlink_register_notifier netlink_unicast netlink_unregister_notifier + next_arg nf_conntrack_destroy nf_ct_attach nf_ct_delete From d256bfafa978a159f6e541969f1a496e2342508b Mon Sep 17 00:00:00 2001 From: Zhifeng Zhu Date: Thu, 27 Jun 2024 16:38:45 +0800 Subject: [PATCH 85/93] ANDROID: vendor_hooks: add hooks in prctl_set_vma In some special scenarios, some threads are allowed to skip waiting, write the set_anon_name task into the queue and return directly, thus improving the system's response speed and performance. Bug: 349739224 Change-Id: Id3686309da108e242a30cfaf68f859b10215f402 Signed-off-by: Zhifeng Zhu --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/sys.h | 4 ++++ kernel/sys.c | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9d4ee2802caf..9abc0d1f53a3 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -433,3 +433,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rwsem_reader_owned); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_clear_rwsem_reader_owned); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_rwsem_writer_owned); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_clear_rwsem_writer_owned); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pr_set_vma_name_bypass); diff --git a/include/trace/hooks/sys.h b/include/trace/hooks/sys.h index e2d5d6d4fc14..120bfedea008 100644 --- a/include/trace/hooks/sys.h +++ b/include/trace/hooks/sys.h @@ -11,6 +11,10 @@ struct task_struct; DECLARE_HOOK(android_vh_syscall_prctl_finished, TP_PROTO(int option, struct task_struct *task), TP_ARGS(option, task)); +DECLARE_RESTRICTED_HOOK(android_rvh_pr_set_vma_name_bypass, + TP_PROTO(struct mm_struct *mm, unsigned long addr, unsigned long size, + struct anon_vma_name *anon_name, int *error, bool *bypass), + TP_ARGS(mm, addr, size, anon_name, error, bypass), 1); #endif #include diff --git a/kernel/sys.c b/kernel/sys.c index 7a5dca7dfac3..380cee197118 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -2330,6 +2330,7 @@ static int prctl_set_vma(unsigned long opt, unsigned long addr, struct mm_struct *mm = current->mm; const char __user *uname; struct anon_vma_name *anon_name = NULL; + bool bypass = false; int error; switch (opt) { @@ -2356,6 +2357,10 @@ static int prctl_set_vma(unsigned long opt, unsigned long addr, } + trace_android_rvh_pr_set_vma_name_bypass(mm, addr, size, anon_name, + &error, &bypass); + if (bypass) + return error; mmap_write_lock(mm); error = madvise_set_anon_name(mm, addr, size, anon_name); mmap_write_unlock(mm); From 256660feeb7b13757e300677ad75d08c9e9db8a6 Mon Sep 17 00:00:00 2001 From: Zhifeng Zhu Date: Thu, 27 Jun 2024 17:52:58 +0800 Subject: [PATCH 86/93] ANDROID: GKI: Add symbol to symbol list for vivo. 1 function symbol added 'int __traceiter_android_rvh_pr_set_vma_name_bypass(void*, struct mm_struct*,unsigned long , unsigned long , struct anon_vma_name*,int*, bool*))' 1 variable symbol added 'struct tracepoint__tracepoint_android_rvh_pr_set_vma_name_bypass' Bug: 349739224 Change-Id: I4a3c4478def0400c7110c979ee00781e1b7e6821 Signed-off-by: Zhifeng Zhu --- android/abi_gki_aarch64.stg | 31 +++++++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 2 ++ 2 files changed, 33 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index b963b30304f2..1b4037a40579 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -326778,6 +326778,17 @@ function { parameter_id: 0x370ed8aa parameter_id: 0x11cfee5a } +function { + id: 0x9bcf72dd + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x1b36c7a2 + parameter_id: 0x33756485 + parameter_id: 0x33756485 + parameter_id: 0x0d956bfc + parameter_id: 0x13580d6c + parameter_id: 0x11cfee5a +} function { id: 0x9bcfc1f5 return_type_id: 0x6720d32f @@ -343368,6 +343379,15 @@ elf_symbol { type_id: 0x9b8f15f1 full_name: "__traceiter_android_rvh_post_init_entity_util_avg" } +elf_symbol { + id: 0x8c494e33 + name: "__traceiter_android_rvh_pr_set_vma_name_bypass" + is_defined: true + symbol_type: FUNCTION + crc: 0x7247f5de + type_id: 0x9bcf72dd + full_name: "__traceiter_android_rvh_pr_set_vma_name_bypass" +} elf_symbol { id: 0x167fc668 name: "__traceiter_android_rvh_preempt_disable" @@ -347841,6 +347861,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_rvh_post_init_entity_util_avg" } +elf_symbol { + id: 0x50cc3541 + name: "__tracepoint_android_rvh_pr_set_vma_name_bypass" + is_defined: true + symbol_type: OBJECT + crc: 0xf9151f7c + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_rvh_pr_set_vma_name_bypass" +} elf_symbol { id: 0x817c415a name: "__tracepoint_android_rvh_preempt_disable" @@ -411776,6 +411805,7 @@ interface { symbol_id: 0x88e9b222 symbol_id: 0x097e467e symbol_id: 0xfad1d9f5 + symbol_id: 0x8c494e33 symbol_id: 0x167fc668 symbol_id: 0xd6a514f5 symbol_id: 0xeccbc3c1 @@ -412273,6 +412303,7 @@ interface { symbol_id: 0x18752990 symbol_id: 0x448fc4e4 symbol_id: 0x121537db + symbol_id: 0x50cc3541 symbol_id: 0x817c415a symbol_id: 0x3fe8bcd7 symbol_id: 0x50605d97 diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index 117e9aea3d0d..52f18122bd06 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -332,6 +332,7 @@ __traceiter_android_rvh_pick_next_entity __traceiter_android_rvh_place_entity __traceiter_android_rvh_prepare_prio_fork + __traceiter_android_rvh_pr_set_vma_name_bypass __traceiter_android_rvh_replace_next_task_fair __traceiter_android_rvh_report_bug __traceiter_android_rvh_rtmutex_prepare_setprio @@ -517,6 +518,7 @@ __tracepoint_android_rvh_pick_next_entity __tracepoint_android_rvh_place_entity __tracepoint_android_rvh_prepare_prio_fork + __tracepoint_android_rvh_pr_set_vma_name_bypass __tracepoint_android_rvh_replace_next_task_fair __tracepoint_android_rvh_report_bug __tracepoint_android_rvh_rtmutex_prepare_setprio From ce6f9cab9edca2712f312476ddc137f18c8ecfff Mon Sep 17 00:00:00 2001 From: Seiya Wang Date: Wed, 3 Jul 2024 10:35:26 +0800 Subject: [PATCH 87/93] ANDROID: GKI: Update symbol list for mtk 1 function symbol(s) added 'int phy_create_lookup(struct phy*, const char*, const char*)' Bug: 350828988 Change-Id: If747b9e3acdf6e644ee23783f4997aff1d973e64 Signed-off-by: Seiya Wang --- android/abi_gki_aarch64.stg | 17 +++++++++++++++++ android/abi_gki_aarch64_mtk | 1 + 2 files changed, 18 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 1b4037a40579..0805b69306f0 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -333501,6 +333501,13 @@ function { parameter_id: 0x0917901f parameter_id: 0x10afcfdf } +function { + id: 0x9f8801da + return_type_id: 0x6720d32f + parameter_id: 0x0bfc9031 + parameter_id: 0x3e10b518 + parameter_id: 0x3e10b518 +} function { id: 0x9f89d33b return_type_id: 0x6720d32f @@ -387312,6 +387319,15 @@ elf_symbol { type_id: 0x91ec6dfe full_name: "phy_connect_direct" } +elf_symbol { + id: 0x2bf61c61 + name: "phy_create_lookup" + is_defined: true + symbol_type: FUNCTION + crc: 0x25d71c76 + type_id: 0x9f8801da + full_name: "phy_create_lookup" +} elf_symbol { id: 0x5b3ff607 name: "phy_device_free" @@ -416685,6 +416701,7 @@ interface { symbol_id: 0xc278f4fa symbol_id: 0x9c15bd7a symbol_id: 0x866cf90c + symbol_id: 0x2bf61c61 symbol_id: 0x5b3ff607 symbol_id: 0x3d4eb5a9 symbol_id: 0x5ebc16d0 diff --git a/android/abi_gki_aarch64_mtk b/android/abi_gki_aarch64_mtk index bb18c96d361e..b67e7a36ee3f 100644 --- a/android/abi_gki_aarch64_mtk +++ b/android/abi_gki_aarch64_mtk @@ -1894,6 +1894,7 @@ phy_attached_info phy_connect phy_connect_direct + phy_create_lookup phy_disconnect phy_do_ioctl_running phy_drivers_register From f6b99539f84bb4c327e041fcd12d78544ef09bf5 Mon Sep 17 00:00:00 2001 From: Krishna Kurapati Date: Sat, 20 Apr 2024 10:18:55 +0530 Subject: [PATCH 88/93] UPSTREAM: usb: dwc3: core: Skip setting event buffers for host only controllers On some SoC's like SA8295P where the tertiary controller is host-only capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible. Trying to access them leads to a crash. For DRD/Peripheral supported controllers, event buffer setup is done again in gadget_pullup. Skip setup or cleanup of event buffers if controller is host-only capable. Suggested-by: Johan Hovold Signed-off-by: Krishna Kurapati Acked-by: Thinh Nguyen Reviewed-by: Johan Hovold Reviewed-by: Bjorn Andersson Tested-by: Johan Hovold Link: https://lore.kernel.org/r/20240420044901.884098-4-quic_kriskura@quicinc.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 89d7f962994604a3e3d480832788d06179abefc5 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master) Bug: 233985973 Change-Id: I66bccca575b3524b8e446f38b154d2434335a65d Signed-off-by: Krishna Kurapati --- drivers/usb/dwc3/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 1d0a81a3f6fe..bd6a302b657f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -485,6 +485,13 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc) static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned int length) { struct dwc3_event_buffer *evt; + unsigned int hw_mode; + + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); + if (hw_mode == DWC3_GHWPARAMS0_MODE_HOST) { + dwc->ev_buf = NULL; + return 0; + } evt = dwc3_alloc_one_event_buffer(dwc, length); if (IS_ERR(evt)) { @@ -506,6 +513,9 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc) { struct dwc3_event_buffer *evt; + if (!dwc->ev_buf) + return 0; + evt = dwc->ev_buf; evt->lpos = 0; dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0), @@ -523,6 +533,9 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc) { struct dwc3_event_buffer *evt; + if (!dwc->ev_buf) + return; + evt = dwc->ev_buf; evt->lpos = 0; From 7fc37949627381ac4d7ebdd5fc26dd689786a6e9 Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Thu, 4 Jul 2024 22:08:43 +0800 Subject: [PATCH 89/93] ANDROID: GKI: Add initialization for rwsem's oem_data and vendor_data. Add initialization for rwsem's oem_data and vendor_data. The __init_rwsem() already contains a hook, but this function may be called before the rwsem_init hook is registered, causing some rwsem's oem_data to be uninitialized and causing unpredictable errors Bug: 351133539 Change-Id: I7bbb83894d200102bc7d84e91678f164529097a0 Signed-off-by: zhujingpeng (cherry picked from commit aaca6b10f1a352dec4596548396f590500f2001b) --- kernel/locking/rwsem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c index 15ebac9c85fb..d2d3e3d65119 100644 --- a/kernel/locking/rwsem.c +++ b/kernel/locking/rwsem.c @@ -348,6 +348,8 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, #ifdef CONFIG_RWSEM_SPIN_ON_OWNER osq_lock_init(&sem->osq); #endif + android_init_vendor_data(sem, 1); + android_init_oem_data(sem, 1); trace_android_vh_rwsem_init(sem); } EXPORT_SYMBOL(__init_rwsem); From 74be75dd1061fb9f7bb18123652d6f986a433233 Mon Sep 17 00:00:00 2001 From: Charan Teja Kalla Date: Mon, 1 Jul 2024 17:10:18 +0530 Subject: [PATCH 90/93] ANDROID: mm: madvise: vendor hook to tune page flags Users can proactively reclaim the pages of an app once it is in background using the system calls, like madvise. But it may be possible that such pages turn out to be the workingset page in the conventional LRU which while swapping can result into accounting of PSI events. Although this PSI events is an indication that wrong pages are being madvised, one can also argue that he is aware of what he is doing using madvise. For such clients, add the vendor hook to tune page flags, such as clearing the Workingset during swapout so that PSI might not get accounyted during swapin. Bug: 350429581 Change-Id: I675c57f63a918c5a23df8273006426d0e611c5c5 Signed-off-by: Charan Teja Kalla --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/madvise.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9abc0d1f53a3..383b0404742a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -101,6 +101,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_waiter_prio); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_wait_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_wait_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rt_mutex_steal); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_or_pageout_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_opt_spin_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_opt_spin_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_can_spin_on_owner); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 4b0da560a4f0..6603dafabfd3 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -240,6 +240,9 @@ DECLARE_HOOK(android_vh_uprobes_replace_page, DECLARE_HOOK(android_vh_shmem_swapin_folio, TP_PROTO(struct folio *folio), TP_ARGS(folio)); +DECLARE_HOOK(android_vh_madvise_cold_or_pageout_page, + TP_PROTO(bool pageout, struct page *page), + TP_ARGS(pageout, page)); #endif /* _TRACE_HOOK_MM_H */ /* This part must be outside protection */ diff --git a/mm/madvise.c b/mm/madvise.c index d084cea48ffe..e445135ed4c1 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -413,6 +413,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, tlb_remove_pmd_tlb_entry(tlb, pmd, addr); } + trace_android_vh_madvise_cold_or_pageout_page(pageout, page); ClearPageReferenced(page); test_and_clear_page_young(page); if (pageout) { @@ -519,6 +520,7 @@ regular_page: * As a side effect, it makes confuse idle-page tracking * because they will miss recent referenced history. */ + trace_android_vh_madvise_cold_or_pageout_page(pageout, page); ClearPageReferenced(page); test_and_clear_page_young(page); if (pageout) { From 56526cf940766bda65e6c3505092e6ba2598ad44 Mon Sep 17 00:00:00 2001 From: Charan Teja Kalla Date: Mon, 1 Jul 2024 17:40:21 +0530 Subject: [PATCH 91/93] ANDROID: mm: swap: export and whitelist get_shadow_from_swap_cache The shadow entry in the swapcache contains information about a page that got swapped out during the reclaim which is then used at the time of refault to determine if a page is going to be a workingset or not. Once the page is swapped out, vendors can implement some algorithms on the swap area to determine if that page can be further pushed down to slower devices, Eg: say from costly and faster disk to slower disk. But if a page that is actively used is pushed to slower disk, the swapin is going to consume time which can show up in PSI events. The side effect of increased PSI events is, an example, increased kills by LMKD. Alternatively, vendors can rely on the information stored in the swapcache and determine if that particular page in the swap can be further pushed down to slower devices. Bug: 350429581 Change-Id: Ibeee10d40cc917229fe3b0fd9a6ef34ad27033e1 Signed-off-by: Charan Teja Kalla --- mm/swap_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index 3e7db8ea40f3..df44400df83f 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -80,6 +80,7 @@ void *get_shadow_from_swap_cache(swp_entry_t entry) return page; return NULL; } +EXPORT_SYMBOL_GPL(get_shadow_from_swap_cache); /* * add_to_swap_cache resembles filemap_add_folio on swapper_space, From 9e55f416954438d1c63194e8dc8a7ec6101ac012 Mon Sep 17 00:00:00 2001 From: Charan Teja Kalla Date: Tue, 2 Jul 2024 19:08:39 +0530 Subject: [PATCH 92/93] ANDROID: abi_gki_aarch64_qcom: whitelist some mm symbols Whitelist the below symbols: android_vh_madvise_cold_or_pageout_page get_shadow_from_swap_cache Compiler o/p: INFO: 2 function symbol(s) added 'int __traceiter_android_vh_madvise_cold_or_pageout_page(void*, bool, struct page*)' 'void* get_shadow_from_swap_cache(swp_entry_t)' 1 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_madvise_cold_or_pageout_page' . Bug: 350429581 Change-Id: I3f51722c9fcdc666534b4b13c62a2f7f71387242 Signed-off-by: Charan Teja Kalla --- android/abi_gki_aarch64.stg | 42 ++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_qcom | 3 +++ 2 files changed, 45 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 0805b69306f0..4c5ad5163610 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -308592,6 +308592,11 @@ function { parameter_id: 0xf435685e parameter_id: 0xf435685e } +function { + id: 0x5f533b5a + return_type_id: 0x18bd6530 + parameter_id: 0x27162aac +} function { id: 0x5f535d88 return_type_id: 0x391f15ea @@ -322167,6 +322172,13 @@ function { parameter_id: 0x34d3469d parameter_id: 0x6720d32f } +function { + id: 0x9a1be7cb + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x6d7f5ff6 + parameter_id: 0x06835e9c +} function { id: 0x9a1c05a3 return_type_id: 0x6720d32f @@ -345276,6 +345288,15 @@ elf_symbol { type_id: 0x9b222516 full_name: "__traceiter_android_vh_look_around_migrate_folio" } +elf_symbol { + id: 0xd224e035 + name: "__traceiter_android_vh_madvise_cold_or_pageout_page" + is_defined: true + symbol_type: FUNCTION + crc: 0x00919f06 + type_id: 0x9a1be7cb + full_name: "__traceiter_android_vh_madvise_cold_or_pageout_page" +} elf_symbol { id: 0xfb6a92a8 name: "__traceiter_android_vh_madvise_cold_pageout_skip" @@ -349758,6 +349779,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_look_around_migrate_folio" } +elf_symbol { + id: 0x35fe8b1b + name: "__tracepoint_android_vh_madvise_cold_or_pageout_page" + is_defined: true + symbol_type: OBJECT + crc: 0xdd1591ff + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_madvise_cold_or_pageout_page" +} elf_symbol { id: 0xcb34ca12 name: "__tracepoint_android_vh_madvise_cold_pageout_skip" @@ -372027,6 +372057,15 @@ elf_symbol { type_id: 0x976222f8 full_name: "get_sg_io_hdr" } +elf_symbol { + id: 0x84798b2b + name: "get_shadow_from_swap_cache" + is_defined: true + symbol_type: FUNCTION + crc: 0x74682152 + type_id: 0x5f533b5a + full_name: "get_shadow_from_swap_cache" +} elf_symbol { id: 0x75d8e345 name: "get_slabinfo" @@ -412031,6 +412070,7 @@ interface { symbol_id: 0x0992491b symbol_id: 0xe19d2bf8 symbol_id: 0x993f42ff + symbol_id: 0xd224e035 symbol_id: 0xfb6a92a8 symbol_id: 0xa94ef105 symbol_id: 0x0e1f9e23 @@ -412529,6 +412569,7 @@ interface { symbol_id: 0x8bd577fd symbol_id: 0xda2d53f2 symbol_id: 0x50a5a949 + symbol_id: 0x35fe8b1b symbol_id: 0xcb34ca12 symbol_id: 0x2f768c2b symbol_id: 0xc34a5545 @@ -415002,6 +415043,7 @@ interface { symbol_id: 0x3266d1f2 symbol_id: 0x7aac3cd4 symbol_id: 0x3a06dd48 + symbol_id: 0x84798b2b symbol_id: 0x75d8e345 symbol_id: 0xfa5debf3 symbol_id: 0x450ea7a4 diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index bec840c8b61d..75a2935d180b 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -1259,6 +1259,7 @@ get_random_u32 __get_random_u32_below get_sg_io_hdr + get_shadow_from_swap_cache get_slabinfo get_state_synchronize_rcu get_state_synchronize_srcu @@ -3449,6 +3450,7 @@ __traceiter_android_vh_ipi_stop __traceiter_android_vh_jiffies_update __traceiter_android_vh_kswapd_per_node + __traceiter_android_vh_madvise_cold_or_pageout_page __traceiter_android_vh_mpam_set __traceiter_android_vh_post_image_save __traceiter_android_vh_printk_hotplug @@ -3600,6 +3602,7 @@ __tracepoint_android_vh_ipi_stop __tracepoint_android_vh_jiffies_update __tracepoint_android_vh_kswapd_per_node + __tracepoint_android_vh_madvise_cold_or_pageout_page __tracepoint_android_vh_mpam_set __tracepoint_android_vh_post_image_save __tracepoint_android_vh_printk_hotplug From 96d66062d0767aeafb690ce014ec91785820d62b Mon Sep 17 00:00:00 2001 From: zhujingpeng Date: Wed, 10 Jul 2024 11:22:28 +0800 Subject: [PATCH 93/93] ANDROID: GKI: Add initialization for mutex oem_data. Although __mutex_init() already contains a hook, but this function may be called before the mutex_init hook is registered, causing mutex's oem_data to be uninitialized and causing unpredictable errors. Bug: 352181884 Change-Id: I04378d6668fb4e7b93c11d930ac46aae484fc835 Signed-off-by: zhujingpeng --- kernel/locking/mutex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 525648da693f..b363b5b3ed2a 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -54,6 +54,7 @@ __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key) #ifdef CONFIG_MUTEX_SPIN_ON_OWNER osq_lock_init(&lock->osq); #endif + android_init_oem_data(lock, 1); trace_android_vh_mutex_init(lock); debug_mutex_init(lock, name, key);