From 78b1a8b2e5c8f11d7d39394deed5a87232f22545 Mon Sep 17 00:00:00 2001 From: Seiya Wang Date: Fri, 19 Jul 2024 15:23:44 +0800 Subject: [PATCH 01/50] ANDROID: GKI: Update symbol list for mtk 2 function symbol(s) added 'int rpmsg_chrdev_eptdev_create(struct rpmsg_device*, struct device*, struct rpmsg_channel_info)' 'int rpmsg_chrdev_eptdev_destroy(struct device*, void*)' 1 variable symbol(s) added 'struct class* rpmsg_class' Bug: 354094574 Change-Id: I3c10ffb4a472076f93190266d38ee5197d663ce3 Signed-off-by: Seiya Wang --- android/abi_gki_aarch64.stg | 37 +++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_mtk | 3 +++ 2 files changed, 40 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 9c35a7b54802..dfc82c582298 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -317171,6 +317171,13 @@ function { parameter_id: 0x26731c99 parameter_id: 0x0a52df14 } +function { + id: 0x94cb16e5 + return_type_id: 0x6720d32f + parameter_id: 0x25b73daa + parameter_id: 0x0258f96e + parameter_id: 0xbd6515b8 +} function { id: 0x94cce46c return_type_id: 0x6720d32f @@ -393166,6 +393173,33 @@ elf_symbol { type_id: 0x3d719472 full_name: "round_jiffies_up" } +elf_symbol { + id: 0x8d5c9fe1 + name: "rpmsg_chrdev_eptdev_create" + is_defined: true + symbol_type: FUNCTION + crc: 0x6447eb34 + type_id: 0x94cb16e5 + full_name: "rpmsg_chrdev_eptdev_create" +} +elf_symbol { + id: 0x641a30d7 + name: "rpmsg_chrdev_eptdev_destroy" + is_defined: true + symbol_type: FUNCTION + crc: 0x0620fcd0 + type_id: 0x9d7428e0 + full_name: "rpmsg_chrdev_eptdev_destroy" +} +elf_symbol { + id: 0x28967786 + name: "rpmsg_class" + is_defined: true + symbol_type: OBJECT + crc: 0x672fe855 + type_id: 0x2a4c6b85 + full_name: "rpmsg_class" +} elf_symbol { id: 0xa3ee1393 name: "rpmsg_create_channel" @@ -417392,6 +417426,9 @@ interface { symbol_id: 0x0e66eaf7 symbol_id: 0x81bce56b symbol_id: 0x01a1f5e7 + symbol_id: 0x8d5c9fe1 + symbol_id: 0x641a30d7 + symbol_id: 0x28967786 symbol_id: 0xa3ee1393 symbol_id: 0x492407e0 symbol_id: 0xfd36afa6 diff --git a/android/abi_gki_aarch64_mtk b/android/abi_gki_aarch64_mtk index b67e7a36ee3f..8406b61da99b 100644 --- a/android/abi_gki_aarch64_mtk +++ b/android/abi_gki_aarch64_mtk @@ -2261,6 +2261,9 @@ round_jiffies round_jiffies_relative round_jiffies_up + rpmsg_chrdev_eptdev_create + rpmsg_chrdev_eptdev_destroy + rpmsg_class rpmsg_create_ept rpmsg_destroy_ept rpmsg_find_device From e8ff0d5cddaf6b9847e3b52a61f19d1e1b86ee99 Mon Sep 17 00:00:00 2001 From: Amit Sunil Dhamne Date: Wed, 24 Apr 2024 15:32:16 -0700 Subject: [PATCH 02/50] UPSTREAM: usb: typec: tcpm: unregister existing source caps before re-registration Check and unregister existing source caps in tcpm_register_source_caps function before registering new ones. This change fixes following warning when port partner resends source caps after negotiating PD contract for the purpose of re-negotiation. [ 343.135030][ T151] sysfs: cannot create duplicate filename '/devices/virtual/usb_power_delivery/pd1/source-capabilities' [ 343.135071][ T151] Call trace: [ 343.135076][ T151] dump_backtrace+0xe8/0x108 [ 343.135099][ T151] show_stack+0x18/0x24 [ 343.135106][ T151] dump_stack_lvl+0x50/0x6c [ 343.135119][ T151] dump_stack+0x18/0x24 [ 343.135126][ T151] sysfs_create_dir_ns+0xe0/0x140 [ 343.135137][ T151] kobject_add_internal+0x228/0x424 [ 343.135146][ T151] kobject_add+0x94/0x10c [ 343.135152][ T151] device_add+0x1b0/0x4c0 [ 343.135187][ T151] device_register+0x20/0x34 [ 343.135195][ T151] usb_power_delivery_register_capabilities+0x90/0x20c [ 343.135209][ T151] tcpm_pd_rx_handler+0x9f0/0x15b8 [ 343.135216][ T151] kthread_worker_fn+0x11c/0x260 [ 343.135227][ T151] kthread+0x114/0x1bc [ 343.135235][ T151] ret_from_fork+0x10/0x20 [ 343.135265][ T151] kobject: kobject_add_internal failed for source-capabilities with -EEXIST, don't try to register things with the same name in the same directory. Fixes: 8203d26905ee ("usb: typec: tcpm: Register USB Power Delivery Capabilities") Cc: linux-usb@vger.kernel.org Cc: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Mark Brown Signed-off-by: Amit Sunil Dhamne Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20240424223227.1807844-1-amitsd@google.com Signed-off-by: Greg Kroah-Hartman Bug: 335453765 (cherry picked from commit 230ecdf71a644c9c73e0e6735b33173074ae3f94) Change-Id: If5c563c16b426c3fb4f8d51bcbda0ba9b72d560a Signed-off-by: Amit Sunil Dhamne --- drivers/usb/typec/tcpm/tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index fc89be47a4da..40b6dbfc81bc 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2425,7 +2425,7 @@ static int tcpm_register_source_caps(struct tcpm_port *port) { struct usb_power_delivery_desc desc = { port->negotiated_rev }; struct usb_power_delivery_capabilities_desc caps = { }; - struct usb_power_delivery_capabilities *cap; + struct usb_power_delivery_capabilities *cap = port->partner_source_caps; if (!port->partner_pd) port->partner_pd = usb_power_delivery_register(NULL, &desc); @@ -2435,6 +2435,9 @@ static int tcpm_register_source_caps(struct tcpm_port *port) memcpy(caps.pdo, port->source_caps, sizeof(u32) * port->nr_source_caps); caps.role = TYPEC_SOURCE; + if (cap) + usb_power_delivery_unregister_capabilities(cap); + cap = usb_power_delivery_register_capabilities(port->partner_pd, &caps); if (IS_ERR(cap)) return PTR_ERR(cap); From 4a9ef0dc4ba5d4410a988c77ba5f0042e4fb9f35 Mon Sep 17 00:00:00 2001 From: Amit Sunil Dhamne Date: Tue, 14 May 2024 15:01:31 -0700 Subject: [PATCH 03/50] UPSTREAM: usb: typec: tcpm: fix use-after-free case in tcpm_register_source_caps There could be a potential use-after-free case in tcpm_register_source_caps(). This could happen when: * new (say invalid) source caps are advertised * the existing source caps are unregistered * tcpm_register_source_caps() returns with an error as usb_power_delivery_register_capabilities() fails This causes port->partner_source_caps to hold on to the now freed source caps. Reset port->partner_source_caps value to NULL after unregistering existing source caps. Fixes: 230ecdf71a64 ("usb: typec: tcpm: unregister existing source caps before re-registration") Cc: stable@vger.kernel.org Signed-off-by: Amit Sunil Dhamne Reviewed-by: Ondrej Jirman Reviewed-by: Heikki Krogerus Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20240514220134.2143181-1-amitsd@google.com Signed-off-by: Greg Kroah-Hartman Bug: 335453765 (cherry picked from commit e7e921918d905544500ca7a95889f898121ba886) Change-Id: I655ac689dd559dfe22fdf545ef5a39ae056f2bde Signed-off-by: Amit Sunil Dhamne --- drivers/usb/typec/tcpm/tcpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 40b6dbfc81bc..acdc5650f2ed 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2435,8 +2435,10 @@ static int tcpm_register_source_caps(struct tcpm_port *port) memcpy(caps.pdo, port->source_caps, sizeof(u32) * port->nr_source_caps); caps.role = TYPEC_SOURCE; - if (cap) + if (cap) { usb_power_delivery_unregister_capabilities(cap); + port->partner_source_caps = NULL; + } cap = usb_power_delivery_register_capabilities(port->partner_pd, &caps); if (IS_ERR(cap)) From f21999db6a004b79123500ff16877ea0c8e5e106 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Fri, 5 Jul 2024 08:43:39 +0100 Subject: [PATCH 04/50] UPSTREAM: usb: gadget: configfs: Prevent OOB read/write in usb_string_copy() commit 6d3c721e686ea6c59e18289b400cc95c76e927e0 upstream. Userspace provided string 's' could trivially have the length zero. Left unchecked this will firstly result in an OOB read in the form `if (str[0 - 1] == '\n') followed closely by an OOB write in the form `str[0 - 1] = '\0'`. There is already a validating check to catch strings that are too long. Let's supply an additional check for invalid strings that are too short. Bug: 346754046 Signed-off-by: Lee Jones Cc: stable Link: https://lore.kernel.org/r/20240705074339.633717-1-lee@kernel.org Signed-off-by: Greg Kroah-Hartman (cherry picked from commit d1205033e912f9332c1dbefa812e6ceb0575ce0a) Signed-off-by: Lee Jones Change-Id: Id9a34f3e5495aef0d2a800a1386210f4d9fa8116 --- drivers/usb/gadget/configfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 96136bdcd328..61815efb0fb9 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -137,9 +137,12 @@ static int usb_string_copy(const char *s, char **s_copy) int ret; char *str; char *copy = *s_copy; + ret = strlen(s); if (ret > USB_MAX_STRING_LEN) return -EOVERFLOW; + if (ret < 1) + return -EINVAL; if (copy) { str = copy; From 8cfaae3d493e4c7e2f9f703ffa38f545ae626c56 Mon Sep 17 00:00:00 2001 From: Jose Ignacio Tornos Martinez Date: Fri, 10 May 2024 11:08:28 +0200 Subject: [PATCH 05/50] UPSTREAM: net: usb: ax88179_178a: fix link status when link is set to down/up The idea was to keep only one reset at initialization stage in order to reduce the total delay, or the reset from usbnet_probe or the reset from usbnet_open. I have seen that restarting from usbnet_probe is necessary to avoid doing too complex things. But when the link is set to down/up (for example to configure a different mac address) the link is not correctly recovered unless a reset is commanded from usbnet_open. So, detect the initialization stage (first call) to not reset from usbnet_open after the reset from usbnet_probe and after this stage, always reset from usbnet_open too (when the link needs to be rechecked). Apply to all the possible devices, the behavior now is going to be the same. Bug: 339479352 cc: stable@vger.kernel.org # 6.6+ Fixes: 56f78615bcb1 ("net: usb: ax88179_178a: avoid writing the mac address before first reading") Reported-by: Isaac Ganoung Reported-by: Yongqin Liu Change-Id: I6314fcc4df3be9624b91545f1cf033144e3ae9ec Signed-off-by: Jose Ignacio Tornos Martinez Reviewed-by: Simon Horman Link: https://lore.kernel.org/r/20240510090846.328201-1-jtornosm@redhat.com Signed-off-by: Jakub Kicinski (cherry picked from commit ecf848eb934b03959918f5269f64c0e52bc23998) Signed-off-by: Yongqin Liu --- drivers/net/usb/ax88179_178a.c | 37 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 21b6c4d94a63..6d31061818e9 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -174,6 +174,7 @@ struct ax88179_data { u32 wol_supported; u32 wolopts; u8 disconnecting; + u8 initialized; }; struct ax88179_int_data { @@ -1673,6 +1674,18 @@ static int ax88179_reset(struct usbnet *dev) return 0; } +static int ax88179_net_reset(struct usbnet *dev) +{ + struct ax88179_data *ax179_data = dev->driver_priv; + + if (ax179_data->initialized) + ax88179_reset(dev); + else + ax179_data->initialized = 1; + + return 0; +} + static int ax88179_stop(struct usbnet *dev) { u16 tmp16; @@ -1692,6 +1705,7 @@ static const struct driver_info ax88179_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1704,6 +1718,7 @@ static const struct driver_info ax88178a_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1716,7 +1731,7 @@ static const struct driver_info cypress_GX3_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1729,7 +1744,7 @@ static const struct driver_info dlink_dub1312_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1742,7 +1757,7 @@ static const struct driver_info sitecom_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1755,7 +1770,7 @@ static const struct driver_info samsung_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1768,7 +1783,7 @@ static const struct driver_info lenovo_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1781,7 +1796,7 @@ static const struct driver_info belkin_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1794,7 +1809,7 @@ static const struct driver_info toshiba_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1807,7 +1822,7 @@ static const struct driver_info mct_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1820,7 +1835,7 @@ static const struct driver_info at_umc2000_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1833,7 +1848,7 @@ static const struct driver_info at_umc200_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, @@ -1846,7 +1861,7 @@ static const struct driver_info at_umc2000sp_info = { .unbind = ax88179_unbind, .status = ax88179_status, .link_reset = ax88179_link_reset, - .reset = ax88179_reset, + .reset = ax88179_net_reset, .stop = ax88179_stop, .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, From d2ab7b14ca1c56e932d9b2e503bb801d37e4d6eb Mon Sep 17 00:00:00 2001 From: Jose Ignacio Tornos Martinez Date: Mon, 17 Jun 2024 12:28:21 +0200 Subject: [PATCH 06/50] UPSTREAM: net: usb: ax88179_178a: improve reset check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After ecf848eb934b ("net: usb: ax88179_178a: fix link status when link is set to down/up") to not reset from usbnet_open after the reset from usbnet_probe at initialization stage to speed up this, some issues have been reported. It seems to happen that if the initialization is slower, and some time passes between the probe operation and the open operation, the second reset from open is necessary too to have the device working. The reason is that if there is no activity with the phy, this is "disconnected". In order to improve this, the solution is to detect when the phy is "disconnected", and we can use the phy status register for this. So we will only reset the device from reset operation in this situation, that is, only if necessary. The same bahavior is happening when the device is stopped (link set to down) and later is restarted (link set to up), so if the phy keeps working we only need to enable the mac again, but if enough time passes between the device stop and restart, reset is necessary, and we can detect the situation checking the phy status register too. Bug: 339479352 cc: stable@vger.kernel.org # 6.6+ Fixes: ecf848eb934b ("net: usb: ax88179_178a: fix link status when link is set to down/up") Reported-by: Yongqin Liu Reported-by: Antje Miederhöfer Reported-by: Arne Fitzenreiter Tested-by: Yongqin Liu Tested-by: Antje Miederhöfer Change-Id: I0b5944bd0bf353281c884b93c15243c2f395dbbf Signed-off-by: Jose Ignacio Tornos Martinez Signed-off-by: David S. Miller (cherry picked from commit 7be4cb7189f747b4e5b6977d0e4387bde3204e62) Signed-off-by: Yongqin Liu --- drivers/net/usb/ax88179_178a.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 6d31061818e9..53f6efc22f5c 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -174,7 +174,6 @@ struct ax88179_data { u32 wol_supported; u32 wolopts; u8 disconnecting; - u8 initialized; }; struct ax88179_int_data { @@ -1676,12 +1675,21 @@ static int ax88179_reset(struct usbnet *dev) static int ax88179_net_reset(struct usbnet *dev) { - struct ax88179_data *ax179_data = dev->driver_priv; + u16 tmp16; - if (ax179_data->initialized) + ax88179_read_cmd(dev, AX_ACCESS_PHY, AX88179_PHY_ID, GMII_PHY_PHYSR, + 2, &tmp16); + if (tmp16) { + ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, + 2, 2, &tmp16); + if (!(tmp16 & AX_MEDIUM_RECEIVE_EN)) { + tmp16 |= AX_MEDIUM_RECEIVE_EN; + ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, + 2, 2, &tmp16); + } + } else { ax88179_reset(dev); - else - ax179_data->initialized = 1; + } return 0; } From 9fe4f05b40b722e9d2f8a799d4071bd42917f388 Mon Sep 17 00:00:00 2001 From: Bian Jin chen Date: Wed, 24 Jul 2024 08:55:57 +0800 Subject: [PATCH 07/50] ANDROID: GKI: Update rockchip symbols for dw_hdmi_qp. 4 function symbol(s) added 'const struct drm_edid* drm_edid_alloc(const void*, size_t)' 'int drm_edid_connector_update(struct drm_connector*, const struct drm_edid*)' 'const struct edid* drm_edid_raw(const struct drm_edid*)' 'const struct drm_edid* drm_edid_read_ddc(struct drm_connector*, struct i2c_adapter*)' Bug: 300024866 Signed-off-by: Bian Jin chen Change-Id: I3085829b4c799b1a38426576841a4bc23ba531ec --- android/abi_gki_aarch64.stg | 89 ++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_rockchip | 6 +++ 2 files changed, 95 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index dfc82c582298..330c4e188e01 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -26568,6 +26568,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xca2c0eb3 } +pointer_reference { + id: 0x381ecdbd + kind: POINTER + pointee_type_id: 0xca3bd069 +} pointer_reference { id: 0x381f3165 kind: POINTER @@ -32853,6 +32858,11 @@ qualified { qualifier: CONST qualified_type_id: 0x58f78c47 } +qualified { + id: 0xca3bd069 + qualifier: CONST + qualified_type_id: 0x58a8f72f +} qualified { id: 0xca4769cf qualifier: CONST @@ -82752,6 +82762,12 @@ member { type_id: 0x2669d715 offset: 256 } +member { + id: 0x31d48c89 + name: "edid" + type_id: 0x31fe2b41 + offset: 64 +} member { id: 0xabec48fb name: "edid_blob_ptr" @@ -229947,6 +229963,16 @@ struct_union { member_id: 0x80852b9d } } +struct_union { + id: 0x58a8f72f + kind: STRUCT + name: "drm_edid" + definition { + bytesize: 16 + member_id: 0xd98a291a + member_id: 0x31d48c89 + } +} struct_union { id: 0x91901b03 kind: STRUCT @@ -300630,6 +300656,12 @@ function { parameter_id: 0x2b79f509 parameter_id: 0x3e10b518 } +function { + id: 0x1abf9365 + return_type_id: 0x381ecdbd + parameter_id: 0x31b5a66f + parameter_id: 0x249959de +} function { id: 0x1ac748a8 return_type_id: 0x48b5725f @@ -301282,6 +301314,12 @@ function { parameter_id: 0x2131312a parameter_id: 0xc0a0d1f0 } +function { + id: 0x1bd78f42 + return_type_id: 0x381ecdbd + parameter_id: 0x391f15ea + parameter_id: 0xf435685e +} function { id: 0x1bd82ebd return_type_id: 0x48b5725f @@ -312138,6 +312176,12 @@ function { parameter_id: 0xf435685e parameter_id: 0x0ab1f084 } +function { + id: 0x910df182 + return_type_id: 0x6720d32f + parameter_id: 0x31b5a66f + parameter_id: 0x381ecdbd +} function { id: 0x910e1f0a return_type_id: 0x6720d32f @@ -324611,6 +324655,11 @@ function { parameter_id: 0x3e10b518 parameter_id: 0x11cfee5a } +function { + id: 0x9b5412ab + return_type_id: 0x31fe2b41 + parameter_id: 0x381ecdbd +} function { id: 0x9b54acf0 return_type_id: 0x6720d32f @@ -366377,6 +366426,15 @@ elf_symbol { type_id: 0xc2503be7 full_name: "drm_do_get_edid" } +elf_symbol { + id: 0xe795db35 + name: "drm_edid_alloc" + is_defined: true + symbol_type: FUNCTION + crc: 0x79c00fa2 + type_id: 0x1bd78f42 + full_name: "drm_edid_alloc" +} elf_symbol { id: 0xef8e6384 name: "drm_edid_block_valid" @@ -366386,6 +366444,15 @@ elf_symbol { type_id: 0xff1209e9 full_name: "drm_edid_block_valid" } +elf_symbol { + id: 0xb2ef9a9d + name: "drm_edid_connector_update" + is_defined: true + symbol_type: FUNCTION + crc: 0xa90534e2 + type_id: 0x910df182 + full_name: "drm_edid_connector_update" +} elf_symbol { id: 0xc74638be name: "drm_edid_duplicate" @@ -366422,6 +366489,24 @@ elf_symbol { type_id: 0xf06a3ce3 full_name: "drm_edid_is_valid" } +elf_symbol { + id: 0x2396487e + name: "drm_edid_raw" + is_defined: true + symbol_type: FUNCTION + crc: 0x4489a5e9 + type_id: 0x9b5412ab + full_name: "drm_edid_raw" +} +elf_symbol { + id: 0xf7be00e0 + name: "drm_edid_read_ddc" + is_defined: true + symbol_type: FUNCTION + crc: 0x5364fe50 + type_id: 0x1abf9365 + full_name: "drm_edid_read_ddc" +} elf_symbol { id: 0x9ff39d6a name: "drm_edid_to_sad" @@ -414449,11 +414534,15 @@ interface { symbol_id: 0x2b8a2bbd symbol_id: 0xae21a946 symbol_id: 0xf35c98a3 + symbol_id: 0xe795db35 symbol_id: 0xef8e6384 + symbol_id: 0xb2ef9a9d symbol_id: 0xc74638be symbol_id: 0xd5cd8e9b symbol_id: 0x7ee897fe symbol_id: 0x903baf1e + symbol_id: 0x2396487e + symbol_id: 0xf7be00e0 symbol_id: 0x9ff39d6a symbol_id: 0x2dd89a0f symbol_id: 0x6ea79777 diff --git a/android/abi_gki_aarch64_rockchip b/android/abi_gki_aarch64_rockchip index 6de47833231f..1702d5c65191 100644 --- a/android/abi_gki_aarch64_rockchip +++ b/android/abi_gki_aarch64_rockchip @@ -3023,3 +3023,9 @@ # required by wlan_mt7663_usb.ko usb_anchor_empty usb_reset_endpoint + +# required by dw_hdmi_qp.ko + drm_edid_alloc + drm_edid_read_ddc + drm_edid_raw + drm_edid_connector_update From 9077d52bd834bd5029d83416b43e463b5ec64871 Mon Sep 17 00:00:00 2001 From: Pierre Couillaud Date: Tue, 23 Jul 2024 14:57:22 -0700 Subject: [PATCH 08/50] ANDROID: GKI: Update symbol list for BCMSTB INFO: 1 function symbol(s) added 'int scsi_resume_device(struct scsi_device*)' Bug: 355032755 Change-Id: I65f90942b8062c559aeb2cb09394846a39c5e1dc Signed-off-by: Pierre Couillaud --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_bcmstb | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 330c4e188e01..07091a27e0b2 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -394644,6 +394644,15 @@ elf_symbol { type_id: 0x94dfa784 full_name: "scsi_rescan_device" } +elf_symbol { + id: 0xb7f78f52 + name: "scsi_resume_device" + is_defined: true + symbol_type: FUNCTION + crc: 0xe60ed6f7 + type_id: 0x94dfa784 + full_name: "scsi_resume_device" +} elf_symbol { id: 0xc9021692 name: "scsi_scan_host" @@ -417669,6 +417678,7 @@ interface { symbol_id: 0x8deacb1d symbol_id: 0x2e407415 symbol_id: 0x24093af7 + symbol_id: 0xb7f78f52 symbol_id: 0xc9021692 symbol_id: 0x51e78cea symbol_id: 0x9489f8a9 diff --git a/android/abi_gki_aarch64_bcmstb b/android/abi_gki_aarch64_bcmstb index bb130e302c70..0998f7d29e70 100644 --- a/android/abi_gki_aarch64_bcmstb +++ b/android/abi_gki_aarch64_bcmstb @@ -191,6 +191,8 @@ gic_nonsecure_priorities gpiochip_add_data_with_key gpiochip_find + gpiochip_generic_free + gpiochip_generic_request gpiochip_get_data gpiochip_remove gpiod_get_value_cansleep @@ -355,6 +357,7 @@ of_address_to_resource of_alias_get_id of_clk_get_by_name + of_count_phandle_with_args of_device_get_match_data of_device_is_available of_device_is_big_endian @@ -490,6 +493,7 @@ register_pernet_device register_pernet_subsys register_pm_notifier + register_reboot_notifier register_syscore_ops regulator_bulk_disable regulator_bulk_enable @@ -660,6 +664,7 @@ unregister_pernet_device unregister_pernet_subsys unregister_pm_notifier + unregister_reboot_notifier up_read up_write usb_alloc_urb @@ -816,7 +821,6 @@ 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 @@ -1353,6 +1357,7 @@ scsi_remove_device scsi_remove_host scsi_rescan_device + scsi_resume_device scsi_schedule_eh scsi_sense_desc_find scsi_set_sense_field_pointer @@ -1449,8 +1454,6 @@ gpiochip_disable_irq gpiochip_enable_irq gpiochip_generic_config - gpiochip_generic_free - gpiochip_generic_request gpiochip_irq_relres gpiochip_irq_reqres of_pinctrl_get @@ -1527,6 +1530,9 @@ usb_set_configuration work_busy +# required by reboot_data_save.ko + ktime_get_real_ts64 + # required by rfcomm.ko kthread_should_stop kthread_stop @@ -1543,11 +1549,9 @@ # 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 From e0bd441f088d01efa53f0dface6d5b4e9c912d13 Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Wed, 19 Jun 2024 12:44:38 -0700 Subject: [PATCH 09/50] ANDROID: Incremental fs: Retry page faults on non-fatal errors In order to not freeze on corrupt data, we need to turn off FAULT_FLAG_ALLOW_RETRY. However, this means we no longer retry on EINTR, so an interrupted read will lead to page faults. The fault handler does not seem to allow dynamic decisions as to whether to turn on or off this flag. To resolve both issues, add a flag to indicate if there are corrupt pages in a file, and only if there are turn off this flag. Also fsanitize changed the behavior of mlock - mlock should fail if the page reads fail, but with fsanitize it returns 0 then page faults on access. This broke this test, and fsanitize offers little value on test code, so disable it. Test: incfs_test passes Bug: 343532239 Change-Id: Id2ced4be3310109206d65dcc92dea05c05131182 Signed-off-by: Paul Lawrence (cherry picked from commit b7bd4d088751a23209e0636e4d71502ef07b2d33) --- fs/incfs/format.h | 5 ++++ fs/incfs/sysfs.c | 2 ++ fs/incfs/vfs.c | 30 ++++++++++++++++++- .../selftests/filesystems/incfs/Makefile | 4 +-- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/fs/incfs/format.h b/fs/incfs/format.h index 14e475b79a16..5e534416866f 100644 --- a/fs/incfs/format.h +++ b/fs/incfs/format.h @@ -314,6 +314,11 @@ struct backing_file_context { * there is no need to get/put the creds */ const struct cred *bc_cred; + + /* + * The file has a bad block, i.e. one that has failed checksumming. + */ + bool bc_has_bad_block; }; struct metadata_handler { diff --git a/fs/incfs/sysfs.c b/fs/incfs/sysfs.c index ba91c07d2887..96f6b02d7a66 100644 --- a/fs/incfs/sysfs.c +++ b/fs/incfs/sysfs.c @@ -35,6 +35,7 @@ DECLARE_FEATURE_FLAG(zstd); DECLARE_FEATURE_FLAG(v2); DECLARE_FEATURE_FLAG(bugfix_throttling); DECLARE_FEATURE_FLAG(bugfix_inode_eviction); +DECLARE_FEATURE_FLAG(bugfix_retry_page_fault); static struct attribute *attributes[] = { &corefs_attr.attr, @@ -42,6 +43,7 @@ static struct attribute *attributes[] = { &v2_attr.attr, &bugfix_throttling_attr.attr, &bugfix_inode_eviction_attr.attr, + &bugfix_retry_page_fault_attr.attr, NULL, }; diff --git a/fs/incfs/vfs.c b/fs/incfs/vfs.c index 7086135a4d7f..dcaed15d1751 100644 --- a/fs/incfs/vfs.c +++ b/fs/incfs/vfs.c @@ -121,7 +121,28 @@ static const struct address_space_operations incfs_address_space_ops = { static vm_fault_t incfs_fault(struct vm_fault *vmf) { - vmf->flags &= ~FAULT_FLAG_ALLOW_RETRY; + struct file *file = vmf->vma->vm_file; + struct data_file *df = get_incfs_data_file(file); + struct backing_file_context *bfc = df ? df->df_backing_file_context : NULL; + + /* + * This is something of a kludge + * We want to retry if the read from the underlying file is interrupted, + * but not if the read fails because the stored data is corrupt since the + * latter causes an infinite loop. + * + * However, whether we wish to retry must be set before we call + * filemap_fault, *and* there is no way of getting the read error code out + * of filemap_fault. + * + * So unless there is a robust solution to both the above problems, we can + * solve the actual issues we have encoutered by retrying unless there is + * known corruption in the backing file. This does mean that we won't retry + * with a corrupt backing file if a (good) read is interrupted, but we + * don't really handle corruption well anyway at this time. + */ + if (bfc && bfc->bc_has_bad_block) + vmf->flags &= ~FAULT_FLAG_ALLOW_RETRY; return filemap_fault(vmf); } @@ -597,6 +618,13 @@ err: if (total_read < PAGE_SIZE) zero_user(page, total_read, PAGE_SIZE - total_read); + if (result == -EBADMSG) { + struct backing_file_context *bfc = df ? df->df_backing_file_context : NULL; + + if (bfc) + bfc->bc_has_bad_block = 1; + } + if (result == 0) SetPageUptodate(page); else diff --git a/tools/testing/selftests/filesystems/incfs/Makefile b/tools/testing/selftests/filesystems/incfs/Makefile index 5a2f6301c4b2..a2033488d423 100644 --- a/tools/testing/selftests/filesystems/incfs/Makefile +++ b/tools/testing/selftests/filesystems/incfs/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS += -D_FILE_OFFSET_BITS=64 -Wall -Werror -I../.. -I../../../../.. -fno-omit-frame-pointer -fsanitize=address -g -LDLIBS := -llz4 -lzstd -lcrypto -lpthread -fsanitize=address +CFLAGS += -D_FILE_OFFSET_BITS=64 -Wall -Wno-deprecated-declarations -Werror -I../.. -I../../../../.. -fno-omit-frame-pointer -g +LDLIBS := -llz4 -lzstd -lcrypto -lpthread TEST_GEN_PROGS := incfs_test incfs_stress incfs_perf include ../../lib.mk From 54edf65d080713327b3c1dc15a4ca112292967ae Mon Sep 17 00:00:00 2001 From: Doug Berger Date: Wed, 24 Apr 2024 11:50:37 -0700 Subject: [PATCH 10/50] UPSTREAM: dt-bindings: gpio: brcmstb: add gpio-ranges Add optional gpio-ranges device-tree property to the Broadcom Set-Top-Box GPIO controller. Bug: 353554778 Change-Id: I95d9e6153e91d4270e1802c97bb4863de8b494c0 Signed-off-by: Doug Berger Acked-by: Florian Fainelli Acked-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20240424185039.1707812-2-opendmb@gmail.com Signed-off-by: Bartosz Golaszewski (cherry picked from commit 7c66f8173360556ac0c3c38a91234af5a0a5a4a9) Signed-off-by: Danesh Petigara Signed-off-by: Pierre Couillaud --- Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml b/Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml index 4a896ff7edc5..73d44dc746ec 100644 --- a/Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml @@ -62,6 +62,8 @@ properties: interrupt-controller: true + gpio-ranges: true + wakeup-source: type: boolean description: > @@ -88,6 +90,7 @@ examples: interrupt-parent = <&irq0_intc>; interrupts = <0x6>; brcm,gpio-bank-widths = <32 32 32 24>; + gpio-ranges = <&pinctrl 0 0 120>; }; upg_gio_aon: gpio@f04172c0 { From 8ea8aeba312a8879dc18d18c37f1e016ac00d171 Mon Sep 17 00:00:00 2001 From: Doug Berger Date: Wed, 24 Apr 2024 11:50:38 -0700 Subject: [PATCH 11/50] BACKPORT: gpio: of: support gpio-ranges for multiple gpiochip devices Some drivers (e.g. gpio-mt7621 and gpio-brcmstb) have multiple gpiochip banks within a single device. Unfortunately, the gpio-ranges property of the device node was being applied to every gpiochip of the device with device relative GPIO offset values rather than gpiochip relative GPIO offset values. This commit makes use of the gpio_chip offset value which can be non-zero for such devices to split the device node gpio-ranges property into GPIO offset ranges that can be applied to each of the relevant gpiochips of the device. Bug: 353554778 Change-Id: I868f0cd8e4dc8003547a34f3cfd57eece731622f Signed-off-by: Doug Berger Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20240424185039.1707812-3-opendmb@gmail.com Signed-off-by: Bartosz Golaszewski (cherry picked from commit e818cd3c8a345c046edff00b5ad0be4d39f7e4d4) [danesh: Resolved minor conflict in drivers/gpio/gpiolib-of.c] Signed-off-by: Danesh Petigara Signed-off-by: Pierre Couillaud --- drivers/gpio/gpiolib-of.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 0e4e1291604d..8ee9ad0bb216 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -895,7 +895,7 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip) struct device_node *np = chip->of_node; struct of_phandle_args pinspec; struct pinctrl_dev *pctldev; - int index = 0, ret; + int index = 0, ret, trim; const char *name; static const char group_names_propname[] = "gpio-ranges-group-names"; struct property *group_names; @@ -921,7 +921,14 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip) if (!pctldev) return -EPROBE_DEFER; + /* Ignore ranges outside of this GPIO chip */ + if (pinspec.args[0] >= (chip->offset + chip->ngpio)) + continue; + if (pinspec.args[0] + pinspec.args[2] <= chip->offset) + continue; + if (pinspec.args[2]) { + /* npins != 0: linear range */ if (group_names) { of_property_read_string_index(np, group_names_propname, @@ -932,7 +939,19 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip) break; } } - /* npins != 0: linear range */ + + /* Trim the range to fit this GPIO chip */ + if (chip->offset > pinspec.args[0]) { + trim = chip->offset - pinspec.args[0]; + pinspec.args[2] -= trim; + pinspec.args[1] += trim; + pinspec.args[0] = 0; + } else { + pinspec.args[0] -= chip->offset; + } + if ((pinspec.args[0] + pinspec.args[2]) > chip->ngpio) + pinspec.args[2] = chip->ngpio - pinspec.args[0]; + ret = gpiochip_add_pin_range(chip, pinctrl_dev_get_devname(pctldev), pinspec.args[0], From dd8ee5c24218599f826f01c38edf48f69e94d32d Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 16 Feb 2023 09:37:25 +0100 Subject: [PATCH 12/50] UPSTREAM: of: reserved_mem: Use proper binary prefix The printed reserved memory information uses the non-standard "K" prefix, while all other printed values use proper binary prefixes. Fix this by using "Ki" instead. While at it, drop the superfluous spaces inside the parentheses, to reduce printed line length. Bug: 353554778 Fixes: aeb9267eb6b1df99 ("of: reserved-mem: print out reserved-mem details during boot") Change-Id: I1cf499acd46f83b43adf381d19044675983e24bc Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20230216083725.1244817-1-geert+renesas@glider.be Signed-off-by: Rob Herring (cherry picked from commit 6ee7afbabcee4d54024c46f8fc74314c69a04613) Signed-off-by: Danesh Petigara Signed-off-by: Pierre Couillaud --- drivers/of/of_reserved_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index ce3864365e97..d0a6577dac67 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -290,7 +290,7 @@ void __init fdt_init_reserved_mem(void) bool reusable = (of_get_flat_dt_prop(node, "reusable", NULL)) != NULL; - pr_info("%pa..%pa ( %lu KB ) %s %s %s\n", + pr_info("%pa..%pa (%lu KiB) %s %s %s\n", &rmem->base, &end, (unsigned long)(rmem->size / SZ_1K), nomap ? "nomap" : "map", reusable ? "reusable" : "non-reusable", From d01f9af4724357973b9e4dabd07703bcf9347729 Mon Sep 17 00:00:00 2001 From: Marcus Ma Date: Wed, 17 Jul 2024 11:02:10 +0800 Subject: [PATCH 13/50] ANDROID: vendor_hooks: vendor hooks for optimizing the blocking problem caused by rwsem lock contention of reverse mapping during memory recycling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dear Sir, We want to apply the following five trace hook: 1、trace_android_vh_do_folio_trylock() 2、trace_android_vh_get_folio_trylock_result() 3、trace_android_vh_folio_trylock_clear() 4、trace_android_vh_folio_trylock_set() 5、trace_android_vh_handle_trylock_failed_folio(). The optimization objectives are as follows: In the process of memory recycling,reverse mapping is indispensable. The role of reverse mapping is to find all vma or page tables mapped to this page through physical address or page structure. Therefore,the process of reverse mapping will inevitably bring synchronous operations. Whether it is file page or an anonymous page,the synchronization operation is realized through the rwsem read-write lock. Therefore,when kswapd or the user's key thread enters direct_reclaim,the rwsem lock will cause the entire recycling link to be blocked,resulting in low memory recycling efficiency and affecting the user experience. On Xiaomi mobile phones,there is a situation in which the reverse mapping is stuck in the rwsem read-write lock during the file page recycling process,causing the entire recycling link to be blocked,so that the memory cannot be recycled in time. The display on the trace shows that there are a large number of D states,and its block function is rmap_walk_file,therefore,for non-forced recycling scenarios,try_lock and asynchronous recycling are used to handle related blocked pages. Bug: 353608806 Change-Id: I3973c9ddc4e25f8b20e763a4a8aa2dd327e3139d Signed-off-by: Marcus Ma --- drivers/android/vendor_hooks.c | 5 +++++ include/trace/hooks/vmscan.h | 16 ++++++++++++++++ mm/rmap.c | 13 +++++++++++++ mm/vmscan.c | 15 ++++++++++++++- 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 383b0404742a..79127e704342 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -435,3 +435,8 @@ 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); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_folio_trylock); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_folio_trylock_result); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_folio_trylock_clear); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_folio_trylock_set); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_trylock_failed_folio); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index f9effdd2d03e..0c5385bdb175 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -53,6 +53,22 @@ DECLARE_HOOK(android_vh_vmscan_kswapd_done, TP_PROTO(int node_id, unsigned int highest_zoneidx, unsigned int alloc_order, unsigned int reclaim_order), TP_ARGS(node_id, highest_zoneidx, alloc_order, reclaim_order)); +DECLARE_HOOK(android_vh_handle_trylock_failed_folio, + TP_PROTO(struct list_head *folio_list), + TP_ARGS(folio_list)); +DECLARE_HOOK(android_vh_folio_trylock_set, + TP_PROTO(struct folio *folio), + TP_ARGS(folio)); +DECLARE_HOOK(android_vh_folio_trylock_clear, + TP_PROTO(struct folio *folio), + TP_ARGS(folio)); +DECLARE_HOOK(android_vh_get_folio_trylock_result, + TP_PROTO(struct folio *folio, bool *trylock_failed), + TP_ARGS(folio, trylock_failed)); +DECLARE_HOOK(android_vh_do_folio_trylock, + TP_PROTO(struct folio *folio, struct rw_semaphore *sem, + bool *got_lock, bool *skip), + TP_ARGS(folio, sem, got_lock, skip)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/rmap.c b/mm/rmap.c index e1f7f7f86a8c..992502845a7d 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -83,6 +83,7 @@ #include #undef CREATE_TRACE_POINTS #include +#include #include "internal.h" @@ -2518,6 +2519,18 @@ static void rmap_walk_file(struct folio *folio, pgoff_start = folio_pgoff(folio); pgoff_end = pgoff_start + folio_nr_pages(folio) - 1; if (!locked) { + bool got_lock = false; + bool skip = false; + + trace_android_vh_do_folio_trylock(folio, + &mapping->i_mmap_rwsem, &got_lock, &skip); + if (skip) { + if (!got_lock) + return; + else + goto lookup; + } + if (i_mmap_trylock_read(mapping)) goto lookup; diff --git a/mm/vmscan.c b/mm/vmscan.c index e7da1c95f58a..d2912a1cd804 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1476,14 +1476,19 @@ static enum folio_references folio_check_references(struct folio *folio, int referenced_ptes, referenced_folio; unsigned long vm_flags; int ret = 0; + bool trylock_failed = false; trace_android_vh_check_folio_look_around_ref(folio, &ret); if (ret) return ret; + trace_android_vh_folio_trylock_set(folio); referenced_ptes = folio_referenced(folio, 1, sc->target_mem_cgroup, &vm_flags); referenced_folio = folio_test_clear_referenced(folio); + trace_android_vh_get_folio_trylock_result(folio, &trylock_failed); + if (trylock_failed) + return FOLIOREF_KEEP; /* * The supposedly reclaimable folio was found to be in a VM_LOCKED vma. @@ -1905,6 +1910,8 @@ retry: if (folio_test_pmd_mappable(folio)) flags |= TTU_SPLIT_HUGE_PMD; + if (!ignore_references) + trace_android_vh_folio_trylock_set(folio); try_to_unmap(folio, flags); if (folio_mapped(folio)) { stat->nr_unmap_fail += nr_pages; @@ -2035,6 +2042,7 @@ retry: * increment nr_reclaimed here (and * leave it off the LRU). */ + trace_android_vh_folio_trylock_clear(folio); nr_reclaimed += nr_pages; continue; } @@ -2071,6 +2079,7 @@ free_it: * Is there need to periodically free_folio_list? It would * appear not as the counts should be low */ + trace_android_vh_folio_trylock_clear(folio); if (unlikely(folio_test_large(folio))) destroy_large_folio(folio); else @@ -2549,6 +2558,7 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan, return 0; nr_reclaimed = shrink_folio_list(&folio_list, pgdat, sc, &stat, false); + trace_android_vh_handle_trylock_failed_folio(&folio_list); spin_lock_irq(&lruvec->lru_lock); move_folios_to_lru(lruvec, &folio_list); @@ -2673,6 +2683,7 @@ static void shrink_active_list(unsigned long nr_to_scan, } } + trace_android_vh_folio_trylock_set(folio); /* Referenced or rmap lock contention: rotate */ if (folio_referenced(folio, 0, sc->target_mem_cgroup, &vm_flags) != 0) { @@ -2686,12 +2697,13 @@ static void shrink_active_list(unsigned long nr_to_scan, * so we ignore them here. */ if ((vm_flags & VM_EXEC) && folio_is_file_lru(folio)) { + trace_android_vh_folio_trylock_clear(folio); nr_rotated += folio_nr_pages(folio); list_add(&folio->lru, &l_active); continue; } } - + trace_android_vh_folio_trylock_clear(folio); folio_clear_active(folio); /* we are de-activating */ folio_set_workingset(folio); list_add(&folio->lru, &l_inactive); @@ -2780,6 +2792,7 @@ unsigned long __reclaim_pages(struct list_head *folio_list, void *private) return nr_reclaimed; } +EXPORT_SYMBOL_GPL(reclaim_pages); unsigned long reclaim_pages(struct list_head *folio_list) { From 918790efaa771edc549d3b9b12428f6a8044a04d Mon Sep 17 00:00:00 2001 From: Marcus Ma Date: Thu, 25 Jul 2024 15:45:24 +0800 Subject: [PATCH 14/50] ANDROID: GKI: update symbol list file for xiaomi 6 function symbol(s) added 'void __traceiter_android_vh_handle_trylock_failed_folio(struct list_head *)' 'void __traceiter_android_vh_folio_trylock_set(struct folio *)' 'void __traceiter_android_vh_folio_trylock_clear(struct folio *)' 'void __traceiter_android_vh_get_folio_trylock_result(struct folio *, bool *)' 'void __traceiter_android_vh_do_folio_trylock(struct folio *, struct rw_semaphore *, bool *, bool *)' 'long reclaim_pages(struct list_head *folio_list)' 5 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_handle_trylock_failed_folio' 'struct tracepoint __tracepoint_android_vh_folio_trylock_set' 'struct tracepoint __tracepoint_android_vh_folio_trylock_clear' 'struct tracepoint __tracepoint_android_vh_get_folio_trylock_result' 'struct tracepoint __tracepoint_android_vh_do_folio_trylock' Bug: 353608806 Change-Id: Ibdf1757c41483961074a87f37c60de7db60d8636 Signed-off-by: Marcus Ma --- android/abi_gki_aarch64.stg | 137 +++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_xiaomi | 13 ++++ 2 files changed, 150 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 07091a27e0b2..7d6567d75384 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -306364,6 +306364,11 @@ function { return_type_id: 0x33756485 parameter_id: 0x3e0d8696 } +function { + id: 0x3e34432b + return_type_id: 0x33756485 + parameter_id: 0x3e6239e1 +} function { id: 0x3e5176fa return_type_id: 0x23f09c34 @@ -324006,6 +324011,15 @@ function { parameter_id: 0x1b8590a8 parameter_id: 0x120540d1 } +function { + id: 0x9b2a15fe + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x2170d06d + parameter_id: 0x00be4281 + parameter_id: 0x11cfee5a + parameter_id: 0x11cfee5a +} function { id: 0x9b2a2afd return_type_id: 0x6720d32f @@ -324061,6 +324075,13 @@ function { parameter_id: 0x21069feb parameter_id: 0x1a6ea392 } +function { + id: 0x9b2e0ad9 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x2170d06d + parameter_id: 0x11cfee5a +} function { id: 0x9b2eaf21 return_type_id: 0x6720d32f @@ -324713,6 +324734,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x1b55a8f2 } +function { + id: 0x9b563284 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x3e6239e1 +} function { id: 0x9b56b28e return_type_id: 0x6720d32f @@ -344807,6 +344834,15 @@ elf_symbol { type_id: 0x9b8657b1 full_name: "__traceiter_android_vh_do_anonymous_page" } +elf_symbol { + id: 0xada127d2 + name: "__traceiter_android_vh_do_folio_trylock" + is_defined: true + symbol_type: FUNCTION + crc: 0x010f9b2f + type_id: 0x9b2a15fe + full_name: "__traceiter_android_vh_do_folio_trylock" +} elf_symbol { id: 0xd593b3ef name: "__traceiter_android_vh_do_futex" @@ -344969,6 +345005,24 @@ elf_symbol { type_id: 0x9bf4cdf9 full_name: "__traceiter_android_vh_filemap_get_folio" } +elf_symbol { + id: 0x1fca37bf + name: "__traceiter_android_vh_folio_trylock_clear" + is_defined: true + symbol_type: FUNCTION + crc: 0x5e1dea77 + type_id: 0x9b2a7922 + full_name: "__traceiter_android_vh_folio_trylock_clear" +} +elf_symbol { + id: 0xe6702595 + name: "__traceiter_android_vh_folio_trylock_set" + is_defined: true + symbol_type: FUNCTION + crc: 0xe42ea59b + type_id: 0x9b2a7922 + full_name: "__traceiter_android_vh_folio_trylock_set" +} elf_symbol { id: 0x9e91661b name: "__traceiter_android_vh_free_oem_binder_struct" @@ -345158,6 +345212,15 @@ elf_symbol { type_id: 0x9a2af11b full_name: "__traceiter_android_vh_futex_wake_up_q_finish" } +elf_symbol { + id: 0x30d4a091 + name: "__traceiter_android_vh_get_folio_trylock_result" + is_defined: true + symbol_type: FUNCTION + crc: 0x63cb5a5d + type_id: 0x9b2e0ad9 + full_name: "__traceiter_android_vh_get_folio_trylock_result" +} elf_symbol { id: 0x83b45f32 name: "__traceiter_android_vh_get_page_wmark" @@ -345194,6 +345257,15 @@ elf_symbol { type_id: 0x9b1477ea full_name: "__traceiter_android_vh_gic_v3_suspend" } +elf_symbol { + id: 0x2b2d07aa + name: "__traceiter_android_vh_handle_trylock_failed_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0xaf71ef88 + type_id: 0x9b563284 + full_name: "__traceiter_android_vh_handle_trylock_failed_folio" +} elf_symbol { id: 0x089c5048 name: "__traceiter_android_vh_hibernate_save_cmp_len" @@ -349298,6 +349370,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_do_anonymous_page" } +elf_symbol { + id: 0x4db9ff7c + name: "__tracepoint_android_vh_do_folio_trylock" + is_defined: true + symbol_type: OBJECT + crc: 0x37afa134 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_do_folio_trylock" +} elf_symbol { id: 0x9fe99d05 name: "__tracepoint_android_vh_do_futex" @@ -349460,6 +349541,24 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_filemap_get_folio" } +elf_symbol { + id: 0xa3ede5d5 + name: "__tracepoint_android_vh_folio_trylock_clear" + is_defined: true + symbol_type: OBJECT + crc: 0x1787317f + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_folio_trylock_clear" +} +elf_symbol { + id: 0x539bf337 + name: "__tracepoint_android_vh_folio_trylock_set" + is_defined: true + symbol_type: OBJECT + crc: 0x38c71263 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_folio_trylock_set" +} elf_symbol { id: 0x901d0e89 name: "__tracepoint_android_vh_free_oem_binder_struct" @@ -349649,6 +349748,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_futex_wake_up_q_finish" } +elf_symbol { + id: 0x46c8630b + name: "__tracepoint_android_vh_get_folio_trylock_result" + is_defined: true + symbol_type: OBJECT + crc: 0x07fd5f8f + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_get_folio_trylock_result" +} elf_symbol { id: 0x4756cfec name: "__tracepoint_android_vh_get_page_wmark" @@ -349685,6 +349793,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_gic_v3_suspend" } +elf_symbol { + id: 0x90e3616c + name: "__tracepoint_android_vh_handle_trylock_failed_folio" + is_defined: true + symbol_type: OBJECT + crc: 0x78e2c5cf + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_handle_trylock_failed_folio" +} elf_symbol { id: 0xc388a58e name: "__tracepoint_android_vh_hibernate_save_cmp_len" @@ -391395,6 +391512,15 @@ elf_symbol { type_id: 0x9df3327a full_name: "reciprocal_value" } +elf_symbol { + id: 0xc61bae77 + name: "reclaim_pages" + is_defined: true + symbol_type: FUNCTION + crc: 0x2d55e4f4 + type_id: 0x3e34432b + full_name: "reclaim_pages" +} elf_symbol { id: 0x2a59e35c name: "reclaim_shmem_address_space" @@ -412142,6 +412268,7 @@ interface { symbol_id: 0x0bf2f5bb symbol_id: 0x5c382938 symbol_id: 0x5e9ed424 + symbol_id: 0xada127d2 symbol_id: 0xd593b3ef symbol_id: 0x1cc3aec5 symbol_id: 0xb12728da @@ -412160,6 +412287,8 @@ interface { symbol_id: 0x343adff1 symbol_id: 0x93a4717b symbol_id: 0x49c69e22 + symbol_id: 0x1fca37bf + symbol_id: 0xe6702595 symbol_id: 0x9e91661b symbol_id: 0xc189c2a7 symbol_id: 0x5ecff02f @@ -412181,10 +412310,12 @@ interface { symbol_id: 0xff623c2f symbol_id: 0x7fef736f symbol_id: 0x9fe60f0c + symbol_id: 0x30d4a091 symbol_id: 0x83b45f32 symbol_id: 0x1df03151 symbol_id: 0xdbe4202a symbol_id: 0x88586647 + symbol_id: 0x2b2d07aa symbol_id: 0x089c5048 symbol_id: 0x1ba2e410 symbol_id: 0xdb6662e8 @@ -412641,6 +412772,7 @@ interface { symbol_id: 0x1ddb60ad symbol_id: 0x0ae2ee16 symbol_id: 0x325e746a + symbol_id: 0x4db9ff7c symbol_id: 0x9fe99d05 symbol_id: 0x82ce823f symbol_id: 0x474d211c @@ -412659,6 +412791,8 @@ interface { symbol_id: 0x2121385f symbol_id: 0x50a83025 symbol_id: 0x6d970e8c + symbol_id: 0xa3ede5d5 + symbol_id: 0x539bf337 symbol_id: 0x901d0e89 symbol_id: 0x04a824b5 symbol_id: 0xe6918e09 @@ -412680,10 +412814,12 @@ interface { symbol_id: 0x0c310ebd symbol_id: 0x9b384a49 symbol_id: 0x828646be + symbol_id: 0x46c8630b symbol_id: 0x4756cfec symbol_id: 0x8b7beb3b symbol_id: 0x60a121b4 symbol_id: 0xf18e312d + symbol_id: 0x90e3616c symbol_id: 0xc388a58e symbol_id: 0xc62a97aa symbol_id: 0xf68497fa @@ -417317,6 +417453,7 @@ interface { symbol_id: 0x590d247f symbol_id: 0xa0aae193 symbol_id: 0x91579542 + symbol_id: 0xc61bae77 symbol_id: 0x2a59e35c symbol_id: 0x8fe1956e symbol_id: 0x3b03aaea diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index 7914087866d4..f7daca8d7907 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -458,3 +458,16 @@ __d_lookup_unhash_wake __fs_parse __filemap_get_folio + +#required by mi_async_reclaim.ko +__traceiter_android_vh_handle_trylock_failed_folio +__tracepoint_android_vh_handle_trylock_failed_folio +__traceiter_android_vh_folio_trylock_set +__tracepoint_android_vh_folio_trylock_set +__traceiter_android_vh_folio_trylock_clear +__tracepoint_android_vh_folio_trylock_clear +__traceiter_android_vh_get_folio_trylock_result +__tracepoint_android_vh_get_folio_trylock_result +__traceiter_android_vh_do_folio_trylock +__tracepoint_android_vh_do_folio_trylock +reclaim_pages From 47af2fba7c037c079a7dca2cf300206ce2f6189c Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Wed, 12 Oct 2022 17:15:59 +0000 Subject: [PATCH 15/50] ANDROID: fix kernelci build-break for !CONFIG_ANDROID_VENDOR_OEM_DATA A recent change to add hooks for firmware-based hibernation added a reference to android_vendor_data1 which breaks builds that don't enable vendor data. Fixes: d2cb755a4398 ("ANDROID: vendor hooks: Add hooks to support bootloader based hibernation") Signed-off-by: Todd Kjos Change-Id: I449e968f8d0926c8573150553eed0905faeac3f3 --- arch/arm64/kernel/hibernate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 2ea6bc542101..f7e7ddc0b038 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -120,8 +120,10 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size) hdr->ttbr1_el1 = __pa_symbol(swapper_pg_dir); hdr->reenter_kernel = _cpu_resume; +#ifdef CONFIG_ANDROID_VENDOR_OEM_DATA trace_android_vh_save_cpu_resume(&hdr->android_vendor_data1, __pa(cpu_resume)); +#endif /* We can't use __hyp_get_vectors() because kvm may still be loaded */ if (el2_reset_needed()) From d7387786c2690e8c5cdf792406b7d80cd5358349 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 26 Jul 2024 08:27:27 +0000 Subject: [PATCH 16/50] ANDROID: GKI: remove export of tracing control functions Android GKI kernel modules should NOT have the ability to control the system-wide tracing functionality, nor query to determine if it is on or not. So remove the exports of these functions. Upstream does not wish to do this, so an Android-only change is required. See the bug id for details. Bug: 355584612 Signed-off-by: Greg Kroah-Hartman Change-Id: I50f69cd9930ddc6b876c5c1dd86f51cfb2ee1bac --- kernel/trace/trace.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 504797975615..dc60ce22165c 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -984,7 +984,6 @@ void tracing_on(void) { tracer_tracing_on(&global_trace); } -EXPORT_SYMBOL_GPL(tracing_on); static __always_inline void @@ -1493,7 +1492,6 @@ int tracing_is_on(void) { return tracer_tracing_is_on(&global_trace); } -EXPORT_SYMBOL_GPL(tracing_is_on); static int __init set_buf_size(char *str) { From f571d0bdaaf646036f73ce3155a447c6ba04bd37 Mon Sep 17 00:00:00 2001 From: "karam.lee" Date: Thu, 25 Jul 2024 15:35:02 +0900 Subject: [PATCH 17/50] ANDROID: power: add vendor hook to handle hibernate failures The driver or external module may need handling due to hibernate failure. This error cannot be detected outside of the hibernate() function. so Add a vendor hook to receive and handle errors in hibernate(). Bug: 342523877 Change-Id: I221e26f571d94e5d5c5aae19937945bb8981f85b Signed-off-by: karam.lee --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/power.h | 4 ++++ kernel/power/main.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 79127e704342..0d33ee078bd6 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -440,3 +440,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_folio_trylock_result); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_folio_trylock_clear); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_folio_trylock_set); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_trylock_failed_folio); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_hibernate_state); diff --git a/include/trace/hooks/power.h b/include/trace/hooks/power.h index e845d0ef6025..fcbba69b3f24 100644 --- a/include/trace/hooks/power.h +++ b/include/trace/hooks/power.h @@ -33,6 +33,10 @@ DECLARE_HOOK(android_vh_freq_qos_remove_request, TP_PROTO(struct freq_qos_request *req), TP_ARGS(req)); +DECLARE_HOOK(android_vh_hibernate_state, + TP_PROTO(int error), + TP_ARGS(error)); + #endif /* _TRACE_HOOK_POWER_H */ /* This part must be outside protection */ #include diff --git a/kernel/power/main.c b/kernel/power/main.c index 31ec4a9b9d70..31547d847d06 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "power.h" @@ -639,6 +641,7 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, error = pm_suspend(state); } else if (state == PM_SUSPEND_MAX) { error = hibernate(); + trace_android_vh_hibernate_state(error); } else { error = -EINVAL; } From 6201b295b8cbd81e0f8be925d2231331342d2175 Mon Sep 17 00:00:00 2001 From: "karam.lee" Date: Fri, 26 Jul 2024 11:45:38 +0900 Subject: [PATCH 18/50] ANDROID: Update the ABI symbol list Adding the following symbols: - __traceiter_android_vh_hibernate_state - __tracepoint_android_vh_hibernate_state Bug: 342523877 Change-Id: I249ec4ce3b2db80470b2d4d862acf4a882ece199 Signed-off-by: karam.lee --- android/abi_gki_aarch64.stg | 20 ++++++++++++++++++++ android/abi_gki_aarch64_qcom | 2 ++ 2 files changed, 22 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 7d6567d75384..cd9e692e00fa 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -345275,6 +345275,15 @@ elf_symbol { type_id: 0x987f6fc2 full_name: "__traceiter_android_vh_hibernate_save_cmp_len" } +elf_symbol { + id: 0x3ec3f8ef + name: "__traceiter_android_vh_hibernate_state" + is_defined: true + symbol_type: FUNCTION + crc: 0x563dcb6d + type_id: 0x9a33392f + full_name: "__traceiter_android_vh_hibernate_state" +} elf_symbol { id: 0x1ba2e410 name: "__traceiter_android_vh_hibernated_do_mem_alloc" @@ -349811,6 +349820,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_hibernate_save_cmp_len" } +elf_symbol { + id: 0x78f2c5bd + name: "__tracepoint_android_vh_hibernate_state" + is_defined: true + symbol_type: OBJECT + crc: 0x1a022782 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_hibernate_state" +} elf_symbol { id: 0xc62a97aa name: "__tracepoint_android_vh_hibernated_do_mem_alloc" @@ -412317,6 +412335,7 @@ interface { symbol_id: 0x88586647 symbol_id: 0x2b2d07aa symbol_id: 0x089c5048 + symbol_id: 0x3ec3f8ef symbol_id: 0x1ba2e410 symbol_id: 0xdb6662e8 symbol_id: 0x64c2fe7a @@ -412821,6 +412840,7 @@ interface { symbol_id: 0xf18e312d symbol_id: 0x90e3616c symbol_id: 0xc388a58e + symbol_id: 0x78f2c5bd symbol_id: 0xc62a97aa symbol_id: 0xf68497fa symbol_id: 0xb6603d58 diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index 77fd16ac9585..bcba5106b9e8 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -3445,6 +3445,7 @@ __traceiter_android_vh_ftrace_size_check __traceiter_android_vh_gic_v3_suspend __traceiter_android_vh_hibernate_save_cmp_len + __traceiter_android_vh_hibernate_state __traceiter_android_vh_hibernated_do_mem_alloc __traceiter_android_vh_ignore_dmabuf_vmap_bounds __traceiter_android_vh_init_aes_encrypt @@ -3597,6 +3598,7 @@ __tracepoint_android_vh_ftrace_size_check __tracepoint_android_vh_gic_v3_suspend __tracepoint_android_vh_hibernate_save_cmp_len + __tracepoint_android_vh_hibernate_state __tracepoint_android_vh_hibernated_do_mem_alloc __tracepoint_android_vh_ignore_dmabuf_vmap_bounds __tracepoint_android_vh_init_aes_encrypt From 7fa70ede91bb2bd1b4f2501f460445c3bba772e4 Mon Sep 17 00:00:00 2001 From: Manish Pandey Date: Fri, 26 Jul 2024 11:50:05 +0530 Subject: [PATCH 19/50] UPSTREAM: scsi: ufs: core: Changing the status to check inflight ufshcd_cmd_inflight() is used to check whether or not a command is in progress. Make it skip commands that have already completed by changing the !blk_mq_request_started(rq) check into blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT. We cannot rely on lrbp->cmd since lrbp->cmd is not cleared when a command completes. Link: https://lore.kernel.org/linux-scsi/20230517223157.1068210-3-bvanassche@acm.org/ Signed-off-by: SEO HOYOUNG Link: https://lore.kernel.org/r/20240411071444.51873-1-hy50.seo@samsung.com Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen Bug: 353887042 (cherry picked from commit 13c28be58c2bdb12e554e01b0e35621060068b11) Change-Id: I038c3956c55967f38a339a13c16fe7518ee4eb17 Signed-off-by: Manish Pandey --- drivers/ufs/core/ufshcd.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index aabea7aaf048..3cfea28032bd 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -3035,16 +3035,7 @@ static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, */ bool ufshcd_cmd_inflight(struct scsi_cmnd *cmd) { - struct request *rq; - - if (!cmd) - return false; - - rq = scsi_cmd_to_rq(cmd); - if (!blk_mq_request_started(rq)) - return false; - - return true; + return cmd && blk_mq_rq_state(scsi_cmd_to_rq(cmd)) == MQ_RQ_IN_FLIGHT; } /* From 7d0a1d6b86b65991d5478653c03d737df882eb07 Mon Sep 17 00:00:00 2001 From: Charan Teja Kalla Date: Wed, 24 Jul 2024 22:37:01 +0530 Subject: [PATCH 20/50] ANDROID: mm: madvise: Avoid counting swap entry references for migration entries Race between the madvise(PAGEOUT) and migration caused by page offline can make the swp_swapcount()->_swap_info_get emitting the "Bad swap file entry " message because it is trying to get the info on the migration entry. Add check if it is a migration entry. Bug: 356032508 Fixes: aee36dd53048 ("ANDROID: mm: add vendor hooks in madvise for swap entry") Change-Id: Ia209d2a0103ac506ceae8fd71f733c1dc85443a6 Signed-off-by: Charan Teja Kalla Signed-off-by: Nikhil V --- mm/madvise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/madvise.c b/mm/madvise.c index e445135ed4c1..e1852ea44c8e 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -450,7 +450,8 @@ regular_page: if (!pte_present(ptent)) { entry = pte_to_swp_entry(ptent); - trace_android_vh_madvise_pageout_swap_entry(entry, + if (!is_migration_entry(entry)) + trace_android_vh_madvise_pageout_swap_entry(entry, swp_swapcount(entry)); continue; } From a112c9c24c7ff5401bfb5afebd67ee65d05795fc Mon Sep 17 00:00:00 2001 From: Tiffany Yang Date: Fri, 26 Jul 2024 13:29:58 -0700 Subject: [PATCH 21/50] ANDROID: fsnotify: Do not notify lower fs of open when ENOSYS Even though FUSE supports d_canonical_path, the underlying server may not implement the operation. In that case, follow the same logic for filesystems that do not have the canonical path operation instead of returning early from fsnotify_file with an error. Bug: 326995824 Test: cts-tradefed run commandAndExit cts -m CtsOsTestCases -t android.os.cts.FileObserverTest Change-Id: Iae618d4159222b06467b9a0bbb67fb67885aa65e Signed-off-by: Tiffany Yang (cherry picked from commit 61d32e739d27dd35353a22804023f099b383df3b) --- include/linux/fsnotify.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 102913f26152..09b4cf9c13cd 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -107,15 +107,17 @@ static inline int fsnotify_file(struct file *file, __u32 mask) ret = path->dentry->d_op->d_canonical_path(path, &lower_path); - if (ret) - return ret; + if (ret != -ENOSYS) { + if (ret) + return ret; - ret = fsnotify_parent(lower_path.dentry, mask, - &lower_path, FSNOTIFY_EVENT_PATH); - path_put(&lower_path); + ret = fsnotify_parent(lower_path.dentry, mask, + &lower_path, FSNOTIFY_EVENT_PATH); + path_put(&lower_path); - if (ret) - return ret; + if (ret) + return ret; + } } } From 055518d9f3bfdd13432cd33c239d6688ef60ed81 Mon Sep 17 00:00:00 2001 From: Richard Fung Date: Mon, 20 May 2024 21:45:43 +0000 Subject: [PATCH 22/50] ANDROID: fuse: Skip canonical path logic if ENOSYS Not all FUSE servers have implemented canonical_path such as virtiofs. This patch makes it so they go through the same logic as other filesystems that don't have canonical path implemented. Bug: 330136711 Test: ./cts-tradefed run commandAndExit cts -m CtsIncidentHostTestCases -t com.android.server.cts.ErrorsTest#testTombstone Change-Id: I35f19bd1a12420015128ac9bc2662b9bd252a612 Signed-off-by: Richard Fung (cherry picked from commit 4b0be62caf6923eac6acdb5a44eb03688e6f9dc5) --- fs/notify/inotify/inotify_user.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index cc9bde854e5a..135d5f5456a0 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -786,11 +786,13 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, if (path.dentry->d_op->d_canonical_path) { ret = path.dentry->d_op->d_canonical_path(&path, &alteredpath); - if (ret) - goto path_put_and_out; - - canonical_path = &alteredpath; - path_put(&path); + if (ret != -ENOSYS) { + if (ret) { + goto path_put_and_out; + } + canonical_path = &alteredpath; + path_put(&path); + } } } From 4ac7f55b9824a3019d45a8bfc261db2bb0f9d2ff Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Mon, 22 Jul 2024 11:51:10 +0800 Subject: [PATCH 23/50] UPSTREAM: erofs: fix race in z_erofs_get_gbuf() In z_erofs_get_gbuf(), the current task may be migrated to another CPU between `z_erofs_gbuf_id()` and `spin_lock(&gbuf->lock)`. Therefore, z_erofs_put_gbuf() will trigger the following issue which was found by stress test: <2>[772156.434168] kernel BUG at fs/erofs/zutil.c:58! .. <4>[772156.435007] <4>[772156.439237] CPU: 0 PID: 3078 Comm: stress Kdump: loaded Tainted: G E 6.10.0-rc7+ #2 <4>[772156.439239] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 1.0.0 01/01/2017 <4>[772156.439241] pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) <4>[772156.439243] pc : z_erofs_put_gbuf+0x64/0x70 [erofs] <4>[772156.439252] lr : z_erofs_lz4_decompress+0x600/0x6a0 [erofs] .. <6>[772156.445958] stress (3127): drop_caches: 1 <4>[772156.446120] Call trace: <4>[772156.446121] z_erofs_put_gbuf+0x64/0x70 [erofs] <4>[772156.446761] z_erofs_lz4_decompress+0x600/0x6a0 [erofs] <4>[772156.446897] z_erofs_decompress_queue+0x740/0xa10 [erofs] <4>[772156.447036] z_erofs_runqueue+0x428/0x8c0 [erofs] <4>[772156.447160] z_erofs_readahead+0x224/0x390 [erofs] .. Bug: 356412494 Fixes: f36f3010f676 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable") Cc: # 6.10+ Reviewed-by: Chunhai Guo Reviewed-by: Sandeep Dhavale Reviewed-by: Chao Yu Change-Id: Ic4924c6c14ee27af6f3c89ea5c562493b3c112a4 Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20240722035110.3456740-1-hsiangkao@linux.alibaba.com (cherry picked from commit 7dc5537c3f8be87e005f0844a7626c987914f8fd) Signed-off-by: Sandeep Dhavale --- fs/erofs/zutil.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c index 86ff23db6084..e8e901c839a7 100644 --- a/fs/erofs/zutil.c +++ b/fs/erofs/zutil.c @@ -38,11 +38,13 @@ void *z_erofs_get_gbuf(unsigned int requiredpages) { struct z_erofs_gbuf *gbuf; + migrate_disable(); 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); + migrate_enable(); /* (for sparse checker) pretend gbuf->lock is still taken */ __acquire(gbuf->lock); return NULL; @@ -57,6 +59,7 @@ void z_erofs_put_gbuf(void *ptr) __releases(gbuf->lock) gbuf = &z_erofs_gbufpool[z_erofs_gbuf_id()]; DBG_BUGON(gbuf->ptr != ptr); spin_unlock(&gbuf->lock); + migrate_enable(); } int z_erofs_gbuf_growsize(unsigned int nrpages) From 6aafd06a463b5af31c4e652571f59995bf93c6d5 Mon Sep 17 00:00:00 2001 From: Ajit Singh Raghav Date: Fri, 2 Aug 2024 14:49:06 +0530 Subject: [PATCH 24/50] ANDROID: GKI: Add symbol list for exynosauto netdev_master_upper_dev_get nla_append These symbols are required to use WIFI BCM driver. Following functions are added in STG file through abi_update 1 function symbol(s) added 'struct net_device* netdev_master_upper_dev_get(struct net_device*)' Bug: 357016601 Change-Id: Iff752b54d88258f2d61fab397da1104145c9297f Signed-off-by: Ajit Singh Raghav --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_exynosauto | 2 ++ 2 files changed, 12 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index cd9e692e00fa..9a90420f7da3 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -382842,6 +382842,15 @@ elf_symbol { type_id: 0x1c532cf2 full_name: "netdev_lower_state_changed" } +elf_symbol { + id: 0x89470a34 + name: "netdev_master_upper_dev_get" + is_defined: true + symbol_type: FUNCTION + crc: 0x8cda1aa4 + type_id: 0xf0da0508 + full_name: "netdev_master_upper_dev_get" +} elf_symbol { id: 0x178677d3 name: "netdev_master_upper_dev_link" @@ -416508,6 +416517,7 @@ interface { symbol_id: 0x06bf2dbd symbol_id: 0x5635039f symbol_id: 0x5a4e487e + symbol_id: 0x89470a34 symbol_id: 0x178677d3 symbol_id: 0xb4ca02f0 symbol_id: 0x9b8c6a7d diff --git a/android/abi_gki_aarch64_exynosauto b/android/abi_gki_aarch64_exynosauto index 8b17937b623d..643e5949901f 100644 --- a/android/abi_gki_aarch64_exynosauto +++ b/android/abi_gki_aarch64_exynosauto @@ -440,7 +440,9 @@ netdev_err netdev_info netdev_is_rx_handler_busy + netdev_master_upper_dev_get netdev_warn + nla_append noop_llseek nr_cpu_ids nsecs_to_jiffies From c0cf9ce611e282f0ac08cf8dea9815a4ffdba3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 13 Mar 2024 22:19:56 +0100 Subject: [PATCH 25/50] UPSTREAM: lib/build_OID_registry: don't mention the full path of the script in output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change strips the full path of the script generating lib/oid_registry_data.c to just lib/build_OID_registry. The motivation for this change is Yocto emitting a build warning File /usr/src/debug/linux-lxatac/6.7-r0/lib/oid_registry_data.c in package linux-lxatac-src contains reference to TMPDIR [buildpaths] So this change brings us one step closer to make the build result reproducible independent of the build path. Link: https://lkml.kernel.org/r/20240313211957.884561-2-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König Cc: Masahiro Yamada Reviewed-by: Nicolas Schier Signed-off-by: Andrew Morton Bug: 346559442 Bug: 347759457 Change-Id: I09c19f26fd33ed95106174cd2f2fc7217ba99f34 (cherry picked from commit 5ef6dc08cfde240b8c748733759185646e654570) Signed-off-by: Giuliano Procida --- lib/build_OID_registry | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/build_OID_registry b/lib/build_OID_registry index d7fc32ea8ac2..56d8bafeb848 100755 --- a/lib/build_OID_registry +++ b/lib/build_OID_registry @@ -8,6 +8,7 @@ # use strict; +use Cwd qw(abs_path); my @names = (); my @oids = (); @@ -17,6 +18,8 @@ if ($#ARGV != 1) { exit(2); } +my $abs_srctree = abs_path($ENV{'srctree'}); + # # Open the file to read from # @@ -35,7 +38,7 @@ close IN_FILE || die; # open C_FILE, ">$ARGV[1]" or die; print C_FILE "/*\n"; -print C_FILE " * Automatically generated by ", $0, ". Do not edit\n"; +print C_FILE " * Automatically generated by ", $0 =~ s#^\Q$abs_srctree/\E##r, ". Do not edit\n"; print C_FILE " */\n"; # From 37391192a93aed8e29291c4d32bd5a3f3b19fa22 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Mon, 1 Jul 2024 17:58:01 +0200 Subject: [PATCH 26/50] UPSTREAM: lib/build_OID_registry: avoid non-destructive substitution for Perl < 5.13.2 compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a system with Perl 5.12.1, commit 5ef6dc08cfde ("lib/build_OID_registry: don't mention the full path of the script in output") causes the build to fail with the error below. Bareword found where operator expected at ./lib/build_OID_registry line 41, near "s#^\Q$abs_srctree/\E##r" syntax error at ./lib/build_OID_registry line 41, near "s#^\Q$abs_srctree/\E##r" Execution of ./lib/build_OID_registry aborted due to compilation errors. make[3]: *** [lib/Makefile:352: lib/oid_registry_data.c] Error 255 Ahmad Fatoum analyzed that non-destructive substitution is only supported since Perl 5.13.2. Instead of dropping `r` and having the side effect of modifying `$0`, introduce a dedicated variable to support older Perl versions. Link: https://lkml.kernel.org/r/20240702223512.8329-2-pmenzel@molgen.mpg.de Link: https://lkml.kernel.org/r/20240701155802.75152-1-pmenzel@molgen.mpg.de Fixes: 5ef6dc08cfde ("lib/build_OID_registry: don't mention the full path of the script in output") Link: https://lore.kernel.org/all/259f7a87-2692-480e-9073-1c1c35b52f67@molgen.mpg.de/ Signed-off-by: Paul Menzel Suggested-by: Ahmad Fatoum Cc: Uwe Kleine-König Cc: Nicolas Schier Cc: Masahiro Yamada Cc: Ahmad Fatoum Signed-off-by: Andrew Morton Bug: 346559442 Bug: 347759457 Change-Id: I367a4d22f3c27c8912703d061360e5aa2c7a5642 (cherry picked from commit 2fe29fe945637b9834c5569fbb1c9d4f881d8263) Signed-off-by: Giuliano Procida --- lib/build_OID_registry | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/build_OID_registry b/lib/build_OID_registry index 56d8bafeb848..8267e8d71338 100755 --- a/lib/build_OID_registry +++ b/lib/build_OID_registry @@ -38,7 +38,9 @@ close IN_FILE || die; # open C_FILE, ">$ARGV[1]" or die; print C_FILE "/*\n"; -print C_FILE " * Automatically generated by ", $0 =~ s#^\Q$abs_srctree/\E##r, ". Do not edit\n"; +my $scriptname = $0; +$scriptname =~ s#^\Q$abs_srctree/\E##; +print C_FILE " * Automatically generated by ", $scriptname, ". Do not edit\n"; print C_FILE " */\n"; # From 1bb38f786569a713fee1a7c98f7304369e36635b Mon Sep 17 00:00:00 2001 From: Petr Pavlu Date: Fri, 17 May 2024 15:40:08 +0200 Subject: [PATCH 27/50] UPSTREAM: ring-buffer: Fix a race between readers and resize checks The reader code in rb_get_reader_page() swaps a new reader page into the ring buffer by doing cmpxchg on old->list.prev->next to point it to the new page. Following that, if the operation is successful, old->list.next->prev gets updated too. This means the underlying doubly-linked list is temporarily inconsistent, page->prev->next or page->next->prev might not be equal back to page for some page in the ring buffer. The resize operation in ring_buffer_resize() can be invoked in parallel. It calls rb_check_pages() which can detect the described inconsistency and stop further tracing: [ 190.271762] ------------[ cut here ]------------ [ 190.271771] WARNING: CPU: 1 PID: 6186 at kernel/trace/ring_buffer.c:1467 rb_check_pages.isra.0+0x6a/0xa0 [ 190.271789] Modules linked in: [...] [ 190.271991] Unloaded tainted modules: intel_uncore_frequency(E):1 skx_edac(E):1 [ 190.272002] CPU: 1 PID: 6186 Comm: cmd.sh Kdump: loaded Tainted: G E 6.9.0-rc6-default #5 158d3e1e6d0b091c34c3b96bfd99a1c58306d79f [ 190.272011] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552c-rebuilt.opensuse.org 04/01/2014 [ 190.272015] RIP: 0010:rb_check_pages.isra.0+0x6a/0xa0 [ 190.272023] Code: [...] [ 190.272028] RSP: 0018:ffff9c37463abb70 EFLAGS: 00010206 [ 190.272034] RAX: ffff8eba04b6cb80 RBX: 0000000000000007 RCX: ffff8eba01f13d80 [ 190.272038] RDX: ffff8eba01f130c0 RSI: ffff8eba04b6cd00 RDI: ffff8eba0004c700 [ 190.272042] RBP: ffff8eba0004c700 R08: 0000000000010002 R09: 0000000000000000 [ 190.272045] R10: 00000000ffff7f52 R11: ffff8eba7f600000 R12: ffff8eba0004c720 [ 190.272049] R13: ffff8eba00223a00 R14: 0000000000000008 R15: ffff8eba067a8000 [ 190.272053] FS: 00007f1bd64752c0(0000) GS:ffff8eba7f680000(0000) knlGS:0000000000000000 [ 190.272057] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 190.272061] CR2: 00007f1bd6662590 CR3: 000000010291e001 CR4: 0000000000370ef0 [ 190.272070] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 190.272073] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 190.272077] Call Trace: [ 190.272098] [ 190.272189] ring_buffer_resize+0x2ab/0x460 [ 190.272199] __tracing_resize_ring_buffer.part.0+0x23/0xa0 [ 190.272206] tracing_resize_ring_buffer+0x65/0x90 [ 190.272216] tracing_entries_write+0x74/0xc0 [ 190.272225] vfs_write+0xf5/0x420 [ 190.272248] ksys_write+0x67/0xe0 [ 190.272256] do_syscall_64+0x82/0x170 [ 190.272363] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 190.272373] RIP: 0033:0x7f1bd657d263 [ 190.272381] Code: [...] [ 190.272385] RSP: 002b:00007ffe72b643f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 190.272391] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f1bd657d263 [ 190.272395] RDX: 0000000000000002 RSI: 0000555a6eb538e0 RDI: 0000000000000001 [ 190.272398] RBP: 0000555a6eb538e0 R08: 000000000000000a R09: 0000000000000000 [ 190.272401] R10: 0000555a6eb55190 R11: 0000000000000246 R12: 00007f1bd6662500 [ 190.272404] R13: 0000000000000002 R14: 00007f1bd6667c00 R15: 0000000000000002 [ 190.272412] [ 190.272414] ---[ end trace 0000000000000000 ]--- Note that ring_buffer_resize() calls rb_check_pages() only if the parent trace_buffer has recording disabled. Recent commit d78ab792705c ("tracing: Stop current tracer when resizing buffer") causes that it is now always the case which makes it more likely to experience this issue. The window to hit this race is nonetheless very small. To help reproducing it, one can add a delay loop in rb_get_reader_page(): ret = rb_head_page_replace(reader, cpu_buffer->reader_page); if (!ret) goto spin; for (unsigned i = 0; i < 1U << 26; i++) /* inserted delay loop */ __asm__ __volatile__ ("" : : : "memory"); rb_list_head(reader->list.next)->prev = &cpu_buffer->reader_page->list; .. and then run the following commands on the target system: echo 1 > /sys/kernel/tracing/events/sched/sched_switch/enable while true; do echo 16 > /sys/kernel/tracing/buffer_size_kb; sleep 0.1 echo 8 > /sys/kernel/tracing/buffer_size_kb; sleep 0.1 done & while true; do for i in /sys/kernel/tracing/per_cpu/*; do timeout 0.1 cat $i/trace_pipe; sleep 0.2 done done To fix the problem, make sure ring_buffer_resize() doesn't invoke rb_check_pages() concurrently with a reader operating on the same ring_buffer_per_cpu by taking its cpu_buffer->reader_lock. Link: https://lore.kernel.org/linux-trace-kernel/20240517134008.24529-3-petr.pavlu@suse.com Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Fixes: 659f451ff213 ("ring-buffer: Add integrity check at end of iter read") Signed-off-by: Petr Pavlu [ Fixed whitespace ] Signed-off-by: Steven Rostedt (Google) Bug: 357487733 Change-Id: Ieed52c111e4f4f969a88be1221118eee6e3b4837 (cherry picked from commit c2274b908db05529980ec056359fae916939fdaa) Signed-off-by: Youngmin Nam --- kernel/trace/ring_buffer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 036d5d9d4dea..1e4335c501d2 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1573,6 +1573,11 @@ static int rb_check_bpage(struct ring_buffer_per_cpu *cpu_buffer, * * As a safety measure we check to make sure the data pages have not * been corrupted. + * + * Callers of this function need to guarantee that the list of pages doesn't get + * modified during the check. In particular, if it's possible that the function + * is invoked with concurrent readers which can swap in a new reader page then + * the caller should take cpu_buffer->reader_lock. */ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer) { @@ -2322,8 +2327,12 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size, */ synchronize_rcu(); for_each_buffer_cpu(buffer, cpu) { + unsigned long flags; + cpu_buffer = buffer->buffers[cpu]; + raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); rb_check_pages(cpu_buffer); + raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); } atomic_dec(&buffer->record_disabled); } From 99d09135c4ef79052226a4d6dd2a714cca3bec0e Mon Sep 17 00:00:00 2001 From: nischaljain Date: Tue, 6 Aug 2024 08:43:26 +0000 Subject: [PATCH 28/50] ANDROID: Update the ABI symbol list Adding the `devfreq_get_devfreq_by_phandle` symbol. Bug: 336947817 Change-Id: I5db1e6c7ba5a845f2116aa0e5438e7f8fece4a65 Signed-off-by: nischaljain --- 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 d5ca9215f400..b5f76e2c4030 100644 --- a/android/abi_gki_aarch64_pixel +++ b/android/abi_gki_aarch64_pixel @@ -367,6 +367,7 @@ dev_fetch_sw_netstats devfreq_add_device devfreq_add_governor + devfreq_get_devfreq_by_phandle devfreq_monitor_resume devfreq_monitor_start devfreq_monitor_stop From 7003f6b36a9b0b2b32d3b19f84c4402afedf7c62 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Wed, 31 Jul 2024 15:05:04 +0800 Subject: [PATCH 29/50] UPSTREAM: ufs: core: bypass quick recovery if need force reset If force_reset is true, bypass quick recovery. This will shorten error recovery time. Bug: 356536706 Change-Id: I86ce0e8ac79b61e203a8fdad5369d540ae873cc0 Signed-off-by: Peter Wang Link: https://lore.kernel.org/r/20240712094506.11284-1-peter.wang@mediatek.com Reviewed-by: Bean Huo Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen (cherry picked from commit 022587d8aec3da1d1698ddae9fb8cfe35f3ad49c) --- drivers/ufs/core/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 3cfea28032bd..bd8cbd64758d 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -6572,7 +6572,8 @@ again: if (ufshcd_err_handling_should_stop(hba)) goto skip_err_handling; - if (hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) { + if ((hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) && + !hba->force_reset) { bool ret; spin_unlock_irqrestore(hba->host->host_lock, flags); From be8ff39d2e99dcd594447dea26ed70d7e9ecced6 Mon Sep 17 00:00:00 2001 From: Sukjin Kong Date: Thu, 8 Aug 2024 12:53:09 +0900 Subject: [PATCH 30/50] ANDROID: GKI: add symbol list for telechips Add symbol list file abi_gki_aarch64_telechips INFO: 18 function symbol(s) added 'int devm_clk_hw_register_clkdev(struct device*, struct clk_hw*, const char*, const char*)' 'struct fwnode_handle* fwnode_get_next_parent(struct fwnode_handle*)' 'struct fwnode_handle* fwnode_get_parent(const struct fwnode_handle*)' 'int linear_range_get_value_array(const struct linear_range*, int, unsigned int, unsigned int*)' 'int media_device_register_entity(struct media_device*, struct media_entity*)' 'struct media_link* media_entity_find_link(struct media_pad*, struct media_pad*)' 'void* of_fdt_unflatten_tree(const unsigned long*, struct device_node*, struct device_node**)' 'int regmap_irq_chip_get_base(struct regmap_irq_chip_data*)' 'int regulator_mode_to_status(unsigned int)' 'int regulator_set_soft_start_regmap(struct regulator_dev*)' 'int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime*, unsigned int, snd_pcm_hw_param_t)' 'int snd_soc_dai_set_clkdiv(struct snd_soc_dai*, int, int)' 'void symbol_put_addr(void*)' 'int trace_define_field(struct trace_event_call*, const char*, const char*, int, int, int, int)' 'int uart_parse_earlycon(char*, unsigned char*, resource_size_t*, char**)' 'int v4l2_fill_pixfmt_mp(struct v4l2_pix_format_mplane*, u32, u32, u32)' 'int vfs_fsync(struct file*, int)' 'int vsscanf(const char*, const char*, va_list)' 1 variable symbol(s) added 'const struct kernel_param_ops param_ops_short' Bug: 358151308 Signed-off-by: Sukjin Kong Change-Id: I13cefc3999f4e8a0b748c126cb179ac5f6c61e22 --- BUILD.bazel | 1 + android/abi_gki_aarch64.stg | 282 ++++++ android/abi_gki_aarch64_telechips | 1567 +++++++++++++++++++++++++++++ 3 files changed, 1850 insertions(+) create mode 100644 android/abi_gki_aarch64_telechips diff --git a/BUILD.bazel b/BUILD.bazel index 1652ff9eb857..5b7a4f7675a7 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -120,6 +120,7 @@ filegroup( "android/abi_gki_aarch64_qcom", "android/abi_gki_aarch64_rockchip", "android/abi_gki_aarch64_sony", + "android/abi_gki_aarch64_telechips", "android/abi_gki_aarch64_tuxera", "android/abi_gki_aarch64_type_visibility", "android/abi_gki_aarch64_unisoc", diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 9a90420f7da3..f9793aea24b5 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -7998,6 +7998,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x6a2e770c } +pointer_reference { + id: 0x101c58b0 + kind: POINTER + pointee_type_id: 0x6a31845f +} pointer_reference { id: 0x101cb45e kind: POINTER @@ -308077,6 +308082,13 @@ function { parameter_id: 0x11c404ba parameter_id: 0x11c404ba } +function { + id: 0x59ee5be0 + return_type_id: 0x18bd6530 + parameter_id: 0x3ea31487 + parameter_id: 0x347303b4 + parameter_id: 0x078cf94a +} function { id: 0x59f18b0b return_type_id: 0x1d5bae2a @@ -313505,6 +313517,14 @@ function { parameter_id: 0x32a623d7 parameter_id: 0x397d1060 } +function { + id: 0x91cdaeeb + return_type_id: 0x6720d32f + parameter_id: 0x37030053 + parameter_id: 0x6720d32f + parameter_id: 0x4585663f + parameter_id: 0x1bf16028 +} function { id: 0x91cfc9b1 return_type_id: 0x6720d32f @@ -315098,6 +315118,13 @@ function { parameter_id: 0x6720d32f parameter_id: 0x2ec35650 } +function { + id: 0x92c5f5e6 + return_type_id: 0x6720d32f + parameter_id: 0x3e10b518 + parameter_id: 0x3e10b518 + parameter_id: 0xe5e56f65 +} function { id: 0x92c62246 return_type_id: 0x6720d32f @@ -317248,6 +317275,17 @@ function { parameter_id: 0x4585663f parameter_id: 0x18bd6530 } +function { + id: 0x94d18288 + return_type_id: 0x6720d32f + parameter_id: 0x269c8e40 + parameter_id: 0x3e10b518 + parameter_id: 0x3e10b518 + parameter_id: 0x6720d32f + parameter_id: 0x6720d32f + parameter_id: 0x6720d32f + parameter_id: 0x6720d32f +} function { id: 0x94d2e9bf return_type_id: 0x6720d32f @@ -320171,6 +320209,12 @@ function { parameter_id: 0x6720d32f parameter_id: 0x0b30ee00 } +function { + id: 0x9872597b + return_type_id: 0x6720d32f + parameter_id: 0x16239d0c + parameter_id: 0x1e9745d3 +} function { id: 0x9872969e return_type_id: 0x6720d32f @@ -321416,6 +321460,11 @@ function { parameter_id: 0xeb0f6de6 parameter_id: 0x4585663f } +function { + id: 0x9975b4d5 + return_type_id: 0x6720d32f + parameter_id: 0x13d55fea +} function { id: 0x99777843 return_type_id: 0x6720d32f @@ -322324,6 +322373,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x1e9745d3 } +function { + id: 0x9a26fadb + return_type_id: 0x6720d32f + parameter_id: 0x18ea6ae3 + parameter_id: 0x6720d32f +} function { id: 0x9a299233 return_type_id: 0x6720d32f @@ -322965,6 +323020,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x1c34b0f2 } +function { + id: 0x9a92b385 + return_type_id: 0x6720d32f + parameter_id: 0x101c58b0 + parameter_id: 0xc9082b19 + parameter_id: 0xc9082b19 + parameter_id: 0xc9082b19 +} function { id: 0x9a92e3b1 return_type_id: 0x6720d32f @@ -329263,6 +329326,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x056cf603 } +function { + id: 0x9cdc07b8 + return_type_id: 0x6720d32f + parameter_id: 0x0483e6f8 + parameter_id: 0x1df06cce + parameter_id: 0x2fc964c0 + parameter_id: 0x0bb0c019 +} function { id: 0x9cde7bf7 return_type_id: 0x6720d32f @@ -329865,6 +329936,14 @@ function { parameter_id: 0x6720d32f parameter_id: 0x31e0e6c6 } +function { + id: 0x9d323390 + return_type_id: 0x6720d32f + parameter_id: 0x0258f96e + parameter_id: 0x0ae4a2c7 + parameter_id: 0x3e10b518 + parameter_id: 0x3e10b518 +} function { id: 0x9d328b5e return_type_id: 0x6720d32f @@ -330785,6 +330864,13 @@ function { parameter_id: 0x01c5a749 parameter_id: 0x12651688 } +function { + id: 0x9db871b3 + return_type_id: 0x6720d32f + parameter_id: 0x04c27a37 + parameter_id: 0x4585663f + parameter_id: 0x78662640 +} function { id: 0x9db8b5e8 return_type_id: 0x6720d32f @@ -336986,6 +337072,12 @@ function { parameter_id: 0x7b64642a parameter_id: 0x499ec4e1 } +function { + id: 0xddfd5a57 + return_type_id: 0x3ae3ff84 + parameter_id: 0x1cc6bdca + parameter_id: 0x1cc6bdca +} function { id: 0xddfd6c01 return_type_id: 0x3ae3ff84 @@ -362014,6 +362106,15 @@ elf_symbol { type_id: 0x9d3d4fff full_name: "devm_clk_hw_register" } +elf_symbol { + id: 0x159517e6 + name: "devm_clk_hw_register_clkdev" + is_defined: true + symbol_type: FUNCTION + crc: 0xadb51090 + type_id: 0x9d323390 + full_name: "devm_clk_hw_register_clkdev" +} elf_symbol { id: 0x61438d3a name: "devm_clk_hw_register_fixed_factor_parent_hw" @@ -371016,6 +371117,24 @@ elf_symbol { type_id: 0x36f1d1fd full_name: "fwnode_get_next_child_node" } +elf_symbol { + id: 0x2cf14595 + name: "fwnode_get_next_parent" + is_defined: true + symbol_type: FUNCTION + crc: 0x49ffea11 + type_id: 0x3842a55f + full_name: "fwnode_get_next_parent" +} +elf_symbol { + id: 0x0648e7f7 + name: "fwnode_get_parent" + is_defined: true + symbol_type: FUNCTION + crc: 0xb8e0f25c + type_id: 0x36e39310 + full_name: "fwnode_get_parent" +} elf_symbol { id: 0xff713254 name: "fwnode_get_phy_node" @@ -380281,6 +380400,15 @@ elf_symbol { type_id: 0x9150cafb full_name: "linear_range_get_value" } +elf_symbol { + id: 0xd2a1adff + name: "linear_range_get_value_array" + is_defined: true + symbol_type: FUNCTION + crc: 0x932c8d7a + type_id: 0x91cdaeeb + full_name: "linear_range_get_value_array" +} elf_symbol { id: 0x91e9c466 name: "linkwatch_fire_event" @@ -380947,6 +381075,15 @@ elf_symbol { type_id: 0x1510b6d0 full_name: "media_device_init" } +elf_symbol { + id: 0xe245d69b + name: "media_device_register_entity" + is_defined: true + symbol_type: FUNCTION + crc: 0xfb89df71 + type_id: 0x9872597b + full_name: "media_device_register_entity" +} elf_symbol { id: 0x84271f20 name: "media_device_unregister" @@ -380974,6 +381111,15 @@ elf_symbol { type_id: 0x144a285c full_name: "media_devnode_remove" } +elf_symbol { + id: 0x53ff8fb5 + name: "media_entity_find_link" + is_defined: true + symbol_type: FUNCTION + crc: 0x598824ed + type_id: 0xddfd5a57 + full_name: "media_entity_find_link" +} elf_symbol { id: 0xd0b869bf name: "media_entity_pads_init" @@ -384453,6 +384599,15 @@ elf_symbol { type_id: 0x91a3a43e full_name: "of_drm_get_panel_orientation" } +elf_symbol { + id: 0x38e8930e + name: "of_fdt_unflatten_tree" + is_defined: true + symbol_type: FUNCTION + crc: 0x11d0f72f + type_id: 0x59ee5be0 + full_name: "of_fdt_unflatten_tree" +} elf_symbol { id: 0x33b9622b name: "of_find_all_nodes" @@ -386067,6 +386222,15 @@ elf_symbol { type_id: 0xd865d5b5 full_name: "param_ops_long" } +elf_symbol { + id: 0xa94e278d + name: "param_ops_short" + is_defined: true + symbol_type: OBJECT + crc: 0x3c7d8485 + type_id: 0xd865d5b5 + full_name: "param_ops_short" +} elf_symbol { id: 0xbbecac69 name: "param_ops_string" @@ -392133,6 +392297,15 @@ elf_symbol { type_id: 0x9feaece8 full_name: "regmap_get_val_bytes" } +elf_symbol { + id: 0x998dd559 + name: "regmap_irq_chip_get_base" + is_defined: true + symbol_type: FUNCTION + crc: 0x6e89a560 + type_id: 0x9975b4d5 + full_name: "regmap_irq_chip_get_base" +} elf_symbol { id: 0x6ff192fd name: "regmap_irq_get_domain" @@ -392592,6 +392765,15 @@ elf_symbol { type_id: 0x9fdbb984 full_name: "regulator_map_voltage_linear_range" } +elf_symbol { + id: 0xd07210c3 + name: "regulator_mode_to_status" + is_defined: true + symbol_type: FUNCTION + crc: 0x56310925 + type_id: 0x8ce1baa0 + full_name: "regulator_mode_to_status" +} elf_symbol { id: 0x4893b166 name: "regulator_notifier_call_chain" @@ -392700,6 +392882,15 @@ elf_symbol { type_id: 0x9fc271b0 full_name: "regulator_set_ramp_delay_regmap" } +elf_symbol { + id: 0xe85ab0d2 + name: "regulator_set_soft_start_regmap" + is_defined: true + symbol_type: FUNCTION + crc: 0x5d36295a + type_id: 0x9e5ef2fc + full_name: "regulator_set_soft_start_regmap" +} elf_symbol { id: 0xc20a2c2c name: "regulator_set_voltage" @@ -397840,6 +398031,15 @@ elf_symbol { type_id: 0x9d419277 full_name: "snd_pcm_hw_constraint_minmax" } +elf_symbol { + id: 0xb501156e + name: "snd_pcm_hw_constraint_pow2" + is_defined: true + symbol_type: FUNCTION + crc: 0x845cbd28 + type_id: 0x9db871b3 + full_name: "snd_pcm_hw_constraint_pow2" +} elf_symbol { id: 0x39aa3d60 name: "snd_pcm_hw_constraint_ratnums" @@ -398353,6 +398553,15 @@ elf_symbol { type_id: 0x9ddaf106 full_name: "snd_soc_dai_set_channel_map" } +elf_symbol { + id: 0x2af41ab1 + name: "snd_soc_dai_set_clkdiv" + is_defined: true + symbol_type: FUNCTION + crc: 0xfdfbbc30 + type_id: 0x9d4e4357 + full_name: "snd_soc_dai_set_clkdiv" +} elf_symbol { id: 0x99dadb46 name: "snd_soc_dai_set_fmt" @@ -400705,6 +400914,15 @@ elf_symbol { type_id: 0xcedb7efb full_name: "swiotlb_max_segment" } +elf_symbol { + id: 0xa24d2a51 + name: "symbol_put_addr" + is_defined: true + symbol_type: FUNCTION + crc: 0x66d87d38 + type_id: 0x16b708df + full_name: "symbol_put_addr" +} elf_symbol { id: 0x1fe11014 name: "sync_blockdev" @@ -402325,6 +402543,15 @@ elf_symbol { type_id: 0x57dbd34b full_name: "trace_clock_local" } +elf_symbol { + id: 0x67b21624 + name: "trace_define_field" + is_defined: true + symbol_type: FUNCTION + crc: 0xb9edc17c + type_id: 0x94d18288 + full_name: "trace_define_field" +} elf_symbol { id: 0x0e209244 name: "trace_event_buffer_commit" @@ -404035,6 +404262,15 @@ elf_symbol { type_id: 0x11b3c739 full_name: "uart_insert_char" } +elf_symbol { + id: 0x637e9bac + name: "uart_parse_earlycon" + is_defined: true + symbol_type: FUNCTION + crc: 0xc5a5c678 + type_id: 0x9cdc07b8 + full_name: "uart_parse_earlycon" +} elf_symbol { id: 0xffeb078f name: "uart_parse_options" @@ -407914,6 +408150,15 @@ elf_symbol { type_id: 0x9bba7997 full_name: "v4l2_fh_release" } +elf_symbol { + id: 0xb8019067 + name: "v4l2_fill_pixfmt_mp" + is_defined: true + symbol_type: FUNCTION + crc: 0x6e9acc41 + type_id: 0x9a92b385 + full_name: "v4l2_fill_pixfmt_mp" +} elf_symbol { id: 0x538ad5cc name: "v4l2_find_dv_timings_cap" @@ -409012,6 +409257,15 @@ elf_symbol { type_id: 0x1edf94e9 full_name: "vfree" } +elf_symbol { + id: 0x39607d61 + name: "vfs_fsync" + is_defined: true + symbol_type: FUNCTION + crc: 0x8da78e7f + type_id: 0x9a26fadb + full_name: "vfs_fsync" +} elf_symbol { id: 0x1499f6a1 name: "vfs_fsync_range" @@ -410245,6 +410499,15 @@ elf_symbol { type_id: 0x9c61211e full_name: "vsprintf" } +elf_symbol { + id: 0xf29d7680 + name: "vsscanf" + is_defined: true + symbol_type: FUNCTION + crc: 0x50d035c2 + type_id: 0x92c5f5e6 + full_name: "vsscanf" +} elf_symbol { id: 0xbd4af188 name: "vunmap" @@ -414205,6 +414468,7 @@ interface { symbol_id: 0xf569682d symbol_id: 0x8837a38c symbol_id: 0x0d9ec99a + symbol_id: 0x159517e6 symbol_id: 0x61438d3a symbol_id: 0xdeeb802d symbol_id: 0x78407718 @@ -415203,6 +415467,8 @@ interface { symbol_id: 0x183013c2 symbol_id: 0xbf494c6d symbol_id: 0x55d636ec + symbol_id: 0x2cf14595 + symbol_id: 0x0648e7f7 symbol_id: 0xff713254 symbol_id: 0x02e45228 symbol_id: 0x90df3dac @@ -416232,6 +416498,7 @@ interface { symbol_id: 0xb514ffaf symbol_id: 0x7d03c60e symbol_id: 0x6149caff + symbol_id: 0xd2a1adff symbol_id: 0x91e9c466 symbol_id: 0xf33d71ea symbol_id: 0xc50733a4 @@ -416306,9 +416573,11 @@ interface { symbol_id: 0x57c27f6f symbol_id: 0x9eddc572 symbol_id: 0xa54f3ef4 + symbol_id: 0xe245d69b symbol_id: 0x84271f20 symbol_id: 0xf60a5d60 symbol_id: 0xea64439d + symbol_id: 0x53ff8fb5 symbol_id: 0xd0b869bf symbol_id: 0x3e285e2f symbol_id: 0xf5924d9f @@ -416696,6 +416965,7 @@ interface { symbol_id: 0xd37bdc53 symbol_id: 0x1d42003f symbol_id: 0xf3b2b115 + symbol_id: 0x38e8930e symbol_id: 0x33b9622b symbol_id: 0x985c43d8 symbol_id: 0xd5545a99 @@ -416875,6 +417145,7 @@ interface { symbol_id: 0xb3d7f6dd symbol_id: 0x24c72ae5 symbol_id: 0x5269af0f + symbol_id: 0xa94e278d symbol_id: 0xbbecac69 symbol_id: 0x73430331 symbol_id: 0x3e079c30 @@ -417549,6 +417820,7 @@ interface { symbol_id: 0x2b688ec7 symbol_id: 0x700d1b28 symbol_id: 0x248856c2 + symbol_id: 0x998dd559 symbol_id: 0x6ff192fd symbol_id: 0x3deea824 symbol_id: 0x90b29211 @@ -417600,6 +417872,7 @@ interface { symbol_id: 0xa66866da symbol_id: 0xcbfd8cea symbol_id: 0x2804801a + symbol_id: 0xd07210c3 symbol_id: 0x4893b166 symbol_id: 0xbf6a903f symbol_id: 0xfd977d86 @@ -417612,6 +417885,7 @@ interface { symbol_id: 0x1764380c symbol_id: 0x5a67d15f symbol_id: 0xfb766d3e + symbol_id: 0xe85ab0d2 symbol_id: 0xc20a2c2c symbol_id: 0x0b03a904 symbol_id: 0x2bce772d @@ -418183,6 +418457,7 @@ interface { symbol_id: 0x0e8fdef9 symbol_id: 0x9dc5f190 symbol_id: 0x4436f3b6 + symbol_id: 0xb501156e symbol_id: 0x39aa3d60 symbol_id: 0xc6fd5d28 symbol_id: 0x3a3577fc @@ -418240,6 +418515,7 @@ interface { symbol_id: 0x3300426e symbol_id: 0x1d763a17 symbol_id: 0x407cd33b + symbol_id: 0x2af41ab1 symbol_id: 0x99dadb46 symbol_id: 0x7f8de782 symbol_id: 0x6a0561ba @@ -418502,6 +418778,7 @@ interface { symbol_id: 0xdf289104 symbol_id: 0x44e002a2 symbol_id: 0xd5e0987f + symbol_id: 0xa24d2a51 symbol_id: 0x1fe11014 symbol_id: 0x8c7e628f symbol_id: 0x75fe69c4 @@ -418682,6 +418959,7 @@ interface { symbol_id: 0x86b2ecdf symbol_id: 0xa274099f symbol_id: 0x00fb9c6d + symbol_id: 0x67b21624 symbol_id: 0x0e209244 symbol_id: 0xe8ad61b2 symbol_id: 0x4f11a926 @@ -418872,6 +419150,7 @@ interface { symbol_id: 0x42e824ab symbol_id: 0x6a1d1a11 symbol_id: 0xd3ec6f8d + symbol_id: 0x637e9bac symbol_id: 0xffeb078f symbol_id: 0x321abf21 symbol_id: 0x92b41cef @@ -419303,6 +419582,7 @@ interface { symbol_id: 0x592a4678 symbol_id: 0xff77e1ca symbol_id: 0xe66642fe + symbol_id: 0xb8019067 symbol_id: 0x538ad5cc symbol_id: 0x2244c8f0 symbol_id: 0xfb876b5c @@ -419425,6 +419705,7 @@ interface { symbol_id: 0x2e0cfc9a symbol_id: 0x9181a5f3 symbol_id: 0xa7ab6134 + symbol_id: 0x39607d61 symbol_id: 0x1499f6a1 symbol_id: 0xf89b49b7 symbol_id: 0x5abb2c12 @@ -419562,6 +419843,7 @@ interface { symbol_id: 0x584cd956 symbol_id: 0x3d09e223 symbol_id: 0x0db9531c + symbol_id: 0xf29d7680 symbol_id: 0xbd4af188 symbol_id: 0xd0f100ba symbol_id: 0xb2149cf6 diff --git a/android/abi_gki_aarch64_telechips b/android/abi_gki_aarch64_telechips new file mode 100644 index 000000000000..42d64d2c317c --- /dev/null +++ b/android/abi_gki_aarch64_telechips @@ -0,0 +1,1567 @@ +[abi_symbol_list] +# commonly used symbols + add_timer + add_uevent_var + alloc_chrdev_region + alloc_workqueue + amba_driver_register + anon_inode_getfd + __arch_copy_from_user + __arch_copy_to_user + arm64_use_ng_mappings + __arm_smccc_hvc + __arm_smccc_smc + atomic_notifier_chain_register + __bitmap_and + __bitmap_andnot + bpf_trace_run1 + bpf_trace_run2 + bpf_trace_run3 + bpf_trace_run4 + bpf_trace_run5 + bus_register_notifier + bus_unregister_notifier + cache_line_size + cancel_work_sync + cdev_add + cdev_del + cdev_device_add + cdev_device_del + cdev_init + __check_object_size + __class_create + class_destroy + class_find_device + clear_page + clk_disable + clk_enable + __clk_get_hw + clk_get_rate + clk_hw_get_flags + __clk_is_enabled + clk_prepare + clk_put + clk_register + clk_register_clkdev + clk_set_rate + clk_unprepare + clk_unregister + complete + component_add + component_del + config_ep_by_speed + config_group_init_type_name + __const_udelay + consume_skb + cpu_bit_bitmap + cpu_hwcaps + cpu_number + __cpu_online_mask + crypto_alloc_shash + crypto_destroy_tfm + crypto_shash_final + crypto_shash_update + debugfs_attr_read + debugfs_attr_write + debugfs_create_dir + debugfs_create_file + debugfs_remove + default_llseek + delayed_work_timer_fn + del_timer + del_timer_sync + destroy_workqueue + dev_driver_string + _dev_err + dev_fwnode + device_create + device_create_file + device_destroy + device_for_each_child + device_initialize + device_property_present + device_property_read_string + device_property_read_u32_array + device_register + device_remove_file + device_set_wakeup_capable + device_wakeup_enable + _dev_info + devm_clk_get + devm_free_irq + devm_gpiod_get_index + devm_gpiod_get_optional + devm_gpio_request + devm_gpio_request_one + devm_ioremap + devm_ioremap_resource + devm_kfree + devm_kmalloc + devm_kstrdup + __devm_of_phy_provider_register + devm_phy_create + devm_phy_get + devm_pinctrl_get + devm_pinctrl_put + __devm_regmap_init + __devm_regmap_init_i2c + devm_regulator_get + devm_regulator_get_optional + devm_regulator_register + devm_request_threaded_irq + __devm_reset_control_get + devm_snd_soc_register_component + devm_usb_get_phy_by_phandle + dev_pm_opp_of_add_table + dev_pm_opp_of_remove_table + dev_pm_opp_put + devres_add + devres_free + dev_set_name + _dev_warn + disable_irq + dma_alloc_attrs + dma_async_device_register + dma_async_device_unregister + dma_async_tx_descriptor_init + dma_buf_attach + dma_buf_begin_cpu_access + dma_buf_detach + dma_buf_end_cpu_access + dma_buf_export + dma_buf_fd + dma_buf_get + dma_buf_map_attachment + dma_buf_mmap + dma_buf_put + dma_buf_unmap_attachment + dma_fence_add_callback + dma_fence_context_alloc + dma_fence_default_wait + dma_fence_init + dma_fence_release + dma_fence_signal + dma_free_attrs + dma_heap_add + dma_heap_get_drvdata + dma_heap_get_name + dmam_alloc_attrs + dma_map_page_attrs + dma_map_sg_attrs + dma_mmap_attrs + dma_pool_alloc + dma_pool_create + dma_pool_destroy + dma_pool_free + dma_release_channel + __dma_request_channel + dma_set_coherent_mask + dma_set_mask + dma_sync_sg_for_cpu + dma_sync_sg_for_device + dma_sync_single_for_cpu + dma_sync_single_for_device + dma_unmap_page_attrs + dma_unmap_sg_attrs + down + down_read + down_write + drm_add_edid_modes + drm_atomic_helper_connector_destroy_state + drm_atomic_helper_connector_duplicate_state + drm_atomic_helper_connector_reset + __drm_atomic_helper_crtc_duplicate_state + drm_atomic_helper_disable_plane + drm_atomic_helper_page_flip + drm_atomic_helper_set_config + drm_atomic_helper_update_plane + drm_compat_ioctl + drm_connector_attach_encoder + drm_connector_cleanup + drm_connector_init + drm_connector_unregister + drm_connector_update_edid_property + drm_crtc_cleanup + drm_crtc_send_vblank_event + drm_crtc_vblank_get + drm_crtc_vblank_off + drm_crtc_vblank_on + drm_dev_alloc + drm_dev_printk + drm_dev_put + drm_dev_register + drm_dev_unregister + drm_display_mode_from_videomode + drm_display_mode_to_videomode + drm_encoder_cleanup + drm_encoder_init + __drm_err + drm_framebuffer_cleanup + drm_framebuffer_init + drm_gem_handle_create + drm_gem_object_free + drm_gem_object_lookup + drm_get_format_info + drm_helper_mode_fill_fb_struct + drm_helper_probe_single_connector_modes + drm_ioctl + drmm_mode_config_init + drm_mode_config_cleanup + drm_mode_create + drm_mode_destroy + drm_mode_probed_add + drm_mode_set_name + drm_of_find_panel_or_bridge + drm_of_find_possible_crtcs + drm_open + drm_panel_add + drm_panel_disable + drm_panel_enable + drm_panel_get_modes + drm_panel_init + drm_panel_prepare + drm_panel_remove + drm_panel_unprepare + drm_plane_cleanup + drm_poll + drm_read + drm_release + dump_stack + enable_irq + event_triggers_call + fd_install + filp_close + find_get_pid + find_vma + finish_wait + flush_work + fput + free_irq + __free_pages + free_pages + freezing_slow_path + fwnode_device_is_available + fwnode_handle_put + fwnode_property_get_reference_args + fwnode_property_present + fwnode_property_read_u32_array + generic_file_llseek + generic_handle_irq + gen_pool_add_owner + gen_pool_alloc_algo_owner + gen_pool_best_fit + gen_pool_create + gen_pool_destroy + gen_pool_free_owner + gen_pool_set_algo + gen_pool_virt_to_phys + get_device + get_kernel_pages + get_unused_fd_flags + get_user_pages + gic_nonsecure_priorities + gpiochip_get_data + gpiod_direction_output_raw + gpiod_set_raw_value + gpiod_set_raw_value_cansleep + gpiod_set_value_cansleep + gpio_free + gpio_request + gpio_request_one + gpio_to_desc + hrtimer_cancel + hrtimer_init + hrtimer_start_range_ns + i2c_del_driver + i2c_get_adapter + i2c_put_adapter + i2c_register_driver + i2c_transfer + i2c_transfer_buffer_flags + idr_alloc + idr_destroy + idr_find + idr_preload + idr_remove + __init_rwsem + __init_swait_queue_head + init_timer_key + init_wait_entry + __init_waitqueue_head + input_allocate_device + input_event + input_register_device + input_unregister_device + iomem_resource + iounmap + irq_get_irq_data + irq_of_parse_and_map + irq_set_irq_wake + irq_to_desc + is_vmalloc_addr + jiffies + jiffies_to_msecs + kasan_flag_enabled + kasprintf + kfree + kimage_vaddr + kimage_voffset + __kmalloc + kmalloc_caches + kmem_cache_alloc + kmem_cache_create + kmem_cache_destroy + kmem_cache_free + kobject_create_and_add + kobject_put + kobject_uevent_env + kstrdup + kstrndup + kstrtoint + kstrtouint + kstrtoull + kthread_create_on_node + kthread_flush_worker + __kthread_init_worker + kthread_queue_work + kthread_should_stop + kthread_stop + kthread_worker_fn + ktime_get + ktime_get_mono_fast_ns + ktime_get_raw_ts64 + ktime_get_real_ts64 + ktime_get_ts64 + kvfree + kvmalloc_node + __list_add_valid + __list_del_entry_valid + list_sort + mbox_chan_received_data + mbox_chan_txdone + mbox_controller_register + mbox_controller_unregister + mbox_free_channel + mbox_request_channel + mbox_request_channel_byname + mbox_send_message + mdiobus_alloc_size + mdiobus_free + mdiobus_read + mdiobus_unregister + mdiobus_write + memcpy + memdup_user + memremap + memset + __memset_io + memstart_addr + memunmap + misc_deregister + misc_register + mmc_gpio_get_ro + mmc_of_parse + mod_timer + module_layout + module_put + __msecs_to_jiffies + msleep + msleep_interruptible + __mutex_init + mutex_is_locked + mutex_lock + mutex_unlock + netif_carrier_off + netif_carrier_on + nonseekable_open + noop_llseek + nr_cpu_ids + ns_to_timespec64 + of_address_to_resource + of_alias_get_id + of_clk_add_provider + of_clk_del_provider + of_clk_get + of_clk_get_by_name + of_clk_get_parent_count + of_clk_get_parent_name + of_count_phandle_with_args + of_device_get_match_data + of_device_is_compatible + of_dma_controller_register + of_find_compatible_node + of_find_device_by_node + of_find_node_by_name + of_find_property + of_get_child_by_name + of_get_display_timings + of_get_named_gpio_flags + of_get_next_child + of_get_phy_mode + of_get_property + of_get_videomode + of_iomap + of_irq_get + of_match_device + of_match_node + of_n_addr_cells + of_n_size_cells + of_phy_simple_xlate + of_platform_depopulate + of_platform_populate + of_property_count_elems_of_size + of_property_match_string + of_property_read_string + of_property_read_string_helper + of_property_read_u32_index + of_property_read_u64 + of_property_read_variable_u32_array + of_property_read_variable_u8_array + of_reserved_mem_lookup + __page_pinner_put_page + panic_notifier_list + param_array_ops + param_ops_bool + param_ops_int + param_ops_uint + perf_trace_buf_alloc + perf_trace_run_bpf_submit + phy_init + phy_init_eee + phy_power_off + phy_power_on + phy_reset + pinctrl_get + pinctrl_gpio_direction_input + pinctrl_gpio_direction_output + pinctrl_lookup_state + pinctrl_pm_select_default_state + pinctrl_pm_select_sleep_state + pinctrl_put + pinctrl_select_state + pin_user_pages + platform_bus_type + platform_device_register_full + platform_device_unregister + __platform_driver_register + platform_driver_unregister + platform_get_irq + platform_get_irq_byname + platform_get_resource + platform_get_resource_byname + __pm_runtime_disable + pm_runtime_enable + __pm_runtime_idle + __pm_runtime_resume + pm_runtime_set_autosuspend_delay + __pm_runtime_set_status + __pm_runtime_suspend + __pm_runtime_use_autosuspend + preempt_schedule + preempt_schedule_notrace + prepare_to_wait_event + proc_create + proc_create_data + proc_mkdir + put_device + put_pid + __put_task_struct + queue_delayed_work_on + queue_work_on + ___ratelimit + _raw_spin_lock + _raw_spin_lock_bh + _raw_spin_lock_irq + _raw_spin_lock_irqsave + _raw_spin_trylock + _raw_spin_unlock + _raw_spin_unlock_bh + _raw_spin_unlock_irq + _raw_spin_unlock_irqrestore + rb_erase + rb_first + rb_insert_color + rb_next + rdev_get_drvdata + refcount_warn_saturate + __refrigerator + regcache_cache_only + regcache_mark_dirty + regcache_sync + __register_chrdev + register_chrdev_region + register_netdev + register_shrinker + register_syscore_ops + regmap_read + regmap_update_bits_base + regmap_write + regulator_disable + regulator_disable_regmap + regulator_enable + regulator_enable_regmap + regulator_get_current_limit_regmap + regulator_get_optional + regulator_get_voltage_sel_regmap + regulator_is_enabled_regmap + regulator_list_voltage_linear + regulator_map_voltage_linear + regulator_put + regulator_set_current_limit_regmap + regulator_set_voltage + regulator_set_voltage_sel_regmap + release_firmware + __release_region + remap_pfn_range + remap_vmalloc_range + remove_proc_entry + request_firmware + __request_region + request_threaded_irq + reset_control_assert + reset_control_deassert + schedule + schedule_timeout + scnprintf + scsi_device_get + scsi_device_put + sdhci_add_host + sdhci_adma_write_desc + sdhci_execute_tuning + sdhci_get_property + sdhci_pltfm_free + sdhci_pltfm_init + sdhci_remove_host + sdhci_reset + sdhci_runtime_resume_host + sdhci_runtime_suspend_host + sdhci_set_bus_width + sdhci_set_clock + seq_lseek + seq_open + seq_printf + seq_puts + seq_read + seq_release + seq_write + set_freezable + set_normalized_timespec64 + set_page_dirty_lock + sg_alloc_table + sg_free_table + sg_init_one + sg_init_table + sg_next + __sg_page_iter_next + __sg_page_iter_start + simple_attr_open + simple_attr_read + simple_attr_release + simple_attr_write + simple_read_from_buffer + simple_strtoul + simple_write_to_buffer + single_open + single_release + skb_pull + skb_put + snd_ctl_boolean_mono_info + snd_dma_free_pages + snd_pcm_hw_constraint_step + snd_pcm_lib_ioctl + snd_pcm_period_elapsed + snd_soc_component_read + snd_soc_component_update_bits + snd_soc_dai_active + snd_soc_dai_set_bclk_ratio + snd_soc_dai_set_clkdiv + snd_soc_dai_set_sysclk + snd_soc_dapm_get_enum_double + snd_soc_dapm_put_enum_double + snd_soc_get_enum_double + snd_soc_get_pcm_runtime + snd_soc_get_volsw + snd_soc_info_enum_double + snd_soc_info_volsw + snd_soc_of_parse_card_name + snd_soc_pm_ops + snd_soc_put_enum_double + snd_soc_put_volsw + snd_soc_register_card + snd_soc_register_component + snd_soc_rtdcom_lookup + snd_soc_set_runtime_hwparams + snd_soc_unregister_component + snprintf + sprintf + sscanf + __stack_chk_fail + stpcpy + strcasecmp + strchr + strcmp + strlcpy + strlen + strncmp + strncpy + strnlen + strscpy + strsep + strstr + __sw_hweight32 + __sw_hweight64 + sync_file_create + sync_file_get_fence + synchronize_irq + sysfs_create_file_ns + sysfs_create_files + sysfs_create_group + sysfs_create_link + sysfs_remove_file_ns + sysfs_remove_group + sysfs_remove_link + system_wq + tasklet_init + __tasklet_schedule + __task_pid_nr_ns + trace_define_field + trace_event_buffer_commit + trace_event_buffer_reserve + trace_event_ignore_this_pid + trace_event_raw_init + trace_event_reg + trace_handle_return + __traceiter_gpu_mem_total + __traceiter_rwmmio_post_read + __traceiter_rwmmio_read + __traceiter_rwmmio_write + __tracepoint_gpu_mem_total + __tracepoint_rwmmio_post_read + __tracepoint_rwmmio_read + __tracepoint_rwmmio_write + trace_print_symbols_seq + trace_raw_output_prep + trace_seq_printf + try_module_get + __udelay + unmap_mapping_range + unpin_user_pages + __unregister_chrdev + unregister_chrdev_region + unregister_netdev + unregister_shrinker + up + up_read + up_write + usb_add_function + usb_add_hcd + usb_add_phy_dev + usb_calc_bus_time + usb_create_hcd + usb_debug_root + usb_disabled + usb_ep_alloc_request + usb_ep_autoconfig + usb_ep_dequeue + usb_ep_disable + usb_ep_enable + usb_ep_free_request + usb_ep_queue + usb_function_register + usb_function_unregister + usb_gstrings_attach + usb_hcd_check_unlink_urb + usb_hcd_giveback_urb + usb_hcd_link_urb_to_ep + usb_hcd_resume_root_hub + usb_hcds_loaded + usb_hcd_unlink_urb_from_ep + usb_interface_id + usb_put_function_instance + usb_put_hcd + usb_remove_hcd + usb_remove_phy + __usecs_to_jiffies + vfree + videomode_from_timings + vmalloc + vmalloc_user + vmap + vmf_insert_mixed + vm_get_page_prot + vunmap + vzalloc + wait_for_completion + wait_for_completion_interruptible + wait_for_completion_timeout + __wake_up + wake_up_process + __warn_printk + +# required by atmel_mxt_ts.ko + gpiod_direction_output + gpiod_set_value + input_alloc_absinfo + input_free_device + input_mt_init_slots + input_mt_report_pointer_emulation + input_mt_report_slot_state + input_set_abs_params + input_set_capability + kmemdup_nul + krealloc + request_firmware_nowait + wait_for_completion_interruptible_timeout + +# required by bootstage.ko + register_pm_notifier + unregister_pm_notifier + +# required by clk-tcc.ko + clk_hw_get_name + clk_hw_get_rate + clk_hw_is_enabled + clk_hw_unregister + devm_clk_hw_register + devm_clk_hw_register_clkdev + devm_of_clk_add_hw_provider + of_clk_parent_fill + proc_create_single_data + unregister_syscore_ops + +# required by cma_heap.ko + cma_alloc + cma_get_name + cma_release + dma_contiguous_default_area + +# required by da9062-core.ko + mfd_add_devices + mfd_remove_devices + regmap_del_irq_chip + regmap_irq_chip_get_base + +# required by da9062-regulator.ko + devm_regmap_field_alloc + regmap_field_read + regmap_field_update_bits_base + regulator_mode_to_status + +# required by dvb-core.ko + alloc_netdev_mqs + capable + crc32_be + down_interruptible + ether_setup + eth_header + eth_header_parse + eth_validate_addr + free_netdev + i2c_unregister_device + kmemdup + ktime_get_with_offset + mutex_lock_interruptible + __netdev_alloc_skb + netif_rx + __printk_ratelimit + __request_module + skb_push + symbol_put_addr + +# required by dwc2.ko + __bitmap_clear + bitmap_find_next_zero_area_off + __bitmap_set + debugfs_create_regset32 + devm_clk_get_optional + devm_platform_get_and_ioremap_resource + devm_regulator_bulk_get + devm_usb_get_phy + dmam_free_coherent + gcd + phy_exit + platform_device_add + platform_device_add_data + platform_device_add_resources + platform_device_alloc + platform_device_put + regulator_bulk_disable + regulator_bulk_enable + 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 + usb_get_dr_mode + usb_hcd_map_urb_for_dma + usb_hcd_unmap_urb_for_dma + usb_hub_clear_tt_buffer + usb_phy_set_charger_current + usb_role_switch_get_drvdata + usb_role_switch_register + usb_role_switch_unregister + usb_speed_string + usb_wakeup_enabled_descendants + +# required by dwc3-tcc.ko + system_freezable_wq + +# required by ehci-tcc.ko + ehci_init_driver + ehci_resume + ehci_suspend + +# required by gpio-pca953x.ko + __bitmap_replace + dev_err_probe + device_get_match_data + devm_gpiochip_add_data_with_key + regcache_sync_region + regmap_bulk_read + regmap_bulk_write + +# required by gpio-regulator.ko + devm_kmemdup + gpiod_count + gpiod_get_optional + gpiod_set_consumer_name + of_get_regulator_init_data + +# required by gpio-tcc.ko + gpiochip_add_data_with_key + gpiochip_generic_free + gpiochip_generic_request + gpiochip_remove + handle_nested_irq + handle_simple_irq + irq_modify_status + platform_irq_count + +# required by hwdmx_drv.ko + param_ops_short + +# required by i2c-dev.ko + i2c_adapter_type + i2c_bus_type + i2c_for_each_dev + i2c_smbus_xfer + i2c_verify_client + +# required by i2c-tcc-v3.ko + i2c_add_numbered_adapter + i2c_del_adapter + i2c_generic_scl_recovery + i2c_recover_bus + +# required by mali_arbiter.ko + kobject_init_and_add + +# required by mali_gpu_assign.ko + param_ops_charp + +# required by mali_gpu_aw.ko + device_attach + +# required by mali_gpu_power.ko + devfreq_add_device + devfreq_recommended_opp + devfreq_register_opp_notifier + devfreq_remove_device + devfreq_unregister_opp_notifier + dev_pm_opp_find_freq_floor + dev_pm_opp_get_freq + dev_pm_opp_get_opp_count + dev_pm_opp_get_voltage + of_device_is_available + of_platform_device_create + of_platform_device_destroy + regulator_is_enabled + +# required by mali_kbase.ko + __arch_clear_user + __bitmap_weight + cancel_delayed_work_sync + __ClearPageMovable + complete_all + debugfs_create_bool + _dev_alert + dev_pm_opp_find_freq_ceil + dma_fence_get_status + dma_fence_remove_callback + downgrade_write + down_trylock + __get_free_pages + get_user_pages_fast + hrtimer_active + hrtimer_forward + iput + kstrtobool_from_user + kstrtouint_from_user + ktime_get_raw + kvfree_call_rcu + __mmdrop + mod_delayed_work_on + of_dma_is_coherent + of_machine_is_compatible + param_ops_byte + pid_task + pin_user_pages_remote + rb_prev + rb_replace_node + __rcu_read_lock + __rcu_read_unlock + register_oom_notifier + seq_putc + __SetPageMovable + simple_open + static_key_slow_dec + static_key_slow_inc + strcspn + synchronize_rcu + sysfs_streq + _totalram_pages + trace_output_call + trace_print_array_seq + trace_print_flags_seq + unlock_page + unpin_user_page + unregister_oom_notifier + vmf_insert_pfn_prot + +# required by mpq7920.ko + regulator_set_active_discharge_regmap + regulator_set_soft_start_regmap + +# required by m_can.ko + alloc_canfd_skb + can_bus_off + of_can_transceiver + of_irq_to_resource + +# required by ohci-hcd.ko + gen_pool_dma_alloc_align + gen_pool_dma_zalloc_align + get_zeroed_page + sb800_prefetch + schedule_timeout_uninterruptible + usb_amd_dev_put + usb_amd_quirk_pll_disable + usb_amd_quirk_pll_enable + usb_hc_died + usb_hcd_poll_rh_status + usb_root_hub_lost_power + +# required by ohci-platform.ko + devm_reset_control_array_get + usb_hcd_platform_shutdown + +# required by ohci-tcc.ko + of_usb_host_tpl_support + +# required by optee.ko + alloc_pages_exact + bus_for_each_dev + completion_done + device_unregister + free_pages_exact + idr_get_next + +# required by pcie-tcc.ko + devm_kasprintf + dw_pcie_ep_init + dw_pcie_ep_raise_msi_irq + dw_pcie_host_init + dw_pcie_read + dw_pcie_read_dbi + dw_pcie_setup_rc + dw_pcie_write + dw_pcie_write_dbi + phy_set_mode_ext + +# required by pinctrl-tcc.ko + of_prop_next_string + pinctrl_dev_get_drvdata + pinctrl_register + +# required by pvrsrvkm.ko + autoremove_wake_function + bpf_trace_run6 + bpf_trace_run7 + bpf_trace_run8 + call_rcu + devm_clk_put + dma_buf_vmap + dma_buf_vunmap + dma_fence_array_ops + dma_fence_enable_sw_signaling + dma_fence_wait_timeout + fget + find_vpid + get_pid_task + __get_task_comm + idr_for_each + idr_replace + kill_pid + ksize + kthread_freezable_should_stop + memcmp + mutex_trylock + prepare_to_wait + proc_remove + put_unused_fd + _raw_read_lock_bh + _raw_read_unlock_bh + _raw_write_lock_bh + _raw_write_unlock_bh + rcu_barrier + sched_clock + seq_vprintf + set_user_nice + si_meminfo + split_page + strcpy + strlcat + trace_set_clr_event + vm_insert_page + vm_map_ram + vm_unmap_ram + vsnprintf + vsscanf + +# required by pwm-tcc.ko + pwmchip_add + pwmchip_remove + +# required by pwrseq_simple.ko + bitmap_alloc + devm_gpiod_get_array + gpiod_set_array_value_cansleep + mmc_pwrseq_register + mmc_pwrseq_unregister + +# required by realtek.ko + __genphy_config_aneg + genphy_read_abilities + genphy_read_mmd_unsupported + genphy_read_status + genphy_resume + genphy_suspend + genphy_write_mmd_unsupported + __mdiobus_read + __mdiobus_write + phy_drivers_register + phy_drivers_unregister + __phy_modify + phy_modify + phy_modify_paged_changed + phy_read_paged + phy_restore_page + phy_select_page + phy_write_paged + +# required by reboot-mode.ko + devres_release + kfree_const + kstrdup_const + register_reboot_notifier + unregister_reboot_notifier + +# required by reserved_mem.ko + of_get_next_available_child + +# required by reset-tcc.ko + devm_reset_controller_register + +# required by rpmb.ko + __class_register + class_unregister + device_del + ida_alloc_range + ida_destroy + ida_free + +# required by rpmb_sim.ko + crypto_shash_setkey + +# required by rtc-tcc.ko + devm_rtc_allocate_device + rtc_time64_to_tm + rtc_tm_to_time64 + rtc_update_irq + +# required by sdhci-tcc.ko + mmc_detect_change + sdhci_set_uhs_signaling + +# required by sg.ko + blk_execute_rq_nowait + blk_rq_map_user + blk_rq_map_user_iov + blk_rq_unmap_user + cdev_alloc + class_interface_unregister + fasync_helper + get_sg_io_hdr + import_iovec + kill_fasync + __module_get + put_disk + put_sg_io_hdr + _raw_read_lock_irqsave + _raw_read_unlock_irqrestore + _raw_write_lock_irq + _raw_write_lock_irqsave + _raw_write_unlock_irq + _raw_write_unlock_irqrestore + scsi_autopm_get_device + scsi_autopm_put_device + scsi_block_when_processing_errors + scsi_command_size_tbl + scsi_ioctl + scsi_ioctl_block_when_processing_errors + scsi_normalize_sense + __scsi_print_sense + scsi_register_interface + sdev_prefix_printk + +# required by snd-soc-tcc-asrc.ko + wait_for_completion_io_timeout + +# required by spi-tcc.ko + devm_spi_register_controller + gpiod_direction_input + __spi_alloc_controller + spi_controller_resume + spi_controller_suspend + +# required by spidev.ko + driver_unregister + __spi_register_driver + spi_setup + spi_sync + stream_open + +# required by stmmac-platform.ko + device_get_phy_mode + devm_platform_ioremap_resource + of_get_mac_address + of_phy_is_fixed_link + platform_get_irq_byname_optional + pm_runtime_force_resume + pm_runtime_force_suspend + +# required by stmmac.ko + crc32_le + debugfs_rename + dev_close + device_set_wakeup_enable + __dev_kfree_skb_any + devm_alloc_etherdev_mqs + dev_open + dql_completed + dql_reset + eth_mac_addr + ethtool_convert_legacy_u32_to_link_mode + ethtool_convert_link_mode_to_legacy_u32 + ethtool_op_get_link + ethtool_op_get_ts_info + eth_type_trans + flow_block_cb_setup_simple + flow_rule_match_basic + flow_rule_match_ipv4_addrs + flow_rule_match_ports + get_random_bytes + jiffies_to_usecs + mdiobus_get_phy + __napi_alloc_skb + napi_complete_done + napi_disable + napi_gro_receive + __napi_schedule + __napi_schedule_irqoff + napi_schedule_prep + netdev_alert + netdev_err + netdev_info + netdev_pick_tx + netdev_rss_key_fill + netdev_update_features + netdev_warn + netif_device_attach + netif_device_detach + __netif_napi_del + netif_schedule_queue + netif_set_real_num_rx_queues + netif_set_real_num_tx_queues + netif_tx_wake_queue + page_pool_alloc_pages + page_pool_create + page_pool_destroy + page_pool_release_page + phy_attached_info + phylink_connect_phy + phylink_create + phylink_destroy + phylink_disconnect_phy + phylink_ethtool_get_eee + phylink_ethtool_get_pauseparam + phylink_ethtool_get_wol + phylink_ethtool_ksettings_get + phylink_ethtool_ksettings_set + phylink_ethtool_nway_reset + phylink_ethtool_set_eee + phylink_ethtool_set_pauseparam + phylink_ethtool_set_wol + phylink_get_eee_err + phylink_mac_change + phylink_mii_ioctl + phylink_of_phy_connect + phylink_set_port_modes + phylink_speed_down + phylink_speed_up + phylink_start + phylink_stop + pm_wakeup_dev_event + register_netdevice_notifier + reset_control_reset + rtnl_lock + rtnl_unlock + skb_add_rx_frag + skb_tstamp_tx + synchronize_net + unregister_netdevice_notifier + +# required by switch_reverse.ko + gpiod_get_raw_value + +# required by system_heap.ko + deferred_free + dmabuf_page_pool_alloc + dmabuf_page_pool_create + dmabuf_page_pool_destroy + dmabuf_page_pool_free + dma_heap_get_dev + +# required by tcc-arxxxx.ko + v4l2_ctrl_handler_free + v4l2_ctrl_handler_init_class + v4l2_ctrl_new_std + v4l2_ctrl_new_std_menu + +# required by tcc-cap-media.ko + media_create_pad_link + media_device_cleanup + media_device_init + __media_device_register + media_device_unregister + media_entity_find_link + v4l2_device_register + v4l2_device_unregister + +# required by tcc-max9286.ko + gpiod_direction_input + gpiod_direction_output_raw + gpiod_set_raw_value_cansleep + gpio_free + gpio_request + gpio_to_desc + of_get_named_gpio_flags + regmap_read + +# required by tcc-amba-pl011.ko + amba_driver_unregister + dma_get_slave_caps + dma_request_chan + do_SAK + handle_sysrq + nr_irqs + oops_in_progress + sysrq_mask + tty_flip_buffer_push + tty_insert_flip_string_fixed_flag + tty_termios_encode_baud_rate + uart_add_one_port + uart_console_device + uart_console_write + uart_get_baud_rate + uart_handle_cts_change + uart_handle_dcd_change + uart_insert_char + uart_parse_earlycon + uart_parse_options + uart_register_driver + uart_remove_one_port + uart_resume_port + uart_set_options + uart_suspend_port + uart_try_toggle_sysrq + uart_unregister_driver + uart_update_timeout + uart_write_wakeup + +# required by tcc-amba-pl08x.ko + amba_release_regions + amba_request_regions + dmaengine_unmap_put + dma_get_slave_channel + vchan_dma_desc_free_list + vchan_find_desc + vchan_init + vchan_tx_desc_free + vchan_tx_submit + +# required by tcc-dma.ko + of_dma_controller_free + tasklet_kill + +# required by tcc-reboot-mode.ko + atomic_notifier_chain_unregister + +# required by tcc-rng.ko + hwrng_register + hwrng_unregister + +# required by tcc-snd-card.ko + snd_soc_dai_set_fmt + snd_soc_dai_set_tdm_slot + snd_soc_unregister_card + +# required by tcc_adc.ko + devm_iio_device_alloc + iio_device_free + __iio_device_register + iio_device_unregister + __ndelay + +# required by tcc_adma_pcm.ko + snd_pcm_hw_constraint_list + snd_pcm_hw_constraint_pow2 + snd_pcm_lib_preallocate_free_for_all + snd_pcm_lib_preallocate_pages_for_all + +# required by tcc_cbus_wdt.ko + devm_watchdog_register_device + watchdog_init_timeout + watchdog_unregister_device + +# required by tcc_drm_dp.ko + drm_helper_hpd_irq_event + drm_object_attach_property + drm_property_create_enum + +# required by tcc_drm_vioc.ko + drm_atomic_helper_check_plane_state + __drm_atomic_helper_crtc_reset + drm_mode_object_get + drm_mode_vrefresh + +# required by tcc_mem.ko + of_translate_address + +# required by tcc_pmi.ko + add_wait_queue + default_wake_function + hex_dump_to_buffer + remove_wait_queue + +# required by tcc_sc_mmc.ko + mmc_add_host + mmc_alloc_host + mmc_request_done + sg_copy_from_buffer + sg_copy_to_buffer + +# required by tcc_sc_ufs.ko + async_schedule_node + blk_queue_max_segment_size + __scsi_add_device + scsi_add_host_with_dma + scsi_change_queue_depth + scsi_host_alloc + scsi_remove_device + scsi_scan_host + +# required by tcc_sec_ipc.ko + mbox_client_txdone + +# required by tcc_tsens_module.ko + +# required by tcc_v4l2_vout.ko + v4l2_device_register + v4l2_device_unregister + video_devdata + video_device_alloc + video_device_release + video_ioctl2 + __video_register_device + video_unregister_device + +# required by tcc_viqe_interface.ko + memmove + +# required by tcc_wdma.ko + iov_iter_init + vfs_fsync + +# required by tccdewarp.ko + simple_strtol + v4l2_fh_add + v4l2_fh_del + v4l2_fh_exit + v4l2_fh_init + vb2_mmap + vb2_poll + +# required by tccsvdw.ko + media_device_register_entity + of_fdt_unflatten_tree + of_graph_get_remote_endpoint + vb2_ioctl_prepare_buf + +# required by tccvin.ko + clk_put + kstrtouint + ktime_get_raw_ts64 + media_pipeline_start + media_pipeline_stop + of_graph_get_endpoint_by_regs + of_reserved_mem_device_init_by_idx + of_reserved_mem_lookup + _raw_spin_lock_irqsave + _raw_spin_unlock_irqrestore + __trace_bprintk + __v4l2_device_register_subdev_nodes + v4l2_fh_open + v4l2_fill_pixfmt_mp + vb2_buffer_done + vb2_dma_contig_memops + vb2_fop_mmap + vb2_fop_poll + vb2_fop_release + vb2_ioctl_dqbuf + vb2_ioctl_expbuf + vb2_ioctl_qbuf + vb2_ioctl_reqbufs + vb2_ioctl_streamoff + vb2_ioctl_streamon + vb2_ops_wait_finish + vb2_ops_wait_prepare + vb2_plane_cookie + vb2_querybuf + vb2_queue_init + video_devdata + video_ioctl2 + __video_register_device + video_unregister_device + +# required by tccdrm.ko + bus_find_device + component_bind_all + component_master_add_with_match + component_master_del + component_match_add_release + component_unbind_all + dma_get_sgtable_attrs + drm_atomic_helper_check + drm_atomic_helper_cleanup_planes + drm_atomic_helper_commit + drm_atomic_helper_commit_hw_done + drm_atomic_helper_commit_modeset_disables + drm_atomic_helper_commit_modeset_enables + drm_atomic_helper_commit_planes + drm_atomic_helper_crtc_reset + drm_atomic_helper_fake_vblank + drm_crtc_vblank_count + drm_crtc_vblank_put + drm_gem_create_mmap_offset + drm_gem_dmabuf_export + drm_gem_dmabuf_release + drm_gem_dumb_map_offset + drm_gem_mmap + drm_gem_mmap_obj + drm_gem_object_init + drm_gem_object_release + drm_gem_prime_fd_to_handle + drm_gem_prime_handle_to_fd + drm_gem_prime_import_dev + drm_gem_vm_close + drm_gem_vm_open + drm_kms_helper_poll_fini + drm_kms_helper_poll_init + drm_mode_config_helper_resume + drm_mode_config_helper_suspend + drm_mode_config_reset + drm_prime_gem_destroy + drm_prime_pages_to_sg + drm_vblank_init + platform_find_device_by_driver + +# required by tccdrm_common.ko + __drm_atomic_helper_crtc_destroy_state + __drm_atomic_helper_plane_destroy_state + __drm_atomic_helper_plane_duplicate_state + __drm_atomic_helper_plane_reset + drm_connector_list_iter_begin + drm_connector_list_iter_end + drm_connector_list_iter_next + drm_crtc_handle_vblank + drm_crtc_init_with_planes + drm_handle_vblank + drm_mode_object_find + drm_universal_plane_init + +# required by tee.ko + bus_register + bus_unregister + compat_ptr_ioctl + in_egroup_p + pin_user_pages_fast + uuid_null + +# required by timer.ko + of_irq_parse_one + of_prop_next_u32 + +# required by touch_bridge.ko + input_close_device + input_open_device + input_register_handle + input_register_handler + input_unregister_handle + input_unregister_handler + +# required by v4l2-fwnode.ko + fwnode_get_next_parent + fwnode_get_parent + fwnode_graph_get_next_endpoint + fwnode_graph_get_port_parent + fwnode_graph_get_remote_endpoint + fwnode_graph_get_remote_port_parent + fwnode_graph_parse_endpoint + fwnode_property_read_u64_array + of_fwnode_ops + of_node_name_eq + v4l2_async_register_subdev + +# required by videobuf-core.ko + __wake_up_sync + +# required by videobuf-dma-sg.ko + unpin_user_pages_dirty_lock + vmalloc_to_page + +# required by vpu.ko + devm_iounmap + kernel_kobj + kobject_del + __memcpy_fromio + __memcpy_toio + __of_reset_control_get + platform_device_register + reset_control_put + +# required by bd96801.regulator.ko + linear_range_get_value_array + regulator_desc_list_voltage_linear_range From 79436849ef1d9468c94af4c5b45478217aa9030d Mon Sep 17 00:00:00 2001 From: Vamsidhar reddy Gaddam Date: Thu, 8 Aug 2024 14:44:33 +0000 Subject: [PATCH 31/50] ANDROID: Update the ABI symbol list Adding the following symbols: - vm_unmapped_area Bug: 344489121 Change-Id: I1798b662e81283e1f8e8f2091e5e4b6d2d4fe2c0 Signed-off-by: Vamsidhar reddy Gaddam --- android/abi_gki_aarch64.stg | 64 +++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_pixel | 1 + 2 files changed, 65 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index f9793aea24b5..ef40c56887f5 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -10848,6 +10848,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x5cd17c3c } +pointer_reference { + id: 0x1da732a0 + kind: POINTER + pointee_type_id: 0x5cdc2c1f +} pointer_reference { id: 0x1daa6efa kind: POINTER @@ -46045,6 +46050,18 @@ member { type_id: 0xf435685e offset: 7744 } +member { + id: 0xc33e1e99 + name: "align_mask" + type_id: 0x33756485 + offset: 256 +} +member { + id: 0xd5d14aaa + name: "align_offset" + type_id: 0x33756485 + offset: 320 +} member { id: 0x5b337c99 name: "align_resource" @@ -102307,6 +102324,12 @@ member { type_id: 0x33756485 offset: 1152 } +member { + id: 0x8cf9b961 + name: "high_limit" + type_id: 0x33756485 + offset: 192 +} member { id: 0x2467cbde name: "high_pkey" @@ -118128,6 +118151,12 @@ member { type_id: 0x5d8155a5 offset: 40 } +member { + id: 0xb55e13dd + name: "length" + type_id: 0x33756485 + offset: 64 +} member { id: 0xb5856118 name: "length" @@ -121607,6 +121636,12 @@ member { type_id: 0x4585663f offset: 736 } +member { + id: 0x02e55acb + name: "low_limit" + type_id: 0x33756485 + offset: 128 +} member { id: 0xbc5b3492 name: "low_pkey" @@ -272745,6 +272780,20 @@ struct_union { member_id: 0xe9550bd8 } } +struct_union { + id: 0x5cdc2c1f + kind: STRUCT + name: "vm_unmapped_area_info" + definition { + bytesize: 48 + member_id: 0x2d5bf13a + member_id: 0xb55e13dd + member_id: 0x02e55acb + member_id: 0x8cf9b961 + member_id: 0xc33e1e99 + member_id: 0xd5d14aaa + } +} struct_union { id: 0x04fd6761 kind: STRUCT @@ -305932,6 +305981,11 @@ function { return_type_id: 0x0490bb4a parameter_id: 0x3fa672fd } +function { + id: 0x36c501fb + return_type_id: 0x33756485 + parameter_id: 0x1da732a0 +} function { id: 0x36cad8bb return_type_id: 0x23f09c34 @@ -410265,6 +410319,15 @@ elf_symbol { type_id: 0x1fc98171 full_name: "vm_unmap_ram" } +elf_symbol { + id: 0xbbf42090 + name: "vm_unmapped_area" + is_defined: true + symbol_type: FUNCTION + crc: 0x064b9739 + type_id: 0x36c501fb + full_name: "vm_unmapped_area" +} elf_symbol { id: 0xca7f93d5 name: "vm_zone_stat" @@ -419817,6 +419880,7 @@ interface { symbol_id: 0xaf85c216 symbol_id: 0xacc76406 symbol_id: 0xef2c49d1 + symbol_id: 0xbbf42090 symbol_id: 0xca7f93d5 symbol_id: 0xac972f8d symbol_id: 0x3c915fdb diff --git a/android/abi_gki_aarch64_pixel b/android/abi_gki_aarch64_pixel index b5f76e2c4030..cc344b06b512 100644 --- a/android/abi_gki_aarch64_pixel +++ b/android/abi_gki_aarch64_pixel @@ -2794,6 +2794,7 @@ vmf_insert_pfn_prot vm_iomap_memory vm_node_stat + vm_unmapped_area vm_zone_stat vprintk vprintk_emit From 8288de83062cc3d442489bdb1b7f0a57663ac240 Mon Sep 17 00:00:00 2001 From: Seiya Wang Date: Tue, 13 Aug 2024 16:56:37 +0800 Subject: [PATCH 32/50] ANDROID: GKI: Update symbol list for mtk 1 function symbol(s) added 'struct snd_kcontrol* snd_soc_cnew(const struct snd_kcontrol_new*, void*, const char*, const char*)' Bug: 359437271 Signed-off-by: Seiya Wang Change-Id: I53d2771c95cabfc6931a83eb43e1499b9de8bc8b --- android/abi_gki_aarch64.stg | 18 ++++++++++++++++++ android/abi_gki_aarch64_mtk | 1 + 2 files changed, 19 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index ef40c56887f5..7f5b973ed0fc 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -305027,6 +305027,14 @@ function { parameter_id: 0x3806a5e7 parameter_id: 0x18bd6530 } +function { + id: 0x22a8d210 + return_type_id: 0x2b8f13b3 + parameter_id: 0x3806a5e7 + parameter_id: 0x18bd6530 + parameter_id: 0x3e10b518 + parameter_id: 0x3e10b518 +} function { id: 0x22b8aec1 return_type_id: 0x48b5725f @@ -398409,6 +398417,15 @@ elf_symbol { type_id: 0x9b263487 full_name: "snd_soc_card_jack_new_pins" } +elf_symbol { + id: 0xf1bbfd92 + name: "snd_soc_cnew" + is_defined: true + symbol_type: FUNCTION + crc: 0x44262341 + type_id: 0x22a8d210 + full_name: "snd_soc_cnew" +} elf_symbol { id: 0x1c40b8b7 name: "snd_soc_component_async_complete" @@ -418556,6 +418573,7 @@ interface { symbol_id: 0x30c684dc symbol_id: 0x80680525 symbol_id: 0xf84e3b0d + symbol_id: 0xf1bbfd92 symbol_id: 0x1c40b8b7 symbol_id: 0xb63a9550 symbol_id: 0x46cb4d6f diff --git a/android/abi_gki_aarch64_mtk b/android/abi_gki_aarch64_mtk index 8406b61da99b..b58300bbea2d 100644 --- a/android/abi_gki_aarch64_mtk +++ b/android/abi_gki_aarch64_mtk @@ -2495,6 +2495,7 @@ snd_soc_bytes_info_ext snd_soc_bytes_tlv_callback snd_soc_card_jack_new + snd_soc_cnew snd_soc_component_exit_regmap snd_soc_component_init_regmap snd_soc_component_read From 4ab8dafa792af9d6fde24b649fa634cb5b375495 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 12 Aug 2024 12:29:22 -0700 Subject: [PATCH 33/50] FROMLIST: scsi: core: Retry passthrough commands if SCMD_RETRY_PASSTHROUGH is set The SCSI core does not retry passthrough commands even if the SCSI device reports a retryable unit attention condition. Support retrying in this case by introducing the SCMD_RETRY_PASSTHROUGH flag. Cc: Damien Le Moal Cc: Mike Christie Signed-off-by: Bart Van Assche Signed-off-by: Bart Van Assche Bug: 348341595 Link: https://lore.kernel.org/linux-scsi/yq17ccp1i4b.fsf@ca-mkp.ca.oracle.com/T/#mfdb1a3a0d6d4803afe1098bdafc12fd4168e30e0 Change-Id: I44092a0d8853fd61bf619e5bae6d65eaaddad780 Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_error.c | 5 ++++- include/scsi/scsi_cmnd.h | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index da7dac77f8cd..fc01cbe63ab7 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1816,7 +1816,10 @@ check_type: * assume caller has checked sense and determined * the check condition was retryable. */ - if (req->cmd_flags & REQ_FAILFAST_DEV || blk_rq_is_passthrough(req)) + if (req->cmd_flags & REQ_FAILFAST_DEV) + return true; + if (blk_rq_is_passthrough(req) && + !(scmd->flags & SCMD_RETRY_PASSTHROUGH)) return true; return false; diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index ce930d1fc2cc..dd3bd080bba4 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -54,8 +54,11 @@ struct scsi_pointer { #define SCMD_INITIALIZED (1 << 1) #define SCMD_LAST (1 << 2) #define SCMD_FAIL_IF_RECOVERING (1 << 4) +/* If set, retry a passthrough command in case of a unit attention. */ +#define SCMD_RETRY_PASSTHROUGH (1 << 5) /* flags preserved across unprep / reprep */ -#define SCMD_PRESERVED_FLAGS (SCMD_INITIALIZED | SCMD_FAIL_IF_RECOVERING) +#define SCMD_PRESERVED_FLAGS \ + (SCMD_INITIALIZED | SCMD_FAIL_IF_RECOVERING | SCMD_RETRY_PASSTHROUGH) /* for scmd->state */ #define SCMD_STATE_COMPLETE 0 From 660e1a26952bd58eda980b25a200957135f98848 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 12 Aug 2024 12:29:28 -0700 Subject: [PATCH 34/50] FROMLIST: sd: Retry START STOP UNIT commands During system resume, sd_start_stop_device() submits a START STOP UNIT command to the SCSI device that is being resumed. That command is not retried in case of a unit attention and hence may fail. An example: [16575.983359] sd 0:0:0:3: [sdd] Starting disk [16575.983693] sd 0:0:0:3: [sdd] Start/Stop Unit failed: Result: hostbyte=0x00 driverbyte=DRIVER_OK [16575.983712] sd 0:0:0:3: [sdd] Sense Key : 0x6 [16575.983730] sd 0:0:0:3: [sdd] ASC=0x29 ASCQ=0x0 [16575.983738] sd 0:0:0:3: PM: dpm_run_callback(): scsi_bus_resume+0x0/0xa0 returns -5 [16575.983783] sd 0:0:0:3: PM: failed to resume async: error -5 Make the SCSI core retry the START STOP UNIT command if a retryable error is encountered. Cc: Damien Le Moal Cc: Mike Christie Change-Id: Ic8e0859c4455d93fcabee42f1598858571f5f3d1 Signed-off-by: Bart Van Assche Bug: 348341595 Link: https://lore.kernel.org/linux-scsi/yq17ccp1i4b.fsf@ca-mkp.ca.oracle.com/T/#m52a26a50649b1d537cb129e5653f723509d6bde7 Signed-off-by: Bart Van Assche --- drivers/scsi/sd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index c04b3179b72a..5903a62709b2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3626,6 +3626,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) const struct scsi_exec_args exec_args = { .sshdr = &sshdr, .req_flags = BLK_MQ_REQ_PM, + .scmd_flags = SCMD_RETRY_PASSTHROUGH, }; struct scsi_device *sdp = sdkp->device; int res; From bbf690e531716d29f19f4a3a0f8f962c0eec17b9 Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Mon, 12 Aug 2024 17:24:05 +0000 Subject: [PATCH 35/50] ANDROID: add vendor hook for mapping_shrinkable To control inode memory reclaim, add restricted vendor hook. Bug: 347958166 Change-Id: Iefb9ef66c9fd5abae99adb1200263e4642f991cc Signed-off-by: Minchan Kim --- drivers/android/vendor_hooks.c | 1 + include/linux/pagemap.h | 6 ++++++ include/trace/hooks/mm.h | 3 +++ mm/filemap.c | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 0d33ee078bd6..20a40e94757f 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -336,6 +336,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_madvise_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_madvise_pageout_begin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_madvise_pageout_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_reclaim_folio_list); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mapping_shrinkable); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 5687abf81821..0da6dae34709 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -137,6 +137,8 @@ static inline bool mapping_empty(struct address_space *mapping) return xa_empty(&mapping->i_pages); } +extern void _trace_android_rvh_mapping_shrinkable(bool *shrinkable); + /* * mapping_shrinkable - test if page cache state allows inode reclaim * @mapping: the page cache mapping @@ -161,7 +163,11 @@ static inline bool mapping_empty(struct address_space *mapping) static inline bool mapping_shrinkable(struct address_space *mapping) { void *head; + bool shrinkable = false; + _trace_android_rvh_mapping_shrinkable(&shrinkable); + if (shrinkable) + return true; /* * On highmem systems, there could be lowmem pressure from the * inodes before there is highmem pressure from the page diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 6603dafabfd3..b8527123813f 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -112,6 +112,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_madvise_pageout_end, DECLARE_RESTRICTED_HOOK(android_rvh_reclaim_folio_list, TP_PROTO(struct list_head *folio_list, void *private), TP_ARGS(folio_list, private), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_mapping_shrinkable, + TP_PROTO(bool *shrinkable), + TP_ARGS(shrinkable), 1); DECLARE_HOOK(android_vh_smaps_pte_entry, TP_PROTO(swp_entry_t entry, unsigned long *writeback, unsigned long *same, unsigned long *huge), diff --git a/mm/filemap.c b/mm/filemap.c index e8744ab862fd..373165ba8a1f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -60,6 +60,12 @@ #include +void _trace_android_rvh_mapping_shrinkable(bool *shrinkable) +{ + trace_android_rvh_mapping_shrinkable(shrinkable); +} +EXPORT_SYMBOL_GPL(_trace_android_rvh_mapping_shrinkable); + /* * Shared mappings implemented 30.11.1994. It's not fully working yet, * though. From ab384f79d463db8e23c526906be16cb6e8ea356f Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Mon, 12 Aug 2024 19:47:51 +0000 Subject: [PATCH 36/50] ANDROID: Update the ABI symbol list Adding the following symbols: - bitmap_find_free_region - bitmap_release_region - of_graph_get_endpoint_by_regs - __traceiter_android_rvh_mapping_shrinkable - __traceiter_android_rvh_util_est_update - __tracepoint_android_rvh_mapping_shrinkable - __tracepoint_android_rvh_util_est_update Bug: 347958166 Change-Id: I4feadf95bf24da1a1554a828e181d4ec65cc9a32 Signed-off-by: Minchan Kim --- android/abi_gki_aarch64.stg | 20 ++++++++++++++++++++ android/abi_gki_aarch64_pixel | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 7f5b973ed0fc..3d3a096761d5 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -343530,6 +343530,15 @@ elf_symbol { type_id: 0x9bc2d779 full_name: "__traceiter_android_rvh_madvise_pageout_end" } +elf_symbol { + id: 0xc5bd3dc9 + name: "__traceiter_android_rvh_mapping_shrinkable" + is_defined: true + symbol_type: FUNCTION + crc: 0xda0f55f8 + type_id: 0x9be885da + full_name: "__traceiter_android_rvh_mapping_shrinkable" +} elf_symbol { id: 0xed2646da name: "__traceiter_android_rvh_meminfo_proc_show" @@ -348075,6 +348084,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_rvh_madvise_pageout_end" } +elf_symbol { + id: 0x3147c5df + name: "__tracepoint_android_rvh_mapping_shrinkable" + is_defined: true + symbol_type: OBJECT + crc: 0x5cf7d2fd + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_rvh_mapping_shrinkable" +} elf_symbol { id: 0x2252c1f0 name: "__tracepoint_android_rvh_meminfo_proc_show" @@ -412476,6 +412494,7 @@ interface { symbol_id: 0x7c212080 symbol_id: 0xc6985675 symbol_id: 0x15c6d0dd + symbol_id: 0xc5bd3dc9 symbol_id: 0xed2646da symbol_id: 0x1ea5d323 symbol_id: 0xc1a482d8 @@ -412981,6 +413000,7 @@ interface { symbol_id: 0x99d57c12 symbol_id: 0xf35a6597 symbol_id: 0xa667d2d3 + symbol_id: 0x3147c5df symbol_id: 0x2252c1f0 symbol_id: 0x3cb4db49 symbol_id: 0x3a6f3fb2 diff --git a/android/abi_gki_aarch64_pixel b/android/abi_gki_aarch64_pixel index cc344b06b512..95d325b8f9d2 100644 --- a/android/abi_gki_aarch64_pixel +++ b/android/abi_gki_aarch64_pixel @@ -76,6 +76,7 @@ __bitmap_andnot __bitmap_clear __bitmap_equal + bitmap_find_free_region bitmap_find_next_zero_area_off bitmap_free bitmap_from_arr32 @@ -84,6 +85,7 @@ bitmap_parselist bitmap_parse_user bitmap_print_to_pagebuf + bitmap_release_region __bitmap_set __bitmap_subset bitmap_to_arr32 @@ -1521,6 +1523,7 @@ of_get_parent of_get_property of_get_regulator_init_data + of_graph_get_endpoint_by_regs of_graph_get_next_endpoint of_graph_get_port_parent of_graph_get_remote_endpoint @@ -2348,6 +2351,7 @@ __traceiter_android_rvh_irqs_enable __traceiter_android_rvh_madvise_pageout_begin __traceiter_android_rvh_madvise_pageout_end + __traceiter_android_rvh_mapping_shrinkable __traceiter_android_rvh_meminfo_proc_show __traceiter_android_rvh_post_init_entity_util_avg __traceiter_android_rvh_preempt_disable @@ -2377,6 +2381,7 @@ __traceiter_android_rvh_update_misfit_status __traceiter_android_rvh_update_rt_rq_load_avg __traceiter_android_rvh_usb_dev_suspend + __traceiter_android_rvh_util_est_update __traceiter_android_rvh_util_fits_cpu __traceiter_android_vh_arch_set_freq_scale __traceiter_android_vh_audio_usb_offload_connect @@ -2476,6 +2481,7 @@ __tracepoint_android_rvh_irqs_enable __tracepoint_android_rvh_madvise_pageout_begin __tracepoint_android_rvh_madvise_pageout_end + __tracepoint_android_rvh_mapping_shrinkable __tracepoint_android_rvh_meminfo_proc_show __tracepoint_android_rvh_post_init_entity_util_avg __tracepoint_android_rvh_preempt_disable @@ -2505,6 +2511,7 @@ __tracepoint_android_rvh_update_misfit_status __tracepoint_android_rvh_update_rt_rq_load_avg __tracepoint_android_rvh_usb_dev_suspend + __tracepoint_android_rvh_util_est_update __tracepoint_android_rvh_util_fits_cpu __tracepoint_android_vh_arch_set_freq_scale __tracepoint_android_vh_audio_usb_offload_connect From 8dabbe83639928fef88038d862f67195ca2a551d Mon Sep 17 00:00:00 2001 From: Xiu Jianfeng Date: Wed, 6 Sep 2023 10:33:12 +0000 Subject: [PATCH 37/50] UPSTREAM: mm: remove duplicated vma->vm_flags check when expanding stack expand_upwards() and expand_downwards() will return -EFAULT if VM_GROWSUP or VM_GROWSDOWN is not correctly set in vma->vm_flags, however in !CONFIG_STACK_GROWSUP case, expand_stack_locked() returns -EINVAL first if !(vma->vm_flags & VM_GROWSDOWN) before calling expand_downwards(), to keep the consistency with CONFIG_STACK_GROWSUP case, remove this check. The usages of this function are as below: A:fs/exec.c ret = expand_stack_locked(vma, stack_base); if (ret) ret = -EFAULT; or B:mm/memory.c mm/mmap.c if (expand_stack_locked(vma, addr)) return NULL; which means the return value will not propagate to other places, so I believe there is no user-visible effects of this change, and it's unnecessary to backport to earlier versions. Bug: 254441685 Link: https://lkml.kernel.org/r/20230906103312.645712-1-xiujianfeng@huaweicloud.com Fixes: f440fa1ac955 ("mm: make find_extend_vma() fail if write lock not held") Signed-off-by: Xiu Jianfeng Cc: Liam R. Howlett Cc: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton (cherry picked from commit 7fa38d0ea00ffe2cd3c95c96c85221b8ae221875) Signed-off-by: Lee Jones Change-Id: Ibb98909a9f9f07b64e339a55cb583b357f9d964b --- mm/mmap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 2686e9e93915..efe4859cd9e6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2232,8 +2232,6 @@ struct vm_area_struct *find_extend_vma_locked(struct mm_struct *mm, unsigned lon #else int expand_stack_locked(struct vm_area_struct *vma, unsigned long address) { - if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) - return -EINVAL; return expand_downwards(vma, address); } From 7f2d1a477cec8deb8b8ec20fa99eda2ef75dbb5a Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Sun, 15 Oct 2023 05:31:08 +0000 Subject: [PATCH 38/50] UPSTREAM: usb: typec: tcpm: Add additional checks for contaminant When transitioning from SNK_DEBOUNCED to unattached, its worthwhile to check for contaminant to mitigate wakeups. ``` [81334.219571] Start toggling [81334.228220] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected] [81334.305147] CC1: 0 -> 0, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected] [81334.305162] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS] [81334.305187] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS] [81334.475515] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 170 ms] [81334.486480] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_DEBOUNCED, polarity 0, disconnected] [81334.486495] state change SNK_DEBOUNCED -> SNK_DEBOUNCED [rev3 NONE_AMS] [81334.486515] pending state change SNK_DEBOUNCED -> SNK_UNATTACHED @ 20 ms [rev3 NONE_AMS] [81334.506621] state change SNK_DEBOUNCED -> SNK_UNATTACHED [delayed 20 ms] [81334.506640] Start toggling [81334.516972] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected] [81334.592759] CC1: 0 -> 0, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected] [81334.592773] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS] [81334.592792] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS] [81334.762940] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 170 ms] [81334.773557] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_DEBOUNCED, polarity 0, disconnected] [81334.773570] state change SNK_DEBOUNCED -> SNK_DEBOUNCED [rev3 NONE_AMS] [81334.773588] pending state change SNK_DEBOUNCED -> SNK_UNATTACHED @ 20 ms [rev3 NONE_AMS] [81334.793672] state change SNK_DEBOUNCED -> SNK_UNATTACHED [delayed 20 ms] [81334.793681] Start toggling [81334.801840] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected] [81334.878655] CC1: 0 -> 0, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected] [81334.878672] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS] [81334.878696] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS] [81335.048968] state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED [delayed 170 ms] [81335.060684] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_DEBOUNCED, polarity 0, disconnected] [81335.060754] state change SNK_DEBOUNCED -> SNK_DEBOUNCED [rev3 NONE_AMS] [81335.060775] pending state change SNK_DEBOUNCED -> SNK_UNATTACHED @ 20 ms [rev3 NONE_AMS] [81335.080884] state change SNK_DEBOUNCED -> SNK_UNATTACHED [delayed 20 ms] [81335.080900] Start toggling ``` Bug: 254441685 Cc: stable@vger.kernel.org Fixes: 599f008c257d ("usb: typec: tcpm: Add callbacks to mitigate wakeups due to contaminant") Signed-off-by: Badhri Jagan Sridharan Acked-by: Heikki Krogerus Link: https://lore.kernel.org/r/20231015053108.2349570-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 1a4a2df07c1f087704c24282cebe882268e38146) Signed-off-by: Lee Jones Change-Id: I6251bd1c032515d96385744a751f792af54b2a31 --- drivers/usb/typec/tcpm/tcpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index acdc5650f2ed..a820e3e24d7a 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3948,6 +3948,8 @@ static void run_state_machine(struct tcpm_port *port) port->potential_contaminant = ((port->enter_state == SRC_ATTACH_WAIT && port->state == SRC_UNATTACHED) || (port->enter_state == SNK_ATTACH_WAIT && + port->state == SNK_UNATTACHED) || + (port->enter_state == SNK_DEBOUNCED && port->state == SNK_UNATTACHED)); port->enter_state = port->state; From 30c476490849cc67bceee306a33e1cb9084bf49d Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 18 Oct 2023 11:42:51 +0200 Subject: [PATCH 39/50] UPSTREAM: wifi: cfg80211: fix assoc response warning on failed links The warning here shouldn't be done before we even set the bss field (or should've used the input data). Move the assignment before the warning to fix it. We noticed this now because of Wen's bugfix, where the bug fixed there had previously hidden this other bug. Bug: 254441685 Fixes: 53ad07e9823b ("wifi: cfg80211: support reporting failed links") Signed-off-by: Johannes Berg (cherry picked from commit c434b2be2d80d236bb090fdb493d4bd5ed589238) Signed-off-by: Lee Jones Change-Id: Ibc3b59e9c61b74a9dbc25ddb2ee75f220bd0f5ae --- net/wireless/mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 775cac4d6100..b59c1bf7c8b3 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -43,10 +43,11 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, for (link_id = 0; link_id < ARRAY_SIZE(data->links); link_id++) { cr.links[link_id].status = data->links[link_id].status; + cr.links[link_id].bss = data->links[link_id].bss; + WARN_ON_ONCE(cr.links[link_id].status != WLAN_STATUS_SUCCESS && (!cr.ap_mld_addr || !cr.links[link_id].bss)); - cr.links[link_id].bss = data->links[link_id].bss; if (!cr.links[link_id].bss) continue; cr.links[link_id].bssid = data->links[link_id].bss->bssid; From 7d59065aa4bfb3f0a9d9ce70f8bdad3f894b9d1c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 14 Nov 2023 09:55:50 -0700 Subject: [PATCH 40/50] BACKPORT: io_uring/fdinfo: remove need for sqpoll lock for thread/pid retrieval A previous commit added a trylock for getting the SQPOLL thread info via fdinfo, but this introduced a regression where we often fail to get it if the thread is busy. For that case, we end up not printing the current CPU and PID info. Rather than rely on this lock, just print the pid we already stored in the io_sq_data struct, and ensure we update the current CPU every time we've slept or potentially rescheduled. The latter won't potentially be 100% accurate, but that wasn't the case before either as the task can get migrated at any time unless it has been pinned at creation time. We retain keeping the io_sq_data dereference inside the ctx->uring_lock, as it has always been, as destruction of the thread and data happen below that. We could make this RCU safe, but there's little point in doing that. With this, we always print the last valid information we had, rather than have spurious outputs with missing information. Bug: 254441685 Fixes: 7644b1a1c9a7 ("io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid") Signed-off-by: Jens Axboe (cherry picked from commit a0d45c3f596be53c1bd8822a1984532d14fdcea9) [Lee: PF_NO_SETAFFINITY has been removed upstream causing surrounding diff to change] Signed-off-by: Lee Jones Change-Id: Iab4aeffb443ed5140b33dd7274fee57c36f40f9e --- io_uring/fdinfo.c | 9 ++------- io_uring/sqpoll.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c index ea2c2ded4e41..42d8461ac546 100644 --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -141,13 +141,8 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, if (has_lock && (ctx->flags & IORING_SETUP_SQPOLL)) { struct io_sq_data *sq = ctx->sq_data; - if (mutex_trylock(&sq->lock)) { - if (sq->thread) { - sq_pid = task_pid_nr(sq->thread); - sq_cpu = task_cpu(sq->thread); - } - mutex_unlock(&sq->lock); - } + sq_pid = sq->task_pid; + sq_cpu = sq->sq_cpu; } seq_printf(m, "SqThread:\t%d\n", sq_pid); diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c index 7b6facf529b8..6f9c78bdd4ec 100644 --- a/io_uring/sqpoll.c +++ b/io_uring/sqpoll.c @@ -214,6 +214,7 @@ static bool io_sqd_handle_event(struct io_sq_data *sqd) did_sig = get_signal(&ksig); cond_resched(); mutex_lock(&sqd->lock); + sqd->sq_cpu = raw_smp_processor_id(); } return did_sig || test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state); } @@ -229,10 +230,15 @@ static int io_sq_thread(void *data) snprintf(buf, sizeof(buf), "iou-sqp-%d", sqd->task_pid); set_task_comm(current, buf); - if (sqd->sq_cpu != -1) + /* reset to our pid after we've set task_comm, for fdinfo */ + sqd->task_pid = current->pid; + + if (sqd->sq_cpu != -1) { set_cpus_allowed_ptr(current, cpumask_of(sqd->sq_cpu)); - else + } else { set_cpus_allowed_ptr(current, cpu_online_mask); + sqd->sq_cpu = raw_smp_processor_id(); + } current->flags |= PF_NO_SETAFFINITY; mutex_lock(&sqd->lock); @@ -262,6 +268,7 @@ static int io_sq_thread(void *data) mutex_unlock(&sqd->lock); cond_resched(); mutex_lock(&sqd->lock); + sqd->sq_cpu = raw_smp_processor_id(); } continue; } @@ -295,6 +302,7 @@ static int io_sq_thread(void *data) mutex_unlock(&sqd->lock); schedule(); mutex_lock(&sqd->lock); + sqd->sq_cpu = raw_smp_processor_id(); } list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) atomic_andnot(IORING_SQ_NEED_WAKEUP, From f3d71968c15f1b66ac937d57d46599c888232dbf Mon Sep 17 00:00:00 2001 From: Laurentiu Tudor Date: Tue, 26 Sep 2023 18:26:00 +0300 Subject: [PATCH 41/50] UPSTREAM: iommu: Map reserved memory as cacheable if device is coherent Check if the device is marked as DMA coherent in the DT and if so, map its reserved memory as cacheable in the IOMMU. This fixes the recently added IOMMU reserved memory support which uses IOMMU_RESV_DIRECT without properly building the PROT for the mapping. Bug: 254441685 Fixes: a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()") Signed-off-by: Laurentiu Tudor Reviewed-by: Jason Gunthorpe Acked-by: Thierry Reding Link: https://lore.kernel.org/r/20230926152600.8749-1-laurentiu.tudor@nxp.com Signed-off-by: Joerg Roedel (cherry picked from commit f1aad9df93f39267e890836a28d22511f23474e1) Signed-off-by: Lee Jones Change-Id: Ic6738822da32e134af9dd3ed5737e611dffe85c9 --- drivers/iommu/of_iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index e5057c464f9c..6012f2157f33 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -261,6 +261,9 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list) phys_addr_t iova; size_t length; + if (of_dma_is_coherent(dev->of_node)) + prot |= IOMMU_CACHE; + maps = of_translate_dma_region(np, maps, &iova, &length); type = iommu_resv_region_get_type(dev, &phys, iova, length); From 793280fe934b693727c6462b6f59b2316ba7d526 Mon Sep 17 00:00:00 2001 From: Daniel Mentz Date: Tue, 7 Nov 2023 22:22:26 -0800 Subject: [PATCH 42/50] UPSTREAM: iommu: Fix printk arg in of_iommu_get_resv_regions() The variable phys is defined as (struct resource *) which aligns with the printk format specifier %pr. Taking the address of it results in a value of type (struct resource **) which is incompatible with the format specifier %pr. Therefore, remove the address of operator (&). Bug: 254441685 Fixes: a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()") Signed-off-by: Daniel Mentz Acked-by: Thierry Reding Link: https://lore.kernel.org/r/20231108062226.928985-1-danielmentz@google.com Signed-off-by: Joerg Roedel (cherry picked from commit c2183b3dcc9dd41b768569ea88bededa58cceebb) Signed-off-by: Lee Jones Change-Id: I36e8878d09f8cb3ff12280fbb535bfb8df682055 --- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 6012f2157f33..6981b43c5fe5 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -198,7 +198,7 @@ iommu_resv_region_get_type(struct device *dev, if (start == phys->start && end == phys->end) return IOMMU_RESV_DIRECT; - dev_warn(dev, "treating non-direct mapping [%pr] -> [%pap-%pap] as reservation\n", &phys, + dev_warn(dev, "treating non-direct mapping [%pr] -> [%pap-%pap] as reservation\n", phys, &start, &end); return IOMMU_RESV_RESERVED; } From 66e0c1458050e2caef5f3516fb59c9637ddce652 Mon Sep 17 00:00:00 2001 From: Ashish Mhetre Date: Tue, 5 Dec 2023 12:26:56 +0530 Subject: [PATCH 43/50] UPSTREAM: iommu: Don't reserve 0-length IOVA region When the bootloader/firmware doesn't setup the framebuffers, their address and size are 0 in "iommu-addresses" property. If IOVA region is reserved with 0 length, then it ends up corrupting the IOVA rbtree with an entry which has pfn_hi < pfn_lo. If we intend to use display driver in kernel without framebuffer then it's causing the display IOMMU mappings to fail as entire valid IOVA space is reserved when address and length are passed as 0. An ideal solution would be firmware removing the "iommu-addresses" property and corresponding "memory-region" if display is not present. But the kernel should be able to handle this by checking for size of IOVA region and skipping the IOVA reservation if size is 0. Also, add a warning if firmware is requesting 0-length IOVA region reservation. Bug: 254441685 Fixes: a5bf3cfce8cb ("iommu: Implement of_iommu_get_resv_regions()") Signed-off-by: Ashish Mhetre Acked-by: Robin Murphy Link: https://lore.kernel.org/r/20231205065656.9544-1-amhetre@nvidia.com Signed-off-by: Joerg Roedel (cherry picked from commit bb57f6705960bebeb832142ce9abf43220c3eab1) Signed-off-by: Lee Jones Change-Id: I2484452356e69ecafc006246313d5c92fe9f1509 --- drivers/iommu/of_iommu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 6981b43c5fe5..3ad1461dc94f 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -265,6 +265,10 @@ void of_iommu_get_resv_regions(struct device *dev, struct list_head *list) prot |= IOMMU_CACHE; maps = of_translate_dma_region(np, maps, &iova, &length); + if (length == 0) { + dev_warn(dev, "Cannot reserve IOVA region of 0 size\n"); + continue; + } type = iommu_resv_region_get_type(dev, &phys, iova, length); region = iommu_alloc_resv_region(iova, length, prot, type, From a8e77a70727039a23c77f75c60b097e1ba4a02a7 Mon Sep 17 00:00:00 2001 From: Chao Yu Date: Mon, 29 Jan 2024 19:27:40 +0800 Subject: [PATCH 44/50] UPSTREAM: f2fs: zone: fix to wait completion of last bio in zone correctly It needs to check last zone_pending_bio and wait IO completion before traverse next fio in io->io_list, otherwise, bio in next zone may be submitted before all IO completion in current zone. Bug: 254441685 Fixes: e067dc3c6b9c ("f2fs: maintain six open zones for zoned devices") Cc: Daeho Jeong Signed-off-by: Chao Yu Reviewed-by: Daeho Jeong Signed-off-by: Jaegeuk Kim (cherry picked from commit 536af8211586af09c5bea1c15ad28ddec5f66a97) Signed-off-by: Lee Jones Change-Id: Ifefc2c6fbda3aae00cef3650cafe48b496da65ca --- fs/f2fs/data.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 90baed7a62ed..2fde898dd6c2 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1015,7 +1015,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) f2fs_bug_on(sbi, is_read_io(fio->op)); f2fs_down_write(&io->io_rwsem); - +next: #ifdef CONFIG_BLK_DEV_ZONED if (f2fs_sb_has_blkzoned(sbi) && btype < META && io->zone_pending_bio) { wait_for_completion_io(&io->zone_wait); @@ -1025,7 +1025,6 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) } #endif -next: if (fio->in_list) { spin_lock(&io->io_lock); if (list_empty(&io->io_list)) { From 5fc3f5b48af2ca26f3f7918f608d2136aa5b1ce1 Mon Sep 17 00:00:00 2001 From: Wenjie Qi Date: Tue, 16 Jan 2024 22:11:38 +0800 Subject: [PATCH 45/50] UPSTREAM: f2fs: fix NULL pointer dereference in f2fs_submit_page_write() BUG: kernel NULL pointer dereference, address: 0000000000000014 RIP: 0010:f2fs_submit_page_write+0x6cf/0x780 [f2fs] Call Trace: ? show_regs+0x6e/0x80 ? __die+0x29/0x70 ? page_fault_oops+0x154/0x4a0 ? prb_read_valid+0x20/0x30 ? __irq_work_queue_local+0x39/0xd0 ? irq_work_queue+0x36/0x70 ? do_user_addr_fault+0x314/0x6c0 ? exc_page_fault+0x7d/0x190 ? asm_exc_page_fault+0x2b/0x30 ? f2fs_submit_page_write+0x6cf/0x780 [f2fs] ? f2fs_submit_page_write+0x736/0x780 [f2fs] do_write_page+0x50/0x170 [f2fs] f2fs_outplace_write_data+0x61/0xb0 [f2fs] f2fs_do_write_data_page+0x3f8/0x660 [f2fs] f2fs_write_single_data_page+0x5bb/0x7a0 [f2fs] f2fs_write_cache_pages+0x3da/0xbe0 [f2fs] ... It is possible that other threads have added this fio to io->bio and submitted the io->bio before entering f2fs_submit_page_write(). At this point io->bio = NULL. If is_end_zone_blkaddr(sbi, fio->new_blkaddr) of this fio is true, then an NULL pointer dereference error occurs at bio_get(io->bio). The original code for determining zone end was after "out:", which would have missed some fio who is zone end. I've moved this code before "skip:" to make sure it's done for each fio. Bug: 254441685 Fixes: e067dc3c6b9c ("f2fs: maintain six open zones for zoned devices") Signed-off-by: Wenjie Qi Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim (cherry picked from commit c2034ef6192a65a986a45c2aa2ed05824fdc0e9f) Signed-off-by: Lee Jones Change-Id: I98714afbda136a8932eaa417fff129bd4db61b26 --- fs/f2fs/data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 2fde898dd6c2..1f81b2c9b0b9 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1085,10 +1085,6 @@ alloc_new: io->last_block_in_bio = fio->new_blkaddr; trace_f2fs_submit_page_write(fio->page, fio); -skip: - if (fio->in_list) - goto next; -out: #ifdef CONFIG_BLK_DEV_ZONED if (f2fs_sb_has_blkzoned(sbi) && btype < META && is_end_zone_blkaddr(sbi, fio->new_blkaddr)) { @@ -1101,6 +1097,10 @@ out: __submit_merged_bio(io); } #endif +skip: + if (fio->in_list) + goto next; +out: if (is_sbi_flag_set(sbi, SBI_IS_SHUTDOWN) || !f2fs_is_checkpoint_ready(sbi)) __submit_merged_bio(io); From 64b0e0b28508be6c85eccbb0be56a4ee9337639d Mon Sep 17 00:00:00 2001 From: Ryan Roberts Date: Tue, 23 Jan 2024 14:17:55 +0000 Subject: [PATCH 46/50] UPSTREAM: mm/userfaultfd: UFFDIO_MOVE implementation should use ptep_get() Commit c33c794828f2 ("mm: ptep_get() conversion") converted all (non-arch) call sites to use ptep_get() instead of doing a direct dereference of the pte. Full rationale can be found in that commit's log. Since then, UFFDIO_MOVE has been implemented which does 7 direct pte dereferences. Let's fix those up to use ptep_get(). I've asserted in the past that there is no reliable automated mechanism to catch these; I'm relying on a combination of Coccinelle (which throws up a lot of false positives) and some compiler magic to force a compiler error on dereference. But given the frequency with which new issues are coming up, I'll add it to my todo list to try to find an automated solution. Bug: 254441685 Link: https://lkml.kernel.org/r/20240123141755.3836179-1-ryan.roberts@arm.com Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI") Signed-off-by: Ryan Roberts Reviewed-by: Suren Baghdasaryan Cc: Andrea Arcangeli Cc: David Hildenbrand Signed-off-by: Andrew Morton (cherry picked from commit 56ae10cf628b02279980d17439c6241a643959c2) Signed-off-by: Lee Jones Change-Id: I0573208f1c7ad5085e0f7e82d484199074a5f6ef --- mm/userfaultfd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index dffa3fe756a6..789b78245e9c 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -941,8 +941,8 @@ static int move_present_pte(struct mm_struct *mm, double_pt_lock(dst_ptl, src_ptl); - if (!pte_same(*src_pte, orig_src_pte) || - !pte_same(*dst_pte, orig_dst_pte)) { + if (!pte_same(ptep_get(src_pte), orig_src_pte) || + !pte_same(ptep_get(dst_pte), orig_dst_pte)) { err = -EAGAIN; goto out; } @@ -985,8 +985,8 @@ static int move_swap_pte(struct mm_struct *mm, double_pt_lock(dst_ptl, src_ptl); - if (!pte_same(*src_pte, orig_src_pte) || - !pte_same(*dst_pte, orig_dst_pte)) { + if (!pte_same(ptep_get(src_pte), orig_src_pte) || + !pte_same(ptep_get(dst_pte), orig_dst_pte)) { double_pt_unlock(dst_ptl, src_ptl); return -EAGAIN; } @@ -1085,7 +1085,7 @@ retry: } spin_lock(dst_ptl); - orig_dst_pte = *dst_pte; + orig_dst_pte = ptep_get(dst_pte); spin_unlock(dst_ptl); if (!pte_none(orig_dst_pte)) { err = -EEXIST; @@ -1093,7 +1093,7 @@ retry: } spin_lock(src_ptl); - orig_src_pte = *src_pte; + orig_src_pte = ptep_get(src_pte); spin_unlock(src_ptl); if (pte_none(orig_src_pte)) { if (!(mode & UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES)) @@ -1131,7 +1131,7 @@ retry: * page isn't freed under us */ spin_lock(src_ptl); - if (!pte_same(orig_src_pte, *src_pte)) { + if (!pte_same(orig_src_pte, ptep_get(src_pte))) { spin_unlock(src_ptl); err = -EAGAIN; goto out; From d6a513a78492b09fbe41a9922948a7371c821c5b Mon Sep 17 00:00:00 2001 From: Andrew Halaney Date: Fri, 29 Mar 2024 15:46:49 -0500 Subject: [PATCH 47/50] UPSTREAM: scsi: ufs: core: Perform read back after writing UTP_TASK_REQ_LIST_BASE_H Currently, the UTP_TASK_REQ_LIST_BASE_L/UTP_TASK_REQ_LIST_BASE_H regs are written to and then completed with an mb(). mb() ensures that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring these bits have taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure the bits hit the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Bug: 254441685 Fixes: 88441a8d355d ("scsi: ufs: core: Add hibernation callbacks") Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Reviewed-by: Can Guo Signed-off-by: Andrew Halaney Link: https://lore.kernel.org/r/20240329-ufs-reset-ensure-effect-before-delay-v5-7-181252004586@redhat.com Signed-off-by: Martin K. Petersen (cherry picked from commit 408e28086f1c7a6423efc79926a43d7001902fae) Signed-off-by: Lee Jones Change-Id: Iadf1f45aebea54393365a5387d35440aa5df3e00 --- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index bd8cbd64758d..2779cded8141 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10257,7 +10257,7 @@ int ufshcd_system_restore(struct device *dev) * are updated with the latest queue addresses. Only after * updating these addresses, we can queue the new commands. */ - mb(); + ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H); /* Resuming from hibernate, assume that link was OFF */ ufshcd_set_link_off(hba); From bd593055710c8bd38c9d2ae2ac6893489c05d912 Mon Sep 17 00:00:00 2001 From: David Stevens Date: Wed, 24 Apr 2024 18:03:41 +0900 Subject: [PATCH 48/50] UPSTREAM: genirq/cpuhotplug: Skip suspended interrupts when restoring affinity irq_restore_affinity_of_irq() restarts managed interrupts unconditionally when the first CPU in the affinity mask comes online. That's correct during normal hotplug operations, but not when resuming from S3 because the drivers are not resumed yet and interrupt delivery is not expected by them. Skip the startup of suspended interrupts and let resume_device_irqs() deal with restoring them. This ensures that irqs are not delivered to drivers during the noirq phase of resuming from S3, after non-boot CPUs are brought back online. Signed-off-by: David Stevens Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240424090341.72236-1-stevensd@chromium.org Bug: 359158960 Change-Id: Ie5610f7dffe05a141e6db1a8b6b067845c910b4a (cherry picked from commit a60dd06af674d3bb76b40da5d722e4a0ecefe650) Signed-off-by: Bart Van Assche --- kernel/irq/cpuhotplug.c | 11 ++++++++--- kernel/irq/manage.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 1ed2b1739363..43340e0b6df0 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -195,10 +195,15 @@ static void irq_restore_affinity_of_irq(struct irq_desc *desc, unsigned int cpu) !irq_data_get_irq_chip(data) || !cpumask_test_cpu(cpu, affinity)) return; - if (irqd_is_managed_and_shutdown(data)) { - irq_startup(desc, IRQ_RESEND, IRQ_START_COND); + /* + * Don't restore suspended interrupts here when a system comes back + * from S3. They are reenabled via resume_device_irqs(). + */ + if (desc->istate & IRQS_SUSPENDED) return; - } + + if (irqd_is_managed_and_shutdown(data)) + irq_startup(desc, IRQ_RESEND, IRQ_START_COND); /* * If the interrupt can only be directed to a single target diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 7103e89a5828..e6783394a715 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -789,10 +789,14 @@ void __enable_irq(struct irq_desc *desc) irq_settings_set_noprobe(desc); /* * Call irq_startup() not irq_enable() here because the - * interrupt might be marked NOAUTOEN. So irq_startup() - * needs to be invoked when it gets enabled the first - * time. If it was already started up, then irq_startup() - * will invoke irq_enable() under the hood. + * interrupt might be marked NOAUTOEN so irq_startup() + * needs to be invoked when it gets enabled the first time. + * This is also required when __enable_irq() is invoked for + * a managed and shutdown interrupt from the S3 resume + * path. + * + * If it was already started up, then irq_startup() will + * invoke irq_enable() under the hood. */ irq_startup(desc, IRQ_RESEND, IRQ_START_FORCE); break; From a339e02cdeb9a42a7e048c190effa05b601bc282 Mon Sep 17 00:00:00 2001 From: Dongli Zhang Date: Tue, 23 Apr 2024 00:34:13 -0700 Subject: [PATCH 49/50] UPSTREAM: genirq/cpuhotplug: Retry with cpu_online_mask when migration fails When a CPU goes offline, the interrupts affine to that CPU are re-configured. Managed interrupts undergo either migration to other CPUs or shutdown if all CPUs listed in the affinity are offline. The migration of managed interrupts is guaranteed on x86 because there are interrupt vectors reserved. Regular interrupts are migrated to a still online CPU in the affinity mask or if there is no online CPU to any online CPU. This works as long as the still online CPUs in the affinity mask have interrupt vectors available, but in case that none of those CPUs has a vector available the migration fails and the device interrupt becomes stale. This is not any different from the case where the affinity mask does not contain any online CPU, but there is no fallback operation for this. Instead of giving up, retry the migration attempt with the online CPU mask if the interrupt is not managed, as managed interrupts cannot be affected by this problem. Signed-off-by: Dongli Zhang Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240423073413.79625-1-dongli.zhang@oracle.com Bug: 359158960 Change-Id: I3e8acfe0598b0cb94389115d680d2216833d6a0c (cherry picked from commit 88d724e2301a69c1ab805cd74fc27aa36ae529e0) Signed-off-by: Bart Van Assche --- kernel/irq/cpuhotplug.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 43340e0b6df0..75cadbc3c232 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -130,6 +130,22 @@ static bool migrate_one_irq(struct irq_desc *desc) * CPU. */ err = irq_do_set_affinity(d, affinity, false); + + /* + * If there are online CPUs in the affinity mask, but they have no + * vectors left to make the migration work, try to break the + * affinity by migrating to any online CPU. + */ + if (err == -ENOSPC && !irqd_affinity_is_managed(d) && affinity != cpu_online_mask) { + pr_debug("IRQ%u: set affinity failed for %*pbl, re-try with online CPUs\n", + d->irq, cpumask_pr_args(affinity)); + + affinity = cpu_online_mask; + brokeaff = true; + + err = irq_do_set_affinity(d, affinity, false); + } + if (err) { pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", d->irq, err); From edca080b95df0ddec775a2725fbcfeddc3f11c9b Mon Sep 17 00:00:00 2001 From: Dongli Zhang Date: Wed, 22 May 2024 15:02:18 -0700 Subject: [PATCH 50/50] BACKPORT: genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline The absence of IRQD_MOVE_PCNTXT prevents immediate effectiveness of interrupt affinity reconfiguration via procfs. Instead, the change is deferred until the next instance of the interrupt being triggered on the original CPU. When the interrupt next triggers on the original CPU, the new affinity is enforced within __irq_move_irq(). A vector is allocated from the new CPU, but the old vector on the original CPU remains and is not immediately reclaimed. Instead, apicd->move_in_progress is flagged, and the reclaiming process is delayed until the next trigger of the interrupt on the new CPU. Upon the subsequent triggering of the interrupt on the new CPU, irq_complete_move() adds a task to the old CPU's vector_cleanup list if it remains online. Subsequently, the timer on the old CPU iterates over its vector_cleanup list, reclaiming old vectors. However, a rare scenario arises if the old CPU is outgoing before the interrupt triggers again on the new CPU. In that case irq_force_complete_move() is not invoked on the outgoing CPU to reclaim the old apicd->prev_vector because the interrupt isn't currently affine to the outgoing CPU, and irq_needs_fixup() returns false. Even though __vector_schedule_cleanup() is later called on the new CPU, it doesn't reclaim apicd->prev_vector; instead, it simply resets both apicd->move_in_progress and apicd->prev_vector to 0. As a result, the vector remains unreclaimed in vector_matrix, leading to a CPU vector leak. To address this issue, move the invocation of irq_force_complete_move() before the irq_needs_fixup() call to reclaim apicd->prev_vector, if the interrupt is currently or used to be affine to the outgoing CPU. Additionally, reclaim the vector in __vector_schedule_cleanup() as well, following a warning message, although theoretically it should never see apicd->move_in_progress with apicd->prev_cpu pointing to an offline CPU. Fixes: f0383c24b485 ("genirq/cpuhotplug: Add support for cleaning up move in progress") Signed-off-by: Dongli Zhang Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240522220218.162423-1-dongli.zhang@oracle.com Bug: 359158960 Change-Id: Ib9a564add4cd1c90ec725ab7f0bdc0db505ae29f (cherry picked from commit a6c11c0a5235fb144a65e0cb2ffd360ddc1f6c32) Signed-off-by: Bart Van Assche --- arch/x86/kernel/apic/vector.c | 9 ++++++--- kernel/irq/cpuhotplug.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 3e6f6b448f6a..d261b4c207d0 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -982,7 +982,8 @@ static void __send_cleanup_vector(struct apic_chip_data *apicd) hlist_add_head(&apicd->clist, per_cpu_ptr(&cleanup_list, cpu)); apic->send_IPI(cpu, IRQ_MOVE_CLEANUP_VECTOR); } else { - apicd->prev_vector = 0; + pr_warn("IRQ %u schedule cleanup for offline CPU %u\n", apicd->irq, cpu); + free_moved_vector(apicd); } raw_spin_unlock(&vector_lock); } @@ -1019,6 +1020,7 @@ void irq_complete_move(struct irq_cfg *cfg) */ void irq_force_complete_move(struct irq_desc *desc) { + unsigned int cpu = smp_processor_id(); struct apic_chip_data *apicd; struct irq_data *irqd; unsigned int vector; @@ -1043,10 +1045,11 @@ void irq_force_complete_move(struct irq_desc *desc) goto unlock; /* - * If prev_vector is empty, no action required. + * If prev_vector is empty or the descriptor is neither currently + * nor previously on the outgoing CPU no action required. */ vector = apicd->prev_vector; - if (!vector) + if (!vector || (apicd->cpu != cpu && apicd->prev_cpu != cpu)) goto unlock; /* diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c index 75cadbc3c232..eb8628390156 100644 --- a/kernel/irq/cpuhotplug.c +++ b/kernel/irq/cpuhotplug.c @@ -69,6 +69,14 @@ static bool migrate_one_irq(struct irq_desc *desc) return false; } + /* + * Complete an eventually pending irq move cleanup. If this + * interrupt was moved in hard irq context, then the vectors need + * to be cleaned up. It can't wait until this interrupt actually + * happens and this CPU was involved. + */ + irq_force_complete_move(desc); + /* * No move required, if: * - Interrupt is per cpu @@ -87,14 +95,6 @@ static bool migrate_one_irq(struct irq_desc *desc) return false; } - /* - * Complete an eventually pending irq move cleanup. If this - * interrupt was moved in hard irq context, then the vectors need - * to be cleaned up. It can't wait until this interrupt actually - * happens and this CPU was involved. - */ - irq_force_complete_move(desc); - /* * If there is a setaffinity pending, then try to reuse the pending * mask, so the last change of the affinity does not get lost. If