From 34fde9ec08a36b05a8a2b6ee14921b3120f4f650 Mon Sep 17 00:00:00 2001 From: Xu Yang Date: Tue, 1 Aug 2023 15:01:10 +0800 Subject: [PATCH 001/113] FROMGIT: usb: typec: tcpm: not sink vbus if operational current is 0mA PD3.0 Spec 6.4.1.3.1 said: For a Sink requiring no power from the Source, the Voltage (B19-10) shall be set to 5V and the Operational Current Shall be set to 0mA. Therefore, we can keep sink path closed if the operational current of the first fixed PDO is 0mA. Bug: 295046582 Signed-off-by: Xu Yang Acked-by: Heikki Krogerus Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20230801070110.1653394-1-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 803b1c8a0cea58cccde16eba31d285956f4c920c https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Change-Id: Iaa361690d54e64b604667f5d9d7f01482a07725b Signed-off-by: Jindong Yue --- drivers/usb/typec/tcpm/tcpm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 6af7c21aeaac..ba7f117cbdcd 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -4312,7 +4312,9 @@ static void run_state_machine(struct tcpm_port *port) if (port->slow_charger_loop && (current_lim > PD_P_SNK_STDBY_MW / 5)) current_lim = PD_P_SNK_STDBY_MW / 5; tcpm_set_current_limit(port, current_lim, 5000); - tcpm_set_charge(port, true); + /* Not sink vbus if operational current is 0mA */ + tcpm_set_charge(port, !!pdo_max_current(port->snk_pdo[0])); + if (!port->pd_supported) tcpm_set_state(port, SNK_READY, 0); else @@ -4601,7 +4603,8 @@ static void run_state_machine(struct tcpm_port *port) tcpm_set_current_limit(port, tcpm_get_current_limit(port), 5000); - tcpm_set_charge(port, true); + /* Not sink vbus if operational current is 0mA */ + tcpm_set_charge(port, !!pdo_max_current(port->snk_pdo[0])); } if (port->ams == HARD_RESET) tcpm_ams_finish(port); From c2611a04b92f0e6a38f718c50605300a325b7c7b Mon Sep 17 00:00:00 2001 From: zhengjiacheng Date: Fri, 18 Aug 2023 14:29:46 +0800 Subject: [PATCH 002/113] ANDROID: GKI: update symbol list file for xiaomi INFO: ABI DIFFERENCES HAVE BEEN DETECTED! INFO: 2 function symbol(s) added 'void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)' 'int pci_disable_pcie_error_reporting(struct pci_dev *dev)' Bug: 296484741 Change-Id: I8e4b871947929f3ba55f1cad5a922b9c377044d1 Signed-off-by: zhengjiacheng --- android/abi_gki_aarch64.stg | 26 ++++++++++++++++++++++++++ android/abi_gki_aarch64_xiaomi | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 0a050f0bf426..c22a52854e13 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -295323,6 +295323,12 @@ function { id: 0x534abe77 return_type_id: 0x295c7202 } +function { + id: 0x5373932e + return_type_id: 0x18bd6530 + parameter_id: 0x11e6864c + parameter_id: 0x6720d32f +} function { id: 0x537f4e77 return_type_id: 0x18bd6530 @@ -363270,6 +363276,15 @@ elf_symbol { type_id: 0x14e1f000 full_name: "pci_disable_msix" } +elf_symbol { + id: 0xc3f9d559 + name: "pci_disable_pcie_error_reporting" + is_defined: true + symbol_type: FUNCTION + crc: 0xb4006e89 + type_id: 0x99f942bc + full_name: "pci_disable_pcie_error_reporting" +} elf_symbol { id: 0xb9d0b3a8 name: "pci_disable_sriov" @@ -363495,6 +363510,15 @@ elf_symbol { type_id: 0x537f83a2 full_name: "pci_iomap_range" } +elf_symbol { + id: 0x1c994923 + name: "pci_ioremap_bar" + is_defined: true + symbol_type: FUNCTION + crc: 0xccd07b76 + type_id: 0x5373932e + full_name: "pci_ioremap_bar" +} elf_symbol { id: 0xec861eec name: "pci_iounmap" @@ -389626,6 +389650,7 @@ interface { symbol_id: 0x7cd4622d symbol_id: 0x5dfeb70f symbol_id: 0x01a00013 + symbol_id: 0xc3f9d559 symbol_id: 0xb9d0b3a8 symbol_id: 0x96b46225 symbol_id: 0x35a3d772 @@ -389651,6 +389676,7 @@ interface { symbol_id: 0xbe6406c3 symbol_id: 0x9c6c58ea symbol_id: 0x2fefe933 + symbol_id: 0x1c994923 symbol_id: 0xec861eec symbol_id: 0x5810bdc3 symbol_id: 0x3cbd6214 diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index 21ad5310ac70..5a0852cf19f6 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -328,3 +328,7 @@ dma_need_sync page_pool_put_page_bulk build_skb_around + +#required by xm_ispv4_pcie.ko + pci_ioremap_bar + pci_disable_pcie_error_reporting From 722f6cc09c1d2f510f785fc9a1507d847a181618 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 10 Nov 2022 14:56:55 +0000 Subject: [PATCH 003/113] ANDROID: Revert "ANDROID: allmodconfig: disable WERROR" This reverts commit eb57c31115051c5404d1bb1f2daec20e051b0287. This branch looks clean of WERROR warnings. Let's try to re-enable it. Fixes: eb57c31115051 ("ANDROID: allmodconfig: disable WERROR") Change-Id: I0106dcd43d7e4b4e20ac768f3faac40285bc837b (cherry picked from commit d19f8758ae7732b14fd85e97c66dec2855d3be73) Signed-off-by: Lee Jones --- build.config.allmodconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/build.config.allmodconfig b/build.config.allmodconfig index 3d443b98714c..65d84dbb710d 100644 --- a/build.config.allmodconfig +++ b/build.config.allmodconfig @@ -4,7 +4,6 @@ POST_DEFCONFIG_CMDS="update_config" function update_config() { ${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \ -e UNWINDER_FRAME_POINTER \ - -d WERROR \ -d SAMPLES \ -d BPFILTER \ -e RANDSTRUCT_NONE \ From 078410e73f0861245354469d54cbf53b7ebf8cb2 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Wed, 12 Jul 2023 08:57:22 +0000 Subject: [PATCH 004/113] UPSTREAM: usb: typec: tcpm: Fix response to vsafe0V event commit 4270d2b4845e820b274702bfc2a7140f69e4d19d upstream. Do not transition to SNK_UNATTACHED state when receiving vsafe0v event while in SNK_HARD_RESET_WAIT_VBUS. Ignore VBUS off events as well as in some platforms VBUS off can be signalled more than once. [143515.364753] Requesting mux state 1, usb-role 2, orientation 2 [143515.365520] pending state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_SINK_ON @ 650 ms [rev3 HARD_RESET] [143515.632281] CC1: 0 -> 0, CC2: 3 -> 0 [state SNK_HARD_RESET_SINK_OFF, polarity 1, disconnected] [143515.637214] VBUS on [143515.664985] VBUS off [143515.664992] state change SNK_HARD_RESET_SINK_OFF -> SNK_HARD_RESET_WAIT_VBUS [rev3 HARD_RESET] [143515.665564] VBUS VSAFE0V [143515.665566] state change SNK_HARD_RESET_WAIT_VBUS -> SNK_UNATTACHED [rev3 HARD_RESET] Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus") Cc: Change-Id: I0279d8abde2ceb42aefea29b4ca21972dbe4065c Signed-off-by: Badhri Jagan Sridharan Acked-by: Heikki Krogerus Link: https://lore.kernel.org/r/20230712085722.1414743-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman Bug: 290878685 (cherry picked from commit c2372b1559d4b5510f44feb885be3533f9919fe0) Change-Id: I9cfd4f5533edf7b3a0893a7bef2845448d21b650 Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/typec/tcpm/tcpm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index ba7f117cbdcd..51b36fc21605 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5381,6 +5381,10 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) /* Do nothing, vbus drop expected */ break; + case SNK_HARD_RESET_WAIT_VBUS: + /* Do nothing, its OK to receive vbus off events */ + break; + default: if (port->pwr_role == TYPEC_SINK && port->attached) tcpm_set_state(port, SNK_UNATTACHED, tcpm_wait_for_discharge(port)); @@ -5432,6 +5436,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) case SNK_DEBOUNCED: /*Do nothing, still waiting for VSAFE5V for connect */ break; + case SNK_HARD_RESET_WAIT_VBUS: + /* Do nothing, its OK to receive vbus off events */ + break; default: if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) tcpm_set_state(port, SNK_UNATTACHED, 0); From 073df44c36d631529bd32a55f4e0a069dbc05d47 Mon Sep 17 00:00:00 2001 From: Kyle Tso Date: Tue, 1 Aug 2023 00:21:59 +0800 Subject: [PATCH 005/113] FROMGIT: usb: typec: tcpm: Refactor the PPS APDO selection In current design of the PPS APDO selection, TCPM power supply only accepts the requested voltage which is inside the range of the selected PPS profile. To extend the flexibility and usability, remove the checks about the voltage range in current profile. And try to search all PPS APDOs of the Source that fit the requested voltage. Also remove some redundant checks in tcpm_pd_build_pps_request. Signed-off-by: Kyle Tso Acked-by: Heikki Krogerus Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20230731162159.19483-1-kyletso@google.com Signed-off-by: Greg Kroah-Hartman Bug: 273608315 (cherry picked from commit 40f362ffa5e9ddf413825c99e9121db0ab59301f git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next) Change-Id: If7969af6acbda6769f6a3581fcf1d2325a2b3355 Signed-off-by: Kyle Tso --- drivers/usb/typec/tcpm/tcpm.c | 120 ++++++---------------------------- 1 file changed, 20 insertions(+), 100 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 51b36fc21605..02c2dfac1b87 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3248,23 +3248,12 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, return ret; } -#define min_pps_apdo_current(x, y) \ - min(pdo_pps_apdo_max_current(x), pdo_pps_apdo_max_current(y)) - static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) { - unsigned int i, j, max_mw = 0, max_mv = 0; - unsigned int min_src_mv, max_src_mv, src_ma, src_mw; - unsigned int min_snk_mv, max_snk_mv; - unsigned int max_op_mv; - u32 pdo, src, snk; - unsigned int src_pdo = 0, snk_pdo = 0; + unsigned int i, src_ma, max_temp_mw = 0, max_op_ma, op_mw; + unsigned int src_pdo = 0; + u32 pdo, src; - /* - * Select the source PPS APDO providing the most power while staying - * within the board's limits. We skip the first PDO as this is always - * 5V 3A. - */ for (i = 1; i < port->nr_source_caps; ++i) { pdo = port->source_caps[i]; @@ -3275,54 +3264,17 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) continue; } - min_src_mv = pdo_pps_apdo_min_voltage(pdo); - max_src_mv = pdo_pps_apdo_max_voltage(pdo); + if (port->pps_data.req_out_volt > pdo_pps_apdo_max_voltage(pdo) || + port->pps_data.req_out_volt < pdo_pps_apdo_min_voltage(pdo)) + continue; + src_ma = pdo_pps_apdo_max_current(pdo); - src_mw = (src_ma * max_src_mv) / 1000; - - /* - * Now search through the sink PDOs to find a matching - * PPS APDO. Again skip the first sink PDO as this will - * always be 5V 3A. - */ - for (j = 1; j < port->nr_snk_pdo; j++) { - pdo = port->snk_pdo[j]; - - switch (pdo_type(pdo)) { - case PDO_TYPE_APDO: - if (pdo_apdo_type(pdo) != APDO_TYPE_PPS) { - tcpm_log(port, - "Not PPS APDO (sink), ignoring"); - continue; - } - - min_snk_mv = - pdo_pps_apdo_min_voltage(pdo); - max_snk_mv = - pdo_pps_apdo_max_voltage(pdo); - break; - default: - tcpm_log(port, - "Not APDO type (sink), ignoring"); - continue; - } - - if (min_src_mv <= max_snk_mv && - max_src_mv >= min_snk_mv) { - max_op_mv = min(max_src_mv, max_snk_mv); - src_mw = (max_op_mv * src_ma) / 1000; - /* Prefer higher voltages if available */ - if ((src_mw == max_mw && - max_op_mv > max_mv) || - src_mw > max_mw) { - src_pdo = i; - snk_pdo = j; - max_mw = src_mw; - max_mv = max_op_mv; - } - } + max_op_ma = min(src_ma, port->pps_data.req_op_curr); + op_mw = max_op_ma * port->pps_data.req_out_volt / 1000; + if (op_mw > max_temp_mw) { + src_pdo = i; + max_temp_mw = op_mw; } - break; default: tcpm_log(port, "Not APDO type (source), ignoring"); @@ -3332,16 +3284,10 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) if (src_pdo) { src = port->source_caps[src_pdo]; - snk = port->snk_pdo[snk_pdo]; - port->pps_data.req_min_volt = max(pdo_pps_apdo_min_voltage(src), - pdo_pps_apdo_min_voltage(snk)); - port->pps_data.req_max_volt = min(pdo_pps_apdo_max_voltage(src), - pdo_pps_apdo_max_voltage(snk)); - port->pps_data.req_max_curr = min_pps_apdo_current(src, snk); - port->pps_data.req_out_volt = min(port->pps_data.req_max_volt, - max(port->pps_data.req_min_volt, - port->pps_data.req_out_volt)); + port->pps_data.req_min_volt = pdo_pps_apdo_min_voltage(src); + port->pps_data.req_max_volt = pdo_pps_apdo_max_voltage(src); + port->pps_data.req_max_curr = pdo_pps_apdo_max_current(src); port->pps_data.req_op_curr = min(port->pps_data.req_max_curr, port->pps_data.req_op_curr); } @@ -3459,32 +3405,16 @@ static int tcpm_pd_send_request(struct tcpm_port *port) static int tcpm_pd_build_pps_request(struct tcpm_port *port, u32 *rdo) { unsigned int out_mv, op_ma, op_mw, max_mv, max_ma, flags; - enum pd_pdo_type type; unsigned int src_pdo_index; - u32 pdo; src_pdo_index = tcpm_pd_select_pps_apdo(port); if (!src_pdo_index) return -EOPNOTSUPP; - pdo = port->source_caps[src_pdo_index]; - type = pdo_type(pdo); - - switch (type) { - case PDO_TYPE_APDO: - if (pdo_apdo_type(pdo) != APDO_TYPE_PPS) { - tcpm_log(port, "Invalid APDO selected!"); - return -EINVAL; - } - max_mv = port->pps_data.req_max_volt; - max_ma = port->pps_data.req_max_curr; - out_mv = port->pps_data.req_out_volt; - op_ma = port->pps_data.req_op_curr; - break; - default: - tcpm_log(port, "Invalid PDO selected!"); - return -EINVAL; - } + max_mv = port->pps_data.req_max_volt; + max_ma = port->pps_data.req_max_curr; + out_mv = port->pps_data.req_out_volt; + op_ma = port->pps_data.req_op_curr; flags = RDO_USB_COMM | RDO_NO_SUSPEND; @@ -5955,12 +5885,6 @@ static int tcpm_pps_set_out_volt(struct tcpm_port *port, u16 req_out_volt) goto port_unlock; } - if (req_out_volt < port->pps_data.min_volt || - req_out_volt > port->pps_data.max_volt) { - ret = -EINVAL; - goto port_unlock; - } - target_mw = (port->current_limit * req_out_volt) / 1000; if (target_mw < port->operating_snk_mw) { ret = -EINVAL; @@ -6489,11 +6413,7 @@ static int tcpm_psy_set_prop(struct power_supply *psy, ret = tcpm_psy_set_online(port, val); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: - if (val->intval < port->pps_data.min_volt * 1000 || - val->intval > port->pps_data.max_volt * 1000) - ret = -EINVAL; - else - ret = tcpm_pps_set_out_volt(port, val->intval / 1000); + ret = tcpm_pps_set_out_volt(port, val->intval / 1000); break; case POWER_SUPPLY_PROP_CURRENT_NOW: if (val->intval > port->pps_data.max_curr * 1000) From 9fd41ac1729d0f43826adf5c74cfe1142f3c2bea Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 28 Jun 2023 17:58:54 -0700 Subject: [PATCH 006/113] ANDROID: Delete build.config.gki.aarch64.16k. This is now implemented with defconfig fragments. define_common_kernels use the regular build.config.gki.aarch64 and apply 16k_defconfig on it. Bug: 286589887 Test: TH Signed-off-by: Yifan Hong (cherry picked from https://android-review.googlesource.com/q/commit:03d155e488ab9e5192cb344419e219203b82ea54) Merged-In: I71d9abd8faa19a2e517b1c9cb82f9b1a0c9b9197 Change-Id: I71d9abd8faa19a2e517b1c9cb82f9b1a0c9b9197 --- build.config.gki.aarch64.16k | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 build.config.gki.aarch64.16k diff --git a/build.config.gki.aarch64.16k b/build.config.gki.aarch64.16k deleted file mode 100644 index 20be95d54647..000000000000 --- a/build.config.gki.aarch64.16k +++ /dev/null @@ -1,5 +0,0 @@ -. ${ROOT_DIR}/${KERNEL_DIR}/build.config.gki.aarch64 - -DEFCONFIG=16k_gki_defconfig -PRE_DEFCONFIG_CMDS="mkdir -p \${OUT_DIR}/arch/arm64/configs/ && cat ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/gki_defconfig ${ROOT_DIR}/${KERNEL_DIR}/arch/arm64/configs/16k_gki.fragment > \${OUT_DIR}/arch/arm64/configs/${DEFCONFIG};" -POST_DEFCONFIG_CMDS="" From 6923dcc21df45f72654021aec2acf5b729b866f3 Mon Sep 17 00:00:00 2001 From: Duoming Zhou Date: Tue, 23 May 2023 07:59:32 +0800 Subject: [PATCH 007/113] UPSTREAM: media: usb: siano: Fix warning due to null work_func_t function pointer [ Upstream commit 6f489a966fbeb0da63d45c2c66a8957eab604bf6 ] The previous commit ebad8e731c1c ("media: usb: siano: Fix use after free bugs caused by do_submit_urb") adds cancel_work_sync() in smsusb_stop_streaming(). But smsusb_stop_streaming() may be called, even if the work_struct surb->wq has not been initialized. As a result, the warning will occur. One of the processes that could lead to warning is shown below: smsusb_probe() smsusb_init_device() if (!dev->in_ep || !dev->out_ep || align < 0) { smsusb_term_device(intf); smsusb_stop_streaming() cancel_work_sync(&dev->surbs[i].wq); __cancel_work_timer() __flush_work() if (WARN_ON(!work->func)) // work->func is null The log reported by syzbot is shown below: WARNING: CPU: 0 PID: 897 at kernel/workqueue.c:3066 __flush_work+0x798/0xa80 kernel/workqueue.c:3063 Modules linked in: CPU: 0 PID: 897 Comm: kworker/0:2 Not tainted 6.2.0-rc1-syzkaller #0 RIP: 0010:__flush_work+0x798/0xa80 kernel/workqueue.c:3066 ... RSP: 0018:ffffc9000464ebf8 EFLAGS: 00010246 RAX: 1ffff11002dbb420 RBX: 0000000000000021 RCX: 1ffffffff204fa4e RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff888016dda0e8 RBP: ffffc9000464ed98 R08: 0000000000000001 R09: ffffffff90253b2f R10: 0000000000000001 R11: 0000000000000000 R12: ffff888016dda0e8 R13: ffff888016dda0e8 R14: ffff888016dda100 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd4331efe8 CR3: 000000000b48e000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __cancel_work_timer+0x315/0x460 kernel/workqueue.c:3160 smsusb_stop_streaming drivers/media/usb/siano/smsusb.c:182 [inline] smsusb_term_device+0xda/0x2d0 drivers/media/usb/siano/smsusb.c:344 smsusb_init_device+0x400/0x9ce drivers/media/usb/siano/smsusb.c:419 smsusb_probe+0xbbd/0xc55 drivers/media/usb/siano/smsusb.c:567 ... This patch adds check before cancel_work_sync(). If surb->wq has not been initialized, the cancel_work_sync() will not be executed. Bug: 295075980 Reported-by: syzbot+27b0b464864741b18b99@syzkaller.appspotmail.com Fixes: ebad8e731c1c ("media: usb: siano: Fix use after free bugs caused by do_submit_urb") Signed-off-by: Duoming Zhou Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin (cherry picked from commit 8abb53c5167cfb5bb275512a3da4ec2468478626) Signed-off-by: Lee Jones Change-Id: Ie2946408cfde466d0138c23093ec6738b7e51161 --- drivers/media/usb/siano/smsusb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index 6f443c542c6d..640737d3b8ae 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -179,7 +179,8 @@ static void smsusb_stop_streaming(struct smsusb_device_t *dev) for (i = 0; i < MAX_URBS; i++) { usb_kill_urb(&dev->surbs[i].urb); - cancel_work_sync(&dev->surbs[i].wq); + if (dev->surbs[i].wq.func) + cancel_work_sync(&dev->surbs[i].wq); if (dev->surbs[i].cb) { smscore_putbuffer(dev->coredev, dev->surbs[i].cb); From ecd8d8a208a7f4c9f325411e1e33f843cad1ace0 Mon Sep 17 00:00:00 2001 From: Sungwoo Kim Date: Wed, 31 May 2023 01:39:56 -0400 Subject: [PATCH 008/113] UPSTREAM: Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb commit 1728137b33c00d5a2b5110ed7aafb42e7c32e4a1 upstream. l2cap_sock_release(sk) frees sk. However, sk's children are still alive and point to the already free'd sk's address. To fix this, l2cap_sock_release(sk) also cleans sk's children. ================================================================== BUG: KASAN: use-after-free in l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650 Read of size 8 at addr ffff888104617aa8 by task kworker/u3:0/276 CPU: 0 PID: 276 Comm: kworker/u3:0 Not tainted 6.2.0-00001-gef397bd4d5fb-dirty #59 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Workqueue: hci2 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x72/0x95 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x175/0x478 mm/kasan/report.c:417 kasan_report+0xb1/0x130 mm/kasan/report.c:517 l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650 l2cap_chan_ready+0x10e/0x1e0 net/bluetooth/l2cap_core.c:1386 l2cap_config_req+0x753/0x9f0 net/bluetooth/l2cap_core.c:4480 l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:5739 [inline] l2cap_sig_channel net/bluetooth/l2cap_core.c:6509 [inline] l2cap_recv_frame+0xe2e/0x43c0 net/bluetooth/l2cap_core.c:7788 l2cap_recv_acldata+0x6ed/0x7e0 net/bluetooth/l2cap_core.c:8506 hci_acldata_packet net/bluetooth/hci_core.c:3813 [inline] hci_rx_work+0x66e/0xbc0 net/bluetooth/hci_core.c:4048 process_one_work+0x4ea/0x8e0 kernel/workqueue.c:2289 worker_thread+0x364/0x8e0 kernel/workqueue.c:2436 kthread+0x1b9/0x200 kernel/kthread.c:376 ret_from_fork+0x2c/0x50 arch/x86/entry/entry_64.S:308 Allocated by task 288: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x82/0x90 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:968 [inline] __kmalloc+0x5a/0x140 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] sk_prot_alloc+0x113/0x1f0 net/core/sock.c:2040 sk_alloc+0x36/0x3c0 net/core/sock.c:2093 l2cap_sock_alloc.constprop.0+0x39/0x1c0 net/bluetooth/l2cap_sock.c:1852 l2cap_sock_create+0x10d/0x220 net/bluetooth/l2cap_sock.c:1898 bt_sock_create+0x183/0x290 net/bluetooth/af_bluetooth.c:132 __sock_create+0x226/0x380 net/socket.c:1518 sock_create net/socket.c:1569 [inline] __sys_socket_create net/socket.c:1606 [inline] __sys_socket_create net/socket.c:1591 [inline] __sys_socket+0x112/0x200 net/socket.c:1639 __do_sys_socket net/socket.c:1652 [inline] __se_sys_socket net/socket.c:1650 [inline] __x64_sys_socket+0x40/0x50 net/socket.c:1650 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc Freed by task 288: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:523 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free mm/kasan/common.c:200 [inline] __kasan_slab_free+0x10a/0x190 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0x88/0x1f0 mm/slub.c:3800 sk_prot_free net/core/sock.c:2076 [inline] __sk_destruct+0x347/0x430 net/core/sock.c:2168 sk_destruct+0x9c/0xb0 net/core/sock.c:2183 __sk_free+0x82/0x220 net/core/sock.c:2194 sk_free+0x7c/0xa0 net/core/sock.c:2205 sock_put include/net/sock.h:1991 [inline] l2cap_sock_kill+0x256/0x2b0 net/bluetooth/l2cap_sock.c:1257 l2cap_sock_release+0x1a7/0x220 net/bluetooth/l2cap_sock.c:1428 __sock_release+0x80/0x150 net/socket.c:650 sock_close+0x19/0x30 net/socket.c:1368 __fput+0x17a/0x5c0 fs/file_table.c:320 task_work_run+0x132/0x1c0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x113/0x120 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x21/0x50 kernel/entry/common.c:296 do_syscall_64+0x4c/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x72/0xdc The buggy address belongs to the object at ffff888104617800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 680 bytes inside of 1024-byte region [ffff888104617800, ffff888104617c00) The buggy address belongs to the physical page: page:00000000dbca6a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888104614000 pfn:0x104614 head:00000000dbca6a80 order:2 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0 flags: 0x200000000010200(slab|head|node=0|zone=2) raw: 0200000000010200 ffff888100041dc0 ffffea0004212c10 ffffea0004234b10 raw: ffff888104614000 0000000000080002 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888104617980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888104617a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888104617a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888104617b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888104617b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Bug: 297025149 Ack: This bug is found by FuzzBT with a modified Syzkaller. Other contributors are Ruoyu Wu and Hui Peng. Signed-off-by: Sungwoo Kim Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 29fac18499332211b2615ade356e2bd8b3269f98) Signed-off-by: Lee Jones Change-Id: I1f4cf5a928b4825c63488bde0d5589517cc84ef8 --- net/bluetooth/l2cap_sock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index eebe256104bc..947ca580bb9a 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -46,6 +46,7 @@ static const struct proto_ops l2cap_sock_ops; static void l2cap_sock_init(struct sock *sk, struct sock *parent); static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio, int kern); +static void l2cap_sock_cleanup_listen(struct sock *parent); bool l2cap_is_socket(struct socket *sock) { @@ -1415,6 +1416,7 @@ static int l2cap_sock_release(struct socket *sock) if (!sk) return 0; + l2cap_sock_cleanup_listen(sk); bt_sock_unlink(&l2cap_sk_list, sk); err = l2cap_sock_shutdown(sock, SHUT_RDWR); From 086befddbe91956168ff8aac9fee78829cf9a82d Mon Sep 17 00:00:00 2001 From: valis Date: Sat, 29 Jul 2023 08:32:00 -0400 Subject: [PATCH 009/113] UPSTREAM: net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free [ Upstream commit 3044b16e7c6fe5d24b1cdbcf1bd0a9d92d1ebd81 ] When u32_change() is called on an existing filter, the whole tcf_result struct is always copied into the new instance of the filter. This causes a problem when updating a filter bound to a class, as tcf_unbind_filter() is always called on the old instance in the success path, decreasing filter_cnt of the still referenced class and allowing it to be deleted, leading to a use-after-free. Fix this by no longer copying the tcf_result struct from the old filter. Bug: 296347075 Fixes: de5df63228fc ("net: sched: cls_u32 changes to knode must appear atomic to readers") Reported-by: valis Reported-by: M A Ramdhan Signed-off-by: valis Signed-off-by: Jamal Hadi Salim Reviewed-by: Victor Nogueira Reviewed-by: Pedro Tammela Reviewed-by: M A Ramdhan Link: https://lore.kernel.org/r/20230729123202.72406-2-jhs@mojatatu.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin (cherry picked from commit aab2d095ce4dd8d01ca484c0cc641fb497bf74db) Signed-off-by: Lee Jones Change-Id: I1a8381c308cc97cf61d6f95a02992d2c553455c5 --- net/sched/cls_u32.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index a3477537c102..b28b42de8be4 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -813,7 +813,6 @@ static struct tc_u_knode *u32_init_knode(struct net *net, struct tcf_proto *tp, new->ifindex = n->ifindex; new->fshift = n->fshift; - new->res = n->res; new->flags = n->flags; RCU_INIT_POINTER(new->ht_down, ht); From 71bedf9d9cd267b053b2789446fc73c2ee24c98d Mon Sep 17 00:00:00 2001 From: Sweet Tea Dorminy Date: Thu, 17 Aug 2023 10:15:56 -0400 Subject: [PATCH 010/113] BACKPORT: blk-crypto: dynamically allocate fallback profile blk_crypto_profile_init() calls lockdep_register_key(), which warns and does not register if the provided memory is a static object. blk-crypto-fallback currently has a static blk_crypto_profile and calls blk_crypto_profile_init() thereupon, resulting in the warning and failure to register. Fortunately it is simple enough to use a dynamically allocated profile and make lockdep function correctly. Fixes: 2fb48d88e77f ("blk-crypto: use dynamic lock class for blk_crypto_profile::lock") Cc: stable@vger.kernel.org Signed-off-by: Sweet Tea Dorminy Reviewed-by: Eric Biggers Link: https://lore.kernel.org/r/20230817141615.15387-1-sweettea-kernel@dorminy.me Signed-off-by: Jens Axboe (cherry picked from commit c984ff1423ae9f70b1f28ce811856db0d9c99021) (resolved conflict due to HW-wrapped key support) Change-Id: I8c889550f97dc3d326930bd5745da6ea64061309 Signed-off-by: Eric Biggers --- block/blk-crypto-fallback.c | 38 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c index 243953d9705d..f96ce6318658 100644 --- a/block/blk-crypto-fallback.c +++ b/block/blk-crypto-fallback.c @@ -78,7 +78,7 @@ static struct blk_crypto_fallback_keyslot { struct crypto_skcipher *tfms[BLK_ENCRYPTION_MODE_MAX]; } *blk_crypto_keyslots; -static struct blk_crypto_profile blk_crypto_fallback_profile; +static struct blk_crypto_profile *blk_crypto_fallback_profile; static struct workqueue_struct *blk_crypto_wq; static mempool_t *blk_crypto_bounce_page_pool; static struct bio_set crypto_bio_split; @@ -294,7 +294,7 @@ static bool blk_crypto_fallback_encrypt_bio(struct bio **bio_ptr) * Get a blk-crypto-fallback keyslot that contains a crypto_skcipher for * this bio's algorithm and key. */ - blk_st = blk_crypto_get_keyslot(&blk_crypto_fallback_profile, + blk_st = blk_crypto_get_keyslot(blk_crypto_fallback_profile, bc->bc_key, &slot); if (blk_st != BLK_STS_OK) { src_bio->bi_status = blk_st; @@ -397,7 +397,7 @@ static void blk_crypto_fallback_decrypt_bio(struct work_struct *work) * Get a blk-crypto-fallback keyslot that contains a crypto_skcipher for * this bio's algorithm and key. */ - blk_st = blk_crypto_get_keyslot(&blk_crypto_fallback_profile, + blk_st = blk_crypto_get_keyslot(blk_crypto_fallback_profile, bc->bc_key, &slot); if (blk_st != BLK_STS_OK) { bio->bi_status = blk_st; @@ -501,7 +501,7 @@ bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr) return false; } - if (!__blk_crypto_cfg_supported(&blk_crypto_fallback_profile, + if (!__blk_crypto_cfg_supported(blk_crypto_fallback_profile, &bc->bc_key->crypto_cfg)) { bio->bi_status = BLK_STS_NOTSUPP; return false; @@ -528,7 +528,7 @@ bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr) int blk_crypto_fallback_evict_key(const struct blk_crypto_key *key) { - return __blk_crypto_evict_key(&blk_crypto_fallback_profile, key); + return __blk_crypto_evict_key(blk_crypto_fallback_profile, key); } static bool blk_crypto_fallback_inited; @@ -536,7 +536,6 @@ static int blk_crypto_fallback_init(void) { int i; int err; - struct blk_crypto_profile *profile = &blk_crypto_fallback_profile; if (blk_crypto_fallback_inited) return 0; @@ -547,19 +546,28 @@ static int blk_crypto_fallback_init(void) if (err) goto out; - err = blk_crypto_profile_init(profile, blk_crypto_num_keyslots); - if (err) + /* Dynamic allocation is needed because of lockdep_register_key(). */ + blk_crypto_fallback_profile = + kzalloc(sizeof(*blk_crypto_fallback_profile), GFP_KERNEL); + if (!blk_crypto_fallback_profile) { + err = -ENOMEM; goto fail_free_bioset; + } + + err = blk_crypto_profile_init(blk_crypto_fallback_profile, + blk_crypto_num_keyslots); + if (err) + goto fail_free_profile; err = -ENOMEM; - profile->ll_ops = blk_crypto_fallback_ll_ops; - profile->max_dun_bytes_supported = BLK_CRYPTO_MAX_IV_SIZE; - profile->key_types_supported = BLK_CRYPTO_KEY_TYPE_STANDARD; + blk_crypto_fallback_profile->ll_ops = blk_crypto_fallback_ll_ops; + blk_crypto_fallback_profile->max_dun_bytes_supported = BLK_CRYPTO_MAX_IV_SIZE; + blk_crypto_fallback_profile->key_types_supported = BLK_CRYPTO_KEY_TYPE_STANDARD; /* All blk-crypto modes have a crypto API fallback. */ for (i = 0; i < BLK_ENCRYPTION_MODE_MAX; i++) - profile->modes_supported[i] = 0xFFFFFFFF; - profile->modes_supported[BLK_ENCRYPTION_MODE_INVALID] = 0; + blk_crypto_fallback_profile->modes_supported[i] = 0xFFFFFFFF; + blk_crypto_fallback_profile->modes_supported[BLK_ENCRYPTION_MODE_INVALID] = 0; blk_crypto_wq = alloc_workqueue("blk_crypto_wq", WQ_UNBOUND | WQ_HIGHPRI | @@ -600,7 +608,9 @@ fail_free_keyslots: fail_free_wq: destroy_workqueue(blk_crypto_wq); fail_destroy_profile: - blk_crypto_profile_destroy(profile); + blk_crypto_profile_destroy(blk_crypto_fallback_profile); +fail_free_profile: + kfree(blk_crypto_fallback_profile); fail_free_bioset: bioset_exit(&crypto_bio_split); out: From 63af84cffec198df9c765895b6e8305f39ede730 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 24 Aug 2023 16:58:19 +0000 Subject: [PATCH 011/113] ANDROID: fips140: fix the error injection module parameters Commit 63f46b45dda2 ("ANDROID: fips140: eliminate crypto-fips.a build step") made all fips140 source files other than fips140-module.c be compiled in the "fake built-in code" mode. This broke the fail_selftest and fail_integrity_check module parameters, as they are defined in fips140-eval-testing.c. Fix this by making fips140-eval-testing.c be compiled "normally", overriding fips140-defs.h. Bug: 188620248 Fixes: 63f46b45dda2 ("ANDROID: fips140: eliminate crypto-fips.a build step") Change-Id: Iebb70bdcbb698b92a7791fa7307e2325b1a9e4b6 Signed-off-by: Eric Biggers --- crypto/fips140-defs.h | 6 +++--- crypto/fips140-eval-testing.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crypto/fips140-defs.h b/crypto/fips140-defs.h index 9005f9513308..d3f62e3c3f37 100644 --- a/crypto/fips140-defs.h +++ b/crypto/fips140-defs.h @@ -17,9 +17,9 @@ * related macros to be expanded as they would be for built-in code; e.g., * module_init() adds the function to the .initcalls section of the binary. * - * The .c file that contains the real module_init() for fips140.ko is then - * responsible for redefining MODULE, and the real module_init() is responsible - * for executing all the initcalls that were collected into .initcalls. + * The .c files that contain the real module_init, module license, and module + * parameters for fips140.ko are then responsible for redefining MODULE. The + * real module_init executes all initcalls that were collected into .initcalls. */ #undef MODULE diff --git a/crypto/fips140-eval-testing.c b/crypto/fips140-eval-testing.c index ea3cd653983a..fdc786884d11 100644 --- a/crypto/fips140-eval-testing.c +++ b/crypto/fips140-eval-testing.c @@ -20,6 +20,14 @@ __inline_maybe_unused notrace #undef BUILD_FIPS140_KO +/* + * Since this .c file contains real module parameters for fips140.ko, it needs + * to be compiled normally, so undo the hacks that were done in fips140-defs.h. + */ +#define MODULE +#undef KBUILD_MODFILE +#undef __DISABLE_EXPORTS + #include #include #include From 2d7f87b0ffd531a79a41de71e3abc983e1bd650c Mon Sep 17 00:00:00 2001 From: liuxudong5 Date: Thu, 27 Jul 2023 19:26:47 +0800 Subject: [PATCH 012/113] ANDROID: vendor_hooks:vendor hook for percpu-rwsem We need a new vendor hook for two reasons: 1.The position of the previous vendor hook is inappropriate: when the task wakes up from percpu_rwsem_wait, it will enter a long runnable state, which will cause frame loss when the application starts. In order to solve this problem, we need to let the process enter the "vip" queue when it is woken up, so we need to set a flag for the process holding the lock to prove that it is about to hold the lock. The timing of setting the flag should be at the beginning of percpu_down_read/percpu_down_write rather than the end. 2.Most of this long runnable state occurs in the cgroup_threadgroup_rwsem, so we only care cgroup_threadgroup_rwsem, and cgroup_threadgroup_rwsem should be exported. At the same time, one more parameter "struct percpu_rw_semaphore *sem", is needed for this vendor hook. Bug: 294496814 Change-Id: I5f014cfb68a60c29bbfd21452336e381e31e81b1 Signed-off-by: liuxudong5 --- drivers/android/vendor_hooks.c | 1 + include/linux/percpu-rwsem.h | 7 +++++++ include/trace/hooks/dtask.h | 4 ++++ kernel/locking/percpu-rwsem.c | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 229f0e712f93..3852fc7543df 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -186,6 +186,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_module_permit_before_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_module_permit_after_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_is_initialized); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_shmem_get_folio); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_record_pcpu_rwsem_time_early); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall); diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h index ebd81e03f3c1..7734ef905011 100644 --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h @@ -23,6 +23,9 @@ struct percpu_rw_semaphore { #endif }; +void _trace_android_vh_record_pcpu_rwsem_time_early( + unsigned long settime, struct percpu_rw_semaphore *sem); + #ifdef CONFIG_DEBUG_LOCK_ALLOC #define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }, #else @@ -54,6 +57,8 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem) rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); preempt_disable(); + _trace_android_vh_record_pcpu_rwsem_time_early(jiffies, sem); + /* * We are in an RCU-sched read-side critical section, so the writer * cannot both change sem->state from readers_fast and start checking @@ -93,6 +98,7 @@ static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem) */ if (ret) { + _trace_android_vh_record_pcpu_rwsem_time_early(jiffies, sem); _trace_android_vh_record_pcpu_rwsem_starttime(current, jiffies); rwsem_acquire_read(&sem->dep_map, 0, 1, _RET_IP_); } @@ -124,6 +130,7 @@ static inline void percpu_up_read(struct percpu_rw_semaphore *sem) this_cpu_dec(*sem->read_count); rcuwait_wake_up(&sem->writer); } + _trace_android_vh_record_pcpu_rwsem_time_early(0, sem); _trace_android_vh_record_pcpu_rwsem_starttime(current, 0); preempt_enable(); } diff --git a/include/trace/hooks/dtask.h b/include/trace/hooks/dtask.h index 1552b71c1792..f5cdfe9b04f9 100644 --- a/include/trace/hooks/dtask.h +++ b/include/trace/hooks/dtask.h @@ -15,6 +15,7 @@ struct mutex; struct rt_mutex_base; struct rw_semaphore; struct task_struct; +struct percpu_rw_semaphore; DECLARE_HOOK(android_vh_mutex_wait_start, TP_PROTO(struct mutex *lock), @@ -80,6 +81,9 @@ DECLARE_HOOK(android_vh_record_rwsem_lock_starttime, DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime, TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies), TP_ARGS(tsk, settime_jiffies)); +DECLARE_HOOK(android_vh_record_pcpu_rwsem_time_early, + TP_PROTO(unsigned long settime_jiffies, struct percpu_rw_semaphore *sem), + TP_ARGS(settime_jiffies, sem)); struct mutex_waiter; DECLARE_HOOK(android_vh_alter_mutex_list_add, diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c index 084aedde3d0f..8b64155ebb1f 100644 --- a/kernel/locking/percpu-rwsem.c +++ b/kernel/locking/percpu-rwsem.c @@ -26,6 +26,20 @@ void _trace_android_vh_record_pcpu_rwsem_starttime(struct task_struct *tsk, } EXPORT_SYMBOL_GPL(_trace_android_vh_record_pcpu_rwsem_starttime); +/* + * trace_android_vh_record_pcpu_rwsem_time_early is called in + * include/linux/percpu-rwsem.h by including include/hooks/dtask.h, which + * will result to build-err. So we create + * func: _trace_android_vh_record_pcpu_rwsem_time_early for percpu-rwsem.h to call. +*/ + +void _trace_android_vh_record_pcpu_rwsem_time_early( + unsigned long settime, struct percpu_rw_semaphore *sem) +{ + trace_android_vh_record_pcpu_rwsem_time_early(settime, sem); +} +EXPORT_SYMBOL_GPL(_trace_android_vh_record_pcpu_rwsem_time_early); + int __percpu_init_rwsem(struct percpu_rw_semaphore *sem, const char *name, struct lock_class_key *key) { @@ -242,6 +256,8 @@ void __sched percpu_down_write(struct percpu_rw_semaphore *sem) rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); trace_contention_begin(sem, LCB_F_PERCPU | LCB_F_WRITE); + trace_android_vh_record_pcpu_rwsem_time_early(jiffies, sem); + /* Notify readers to take the slow path. */ rcu_sync_enter(&sem->rss); @@ -294,6 +310,7 @@ void percpu_up_write(struct percpu_rw_semaphore *sem) * exclusive write lock because its counting. */ rcu_sync_exit(&sem->rss); + trace_android_vh_record_pcpu_rwsem_time_early(0, sem); trace_android_vh_record_pcpu_rwsem_starttime(current, 0); } EXPORT_SYMBOL_GPL(percpu_up_write); From 9ca47685c5df46d5111c2081f216ac21cb164247 Mon Sep 17 00:00:00 2001 From: xiaofeng Date: Tue, 15 Aug 2023 20:57:25 +0800 Subject: [PATCH 013/113] ANDROID: GKI: Update symbol list for xiaomi 2 symbol(s) added 'int __traceiter_android_vh_record_pcpu_rwsem_time_early(unsigned long settime_jiffies, struct percpu_rw_semaphore *sem)' 'struct tracepoint __tracepoint_android_vh_record_pcpu_rwsem_time_early' Bug: 294496814 Change-Id: Ibff9da7be5a5f9ff9cac537ee2bbddc3d34abef8 Signed-off-by: xiaofeng --- android/abi_gki_aarch64.stg | 27 +++++++++++++++++++++++++++ android/abi_gki_aarch64_xiaomi | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index c22a52854e13..aa243832c1f4 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -311041,6 +311041,13 @@ function { parameter_id: 0x17047654 parameter_id: 0xc9082b19 } +function { + id: 0x9b6602ad + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x33756485 + parameter_id: 0x11b57133 +} function { id: 0x9b660b2c return_type_id: 0x6720d32f @@ -329229,6 +329236,15 @@ elf_symbol { type_id: 0x9bd7019d full_name: "__traceiter_android_vh_record_pcpu_rwsem_starttime" } +elf_symbol { + id: 0x1a91ec8c + name: "__traceiter_android_vh_record_pcpu_rwsem_time_early" + is_defined: true + symbol_type: FUNCTION + crc: 0xeeef021b + type_id: 0x9b6602ad + full_name: "__traceiter_android_vh_record_pcpu_rwsem_time_early" +} elf_symbol { id: 0x92518ec5 name: "__traceiter_android_vh_record_rtmutex_lock_starttime" @@ -332487,6 +332503,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_record_pcpu_rwsem_starttime" } +elf_symbol { + id: 0x158c4cfa + name: "__tracepoint_android_vh_record_pcpu_rwsem_time_early" + is_defined: true + symbol_type: OBJECT + crc: 0xfb2f7ea7 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_record_pcpu_rwsem_time_early" +} elf_symbol { id: 0x4568ff8f name: "__tracepoint_android_vh_record_rtmutex_lock_starttime" @@ -385868,6 +385893,7 @@ interface { symbol_id: 0x93303c51 symbol_id: 0x7d069e91 symbol_id: 0x0fa39b81 + symbol_id: 0x1a91ec8c symbol_id: 0x92518ec5 symbol_id: 0x9792c22e symbol_id: 0xe2d75052 @@ -386230,6 +386256,7 @@ interface { symbol_id: 0xb0c197a3 symbol_id: 0x761f292f symbol_id: 0xef7ad117 + symbol_id: 0x158c4cfa symbol_id: 0x4568ff8f symbol_id: 0xe918e2ec symbol_id: 0x13b2fb38 diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index 5a0852cf19f6..bd22553da95c 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -332,3 +332,7 @@ #required by xm_ispv4_pcie.ko pci_ioremap_bar pci_disable_pcie_error_reporting + +#required by lock_optimization module + __traceiter_android_vh_record_pcpu_rwsem_time_early + __tracepoint_android_vh_record_pcpu_rwsem_time_early From 7afa84fbb9f2c05f18a25132226917ea195556e4 Mon Sep 17 00:00:00 2001 From: xieliujie Date: Thu, 17 Aug 2023 17:06:46 +0800 Subject: [PATCH 014/113] ANDROID: vendor_hooks: Add hooks for waking up and exiting control Add hooks at process waking up and exiting routines so that oems can control these procedures. One possible benifit is the peak of system load can be shaved and load can be more smooth when a large number of threads is killed once upon a time, while a sudden peak of system load can probably lead to user junk issues. Bug: 296493318 Change-Id: Ide5f9e63a4f50d6a9e3ffbc9516de9ce48ededef Signed-off-by: xieliujie --- drivers/android/vendor_hooks.c | 3 +++ include/trace/hooks/dtask.h | 13 +++++++++++++ kernel/cgroup/freezer.c | 9 +++++++-- kernel/exit.c | 3 +++ kernel/sched/core.c | 2 ++ kernel/signal.c | 7 ++++++- 6 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 3852fc7543df..36616a30c55b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -321,3 +321,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake); diff --git a/include/trace/hooks/dtask.h b/include/trace/hooks/dtask.h index f5cdfe9b04f9..2d5b13dce01f 100644 --- a/include/trace/hooks/dtask.h +++ b/include/trace/hooks/dtask.h @@ -105,6 +105,19 @@ DECLARE_HOOK(android_vh_task_blocks_on_rtmutex, DECLARE_HOOK(android_vh_rtmutex_waiter_prio, TP_PROTO(struct task_struct *task, int *waiter_prio), TP_ARGS(task, waiter_prio)); + +DECLARE_HOOK(android_vh_exit_signal_whether_wake, + TP_PROTO(struct task_struct *p, bool *wake), + TP_ARGS(p, wake)); + +DECLARE_HOOK(android_vh_exit_check, + TP_PROTO(struct task_struct *p), + TP_ARGS(p)); + +DECLARE_HOOK(android_vh_freeze_whether_wake, + TP_PROTO(struct task_struct *t, bool *wake), + TP_ARGS(t, wake)); + #endif /* _TRACE_HOOK_DTASK_H */ /* This part must be outside protection */ diff --git a/kernel/cgroup/freezer.c b/kernel/cgroup/freezer.c index 617861a54793..d0224d3c0a32 100644 --- a/kernel/cgroup/freezer.c +++ b/kernel/cgroup/freezer.c @@ -7,6 +7,7 @@ #include "cgroup-internal.h" #include +#include /* * Propagate the cgroup frozen state upwards by the cgroup tree. @@ -155,17 +156,21 @@ void cgroup_leave_frozen(bool always_leave) static void cgroup_freeze_task(struct task_struct *task, bool freeze) { unsigned long flags; + bool wake = true; /* If the task is about to die, don't bother with freezing it. */ if (!lock_task_sighand(task, &flags)) return; + trace_android_vh_freeze_whether_wake(task, &wake); if (freeze) { task->jobctl |= JOBCTL_TRAP_FREEZE; - signal_wake_up(task, false); + if (wake) + signal_wake_up(task, false); } else { task->jobctl &= ~JOBCTL_TRAP_FREEZE; - wake_up_process(task); + if (wake) + wake_up_process(task); } unlock_task_sighand(task, &flags); diff --git a/kernel/exit.c b/kernel/exit.c index 1e3b9675fbe5..15ae928cdd2f 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -73,6 +73,7 @@ #include #include #include +#include /* * The default value should be high enough to not crash a system that randomly @@ -827,6 +828,8 @@ void __noreturn do_exit(long code) io_uring_files_cancel(); exit_signals(tsk); /* sets PF_EXITING */ + trace_android_vh_exit_check(current); + /* sync mm's RSS info before statistics gathering */ if (tsk->mm) sync_mm_rss(tsk->mm); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 95843540088b..f534940a660a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4455,6 +4455,7 @@ int wake_up_state(struct task_struct *p, unsigned int state) { return try_to_wake_up(p, state, 0); } +EXPORT_SYMBOL(wake_up_state); /* * Perform scheduler related setup for a newly forked process p. @@ -5364,6 +5365,7 @@ unsigned int nr_running(void) return sum; } +EXPORT_SYMBOL(nr_running); /* * Check if only the current task is running on the CPU. diff --git a/kernel/signal.c b/kernel/signal.c index 95d48c43fd9e..3b3204c26641 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -58,6 +58,7 @@ #undef CREATE_TRACE_POINTS #include +#include /* * SLAB caches for signal bits. */ @@ -1001,6 +1002,7 @@ static void complete_signal(int sig, struct task_struct *p, enum pid_type type) { struct signal_struct *signal = p->signal; struct task_struct *t; + bool wake; /* * Now find a thread we can wake up to take the signal off the queue. @@ -1060,7 +1062,10 @@ static void complete_signal(int sig, struct task_struct *p, enum pid_type type) trace_android_vh_exit_signal(t); task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK); sigaddset(&t->pending.signal, SIGKILL); - signal_wake_up(t, 1); + wake = true; + trace_android_vh_exit_signal_whether_wake(t, &wake); + if (wake) + signal_wake_up(t, 1); } while_each_thread(p, t); return; } From 20d8a8975810973603095dad03fd0c1a9eb06848 Mon Sep 17 00:00:00 2001 From: xieliujie Date: Mon, 21 Aug 2023 14:42:23 +0800 Subject: [PATCH 015/113] ANDROID: ABI: Update oplus symbol list 6 function symbol(s) added 'int __traceiter_android_vh_exit_check(void*, struct task_struct*)' 'int __traceiter_android_vh_exit_signal_whether_wake(void*, struct task_struct*, bool*)' 'int __traceiter_android_vh_freeze_whether_wake(void*, struct task_struct*, bool*)' 'void kick_process(struct task_struct*)' 'unsigned int nr_running()' 'int wake_up_state(struct task_struct*, unsigned int)' 3 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_exit_check' 'struct tracepoint __tracepoint_android_vh_exit_signal_whether_wake' 'struct tracepoint __tracepoint_android_vh_freeze_whether_wake' Bug: 296493318 Change-Id: I7da7164d2b859d7396d0b9973a06dc8bd7a03d09 Signed-off-by: xieliujie --- android/abi_gki_aarch64.stg | 96 +++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_oplus | 9 ++++ 2 files changed, 105 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index aa243832c1f4..928c98fcbd8c 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -312611,6 +312611,12 @@ function { parameter_id: 0x2e029f76 parameter_id: 0x11cfee5a } +function { + id: 0x9bd09cc2 + return_type_id: 0x6720d32f + parameter_id: 0x1d19a9d5 + parameter_id: 0x4585663f +} function { id: 0x9bd130b8 return_type_id: 0x6720d32f @@ -328633,6 +328639,15 @@ elf_symbol { type_id: 0x9bcd4ff7 full_name: "__traceiter_android_vh_encrypt_page" } +elf_symbol { + id: 0x1921d10d + name: "__traceiter_android_vh_exit_check" + is_defined: true + symbol_type: FUNCTION + crc: 0x73fa852b + type_id: 0x9bdbdcc4 + full_name: "__traceiter_android_vh_exit_check" +} elf_symbol { id: 0x1f554c2a name: "__traceiter_android_vh_exit_signal" @@ -328642,6 +328657,15 @@ elf_symbol { type_id: 0x9bdbdcc4 full_name: "__traceiter_android_vh_exit_signal" } +elf_symbol { + id: 0x343adff1 + name: "__traceiter_android_vh_exit_signal_whether_wake" + is_defined: true + symbol_type: FUNCTION + crc: 0x003a6b81 + type_id: 0x9bdfaf3f + full_name: "__traceiter_android_vh_exit_signal_whether_wake" +} elf_symbol { id: 0x93a4717b name: "__traceiter_android_vh_file_is_tiny_bypass" @@ -328678,6 +328702,15 @@ elf_symbol { type_id: 0x9bcfc1f5 full_name: "__traceiter_android_vh_free_user" } +elf_symbol { + id: 0x4d354aab + name: "__traceiter_android_vh_freeze_whether_wake" + is_defined: true + symbol_type: FUNCTION + crc: 0xefd9d739 + type_id: 0x9bdfaf3f + full_name: "__traceiter_android_vh_freeze_whether_wake" +} elf_symbol { id: 0x3272ce60 name: "__traceiter_android_vh_freq_qos_add_request" @@ -331900,6 +331933,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_encrypt_page" } +elf_symbol { + id: 0x684e5f4f + name: "__tracepoint_android_vh_exit_check" + is_defined: true + symbol_type: OBJECT + crc: 0x49c49792 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_exit_check" +} elf_symbol { id: 0x0d418d38 name: "__tracepoint_android_vh_exit_signal" @@ -331909,6 +331951,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_exit_signal" } +elf_symbol { + id: 0x2121385f + name: "__tracepoint_android_vh_exit_signal_whether_wake" + is_defined: true + symbol_type: OBJECT + crc: 0xfc31d092 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_exit_signal_whether_wake" +} elf_symbol { id: 0x50a83025 name: "__tracepoint_android_vh_file_is_tiny_bypass" @@ -331945,6 +331996,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_free_user" } +elf_symbol { + id: 0x888dea6d + name: "__tracepoint_android_vh_freeze_whether_wake" + is_defined: true + symbol_type: OBJECT + crc: 0x8e4434ef + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_freeze_whether_wake" +} elf_symbol { id: 0xace80c56 name: "__tracepoint_android_vh_freq_qos_add_request" @@ -356408,6 +356468,15 @@ elf_symbol { type_id: 0x10985193 full_name: "kick_all_cpus_sync" } +elf_symbol { + id: 0xe4128490 + name: "kick_process" + is_defined: true + symbol_type: FUNCTION + crc: 0xf7f30b89 + type_id: 0x17de3be6 + full_name: "kick_process" +} elf_symbol { id: 0xb1072fb1 name: "kill_anon_super" @@ -361066,6 +361135,15 @@ elf_symbol { type_id: 0x6720d32f full_name: "nr_irqs" } +elf_symbol { + id: 0xea37502b + name: "nr_running" + is_defined: true + symbol_type: FUNCTION + crc: 0x909a8abf + type_id: 0xcedb7efb + full_name: "nr_running" +} elf_symbol { id: 0x0bb7f730 name: "nr_swap_pages" @@ -384239,6 +384317,15 @@ elf_symbol { type_id: 0x9ac6895a full_name: "wake_up_process" } +elf_symbol { + id: 0x63928faf + name: "wake_up_state" + is_defined: true + symbol_type: FUNCTION + crc: 0xecf43f83 + type_id: 0x9bd09cc2 + full_name: "wake_up_state" +} elf_symbol { id: 0xecc7b6fc name: "wake_up_var" @@ -385826,11 +385913,14 @@ interface { symbol_id: 0xdcaa59a3 symbol_id: 0x7ebac47a symbol_id: 0xf586d5b6 + symbol_id: 0x1921d10d symbol_id: 0x1f554c2a + symbol_id: 0x343adff1 symbol_id: 0x93a4717b symbol_id: 0xc189c2a7 symbol_id: 0x5ecff02f symbol_id: 0xe3ce1f52 + symbol_id: 0x4d354aab symbol_id: 0x3272ce60 symbol_id: 0x4d900d32 symbol_id: 0xe6eff83f @@ -386189,11 +386279,14 @@ interface { symbol_id: 0x54b2cd01 symbol_id: 0x188eab44 symbol_id: 0xe7584e1c + symbol_id: 0x684e5f4f symbol_id: 0x0d418d38 + symbol_id: 0x2121385f symbol_id: 0x50a83025 symbol_id: 0x04a824b5 symbol_id: 0xe6918e09 symbol_id: 0x4d4fd1cc + symbol_id: 0x888dea6d symbol_id: 0xace80c56 symbol_id: 0xa0ce156c symbol_id: 0x46787271 @@ -388911,6 +389004,7 @@ interface { symbol_id: 0x6dc922be symbol_id: 0x5cdb4ea4 symbol_id: 0x6d575dad + symbol_id: 0xe4128490 symbol_id: 0xb1072fb1 symbol_id: 0x661955d6 symbol_id: 0xd6a8ff16 @@ -389429,6 +389523,7 @@ interface { symbol_id: 0x1560f116 symbol_id: 0x1cfcf940 symbol_id: 0x3704ac3f + symbol_id: 0xea37502b symbol_id: 0x0bb7f730 symbol_id: 0xb65e3baf symbol_id: 0xf68f8b33 @@ -392004,6 +392099,7 @@ interface { symbol_id: 0x7540b5a8 symbol_id: 0xb1036d49 symbol_id: 0x9a87f32b + symbol_id: 0x63928faf symbol_id: 0xecc7b6fc symbol_id: 0x5d14316b symbol_id: 0x0094f87c diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index ee42a50dcbdb..e1762196754a 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -38,6 +38,7 @@ ipv6_find_hdr is_ashmem_file jiffies_64_to_clock_t + kick_process ktime_get_coarse_real_ts64 memory_cgrp_subsys memory_cgrp_subsys_enabled_key @@ -48,6 +49,7 @@ nf_ct_delete nf_register_net_hooks nf_unregister_net_hooks + nr_running of_css __page_file_index __page_mapcount @@ -90,6 +92,9 @@ __traceiter_android_vh_account_process_tick_gran __traceiter_android_vh_account_task_time __traceiter_android_vh_do_futex + __traceiter_android_vh_exit_check + __traceiter_android_vh_exit_signal_whether_wake + __traceiter_android_vh_freeze_whether_wake __traceiter_android_vh_futex_sleep_start __traceiter_android_vh_futex_wait_end __traceiter_android_vh_futex_wait_start @@ -182,12 +187,15 @@ __tracepoint_android_vh_check_folio_look_around_ref __tracepoint_android_vh_do_futex __tracepoint_android_vh_dup_task_struct + __tracepoint_android_vh_exit_check __tracepoint_android_vh_exit_signal + __tracepoint_android_vh_exit_signal_whether_wake __tracepoint_android_vh_mem_cgroup_id_remove __tracepoint_android_vh_mem_cgroup_css_offline __tracepoint_android_vh_mem_cgroup_css_online __tracepoint_android_vh_mem_cgroup_free __tracepoint_android_vh_mem_cgroup_alloc + __tracepoint_android_vh_freeze_whether_wake __tracepoint_android_vh_futex_sleep_start __tracepoint_android_vh_futex_wait_end __tracepoint_android_vh_futex_wait_start @@ -240,5 +248,6 @@ wait_for_completion_io_timeout wait_for_completion_killable_timeout wakeup_source_remove + wake_up_state wq_worker_comm zero_pfn From 2d1d3be2baa520c6fb1e8edd5dc2d9e7a9f8781f Mon Sep 17 00:00:00 2001 From: aaro Date: Mon, 21 Aug 2023 19:13:20 +0300 Subject: [PATCH 016/113] ANDROID: GKI: Add Tuxera symbol list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This list covers Microsoft exFAT by Tuxera and Microsoft NTFS by Tuxera file system drivers 6 function symbol(s) added 'int filemap_add_folio(struct address_space*, struct folio*, unsigned long, gfp_t)' 'int invalidate_inode_pages2_range(struct address_space*, unsigned long, unsigned long)' 'void mnt_drop_write_file(struct file*)' 'int mnt_want_write_file(struct file*)' 'gfp_t readahead_gfp_mask(struct address_space*)' 'int sync_filesystem(struct super_block*)' Bug: 296854551 Change-Id: Iefb4d25b2ae4b523c8d743c0843e81129654227f Signed-off-by: Aaro Mäkinen --- BUILD.bazel | 1 + android/abi_gki_aarch64.stg | 80 ++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_tuxera | 23 ++++++++++ 3 files changed, 104 insertions(+) create mode 100644 android/abi_gki_aarch64_tuxera diff --git a/BUILD.bazel b/BUILD.bazel index a9f5348d052e..a75b0775c50f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -69,6 +69,7 @@ filegroup( "android/abi_gki_aarch64_oplus", "android/abi_gki_aarch64_pixel", "android/abi_gki_aarch64_qcom", + "android/abi_gki_aarch64_tuxera", "android/abi_gki_aarch64_unisoc", "android/abi_gki_aarch64_virtual_device", "android/abi_gki_aarch64_vivo", diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 928c98fcbd8c..c14b9144a601 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -294941,6 +294941,11 @@ function { parameter_id: 0x33756485 parameter_id: 0x33756485 } +function { + id: 0x4a02979c + return_type_id: 0xf1a6dfed + parameter_id: 0x1582ab06 +} function { id: 0x4a279a3e return_type_id: 0x3d4280e0 @@ -306487,6 +306492,13 @@ function { parameter_id: 0x2dab4556 parameter_id: 0x1d2416d3 } +function { + id: 0x98214125 + return_type_id: 0x6720d32f + parameter_id: 0x1582ab06 + parameter_id: 0x33756485 + parameter_id: 0x33756485 +} function { id: 0x982246a7 return_type_id: 0x6720d32f @@ -306806,6 +306818,14 @@ function { parameter_id: 0x6720d32f parameter_id: 0x3e10b518 } +function { + id: 0x986a916d + return_type_id: 0x6720d32f + parameter_id: 0x1582ab06 + parameter_id: 0x2170d06d + parameter_id: 0x33756485 + parameter_id: 0xf1a6dfed +} function { id: 0x986ccce1 return_type_id: 0x6720d32f @@ -349579,6 +349599,15 @@ elf_symbol { type_id: 0x9b2d0f7e full_name: "file_write_and_wait_range" } +elf_symbol { + id: 0xbe28ee32 + name: "filemap_add_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0x42f25711 + type_id: 0x986a916d + full_name: "filemap_add_folio" +} elf_symbol { id: 0xb9dc79d0 name: "filp_close" @@ -354694,6 +354723,15 @@ elf_symbol { type_id: 0x1b4c69f5 full_name: "interval_tree_remove" } +elf_symbol { + id: 0x38472bf4 + name: "invalidate_inode_pages2_range" + is_defined: true + symbol_type: FUNCTION + crc: 0x91936719 + type_id: 0x98214125 + full_name: "invalidate_inode_pages2_range" +} elf_symbol { id: 0xc3e2d4ae name: "invalidate_mapping_pages" @@ -359893,6 +359931,24 @@ elf_symbol { type_id: 0x10985193 full_name: "mmu_notifier_synchronize" } +elf_symbol { + id: 0x8ba1a556 + name: "mnt_drop_write_file" + is_defined: true + symbol_type: FUNCTION + crc: 0x85bbfbfb + type_id: 0x16a2cb2b + full_name: "mnt_drop_write_file" +} +elf_symbol { + id: 0xa5e98cbe + name: "mnt_want_write_file" + is_defined: true + symbol_type: FUNCTION + crc: 0xd1d02e22 + type_id: 0x9bba7997 + full_name: "mnt_want_write_file" +} elf_symbol { id: 0xdf7b9a78 name: "mod_delayed_work_on" @@ -367807,6 +367863,15 @@ elf_symbol { type_id: 0xb8307855 full_name: "read_cache_page" } +elf_symbol { + id: 0x2886690b + name: "readahead_gfp_mask" + is_defined: true + symbol_type: FUNCTION + crc: 0x74cada1a + type_id: 0x4a02979c + full_name: "readahead_gfp_mask" +} elf_symbol { id: 0x46082c90 name: "reboot_mode" @@ -376028,6 +376093,15 @@ elf_symbol { type_id: 0xc68f67ec full_name: "sync_file_get_fence" } +elf_symbol { + id: 0xfb2634da + name: "sync_filesystem" + is_defined: true + symbol_type: FUNCTION + crc: 0x9b53df8a + type_id: 0x943b7925 + full_name: "sync_filesystem" +} elf_symbol { id: 0x3da4fd63 name: "synchronize_irq" @@ -388239,6 +388313,7 @@ interface { symbol_id: 0xe7aacfe5 symbol_id: 0x9e942fbe symbol_id: 0x46b6e531 + symbol_id: 0xbe28ee32 symbol_id: 0xb9dc79d0 symbol_id: 0x8bbdb127 symbol_id: 0xeaf15c9b @@ -388807,6 +388882,7 @@ interface { symbol_id: 0x0d19106d symbol_id: 0xfe94820e symbol_id: 0xe7fc8dce + symbol_id: 0x38472bf4 symbol_id: 0xc3e2d4ae symbol_id: 0x6b8c216a symbol_id: 0x6f047c6e @@ -389385,6 +389461,8 @@ interface { symbol_id: 0x381bc1b0 symbol_id: 0x236a1277 symbol_id: 0xa062fd64 + symbol_id: 0x8ba1a556 + symbol_id: 0xa5e98cbe symbol_id: 0xdf7b9a78 symbol_id: 0xa259d75f symbol_id: 0x93f5b442 @@ -390264,6 +390342,7 @@ interface { symbol_id: 0x85c7decb symbol_id: 0x87a9e1a0 symbol_id: 0x5b227eda + symbol_id: 0x2886690b symbol_id: 0x46082c90 symbol_id: 0x590d247f symbol_id: 0x91579542 @@ -391178,6 +391257,7 @@ interface { symbol_id: 0x1fe11014 symbol_id: 0x2a267913 symbol_id: 0xf3c91dcd + symbol_id: 0xfb2634da symbol_id: 0x3da4fd63 symbol_id: 0xc49e9f39 symbol_id: 0x89663420 diff --git a/android/abi_gki_aarch64_tuxera b/android/abi_gki_aarch64_tuxera new file mode 100644 index 000000000000..d04285e84983 --- /dev/null +++ b/android/abi_gki_aarch64_tuxera @@ -0,0 +1,23 @@ +__folio_put +__page_pinner_put_page +__percpu_down_read +_printk +_trace_android_vh_record_pcpu_rwsem_starttime +alt_cb_patch_nops +bio_alloc_bioset +call_rcu +filemap_add_folio +fs_bio_set +invalidate_inode_pages2_range +jiffies +mnt_drop_write_file +mnt_want_write_file +page_pinner_inited +preempt_schedule +preempt_schedule_notrace +rcu_barrier +rcuwait_wake_up +readahead_gfp_mask +strstr +sync_filesystem + From 4db95aa21ae4d2b0fc50c8e538e692bca8fd8c4c Mon Sep 17 00:00:00 2001 From: Prakruthi Deepak Heragu Date: Tue, 22 Aug 2023 17:15:50 -0700 Subject: [PATCH 017/113] ANDROID: virt: gunyah: Do not allocate irq for GH_RM_RESOURCE_NO_VIRQ Resource manager can now return GH_RM_RESOURCE_NO_VIRQ (-1) instead of 0 as the value to mean "there's no vIRQ for this resource". Bug: 297100131 Change-Id: I93c4f41b881bfc9e094fa6115df7ba6fcdaa7e6e Signed-off-by: Elliot Berman Signed-off-by: Prakruthi Deepak Heragu --- drivers/virt/gunyah/rsc_mgr.c | 2 +- include/linux/gunyah_rsc_mgr.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/virt/gunyah/rsc_mgr.c b/drivers/virt/gunyah/rsc_mgr.c index ab29e7687e3b..dd6fe39f652d 100644 --- a/drivers/virt/gunyah/rsc_mgr.c +++ b/drivers/virt/gunyah/rsc_mgr.c @@ -300,7 +300,7 @@ struct gh_resource *gh_rm_alloc_resource(struct gh_rm *rm, struct gh_rm_hyp_reso ghrsc->capid = le64_to_cpu(hyp_resource->cap_id); ghrsc->irq = IRQ_NOTCONNECTED; ghrsc->rm_label = le32_to_cpu(hyp_resource->resource_label); - if (hyp_resource->virq) { + if (hyp_resource->virq && hyp_resource->virq != GH_RM_RESOURCE_NO_VIRQ) { struct gh_irq_chip_data irq_data = { .gh_virq = le32_to_cpu(hyp_resource->virq), }; diff --git a/include/linux/gunyah_rsc_mgr.h b/include/linux/gunyah_rsc_mgr.h index bc55be6d8d33..0d9ec6d5162d 100644 --- a/include/linux/gunyah_rsc_mgr.h +++ b/include/linux/gunyah_rsc_mgr.h @@ -139,6 +139,7 @@ struct gh_rm_hyp_resource { __le32 resource_label; __le64 cap_id; __le32 virq_handle; +#define GH_RM_RESOURCE_NO_VIRQ 0xFFFFFFFF __le32 virq; __le64 base; __le64 size; From ec6b3d552a9f9fb3d44c55484fb57e6587d83968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 25 Jul 2023 01:54:43 -0700 Subject: [PATCH 018/113] UPSTREAM: netfilter: nfnetlink_log: always add a timestamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compared to all the other work we're already doing to deliver an skb to userspace this is very cheap - at worse an extra call to ktime_get_real() - and very useful. (and indeed it may even be cheaper if we're running from other hooks) (background: Android occasionally logs packets which caused wake from sleep/suspend and we'd like to have timestamps reliably associated with these events) Cc: Pablo Neira Ayuso Cc: Martin KaFai Lau Cc: Florian Westphal Signed-off-by: Maciej Å»enczykowski Signed-off-by: Florian Westphal (cherry picked from commit 1d85594fd3e7e39e63b53b1bdc2d89db43b6ecd5) Change-Id: Id9b8bc046204c11bf3321e73a67b444777d387dd --- net/netfilter/nfnetlink_log.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index d97eb280cb2e..485465d7624e 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -460,7 +460,6 @@ __build_packet_message(struct nfnl_log_net *log, sk_buff_data_t old_tail = inst->skb->tail; struct sock *sk; const unsigned char *hwhdrp; - ktime_t tstamp; nlh = nfnl_msg_put(inst->skb, 0, 0, nfnl_msg_type(NFNL_SUBSYS_ULOG, NFULNL_MSG_PACKET), @@ -589,10 +588,9 @@ __build_packet_message(struct nfnl_log_net *log, goto nla_put_failure; } - tstamp = skb_tstamp_cond(skb, false); - if (hooknum <= NF_INET_FORWARD && tstamp) { + if (hooknum <= NF_INET_FORWARD) { + struct timespec64 kts = ktime_to_timespec64(skb_tstamp_cond(skb, true)); struct nfulnl_msg_packet_timestamp ts; - struct timespec64 kts = ktime_to_timespec64(tstamp); ts.sec = cpu_to_be64(kts.tv_sec); ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC); From 5ef132d5643b8eca37fb2ce1aa7868988bf7deee Mon Sep 17 00:00:00 2001 From: Nhat Pham Date: Mon, 28 Nov 2022 11:16:12 -0800 Subject: [PATCH 019/113] UPSTREAM: zsmalloc: consolidate zs_pool's migrate_lock and size_class's locks Currently, zsmalloc has a hierarchy of locks, which includes a pool-level migrate_lock, and a lock for each size class. We have to obtain both locks in the hotpath in most cases anyway, except for zs_malloc. This exception will no longer exist when we introduce a LRU into the zs_pool for the new writeback functionality - we will need to obtain a pool-level lock to synchronize LRU handling even in zs_malloc. In preparation for zsmalloc writeback, consolidate these locks into a single pool-level lock, which drastically reduces the complexity of synchronization in zsmalloc. We have also benchmarked the lock consolidation to see the performance effect of this change on zram. First, we ran a synthetic FS workload on a server machine with 36 cores (same machine for all runs), using fs_mark -d ../zram1mnt -s 100000 -n 2500 -t 32 -k before and after for btrfs and ext4 on zram (FS usage is 80%). Here is the result (unit is file/second): With lock consolidation (btrfs): Average: 13520.2, Median: 13531.0, Stddev: 137.5961482019028 Without lock consolidation (btrfs): Average: 13487.2, Median: 13575.0, Stddev: 309.08283679298665 With lock consolidation (ext4): Average: 16824.4, Median: 16839.0, Stddev: 89.97388510006668 Without lock consolidation (ext4) Average: 16958.0, Median: 16986.0, Stddev: 194.7370021336469 As you can see, we observe a 0.3% regression for btrfs, and a 0.9% regression for ext4. This is a small, barely measurable difference in my opinion. For a more realistic scenario, we also tries building the kernel on zram. Here is the time it takes (in seconds): With lock consolidation (btrfs): real Average: 319.6, Median: 320.0, Stddev: 0.8944271909999159 user Average: 6894.2, Median: 6895.0, Stddev: 25.528415540334656 sys Average: 521.4, Median: 522.0, Stddev: 1.51657508881031 Without lock consolidation (btrfs): real Average: 319.8, Median: 320.0, Stddev: 0.8366600265340756 user Average: 6896.6, Median: 6899.0, Stddev: 16.04057355583023 sys Average: 520.6, Median: 521.0, Stddev: 1.140175425099138 With lock consolidation (ext4): real Average: 320.0, Median: 319.0, Stddev: 1.4142135623730951 user Average: 6896.8, Median: 6878.0, Stddev: 28.621670111997307 sys Average: 521.2, Median: 521.0, Stddev: 1.7888543819998317 Without lock consolidation (ext4) real Average: 319.6, Median: 319.0, Stddev: 0.8944271909999159 user Average: 6886.2, Median: 6887.0, Stddev: 16.93221781102523 sys Average: 520.4, Median: 520.0, Stddev: 1.140175425099138 The difference is entirely within the noise of a typical run on zram. This hardly justifies the complexity of maintaining both the pool lock and the class lock. In fact, for writeback, we would need to introduce yet another lock to prevent data races on the pool's LRU, further complicating the lock handling logic. IMHO, it is just better to collapse all of these into a single pool-level lock. Link: https://lkml.kernel.org/r/20221128191616.1261026-4-nphamcs@gmail.com Change-Id: Ib0eb09d7a69190fc4ffea8f819423c7f66d83379 Signed-off-by: Nhat Pham Suggested-by: Johannes Weiner Acked-by: Minchan Kim Acked-by: Johannes Weiner Reviewed-by: Sergey Senozhatsky Cc: Dan Streetman Cc: Nitin Gupta Cc: Seth Jennings Cc: Vitaly Wool Signed-off-by: Andrew Morton (cherry picked from commit c0547d0b6a4b637db05406b90ba82e1b2e71de56) Bug: 297093100 Signed-off-by: Kalesh Singh --- mm/zsmalloc.c | 87 ++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 649376f17bd9..33d8357fdbf2 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -33,8 +33,7 @@ /* * lock ordering: * page_lock - * pool->migrate_lock - * class->lock + * pool->lock * zspage->lock */ @@ -192,7 +191,6 @@ static const int fullness_threshold_frac = 4; static size_t huge_class_size; struct size_class { - spinlock_t lock; struct list_head fullness_list[NR_ZS_FULLNESS]; /* * Size of objects stored in this class. Must be multiple @@ -247,8 +245,7 @@ struct zs_pool { #ifdef CONFIG_COMPACTION struct work_struct free_work; #endif - /* protect page/zspage migration */ - rwlock_t migrate_lock; + spinlock_t lock; }; struct zspage { @@ -355,7 +352,7 @@ static void cache_free_zspage(struct zs_pool *pool, struct zspage *zspage) kmem_cache_free(pool->zspage_cachep, zspage); } -/* class->lock(which owns the handle) synchronizes races */ +/* pool->lock(which owns the handle) synchronizes races */ static void record_obj(unsigned long handle, unsigned long obj) { *(unsigned long *)handle = obj; @@ -452,7 +449,7 @@ static __maybe_unused int is_first_page(struct page *page) return PagePrivate(page); } -/* Protected by class->lock */ +/* Protected by pool->lock */ static inline int get_zspage_inuse(struct zspage *zspage) { return zspage->inuse; @@ -597,13 +594,13 @@ static int zs_stats_size_show(struct seq_file *s, void *v) if (class->index != i) continue; - spin_lock(&class->lock); + spin_lock(&pool->lock); class_almost_full = zs_stat_get(class, CLASS_ALMOST_FULL); class_almost_empty = zs_stat_get(class, CLASS_ALMOST_EMPTY); obj_allocated = zs_stat_get(class, OBJ_ALLOCATED); obj_used = zs_stat_get(class, OBJ_USED); freeable = zs_can_compact(class); - spin_unlock(&class->lock); + spin_unlock(&pool->lock); objs_per_zspage = class->objs_per_zspage; pages_used = obj_allocated / objs_per_zspage * @@ -916,7 +913,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class, get_zspage_mapping(zspage, &class_idx, &fg); - assert_spin_locked(&class->lock); + assert_spin_locked(&pool->lock); VM_BUG_ON(get_zspage_inuse(zspage)); VM_BUG_ON(fg != ZS_EMPTY); @@ -1247,19 +1244,19 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, BUG_ON(in_interrupt()); /* It guarantees it can get zspage from handle safely */ - read_lock(&pool->migrate_lock); + spin_lock(&pool->lock); obj = handle_to_obj(handle); obj_to_location(obj, &page, &obj_idx); zspage = get_zspage(page); /* - * migration cannot move any zpages in this zspage. Here, class->lock + * migration cannot move any zpages in this zspage. Here, pool->lock * is too heavy since callers would take some time until they calls * zs_unmap_object API so delegate the locking from class to zspage * which is smaller granularity. */ migrate_read_lock(zspage); - read_unlock(&pool->migrate_lock); + spin_unlock(&pool->lock); class = zspage_class(pool, zspage); off = (class->size * obj_idx) & ~PAGE_MASK; @@ -1412,8 +1409,8 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) size += ZS_HANDLE_SIZE; class = pool->size_class[get_size_class_index(size)]; - /* class->lock effectively protects the zpage migration */ - spin_lock(&class->lock); + /* pool->lock effectively protects the zpage migration */ + spin_lock(&pool->lock); zspage = find_get_zspage(class); if (likely(zspage)) { obj = obj_malloc(pool, zspage, handle); @@ -1421,12 +1418,12 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) fix_fullness_group(class, zspage); record_obj(handle, obj); class_stat_inc(class, OBJ_USED, 1); - spin_unlock(&class->lock); + spin_unlock(&pool->lock); return handle; } - spin_unlock(&class->lock); + spin_unlock(&pool->lock); zspage = alloc_zspage(pool, class, gfp); if (!zspage) { @@ -1434,7 +1431,7 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) return (unsigned long)ERR_PTR(-ENOMEM); } - spin_lock(&class->lock); + spin_lock(&pool->lock); obj = obj_malloc(pool, zspage, handle); newfg = get_fullness_group(class, zspage); insert_zspage(class, zspage, newfg); @@ -1447,7 +1444,7 @@ unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp) /* We completely set up zspage so mark them as movable */ SetZsPageMovable(pool, zspage); - spin_unlock(&class->lock); + spin_unlock(&pool->lock); return handle; } @@ -1491,16 +1488,14 @@ void zs_free(struct zs_pool *pool, unsigned long handle) return; /* - * The pool->migrate_lock protects the race with zpage's migration + * The pool->lock protects the race with zpage's migration * so it's safe to get the page from handle. */ - read_lock(&pool->migrate_lock); + spin_lock(&pool->lock); obj = handle_to_obj(handle); obj_to_page(obj, &f_page); zspage = get_zspage(f_page); class = zspage_class(pool, zspage); - spin_lock(&class->lock); - read_unlock(&pool->migrate_lock); obj_free(class->size, obj); class_stat_dec(class, OBJ_USED, 1); @@ -1510,7 +1505,7 @@ void zs_free(struct zs_pool *pool, unsigned long handle) free_zspage(pool, class, zspage); out: - spin_unlock(&class->lock); + spin_unlock(&pool->lock); cache_free_handle(pool, handle); } EXPORT_SYMBOL_GPL(zs_free); @@ -1867,16 +1862,12 @@ static int zs_page_migrate(struct page *newpage, struct page *page, pool = zspage->pool; /* - * The pool migrate_lock protects the race between zpage migration + * The pool's lock protects the race between zpage migration * and zs_free. */ - write_lock(&pool->migrate_lock); + spin_lock(&pool->lock); class = zspage_class(pool, zspage); - /* - * the class lock protects zpage alloc/free in the zspage. - */ - spin_lock(&class->lock); /* the migrate_write_lock protects zpage access via zs_map_object */ migrate_write_lock(zspage); @@ -1906,10 +1897,9 @@ static int zs_page_migrate(struct page *newpage, struct page *page, replace_sub_page(class, zspage, newpage, page); /* * Since we complete the data copy and set up new zspage structure, - * it's okay to release migration_lock. + * it's okay to release the pool's lock. */ - write_unlock(&pool->migrate_lock); - spin_unlock(&class->lock); + spin_unlock(&pool->lock); dec_zspage_isolation(zspage); migrate_write_unlock(zspage); @@ -1964,9 +1954,9 @@ static void async_free_zspage(struct work_struct *work) if (class->index != i) continue; - spin_lock(&class->lock); + spin_lock(&pool->lock); list_splice_init(&class->fullness_list[ZS_EMPTY], &free_pages); - spin_unlock(&class->lock); + spin_unlock(&pool->lock); } list_for_each_entry_safe(zspage, tmp, &free_pages, list) { @@ -1976,9 +1966,9 @@ static void async_free_zspage(struct work_struct *work) get_zspage_mapping(zspage, &class_idx, &fullness); VM_BUG_ON(fullness != ZS_EMPTY); class = pool->size_class[class_idx]; - spin_lock(&class->lock); + spin_lock(&pool->lock); __free_zspage(pool, class, zspage); - spin_unlock(&class->lock); + spin_unlock(&pool->lock); } }; @@ -2039,10 +2029,11 @@ static unsigned long __zs_compact(struct zs_pool *pool, struct zspage *dst_zspage = NULL; unsigned long pages_freed = 0; - /* protect the race between zpage migration and zs_free */ - write_lock(&pool->migrate_lock); - /* protect zpage allocation/free */ - spin_lock(&class->lock); + /* + * protect the race between zpage migration and zs_free + * as well as zpage allocation/free + */ + spin_lock(&pool->lock); while ((src_zspage = isolate_zspage(class, true))) { /* protect someone accessing the zspage(i.e., zs_map_object) */ migrate_write_lock(src_zspage); @@ -2067,7 +2058,7 @@ static unsigned long __zs_compact(struct zs_pool *pool, putback_zspage(class, dst_zspage); migrate_write_unlock(dst_zspage); dst_zspage = NULL; - if (rwlock_is_contended(&pool->migrate_lock)) + if (spin_is_contended(&pool->lock)) break; } @@ -2084,11 +2075,9 @@ static unsigned long __zs_compact(struct zs_pool *pool, pages_freed += class->pages_per_zspage; } else migrate_write_unlock(src_zspage); - spin_unlock(&class->lock); - write_unlock(&pool->migrate_lock); + spin_unlock(&pool->lock); cond_resched(); - write_lock(&pool->migrate_lock); - spin_lock(&class->lock); + spin_lock(&pool->lock); } if (src_zspage) { @@ -2096,8 +2085,7 @@ static unsigned long __zs_compact(struct zs_pool *pool, migrate_write_unlock(src_zspage); } - spin_unlock(&class->lock); - write_unlock(&pool->migrate_lock); + spin_unlock(&pool->lock); return pages_freed; } @@ -2200,7 +2188,7 @@ struct zs_pool *zs_create_pool(const char *name) return NULL; init_deferred_free(pool); - rwlock_init(&pool->migrate_lock); + spin_lock_init(&pool->lock); pool->name = kstrdup(name, GFP_KERNEL); if (!pool->name) @@ -2271,7 +2259,6 @@ struct zs_pool *zs_create_pool(const char *name) class->index = i; class->pages_per_zspage = pages_per_zspage; class->objs_per_zspage = objs_per_zspage; - spin_lock_init(&class->lock); pool->size_class[i] = class; for (fullness = ZS_EMPTY; fullness < NR_ZS_FULLNESS; fullness++) From c0e84be92384482fe9ccae92e3d6fb6ca788cd75 Mon Sep 17 00:00:00 2001 From: "yue.shen" Date: Thu, 24 Aug 2023 14:05:49 +0800 Subject: [PATCH 020/113] ANDROID: ABI: Update symbols to unisoc whitelist for A14-6.1 Update whitelist for the symbols used by the unisoc in abi_gki_aarch64_unisoc. 1 variable symbol(s) added 'int percpu_counter_batch' Bug: 296338673 Change-Id: Idd1d03e9482c5f9c3ea2184066371cd6705ddd0e Signed-off-by: Yue Shen --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_unisoc | 1 + 2 files changed, 11 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index c14b9144a601..4597ad6d487b 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -364191,6 +364191,15 @@ elf_symbol { type_id: 0x12feb005 full_name: "percpu_counter_add_batch" } +elf_symbol { + id: 0x7efbd192 + name: "percpu_counter_batch" + is_defined: true + symbol_type: OBJECT + crc: 0x05240ee7 + type_id: 0x6720d32f + full_name: "percpu_counter_batch" +} elf_symbol { id: 0x22f7748e name: "percpu_down_write" @@ -389934,6 +389943,7 @@ interface { symbol_id: 0x123cd197 symbol_id: 0xe57e5e73 symbol_id: 0x8ba9d028 + symbol_id: 0x7efbd192 symbol_id: 0x22f7748e symbol_id: 0x12951e5c symbol_id: 0xe4bc7703 diff --git a/android/abi_gki_aarch64_unisoc b/android/abi_gki_aarch64_unisoc index ac818f2e495f..8455aae21346 100644 --- a/android/abi_gki_aarch64_unisoc +++ b/android/abi_gki_aarch64_unisoc @@ -412,6 +412,7 @@ param_ops_int param_ops_uint pcpu_nr_pages + percpu_counter_batch __per_cpu_offset perf_trace_buf_alloc perf_trace_run_bpf_submit From cb440cecb223364ebc2739dcede3ca748b418f3a Mon Sep 17 00:00:00 2001 From: Andrew Yang Date: Fri, 21 Jul 2023 14:37:01 +0800 Subject: [PATCH 021/113] BACKPORT: zsmalloc: fix races between modifications of fullness and isolated We encountered many kernel exceptions of VM_BUG_ON(zspage->isolated == 0) in dec_zspage_isolation() and BUG_ON(!pages[1]) in zs_unmap_object() lately. This issue only occurs when migration and reclamation occur at the same time. With our memory stress test, we can reproduce this issue several times a day. We have no idea why no one else encountered this issue. BTW, we switched to the new kernel version with this defect a few months ago. Since fullness and isolated share the same unsigned int, modifications of them should be protected by the same lock. [andrew.yang@mediatek.com: move comment] Link: https://lkml.kernel.org/r/20230727062910.6337-1-andrew.yang@mediatek.com Link: https://lkml.kernel.org/r/20230721063705.11455-1-andrew.yang@mediatek.com Fixes: c4549b871102 ("zsmalloc: remove zspage isolation for migration") Change-Id: I4aeda0715d65f828bb88ad6fbf36b9927c7a5c4b Signed-off-by: Andrew Yang Reviewed-by: Sergey Senozhatsky Cc: AngeloGioacchino Del Regno Cc: Matthias Brugger Cc: Minchan Kim Cc: Sebastian Andrzej Siewior Cc: Signed-off-by: Andrew Morton (cherry picked from commit 4b5d1e47b69426c0f7491d97d73ad0152d02d437) Bug: 297093100 [ Kalesh Singh - Fix trivial conflicts in zs_page_putback()] Signed-off-by: Kalesh Singh --- mm/zsmalloc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 33d8357fdbf2..9fb906d56e0b 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1816,6 +1816,7 @@ static void replace_sub_page(struct size_class *class, struct zspage *zspage, static bool zs_page_isolate(struct page *page, isolate_mode_t mode) { + struct zs_pool *pool; struct zspage *zspage; /* @@ -1826,9 +1827,10 @@ static bool zs_page_isolate(struct page *page, isolate_mode_t mode) VM_BUG_ON_PAGE(PageIsolated(page), page); zspage = get_zspage(page); - migrate_write_lock(zspage); + pool = zspage->pool; + spin_lock(&pool->lock); inc_zspage_isolation(zspage); - migrate_write_unlock(zspage); + spin_unlock(&pool->lock); return true; } @@ -1895,12 +1897,12 @@ static int zs_page_migrate(struct page *newpage, struct page *page, kunmap_atomic(s_addr); replace_sub_page(class, zspage, newpage, page); + dec_zspage_isolation(zspage); /* * Since we complete the data copy and set up new zspage structure, * it's okay to release the pool's lock. */ spin_unlock(&pool->lock); - dec_zspage_isolation(zspage); migrate_write_unlock(zspage); get_page(newpage); @@ -1918,14 +1920,16 @@ static int zs_page_migrate(struct page *newpage, struct page *page, static void zs_page_putback(struct page *page) { struct zspage *zspage; + struct zs_pool *pool; VM_BUG_ON_PAGE(!PageMovable(page), page); VM_BUG_ON_PAGE(!PageIsolated(page), page); zspage = get_zspage(page); - migrate_write_lock(zspage); + pool = zspage->pool; + spin_lock(&pool->lock); dec_zspage_isolation(zspage); - migrate_write_unlock(zspage); + spin_unlock(&pool->lock); } static const struct movable_operations zsmalloc_mops = { From 797dac42cc52ed86901688c3740219a16f2238c7 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Fri, 25 Aug 2023 09:58:36 -0700 Subject: [PATCH 022/113] ANDROID: GKI: Update ABI for zsmalloc fixes zs_pool->lock was added upstream as a replacement for the size_class locks. The tooling over-cautiously reports this as a ABI breakage but both of these structs (zs_pool and size_class) are internal to zsmalloc.c. Update the ABI to allow these changes. Bug: 297093100 Change-Id: Ib9fc5a036f75d89fb6bee4c146034f6c81759e04 Signed-off-by: Kalesh Singh --- android/abi_gki_aarch64.stg | 68 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 4597ad6d487b..4bd2671ae57a 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -91948,10 +91948,9 @@ member { offset: 712 } member { - id: 0xf667d80f + id: 0xf667dcee name: "fullness_list" type_id: 0xb8bf135c - offset: 64 } member { id: 0xfeb50ea0 @@ -103779,12 +103778,6 @@ member { type_id: 0x4585663f offset: 320 } -member { - id: 0xad7c8a98 - name: "index" - type_id: 0x4585663f - offset: 672 -} member { id: 0xad7c8ba4 name: "index" @@ -103797,6 +103790,12 @@ member { type_id: 0x4585663f offset: 480 } +member { + id: 0xad7c8d2b + name: "index" + type_id: 0x4585663f + offset: 608 +} member { id: 0xad7c8d72 name: "index" @@ -115578,6 +115577,12 @@ member { type_id: 0xf313e71a offset: 768 } +member { + id: 0x2d1fe43b + name: "lock" + type_id: 0xf313e71a + offset: 17536 +} member { id: 0x2d1fe44c name: "lock" @@ -123438,12 +123443,6 @@ member { type_id: 0x2c8b0a9f offset: 768 } -member { - id: 0xdb33fcdf - name: "migrate_lock" - type_id: 0xf4933b90 - offset: 17536 -} member { id: 0x8edaa968 name: "migrate_page" @@ -136400,10 +136399,10 @@ member { type_id: 0xad7c0a89 } member { - id: 0x7a226550 + id: 0x7a226b7d name: "objs_per_zspage" type_id: 0x6720d32f - offset: 608 + offset: 544 } member { id: 0x33953b25 @@ -141342,10 +141341,10 @@ member { bitsize: 1 } member { - id: 0x338646f2 + id: 0x338649f9 name: "pages_per_zspage" type_id: 0x6720d32f - offset: 640 + offset: 576 } member { id: 0xf9521fd2 @@ -173982,18 +173981,18 @@ member { type_id: 0x6720d32f offset: 96 } -member { - id: 0xd91935d3 - name: "size" - type_id: 0x6720d32f - offset: 576 -} member { id: 0xd9193607 name: "size" type_id: 0x6720d32f offset: 896 } +member { + id: 0xd91937b9 + name: "size" + type_id: 0x6720d32f + offset: 512 +} member { id: 0xd9193b66 name: "size" @@ -179931,10 +179930,10 @@ member { offset: 896 } member { - id: 0xb91e0d04 + id: 0xb91e0940 name: "stats" type_id: 0x6b61371d - offset: 704 + offset: 640 } member { id: 0xb920e0d3 @@ -249070,14 +249069,13 @@ struct_union { kind: STRUCT name: "size_class" definition { - bytesize: 136 - member_id: 0x2d1fec85 - member_id: 0xf667d80f - member_id: 0xd91935d3 - member_id: 0x7a226550 - member_id: 0x338646f2 - member_id: 0xad7c8a98 - member_id: 0xb91e0d04 + bytesize: 128 + member_id: 0xf667dcee + member_id: 0xd91937b9 + member_id: 0x7a226b7d + member_id: 0x338649f9 + member_id: 0xad7c8d2b + member_id: 0xb91e0940 } } struct_union { @@ -265101,7 +265099,7 @@ struct_union { member_id: 0xb9089225 member_id: 0x868caa9e member_id: 0x8a67a9e5 - member_id: 0xdb33fcdf + member_id: 0x2d1fe43b } } struct_union { From 9089c10d9c5aed96b32144b06884904a85a35fbd Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 20:16:48 +0800 Subject: [PATCH 023/113] UPSTREAM: erofs: initialize packed inode after root inode is assigned As commit 8f7acdae2cd4 ("staging: erofs: kill all failure handling in fill_super()"), move the initialization of packed inode after root inode is assigned, so that the iput() in .put_super() is adequate as the failure handling. Otherwise, iput() is also needed in .kill_sb(), in case of the mounting fails halfway. Signed-off-by: Jingbo Xu Reviewed-by: Yue Hu Fixes: b15b2e307c3a ("erofs: support on-disk compressed fragments data") Reviewed-by: Gao Xiang Acked-by: Chao Yu Link: https://lore.kernel.org/r/20230407141710.113882-3-jefflexu@linux.alibaba.com Signed-off-by: Gao Xiang (cherry picked from commit cb9bce79514392a9a216ff67148e05e2d72c28bd https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I3cec91605b42c588e2c8f69629f0bdcc20078de2 Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/internal.h | 1 + fs/erofs/super.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index e51f27b6bde1..4868000806d8 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -154,6 +154,7 @@ struct erofs_sb_info { /* what we really care is nid, rather than ino.. */ erofs_nid_t root_nid; + erofs_nid_t packed_nid; /* used for statfs, f_files - f_favail */ u64 inos; diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 626a615dafc2..bd8bf8fc2f5d 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -381,17 +381,7 @@ static int erofs_read_superblock(struct super_block *sb) #endif sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact)); sbi->root_nid = le16_to_cpu(dsb->root_nid); -#ifdef CONFIG_EROFS_FS_ZIP - sbi->packed_inode = NULL; - if (erofs_sb_has_fragments(sbi) && dsb->packed_nid) { - sbi->packed_inode = - erofs_iget(sb, le64_to_cpu(dsb->packed_nid)); - if (IS_ERR(sbi->packed_inode)) { - ret = PTR_ERR(sbi->packed_inode); - goto out; - } - } -#endif + sbi->packed_nid = le64_to_cpu(dsb->packed_nid); sbi->inos = le64_to_cpu(dsb->inos); sbi->build_time = le64_to_cpu(dsb->build_time); @@ -800,6 +790,16 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) erofs_shrinker_register(sb); /* sb->s_umount is already locked, SB_ACTIVE and SB_BORN are not set */ +#ifdef CONFIG_EROFS_FS_ZIP + if (erofs_sb_has_fragments(sbi) && sbi->packed_nid) { + sbi->packed_inode = erofs_iget(sb, sbi->packed_nid); + if (IS_ERR(sbi->packed_inode)) { + err = PTR_ERR(sbi->packed_inode); + sbi->packed_inode = NULL; + return err; + } + } +#endif err = erofs_init_managed_cache(sb); if (err) return err; From 6ec6eee87e03e09ad850b003c50f15d9910da6a8 Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 20:32:51 +0800 Subject: [PATCH 024/113] UPSTREAM: erofs: stop parsing non-compact HEAD index if clusterofs is invalid Syzbot generated a crafted image [1] with a non-compact HEAD index of clusterofs 33024 while valid numbers should be 0 ~ lclustersize-1, which causes the following unexpected behavior as below: BUG: unable to handle page fault for address: fffff52101a3fff9 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 23ffed067 P4D 23ffed067 PUD 0 Oops: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 4398 Comm: kworker/u5:1 Not tainted 6.3.0-rc6-syzkaller-g09a9639e56c0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Workqueue: erofs_worker z_erofs_decompressqueue_work RIP: 0010:z_erofs_decompress_queue+0xb7e/0x2b40 ... Call Trace: z_erofs_decompressqueue_work+0x99/0xe0 process_one_work+0x8f6/0x1170 worker_thread+0xa63/0x1210 kthread+0x270/0x300 ret_from_fork+0x1f/0x30 Note that normal images or images using compact indexes are not impacted. Let's fix this now. [1] https://lore.kernel.org/r/000000000000ec75b005ee97fbaa@google.com Reported-and-tested-by: syzbot+aafb3f37cfeb6534c4ac@syzkaller.appspotmail.com Fixes: 02827e1796b3 ("staging: erofs: add erofs_map_blocks_iter") Fixes: 152a333a5895 ("staging: erofs: add compacted compression indexes support") Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230410173714.104604-1-hsiangkao@linux.alibaba.com (cherry picked from commit cc4efd3dd2ac9f89143e5d881609747ecff04164 https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I8e4d7d3f30d70f8c4ab42b33f215af1292c57fcf Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/zmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 39cc014dba40..bb91cc649972 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -211,6 +211,10 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m, if (advise & Z_EROFS_VLE_DI_PARTIAL_REF) m->partialref = true; m->clusterofs = le16_to_cpu(di->di_clusterofs); + if (m->clusterofs >= 1 << vi->z_logical_clusterbits) { + DBG_BUGON(1); + return -EFSCORRUPTED; + } m->pblk = le32_to_cpu(di->di_u.blkaddr); break; default: From 7521b904dce7df25e44fde5d679169fda99402a8 Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 20:37:38 +0800 Subject: [PATCH 025/113] UPSTREAM: erofs: fix potential overflow calculating xattr_isize Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum of 256K (64K * 4). Thus declare xattr_isize as unsigned int to avoid the potential overflow. Fixes: bfb8674dc044 ("staging: erofs: add erofs in-memory stuffs") Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230414061810.6479-1-jefflexu@linux.alibaba.com Signed-off-by: Gao Xiang (cherry picked from commit 1b3567a1969b26f709d82a874498c0754ea841c3 https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I43d88c7ebc3b320e226ab4d7bc6717432ef5ad82 Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 4868000806d8..340bd56a5755 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -311,7 +311,7 @@ struct erofs_inode { unsigned char datalayout; unsigned char inode_isize; - unsigned short xattr_isize; + unsigned int xattr_isize; unsigned int xattr_shared_count; unsigned int *xattr_shared_xattrs; From f11ccb03a03e6c164b0300540d7abe0fb1c4096f Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 20:51:35 +0800 Subject: [PATCH 026/113] UPSTREAM: erofs: kill hooked chains to avoid loops on deduplicated compressed images After heavily stressing EROFS with several images which include a hand-crafted image of repeated patterns for more than 46 days, I found two chains could be linked with each other almost simultaneously and form a loop so that the entire loop won't be submitted. As a consequence, the corresponding file pages will remain locked forever. It can be _only_ observed on data-deduplicated compressed images. For example, consider two chains with five pclusters in total: Chain 1: 2->3->4->5 -- The tail pcluster is 5; Chain 2: 5->1->2 -- The tail pcluster is 2. Chain 2 could link to Chain 1 with pcluster 5; and Chain 1 could link to Chain 2 at the same time with pcluster 2. Since hooked chains are all linked locklessly now, I have no idea how to simply avoid the race. Instead, let's avoid hooked chains completely until I could work out a proper way to fix this and end users finally tell us that it's needed to add it back. Actually, this optimization can be found with multi-threaded workloads (especially even more often on deduplicated compressed images), yet I'm not sure about the overall system impacts of not having this compared with implementation complexity. Fixes: 267f2492c8f7 ("erofs: introduce multi-reference pclusters (fully-referenced)") Signed-off-by: Gao Xiang Reviewed-by: Yue Hu Link: https://lore.kernel.org/r/20230526201459.128169-4-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang (cherry picked from commit 967c28b23f6c89bb8eef6a046ea88afe0d7c1029 https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I33607c174bfeb54119c6de271b44c9fe2a7399e6 Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/zdata.c | 67 ++++++++---------------------------------------- fs/erofs/zdata.h | 5 +--- 2 files changed, 11 insertions(+), 61 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 3d1b88efb075..9076f3324cb1 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -355,20 +355,6 @@ out_error_pcluster_pool: enum z_erofs_pclustermode { Z_EROFS_PCLUSTER_INFLIGHT, - /* - * The current pclusters was the tail of an exist chain, in addition - * that the previous processed chained pclusters are all decided to - * be hooked up to it. - * A new chain will be created for the remaining pclusters which are - * not processed yet, so different from Z_EROFS_PCLUSTER_FOLLOWED, - * the next pcluster cannot reuse the whole page safely for inplace I/O - * in the following scenario: - * ________________________________________________________________ - * | tail (partial) page | head (partial) page | - * | (belongs to the next pcl) | (belongs to the current pcl) | - * |_______PCLUSTER_FOLLOWED______|________PCLUSTER_HOOKED__________| - */ - Z_EROFS_PCLUSTER_HOOKED, /* * a weak form of Z_EROFS_PCLUSTER_FOLLOWED, the difference is that it * could be dispatched into bypass queue later due to uptodated managed @@ -386,8 +372,8 @@ enum z_erofs_pclustermode { * ________________________________________________________________ * | tail (partial) page | head (partial) page | * | (of the current cl) | (of the previous collection) | - * | PCLUSTER_FOLLOWED or | | - * |_____PCLUSTER_HOOKED__|___________PCLUSTER_FOLLOWED____________| + * | | | + * |__PCLUSTER_FOLLOWED___|___________PCLUSTER_FOLLOWED____________| * * [ (*) the above page can be used as inplace I/O. ] */ @@ -400,7 +386,7 @@ struct z_erofs_decompress_frontend { struct z_erofs_bvec_iter biter; struct page *candidate_bvpage; - struct z_erofs_pcluster *pcl, *tailpcl; + struct z_erofs_pcluster *pcl; z_erofs_next_pcluster_t owned_head; enum z_erofs_pclustermode mode; @@ -589,19 +575,7 @@ static void z_erofs_try_to_claim_pcluster(struct z_erofs_decompress_frontend *f) return; } - /* - * type 2, link to the end of an existing open chain, be careful - * that its submission is controlled by the original attached chain. - */ - if (*owned_head != &pcl->next && pcl != f->tailpcl && - cmpxchg(&pcl->next, Z_EROFS_PCLUSTER_TAIL, - *owned_head) == Z_EROFS_PCLUSTER_TAIL) { - *owned_head = Z_EROFS_PCLUSTER_TAIL; - f->mode = Z_EROFS_PCLUSTER_HOOKED; - f->tailpcl = NULL; - return; - } - /* type 3, it belongs to a chain, but it isn't the end of the chain */ + /* type 2, it belongs to an ongoing chain */ f->mode = Z_EROFS_PCLUSTER_INFLIGHT; } @@ -662,9 +636,6 @@ static int z_erofs_register_pcluster(struct z_erofs_decompress_frontend *fe) goto err_out; } } - /* used to check tail merging loop due to corrupted images */ - if (fe->owned_head == Z_EROFS_PCLUSTER_TAIL) - fe->tailpcl = pcl; fe->owned_head = &pcl->next; fe->pcl = pcl; return 0; @@ -685,7 +656,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe) /* must be Z_EROFS_PCLUSTER_TAIL or pointed to previous pcluster */ DBG_BUGON(fe->owned_head == Z_EROFS_PCLUSTER_NIL); - DBG_BUGON(fe->owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED); if (!(map->m_flags & EROFS_MAP_META)) { grp = erofs_find_workgroup(fe->inode->i_sb, @@ -704,10 +674,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe) if (ret == -EEXIST) { mutex_lock(&fe->pcl->lock); - /* used to check tail merging loop due to corrupted images */ - if (fe->owned_head == Z_EROFS_PCLUSTER_TAIL) - fe->tailpcl = fe->pcl; - z_erofs_try_to_claim_pcluster(fe); } else if (ret) { return ret; @@ -887,8 +853,7 @@ hitted: * those chains are handled asynchronously thus the page cannot be used * for inplace I/O or bvpage (should be processed in a strict order.) */ - tight &= (fe->mode >= Z_EROFS_PCLUSTER_HOOKED && - fe->mode != Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE); + tight &= (fe->mode > Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE); cur = end - min_t(unsigned int, offset + end - map->m_la, end); if (!(map->m_flags & EROFS_MAP_MAPPED)) { @@ -1270,11 +1235,7 @@ static void z_erofs_decompress_queue(const struct z_erofs_decompressqueue *io, LIST_HEAD_INIT(be.decompressed_secondary_bvecs), }; z_erofs_next_pcluster_t owned = io->head; - - while (owned != Z_EROFS_PCLUSTER_TAIL_CLOSED) { - /* impossible that 'owned' equals Z_EROFS_WORK_TPTR_TAIL */ - DBG_BUGON(owned == Z_EROFS_PCLUSTER_TAIL); - /* impossible that 'owned' equals Z_EROFS_PCLUSTER_NIL */ + while (owned != Z_EROFS_PCLUSTER_TAIL) { DBG_BUGON(owned == Z_EROFS_PCLUSTER_NIL); be.pcl = container_of(owned, struct z_erofs_pcluster, next); @@ -1291,7 +1252,7 @@ static void z_erofs_decompressqueue_work(struct work_struct *work) container_of(work, struct z_erofs_decompressqueue, u.work); struct page *pagepool = NULL; - DBG_BUGON(bgq->head == Z_EROFS_PCLUSTER_TAIL_CLOSED); + DBG_BUGON(bgq->head == Z_EROFS_PCLUSTER_TAIL); z_erofs_decompress_queue(bgq, &pagepool); erofs_release_pages(&pagepool); kvfree(bgq); @@ -1483,7 +1444,7 @@ fg_out: q->eio = false; } q->sb = sb; - q->head = Z_EROFS_PCLUSTER_TAIL_CLOSED; + q->head = Z_EROFS_PCLUSTER_TAIL; return q; } @@ -1515,11 +1476,7 @@ static void move_to_bypass_jobqueue(struct z_erofs_pcluster *pcl, z_erofs_next_pcluster_t *const submit_qtail = qtail[JQ_SUBMIT]; z_erofs_next_pcluster_t *const bypass_qtail = qtail[JQ_BYPASS]; - DBG_BUGON(owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED); - if (owned_head == Z_EROFS_PCLUSTER_TAIL) - owned_head = Z_EROFS_PCLUSTER_TAIL_CLOSED; - - WRITE_ONCE(pcl->next, Z_EROFS_PCLUSTER_TAIL_CLOSED); + WRITE_ONCE(pcl->next, Z_EROFS_PCLUSTER_TAIL); WRITE_ONCE(*submit_qtail, owned_head); WRITE_ONCE(*bypass_qtail, &pcl->next); @@ -1586,15 +1543,11 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f, unsigned int i = 0; bool bypass = true; - /* no possible 'owned_head' equals the following */ - DBG_BUGON(owned_head == Z_EROFS_PCLUSTER_TAIL_CLOSED); DBG_BUGON(owned_head == Z_EROFS_PCLUSTER_NIL); pcl = container_of(owned_head, struct z_erofs_pcluster, next); + owned_head = READ_ONCE(pcl->next); - /* close the main owned chain at first */ - owned_head = cmpxchg(&pcl->next, Z_EROFS_PCLUSTER_TAIL, - Z_EROFS_PCLUSTER_TAIL_CLOSED); if (z_erofs_is_inline_pcluster(pcl)) { move_to_bypass_jobqueue(pcl, qtail, owned_head); continue; diff --git a/fs/erofs/zdata.h b/fs/erofs/zdata.h index 4588a47c867e..9fd6abe967a9 100644 --- a/fs/erofs/zdata.h +++ b/fs/erofs/zdata.h @@ -94,11 +94,8 @@ struct z_erofs_pcluster { /* let's avoid the valid 32-bit kernel addresses */ -/* the chained workgroup has't submitted io (still open) */ +/* the end of a chain of pclusters */ #define Z_EROFS_PCLUSTER_TAIL ((void *)0x5F0ECAFE) -/* the chained workgroup has already submitted io */ -#define Z_EROFS_PCLUSTER_TAIL_CLOSED ((void *)0x5F0EDEAD) - #define Z_EROFS_PCLUSTER_NIL (NULL) struct z_erofs_decompressqueue { From cc6111a28721e80f741d0ed05c1d6badddb1bcee Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 20:55:20 +0800 Subject: [PATCH 027/113] UPSTREAM: erofs: fix compact 4B support for 16k block size In compact 4B, two adjacent lclusters are packed together as a unit to form on-disk indexes for effective random access, as below: (amortized = 4, vcnt = 2) _____________________________________________ |___@_____ encoded bits __________|_ blkaddr _| 0 . amortized * vcnt = 8 . . . . amortized * vcnt - 4 = 4 . . .____________________________. |_type (2 bits)_|_clusterofs_| Therefore, encoded bits for each pack are 32 bits (4 bytes). IOWs, since each lcluster can get 16 bits for its type and clusterofs, the maximum supported lclustersize for compact 4B format is 16k (14 bits). Fix this to enable compact 4B format for 16k lclusters (blocks), which is tested on an arm64 server with 16k page size. Fixes: 152a333a5895 ("staging: erofs: add compacted compression indexes support") Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20230601112341.56960-1-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang (cherry picked from commit 001b8ccd0650727e54ec16ef72bf1b8eeab7168e https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I97918294a1d00a65223e741c3d153f375ab50507 Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/zmap.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index bb91cc649972..3adab0d9cbe0 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -273,7 +273,7 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m, u8 *in, type; bool big_pcluster; - if (1 << amortizedshift == 4) + if (1 << amortizedshift == 4 && lclusterbits <= 14) vcnt = 2; else if (1 << amortizedshift == 2 && lclusterbits == 12) vcnt = 16; @@ -375,7 +375,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, { struct inode *const inode = m->inode; struct erofs_inode *const vi = EROFS_I(inode); - const unsigned int lclusterbits = vi->z_logical_clusterbits; const erofs_off_t ebase = ALIGN(iloc(EROFS_I_SB(inode), vi->nid) + vi->inode_isize + vi->xattr_isize, 8) + sizeof(struct z_erofs_map_header); @@ -384,9 +383,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, unsigned int amortizedshift; erofs_off_t pos; - if (lclusterbits != 12) - return -EOPNOTSUPP; - if (lcn >= totalidx) return -EINVAL; From 2f805fb91250695fe5a0475cd6dcdc3337114fb6 Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 20:57:44 +0800 Subject: [PATCH 028/113] UPSTREAM: erofs: Fix detection of atomic context Current check for atomic context is not sufficient as z_erofs_decompressqueue_endio can be called under rcu lock from blk_mq_flush_plug_list(). See the stacktrace [1] In such case we should hand off the decompression work for async processing rather than trying to do sync decompression in current context. Patch fixes the detection by checking for rcu_read_lock_any_held() and while at it use more appropriate !in_task() check than in_atomic(). Background: Historically erofs would always schedule a kworker for decompression which would incur the scheduling cost regardless of the context. But z_erofs_decompressqueue_endio() may not always be in atomic context and we could actually benefit from doing the decompression in z_erofs_decompressqueue_endio() if we are in thread context, for example when running with dm-verity. This optimization was later added in patch [2] which has shown improvement in performance benchmarks. ============================================== [1] Problem stacktrace [name:core&]BUG: sleeping function called from invalid context at kernel/locking/mutex.c:291 [name:core&]in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 1615, name: CpuMonitorServi [name:core&]preempt_count: 0, expected: 0 [name:core&]RCU nest depth: 1, expected: 0 CPU: 7 PID: 1615 Comm: CpuMonitorServi Tainted: G S W OE 6.1.25-android14-5-maybe-dirty-mainline #1 Hardware name: MT6897 (DT) Call trace: dump_backtrace+0x108/0x15c show_stack+0x20/0x30 dump_stack_lvl+0x6c/0x8c dump_stack+0x20/0x48 __might_resched+0x1fc/0x308 __might_sleep+0x50/0x88 mutex_lock+0x2c/0x110 z_erofs_decompress_queue+0x11c/0xc10 z_erofs_decompress_kickoff+0x110/0x1a4 z_erofs_decompressqueue_endio+0x154/0x180 bio_endio+0x1b0/0x1d8 __dm_io_complete+0x22c/0x280 clone_endio+0xe4/0x280 bio_endio+0x1b0/0x1d8 blk_update_request+0x138/0x3a4 blk_mq_plug_issue_direct+0xd4/0x19c blk_mq_flush_plug_list+0x2b0/0x354 __blk_flush_plug+0x110/0x160 blk_finish_plug+0x30/0x4c read_pages+0x2fc/0x370 page_cache_ra_unbounded+0xa4/0x23c page_cache_ra_order+0x290/0x320 do_sync_mmap_readahead+0x108/0x2c0 filemap_fault+0x19c/0x52c __do_fault+0xc4/0x114 handle_mm_fault+0x5b4/0x1168 do_page_fault+0x338/0x4b4 do_translation_fault+0x40/0x60 do_mem_abort+0x60/0xc8 el0_da+0x4c/0xe0 el0t_64_sync_handler+0xd4/0xfc el0t_64_sync+0x1a0/0x1a4 [2] Link: https://lore.kernel.org/all/20210317035448.13921-1-huangjianan@oppo.com/ Reported-by: Will Shiu Suggested-by: Gao Xiang Signed-off-by: Sandeep Dhavale Reviewed-by: Gao Xiang Reviewed-by: Alexandre Mergnat Link: https://lore.kernel.org/r/20230621220848.3379029-1-dhavale@google.com Signed-off-by: Gao Xiang (cherry picked from commit 12d0a24afd9ea58e581ea64d64e066f2027b28d9 https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I652b189e316b26ca56e1d7b6f1e4c52ae20bb3b7 Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/zdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 9076f3324cb1..e9a07ac7bb26 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1280,7 +1280,7 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, if (atomic_add_return(bios, &io->pending_bios)) return; /* Use (kthread_)work and sync decompression for atomic contexts only */ - if (in_atomic() || irqs_disabled()) { + if (!in_task() || irqs_disabled() || rcu_read_lock_any_held()) { #ifdef CONFIG_EROFS_FS_PCPU_KTHREAD struct kthread_worker *worker; From 8497f46a873656ba8c6f79895d70107e2d6ac9d0 Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 21:00:15 +0800 Subject: [PATCH 029/113] UPSTREAM: erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF z_erofs_pcluster_readmore() may take a long time to loop when the page offset is large enough, which is unnecessary should be prevented. For example, when the following case is encountered, it will loop 4691368 times, taking about 27 seconds: - offset = 19217289215 - inode_size = 1442672 Signed-off-by: Chunhai Guo Fixes: 386292919c25 ("erofs: introduce readmore decompression strategy") Reviewed-by: Gao Xiang Reviewed-by: Yue Hu Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230710042531.28761-1-guochunhai@vivo.com Signed-off-by: Gao Xiang (cherry picked from commit 936aa701d82d397c2d1afcd18ce2c739471d978d https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I279b0fadcfa8c0ff0d638a86c7bb2c6b4d07f194 Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/zdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index e9a07ac7bb26..01c1ab655277 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1691,7 +1691,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, } cur = map->m_la + map->m_llen - 1; - while (cur >= end) { + while ((cur >= end) && (cur < i_size_read(inode))) { pgoff_t index = cur >> PAGE_SHIFT; struct page *page; From ffaab71302ca81ac4addbc63f5a81be37988595a Mon Sep 17 00:00:00 2001 From: sunshijie Date: Mon, 21 Aug 2023 21:02:05 +0800 Subject: [PATCH 030/113] UPSTREAM: erofs: avoid infinite loop in z_erofs_do_read_page() when reading beyond EOF z_erofs_do_read_page() may loop infinitely due to the inappropriate truncation in the below statement. Since the offset is 64 bits and min_t() truncates the result to 32 bits. The solution is to replace unsigned int with a 64-bit type, such as erofs_off_t. cur = end - min_t(unsigned int, offset + end - map->m_la, end); - For example: - offset = 0x400160000 - end = 0x370 - map->m_la = 0x160370 - offset + end - map->m_la = 0x400000000 - offset + end - map->m_la = 0x00000000 (truncated as unsigned int) - Expected result: - cur = 0 - Actual result: - cur = 0x370 Signed-off-by: Chunhai Guo Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230710093410.44071-1-guochunhai@vivo.com Signed-off-by: Gao Xiang (cherry picked from commit 8191213a5835b0317c5e4d0d337ae1ae00c75253 https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev) Bug: 296824280 Change-Id: I152508ba4c0eb83aeae5d753e22b0ca8d3ada56d Signed-off-by: sunshijie Signed-off-by: sunshijie --- fs/erofs/zdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 01c1ab655277..a08299d80ca1 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -855,7 +855,7 @@ hitted: */ tight &= (fe->mode > Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE); - cur = end - min_t(unsigned int, offset + end - map->m_la, end); + cur = end - min_t(erofs_off_t, offset + end - map->m_la, end); if (!(map->m_flags & EROFS_MAP_MAPPED)) { zero_user_segment(page, cur, end); goto next_part; From cd018c99fa2f79262262a2698455f9ee3e5f5076 Mon Sep 17 00:00:00 2001 From: Enlin Mu Date: Tue, 1 Aug 2023 14:04:32 +0800 Subject: [PATCH 031/113] FROMGIT: pstore/ram: Check start of empty przs during init After commit 30696378f68a ("pstore/ram: Do not treat empty buffers as valid"), initialization would assume a prz was valid after seeing that the buffer_size is zero (regardless of the buffer start position). This unchecked start value means it could be outside the bounds of the buffer, leading to future access panics when written to: sysdump_panic_event+0x3b4/0x5b8 atomic_notifier_call_chain+0x54/0x90 panic+0x1c8/0x42c die+0x29c/0x2a8 die_kernel_fault+0x68/0x78 __do_kernel_fault+0x1c4/0x1e0 do_bad_area+0x40/0x100 do_translation_fault+0x68/0x80 do_mem_abort+0x68/0xf8 el1_da+0x1c/0xc0 __raw_writeb+0x38/0x174 __memcpy_toio+0x40/0xac persistent_ram_update+0x44/0x12c persistent_ram_write+0x1a8/0x1b8 ramoops_pstore_write+0x198/0x1e8 pstore_console_write+0x94/0xe0 ... To avoid this, also check if the prz start is 0 during the initialization phase. If not, the next prz sanity check case will discover it (start > size) and zap the buffer back to a sane state. Bug: 293538531 Fixes: 30696378f68a ("pstore/ram: Do not treat empty buffers as valid") Cc: Yunlong Xing Cc: stable@vger.kernel.org Change-Id: I6ff3a11b8b21f6f5ab37d8432751e5d33a441d8c Signed-off-by: Enlin Mu Link: https://lore.kernel.org/r/20230801060432.1307717-1-yunlong.xing@unisoc.com [kees: update commit log with backtrace and clarifications] (cherry picked from commit fe8c3623ab06603eb760444a032d426542212021 https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore) Signed-off-by: Kees Cook Signed-off-by: Chunhui Li --- fs/pstore/ram_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 8bf09886e7e6..fea6e42b2dd2 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -518,7 +518,7 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig, sig ^= PERSISTENT_RAM_SIG; if (prz->buffer->sig == sig) { - if (buffer_size(prz) == 0) { + if (buffer_size(prz) == 0 && buffer_start(prz) == 0) { pr_debug("found existing empty buffer\n"); return 0; } From 7551a1a2a11f307f74ee5a1654843ef990b69d02 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Fri, 16 Apr 2021 15:21:14 +0530 Subject: [PATCH 032/113] ANDROID: cgroup: Add android_rvh_cgroup_force_kthread_migration In Android GKI, CONFIG_FAIR_GROUP_SCHED is enabled [1] to help prioritize important work. Given that CPU shares of root cgroup can't be changed, leaving the tasks inside root cgroup will give them higher share compared to the other tasks inside important cgroups. This is mitigated by moving all tasks inside root cgroup to a different cgroup after Android is booted. However, there are many kernel tasks stuck in the root cgroup after the boot. It is possible to relax kernel threads and kworkers migrations under certain scenarios. However the patch [2] posted at upstream is not accepted. Hence add a restricted vendor hook to notify modules when a kernel thread is requested for cgroup migration. The modules can relax the restrictions forced by the kernel and allow the cgroup migration. [1] https://android.googlesource.com/kernel/common/+/f08f049de11c15a4251cb1db08cf0bee20bd9b59 [2] https://lore.kernel.org/lkml/1617714261-18111-1-git-send-email-pkondeti@codeaurora.org Bug: 184594949 Change-Id: I445a170ba797c8bece3b4b59b7a42cdd85438f1f Signed-off-by: Pavankumar Kondeti [quic_dickey@quicinc.com: port to android-mainline kernel] Signed-off-by: Stephen Dickey --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/cgroup.h | 4 ++++ kernel/cgroup/cgroup-internal.h | 3 ++- kernel/cgroup/cgroup-v1.c | 2 +- kernel/cgroup/cgroup.c | 11 ++++++++--- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 36616a30c55b..1f31007f8c65 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -136,6 +136,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sysfs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_command); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_compl_command); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_set_task); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cgroup_force_kthread_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_syscall_prctl_finished); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_uic_command); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_tm_command); diff --git a/include/trace/hooks/cgroup.h b/include/trace/hooks/cgroup.h index a50e6abc55ee..b824197118f9 100644 --- a/include/trace/hooks/cgroup.h +++ b/include/trace/hooks/cgroup.h @@ -23,6 +23,10 @@ DECLARE_HOOK(android_vh_cgroup_attach, TP_PROTO(struct cgroup_subsys *ss, struct cgroup_taskset *tset), TP_ARGS(ss, tset)); +DECLARE_RESTRICTED_HOOK(android_rvh_cgroup_force_kthread_migration, + TP_PROTO(struct task_struct *tsk, struct cgroup *dst_cgrp, bool *force_migration), + TP_ARGS(tsk, dst_cgrp, force_migration), 1); + DECLARE_RESTRICTED_HOOK(android_rvh_cpuset_fork, TP_PROTO(struct task_struct *p, bool *inherit_cpus), TP_ARGS(p, inherit_cpus), 1); diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 367b0a42ada9..892b770067b5 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -251,7 +251,8 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, void cgroup_attach_lock(bool lock_threadgroup); void cgroup_attach_unlock(bool lock_threadgroup); struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, - bool *locked) + bool *locked, + struct cgroup *dst_cgrp); __acquires(&cgroup_threadgroup_rwsem); void cgroup_procs_write_finish(struct task_struct *task, bool locked) __releases(&cgroup_threadgroup_rwsem); diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index c6822bf6c918..fed5bf717ce1 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -501,7 +501,7 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, if (!cgrp) return -ENODEV; - task = cgroup_procs_write_start(buf, threadgroup, &locked); + task = cgroup_procs_write_start(buf, threadgroup, &locked, cgrp); ret = PTR_ERR_OR_ZERO(task); if (ret) goto out_unlock; diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index c827832ff7a2..7ccbfa771e0c 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2920,10 +2920,12 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, } struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, - bool *threadgroup_locked) + bool *threadgroup_locked, + struct cgroup *dst_cgrp) { struct task_struct *tsk; pid_t pid; + bool force_migration = false; if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) return ERR_PTR(-EINVAL); @@ -2954,13 +2956,16 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, if (threadgroup) tsk = tsk->group_leader; + if (tsk->flags & PF_KTHREAD) + trace_android_rvh_cgroup_force_kthread_migration(tsk, dst_cgrp, &force_migration); + /* * kthreads may acquire PF_NO_SETAFFINITY during initialization. * If userland migrates such a kthread to a non-root cgroup, it can * become trapped in a cpuset, or RT kthread may be born in a * cgroup with no rt_runtime allocated. Just say no. */ - if (tsk->no_cgroup_migration || (tsk->flags & PF_NO_SETAFFINITY)) { + if (!force_migration && (tsk->no_cgroup_migration || (tsk->flags & PF_NO_SETAFFINITY))) { tsk = ERR_PTR(-EINVAL); goto out_unlock_threadgroup; } @@ -5147,7 +5152,7 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf, if (!dst_cgrp) return -ENODEV; - task = cgroup_procs_write_start(buf, threadgroup, &threadgroup_locked); + task = cgroup_procs_write_start(buf, threadgroup, &threadgroup_locked, dst_cgrp); ret = PTR_ERR_OR_ZERO(task); if (ret) goto out_unlock; From 5b0878fc616a66f63c0a84821591ff37ae133d7f Mon Sep 17 00:00:00 2001 From: Stephen Dickey Date: Thu, 24 Aug 2023 11:30:19 -0700 Subject: [PATCH 033/113] ANDROID: abi_gki_aarch64_qcom: update abi symbols Add android_rvh_cgroup_force_migration and other symbols. Symbols added: __traceiter_android_rvh_cgroup_force_kthread_migration __tracepoint_android_rvh_cgroup_force_kthread_migration Bug: 184594949 Change-Id: I8ffed8f422a33f141edc95d1b65a07b8fe30b424 Signed-off-by: Stephen Dickey --- android/abi_gki_aarch64.stg | 28 ++++++++++++++++++++++++++++ android/abi_gki_aarch64_qcom | 20 ++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 4bd2671ae57a..2f22d2576de3 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -313155,6 +313155,14 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x141e84b4 } +function { + id: 0x9bddb3a2 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x1d19a9d5 + parameter_id: 0x18a16691 + parameter_id: 0x11cfee5a +} function { id: 0x9bddb929 return_type_id: 0x6720d32f @@ -327154,6 +327162,15 @@ elf_symbol { type_id: 0x9bc25990 full_name: "__traceiter_android_rvh_can_migrate_task" } +elf_symbol { + id: 0xbbd04d50 + name: "__traceiter_android_rvh_cgroup_force_kthread_migration" + is_defined: true + symbol_type: FUNCTION + crc: 0x94b3e68f + type_id: 0x9bddb3a2 + full_name: "__traceiter_android_rvh_cgroup_force_kthread_migration" +} elf_symbol { id: 0xc93c7d6d name: "__traceiter_android_rvh_check_preempt_tick" @@ -330448,6 +330465,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_rvh_can_migrate_task" } +elf_symbol { + id: 0xb208306e + name: "__tracepoint_android_rvh_cgroup_force_kthread_migration" + is_defined: true + symbol_type: OBJECT + crc: 0x0c180285 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_rvh_cgroup_force_kthread_migration" +} elf_symbol { id: 0x60b5a917 name: "__tracepoint_android_rvh_check_preempt_tick" @@ -385827,6 +385853,7 @@ interface { symbol_id: 0x144db0a1 symbol_id: 0x192bbbd5 symbol_id: 0xadc13d20 + symbol_id: 0xbbd04d50 symbol_id: 0xc93c7d6d symbol_id: 0x9d00b8f0 symbol_id: 0x5e9397c4 @@ -386193,6 +386220,7 @@ interface { symbol_id: 0xd7757253 symbol_id: 0x1e8a7e23 symbol_id: 0xfe3875f6 + symbol_id: 0xb208306e symbol_id: 0x60b5a917 symbol_id: 0x1dd402e6 symbol_id: 0x070d1e2a diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index fcebe5582b85..dfbadd704176 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -342,6 +342,7 @@ copy_from_kernel_nofault copy_page __copy_overflow + copy_page _copy_to_iter __cpu_active_mask cpu_bit_bitmap @@ -667,6 +668,7 @@ devm_rtc_allocate_device __devm_rtc_register_device devm_snd_soc_register_card + devm_snd_soc_register_component devm_thermal_of_cooling_device_register devm_thermal_of_zone_register devm_usb_get_phy_by_node @@ -854,8 +856,11 @@ drm_atomic_helper_commit_modeset_enables drm_atomic_helper_commit_planes __drm_atomic_helper_connector_destroy_state + drm_atomic_helper_connector_destroy_state __drm_atomic_helper_connector_duplicate_state + drm_atomic_helper_connector_duplicate_state __drm_atomic_helper_connector_reset + drm_atomic_helper_connector_reset __drm_atomic_helper_crtc_destroy_state __drm_atomic_helper_crtc_duplicate_state drm_atomic_helper_dirtyfb @@ -929,6 +934,7 @@ drm_dev_register drm_dev_unregister drm_display_mode_from_cea_vic + drm_do_get_edid drm_edid_duplicate drm_edid_get_monitor_name drm_edid_is_valid @@ -1331,6 +1337,7 @@ hci_uart_unregister_device hci_unregister_cb hci_unregister_dev + hdmi_audio_infoframe_init hex2bin hex_asc_upper hex_dump_to_buffer @@ -1900,9 +1907,13 @@ migrate_pages migrate_swap __migrate_task + mipi_dsi_attach mipi_dsi_create_packet mipi_dsi_dcs_set_display_brightness mipi_dsi_dcs_set_tear_off + mipi_dsi_detach + mipi_dsi_device_register_full + mipi_dsi_device_unregister mipi_dsi_host_register mipi_dsi_host_unregister misc_deregister @@ -2980,6 +2991,8 @@ smp_call_function_single smp_call_function_single_async snapshot_get_image_size + snd_ctl_add + snd_ctl_new1 snd_ctl_remove snd_hwdep_new snd_info_create_card_entry @@ -2988,7 +3001,12 @@ snd_info_register snd_interval_refine snd_jack_set_key + snd_pcm_add_chmap_ctls + snd_pcm_create_iec958_consumer_default + snd_pcm_fill_iec958_consumer + snd_pcm_fill_iec958_consumer_hw_params snd_pcm_format_width + snd_pcm_hw_constraint_eld _snd_pcm_hw_params_any snd_pcm_set_managed_buffer snd_pcm_std_chmaps @@ -3269,6 +3287,7 @@ __traceiter_android_rvh_before_do_sched_yield __traceiter_android_rvh_build_perf_domains __traceiter_android_rvh_can_migrate_task + __traceiter_android_rvh_cgroup_force_kthread_migration __traceiter_android_rvh_check_preempt_tick __traceiter_android_rvh_check_preempt_wakeup __traceiter_android_rvh_check_preempt_wakeup_ignore @@ -3413,6 +3432,7 @@ __tracepoint_android_rvh_before_do_sched_yield __tracepoint_android_rvh_build_perf_domains __tracepoint_android_rvh_can_migrate_task + __tracepoint_android_rvh_cgroup_force_kthread_migration __tracepoint_android_rvh_check_preempt_tick __tracepoint_android_rvh_check_preempt_wakeup __tracepoint_android_rvh_check_preempt_wakeup_ignore From f4ba064f766bcdc4fa55effbde1db7c85c461330 Mon Sep 17 00:00:00 2001 From: valis Date: Sat, 29 Jul 2023 08:32:01 -0400 Subject: [PATCH 034/113] UPSTREAM: net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free [ Upstream commit 76e42ae831991c828cffa8c37736ebfb831ad5ec ] When fw_change() is called on an existing filter, the whole tcf_result struct is always copied into the new instance of the filter. This causes a problem when updating a filter bound to a class, as tcf_unbind_filter() is always called on the old instance in the success path, decreasing filter_cnt of the still referenced class and allowing it to be deleted, leading to a use-after-free. Fix this by no longer copying the tcf_result struct from the old filter. Bug: 296347075 Fixes: e35a8ee5993b ("net: sched: fw use RCU") Reported-by: valis Reported-by: Bing-Jhong Billy Jheng Signed-off-by: valis Signed-off-by: Jamal Hadi Salim Reviewed-by: Victor Nogueira Reviewed-by: Pedro Tammela Reviewed-by: M A Ramdhan Link: https://lore.kernel.org/r/20230729123202.72406-3-jhs@mojatatu.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin (cherry picked from commit 7f691439b29be0aae68f83ad5eecfddc11007724) Signed-off-by: Lee Jones Change-Id: I33c91c83d1cd8e889a7261adfa3779ca6c141088 --- net/sched/cls_fw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 1212b057b129..6160ef7d646a 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c @@ -265,7 +265,6 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, return -ENOBUFS; fnew->id = f->id; - fnew->res = f->res; fnew->ifindex = f->ifindex; fnew->tp = f->tp; From 0adc759b0c59e7346ee347ed77db89bea5b01e3f Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Thu, 13 Jul 2023 21:59:37 +0900 Subject: [PATCH 035/113] UPSTREAM: exfat: check if filename entries exceeds max filename length [ Upstream commit d42334578eba1390859012ebb91e1e556d51db49 ] exfat_extract_uni_name copies characters from a given file name entry into the 'uniname' variable. This variable is actually defined on the stack of the exfat_readdir() function. According to the definition of the 'exfat_uni_name' type, the file name should be limited 255 characters (+ null teminator space), but the exfat_get_uniname_from_ext_entry() function can write more characters because there is no check if filename entries exceeds max filename length. This patch add the check not to copy filename characters when exceeding max filename length. Bug: 296393077 Cc: stable@vger.kernel.org Cc: Yuezhang Mo Reported-by: Maxim Suhanov Reviewed-by: Sungjong Seo Signed-off-by: Namjae Jeon Signed-off-by: Sasha Levin (cherry picked from commit c2fdf827f8fc6a571e1b7cc38a61041f0321adf5) Signed-off-by: Lee Jones Change-Id: I57a9ab007a5eac9c3415aa460df324c9044908c0 --- fs/exfat/dir.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index 15c4f901be36..33100904c951 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -34,6 +34,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, { int i; struct exfat_entry_set_cache *es; + unsigned int uni_len = 0, len; es = exfat_get_dentry_set(sb, p_dir, entry, ES_ALL_ENTRIES); if (!es) @@ -52,7 +53,10 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb, if (exfat_get_entry_type(ep) != TYPE_EXTEND) break; - exfat_extract_uni_name(ep, uniname); + len = exfat_extract_uni_name(ep, uniname); + uni_len += len; + if (len != EXFAT_FILE_NAME_LEN || uni_len >= MAX_NAME_LENGTH) + break; uniname += EXFAT_FILE_NAME_LEN; } @@ -1027,7 +1031,8 @@ rewind: if (entry_type == TYPE_EXTEND) { unsigned short entry_uniname[16], unichar; - if (step != DIRENT_STEP_NAME) { + if (step != DIRENT_STEP_NAME || + name_len >= MAX_NAME_LENGTH) { step = DIRENT_STEP_FILE; continue; } From ec1f17ddac622f90f63bf8316997c57ade22f28f Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 31 Jul 2023 18:42:36 +0200 Subject: [PATCH 036/113] UPSTREAM: net: tun_chr_open(): set sk_uid from current_fsuid() commit 9bc3047374d5bec163e83e743709e23753376f0c upstream. Commit a096ccca6e50 initializes the "sk_uid" field in the protocol socket (struct sock) from the "/dev/net/tun" device node's owner UID. Per original commit 86741ec25462 ("net: core: Add a UID field to struct sock.", 2016-11-04), that's wrong: the idea is to cache the UID of the userspace process that creates the socket. Commit 86741ec25462 mentions socket() and accept(); with "tun", the action that creates the socket is open("/dev/net/tun"). Therefore the device node's owner UID is irrelevant. In most cases, "/dev/net/tun" will be owned by root, so in practice, commit a096ccca6e50 has no observable effect: - before, "sk_uid" would be zero, due to undefined behavior (CVE-2023-1076), - after, "sk_uid" would be zero, due to "/dev/net/tun" being owned by root. What matters is the (fs)UID of the process performing the open(), so cache that in "sk_uid". Bug: 295995961 Cc: Eric Dumazet Cc: Lorenzo Colitti Cc: Paolo Abeni Cc: Pietro Borrello Cc: netdev@vger.kernel.org Cc: stable@vger.kernel.org Fixes: a096ccca6e50 ("tun: tun_chr_open(): correctly initialize socket uid") Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2173435 Signed-off-by: Laszlo Ersek Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman (cherry picked from commit b6846d7c408b33e4701f4f5ca28932e2a08e0a2e) Signed-off-by: Lee Jones Change-Id: I2540ac5876ca7dad39e1b867a5e09a5c9c69bb86 --- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 91d198aff2f9..fa1d58fd741a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -3449,7 +3449,7 @@ static int tun_chr_open(struct inode *inode, struct file * file) tfile->socket.file = file; tfile->socket.ops = &tun_socket_ops; - sock_init_data_uid(&tfile->socket, &tfile->sk, inode->i_uid); + sock_init_data_uid(&tfile->socket, &tfile->sk, current_fsuid()); tfile->sk.sk_write_space = tun_sock_write_space; tfile->sk.sk_sndbuf = INT_MAX; From e0c4636bd23926da6e8db91f100e06d8baac4e24 Mon Sep 17 00:00:00 2001 From: valis Date: Sat, 29 Jul 2023 08:32:02 -0400 Subject: [PATCH 037/113] UPSTREAM: net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free [ Upstream commit b80b829e9e2c1b3f7aae34855e04d8f6ecaf13c8 ] When route4_change() is called on an existing filter, the whole tcf_result struct is always copied into the new instance of the filter. This causes a problem when updating a filter bound to a class, as tcf_unbind_filter() is always called on the old instance in the success path, decreasing filter_cnt of the still referenced class and allowing it to be deleted, leading to a use-after-free. Fix this by no longer copying the tcf_result struct from the old filter. Bug: 296347075 Fixes: 1109c00547fc ("net: sched: RCU cls_route") Reported-by: valis Reported-by: Bing-Jhong Billy Jheng Signed-off-by: valis Signed-off-by: Jamal Hadi Salim Reviewed-by: Victor Nogueira Reviewed-by: Pedro Tammela Reviewed-by: M A Ramdhan Link: https://lore.kernel.org/r/20230729123202.72406-4-jhs@mojatatu.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin (cherry picked from commit d4d3b53a4c66004e8e864fea744b3a2b86a73b62) Signed-off-by: Lee Jones Change-Id: Iefbd201b92847ec1349f92c107d7ef5aec3fb359 --- net/sched/cls_route.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 9e43b929d4ca..306188bf2d1f 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c @@ -511,7 +511,6 @@ static int route4_change(struct net *net, struct sk_buff *in_skb, if (fold) { f->id = fold->id; f->iif = fold->iif; - f->res = fold->res; f->handle = fold->handle; f->tp = fold->tp; From beaffb638b34ba2ccd4cf35848bbb96b74bcd9d2 Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Tue, 11 Apr 2023 10:02:58 +0800 Subject: [PATCH 038/113] FROMLIST: docs: geniezone: Introduce GenieZone hypervisor GenieZone is MediaTek proprietary hypervisor solution, and it is running in EL2 stand alone as a type-I hypervisor. It is a pure EL2 implementation which implies it does not rely any specific host VM, and this behavior improves GenieZone's security as it limits its interface. Change-Id: I8326093b5be79af5f87285fc74ee0cd7f5827808 Signed-off-by: Yingshiuan Pan Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-2-yi-de.wu@mediatek.com/ --- Documentation/virt/geniezone/introduction.rst | 86 +++++++++++++++++++ Documentation/virt/index.rst | 1 + MAINTAINERS | 6 ++ 3 files changed, 93 insertions(+) create mode 100644 Documentation/virt/geniezone/introduction.rst diff --git a/Documentation/virt/geniezone/introduction.rst b/Documentation/virt/geniezone/introduction.rst new file mode 100644 index 000000000000..fb9fa41bcfb8 --- /dev/null +++ b/Documentation/virt/geniezone/introduction.rst @@ -0,0 +1,86 @@ +.. SPDX-License-Identifier: GPL-2.0 + +====================== +GenieZone Introduction +====================== + +Overview +======== +GenieZone hypervisor(gzvm) is a type-1 hypervisor that supports various virtual +machine types and provides security features such as TEE-like scenarios and +secure boot. It can create guest VMs for security use cases and has +virtualization capabilities for both platform and interrupt. Although the +hypervisor can be booted independently, it requires the assistance of GenieZone +hypervisor kernel driver(gzvm-ko) to leverage the ability of Linux kernel for +vCPU scheduling, memory management, inter-VM communication and virtio backend +support. + +Supported Architecture +====================== +GenieZone now only supports MediaTek ARM64 SoC. + +Features +======== + +- vCPU Management + +VM manager aims to provide vCPUs on the basis of time sharing on physical CPUs. +It requires Linux kernel in host VM for vCPU scheduling and VM power management. + +- Memory Management + +Direct use of physical memory from VMs is forbidden and designed to be dictated +to the privilege models managed by GenieZone hypervisor for security reason. +With the help of gzvm-ko, the hypervisor would be able to manipulate memory as +objects. + +- Virtual Platform + +We manage to emulate a virtual mobile platform for guest OS running on guest +VM. The platform supports various architecture-defined devices, such as +virtual arch timer, GIC, MMIO, PSCI, and exception watching...etc. + +- Inter-VM Communication + +Communication among guest VMs was provided mainly on RPC. More communication +mechanisms were to be provided in the future based on VirtIO-vsock. + +- Device Virtualization + +The solution is provided using the well-known VirtIO. The gzvm-ko would +redirect MMIO traps back to VMM where the virtual devices are mostly emulated. +Ioeventfd is implemented using eventfd for signaling host VM that some IO +events in guest VMs need to be processed. + +- Interrupt virtualization + +All Interrupts during some guest VMs running would be handled by GenieZone +hypervisor with the help of gzvm-ko, both virtual and physical ones. In case +there's no guest VM running out there, physical interrupts would be handled by +host VM directly for performance reason. Irqfd is also implemented using +eventfd for accepting vIRQ requests in gzvm-ko. + +Platform architecture component +=============================== + +- vm + +The vm component is responsible for setting up the capability and memory +management for the protected VMs. The capability is mainly about the lifecycle +control and boot context initialization. And the memory management is highly +integrated with ARM 2-stage translation tables to convert VA to IPA to PA under +proper security measures required by protected VMs. + +- vcpu + +The vcpu component is the core of virtualizing aarch64 physical CPU runnable, +and it controls the vCPU lifecycle including creating, running and destroying. +With self-defined exit handler, the vm component would be able to act +accordingly before terminated. + +- vgic + +The vgic component exposes control interfaces to Linux kernel via irqchip, and +we intend to support all SPI, PPI, and SGI. When it comes to virtual +interrupts, the GenieZone hypervisor would write to list registers and trigger +vIRQ injection in guest VMs via GIC. diff --git a/Documentation/virt/index.rst b/Documentation/virt/index.rst index 418d540f5484..9e73018d6a8c 100644 --- a/Documentation/virt/index.rst +++ b/Documentation/virt/index.rst @@ -16,6 +16,7 @@ Linux Virtualization Support coco/sev-guest hyperv/index gunyah/index + geniezone/introduction .. only:: html and subproject diff --git a/MAINTAINERS b/MAINTAINERS index 2e0a79e6f4ce..eb6408c70edd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8665,6 +8665,12 @@ F: include/vdso/ F: kernel/time/vsyscall.c F: lib/vdso/ +GENIEZONE HYPERVISOR DRIVER +M: Yingshiuan Pan +M: Ze-Yu Wang +M: Yi-De Wu +F: Documentation/virt/geniezone/ + GENWQE (IBM Generic Workqueue Card) M: Frank Haverkamp S: Supported From 40107a00813ad2c855293959932c5b99611501a6 Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Tue, 11 Apr 2023 10:03:08 +0800 Subject: [PATCH 039/113] FROMLIST: dt-bindings: hypervisor: Add MediaTek GenieZone hypervisor Add documentation for GenieZone(gzvm) node. This node informs gzvm driver to start probing if geniezone hypervisor is available and able to do virtual machine operations. Change-Id: Ie448a33b8981ee25fe36231a10af5c1372d23012 Signed-off-by: Yingshiuan Pan Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-3-yi-de.wu@mediatek.com/ --- .../hypervisor/mediatek,geniezone-hyp.yaml | 31 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml diff --git a/Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml b/Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml new file mode 100644 index 000000000000..ab89a4c310cb --- /dev/null +++ b/Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hypervisor/mediatek,geniezone-hyp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek GenieZone hypervisor + +maintainers: + - Yingshiuan Pan + +description: + This interface is designed for integrating GenieZone hypervisor into Android + Virtualization Framework(AVF) along with Crosvm as a VMM. + It acts like a wrapper for every hypercall to GenieZone hypervisor in + order to control guest VM lifecycles and virtual interrupt injections. + +properties: + compatible: + const: mediatek,geniezone-hyp + +required: + - compatible + +additionalProperties: false + +examples: + - | + hypervisor { + compatible = "mediatek,geniezone-hyp"; + }; diff --git a/MAINTAINERS b/MAINTAINERS index eb6408c70edd..826f939ea8f1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8669,6 +8669,7 @@ GENIEZONE HYPERVISOR DRIVER M: Yingshiuan Pan M: Ze-Yu Wang M: Yi-De Wu +F: Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml F: Documentation/virt/geniezone/ GENWQE (IBM Generic Workqueue Card) From 6ce86d075eb9b014326525953b501a9010968b72 Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Wed, 19 Apr 2023 23:50:58 -0600 Subject: [PATCH 040/113] FROMLIST: virt: geniezone: Add GenieZone hypervisor support GenieZone is MediaTek hypervisor solution, and it is running in EL2 stand alone as a type-I hypervisor. This patch exports a set of ioctl interfaces for userspace VMM (e.g., crosvm) to operate guest VMs lifecycle (creation and destroy) on GenieZone. Change-Id: I4fbc79bab120fe5ad90e2832f70562e97bbf40c0 Signed-off-by: Yingshiuan Pan Signed-off-by: Jerry Wang Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-4-yi-de.wu@mediatek.com/ --- MAINTAINERS | 6 + arch/arm64/Kbuild | 1 + arch/arm64/geniezone/Makefile | 9 + arch/arm64/geniezone/gzvm_arch_common.h | 68 ++++ arch/arm64/geniezone/vm.c | 212 +++++++++++++ arch/arm64/include/uapi/asm/gzvm_arch.h | 20 ++ drivers/virt/Kconfig | 2 + drivers/virt/geniezone/Kconfig | 16 + drivers/virt/geniezone/Makefile | 10 + drivers/virt/geniezone/gzvm_main.c | 142 +++++++++ drivers/virt/geniezone/gzvm_vm.c | 400 ++++++++++++++++++++++++ include/linux/gzvm_drv.h | 91 ++++++ include/uapi/asm-generic/Kbuild | 1 + include/uapi/asm-generic/gzvm_arch.h | 10 + include/uapi/linux/gzvm.h | 76 +++++ 15 files changed, 1064 insertions(+) create mode 100644 arch/arm64/geniezone/Makefile create mode 100644 arch/arm64/geniezone/gzvm_arch_common.h create mode 100644 arch/arm64/geniezone/vm.c create mode 100644 arch/arm64/include/uapi/asm/gzvm_arch.h create mode 100644 drivers/virt/geniezone/Kconfig create mode 100644 drivers/virt/geniezone/Makefile create mode 100644 drivers/virt/geniezone/gzvm_main.c create mode 100644 drivers/virt/geniezone/gzvm_vm.c create mode 100644 include/linux/gzvm_drv.h create mode 100644 include/uapi/asm-generic/gzvm_arch.h create mode 100644 include/uapi/linux/gzvm.h diff --git a/MAINTAINERS b/MAINTAINERS index 826f939ea8f1..f0e039fe78bb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8671,6 +8671,12 @@ M: Ze-Yu Wang M: Yi-De Wu F: Documentation/devicetree/bindings/hypervisor/mediatek,geniezone-hyp.yaml F: Documentation/virt/geniezone/ +F: arch/arm64/geniezone/ +F: arch/arm64/include/uapi/asm/gzvm_arch.h +F: drivers/virt/geniezone/ +F: include/linux/gzvm_drv.h +F include/uapi/asm-generic/gzvm_arch.h +F: include/uapi/linux/gzvm.h GENWQE (IBM Generic Workqueue Card) M: Frank Haverkamp diff --git a/arch/arm64/Kbuild b/arch/arm64/Kbuild index e4847ba0e3c9..ddcb496ce66c 100644 --- a/arch/arm64/Kbuild +++ b/arch/arm64/Kbuild @@ -5,6 +5,7 @@ obj-$(CONFIG_XEN) += xen/ obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/ obj-$(CONFIG_GUNYAH) += gunyah/ obj-$(CONFIG_CRYPTO) += crypto/ +obj-$(CONFIG_MTK_GZVM) += geniezone/ # for cleaning subdir- += boot diff --git a/arch/arm64/geniezone/Makefile b/arch/arm64/geniezone/Makefile new file mode 100644 index 000000000000..2957898cdd05 --- /dev/null +++ b/arch/arm64/geniezone/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Main Makefile for gzvm, this one includes drivers/virt/geniezone/Makefile +# +include $(srctree)/drivers/virt/geniezone/Makefile + +gzvm-y += vm.o + +obj-$(CONFIG_MTK_GZVM) += gzvm.o diff --git a/arch/arm64/geniezone/gzvm_arch_common.h b/arch/arm64/geniezone/gzvm_arch_common.h new file mode 100644 index 000000000000..fdb95d619102 --- /dev/null +++ b/arch/arm64/geniezone/gzvm_arch_common.h @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#ifndef __GZVM_ARCH_COMMON_H__ +#define __GZVM_ARCH_COMMON_H__ + +#include + +enum { + GZVM_FUNC_CREATE_VM = 0, + GZVM_FUNC_DESTROY_VM = 1, + GZVM_FUNC_CREATE_VCPU = 2, + GZVM_FUNC_DESTROY_VCPU = 3, + GZVM_FUNC_SET_MEMREGION = 4, + GZVM_FUNC_RUN = 5, + GZVM_FUNC_GET_ONE_REG = 8, + GZVM_FUNC_SET_ONE_REG = 9, + GZVM_FUNC_IRQ_LINE = 10, + GZVM_FUNC_CREATE_DEVICE = 11, + GZVM_FUNC_PROBE = 12, + GZVM_FUNC_ENABLE_CAP = 13, + NR_GZVM_FUNC, +}; + +#define SMC_ENTITY_MTK 59 +#define GZVM_FUNCID_START (0x1000) +#define GZVM_HCALL_ID(func) \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, \ + SMC_ENTITY_MTK, (GZVM_FUNCID_START + (func))) + +#define MT_HVC_GZVM_CREATE_VM GZVM_HCALL_ID(GZVM_FUNC_CREATE_VM) +#define MT_HVC_GZVM_DESTROY_VM GZVM_HCALL_ID(GZVM_FUNC_DESTROY_VM) +#define MT_HVC_GZVM_CREATE_VCPU GZVM_HCALL_ID(GZVM_FUNC_CREATE_VCPU) +#define MT_HVC_GZVM_DESTROY_VCPU GZVM_HCALL_ID(GZVM_FUNC_DESTROY_VCPU) +#define MT_HVC_GZVM_SET_MEMREGION GZVM_HCALL_ID(GZVM_FUNC_SET_MEMREGION) +#define MT_HVC_GZVM_RUN GZVM_HCALL_ID(GZVM_FUNC_RUN) +#define MT_HVC_GZVM_GET_ONE_REG GZVM_HCALL_ID(GZVM_FUNC_GET_ONE_REG) +#define MT_HVC_GZVM_SET_ONE_REG GZVM_HCALL_ID(GZVM_FUNC_SET_ONE_REG) +#define MT_HVC_GZVM_IRQ_LINE GZVM_HCALL_ID(GZVM_FUNC_IRQ_LINE) +#define MT_HVC_GZVM_CREATE_DEVICE GZVM_HCALL_ID(GZVM_FUNC_CREATE_DEVICE) +#define MT_HVC_GZVM_PROBE GZVM_HCALL_ID(GZVM_FUNC_PROBE) +#define MT_HVC_GZVM_ENABLE_CAP GZVM_HCALL_ID(GZVM_FUNC_ENABLE_CAP) + +/** + * gzvm_hypcall_wrapper() - the wrapper for hvc calls + * @a0-a7: arguments passed in registers 0 to 7 + * @res: result values from registers 0 to 3 + * + * Return: The wrapper helps caller to convert geniezone errno to Linux errno. + */ +static inline int gzvm_hypcall_wrapper(unsigned long a0, unsigned long a1, + unsigned long a2, unsigned long a3, + unsigned long a4, unsigned long a5, + unsigned long a6, unsigned long a7, + struct arm_smccc_res *res) +{ + arm_smccc_hvc(a0, a1, a2, a3, a4, a5, a6, a7, res); + return gzvm_err_to_errno(res->a0); +} + +static inline u16 get_vmid_from_tuple(unsigned int tuple) +{ + return (u16)(tuple >> 16); +} + +#endif /* __GZVM_ARCH_COMMON_H__ */ diff --git a/arch/arm64/geniezone/vm.c b/arch/arm64/geniezone/vm.c new file mode 100644 index 000000000000..e35751b21821 --- /dev/null +++ b/arch/arm64/geniezone/vm.c @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include + +#include +#include +#include "gzvm_arch_common.h" + +#define PAR_PA47_MASK ((((1UL << 48) - 1) >> 12) << 12) + +int gzvm_arch_probe(void) +{ + struct arm_smccc_res res; + + arm_smccc_hvc(MT_HVC_GZVM_PROBE, 0, 0, 0, 0, 0, 0, 0, &res); + if (res.a0 == 0) + return 0; + + return -ENXIO; +} + +int gzvm_arch_set_memregion(u16 vm_id, size_t buf_size, + phys_addr_t region) +{ + struct arm_smccc_res res; + + return gzvm_hypcall_wrapper(MT_HVC_GZVM_SET_MEMREGION, vm_id, + buf_size, region, 0, 0, 0, 0, &res); +} + +static int gzvm_cap_arm_vm_ipa_size(void __user *argp) +{ + __u64 value = CONFIG_ARM64_PA_BITS; + + if (copy_to_user(argp, &value, sizeof(__u64))) + return -EFAULT; + + return 0; +} + +int gzvm_arch_check_extension(struct gzvm *gzvm, __u64 cap, void __user *argp) +{ + int ret = -EOPNOTSUPP; + + switch (cap) { + case GZVM_CAP_ARM_PROTECTED_VM: { + __u64 success = 1; + + if (copy_to_user(argp, &success, sizeof(__u64))) + return -EFAULT; + ret = 0; + break; + } + case GZVM_CAP_ARM_VM_IPA_SIZE: { + ret = gzvm_cap_arm_vm_ipa_size(argp); + break; + } + default: + ret = -EOPNOTSUPP; + } + + return ret; +} + +/** + * gzvm_arch_create_vm() - create vm + * @vm_type: VM type. Only supports Linux VM now. + * + * Return: + * * positive value - VM ID + * * -ENOMEM - Memory not enough for storing VM data + */ +int gzvm_arch_create_vm(unsigned long vm_type) +{ + struct arm_smccc_res res; + int ret; + + ret = gzvm_hypcall_wrapper(MT_HVC_GZVM_CREATE_VM, vm_type, 0, 0, 0, 0, + 0, 0, &res); + + if (ret == 0) + return res.a1; + else + return ret; +} + +int gzvm_arch_destroy_vm(u16 vm_id) +{ + struct arm_smccc_res res; + + return gzvm_hypcall_wrapper(MT_HVC_GZVM_DESTROY_VM, vm_id, 0, 0, 0, 0, + 0, 0, &res); +} + +static int gzvm_vm_arch_enable_cap(struct gzvm *gzvm, + struct gzvm_enable_cap *cap, + struct arm_smccc_res *res) +{ + return gzvm_hypcall_wrapper(MT_HVC_GZVM_ENABLE_CAP, gzvm->vm_id, + cap->cap, cap->args[0], cap->args[1], + cap->args[2], cap->args[3], cap->args[4], + res); +} + +/** + * gzvm_vm_ioctl_get_pvmfw_size() - Get pvmfw size from hypervisor, return + * in x1, and return to userspace in args + * @gzvm: Pointer to struct gzvm. + * @cap: Pointer to struct gzvm_enable_cap. + * @argp: Pointer to struct gzvm_enable_cap in user space. + * + * Return: + * * 0 - Succeed + * * -EINVAL - Hypervisor return invalid results + * * -EFAULT - Fail to copy back to userspace buffer + */ +static int gzvm_vm_ioctl_get_pvmfw_size(struct gzvm *gzvm, + struct gzvm_enable_cap *cap, + void __user *argp) +{ + struct arm_smccc_res res = {0}; + + if (gzvm_vm_arch_enable_cap(gzvm, cap, &res) != 0) + return -EINVAL; + + cap->args[1] = res.a1; + if (copy_to_user(argp, cap, sizeof(*cap))) + return -EFAULT; + + return 0; +} + +/** + * gzvm_vm_ioctl_cap_pvm() - Proceed GZVM_CAP_ARM_PROTECTED_VM's subcommands + * @gzvm: Pointer to struct gzvm. + * @cap: Pointer to struct gzvm_enable_cap. + * @argp: Pointer to struct gzvm_enable_cap in user space. + * + * Return: + * * 0 - Succeed + * * -EINVAL - Invalid subcommand or arguments + */ +static int gzvm_vm_ioctl_cap_pvm(struct gzvm *gzvm, + struct gzvm_enable_cap *cap, + void __user *argp) +{ + int ret = -EINVAL; + struct arm_smccc_res res = {0}; + + switch (cap->args[0]) { + case GZVM_CAP_ARM_PVM_SET_PVMFW_IPA: + fallthrough; + case GZVM_CAP_ARM_PVM_SET_PROTECTED_VM: + ret = gzvm_vm_arch_enable_cap(gzvm, cap, &res); + break; + case GZVM_CAP_ARM_PVM_GET_PVMFW_SIZE: + ret = gzvm_vm_ioctl_get_pvmfw_size(gzvm, cap, argp); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +int gzvm_vm_ioctl_arch_enable_cap(struct gzvm *gzvm, + struct gzvm_enable_cap *cap, + void __user *argp) +{ + int ret = -EINVAL; + + switch (cap->cap) { + case GZVM_CAP_ARM_PROTECTED_VM: + ret = gzvm_vm_ioctl_cap_pvm(gzvm, cap, argp); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +/** + * gzvm_hva_to_pa_arch() - converts hva to pa with arch-specific way + * @hva: Host virtual address. + * + * Return: 0 if translation error + */ +u64 gzvm_hva_to_pa_arch(u64 hva) +{ + u64 par; + unsigned long flags; + + local_irq_save(flags); + asm volatile("at s1e1r, %0" :: "r" (hva)); + isb(); + par = read_sysreg_par(); + local_irq_restore(flags); + + if (par & SYS_PAR_EL1_F) + return 0; + + return par & PAR_PA47_MASK; +} diff --git a/arch/arm64/include/uapi/asm/gzvm_arch.h b/arch/arm64/include/uapi/asm/gzvm_arch.h new file mode 100644 index 000000000000..847bb627a65d --- /dev/null +++ b/arch/arm64/include/uapi/asm/gzvm_arch.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#ifndef __GZVM_ARCH_H__ +#define __GZVM_ARCH_H__ + +#include + +#define GZVM_CAP_ARM_VM_IPA_SIZE 165 +#define GZVM_CAP_ARM_PROTECTED_VM 0xffbadab1 + +/* sub-commands put in args[0] for GZVM_CAP_ARM_PROTECTED_VM */ +#define GZVM_CAP_ARM_PVM_SET_PVMFW_IPA 0 +#define GZVM_CAP_ARM_PVM_GET_PVMFW_SIZE 1 +/* GZVM_CAP_ARM_PVM_SET_PROTECTED_VM only sets protected but not load pvmfw */ +#define GZVM_CAP_ARM_PVM_SET_PROTECTED_VM 2 + +#endif /* __GZVM_ARCH_H__ */ diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig index c39409b69d01..41440e116e71 100644 --- a/drivers/virt/Kconfig +++ b/drivers/virt/Kconfig @@ -54,4 +54,6 @@ source "drivers/virt/coco/sev-guest/Kconfig" source "drivers/virt/gunyah/Kconfig" +source "drivers/virt/geniezone/Kconfig" + endif diff --git a/drivers/virt/geniezone/Kconfig b/drivers/virt/geniezone/Kconfig new file mode 100644 index 000000000000..2643fb8913cc --- /dev/null +++ b/drivers/virt/geniezone/Kconfig @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config MTK_GZVM + tristate "GenieZone Hypervisor driver for guest VM operation" + depends on ARM64 + help + This driver, gzvm, enables to run guest VMs on MTK GenieZone + hypervisor. It exports kvm-like interfaces for VMM (e.g., crosvm) in + order to operate guest VMs on GenieZone hypervisor. + + GenieZone hypervisor now only supports MediaTek SoC and arm64 + architecture. + + Select M if you want it be built as a module (gzvm.ko). + + If unsure, say N. diff --git a/drivers/virt/geniezone/Makefile b/drivers/virt/geniezone/Makefile new file mode 100644 index 000000000000..066efddc0b9c --- /dev/null +++ b/drivers/virt/geniezone/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for GenieZone driver, this file should be include in arch's +# to avoid two ko being generated. +# + +GZVM_DIR ?= ../../../drivers/virt/geniezone + +gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o + diff --git a/drivers/virt/geniezone/gzvm_main.c b/drivers/virt/geniezone/gzvm_main.c new file mode 100644 index 000000000000..9168ed251b08 --- /dev/null +++ b/drivers/virt/geniezone/gzvm_main.c @@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * gzvm_err_to_errno() - Convert geniezone return value to standard errno + * + * @err: Return value from geniezone function return + * + * Return: Standard errno + */ +int gzvm_err_to_errno(unsigned long err) +{ + int gz_err = (int)err; + + switch (gz_err) { + case 0: + return 0; + case ERR_NO_MEMORY: + return -ENOMEM; + case ERR_NOT_SUPPORTED: + return -EOPNOTSUPP; + case ERR_NOT_IMPLEMENTED: + return -EOPNOTSUPP; + case ERR_FAULT: + return -EFAULT; + default: + break; + } + + return -EINVAL; +} + +/** + * gzvm_dev_ioctl_check_extension() - Check if given capability is support + * or not + * + * @gzvm: Pointer to struct gzvm + * @args: Pointer in u64 from userspace + * + * Return: + * * 0 - Support, no error + * * -EOPNOTSUPP - Not support + * * -EFAULT - Failed to get data from userspace + */ +long gzvm_dev_ioctl_check_extension(struct gzvm *gzvm, unsigned long args) +{ + __u64 cap; + void __user *argp = (void __user *)args; + + if (copy_from_user(&cap, argp, sizeof(uint64_t))) + return -EFAULT; + return gzvm_arch_check_extension(gzvm, cap, argp); +} + +static long gzvm_dev_ioctl(struct file *filp, unsigned int cmd, + unsigned long user_args) +{ + long ret = -ENOTTY; + + switch (cmd) { + case GZVM_CREATE_VM: + ret = gzvm_dev_ioctl_create_vm(user_args); + break; + case GZVM_CHECK_EXTENSION: + if (!user_args) + return -EINVAL; + ret = gzvm_dev_ioctl_check_extension(NULL, user_args); + break; + default: + ret = -ENOTTY; + } + + return ret; +} + +static const struct file_operations gzvm_chardev_ops = { + .unlocked_ioctl = gzvm_dev_ioctl, + .llseek = noop_llseek, +}; + +static struct miscdevice gzvm_dev = { + .minor = MISC_DYNAMIC_MINOR, + .name = KBUILD_MODNAME, + .fops = &gzvm_chardev_ops, +}; + +static int gzvm_drv_probe(struct platform_device *pdev) +{ + int ret; + + if (gzvm_arch_probe() != 0) { + dev_err(&pdev->dev, "Not found available conduit\n"); + return -ENODEV; + } + + ret = misc_register(&gzvm_dev); + if (ret) + return ret; + + return 0; +} + +static int gzvm_drv_remove(struct platform_device *pdev) +{ + gzvm_destroy_all_vms(); + misc_deregister(&gzvm_dev); + return 0; +} + +static const struct of_device_id gzvm_of_match[] = { + { .compatible = "mediatek,geniezone-hyp", }, + {/* sentinel */}, +}; + +static struct platform_driver gzvm_driver = { + .probe = gzvm_drv_probe, + .remove = gzvm_drv_remove, + .driver = { + .name = KBUILD_MODNAME, + .owner = THIS_MODULE, + .of_match_table = gzvm_of_match, + }, +}; + +module_platform_driver(gzvm_driver); + +MODULE_DEVICE_TABLE(of, gzvm_of_match); +MODULE_AUTHOR("MediaTek"); +MODULE_DESCRIPTION("GenieZone interface for VMM"); +MODULE_LICENSE("GPL"); diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c new file mode 100644 index 000000000000..ee751369fd4b --- /dev/null +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -0,0 +1,400 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_MUTEX(gzvm_list_lock); +static LIST_HEAD(gzvm_list); + +/** + * hva_to_pa_fast() - converts hva to pa in generic fast way + * @hva: Host virtual address. + * + * Return: 0 if translation error + */ +static u64 hva_to_pa_fast(u64 hva) +{ + struct page *page[1]; + + u64 pfn; + + if (get_user_page_fast_only(hva, 0, page)) { + pfn = page_to_phys(page[0]); + put_page((struct page *)page); + return pfn; + } else { + return 0; + } +} + +/** + * hva_to_pa_slow() - note that this function may sleep + * @hva: Host virtual address. + * + * Return: 0 if translation error + */ +static u64 hva_to_pa_slow(u64 hva) +{ + struct page *page; + int npages; + u64 pfn; + + npages = get_user_pages_unlocked(hva, 1, &page, 0); + if (npages != 1) + return 0; + + pfn = page_to_phys(page); + put_page(page); + + return pfn; +} + +static u64 gzvm_gfn_to_hva_memslot(struct gzvm_memslot *memslot, u64 gfn) +{ + u64 offset = gfn - memslot->base_gfn; + + return memslot->userspace_addr + offset * PAGE_SIZE; +} + +static u64 __gzvm_gfn_to_pfn_memslot(struct gzvm_memslot *memslot, u64 gfn) +{ + u64 hva, pa; + + hva = gzvm_gfn_to_hva_memslot(memslot, gfn); + + pa = gzvm_hva_to_pa_arch(hva); + if (pa != 0) + return PHYS_PFN(pa); + + pa = hva_to_pa_fast(hva); + if (pa) + return PHYS_PFN(pa); + + pa = hva_to_pa_slow(hva); + if (pa) + return PHYS_PFN(pa); + + return 0; +} + +/** + * gzvm_gfn_to_pfn_memslot() - Translate gfn (guest ipa) to pfn (host pa), + * result is in @pfn + * @memslot: Pointer to struct gzvm_memslot. + * @gfn: Guest frame number. + * @pfn: Host page frame number. + * + * Return: + * * 0 - Succeed + * * -EFAULT - Failed to convert + */ +static int gzvm_gfn_to_pfn_memslot(struct gzvm_memslot *memslot, u64 gfn, + u64 *pfn) +{ + u64 __pfn; + + if (!memslot) + return -EFAULT; + + __pfn = __gzvm_gfn_to_pfn_memslot(memslot, gfn); + if (__pfn == 0) { + *pfn = 0; + return -EFAULT; + } + + *pfn = __pfn; + + return 0; +} + +/** + * fill_constituents() - Populate pa to buffer until full + * @consti: Pointer to struct mem_region_addr_range. + * @consti_cnt: Constituent count. + * @max_nr_consti: Maximum number of constituent count. + * @gfn: Guest frame number. + * @total_pages: Total page numbers. + * @slot: Pointer to struct gzvm_memslot. + * + * Return: how many pages we've fill in, negative if error + */ +static int fill_constituents(struct mem_region_addr_range *consti, + int *consti_cnt, int max_nr_consti, u64 gfn, + u32 total_pages, struct gzvm_memslot *slot) +{ + u64 pfn, prev_pfn, gfn_end; + int nr_pages = 1; + int i = 0; + + if (unlikely(total_pages == 0)) + return -EINVAL; + gfn_end = gfn + total_pages; + + /* entry 0 */ + if (gzvm_gfn_to_pfn_memslot(slot, gfn, &pfn) != 0) + return -EFAULT; + consti[0].address = PFN_PHYS(pfn); + consti[0].pg_cnt = 1; + gfn++; + prev_pfn = pfn; + + while (i < max_nr_consti && gfn < gfn_end) { + if (gzvm_gfn_to_pfn_memslot(slot, gfn, &pfn) != 0) + return -EFAULT; + if (pfn == (prev_pfn + 1)) { + consti[i].pg_cnt++; + } else { + i++; + if (i >= max_nr_consti) + break; + consti[i].address = PFN_PHYS(pfn); + consti[i].pg_cnt = 1; + } + prev_pfn = pfn; + gfn++; + nr_pages++; + } + if (i != max_nr_consti) + i++; + *consti_cnt = i; + + return nr_pages; +} + +/* register_memslot_addr_range() - Register memory region to GZ */ +static int +register_memslot_addr_range(struct gzvm *gzvm, struct gzvm_memslot *memslot) +{ + struct gzvm_memory_region_ranges *region; + u32 buf_size; + int max_nr_consti, remain_pages; + u64 gfn, gfn_end; + + buf_size = PAGE_SIZE * 2; + region = alloc_pages_exact(buf_size, GFP_KERNEL); + if (!region) + return -ENOMEM; + max_nr_consti = (buf_size - sizeof(*region)) / + sizeof(struct mem_region_addr_range); + + region->slot = memslot->slot_id; + remain_pages = memslot->npages; + gfn = memslot->base_gfn; + gfn_end = gfn + remain_pages; + while (gfn < gfn_end) { + int nr_pages; + + nr_pages = fill_constituents(region->constituents, + ®ion->constituent_cnt, + max_nr_consti, gfn, + remain_pages, memslot); + if (nr_pages < 0) { + pr_err("Failed to fill constituents\n"); + free_pages_exact(region, buf_size); + return nr_pages; + } + region->gpa = PFN_PHYS(gfn); + region->total_pages = nr_pages; + + remain_pages -= nr_pages; + gfn += nr_pages; + + if (gzvm_arch_set_memregion(gzvm->vm_id, buf_size, + virt_to_phys(region))) { + pr_err("Failed to register memregion to hypervisor\n"); + free_pages_exact(region, buf_size); + return -EFAULT; + } + } + free_pages_exact(region, buf_size); + return 0; +} + +/** + * gzvm_vm_ioctl_set_memory_region() - Set memory region of guest + * @gzvm: Pointer to struct gzvm. + * @mem: Input memory region from user. + * + * Return: + * * -EXIO - memslot is out-of-range + * * -EFAULT - Cannot find corresponding vma + * * -EINVAL - region size and vma size does not match + */ +static int +gzvm_vm_ioctl_set_memory_region(struct gzvm *gzvm, + struct gzvm_userspace_memory_region *mem) +{ + struct vm_area_struct *vma; + struct gzvm_memslot *memslot; + unsigned long size; + __u32 slot; + + slot = mem->slot; + if (slot >= GZVM_MAX_MEM_REGION) + return -ENXIO; + memslot = &gzvm->memslot[slot]; + + vma = vma_lookup(gzvm->mm, mem->userspace_addr); + if (!vma) + return -EFAULT; + + size = vma->vm_end - vma->vm_start; + if (size != mem->memory_size) + return -EINVAL; + + memslot->base_gfn = __phys_to_pfn(mem->guest_phys_addr); + memslot->npages = size >> PAGE_SHIFT; + memslot->userspace_addr = mem->userspace_addr; + memslot->vma = vma; + memslot->flags = mem->flags; + memslot->slot_id = mem->slot; + return register_memslot_addr_range(gzvm, memslot); +} + +static int gzvm_vm_ioctl_enable_cap(struct gzvm *gzvm, + struct gzvm_enable_cap *cap, + void __user *argp) +{ + return gzvm_vm_ioctl_arch_enable_cap(gzvm, cap, argp); +} + +/* gzvm_vm_ioctl() - Ioctl handler of VM FD */ +static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl, + unsigned long arg) +{ + long ret = -ENOTTY; + void __user *argp = (void __user *)arg; + struct gzvm *gzvm = filp->private_data; + + switch (ioctl) { + case GZVM_CHECK_EXTENSION: { + ret = gzvm_dev_ioctl_check_extension(gzvm, arg); + break; + } + case GZVM_SET_USER_MEMORY_REGION: { + struct gzvm_userspace_memory_region userspace_mem; + + if (copy_from_user(&userspace_mem, argp, sizeof(userspace_mem))) { + ret = -EFAULT; + goto out; + } + ret = gzvm_vm_ioctl_set_memory_region(gzvm, &userspace_mem); + break; + } + case GZVM_ENABLE_CAP: { + struct gzvm_enable_cap cap; + + if (copy_from_user(&cap, argp, sizeof(cap))) { + ret = -EFAULT; + goto out; + } + ret = gzvm_vm_ioctl_enable_cap(gzvm, &cap, argp); + break; + } + default: + ret = -ENOTTY; + } +out: + return ret; +} + +static void gzvm_destroy_vm(struct gzvm *gzvm) +{ + pr_debug("VM-%u is going to be destroyed\n", gzvm->vm_id); + + mutex_lock(&gzvm->lock); + + gzvm_arch_destroy_vm(gzvm->vm_id); + + mutex_lock(&gzvm_list_lock); + list_del(&gzvm->vm_list); + mutex_unlock(&gzvm_list_lock); + + mutex_unlock(&gzvm->lock); + + kfree(gzvm); +} + +static int gzvm_vm_release(struct inode *inode, struct file *filp) +{ + struct gzvm *gzvm = filp->private_data; + + gzvm_destroy_vm(gzvm); + return 0; +} + +static const struct file_operations gzvm_vm_fops = { + .release = gzvm_vm_release, + .unlocked_ioctl = gzvm_vm_ioctl, + .llseek = noop_llseek, +}; + +static struct gzvm *gzvm_create_vm(unsigned long vm_type) +{ + int ret; + struct gzvm *gzvm; + + gzvm = kzalloc(sizeof(*gzvm), GFP_KERNEL); + if (!gzvm) + return ERR_PTR(-ENOMEM); + + ret = gzvm_arch_create_vm(vm_type); + if (ret < 0) { + kfree(gzvm); + return ERR_PTR(ret); + } + + gzvm->vm_id = ret; + gzvm->mm = current->mm; + mutex_init(&gzvm->lock); + + mutex_lock(&gzvm_list_lock); + list_add(&gzvm->vm_list, &gzvm_list); + mutex_unlock(&gzvm_list_lock); + + pr_debug("VM-%u is created\n", gzvm->vm_id); + + return gzvm; +} + +/** + * gzvm_dev_ioctl_create_vm - Create vm fd + * @vm_type: VM type. Only supports Linux VM now. + * + * Return: fd of vm, negative if error + */ +int gzvm_dev_ioctl_create_vm(unsigned long vm_type) +{ + struct gzvm *gzvm; + + gzvm = gzvm_create_vm(vm_type); + if (IS_ERR(gzvm)) + return PTR_ERR(gzvm); + + return anon_inode_getfd("gzvm-vm", &gzvm_vm_fops, gzvm, + O_RDWR | O_CLOEXEC); +} + +void gzvm_destroy_all_vms(void) +{ + struct gzvm *gzvm, *tmp; + + mutex_lock(&gzvm_list_lock); + if (list_empty(&gzvm_list)) + goto out; + + list_for_each_entry_safe(gzvm, tmp, &gzvm_list, vm_list) + gzvm_destroy_vm(gzvm); + +out: + mutex_unlock(&gzvm_list_lock); +} diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h new file mode 100644 index 000000000000..580214b0f4c5 --- /dev/null +++ b/include/linux/gzvm_drv.h @@ -0,0 +1,91 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#ifndef __GZVM_DRV_H__ +#define __GZVM_DRV_H__ + +#include +#include +#include +#include + +#define GZVM_VCPU_MMAP_SIZE PAGE_SIZE +#define INVALID_VM_ID 0xffff + +/* + * These are the efinitions of APIs between GenieZone hypervisor and driver, + * there's no need to be visible to uapi. Furthermore, We need GenieZone + * specific error code in order to map to Linux errno + */ +#define NO_ERROR (0) +#define ERR_NO_MEMORY (-5) +#define ERR_NOT_SUPPORTED (-24) +#define ERR_NOT_IMPLEMENTED (-27) +#define ERR_FAULT (-40) + +/* + * The following data structures are for data transferring between driver and + * hypervisor, and they're aligned with hypervisor definitions + */ +#define GZVM_MAX_VCPUS 8 +#define GZVM_MAX_MEM_REGION 10 + +/* struct mem_region_addr_range - Identical to ffa memory constituent */ +struct mem_region_addr_range { + /* the base IPA of the constituent memory region, aligned to 4 kiB */ + __u64 address; + /* the number of 4 kiB pages in the constituent memory region. */ + __u32 pg_cnt; + __u32 reserved; +}; + +struct gzvm_memory_region_ranges { + __u32 slot; + __u32 constituent_cnt; + __u64 total_pages; + __u64 gpa; + struct mem_region_addr_range constituents[]; +}; + +/* struct gzvm_memslot - VM's memory slot descriptor */ +struct gzvm_memslot { + u64 base_gfn; /* begin of guest page frame */ + unsigned long npages; /* number of pages this slot covers */ + unsigned long userspace_addr; /* corresponding userspace va */ + struct vm_area_struct *vma; /* vma related to this userspace addr */ + u32 flags; + u32 slot_id; +}; + +struct gzvm { + /* userspace tied to this vm */ + struct mm_struct *mm; + struct gzvm_memslot memslot[GZVM_MAX_MEM_REGION]; + /* lock for list_add*/ + struct mutex lock; + struct list_head vm_list; + u16 vm_id; +}; + +long gzvm_dev_ioctl_check_extension(struct gzvm *gzvm, unsigned long args); +int gzvm_dev_ioctl_create_vm(unsigned long vm_type); + +int gzvm_err_to_errno(unsigned long err); + +void gzvm_destroy_all_vms(void); + +/* arch-dependant functions */ +int gzvm_arch_probe(void); +int gzvm_arch_set_memregion(u16 vm_id, size_t buf_size, + phys_addr_t region); +int gzvm_arch_check_extension(struct gzvm *gzvm, __u64 cap, void __user *argp); +int gzvm_arch_create_vm(unsigned long vm_type); +int gzvm_arch_destroy_vm(u16 vm_id); +int gzvm_vm_ioctl_arch_enable_cap(struct gzvm *gzvm, + struct gzvm_enable_cap *cap, + void __user *argp); +u64 gzvm_hva_to_pa_arch(u64 hva); + +#endif /* __GZVM_DRV_H__ */ diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild index ebb180aac74e..5af115a3c1a8 100644 --- a/include/uapi/asm-generic/Kbuild +++ b/include/uapi/asm-generic/Kbuild @@ -34,3 +34,4 @@ mandatory-y += termbits.h mandatory-y += termios.h mandatory-y += types.h mandatory-y += unistd.h +mandatory-y += gzvm_arch.h diff --git a/include/uapi/asm-generic/gzvm_arch.h b/include/uapi/asm-generic/gzvm_arch.h new file mode 100644 index 000000000000..c4cc12716c91 --- /dev/null +++ b/include/uapi/asm-generic/gzvm_arch.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#ifndef __ASM_GENERIC_GZVM_ARCH_H +#define __ASM_GENERIC_GZVM_ARCH_H +/* geniezone only supports aarch64 platform for now */ + +#endif /* __ASM_GENERIC_GZVM_ARCH_H */ diff --git a/include/uapi/linux/gzvm.h b/include/uapi/linux/gzvm.h new file mode 100644 index 000000000000..99730c142b0e --- /dev/null +++ b/include/uapi/linux/gzvm.h @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +/** + * DOC: UAPI of GenieZone Hypervisor + * + * This file declares common data structure shared among user space, + * kernel space, and GenieZone hypervisor. + */ +#ifndef __GZVM_H__ +#define __GZVM_H__ + +#include +#include +#include + +#include + +/* GZVM ioctls */ +#define GZVM_IOC_MAGIC 0x92 /* gz */ + +/* ioctls for /dev/gzvm fds */ +#define GZVM_CREATE_VM _IO(GZVM_IOC_MAGIC, 0x01) /* Returns a Geniezone VM fd */ + +/* + * Check if the given capability is supported or not. + * The argument is capability. Ex. GZVM_CAP_ARM_PROTECTED_VM or GZVM_CAP_ARM_VM_IPA_SIZE + * return is 0 (supported, no error) + * return is -EOPNOTSUPP (unsupported) + * return is -EFAULT (failed to get the argument from userspace) + */ +#define GZVM_CHECK_EXTENSION _IO(GZVM_IOC_MAGIC, 0x03) + +/* ioctls for VM fds */ +/* for GZVM_SET_MEMORY_REGION */ +struct gzvm_memory_region { + __u32 slot; + __u32 flags; + __u64 guest_phys_addr; + __u64 memory_size; /* bytes */ +}; + +#define GZVM_SET_MEMORY_REGION _IOW(GZVM_IOC_MAGIC, 0x40, \ + struct gzvm_memory_region) + +/* for GZVM_SET_USER_MEMORY_REGION */ +struct gzvm_userspace_memory_region { + __u32 slot; + __u32 flags; + __u64 guest_phys_addr; + /* bytes */ + __u64 memory_size; + /* start of the userspace allocated memory */ + __u64 userspace_addr; +}; + +#define GZVM_SET_USER_MEMORY_REGION _IOW(GZVM_IOC_MAGIC, 0x46, \ + struct gzvm_userspace_memory_region) + +/* for GZVM_ENABLE_CAP */ +struct gzvm_enable_cap { + /* in */ + __u64 cap; + /** + * we have total 5 (8 - 3) registers can be used for + * additional args + */ + __u64 args[5]; +}; + +#define GZVM_ENABLE_CAP _IOW(GZVM_IOC_MAGIC, 0xa3, \ + struct gzvm_enable_cap) + +#endif /* __GZVM_H__ */ From 540cff0872421713f018829240ba62d5dc0ebb08 Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Wed, 19 Apr 2023 13:56:37 +0800 Subject: [PATCH 041/113] FROMLIST: virt: geniezone: Add vcpu support VMM use this interface to create vcpu instance which is a fd, and this fd will be for any vcpu operations, such as setting vcpu registers and accepts the most important ioctl GZVM_VCPU_RUN which requests GenieZone hypervisor to do context switch to execute VM's vcpu context. Change-Id: I76e6e5b3a33b30eb0b841288c3aa041e63564da2 Signed-off-by: Yingshiuan Pan Signed-off-by: Jerry Wang Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-5-yi-de.wu@mediatek.com/ --- arch/arm64/geniezone/Makefile | 2 +- arch/arm64/geniezone/gzvm_arch_common.h | 20 ++ arch/arm64/geniezone/vcpu.c | 88 +++++++++ arch/arm64/geniezone/vm.c | 11 ++ arch/arm64/include/uapi/asm/gzvm_arch.h | 30 +++ drivers/virt/geniezone/Makefile | 3 +- drivers/virt/geniezone/gzvm_vcpu.c | 250 ++++++++++++++++++++++++ drivers/virt/geniezone/gzvm_vm.c | 5 + include/linux/gzvm_drv.h | 21 ++ include/uapi/linux/gzvm.h | 136 +++++++++++++ 10 files changed, 564 insertions(+), 2 deletions(-) create mode 100644 arch/arm64/geniezone/vcpu.c create mode 100644 drivers/virt/geniezone/gzvm_vcpu.c diff --git a/arch/arm64/geniezone/Makefile b/arch/arm64/geniezone/Makefile index 2957898cdd05..69b0a4abeab0 100644 --- a/arch/arm64/geniezone/Makefile +++ b/arch/arm64/geniezone/Makefile @@ -4,6 +4,6 @@ # include $(srctree)/drivers/virt/geniezone/Makefile -gzvm-y += vm.o +gzvm-y += vm.o vcpu.o obj-$(CONFIG_MTK_GZVM) += gzvm.o diff --git a/arch/arm64/geniezone/gzvm_arch_common.h b/arch/arm64/geniezone/gzvm_arch_common.h index fdb95d619102..9be9cf77faa3 100644 --- a/arch/arm64/geniezone/gzvm_arch_common.h +++ b/arch/arm64/geniezone/gzvm_arch_common.h @@ -21,6 +21,7 @@ enum { GZVM_FUNC_CREATE_DEVICE = 11, GZVM_FUNC_PROBE = 12, GZVM_FUNC_ENABLE_CAP = 13, + GZVM_FUNC_INFORM_EXIT = 14, NR_GZVM_FUNC, }; @@ -42,6 +43,7 @@ enum { #define MT_HVC_GZVM_CREATE_DEVICE GZVM_HCALL_ID(GZVM_FUNC_CREATE_DEVICE) #define MT_HVC_GZVM_PROBE GZVM_HCALL_ID(GZVM_FUNC_PROBE) #define MT_HVC_GZVM_ENABLE_CAP GZVM_HCALL_ID(GZVM_FUNC_ENABLE_CAP) +#define MT_HVC_GZVM_INFORM_EXIT GZVM_HCALL_ID(GZVM_FUNC_INFORM_EXIT) /** * gzvm_hypcall_wrapper() - the wrapper for hvc calls @@ -65,4 +67,22 @@ static inline u16 get_vmid_from_tuple(unsigned int tuple) return (u16)(tuple >> 16); } +static inline u16 get_vcpuid_from_tuple(unsigned int tuple) +{ + return (u16)(tuple & 0xffff); +} + +static inline unsigned int +assemble_vm_vcpu_tuple(u16 vmid, u16 vcpuid) +{ + return ((unsigned int)vmid << 16 | vcpuid); +} + +static inline void +disassemble_vm_vcpu_tuple(unsigned int tuple, u16 *vmid, u16 *vcpuid) +{ + *vmid = get_vmid_from_tuple(tuple); + *vcpuid = get_vcpuid_from_tuple(tuple); +} + #endif /* __GZVM_ARCH_COMMON_H__ */ diff --git a/arch/arm64/geniezone/vcpu.c b/arch/arm64/geniezone/vcpu.c new file mode 100644 index 000000000000..95681fd66656 --- /dev/null +++ b/arch/arm64/geniezone/vcpu.c @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include + +#include +#include +#include "gzvm_arch_common.h" + +int gzvm_arch_vcpu_update_one_reg(struct gzvm_vcpu *vcpu, __u64 reg_id, + bool is_write, __u64 *data) +{ + struct arm_smccc_res res; + unsigned long a1; + int ret; + + /* reg id follows KVM's encoding */ + switch (reg_id & GZVM_REG_ARM_COPROC_MASK) { + case GZVM_REG_ARM_CORE: + break; + default: + return -EOPNOTSUPP; + } + + a1 = assemble_vm_vcpu_tuple(vcpu->gzvm->vm_id, vcpu->vcpuid); + if (!is_write) { + ret = gzvm_hypcall_wrapper(MT_HVC_GZVM_GET_ONE_REG, + a1, reg_id, 0, 0, 0, 0, 0, &res); + if (ret == 0) + *data = res.a1; + } else { + ret = gzvm_hypcall_wrapper(MT_HVC_GZVM_SET_ONE_REG, + a1, reg_id, *data, 0, 0, 0, 0, &res); + } + + return ret; +} + +int gzvm_arch_vcpu_run(struct gzvm_vcpu *vcpu, __u64 *exit_reason) +{ + struct arm_smccc_res res; + unsigned long a1; + int ret; + + a1 = assemble_vm_vcpu_tuple(vcpu->gzvm->vm_id, vcpu->vcpuid); + ret = gzvm_hypcall_wrapper(MT_HVC_GZVM_RUN, a1, 0, 0, 0, 0, 0, + 0, &res); + *exit_reason = res.a1; + return ret; +} + +int gzvm_arch_destroy_vcpu(u16 vm_id, int vcpuid) +{ + struct arm_smccc_res res; + unsigned long a1; + + a1 = assemble_vm_vcpu_tuple(vm_id, vcpuid); + gzvm_hypcall_wrapper(MT_HVC_GZVM_DESTROY_VCPU, a1, 0, 0, 0, 0, 0, 0, + &res); + + return 0; +} + +/** + * gzvm_arch_create_vcpu() - Call smc to gz hypervisor to create vcpu + * @vm_id: vm id + * @vcpuid: vcpu id + * @run: Virtual address of vcpu->run + * + * Return: The wrapper helps caller to convert geniezone errno to Linux errno. + */ +int gzvm_arch_create_vcpu(u16 vm_id, int vcpuid, void *run) +{ + struct arm_smccc_res res; + unsigned long a1, a2; + int ret; + + a1 = assemble_vm_vcpu_tuple(vm_id, vcpuid); + a2 = (__u64)virt_to_phys(run); + ret = gzvm_hypcall_wrapper(MT_HVC_GZVM_CREATE_VCPU, a1, a2, 0, 0, 0, 0, + 0, &res); + + return ret; +} diff --git a/arch/arm64/geniezone/vm.c b/arch/arm64/geniezone/vm.c index e35751b21821..2df321f13057 100644 --- a/arch/arm64/geniezone/vm.c +++ b/arch/arm64/geniezone/vm.c @@ -14,6 +14,17 @@ #define PAR_PA47_MASK ((((1UL << 48) - 1) >> 12) << 12) +int gzvm_arch_inform_exit(u16 vm_id) +{ + struct arm_smccc_res res; + + arm_smccc_hvc(MT_HVC_GZVM_INFORM_EXIT, vm_id, 0, 0, 0, 0, 0, 0, &res); + if (res.a0 == 0) + return 0; + + return -ENXIO; +} + int gzvm_arch_probe(void) { struct arm_smccc_res res; diff --git a/arch/arm64/include/uapi/asm/gzvm_arch.h b/arch/arm64/include/uapi/asm/gzvm_arch.h index 847bb627a65d..e56b4700e07e 100644 --- a/arch/arm64/include/uapi/asm/gzvm_arch.h +++ b/arch/arm64/include/uapi/asm/gzvm_arch.h @@ -17,4 +17,34 @@ /* GZVM_CAP_ARM_PVM_SET_PROTECTED_VM only sets protected but not load pvmfw */ #define GZVM_CAP_ARM_PVM_SET_PROTECTED_VM 2 +/* + * Architecture specific registers are to be defined in arch headers and + * ORed with the arch identifier. + */ +#define GZVM_REG_ARM 0x4000000000000000ULL +#define GZVM_REG_ARM64 0x6000000000000000ULL + +#define GZVM_REG_SIZE_SHIFT 52 +#define GZVM_REG_SIZE_MASK 0x00f0000000000000ULL +#define GZVM_REG_SIZE_U8 0x0000000000000000ULL +#define GZVM_REG_SIZE_U16 0x0010000000000000ULL +#define GZVM_REG_SIZE_U32 0x0020000000000000ULL +#define GZVM_REG_SIZE_U64 0x0030000000000000ULL +#define GZVM_REG_SIZE_U128 0x0040000000000000ULL +#define GZVM_REG_SIZE_U256 0x0050000000000000ULL +#define GZVM_REG_SIZE_U512 0x0060000000000000ULL +#define GZVM_REG_SIZE_U1024 0x0070000000000000ULL +#define GZVM_REG_SIZE_U2048 0x0080000000000000ULL + +#define GZVM_REG_ARCH_MASK 0xff00000000000000ULL + +/* If you need to interpret the index values, here is the key: */ +#define GZVM_REG_ARM_COPROC_MASK 0x000000000FFF0000 +#define GZVM_REG_ARM_COPROC_SHIFT 16 + +/* Normal registers are mapped as coprocessor 16. */ +#define GZVM_REG_ARM_CORE (0x0010 << GZVM_REG_ARM_COPROC_SHIFT) +#define GZVM_REG_ARM_CORE_REG(name) \ + (offsetof(struct gzvm_regs, name) / sizeof(__u32)) + #endif /* __GZVM_ARCH_H__ */ diff --git a/drivers/virt/geniezone/Makefile b/drivers/virt/geniezone/Makefile index 066efddc0b9c..8ebf2db0c970 100644 --- a/drivers/virt/geniezone/Makefile +++ b/drivers/virt/geniezone/Makefile @@ -6,5 +6,6 @@ GZVM_DIR ?= ../../../drivers/virt/geniezone -gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o +gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o \ + $(GZVM_DIR)/gzvm_vcpu.o diff --git a/drivers/virt/geniezone/gzvm_vcpu.c b/drivers/virt/geniezone/gzvm_vcpu.c new file mode 100644 index 000000000000..e051343f2b0e --- /dev/null +++ b/drivers/virt/geniezone/gzvm_vcpu.c @@ -0,0 +1,250 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* maximum size needed for holding an integer */ +#define ITOA_MAX_LEN 12 + +static long gzvm_vcpu_update_one_reg(struct gzvm_vcpu *vcpu, + void * __user argp, + bool is_write) +{ + struct gzvm_one_reg reg; + void __user *reg_addr; + u64 data = 0; + u64 reg_size; + long ret; + + if (copy_from_user(®, argp, sizeof(reg))) + return -EFAULT; + + reg_addr = (void __user *)reg.addr; + reg_size = (reg.id & GZVM_REG_SIZE_MASK) >> GZVM_REG_SIZE_SHIFT; + reg_size = BIT(reg_size); + + if (is_write) { + if (copy_from_user(&data, reg_addr, reg_size)) + return -EFAULT; + } + + ret = gzvm_arch_vcpu_update_one_reg(vcpu, reg.id, is_write, &data); + + if (ret) + return ret; + + if (!is_write) { + if (copy_to_user(reg_addr, &data, reg_size)) + return -EFAULT; + } + + return 0; +} + +/** + * gzvm_vcpu_run() - Handle vcpu run ioctl, entry point to guest and exit + * point from guest + * @vcpu: Pointer to struct gzvm_vcpu + * @argp: Pointer to struct gzvm_vcpu_run in userspace + * + * Return: + * * 0 - Success. + * * Negative - Failure. + */ +static long gzvm_vcpu_run(struct gzvm_vcpu *vcpu, void * __user argp) +{ + bool need_userspace = false; + u64 exit_reason = 0; + + if (copy_from_user(vcpu->run, argp, sizeof(struct gzvm_vcpu_run))) + return -EFAULT; + + for (int i = 0; i < ARRAY_SIZE(vcpu->run->padding1); i++) { + if (vcpu->run->padding1[i]) + return -EINVAL; + } + + if (vcpu->run->immediate_exit == 1) + return -EINTR; + + while (!need_userspace && !signal_pending(current)) { + gzvm_arch_vcpu_run(vcpu, &exit_reason); + + switch (exit_reason) { + case GZVM_EXIT_MMIO: + need_userspace = true; + break; + /** + * it's geniezone's responsibility to fill corresponding data + * structure + */ + case GZVM_EXIT_HYPERCALL: + fallthrough; + case GZVM_EXIT_EXCEPTION: + fallthrough; + case GZVM_EXIT_DEBUG: + fallthrough; + case GZVM_EXIT_FAIL_ENTRY: + fallthrough; + case GZVM_EXIT_INTERNAL_ERROR: + fallthrough; + case GZVM_EXIT_SYSTEM_EVENT: + fallthrough; + case GZVM_EXIT_SHUTDOWN: + need_userspace = true; + break; + case GZVM_EXIT_IRQ: + fallthrough; + case GZVM_EXIT_GZ: + break; + case GZVM_EXIT_UNKNOWN: + fallthrough; + default: + pr_err("vcpu unknown exit\n"); + need_userspace = true; + goto out; + } + } + +out: + if (copy_to_user(argp, vcpu->run, sizeof(struct gzvm_vcpu_run))) + return -EFAULT; + if (signal_pending(current)) { + // invoke hvc to inform gz to map memory + gzvm_arch_inform_exit(vcpu->gzvm->vm_id); + return -ERESTARTSYS; + } + return 0; +} + +static long gzvm_vcpu_ioctl(struct file *filp, unsigned int ioctl, + unsigned long arg) +{ + int ret = -ENOTTY; + void __user *argp = (void __user *)arg; + struct gzvm_vcpu *vcpu = filp->private_data; + + switch (ioctl) { + case GZVM_RUN: + ret = gzvm_vcpu_run(vcpu, argp); + break; + case GZVM_GET_ONE_REG: + /* is_write */ + ret = gzvm_vcpu_update_one_reg(vcpu, argp, false); + break; + case GZVM_SET_ONE_REG: + /* is_write */ + ret = gzvm_vcpu_update_one_reg(vcpu, argp, true); + break; + default: + break; + } + + return ret; +} + +static const struct file_operations gzvm_vcpu_fops = { + .unlocked_ioctl = gzvm_vcpu_ioctl, + .llseek = noop_llseek, +}; + +/* caller must hold the vm lock */ +static void gzvm_destroy_vcpu(struct gzvm_vcpu *vcpu) +{ + if (!vcpu) + return; + + gzvm_arch_destroy_vcpu(vcpu->gzvm->vm_id, vcpu->vcpuid); + /* clean guest's data */ + memset(vcpu->run, 0, GZVM_VCPU_RUN_MAP_SIZE); + free_pages_exact(vcpu->run, GZVM_VCPU_RUN_MAP_SIZE); + kfree(vcpu); +} + +/** + * gzvm_destroy_vcpus() - Destroy all vcpus, caller has to hold the vm lock + * + * @gzvm: vm struct that owns the vcpus + */ +void gzvm_destroy_vcpus(struct gzvm *gzvm) +{ + int i; + + for (i = 0; i < GZVM_MAX_VCPUS; i++) { + gzvm_destroy_vcpu(gzvm->vcpus[i]); + gzvm->vcpus[i] = NULL; + } +} + +/* create_vcpu_fd() - Allocates an inode for the vcpu. */ +static int create_vcpu_fd(struct gzvm_vcpu *vcpu) +{ + /* sizeof("gzvm-vcpu:") + max(strlen(itoa(vcpuid))) + null */ + char name[10 + ITOA_MAX_LEN + 1]; + + snprintf(name, sizeof(name), "gzvm-vcpu:%d", vcpu->vcpuid); + return anon_inode_getfd(name, &gzvm_vcpu_fops, vcpu, O_RDWR | O_CLOEXEC); +} + +/** + * gzvm_vm_ioctl_create_vcpu() - for GZVM_CREATE_VCPU + * @gzvm: Pointer to struct gzvm + * @cpuid: equals arg + * + * Return: Fd of vcpu, negative errno if error occurs + */ +int gzvm_vm_ioctl_create_vcpu(struct gzvm *gzvm, u32 cpuid) +{ + struct gzvm_vcpu *vcpu; + int ret; + + if (cpuid >= GZVM_MAX_VCPUS) + return -EINVAL; + + vcpu = kzalloc(sizeof(*vcpu), GFP_KERNEL); + if (!vcpu) + return -ENOMEM; + + /** + * Allocate 2 pages for data sharing between driver and gz hypervisor + * + * |- page 0 -|- page 1 -| + * |gzvm_vcpu_run|......|hwstate|.......| + * + */ + vcpu->run = alloc_pages_exact(GZVM_VCPU_RUN_MAP_SIZE, + GFP_KERNEL_ACCOUNT | __GFP_ZERO); + if (!vcpu->run) { + ret = -ENOMEM; + goto free_vcpu; + } + vcpu->vcpuid = cpuid; + vcpu->gzvm = gzvm; + mutex_init(&vcpu->lock); + + ret = gzvm_arch_create_vcpu(gzvm->vm_id, vcpu->vcpuid, vcpu->run); + if (ret < 0) + goto free_vcpu_run; + + ret = create_vcpu_fd(vcpu); + if (ret < 0) + goto free_vcpu_run; + gzvm->vcpus[cpuid] = vcpu; + + return ret; + +free_vcpu_run: + free_pages_exact(vcpu->run, GZVM_VCPU_RUN_MAP_SIZE); +free_vcpu: + kfree(vcpu); + return ret; +} diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c index ee751369fd4b..aea99d050653 100644 --- a/drivers/virt/geniezone/gzvm_vm.c +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -280,6 +280,10 @@ static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl, ret = gzvm_dev_ioctl_check_extension(gzvm, arg); break; } + case GZVM_CREATE_VCPU: { + ret = gzvm_vm_ioctl_create_vcpu(gzvm, arg); + break; + } case GZVM_SET_USER_MEMORY_REGION: { struct gzvm_userspace_memory_region userspace_mem; @@ -313,6 +317,7 @@ static void gzvm_destroy_vm(struct gzvm *gzvm) mutex_lock(&gzvm->lock); + gzvm_destroy_vcpus(gzvm); gzvm_arch_destroy_vm(gzvm->vm_id); mutex_lock(&gzvm_list_lock); diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h index 580214b0f4c5..aae65d243b06 100644 --- a/include/linux/gzvm_drv.h +++ b/include/linux/gzvm_drv.h @@ -32,6 +32,8 @@ #define GZVM_MAX_VCPUS 8 #define GZVM_MAX_MEM_REGION 10 +#define GZVM_VCPU_RUN_MAP_SIZE (PAGE_SIZE * 2) + /* struct mem_region_addr_range - Identical to ffa memory constituent */ struct mem_region_addr_range { /* the base IPA of the constituent memory region, aligned to 4 kiB */ @@ -59,7 +61,16 @@ struct gzvm_memslot { u32 slot_id; }; +struct gzvm_vcpu { + struct gzvm *gzvm; + int vcpuid; + /* lock of vcpu*/ + struct mutex lock; + struct gzvm_vcpu_run *run; +}; + struct gzvm { + struct gzvm_vcpu *vcpus[GZVM_MAX_VCPUS]; /* userspace tied to this vm */ struct mm_struct *mm; struct gzvm_memslot memslot[GZVM_MAX_MEM_REGION]; @@ -76,6 +87,8 @@ int gzvm_err_to_errno(unsigned long err); void gzvm_destroy_all_vms(void); +void gzvm_destroy_vcpus(struct gzvm *gzvm); + /* arch-dependant functions */ int gzvm_arch_probe(void); int gzvm_arch_set_memregion(u16 vm_id, size_t buf_size, @@ -86,6 +99,14 @@ int gzvm_arch_destroy_vm(u16 vm_id); int gzvm_vm_ioctl_arch_enable_cap(struct gzvm *gzvm, struct gzvm_enable_cap *cap, void __user *argp); + u64 gzvm_hva_to_pa_arch(u64 hva); +int gzvm_vm_ioctl_create_vcpu(struct gzvm *gzvm, u32 cpuid); +int gzvm_arch_vcpu_update_one_reg(struct gzvm_vcpu *vcpu, __u64 reg_id, + bool is_write, __u64 *data); +int gzvm_arch_create_vcpu(u16 vm_id, int vcpuid, void *run); +int gzvm_arch_vcpu_run(struct gzvm_vcpu *vcpu, __u64 *exit_reason); +int gzvm_arch_destroy_vcpu(u16 vm_id, int vcpuid); +int gzvm_arch_inform_exit(u16 vm_id); #endif /* __GZVM_DRV_H__ */ diff --git a/include/uapi/linux/gzvm.h b/include/uapi/linux/gzvm.h index 99730c142b0e..4814c82b0dff 100644 --- a/include/uapi/linux/gzvm.h +++ b/include/uapi/linux/gzvm.h @@ -44,6 +44,11 @@ struct gzvm_memory_region { #define GZVM_SET_MEMORY_REGION _IOW(GZVM_IOC_MAGIC, 0x40, \ struct gzvm_memory_region) +/* + * GZVM_CREATE_VCPU receives as a parameter the vcpu slot, + * and returns a vcpu fd. + */ +#define GZVM_CREATE_VCPU _IO(GZVM_IOC_MAGIC, 0x41) /* for GZVM_SET_USER_MEMORY_REGION */ struct gzvm_userspace_memory_region { @@ -59,6 +64,124 @@ struct gzvm_userspace_memory_region { #define GZVM_SET_USER_MEMORY_REGION _IOW(GZVM_IOC_MAGIC, 0x46, \ struct gzvm_userspace_memory_region) +/* + * ioctls for vcpu fds + */ +#define GZVM_RUN _IO(GZVM_IOC_MAGIC, 0x80) + +/* VM exit reason */ +enum { + GZVM_EXIT_UNKNOWN = 0x92920000, + GZVM_EXIT_MMIO = 0x92920001, + GZVM_EXIT_HYPERCALL = 0x92920002, + GZVM_EXIT_IRQ = 0x92920003, + GZVM_EXIT_EXCEPTION = 0x92920004, + GZVM_EXIT_DEBUG = 0x92920005, + GZVM_EXIT_FAIL_ENTRY = 0x92920006, + GZVM_EXIT_INTERNAL_ERROR = 0x92920007, + GZVM_EXIT_SYSTEM_EVENT = 0x92920008, + GZVM_EXIT_SHUTDOWN = 0x92920009, + GZVM_EXIT_GZ = 0x9292000a, +}; + +/** + * struct gzvm_vcpu_run: Same purpose as kvm_run, this struct is + * shared between userspace, kernel and + * GenieZone hypervisor + * @exit_reason: The reason why gzvm_vcpu_run has stopped running the vCPU + * @immediate_exit: Polled when the vcpu is scheduled. + * If set, immediately returns -EINTR + * @padding1: Reserved for future-proof and must be zero filled + * @mmio: The nested struct in anonymous union. Handle mmio in host side + * @phys_addr: The address guest tries to access + * @data: The value to be written (is_write is 1) or + * be filled by user for reads (is_write is 0) + * @size: The size of written data. + * Only the first `size` bytes of `data` are handled + * @reg_nr: The register number where the data is stored + * @is_write: 1 for VM to perform a write or 0 for VM to perform a read + * @fail_entry: The nested struct in anonymous union. + * Handle invalid entry address at the first run + * @hardware_entry_failure_reason: The reason codes about hardware entry failure + * @cpu: The current processor number via smp_processor_id() + * @exception: The nested struct in anonymous union. + * Handle exception occurred in VM + * @exception: Which exception vector + * @error_code: Exception error codes + * @hypercall: The nested struct in anonymous union. + * Some hypercalls issued from VM must be handled + * @args: The hypercall's arguments + * @internal: The nested struct in anonymous union. The errors from hypervisor + * @suberror: The errors codes about GZVM_EXIT_INTERNAL_ERROR + * @ndata: The number of elements used in data[] + * @data: Keep the detailed information about GZVM_EXIT_INTERNAL_ERROR + * @system_event: The nested struct in anonymous union. + * VM's PSCI must be handled by host + * @type: System event type. + * Ex. GZVM_SYSTEM_EVENT_SHUTDOWN or GZVM_SYSTEM_EVENT_RESET...etc. + * @ndata: The number of elements used in data[] + * @data: Keep the detailed information about GZVM_EXIT_SYSTEM_EVENT + * @padding: Fix it to a reasonable size future-proof for keeping the same + * struct size when adding new variables in the union is needed + * + * Keep identical layout between the 3 modules + */ +struct gzvm_vcpu_run { + /* to userspace */ + __u32 exit_reason; + __u8 immediate_exit; + __u8 padding1[3]; + /* union structure of collection of guest exit reason */ + union { + /* GZVM_EXIT_MMIO */ + struct { + /* from FAR_EL2 */ + __u64 phys_addr; + __u8 data[8]; + /* from ESR_EL2 as */ + __u64 size; + /* from ESR_EL2 */ + __u32 reg_nr; + /* from ESR_EL2 */ + __u8 is_write; + } mmio; + /* GZVM_EXIT_FAIL_ENTRY */ + struct { + __u64 hardware_entry_failure_reason; + __u32 cpu; + } fail_entry; + /* GZVM_EXIT_EXCEPTION */ + struct { + __u32 exception; + __u32 error_code; + } exception; + /* GZVM_EXIT_HYPERCALL */ + struct { + __u64 args[8]; /* in-out */ + } hypercall; + /* GZVM_EXIT_INTERNAL_ERROR */ + struct { + __u32 suberror; + __u32 ndata; + __u64 data[16]; + } internal; + /* GZVM_EXIT_SYSTEM_EVENT */ + struct { +#define GZVM_SYSTEM_EVENT_SHUTDOWN 1 +#define GZVM_SYSTEM_EVENT_RESET 2 +#define GZVM_SYSTEM_EVENT_CRASH 3 +#define GZVM_SYSTEM_EVENT_WAKEUP 4 +#define GZVM_SYSTEM_EVENT_SUSPEND 5 +#define GZVM_SYSTEM_EVENT_SEV_TERM 6 +#define GZVM_SYSTEM_EVENT_S2IDLE 7 + __u32 type; + __u32 ndata; + __u64 data[16]; + } system_event; + char padding[256]; + }; +}; + /* for GZVM_ENABLE_CAP */ struct gzvm_enable_cap { /* in */ @@ -73,4 +196,17 @@ struct gzvm_enable_cap { #define GZVM_ENABLE_CAP _IOW(GZVM_IOC_MAGIC, 0xa3, \ struct gzvm_enable_cap) +/* for GZVM_GET/SET_ONE_REG */ +struct gzvm_one_reg { + __u64 id; + __u64 addr; +}; + +#define GZVM_GET_ONE_REG _IOW(GZVM_IOC_MAGIC, 0xab, \ + struct gzvm_one_reg) +#define GZVM_SET_ONE_REG _IOW(GZVM_IOC_MAGIC, 0xac, \ + struct gzvm_one_reg) + +#define GZVM_REG_GENERIC 0x0000000000000000ULL + #endif /* __GZVM_H__ */ From 7427b76faa34786d03de62fe42d43b22c1d5228d Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Fri, 21 Apr 2023 14:34:02 +0800 Subject: [PATCH 042/113] FROMLIST: virt: geniezone: Add irqchip support for virtual interrupt injection Enable GenieZone to handle virtual interrupt injection request. Change-Id: I2dc99a1d30309864eb7bbc91c97570cbb7c548a2 Signed-off-by: Yingshiuan Pan Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-6-yi-de.wu@mediatek.com/ --- arch/arm64/geniezone/Makefile | 2 +- arch/arm64/geniezone/vgic.c | 108 ++++++++++++++++++++++++ arch/arm64/include/uapi/asm/gzvm_arch.h | 4 + drivers/virt/geniezone/gzvm_common.h | 12 +++ drivers/virt/geniezone/gzvm_vm.c | 82 ++++++++++++++++++ include/linux/gzvm_drv.h | 4 + include/uapi/linux/gzvm.h | 66 +++++++++++++++ 7 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/geniezone/vgic.c create mode 100644 drivers/virt/geniezone/gzvm_common.h diff --git a/arch/arm64/geniezone/Makefile b/arch/arm64/geniezone/Makefile index 69b0a4abeab0..0e4f1087f9de 100644 --- a/arch/arm64/geniezone/Makefile +++ b/arch/arm64/geniezone/Makefile @@ -4,6 +4,6 @@ # include $(srctree)/drivers/virt/geniezone/Makefile -gzvm-y += vm.o vcpu.o +gzvm-y += vm.o vcpu.o vgic.o obj-$(CONFIG_MTK_GZVM) += gzvm.o diff --git a/arch/arm64/geniezone/vgic.c b/arch/arm64/geniezone/vgic.c new file mode 100644 index 000000000000..3746e0c9e247 --- /dev/null +++ b/arch/arm64/geniezone/vgic.c @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include "gzvm_arch_common.h" + +/** + * is_irq_valid() - Check the irq number and irq_type are matched + * @irq: interrupt number + * @irq_type: interrupt type + * + * Return: + * true if irq is valid else false. + */ +static bool is_irq_valid(u32 irq, u32 irq_type) +{ + switch (irq_type) { + case GZVM_IRQ_TYPE_CPU: + /* 0 ~ 15: SGI */ + if (likely(irq <= GZVM_IRQ_CPU_FIQ)) + return true; + break; + case GZVM_IRQ_TYPE_PPI: + /* 16 ~ 31: PPI */ + if (likely(irq >= GZVM_VGIC_NR_SGIS && + irq < GZVM_VGIC_NR_PRIVATE_IRQS)) + return true; + break; + case GZVM_IRQ_TYPE_SPI: + /* 32 ~ : SPT */ + if (likely(irq >= GZVM_VGIC_NR_PRIVATE_IRQS)) + return true; + break; + default: + return false; + } + return false; +} + +/** + * gzvm_vgic_inject_irq() - Inject virtual interrupt to a VM + * @gzvm: Pointer to struct gzvm + * @vcpu_idx: vcpu index, only valid if PPI + * @irq_type: Interrupt type + * @irq: irq number + * @level: 1 if true else 0 + * + * Return: + * * 0 - Success. + * * Negative - Failure. + */ +static int gzvm_vgic_inject_irq(struct gzvm *gzvm, unsigned int vcpu_idx, + u32 irq_type, u32 irq, bool level) +{ + unsigned long a1 = assemble_vm_vcpu_tuple(gzvm->vm_id, vcpu_idx); + struct arm_smccc_res res; + + if (!unlikely(is_irq_valid(irq, irq_type))) + return -EINVAL; + + gzvm_hypcall_wrapper(MT_HVC_GZVM_IRQ_LINE, a1, irq, level, + 0, 0, 0, 0, &res); + if (res.a0) { + pr_err("Failed to set IRQ level (%d) to irq#%u on vcpu %d with ret=%d\n", + level, irq, vcpu_idx, (int)res.a0); + return -EFAULT; + } + + return 0; +} + +/** + * gzvm_vgic_inject_spi() - Inject virtual spi interrupt + * @gzvm: Pointer to struct gzvm + * @vcpu_idx: vcpu index + * @spi_irq: This is spi interrupt number (starts from 0 instead of 32) + * @level: 1 if true else 0 + * + * Return: + * * 0 if succeed else other negative values indicating each errors + */ +static int gzvm_vgic_inject_spi(struct gzvm *gzvm, unsigned int vcpu_idx, + u32 spi_irq, bool level) +{ + return gzvm_vgic_inject_irq(gzvm, 0, GZVM_IRQ_TYPE_SPI, + spi_irq + GZVM_VGIC_NR_PRIVATE_IRQS, + level); +} + +int gzvm_arch_create_device(u16 vm_id, struct gzvm_create_device *gzvm_dev) +{ + struct arm_smccc_res res; + + return gzvm_hypcall_wrapper(MT_HVC_GZVM_CREATE_DEVICE, vm_id, + virt_to_phys(gzvm_dev), 0, 0, 0, 0, 0, + &res); +} + +int gzvm_arch_inject_irq(struct gzvm *gzvm, unsigned int vcpu_idx, + u32 irq_type, u32 irq, bool level) +{ + /* default use spi */ + return gzvm_vgic_inject_spi(gzvm, vcpu_idx, irq, level); +} diff --git a/arch/arm64/include/uapi/asm/gzvm_arch.h b/arch/arm64/include/uapi/asm/gzvm_arch.h index e56b4700e07e..acfe9be0f849 100644 --- a/arch/arm64/include/uapi/asm/gzvm_arch.h +++ b/arch/arm64/include/uapi/asm/gzvm_arch.h @@ -47,4 +47,8 @@ #define GZVM_REG_ARM_CORE_REG(name) \ (offsetof(struct gzvm_regs, name) / sizeof(__u32)) +#define GZVM_VGIC_NR_SGIS 16 +#define GZVM_VGIC_NR_PPIS 16 +#define GZVM_VGIC_NR_PRIVATE_IRQS (GZVM_VGIC_NR_SGIS + GZVM_VGIC_NR_PPIS) + #endif /* __GZVM_ARCH_H__ */ diff --git a/drivers/virt/geniezone/gzvm_common.h b/drivers/virt/geniezone/gzvm_common.h new file mode 100644 index 000000000000..d0e39ded79e6 --- /dev/null +++ b/drivers/virt/geniezone/gzvm_common.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#ifndef __GZ_COMMON_H__ +#define __GZ_COMMON_H__ + +int gzvm_irqchip_inject_irq(struct gzvm *gzvm, unsigned int vcpu_idx, + u32 irq_type, u32 irq, bool level); + +#endif /* __GZVM_COMMON_H__ */ diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c index aea99d050653..b1397180cd02 100644 --- a/drivers/virt/geniezone/gzvm_vm.c +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -11,6 +11,7 @@ #include #include #include +#include "gzvm_common.h" static DEFINE_MUTEX(gzvm_list_lock); static LIST_HEAD(gzvm_list); @@ -260,6 +261,73 @@ gzvm_vm_ioctl_set_memory_region(struct gzvm *gzvm, return register_memslot_addr_range(gzvm, memslot); } +int gzvm_irqchip_inject_irq(struct gzvm *gzvm, unsigned int vcpu_idx, + u32 irq_type, u32 irq, bool level) +{ + return gzvm_arch_inject_irq(gzvm, vcpu_idx, irq_type, irq, level); +} + +static int gzvm_vm_ioctl_irq_line(struct gzvm *gzvm, + struct gzvm_irq_level *irq_level) +{ + u32 irq = irq_level->irq; + u32 irq_type, vcpu_idx, vcpu2_idx, irq_num; + bool level = irq_level->level; + + irq_type = FIELD_GET(GZVM_IRQ_LINE_TYPE, irq); + vcpu_idx = FIELD_GET(GZVM_IRQ_LINE_VCPU, irq); + vcpu2_idx = FIELD_GET(GZVM_IRQ_LINE_VCPU2, irq) * (GZVM_IRQ_VCPU_MASK + 1); + irq_num = FIELD_GET(GZVM_IRQ_LINE_NUM, irq); + + return gzvm_irqchip_inject_irq(gzvm, vcpu_idx + vcpu2_idx, irq_type, irq_num, + level); +} + +static int gzvm_vm_ioctl_create_device(struct gzvm *gzvm, void __user *argp) +{ + struct gzvm_create_device *gzvm_dev; + void *dev_data = NULL; + int ret; + + gzvm_dev = (struct gzvm_create_device *)alloc_pages_exact(PAGE_SIZE, + GFP_KERNEL); + if (!gzvm_dev) + return -ENOMEM; + if (copy_from_user(gzvm_dev, argp, sizeof(*gzvm_dev))) { + ret = -EFAULT; + goto err_free_dev; + } + + if (gzvm_dev->attr_addr != 0 && gzvm_dev->attr_size != 0) { + size_t attr_size = gzvm_dev->attr_size; + void __user *attr_addr = (void __user *)gzvm_dev->attr_addr; + + /* Size of device specific data should not be over a page. */ + if (attr_size > PAGE_SIZE) + return -EINVAL; + + dev_data = alloc_pages_exact(attr_size, GFP_KERNEL); + if (!dev_data) { + ret = -ENOMEM; + goto err_free_dev; + } + + if (copy_from_user(dev_data, attr_addr, attr_size)) { + ret = -EFAULT; + goto err_free_dev_data; + } + gzvm_dev->attr_addr = virt_to_phys(dev_data); + } + + ret = gzvm_arch_create_device(gzvm->vm_id, gzvm_dev); +err_free_dev_data: + if (dev_data) + free_pages_exact(dev_data, 0); +err_free_dev: + free_pages_exact(gzvm_dev, 0); + return ret; +} + static int gzvm_vm_ioctl_enable_cap(struct gzvm *gzvm, struct gzvm_enable_cap *cap, void __user *argp) @@ -294,6 +362,20 @@ static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl, ret = gzvm_vm_ioctl_set_memory_region(gzvm, &userspace_mem); break; } + case GZVM_IRQ_LINE: { + struct gzvm_irq_level irq_event; + + if (copy_from_user(&irq_event, argp, sizeof(irq_event))) { + ret = -EFAULT; + goto out; + } + ret = gzvm_vm_ioctl_irq_line(gzvm, &irq_event); + break; + } + case GZVM_CREATE_DEVICE: { + ret = gzvm_vm_ioctl_create_device(gzvm, argp); + break; + } case GZVM_ENABLE_CAP: { struct gzvm_enable_cap cap; diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h index aae65d243b06..fd703538c817 100644 --- a/include/linux/gzvm_drv.h +++ b/include/linux/gzvm_drv.h @@ -109,4 +109,8 @@ int gzvm_arch_vcpu_run(struct gzvm_vcpu *vcpu, __u64 *exit_reason); int gzvm_arch_destroy_vcpu(u16 vm_id, int vcpuid); int gzvm_arch_inform_exit(u16 vm_id); +int gzvm_arch_create_device(u16 vm_id, struct gzvm_create_device *gzvm_dev); +int gzvm_arch_inject_irq(struct gzvm *gzvm, unsigned int vcpu_idx, + u32 irq_type, u32 irq, bool level); + #endif /* __GZVM_DRV_H__ */ diff --git a/include/uapi/linux/gzvm.h b/include/uapi/linux/gzvm.h index 4814c82b0dff..fb019d232a98 100644 --- a/include/uapi/linux/gzvm.h +++ b/include/uapi/linux/gzvm.h @@ -64,6 +64,72 @@ struct gzvm_userspace_memory_region { #define GZVM_SET_USER_MEMORY_REGION _IOW(GZVM_IOC_MAGIC, 0x46, \ struct gzvm_userspace_memory_region) +/* for GZVM_IRQ_LINE, irq field index values */ +#define GZVM_IRQ_VCPU_MASK 0xff +#define GZVM_IRQ_LINE_TYPE GENMASK(27, 24) +#define GZVM_IRQ_LINE_VCPU GENMASK(23, 16) +#define GZVM_IRQ_LINE_VCPU2 GENMASK(31, 28) +#define GZVM_IRQ_LINE_NUM GENMASK(15, 0) + +/* irq_type field */ +#define GZVM_IRQ_TYPE_CPU 0 +#define GZVM_IRQ_TYPE_SPI 1 +#define GZVM_IRQ_TYPE_PPI 2 + +/* out-of-kernel GIC cpu interrupt injection irq_number field */ +#define GZVM_IRQ_CPU_IRQ 0 +#define GZVM_IRQ_CPU_FIQ 1 + +struct gzvm_irq_level { + union { + __u32 irq; + __s32 status; + }; + __u32 level; +}; + +#define GZVM_IRQ_LINE _IOW(GZVM_IOC_MAGIC, 0x61, \ + struct gzvm_irq_level) + +enum gzvm_device_type { + GZVM_DEV_TYPE_ARM_VGIC_V3_DIST = 0, + GZVM_DEV_TYPE_ARM_VGIC_V3_REDIST = 1, + GZVM_DEV_TYPE_MAX, +}; + +/** + * struct gzvm_create_device: For GZVM_CREATE_DEVICE. + * @dev_type: Device type. + * @id: Device id. + * @flags: Bypass to hypervisor to handle them and these are flags of virtual + * devices. + * @dev_addr: Device ipa address in VM's view. + * @dev_reg_size: Device register range size. + * @attr_addr: If user -> kernel, this is user virtual address of device + * specific attributes (if needed). If kernel->hypervisor, + * this is ipa. + * @attr_size: This attr_size is the buffer size in bytes of each attribute + * needed from various devices. The attribute here refers to the + * additional data passed from VMM(e.g. Crosvm) to GenieZone + * hypervisor when virtual devices were to be created. Thus, + * we need attr_addr and attr_size in the gzvm_create_device + * structure to keep track of the attribute mentioned. + * + * Store information needed to create device. + */ +struct gzvm_create_device { + __u32 dev_type; + __u32 id; + __u64 flags; + __u64 dev_addr; + __u64 dev_reg_size; + __u64 attr_addr; + __u64 attr_size; +}; + +#define GZVM_CREATE_DEVICE _IOWR(GZVM_IOC_MAGIC, 0xe0, \ + struct gzvm_create_device) + /* * ioctls for vcpu fds */ From e73a5222e63e1984554773dbc08317f822216f52 Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Tue, 18 Apr 2023 12:19:05 +0800 Subject: [PATCH 043/113] FROMLIST: virt: geniezone: Add irqfd support irqfd enables other threads than vcpu threads to inject virtual interrupt through irqfd asynchronously rather through ioctl interface. This interface is necessary for VMM which creates separated thread for IO handling or uses vhost devices. Change-Id: I3a77cdcec0530193a518352f30c162d08b5b35ef Signed-off-by: Yingshiuan Pan Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-7-yi-de.wu@mediatek.com/ --- arch/arm64/geniezone/gzvm_arch_common.h | 18 + drivers/virt/geniezone/Makefile | 3 +- drivers/virt/geniezone/gzvm_irqfd.c | 566 ++++++++++++++++++++++++ drivers/virt/geniezone/gzvm_main.c | 3 +- drivers/virt/geniezone/gzvm_vcpu.c | 1 + drivers/virt/geniezone/gzvm_vm.c | 18 + include/linux/gzvm_drv.h | 26 ++ include/uapi/linux/gzvm.h | 26 ++ 8 files changed, 658 insertions(+), 3 deletions(-) create mode 100644 drivers/virt/geniezone/gzvm_irqfd.c diff --git a/arch/arm64/geniezone/gzvm_arch_common.h b/arch/arm64/geniezone/gzvm_arch_common.h index 9be9cf77faa3..051d8f49a1df 100644 --- a/arch/arm64/geniezone/gzvm_arch_common.h +++ b/arch/arm64/geniezone/gzvm_arch_common.h @@ -45,6 +45,8 @@ enum { #define MT_HVC_GZVM_ENABLE_CAP GZVM_HCALL_ID(GZVM_FUNC_ENABLE_CAP) #define MT_HVC_GZVM_INFORM_EXIT GZVM_HCALL_ID(GZVM_FUNC_INFORM_EXIT) +#define GIC_V3_NR_LRS 16 + /** * gzvm_hypcall_wrapper() - the wrapper for hvc calls * @a0-a7: arguments passed in registers 0 to 7 @@ -72,6 +74,22 @@ static inline u16 get_vcpuid_from_tuple(unsigned int tuple) return (u16)(tuple & 0xffff); } +/** + * struct gzvm_vcpu_hwstate: Sync architecture state back to host for handling + * @nr_lrs: The available LRs(list registers) in Soc. + * @__pad: add an explicit '__u32 __pad;' in the middle to make it clear + * what the actual layout is. + * @lr: The array of LRs(list registers). + * + * - Keep the same layout of hypervisor data struct. + * - Sync list registers back for acking virtual device interrupt status. + */ +struct gzvm_vcpu_hwstate { + __le32 nr_lrs; + __le32 __pad; + __le64 lr[GIC_V3_NR_LRS]; +}; + static inline unsigned int assemble_vm_vcpu_tuple(u16 vmid, u16 vcpuid) { diff --git a/drivers/virt/geniezone/Makefile b/drivers/virt/geniezone/Makefile index 8ebf2db0c970..19a835b0aac2 100644 --- a/drivers/virt/geniezone/Makefile +++ b/drivers/virt/geniezone/Makefile @@ -7,5 +7,4 @@ GZVM_DIR ?= ../../../drivers/virt/geniezone gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o \ - $(GZVM_DIR)/gzvm_vcpu.o - + $(GZVM_DIR)/gzvm_vcpu.o $(GZVM_DIR)/gzvm_irqfd.o diff --git a/drivers/virt/geniezone/gzvm_irqfd.c b/drivers/virt/geniezone/gzvm_irqfd.c new file mode 100644 index 000000000000..b10ac3a940ee --- /dev/null +++ b/drivers/virt/geniezone/gzvm_irqfd.c @@ -0,0 +1,566 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include "gzvm_common.h" + +struct gzvm_irq_ack_notifier { + struct hlist_node link; + unsigned int gsi; + void (*irq_acked)(struct gzvm_irq_ack_notifier *ian); +}; + +/** + * struct gzvm_kernel_irqfd_resampler - irqfd resampler descriptor. + * @gzvm: Poiner to gzvm. + * @list: List of resampling struct _irqfd objects sharing this gsi. + * RCU list modified under gzvm->irqfds.resampler_lock. + * @notifier: gzvm irq ack notifier. + * @link: Entry in list of gzvm->irqfd.resampler_list. + * Use for sharing esamplers among irqfds on the same gsi. + * Accessed and modified under gzvm->irqfds.resampler_lock. + * + * Resampling irqfds are a special variety of irqfds used to emulate + * level triggered interrupts. The interrupt is asserted on eventfd + * trigger. On acknowledgment through the irq ack notifier, the + * interrupt is de-asserted and userspace is notified through the + * resamplefd. All resamplers on the same gsi are de-asserted + * together, so we don't need to track the state of each individual + * user. We can also therefore share the same irq source ID. + */ +struct gzvm_kernel_irqfd_resampler { + struct gzvm *gzvm; + + struct list_head list; + struct gzvm_irq_ack_notifier notifier; + + struct list_head link; +}; + +/** + * struct gzvm_kernel_irqfd: gzvm kernel irqfd descriptor. + * @gzvm: Pointer to struct gzvm. + * @wait: Wait queue entry. + * @gsi: Used for level IRQ fast-path. + * @resampler: The resampler used by this irqfd (resampler-only). + * @resamplefd: Eventfd notified on resample (resampler-only). + * @resampler_link: Entry in list of irqfds for a resampler (resampler-only). + * @eventfd: Used for setup/shutdown. + * @list: struct list_head. + * @pt: struct poll_table_struct. + * @shutdown: struct work_struct. + */ +struct gzvm_kernel_irqfd { + struct gzvm *gzvm; + wait_queue_entry_t wait; + + int gsi; + + struct gzvm_kernel_irqfd_resampler *resampler; + + struct eventfd_ctx *resamplefd; + + struct list_head resampler_link; + + struct eventfd_ctx *eventfd; + struct list_head list; + poll_table pt; + struct work_struct shutdown; +}; + +static struct workqueue_struct *irqfd_cleanup_wq; + +/** + * irqfd_set_spi(): irqfd to inject virtual interrupt. + * @gzvm: Pointer to gzvm. + * @irq_source_id: irq source id. + * @irq: This is spi interrupt number (starts from 0 instead of 32). + * @level: irq triggered level. + * @line_status: irq status. + */ +static void irqfd_set_spi(struct gzvm *gzvm, int irq_source_id, u32 irq, + int level, bool line_status) +{ + if (level) + gzvm_irqchip_inject_irq(gzvm, irq_source_id, 0, irq, level); +} + +/** + * irqfd_resampler_ack() - Notify all of the resampler irqfds using this GSI + * when IRQ de-assert once. + * @ian: Pointer to gzvm_irq_ack_notifier. + * + * Since resampler irqfds share an IRQ source ID, we de-assert once + * then notify all of the resampler irqfds using this GSI. We can't + * do multiple de-asserts or we risk racing with incoming re-asserts. + */ +static void irqfd_resampler_ack(struct gzvm_irq_ack_notifier *ian) +{ + struct gzvm_kernel_irqfd_resampler *resampler; + struct gzvm *gzvm; + struct gzvm_kernel_irqfd *irqfd; + int idx; + + resampler = container_of(ian, + struct gzvm_kernel_irqfd_resampler, notifier); + gzvm = resampler->gzvm; + + irqfd_set_spi(gzvm, GZVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, + resampler->notifier.gsi, 0, false); + + idx = srcu_read_lock(&gzvm->irq_srcu); + + list_for_each_entry_srcu(irqfd, &resampler->list, resampler_link, + srcu_read_lock_held(&gzvm->irq_srcu)) { + eventfd_signal(irqfd->resamplefd, 1); + } + + srcu_read_unlock(&gzvm->irq_srcu, idx); +} + +static void gzvm_register_irq_ack_notifier(struct gzvm *gzvm, + struct gzvm_irq_ack_notifier *ian) +{ + mutex_lock(&gzvm->irq_lock); + hlist_add_head_rcu(&ian->link, &gzvm->irq_ack_notifier_list); + mutex_unlock(&gzvm->irq_lock); +} + +static void gzvm_unregister_irq_ack_notifier(struct gzvm *gzvm, + struct gzvm_irq_ack_notifier *ian) +{ + mutex_lock(&gzvm->irq_lock); + hlist_del_init_rcu(&ian->link); + mutex_unlock(&gzvm->irq_lock); + synchronize_srcu(&gzvm->irq_srcu); +} + +static void irqfd_resampler_shutdown(struct gzvm_kernel_irqfd *irqfd) +{ + struct gzvm_kernel_irqfd_resampler *resampler = irqfd->resampler; + struct gzvm *gzvm = resampler->gzvm; + + mutex_lock(&gzvm->irqfds.resampler_lock); + + list_del_rcu(&irqfd->resampler_link); + synchronize_srcu(&gzvm->irq_srcu); + + if (list_empty(&resampler->list)) { + list_del(&resampler->link); + gzvm_unregister_irq_ack_notifier(gzvm, &resampler->notifier); + irqfd_set_spi(gzvm, GZVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, + resampler->notifier.gsi, 0, false); + kfree(resampler); + } + + mutex_unlock(&gzvm->irqfds.resampler_lock); +} + +/** + * irqfd_shutdown() - Race-free decouple logic (ordering is critical). + * @work: Pointer to work_struct. + */ +static void irqfd_shutdown(struct work_struct *work) +{ + struct gzvm_kernel_irqfd *irqfd = + container_of(work, struct gzvm_kernel_irqfd, shutdown); + struct gzvm *gzvm = irqfd->gzvm; + u64 cnt; + + /* Make sure irqfd has been initialized in assign path. */ + synchronize_srcu(&gzvm->irq_srcu); + + /* + * Synchronize with the wait-queue and unhook ourselves to prevent + * further events. + */ + eventfd_ctx_remove_wait_queue(irqfd->eventfd, &irqfd->wait, &cnt); + + if (irqfd->resampler) { + irqfd_resampler_shutdown(irqfd); + eventfd_ctx_put(irqfd->resamplefd); + } + + /* + * It is now safe to release the object's resources + */ + eventfd_ctx_put(irqfd->eventfd); + kfree(irqfd); +} + +/** + * irqfd_is_active() - Assumes gzvm->irqfds.lock is held. + * @irqfd: Pointer to gzvm_kernel_irqfd. + * + * Return: + * * true - irqfd is active. + */ +static bool irqfd_is_active(struct gzvm_kernel_irqfd *irqfd) +{ + return list_empty(&irqfd->list) ? false : true; +} + +/** + * irqfd_deactivate() - Mark the irqfd as inactive and schedule it for removal. + * assumes gzvm->irqfds.lock is held. + * @irqfd: Pointer to gzvm_kernel_irqfd. + */ +static void irqfd_deactivate(struct gzvm_kernel_irqfd *irqfd) +{ + if (!irqfd_is_active(irqfd)) + return; + + list_del_init(&irqfd->list); + + queue_work(irqfd_cleanup_wq, &irqfd->shutdown); +} + +/** + * irqfd_wakeup() - Callback of irqfd wait queue, would be woken by writing to + * irqfd to do virtual interrupt injection. + * @wait: Pointer to wait_queue_entry_t. + * @mode: Unused. + * @sync: Unused. + * @key: Get flags about Epoll events. + * + * Return: + * * 0 - Success + */ +static int irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, int sync, + void *key) +{ + struct gzvm_kernel_irqfd *irqfd = + container_of(wait, struct gzvm_kernel_irqfd, wait); + __poll_t flags = key_to_poll(key); + struct gzvm *gzvm = irqfd->gzvm; + + if (flags & EPOLLIN) { + u64 cnt; + + eventfd_ctx_do_read(irqfd->eventfd, &cnt); + /* gzvm's irq injection is not blocked, don't need workq */ + irqfd_set_spi(gzvm, GZVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, + 1, false); + } + + if (flags & EPOLLHUP) { + /* The eventfd is closing, detach from GZVM */ + unsigned long iflags; + + spin_lock_irqsave(&gzvm->irqfds.lock, iflags); + + /* + * Do more check if someone deactivated the irqfd before + * we could acquire the irqfds.lock. + */ + if (irqfd_is_active(irqfd)) + irqfd_deactivate(irqfd); + + spin_unlock_irqrestore(&gzvm->irqfds.lock, iflags); + } + + return 0; +} + +static void irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh, + poll_table *pt) +{ + struct gzvm_kernel_irqfd *irqfd = + container_of(pt, struct gzvm_kernel_irqfd, pt); + add_wait_queue_priority(wqh, &irqfd->wait); +} + +static int gzvm_irqfd_assign(struct gzvm *gzvm, struct gzvm_irqfd *args) +{ + struct gzvm_kernel_irqfd *irqfd, *tmp; + struct fd f; + struct eventfd_ctx *eventfd = NULL, *resamplefd = NULL; + int ret; + __poll_t events; + int idx; + + irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL_ACCOUNT); + if (!irqfd) + return -ENOMEM; + + irqfd->gzvm = gzvm; + irqfd->gsi = args->gsi; + irqfd->resampler = NULL; + + INIT_LIST_HEAD(&irqfd->list); + INIT_WORK(&irqfd->shutdown, irqfd_shutdown); + + f = fdget(args->fd); + if (!f.file) { + ret = -EBADF; + goto out; + } + + eventfd = eventfd_ctx_fileget(f.file); + if (IS_ERR(eventfd)) { + ret = PTR_ERR(eventfd); + goto fail; + } + + irqfd->eventfd = eventfd; + + if (args->flags & GZVM_IRQFD_FLAG_RESAMPLE) { + struct gzvm_kernel_irqfd_resampler *resampler; + + resamplefd = eventfd_ctx_fdget(args->resamplefd); + if (IS_ERR(resamplefd)) { + ret = PTR_ERR(resamplefd); + goto fail; + } + + irqfd->resamplefd = resamplefd; + INIT_LIST_HEAD(&irqfd->resampler_link); + + mutex_lock(&gzvm->irqfds.resampler_lock); + + list_for_each_entry(resampler, + &gzvm->irqfds.resampler_list, link) { + if (resampler->notifier.gsi == irqfd->gsi) { + irqfd->resampler = resampler; + break; + } + } + + if (!irqfd->resampler) { + resampler = kzalloc(sizeof(*resampler), + GFP_KERNEL_ACCOUNT); + if (!resampler) { + ret = -ENOMEM; + mutex_unlock(&gzvm->irqfds.resampler_lock); + goto fail; + } + + resampler->gzvm = gzvm; + INIT_LIST_HEAD(&resampler->list); + resampler->notifier.gsi = irqfd->gsi; + resampler->notifier.irq_acked = irqfd_resampler_ack; + INIT_LIST_HEAD(&resampler->link); + + list_add(&resampler->link, &gzvm->irqfds.resampler_list); + gzvm_register_irq_ack_notifier(gzvm, + &resampler->notifier); + irqfd->resampler = resampler; + } + + list_add_rcu(&irqfd->resampler_link, &irqfd->resampler->list); + synchronize_srcu(&gzvm->irq_srcu); + + mutex_unlock(&gzvm->irqfds.resampler_lock); + } + + /* + * Install our own custom wake-up handling so we are notified via + * a callback whenever someone signals the underlying eventfd + */ + init_waitqueue_func_entry(&irqfd->wait, irqfd_wakeup); + init_poll_funcptr(&irqfd->pt, irqfd_ptable_queue_proc); + + spin_lock_irq(&gzvm->irqfds.lock); + + ret = 0; + list_for_each_entry(tmp, &gzvm->irqfds.items, list) { + if (irqfd->eventfd != tmp->eventfd) + continue; + /* This fd is used for another irq already. */ + pr_err("already used: gsi=%d fd=%d\n", args->gsi, args->fd); + ret = -EBUSY; + spin_unlock_irq(&gzvm->irqfds.lock); + goto fail; + } + + idx = srcu_read_lock(&gzvm->irq_srcu); + + list_add_tail(&irqfd->list, &gzvm->irqfds.items); + + spin_unlock_irq(&gzvm->irqfds.lock); + + /* + * Check if there was an event already pending on the eventfd + * before we registered, and trigger it as if we didn't miss it. + */ + events = vfs_poll(f.file, &irqfd->pt); + + /* In case there is already a pending event */ + if (events & EPOLLIN) + irqfd_set_spi(gzvm, GZVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, + irqfd->gsi, 1, false); + + srcu_read_unlock(&gzvm->irq_srcu, idx); + + /* + * do not drop the file until the irqfd is fully initialized, otherwise + * we might race against the EPOLLHUP + */ + fdput(f); + return 0; + +fail: + if (irqfd->resampler) + irqfd_resampler_shutdown(irqfd); + + if (resamplefd && !IS_ERR(resamplefd)) + eventfd_ctx_put(resamplefd); + + if (eventfd && !IS_ERR(eventfd)) + eventfd_ctx_put(eventfd); + + fdput(f); + +out: + kfree(irqfd); + return ret; +} + +static void gzvm_notify_acked_gsi(struct gzvm *gzvm, int gsi) +{ + struct gzvm_irq_ack_notifier *gian; + + hlist_for_each_entry_srcu(gian, &gzvm->irq_ack_notifier_list, + link, srcu_read_lock_held(&gzvm->irq_srcu)) + if (gian->gsi == gsi) + gian->irq_acked(gian); +} + +void gzvm_notify_acked_irq(struct gzvm *gzvm, unsigned int gsi) +{ + int idx; + + idx = srcu_read_lock(&gzvm->irq_srcu); + gzvm_notify_acked_gsi(gzvm, gsi); + srcu_read_unlock(&gzvm->irq_srcu, idx); +} + +/** + * gzvm_irqfd_deassign() - Shutdown any irqfd's that match fd+gsi. + * @gzvm: Pointer to gzvm. + * @args: Pointer to gzvm_irqfd. + * + * Return: + * * 0 - Success. + * * Negative value - Failure. + */ +static int gzvm_irqfd_deassign(struct gzvm *gzvm, struct gzvm_irqfd *args) +{ + struct gzvm_kernel_irqfd *irqfd, *tmp; + struct eventfd_ctx *eventfd; + + eventfd = eventfd_ctx_fdget(args->fd); + if (IS_ERR(eventfd)) + return PTR_ERR(eventfd); + + spin_lock_irq(&gzvm->irqfds.lock); + + list_for_each_entry_safe(irqfd, tmp, &gzvm->irqfds.items, list) { + if (irqfd->eventfd == eventfd && irqfd->gsi == args->gsi) + irqfd_deactivate(irqfd); + } + + spin_unlock_irq(&gzvm->irqfds.lock); + eventfd_ctx_put(eventfd); + + /* + * Block until we know all outstanding shutdown jobs have completed + * so that we guarantee there will not be any more interrupts on this + * gsi once this deassign function returns. + */ + flush_workqueue(irqfd_cleanup_wq); + + return 0; +} + +int gzvm_irqfd(struct gzvm *gzvm, struct gzvm_irqfd *args) +{ + for (int i = 0; i < ARRAY_SIZE(args->pad); i++) { + if (args->pad[i]) + return -EINVAL; + } + + if (args->flags & + ~(GZVM_IRQFD_FLAG_DEASSIGN | GZVM_IRQFD_FLAG_RESAMPLE)) + return -EINVAL; + + if (args->flags & GZVM_IRQFD_FLAG_DEASSIGN) + return gzvm_irqfd_deassign(gzvm, args); + + return gzvm_irqfd_assign(gzvm, args); +} + +/** + * gzvm_vm_irqfd_init() - Initialize irqfd data structure per VM + * + * @gzvm: Pointer to struct gzvm. + * + * Return: + * * 0 - Success. + * * Negative - Failure. + */ +int gzvm_vm_irqfd_init(struct gzvm *gzvm) +{ + mutex_init(&gzvm->irq_lock); + + spin_lock_init(&gzvm->irqfds.lock); + INIT_LIST_HEAD(&gzvm->irqfds.items); + INIT_LIST_HEAD(&gzvm->irqfds.resampler_list); + if (init_srcu_struct(&gzvm->irq_srcu)) + return -EINVAL; + INIT_HLIST_HEAD(&gzvm->irq_ack_notifier_list); + mutex_init(&gzvm->irqfds.resampler_lock); + + return 0; +} + +/** + * gzvm_vm_irqfd_release() - This function is called as the gzvm VM fd is being + * released. Shutdown all irqfds that still remain open. + * @gzvm: Pointer to gzvm. + */ +void gzvm_vm_irqfd_release(struct gzvm *gzvm) +{ + struct gzvm_kernel_irqfd *irqfd, *tmp; + + spin_lock_irq(&gzvm->irqfds.lock); + + list_for_each_entry_safe(irqfd, tmp, &gzvm->irqfds.items, list) + irqfd_deactivate(irqfd); + + spin_unlock_irq(&gzvm->irqfds.lock); + + /* + * Block until we know all outstanding shutdown jobs have completed. + */ + flush_workqueue(irqfd_cleanup_wq); +} + +/** + * gzvm_drv_irqfd_init() - Erase flushing work items when a VM exits. + * + * Return: + * * 0 - Success. + * * Negative - Failure. + * + * Create a host-wide workqueue for issuing deferred shutdown requests + * aggregated from all vm* instances. We need our own isolated + * queue to ease flushing work items when a VM exits. + */ +int gzvm_drv_irqfd_init(void) +{ + irqfd_cleanup_wq = alloc_workqueue("gzvm-irqfd-cleanup", 0, 0); + if (!irqfd_cleanup_wq) + return -ENOMEM; + + return 0; +} + +void gzvm_drv_irqfd_exit(void) +{ + destroy_workqueue(irqfd_cleanup_wq); +} diff --git a/drivers/virt/geniezone/gzvm_main.c b/drivers/virt/geniezone/gzvm_main.c index 9168ed251b08..3d970ab1dd8a 100644 --- a/drivers/virt/geniezone/gzvm_main.c +++ b/drivers/virt/geniezone/gzvm_main.c @@ -109,11 +109,12 @@ static int gzvm_drv_probe(struct platform_device *pdev) if (ret) return ret; - return 0; + return gzvm_drv_irqfd_init(); } static int gzvm_drv_remove(struct platform_device *pdev) { + gzvm_drv_irqfd_exit(); gzvm_destroy_all_vms(); misc_deregister(&gzvm_dev); return 0; diff --git a/drivers/virt/geniezone/gzvm_vcpu.c b/drivers/virt/geniezone/gzvm_vcpu.c index e051343f2b0e..a717fc713b2e 100644 --- a/drivers/virt/geniezone/gzvm_vcpu.c +++ b/drivers/virt/geniezone/gzvm_vcpu.c @@ -227,6 +227,7 @@ int gzvm_vm_ioctl_create_vcpu(struct gzvm *gzvm, u32 cpuid) ret = -ENOMEM; goto free_vcpu; } + vcpu->hwstate = (void *)vcpu->run + PAGE_SIZE; vcpu->vcpuid = cpuid; vcpu->gzvm = gzvm; mutex_init(&vcpu->lock); diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c index b1397180cd02..a93f5b0e7078 100644 --- a/drivers/virt/geniezone/gzvm_vm.c +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -376,6 +376,16 @@ static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl, ret = gzvm_vm_ioctl_create_device(gzvm, argp); break; } + case GZVM_IRQFD: { + struct gzvm_irqfd data; + + if (copy_from_user(&data, argp, sizeof(data))) { + ret = -EFAULT; + goto out; + } + ret = gzvm_irqfd(gzvm, &data); + break; + } case GZVM_ENABLE_CAP: { struct gzvm_enable_cap cap; @@ -399,6 +409,7 @@ static void gzvm_destroy_vm(struct gzvm *gzvm) mutex_lock(&gzvm->lock); + gzvm_vm_irqfd_release(gzvm); gzvm_destroy_vcpus(gzvm); gzvm_arch_destroy_vm(gzvm->vm_id); @@ -444,6 +455,13 @@ static struct gzvm *gzvm_create_vm(unsigned long vm_type) gzvm->mm = current->mm; mutex_init(&gzvm->lock); + ret = gzvm_vm_irqfd_init(gzvm); + if (ret) { + pr_err("Failed to initialize irqfd\n"); + kfree(gzvm); + return ERR_PTR(ret); + } + mutex_lock(&gzvm_list_lock); list_add(&gzvm->vm_list, &gzvm_list); mutex_unlock(&gzvm_list_lock); diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h index fd703538c817..690ab35da9bc 100644 --- a/include/linux/gzvm_drv.h +++ b/include/linux/gzvm_drv.h @@ -10,6 +10,7 @@ #include #include #include +#include #define GZVM_VCPU_MMAP_SIZE PAGE_SIZE #define INVALID_VM_ID 0xffff @@ -24,6 +25,8 @@ #define ERR_NOT_SUPPORTED (-24) #define ERR_NOT_IMPLEMENTED (-27) #define ERR_FAULT (-40) +#define GZVM_USERSPACE_IRQ_SOURCE_ID 0 +#define GZVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 /* * The following data structures are for data transferring between driver and @@ -67,6 +70,7 @@ struct gzvm_vcpu { /* lock of vcpu*/ struct mutex lock; struct gzvm_vcpu_run *run; + struct gzvm_vcpu_hwstate *hwstate; }; struct gzvm { @@ -76,8 +80,23 @@ struct gzvm { struct gzvm_memslot memslot[GZVM_MAX_MEM_REGION]; /* lock for list_add*/ struct mutex lock; + + struct { + /* lock for irqfds list operation */ + spinlock_t lock; + struct list_head items; + struct list_head resampler_list; + /* lock for irqfds resampler */ + struct mutex resampler_lock; + } irqfds; + struct list_head vm_list; u16 vm_id; + + struct hlist_head irq_ack_notifier_list; + struct srcu_struct irq_srcu; + /* lock for irq injection */ + struct mutex irq_lock; }; long gzvm_dev_ioctl_check_extension(struct gzvm *gzvm, unsigned long args); @@ -113,4 +132,11 @@ int gzvm_arch_create_device(u16 vm_id, struct gzvm_create_device *gzvm_dev); int gzvm_arch_inject_irq(struct gzvm *gzvm, unsigned int vcpu_idx, u32 irq_type, u32 irq, bool level); +void gzvm_notify_acked_irq(struct gzvm *gzvm, unsigned int gsi); +int gzvm_irqfd(struct gzvm *gzvm, struct gzvm_irqfd *args); +int gzvm_drv_irqfd_init(void); +void gzvm_drv_irqfd_exit(void); +int gzvm_vm_irqfd_init(struct gzvm *gzvm); +void gzvm_vm_irqfd_release(struct gzvm *gzvm); + #endif /* __GZVM_DRV_H__ */ diff --git a/include/uapi/linux/gzvm.h b/include/uapi/linux/gzvm.h index fb019d232a98..f4b16d70f035 100644 --- a/include/uapi/linux/gzvm.h +++ b/include/uapi/linux/gzvm.h @@ -275,4 +275,30 @@ struct gzvm_one_reg { #define GZVM_REG_GENERIC 0x0000000000000000ULL +#define GZVM_IRQFD_FLAG_DEASSIGN BIT(0) +/* + * GZVM_IRQFD_FLAG_RESAMPLE indicates resamplefd is valid and specifies + * the irqfd to operate in resampling mode for level triggered interrupt + * emulation. + */ +#define GZVM_IRQFD_FLAG_RESAMPLE BIT(1) + +/** + * struct gzvm_irqfd: gzvm irqfd descriptor + * @fd: File descriptor. + * @gsi: Used for level IRQ fast-path. + * @flags: FLAG_DEASSIGN or FLAG_RESAMPLE. + * @resamplefd: The file descriptor of the resampler. + * @pad: Reserved for future-proof. + */ +struct gzvm_irqfd { + __u32 fd; + __u32 gsi; + __u32 flags; + __u32 resamplefd; + __u8 pad[16]; +}; + +#define GZVM_IRQFD _IOW(GZVM_IOC_MAGIC, 0x76, struct gzvm_irqfd) + #endif /* __GZVM_H__ */ From c26057e351fadf1af9ae2e1149e15e85fb3f789e Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Tue, 18 Apr 2023 12:11:14 +0800 Subject: [PATCH 044/113] FROMLIST: virt: geniezone: Add ioeventfd support Ioeventfd leverages eventfd to provide asynchronous notification mechanism for VMM. VMM can register a mmio address and bind with an eventfd. Once a mmio trap occurs on this registered region, its corresponding eventfd will be notified. Change-Id: Iff6bb7dd8ba42d08813e531ab40629492a1218bc Signed-off-by: Yingshiuan Pan Signed-off-by: Liju Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-8-yi-de.wu@mediatek.com/ --- drivers/virt/geniezone/Makefile | 3 +- drivers/virt/geniezone/gzvm_ioeventfd.c | 273 ++++++++++++++++++++++++ drivers/virt/geniezone/gzvm_vcpu.c | 27 ++- drivers/virt/geniezone/gzvm_vm.c | 17 ++ include/linux/gzvm_drv.h | 12 ++ include/uapi/linux/gzvm.h | 25 +++ 6 files changed, 355 insertions(+), 2 deletions(-) create mode 100644 drivers/virt/geniezone/gzvm_ioeventfd.c diff --git a/drivers/virt/geniezone/Makefile b/drivers/virt/geniezone/Makefile index 19a835b0aac2..bc5ae49f2407 100644 --- a/drivers/virt/geniezone/Makefile +++ b/drivers/virt/geniezone/Makefile @@ -7,4 +7,5 @@ GZVM_DIR ?= ../../../drivers/virt/geniezone gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o \ - $(GZVM_DIR)/gzvm_vcpu.o $(GZVM_DIR)/gzvm_irqfd.o + $(GZVM_DIR)/gzvm_vcpu.o $(GZVM_DIR)/gzvm_irqfd.o \ + $(GZVM_DIR)/gzvm_ioeventfd.o diff --git a/drivers/virt/geniezone/gzvm_ioeventfd.c b/drivers/virt/geniezone/gzvm_ioeventfd.c new file mode 100644 index 000000000000..8d41db16ada2 --- /dev/null +++ b/drivers/virt/geniezone/gzvm_ioeventfd.c @@ -0,0 +1,273 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023 MediaTek Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct gzvm_ioevent { + struct list_head list; + __u64 addr; + __u32 len; + struct eventfd_ctx *evt_ctx; + __u64 datamatch; + bool wildcard; +}; + +/** + * ioeventfd_check_collision() - Check collison assumes gzvm->slots_lock held. + * @gzvm: Pointer to gzvm. + * @p: Pointer to gzvm_ioevent. + * + * Return: + * * true - collison found + * * false - no collison + */ +static bool ioeventfd_check_collision(struct gzvm *gzvm, struct gzvm_ioevent *p) +{ + struct gzvm_ioevent *_p; + + list_for_each_entry(_p, &gzvm->ioevents, list) + if (_p->addr == p->addr && + (!_p->len || !p->len || + (_p->len == p->len && + (_p->wildcard || p->wildcard || + _p->datamatch == p->datamatch)))) + return true; + + return false; +} + +static void gzvm_ioevent_release(struct gzvm_ioevent *p) +{ + eventfd_ctx_put(p->evt_ctx); + list_del(&p->list); + kfree(p); +} + +static bool gzvm_ioevent_in_range(struct gzvm_ioevent *p, __u64 addr, int len, + const void *val) +{ + u64 _val; + + if (addr != p->addr) + /* address must be precise for a hit */ + return false; + + if (!p->len) + /* length = 0 means only look at the address, so always a hit */ + return true; + + if (len != p->len) + /* address-range must be precise for a hit */ + return false; + + if (p->wildcard) + /* all else equal, wildcard is always a hit */ + return true; + + /* otherwise, we have to actually compare the data */ + + WARN_ON_ONCE(!IS_ALIGNED((unsigned long)val, len)); + + switch (len) { + case 1: + _val = *(u8 *)val; + break; + case 2: + _val = *(u16 *)val; + break; + case 4: + _val = *(u32 *)val; + break; + case 8: + _val = *(u64 *)val; + break; + default: + return false; + } + + return _val == p->datamatch; +} + +static int gzvm_deassign_ioeventfd(struct gzvm *gzvm, + struct gzvm_ioeventfd *args) +{ + struct gzvm_ioevent *p, *tmp; + struct eventfd_ctx *evt_ctx; + int ret = -ENOENT; + bool wildcard; + + evt_ctx = eventfd_ctx_fdget(args->fd); + if (IS_ERR(evt_ctx)) + return PTR_ERR(evt_ctx); + + wildcard = !(args->flags & GZVM_IOEVENTFD_FLAG_DATAMATCH); + + mutex_lock(&gzvm->lock); + + list_for_each_entry_safe(p, tmp, &gzvm->ioevents, list) { + if (p->evt_ctx != evt_ctx || + p->addr != args->addr || + p->len != args->len || + p->wildcard != wildcard) + continue; + + if (!p->wildcard && p->datamatch != args->datamatch) + continue; + + gzvm_ioevent_release(p); + ret = 0; + break; + } + + mutex_unlock(&gzvm->lock); + + /* got in the front of this function */ + eventfd_ctx_put(evt_ctx); + + return ret; +} + +static int gzvm_assign_ioeventfd(struct gzvm *gzvm, struct gzvm_ioeventfd *args) +{ + struct eventfd_ctx *evt_ctx; + struct gzvm_ioevent *evt; + int ret; + + evt_ctx = eventfd_ctx_fdget(args->fd); + if (IS_ERR(evt_ctx)) + return PTR_ERR(evt_ctx); + + evt = kmalloc(sizeof(*evt), GFP_KERNEL); + if (!evt) + return -ENOMEM; + *evt = (struct gzvm_ioevent) { + .addr = args->addr, + .len = args->len, + .evt_ctx = evt_ctx, + }; + if (args->flags & GZVM_IOEVENTFD_FLAG_DATAMATCH) { + evt->datamatch = args->datamatch; + evt->wildcard = false; + } else { + evt->wildcard = true; + } + + if (ioeventfd_check_collision(gzvm, evt)) { + ret = -EEXIST; + goto err_free; + } + + mutex_lock(&gzvm->lock); + list_add_tail(&evt->list, &gzvm->ioevents); + mutex_unlock(&gzvm->lock); + + return 0; + +err_free: + kfree(evt); + eventfd_ctx_put(evt_ctx); + return ret; +} + +/** + * gzvm_ioeventfd_check_valid() - Check user arguments is valid. + * @args: Pointer to gzvm_ioeventfd. + * + * Return: + * * true if user arguments are valid. + * * false if user arguments are invalid. + */ +static bool gzvm_ioeventfd_check_valid(struct gzvm_ioeventfd *args) +{ + /* must be natural-word sized, or 0 to ignore length */ + switch (args->len) { + case 0: + case 1: + case 2: + case 4: + case 8: + break; + default: + return false; + } + + /* check for range overflow */ + if (args->addr + args->len < args->addr) + return false; + + /* check for extra flags that we don't understand */ + if (args->flags & ~GZVM_IOEVENTFD_VALID_FLAG_MASK) + return false; + + /* ioeventfd with no length can't be combined with DATAMATCH */ + if (!args->len && (args->flags & GZVM_IOEVENTFD_FLAG_DATAMATCH)) + return false; + + /* gzvm does not support pio bus ioeventfd */ + if (args->flags & GZVM_IOEVENTFD_FLAG_PIO) + return false; + + return true; +} + +/** + * gzvm_ioeventfd() - Register ioevent to ioevent list. + * @gzvm: Pointer to gzvm. + * @args: Pointer to gzvm_ioeventfd. + * + * Return: + * * 0 - Success. + * * Negative - Failure. + */ +int gzvm_ioeventfd(struct gzvm *gzvm, struct gzvm_ioeventfd *args) +{ + if (gzvm_ioeventfd_check_valid(args) == false) + return -EINVAL; + + if (args->flags & GZVM_IOEVENTFD_FLAG_DEASSIGN) + return gzvm_deassign_ioeventfd(gzvm, args); + return gzvm_assign_ioeventfd(gzvm, args); +} + +/** + * gzvm_ioevent_write() - Travers this vm's registered ioeventfd to see if + * need notifying it. + * @vcpu: Pointer to vcpu. + * @addr: mmio address. + * @len: mmio size. + * @val: Pointer to void. + * + * Return: + * * true if this io is already sent to ioeventfd's listener. + * * false if we cannot find any ioeventfd registering this mmio write. + */ +bool gzvm_ioevent_write(struct gzvm_vcpu *vcpu, __u64 addr, int len, + const void *val) +{ + struct gzvm_ioevent *e; + + list_for_each_entry(e, &vcpu->gzvm->ioevents, list) { + if (gzvm_ioevent_in_range(e, addr, len, val)) { + eventfd_signal(e->evt_ctx, 1); + return true; + } + } + return false; +} + +int gzvm_init_ioeventfd(struct gzvm *gzvm) +{ + INIT_LIST_HEAD(&gzvm->ioevents); + + return 0; +} diff --git a/drivers/virt/geniezone/gzvm_vcpu.c b/drivers/virt/geniezone/gzvm_vcpu.c index a717fc713b2e..72bd122a8be7 100644 --- a/drivers/virt/geniezone/gzvm_vcpu.c +++ b/drivers/virt/geniezone/gzvm_vcpu.c @@ -50,6 +50,30 @@ static long gzvm_vcpu_update_one_reg(struct gzvm_vcpu *vcpu, return 0; } +/** + * gzvm_vcpu_handle_mmio() - Handle mmio in kernel space. + * @vcpu: Pointer to vcpu. + * + * Return: + * * true - This mmio exit has been processed. + * * false - This mmio exit has not been processed, require userspace. + */ +static bool gzvm_vcpu_handle_mmio(struct gzvm_vcpu *vcpu) +{ + __u64 addr; + __u32 len; + const void *val_ptr; + + /* So far, we don't have in-kernel mmio read handler */ + if (!vcpu->run->mmio.is_write) + return false; + addr = vcpu->run->mmio.phys_addr; + len = vcpu->run->mmio.size; + val_ptr = &vcpu->run->mmio.data; + + return gzvm_ioevent_write(vcpu, addr, len, val_ptr); +} + /** * gzvm_vcpu_run() - Handle vcpu run ioctl, entry point to guest and exit * point from guest @@ -81,7 +105,8 @@ static long gzvm_vcpu_run(struct gzvm_vcpu *vcpu, void * __user argp) switch (exit_reason) { case GZVM_EXIT_MMIO: - need_userspace = true; + if (!gzvm_vcpu_handle_mmio(vcpu)) + need_userspace = true; break; /** * it's geniezone's responsibility to fill corresponding data diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c index a93f5b0e7078..60bd017e41fa 100644 --- a/drivers/virt/geniezone/gzvm_vm.c +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -386,6 +386,16 @@ static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl, ret = gzvm_irqfd(gzvm, &data); break; } + case GZVM_IOEVENTFD: { + struct gzvm_ioeventfd data; + + if (copy_from_user(&data, argp, sizeof(data))) { + ret = -EFAULT; + goto out; + } + ret = gzvm_ioeventfd(gzvm, &data); + break; + } case GZVM_ENABLE_CAP: { struct gzvm_enable_cap cap; @@ -462,6 +472,13 @@ static struct gzvm *gzvm_create_vm(unsigned long vm_type) return ERR_PTR(ret); } + ret = gzvm_init_ioeventfd(gzvm); + if (ret) { + pr_err("Failed to initialize ioeventfd\n"); + kfree(gzvm); + return ERR_PTR(ret); + } + mutex_lock(&gzvm_list_lock); list_add(&gzvm->vm_list, &gzvm_list); mutex_unlock(&gzvm_list_lock); diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h index 690ab35da9bc..e3be47286053 100644 --- a/include/linux/gzvm_drv.h +++ b/include/linux/gzvm_drv.h @@ -6,6 +6,7 @@ #ifndef __GZVM_DRV_H__ #define __GZVM_DRV_H__ +#include #include #include #include @@ -90,6 +91,8 @@ struct gzvm { struct mutex resampler_lock; } irqfds; + struct list_head ioevents; + struct list_head vm_list; u16 vm_id; @@ -139,4 +142,13 @@ void gzvm_drv_irqfd_exit(void); int gzvm_vm_irqfd_init(struct gzvm *gzvm); void gzvm_vm_irqfd_release(struct gzvm *gzvm); +int gzvm_init_ioeventfd(struct gzvm *gzvm); +int gzvm_ioeventfd(struct gzvm *gzvm, struct gzvm_ioeventfd *args); +bool gzvm_ioevent_write(struct gzvm_vcpu *vcpu, __u64 addr, int len, + const void *val); +void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt); +struct vm_area_struct *vma_lookup(struct mm_struct *mm, unsigned long addr); +void add_wait_queue_priority(struct wait_queue_head *wq_head, + struct wait_queue_entry *wq_entry); + #endif /* __GZVM_DRV_H__ */ diff --git a/include/uapi/linux/gzvm.h b/include/uapi/linux/gzvm.h index f4b16d70f035..506ef975de02 100644 --- a/include/uapi/linux/gzvm.h +++ b/include/uapi/linux/gzvm.h @@ -301,4 +301,29 @@ struct gzvm_irqfd { #define GZVM_IRQFD _IOW(GZVM_IOC_MAGIC, 0x76, struct gzvm_irqfd) +enum { + gzvm_ioeventfd_flag_nr_datamatch = 0, + gzvm_ioeventfd_flag_nr_pio = 1, + gzvm_ioeventfd_flag_nr_deassign = 2, + gzvm_ioeventfd_flag_nr_max, +}; + +#define GZVM_IOEVENTFD_FLAG_DATAMATCH (1 << gzvm_ioeventfd_flag_nr_datamatch) +#define GZVM_IOEVENTFD_FLAG_PIO (1 << gzvm_ioeventfd_flag_nr_pio) +#define GZVM_IOEVENTFD_FLAG_DEASSIGN (1 << gzvm_ioeventfd_flag_nr_deassign) +#define GZVM_IOEVENTFD_VALID_FLAG_MASK ((1 << gzvm_ioeventfd_flag_nr_max) - 1) + +struct gzvm_ioeventfd { + __u64 datamatch; + /* private: legal pio/mmio address */ + __u64 addr; + /* private: 1, 2, 4, or 8 bytes; or 0 to ignore length */ + __u32 len; + __s32 fd; + __u32 flags; + __u8 pad[36]; +}; + +#define GZVM_IOEVENTFD _IOW(GZVM_IOC_MAGIC, 0x79, struct gzvm_ioeventfd) + #endif /* __GZVM_H__ */ From 39bd65ec1dc2ca4e3b2b490d04832b0765e15f2e Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Thu, 1 Jun 2023 15:02:33 +0800 Subject: [PATCH 045/113] FROMLIST: virt: geniezone: Add memory region support Hypervisor might need to know the precise purpose of each memory region, so that it can provide specific memory protection. We add a new uapi to pass address and size of a memory region and its purpose. Change-Id: I53cc0953fd1e3f0aa3c0a91bb5877b2fb297c858 Signed-off-by: Jerry Wang Signed-off-by: Liju-clr Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-9-yi-de.wu@mediatek.com/ --- arch/arm64/geniezone/gzvm_arch_common.h | 2 ++ arch/arm64/geniezone/vm.c | 10 ++++++++++ drivers/virt/geniezone/gzvm_vm.c | 7 +++++++ include/linux/gzvm_drv.h | 3 +++ 4 files changed, 22 insertions(+) diff --git a/arch/arm64/geniezone/gzvm_arch_common.h b/arch/arm64/geniezone/gzvm_arch_common.h index 051d8f49a1df..321f5dbcd616 100644 --- a/arch/arm64/geniezone/gzvm_arch_common.h +++ b/arch/arm64/geniezone/gzvm_arch_common.h @@ -22,6 +22,7 @@ enum { GZVM_FUNC_PROBE = 12, GZVM_FUNC_ENABLE_CAP = 13, GZVM_FUNC_INFORM_EXIT = 14, + GZVM_FUNC_MEMREGION_PURPOSE = 15, NR_GZVM_FUNC, }; @@ -44,6 +45,7 @@ enum { #define MT_HVC_GZVM_PROBE GZVM_HCALL_ID(GZVM_FUNC_PROBE) #define MT_HVC_GZVM_ENABLE_CAP GZVM_HCALL_ID(GZVM_FUNC_ENABLE_CAP) #define MT_HVC_GZVM_INFORM_EXIT GZVM_HCALL_ID(GZVM_FUNC_INFORM_EXIT) +#define MT_HVC_GZVM_MEMREGION_PURPOSE GZVM_HCALL_ID(GZVM_FUNC_MEMREGION_PURPOSE) #define GIC_V3_NR_LRS 16 diff --git a/arch/arm64/geniezone/vm.c b/arch/arm64/geniezone/vm.c index 2df321f13057..17327081eb27 100644 --- a/arch/arm64/geniezone/vm.c +++ b/arch/arm64/geniezone/vm.c @@ -109,6 +109,16 @@ int gzvm_arch_destroy_vm(u16 vm_id) 0, 0, &res); } +int gzvm_arch_memregion_purpose(struct gzvm *gzvm, + struct gzvm_userspace_memory_region *mem) +{ + struct arm_smccc_res res; + + return gzvm_hypcall_wrapper(MT_HVC_GZVM_MEMREGION_PURPOSE, gzvm->vm_id, + mem->guest_phys_addr, mem->memory_size, + mem->flags, 0, 0, 0, &res); +} + static int gzvm_vm_arch_enable_cap(struct gzvm *gzvm, struct gzvm_enable_cap *cap, struct arm_smccc_res *res) diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c index 60bd017e41fa..a1cf970e4c91 100644 --- a/drivers/virt/geniezone/gzvm_vm.c +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -234,6 +234,7 @@ static int gzvm_vm_ioctl_set_memory_region(struct gzvm *gzvm, struct gzvm_userspace_memory_region *mem) { + int ret; struct vm_area_struct *vma; struct gzvm_memslot *memslot; unsigned long size; @@ -258,6 +259,12 @@ gzvm_vm_ioctl_set_memory_region(struct gzvm *gzvm, memslot->vma = vma; memslot->flags = mem->flags; memslot->slot_id = mem->slot; + + ret = gzvm_arch_memregion_purpose(gzvm, mem); + if (ret) { + pr_err("Failed to config memory region for the specified purpose\n"); + return -EFAULT; + } return register_memslot_addr_range(gzvm, memslot); } diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h index e3be47286053..feae52b588d5 100644 --- a/include/linux/gzvm_drv.h +++ b/include/linux/gzvm_drv.h @@ -142,6 +142,9 @@ void gzvm_drv_irqfd_exit(void); int gzvm_vm_irqfd_init(struct gzvm *gzvm); void gzvm_vm_irqfd_release(struct gzvm *gzvm); +int gzvm_arch_memregion_purpose(struct gzvm *gzvm, + struct gzvm_userspace_memory_region *mem); + int gzvm_init_ioeventfd(struct gzvm *gzvm); int gzvm_ioeventfd(struct gzvm *gzvm, struct gzvm_ioeventfd *args); bool gzvm_ioevent_write(struct gzvm_vcpu *vcpu, __u64 addr, int len, From 3e079b7691b8b408394bea862cf40f7384ed277d Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Thu, 1 Jun 2023 15:15:15 +0800 Subject: [PATCH 046/113] FROMLIST: virt: geniezone: Add dtb config support Hypervisor might need to know the accurate address and size of dtb passed from userspace. And then hypervisor would parse the dtb and get vm information. Change-Id: I23194d45f5c60555ba7fde9dd8d393443fd41310 Signed-off-by: Jerry Wang Signed-off-by: Liju-clr Chen Signed-off-by: Yi-De Wu Bug: 280363874 Link: https://lore.kernel.org/lkml/20230727080005.14474-10-yi-de.wu@mediatek.com/ --- arch/arm64/geniezone/gzvm_arch_common.h | 2 ++ arch/arm64/geniezone/vm.c | 9 +++++++++ drivers/virt/geniezone/gzvm_vm.c | 10 ++++++++++ include/linux/gzvm_drv.h | 1 + include/uapi/linux/gzvm.h | 14 ++++++++++++++ 5 files changed, 36 insertions(+) diff --git a/arch/arm64/geniezone/gzvm_arch_common.h b/arch/arm64/geniezone/gzvm_arch_common.h index 321f5dbcd616..82d2c44e819b 100644 --- a/arch/arm64/geniezone/gzvm_arch_common.h +++ b/arch/arm64/geniezone/gzvm_arch_common.h @@ -23,6 +23,7 @@ enum { GZVM_FUNC_ENABLE_CAP = 13, GZVM_FUNC_INFORM_EXIT = 14, GZVM_FUNC_MEMREGION_PURPOSE = 15, + GZVM_FUNC_SET_DTB_CONFIG = 16, NR_GZVM_FUNC, }; @@ -46,6 +47,7 @@ enum { #define MT_HVC_GZVM_ENABLE_CAP GZVM_HCALL_ID(GZVM_FUNC_ENABLE_CAP) #define MT_HVC_GZVM_INFORM_EXIT GZVM_HCALL_ID(GZVM_FUNC_INFORM_EXIT) #define MT_HVC_GZVM_MEMREGION_PURPOSE GZVM_HCALL_ID(GZVM_FUNC_MEMREGION_PURPOSE) +#define MT_HVC_GZVM_SET_DTB_CONFIG GZVM_HCALL_ID(GZVM_FUNC_SET_DTB_CONFIG) #define GIC_V3_NR_LRS 16 diff --git a/arch/arm64/geniezone/vm.c b/arch/arm64/geniezone/vm.c index 17327081eb27..a47e1d60dc1f 100644 --- a/arch/arm64/geniezone/vm.c +++ b/arch/arm64/geniezone/vm.c @@ -119,6 +119,15 @@ int gzvm_arch_memregion_purpose(struct gzvm *gzvm, mem->flags, 0, 0, 0, &res); } +int gzvm_arch_set_dtb_config(struct gzvm *gzvm, struct gzvm_dtb_config *cfg) +{ + struct arm_smccc_res res; + + return gzvm_hypcall_wrapper(MT_HVC_GZVM_SET_DTB_CONFIG, gzvm->vm_id, + cfg->dtb_addr, cfg->dtb_size, 0, 0, 0, 0, + &res); +} + static int gzvm_vm_arch_enable_cap(struct gzvm *gzvm, struct gzvm_enable_cap *cap, struct arm_smccc_res *res) diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c index a1cf970e4c91..8e9967b754df 100644 --- a/drivers/virt/geniezone/gzvm_vm.c +++ b/drivers/virt/geniezone/gzvm_vm.c @@ -413,6 +413,16 @@ static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl, ret = gzvm_vm_ioctl_enable_cap(gzvm, &cap, argp); break; } + case GZVM_SET_DTB_CONFIG: { + struct gzvm_dtb_config cfg; + + if (copy_from_user(&cfg, argp, sizeof(cfg))) { + ret = -EFAULT; + goto out; + } + ret = gzvm_arch_set_dtb_config(gzvm, &cfg); + break; + } default: ret = -ENOTTY; } diff --git a/include/linux/gzvm_drv.h b/include/linux/gzvm_drv.h index feae52b588d5..d76c2adc3c22 100644 --- a/include/linux/gzvm_drv.h +++ b/include/linux/gzvm_drv.h @@ -144,6 +144,7 @@ void gzvm_vm_irqfd_release(struct gzvm *gzvm); int gzvm_arch_memregion_purpose(struct gzvm *gzvm, struct gzvm_userspace_memory_region *mem); +int gzvm_arch_set_dtb_config(struct gzvm *gzvm, struct gzvm_dtb_config *args); int gzvm_init_ioeventfd(struct gzvm *gzvm); int gzvm_ioeventfd(struct gzvm *gzvm, struct gzvm_ioeventfd *args); diff --git a/include/uapi/linux/gzvm.h b/include/uapi/linux/gzvm.h index 506ef975de02..d37be00fbeea 100644 --- a/include/uapi/linux/gzvm.h +++ b/include/uapi/linux/gzvm.h @@ -326,4 +326,18 @@ struct gzvm_ioeventfd { #define GZVM_IOEVENTFD _IOW(GZVM_IOC_MAGIC, 0x79, struct gzvm_ioeventfd) +/** + * struct gzvm_dtb_config: store address and size of dtb passed from userspace + * + * @dtb_addr: dtb address set by VMM (guset memory) + * @dtb_size: dtb size + */ +struct gzvm_dtb_config { + __u64 dtb_addr; + __u64 dtb_size; +}; + +#define GZVM_SET_DTB_CONFIG _IOW(GZVM_IOC_MAGIC, 0xff, \ + struct gzvm_dtb_config) + #endif /* __GZVM_H__ */ From 9a399ca7133e2747eb6155f6c9621e3bdfb1f9e1 Mon Sep 17 00:00:00 2001 From: Ulises Mendez Martinez Date: Mon, 7 Aug 2023 12:42:40 +0000 Subject: [PATCH 047/113] ANDROID: Add arch specific gki module list targets * This is a no-op change preparing for the split of target and files based on the architecture used. Bug: 293529933 Change-Id: I7783b60e591aaad23b5446af5cb04af5765f4b3f Signed-off-by: Ulises Mendez Martinez --- BUILD.bazel | 48 ++++++++++++++++++++++++++++++++++++++---------- modules.bzl | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 11 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index a75b0775c50f..ae4e71ea7624 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -14,7 +14,7 @@ load( "kernel_modules_install", "merged_kernel_uapi_headers", ) -load(":modules.bzl", "COMMON_GKI_MODULES_LIST") +load(":modules.bzl", "get_gki_modules_list") package( default_visibility = [ @@ -46,10 +46,38 @@ checkpatch( checkpatch_pl = "scripts/checkpatch.pl", ) +# Deprecated - Use arch specific files from below. write_file( name = "gki_system_dlkm_modules", out = "android/gki_system_dlkm_modules", - content = COMMON_GKI_MODULES_LIST + [ + content = get_gki_modules_list("arm64") + [ + # Ensure new line at the end. + "", + ], +) + +write_file( + name = "gki_system_dlkm_modules_arm64", + out = "android/gki_system_dlkm_modules_arm64", + content = get_gki_modules_list("arm64") + [ + # Ensure new line at the end. + "", + ], +) + +write_file( + name = "gki_system_dlkm_modules_x86_64", + out = "android/gki_system_dlkm_modules_x86_64", + content = get_gki_modules_list("x86_64") + [ + # Ensure new line at the end. + "", + ], +) + +write_file( + name = "gki_system_dlkm_modules_risc64", + out = "android/gki_system_dlkm_modules_riscv64", + content = get_gki_modules_list("riscv64") + [ # Ensure new line at the end. "", ], @@ -81,7 +109,7 @@ filegroup( define_common_kernels(target_configs = { "kernel_aarch64": { "kmi_symbol_list_strict_mode": True, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("arm64"), "kmi_symbol_list": "android/abi_gki_aarch64", "kmi_symbol_list_add_only": True, "additional_kmi_symbol_lists": [":aarch64_additional_kmi_symbol_lists"], @@ -91,12 +119,12 @@ define_common_kernels(target_configs = { }, "kernel_aarch64_16k": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("arm64"), "make_goals": _GKI_AARCH64_MAKE_GOALS, }, "kernel_aarch64_debug": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("arm64"), "kmi_symbol_list": "android/abi_gki_aarch64", "kmi_symbol_list_add_only": True, "additional_kmi_symbol_lists": [":aarch64_additional_kmi_symbol_lists"], @@ -106,19 +134,19 @@ define_common_kernels(target_configs = { }, "kernel_riscv64": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("riscv64"), "make_goals": _GKI_RISCV64_MAKE_GOALS, }, "kernel_x86_64": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("x86_64"), "protected_exports_list": "android/abi_gki_protected_exports_x86_64", "protected_modules_list": "android/gki_x86_64_protected_modules", "make_goals": _GKI_X86_64_MAKE_GOALS, }, "kernel_x86_64_debug": { "kmi_symbol_list_strict_mode": False, - "module_implicit_outs": COMMON_GKI_MODULES_LIST, + "module_implicit_outs": get_gki_modules_list("x86_64"), "protected_exports_list": "android/abi_gki_protected_exports_x86_64", "protected_modules_list": "android/gki_x86_64_protected_modules", "make_goals": _GKI_X86_64_MAKE_GOALS, @@ -480,7 +508,7 @@ kernel_build( "modules", "rk3399-rock-pi-4b.dtb", ], - module_outs = COMMON_GKI_MODULES_LIST + _ROCKPI4_MODULE_OUTS + _ROCKPI4_WATCHDOG_MODULE_OUTS, + module_outs = get_gki_modules_list("arm64") + _ROCKPI4_MODULE_OUTS + _ROCKPI4_WATCHDOG_MODULE_OUTS, visibility = ["//visibility:private"], ) @@ -503,7 +531,7 @@ kernel_build( "modules", "rk3399-rock-pi-4b.dtb", ], - module_outs = COMMON_GKI_MODULES_LIST + _ROCKPI4_MODULE_OUTS, + module_outs = get_gki_modules_list("arm64") + _ROCKPI4_MODULE_OUTS, visibility = ["//visibility:private"], ) diff --git a/modules.bzl b/modules.bzl index 868ef5ed2bd3..4254764296fc 100644 --- a/modules.bzl +++ b/modules.bzl @@ -6,7 +6,7 @@ This module contains a full list of kernel modules compiled by GKI. """ -COMMON_GKI_MODULES_LIST = [ +_COMMON_GKI_MODULES_LIST = [ # keep sorted "drivers/block/zram/zram.ko", "drivers/bluetooth/btbcm.ko", @@ -68,3 +68,43 @@ COMMON_GKI_MODULES_LIST = [ "net/tipc/diag.ko", "net/tipc/tipc.ko", ] + +# Deprecated - Use `get_gki_modules_list` function instead. +COMMON_GKI_MODULES_LIST = _COMMON_GKI_MODULES_LIST + +_ARM64_GKI_MODULES_LIST = [ + # keep sorted +] + +_RISCV64_GKI_MODULES_LIST = [ + # keep sorted +] + +_X86_64_GKI_MODULES_LIST = [ + # keep sorted +] + +# buildifier: disable=unnamed-macro +def get_gki_modules_list(arch = None): + """ Provides the list of GKI modules. + + Args: + arch: One of [arm64, x86_64, riscv64]. + + Returns: + The list of GKI modules for the given |arch|. + """ + gki_modules_list = [] + _COMMON_GKI_MODULES_LIST + if arch == "arm64": + gki_modules_list += _ARM64_GKI_MODULES_LIST + elif arch == "x86_64": + gki_modules_list += _X86_64_GKI_MODULES_LIST + elif arch == "riscv64": + gki_modules_list += _RISCV64_GKI_MODULES_LIST + else: + fail("{}: arch {} not supported. Use one of [arm64, x86_64, riscv64]".format( + str(native.package_relative_label(":x")).removesuffix(":x"), + arch, + )) + + return gki_modules_list From 67018dd4e42f7ced0619e865c166c9f0ff9ffd61 Mon Sep 17 00:00:00 2001 From: Yi-De Wu Date: Thu, 18 May 2023 14:08:40 +0800 Subject: [PATCH 048/113] ANDROID: virt: geniezone: Enable as GKI module for arm64 Enables CONFIG_MTK_GZVM (gzvm.ko) as protected GKI module for arm64. Depends on ARM64 so no need to explicitly disable for other architecture's gki_defconfig files. Change-Id: I7bbef9192d92db295623f491e2a923147473a196 Signed-off-by: Yingshiuan Pan Signed-off-by: Yi-De Wu Bug: 280363874 --- android/gki_aarch64_protected_modules | 1 + arch/arm64/configs/gki_defconfig | 1 + modules.bzl | 1 + 3 files changed, 3 insertions(+) diff --git a/android/gki_aarch64_protected_modules b/android/gki_aarch64_protected_modules index d6b0777dd474..3f1af7946695 100644 --- a/android/gki_aarch64_protected_modules +++ b/android/gki_aarch64_protected_modules @@ -1,3 +1,4 @@ +arch/arm64/geniezone/gzvm.ko drivers/bluetooth/btbcm.ko drivers/bluetooth/btqca.ko drivers/bluetooth/btsdio.ko diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index a354cff562ed..ceaf2f1fdeab 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -551,6 +551,7 @@ CONFIG_GUNYAH=y CONFIG_GUNYAH_VCPU=y CONFIG_GUNYAH_IRQFD=y CONFIG_GUNYAH_IOEVENTFD=y +CONFIG_MTK_GZVM=m CONFIG_VHOST_VSOCK=y CONFIG_STAGING=y CONFIG_ASHMEM=y diff --git a/modules.bzl b/modules.bzl index 4254764296fc..dc86e7522fa4 100644 --- a/modules.bzl +++ b/modules.bzl @@ -74,6 +74,7 @@ COMMON_GKI_MODULES_LIST = _COMMON_GKI_MODULES_LIST _ARM64_GKI_MODULES_LIST = [ # keep sorted + "arch/arm64/geniezone/gzvm.ko", ] _RISCV64_GKI_MODULES_LIST = [ From e44e3955f7e78d5609a5c472bb261adbef142d63 Mon Sep 17 00:00:00 2001 From: Ulises Mendez Martinez Date: Thu, 10 Aug 2023 13:39:15 +0000 Subject: [PATCH 049/113] ANDROID: Use alias for old rules. * This is in preparation for removal of these targets. Bug: 293529933 Change-Id: I7b7400bb95b0d2c571be18b97727d878996ab575 Signed-off-by: Ulises Mendez Martinez (cherry picked from commit 83379c35cd0f39f65d89aacb7fbd4166b4cc9e9a) --- BUILD.bazel | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index ae4e71ea7624..9684c9d3b097 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -47,13 +47,24 @@ checkpatch( ) # Deprecated - Use arch specific files from below. -write_file( +alias( name = "gki_system_dlkm_modules", - out = "android/gki_system_dlkm_modules", - content = get_gki_modules_list("arm64") + [ - # Ensure new line at the end. - "", - ], + actual = "gki_system_dlkm_modules_arm64", + deprecation = """ + Common list for all architectures is deprecated. + Instead use the file corresponding to the architecture used: + i.e. `gki_system_dlkm_modules_{arch}` + """, +) + +alias( + name = "android/gki_system_dlkm_modules", + actual = "android/gki_system_dlkm_modules_arm64", + deprecation = """ + Common list for all architectures is deprecated. + Instead use the file corresponding to the architecture used: + i.e. `gki_system_dlkm_modules_{arch}` + """, ) write_file( From f08623648a881a90f741c153590e95e4641d4cd5 Mon Sep 17 00:00:00 2001 From: Pratyush Brahma Date: Thu, 17 Aug 2023 15:38:28 +0530 Subject: [PATCH 050/113] ANDROID: mm: Export page_owner_inited and __set_page_owner Export page_owner_inited and __set_page_owner symbol for loadable vendor modules. Bug: 296348400 Change-Id: I220ec1b94326ca3c6cc809d54646c51194645197 Signed-off-by: Pratyush Brahma --- mm/page_owner.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_owner.c b/mm/page_owner.c index ab06f4391954..95c436aec4c0 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -36,6 +36,7 @@ struct page_owner { static bool page_owner_enabled __initdata; DEFINE_STATIC_KEY_FALSE(page_owner_inited); +EXPORT_SYMBOL_GPL(page_owner_inited); static depot_stack_handle_t dummy_handle; static depot_stack_handle_t failure_handle; @@ -214,6 +215,7 @@ noinline void __set_page_owner(struct page *page, unsigned short order, __set_page_owner_handle(page_ext, handle, order, gfp_mask); page_ext_put(page_ext); } +EXPORT_SYMBOL_GPL(__set_page_owner); void __set_page_owner_migrate_reason(struct page *page, int reason) { From 2a13641a142a7ccb1d3396d2b7898755023a5911 Mon Sep 17 00:00:00 2001 From: Pratyush Brahma Date: Tue, 22 Aug 2023 11:08:12 +0530 Subject: [PATCH 051/113] ANDROID: GKI: Update abi_gki_aarch64_qcom for page_owner symbols Update abi_gki_aarch64_qcom to include __set_page_owner and page_owner_inited symbols. Bug: 296348400 Change-Id: I3dec65fb596764e51897dd0251aada539a34feca Signed-off-by: Pratyush Brahma --- android/abi_gki_aarch64.stg | 27 +++++++++++++++++++++++++++ android/abi_gki_aarch64_qcom | 2 ++ 2 files changed, 29 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 2f22d2576de3..b10f2c56ec73 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -284102,6 +284102,13 @@ function { return_type_id: 0x48b5725f parameter_id: 0x0a134144 } +function { + id: 0x12201786 + return_type_id: 0x48b5725f + parameter_id: 0x06835e9c + parameter_id: 0xc93e017b + parameter_id: 0xf1a6dfed +} function { id: 0x12217922 return_type_id: 0x48b5725f @@ -326766,6 +326773,15 @@ elf_symbol { type_id: 0x1009f18b full_name: "__serio_register_port" } +elf_symbol { + id: 0xeaddb422 + name: "__set_page_owner" + is_defined: true + symbol_type: FUNCTION + crc: 0xe501529f + type_id: 0x12201786 + full_name: "__set_page_owner" +} elf_symbol { id: 0x29a11d8a name: "__sg_page_iter_dma_next" @@ -362928,6 +362944,15 @@ elf_symbol { type_id: 0x6a8ce717 full_name: "page_mapping" } +elf_symbol { + id: 0x8cc91d1b + name: "page_owner_inited" + is_defined: true + symbol_type: OBJECT + crc: 0xda1512e5 + type_id: 0x8e47c273 + full_name: "page_owner_inited" +} elf_symbol { id: 0x44e50ff8 name: "page_pinner_inited" @@ -385809,6 +385834,7 @@ interface { symbol_id: 0x55017671 symbol_id: 0x257c4bb9 symbol_id: 0x8aca43ec + symbol_id: 0xeaddb422 symbol_id: 0x29a11d8a symbol_id: 0x208b66fa symbol_id: 0x4a440f54 @@ -389826,6 +389852,7 @@ interface { symbol_id: 0x13dfcd3d symbol_id: 0xc2b69854 symbol_id: 0x4f3e5356 + symbol_id: 0x8cc91d1b symbol_id: 0x44e50ff8 symbol_id: 0xec5c680b symbol_id: 0xdc14ff55 diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index dfbadd704176..6812f3091379 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -2213,6 +2213,7 @@ page_ext_put page_is_ram page_mapping + page_owner_inited page_pinner_inited __page_pinner_put_page page_pool_alloc_pages @@ -2888,6 +2889,7 @@ set_normalized_timespec64 set_page_dirty_lock __SetPageMovable + __set_page_owner set_task_cpu setup_udp_tunnel_sock set_user_nice From 37edfbc5c4676b0df1b1d940931f20b55d4d4a29 Mon Sep 17 00:00:00 2001 From: David Gow Date: Sat, 18 Mar 2023 12:15:54 +0800 Subject: [PATCH 052/113] UPSTREAM: um: Only disable SSE on clang to work around old GCC bugs As part of the Rust support for UML, we disable SSE (and similar flags) to match the normal x86 builds. This both makes sense (we ideally want a similar configuration to x86), and works around a crash bug with SSE generation under Rust with LLVM. However, this breaks compiling stdlib.h under gcc < 11, as the x86_64 ABI requires floating-point return values be stored in an SSE register. gcc 11 fixes this by only doing register allocation when a function is actually used, and since we never use atof(), it shouldn't be a problem: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652 Nevertheless, only disable SSE on clang setups, as that's a simple way of working around everyone's bugs. Fixes: 884981867947 ("rust: arch/um: Disable FP/SIMD instruction to match x86") Reported-by: Roberto Sassu Link: https://lore.kernel.org/linux-um/6df2ecef9011d85654a82acd607fdcbc93ad593c.camel@huaweicloud.com/ Tested-by: Roberto Sassu Tested-by: SeongJae Park Signed-off-by: David Gow Reviewed-by: Vincenzo Palazzo Tested-by: Arthur Grillo Signed-off-by: Richard Weinberger Bug: 296671039 Change-Id: Ie71e5c59ca9fb6a480895af233fae9a15f5c5ddc (cherry picked from commit a3046a618a284579d1189af8711765f553eed707) Signed-off-by: Dongseok Yi --- arch/x86/Makefile.um | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um index d2e95d1d4db7..1aa64846e539 100644 --- a/arch/x86/Makefile.um +++ b/arch/x86/Makefile.um @@ -3,9 +3,14 @@ core-y += arch/x86/crypto/ # # Disable SSE and other FP/SIMD instructions to match normal x86 +# This is required to work around issues in older LLVM versions, but breaks +# GCC versions < 11. See: +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652 # +ifeq ($(CONFIG_CC_IS_CLANG),y) KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2 +endif ifeq ($(CONFIG_X86_32),y) START := 0x8048000 From 264e2973a4bfc73bb23ec1d60d742dd24d1a2ae6 Mon Sep 17 00:00:00 2001 From: Ramji Jiyani Date: Wed, 30 Aug 2023 06:53:07 +0000 Subject: [PATCH 053/113] ANDROID: arm as an option for get_gki_modules_list If driver config depends on ARM64, driver is not available for the ARM targets as module. Introduce arm as an option for get_gki_modules_list() to separate ARM64 dependent modules. virtual_device_arm Cuttlefish target is the current consumer of this; and it fails when there is ARM64 dependent module is introduced like OEM hypervisors. Bug: 293529933 Test: TH Change-Id: I462e8968faa48d58721d884688af62ff603c9a3d Signed-off-by: Ramji Jiyani (cherry picked from commit b0e30c021b79d9cb9a67b12a94d1fe2f61126f14) --- modules.bzl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules.bzl b/modules.bzl index dc86e7522fa4..025abfebedf2 100644 --- a/modules.bzl +++ b/modules.bzl @@ -72,6 +72,10 @@ _COMMON_GKI_MODULES_LIST = [ # Deprecated - Use `get_gki_modules_list` function instead. COMMON_GKI_MODULES_LIST = _COMMON_GKI_MODULES_LIST +_ARM_GKI_MODULES_LIST = [ + # keep sorted +] + _ARM64_GKI_MODULES_LIST = [ # keep sorted "arch/arm64/geniezone/gzvm.ko", @@ -90,20 +94,22 @@ def get_gki_modules_list(arch = None): """ Provides the list of GKI modules. Args: - arch: One of [arm64, x86_64, riscv64]. + arch: One of [arm, arm64, x86_64, riscv64]. Returns: The list of GKI modules for the given |arch|. """ gki_modules_list = [] + _COMMON_GKI_MODULES_LIST - if arch == "arm64": + if arch == "arm": + gki_modules_list += _ARM_GKI_MODULES_LIST + elif arch == "arm64": gki_modules_list += _ARM64_GKI_MODULES_LIST elif arch == "x86_64": gki_modules_list += _X86_64_GKI_MODULES_LIST elif arch == "riscv64": gki_modules_list += _RISCV64_GKI_MODULES_LIST else: - fail("{}: arch {} not supported. Use one of [arm64, x86_64, riscv64]".format( + fail("{}: arch {} not supported. Use one of [arm, arm64, x86_64, riscv64]".format( str(native.package_relative_label(":x")).removesuffix(":x"), arch, )) From 638804ea1ce06120f440cb308fcb24ad485e7d60 Mon Sep 17 00:00:00 2001 From: Ramji Jiyani Date: Thu, 31 Aug 2023 00:23:28 +0000 Subject: [PATCH 054/113] ANDROID: kleaf: get_gki_modules_list add i386 option Adds "i386" as an option to get the list of 32-bit x86 modules in get_gki_modules_list(). virtual_device_i686 Cuttlefish target is a consumer. Option is named i386 to match the `arch` attributes in kernel_build rule. Bug: 293529933 Test: TH Change-Id: Ic5278aa687999a2bb2d98b97b204b99d1fcd809a Signed-off-by: Ramji Jiyani (cherry picked from commit 2a9967e15f99010ec06ac089b42a2ac20f2a57cb) --- modules.bzl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules.bzl b/modules.bzl index 025abfebedf2..a1eb6849b8fe 100644 --- a/modules.bzl +++ b/modules.bzl @@ -85,6 +85,11 @@ _RISCV64_GKI_MODULES_LIST = [ # keep sorted ] +_X86_GKI_MODULES_LIST = [ + # keep sorted + "drivers/ptp/ptp_kvm.ko", +] + _X86_64_GKI_MODULES_LIST = [ # keep sorted ] @@ -94,7 +99,7 @@ def get_gki_modules_list(arch = None): """ Provides the list of GKI modules. Args: - arch: One of [arm, arm64, x86_64, riscv64]. + arch: One of [arm, arm64, i386, x86_64, riscv64]. Returns: The list of GKI modules for the given |arch|. @@ -104,12 +109,14 @@ def get_gki_modules_list(arch = None): gki_modules_list += _ARM_GKI_MODULES_LIST elif arch == "arm64": gki_modules_list += _ARM64_GKI_MODULES_LIST + elif arch == "i386": + gki_modules_list += _X86_GKI_MODULES_LIST elif arch == "x86_64": gki_modules_list += _X86_64_GKI_MODULES_LIST elif arch == "riscv64": gki_modules_list += _RISCV64_GKI_MODULES_LIST else: - fail("{}: arch {} not supported. Use one of [arm, arm64, x86_64, riscv64]".format( + fail("{}: arch {} not supported. Use one of [arm, arm64, i386, x86_64, riscv64]".format( str(native.package_relative_label(":x")).removesuffix(":x"), arch, )) From dd87a7122cb918cb030f450deb5aacfab93611a7 Mon Sep 17 00:00:00 2001 From: ying zuxin <11154159@vivo.com> Date: Wed, 30 Aug 2023 19:55:35 +0800 Subject: [PATCH 055/113] ANDROID: GKI: Update symbol list for VIVO INFO: 1 function symbol(s) added 'void blk_fill_rwbs(char*, blk_opf_t)' Bug: 298155651 Change-Id: If30ac266aff8ba370e3064a59f082a02035c9dff Signed-off-by: ying zuxin --- android/abi_gki_aarch64.stg | 16 ++++++++++++++++ android/abi_gki_aarch64_vivo | 1 + 2 files changed, 17 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index b10f2c56ec73..cf17f6a0b970 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -282696,6 +282696,12 @@ function { parameter_id: 0x00b7947f parameter_id: 0x384f7d7c } +function { + id: 0x105539bd + return_type_id: 0x48b5725f + parameter_id: 0x0483e6f8 + parameter_id: 0x7b64642a +} function { id: 0x10563618 return_type_id: 0x48b5725f @@ -335672,6 +335678,15 @@ elf_symbol { type_id: 0x168d2c88 full_name: "blk_execute_rq_nowait" } +elf_symbol { + id: 0x9eda4f26 + name: "blk_fill_rwbs" + is_defined: true + symbol_type: FUNCTION + crc: 0x2bd8a8bb + type_id: 0x105539bd + full_name: "blk_fill_rwbs" +} elf_symbol { id: 0xc0d4821a name: "blk_finish_plug" @@ -386823,6 +386838,7 @@ interface { symbol_id: 0x528ef002 symbol_id: 0x90bf9007 symbol_id: 0xd76a9123 + symbol_id: 0x9eda4f26 symbol_id: 0xc0d4821a symbol_id: 0xaea1564a symbol_id: 0x0d1fc920 diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index b17c82fe8684..679c37e8b995 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -807,6 +807,7 @@ blk_bio_list_merge blk_execute_rq blk_execute_rq_nowait + blk_fill_rwbs blk_mq_alloc_request blk_mq_alloc_sq_tag_set blk_mq_alloc_tag_set From 8e6550add2d133105d93fe04c0e2f2fe4df36cb9 Mon Sep 17 00:00:00 2001 From: Tangquan Zheng Date: Tue, 29 Aug 2023 17:44:48 +0800 Subject: [PATCH 056/113] ANDROID: vendor_hooks: Add tune swappiness hook in get_scan_count() Add hook in get_scan_count() for customized swappiness. Partial cherry-pick of aosp/2119426. Bug: 297985476 Change-Id: I9d4074cf1a4097ff2a96be04646a01624cbd8dc3 Signed-off-by: Tangquan Zheng --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 3 +++ mm/vmscan.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 1f31007f8c65..9a310923f1ed 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -322,6 +322,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index d66ab9279266..e6594ca0d299 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -43,6 +43,9 @@ enum scan_balance; DECLARE_HOOK(android_vh_tune_scan_type, TP_PROTO(enum scan_balance *scan_type), TP_ARGS(scan_type)); +DECLARE_HOOK(android_vh_tune_swappiness, + TP_PROTO(int *swappiness), + TP_ARGS(swappiness)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index b12f027ff098..6be9bee3eca1 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2966,6 +2966,8 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, goto out; } + + trace_android_vh_tune_swappiness(&swappiness); /* * Global reclaim will swap to prevent OOM even with no * swappiness, but memcg users want to use this knob to From ce18fe6f29fbad26287c3cb8ec34185a8bb1d0ee Mon Sep 17 00:00:00 2001 From: zhengtangquan Date: Wed, 30 Aug 2023 14:46:21 +0800 Subject: [PATCH 057/113] ANDROID: GKI: Add symbols to symbol list for oplus 1 function symbol(s) added 'int __traceiter_android_vh_tune_swappiness(void*, int*)' 1 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_tune_swappiness' Bug: 297985476 Change-Id: I63e0e77b71df1b81eaa7d7370c6f739337d6c7e3 Signed-off-by: Tangquan Zheng --- android/abi_gki_aarch64.stg | 20 ++++++++++++++++++++ android/abi_gki_aarch64_oplus | 2 ++ 2 files changed, 22 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index cf17f6a0b970..710bf35a109b 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -329812,6 +329812,15 @@ elf_symbol { type_id: 0x9b85c291 full_name: "__traceiter_android_vh_tune_scan_type" } +elf_symbol { + id: 0x3947ecb4 + name: "__traceiter_android_vh_tune_swappiness" + is_defined: true + symbol_type: FUNCTION + crc: 0xd2ac8d57 + type_id: 0x9be2da56 + full_name: "__traceiter_android_vh_tune_swappiness" +} elf_symbol { id: 0x8a773cc3 name: "__traceiter_android_vh_typec_store_partner_src_caps" @@ -333115,6 +333124,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_tune_scan_type" } +elf_symbol { + id: 0xfe6b6962 + name: "__tracepoint_android_vh_tune_swappiness" + is_defined: true + symbol_type: OBJECT + crc: 0x88fcdb6c + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_tune_swappiness" +} elf_symbol { id: 0x18e67da1 name: "__tracepoint_android_vh_typec_store_partner_src_caps" @@ -386186,6 +386204,7 @@ interface { symbol_id: 0x0119fc41 symbol_id: 0xd9f43028 symbol_id: 0x39155e73 + symbol_id: 0x3947ecb4 symbol_id: 0x8a773cc3 symbol_id: 0x9545623c symbol_id: 0x558490b1 @@ -386553,6 +386572,7 @@ interface { symbol_id: 0x09ba106b symbol_id: 0xf9580976 symbol_id: 0x49b955bd + symbol_id: 0xfe6b6962 symbol_id: 0x18e67da1 symbol_id: 0x75a2f39e symbol_id: 0x7b5c377f diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index e1762196754a..51994d0e6fae 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -163,6 +163,7 @@ __traceiter_sched_waking __traceiter_task_rename __traceiter_android_vh_test_clear_look_around_ref + __traceiter_android_vh_tune_swappiness __tracepoint_android_rvh_post_init_entity_util_avg __tracepoint_android_rvh_rtmutex_force_update __tracepoint_android_vh_account_process_tick_gran @@ -226,6 +227,7 @@ __tracepoint_android_vh_sync_txn_recvd __tracepoint_android_vh_task_blocks_on_rtmutex __tracepoint_android_vh_test_clear_look_around_ref + __tracepoint_android_vh_tune_swappiness __tracepoint_block_bio_queue __tracepoint_block_getrq __tracepoint_block_rq_complete From 20266a0652baf8ac0e9f0ca1de1cb8af8af430ef Mon Sep 17 00:00:00 2001 From: Ramji Jiyani Date: Thu, 31 Aug 2023 05:00:40 +0000 Subject: [PATCH 058/113] ANDROID: kleaf: Remove ptp_kvm.ko from i386 modules commit 638804ea1ce0 ("ANDROID: kleaf: get_gki_modules_list add i386 option") introduced i386 as an option for get_gki_modules_list() with ptp_kvm.ko as i386 module. ptp_kvm.ko is not a module on anrdoid14-6.1, and cherry pick from android15-6.1 should have been worked to remove it. Remove ptp_kvm.ko from i386 list and make it empty for android14-6.1. Fixes: 638804ea1ce0 ("ANDROID: kleaf: get_gki_modules_list add i386 option") Bug: 293529933 Test: TH Change-Id: Ied9d8c06c9f38dc271d541275afee053a87ecd79 Signed-off-by: Ramji Jiyani --- modules.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/modules.bzl b/modules.bzl index a1eb6849b8fe..52d92225aab4 100644 --- a/modules.bzl +++ b/modules.bzl @@ -87,7 +87,6 @@ _RISCV64_GKI_MODULES_LIST = [ _X86_GKI_MODULES_LIST = [ # keep sorted - "drivers/ptp/ptp_kvm.ko", ] _X86_64_GKI_MODULES_LIST = [ From 0c34d588aff728101c8b20126c7ea98e9a28a962 Mon Sep 17 00:00:00 2001 From: Will Shiu Date: Wed, 30 Aug 2023 11:22:41 +0800 Subject: [PATCH 059/113] UPSTREAM: locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock As following backtrace, the struct file_lock request , in posix_lock_inode is free before ftrace function using. Replace the ftrace function ahead free flow could fix the use-after-free issue. [name:report&]=============================================== BUG:KASAN: use-after-free in trace_event_raw_event_filelock_lock+0x80/0x12c [name:report&]Read at addr f6ffff8025622620 by task NativeThread/16753 [name:report_hw_tags&]Pointer tag: [f6], memory tag: [fe] [name:report&] BT: Hardware name: MT6897 (DT) Call trace: dump_backtrace+0xf8/0x148 show_stack+0x18/0x24 dump_stack_lvl+0x60/0x7c print_report+0x2c8/0xa08 kasan_report+0xb0/0x120 __do_kernel_fault+0xc8/0x248 do_bad_area+0x30/0xdc do_tag_check_fault+0x1c/0x30 do_mem_abort+0x58/0xbc el1_abort+0x3c/0x5c el1h_64_sync_handler+0x54/0x90 el1h_64_sync+0x68/0x6c trace_event_raw_event_filelock_lock+0x80/0x12c posix_lock_inode+0xd0c/0xd60 do_lock_file_wait+0xb8/0x190 fcntl_setlk+0x2d8/0x440 ... [name:report&] [name:report&]Allocated by task 16752: ... slab_post_alloc_hook+0x74/0x340 kmem_cache_alloc+0x1b0/0x2f0 posix_lock_inode+0xb0/0xd60 ... [name:report&] [name:report&]Freed by task 16752: ... kmem_cache_free+0x274/0x5b0 locks_dispose_list+0x3c/0x148 posix_lock_inode+0xc40/0xd60 do_lock_file_wait+0xb8/0x190 fcntl_setlk+0x2d8/0x440 do_fcntl+0x150/0xc18 ... Bug: 290585450 Link:https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?h=locks-6.6&id=74f6f5912693ce454384eaeec48705646a21c74f (cherry picked from commit 74f6f5912693ce454384eaeec48705646a21c74f) Change-Id: I7daa6e72d1815daff30dd39726e14b1d57b60f5f Signed-off-by: Will Shiu --- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/locks.c b/fs/locks.c index 240b9309ed6d..1047ab2b15e9 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1300,6 +1300,7 @@ retry: out: spin_unlock(&ctx->flc_lock); percpu_up_read(&file_rwsem); + trace_posix_lock_inode(inode, request, error); /* * Free any unused locks. */ @@ -1308,7 +1309,6 @@ retry: if (new_fl2) locks_free_lock(new_fl2); locks_dispose_list(&dispose); - trace_posix_lock_inode(inode, request, error); return error; } From b15c3a3df0a82212ed2d1f2088e2246ec2b6d965 Mon Sep 17 00:00:00 2001 From: Heikki Krogerus Date: Tue, 6 Jun 2023 14:58:02 +0300 Subject: [PATCH 060/113] UPSTREAM: usb: typec: ucsi: Fix command cancellation The Cancel command was passed to the write callback as the offset instead of as the actual command which caused NULL pointer dereference. Reported-by: Stephan Bolten Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217517 Fixes: 094902bc6a3c ("usb: typec: ucsi: Always cancel the command if PPM reports BUSY condition") Cc: stable@vger.kernel.org Signed-off-by: Heikki Krogerus Message-ID: <20230606115802.79339-1-heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman Bug: 298597334 Change-Id: I7f23e49c58b566f462ba34f76966db662308a5bc (cherry picked from commit c4a8bfabefed706bb9150867db528ceefd5cb5fe) Signed-off-by: Udipto Goswami --- drivers/usb/typec/ucsi/ucsi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 086b50968983..47a2c73df342 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -132,10 +132,8 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) if (ret) return ret; - if (cci & UCSI_CCI_BUSY) { - ucsi->ops->async_write(ucsi, UCSI_CANCEL, NULL, 0); - return -EBUSY; - } + if (cmd != UCSI_CANCEL && cci & UCSI_CCI_BUSY) + return ucsi_exec_command(ucsi, UCSI_CANCEL); if (!(cci & UCSI_CCI_COMMAND_COMPLETE)) return -EIO; @@ -149,6 +147,11 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) return ucsi_read_error(ucsi); } + if (cmd == UCSI_CANCEL && cci & UCSI_CCI_CANCEL_COMPLETE) { + ret = ucsi_acknowledge_command(ucsi); + return ret ? ret : -EBUSY; + } + return UCSI_CCI_LENGTH(cci); } From d95b2b008eee3e9204b0c8738e1fed7e656e278c Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 31 Jul 2023 18:42:37 +0200 Subject: [PATCH 061/113] UPSTREAM: net: tap_open(): set sk_uid from current_fsuid() commit 5c9241f3ceab3257abe2923a59950db0dc8bb737 upstream. Commit 66b2c338adce initializes the "sk_uid" field in the protocol socket (struct sock) from the "/dev/tapX" device node's owner UID. Per original commit 86741ec25462 ("net: core: Add a UID field to struct sock.", 2016-11-04), that's wrong: the idea is to cache the UID of the userspace process that creates the socket. Commit 86741ec25462 mentions socket() and accept(); with "tap", the action that creates the socket is open("/dev/tapX"). Therefore the device node's owner UID is irrelevant. In most cases, "/dev/tapX" will be owned by root, so in practice, commit 66b2c338adce has no observable effect: - before, "sk_uid" would be zero, due to undefined behavior (CVE-2023-1076), - after, "sk_uid" would be zero, due to "/dev/tapX" being owned by root. What matters is the (fs)UID of the process performing the open(), so cache that in "sk_uid". Bug: 295995961 Cc: Eric Dumazet Cc: Lorenzo Colitti Cc: Paolo Abeni Cc: Pietro Borrello Cc: netdev@vger.kernel.org Cc: stable@vger.kernel.org Fixes: 66b2c338adce ("tap: tap_open(): correctly initialize socket uid") Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2173435 Signed-off-by: Laszlo Ersek Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 767800fc402deac438c5aed9c82f0e71a70c86fd) Signed-off-by: Lee Jones Change-Id: Ib5f80015e5c0280acf9f35124d3ff267ff0420f0 --- drivers/net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 760d8d1b6cba..f34ebd1d1f39 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -533,7 +533,7 @@ static int tap_open(struct inode *inode, struct file *file) q->sock.state = SS_CONNECTED; q->sock.file = file; q->sock.ops = &tap_socket_ops; - sock_init_data_uid(&q->sock, &q->sk, inode->i_uid); + sock_init_data_uid(&q->sock, &q->sk, current_fsuid()); q->sk.sk_write_space = tap_sock_write_space; q->sk.sk_destruct = tap_sock_destruct; q->flags = IFF_VNET_HDR | IFF_NO_PI | IFF_TAP; From c603880bd51d72fb75172c41405fba349db8d8ad Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 23 Jul 2023 16:41:48 +0200 Subject: [PATCH 062/113] UPSTREAM: netfilter: nf_tables: disallow rule addition to bound chain via NFTA_RULE_CHAIN_ID [ Upstream commit 0ebc1064e4874d5987722a2ddbc18f94aa53b211 ] Bail out with EOPNOTSUPP when adding rule to bound chain via NFTA_RULE_CHAIN_ID. The following warning splat is shown when adding a rule to a deleted bound chain: WARNING: CPU: 2 PID: 13692 at net/netfilter/nf_tables_api.c:2013 nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] CPU: 2 PID: 13692 Comm: chain-bound-rul Not tainted 6.1.39 #1 RIP: 0010:nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] Bug: 296128351 Fixes: d0e2c7de92c7 ("netfilter: nf_tables: add NFT_CHAIN_BINDING") Reported-by: Kevin Rich Signed-off-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin (cherry picked from commit 268cb07ef3ee17b5454a7c4b23376802c5b00c79) Signed-off-by: Lee Jones Change-Id: Icf97f57d18bb2b30ed28a3de6cdd18661d7f1c3d --- net/netfilter/nf_tables_api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index ea2216826e11..ed73d8585e6e 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3533,8 +3533,6 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info, NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_CHAIN]); return PTR_ERR(chain); } - if (nft_chain_is_bound(chain)) - return -EOPNOTSUPP; } else if (nla[NFTA_RULE_CHAIN_ID]) { chain = nft_chain_lookup_byid(net, table, nla[NFTA_RULE_CHAIN_ID]); @@ -3546,6 +3544,9 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info, return -EINVAL; } + if (nft_chain_is_bound(chain)) + return -EOPNOTSUPP; + if (nla[NFTA_RULE_HANDLE]) { handle = be64_to_cpu(nla_get_be64(nla[NFTA_RULE_HANDLE])); rule = __nft_rule_lookup(chain, handle); From 4b3ab91671d89c3bb00d82c7c7b746d53c1688cd Mon Sep 17 00:00:00 2001 From: Lin Ma Date: Sun, 25 Jun 2023 17:10:07 +0800 Subject: [PATCH 063/113] UPSTREAM: net: nfc: Fix use-after-free caused by nfc_llcp_find_local [ Upstream commit 6709d4b7bc2e079241fdef15d1160581c5261c10 ] This commit fixes several use-after-free that caused by function nfc_llcp_find_local(). For example, one UAF can happen when below buggy time window occurs. // nfc_genl_llc_get_params | // nfc_unregister_device | dev = nfc_get_device(idx); | device_lock(...) if (!dev) | dev->shutting_down = true; return -ENODEV; | device_unlock(...); | device_lock(...); | // nfc_llcp_unregister_device | nfc_llcp_find_local() nfc_llcp_find_local(...); | | local_cleanup() if (!local) { | rc = -ENODEV; | // nfc_llcp_local_put goto exit; | kref_put(.., local_release) } | | // local_release | list_del(&local->list) // nfc_genl_send_params | kfree() local->dev->idx !!!UAF!!! | | and the crash trace for the one of the discussed UAF like: BUG: KASAN: slab-use-after-free in nfc_genl_llc_get_params+0x72f/0x780 net/nfc/netlink.c:1045 Read of size 8 at addr ffff888105b0e410 by task 20114 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x72/0xa0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:319 [inline] print_report+0xcc/0x620 mm/kasan/report.c:430 kasan_report+0xb2/0xe0 mm/kasan/report.c:536 nfc_genl_send_params net/nfc/netlink.c:999 [inline] nfc_genl_llc_get_params+0x72f/0x780 net/nfc/netlink.c:1045 genl_family_rcv_msg_doit.isra.0+0x1ee/0x2e0 net/netlink/genetlink.c:968 genl_family_rcv_msg net/netlink/genetlink.c:1048 [inline] genl_rcv_msg+0x503/0x7d0 net/netlink/genetlink.c:1065 netlink_rcv_skb+0x161/0x430 net/netlink/af_netlink.c:2548 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1076 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x644/0x900 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x934/0xe70 net/netlink/af_netlink.c:1913 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg+0x1b6/0x200 net/socket.c:747 ____sys_sendmsg+0x6e9/0x890 net/socket.c:2501 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2555 __sys_sendmsg+0xf7/0x1d0 net/socket.c:2584 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f34640a2389 RSP: 002b:00007f3463415168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f34641c1f80 RCX: 00007f34640a2389 RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000006 RBP: 00007f34640ed493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe38449ecf R14: 00007f3463415300 R15: 0000000000022000 Allocated by task 20116: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x7f/0x90 mm/kasan/common.c:383 kmalloc include/linux/slab.h:580 [inline] kzalloc include/linux/slab.h:720 [inline] nfc_llcp_register_device+0x49/0xa40 net/nfc/llcp_core.c:1567 nfc_register_device+0x61/0x260 net/nfc/core.c:1124 nci_register_device+0x776/0xb20 net/nfc/nci/core.c:1257 virtual_ncidev_open+0x147/0x230 drivers/nfc/virtual_ncidev.c:148 misc_open+0x379/0x4a0 drivers/char/misc.c:165 chrdev_open+0x26c/0x780 fs/char_dev.c:414 do_dentry_open+0x6c4/0x12a0 fs/open.c:920 do_open fs/namei.c:3560 [inline] path_openat+0x24fe/0x37e0 fs/namei.c:3715 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x171/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x143/0x200 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc Freed by task 20115: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free mm/kasan/common.c:200 [inline] __kasan_slab_free+0x10a/0x190 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0x7a/0x190 mm/slub.c:3800 local_release net/nfc/llcp_core.c:174 [inline] kref_put include/linux/kref.h:65 [inline] nfc_llcp_local_put net/nfc/llcp_core.c:182 [inline] nfc_llcp_local_put net/nfc/llcp_core.c:177 [inline] nfc_llcp_unregister_device+0x206/0x290 net/nfc/llcp_core.c:1620 nfc_unregister_device+0x160/0x1d0 net/nfc/core.c:1179 virtual_ncidev_close+0x52/0xa0 drivers/nfc/virtual_ncidev.c:163 __fput+0x252/0xa20 fs/file_table.c:321 task_work_run+0x174/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x108/0x110 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x21/0x50 kernel/entry/common.c:297 do_syscall_64+0x4c/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x72/0xdc Last potentially related work creation: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x95/0xb0 mm/kasan/generic.c:491 kvfree_call_rcu+0x29/0xa80 kernel/rcu/tree.c:3328 drop_sysctl_table+0x3be/0x4e0 fs/proc/proc_sysctl.c:1735 unregister_sysctl_table.part.0+0x9c/0x190 fs/proc/proc_sysctl.c:1773 unregister_sysctl_table+0x24/0x30 fs/proc/proc_sysctl.c:1753 neigh_sysctl_unregister+0x5f/0x80 net/core/neighbour.c:3895 addrconf_notify+0x140/0x17b0 net/ipv6/addrconf.c:3684 notifier_call_chain+0xbe/0x210 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x150 net/core/dev.c:1937 call_netdevice_notifiers_extack net/core/dev.c:1975 [inline] call_netdevice_notifiers net/core/dev.c:1989 [inline] dev_change_name+0x3c3/0x870 net/core/dev.c:1211 dev_ifsioc+0x800/0xf70 net/core/dev_ioctl.c:376 dev_ioctl+0x3d9/0xf80 net/core/dev_ioctl.c:542 sock_do_ioctl+0x160/0x260 net/socket.c:1213 sock_ioctl+0x3f9/0x670 net/socket.c:1316 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x19e/0x210 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc The buggy address belongs to the object at ffff888105b0e400 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 16 bytes inside of freed 1024-byte region [ffff888105b0e400, ffff888105b0e800) The buggy address belongs to the physical page: head:ffffea000416c200 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x200000000010200(slab|head|node=0|zone=2) raw: 0200000000010200 ffff8881000430c0 ffffea00044c7010 ffffea0004510e10 raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888105b0e300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888105b0e380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888105b0e400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888105b0e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888105b0e500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb In summary, this patch solves those use-after-free by 1. Re-implement the nfc_llcp_find_local(). The current version does not grab the reference when getting the local from the linked list. For example, the llcp_sock_bind() gets the reference like below: // llcp_sock_bind() local = nfc_llcp_find_local(dev); // A ..... \ | raceable ..... / llcp_sock->local = nfc_llcp_local_get(local); // B There is an apparent race window that one can drop the reference and free the local object fetched in (A) before (B) gets the reference. 2. Some callers of the nfc_llcp_find_local() do not grab the reference at all. For example, the nfc_genl_llc_{{get/set}_params/sdreq} functions. We add the nfc_llcp_local_put() for them. Moreover, we add the necessary error handling function to put the reference. 3. Add the nfc_llcp_remove_local() helper. The local object is removed from the linked list in local_release() when all reference is gone. This patch removes it when nfc_llcp_unregister_device() is called. Therefore, every caller of nfc_llcp_find_local() will get a reference even when the nfc_llcp_unregister_device() is called. This promises no use-after-free for the local object is ever possible. Bug: 294167961 Fixes: 52feb444a903 ("NFC: Extend netlink interface for LTO, RW, and MIUX parameters support") Fixes: c7aa12252f51 ("NFC: Take a reference on the LLCP local pointer when creating a socket") Signed-off-by: Lin Ma Reviewed-by: Simon Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (cherry picked from commit 425d9d3a92df7d96b3cfb7ee5c240293a21cbde3) Signed-off-by: Lee Jones Change-Id: I8e7e7101ce0d5c81da9b8febd4ad78dd1affc4a5 --- net/nfc/llcp.h | 1 - net/nfc/llcp_commands.c | 12 +++++++--- net/nfc/llcp_core.c | 51 ++++++++++++++++++++++++++++++++++------- net/nfc/llcp_sock.c | 18 ++++++++------- net/nfc/netlink.c | 20 ++++++++++++---- net/nfc/nfc.h | 1 + 6 files changed, 78 insertions(+), 25 deletions(-) diff --git a/net/nfc/llcp.h b/net/nfc/llcp.h index c1d9be636933..d8345ed57c95 100644 --- a/net/nfc/llcp.h +++ b/net/nfc/llcp.h @@ -201,7 +201,6 @@ void nfc_llcp_sock_link(struct llcp_sock_list *l, struct sock *s); void nfc_llcp_sock_unlink(struct llcp_sock_list *l, struct sock *s); void nfc_llcp_socket_remote_param_init(struct nfc_llcp_sock *sock); struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev); -struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local); int nfc_llcp_local_put(struct nfc_llcp_local *local); u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local, struct nfc_llcp_sock *sock); diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c index 41e3a20c8935..5d2d4bc26ef9 100644 --- a/net/nfc/llcp_commands.c +++ b/net/nfc/llcp_commands.c @@ -359,6 +359,7 @@ int nfc_llcp_send_symm(struct nfc_dev *dev) struct sk_buff *skb; struct nfc_llcp_local *local; u16 size = 0; + int err; local = nfc_llcp_find_local(dev); if (local == NULL) @@ -368,8 +369,10 @@ int nfc_llcp_send_symm(struct nfc_dev *dev) size += dev->tx_headroom + dev->tx_tailroom + NFC_HEADER_SIZE; skb = alloc_skb(size, GFP_KERNEL); - if (skb == NULL) - return -ENOMEM; + if (skb == NULL) { + err = -ENOMEM; + goto out; + } skb_reserve(skb, dev->tx_headroom + NFC_HEADER_SIZE); @@ -379,8 +382,11 @@ int nfc_llcp_send_symm(struct nfc_dev *dev) nfc_llcp_send_to_raw_sock(local, skb, NFC_DIRECTION_TX); - return nfc_data_exchange(dev, local->target_idx, skb, + err = nfc_data_exchange(dev, local->target_idx, skb, nfc_llcp_recv, local); +out: + nfc_llcp_local_put(local); + return err; } int nfc_llcp_send_connect(struct nfc_llcp_sock *sock) diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c index a27e1842b2a0..f60e424e0607 100644 --- a/net/nfc/llcp_core.c +++ b/net/nfc/llcp_core.c @@ -17,6 +17,8 @@ static u8 llcp_magic[3] = {0x46, 0x66, 0x6d}; static LIST_HEAD(llcp_devices); +/* Protects llcp_devices list */ +static DEFINE_SPINLOCK(llcp_devices_lock); static void nfc_llcp_rx_skb(struct nfc_llcp_local *local, struct sk_buff *skb); @@ -141,7 +143,7 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool device, write_unlock(&local->raw_sockets.lock); } -struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) +static struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) { kref_get(&local->ref); @@ -169,7 +171,6 @@ static void local_release(struct kref *ref) local = container_of(ref, struct nfc_llcp_local, ref); - list_del(&local->list); local_cleanup(local); kfree(local); } @@ -282,12 +283,33 @@ static void nfc_llcp_sdreq_timer(struct timer_list *t) struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev) { struct nfc_llcp_local *local; + struct nfc_llcp_local *res = NULL; + spin_lock(&llcp_devices_lock); list_for_each_entry(local, &llcp_devices, list) - if (local->dev == dev) - return local; + if (local->dev == dev) { + res = nfc_llcp_local_get(local); + break; + } + spin_unlock(&llcp_devices_lock); - pr_debug("No device found\n"); + return res; +} + +static struct nfc_llcp_local *nfc_llcp_remove_local(struct nfc_dev *dev) +{ + struct nfc_llcp_local *local, *tmp; + + spin_lock(&llcp_devices_lock); + list_for_each_entry_safe(local, tmp, &llcp_devices, list) + if (local->dev == dev) { + list_del(&local->list); + spin_unlock(&llcp_devices_lock); + return local; + } + spin_unlock(&llcp_devices_lock); + + pr_warn("Shutting down device not found\n"); return NULL; } @@ -608,12 +630,15 @@ u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *general_bytes_len) *general_bytes_len = local->gb_len; + nfc_llcp_local_put(local); + return local->gb; } int nfc_llcp_set_remote_gb(struct nfc_dev *dev, const u8 *gb, u8 gb_len) { struct nfc_llcp_local *local; + int err; if (gb_len < 3 || gb_len > NFC_MAX_GT_LEN) return -EINVAL; @@ -630,12 +655,16 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, const u8 *gb, u8 gb_len) if (memcmp(local->remote_gb, llcp_magic, 3)) { pr_err("MAC does not support LLCP\n"); - return -EINVAL; + err = -EINVAL; + goto out; } - return nfc_llcp_parse_gb_tlv(local, + err = nfc_llcp_parse_gb_tlv(local, &local->remote_gb[3], local->remote_gb_len - 3); +out: + nfc_llcp_local_put(local); + return err; } static u8 nfc_llcp_dsap(const struct sk_buff *pdu) @@ -1517,6 +1546,8 @@ int nfc_llcp_data_received(struct nfc_dev *dev, struct sk_buff *skb) __nfc_llcp_recv(local, skb); + nfc_llcp_local_put(local); + return 0; } @@ -1533,6 +1564,8 @@ void nfc_llcp_mac_is_down(struct nfc_dev *dev) /* Close and purge all existing sockets */ nfc_llcp_socket_release(local, true, 0); + + nfc_llcp_local_put(local); } void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, @@ -1558,6 +1591,8 @@ void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, mod_timer(&local->link_timer, jiffies + msecs_to_jiffies(local->remote_lto)); } + + nfc_llcp_local_put(local); } int nfc_llcp_register_device(struct nfc_dev *ndev) @@ -1608,7 +1643,7 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) void nfc_llcp_unregister_device(struct nfc_dev *dev) { - struct nfc_llcp_local *local = nfc_llcp_find_local(dev); + struct nfc_llcp_local *local = nfc_llcp_remove_local(dev); if (local == NULL) { pr_debug("No such device\n"); diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c index 77642d18a3b4..645677f84dba 100644 --- a/net/nfc/llcp_sock.c +++ b/net/nfc/llcp_sock.c @@ -99,7 +99,7 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) } llcp_sock->dev = dev; - llcp_sock->local = nfc_llcp_local_get(local); + llcp_sock->local = local; llcp_sock->nfc_protocol = llcp_addr.nfc_protocol; llcp_sock->service_name_len = min_t(unsigned int, llcp_addr.service_name_len, @@ -186,7 +186,7 @@ static int llcp_raw_sock_bind(struct socket *sock, struct sockaddr *addr, } llcp_sock->dev = dev; - llcp_sock->local = nfc_llcp_local_get(local); + llcp_sock->local = local; llcp_sock->nfc_protocol = llcp_addr.nfc_protocol; nfc_llcp_sock_link(&local->raw_sockets, sk); @@ -696,22 +696,22 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr, if (dev->dep_link_up == false) { ret = -ENOLINK; device_unlock(&dev->dev); - goto put_dev; + goto sock_llcp_put_local; } device_unlock(&dev->dev); if (local->rf_mode == NFC_RF_INITIATOR && addr->target_idx != local->target_idx) { ret = -ENOLINK; - goto put_dev; + goto sock_llcp_put_local; } llcp_sock->dev = dev; - llcp_sock->local = nfc_llcp_local_get(local); + llcp_sock->local = local; llcp_sock->ssap = nfc_llcp_get_local_ssap(local); if (llcp_sock->ssap == LLCP_SAP_MAX) { ret = -ENOMEM; - goto sock_llcp_put_local; + goto sock_llcp_nullify; } llcp_sock->reserved_ssap = llcp_sock->ssap; @@ -757,11 +757,13 @@ sock_unlink: sock_llcp_release: nfc_llcp_put_ssap(local, llcp_sock->ssap); -sock_llcp_put_local: - nfc_llcp_local_put(llcp_sock->local); +sock_llcp_nullify: llcp_sock->local = NULL; llcp_sock->dev = NULL; +sock_llcp_put_local: + nfc_llcp_local_put(local); + put_dev: nfc_put_device(dev); diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index b9264e730fd9..e9ac6a6f934e 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -1039,11 +1039,14 @@ static int nfc_genl_llc_get_params(struct sk_buff *skb, struct genl_info *info) msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) { rc = -ENOMEM; - goto exit; + goto put_local; } rc = nfc_genl_send_params(msg, local, info->snd_portid, info->snd_seq); +put_local: + nfc_llcp_local_put(local); + exit: device_unlock(&dev->dev); @@ -1105,7 +1108,7 @@ static int nfc_genl_llc_set_params(struct sk_buff *skb, struct genl_info *info) if (info->attrs[NFC_ATTR_LLC_PARAM_LTO]) { if (dev->dep_link_up) { rc = -EINPROGRESS; - goto exit; + goto put_local; } local->lto = nla_get_u8(info->attrs[NFC_ATTR_LLC_PARAM_LTO]); @@ -1117,6 +1120,9 @@ static int nfc_genl_llc_set_params(struct sk_buff *skb, struct genl_info *info) if (info->attrs[NFC_ATTR_LLC_PARAM_MIUX]) local->miux = cpu_to_be16(miux); +put_local: + nfc_llcp_local_put(local); + exit: device_unlock(&dev->dev); @@ -1172,7 +1178,7 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) if (rc != 0) { rc = -EINVAL; - goto exit; + goto put_local; } if (!sdp_attrs[NFC_SDP_ATTR_URI]) @@ -1191,7 +1197,7 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) sdreq = nfc_llcp_build_sdreq_tlv(tid, uri, uri_len); if (sdreq == NULL) { rc = -ENOMEM; - goto exit; + goto put_local; } tlvs_len += sdreq->tlv_len; @@ -1201,10 +1207,14 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info) if (hlist_empty(&sdreq_list)) { rc = -EINVAL; - goto exit; + goto put_local; } rc = nfc_llcp_send_snl_sdreq(local, &sdreq_list, tlvs_len); + +put_local: + nfc_llcp_local_put(local); + exit: device_unlock(&dev->dev); diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index de2ec66d7e83..0b1e6466f4fb 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h @@ -52,6 +52,7 @@ int nfc_llcp_set_remote_gb(struct nfc_dev *dev, const u8 *gb, u8 gb_len); u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *general_bytes_len); int nfc_llcp_data_received(struct nfc_dev *dev, struct sk_buff *skb); struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev); +int nfc_llcp_local_put(struct nfc_llcp_local *local); int __init nfc_llcp_init(void); void nfc_llcp_exit(void); void nfc_llcp_free_sdp_tlv(struct nfc_llcp_sdp_tlv *sdp); From 87647c0c54bbfe865691d8b58988a3ce941b905e Mon Sep 17 00:00:00 2001 From: John Stultz Date: Sat, 26 Aug 2023 01:32:59 +0000 Subject: [PATCH 064/113] ANDROID: uid_sys_stats: Use llist for deferred work A use-after-free bug was found in the previous custom lock-free list implementation for the deferred work, so switch functionality to llist implementation. While the previous approach atomically handled the list head, it did not assure the new node's next pointer was assigned before the head was pointed to the node, allowing the consumer to traverse to an invalid next pointer. Additionally, in switching to llists, this patch pulls the entire list off the list head once and processes it separately, reducing the number of atomic operations compared with the custom lists's implementation which pulled one node at a time atomically from the list head. BUG: KASAN: use-after-free in process_notifier+0x270/0x2dc Write of size 8 at addr d4ffff89545c3c58 by task Blocking Thread/3431 Pointer tag: [d4], memory tag: [fe] call trace: dump_backtrace+0xf8/0x118 show_stack+0x18/0x24 dump_stack_lvl+0x60/0x78 print_report+0x178/0x470 kasan_report+0x8c/0xbc kasan_tag_mismatch+0x28/0x3c __hwasan_tag_mismatch+0x30/0x60 process_notifier+0x270/0x2dc notifier_call_chain+0xb4/0x108 blocking_notifier_call_chain+0x54/0x80 profile_task_exit+0x20/0x2c do_exit+0xec/0x1114 __arm64_sys_exit_group+0x0/0x24 get_signal+0x93c/0xa78 do_notify_resume+0x158/0x3fc el0_svc+0x54/0x78 el0t_64_sync_handler+0x44/0xe4 el0t_64_sync+0x190/0x194 Bug: 294468796 Bug: 295787403 Fixes: 8e86825eecfa ("ANDROID: uid_sys_stats: Use a single work for deferred updates") Change-Id: Id377348c239ec720a5237726bc3632544d737e3b Signed-off-by: John Stultz [nkapron: Squashed with other changes and rewrote the commit message] Signed-off-by: Neill Kapron --- drivers/misc/uid_sys_stats.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/misc/uid_sys_stats.c b/drivers/misc/uid_sys_stats.c index f5eaa63035ca..842597bbeb89 100644 --- a/drivers/misc/uid_sys_stats.c +++ b/drivers/misc/uid_sys_stats.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -636,22 +637,22 @@ struct update_stats_work { struct task_io_accounting ioac; u64 utime; u64 stime; - struct update_stats_work *next; + struct llist_node node; }; -static atomic_long_t work_usw; +static LLIST_HEAD(work_usw); static void update_stats_workfn(struct work_struct *work) { - struct update_stats_work *usw; + struct update_stats_work *usw, *t; struct uid_entry *uid_entry; struct task_entry *task_entry __maybe_unused; + struct llist_node *node; rt_mutex_lock(&uid_lock); - while ((usw = (struct update_stats_work *)atomic_long_read(&work_usw))) { - if (atomic_long_cmpxchg(&work_usw, (long)usw, (long)(usw->next)) != (long)usw) - continue; + node = llist_del_all(&work_usw); + llist_for_each_entry_safe(usw, t, node, node) { uid_entry = find_uid_entry(usw->uid); if (!uid_entry) goto next; @@ -664,7 +665,7 @@ static void update_stats_workfn(struct work_struct *work) if (!task_entry) goto next; add_uid_tasks_io_stats(task_entry, &usw->ioac, - UID_STATE_DEAD_TASKS); + UID_STATE_DEAD_TASKS); #endif __add_uid_io_stats(uid_entry, &usw->ioac, UID_STATE_DEAD_TASKS); next: @@ -704,8 +705,7 @@ static int process_notifier(struct notifier_block *self, */ usw->ioac = task->ioac; task_cputime_adjusted(task, &usw->utime, &usw->stime); - usw->next = (struct update_stats_work *)atomic_long_xchg(&work_usw, - (long)usw); + llist_add(&usw->node, &work_usw); schedule_work(&update_stats_work); } return NOTIFY_OK; From bd0308e36bc88b6545bef421d3299b3c6e4d50c0 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 28 Aug 2023 14:30:14 +0800 Subject: [PATCH 065/113] ANDROID: GKI: Update symbols to symbol list Update symbols to symbol list externed by oppo network group. 5 Added function: [A] 'function int __rtnl_link_register(rtnl_link_ops*)' [A] 'function int ip_local_deliver(struct sk_buff *)' [A] 'function iov_iter_advance(struct iov_iter *i, size_t size)' [A] 'function int nf_register_net_hook(struct net *net, const struct nf_hook_ops *reg)' [A] 'function void nf_unregister_net_hook(struct net *, const struct nf_hook_ops *)' These functions have been merged in lower versions of the kernel and are still needed by oppo in higher versions. These functions are needed by other modules that provide functionality for oppo's network, such as the network tracking module, the network warm-up module, etc. Bug: 297979024 Change-Id: Ic1a4c869b3894a06f7cab7b5120574ed94d519b2 Signed-off-by: Wei Liu --- android/abi_gki_aarch64.stg | 62 +++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_oplus | 5 +++ 2 files changed, 67 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 710bf35a109b..e23c331b66f9 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -285031,6 +285031,12 @@ function { parameter_id: 0x09427c40 parameter_id: 0x6d7f5ff6 } +function { + id: 0x137f5862 + return_type_id: 0x48b5725f + parameter_id: 0x0ca27481 + parameter_id: 0x33e53462 +} function { id: 0x1382dd85 return_type_id: 0x48b5725f @@ -317411,6 +317417,12 @@ function { parameter_id: 0x33b77109 parameter_id: 0x0277bf8a } +function { + id: 0x9e67eade + return_type_id: 0x6720d32f + parameter_id: 0x0ca27481 + parameter_id: 0x33e53462 +} function { id: 0x9e68eb19 return_type_id: 0x6720d32f @@ -326680,6 +326692,15 @@ elf_symbol { type_id: 0x1dbb54c5 full_name: "__rt_mutex_init" } +elf_symbol { + id: 0x31b4eed9 + name: "__rtnl_link_unregister" + is_defined: true + symbol_type: FUNCTION + crc: 0x139f3c01 + type_id: 0x1cd366b4 + full_name: "__rtnl_link_unregister" +} elf_symbol { id: 0x99aa632e name: "__sbitmap_queue_get" @@ -355255,6 +355276,15 @@ elf_symbol { type_id: 0x1a5fed1b full_name: "iounmap" } +elf_symbol { + id: 0x382b3272 + name: "iov_iter_advance" + is_defined: true + symbol_type: FUNCTION + crc: 0x4a850157 + type_id: 0x189472bc + full_name: "iov_iter_advance" +} elf_symbol { id: 0x71726a83 name: "iov_iter_init" @@ -355345,6 +355375,15 @@ elf_symbol { type_id: 0x1557244f full_name: "ip_compute_csum" } +elf_symbol { + id: 0x333700e4 + name: "ip_local_deliver" + is_defined: true + symbol_type: FUNCTION + crc: 0x20dcb3a1 + type_id: 0x9cd33969 + full_name: "ip_local_deliver" +} elf_symbol { id: 0x5234b1b5 name: "ip_local_out" @@ -360904,6 +360943,15 @@ elf_symbol { type_id: 0xfebe0504 full_name: "nf_ct_invert_tuple" } +elf_symbol { + id: 0x8b1dfb41 + name: "nf_register_net_hook" + is_defined: true + symbol_type: FUNCTION + crc: 0x10b94e6c + type_id: 0x9e67eade + full_name: "nf_register_net_hook" +} elf_symbol { id: 0x43078d96 name: "nf_register_net_hooks" @@ -360913,6 +360961,15 @@ elf_symbol { type_id: 0x9e768b87 full_name: "nf_register_net_hooks" } +elf_symbol { + id: 0x840dad92 + name: "nf_unregister_net_hook" + is_defined: true + symbol_type: FUNCTION + crc: 0xd4486d5d + type_id: 0x137f5862 + full_name: "nf_unregister_net_hook" +} elf_symbol { id: 0x619db28f name: "nf_unregister_net_hooks" @@ -385856,6 +385913,7 @@ interface { symbol_id: 0x2b453adc symbol_id: 0xd5276fa4 symbol_id: 0x98379aaf + symbol_id: 0x31b4eed9 symbol_id: 0x99aa632e symbol_id: 0xe68925b8 symbol_id: 0x6e3bb1cf @@ -389030,6 +389088,7 @@ interface { symbol_id: 0x42137268 symbol_id: 0xa0390871 symbol_id: 0xfb789e26 + symbol_id: 0x382b3272 symbol_id: 0x71726a83 symbol_id: 0xffb394c4 symbol_id: 0x48a6183b @@ -389040,6 +389099,7 @@ interface { symbol_id: 0x7837fb7f symbol_id: 0x807f9d22 symbol_id: 0x6cd920cf + symbol_id: 0x333700e4 symbol_id: 0x5234b1b5 symbol_id: 0xaed020d7 symbol_id: 0xc1d5ac06 @@ -389658,7 +389718,9 @@ interface { symbol_id: 0xb4e99805 symbol_id: 0x471faa17 symbol_id: 0x82e37620 + symbol_id: 0x8b1dfb41 symbol_id: 0x43078d96 + symbol_id: 0x840dad92 symbol_id: 0x619db28f symbol_id: 0x36bc8d13 symbol_id: 0x38637341 diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 51994d0e6fae..63e48209f547 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -32,10 +32,12 @@ iio_channel_get iio_channel_release iio_get_channel_type + ip_local_deliver ip6_local_out ip6_route_me_harder ip_route_me_harder ipv6_find_hdr + iov_iter_advance is_ashmem_file jiffies_64_to_clock_t kick_process @@ -47,7 +49,9 @@ mmc_wait_for_cmd nf_ct_attach nf_ct_delete + nf_register_net_hook nf_register_net_hooks + nf_unregister_net_hook nf_unregister_net_hooks nr_running of_css @@ -67,6 +71,7 @@ remove_proc_subtree rtc_read_alarm rtc_set_alarm + __rtnl_link_unregister sdio_memcpy_fromio sdio_memcpy_toio sdio_set_block_size From 404522c763dfd3f77a9fbb2041bda54a1f8a795c Mon Sep 17 00:00:00 2001 From: Yu Kuai Date: Wed, 31 May 2023 15:34:35 +0800 Subject: [PATCH 066/113] UPSTREAM: blk-ioc: protect ioc_destroy_icq() by 'queue_lock' Currently, icq is tracked by both request_queue(icq->q_node) and task(icq->ioc_node), and ioc_clear_queue() from elevator exit is not safe because it can access the list without protection: ioc_clear_queue ioc_release_fn lock queue_lock list_splice /* move queue list to a local list */ unlock queue_lock /* * lock is released, the local list * can be accessed through task exit. */ lock ioc->lock while (!hlist_empty) icq = hlist_entry lock queue_lock ioc_destroy_icq delete icq->ioc_node while (!list_empty) icq = list_entry() list_del icq->q_node /* * This is not protected by any lock, * list_entry concurrent with list_del * is not safe. */ unlock queue_lock unlock ioc->lock Fix this problem by protecting list 'icq->q_node' by queue_lock from ioc_clear_queue(). Reported-and-tested-by: Pradeep Pragallapati Link: https://lore.kernel.org/lkml/20230517084434.18932-1-quic_pragalla@quicinc.com/ Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20230531073435.2923422-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Bug: 285274586 (cherry picked from commit 5a0ac57c48aa9380126bd9bf3ec82140aab84548) Change-Id: I60f3acfaa32f18bed58c8190178cdca5ebd91100 Signed-off-by: Pradeep P V K --- block/blk-ioc.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/block/blk-ioc.c b/block/blk-ioc.c index 63fc02042408..d5db92e62c43 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c @@ -77,6 +77,10 @@ static void ioc_destroy_icq(struct io_cq *icq) struct elevator_type *et = q->elevator->type; lockdep_assert_held(&ioc->lock); + lockdep_assert_held(&q->queue_lock); + + if (icq->flags & ICQ_DESTROYED) + return; radix_tree_delete(&ioc->icq_tree, icq->q->id); hlist_del_init(&icq->ioc_node); @@ -128,12 +132,7 @@ static void ioc_release_fn(struct work_struct *work) spin_lock(&q->queue_lock); spin_lock(&ioc->lock); - /* - * The icq may have been destroyed when the ioc lock - * was released. - */ - if (!(icq->flags & ICQ_DESTROYED)) - ioc_destroy_icq(icq); + ioc_destroy_icq(icq); spin_unlock(&q->queue_lock); rcu_read_unlock(); @@ -171,23 +170,20 @@ static bool ioc_delay_free(struct io_context *ioc) */ void ioc_clear_queue(struct request_queue *q) { - LIST_HEAD(icq_list); - spin_lock_irq(&q->queue_lock); - list_splice_init(&q->icq_list, &icq_list); - spin_unlock_irq(&q->queue_lock); - - rcu_read_lock(); - while (!list_empty(&icq_list)) { + while (!list_empty(&q->icq_list)) { struct io_cq *icq = - list_entry(icq_list.next, struct io_cq, q_node); + list_first_entry(&q->icq_list, struct io_cq, q_node); + /* + * Other context won't hold ioc lock to wait for queue_lock, see + * details in ioc_release_fn(). + */ spin_lock_irq(&icq->ioc->lock); - if (!(icq->flags & ICQ_DESTROYED)) - ioc_destroy_icq(icq); + ioc_destroy_icq(icq); spin_unlock_irq(&icq->ioc->lock); } - rcu_read_unlock(); + spin_unlock_irq(&q->queue_lock); } #else /* CONFIG_BLK_ICQ */ static inline void ioc_exit_icqs(struct io_context *ioc) From 0fdb44964c28cb797a85e75bb47831bf484aa667 Mon Sep 17 00:00:00 2001 From: Santosh Dronamraju Date: Tue, 5 Sep 2023 18:31:05 +0530 Subject: [PATCH 067/113] ANDROID: ABI: Update allowed list for QCOM Leaf changes summary: 2 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 2 Added functions: [A] 'function unsigned int blk_crypto_keyslot_index(struct blk_crypto_keyslot *slot)' [A] 'function bool blk_crypto_register(struct blk_crypto_profile *profile, struct request_queue *q)' Bug: 299067622 Change-Id: I3b5c9bad658ed88d8bdcdc0ed8c2ef0673d7600f Signed-off-by: Santosh Dronamraju --- android/abi_gki_aarch64_qcom | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index 6812f3091379..bb194a7f25af 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -94,6 +94,8 @@ bit_wait_timeout __blk_alloc_disk blkdev_get_by_dev + blk_crypto_keyslot_index + blk_crypto_register blk_execute_rq blk_execute_rq_nowait __blk_mq_alloc_disk From 8fb9de0877bf733b0e7f4ef82037c904e1daa3f7 Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Tue, 29 Aug 2023 11:17:44 -0700 Subject: [PATCH 068/113] ANDROID: fuse-bpf: Get correct inode in mkdir We were getting the inode with the parent inode info Also change variable names to remove confusion Also set bpf correctly in new inode Bug: 293838958 Test: fuse_test, atest ScopedStorageDeviceTest, atest CtsScopedStorageHostTest Change-Id: I0b6a6951599e0d211afd2243daacb98679503448 Signed-off-by: Paul Lawrence --- fs/fuse/backing.c | 29 +++++++++------- .../selftests/filesystems/fuse/fuse_test.c | 33 +++++++++++++++++++ .../selftests/filesystems/fuse/test_bpf.c | 22 +++++++++++++ 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 9df0535ad20f..303a78a63cd2 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -1446,32 +1446,34 @@ int fuse_mkdir_initialize( int fuse_mkdir_backing( struct fuse_bpf_args *fa, - struct inode *dir, struct dentry *entry, umode_t mode) + struct inode *dir_inode, struct dentry *entry, umode_t mode) { int err = 0; const struct fuse_mkdir_in *fmi = fa->in_args[0].value; - struct fuse_inode *fuse_inode = get_fuse_inode(dir); - struct inode *backing_inode = fuse_inode->backing_inode; + struct fuse_inode *dir_fuse_inode = get_fuse_inode(dir_inode); + struct inode *dir_backing_inode = dir_fuse_inode->backing_inode; struct path backing_path = {}; struct inode *inode = NULL; - struct dentry *d; //TODO Actually deal with changing the backing entry in mkdir get_fuse_backing_path(entry, &backing_path); if (!backing_path.dentry) return -EBADF; - inode_lock_nested(backing_inode, I_MUTEX_PARENT); + inode_lock_nested(dir_backing_inode, I_MUTEX_PARENT); mode = fmi->mode; - if (!IS_POSIXACL(backing_inode)) + if (!IS_POSIXACL(dir_backing_inode)) mode &= ~fmi->umask; - err = vfs_mkdir(&init_user_ns, backing_inode, backing_path.dentry, mode); + err = vfs_mkdir(&init_user_ns, dir_backing_inode, backing_path.dentry, + mode); if (err) goto out; if (d_really_is_negative(backing_path.dentry) || unlikely(d_unhashed(backing_path.dentry))) { - d = lookup_one_len(entry->d_name.name, backing_path.dentry->d_parent, - entry->d_name.len); + struct dentry *d = lookup_one_len(entry->d_name.name, + backing_path.dentry->d_parent, + entry->d_name.len); + if (IS_ERR(d)) { err = PTR_ERR(d); goto out; @@ -1479,14 +1481,19 @@ int fuse_mkdir_backing( dput(backing_path.dentry); backing_path.dentry = d; } - inode = fuse_iget_backing(dir->i_sb, fuse_inode->nodeid, backing_inode); + inode = fuse_iget_backing(dir_inode->i_sb, 0, + backing_path.dentry->d_inode); if (IS_ERR(inode)) { err = PTR_ERR(inode); goto out; } d_instantiate(entry, inode); + if (get_fuse_inode(inode)->bpf) + bpf_prog_put(get_fuse_inode(inode)->bpf); + get_fuse_inode(inode)->bpf = get_fuse_dentry(entry)->bpf; + get_fuse_dentry(entry)->bpf = NULL; out: - inode_unlock(backing_inode); + inode_unlock(dir_backing_inode); path_put(&backing_path); return err; } diff --git a/tools/testing/selftests/filesystems/fuse/fuse_test.c b/tools/testing/selftests/filesystems/fuse/fuse_test.c index 0bf1f030cbcd..01730e57dc51 100644 --- a/tools/testing/selftests/filesystems/fuse/fuse_test.c +++ b/tools/testing/selftests/filesystems/fuse/fuse_test.c @@ -2047,6 +2047,38 @@ out: return result; } +static int bpf_test_mkdir_and_remove_bpf(const char *mount_dir) +{ + const char *dir = "dir"; + + int result = TEST_FAILURE; + int src_fd = -1; + int bpf_fd = -1; + int fuse_dev = -1; + int fd = -1; + int fd2 = -1; + + TEST(src_fd = open(ft_src, O_DIRECTORY | O_RDONLY | O_CLOEXEC), + src_fd != -1); + TESTEQUAL(install_elf_bpf("test_bpf.bpf", "test_mkdir_remove", &bpf_fd, + NULL, NULL), 0); + TESTEQUAL(mount_fuse_no_init(mount_dir, bpf_fd, src_fd, &fuse_dev), 0); + TEST(fd = s_mkdir(s_path(s(mount_dir), s(dir)), 0777), + fd != -1); + TEST(fd2 = s_open(s_path(s(mount_dir), s(dir)), O_RDONLY), + fd2 != -1); + + result = TEST_SUCCESS; +out: + close(fd2); + close(fd); + close(fuse_dev); + close(bpf_fd); + close(src_fd); + umount(mount_dir); + return result; +} + static void parse_range(const char *ranges, bool *run_test, size_t tests) { size_t i; @@ -2175,6 +2207,7 @@ int main(int argc, char *argv[]) MAKE_TEST(bpf_test_lookup_postfilter), MAKE_TEST(flock_test), MAKE_TEST(bpf_test_create_and_remove_bpf), + MAKE_TEST(bpf_test_mkdir_and_remove_bpf), }; #undef MAKE_TEST diff --git a/tools/testing/selftests/filesystems/fuse/test_bpf.c b/tools/testing/selftests/filesystems/fuse/test_bpf.c index e02bdb4a9380..a014b915c059 100644 --- a/tools/testing/selftests/filesystems/fuse/test_bpf.c +++ b/tools/testing/selftests/filesystems/fuse/test_bpf.c @@ -530,4 +530,26 @@ int createremovebpf_test(struct fuse_bpf_args *fa) } } +SEC("test_mkdir_remove") +int mkdirremovebpf_test(struct fuse_bpf_args *fa) +{ + switch (fa->opcode) { + case FUSE_LOOKUP | FUSE_PREFILTER: { + return FUSE_BPF_BACKING | FUSE_BPF_POST_FILTER; + } + case FUSE_LOOKUP | FUSE_POSTFILTER: { + struct fuse_entry_bpf_out *febo = fa->out_args[1].value; + + febo->bpf_action = FUSE_ACTION_REMOVE; + return 0; + } + + case FUSE_OPENDIR | FUSE_PREFILTER: { + return -EIO; + } + + default: + return FUSE_BPF_BACKING; + } +} From 1fb9e95d464aad70ddcd5774ff61af375a4f324a Mon Sep 17 00:00:00 2001 From: luoyongjie Date: Tue, 5 Sep 2023 11:27:10 +0800 Subject: [PATCH 069/113] ANDROID: GKI: add symbol list file for meizu add abi_gki_aarch64_meizu INFO: 3 function symbol(s) added 'int __traceiter_android_rvh_sk_alloc(void*, struct sock*)' 'int __traceiter_android_rvh_sk_free(void*, struct sock*)' 'int __traceiter_android_vh_alloc_pages_slowpath(void*, gfp_t, unsigned int, unsigned long)' 3 variable symbol(s) added 'struct tracepoint __tracepoint_android_rvh_sk_alloc' 'struct tracepoint __tracepoint_android_rvh_sk_free' 'struct tracepoint __tracepoint_android_vh_alloc_pages_slowpath' Bug: 298972064 Change-Id: Ia38dd6adc6aac353d347a0a17db6582879bb3978 Signed-off-by: luoyongjie --- BUILD.bazel | 1 + android/abi_gki_aarch64.stg | 74 +++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_meizu | 14 +++++++ 3 files changed, 89 insertions(+) create mode 100644 android/abi_gki_aarch64_meizu diff --git a/BUILD.bazel b/BUILD.bazel index 9684c9d3b097..b0376d31d72e 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -104,6 +104,7 @@ filegroup( "android/abi_gki_aarch64_galaxy", "android/abi_gki_aarch64_honor", "android/abi_gki_aarch64_imx", + "android/abi_gki_aarch64_meizu", "android/abi_gki_aarch64_mtk", "android/abi_gki_aarch64_oplus", "android/abi_gki_aarch64_pixel", diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index e23c331b66f9..c4d672bfeeb5 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -306896,6 +306896,14 @@ function { parameter_id: 0x33756485 parameter_id: 0x0d7d7298 } +function { + id: 0x98788d90 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0xf1a6dfed + parameter_id: 0x4585663f + parameter_id: 0x33756485 +} function { id: 0x98792c3d return_type_id: 0x3e10b518 @@ -313027,6 +313035,12 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x0b3476b2 } +function { + id: 0x9bdaaaaa + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x1d44326e +} function { id: 0x9bdad4db return_type_id: 0x6720d32f @@ -328060,6 +328074,24 @@ elf_symbol { type_id: 0x9baf3eaf full_name: "__traceiter_android_rvh_show_max_freq" } +elf_symbol { + id: 0x955e6fc1 + name: "__traceiter_android_rvh_sk_alloc" + is_defined: true + symbol_type: FUNCTION + crc: 0x25e47a00 + type_id: 0x9bdaaaaa + full_name: "__traceiter_android_rvh_sk_alloc" +} +elf_symbol { + id: 0xfe20c6e3 + name: "__traceiter_android_rvh_sk_free" + is_defined: true + symbol_type: FUNCTION + crc: 0xd0de15c8 + type_id: 0x9bdaaaaa + full_name: "__traceiter_android_rvh_sk_free" +} elf_symbol { id: 0x7b07c7f1 name: "__traceiter_android_rvh_tick_entry" @@ -328195,6 +328227,15 @@ elf_symbol { type_id: 0x98716c4f full_name: "__traceiter_android_vh_alloc_pages_reclaim_bypass" } +elf_symbol { + id: 0xa6e329cd + name: "__traceiter_android_vh_alloc_pages_slowpath" + is_defined: true + symbol_type: FUNCTION + crc: 0xd7a24d94 + type_id: 0x98788d90 + full_name: "__traceiter_android_vh_alloc_pages_slowpath" +} elf_symbol { id: 0x9c240ef1 name: "__traceiter_android_vh_alloc_uid" @@ -331372,6 +331413,24 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_rvh_show_max_freq" } +elf_symbol { + id: 0xad588d93 + name: "__tracepoint_android_rvh_sk_alloc" + is_defined: true + symbol_type: OBJECT + crc: 0xda71608c + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_rvh_sk_alloc" +} +elf_symbol { + id: 0x05463d55 + name: "__tracepoint_android_rvh_sk_free" + is_defined: true + symbol_type: OBJECT + crc: 0x06bf13fe + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_rvh_sk_free" +} elf_symbol { id: 0x8db62b4f name: "__tracepoint_android_rvh_tick_entry" @@ -331507,6 +331566,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_alloc_pages_reclaim_bypass" } +elf_symbol { + id: 0x1ebb872f + name: "__tracepoint_android_vh_alloc_pages_slowpath" + is_defined: true + symbol_type: OBJECT + crc: 0x08e2839b + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_alloc_pages_slowpath" +} elf_symbol { id: 0xea695d5b name: "__tracepoint_android_vh_alloc_uid" @@ -386065,6 +386133,8 @@ interface { symbol_id: 0xa01b20ce symbol_id: 0x73c83ef4 symbol_id: 0x46515de8 + symbol_id: 0x955e6fc1 + symbol_id: 0xfe20c6e3 symbol_id: 0x7b07c7f1 symbol_id: 0x968833a5 symbol_id: 0x09f2fded @@ -386080,6 +386150,7 @@ interface { symbol_id: 0x86527a4e symbol_id: 0x33f9278c symbol_id: 0x2e343246 + symbol_id: 0xa6e329cd symbol_id: 0x9c240ef1 symbol_id: 0x505f4289 symbol_id: 0xd5431a65 @@ -386433,6 +386504,8 @@ interface { symbol_id: 0xe48123a4 symbol_id: 0x00b7ed82 symbol_id: 0xe8cacf26 + symbol_id: 0xad588d93 + symbol_id: 0x05463d55 symbol_id: 0x8db62b4f symbol_id: 0xe9c87fab symbol_id: 0xdf07959f @@ -386448,6 +386521,7 @@ interface { symbol_id: 0xe1489e0c symbol_id: 0x37776872 symbol_id: 0xfc735654 + symbol_id: 0x1ebb872f symbol_id: 0xea695d5b symbol_id: 0xd82141b7 symbol_id: 0xe520cb67 diff --git a/android/abi_gki_aarch64_meizu b/android/abi_gki_aarch64_meizu new file mode 100644 index 000000000000..32c666766bd9 --- /dev/null +++ b/android/abi_gki_aarch64_meizu @@ -0,0 +1,14 @@ +[abi_symbol_list] + __traceiter_android_vh_tune_scan_type + __traceiter_android_vh_tune_swappiness + __tracepoint_android_vh_tune_swappiness + __tracepoint_android_vh_tune_scan_type + __traceiter_android_rvh_sk_alloc + __traceiter_android_rvh_sk_free + __tracepoint_android_rvh_sk_alloc + __tracepoint_android_rvh_sk_free + __traceiter_android_vh_alloc_pages_slowpath + __tracepoint_android_vh_tune_swappiness + __tracepoint_android_vh_tune_scan_type + __tracepoint_android_vh_alloc_pages_slowpath + From 176d72d941d8bdb4506bd1738c851c4f887b5610 Mon Sep 17 00:00:00 2001 From: liuxudong5 Date: Tue, 15 Aug 2023 11:24:01 +0800 Subject: [PATCH 070/113] ANDROID: vendor_hooks: export cgroup_threadgroup_rwsem When the task wakes up from percpu_rwsem_wait, it will enter a long runnable state, which will cause frame loss when the application starts. In order to solve this problem, we need to let the process enter the "vip" queue when it is woken up, so we need to set a flag for the process holding the lock to prove that it is about to hold the lock. Most of this long runnable state occurs in the cgroup_threadgroup_rwsem, so we only care cgroup_threadgroup_rwsem, and cgroup_threadgroup_rwsem should be exported. Finally, if the semaphore is of cgroup_threadgroup_rwsem type and has a flag, then let it join the "vip" queue. Bug: 297785167 Signed-off-by: liuxudong Change-Id: I2297dfbc2f2681581241f85a3b4fd59415ea67db --- kernel/cgroup/cgroup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 7ccbfa771e0c..4f5074da1448 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -114,6 +114,7 @@ static DEFINE_SPINLOCK(cgroup_idr_lock); static DEFINE_SPINLOCK(cgroup_file_kn_lock); DEFINE_PERCPU_RWSEM(cgroup_threadgroup_rwsem); +EXPORT_SYMBOL_GPL(cgroup_threadgroup_rwsem); #define cgroup_assert_mutex_or_rcu_locked() \ RCU_LOCKDEP_WARN(!rcu_read_lock_held() && \ From 9f5a84b95553cb24ef6d9a0a60ec87f98db905e8 Mon Sep 17 00:00:00 2001 From: xiaofeng Date: Tue, 15 Aug 2023 21:04:46 +0800 Subject: [PATCH 071/113] ANDROID: GKI: Update symbol list for xiaomi 1 symbol(s) added export cgroup_threadgroup_rwsem Bug: 297785167 Change-Id: I8eb493e719f218f2804bdfb5800049c30992f065 Signed-off-by: xiaofeng --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_xiaomi | 1 + 2 files changed, 11 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index c4d672bfeeb5..2120604f9f5b 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -337853,6 +337853,15 @@ elf_symbol { type_id: 0x751b5661 full_name: "cgroup_taskset_next" } +elf_symbol { + id: 0xb7533de5 + name: "cgroup_threadgroup_rwsem" + is_defined: true + symbol_type: OBJECT + crc: 0x4e1c73cb + type_id: 0x6c952252 + full_name: "cgroup_threadgroup_rwsem" +} elf_symbol { id: 0x7a871d1c name: "check_move_unevictable_pages" @@ -387220,6 +387229,7 @@ interface { symbol_id: 0x4ce62869 symbol_id: 0x6d77f512 symbol_id: 0xb3cbf3c8 + symbol_id: 0xb7533de5 symbol_id: 0x7a871d1c symbol_id: 0x91718d34 symbol_id: 0x65e5fa26 diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index bd22553da95c..5c5426861df6 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -336,3 +336,4 @@ #required by lock_optimization module __traceiter_android_vh_record_pcpu_rwsem_time_early __tracepoint_android_vh_record_pcpu_rwsem_time_early + cgroup_threadgroup_rwsem From 523bfe85392c3996b9c84bb964ee0df3a50a91a3 Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Fri, 7 Jul 2023 12:33:52 -0700 Subject: [PATCH 072/113] ANDROID: fuse-bpf: Align data structs for 32-bit kernels BPF is always 64-bit code, so we need to pad the uapi structs to be the same on 32-bit as 64-bit Bug: 285477572 Test: Cuttlefish x86_64, x86 and x86 only all boot and load fuseMedia Change-Id: Idf5b09b2581b8d097048e7d2ff4039cd1806c082 Signed-off-by: Paul Lawrence --- include/uapi/linux/android_fuse.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/android_fuse.h b/include/uapi/linux/android_fuse.h index 221e30ea7f01..58f3d171952d 100644 --- a/include/uapi/linux/android_fuse.h +++ b/include/uapi/linux/android_fuse.h @@ -56,15 +56,29 @@ struct fuse_in_postfilter_header { /** One input argument of a request */ struct fuse_bpf_in_arg { uint32_t size; - const void *value; - const void *end_offset; + uint32_t padding; + union { + const void *value; + uint64_t padding2; + }; + union { + const void *end_offset; + uint64_t padding3; + }; }; /** One output argument of a request */ struct fuse_bpf_arg { uint32_t size; - void *value; - void *end_offset; + uint32_t padding; + union { + void *value; + uint64_t padding2; + }; + union { + void *end_offset; + uint64_t padding3; + }; }; #define FUSE_MAX_IN_ARGS 5 @@ -80,6 +94,7 @@ struct fuse_bpf_args { uint32_t in_numargs; uint32_t out_numargs; uint32_t flags; + uint32_t padding; struct fuse_bpf_in_arg in_args[FUSE_MAX_IN_ARGS]; struct fuse_bpf_arg out_args[FUSE_MAX_OUT_ARGS]; }; From 3973acfed0d499b963ae0743bebe8b78a59cfcb9 Mon Sep 17 00:00:00 2001 From: Yu Kuai Date: Tue, 6 Jun 2023 09:14:38 +0800 Subject: [PATCH 073/113] UPSTREAM: blk-ioc: fix recursive spin_lock/unlock_irq() in ioc_clear_queue() Recursive spin_lock/unlock_irq() is not safe, because spin_unlock_irq() will enable irq unconditionally: spin_lock_irq queue_lock -> disable irq spin_lock_irq ioc->lock spin_unlock_irq ioc->lock -> enable irq /* * AA dead lock will be triggered if current context is preempted by irq, * and irq try to hold queue_lock again. */ spin_unlock_irq queue_lock Fix this problem by using spin_lock/unlock() directly for 'ioc->lock'. Fixes: 5a0ac57c48aa ("blk-ioc: protect ioc_destroy_icq() by 'queue_lock'") Signed-off-by: Yu Kuai Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20230606011438.3743440-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Bug: 285274586 (cherry picked from commit a7cfa0af0c88353b4eb59db5a2a0fbe35329b3f9) Change-Id: I92433b1c639d20dd0cab6fc495a1b087cfdc8835 Signed-off-by: Pradeep P V K --- block/blk-ioc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-ioc.c b/block/blk-ioc.c index d5db92e62c43..25dd4db11121 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c @@ -179,9 +179,9 @@ void ioc_clear_queue(struct request_queue *q) * Other context won't hold ioc lock to wait for queue_lock, see * details in ioc_release_fn(). */ - spin_lock_irq(&icq->ioc->lock); + spin_lock(&icq->ioc->lock); ioc_destroy_icq(icq); - spin_unlock_irq(&icq->ioc->lock); + spin_unlock(&icq->ioc->lock); } spin_unlock_irq(&q->queue_lock); } From 4d8d9522dbbc4551cb1499ec82a298abe25b4223 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 5 Sep 2023 14:26:41 +0800 Subject: [PATCH 074/113] ANDROID: GKI: Export four symbols in file net/core/net-trace.c step 1: export the follow symbols in file net/core/net-trace.c EXPORT_TRACEPOINT_SYMBOL_GPL(net_dev_queue); EXPORT_TRACEPOINT_SYMBOL_GPL(net_dev_xmit); EXPORT_TRACEPOINT_SYMBOL_GPL(netif_receive_skb); EXPORT_TRACEPOINT_SYMBOL_GPL(netif_rx); step 2: update to symbol list, see link: https://android-review.googlesource.com/c/kernel/common/+/2742633 Bug: 193384408 Change-Id: I5a247d04000289809db89b609ddaec9af33db041 Signed-off-by: Wei Liu --- net/core/net-traces.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/core/net-traces.c b/net/core/net-traces.c index 82a8a5c05639..ed7d56d17665 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c @@ -60,3 +60,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll); EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset); EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum); + +EXPORT_TRACEPOINT_SYMBOL_GPL(net_dev_queue); +EXPORT_TRACEPOINT_SYMBOL_GPL(net_dev_xmit); +EXPORT_TRACEPOINT_SYMBOL_GPL(netif_receive_skb); +EXPORT_TRACEPOINT_SYMBOL_GPL(netif_rx); + From a891f77b7bb88ded6f530d0dd6a2e7e8467547b0 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 6 Sep 2023 15:06:16 +0800 Subject: [PATCH 075/113] ANDROID: GKI: Update symbols to symbol list step2:Add symbol list for oplus in android/abi_gki_aarch64_oplus 4 function symbol(s) added 'int __traceiter_net_dev_queue(void*, struct sk_buff*)' 'int __traceiter_net_dev_xmit(void*, struct sk_buff*, int, struct net_device*, unsigned int)' 'int __traceiter_netif_receive_skb(void*, struct sk_buff*)' 'int __traceiter_netif_rx(void*, struct sk_buff*)' 4 variable symbol(s) added 'struct tracepoint __tracepoint_net_dev_queue' 'struct tracepoint __tracepoint_net_dev_xmit' 'struct tracepoint __tracepoint_netif_receive_skb' 'struct tracepoint __tracepoint_netif_rx' Bug: 282874982 Change-Id: I7229e887e4733898a147567fd489ffd8d10c45f4 Signed-off-by: Wei Liu --- android/abi_gki_aarch64.stg | 95 +++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_oplus | 8 +++ 2 files changed, 103 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 2120604f9f5b..ea28c0b6304c 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -311893,6 +311893,15 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x030b9acf } +function { + id: 0x9ba3940a + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x054f691a + parameter_id: 0x6720d32f + parameter_id: 0x32a623d7 + parameter_id: 0x4585663f +} function { id: 0x9ba399e4 return_type_id: 0x6720d32f @@ -312301,6 +312310,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x18ea6ae3 } +function { + id: 0x9bba87c7 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x054f691a +} function { id: 0x9bbb9163 return_type_id: 0x6720d32f @@ -330306,6 +330321,42 @@ elf_symbol { type_id: 0x9bcd50ad full_name: "__traceiter_mmap_lock_start_locking" } +elf_symbol { + id: 0x16d7641f + name: "__traceiter_net_dev_queue" + is_defined: true + symbol_type: FUNCTION + crc: 0x51ca976f + type_id: 0x9bba87c7 + full_name: "__traceiter_net_dev_queue" +} +elf_symbol { + id: 0xc8ec671c + name: "__traceiter_net_dev_xmit" + is_defined: true + symbol_type: FUNCTION + crc: 0x7a8f0110 + type_id: 0x9ba3940a + full_name: "__traceiter_net_dev_xmit" +} +elf_symbol { + id: 0x60c24c4f + name: "__traceiter_netif_receive_skb" + is_defined: true + symbol_type: FUNCTION + crc: 0x6957530d + type_id: 0x9bba87c7 + full_name: "__traceiter_netif_receive_skb" +} +elf_symbol { + id: 0xa7548418 + name: "__traceiter_netif_rx" + is_defined: true + symbol_type: FUNCTION + crc: 0x76d09323 + type_id: 0x9bba87c7 + full_name: "__traceiter_netif_rx" +} elf_symbol { id: 0x3e69b303 name: "__traceiter_pelt_rt_tp" @@ -333645,6 +333696,42 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_mmap_lock_start_locking" } +elf_symbol { + id: 0xd21276a5 + name: "__tracepoint_net_dev_queue" + is_defined: true + symbol_type: OBJECT + crc: 0x0f304d20 + type_id: 0x18ccbd2c + full_name: "__tracepoint_net_dev_queue" +} +elf_symbol { + id: 0x4a43bdfe + name: "__tracepoint_net_dev_xmit" + is_defined: true + symbol_type: OBJECT + crc: 0xb1d40474 + type_id: 0x18ccbd2c + full_name: "__tracepoint_net_dev_xmit" +} +elf_symbol { + id: 0xd224caa5 + name: "__tracepoint_netif_receive_skb" + is_defined: true + symbol_type: OBJECT + crc: 0x8ee83e85 + type_id: 0x18ccbd2c + full_name: "__tracepoint_netif_receive_skb" +} +elf_symbol { + id: 0xcbc5fd52 + name: "__tracepoint_netif_rx" + is_defined: true + symbol_type: OBJECT + crc: 0x8aa12be4 + type_id: 0x18ccbd2c + full_name: "__tracepoint_netif_rx" +} elf_symbol { id: 0xf3cb5921 name: "__tracepoint_pelt_rt_tp" @@ -386390,6 +386477,10 @@ interface { symbol_id: 0x5c33446d symbol_id: 0x423dad0f symbol_id: 0xc630c439 + symbol_id: 0x16d7641f + symbol_id: 0xc8ec671c + symbol_id: 0x60c24c4f + symbol_id: 0xa7548418 symbol_id: 0x3e69b303 symbol_id: 0x7f1a363f symbol_id: 0x2c11fea4 @@ -386761,6 +386852,10 @@ interface { symbol_id: 0x88a08d67 symbol_id: 0xe2682879 symbol_id: 0xdffbb8bf + symbol_id: 0xd21276a5 + symbol_id: 0x4a43bdfe + symbol_id: 0xd224caa5 + symbol_id: 0xcbc5fd52 symbol_id: 0xf3cb5921 symbol_id: 0xcb194ec9 symbol_id: 0x009c40ce diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 63e48209f547..3aebc62c3c00 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -160,6 +160,10 @@ __traceiter_block_rq_issue __traceiter_block_rq_merge __traceiter_block_rq_requeue + __traceiter_net_dev_queue + __traceiter_net_dev_xmit + __traceiter_netif_receive_skb + __traceiter_netif_rx __traceiter_sched_stat_blocked __traceiter_sched_stat_iowait __traceiter_sched_stat_runtime @@ -239,6 +243,10 @@ __tracepoint_block_rq_issue __tracepoint_block_rq_merge __tracepoint_block_rq_requeue + __tracepoint_net_dev_queue + __tracepoint_net_dev_xmit + __tracepoint_netif_receive_skb + __tracepoint_netif_rx __tracepoint_sched_stat_blocked __tracepoint_sched_stat_iowait __tracepoint_sched_stat_runtime From 3367abadff8d5401db5b92dafd828f921160ec24 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sat, 12 Aug 2023 13:05:16 +0200 Subject: [PATCH 076/113] UPSTREAM: netfilter: nf_tables: deactivate catchall elements in next generation [ Upstream commit 90e5b3462efa37b8bba82d7c4e63683856e188af ] When flushing, individual set elements are disabled in the next generation via the ->flush callback. Catchall elements are not disabled. This is incorrect and may lead to double-deactivations of catchall elements which then results in memory leaks: WARNING: CPU: 1 PID: 3300 at include/net/netfilter/nf_tables.h:1172 nft_map_deactivate+0x549/0x730 CPU: 1 PID: 3300 Comm: nft Not tainted 6.5.0-rc5+ #60 RIP: 0010:nft_map_deactivate+0x549/0x730 [..] ? nft_map_deactivate+0x549/0x730 nf_tables_delset+0xb66/0xeb0 (the warn is due to nft_use_dec() detecting underflow). Bug: 298710879 Fixes: aaa31047a6d2 ("netfilter: nftables: add catch-all set element support") Reported-by: lonial con Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin (cherry picked from commit 00ea7eb1c69eec91cdf9259f0e427c56e7999fcd) Signed-off-by: Lee Jones Change-Id: I870613042789da3ab44f5f34a240f5dc8c4b25a2 --- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index ed73d8585e6e..d7ac35073c01 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6688,6 +6688,7 @@ static int nft_set_catchall_flush(const struct nft_ctx *ctx, ret = __nft_set_catchall_flush(ctx, set, &elem); if (ret < 0) break; + nft_set_elem_change_active(ctx->net, set, ext); } return ret; From 84131c988b4a33d9c909f0400147dcac5c53af58 Mon Sep 17 00:00:00 2001 From: Bumyong Lee Date: Wed, 6 Sep 2023 14:10:35 +0900 Subject: [PATCH 077/113] ANDROID: Update symbol list for Exynos Auto SoCs Update symbol list for Exynos Auto SoCs Bug: 299219798 Signed-off-by: Bumyong Lee Change-Id: I2a6a58cdfceb28186ee6a5778ce78e872d06c04f --- android/abi_gki_aarch64_exynosauto | 524 +++++++++++++++++++++++++---- 1 file changed, 462 insertions(+), 62 deletions(-) diff --git a/android/abi_gki_aarch64_exynosauto b/android/abi_gki_aarch64_exynosauto index da26fd1faca5..a26228697242 100644 --- a/android/abi_gki_aarch64_exynosauto +++ b/android/abi_gki_aarch64_exynosauto @@ -1,94 +1,386 @@ [abi_symbol_list] # commonly used symbols + alloc_workqueue + alt_cb_patch_nops + __arch_copy_from_user + __arch_copy_to_user + arm64_use_ng_mappings + blocking_notifier_call_chain + blocking_notifier_chain_register + cancel_delayed_work_sync + __check_object_size + __class_create + class_destroy + clk_disable + clk_enable + __clk_get_hw + clk_get_rate + clk_hw_get_parent clk_prepare + clk_register + clk_register_clkdev + clk_register_fixed_factor + clk_register_fixed_rate + clk_set_rate clk_unprepare + complete + __const_udelay + cpu_hwcaps + cpu_number + debugfs_create_dir + debugfs_create_file + debugfs_create_u32 + debugfs_remove + default_llseek + delayed_work_timer_fn + dev_driver_string _dev_err + device_create + device_create_file + device_destroy + device_for_each_child + device_get_match_data + device_remove_file + device_set_wakeup_capable + device_wakeup_disable + device_wakeup_enable _dev_info + devm_clk_get + devm_free_irq + devm_i2c_new_dummy_device + devm_ioremap + devm_ioremap_resource + devm_kfree devm_kmalloc + devm_mfd_add_devices + devm_pinctrl_get + devm_regulator_register devm_request_threaded_irq _dev_warn + disable_irq + disable_irq_nosync + dma_alloc_attrs + dma_free_attrs + dma_map_page_attrs + dma_release_channel + dma_request_chan dma_set_coherent_mask dma_set_mask + dma_unmap_page_attrs + enable_irq + fortify_panic + free_irq + get_device + gic_nonsecure_priorities + gpiod_direction_input + gpiod_direction_output_raw + gpiod_get_raw_value + gpiod_set_raw_value + gpio_to_desc + handle_level_irq + i2c_add_numbered_adapter + i2c_del_driver + i2c_register_driver + i2c_unregister_device + __init_swait_queue_head + init_timer_key + ioremap_prot + iounmap + irq_get_irq_data + irq_modify_status + irq_of_parse_and_map + irq_set_chip_and_handler_name + irq_set_chip_data + irq_set_irq_wake + is_vmalloc_addr + jiffies kfree + __kmalloc kmalloc_caches kmalloc_trace + kstrtoint + ktime_get + ktime_get_mono_fast_ns __list_add_valid + __list_del_entry_valid log_post_read_mmio log_post_write_mmio log_read_mmio log_write_mmio + loops_per_jiffy + memcpy + memdup_user + memset module_layout + __msecs_to_jiffies + msleep + __mutex_init + mutex_lock + mutex_unlock + of_address_to_resource + of_alias_get_id + of_clk_add_provider + of_clk_src_onecell_get + of_device_is_available + of_find_compatible_node + of_find_device_by_node + of_find_matching_node_and_match + of_find_node_by_name of_find_property + of_get_child_by_name + of_get_named_gpio_flags + of_get_next_child + of_get_property + of_get_regulator_init_data + of_iomap + of_match_node + __of_parse_phandle_with_args + of_property_read_string + of_property_read_string_helper of_property_read_variable_u32_array + of_root + panic + param_ops_int + param_ops_uint + pinctrl_lookup_state + pinctrl_select_state __platform_driver_register + platform_driver_unregister + platform_get_irq + platform_get_irq_optional + 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_suspend + __pm_runtime_use_autosuspend _printk + put_device __put_task_struct + queue_delayed_work_on + queue_work_on + _raw_spin_lock _raw_spin_lock_irqsave + _raw_spin_unlock _raw_spin_unlock_irqrestore + rdev_get_drvdata + rdev_get_id + register_pm_notifier + register_syscore_ops + regmap_read + regmap_update_bits_base + regmap_write + regulator_disable + regulator_enable + regulator_list_voltage_linear + regulator_map_voltage_linear + sched_clock + seq_lseek + seq_printf + seq_puts + seq_read + sg_init_table + simple_open + simple_read_from_buffer + simple_write_to_buffer + single_open + single_release snprintf + sprintf + sscanf __stack_chk_fail + strcasecmp + strcmp + strlcat + strlen + strncmp + strnlen + strscpy + strstr + syscon_regmap_lookup_by_phandle + sysfs_create_group + sysfs_emit + system_wq + __udelay + usleep_range_state + wait_for_completion_timeout + __warn_printk + +# required by cmupmucal.ko + debugfs_create_x32 + kernel_kobj + kobject_create_and_add + kstrtouint + of_find_node_by_type + +# required by dmatest.ko + __dma_request_channel + finish_wait + get_random_bytes + init_wait_entry + __init_waitqueue_head + kmem_cache_create + kmem_cache_destroy + kthread_create_on_node + kthread_should_stop + kthread_stop + mempool_alloc + mempool_alloc_slab + mempool_create + mempool_destroy + mempool_free + mempool_free_slab + param_get_bool + param_get_string + param_ops_bool + param_ops_string + param_set_bool + param_set_copystring + prepare_to_wait_event + refcount_warn_saturate + schedule + schedule_timeout + set_freezable + set_user_nice + strim + __wake_up + wake_up_process + +# required by dwc3-exynosauto-usb.ko + cancel_work_sync + device_create_managed_software_node + device_property_present + devm_phy_get + devm_regulator_get + of_match_device + of_platform_populate + phy_exit + phy_init + phy_power_off + phy_power_on + platform_device_add + platform_device_add_resources + platform_device_alloc + platform_device_del + platform_device_put + platform_device_unregister + platform_get_irq_byname_optional + __pm_relax + pm_runtime_allow + pm_runtime_forbid + __pm_runtime_set_status + __pm_stay_awake + sysfs_remove_group + typec_register_partner + typec_register_port + typec_set_data_role + typec_set_pwr_opmode + typec_set_pwr_role + typec_unregister_partner + typec_unregister_port + unregister_pm_notifier + usb_gadget_set_state + usb_otg_state_string + wakeup_source_register + wakeup_source_unregister + +# required by ect_parser.ko + memstart_addr + of_reserved_mem_lookup + strcpy + vmap + +# required by exynos-acme.ko + __bitmap_and + bitmap_parselist + __bitmap_weight + __cpu_active_mask + cpufreq_cpu_get + cpufreq_cpu_get_raw + cpufreq_cpu_put + __cpufreq_driver_target + cpufreq_freq_transition_begin + cpufreq_freq_transition_end + cpufreq_frequency_table_verify + cpufreq_generic_attr + cpufreq_register_driver + cpufreq_table_index_unsorted + cpuhp_tasks_frozen + __cpu_online_mask + dev_pm_opp_add + _find_first_bit + freq_qos_add_request + freq_qos_update_request + get_cpu_device + nr_cpu_ids + scnprintf + sysfs_create_file_ns + system_state + +# required by exynos-bts.ko + devm_kstrdup + _dev_notice # required by exynos-chipid_v2.ko kasprintf - of_device_is_available - of_find_matching_node_and_match of_find_node_opts_by_path - of_iomap - of_property_read_string soc_device_register subsys_system_register +# required by exynos-pd.ko + atomic_notifier_call_chain + kstrdup + of_genpd_add_provider_simple + pm_genpd_add_subdomain + pm_genpd_init + +# required by exynos-pd_el3.ko + __arm_smccc_smc + +# required by exynos-pm-time.ko + jiffies_to_msecs + +# required by exynos-pm.ko + of_property_count_elems_of_size + +# required by exynos_acpm.ko + generic_file_llseek + simple_attr_open + simple_attr_read + simple_attr_release + simple_attr_write + wait_for_completion_interruptible_timeout + +# required by exynos_pm_qos.ko + blocking_notifier_chain_unregister + kstrtoint_from_user + misc_register + noop_llseek + _raw_read_lock_irqsave + _raw_read_unlock_irqrestore + _raw_write_lock_irqsave + _raw_write_unlock_irqrestore + __usecs_to_jiffies + # required by exynos_tty.ko atomic_notifier_chain_register - clk_disable - clk_enable - clk_get_rate - clk_set_rate - __const_udelay - dev_driver_string - device_create_file - devm_clk_get - devm_ioremap - devm_kfree - devm_pinctrl_get - disable_irq_nosync dma_get_slave_caps - dma_map_page_attrs - dma_release_channel - dma_request_chan dma_sync_single_for_cpu dma_sync_single_for_device - dma_unmap_page_attrs do_SAK - enable_irq - free_irq - gic_nonsecure_priorities handle_sysrq iomem_resource - is_vmalloc_addr - jiffies kmalloc_large - of_alias_get_id - of_get_property - of_match_node oops_in_progress panic_notifier_list - pinctrl_lookup_state - pinctrl_select_state - platform_driver_unregister - platform_get_irq - platform_get_resource _raw_spin_trylock register_console - regmap_read - regmap_update_bits_base __release_region __request_region request_threaded_irq - sched_clock - sg_init_table - sscanf - syscon_regmap_lookup_by_phandle sysrq_mask tty_flip_buffer_push tty_insert_flip_string_fixed_flag @@ -107,50 +399,158 @@ uart_unregister_driver uart_update_timeout uart_write_wakeup - __warn_printk + +# required by exynosauto_v920_thermal.ko + devm_thermal_of_zone_register + devm_thermal_of_zone_unregister + of_device_is_compatible + of_thermal_get_ntrips + strncpy + thermal_zone_device_update + +# required by i2c-dev.ko + bus_register_notifier + bus_unregister_notifier + cdev_device_add + cdev_device_del + cdev_init + device_initialize + dev_set_name + i2c_adapter_type + i2c_bus_type + i2c_for_each_dev + i2c_get_adapter + i2c_put_adapter + i2c_smbus_xfer + i2c_transfer + i2c_transfer_buffer_flags + i2c_verify_client + register_chrdev_region + unregister_chrdev_region + +# required by i2c-exynosauto.ko + cpu_bit_bitmap + i2c_del_adapter + __irq_apply_affinity_hint + +# required by phy-exynosauto-usbdrd-super.ko + __clk_is_enabled + __devm_of_phy_provider_register + devm_phy_create + gpio_request + +# required by pinctrl-samsung-core.ko + device_get_next_child_node + devm_gpiochip_add_data_with_key + devm_kmemdup + devm_pinctrl_register + fwnode_handle_put + fwnode_property_present + generic_handle_domain_irq + gpiochip_generic_free + gpiochip_generic_request + gpiochip_get_data + gpiochip_lock_as_irq + gpiochip_unlock_as_irq + handle_edge_irq + irq_create_mapping_affinity + __irq_domain_add + irq_domain_remove + irq_domain_xlate_twocell + irq_set_chained_handler_and_data + kmemdup + krealloc + of_device_get_match_data + of_fwnode_ops + of_node_name_eq + of_prop_next_string + pinctrl_add_gpio_range + pinctrl_dev_get_drvdata + pinctrl_remove_gpio_range # required by pl330.ko - alt_cb_patch_nops amba_driver_register amba_driver_unregister - debugfs_create_file dev_err_probe - devm_free_irq - devm_ioremap_resource __devm_reset_control_get - dma_alloc_attrs dma_async_device_register dma_async_device_unregister dma_async_tx_descriptor_init dmaengine_unmap_put - dma_free_attrs dma_get_slave_channel dma_map_resource dma_unmap_resource - __kmalloc - ktime_get_mono_fast_ns - __list_del_entry_valid - loops_per_jiffy of_dma_controller_free of_dma_controller_register pm_runtime_force_resume pm_runtime_force_suspend pm_runtime_irq_safe - __pm_runtime_resume - pm_runtime_set_autosuspend_delay - __pm_runtime_suspend - __pm_runtime_use_autosuspend - _raw_spin_lock - _raw_spin_unlock reset_control_assert reset_control_deassert - seq_lseek - seq_printf - seq_puts - seq_read sg_next - single_open - single_release tasklet_kill __tasklet_schedule tasklet_setup + +# required by pwm-samsung.ko + devm_platform_ioremap_resource + of_prop_next_u32 + pwmchip_add + pwmchip_remove + pwm_get_chip_data + pwm_set_chip_data + +# required by rtc-s2vps02.ko + devm_rtc_device_register + pm_wakeup_ws_event + rtc_update_irq + rtc_valid_tm + +# required by s2vps02-master-mfd.ko + destroy_workqueue + __devm_irq_alloc_descs + handle_nested_irq + +# required by spi-exynosauto.ko + gpio_free + gpio_request_one + __spi_alloc_controller + spi_controller_resume + spi_controller_suspend + spi_delay_exec + spi_finalize_current_message + spi_register_controller + spi_unregister_controller + +# required by spidev.ko + device_property_match_string + driver_unregister + _raw_spin_lock_irq + _raw_spin_unlock_irq + __register_chrdev + __spi_register_driver + spi_setup + spi_sync + stream_open + __unregister_chrdev + +# required by ufs-exynosauto-core.ko + _find_next_bit + flush_work + kstrtoull + of_property_read_variable_u16_array + of_property_read_variable_u8_array + scsi_dma_unmap + scsi_done + ufshcd_auto_hibern8_update + ufshcd_config_pwr_mode + ufshcd_dme_get_attr + ufshcd_dme_set_attr + ufshcd_dump_regs + ufshcd_link_recovery + ufshcd_pltfrm_init + ufshcd_release + ufshcd_remove + ufshcd_shutdown + ufshcd_system_resume + ufshcd_system_suspend From eb9686932be35a47b6d621cc033a861b51e42741 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Mon, 28 Aug 2023 07:08:54 +0000 Subject: [PATCH 078/113] ANDROID: sched: Export symbols needed for vendor hooks Bug: 297343949 Change-Id: I0cb65e85b36687bfaae6a185ca373d7fb8de0a77 Signed-off-by: Rick Yiu --- kernel/sched/core.c | 1 + kernel/sched/fair.c | 1 + kernel/sched/pelt.c | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f534940a660a..8c1911fc5664 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2588,6 +2588,7 @@ out_unlock: put_task_struct(p); return 0; } +EXPORT_SYMBOL_GPL(push_cpu_stop); /* * sched_class::set_cpus_allowed must do the below, but is not required to diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 06e8f15819dd..d944a6f813c6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3350,6 +3350,7 @@ void reweight_task(struct task_struct *p, int prio) reweight_entity(cfs_rq, se, weight); load->inv_weight = sched_prio_to_wmult[prio]; } +EXPORT_SYMBOL_GPL(reweight_task); static inline int throttled_hierarchy(struct cfs_rq *cfs_rq); diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c index a005458373be..c1c84f5a3c03 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -176,7 +176,7 @@ accumulate_sum(u64 delta, struct sched_avg *sa, * load_avg = u_0` + y*(u_0 + u_1*y + u_2*y^2 + ... ) * = u_0 + u_1*y + u_2*y^2 + ... [re-labeling u_i --> u_{i+1}] */ -static __always_inline int +int ___update_load_sum(u64 now, struct sched_avg *sa, unsigned long load, unsigned long runnable, int running) { @@ -228,6 +228,7 @@ ___update_load_sum(u64 now, struct sched_avg *sa, return 1; } +EXPORT_SYMBOL_GPL(___update_load_sum); /* * When syncing *_avg with *_sum, we must take into account the current @@ -253,7 +254,7 @@ ___update_load_sum(u64 now, struct sched_avg *sa, * the period_contrib of cfs_rq when updating the sched_avg of a sched_entity * if it's more convenient. */ -static __always_inline void +void ___update_load_avg(struct sched_avg *sa, unsigned long load) { u32 divider = get_pelt_divider(sa); @@ -265,6 +266,7 @@ ___update_load_avg(struct sched_avg *sa, unsigned long load) sa->runnable_avg = div_u64(sa->runnable_sum, divider); WRITE_ONCE(sa->util_avg, sa->util_sum / divider); } +EXPORT_SYMBOL_GPL(___update_load_avg); /* * sched_entity: From 2b25d535d0703dbee0f9860dfd2c487e96a89fd8 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Mon, 19 Dec 2022 07:02:04 +0000 Subject: [PATCH 079/113] ANDROID: topology: Add vendor hook for use_amu_fie Vendors could decide to use amu fie feature or not, such as if they have some feature that needs amu fie to be disabled. Bug: 297343949 Change-Id: I6b44ee899c58e7d5a8b2db03a30e3ab14b08f101 Signed-off-by: Rick Yiu --- arch/arm64/kernel/topology.c | 7 +++++++ drivers/android/vendor_hooks.c | 1 + drivers/base/arch_topology.c | 6 ++++++ include/trace/hooks/topology.h | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 817d788cd866..7c93307bd960 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -22,6 +22,8 @@ #include #include +#include + #ifdef CONFIG_ACPI static bool __init acpi_cpu_is_threaded(int cpu) { @@ -151,6 +153,11 @@ static void amu_scale_freq_tick(void) { u64 prev_core_cnt, prev_const_cnt; u64 core_cnt, const_cnt, scale; + bool use_amu_fie = true; + + trace_android_vh_use_amu_fie(&use_amu_fie); + if(!use_amu_fie) + return; prev_const_cnt = this_cpu_read(arch_const_cycles_prev); prev_core_cnt = this_cpu_read(arch_core_cycles_prev); diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9a310923f1ed..b42e7f6ee83e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -326,3 +326,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_amu_fie); diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 2cdade8aa933..148e24b91cf1 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -34,6 +34,12 @@ static DEFINE_PER_CPU(u32, freq_factor) = 1; static bool supports_scale_freq_counters(const struct cpumask *cpus) { + bool use_amu_fie = true; + + trace_android_vh_use_amu_fie(&use_amu_fie); + if (!use_amu_fie) + return false; + return cpumask_subset(cpus, &scale_freq_counters_mask); } diff --git a/include/trace/hooks/topology.h b/include/trace/hooks/topology.h index d2673d4379c1..56a9fd22f8c6 100644 --- a/include/trace/hooks/topology.h +++ b/include/trace/hooks/topology.h @@ -24,6 +24,10 @@ DECLARE_HOOK(android_vh_arch_set_freq_scale, #endif +DECLARE_HOOK(android_vh_use_amu_fie, + TP_PROTO(bool *use_amu_fie), + TP_ARGS(use_amu_fie)); + #endif /* _TRACE_HOOK_TOPOLOGY_H */ /* This part must be outside protection */ #include From b57e3c1d9943249f0e7383cb54dd29ed8c416a78 Mon Sep 17 00:00:00 2001 From: Qais Yousef Date: Fri, 25 Nov 2022 15:23:17 +0000 Subject: [PATCH 080/113] ANDROID: sched/uclamp: Don't enable uclamp_is_used static key by in-kernel requests We do have now in-kernel users of uclamp to implement inheritance. The static_branch_enable() path unconditionally holds the cpus_read_lock() which might_sleep(). The path in binder that implements inheritance happens from in_atomic() context which leads to a splat like this one: [ 147.529960] BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:56 [ 147.530196] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2586, name: RenderThread [ 147.530410] INFO: lockdep is turned off. [ 147.530518] Preemption disabled at: [ 147.530521] [] binder_proc_transaction+0x78/0x41c [ 147.530793] CPU: 8 PID: 2586 Comm: RenderThread Tainted: G S W O 5.15.76-android14-5-00086-gc01afe5d262f #1 [ 147.531214] Call trace: [ 147.531288] dump_backtrace+0xe8/0x134 [ 147.531444] show_stack+0x1c/0x4c [ 147.531598] dump_stack_lvl+0x74/0x94 [ 147.531766] dump_stack+0x14/0x3c [ 147.531920] ___might_sleep+0x210/0x230 [ 147.532094] __might_sleep+0x54/0x84 [ 147.532259] cpus_read_lock+0x2c/0x160 [ 147.532429] static_key_enable+0x1c/0x34 [ 147.532608] __sched_setscheduler+0x2a8/0x99c [ 147.532802] sched_setattr_nocheck+0x1c/0x24 [ 147.532994] binder_do_set_priority+0x31c/0x4a4 [ 147.533195] binder_transaction_priority+0x200/0x3f4 [ 147.533413] binder_proc_transaction+0x220/0x41c [ 147.533618] binder_transaction+0x1df0/0x234c [ 147.533812] binder_thread_write+0xd84/0x2398 [ 147.534007] binder_ioctl_write_read+0x19c/0xb28 [ 147.534212] binder_ioctl+0x344/0x1a3c [ 147.534382] __arm64_sys_ioctl+0x94/0xc8 [ 147.534561] invoke_syscall+0x44/0xf8 [ 147.534729] el0_svc_common+0xc8/0x10c [ 147.534900] do_el0_svc+0x20/0x28 [ 147.535053] el0_svc+0x58/0xe0 [ 147.535198] el0t_64_sync_handler+0x7c/0xe4 [ 147.535386] el0t_64_sync+0x188/0x18c Prevent enabling the lock for !user initiated sched_setattr() operations. Generally we don't expect in-kernel uclamp users. Bug: 259145692 Signed-off-by: Qais Yousef Change-Id: Iac5be139b5ffd39f5e1c0431ce253133d81b98cf --- kernel/sched/core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8c1911fc5664..773175f6df5d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1880,7 +1880,7 @@ done: #endif static int uclamp_validate(struct task_struct *p, - const struct sched_attr *attr) + const struct sched_attr *attr, bool user) { int util_min = p->uclamp_req[UCLAMP_MIN].value; int util_max = p->uclamp_req[UCLAMP_MAX].value; @@ -1905,11 +1905,19 @@ static int uclamp_validate(struct task_struct *p, /* * We have valid uclamp attributes; make sure uclamp is enabled. * - * We need to do that here, because enabling static branches is a - * blocking operation which obviously cannot be done while holding + * We need to do that here, because enabling static branches is + * a blocking operation which obviously cannot be done while holding * scheduler locks. + * + * We only enable the static key if this was initiated by user space + * request. There should be no in-kernel users of uclamp except to + * implement things like inheritance like in binder. These in-kernel + * callers can rightfully be called be sometimes in_atomic() context + * which is invalid context to enable the key in. The enabling path + * unconditionally holds the cpus_read_lock() which might_sleep(). */ - static_branch_enable(&sched_uclamp_used); + if (user) + static_branch_enable(&sched_uclamp_used); return 0; } @@ -2050,7 +2058,7 @@ static void __init init_uclamp(void) static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { } static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { } static inline int uclamp_validate(struct task_struct *p, - const struct sched_attr *attr) + const struct sched_attr *attr, bool user) { return -EOPNOTSUPP; } @@ -7649,7 +7657,7 @@ recheck: /* Update task specific "requested" clamps */ if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) { - retval = uclamp_validate(p, attr); + retval = uclamp_validate(p, attr, user); if (retval) return retval; } From 57629741518b30501e7a653bb9ca05b929550651 Mon Sep 17 00:00:00 2001 From: Qais Yousef Date: Thu, 11 May 2023 15:34:13 +0000 Subject: [PATCH 081/113] ANDROID: Add new hook to enable overriding uclamp_validate() We want to add more special values, specifically for uclamp_max so that it can be set automatically to the most efficient value based on the core it's running on. Bug: 297343949 Signed-off-by: Qais Yousef Change-Id: I57343c4544f6cac621c855cbb94de0b8d80c51fa --- include/trace/hooks/sched.h | 5 +++++ kernel/sched/core.c | 6 ++++++ kernel/sched/vendor_hooks.c | 1 + 3 files changed, 12 insertions(+) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 4cc3f0cded7b..d661a77a9d33 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -321,6 +321,11 @@ DECLARE_HOOK(android_vh_setscheduler_uclamp, TP_PROTO(struct task_struct *tsk, int clamp_id, unsigned int value), TP_ARGS(tsk, clamp_id, value)); +DECLARE_HOOK(android_vh_uclamp_validate, + TP_PROTO(struct task_struct *p, const struct sched_attr *attr, + bool user, int *ret, bool *done), + TP_ARGS(p, attr, user, ret, done)); + DECLARE_HOOK(android_vh_update_topology_flags_workfn, TP_PROTO(void *unused), TP_ARGS(unused)); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 773175f6df5d..f27338be5f24 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1884,6 +1884,12 @@ static int uclamp_validate(struct task_struct *p, { int util_min = p->uclamp_req[UCLAMP_MIN].value; int util_max = p->uclamp_req[UCLAMP_MAX].value; + bool done = false; + int ret = 0; + + trace_android_vh_uclamp_validate(p, attr, user, &ret, &done); + if (done) + return ret; if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP_MIN) { util_min = attr->sched_util_min; diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index f528b1f6cbb9..6926c355facd 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -99,3 +99,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_irqtime_account_process_tick); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_effective_cpu_util); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmput); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_uclamp_validate); From e08c5de06edd75e3591ea5ff426b4845cf4076ce Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Thu, 29 Oct 2020 00:13:26 -0700 Subject: [PATCH 082/113] ANDROID: sched: Add vendor hooks for override sugov behavior Upstream moved the sugov to DEADLINE class which has higher prio than RT so it can potentially block many RT use case in Android. Also currently iowait doesn't distinguish background/foreground tasks and we have seen cases where device run to high frequency unnecessarily when running some background I/O. Bug: 297343949 Signed-off-by: Wei Wang Change-Id: I21e9bfe9ef75a4178279574389e417c3f38e65ac --- include/trace/hooks/sched.h | 8 +++++++- kernel/sched/cpufreq_schedutil.c | 1 + kernel/sched/fair.c | 5 ++++- kernel/sched/vendor_hooks.c | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index d661a77a9d33..1b1409197a1e 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -394,7 +394,13 @@ DECLARE_HOOK(android_vh_mmput, TP_PROTO(struct mm_struct *mm), TP_ARGS(mm)); -/* macro versions of hooks are no longer required */ +struct sched_attr; +DECLARE_HOOK(android_vh_set_sugov_sched_attr, + TP_PROTO(struct sched_attr *attr), + TP_ARGS(attr)); +DECLARE_RESTRICTED_HOOK(android_rvh_set_iowait, + TP_PROTO(struct task_struct *p, struct rq *rq, int *should_iowait_boost), + TP_ARGS(p, rq, should_iowait_boost), 1); #endif /* _TRACE_HOOK_SCHED_H */ /* This part must be outside protection */ diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 042e5ad60843..bf0426428915 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -603,6 +603,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy) if (policy->fast_switch_enabled) return 0; + trace_android_vh_set_sugov_sched_attr(&attr); kthread_init_work(&sg_policy->work, sugov_work); kthread_init_worker(&sg_policy->worker); thread = kthread_create(kthread_worker_fn, &sg_policy->worker, diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d944a6f813c6..dbc6688a82b6 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6130,6 +6130,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) struct sched_entity *se = &p->se; int idle_h_nr_running = task_has_idle_policy(p); int task_new = !(flags & ENQUEUE_WAKEUP); + int should_iowait_boost; /* * The code below (indirectly) updates schedutil which looks at @@ -6144,7 +6145,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) * utilization updates, so do it here explicitly with the IOWAIT flag * passed. */ - if (p->in_iowait) + should_iowait_boost = p->in_iowait; + trace_android_rvh_set_iowait(p, rq, &should_iowait_boost); + if (should_iowait_boost) cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT); for_each_sched_entity(se) { diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index 6926c355facd..6bf23be1aa10 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -100,3 +100,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_effective_cpu_util); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmput); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_uclamp_validate); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_sugov_sched_attr); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_iowait); From 6d97f75abc168e1d38feb9450daa52cd0fbcdc62 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Fri, 7 Jan 2022 18:31:06 +0800 Subject: [PATCH 083/113] ANDROID: sched: Add vendor hook for util-update related functions Vendor may have the need to implement their own util tracking. Bug: 297343949 Signed-off-by: Rick Yiu Change-Id: I973902e6ff82a85ecd029ac5a78692d629df1ebe --- include/trace/hooks/sched.h | 20 ++++++++++++++++++++ kernel/sched/fair.c | 10 ++++++++++ kernel/sched/vendor_hooks.c | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 1b1409197a1e..18f03c60a792 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -402,6 +402,26 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_iowait, TP_PROTO(struct task_struct *p, struct rq *rq, int *should_iowait_boost), TP_ARGS(p, rq, should_iowait_boost), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_attach_entity_load_avg, + TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se), + TP_ARGS(cfs_rq, se), 1); + +DECLARE_RESTRICTED_HOOK(android_rvh_detach_entity_load_avg, + TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se), + TP_ARGS(cfs_rq, se), 1); + +DECLARE_RESTRICTED_HOOK(android_rvh_update_load_avg, + TP_PROTO(u64 now, struct cfs_rq *cfs_rq, struct sched_entity *se), + TP_ARGS(now, cfs_rq, se), 1); + +DECLARE_RESTRICTED_HOOK(android_rvh_remove_entity_load_avg, + TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se), + TP_ARGS(cfs_rq, se), 1); + +DECLARE_RESTRICTED_HOOK(android_rvh_update_blocked_fair, + TP_PROTO(struct rq *rq), + TP_ARGS(rq), 1); + #endif /* _TRACE_HOOK_SCHED_H */ /* This part must be outside protection */ #include diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index dbc6688a82b6..fddd87c38cf3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4129,6 +4129,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s else se->avg.load_sum = 1; + trace_android_rvh_attach_entity_load_avg(cfs_rq, se); + enqueue_load_avg(cfs_rq, se); cfs_rq->avg.util_avg += se->avg.util_avg; cfs_rq->avg.util_sum += se->avg.util_sum; @@ -4152,6 +4154,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s */ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { + trace_android_rvh_detach_entity_load_avg(cfs_rq, se); + dequeue_load_avg(cfs_rq, se); sub_positive(&cfs_rq->avg.util_avg, se->avg.util_avg); sub_positive(&cfs_rq->avg.util_sum, se->avg.util_sum); @@ -4196,6 +4200,8 @@ static inline void update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s decayed = update_cfs_rq_load_avg(now, cfs_rq); decayed |= propagate_entity_load_avg(se); + trace_android_rvh_update_load_avg(now, cfs_rq, se); + if (!se->avg.last_update_time && (flags & DO_ATTACH)) { /* @@ -4253,6 +4259,8 @@ static void remove_entity_load_avg(struct sched_entity *se) sync_entity_load_avg(se); + trace_android_rvh_remove_entity_load_avg(cfs_rq, se); + raw_spin_lock_irqsave(&cfs_rq->removed.lock, flags); ++cfs_rq->removed.nr; cfs_rq->removed.util_avg += se->avg.util_avg; @@ -8756,6 +8764,8 @@ static bool __update_blocked_fair(struct rq *rq, bool *done) bool decayed = false; int cpu = cpu_of(rq); + trace_android_rvh_update_blocked_fair(rq); + /* * Iterates the task_group tree in a bottom up fashion, see * list_add_leaf_cfs_rq() for details. diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index 6bf23be1aa10..6dfffed61e3c 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -102,3 +102,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmput); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_uclamp_validate); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_sugov_sched_attr); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_iowait); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_attach_entity_load_avg); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_detach_entity_load_avg); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_remove_entity_load_avg); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_blocked_fair); From 2490ab50e7c7f0200a97aadb3ca003de4a822b58 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Tue, 22 Mar 2022 22:22:09 +0800 Subject: [PATCH 084/113] ANDROID: sched: Add vendor hook for rt util update Vendor may have need to track rt util. Bug: 201261299 Signed-off-by: Rick Yiu Change-Id: I2f4e5142c6bc8574ee3558042e1fb0dae13b702d --- include/trace/hooks/sched.h | 4 ++++ kernel/sched/rt.c | 3 +++ kernel/sched/vendor_hooks.c | 1 + 3 files changed, 8 insertions(+) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 18f03c60a792..594d6bd6c38b 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -422,6 +422,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_blocked_fair, TP_PROTO(struct rq *rq), TP_ARGS(rq), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_update_rt_rq_load_avg, + TP_PROTO(u64 now, struct rq *rq, struct task_struct *tsk, int running), + TP_ARGS(now, rq, tsk, running), 1); + #endif /* _TRACE_HOOK_SCHED_H */ /* This part must be outside protection */ #include diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index b55c5221fc4c..0de7c8fdb3f7 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1848,6 +1848,7 @@ static inline void set_next_task_rt(struct rq *rq, struct task_struct *p, bool f */ if (rq->curr->sched_class != &rt_sched_class) update_rt_rq_load_avg(rq_clock_pelt(rq), rq, 0); + trace_android_rvh_update_rt_rq_load_avg(rq_clock_pelt(rq), rq, p, 0); rt_queue_push_tasks(rq); } @@ -1918,6 +1919,7 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p) update_curr_rt(rq); update_rt_rq_load_avg(rq_clock_pelt(rq), rq, 1); + trace_android_rvh_update_rt_rq_load_avg(rq_clock_pelt(rq), rq, p, 1); /* * The previous task needs to be made eligible for pushing @@ -2737,6 +2739,7 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued) update_curr_rt(rq); update_rt_rq_load_avg(rq_clock_pelt(rq), rq, 1); + trace_android_rvh_update_rt_rq_load_avg(rq_clock_pelt(rq), rq, p, 1); watchdog(rq, p); diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index 6dfffed61e3c..9a8f2c3b2758 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -107,3 +107,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_detach_entity_load_avg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_load_avg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_remove_entity_load_avg); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_blocked_fair); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rt_rq_load_avg); From 20ecb229c5b2aa9b87bbcd42b37a0ee523ae0fa7 Mon Sep 17 00:00:00 2001 From: Qais Yousef Date: Tue, 25 Jul 2023 16:38:34 +0000 Subject: [PATCH 085/113] ANDROID: cpuidle: teo: Export a function that allows modifying util_threshold There are some corner cases where we do worse in power because the threshold is too low. Until these cases are better understood and addressed upstream, provide a function for vendors to override this value with something more suitable in their modules. Bug: 289293494 Signed-off-by: Qais Yousef Change-Id: I95dd36718a317f3fcb2a9f4bc87dd3390a4f7d7d --- drivers/cpuidle/governors/teo.c | 13 +++++++++++++ include/linux/cpuidle.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c index 987fc5f3997d..356ffc41d284 100644 --- a/drivers/cpuidle/governors/teo.c +++ b/drivers/cpuidle/governors/teo.c @@ -202,6 +202,19 @@ struct teo_cpu { static DEFINE_PER_CPU(struct teo_cpu, teo_cpus); +unsigned long teo_cpu_get_util_threshold(int cpu) +{ + struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, cpu); + return cpu_data->util_threshold; +} +EXPORT_SYMBOL_GPL(teo_cpu_get_util_threshold); +void teo_cpu_set_util_threshold(int cpu, unsigned long util) +{ + struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, cpu); + cpu_data->util_threshold = util; +} +EXPORT_SYMBOL_GPL(teo_cpu_set_util_threshold); + /** * teo_cpu_is_utilized - Check if the CPU's util is above the threshold * @cpu: Target CPU diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 1035cb423fc1..c223ca3eebaa 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -314,4 +314,12 @@ extern s64 cpuidle_governor_latency_req(unsigned int cpu); #define CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(low_level_idle_enter, idx, state) \ __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, state, 1) +#ifdef CONFIG_CPU_IDLE_GOV_TEO +unsigned long teo_cpu_get_util_threshold(int cpu); +void teo_cpu_set_util_threshold(int cpu, unsigned long util); +#else +static inline unsigned long teo_cpu_get_util_threshold(int cpu) {return -1;} +static inline void teo_cpu_set_util_threshold(int cpu, unsigned long util) {} +#endif + #endif /* _LINUX_CPUIDLE_H */ From a68bd014933d54623838ac1c07fd725694631e53 Mon Sep 17 00:00:00 2001 From: Mostafa Saleh Date: Wed, 6 Sep 2023 17:57:36 +0000 Subject: [PATCH 086/113] ANDROID: KVM: arm64: Don't update IOMMUs for share/unshare Share/unshare initiated by host doesn't change memory permission, and as currently pKVM doesn't support device assignment, there is no need to update the IOMMU unnecessarily as it waste cycles. Once device assignment is enabled, this assumption will not be valid as guests have access to DMA. Bug: 291843613 Change-Id: I28c69ec8f721711d5b59fa2784386fa61654fe5a Signed-off-by: Mostafa Saleh --- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index 2aeb5a8a7baa..34d737112e72 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c @@ -1048,9 +1048,20 @@ static int __host_check_page_state_range(u64 addr, u64 size, static int __host_set_page_state_range(u64 addr, u64 size, enum pkvm_page_state state) { + bool update_iommu = true; enum kvm_pgtable_prot prot = pkvm_mkstate(PKVM_HOST_MEM_PROT, state); - return host_stage2_idmap_locked(addr, size, prot, true); + /* + * Sharing and unsharing host pages shouldn't change the IOMMU page tables, + * so avoid extra page tables walks for the IOMMU. + * HOWEVER THIS WILL NOT WORK WHEN DEVICE ASSIGNMENT IS SUPPORTED AS THE GUEST + * MIGHT HAVE ACCESS TO DMA. + * but as Android-14 doesn't support device assignment this should be fine. + */ + if ((state == PKVM_PAGE_OWNED) || (state == PKVM_PAGE_SHARED_OWNED)) + update_iommu = false; + + return host_stage2_idmap_locked(addr, size, prot, update_iommu); } static int host_request_owned_transition(u64 *completer_addr, From 68eefde2d34b5aa5693b16b86604f2d4979ad83a Mon Sep 17 00:00:00 2001 From: RD Babiera Date: Tue, 5 Sep 2023 22:14:40 +0000 Subject: [PATCH 087/113] UPSTREAM: usb: typec: tcpm: set initial svdm version based on pd revision When sending Discover Identity messages to a Port Partner that uses Power Delivery v2 and SVDM v1, we currently send PD v2 messages with SVDM v2.0, expecting the port partner to respond with its highest supported SVDM version as stated in Section 6.4.4.2.3 in the Power Delivery v3 specification. However, sending SVDM v2 to some Power Delivery v2 port partners results in a NAK whereas sending SVDM v1 does not. NAK messages can be handled by the initiator (PD v3 section 6.4.4.2.5.1), and one solution could be to resend Discover Identity on a lower SVDM version if possible. But, Section 6.4.4.3 of PD v2 states that "A NAK response Should be taken as an indication not to retry that particular Command." Instead, we can set the SVDM version to the maximum one supported by the negotiated PD revision. When operating in PD v2, this obeys Section 6.4.4.2.3, which states the SVDM field "Shall be set to zero to indicate Version 1.0." In PD v3, the SVDM field "Shall be set to 01b to indicate Version 2.0." Fixes: c34e85fa69b9 ("usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work") Cc: stable@vger.kernel.org Signed-off-by: RD Babiera Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20230731165926.1815338-1-rdbabiera@google.com Signed-off-by: Greg Kroah-Hartman Bug: 289437937 (cherry picked from commit c97cd0b4b54eb42aed7f6c3c295a2d137f6d2416) Signed-off-by: RD Babiera (cherry picked from https://android-review.googlesource.com/q/commit:d02aef1ae51a03b9ab20c8e01ed32593a7ffc6fc) Merged-In: Ie919c29bab68cb08cb659471ff6106bae502c8dd Change-Id: Ie919c29bab68cb08cb659471ff6106bae502c8dd --- drivers/usb/typec/tcpm/tcpm.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 02c2dfac1b87..ecdfce81dadb 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3853,6 +3853,29 @@ static enum typec_cc_status tcpm_pwr_opmode_to_rp(enum typec_pwr_opmode opmode) } } +static void tcpm_set_initial_svdm_version(struct tcpm_port *port) +{ + switch (port->negotiated_rev) { + case PD_REV30: + break; + /* + * 6.4.4.2.3 Structured VDM Version + * 2.0 states "At this time, there is only one version (1.0) defined. + * This field Shall be set to zero to indicate Version 1.0." + * 3.0 states "This field Shall be set to 01b to indicate Version 2.0." + * To ensure that we follow the Power Delivery revision we are currently + * operating on, downgrade the SVDM version to the highest one supported + * by the Power Delivery revision. + */ + case PD_REV20: + typec_partner_set_svdm_version(port->partner, SVDM_VER_1_0); + break; + default: + typec_partner_set_svdm_version(port->partner, SVDM_VER_1_0); + break; + } +} + static void run_state_machine(struct tcpm_port *port) { int ret; @@ -4097,10 +4120,12 @@ static void run_state_machine(struct tcpm_port *port) * For now, this driver only supports SOP for DISCOVER_IDENTITY, thus using * port->explicit_contract to decide whether to send the command. */ - if (port->explicit_contract) + if (port->explicit_contract) { + tcpm_set_initial_svdm_version(port); mod_send_discover_delayed_work(port, 0); - else + } else { port->send_discover = false; + } /* * 6.3.5 @@ -4403,10 +4428,12 @@ static void run_state_machine(struct tcpm_port *port) * For now, this driver only supports SOP for DISCOVER_IDENTITY, thus using * port->explicit_contract. */ - if (port->explicit_contract) + if (port->explicit_contract) { + tcpm_set_initial_svdm_version(port); mod_send_discover_delayed_work(port, 0); - else + } else { port->send_discover = false; + } power_supply_changed(port->psy); break; From cd94fe67fd3323953016b8193f5be75982da96c8 Mon Sep 17 00:00:00 2001 From: Prathu Baronia Date: Mon, 4 Sep 2023 14:21:36 +0530 Subject: [PATCH 088/113] ANDROID: ABI: Update symbols to qcom whitelist Update whitelist for the symbols used by qcom socs in abi_gki_aarch64_qcom. 1 function symbol(s) added 'vhost_dev_flush' Bug: 299585715 Change-Id: I403394331953c9cfee54b4b0c2a0365a3df5f0af Signed-off-by: Prathu Baronia Signed-off-by: Aleksei Vetrov --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_qcom | 1 + 2 files changed, 11 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index ea28c0b6304c..659c0b5ab92a 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -383443,6 +383443,15 @@ elf_symbol { type_id: 0x1eca8a34 full_name: "vhost_dev_cleanup" } +elf_symbol { + id: 0x14bde45c + name: "vhost_dev_flush" + is_defined: true + symbol_type: FUNCTION + crc: 0xdb5a9875 + type_id: 0x1eca8a34 + full_name: "vhost_dev_flush" +} elf_symbol { id: 0x429eeda3 name: "vhost_dev_init" @@ -392379,6 +392388,7 @@ interface { symbol_id: 0xf33dadbd symbol_id: 0x743ba358 symbol_id: 0x9f33c2c6 + symbol_id: 0x14bde45c symbol_id: 0x429eeda3 symbol_id: 0x67d81c4b symbol_id: 0x5b1b7953 diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index bb194a7f25af..2e7e84cbdbe6 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -3907,6 +3907,7 @@ vhost_dev_init vhost_dev_ioctl vhost_dev_stop + vhost_dev_flush vhost_disable_notify vhost_enable_notify vhost_get_vq_desc From 478ec4dbea4216d169ddb5f293e77ed81a01e126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aaro=20M=C3=A4kinen?= Date: Mon, 11 Sep 2023 15:57:57 +0300 Subject: [PATCH 089/113] ANDROID: GKI: Update Tuxera symbol list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This list covers Microsoft exFAT by Tuxera and Microsoft NTFS by Tuxera file system drivers. INFO: 118 function symbol(s) added 'void __bforget(struct buffer_head*)' 'void __bh_read_batch(int, struct buffer_head**, blk_opf_t, bool)' 'ssize_t __blockdev_direct_IO(struct kiocb*, struct inode*, struct block_device*, struct iov_iter*, get_block_t*, dio_iodone_t*, dio_submit_t*, int)' 'struct buffer_head* __bread_gfp(struct block_device*, sector_t, unsigned int, gfp_t)' 'void __breadahead(struct block_device*, sector_t, unsigned int)' 'void __brelse(struct buffer_head*)' 'void __filemap_set_wb_err(struct address_space*, int)' 'struct folio* __folio_alloc(gfp_t, unsigned int, int, nodemask_t*)' 'void __folio_cancel_dirty(struct folio*)' 'void __insert_inode_hash(struct inode*, unsigned long)' 'void __mark_inode_dirty(struct inode*, int)' 'void __remove_inode_hash(struct inode*)' 'int __set_page_dirty_nobuffers(struct page*)' 'int __sync_dirty_buffer(struct buffer_head*, blk_opf_t)' 'void _trace_android_vh_record_pcpu_rwsem_time_early(unsigned long, struct percpu_rw_semaphore*)' 'struct wait_queue_head* bit_waitqueue(void*, int)' 'int blkdev_issue_discard(struct block_device*, sector_t, sector_t, gfp_t)' 'bool block_dirty_folio(struct address_space*, struct folio*)' 'void block_invalidate_folio(struct folio*, size_t, size_t)' 'bool block_is_partially_uptodate(struct folio*, size_t, size_t)' 'int buffer_migrate_folio(struct address_space*, struct folio*, struct folio*, enum migrate_mode)' 'bool capable_wrt_inode_uidgid(struct user_namespace*, const struct inode*, int)' 'void clean_bdev_aliases(struct block_device*, sector_t, sector_t)' 'void clear_inode(struct inode*)' 'bool clear_page_dirty_for_io(struct page*)' 'size_t copy_page_from_iter_atomic(struct page*, unsigned int, size_t, struct iov_iter*)' 'void create_empty_buffers(struct page*, unsigned long, unsigned long)' 'int current_umask()' 'struct dentry* d_add_ci(struct dentry*, struct inode*, struct qstr*)' 'void d_instantiate(struct dentry*, struct inode*)' 'struct dentry* d_obtain_alias(struct inode*)' 'struct dentry* d_splice_alias(struct inode*, struct dentry*)' 'int down_write_trylock(struct rw_semaphore*)' 'void drop_nlink(struct inode*)' 'void end_buffer_write_sync(struct buffer_head*, int)' 'void end_page_writeback(struct page*)' 'errseq_t errseq_set(errseq_t*, int)' 'size_t fault_in_iov_iter_readable(const struct iov_iter*, size_t)' 'size_t fault_in_safe_writeable(const char*, size_t)' 'int fiemap_fill_next_extent(struct fiemap_extent_info*, u64, u64, u64, u32)' 'int fiemap_prep(struct inode*, struct fiemap_extent_info*, u64, u64*, u32)' 'int file_check_and_advance_wb_err(struct file*)' 'int file_remove_privs(struct file*)' 'int file_update_time(struct file*)' 'bool filemap_dirty_folio(struct address_space*, struct folio*)' 'vm_fault_t filemap_fault(struct vm_fault*)' 'int filemap_fdatawait_range(struct address_space*, loff_t, loff_t)' 'int filemap_fdatawrite(struct address_space*)' 'int filemap_fdatawrite_range(struct address_space*, loff_t, loff_t)' 'int filemap_flush(struct address_space*)' 'int filemap_write_and_wait_range(struct address_space*, loff_t, loff_t)' 'int folio_write_one(struct folio*)' 'int generic_error_remove_page(struct address_space*, struct page*)' 'ssize_t generic_file_direct_write(struct kiocb*, struct iov_iter*)' 'int generic_file_mmap(struct file*, struct vm_area_struct*)' 'int generic_file_open(struct inode*, struct file*)' 'ssize_t generic_file_splice_read(struct file*, loff_t*, struct pipe_inode_info*, size_t, unsigned int)' 'void generic_fillattr(struct user_namespace*, struct inode*, struct kstat*)' 'ssize_t generic_read_dir(struct file*, char*, size_t, loff_t*)' 'struct page* grab_cache_page_write_begin(struct address_space*, unsigned long)' 'struct inode* iget5_locked(struct super_block*, unsigned long, int(*)(struct inode*, void*), int(*)(struct inode*, void*), void*)' 'struct inode* igrab(struct inode*)' 'void ihold(struct inode*)' 'struct inode* ilookup5(struct super_block*, unsigned long, int(*)(struct inode*, void*), void*)' 'int in_group_p(kgid_t)' 'void inc_nlink(struct inode*)' 'void init_special_inode(struct inode*, umode_t, dev_t)' 'void inode_dio_wait(struct inode*)' 'void inode_init_once(struct inode*)' 'void inode_init_owner(struct user_namespace*, struct inode*, const struct inode*, umode_t)' 'bool inode_maybe_inc_iversion(struct inode*, bool)' 'int inode_newsize_ok(const struct inode*, loff_t)' 'void inode_set_flags(struct inode*, unsigned int, unsigned int)' 'void invalidate_bdev(struct block_device*)' 'unsigned long iov_iter_alignment(const struct iov_iter*)' 'ssize_t iov_iter_get_pages2(struct iov_iter*, struct page**, size_t, unsigned int, size_t*)' 'size_t iov_iter_single_seg_count(const struct iov_iter*)' 'bool is_bad_inode(struct inode*)' 'ssize_t iter_file_splice_write(struct pipe_inode_info*, struct file*, loff_t*, size_t, unsigned int)' 'ino_t iunique(struct super_block*, ino_t)' 'void kill_block_super(struct super_block*)' 'void* kmem_cache_alloc_lru(struct kmem_cache*, struct list_lru*, gfp_t)' 'struct nls_table* load_nls(char*)' 'struct nls_table* load_nls_default()' 'void make_bad_inode(struct inode*)' 'void mark_buffer_async_write(struct buffer_head*)' 'void mark_buffer_dirty(struct buffer_head*)' 'void mark_buffer_write_io_error(struct buffer_head*)' 'struct dentry* mount_bdev(struct file_system_type*, int, const char*, void*, int(*)(struct super_block*, void*, int))' 'int mpage_read_folio(struct folio*, get_block_t*)' 'void mpage_readahead(struct readahead_control*, get_block_t*)' 'int notify_change(struct user_namespace*, struct dentry*, struct iattr*, struct inode**)' 'unsigned long page_cache_next_miss(struct address_space*, unsigned long, unsigned long)' 'unsigned long page_cache_prev_miss(struct address_space*, unsigned long, unsigned long)' 'void page_zero_new_buffers(struct page*, unsigned int, unsigned int)' 'struct page* pagecache_get_page(struct address_space*, unsigned long, int, gfp_t)' 'unsigned int pagevec_lookup_range_tag(struct pagevec*, struct address_space*, unsigned long*, unsigned long, xa_mark_t)' 'bool redirty_page_for_writepage(struct writeback_control*, struct page*)' 'int sb_min_blocksize(struct super_block*, int)' 'int sb_set_blocksize(struct super_block*, int)' 'int security_inode_init_security(struct inode*, struct inode*, const struct qstr*, initxattrs, void*)' 'void set_nlink(struct inode*, unsigned int)' 'bool set_page_writeback(struct page*)' 'int setattr_prepare(struct user_namespace*, struct dentry*, struct iattr*)' 'int sync_dirty_buffer(struct buffer_head*)' 'int sync_inode_metadata(struct inode*, int)' 'void tag_pages_for_writeback(struct address_space*, unsigned long, unsigned long)' 'struct timespec64 timestamp_truncate(struct timespec64, struct inode*)' 'void touch_atime(const struct path*)' 'void truncate_inode_pages(struct address_space*, loff_t)' 'void truncate_inode_pages_final(struct address_space*)' 'void truncate_pagecache(struct inode*, loff_t)' 'void truncate_setsize(struct inode*, loff_t)' 'void try_to_writeback_inodes_sb(struct super_block*, enum wb_reason)' 'void unload_nls(struct nls_table*)' 'void unlock_new_inode(struct inode*)' 'int wake_bit_function(struct wait_queue_entry*, unsigned int, int, void*)' 'int write_inode_now(struct inode*, int)' Bug: 299833811 Change-Id: I51ae5f4b02bab32a913b95b16ab5625ba41458f5 Signed-off-by: Aaro Mäkinen --- android/abi_gki_aarch64.stg | 1816 ++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_tuxera | 303 +++++- 2 files changed, 2096 insertions(+), 23 deletions(-) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 659c0b5ab92a..a4deca84a412 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -223,6 +223,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x292a6e73 } +pointer_reference { + id: 0x00daeb4b + kind: POINTER + pointee_type_id: 0x292b4bb0 +} pointer_reference { id: 0x00dd92af kind: POINTER @@ -1828,6 +1833,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x30293561 } +pointer_reference { + id: 0x06a428cc + kind: POINTER + pointee_type_id: 0x30d045ac +} pointer_reference { id: 0x06afdad0 kind: POINTER @@ -2608,6 +2618,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x0dd91f48 } +pointer_reference { + id: 0x09eee7e5 + kind: POINTER + pointee_type_id: 0x0dfb7909 +} pointer_reference { id: 0x09f1b886 kind: POINTER @@ -3648,6 +3663,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1b841a62 } +pointer_reference { + id: 0x0c715d8d + kind: POINTER + pointee_type_id: 0x1b8590a8 +} pointer_reference { id: 0x0c74ddbe kind: POINTER @@ -3983,6 +4003,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x197157bd } +pointer_reference { + id: 0x0ccdc0f9 + kind: POINTER + pointee_type_id: 0x1977e57b +} pointer_reference { id: 0x0cce6a6a kind: POINTER @@ -6708,6 +6733,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x167c181d } +pointer_reference { + id: 0x0f12d1e7 + kind: POINTER + pointee_type_id: 0x160ba102 +} pointer_reference { id: 0x0f161b41 kind: POINTER @@ -11998,6 +12028,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xb837e52e } +pointer_reference { + id: 0x24a22acc + kind: POINTER + pointee_type_id: 0xb8c84daf +} pointer_reference { id: 0x24bbc433 kind: POINTER @@ -14158,6 +14193,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9b022eae } +pointer_reference { + id: 0x2c50e503 + kind: POINTER + pointee_type_id: 0x9b037291 +} pointer_reference { id: 0x2c510476 kind: POINTER @@ -14953,6 +14993,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9bbdba09 } +pointer_reference { + id: 0x2c7fb451 + kind: POINTER + pointee_type_id: 0x9bbe37da +} pointer_reference { id: 0x2c7ffaf6 kind: POINTER @@ -15333,6 +15378,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x98f1d602 } +pointer_reference { + id: 0x2cacacc0 + kind: POINTER + pointee_type_id: 0x98f2559e +} pointer_reference { id: 0x2caea882 kind: POINTER @@ -16573,6 +16623,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9e8fd7cb } +pointer_reference { + id: 0x2d34349d + kind: POINTER + pointee_type_id: 0x9e9034ea +} pointer_reference { id: 0x2d3466af kind: POINTER @@ -18623,6 +18678,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x920d4b76 } +pointer_reference { + id: 0x2e137a28 + kind: POINTER + pointee_type_id: 0x920d0e3f +} pointer_reference { id: 0x2e1466a0 kind: POINTER @@ -21028,6 +21088,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x97b2b8d0 } +pointer_reference { + id: 0x2f802886 + kind: POINTER + pointee_type_id: 0x94404485 +} pointer_reference { id: 0x2f805571 kind: POINTER @@ -24653,6 +24718,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xf3dea95c } +pointer_reference { + id: 0x3667e19e + kind: POINTER + pointee_type_id: 0xf3df60e5 +} pointer_reference { id: 0x3668642a kind: POINTER @@ -27888,6 +27958,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xdda60846 } +pointer_reference { + id: 0x3dfac2ad + kind: POINTER + pointee_type_id: 0xddabec2b +} pointer_reference { id: 0x3e001c39 kind: POINTER @@ -29253,6 +29328,16 @@ typedef { name: "dev_t" referred_type_id: 0xe83041c0 } +typedef { + id: 0xb8c84daf + name: "dio_iodone_t" + referred_type_id: 0x9f043139 +} +typedef { + id: 0x30d045ac + name: "dio_submit_t" + referred_type_id: 0x15976e28 +} typedef { id: 0xe02e14d6 name: "dma_addr_t" @@ -29393,6 +29478,11 @@ typedef { name: "genpool_algo_t" referred_type_id: 0x06afdad0 } +typedef { + id: 0x98f2559e + name: "get_block_t" + referred_type_id: 0x982488f7 +} typedef { id: 0x244afa25 name: "gfn_t" @@ -29438,6 +29528,11 @@ typedef { name: "hfn_t" referred_type_id: 0x92233392 } +typedef { + id: 0xd57eb7ba + name: "initxattrs" + referred_type_id: 0x2c7fb451 +} typedef { id: 0xee72cbfc name: "ino_t" @@ -33403,6 +33498,11 @@ qualified { qualifier: CONST qualified_type_id: 0xbe067d4b } +qualified { + id: 0xf3df60e5 + qualifier: CONST + qualified_type_id: 0xbf3a351e +} qualified { id: 0xf3e17637 qualifier: CONST @@ -43825,6 +43925,12 @@ member { name: "algorithm_id" type_id: 0x295c7202 } +member { + id: 0x25050ebe + name: "alias" + type_id: 0x3e10b518 + offset: 64 +} member { id: 0x33075cab name: "align" @@ -58966,6 +59072,12 @@ member { type_id: 0x32941b2b offset: 128 } +member { + id: 0x26d4a9a4 + name: "char2uni" + type_id: 0x2e137a28 + offset: 192 +} member { id: 0xfdbbc663 name: "char_dev" @@ -59072,6 +59184,23 @@ member { type_id: 0x3bc90e1f offset: 704 } +member { + id: 0x551378c2 + name: "charset" + type_id: 0x3e10b518 +} +member { + id: 0x6322a32f + name: "charset2lower" + type_id: 0x384c5795 + offset: 256 +} +member { + id: 0x06048b6e + name: "charset2upper" + type_id: 0x384c5795 + offset: 320 +} member { id: 0x9e156774 name: "check" @@ -130574,6 +130703,12 @@ member { type_id: 0x015f6fbc offset: 896 } +member { + id: 0x11f3dd43 + name: "next" + type_id: 0x00daeb4b + offset: 448 +} member { id: 0x11f3fee9 name: "next" @@ -194131,6 +194266,12 @@ member { type_id: 0x0f626ee5 offset: 1408 } +member { + id: 0xe6eaad3f + name: "uni2char" + type_id: 0x2d34349d + offset: 128 +} member { id: 0xb7a98fcb name: "uniq" @@ -197352,6 +197493,12 @@ member { type_id: 0x0483e6f8 offset: 64 } +member { + id: 0xa010e540 + name: "value" + type_id: 0x18bd6530 + offset: 64 +} member { id: 0xa010e863 name: "value" @@ -197483,6 +197630,12 @@ member { name: "value64" type_id: 0xdd6eef0a } +member { + id: 0x9bef952d + name: "value_len" + type_id: 0xf435685e + offset: 128 +} member { id: 0x0e144f7f name: "value_offset" @@ -239456,6 +239609,22 @@ struct_union { member_id: 0x7bb01964 } } +struct_union { + id: 0x292b4bb0 + kind: STRUCT + name: "nls_table" + definition { + bytesize: 64 + member_id: 0x551378c2 + member_id: 0x25050ebe + member_id: 0xe6eaad3f + member_id: 0x26d4a9a4 + member_id: 0x6322a32f + member_id: 0x06048b6e + member_id: 0x4a9653c2 + member_id: 0x11f3dd43 + } +} struct_union { id: 0x594b6ab2 kind: STRUCT @@ -263724,6 +263893,17 @@ struct_union { member_id: 0xfbed12c2 } } +struct_union { + id: 0xbf3a351e + kind: STRUCT + name: "xattr" + definition { + bytesize: 24 + member_id: 0x0de57ce8 + member_id: 0xa010e540 + member_id: 0x9bef952d + } +} struct_union { id: 0x1016eff1 kind: STRUCT @@ -282009,6 +282189,14 @@ function { return_type_id: 0x48b5725f parameter_id: 0x6720d32f } +function { + id: 0x097c3ebf + return_type_id: 0x48b5725f + parameter_id: 0x6720d32f + parameter_id: 0x0ccdc0f9 + parameter_id: 0x7b64642a + parameter_id: 0x6d7f5ff6 +} function { id: 0x098158fd return_type_id: 0x48b5725f @@ -282580,6 +282768,13 @@ function { return_type_id: 0x48b5725f parameter_id: 0x02862e14 } +function { + id: 0x103ff2f5 + return_type_id: 0x48b5725f + parameter_id: 0x06835e9c + parameter_id: 0x4585663f + parameter_id: 0x4585663f +} function { id: 0x1043ff6b return_type_id: 0x48b5725f @@ -282967,6 +283162,11 @@ function { parameter_id: 0x060cf413 parameter_id: 0x6d7f5ff6 } +function { + id: 0x10aeeb41 + return_type_id: 0x48b5725f + parameter_id: 0x00daeb4b +} function { id: 0x10aef91d return_type_id: 0x48b5725f @@ -283015,6 +283215,13 @@ function { parameter_id: 0x030b9acf parameter_id: 0x26a490c7 } +function { + id: 0x10c07815 + return_type_id: 0x48b5725f + parameter_id: 0x0c2e195c + parameter_id: 0xd0b3a203 + parameter_id: 0x4585663f +} function { id: 0x10c35fd7 return_type_id: 0x48b5725f @@ -283176,6 +283383,13 @@ function { parameter_id: 0xf435685e parameter_id: 0x4585663f } +function { + id: 0x10e535a4 + return_type_id: 0x48b5725f + parameter_id: 0x0c2e195c + parameter_id: 0xd0b3a203 + parameter_id: 0xd0b3a203 +} function { id: 0x10e93841 return_type_id: 0x48b5725f @@ -284037,6 +284251,13 @@ function { parameter_id: 0x0665e6b6 parameter_id: 0x3e10b518 } +function { + id: 0x11f98eff + return_type_id: 0x48b5725f + parameter_id: 0x06835e9c + parameter_id: 0x33756485 + parameter_id: 0x33756485 +} function { id: 0x11fe33ba return_type_id: 0x48b5725f @@ -284079,6 +284300,23 @@ function { parameter_id: 0xf435685e parameter_id: 0x0379c823 } +function { + id: 0x12101463 + return_type_id: 0x1b8590a8 + parameter_id: 0x26ee682a + parameter_id: 0x33756485 + parameter_id: 0x2c50e503 + parameter_id: 0x18bd6530 +} +function { + id: 0x1210c1fa + return_type_id: 0x1b8590a8 + parameter_id: 0x26ee682a + parameter_id: 0x33756485 + parameter_id: 0x2c50e503 + parameter_id: 0x2c50e503 + parameter_id: 0x18bd6530 +} function { id: 0x1210f89b return_type_id: 0x48b5725f @@ -284748,6 +284986,21 @@ function { return_type_id: 0x48b5725f parameter_id: 0x0e2680c2 } +function { + id: 0x13129118 + return_type_id: 0x48b5725f + parameter_id: 0x0fabaf3b + parameter_id: 0x1b8590a8 + parameter_id: 0x39d1288c + parameter_id: 0x1253769c +} +function { + id: 0x13184981 + return_type_id: 0x48b5725f + parameter_id: 0x0fabaf3b + parameter_id: 0x1b8590a8 + parameter_id: 0x1396794c +} function { id: 0x1327a0fb return_type_id: 0x48b5725f @@ -285096,6 +285349,11 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x6720d32f } +function { + id: 0x1393d7c4 + return_type_id: 0x48b5725f + parameter_id: 0x0c2e195c +} function { id: 0x139c8318 return_type_id: 0x48b5725f @@ -285626,6 +285884,12 @@ function { parameter_id: 0x0cbf60eb parameter_id: 0x6720d32f } +function { + id: 0x1464781e + return_type_id: 0x48b5725f + parameter_id: 0x1582ab06 + parameter_id: 0x6720d32f +} function { id: 0x14667c52 return_type_id: 0x48b5725f @@ -285692,6 +285956,12 @@ function { parameter_id: 0x1d25f132 parameter_id: 0xd41e888f } +function { + id: 0x14827bad + return_type_id: 0xee72cbfc + parameter_id: 0x26ee682a + parameter_id: 0xee72cbfc +} function { id: 0x14830594 return_type_id: 0x48b5725f @@ -286127,6 +286397,13 @@ function { parameter_id: 0x12e24ee1 parameter_id: 0x4585663f } +function { + id: 0x1539f399 + return_type_id: 0x48b5725f + parameter_id: 0x1582ab06 + parameter_id: 0x33756485 + parameter_id: 0x33756485 +} function { id: 0x153d1e98 return_type_id: 0x48b5725f @@ -286253,6 +286530,12 @@ function { parameter_id: 0x4585663f parameter_id: 0x13580d6c } +function { + id: 0x1566644a + return_type_id: 0x48b5725f + parameter_id: 0x1582ab06 + parameter_id: 0x27a7c613 +} function { id: 0x1566db85 return_type_id: 0x48b5725f @@ -286436,6 +286719,13 @@ function { parameter_id: 0x3b20fed2 parameter_id: 0x4585663f } +function { + id: 0x15976e28 + return_type_id: 0x48b5725f + parameter_id: 0x15a30023 + parameter_id: 0x1b8590a8 + parameter_id: 0x27a7c613 +} function { id: 0x159d827c return_type_id: 0x48b5725f @@ -286635,6 +286925,13 @@ function { parameter_id: 0x18bd6530 parameter_id: 0xf435685e } +function { + id: 0x160abbb8 + return_type_id: 0x48b5725f + parameter_id: 0x1b8590a8 + parameter_id: 0x1253769c + parameter_id: 0xeb0f6de6 +} function { id: 0x161199c0 return_type_id: 0x48b5725f @@ -287090,6 +287387,24 @@ function { return_type_id: 0x48b5725f parameter_id: 0x18a2fb63 } +function { + id: 0x16b316ef + return_type_id: 0xd5cc9c9a + parameter_id: 0x08bd7371 + parameter_id: 0x1b8590a8 + parameter_id: 0x0c2e195c + parameter_id: 0x2f73da3b + parameter_id: 0x2cacacc0 + parameter_id: 0x24a22acc + parameter_id: 0x06a428cc + parameter_id: 0x6720d32f +} +function { + id: 0x16b4e02b + return_type_id: 0x48b5725f + parameter_id: 0x1b8590a8 + parameter_id: 0x33756485 +} function { id: 0x16b50572 return_type_id: 0x48b5725f @@ -287294,6 +287609,12 @@ function { return_type_id: 0x48b5725f parameter_id: 0x19fa9e98 } +function { + id: 0x16e7aaa1 + return_type_id: 0x48b5725f + parameter_id: 0x1b8590a8 + parameter_id: 0x27a7c613 +} function { id: 0x16e9508e return_type_id: 0x48b5725f @@ -287617,6 +287938,12 @@ function { parameter_id: 0x2e18f543 parameter_id: 0x2e18f543 } +function { + id: 0x176f2021 + return_type_id: 0x48b5725f + parameter_id: 0x1b8590a8 + parameter_id: 0x4585663f +} function { id: 0x176fe039 return_type_id: 0x48b5725f @@ -287631,6 +287958,13 @@ function { parameter_id: 0x33756485 parameter_id: 0x33756485 } +function { + id: 0x177e4178 + return_type_id: 0x48b5725f + parameter_id: 0x1b8590a8 + parameter_id: 0x4585663f + parameter_id: 0x4585663f +} function { id: 0x177f3bf9 return_type_id: 0x48b5725f @@ -288852,6 +289186,12 @@ function { return_type_id: 0x48b5725f parameter_id: 0x25b73daa } +function { + id: 0x19fc4f29 + return_type_id: 0x48b5725f + parameter_id: 0x275ab027 + parameter_id: 0x2cacacc0 +} function { id: 0x19fe25be return_type_id: 0x48b5725f @@ -289613,6 +289953,12 @@ function { parameter_id: 0x2a9beac2 parameter_id: 0x6d7f5ff6 } +function { + id: 0x1b90a8d8 + return_type_id: 0x48b5725f + parameter_id: 0x26ee682a + parameter_id: 0xacd8d043 +} function { id: 0x1b939067 return_type_id: 0x48b5725f @@ -289902,6 +290248,12 @@ function { return_type_id: 0x48b5725f parameter_id: 0x326c4938 } +function { + id: 0x1c03dd76 + return_type_id: 0x48b5725f + parameter_id: 0x33756485 + parameter_id: 0x11b57133 +} function { id: 0x1c048955 return_type_id: 0x48b5725f @@ -291046,6 +291398,11 @@ function { parameter_id: 0x3e10b518 parameter_id: 0xa52a0930 } +function { + id: 0x1d8c491d + return_type_id: 0x1b8590a8 + parameter_id: 0x1b8590a8 +} function { id: 0x1d8d431c return_type_id: 0x48b5725f @@ -291589,6 +291946,11 @@ function { parameter_id: 0x3b04bead parameter_id: 0x18bd6530 } +function { + id: 0x1e3bdb22 + return_type_id: 0x48b5725f + parameter_id: 0x3a8e2ac6 +} function { id: 0x1e3db1e5 return_type_id: 0x48b5725f @@ -292421,6 +292783,15 @@ function { parameter_id: 0x3d92f9c7 parameter_id: 0x3054f2d7 } +function { + id: 0x1f3dc21f + return_type_id: 0xd5cc9c9a + parameter_id: 0x2f73da3b + parameter_id: 0x0b30ee00 + parameter_id: 0xf435685e + parameter_id: 0x4585663f + parameter_id: 0x379d63b0 +} function { id: 0x1f458cf4 return_type_id: 0x48b5725f @@ -294330,6 +294701,11 @@ function { return_type_id: 0x33756485 parameter_id: 0x37b4f743 } +function { + id: 0x3c97e3d9 + return_type_id: 0x33756485 + parameter_id: 0x34ecba28 +} function { id: 0x3cc96bbe return_type_id: 0x0483e6f8 @@ -295071,6 +295447,11 @@ function { return_type_id: 0xc9082b19 parameter_id: 0x2e8d5f05 } +function { + id: 0x4e6eaff2 + return_type_id: 0x00daeb4b + parameter_id: 0x0483e6f8 +} function { id: 0x4e848709 return_type_id: 0x18ea6ae3 @@ -295110,6 +295491,10 @@ function { parameter_id: 0x3b04bead parameter_id: 0x038de60c } +function { + id: 0x4f4e564c + return_type_id: 0x00daeb4b +} function { id: 0x4f645cab return_type_id: 0x00a43052 @@ -296372,6 +296757,13 @@ function { parameter_id: 0x2cac4c27 parameter_id: 0x18bd6530 } +function { + id: 0x5de26741 + return_type_id: 0x18bd6530 + parameter_id: 0x2efd5036 + parameter_id: 0x3dfac2ad + parameter_id: 0xf1a6dfed +} function { id: 0x5de7952d return_type_id: 0x18bd6530 @@ -296536,6 +296928,14 @@ function { parameter_id: 0x35d510c3 parameter_id: 0x6720d32f } +function { + id: 0x61257a20 + return_type_id: 0x2170d06d + parameter_id: 0xf1a6dfed + parameter_id: 0x4585663f + parameter_id: 0x6720d32f + parameter_id: 0x2fb2b385 +} function { id: 0x619a645f return_type_id: 0x249959de @@ -297659,6 +298059,15 @@ function { parameter_id: 0x3e10b518 parameter_id: 0x18bd6530 } +function { + id: 0x81599f70 + return_type_id: 0x120540d1 + parameter_id: 0x32ec08f2 + parameter_id: 0x6720d32f + parameter_id: 0x3e10b518 + parameter_id: 0x18bd6530 + parameter_id: 0x2f802886 +} function { id: 0x81a9f9cd return_type_id: 0x09a83f1c @@ -298177,6 +298586,13 @@ function { return_type_id: 0x2e0f9112 parameter_id: 0x3912ab06 } +function { + id: 0x889f851e + return_type_id: 0x120540d1 + parameter_id: 0x120540d1 + parameter_id: 0x1b8590a8 + parameter_id: 0x04c1427f +} function { id: 0x88bccf1d return_type_id: 0x120540d1 @@ -298270,6 +298686,12 @@ function { parameter_id: 0x120540d1 parameter_id: 0x4585663f } +function { + id: 0x8ad88211 + return_type_id: 0x120540d1 + parameter_id: 0x1b8590a8 + parameter_id: 0x120540d1 +} function { id: 0x8ae0b646 return_type_id: 0x6720d32f @@ -301395,6 +301817,13 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3e292ad1 } +function { + id: 0x920d0e3f + return_type_id: 0x6720d32f + parameter_id: 0x384c5795 + parameter_id: 0x6720d32f + parameter_id: 0x09eee7e5 +} function { id: 0x920d4b76 return_type_id: 0x6720d32f @@ -302196,6 +302625,15 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x6720d32f } +function { + id: 0x92ab0d8f + return_type_id: 0x6720d32f + parameter_id: 0x351641b0 + parameter_id: 0x92233392 + parameter_id: 0x92233392 + parameter_id: 0x92233392 + parameter_id: 0xc9082b19 +} function { id: 0x92acc8e1 return_type_id: 0x6720d32f @@ -303020,6 +303458,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3ba261b0 } +function { + id: 0x936a3614 + return_type_id: 0x6720d32f + parameter_id: 0x39d1288c + parameter_id: 0x27a7c613 +} function { id: 0x936c5d25 return_type_id: 0x6720d32f @@ -303786,6 +304230,13 @@ function { parameter_id: 0x25653b02 parameter_id: 0x396f8ae8 } +function { + id: 0x94404485 + return_type_id: 0x6720d32f + parameter_id: 0x26ee682a + parameter_id: 0x18bd6530 + parameter_id: 0x6720d32f +} function { id: 0x9441b35b return_type_id: 0x6720d32f @@ -304615,6 +305066,12 @@ function { parameter_id: 0x25782362 parameter_id: 0x6d7f5ff6 } +function { + id: 0x956e6587 + return_type_id: 0x6720d32f + parameter_id: 0x2170d06d + parameter_id: 0x2cacacc0 +} function { id: 0x957149c4 return_type_id: 0x6720d32f @@ -306165,6 +306622,14 @@ function { parameter_id: 0x25782362 parameter_id: 0xdb6afbca } +function { + id: 0x97b4bbf8 + return_type_id: 0xf435685e + parameter_id: 0x06835e9c + parameter_id: 0x4585663f + parameter_id: 0xf435685e + parameter_id: 0x2f73da3b +} function { id: 0x97b9c78c return_type_id: 0x6720d32f @@ -306528,6 +306993,14 @@ function { return_type_id: 0xfc0e1dbd parameter_id: 0xfc0e1dbd } +function { + id: 0x982488f7 + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0xd0b3a203 + parameter_id: 0x1977e57b + parameter_id: 0x6720d32f +} function { id: 0x98249b1d return_type_id: 0x6720d32f @@ -306896,6 +307369,13 @@ function { parameter_id: 0x33756485 parameter_id: 0x0d7d7298 } +function { + id: 0x98773f07 + return_type_id: 0x6720d32f + parameter_id: 0x1582ab06 + parameter_id: 0x27a7c613 + parameter_id: 0x27a7c613 +} function { id: 0x98788d90 return_type_id: 0x6720d32f @@ -308428,6 +308908,12 @@ function { parameter_id: 0x1c3dbe5a parameter_id: 0x0db25a6d } +function { + id: 0x99d43279 + return_type_id: 0xf435685e + parameter_id: 0x34ecba28 + parameter_id: 0xf435685e +} function { id: 0x99d6eb87 return_type_id: 0x6720d32f @@ -308646,6 +309132,11 @@ function { parameter_id: 0x1d44326e parameter_id: 0x348ad8b0 } +function { + id: 0x9a04e7d8 + return_type_id: 0xf435685e + parameter_id: 0x34ecba28 +} function { id: 0x9a077ed2 return_type_id: 0x6720d32f @@ -308842,6 +309333,12 @@ function { parameter_id: 0x1dc3d428 parameter_id: 0x37f5d3d4 } +function { + id: 0x9a308be1 + return_type_id: 0x6720d32f + parameter_id: 0x1977e57b + parameter_id: 0x7b64642a +} function { id: 0x9a32aa77 return_type_id: 0x6720d32f @@ -309867,12 +310364,33 @@ function { return_type_id: 0x6720d32f parameter_id: 0x1df06cce } +function { + id: 0x9afd0449 + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x6720d32f +} function { id: 0x9b022eae return_type_id: 0x6720d32f parameter_id: 0x1b8590a8 parameter_id: 0x18ea6ae3 } +function { + id: 0x9b034295 + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x1b8590a8 + parameter_id: 0x3e001c39 + parameter_id: 0xd57eb7ba + parameter_id: 0x18bd6530 +} +function { + id: 0x9b037291 + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x18bd6530 +} function { id: 0x9b03e163 return_type_id: 0x6720d32f @@ -311182,6 +311700,12 @@ function { parameter_id: 0x3e10b518 parameter_id: 0xf435685e } +function { + id: 0x9b6b31b5 + return_type_id: 0xf435685e + parameter_id: 0x3e10b518 + parameter_id: 0xf435685e +} function { id: 0x9b6b9392 return_type_id: 0x6720d32f @@ -311706,6 +312230,15 @@ function { parameter_id: 0x18bd6530 parameter_id: 0x30c17c17 } +function { + id: 0x9b91dcee + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x351641b0 + parameter_id: 0x92233392 + parameter_id: 0x2e18f543 + parameter_id: 0xc9082b19 +} function { id: 0x9b922d94 return_type_id: 0x6720d32f @@ -312379,6 +312912,13 @@ function { parameter_id: 0x3f949c69 parameter_id: 0x13580d6c } +function { + id: 0x9bbe37da + return_type_id: 0x6720d32f + parameter_id: 0x1b8590a8 + parameter_id: 0x3667e19e + parameter_id: 0x18bd6530 +} function { id: 0x9bbe6322 return_type_id: 0x6720d32f @@ -313166,6 +313706,11 @@ function { parameter_id: 0x4585663f parameter_id: 0x6d7f5ff6 } +function { + id: 0x9bdd1a71 + return_type_id: 0x6720d32f + parameter_id: 0x1977e57b +} function { id: 0x9bdd30f1 return_type_id: 0x6720d32f @@ -316900,6 +317445,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x01f1fcec } +function { + id: 0x9dfe4183 + return_type_id: 0x6720d32f + parameter_id: 0x0c2e195c + parameter_id: 0xd0b3a203 + parameter_id: 0xd0b3a203 + parameter_id: 0xf1a6dfed +} function { id: 0x9dfe427d return_type_id: 0x6720d32f @@ -317117,6 +317670,14 @@ function { parameter_id: 0x120540d1 parameter_id: 0x0b756bd6 } +function { + id: 0x9e20f17d + return_type_id: 0x6720d32f + parameter_id: 0x0fabaf3b + parameter_id: 0x120540d1 + parameter_id: 0x0b756bd6 + parameter_id: 0x0c715d8d +} function { id: 0x9e215925 return_type_id: 0x6720d32f @@ -317664,6 +318225,13 @@ function { parameter_id: 0x057af395 parameter_id: 0xc9082b19 } +function { + id: 0x9e9034ea + return_type_id: 0x6720d32f + parameter_id: 0x0dfb7909 + parameter_id: 0x1df06cce + parameter_id: 0x6720d32f +} function { id: 0x9e917c22 return_type_id: 0x6720d32f @@ -318169,6 +318737,14 @@ function { parameter_id: 0x054f691a parameter_id: 0xf435685e } +function { + id: 0x9f043139 + return_type_id: 0x6720d32f + parameter_id: 0x08bd7371 + parameter_id: 0x27a7c613 + parameter_id: 0xd5cc9c9a + parameter_id: 0x18bd6530 +} function { id: 0x9f04337e return_type_id: 0x6720d32f @@ -320382,6 +320958,12 @@ function { parameter_id: 0x11e6864c parameter_id: 0xf017819f } +function { + id: 0xb55dce02 + return_type_id: 0x160ba102 + parameter_id: 0x0f12d1e7 + parameter_id: 0x6720d32f +} function { id: 0xb649ac13 return_type_id: 0x067c4b9a @@ -320407,6 +320989,14 @@ function { parameter_id: 0x33756485 parameter_id: 0xf1a6dfed } +function { + id: 0xb82f817c + return_type_id: 0x06835e9c + parameter_id: 0x1582ab06 + parameter_id: 0x33756485 + parameter_id: 0x6720d32f + parameter_id: 0xf1a6dfed +} function { id: 0xb8307855 return_type_id: 0x06835e9c @@ -320415,6 +321005,12 @@ function { parameter_id: 0x1650be92 parameter_id: 0x18ea6ae3 } +function { + id: 0xb8358fd3 + return_type_id: 0x06835e9c + parameter_id: 0x1582ab06 + parameter_id: 0x33756485 +} function { id: 0xb87b745c return_type_id: 0x06835e9c @@ -320489,6 +321085,12 @@ function { parameter_id: 0x1908b154 parameter_id: 0x6d7f5ff6 } +function { + id: 0xb98ee524 + return_type_id: 0x399c459b + parameter_id: 0x399c459b + parameter_id: 0x1b8590a8 +} function { id: 0xb996d78c return_type_id: 0xc4cf348e @@ -321527,6 +322129,15 @@ function { parameter_id: 0x019e2530 parameter_id: 0x4585663f } +function { + id: 0xcfac76b5 + return_type_id: 0x4585663f + parameter_id: 0x04810ecd + parameter_id: 0x1582ab06 + parameter_id: 0x064d6086 + parameter_id: 0x33756485 + parameter_id: 0x7f7172c7 +} function { id: 0xcfc2716e return_type_id: 0x6d7f5ff6 @@ -323245,6 +323856,12 @@ function { parameter_id: 0x235889e8 parameter_id: 0x3654c061 } +function { + id: 0xf6be4a6e + return_type_id: 0x6d7f5ff6 + parameter_id: 0x20007040 + parameter_id: 0x06835e9c +} function { id: 0xf6c0819f return_type_id: 0x6d7f5ff6 @@ -323434,6 +324051,12 @@ function { parameter_id: 0x1a61f607 parameter_id: 0x39a83127 } +function { + id: 0xf8e4b6f7 + return_type_id: 0x172847a8 + parameter_id: 0x18bd6530 + parameter_id: 0x6720d32f +} function { id: 0xf8fa1a38 return_type_id: 0x6d7f5ff6 @@ -323484,6 +324107,12 @@ function { return_type_id: 0x6d7f5ff6 parameter_id: 0x1d25f132 } +function { + id: 0xf9f0c251 + return_type_id: 0x6d7f5ff6 + parameter_id: 0x1b8590a8 + parameter_id: 0x6d7f5ff6 +} function { id: 0xf9f5579f return_type_id: 0x6d7f5ff6 @@ -323831,6 +324460,13 @@ function { parameter_id: 0x0258f96e parameter_id: 0xe5b69de1 } +function { + id: 0xfdb03c5c + return_type_id: 0x6d7f5ff6 + parameter_id: 0x0fabaf3b + parameter_id: 0x39d1288c + parameter_id: 0x6720d32f +} function { id: 0xfdb2dd0c return_type_id: 0x6d7f5ff6 @@ -324254,6 +324890,24 @@ elf_symbol { type_id: 0x1b18f64e full_name: "__balance_callbacks" } +elf_symbol { + id: 0xac51df48 + name: "__bforget" + is_defined: true + symbol_type: FUNCTION + crc: 0x364b830b + type_id: 0x16c5a8cd + full_name: "__bforget" +} +elf_symbol { + id: 0x2c42b675 + name: "__bh_read_batch" + is_defined: true + symbol_type: FUNCTION + crc: 0xa59bae72 + type_id: 0x097c3ebf + full_name: "__bh_read_batch" +} elf_symbol { id: 0x8920b575 name: "__bitmap_and" @@ -324452,6 +325106,42 @@ elf_symbol { type_id: 0x56fc975d full_name: "__blkg_prfill_u64" } +elf_symbol { + id: 0x2d1c1f2d + name: "__blockdev_direct_IO" + is_defined: true + symbol_type: FUNCTION + crc: 0x02673f92 + type_id: 0x16b316ef + full_name: "__blockdev_direct_IO" +} +elf_symbol { + id: 0x9bed4545 + name: "__bread_gfp" + is_defined: true + symbol_type: FUNCTION + crc: 0xe44aece3 + type_id: 0x65d68df5 + full_name: "__bread_gfp" +} +elf_symbol { + id: 0xefdcf4c1 + name: "__breadahead" + is_defined: true + symbol_type: FUNCTION + crc: 0x6b1f432a + type_id: 0x10c07815 + full_name: "__breadahead" +} +elf_symbol { + id: 0x2f449b9e + name: "__brelse" + is_defined: true + symbol_type: FUNCTION + crc: 0x40b1280f + type_id: 0x16c5a8cd + full_name: "__brelse" +} elf_symbol { id: 0x2057d4fc name: "__check_object_size" @@ -325325,6 +326015,15 @@ elf_symbol { type_id: 0x20cd94dc full_name: "__fdget" } +elf_symbol { + id: 0x6036d483 + name: "__filemap_set_wb_err" + is_defined: true + symbol_type: FUNCTION + crc: 0xf59ce848 + type_id: 0x1464781e + full_name: "__filemap_set_wb_err" +} elf_symbol { id: 0xaf8ee687 name: "__find_nth_bit" @@ -325343,6 +326042,24 @@ elf_symbol { type_id: 0x14667c52 full_name: "__flush_workqueue" } +elf_symbol { + id: 0x6a92cb2d + name: "__folio_alloc" + is_defined: true + symbol_type: FUNCTION + crc: 0xfcda658e + type_id: 0x61257a20 + full_name: "__folio_alloc" +} +elf_symbol { + id: 0x6fc34fdb + name: "__folio_cancel_dirty" + is_defined: true + symbol_type: FUNCTION + crc: 0x6b54d941 + type_id: 0x18c46588 + full_name: "__folio_cancel_dirty" +} elf_symbol { id: 0x47a334c4 name: "__folio_lock" @@ -325631,6 +326348,15 @@ elf_symbol { type_id: 0x15acd3b0 full_name: "__init_waitqueue_head" } +elf_symbol { + id: 0xd02fc75b + name: "__insert_inode_hash" + is_defined: true + symbol_type: FUNCTION + crc: 0x25021594 + type_id: 0x16b4e02b + full_name: "__insert_inode_hash" +} elf_symbol { id: 0xe97034af name: "__ioread32_copy" @@ -325938,6 +326664,15 @@ elf_symbol { type_id: 0x16c5a8cd full_name: "__lock_buffer" } +elf_symbol { + id: 0x0b9d6bbc + name: "__mark_inode_dirty" + is_defined: true + symbol_type: FUNCTION + crc: 0x2370c1c0 + type_id: 0x17e5b6f5 + full_name: "__mark_inode_dirty" +} elf_symbol { id: 0x040ec563 name: "__mdiobus_read" @@ -326658,6 +327393,15 @@ elf_symbol { type_id: 0x1c3ba516 full_name: "__release_region" } +elf_symbol { + id: 0x9d948fe1 + name: "__remove_inode_hash" + is_defined: true + symbol_type: FUNCTION + crc: 0x152cf8f0 + type_id: 0x167935b9 + full_name: "__remove_inode_hash" +} elf_symbol { id: 0xf7c2da07 name: "__request_module" @@ -326829,6 +327573,15 @@ elf_symbol { type_id: 0x1009f18b full_name: "__serio_register_port" } +elf_symbol { + id: 0xa2cf1eee + name: "__set_page_dirty_nobuffers" + is_defined: true + symbol_type: FUNCTION + crc: 0x924fff08 + type_id: 0x9c203488 + full_name: "__set_page_dirty_nobuffers" +} elf_symbol { id: 0xeaddb422 name: "__set_page_owner" @@ -327081,6 +327834,15 @@ elf_symbol { type_id: 0xdfba2774 full_name: "__sw_hweight8" } +elf_symbol { + id: 0xd8a7d75e + name: "__sync_dirty_buffer" + is_defined: true + symbol_type: FUNCTION + crc: 0xc6ed2a41 + type_id: 0x9a308be1 + full_name: "__sync_dirty_buffer" +} elf_symbol { id: 0x04e4f57e name: "__sysfs_match_string" @@ -334668,6 +335430,15 @@ elf_symbol { type_id: 0x1713ee74 full_name: "_trace_android_vh_record_pcpu_rwsem_starttime" } +elf_symbol { + id: 0x874fa015 + name: "_trace_android_vh_record_pcpu_rwsem_time_early" + is_defined: true + symbol_type: FUNCTION + crc: 0x2ea4d65a + type_id: 0x1c03dd76 + full_name: "_trace_android_vh_record_pcpu_rwsem_time_early" +} elf_symbol { id: 0x86a88093 name: "_vb2_fop_release" @@ -335701,6 +336472,15 @@ elf_symbol { type_id: 0x9ad0bd67 full_name: "bit_wait_timeout" } +elf_symbol { + id: 0x00f38540 + name: "bit_waitqueue" + is_defined: true + symbol_type: FUNCTION + crc: 0xad9901ae + type_id: 0xf8e4b6f7 + full_name: "bit_waitqueue" +} elf_symbol { id: 0x181f78de name: "bitmap_alloc" @@ -336583,6 +337363,15 @@ elf_symbol { type_id: 0x26cc0900 full_name: "blkdev_get_by_path" } +elf_symbol { + id: 0x4d722bb5 + name: "blkdev_issue_discard" + is_defined: true + symbol_type: FUNCTION + crc: 0x992b458f + type_id: 0x9dfe4183 + full_name: "blkdev_issue_discard" +} elf_symbol { id: 0x2a322266 name: "blkdev_issue_flush" @@ -336655,6 +337444,33 @@ elf_symbol { type_id: 0x104d4296 full_name: "blkg_rwstat_recursive_sum" } +elf_symbol { + id: 0xd289c43d + name: "block_dirty_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0x77ada257 + type_id: 0xfb413284 + full_name: "block_dirty_folio" +} +elf_symbol { + id: 0x6efa206d + name: "block_invalidate_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0x3045fd1d + type_id: 0x1b29bd73 + full_name: "block_invalidate_folio" +} +elf_symbol { + id: 0x5cf37146 + name: "block_is_partially_uptodate" + is_defined: true + symbol_type: FUNCTION + crc: 0x5e5d36ff + type_id: 0xf515b7e4 + full_name: "block_is_partially_uptodate" +} elf_symbol { id: 0x427cedc9 name: "blockdev_superblock" @@ -337222,6 +338038,15 @@ elf_symbol { type_id: 0x9a22976b full_name: "btbcm_write_pcm_int_params" } +elf_symbol { + id: 0x6bb6d4ca + name: "buffer_migrate_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0x697d2102 + type_id: 0x986ccce1 + full_name: "buffer_migrate_folio" +} elf_symbol { id: 0x8ea00f54 name: "build_skb" @@ -337679,6 +338504,15 @@ elf_symbol { type_id: 0xe76c6fcf full_name: "capable" } +elf_symbol { + id: 0x61aaf300 + name: "capable_wrt_inode_uidgid" + is_defined: true + symbol_type: FUNCTION + crc: 0xaa02669a + type_id: 0xfdb03c5c + full_name: "capable_wrt_inode_uidgid" +} elf_symbol { id: 0xb2bfcc0c name: "cdc_parse_cdc_header" @@ -338066,6 +338900,15 @@ elf_symbol { type_id: 0x1a0b4b72 full_name: "class_unregister" } +elf_symbol { + id: 0xb242a940 + name: "clean_bdev_aliases" + is_defined: true + symbol_type: FUNCTION + crc: 0xa36f5732 + type_id: 0x10e535a4 + full_name: "clean_bdev_aliases" +} elf_symbol { id: 0xd156aa2c name: "cleancache_register_ops" @@ -338084,6 +338927,15 @@ elf_symbol { type_id: 0x187ab05b full_name: "cleanup_srcu_struct" } +elf_symbol { + id: 0xfa95bdc1 + name: "clear_inode" + is_defined: true + symbol_type: FUNCTION + crc: 0x89b4e8c0 + type_id: 0x167935b9 + full_name: "clear_inode" +} elf_symbol { id: 0xb63845e5 name: "clear_page" @@ -338091,6 +338943,15 @@ elf_symbol { symbol_type: FUNCTION crc: 0x3d9ee9f0 } +elf_symbol { + id: 0x52eaa51b + name: "clear_page_dirty_for_io" + is_defined: true + symbol_type: FUNCTION + crc: 0x20bc8096 + type_id: 0xff048ca3 + full_name: "clear_page_dirty_for_io" +} elf_symbol { id: 0x5332f89b name: "clk_bulk_disable" @@ -339115,6 +339976,15 @@ elf_symbol { symbol_type: FUNCTION crc: 0x4d0d163d } +elf_symbol { + id: 0x9f1f7cee + name: "copy_page_from_iter_atomic" + is_defined: true + symbol_type: FUNCTION + crc: 0xc8b6f813 + type_id: 0x97b4bbf8 + full_name: "copy_page_from_iter_atomic" +} elf_symbol { id: 0xd89255c2 name: "cpu_all_bits" @@ -339831,6 +340701,15 @@ elf_symbol { type_id: 0x25b94d0a full_name: "crc_ccitt" } +elf_symbol { + id: 0xd5cc5ce2 + name: "create_empty_buffers" + is_defined: true + symbol_type: FUNCTION + crc: 0x9b40f91e + type_id: 0x11f98eff + full_name: "create_empty_buffers" +} elf_symbol { id: 0xc3e46036 name: "create_function_device" @@ -340371,6 +341250,15 @@ elf_symbol { type_id: 0xb166862a full_name: "current_time" } +elf_symbol { + id: 0x4c090f07 + name: "current_umask" + is_defined: true + symbol_type: FUNCTION + crc: 0x5e95b1cd + type_id: 0x9d80e32f + full_name: "current_umask" +} elf_symbol { id: 0x171eca8a name: "d_add" @@ -340380,6 +341268,15 @@ elf_symbol { type_id: 0x147717e5 full_name: "d_add" } +elf_symbol { + id: 0x82537a82 + name: "d_add_ci" + is_defined: true + symbol_type: FUNCTION + crc: 0x09ad89bb + type_id: 0x889f851e + full_name: "d_add_ci" +} elf_symbol { id: 0x79187969 name: "d_alloc_name" @@ -340389,6 +341286,15 @@ elf_symbol { type_id: 0x8808e1d8 full_name: "d_alloc_name" } +elf_symbol { + id: 0x04f5a6e5 + name: "d_instantiate" + is_defined: true + symbol_type: FUNCTION + crc: 0xff9152a3 + type_id: 0x147717e5 + full_name: "d_instantiate" +} elf_symbol { id: 0x52864a7e name: "d_make_root" @@ -340398,6 +341304,15 @@ elf_symbol { type_id: 0x8a909712 full_name: "d_make_root" } +elf_symbol { + id: 0x8d5ab7b4 + name: "d_obtain_alias" + is_defined: true + symbol_type: FUNCTION + crc: 0x3e22d08f + type_id: 0x8a909712 + full_name: "d_obtain_alias" +} elf_symbol { id: 0xccc25fc1 name: "d_path" @@ -340407,6 +341322,15 @@ elf_symbol { type_id: 0x30964cd5 full_name: "d_path" } +elf_symbol { + id: 0xb96af991 + name: "d_splice_alias" + is_defined: true + symbol_type: FUNCTION + crc: 0x2dc0ecfe + type_id: 0x8ad88211 + full_name: "d_splice_alias" +} elf_symbol { id: 0xb771d13e name: "dapm_clock_event" @@ -345159,6 +346083,15 @@ elf_symbol { type_id: 0x9daf738f full_name: "down_write_killable" } +elf_symbol { + id: 0x626b81c7 + name: "down_write_trylock" + is_defined: true + symbol_type: FUNCTION + crc: 0xd0e551cc + type_id: 0x9daf738f + full_name: "down_write_trylock" +} elf_symbol { id: 0x4a57b168 name: "downgrade_write" @@ -348975,6 +349908,15 @@ elf_symbol { type_id: 0x9341cc84 full_name: "drmm_mode_config_init" } +elf_symbol { + id: 0x4dae13e9 + name: "drop_nlink" + is_defined: true + symbol_type: FUNCTION + crc: 0x4c7bc8cb + type_id: 0x167935b9 + full_name: "drop_nlink" +} elf_symbol { id: 0xe2b96ffd name: "dst_cache_destroy" @@ -349434,6 +350376,24 @@ elf_symbol { type_id: 0x17592b81 full_name: "end_buffer_read_sync" } +elf_symbol { + id: 0x45c0e0ad + name: "end_buffer_write_sync" + is_defined: true + symbol_type: FUNCTION + crc: 0x7207a9fa + type_id: 0x17592b81 + full_name: "end_buffer_write_sync" +} +elf_symbol { + id: 0xf7fd2915 + name: "end_page_writeback" + is_defined: true + symbol_type: FUNCTION + crc: 0xd203f7c4 + type_id: 0x11388634 + full_name: "end_page_writeback" +} elf_symbol { id: 0x7b9ffce9 name: "errno_to_blk_status" @@ -349443,6 +350403,15 @@ elf_symbol { type_id: 0x53bd7367 full_name: "errno_to_blk_status" } +elf_symbol { + id: 0xe506b877 + name: "errseq_set" + is_defined: true + symbol_type: FUNCTION + crc: 0x2ec6bba0 + type_id: 0xb55dce02 + full_name: "errseq_set" +} elf_symbol { id: 0xda116c83 name: "eth_commit_mac_addr_change" @@ -349794,6 +350763,24 @@ elf_symbol { type_id: 0x8432b9df full_name: "fasync_helper" } +elf_symbol { + id: 0xc56006c7 + name: "fault_in_iov_iter_readable" + is_defined: true + symbol_type: FUNCTION + crc: 0xd085a60d + type_id: 0x99d43279 + full_name: "fault_in_iov_iter_readable" +} +elf_symbol { + id: 0x639b2403 + name: "fault_in_safe_writeable" + is_defined: true + symbol_type: FUNCTION + crc: 0xf394f7da + type_id: 0x9b6b31b5 + full_name: "fault_in_safe_writeable" +} elf_symbol { id: 0xbbfb394e name: "fb_get_options" @@ -349830,6 +350817,33 @@ elf_symbol { type_id: 0x50f3b181 full_name: "fget" } +elf_symbol { + id: 0xab45f2a8 + name: "fiemap_fill_next_extent" + is_defined: true + symbol_type: FUNCTION + crc: 0x970a3f8f + type_id: 0x92ab0d8f + full_name: "fiemap_fill_next_extent" +} +elf_symbol { + id: 0x41eed79f + name: "fiemap_prep" + is_defined: true + symbol_type: FUNCTION + crc: 0x12888fc3 + type_id: 0x9b91dcee + full_name: "fiemap_prep" +} +elf_symbol { + id: 0xcdc0fffd + name: "file_check_and_advance_wb_err" + is_defined: true + symbol_type: FUNCTION + crc: 0x247050da + type_id: 0x9bba7997 + full_name: "file_check_and_advance_wb_err" +} elf_symbol { id: 0xe7aacfe5 name: "file_path" @@ -349848,6 +350862,24 @@ elf_symbol { type_id: 0x14609640 full_name: "file_ra_state_init" } +elf_symbol { + id: 0x99b0f07b + name: "file_remove_privs" + is_defined: true + symbol_type: FUNCTION + crc: 0x7adb4755 + type_id: 0x9bba7997 + full_name: "file_remove_privs" +} +elf_symbol { + id: 0xffbe24f4 + name: "file_update_time" + is_defined: true + symbol_type: FUNCTION + crc: 0xf206510a + type_id: 0x9bba7997 + full_name: "file_update_time" +} elf_symbol { id: 0x46b6e531 name: "file_write_and_wait_range" @@ -349866,6 +350898,69 @@ elf_symbol { type_id: 0x986a916d full_name: "filemap_add_folio" } +elf_symbol { + id: 0x4927c9f3 + name: "filemap_dirty_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0xa4ca0b75 + type_id: 0xfb413284 + full_name: "filemap_dirty_folio" +} +elf_symbol { + id: 0x50a5072e + name: "filemap_fault" + is_defined: true + symbol_type: FUNCTION + crc: 0x6ea71511 + type_id: 0xcee4fe8d + full_name: "filemap_fault" +} +elf_symbol { + id: 0xef606c3f + name: "filemap_fdatawait_range" + is_defined: true + symbol_type: FUNCTION + crc: 0x021f318f + type_id: 0x98773f07 + full_name: "filemap_fdatawait_range" +} +elf_symbol { + id: 0x3289d59f + name: "filemap_fdatawrite" + is_defined: true + symbol_type: FUNCTION + crc: 0xd20a8cfb + type_id: 0x98e049ee + full_name: "filemap_fdatawrite" +} +elf_symbol { + id: 0x82b19820 + name: "filemap_fdatawrite_range" + is_defined: true + symbol_type: FUNCTION + crc: 0x99f56961 + type_id: 0x98773f07 + full_name: "filemap_fdatawrite_range" +} +elf_symbol { + id: 0x7c937fc2 + name: "filemap_flush" + is_defined: true + symbol_type: FUNCTION + crc: 0x12f67935 + type_id: 0x98e049ee + full_name: "filemap_flush" +} +elf_symbol { + id: 0xc7c68a05 + name: "filemap_write_and_wait_range" + is_defined: true + symbol_type: FUNCTION + crc: 0x44a9ebe6 + type_id: 0x98773f07 + full_name: "filemap_write_and_wait_range" +} elf_symbol { id: 0xb9dc79d0 name: "filp_close" @@ -350091,6 +351186,15 @@ elf_symbol { type_id: 0x1958e6c4 full_name: "folio_wait_bit" } +elf_symbol { + id: 0x07508208 + name: "folio_write_one" + is_defined: true + symbol_type: FUNCTION + crc: 0x198f6eb0 + type_id: 0x95dcd734 + full_name: "folio_write_one" +} elf_symbol { id: 0xcb14b5cc name: "follow_pfn" @@ -350838,6 +351942,24 @@ elf_symbol { type_id: 0x7e204efc full_name: "generic_device_group" } +elf_symbol { + id: 0xe21d8d05 + name: "generic_error_remove_page" + is_defined: true + symbol_type: FUNCTION + crc: 0xae4d8a76 + type_id: 0x98fa4494 + full_name: "generic_error_remove_page" +} +elf_symbol { + id: 0x338cfb0f + name: "generic_file_direct_write" + is_defined: true + symbol_type: FUNCTION + crc: 0x552bc0af + type_id: 0x16637235 + full_name: "generic_file_direct_write" +} elf_symbol { id: 0x94b60724 name: "generic_file_llseek" @@ -350847,6 +351969,24 @@ elf_symbol { type_id: 0x2d64ae3e full_name: "generic_file_llseek" } +elf_symbol { + id: 0x6ac5d61b + name: "generic_file_mmap" + is_defined: true + symbol_type: FUNCTION + crc: 0xe3415064 + type_id: 0x9b923492 + full_name: "generic_file_mmap" +} +elf_symbol { + id: 0x54756210 + name: "generic_file_open" + is_defined: true + symbol_type: FUNCTION + crc: 0x62233d3d + type_id: 0x9b022eae + full_name: "generic_file_open" +} elf_symbol { id: 0x5ec3daa8 name: "generic_file_read_iter" @@ -350856,6 +351996,24 @@ elf_symbol { type_id: 0x16637235 full_name: "generic_file_read_iter" } +elf_symbol { + id: 0x5530f759 + name: "generic_file_splice_read" + is_defined: true + symbol_type: FUNCTION + crc: 0xa2e84b5f + type_id: 0x12c79320 + full_name: "generic_file_splice_read" +} +elf_symbol { + id: 0x3812bb22 + name: "generic_fillattr" + is_defined: true + symbol_type: FUNCTION + crc: 0xb418cdc6 + type_id: 0x13184981 + full_name: "generic_fillattr" +} elf_symbol { id: 0x2f7205ee name: "generic_handle_domain_irq" @@ -350892,6 +352050,15 @@ elf_symbol { type_id: 0x16637235 full_name: "generic_perform_write" } +elf_symbol { + id: 0x4c4073c3 + name: "generic_read_dir" + is_defined: true + symbol_type: FUNCTION + crc: 0x91cfdae1 + type_id: 0x12e4741f + full_name: "generic_read_dir" +} elf_symbol { id: 0x798f83da name: "generic_shutdown_super" @@ -352173,6 +353340,15 @@ elf_symbol { type_id: 0x901afa25 full_name: "gpiod_to_irq" } +elf_symbol { + id: 0x085aa99f + name: "grab_cache_page_write_begin" + is_defined: true + symbol_type: FUNCTION + crc: 0xb2975faa + type_id: 0xb8358fd3 + full_name: "grab_cache_page_write_begin" +} elf_symbol { id: 0x4dcdd24d name: "gre_add_protocol" @@ -354009,6 +355185,15 @@ elf_symbol { type_id: 0x12c15d81 full_name: "ieee802154_xmit_hw_error" } +elf_symbol { + id: 0xb9f64e9d + name: "iget5_locked" + is_defined: true + symbol_type: FUNCTION + crc: 0xcccf338c + type_id: 0x1210c1fa + full_name: "iget5_locked" +} elf_symbol { id: 0x4a5f3d41 name: "ignore_console_lock_warning" @@ -354018,6 +355203,24 @@ elf_symbol { type_id: 0x74d29cf1 full_name: "ignore_console_lock_warning" } +elf_symbol { + id: 0x4292b79d + name: "igrab" + is_defined: true + symbol_type: FUNCTION + crc: 0x49b765c7 + type_id: 0x1d8c491d + full_name: "igrab" +} +elf_symbol { + id: 0xb779176d + name: "ihold" + is_defined: true + symbol_type: FUNCTION + crc: 0xaafc22eb + type_id: 0x167935b9 + full_name: "ihold" +} elf_symbol { id: 0x98a39db9 name: "iio_alloc_pollfunc" @@ -354333,6 +355536,15 @@ elf_symbol { type_id: 0x92755a6c full_name: "iio_write_channel_raw" } +elf_symbol { + id: 0xf87ecda4 + name: "ilookup5" + is_defined: true + symbol_type: FUNCTION + crc: 0x3c5a783a + type_id: 0x12101463 + full_name: "ilookup5" +} elf_symbol { id: 0x00b4d2da name: "import_iovec" @@ -354387,6 +355599,24 @@ elf_symbol { type_id: 0xb1b78fab full_name: "in_egroup_p" } +elf_symbol { + id: 0x63d665a4 + name: "in_group_p" + is_defined: true + symbol_type: FUNCTION + crc: 0x8b8059bd + type_id: 0xb1b78fab + full_name: "in_group_p" +} +elf_symbol { + id: 0x8efc83b2 + name: "inc_nlink" + is_defined: true + symbol_type: FUNCTION + crc: 0xd16fc9d0 + type_id: 0x167935b9 + full_name: "inc_nlink" +} elf_symbol { id: 0x53baed4c name: "inc_node_page_state" @@ -354585,6 +355815,15 @@ elf_symbol { type_id: 0x5d05d02e full_name: "init_pseudo" } +elf_symbol { + id: 0xa64f3c31 + name: "init_special_inode" + is_defined: true + symbol_type: FUNCTION + crc: 0x0b1432c5 + type_id: 0x160abbb8 + full_name: "init_special_inode" +} elf_symbol { id: 0x7dce8737 name: "init_srcu_struct" @@ -354648,6 +355887,60 @@ elf_symbol { type_id: 0x1378736d full_name: "init_wait_var_entry" } +elf_symbol { + id: 0x7a805e08 + name: "inode_dio_wait" + is_defined: true + symbol_type: FUNCTION + crc: 0xe5edf4d7 + type_id: 0x167935b9 + full_name: "inode_dio_wait" +} +elf_symbol { + id: 0x318d9226 + name: "inode_init_once" + is_defined: true + symbol_type: FUNCTION + crc: 0xfcba10c7 + type_id: 0x167935b9 + full_name: "inode_init_once" +} +elf_symbol { + id: 0x4e9dfa3b + name: "inode_init_owner" + is_defined: true + symbol_type: FUNCTION + crc: 0x2924f2e6 + type_id: 0x13129118 + full_name: "inode_init_owner" +} +elf_symbol { + id: 0x7c74ccbc + name: "inode_maybe_inc_iversion" + is_defined: true + symbol_type: FUNCTION + crc: 0xb431e564 + type_id: 0xf9f0c251 + full_name: "inode_maybe_inc_iversion" +} +elf_symbol { + id: 0xf4ae7c22 + name: "inode_newsize_ok" + is_defined: true + symbol_type: FUNCTION + crc: 0x3ee4bf76 + type_id: 0x936a3614 + full_name: "inode_newsize_ok" +} +elf_symbol { + id: 0x2b7e86c2 + name: "inode_set_flags" + is_defined: true + symbol_type: FUNCTION + crc: 0x6d364533 + type_id: 0x177e4178 + full_name: "inode_set_flags" +} elf_symbol { id: 0x18eeb52f name: "input_alloc_absinfo" @@ -354981,6 +356274,15 @@ elf_symbol { type_id: 0x1b4c69f5 full_name: "interval_tree_remove" } +elf_symbol { + id: 0x22167fe7 + name: "invalidate_bdev" + is_defined: true + symbol_type: FUNCTION + crc: 0xe6a5cbed + type_id: 0x1393d7c4 + full_name: "invalidate_bdev" +} elf_symbol { id: 0x38472bf4 name: "invalidate_inode_pages2_range" @@ -355449,6 +356751,24 @@ elf_symbol { type_id: 0x189472bc full_name: "iov_iter_advance" } +elf_symbol { + id: 0x29ecb8e9 + name: "iov_iter_alignment" + is_defined: true + symbol_type: FUNCTION + crc: 0xd13c0fd5 + type_id: 0x3c97e3d9 + full_name: "iov_iter_alignment" +} +elf_symbol { + id: 0x3d6623cb + name: "iov_iter_get_pages2" + is_defined: true + symbol_type: FUNCTION + crc: 0x43784624 + type_id: 0x1f3dc21f + full_name: "iov_iter_get_pages2" +} elf_symbol { id: 0x71726a83 name: "iov_iter_init" @@ -355476,6 +356796,15 @@ elf_symbol { type_id: 0x189472bc full_name: "iov_iter_revert" } +elf_symbol { + id: 0x1c2c7614 + name: "iov_iter_single_seg_count" + is_defined: true + symbol_type: FUNCTION + crc: 0x1c396b24 + type_id: 0x9a04e7d8 + full_name: "iov_iter_single_seg_count" +} elf_symbol { id: 0x6c6beb07 name: "iova_domain_init_rcaches" @@ -356268,6 +357597,15 @@ elf_symbol { type_id: 0x9bba7997 full_name: "is_ashmem_file" } +elf_symbol { + id: 0x65d49acf + name: "is_bad_inode" + is_defined: true + symbol_type: FUNCTION + crc: 0x11395a73 + type_id: 0xf8453f2e + full_name: "is_bad_inode" +} elf_symbol { id: 0x064a6e13 name: "is_console_locked" @@ -356323,6 +357661,15 @@ elf_symbol { type_id: 0x9c203488 full_name: "isolate_anon_lru_page" } +elf_symbol { + id: 0xbb7edccb + name: "iter_file_splice_write" + is_defined: true + symbol_type: FUNCTION + crc: 0x4d5b9d7d + type_id: 0x165fda2d + full_name: "iter_file_splice_write" +} elf_symbol { id: 0xd4b34ea6 name: "iterate_dir" @@ -356341,6 +357688,15 @@ elf_symbol { type_id: 0x9659ea27 full_name: "iterate_fd" } +elf_symbol { + id: 0xca27ab6b + name: "iunique" + is_defined: true + symbol_type: FUNCTION + crc: 0x371ada39 + type_id: 0x14827bad + full_name: "iunique" +} elf_symbol { id: 0x124d42c2 name: "iw_handler_get_spy" @@ -356800,6 +358156,15 @@ elf_symbol { type_id: 0x1923cb99 full_name: "kill_anon_super" } +elf_symbol { + id: 0xe657d525 + name: "kill_block_super" + is_defined: true + symbol_type: FUNCTION + crc: 0x0ae50695 + type_id: 0x1923cb99 + full_name: "kill_block_super" +} elf_symbol { id: 0x661955d6 name: "kill_fasync" @@ -356890,6 +358255,15 @@ elf_symbol { type_id: 0x5eef7e83 full_name: "kmem_cache_alloc" } +elf_symbol { + id: 0x3b959429 + name: "kmem_cache_alloc_lru" + is_defined: true + symbol_type: FUNCTION + crc: 0x390004c6 + type_id: 0x5de26741 + full_name: "kmem_cache_alloc_lru" +} elf_symbol { id: 0x86921e4b name: "kmem_cache_alloc_node" @@ -358375,6 +359749,24 @@ elf_symbol { type_id: 0xc8585588 full_name: "llist_reverse_order" } +elf_symbol { + id: 0x6b29ddfb + name: "load_nls" + is_defined: true + symbol_type: FUNCTION + crc: 0x14646232 + type_id: 0x4e6eaff2 + full_name: "load_nls" +} +elf_symbol { + id: 0xc05c2da4 + name: "load_nls_default" + is_defined: true + symbol_type: FUNCTION + crc: 0xbeb78729 + type_id: 0x4f4e564c + full_name: "load_nls_default" +} elf_symbol { id: 0xaaab26df name: "lock_sock_nested" @@ -358555,6 +359947,42 @@ elf_symbol { type_id: 0xf1236ad6 full_name: "mac_pton" } +elf_symbol { + id: 0xf4530070 + name: "make_bad_inode" + is_defined: true + symbol_type: FUNCTION + crc: 0xfc3a4c5b + type_id: 0x167935b9 + full_name: "make_bad_inode" +} +elf_symbol { + id: 0x7ee18475 + name: "mark_buffer_async_write" + is_defined: true + symbol_type: FUNCTION + crc: 0x747d8323 + type_id: 0x16c5a8cd + full_name: "mark_buffer_async_write" +} +elf_symbol { + id: 0x18bd1341 + name: "mark_buffer_dirty" + is_defined: true + symbol_type: FUNCTION + crc: 0xeebcd79e + type_id: 0x16c5a8cd + full_name: "mark_buffer_dirty" +} +elf_symbol { + id: 0xac8ea5a3 + name: "mark_buffer_write_io_error" + is_defined: true + symbol_type: FUNCTION + crc: 0x1161eeb7 + type_id: 0x16c5a8cd + full_name: "mark_buffer_write_io_error" +} elf_symbol { id: 0x5a1c51ee name: "mark_page_accessed" @@ -360279,6 +361707,33 @@ elf_symbol { type_id: 0x1251a683 full_name: "module_put" } +elf_symbol { + id: 0x18e8ea11 + name: "mount_bdev" + is_defined: true + symbol_type: FUNCTION + crc: 0x60df2cf1 + type_id: 0x81599f70 + full_name: "mount_bdev" +} +elf_symbol { + id: 0x1405e8c0 + name: "mpage_read_folio" + is_defined: true + symbol_type: FUNCTION + crc: 0xec56bcef + type_id: 0x956e6587 + full_name: "mpage_read_folio" +} +elf_symbol { + id: 0x84babda3 + name: "mpage_readahead" + is_defined: true + symbol_type: FUNCTION + crc: 0x6659babe + type_id: 0x19fc4f29 + full_name: "mpage_readahead" +} elf_symbol { id: 0xbedab58b name: "msi_first_desc" @@ -361458,6 +362913,15 @@ elf_symbol { type_id: 0x2d64ae3e full_name: "noop_llseek" } +elf_symbol { + id: 0x16059afd + name: "notify_change" + is_defined: true + symbol_type: FUNCTION + crc: 0x1869b2a0 + type_id: 0x9e20f17d + full_name: "notify_change" +} elf_symbol { id: 0x1560f116 name: "nr_cpu_ids" @@ -363132,6 +364596,24 @@ elf_symbol { type_id: 0x6720d32f full_name: "overflowuid" } +elf_symbol { + id: 0xdea2b008 + name: "page_cache_next_miss" + is_defined: true + symbol_type: FUNCTION + crc: 0x8865f190 + type_id: 0x340d6f59 + full_name: "page_cache_next_miss" +} +elf_symbol { + id: 0xdf2c83f5 + name: "page_cache_prev_miss" + is_defined: true + symbol_type: FUNCTION + crc: 0x01049f80 + type_id: 0x340d6f59 + full_name: "page_cache_prev_miss" +} elf_symbol { id: 0x60d84cc3 name: "page_endio" @@ -363297,6 +364779,33 @@ elf_symbol { type_id: 0x19658c89 full_name: "page_reporting_unregister" } +elf_symbol { + id: 0x4271852e + name: "page_zero_new_buffers" + is_defined: true + symbol_type: FUNCTION + crc: 0x670fcbd9 + type_id: 0x103ff2f5 + full_name: "page_zero_new_buffers" +} +elf_symbol { + id: 0x0fe80546 + name: "pagecache_get_page" + is_defined: true + symbol_type: FUNCTION + crc: 0xcba46f3c + type_id: 0xb82f817c + full_name: "pagecache_get_page" +} +elf_symbol { + id: 0x9b003f99 + name: "pagevec_lookup_range_tag" + is_defined: true + symbol_type: FUNCTION + crc: 0xb9dae17e + type_id: 0xcfac76b5 + full_name: "pagevec_lookup_range_tag" +} elf_symbol { id: 0x37d86bb7 name: "panic" @@ -368220,6 +369729,15 @@ elf_symbol { type_id: 0x98e049ee full_name: "reclaim_shmem_address_space" } +elf_symbol { + id: 0x8fe1956e + name: "redirty_page_for_writepage" + is_defined: true + symbol_type: FUNCTION + crc: 0x9d126bc3 + type_id: 0xf6be4a6e + full_name: "redirty_page_for_writepage" +} elf_symbol { id: 0x3b03aaea name: "refcount_dec_and_lock" @@ -370587,6 +372105,24 @@ elf_symbol { type_id: 0x1192ec84 full_name: "sb800_prefetch" } +elf_symbol { + id: 0x75781cce + name: "sb_min_blocksize" + is_defined: true + symbol_type: FUNCTION + crc: 0xe004c464 + type_id: 0x95a7fa69 + full_name: "sb_min_blocksize" +} +elf_symbol { + id: 0xd3eab591 + name: "sb_set_blocksize" + is_defined: true + symbol_type: FUNCTION + crc: 0x94ed96ed + type_id: 0x95a7fa69 + full_name: "sb_set_blocksize" +} elf_symbol { id: 0x806f167c name: "sbitmap_add_wait_queue" @@ -371631,6 +373167,15 @@ elf_symbol { type_id: 0x9aa0b156 full_name: "security_file_ioctl" } +elf_symbol { + id: 0xb7265b03 + name: "security_inode_init_security" + is_defined: true + symbol_type: FUNCTION + crc: 0x1e6fb814 + type_id: 0x9b034295 + full_name: "security_inode_init_security" +} elf_symbol { id: 0x24b9d7ed name: "security_sk_classify_flow" @@ -372153,6 +373698,15 @@ elf_symbol { type_id: 0x130ef56d full_name: "set_next_entity" } +elf_symbol { + id: 0x7e3fb039 + name: "set_nlink" + is_defined: true + symbol_type: FUNCTION + crc: 0x190daaac + type_id: 0x176f2021 + full_name: "set_nlink" +} elf_symbol { id: 0xaae00157 name: "set_normalized_timespec64" @@ -372180,6 +373734,15 @@ elf_symbol { type_id: 0x9c203488 full_name: "set_page_dirty_lock" } +elf_symbol { + id: 0x500f328c + name: "set_page_writeback" + is_defined: true + symbol_type: FUNCTION + crc: 0x7c2bfc58 + type_id: 0xff048ca3 + full_name: "set_page_writeback" +} elf_symbol { id: 0xe19d98a9 name: "set_task_cpu" @@ -372198,6 +373761,15 @@ elf_symbol { type_id: 0x142e0390 full_name: "set_user_nice" } +elf_symbol { + id: 0x7d05df74 + name: "setattr_prepare" + is_defined: true + symbol_type: FUNCTION + crc: 0xd880e38e + type_id: 0x9e20c0b8 + full_name: "setattr_prepare" +} elf_symbol { id: 0x5d6d169f name: "setup_udp_tunnel_sock" @@ -376387,6 +377959,15 @@ elf_symbol { type_id: 0x9e8b6578 full_name: "sync_blockdev" } +elf_symbol { + id: 0x75fe69c4 + name: "sync_dirty_buffer" + is_defined: true + symbol_type: FUNCTION + crc: 0xcedf4474 + type_id: 0x9bdd1a71 + full_name: "sync_dirty_buffer" +} elf_symbol { id: 0x2a267913 name: "sync_file_create" @@ -376414,6 +377995,15 @@ elf_symbol { type_id: 0x943b7925 full_name: "sync_filesystem" } +elf_symbol { + id: 0xe7caa0b7 + name: "sync_inode_metadata" + is_defined: true + symbol_type: FUNCTION + crc: 0xf4644f98 + type_id: 0x9afd0449 + full_name: "sync_inode_metadata" +} elf_symbol { id: 0x3da4fd63 name: "synchronize_irq" @@ -376891,6 +378481,15 @@ elf_symbol { type_id: 0x13f8b706 full_name: "system_wq" } +elf_symbol { + id: 0x5a86c789 + name: "tag_pages_for_writeback" + is_defined: true + symbol_type: FUNCTION + crc: 0x31d107da + type_id: 0x1539f399 + full_name: "tag_pages_for_writeback" +} elf_symbol { id: 0x2eda3aae name: "task_active_pid_ns" @@ -377440,6 +379039,15 @@ elf_symbol { type_id: 0x3e2facf6 full_name: "timespec64_to_jiffies" } +elf_symbol { + id: 0xaed64d9d + name: "timestamp_truncate" + is_defined: true + symbol_type: FUNCTION + crc: 0xe6d28852 + type_id: 0xb98ee524 + full_name: "timestamp_truncate" +} elf_symbol { id: 0xa603e7df name: "tipc_dump_done" @@ -377503,6 +379111,15 @@ elf_symbol { type_id: 0x1c163406 full_name: "topology_update_thermal_pressure" } +elf_symbol { + id: 0x3217f3a4 + name: "touch_atime" + is_defined: true + symbol_type: FUNCTION + crc: 0x838565c7 + type_id: 0x1e3bdb22 + full_name: "touch_atime" +} elf_symbol { id: 0xf7dfdad1 name: "touch_softlockup_watchdog" @@ -377755,6 +379372,42 @@ elf_symbol { type_id: 0x10985193 full_name: "tracing_off" } +elf_symbol { + id: 0x3f07269b + name: "truncate_inode_pages" + is_defined: true + symbol_type: FUNCTION + crc: 0x30d50607 + type_id: 0x1566644a + full_name: "truncate_inode_pages" +} +elf_symbol { + id: 0x3c7c6ce9 + name: "truncate_inode_pages_final" + is_defined: true + symbol_type: FUNCTION + crc: 0xc3c0465a + type_id: 0x15f8fb52 + full_name: "truncate_inode_pages_final" +} +elf_symbol { + id: 0x7a43283c + name: "truncate_pagecache" + is_defined: true + symbol_type: FUNCTION + crc: 0x288af9d7 + type_id: 0x16e7aaa1 + full_name: "truncate_pagecache" +} +elf_symbol { + id: 0x44cd0751 + name: "truncate_setsize" + is_defined: true + symbol_type: FUNCTION + crc: 0x3a8f6a77 + type_id: 0x16e7aaa1 + full_name: "truncate_setsize" +} elf_symbol { id: 0x3d986fb5 name: "try_module_get" @@ -377782,6 +379435,15 @@ elf_symbol { type_id: 0x360a8ce9 full_name: "try_to_free_mem_cgroup_pages" } +elf_symbol { + id: 0x8fa1e478 + name: "try_to_writeback_inodes_sb" + is_defined: true + symbol_type: FUNCTION + crc: 0xaa6bae3f + type_id: 0x1b90a8d8 + full_name: "try_to_writeback_inodes_sb" +} elf_symbol { id: 0xe54aec5b name: "try_wait_for_completion" @@ -379843,6 +381505,15 @@ elf_symbol { type_id: 0x13f52df1 full_name: "uio_unregister_device" } +elf_symbol { + id: 0xa13a99d8 + name: "unload_nls" + is_defined: true + symbol_type: FUNCTION + crc: 0xf632a6eb + type_id: 0x10aeeb41 + full_name: "unload_nls" +} elf_symbol { id: 0x9f5197f0 name: "unlock_buffer" @@ -379852,6 +381523,15 @@ elf_symbol { type_id: 0x16c5a8cd full_name: "unlock_buffer" } +elf_symbol { + id: 0x5ad67dea + name: "unlock_new_inode" + is_defined: true + symbol_type: FUNCTION + crc: 0x8e87ba89 + type_id: 0x167935b9 + full_name: "unlock_new_inode" +} elf_symbol { id: 0x11fd8c82 name: "unlock_page" @@ -384685,6 +386365,15 @@ elf_symbol { type_id: 0xa7f744cd full_name: "wait_woken" } +elf_symbol { + id: 0x738279bf + name: "wake_bit_function" + is_defined: true + symbol_type: FUNCTION + crc: 0xca431c05 + type_id: 0x9d71353d + full_name: "wake_bit_function" +} elf_symbol { id: 0x7540b5a8 name: "wake_up_bit" @@ -384964,6 +386653,15 @@ elf_symbol { type_id: 0x126f3be6 full_name: "wq_worker_comm" } +elf_symbol { + id: 0xa643ac3f + name: "write_inode_now" + is_defined: true + symbol_type: FUNCTION + crc: 0x627c55da + type_id: 0x9afd0449 + full_name: "write_inode_now" +} elf_symbol { id: 0x61731bd0 name: "ww_mutex_lock" @@ -385812,6 +387510,8 @@ interface { symbol_id: 0xeaf0b860 symbol_id: 0x1bc9d7cd symbol_id: 0xd97b055a + symbol_id: 0xac51df48 + symbol_id: 0x2c42b675 symbol_id: 0x8920b575 symbol_id: 0x149a28b5 symbol_id: 0x1709df48 @@ -385834,6 +387534,10 @@ interface { symbol_id: 0xc8eb813d symbol_id: 0x7bf707d4 symbol_id: 0xbf1d0365 + symbol_id: 0x2d1c1f2d + symbol_id: 0x9bed4545 + symbol_id: 0xefdcf4c1 + symbol_id: 0x2f449b9e symbol_id: 0x2057d4fc symbol_id: 0x4598418e symbol_id: 0x587f0c74 @@ -385931,8 +387635,11 @@ interface { symbol_id: 0x80f1cf36 symbol_id: 0x3e32c80e symbol_id: 0x5298aa39 + symbol_id: 0x6036d483 symbol_id: 0xaf8ee687 symbol_id: 0x746a66fc + symbol_id: 0x6a92cb2d + symbol_id: 0x6fc34fdb symbol_id: 0x47a334c4 symbol_id: 0xebf4b11f symbol_id: 0x5b1ea047 @@ -385965,6 +387672,7 @@ interface { symbol_id: 0x88943e29 symbol_id: 0x1060f5aa symbol_id: 0x66da9aca + symbol_id: 0xd02fc75b symbol_id: 0xe97034af symbol_id: 0xdb78f816 symbol_id: 0x6db91312 @@ -385999,6 +387707,7 @@ interface { symbol_id: 0xb3ed4cf9 symbol_id: 0x9f86f628 symbol_id: 0x22bd6642 + symbol_id: 0x0b9d6bbc symbol_id: 0x040ec563 symbol_id: 0xa5f70021 symbol_id: 0xc8acd38c @@ -386079,6 +387788,7 @@ interface { symbol_id: 0x3f068dc8 symbol_id: 0x2a48bf7d symbol_id: 0xe3a7489a + symbol_id: 0x9d948fe1 symbol_id: 0xf7c2da07 symbol_id: 0x1141e9bb symbol_id: 0xf263b97f @@ -386098,6 +387808,7 @@ interface { symbol_id: 0x55017671 symbol_id: 0x257c4bb9 symbol_id: 0x8aca43ec + symbol_id: 0xa2cf1eee symbol_id: 0xeaddb422 symbol_id: 0x29a11d8a symbol_id: 0x208b66fa @@ -386126,6 +387837,7 @@ interface { symbol_id: 0x7d0d7b3f symbol_id: 0xef62271a symbol_id: 0x243936f1 + symbol_id: 0xd8a7d75e symbol_id: 0x04e4f57e symbol_id: 0xb04d8b58 symbol_id: 0xd7d29ff4 @@ -386969,6 +388681,7 @@ interface { symbol_id: 0xa5eaf571 symbol_id: 0x7c570dc6 symbol_id: 0x993e379e + symbol_id: 0x874fa015 symbol_id: 0x86a88093 symbol_id: 0xfbb6649f symbol_id: 0xa3514d5f @@ -387084,6 +388797,7 @@ interface { symbol_id: 0x1cb0de6c symbol_id: 0xe0e9f920 symbol_id: 0xfba0da8c + symbol_id: 0x00f38540 symbol_id: 0x181f78de symbol_id: 0xbe6da55e symbol_id: 0x95792096 @@ -387182,6 +388896,7 @@ interface { symbol_id: 0x4cb4702d symbol_id: 0x0b067d4b symbol_id: 0xc0201123 + symbol_id: 0x4d722bb5 symbol_id: 0x2a322266 symbol_id: 0x57e1cd01 symbol_id: 0xf0581d11 @@ -387190,6 +388905,9 @@ interface { symbol_id: 0xabd39b51 symbol_id: 0x6dfac71b symbol_id: 0xb0184730 + symbol_id: 0xd289c43d + symbol_id: 0x6efa206d + symbol_id: 0x5cf37146 symbol_id: 0x427cedc9 symbol_id: 0x11fbb9ce symbol_id: 0xd4a0f991 @@ -387253,6 +388971,7 @@ interface { symbol_id: 0xb47c5ffe symbol_id: 0xdded4dcd symbol_id: 0x9dea2dda + symbol_id: 0x6bb6d4ca symbol_id: 0x8ea00f54 symbol_id: 0x521ad765 symbol_id: 0x0f9d7b5e @@ -387304,6 +389023,7 @@ interface { symbol_id: 0x9c1662dc symbol_id: 0x9e7fc289 symbol_id: 0x0e419b40 + symbol_id: 0x61aaf300 symbol_id: 0xb2bfcc0c symbol_id: 0x06192615 symbol_id: 0x9e3deb49 @@ -387347,9 +389067,12 @@ interface { symbol_id: 0xb29100f2 symbol_id: 0xef9eb644 symbol_id: 0xf91cb171 + symbol_id: 0xb242a940 symbol_id: 0xd156aa2c symbol_id: 0x00d9abe7 + symbol_id: 0xfa95bdc1 symbol_id: 0xb63845e5 + symbol_id: 0x52eaa51b symbol_id: 0x5332f89b symbol_id: 0xdfc28761 symbol_id: 0x75df86d2 @@ -387464,6 +389187,7 @@ interface { symbol_id: 0x610edc84 symbol_id: 0xd71898b4 symbol_id: 0xc1167624 + symbol_id: 0x9f1f7cee symbol_id: 0xd89255c2 symbol_id: 0x962b6a68 symbol_id: 0x33bbeca6 @@ -387544,6 +389268,7 @@ interface { symbol_id: 0xec1b66f9 symbol_id: 0xac913841 symbol_id: 0x42676517 + symbol_id: 0xd5cc5ce2 symbol_id: 0xc3e46036 symbol_id: 0xcd2564d1 symbol_id: 0x2968f72a @@ -387604,10 +389329,15 @@ interface { symbol_id: 0x50e383fc symbol_id: 0x823aeba5 symbol_id: 0xde96cb2f + symbol_id: 0x4c090f07 symbol_id: 0x171eca8a + symbol_id: 0x82537a82 symbol_id: 0x79187969 + symbol_id: 0x04f5a6e5 symbol_id: 0x52864a7e + symbol_id: 0x8d5ab7b4 symbol_id: 0xccc25fc1 + symbol_id: 0xb96af991 symbol_id: 0xb771d13e symbol_id: 0x53d11a8d symbol_id: 0x5489a975 @@ -388134,6 +389864,7 @@ interface { symbol_id: 0x3d2d0ba2 symbol_id: 0x0d57c53d symbol_id: 0xab93a1ea + symbol_id: 0x626b81c7 symbol_id: 0x4a57b168 symbol_id: 0x8a417941 symbol_id: 0xb04874d2 @@ -388558,6 +390289,7 @@ interface { symbol_id: 0xdaf34c14 symbol_id: 0x1f1ab070 symbol_id: 0x66dcfd31 + symbol_id: 0x4dae13e9 symbol_id: 0xe2b96ffd symbol_id: 0x126bb89f symbol_id: 0x2e0e7810 @@ -388609,7 +390341,10 @@ interface { symbol_id: 0x8f99729e symbol_id: 0xb6a9c6f8 symbol_id: 0x309cb0fd + symbol_id: 0x45c0e0ad + symbol_id: 0xf7fd2915 symbol_id: 0x7b9ffce9 + symbol_id: 0xe506b877 symbol_id: 0xda116c83 symbol_id: 0xa279fd1d symbol_id: 0x134d07e5 @@ -388649,14 +390384,28 @@ interface { symbol_id: 0x0a446897 symbol_id: 0xb107d2cd symbol_id: 0x8628f24d + symbol_id: 0xc56006c7 + symbol_id: 0x639b2403 symbol_id: 0xbbfb394e symbol_id: 0x79edfc56 symbol_id: 0xc3077f07 symbol_id: 0xedcfa797 + symbol_id: 0xab45f2a8 + symbol_id: 0x41eed79f + symbol_id: 0xcdc0fffd symbol_id: 0xe7aacfe5 symbol_id: 0x9e942fbe + symbol_id: 0x99b0f07b + symbol_id: 0xffbe24f4 symbol_id: 0x46b6e531 symbol_id: 0xbe28ee32 + symbol_id: 0x4927c9f3 + symbol_id: 0x50a5072e + symbol_id: 0xef606c3f + symbol_id: 0x3289d59f + symbol_id: 0x82b19820 + symbol_id: 0x7c937fc2 + symbol_id: 0xc7c68a05 symbol_id: 0xb9dc79d0 symbol_id: 0x8bbdb127 symbol_id: 0xeaf15c9b @@ -388682,6 +390431,7 @@ interface { symbol_id: 0x09d08108 symbol_id: 0x3c7c2553 symbol_id: 0x3dca9a13 + symbol_id: 0x07508208 symbol_id: 0xcb14b5cc symbol_id: 0x1721c938 symbol_id: 0x1bf542c4 @@ -388765,12 +390515,19 @@ interface { symbol_id: 0xc5fee33e symbol_id: 0x7419d447 symbol_id: 0x30828743 + symbol_id: 0xe21d8d05 + symbol_id: 0x338cfb0f symbol_id: 0x94b60724 + symbol_id: 0x6ac5d61b + symbol_id: 0x54756210 symbol_id: 0x5ec3daa8 + symbol_id: 0x5530f759 + symbol_id: 0x3812bb22 symbol_id: 0x2f7205ee symbol_id: 0x7d577f86 symbol_id: 0x95a840b8 symbol_id: 0x7f639ef1 + symbol_id: 0x4c4073c3 symbol_id: 0x798f83da symbol_id: 0x542785af symbol_id: 0x86da67c0 @@ -388913,6 +390670,7 @@ interface { symbol_id: 0x2bcde32a symbol_id: 0x65cf864e symbol_id: 0xc5a4a821 + symbol_id: 0x085aa99f symbol_id: 0x4dcdd24d symbol_id: 0x8df87722 symbol_id: 0x0ac30c0d @@ -389117,7 +390875,10 @@ interface { symbol_id: 0x82d54cd2 symbol_id: 0xec107a09 symbol_id: 0x841218b7 + symbol_id: 0xb9f64e9d symbol_id: 0x4a5f3d41 + symbol_id: 0x4292b79d + symbol_id: 0xb779176d symbol_id: 0x98a39db9 symbol_id: 0xf9fd308c symbol_id: 0x5956f21f @@ -389153,12 +390914,15 @@ interface { symbol_id: 0x08fd4b84 symbol_id: 0xc6d8f246 symbol_id: 0x6f2f4bd1 + symbol_id: 0xf87ecda4 symbol_id: 0x00b4d2da symbol_id: 0xdf968210 symbol_id: 0xc93c3b7d symbol_id: 0xcae49fd9 symbol_id: 0x83940072 symbol_id: 0x511cdd52 + symbol_id: 0x63d665a4 + symbol_id: 0x8efc83b2 symbol_id: 0x53baed4c symbol_id: 0xaf4fc4b9 symbol_id: 0x2d6e1a71 @@ -389181,6 +390945,7 @@ interface { symbol_id: 0x86c8a137 symbol_id: 0x64e448f4 symbol_id: 0x4e874464 + symbol_id: 0xa64f3c31 symbol_id: 0x7dce8737 symbol_id: 0x3d6f5577 symbol_id: 0x2b35dbba @@ -389188,6 +390953,12 @@ interface { symbol_id: 0x5eecacc4 symbol_id: 0x215b5641 symbol_id: 0xbf6470f2 + symbol_id: 0x7a805e08 + symbol_id: 0x318d9226 + symbol_id: 0x4e9dfa3b + symbol_id: 0x7c74ccbc + symbol_id: 0xf4ae7c22 + symbol_id: 0x2b7e86c2 symbol_id: 0x18eeb52f symbol_id: 0xbc652525 symbol_id: 0x2336c16f @@ -389225,6 +390996,7 @@ interface { symbol_id: 0x0d19106d symbol_id: 0xfe94820e symbol_id: 0xe7fc8dce + symbol_id: 0x22167fe7 symbol_id: 0x38472bf4 symbol_id: 0xc3e2d4ae symbol_id: 0x6b8c216a @@ -389277,9 +391049,12 @@ interface { symbol_id: 0xa0390871 symbol_id: 0xfb789e26 symbol_id: 0x382b3272 + symbol_id: 0x29ecb8e9 + symbol_id: 0x3d6623cb symbol_id: 0x71726a83 symbol_id: 0xffb394c4 symbol_id: 0x48a6183b + symbol_id: 0x1c2c7614 symbol_id: 0x6c6beb07 symbol_id: 0x1be0f35f symbol_id: 0xd9fe9b1d @@ -389368,14 +391143,17 @@ interface { symbol_id: 0xdbb90310 symbol_id: 0x3d2a104d symbol_id: 0x9ba08730 + symbol_id: 0x65d49acf symbol_id: 0x064a6e13 symbol_id: 0x73ffe9a9 symbol_id: 0x03de6dc5 symbol_id: 0xe4e974b3 symbol_id: 0x2066c48d symbol_id: 0x1cd74592 + symbol_id: 0xbb7edccb symbol_id: 0xd4b34ea6 symbol_id: 0x3c6496cb + symbol_id: 0xca27ab6b symbol_id: 0x124d42c2 symbol_id: 0xd106aba0 symbol_id: 0x5cce6b17 @@ -389427,6 +391205,7 @@ interface { symbol_id: 0x6d575dad symbol_id: 0xe4128490 symbol_id: 0xb1072fb1 + symbol_id: 0xe657d525 symbol_id: 0x661955d6 symbol_id: 0xd6a8ff16 symbol_id: 0x053e25cb @@ -389437,6 +391216,7 @@ interface { symbol_id: 0xa64fdec4 symbol_id: 0xcbec700e symbol_id: 0x394ce3dd + symbol_id: 0x3b959429 symbol_id: 0x86921e4b symbol_id: 0x56f23732 symbol_id: 0xa5a4fafa @@ -389602,6 +391382,8 @@ interface { symbol_id: 0xf33d71ea symbol_id: 0xc50733a4 symbol_id: 0xc162c911 + symbol_id: 0x6b29ddfb + symbol_id: 0xc05c2da4 symbol_id: 0xaaab26df symbol_id: 0x42eaca18 symbol_id: 0x408fc274 @@ -389622,6 +391404,10 @@ interface { symbol_id: 0x01bea327 symbol_id: 0x4f31c756 symbol_id: 0x7bd17841 + symbol_id: 0xf4530070 + symbol_id: 0x7ee18475 + symbol_id: 0x18bd1341 + symbol_id: 0xac8ea5a3 symbol_id: 0x5a1c51ee symbol_id: 0xe4eac6bd symbol_id: 0x602510fe @@ -389814,6 +391600,9 @@ interface { symbol_id: 0xe4008a83 symbol_id: 0x7eaf76f6 symbol_id: 0x65106d59 + symbol_id: 0x18e8ea11 + symbol_id: 0x1405e8c0 + symbol_id: 0x84babda3 symbol_id: 0xbedab58b symbol_id: 0x603dd7ca symbol_id: 0xc30a6d76 @@ -389945,6 +391734,7 @@ interface { symbol_id: 0x39787440 symbol_id: 0x7f258c4e symbol_id: 0x64e6aa0b + symbol_id: 0x16059afd symbol_id: 0x1560f116 symbol_id: 0x1cfcf940 symbol_id: 0x3704ac3f @@ -390131,6 +391921,8 @@ interface { symbol_id: 0x57ecab02 symbol_id: 0x27d0c7b6 symbol_id: 0x28b33064 + symbol_id: 0xdea2b008 + symbol_id: 0xdf2c83f5 symbol_id: 0x60d84cc3 symbol_id: 0xb613af5e symbol_id: 0xff029108 @@ -390149,6 +391941,9 @@ interface { symbol_id: 0x3c537500 symbol_id: 0x1b814fa6 symbol_id: 0x9ca2e070 + symbol_id: 0x4271852e + symbol_id: 0x0fe80546 + symbol_id: 0x9b003f99 symbol_id: 0x37d86bb7 symbol_id: 0x32ecd828 symbol_id: 0xe769f645 @@ -390696,6 +392491,7 @@ interface { symbol_id: 0x590d247f symbol_id: 0x91579542 symbol_id: 0x2a59e35c + symbol_id: 0x8fe1956e symbol_id: 0x3b03aaea symbol_id: 0xeeb1ddf9 symbol_id: 0x54bb98b3 @@ -390959,6 +392755,8 @@ interface { symbol_id: 0x8fb082a6 symbol_id: 0x570df167 symbol_id: 0x84f045c2 + symbol_id: 0x75781cce + symbol_id: 0xd3eab591 symbol_id: 0x806f167c symbol_id: 0xf13ba64e symbol_id: 0xe4f77cb7 @@ -391075,6 +392873,7 @@ interface { symbol_id: 0x4a4e8bee symbol_id: 0x5b060b7d symbol_id: 0xec171799 + symbol_id: 0xb7265b03 symbol_id: 0x24b9d7ed symbol_id: 0x25471057 symbol_id: 0xb77dc501 @@ -391133,11 +392932,14 @@ interface { symbol_id: 0x1f625c64 symbol_id: 0x180ceb0c symbol_id: 0x19ed5e1a + symbol_id: 0x7e3fb039 symbol_id: 0xaae00157 symbol_id: 0x455375fa symbol_id: 0xc1ea8aaa + symbol_id: 0x500f328c symbol_id: 0xe19d98a9 symbol_id: 0xdebcf3e9 + symbol_id: 0x7d05df74 symbol_id: 0x5d6d169f symbol_id: 0x023858a0 symbol_id: 0x7b2c2128 @@ -391604,9 +393406,11 @@ interface { symbol_id: 0xfb52ace2 symbol_id: 0x44e002a2 symbol_id: 0x1fe11014 + symbol_id: 0x75fe69c4 symbol_id: 0x2a267913 symbol_id: 0xf3c91dcd symbol_id: 0xfb2634da + symbol_id: 0xe7caa0b7 symbol_id: 0x3da4fd63 symbol_id: 0xc49e9f39 symbol_id: 0x89663420 @@ -391660,6 +393464,7 @@ interface { symbol_id: 0xa64e4b1e symbol_id: 0xd143c302 symbol_id: 0xbf6d0a0f + symbol_id: 0x5a86c789 symbol_id: 0x2eda3aae symbol_id: 0x9891b743 symbol_id: 0x51f65372 @@ -391721,6 +393526,7 @@ interface { symbol_id: 0x5da495c5 symbol_id: 0xdc3e523b symbol_id: 0x3934d205 + symbol_id: 0xaed64d9d symbol_id: 0xa603e7df symbol_id: 0xfbbf21e2 symbol_id: 0xb08b0149 @@ -391728,6 +393534,7 @@ interface { symbol_id: 0x18c0f285 symbol_id: 0xd3e5c9bd symbol_id: 0x96be8568 + symbol_id: 0x3217f3a4 symbol_id: 0xf7dfdad1 symbol_id: 0x47d78ddb symbol_id: 0x961122f4 @@ -391756,9 +393563,14 @@ interface { symbol_id: 0x3df2f359 symbol_id: 0x33172d21 symbol_id: 0x54bbaa46 + symbol_id: 0x3f07269b + symbol_id: 0x3c7c6ce9 + symbol_id: 0x7a43283c + symbol_id: 0x44cd0751 symbol_id: 0x3d986fb5 symbol_id: 0x2f855953 symbol_id: 0x8814f5b8 + symbol_id: 0x8fa1e478 symbol_id: 0xe54aec5b symbol_id: 0xce4acc7b symbol_id: 0xe244df50 @@ -391988,7 +393800,9 @@ interface { symbol_id: 0xc9fa7338 symbol_id: 0xb163f167 symbol_id: 0x439eff60 + symbol_id: 0xa13a99d8 symbol_id: 0x9f5197f0 + symbol_id: 0x5ad67dea symbol_id: 0x11fd8c82 symbol_id: 0xe41b8f90 symbol_id: 0x60ffe144 @@ -392526,6 +394340,7 @@ interface { symbol_id: 0x60488ecf symbol_id: 0x9d727719 symbol_id: 0xa4027847 + symbol_id: 0x738279bf symbol_id: 0x7540b5a8 symbol_id: 0xb1036d49 symbol_id: 0x9a87f32b @@ -392557,6 +394372,7 @@ interface { symbol_id: 0x4e8c6206 symbol_id: 0x887e1dde symbol_id: 0x180eeaeb + symbol_id: 0xa643ac3f symbol_id: 0x61731bd0 symbol_id: 0x6f9f10f2 symbol_id: 0x99941051 diff --git a/android/abi_gki_aarch64_tuxera b/android/abi_gki_aarch64_tuxera index d04285e84983..cbffd3f1685f 100644 --- a/android/abi_gki_aarch64_tuxera +++ b/android/abi_gki_aarch64_tuxera @@ -1,23 +1,280 @@ -__folio_put -__page_pinner_put_page -__percpu_down_read -_printk -_trace_android_vh_record_pcpu_rwsem_starttime -alt_cb_patch_nops -bio_alloc_bioset -call_rcu -filemap_add_folio -fs_bio_set -invalidate_inode_pages2_range -jiffies -mnt_drop_write_file -mnt_want_write_file -page_pinner_inited -preempt_schedule -preempt_schedule_notrace -rcu_barrier -rcuwait_wake_up -readahead_gfp_mask -strstr -sync_filesystem - +[abi_symbol_list] + alt_cb_patch_nops + __arch_copy_from_user + __arch_copy_to_user + autoremove_wake_function + balance_dirty_pages_ratelimited + bcmp + __bforget + __bh_read_batch + bio_add_page + bio_alloc_bioset + bio_put + __bitmap_weight + bit_waitqueue + blkdev_issue_discard + blkdev_issue_flush + blk_finish_plug + blk_start_plug + __blockdev_direct_IO + block_dirty_folio + block_invalidate_folio + block_is_partially_uptodate + __breadahead + __bread_gfp + __brelse + buffer_migrate_folio + call_rcu + capable + capable_wrt_inode_uidgid + __check_object_size + clean_bdev_aliases + clear_inode + clear_page + clear_page_dirty_for_io + copy_page_from_iter_atomic + cpu_hwcaps + create_empty_buffers + current_umask + d_add + d_add_ci + d_instantiate + d_make_root + d_obtain_alias + down_read + down_write + down_write_trylock + dput + drop_nlink + d_splice_alias + dump_stack + end_buffer_read_sync + end_buffer_write_sync + end_page_writeback + errseq_set + fault_in_iov_iter_readable + fault_in_safe_writeable + fget + fiemap_fill_next_extent + fiemap_prep + file_check_and_advance_wb_err + filemap_add_folio + filemap_dirty_folio + filemap_fault + filemap_fdatawait_range + filemap_fdatawrite + filemap_fdatawrite_range + filemap_flush + __filemap_set_wb_err + filemap_write_and_wait_range + file_remove_privs + file_update_time + file_write_and_wait_range + finish_wait + flush_dcache_page + __folio_alloc + __folio_cancel_dirty + __folio_lock + __folio_put + folio_wait_bit + folio_write_one + fortify_panic + fput + freezer_active + freezing_slow_path + fs_bio_set + generic_error_remove_page + generic_file_direct_write + generic_file_llseek + generic_file_mmap + generic_file_open + generic_file_read_iter + generic_file_splice_read + generic_fillattr + generic_perform_write + generic_read_dir + generic_write_checks + __getblk_gfp + gic_nonsecure_priorities + grab_cache_page_write_begin + iget5_locked + igrab + ihold + ilookup5 + inc_nlink + in_group_p + __init_rwsem + init_special_inode + init_wait_entry + __init_waitqueue_head + inode_dio_wait + inode_init_once + inode_init_owner + inode_maybe_inc_iversion + inode_newsize_ok + inode_set_flags + __insert_inode_hash + invalidate_bdev + invalidate_inode_pages2_range + invalidate_mapping_pages + io_schedule + iov_iter_advance + iov_iter_alignment + iov_iter_get_pages2 + iov_iter_single_seg_count + iput + is_bad_inode + iter_file_splice_write + iunique + jiffies + jiffies_to_msecs + kasan_flag_enabled + kfree + kill_block_super + __kmalloc + kmalloc_caches + kmalloc_trace + kmem_cache_alloc + kmem_cache_alloc_lru + kmem_cache_create + kmem_cache_create_usercopy + kmem_cache_destroy + kmem_cache_free + krealloc + kthread_complete_and_exit + kthread_create_on_node + kthread_should_stop + kthread_stop + ktime_get_coarse_real_ts64 + kvfree + __list_add_valid + __list_del_entry_valid + load_nls + load_nls_default + __lock_buffer + make_bad_inode + mark_buffer_async_write + mark_buffer_dirty + mark_buffer_write_io_error + __mark_inode_dirty + mark_page_accessed + memcmp + memcpy + memmove + memset + mktime64 + mnt_drop_write_file + mnt_want_write_file + mount_bdev + mpage_readahead + mpage_read_folio + __msecs_to_jiffies + __mutex_init + mutex_lock + mutex_trylock + mutex_unlock + new_inode + notify_change + pagecache_get_page + page_cache_next_miss + page_cache_prev_miss + page_pinner_inited + __page_pinner_put_page + pagevec_lookup_range_tag + __pagevec_release + page_zero_new_buffers + __percpu_down_read + preempt_schedule + preempt_schedule_notrace + prepare_to_wait + prepare_to_wait_event + _printk + __printk_ratelimit + ___ratelimit + _raw_read_lock + _raw_read_lock_irqsave + _raw_read_unlock + _raw_read_unlock_irqrestore + _raw_spin_lock + _raw_spin_lock_irqsave + _raw_spin_unlock + _raw_spin_unlock_irqrestore + _raw_write_lock + _raw_write_lock_irqsave + _raw_write_unlock + _raw_write_unlock_irqrestore + rcu_barrier + rcuwait_wake_up + readahead_gfp_mask + read_cache_page + redirty_page_for_writepage + __refrigerator + register_filesystem + __remove_inode_hash + sb_min_blocksize + sb_set_blocksize + schedule + schedule_timeout + schedule_timeout_interruptible + security_inode_init_security + seq_printf + setattr_prepare + set_freezable + set_nlink + set_page_dirty + __set_page_dirty_nobuffers + set_page_writeback + set_user_nice + simple_strtol + simple_strtoul + simple_strtoull + snprintf + sprintf + sscanf + __stack_chk_fail + strchr + strcmp + strlen + strncasecmp + strncmp + strsep + strstr + submit_bh + submit_bio + sync_blockdev + __sync_dirty_buffer + sync_dirty_buffer + sync_filesystem + sync_inode_metadata + sys_tz + tag_pages_for_writeback + time64_to_tm + timestamp_truncate + touch_atime + _trace_android_vh_record_pcpu_rwsem_starttime + _trace_android_vh_record_pcpu_rwsem_time_early + truncate_inode_pages + truncate_inode_pages_final + truncate_pagecache + truncate_setsize + try_to_writeback_inodes_sb + unload_nls + unlock_buffer + unlock_new_inode + unlock_page + unregister_filesystem + up_read + up_write + vfree + vfs_fsync_range + __vmalloc + vmalloc + vsnprintf + vzalloc + __wait_on_buffer + wake_bit_function + __wake_up + wake_up_process + __warn_printk + write_inode_now + xa_load From e2fa9ebcaea23e1562965c579ff11c06a3258f8c Mon Sep 17 00:00:00 2001 From: Sergey Senozhatsky Date: Tue, 18 Apr 2023 16:46:39 +0900 Subject: [PATCH 090/113] UPSTREAM: zsmalloc: allow only one active pool compaction context zsmalloc pool can be compacted concurrently by many contexts, e.g. cc1 handle_mm_fault() do_anonymous_page() __alloc_pages_slowpath() try_to_free_pages() do_try_to_free_pages( lru_gen_shrink_node() shrink_slab() do_shrink_slab() zs_shrinker_scan() zs_compact() Pool compaction is currently (basically) single-threaded as it is performed under pool->lock. Having multiple compaction threads results in unnecessary contention, as each thread competes for pool->lock. This, in turn, affects all zsmalloc operations such as zs_malloc(), zs_map_object(), zs_free(), etc. Introduce the pool->compaction_in_progress atomic variable, which ensures that only one compaction context can run at a time. This reduces overall pool->lock contention in (corner) cases when many contexts attempt to shrink zspool simultaneously. Link: https://lkml.kernel.org/r/20230418074639.1903197-1-senozhatsky@chromium.org Fixes: c0547d0b6a4b ("zsmalloc: consolidate zs_pool's migrate_lock and size_class's locks") Signed-off-by: Sergey Senozhatsky Reviewed-by: Yosry Ahmed Cc: Minchan Kim Signed-off-by: Andrew Morton (cherry picked from commit cb440cecb223364ebc2739dcede3ca748b418f3a) Bug: 296365608 Change-Id: Ic7878e08c3484ade8c766d051a8f17cc8179eedf Signed-off-by: Suren Baghdasaryan --- mm/zsmalloc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 9fb906d56e0b..02e784182c20 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -246,6 +246,7 @@ struct zs_pool { struct work_struct free_work; #endif spinlock_t lock; + atomic_t compaction_in_progress; }; struct zspage { @@ -2100,6 +2101,15 @@ unsigned long zs_compact(struct zs_pool *pool) struct size_class *class; unsigned long pages_freed = 0; + /* + * Pool compaction is performed under pool->lock so it is basically + * single-threaded. Having more than one thread in __zs_compact() + * will increase pool->lock contention, which will impact other + * zsmalloc operations that need pool->lock. + */ + if (atomic_xchg(&pool->compaction_in_progress, 1)) + return 0; + for (i = ZS_SIZE_CLASSES - 1; i >= 0; i--) { class = pool->size_class[i]; if (class->index != i) @@ -2107,6 +2117,7 @@ unsigned long zs_compact(struct zs_pool *pool) pages_freed += __zs_compact(pool, class); } atomic_long_add(pages_freed, &pool->stats.pages_compacted); + atomic_set(&pool->compaction_in_progress, 0); return pages_freed; } @@ -2193,6 +2204,7 @@ struct zs_pool *zs_create_pool(const char *name) init_deferred_free(pool); spin_lock_init(&pool->lock); + atomic_set(&pool->compaction_in_progress, 0); pool->name = kstrdup(name, GFP_KERNEL); if (!pool->name) From 3ffb0380981dda9cd48cd72a75a268375e94be6d Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 7 Sep 2023 18:45:32 +0000 Subject: [PATCH 091/113] ANDROID: GKI: update ABI definition Regenerate ABU definition file to resolve ABI breakage caused by a private struct zs_pool: INFO: ABI DIFFERENCES HAVE BEEN DETECTED! INFO: type 'struct zs_pool' changed member 'atomic_t compaction_in_progress' was added Bug: 296365608 Change-Id: I477b6dbbdaf464b2fdf3e666b9696f1a79095a63 Signed-off-by: Suren Baghdasaryan --- android/abi_gki_aarch64.stg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index a4deca84a412..acf5a487d77e 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -62651,6 +62651,12 @@ member { type_id: 0x6720d32f offset: 11712 } +member { + id: 0x9ad71760 + name: "compaction_in_progress" + type_id: 0x74d29cf1 + offset: 17568 +} member { id: 0x583d51cc name: "companion_ports" @@ -265280,6 +265286,7 @@ struct_union { member_id: 0x868caa9e member_id: 0x8a67a9e5 member_id: 0x2d1fe43b + member_id: 0x9ad71760 } } struct_union { From e490b62fedc4603f249051e5327b89574cb02057 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Wed, 23 Aug 2023 17:29:46 +0800 Subject: [PATCH 092/113] FROMLIST: ufs: core: only suspend clock scaling if scale down If clock scale up and suspend clock scaling, ufs will keep high performance/power mode but no read/write requests on going. It is logic wrong and have power concern. Bug: 298004596 Link: https://lore.kernel.org/all/20230831130826.5592-2-peter.wang@mediatek.com/ Change-Id: I950ec28a506d7eb83c575d9bd482c41869e73848 Signed-off-by: Peter Wang --- 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 1df28ecf6226..a1ab4a71eab1 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1495,7 +1495,7 @@ static int ufshcd_devfreq_target(struct device *dev, ktime_to_us(ktime_sub(ktime_get(), start)), ret); out: - if (sched_clk_scaling_suspend_work) + if (sched_clk_scaling_suspend_work && !scale_up) queue_work(hba->clk_scaling.workq, &hba->clk_scaling.suspend_work); From 89434cbd2dabb56bedc633c1413bd168d7726454 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Wed, 23 Aug 2023 17:29:48 +0800 Subject: [PATCH 093/113] FROMLIST: ufs: core: fix abnormal scale up after scale down When no active_reqs, devfreq_monitor(Thread A) will suspend clock scaling. But it may have racing with clk_scaling.suspend_work(Thread B) and actually not suspend clock scaling(requue after suspend). Next time after polling_ms, devfreq_monitor read clk_scaling.window_start_t = 0 then scale up clock abnormal. Below is racing step: devfreq->work (Thread A) devfreq_monitor update_devfreq ..... ufshcd_devfreq_target queue_work(hba->clk_scaling.workq, 1 &hba->clk_scaling.suspend_work) ..... 5 queue_delayed_work(devfreq_wq, &devfreq->work, msecs_to_jiffies(devfreq->profile->polling_ms)); 2 hba->clk_scaling.suspend_work (Thread B) ufshcd_clk_scaling_suspend_work __ufshcd_suspend_clkscaling devfreq_suspend_device(hba->devfreq); 3 cancel_delayed_work_sync(&devfreq->work); 4 hba->clk_scaling.window_start_t = 0; ..... Bug: 298004596 Link: https://lore.kernel.org/all/20230831130826.5592-4-peter.wang@mediatek.com/ Change-Id: I3ea77255f1b3845e9dd7bf6b050f3e9ba1f5f3f2 Signed-off-by: Peter Wang --- drivers/ufs/core/ufshcd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index a1ab4a71eab1..3ff3301f5262 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1464,6 +1464,13 @@ static int ufshcd_devfreq_target(struct device *dev, return 0; } + /* Skip scaling clock when clock scaling is suspended */ + if (hba->clk_scaling.is_suspended) { + spin_unlock_irqrestore(hba->host->host_lock, irq_flags); + dev_warn(hba->dev, "clock scaling is suspended, skip"); + return 0; + } + if (!hba->clk_scaling.active_reqs) sched_clk_scaling_suspend_work = true; From 2eb5b31ac1e3398173e2bf5a042f638056b9fd7f Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Thu, 31 Aug 2023 21:08:25 +0800 Subject: [PATCH 094/113] FROMLIST: ufs: core: fix abnormal scale up after last cmd finish When ufshcd_clk_scaling_suspend_work(Thread A) running and new command coming, ufshcd_clk_scaling_start_busy(Thread B) may get host_lock after Thread A first time release host_lock. Then Thread A second time get host_lock will set clk_scaling.window_start_t = 0 which scale up clock abnormal next polling_ms time. Also inlines another __ufshcd_suspend_clkscaling calls. Below is racing step: 1 hba->clk_scaling.suspend_work (Thread A) ufshcd_clk_scaling_suspend_work 2 spin_lock_irqsave(hba->host->host_lock, irq_flags); 3 hba->clk_scaling.is_suspended = true; 4 spin_unlock_irqrestore(hba->host->host_lock, irq_flags); __ufshcd_suspend_clkscaling 7 spin_lock_irqsave(hba->host->host_lock, flags); 8 hba->clk_scaling.window_start_t = 0; 9 spin_unlock_irqrestore(hba->host->host_lock, flags); ufshcd_send_command (Thread B) ufshcd_clk_scaling_start_busy 5 spin_lock_irqsave(hba->host->host_lock, flags); .... 6 spin_unlock_irqrestore(hba->host->host_lock, flags); Bug: 298004596 Link: https://lore.kernel.org/all/20230831130826.5592-3-peter.wang@mediatek.com/ Change-Id: Ib208b1265107769005c4ae3f72d46b12c072b5c7 Signed-off-by: Peter Wang --- drivers/ufs/core/ufshcd.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 3ff3301f5262..430ae3d2fc8a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -294,7 +294,6 @@ static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); static int ufshcd_host_reset_and_restore(struct ufs_hba *hba); static void ufshcd_resume_clkscaling(struct ufs_hba *hba); static void ufshcd_suspend_clkscaling(struct ufs_hba *hba); -static void __ufshcd_suspend_clkscaling(struct ufs_hba *hba); static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up); static irqreturn_t ufshcd_intr(int irq, void *__hba); static int ufshcd_change_power_mode(struct ufs_hba *hba, @@ -1417,9 +1416,10 @@ static void ufshcd_clk_scaling_suspend_work(struct work_struct *work) return; } hba->clk_scaling.is_suspended = true; + hba->clk_scaling.window_start_t = 0; spin_unlock_irqrestore(hba->host->host_lock, irq_flags); - __ufshcd_suspend_clkscaling(hba); + devfreq_suspend_device(hba->devfreq); } static void ufshcd_clk_scaling_resume_work(struct work_struct *work) @@ -1608,16 +1608,6 @@ static void ufshcd_devfreq_remove(struct ufs_hba *hba) dev_pm_opp_remove(hba->dev, clki->max_freq); } -static void __ufshcd_suspend_clkscaling(struct ufs_hba *hba) -{ - unsigned long flags; - - devfreq_suspend_device(hba->devfreq); - spin_lock_irqsave(hba->host->host_lock, flags); - hba->clk_scaling.window_start_t = 0; - spin_unlock_irqrestore(hba->host->host_lock, flags); -} - static void ufshcd_suspend_clkscaling(struct ufs_hba *hba) { unsigned long flags; @@ -1630,11 +1620,12 @@ static void ufshcd_suspend_clkscaling(struct ufs_hba *hba) if (!hba->clk_scaling.is_suspended) { suspend = true; hba->clk_scaling.is_suspended = true; + hba->clk_scaling.window_start_t = 0; } spin_unlock_irqrestore(hba->host->host_lock, flags); if (suspend) - __ufshcd_suspend_clkscaling(hba); + devfreq_suspend_device(hba->devfreq); } static void ufshcd_resume_clkscaling(struct ufs_hba *hba) From e6ed59127c865d56c836747a23cf72cdae465e7b Mon Sep 17 00:00:00 2001 From: Kuniyuki Iwashima Date: Mon, 21 Aug 2023 10:55:05 -0700 Subject: [PATCH 095/113] UPSTREAM: af_unix: Fix null-ptr-deref in unix_stream_sendpage(). Bing-Jhong Billy Jheng reported null-ptr-deref in unix_stream_sendpage() with detailed analysis and a nice repro. unix_stream_sendpage() tries to add data to the last skb in the peer's recv queue without locking the queue. If the peer's FD is passed to another socket and the socket's FD is passed to the peer, there is a loop between them. If we close both sockets without receiving FD, the sockets will be cleaned up by garbage collection. The garbage collection iterates such sockets and unlinks skb with FD from the socket's receive queue under the queue's lock. So, there is a race where unix_stream_sendpage() could access an skb locklessly that is being released by garbage collection, resulting in use-after-free. To avoid the issue, unix_stream_sendpage() must lock the peer's recv queue. Note the issue does not exist in 6.5+ thanks to the recent sendpage() refactoring. This patch is originally written by Linus Torvalds. BUG: unable to handle page fault for address: ffff988004dd6870 PF: supervisor read access in kernel mode PF: error_code(0x0000) - not-present page PGD 0 P4D 0 PREEMPT SMP PTI CPU: 4 PID: 297 Comm: garbage_uaf Not tainted 6.1.46 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:kmem_cache_alloc_node+0xa2/0x1e0 Code: c0 0f 84 32 01 00 00 41 83 fd ff 74 10 48 8b 00 48 c1 e8 3a 41 39 c5 0f 85 1c 01 00 00 41 8b 44 24 28 49 8b 3c 24 48 8d 4a 40 <49> 8b 1c 06 4c 89 f0 65 48 0f c7 0f 0f 94 c0 84 c0 74 a1 41 8b 44 RSP: 0018:ffffc9000079fac0 EFLAGS: 00000246 RAX: 0000000000000070 RBX: 0000000000000005 RCX: 000000000001a284 RDX: 000000000001a244 RSI: 0000000000400cc0 RDI: 000000000002eee0 RBP: 0000000000400cc0 R08: 0000000000400cc0 R09: 0000000000000003 R10: 0000000000000001 R11: 0000000000000000 R12: ffff888003970f00 R13: 00000000ffffffff R14: ffff988004dd6800 R15: 00000000000000e8 FS: 00007f174d6f3600(0000) GS:ffff88807db00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff988004dd6870 CR3: 00000000092be000 CR4: 00000000007506e0 PKRU: 55555554 Call Trace: ? __die_body.cold+0x1a/0x1f ? page_fault_oops+0xa9/0x1e0 ? fixup_exception+0x1d/0x310 ? exc_page_fault+0xa8/0x150 ? asm_exc_page_fault+0x22/0x30 ? kmem_cache_alloc_node+0xa2/0x1e0 ? __alloc_skb+0x16c/0x1e0 __alloc_skb+0x16c/0x1e0 alloc_skb_with_frags+0x48/0x1e0 sock_alloc_send_pskb+0x234/0x270 unix_stream_sendmsg+0x1f5/0x690 sock_sendmsg+0x5d/0x60 ____sys_sendmsg+0x210/0x260 ___sys_sendmsg+0x83/0xd0 ? kmem_cache_alloc+0xc6/0x1c0 ? avc_disable+0x20/0x20 ? percpu_counter_add_batch+0x53/0xc0 ? alloc_empty_file+0x5d/0xb0 ? alloc_file+0x91/0x170 ? alloc_file_pseudo+0x94/0x100 ? __fget_light+0x9f/0x120 __sys_sendmsg+0x54/0xa0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x69/0xd3 RIP: 0033:0x7f174d639a7d Code: 28 89 54 24 1c 48 89 74 24 10 89 7c 24 08 e8 8a c1 f4 ff 8b 54 24 1c 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 33 44 89 c7 48 89 44 24 08 e8 de c1 f4 ff 48 RSP: 002b:00007ffcb563ea50 EFLAGS: 00000293 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f174d639a7d RDX: 0000000000000000 RSI: 00007ffcb563eab0 RDI: 0000000000000007 RBP: 00007ffcb563eb10 R08: 0000000000000000 R09: 00000000ffffffff R10: 00000000004040a0 R11: 0000000000000293 R12: 00007ffcb563ec28 R13: 0000000000401398 R14: 0000000000403e00 R15: 00007f174d72c000 Bug: 299922588 Fixes: 869e7c62486e ("net: af_unix: implement stream sendpage support") Reported-by: Bing-Jhong Billy Jheng Reviewed-by: Bing-Jhong Billy Jheng Co-developed-by: Linus Torvalds Signed-off-by: Linus Torvalds Signed-off-by: Kuniyuki Iwashima Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 790c2f9d15b594350ae9bca7b236f2b1859de02c) Signed-off-by: Lee Jones Change-Id: Ied4a40e6ae0e594ef84f36287bc6194602935585 --- net/unix/af_unix.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 8c05d9aaaefd..999182d3c1a2 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2290,6 +2290,7 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page, if (false) { alloc_skb: + spin_unlock(&other->sk_receive_queue.lock); unix_state_unlock(other); mutex_unlock(&unix_sk(other)->iolock); newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, @@ -2329,6 +2330,7 @@ alloc_skb: init_scm = false; } + spin_lock(&other->sk_receive_queue.lock); skb = skb_peek_tail(&other->sk_receive_queue); if (tail && tail == skb) { skb = newskb; @@ -2359,14 +2361,11 @@ alloc_skb: refcount_add(size, &sk->sk_wmem_alloc); if (newskb) { - err = unix_scm_to_skb(&scm, skb, false); - if (err) - goto err_state_unlock; - spin_lock(&other->sk_receive_queue.lock); + unix_scm_to_skb(&scm, skb, false); __skb_queue_tail(&other->sk_receive_queue, newskb); - spin_unlock(&other->sk_receive_queue.lock); } + spin_unlock(&other->sk_receive_queue.lock); unix_state_unlock(other); mutex_unlock(&unix_sk(other)->iolock); From 0500235e3f9d430936afc1377ac2efd76487ae9a Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Thu, 13 Jul 2023 12:56:21 -0700 Subject: [PATCH 096/113] ANDROID: vendor_hook: Add vendor hook to decide scan abort policy Allow vendor hook to enable checking of the high water marks to decide if reclaim should continue scanning. Bug: 224956008 Change-Id: I63fe1fd386e7599451c2df0a04c8440b4fc142fc Signed-off-by: Kalesh Singh --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/vmscan.h | 3 ++ mm/vmscan.c | 51 ++++++++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b42e7f6ee83e..0c754ba4dd5d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -327,3 +327,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_amu_fie); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_scan_abort_check_wmarks); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index e6594ca0d299..625d30d75757 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -46,6 +46,9 @@ DECLARE_HOOK(android_vh_tune_scan_type, DECLARE_HOOK(android_vh_tune_swappiness, TP_PROTO(int *swappiness), TP_ARGS(swappiness)); +DECLARE_HOOK(android_vh_scan_abort_check_wmarks, + TP_PROTO(bool *check_wmarks), + TP_ARGS(check_wmarks)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index 6be9bee3eca1..647e4c0aa0bd 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5277,11 +5277,51 @@ static unsigned long get_nr_to_reclaim(struct scan_control *sc) return max(sc->nr_to_reclaim, compact_gap(sc->order)); } +static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc) +{ + unsigned long nr_to_reclaim = get_nr_to_reclaim(sc); + bool check_wmarks = false; + int i; + + if (sc->nr_reclaimed >= nr_to_reclaim) + return true; + + trace_android_vh_scan_abort_check_wmarks(&check_wmarks); + + if (!check_wmarks) + return false; + + if (!current_is_kswapd()) + return false; + + for (i = 0; i <= sc->reclaim_idx; i++) { + unsigned long wmark; + struct zone *zone = lruvec_pgdat(lruvec)->node_zones + i; + + if (!managed_zone(zone)) + continue; + + if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) + wmark = wmark_pages(zone, WMARK_PROMO); + else + wmark = high_wmark_pages(zone); + + /* + * Abort scan once the target number of order zero pages are met. + * Reclaim MIN_LRU_BATCH << 2 to facilitate immediate kswapd sleep. + */ + wmark += MIN_LRU_BATCH << 2; + if (!zone_watermark_ok_safe(zone, 0, wmark, sc->reclaim_idx)) + return false; + } + + return true; +} + static bool try_to_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) { long nr_to_scan; unsigned long scanned = 0; - unsigned long nr_to_reclaim = get_nr_to_reclaim(sc); int swappiness = get_swappiness(lruvec, sc); /* clean file folios are more likely to exist */ @@ -5303,7 +5343,7 @@ static bool try_to_shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) if (scanned >= nr_to_scan) break; - if (sc->nr_reclaimed >= nr_to_reclaim) + if (should_abort_scan(lruvec, sc)) break; cond_resched(); @@ -5362,10 +5402,9 @@ static void shrink_many(struct pglist_data *pgdat, struct scan_control *sc) int bin; int first_bin; struct lruvec *lruvec; - struct lru_gen_folio *lrugen; + struct lru_gen_folio *lrugen = NULL; struct mem_cgroup *memcg; const struct hlist_nulls_node *pos; - unsigned long nr_to_reclaim = get_nr_to_reclaim(sc); bin = first_bin = get_random_u32_below(MEMCG_NR_BINS); restart: @@ -5396,7 +5435,7 @@ restart: rcu_read_lock(); - if (sc->nr_reclaimed >= nr_to_reclaim) + if (should_abort_scan(lruvec, sc)) break; } @@ -5407,7 +5446,7 @@ restart: mem_cgroup_put(memcg); - if (sc->nr_reclaimed >= nr_to_reclaim) + if (lruvec && should_abort_scan(lruvec, sc)) return; /* restart if raced with lru_gen_rotate_memcg() */ From 3a51a619270161f4f0ec95e36d5cfdfacb14148e Mon Sep 17 00:00:00 2001 From: Charan Teja Kalla Date: Tue, 12 Sep 2023 11:45:07 +0530 Subject: [PATCH 097/113] ANDROID: abi_gki_aarch64_qcom: white list symbols for mglru overshoot Whitelist the below symbols that can be used to decide if overshooting of kswapd reclaim is allowed. Symbols added: __traceiter_android_vh_scan_abort_check_wmarks __tracepoint_android_vh_scan_abort_check_wmarks Bug: 224956008 Change-Id: I185a570b345d2db0a1426075faa4d9c6325fb0e8 Signed-off-by: Charan Teja Kalla Signed-off-by: Kalesh Singh --- 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 acf5a487d77e..6b1d2524bb8b 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -330379,6 +330379,15 @@ elf_symbol { type_id: 0x9b9f0206 full_name: "__traceiter_android_vh_save_hib_resume_bdev" } +elf_symbol { + id: 0x06c7b387 + name: "__traceiter_android_vh_scan_abort_check_wmarks" + is_defined: true + symbol_type: FUNCTION + crc: 0x48b7d14f + type_id: 0x9be885da + full_name: "__traceiter_android_vh_scan_abort_check_wmarks" +} elf_symbol { id: 0x3a4e20d6 name: "__traceiter_android_vh_sched_pelt_multiplier" @@ -333754,6 +333763,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_save_hib_resume_bdev" } +elf_symbol { + id: 0x8b4c2f61 + name: "__tracepoint_android_vh_scan_abort_check_wmarks" + is_defined: true + symbol_type: OBJECT + crc: 0x814e8595 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_scan_abort_check_wmarks" +} elf_symbol { id: 0xb3b18fc4 name: "__tracepoint_android_vh_sched_pelt_multiplier" @@ -388126,6 +388144,7 @@ interface { symbol_id: 0x947bd437 symbol_id: 0xbdbb0c65 symbol_id: 0xa1325610 + symbol_id: 0x06c7b387 symbol_id: 0x3a4e20d6 symbol_id: 0x237634b3 symbol_id: 0xb5ed74f6 @@ -388501,6 +388520,7 @@ interface { symbol_id: 0xbe3d9b79 symbol_id: 0x30004003 symbol_id: 0xb91d18b6 + symbol_id: 0x8b4c2f61 symbol_id: 0xb3b18fc4 symbol_id: 0x40d6a8c5 symbol_id: 0x931fa088 diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index 2e7e84cbdbe6..a245078f791d 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -3401,6 +3401,7 @@ __traceiter_android_vh_rproc_recovery_set __traceiter_android_vh_save_cpu_resume __traceiter_android_vh_save_hib_resume_bdev + __traceiter_android_vh_scan_abort_check_wmarks __traceiter_android_vh_scheduler_tick __traceiter_android_vh_setscheduler_uclamp __traceiter_android_vh_show_resume_epoch_val @@ -3546,6 +3547,7 @@ __tracepoint_android_vh_rproc_recovery_set __tracepoint_android_vh_save_cpu_resume __tracepoint_android_vh_save_hib_resume_bdev + __tracepoint_android_vh_scan_abort_check_wmarks __tracepoint_android_vh_scheduler_tick __tracepoint_android_vh_setscheduler_uclamp __tracepoint_android_vh_show_resume_epoch_val From 6e5f1821281fd8b67e7033f3a07d14d4d18588f9 Mon Sep 17 00:00:00 2001 From: zhengtangquan Date: Wed, 6 Sep 2023 10:39:36 +0800 Subject: [PATCH 098/113] ANDROID: signal: Add vendor hook for memory reap Add vendor hook to determine if the memory of a process that received the SIGKILL can be reaped. Partial cherry-pick of aosp/1724512 & aosp/2093626. Bug: 232062955 Change-Id: I75072bd264df33caff67d083821ee6f33ca83af9 Signed-off-by: Tangquan Zheng --- drivers/android/vendor_hooks.c | 1 + include/linux/oom.h | 2 ++ include/trace/hooks/signal.h | 3 +++ kernel/signal.c | 11 ++++++++++- mm/oom_kill.c | 31 +++++++++++++++++++++++++++---- 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 0c754ba4dd5d..104e4eb48ff9 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -85,6 +85,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_set_priority); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_restore_priority); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wakeup_ilocked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_send_sig_info); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_killed_process); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_wait_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_wait_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_init); diff --git a/include/linux/oom.h b/include/linux/oom.h index 7d0c9c48a0c5..f008e23d9b41 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -112,4 +112,6 @@ extern void oom_killer_enable(void); extern struct task_struct *find_lock_task_mm(struct task_struct *p); +/* call for adding killed process to reaper. */ +extern void add_to_oom_reaper(struct task_struct *p); #endif /* _INCLUDE_LINUX_OOM_H */ diff --git a/include/trace/hooks/signal.h b/include/trace/hooks/signal.h index 4e61006cb145..c845aec359d7 100644 --- a/include/trace/hooks/signal.h +++ b/include/trace/hooks/signal.h @@ -14,6 +14,9 @@ DECLARE_HOOK(android_vh_do_send_sig_info, DECLARE_HOOK(android_vh_exit_signal, TP_PROTO(struct task_struct *task), TP_ARGS(task)); +DECLARE_HOOK(android_vh_killed_process, + TP_PROTO(struct task_struct *killer, struct task_struct *dst, bool *reap), + TP_ARGS(killer, dst, reap)); #endif /* _TRACE_HOOK_SIGNAL_H */ /* This part must be outside protection */ #include diff --git a/kernel/signal.c b/kernel/signal.c index 3b3204c26641..2f90f315ec1b 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -45,6 +45,7 @@ #include #include #include +#include #define CREATE_TRACE_POINTS #include @@ -1448,8 +1449,16 @@ int group_send_sig_info(int sig, struct kernel_siginfo *info, ret = check_kill_permission(sig, info, p); rcu_read_unlock(); - if (!ret && sig) + if (!ret && sig) { ret = do_send_sig_info(sig, info, p, type); + if (!ret && sig == SIGKILL) { + bool reap = false; + + trace_android_vh_killed_process(current, p, &reap); + if (reap) + add_to_oom_reaper(p); + } + } return ret; } diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 1276e49b31b0..2c5b854f767b 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -745,6 +745,19 @@ static inline void queue_oom_reaper(struct task_struct *tsk) } #endif /* CONFIG_MMU */ +/** + * tsk->mm has to be non NULL and caller has to guarantee it is stable (either + * under task_lock or operate on the current). + */ +static void __mark_oom_victim(struct task_struct *tsk) +{ + struct mm_struct *mm = tsk->mm; + + if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) { + mmgrab(tsk->signal->oom_mm); + } +} + /** * mark_oom_victim - mark the given task as OOM victim * @tsk: task to mark @@ -757,16 +770,13 @@ static inline void queue_oom_reaper(struct task_struct *tsk) */ static void mark_oom_victim(struct task_struct *tsk) { - struct mm_struct *mm = tsk->mm; - WARN_ON(oom_killer_disabled); /* OOM killer might race with memcg OOM */ if (test_and_set_tsk_thread_flag(tsk, TIF_MEMDIE)) return; /* oom_mm is bound to the signal struct life time. */ - if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) - mmgrab(tsk->signal->oom_mm); + __mark_oom_victim(tsk); /* * Make sure that the task is woken up from uninterruptible sleep @@ -1260,3 +1270,16 @@ put_task: return -ENOSYS; #endif /* CONFIG_MMU */ } + +void add_to_oom_reaper(struct task_struct *p) +{ + p = find_lock_task_mm(p); + if (!p) + return; + + if (task_will_free_mem(p)) { + __mark_oom_victim(p); + queue_oom_reaper(p); + } + task_unlock(p); +} From 7579b22626ff63d1e755c7afe0e6a82b879f939e Mon Sep 17 00:00:00 2001 From: zhengtangquan Date: Wed, 6 Sep 2023 10:43:51 +0800 Subject: [PATCH 099/113] ANDROID: GKI: Add symbols to symbol list for oplus 1 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_killed_process' 1 variable symbol(s) added 'struct tracepoint __tracepoint_android_vh_killed_process' Bug: 232062955 Change-Id: I8ae3cdd8f8b7a953d76349d3299b6b9b87ab8707 Signed-off-by: Tangquan Zheng --- android/abi_gki_aarch64.stg | 28 ++++++++++++++++++++++++++++ android/abi_gki_aarch64_oplus | 2 ++ 2 files changed, 30 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 6b1d2524bb8b..d2cdb28ed0bb 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -313702,6 +313702,14 @@ function { parameter_id: 0x1d19a9d5 parameter_id: 0x13580d6c } +function { + id: 0x9bdcdd91 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x1d19a9d5 + parameter_id: 0x1d19a9d5 + parameter_id: 0x11cfee5a +} function { id: 0x9bdcf60d return_type_id: 0x6720d32f @@ -329848,6 +329856,15 @@ elf_symbol { type_id: 0x9bcd4ff7 full_name: "__traceiter_android_vh_jiffies_update" } +elf_symbol { + id: 0xe261e8cc + name: "__traceiter_android_vh_killed_process" + is_defined: true + symbol_type: FUNCTION + crc: 0x593713f5 + type_id: 0x9bdcdd91 + full_name: "__traceiter_android_vh_killed_process" +} elf_symbol { id: 0x18fde973 name: "__traceiter_android_vh_kswapd_per_node" @@ -333232,6 +333249,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_android_vh_jiffies_update" } +elf_symbol { + id: 0xa48390ca + name: "__tracepoint_android_vh_killed_process" + is_defined: true + symbol_type: OBJECT + crc: 0xe41a7380 + type_id: 0x18ccbd2c + full_name: "__tracepoint_android_vh_killed_process" +} elf_symbol { id: 0x586a06d1 name: "__tracepoint_android_vh_kswapd_per_node" @@ -388085,6 +388111,7 @@ interface { symbol_id: 0x0bf41403 symbol_id: 0x4dca46cc symbol_id: 0xf83fbd26 + symbol_id: 0xe261e8cc symbol_id: 0x18fde973 symbol_id: 0xe19d2bf8 symbol_id: 0x993f42ff @@ -388461,6 +388488,7 @@ interface { symbol_id: 0x31457bed symbol_id: 0x62c13726 symbol_id: 0xafbca760 + symbol_id: 0xa48390ca symbol_id: 0x586a06d1 symbol_id: 0xda2d53f2 symbol_id: 0x50a5a949 diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 3aebc62c3c00..1e638ea28886 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -130,6 +130,7 @@ __traceiter_android_vh_check_folio_look_around_ref __traceiter_android_vh_dup_task_struct __traceiter_android_vh_exit_signal + __traceiter_android_vh_killed_process __traceiter_android_vh_look_around __traceiter_android_vh_look_around_migrate_folio __traceiter_android_vh_mem_cgroup_id_remove @@ -199,6 +200,7 @@ __tracepoint_android_vh_dup_task_struct __tracepoint_android_vh_exit_check __tracepoint_android_vh_exit_signal + __tracepoint_android_vh_killed_process __tracepoint_android_vh_exit_signal_whether_wake __tracepoint_android_vh_mem_cgroup_id_remove __tracepoint_android_vh_mem_cgroup_css_offline From c2ac612610e014cc446137b1f0b3ba1e3bbafc34 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Thu, 10 Aug 2023 22:45:32 -0700 Subject: [PATCH 100/113] BACKPORT: printk: ringbuffer: Fix truncating buffer size min_t cast If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in copy_data() was causing writes to truncate. This manifested as output bytes being skipped, seen as %NUL bytes in pstore dumps when the available record size was larger than 65536. Fix the cast to no longer truncate the calculation. Bug: 300230860 (cherry picked from commit 53e9e33ede37a247d926db5e4a9e56b55204e66c) Change-Id: I1b55761335aba6fa39f00306f7b0255c2afd0849 Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: John Ogness Reported-by: Vijay Balakrishna Link: https://lore.kernel.org/lkml/d8bb1ec7-a4c5-43a2-9de0-9643a70b899f@linux.microsoft.com/ Fixes: b6cf8b3f3312 ("printk: add lockless ringbuffer") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Tested-by: Vijay Balakrishna Tested-by: Guilherme G. Piccoli # Steam Deck Reviewed-by: Tyler Hicks (Microsoft) Tested-by: Tyler Hicks (Microsoft) Reviewed-by: John Ogness Reviewed-by: Sergey Senozhatsky Reviewed-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20230811054528.never.165-kees@kernel.org Signed-off-by: Enlin Mu --- kernel/printk/printk_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c index 2b7b6ddab4f7..0bbcd1344f21 100644 --- a/kernel/printk/printk_ringbuffer.c +++ b/kernel/printk/printk_ringbuffer.c @@ -1735,7 +1735,7 @@ static bool copy_data(struct prb_data_ring *data_ring, if (!buf || !buf_size) return true; - data_size = min_t(u16, buf_size, len); + data_size = min_t(unsigned int, buf_size, len); memcpy(&buf[0], data, data_size); /* LMM(copy_data:A) */ return true; From 85902d60cd82da3491985e7f5967e60d2a871a89 Mon Sep 17 00:00:00 2001 From: Sangmoon Kim Date: Wed, 13 Sep 2023 15:05:14 +0900 Subject: [PATCH 101/113] ANDROID: ABI: update symbol list for galaxy 1 function symbol(s) added 'int __traceiter_error_report_end(void*, enum error_detector, unsigned long)' 1 variable symbol(s) added 'struct tracepoint __tracepoint_error_report_end' Bug: 300201494 Change-Id: I558abcc6f2d4bcae873687fc58d52228d0d53436 Signed-off-by: Sangmoon Kim --- android/abi_gki_aarch64.stg | 45 ++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_galaxy | 2 ++ 2 files changed, 47 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index d2cdb28ed0bb..43192034b59f 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -271397,6 +271397,24 @@ enumeration { } } } +enumeration { + id: 0x63bb62a2 + name: "error_detector" + definition { + underlying_type_id: 0x4585663f + enumerator { + name: "ERROR_DETECTOR_KFENCE" + } + enumerator { + name: "ERROR_DETECTOR_KASAN" + value: 1 + } + enumerator { + name: "ERROR_DETECTOR_WARN" + value: 2 + } + } +} enumeration { id: 0xcd568da6 name: "ethtool_link_ext_state" @@ -309322,6 +309340,13 @@ function { parameter_id: 0x6720d32f parameter_id: 0x1d19a9d5 } +function { + id: 0x9a2d8ab0 + return_type_id: 0x6720d32f + parameter_id: 0x18bd6530 + parameter_id: 0x63bb62a2 + parameter_id: 0x33756485 +} function { id: 0x9a2dc3fa return_type_id: 0x6720d32f @@ -331008,6 +331033,15 @@ elf_symbol { type_id: 0x9ba39408 full_name: "__traceiter_dma_fence_emit" } +elf_symbol { + id: 0x5e5d9a70 + name: "__traceiter_error_report_end" + is_defined: true + symbol_type: FUNCTION + crc: 0xd29c1f10 + type_id: 0x9a2d8ab0 + full_name: "__traceiter_error_report_end" +} elf_symbol { id: 0x104ffeec name: "__traceiter_gpu_mem_total" @@ -334401,6 +334435,15 @@ elf_symbol { type_id: 0x18ccbd2c full_name: "__tracepoint_dma_fence_emit" } +elf_symbol { + id: 0x3b13741e + name: "__tracepoint_error_report_end" + is_defined: true + symbol_type: OBJECT + crc: 0x0a463293 + type_id: 0x18ccbd2c + full_name: "__tracepoint_error_report_end" +} elf_symbol { id: 0xd8f3ca82 name: "__tracepoint_gpu_mem_total" @@ -388239,6 +388282,7 @@ interface { symbol_id: 0x7e705ab7 symbol_id: 0x7b03aae7 symbol_id: 0x92373f85 + symbol_id: 0x5e5d9a70 symbol_id: 0x104ffeec symbol_id: 0x6d4f31c4 symbol_id: 0xcf61fd25 @@ -388616,6 +388660,7 @@ interface { symbol_id: 0xbf086359 symbol_id: 0xef6e6795 symbol_id: 0xb2d6f207 + symbol_id: 0x3b13741e symbol_id: 0xd8f3ca82 symbol_id: 0xff315556 symbol_id: 0x6d72699f diff --git a/android/abi_gki_aarch64_galaxy b/android/abi_gki_aarch64_galaxy index d14cade9b61a..01f6927b0592 100644 --- a/android/abi_gki_aarch64_galaxy +++ b/android/abi_gki_aarch64_galaxy @@ -359,6 +359,7 @@ __traceiter_android_vh_wq_lockup_pool __traceiter_block_rq_insert __traceiter_console + __traceiter_error_report_end __traceiter_hrtimer_expire_entry __traceiter_hrtimer_expire_exit __traceiter_irq_handler_entry @@ -400,6 +401,7 @@ __tracepoint_android_vh_watchdog_timer_softlockup __tracepoint_android_vh_wq_lockup_pool __tracepoint_block_rq_insert + __tracepoint_error_report_end __tracepoint_console __tracepoint_hrtimer_expire_entry __tracepoint_hrtimer_expire_exit From de3e9f3111789ffb6dcc8d1ff6aa6ea632d6d3fc Mon Sep 17 00:00:00 2001 From: Venkata Rao Kakani Date: Wed, 13 Sep 2023 12:21:14 +0530 Subject: [PATCH 102/113] ANDROID: ABI: Add to QCOM symbols list Symbols updated to QCOM abi symbol list: bio_split dm_bufio_client_create dm_bufio_client_destroy dm_bufio_mark_buffer_dirty dm_bufio_new dm_bufio_read dm_bufio_release dm_bufio_write_dirty_buffers dm_disk dm_get_device dm_kobject_release dm_read_arg_group dm_register_target dm_shift_arg dm_table_get_md dm_table_get_mode dm_unregister_target Bug: 300189063 Change-Id: I0bfe7093e12074218384d645123fbb8854615162 Signed-off-by: Venkata Rao Kakani --- android/abi_gki_aarch64.stg | 2236 ++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_qcom | 17 + 2 files changed, 2253 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 43192034b59f..125b8f0bc578 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -158,6 +158,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x285ee61e } +pointer_reference { + id: 0x0087f4f8 + kind: POINTER + pointee_type_id: 0x285f357e +} pointer_reference { id: 0x0092c032 kind: POINTER @@ -578,6 +583,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x225b7cde } +pointer_reference { + id: 0x0206e829 + kind: POINTER + pointee_type_id: 0x225b463b +} pointer_reference { id: 0x020c1a12 kind: POINTER @@ -2583,6 +2593,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x0cfb4b7c } +pointer_reference { + id: 0x09b53a9f + kind: POINTER + pointee_type_id: 0x0c940ce3 +} pointer_reference { id: 0x09bb9b7e kind: POINTER @@ -3363,6 +3378,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1a8d07bb } +pointer_reference { + id: 0x0c33de94 + kind: POINTER + pointee_type_id: 0x1a8f9ccc +} pointer_reference { id: 0x0c3509f9 kind: POINTER @@ -3463,6 +3483,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1b5d6044 } +pointer_reference { + id: 0x0c483694 + kind: POINTER + pointee_type_id: 0x1b603ccd +} pointer_reference { id: 0x0c485c36 kind: POINTER @@ -4623,6 +4648,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1f060fb8 } +pointer_reference { + id: 0x0d52f144 + kind: POINTER + pointee_type_id: 0x1f0b238f +} pointer_reference { id: 0x0d53cd40 kind: POINTER @@ -4658,6 +4688,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1f202bf3 } +pointer_reference { + id: 0x0d599e4a + kind: POINTER + pointee_type_id: 0x1f269fb6 +} pointer_reference { id: 0x0d5a6860 kind: POINTER @@ -4713,6 +4748,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1fde992a } +pointer_reference { + id: 0x0d6927be + kind: POINTER + pointee_type_id: 0x1fe47867 +} pointer_reference { id: 0x0d6b4ee3 kind: POINTER @@ -5183,6 +5223,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x1cbe3d95 } +pointer_reference { + id: 0x0dc11255 + kind: POINTER + pointee_type_id: 0x1d44afc8 +} pointer_reference { id: 0x0dc35132 kind: POINTER @@ -7088,6 +7133,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x17d51999 } +pointer_reference { + id: 0x0f65ebe2 + kind: POINTER + pointee_type_id: 0x17d74917 +} pointer_reference { id: 0x0f67218c kind: POINTER @@ -7513,6 +7563,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x154ed535 } +pointer_reference { + id: 0x0fc3c654 + kind: POINTER + pointee_type_id: 0x154fffcf +} pointer_reference { id: 0x0fc46487 kind: POINTER @@ -8558,6 +8613,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x7bdc8a60 } +pointer_reference { + id: 0x146a39bf + kind: POINTER + pointee_type_id: 0x7be80061 +} pointer_reference { id: 0x14731fc7 kind: POINTER @@ -10378,6 +10438,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x5f502f26 } +pointer_reference { + id: 0x1d44afc8 + kind: POINTER + pointee_type_id: 0x5f5259bd +} pointer_reference { id: 0x1d44eec5 kind: POINTER @@ -11228,6 +11293,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xa8a462e4 } +pointer_reference { + id: 0x20bba379 + kind: POINTER + pointee_type_id: 0xa8ae6b7a +} pointer_reference { id: 0x20d23755 kind: POINTER @@ -12713,6 +12783,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x8b3c441e } +pointer_reference { + id: 0x285f357e + kind: POINTER + pointee_type_id: 0x8b3c3364 +} pointer_reference { id: 0x2862f859 kind: POINTER @@ -13408,6 +13483,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x84ef9574 } +pointer_reference { + id: 0x2bae2afe + kind: POINTER + pointee_type_id: 0x84f84d67 +} pointer_reference { id: 0x2bb01e4c kind: POINTER @@ -15413,6 +15493,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x98881e2d } +pointer_reference { + id: 0x2cb2c9fe + kind: POINTER + pointee_type_id: 0x988bc164 +} pointer_reference { id: 0x2cb3cf30 kind: POINTER @@ -16093,6 +16178,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9e4766bb } +pointer_reference { + id: 0x2d01fcba + kind: POINTER + pointee_type_id: 0x9e471477 +} pointer_reference { id: 0x2d0240fc kind: POINTER @@ -17148,6 +17238,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9f9d90bf } +pointer_reference { + id: 0x2d77f22a + kind: POINTER + pointee_type_id: 0x9f9f2e37 +} pointer_reference { id: 0x2d7870f7 kind: POINTER @@ -18673,6 +18768,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x92075c0f } +pointer_reference { + id: 0x2e133d23 + kind: POINTER + pointee_type_id: 0x920c1213 +} pointer_reference { id: 0x2e136b7a kind: POINTER @@ -18698,6 +18798,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9215c28e } +pointer_reference { + id: 0x2e157919 + kind: POINTER + pointee_type_id: 0x921502fa +} pointer_reference { id: 0x2e160375 kind: POINTER @@ -18803,6 +18908,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x92d3b873 } +pointer_reference { + id: 0x2e2690ae + kind: POINTER + pointee_type_id: 0x92daa424 +} pointer_reference { id: 0x2e27223f kind: POINTER @@ -18858,6 +18968,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x92fce902 } +pointer_reference { + id: 0x2e2f0b11 + kind: POINTER + pointee_type_id: 0x92fccadb +} pointer_reference { id: 0x2e2ff28a kind: POINTER @@ -18883,6 +18998,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x92878d53 } +pointer_reference { + id: 0x2e323a43 + kind: POINTER + pointee_type_id: 0x92880f91 +} pointer_reference { id: 0x2e334b9e kind: POINTER @@ -18898,6 +19018,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x929702b9 } +pointer_reference { + id: 0x2e360c76 + kind: POINTER + pointee_type_id: 0x9298d745 +} pointer_reference { id: 0x2e36aac4 kind: POINTER @@ -18918,6 +19043,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x92a82deb } +pointer_reference { + id: 0x2e3aa811 + kind: POINTER + pointee_type_id: 0x92aa46db +} pointer_reference { id: 0x2e3afbd5 kind: POINTER @@ -18933,11 +19063,21 @@ pointer_reference { kind: POINTER pointee_type_id: 0x92ae55cd } +pointer_reference { + id: 0x2e3beeb2 + kind: POINTER + pointee_type_id: 0x92af5c55 +} pointer_reference { id: 0x2e3de161 kind: POINTER pointee_type_id: 0x92b76318 } +pointer_reference { + id: 0x2e3f95bc + kind: POINTER + pointee_type_id: 0x92beb06d +} pointer_reference { id: 0x2e3fe61b kind: POINTER @@ -19218,6 +19358,16 @@ pointer_reference { kind: POINTER pointee_type_id: 0x93e8e7b0 } +pointer_reference { + id: 0x2e6a357b + kind: POINTER + pointee_type_id: 0x93e83373 +} +pointer_reference { + id: 0x2e6a35a0 + kind: POINTER + pointee_type_id: 0x93e8301d +} pointer_reference { id: 0x2e6c8788 kind: POINTER @@ -19588,6 +19738,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x9090fcd9 } +pointer_reference { + id: 0x2eb464c1 + kind: POINTER + pointee_type_id: 0x90917599 +} pointer_reference { id: 0x2eb4795d kind: POINTER @@ -20623,6 +20778,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0x96d126d3 } +pointer_reference { + id: 0x2f24a589 + kind: POINTER + pointee_type_id: 0x96d270ba +} pointer_reference { id: 0x2f25d7c2 kind: POINTER @@ -23063,6 +23223,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xe1c969cb } +pointer_reference { + id: 0x32e4574b + kind: POINTER + pointee_type_id: 0xe1d1bbb1 +} pointer_reference { id: 0x32e49390 kind: POINTER @@ -24653,6 +24818,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xf2c78cfb } +pointer_reference { + id: 0x3622fa2a + kind: POINTER + pointee_type_id: 0xf2cb0e35 +} pointer_reference { id: 0x3626871f kind: POINTER @@ -27093,6 +27263,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xc50a1b96 } +pointer_reference { + id: 0x3bd6fa3a + kind: POINTER + pointee_type_id: 0xc51b0e75 +} pointer_reference { id: 0x3bd9eb0b kind: POINTER @@ -27118,6 +27293,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xc5d356cb } +pointer_reference { + id: 0x3be6380c + kind: POINTER + pointee_type_id: 0xc5d806af +} pointer_reference { id: 0x3be64ffd kind: POINTER @@ -27558,6 +27738,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xde680909 } +pointer_reference { + id: 0x3d1364e9 + kind: POINTER + pointee_type_id: 0xde0d753a +} pointer_reference { id: 0x3d1ec847 kind: POINTER @@ -27948,6 +28133,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xddfa054d } +pointer_reference { + id: 0x3df0a7d3 + kind: POINTER + pointee_type_id: 0xdd8279d0 +} pointer_reference { id: 0x3df7e337 kind: POINTER @@ -28063,6 +28253,11 @@ pointer_reference { kind: POINTER pointee_type_id: 0xd2e61f73 } +pointer_reference { + id: 0x3e2a5e3d + kind: POINTER + pointee_type_id: 0xd2e99e69 +} pointer_reference { id: 0x3e2de599 kind: POINTER @@ -29113,6 +29308,11 @@ typedef { name: "blk_qc_t" referred_type_id: 0x4585663f } +typedef { + id: 0xa47a28f3 + name: "blk_short_t" + referred_type_id: 0x914dbfdc +} typedef { id: 0x7be80061 name: "blk_status_t" @@ -29338,6 +29538,116 @@ typedef { name: "dio_submit_t" referred_type_id: 0x15976e28 } +typedef { + id: 0x7722f5fe + name: "dm_busy_fn" + referred_type_id: 0x2e2f0b11 +} +typedef { + id: 0x81034bb7 + name: "dm_clone_and_map_request_fn" + referred_type_id: 0x2e323a43 +} +typedef { + id: 0xec2f5289 + name: "dm_ctr_fn" + referred_type_id: 0x2e6a357b +} +typedef { + id: 0x5833b757 + name: "dm_dax_direct_access_fn" + referred_type_id: 0x20bba379 +} +typedef { + id: 0xdbb955db + name: "dm_dax_recovery_write_fn" + referred_type_id: 0x2cb2c9fe +} +typedef { + id: 0xc272516a + name: "dm_dax_zero_page_range_fn" + referred_type_id: 0x2e133d23 +} +typedef { + id: 0xdee852ab + name: "dm_dtr_fn" + referred_type_id: 0x0d6927be +} +typedef { + id: 0x72f27b5e + name: "dm_endio_fn" + referred_type_id: 0x2e3beeb2 +} +typedef { + id: 0x5d27fec1 + name: "dm_io_hints_fn" + referred_type_id: 0x0d52f144 +} +typedef { + id: 0x4944b34e + name: "dm_iterate_devices_fn" + referred_type_id: 0x2eb464c1 +} +typedef { + id: 0x7abd5475 + name: "dm_map_fn" + referred_type_id: 0x2e3aa811 +} +typedef { + id: 0x4a37c87b + name: "dm_message_fn" + referred_type_id: 0x2e6a35a0 +} +typedef { + id: 0x540fc033 + name: "dm_postsuspend_fn" + referred_type_id: 0x0d6927be +} +typedef { + id: 0xb5818a23 + name: "dm_prepare_ioctl_fn" + referred_type_id: 0x2e2690ae +} +typedef { + id: 0xcd86b17c + name: "dm_preresume_fn" + referred_type_id: 0x2e2f0b11 +} +typedef { + id: 0xeab0ac41 + name: "dm_presuspend_fn" + referred_type_id: 0x0d6927be +} +typedef { + id: 0xa3284d98 + name: "dm_presuspend_undo_fn" + referred_type_id: 0x0d6927be +} +typedef { + id: 0x1ce28cf1 + name: "dm_release_clone_request_fn" + referred_type_id: 0x0f65ebe2 +} +typedef { + id: 0xb0c08c5a + name: "dm_report_zones_fn" + referred_type_id: 0x2e157919 +} +typedef { + id: 0xabcaeaec + name: "dm_request_endio_fn" + referred_type_id: 0x2e360c76 +} +typedef { + id: 0x77a6dd29 + name: "dm_resume_fn" + referred_type_id: 0x0d6927be +} +typedef { + id: 0xba528163 + name: "dm_status_fn" + referred_type_id: 0x0d599e4a +} typedef { id: 0xe02e14d6 name: "dma_addr_t" @@ -29608,6 +29918,11 @@ typedef { name: "isolate_mode_t" referred_type_id: 0x4585663f } +typedef { + id: 0x9ae406d4 + name: "iterate_devices_callout_fn" + referred_type_id: 0x2e3f95bc +} typedef { id: 0xc6154084 name: "iw_handler" @@ -30458,6 +30773,11 @@ typedef { name: "ssize_t" referred_type_id: 0x2da051ab } +typedef { + id: 0x34e17987 + name: "status_type_t" + referred_type_id: 0x42178190 +} typedef { id: 0x6c15168b name: "substring_t" @@ -32408,6 +32728,11 @@ qualified { qualifier: CONST qualified_type_id: 0x07afa3be } +qualified { + id: 0xde0d753a + qualifier: CONST + qualified_type_id: 0x08726260 +} qualified { id: 0xde3bc780 qualifier: CONST @@ -34982,6 +35307,11 @@ array { number_of_elements: 2 element_type_id: 0xbcedc070 } +array { + id: 0x439cf6d8 + number_of_elements: 16 + element_type_id: 0x3ebcd127 +} array { id: 0x43acdd98 number_of_elements: 32 @@ -35412,6 +35742,11 @@ array { number_of_elements: 32 element_type_id: 0x21069feb } +array { + id: 0x5d529b1e + number_of_elements: 16 + element_type_id: 0x4585663f +} array { id: 0x5e18785f number_of_elements: 16 @@ -41720,6 +42055,12 @@ member { type_id: 0x5d8155a5 offset: 19520 } +member { + id: 0xc0138ce8 + name: "accessed" + type_id: 0x4585663f + offset: 608 +} member { id: 0x6311fd99 name: "accessory" @@ -41756,6 +42097,13 @@ member { type_id: 0x92233392 offset: 2432 } +member { + id: 0x1a19769d + name: "accounts_remapped_io" + type_id: 0x6d7f5ff6 + offset: 580 + bitsize: 1 +} member { id: 0x542cf718 name: "acct" @@ -44180,6 +44528,12 @@ member { type_id: 0x1fe7f40f offset: 64 } +member { + id: 0xa0650951 + name: "alloc_callback" + type_id: 0x0c33de94 + offset: 960 +} member { id: 0x3f6534a2 name: "alloc_container_ctx" @@ -46275,6 +46629,12 @@ member { type_id: 0x92233392 offset: 3008 } +member { + id: 0x63760fd1 + name: "android_kabi_reserved2" + type_id: 0x92233392 + offset: 1792 +} member { id: 0x63760fdb name: "android_kabi_reserved2" @@ -47953,6 +48313,11 @@ member { type_id: 0x6720d32f offset: 704 } +member { + id: 0x2075b8f0 + name: "argc" + type_id: 0x4585663f +} member { id: 0x6fcff76c name: "argmin" @@ -48034,6 +48399,12 @@ member { name: "argv" type_id: 0x13e50c8a } +member { + id: 0xe8735870 + name: "argv" + type_id: 0x0bb0c019 + offset: 64 +} member { id: 0xe8f87d89 name: "argv" @@ -48523,6 +48894,12 @@ member { type_id: 0x9e8abf4f offset: 192 } +member { + id: 0x5ee21ccd + name: "async_write_error" + type_id: 0x6720d32f + offset: 1792 +} member { id: 0xd1b258a6 name: "at" @@ -51726,6 +52103,12 @@ member { name: "bdev" type_id: 0x0c2e195c } +member { + id: 0x51f02b11 + name: "bdev" + type_id: 0x0c2e195c + offset: 832 +} member { id: 0x51f02ed6 name: "bdev" @@ -51869,6 +52252,12 @@ member { type_id: 0x2eda6351 offset: 1664 } +member { + id: 0x38c2e7fb + name: "begin" + type_id: 0xd0b3a203 + offset: 128 +} member { id: 0x21bcbcbc name: "begin_cpu_access" @@ -52452,6 +52841,12 @@ member { type_id: 0x200a0749 offset: 768 } +member { + id: 0xccd15e20 + name: "bios" + type_id: 0x200a0749 + offset: 576 +} member { id: 0x24640f13 name: "bios_limit" @@ -53028,6 +53423,12 @@ member { type_id: 0x24159bc9 offset: 192 } +member { + id: 0x4280b12f + name: "block" + type_id: 0xd0b3a203 + offset: 448 +} member { id: 0x42990dd1 name: "block" @@ -53106,6 +53507,12 @@ member { type_id: 0x4585663f offset: 160 } +member { + id: 0x3c120643 + name: "block_size" + type_id: 0x4585663f + offset: 896 +} member { id: 0xb034a057 name: "block_start" @@ -54100,6 +54507,11 @@ member { type_id: 0xe62ebf07 offset: 288 } +member { + id: 0x9929500d + name: "bs" + type_id: 0x200a0749 +} member { id: 0xff1a115d name: "bsg_dev" @@ -54930,6 +55342,12 @@ member { type_id: 0x0baa70a7 offset: 736 } +member { + id: 0x215141b0 + name: "buffer_tree" + type_id: 0xeb923a9b + offset: 1472 +} member { id: 0xe613256f name: "buffered" @@ -55580,6 +55998,12 @@ member { type_id: 0x74d29cf1 offset: 992 } +member { + id: 0x60a635ef + name: "busy" + type_id: 0x7722f5fe + offset: 1344 +} member { id: 0x60bc6a32 name: "busy" @@ -56160,6 +56584,12 @@ member { type_id: 0x295c7202 offset: 16 } +member { + id: 0x0f75b561 + name: "c" + type_id: 0x2d01fcba + offset: 960 +} member { id: 0x0fa4ebff name: "c" @@ -60550,6 +60980,12 @@ member { type_id: 0x18bd6530 offset: 3456 } +member { + id: 0xf4c5928f + name: "client_list" + type_id: 0xd3c80119 + offset: 1856 +} member { id: 0xa9f3f07b name: "client_ops" @@ -61083,12 +61519,24 @@ member { name: "clockid" type_id: 0x4478ba6b } +member { + id: 0xf6b3df73 + name: "clone" + type_id: 0x7ccce612 + offset: 320 +} member { id: 0xf6c2da43 name: "clone" type_id: 0x0dc966bc offset: 448 } +member { + id: 0xe7b15fc6 + name: "clone_and_map_rq" + type_id: 0x81034bb7 + offset: 512 +} member { id: 0xcf60e1c3 name: "cloned" @@ -65315,6 +65763,12 @@ member { type_id: 0x07d29d85 offset: 320 } +member { + id: 0xb91305cd + name: "counts" + type_id: 0x5d529b1e + offset: 128 +} member { id: 0x70db1c35 name: "coupled_rdevs" @@ -66681,6 +67135,12 @@ member { type_id: 0x0815495d offset: 37248 } +member { + id: 0x5497e4e5 + name: "crypto_profile" + type_id: 0x08956bf0 + offset: 2304 +} member { id: 0x5497e671 name: "crypto_profile" @@ -67133,6 +67593,12 @@ member { type_id: 0x0f3dfb90 offset: 576 } +member { + id: 0x64f1a684 + name: "ctr" + type_id: 0xec2f5289 + offset: 320 +} member { id: 0x6900647d name: "ctrl" @@ -69470,6 +69936,12 @@ member { type_id: 0x18bd6530 offset: 128 } +member { + id: 0x109b80af + name: "data_mode" + type_id: 0x5d8155a5 + offset: 576 +} member { id: 0x970da8c8 name: "data_offset" @@ -69786,6 +70258,18 @@ member { type_id: 0x18bd6530 offset: 64 } +member { + id: 0x57d05926 + name: "dax_dev" + type_id: 0x35abdbf6 + offset: 1920 +} +member { + id: 0x57d05c19 + name: "dax_dev" + type_id: 0x35abdbf6 + offset: 64 +} member { id: 0x57d05f3f name: "dax_dev" @@ -69798,6 +70282,12 @@ member { type_id: 0xe1a31370 offset: 7680 } +member { + id: 0x830b1efa + name: "dax_recovery_write" + type_id: 0xdbb955db + offset: 1664 +} member { id: 0x08509b5c name: "dax_seed" @@ -69810,6 +70300,12 @@ member { type_id: 0x36691375 offset: 64 } +member { + id: 0xc7158a13 + name: "dax_zero_page_range" + type_id: 0xc272516a + offset: 1600 +} member { id: 0xf540eeb1 name: "db_off" @@ -71055,6 +71551,12 @@ member { type_id: 0xd3c80119 offset: 1408 } +member { + id: 0xf0efa471 + name: "deferred" + type_id: 0x59cf4672 + offset: 2880 +} member { id: 0x17c292e0 name: "deferred_cmd" @@ -71079,6 +71581,12 @@ member { type_id: 0x5e8dc7f4 offset: 576 } +member { + id: 0xa9cf9302 + name: "deferred_lock" + type_id: 0xf313e71a + offset: 2816 +} member { id: 0x94bc1785 name: "deferred_probe" @@ -71707,6 +72215,12 @@ member { type_id: 0x4585663f offset: 2368 } +member { + id: 0x1b2184e9 + name: "depth" + type_id: 0x4585663f + offset: 96 +} member { id: 0x1b218a1d name: "depth" @@ -74292,6 +74806,12 @@ member { type_id: 0xd3c80119 offset: 3328 } +member { + id: 0x33ed565c + name: "devices" + type_id: 0xd3c80119 + offset: 1984 +} member { id: 0x33ed5762 name: "devices" @@ -74971,6 +75491,12 @@ member { type_id: 0x0f08e52a offset: 704 } +member { + id: 0x6b820536 + name: "direct_access" + type_id: 0x5833b757 + offset: 1536 +} member { id: 0x6bfa0272 name: "direct_access" @@ -75120,6 +75646,12 @@ member { type_id: 0x064d6086 offset: 1536 } +member { + id: 0x077f45a8 + name: "dirty_end" + type_id: 0x4585663f + offset: 864 +} member { id: 0xcaa4df71 name: "dirty_exceeded" @@ -75168,6 +75700,12 @@ member { type_id: 0x33756485 offset: 5312 } +member { + id: 0x522ab1e5 + name: "dirty_start" + type_id: 0x4585663f + offset: 832 +} member { id: 0xd7a3d362 name: "dis_hw_timestamp" @@ -75507,6 +76045,13 @@ member { type_id: 0x1f3c8679 offset: 1792 } +member { + id: 0x7a833cf4 + name: "discards_supported" + type_id: 0x6d7f5ff6 + offset: 577 + bitsize: 1 +} member { id: 0x513a35c9 name: "disconn_cfm" @@ -75687,6 +76232,12 @@ member { type_id: 0x2131312a offset: 128 } +member { + id: 0x6071aa84 + name: "disk" + type_id: 0x2131312a + offset: 1856 +} member { id: 0xe00832b6 name: "disk_events_disable_depth" @@ -76009,6 +76560,12 @@ member { type_id: 0x99caa0ae offset: 384 } +member { + id: 0x56ecab6c + name: "dm_io" + type_id: 0x09b53a9f + offset: 1216 +} member { id: 0x811af440 name: "dma" @@ -78588,6 +79145,12 @@ member { name: "dtr" type_id: 0x6d7f5ff6 } +member { + id: 0xb0de17e8 + name: "dtr" + type_id: 0xdee852ab + offset: 384 +} member { id: 0xc9708f00 name: "dtr_rts" @@ -78941,6 +79504,12 @@ member { name: "duration" type_id: 0xc9082b19 } +member { + id: 0x5e3459b5 + name: "duration_ns" + type_id: 0xd5df6730 + offset: 64 +} member { id: 0xd5562c37 name: "duty" @@ -80069,6 +80638,13 @@ member { type_id: 0x6720d32f offset: 8512 } +member { + id: 0x4ccb6a85 + name: "emulate_zone_append" + type_id: 0x6d7f5ff6 + offset: 579 + bitsize: 1 +} member { id: 0x030a11d9 name: "emulated" @@ -80921,6 +81497,18 @@ member { type_id: 0x3b5cc110 offset: 2368 } +member { + id: 0xec2a10b4 + name: "end_io" + type_id: 0x0c483694 + offset: 1152 +} +member { + id: 0xec54a25c + name: "end_io" + type_id: 0x72f27b5e + offset: 640 +} member { id: 0xb9877618 name: "end_io_data" @@ -81914,6 +82502,18 @@ member { type_id: 0x39470e64 offset: 1152 } +member { + id: 0x7f0253e8 + name: "error" + type_id: 0x0483e6f8 + offset: 64 +} +member { + id: 0x7f025c11 + name: "error" + type_id: 0x0483e6f8 + offset: 512 +} member { id: 0x7f4352ad name: "error" @@ -82487,6 +83087,12 @@ member { name: "event_cmd" type_id: 0x8b7a3a75 } +member { + id: 0x5138cba7 + name: "event_context" + type_id: 0x18bd6530 + offset: 2176 +} member { id: 0x93a48b9c name: "event_count" @@ -82522,6 +83128,12 @@ member { type_id: 0xc93e017b offset: 368 } +member { + id: 0xd4abd33d + name: "event_fn" + type_id: 0x0f3dfb90 + offset: 2112 +} member { id: 0x50510202 name: "event_handler" @@ -82647,6 +83259,12 @@ member { type_id: 0x0e4e664a offset: 1344 } +member { + id: 0x56ec2c77 + name: "event_nr" + type_id: 0x74d29cf1 + offset: 3712 +} member { id: 0x5d544312 name: "event_read_lock" @@ -82737,6 +83355,12 @@ member { offset: 64 bitsize: 1 } +member { + id: 0x9f773f87 + name: "eventq" + type_id: 0x03913382 + offset: 3520 +} member { id: 0x110fb720 name: "events" @@ -85724,6 +86348,11 @@ member { type_id: 0x4585663f offset: 1664 } +member { + id: 0xc504f94b + name: "features" + type_id: 0x1c898f28 +} member { id: 0xc531247f name: "features" @@ -89003,6 +89632,12 @@ member { type_id: 0xd41e888f offset: 128 } +member { + id: 0x2dccf0c8 + name: "flags" + type_id: 0xa47a28f3 + offset: 16 +} member { id: 0x2dd0356f name: "flags" @@ -89653,6 +90288,13 @@ member { offset: 1 bitsize: 1 } +member { + id: 0xa1b9c8d2 + name: "flush_supported" + type_id: 0x6d7f5ff6 + offset: 576 + bitsize: 1 +} member { id: 0x702e33bb name: "flush_to" @@ -91022,6 +91664,12 @@ member { type_id: 0x0f3dfb90 offset: 1600 } +member { + id: 0x6458e4c6 + name: "free_buffer_wait" + type_id: 0x03913382 + offset: 1536 +} member { id: 0xc583ca0b name: "free_buffers" @@ -93250,6 +93898,12 @@ member { type_id: 0x0a0607fc offset: 2368 } +member { + id: 0x3a26f97c + name: "geometry" + type_id: 0x4db3b057 + offset: 2240 +} member { id: 0x3a570a9f name: "geometry" @@ -95095,6 +95749,12 @@ member { type_id: 0xd3c80119 offset: 7360 } +member { + id: 0xc81f8729 + name: "global_list" + type_id: 0xd3c80119 + offset: 320 +} member { id: 0x523f440f name: "global_node" @@ -98401,6 +99061,12 @@ member { type_id: 0xc5d9d969 offset: 864 } +member { + id: 0x6da33f40 + name: "highs" + type_id: 0x3ebcd127 + offset: 1728 +} member { id: 0x06f8b424 name: "highspeed" @@ -98596,6 +99262,12 @@ member { type_id: 0x3a47ea7a offset: 1152 } +member { + id: 0xffe3e6f3 + name: "hold_count" + type_id: 0x4585663f + offset: 640 +} member { id: 0x72254387 name: "hold_queue" @@ -98631,6 +99303,12 @@ member { type_id: 0x35dc1d5d offset: 6976 } +member { + id: 0x1f2404cf + name: "holders" + type_id: 0x74d29cf1 + offset: 1536 +} member { id: 0xf82bbc03 name: "holders_dir" @@ -103318,6 +103996,24 @@ member { offset: 1312 bitsize: 1 } +member { + id: 0x63660872 + name: "immutable_target" + type_id: 0x3df0a7d3 + offset: 1600 +} +member { + id: 0xfa2d1749 + name: "immutable_target_type" + type_id: 0x3622fa2a + offset: 1856 +} +member { + id: 0xfa2d1f78 + name: "immutable_target_type" + type_id: 0x3622fa2a + offset: 1664 +} member { id: 0x0239d915 name: "imod_interval" @@ -103853,6 +104549,12 @@ member { name: "index" type_id: 0x5fb59157 } +member { + id: 0xad7a9230 + name: "index" + type_id: 0x439cf6d8 + offset: 640 +} member { id: 0xad7c80e2 name: "index" @@ -105012,6 +105714,13 @@ member { type_id: 0x2c197132 offset: 512 } +member { + id: 0xf51d09e4 + name: "init_tio_pdu" + type_id: 0x6d7f5ff6 + offset: 3936 + bitsize: 1 +} member { id: 0x29079611 name: "init_valid_mask" @@ -105807,12 +106516,26 @@ member { type_id: 0xd41e888f offset: 480 } +member { + id: 0xe590115b + name: "integrity_added" + type_id: 0x4585663f + offset: 1922 + bitsize: 1 +} member { id: 0xb37c96b5 name: "integrity_failed" type_id: 0xe62ebf07 offset: 64 } +member { + id: 0x6f52824f + name: "integrity_supported" + type_id: 0x6d7f5ff6 + offset: 1920 + bitsize: 1 +} member { id: 0x31cd18d3 name: "intensity" @@ -105883,6 +106606,12 @@ member { type_id: 0x914dbfdc offset: 1856 } +member { + id: 0x3cd46820 + name: "interface_ptr" + type_id: 0x18bd6530 + offset: 3456 +} member { id: 0x54b2e4db name: "interfaces" @@ -105990,6 +106719,12 @@ member { type_id: 0x6720d32f offset: 576 } +member { + id: 0x1eb686c0 + name: "internal_suspend_count" + type_id: 0x4585663f + offset: 4672 +} member { id: 0x52285a55 name: "internal_tag" @@ -106566,6 +107301,18 @@ member { type_id: 0x6d7f5ff6 offset: 72 } +member { + id: 0x9d69c21e + name: "io" + type_id: 0x0206e829 + offset: 64 +} +member { + id: 0x5fad2d83 + name: "io_barrier" + type_id: 0xa46efa19 + offset: 6400 +} member { id: 0x7aee4108 name: "io_base" @@ -106584,6 +107331,12 @@ member { type_id: 0x80c20070 offset: 1792 } +member { + id: 0x627115f2 + name: "io_bs" + type_id: 0x200a0749 + offset: 2112 +} member { id: 0x65b934f9 name: "io_buffers_cache" @@ -106626,6 +107379,12 @@ member { type_id: 0x38f320f1 offset: 19456 } +member { + id: 0x43d5e607 + name: "io_count" + type_id: 0x74d29cf1 + offset: 416 +} member { id: 0xa3dbd5d1 name: "io_dev" @@ -106638,6 +107397,12 @@ member { type_id: 0x3c5401fe offset: 192 } +member { + id: 0x4b3c38dc + name: "io_hints" + type_id: 0x5d27fec1 + offset: 1472 +} member { id: 0xfe460429 name: "io_is_busy" @@ -109709,6 +110474,12 @@ member { type_id: 0x2c4043e6 offset: 448 } +member { + id: 0x5a8eeaf5 + name: "iterate_devices" + type_id: 0x4944b34e + offset: 1408 +} member { id: 0x7b221f4e name: "iterate_shared" @@ -111043,6 +111814,12 @@ member { type_id: 0x141ef775 offset: 6144 } +member { + id: 0xd68a69a4 + name: "kobj_holder" + type_id: 0xa1319a08 + offset: 5376 +} member { id: 0x84231c09 name: "kobj_type" @@ -111654,6 +112431,12 @@ member { type_id: 0x33756485 offset: 256 } +member { + id: 0x2660c5df + name: "last" + type_id: 0x0fc3c654 + offset: 512 +} member { id: 0x2667209c name: "last" @@ -111696,6 +112479,12 @@ member { type_id: 0x92233392 offset: 384 } +member { + id: 0x8c1c72c6 + name: "last_accessed" + type_id: 0x33756485 + offset: 768 +} member { id: 0x46917fc8 name: "last_ack" @@ -112227,6 +113016,12 @@ member { type_id: 0x054f691a offset: 1088 } +member { + id: 0xaac934df + name: "last_rw" + type_id: 0x4585663f + offset: 64 +} member { id: 0xa444a488 name: "last_sample_time" @@ -112239,6 +113034,11 @@ member { type_id: 0x92233392 offset: 10560 } +member { + id: 0x0d364652 + name: "last_sector" + type_id: 0xd0b3a203 +} member { id: 0x02f7d82f name: "last_sector_bug" @@ -113492,6 +114292,12 @@ member { name: "len" type_id: 0xc93e017b } +member { + id: 0xb8d56e3d + name: "len" + type_id: 0xd0b3a203 + offset: 192 +} member { id: 0xb8e3f22b name: "len" @@ -113581,6 +114387,12 @@ member { type_id: 0x33756485 offset: 64 } +member { + id: 0x399dce5b + name: "len_ptr" + type_id: 0x1bf16028 + offset: 192 +} member { id: 0xf7528eb9 name: "len_so_far" @@ -114052,6 +114864,13 @@ member { type_id: 0x4585663f offset: 1664 } +member { + id: 0x8bbdb526 + name: "limit_swap_bios" + type_id: 0x6d7f5ff6 + offset: 578 + bitsize: 1 +} member { id: 0x6270d42c name: "limit_valid" @@ -114788,6 +115607,12 @@ member { type_id: 0xd3c80119 offset: 512 } +member { + id: 0x7c00e44f + name: "list" + type_id: 0xd3c80119 + offset: 1856 +} member { id: 0x7c00e5d1 name: "list" @@ -115108,6 +115933,12 @@ member { type_id: 0xd3c80119 offset: 256 } +member { + id: 0x76367e75 + name: "list_mode" + type_id: 0x5d8155a5 + offset: 584 +} member { id: 0xd773d1c8 name: "list_node" @@ -117308,6 +118139,12 @@ member { type_id: 0x360c66c5 offset: 2752 } +member { + id: 0x545a8863 + name: "lru" + type_id: 0x585b40a5 + offset: 448 +} member { id: 0x5484b289 name: "lru" @@ -117343,6 +118180,12 @@ member { type_id: 0x74d29cf1 offset: 49152 } +member { + id: 0x94eba612 + name: "lru_list" + type_id: 0xd3c80119 + offset: 192 +} member { id: 0x50d1f6aa name: "lru_lock" @@ -117891,6 +118734,11 @@ member { name: "magic" type_id: 0xe8034002 } +member { + id: 0xd6baf777 + name: "magic" + type_id: 0xc93e017b +} member { id: 0xd6e31323 name: "magic" @@ -118240,6 +119088,12 @@ member { type_id: 0xb9c7723b offset: 1216 } +member { + id: 0x8d8ccb94 + name: "map" + type_id: 0x7abd5475 + offset: 448 +} member { id: 0x8dbdb056 name: "map" @@ -118297,6 +119151,12 @@ member { type_id: 0x1bf16028 offset: 1664 } +member { + id: 0x8deec674 + name: "map" + type_id: 0x18bd6530 + offset: 896 +} member { id: 0x8df0341e name: "map" @@ -120625,6 +121485,12 @@ member { type_id: 0x33756485 offset: 256 } +member { + id: 0x09343eea + name: "max_io_len" + type_id: 0x1c3dbe5a + offset: 256 +} member { id: 0xf058f4c8 name: "max_keysize" @@ -122490,6 +123356,17 @@ member { type_id: 0x4585663f offset: 640 } +member { + id: 0xff5d592e + name: "md" + type_id: 0x2d77f22a +} +member { + id: 0xff5d5e59 + name: "md" + type_id: 0x2d77f22a + offset: 448 +} member { id: 0x966b766d name: "md_dst" @@ -123223,6 +124100,18 @@ member { type_id: 0x064d6086 offset: 2240 } +member { + id: 0x1f686bd1 + name: "mempools" + type_id: 0x32e4574b + offset: 5312 +} +member { + id: 0x1f686eb8 + name: "mempools" + type_id: 0x32e4574b + offset: 2240 +} member { id: 0xebf8e0ed name: "memregion" @@ -123287,6 +124176,11 @@ member { type_id: 0x0f78a6c8 offset: 128 } +member { + id: 0x037856c6 + name: "merged" + type_id: 0x6d7f5ff6 +} member { id: 0x5052f78e name: "merges" @@ -123322,6 +124216,12 @@ member { type_id: 0xb3e7bac9 offset: 5448 } +member { + id: 0x9de5400c + name: "message" + type_id: 0x4a37c87b + offset: 1152 +} member { id: 0x8cf2c6b7 name: "message_id" @@ -124305,6 +125205,12 @@ member { type_id: 0x0faae5b1 offset: 320 } +member { + id: 0xf910802f + name: "minimum_buffers" + type_id: 0x4585663f + offset: 1440 +} member { id: 0x0eef50fa name: "miniq_egress" @@ -125431,6 +126337,18 @@ member { type_id: 0x5adf57ae offset: 7680 } +member { + id: 0x87085ac9 + name: "mode" + type_id: 0x9547a3da + offset: 1952 +} +member { + id: 0x87085bff + name: "mode" + type_id: 0x9547a3da + offset: 128 +} member { id: 0x8709c295 name: "mode" @@ -127642,6 +128560,12 @@ member { type_id: 0x33756485 offset: 2240 } +member { + id: 0x04227360 + name: "n_buffers" + type_id: 0x607419c2 + offset: 704 +} member { id: 0x650782f7 name: "n_channels" @@ -128143,6 +129067,12 @@ member { name: "name" type_id: 0x4d65b854 } +member { + id: 0x0d9941a0 + name: "name" + type_id: 0x42201dce + offset: 160 +} member { id: 0x0d9944ca name: "name" @@ -128173,6 +129103,12 @@ member { type_id: 0x42201dce offset: 672 } +member { + id: 0x0d994b65 + name: "name" + type_id: 0x42201dce + offset: 1728 +} member { id: 0x0d994c40 name: "name" @@ -129762,6 +130698,12 @@ member { type_id: 0xc9082b19 offset: 32 } +member { + id: 0x9460fdf7 + name: "need_reserved_buffers" + type_id: 0x4585663f + offset: 1408 +} member { id: 0xa5ad7a15 name: "need_retune" @@ -129786,6 +130728,12 @@ member { type_id: 0x6d7f5ff6 offset: 8 } +member { + id: 0x247d2bc2 + name: "need_shrink" + type_id: 0xb02b353a + offset: 2880 +} member { id: 0x394e18c1 name: "need_sync" @@ -129849,6 +130797,13 @@ member { offset: 325 bitsize: 1 } +member { + id: 0xf55a45f8 + name: "needs_bio_set_dev" + type_id: 0x6d7f5ff6 + offset: 581 + bitsize: 1 +} member { id: 0x87f2640c name: "needs_force_resume" @@ -130686,6 +131641,12 @@ member { type_id: 0x0379fcff offset: 128 } +member { + id: 0x11f10efe + name: "next" + type_id: 0x0206e829 + offset: 192 +} member { id: 0x11f1c380 name: "next" @@ -131002,6 +131963,12 @@ member { type_id: 0x2e8d5f05 offset: 1856 } +member { + id: 0x7cd3c1cb + name: "next_sector" + type_id: 0xd0b3a203 + offset: 64 +} member { id: 0x430d2e4c name: "next_seq" @@ -131935,6 +132902,12 @@ member { offset: 275 bitsize: 1 } +member { + id: 0xec4c530d + name: "no_sleep" + type_id: 0x6d7f5ff6 + offset: 416 +} member { id: 0x1ccebffc name: "no_start_on_add" @@ -134214,6 +135187,12 @@ member { type_id: 0x6720d32f offset: 51840 } +member { + id: 0x42b6c2d1 + name: "nr_zones" + type_id: 0x4585663f + offset: 10240 +} member { id: 0x42b6ca98 name: "nr_zones" @@ -134627,6 +135606,12 @@ member { type_id: 0x295c7202 offset: 40 } +member { + id: 0x197cb73f + name: "num_allocated" + type_id: 0x4585663f + offset: 1696 +} member { id: 0xf074f928 name: "num_alt_modes" @@ -135007,6 +135992,12 @@ member { type_id: 0xc9082b19 offset: 64 } +member { + id: 0xe8ffd602 + name: "num_discard_bios" + type_id: 0x4585663f + offset: 320 +} member { id: 0x9494166e name: "num_domains" @@ -135126,6 +136117,12 @@ member { type_id: 0x6720d32f offset: 7552 } +member { + id: 0xf997f643 + name: "num_flush_bios" + type_id: 0x4585663f + offset: 288 +} member { id: 0x7bcccefc name: "num_formats" @@ -135859,6 +136856,12 @@ member { type_id: 0x27a7c613 offset: 128 } +member { + id: 0x772e5751 + name: "num_secure_erase_bios" + type_id: 0x4585663f + offset: 352 +} member { id: 0xab5509da name: "num_segs" @@ -136015,6 +137018,12 @@ member { type_id: 0x4585663f offset: 64 } +member { + id: 0x0e2a551a + name: "num_targets" + type_id: 0x4585663f + offset: 1664 +} member { id: 0x72a5b6f7 name: "num_tbps" @@ -136183,6 +137192,12 @@ member { type_id: 0x4585663f offset: 7616 } +member { + id: 0x4fa0a319 + name: "num_write_zeroes_bios" + type_id: 0x4585663f + offset: 384 +} member { id: 0xd474418d name: "numa_node" @@ -136219,6 +137234,12 @@ member { type_id: 0x6720d32f offset: 8480 } +member { + id: 0x0f379684 + name: "numa_node_id" + type_id: 0x6720d32f + offset: 1440 +} member { id: 0x35834d78 name: "numa_pwq_tbl" @@ -137516,6 +138537,12 @@ member { type_id: 0xe62ebf07 offset: 96 } +member { + id: 0x1293b17d + name: "old_sector" + type_id: 0xd0b3a203 + offset: 256 +} member { id: 0xa9aee94d name: "old_sk_destruct" @@ -138144,6 +139171,12 @@ member { type_id: 0x6720d32f offset: 64 } +member { + id: 0x3961e57f + name: "open_count" + type_id: 0x74d29cf1 + offset: 1568 +} member { id: 0x3961e85c name: "open_count" @@ -139331,6 +140364,24 @@ member { name: "orig_addr" type_id: 0xbdd18903 } +member { + id: 0xd07b78d9 + name: "orig_bio" + type_id: 0x15a30023 + offset: 512 +} +member { + id: 0x17637816 + name: "orig_cb" + type_id: 0xfc2c3062 + offset: 192 +} +member { + id: 0x9772cb65 + name: "orig_data" + type_id: 0x18bd6530 + offset: 128 +} member { id: 0x25ffe762 name: "orig_description" @@ -143724,6 +144775,12 @@ member { type_id: 0x74d29cf1 offset: 256 } +member { + id: 0x4c3543b9 + name: "pending_io" + type_id: 0x064d6086 + offset: 2176 +} member { id: 0x9f9c13ba name: "pending_irq" @@ -143900,6 +144957,12 @@ member { type_id: 0x2f5f8053 offset: 768 } +member { + id: 0x319b41b8 + name: "per_io_data_size" + type_id: 0x4585663f + offset: 416 +} member { id: 0xd61b14f9 name: "per_parent_data" @@ -147298,6 +148361,11 @@ member { type_id: 0xb914bfab offset: 10048 } +member { + id: 0xde69b270 + name: "pool" + type_id: 0xe97fe194 +} member { id: 0xde82c205 name: "pool" @@ -148130,6 +149198,12 @@ member { type_id: 0x2c78b884 offset: 64 } +member { + id: 0xc58884a8 + name: "postsuspend" + type_id: 0x540fc033 + offset: 896 +} member { id: 0x5016a0d8 name: "potential_contaminant" @@ -148912,6 +149986,12 @@ member { type_id: 0x2c831d6e offset: 704 } +member { + id: 0x552de7df + name: "precise_timestamps" + type_id: 0x6d7f5ff6 + offset: 576 +} member { id: 0x5f1f9d63 name: "precision" @@ -149241,6 +150321,12 @@ member { type_id: 0x2ea6d809 offset: 832 } +member { + id: 0xd1d88fb4 + name: "prepare_ioctl" + type_id: 0xb5818a23 + offset: 1216 +} member { id: 0x25513c26 name: "prepare_late" @@ -149354,6 +150440,12 @@ member { type_id: 0x287dadb4 offset: 3648 } +member { + id: 0xc22f1b4d + name: "preresume" + type_id: 0xcd86b17c + offset: 960 +} member { id: 0x34aa29cb name: "present" @@ -149396,6 +150488,18 @@ member { type_id: 0x6d7f5ff6 offset: 6312 } +member { + id: 0x542288b2 + name: "presuspend" + type_id: 0xeab0ac41 + offset: 768 +} +member { + id: 0x8a92bcd2 + name: "presuspend_undo" + type_id: 0xa3284d98 + offset: 832 +} member { id: 0xedbb0da6 name: "pretimeout" @@ -153748,6 +154852,12 @@ member { name: "queue" type_id: 0x09427c40 } +member { + id: 0xaddb4c9f + name: "queue" + type_id: 0x09427c40 + offset: 1472 +} member { id: 0xaddb4cea name: "queue" @@ -156517,6 +157627,12 @@ member { type_id: 0x2e103219 offset: 256 } +member { + id: 0xffa6c51e + name: "read_error" + type_id: 0x7be80061 + offset: 592 +} member { id: 0x26d2a405 name: "read_event_config" @@ -159353,6 +160469,12 @@ member { type_id: 0x2f8ebbca offset: 64 } +member { + id: 0x2e40d714 + name: "release_clone_rq" + type_id: 0x1ce28cf1 + offset: 576 +} member { id: 0x06fc76ed name: "release_completion" @@ -160329,6 +161451,12 @@ member { name: "report_type" type_id: 0xe62ebf07 } +member { + id: 0x0d0ed2a2 + name: "report_zones" + type_id: 0xb0c08c5a + offset: 1280 +} member { id: 0x0d9120ed name: "report_zones" @@ -160907,6 +162035,12 @@ member { type_id: 0x0f79fcf8 offset: 256 } +member { + id: 0xee14c6d9 + name: "requeue_list" + type_id: 0x0206e829 + offset: 3392 +} member { id: 0xeec50ace name: "requeue_list" @@ -160931,6 +162065,12 @@ member { type_id: 0x1f3c8679 offset: 18752 } +member { + id: 0x37483f88 + name: "requeue_work" + type_id: 0x1f3c8679 + offset: 3008 +} member { id: 0x37a61301 name: "requeue_work" @@ -161838,6 +162978,12 @@ member { type_id: 0x295c7202 offset: 8 } +member { + id: 0x9a257ac5 + name: "reserved_buffers" + type_id: 0xd3c80119 + offset: 1280 +} member { id: 0xaa963da5 name: "reserved_char" @@ -162804,6 +163950,12 @@ member { type_id: 0x2c18712b offset: 2624 } +member { + id: 0xcae841ae + name: "resume" + type_id: 0x77a6dd29 + offset: 1024 +} member { id: 0xa4d8edf6 name: "resume_done" @@ -164275,6 +165427,12 @@ member { type_id: 0xd5df6730 offset: 28544 } +member { + id: 0x37cf0b9e + name: "rq_end_io" + type_id: 0xabcaeaec + offset: 704 +} member { id: 0x97cc8149 name: "rq_flags" @@ -169314,6 +170472,12 @@ member { type_id: 0xd0b3a203 offset: 384 } +member { + id: 0xf705dc19 + name: "sector_offset" + type_id: 0x4585663f + offset: 576 +} member { id: 0x173ce3ee name: "sector_size" @@ -169326,6 +170490,12 @@ member { type_id: 0x4585663f offset: 320 } +member { + id: 0x3721dfe0 + name: "sectors" + type_id: 0x4585663f + offset: 608 +} member { id: 0x3739d0c7 name: "sectors" @@ -169338,6 +170508,12 @@ member { type_id: 0x80904a3b offset: 256 } +member { + id: 0x0b50257c + name: "sectors_per_block_bits" + type_id: 0x29b77961 + offset: 928 +} member { id: 0xb0199c94 name: "secure_elements" @@ -173424,6 +174600,18 @@ member { offset: 22113 bitsize: 1 } +member { + id: 0x133be164 + name: "shrink_work" + type_id: 0x1f3c8679 + offset: 2496 +} +member { + id: 0x868ca1f0 + name: "shrinker" + type_id: 0xb4975242 + offset: 1984 +} member { id: 0x868caa9e name: "shrinker" @@ -174019,6 +175207,13 @@ member { name: "single_show" type_id: 0x2d8ee262 } +member { + id: 0xdf12b226 + name: "singleton" + type_id: 0x6d7f5ff6 + offset: 1921 + bitsize: 1 +} member { id: 0x5c8384f3 name: "sink" @@ -175622,6 +176817,18 @@ member { type_id: 0x2efd5036 offset: 64 } +member { + id: 0xd9ef0498 + name: "slab_buffer" + type_id: 0x2efd5036 + offset: 1088 +} +member { + id: 0x031120c5 + name: "slab_cache" + type_id: 0x2efd5036 + offset: 1152 +} member { id: 0x031126d0 name: "slab_cache" @@ -177207,6 +178414,12 @@ member { name: "spinlock" type_id: 0xf313e71a } +member { + id: 0x9a7d31f4 + name: "spinlock" + type_id: 0xf313e71a + offset: 384 +} member { id: 0x9a7d37a1 name: "spinlock" @@ -178757,6 +179970,18 @@ member { type_id: 0xbdd18903 offset: 128 } +member { + id: 0x46cb8735 + name: "start" + type_id: 0xd0b3a203 + offset: 320 +} +member { + id: 0x46cb87d7 + name: "start" + type_id: 0xd0b3a203 + offset: 1728 +} member { id: 0x46d23b7b name: "start" @@ -179007,6 +180232,12 @@ member { type_id: 0x33756485 offset: 2112 } +member { + id: 0xa3682aac + name: "start_time" + type_id: 0x33756485 + offset: 64 +} member { id: 0xa3c97b9b name: "start_time" @@ -179470,6 +180701,12 @@ member { type_id: 0x33756485 offset: 1664 } +member { + id: 0x72c08b58 + name: "state" + type_id: 0x33756485 + offset: 704 +} member { id: 0x72c08d84 name: "state" @@ -180141,6 +181378,12 @@ member { type_id: 0x29b1eb4b offset: 256 } +member { + id: 0xb95d079c + name: "stats" + type_id: 0x286f60a3 + offset: 4032 +} member { id: 0xb96dd5c1 name: "stats" @@ -180188,6 +181431,12 @@ member { type_id: 0x815cddc3 offset: 1664 } +member { + id: 0x96627cf8 + name: "stats_aux" + type_id: 0xb4683157 + offset: 256 +} member { id: 0x4fb8f148 name: "stats_block_coalesce_usecs" @@ -180265,6 +181514,12 @@ member { type_id: 0x6720d32f offset: 96 } +member { + id: 0x201cce16 + name: "status" + type_id: 0x7be80061 + offset: 384 +} member { id: 0x2022a603 name: "status" @@ -180436,6 +181691,12 @@ member { type_id: 0xc9082b19 offset: 64 } +member { + id: 0x20dd7873 + name: "status" + type_id: 0xba528163 + offset: 1088 +} member { id: 0x20fcc1ce name: "status" @@ -182519,6 +183780,11 @@ member { type_id: 0x2dd58efa offset: 512 } +member { + id: 0x13692fb1 + name: "suspend_lock" + type_id: 0xa7c362b0 +} member { id: 0x86f0bc08 name: "suspend_noirq" @@ -182823,6 +184089,24 @@ member { type_id: 0x2fd46ff4 offset: 1088 } +member { + id: 0x69e5d3c9 + name: "swap_bios" + type_id: 0x6720d32f + offset: 4704 +} +member { + id: 0xcec5b332 + name: "swap_bios_lock" + type_id: 0xa7c362b0 + offset: 4928 +} +member { + id: 0xec6548f1 + name: "swap_bios_semaphore" + type_id: 0x6e3b7d7f + offset: 4736 +} member { id: 0xc43ef2ec name: "swap_complete" @@ -184595,6 +185879,11 @@ member { name: "table" type_id: 0x28d027d4 } +member { + id: 0xb6c41435 + name: "table" + type_id: 0x2f24a589 +} member { id: 0xb6cd92ad name: "table" @@ -184621,6 +185910,18 @@ member { type_id: 0x6720d32f offset: 672 } +member { + id: 0x0d77c97c + name: "table_devices" + type_id: 0xd3c80119 + offset: 768 +} +member { + id: 0x72b151f9 + name: "table_devices_lock" + type_id: 0xa7c362b0 + offset: 384 +} member { id: 0x4df2d47b name: "table_fulls" @@ -184729,6 +186030,12 @@ member { type_id: 0x99433372 offset: 128 } +member { + id: 0x0de002cb + name: "tag_set" + type_id: 0x2cc0f57b + offset: 3968 +} member { id: 0x0de00aa5 name: "tag_set" @@ -185066,6 +186373,12 @@ member { type_id: 0x66f6fc33 offset: 256 } +member { + id: 0x6669afd1 + name: "target_bio_nr" + type_id: 0x4585663f + offset: 32 +} member { id: 0xa2d76a12 name: "target_blocked" @@ -185253,6 +186566,12 @@ member { type_id: 0x0d107c2b offset: 64 } +member { + id: 0x1623d50f + name: "targets" + type_id: 0x3df0a7d3 + offset: 1792 +} member { id: 0x167e5754 name: "targets" @@ -186506,6 +187825,11 @@ member { type_id: 0x49b889e7 offset: 12704 } +member { + id: 0x7cd9a358 + name: "tgt" + type_id: 0x3df0a7d3 +} member { id: 0x07611cab name: "tgt_index" @@ -186907,6 +188231,12 @@ member { type_id: 0x09427c40 offset: 23232 } +member { + id: 0x1e282dde + name: "ti" + type_id: 0x3df0a7d3 + offset: 128 +} member { id: 0xe879699b name: "tick" @@ -187825,6 +189155,12 @@ member { name: "timings" type_id: 0x9699a1e3 } +member { + id: 0x2c593fc1 + name: "tio" + type_id: 0xd16b19a7 + offset: 640 +} member { id: 0x73627a10 name: "tiocmget" @@ -192166,6 +193502,12 @@ member { name: "type" type_id: 0x368ec5cb } +member { + id: 0x5c60f365 + name: "type" + type_id: 0x3622fa2a + offset: 64 +} member { id: 0x5c61158d name: "type" @@ -192455,6 +193797,18 @@ member { type_id: 0xfdb649ac offset: 32 } +member { + id: 0x5cab8146 + name: "type" + type_id: 0xfd56cb64 + offset: 1408 +} +member { + id: 0x5cab8754 + name: "type" + type_id: 0xfd56cb64 + offset: 64 +} member { id: 0x5cac8829 name: "type" @@ -192865,6 +194219,12 @@ member { type_id: 0xf313e71a offset: 352 } +member { + id: 0xc5f5f87e + name: "type_lock" + type_id: 0xa7c362b0 + offset: 1024 +} member { id: 0xe2794a8c name: "type_names" @@ -193746,12 +195106,30 @@ member { type_id: 0x2de090d3 offset: 448 } +member { + id: 0x1704d15b + name: "uevent_list" + type_id: 0xd3c80119 + offset: 3776 +} +member { + id: 0xdc003eed + name: "uevent_lock" + type_id: 0xf313e71a + offset: 3904 +} member { id: 0x7a23f532 name: "uevent_ops" type_id: 0x3fdb8af3 offset: 960 } +member { + id: 0x271c2c01 + name: "uevent_seq" + type_id: 0x74d29cf1 + offset: 3744 +} member { id: 0x069b6afd name: "uevent_sock" @@ -198442,6 +199820,12 @@ member { type_id: 0x3e10b518 offset: 128 } +member { + id: 0xa662981f + name: "version" + type_id: 0x03a4acbb + offset: 192 +} member { id: 0xa66a9aeb name: "version" @@ -200556,6 +201940,12 @@ member { type_id: 0x03913382 offset: 7488 } +member { + id: 0x202d9516 + name: "wait" + type_id: 0x03913382 + offset: 1984 +} member { id: 0x202d9556 name: "wait" @@ -202078,6 +203468,12 @@ member { type_id: 0x1f3c8679 offset: 2176 } +member { + id: 0xd6e6623f + name: "work" + type_id: 0x1f3c8679 + offset: 2432 +} member { id: 0xd6e66356 name: "work" @@ -202532,6 +203928,12 @@ member { type_id: 0x13f8b706 offset: 1152 } +member { + id: 0x22fae506 + name: "wq" + type_id: 0x13f8b706 + offset: 2368 +} member { id: 0x22fae76b name: "wq" @@ -202885,6 +204287,12 @@ member { type_id: 0xedf277ba offset: 2048 } +member { + id: 0x6cd173ed + name: "write_callback" + type_id: 0x0c33de94 + offset: 1024 +} member { id: 0xf2bc2b47 name: "write_char" @@ -202932,6 +204340,18 @@ member { type_id: 0x2c691ecf offset: 384 } +member { + id: 0xdc734cb7 + name: "write_end" + type_id: 0x4585663f + offset: 928 +} +member { + id: 0x6d2dbcdf + name: "write_error" + type_id: 0x7be80061 + offset: 600 +} member { id: 0x2d1f9b2d name: "write_event_config" @@ -203028,6 +204448,12 @@ member { type_id: 0x0dee87ef offset: 192 } +member { + id: 0x32aed56a + name: "write_list" + type_id: 0xd3c80119 + offset: 1024 +} member { id: 0x3b7c6234 name: "write_lock" @@ -203150,6 +204576,12 @@ member { type_id: 0x7ca48629 offset: 1856 } +member { + id: 0xb4ed2fb3 + name: "write_start" + type_id: 0x4585663f + offset: 896 +} member { id: 0x8b22f978 name: "write_started" @@ -204484,6 +205916,12 @@ member { type_id: 0x18bd6530 offset: 64 } +member { + id: 0x7e8b2a1f + name: "zone_idx" + type_id: 0x4585663f + offset: 256 +} member { id: 0x7ea98be0 name: "zone_idx" @@ -204539,6 +205977,12 @@ member { type_id: 0x2efd5036 offset: 16448 } +member { + id: 0x2137fd7f + name: "zwp_offset" + type_id: 0x1bf16028 + offset: 10304 +} member { id: 0x6006a5e2 name: "zx_wakeup_clear_needed" @@ -219797,6 +221241,268 @@ struct_union { member_id: 0xb20c2eb5 } } +struct_union { + id: 0x08726260 + kind: STRUCT + name: "dm_arg" + definition { + bytesize: 16 + member_id: 0xf9d5048c + member_id: 0x97b38f9c + member_id: 0x7f0253e8 + } +} +struct_union { + id: 0x84f84d67 + kind: STRUCT + name: "dm_arg_set" + definition { + bytesize: 16 + member_id: 0x2075b8f0 + member_id: 0xe8735870 + } +} +struct_union { + id: 0x8b3c3364 + kind: STRUCT + name: "dm_buffer" + definition { + bytesize: 152 + member_id: 0x0f470b14 + member_id: 0x94eba612 + member_id: 0xc81f8729 + member_id: 0x4280b12f + member_id: 0xff8a9211 + member_id: 0x109b80af + member_id: 0x76367e75 + member_id: 0xffa6c51e + member_id: 0x6d2dbcdf + member_id: 0xc0138ce8 + member_id: 0xffe3e6f3 + member_id: 0x72c08b58 + member_id: 0x8c1c72c6 + member_id: 0x522ab1e5 + member_id: 0x077f45a8 + member_id: 0xb4ed2fb3 + member_id: 0xdc734cb7 + member_id: 0x0f75b561 + member_id: 0x32aed56a + member_id: 0xec2a10b4 + } +} +struct_union { + id: 0x9e471477 + kind: STRUCT + name: "dm_bufio_client" + definition { + bytesize: 368 + member_id: 0x2d4b3c00 + member_id: 0x9a7d31f4 + member_id: 0xec4c530d + member_id: 0x545a8863 + member_id: 0x04227360 + member_id: 0x51f02b11 + member_id: 0x3c120643 + member_id: 0x0b50257c + member_id: 0xa0650951 + member_id: 0x6cd173ed + member_id: 0xd9ef0498 + member_id: 0x031120c5 + member_id: 0x56ecab6c + member_id: 0x9a257ac5 + member_id: 0x9460fdf7 + member_id: 0xf910802f + member_id: 0x215141b0 + member_id: 0x6458e4c6 + member_id: 0x46cb87d7 + member_id: 0x5ee21ccd + member_id: 0xf4c5928f + member_id: 0x868ca1f0 + member_id: 0x133be164 + member_id: 0x247d2bc2 + } +} +struct_union { + id: 0x5f5259bd + kind: STRUCT + name: "dm_dev" + definition { + bytesize: 40 + member_id: 0x51f028ab + member_id: 0x57d05c19 + member_id: 0x87085bff + member_id: 0x0d9941a0 + } +} +struct_union { + id: 0x225b463b + kind: STRUCT + name: "dm_io" + definition { + bytesize: 280 + member_id: 0xd6baf777 + member_id: 0x2dccf0c8 + member_id: 0x2d1fe1be + member_id: 0xa3682aac + member_id: 0xff8a90cb + member_id: 0x11f10efe + member_id: 0x96627cf8 + member_id: 0x201cce16 + member_id: 0x43d5e607 + member_id: 0xff5d5e59 + member_id: 0xd07b78d9 + member_id: 0xf705dc19 + member_id: 0x3721dfe0 + member_id: 0x2c593fc1 + } +} +struct_union { + id: 0x0c940ce3 + kind: STRUCT + name: "dm_io_client" + definition { + bytesize: 336 + member_id: 0xde69b270 + member_id: 0xccd15e20 + } +} +struct_union { + id: 0xa1319a08 + kind: STRUCT + name: "dm_kobject_holder" + definition { + bytesize: 128 + member_id: 0x452b206c + member_id: 0xc494a473 + } +} +struct_union { + id: 0xe1d1bbb1 + kind: STRUCT + name: "dm_md_mempools" + definition { + bytesize: 528 + member_id: 0x9929500d + member_id: 0x627115f2 + } +} +struct_union { + id: 0xd2e99e69 + kind: STRUCT + name: "dm_report_zones_args" + definition { + bytesize: 48 + member_id: 0x7cd9a358 + member_id: 0x7cd3c1cb + member_id: 0x9772cb65 + member_id: 0x17637816 + member_id: 0x7e8b2a1f + member_id: 0x46cb8735 + } +} +struct_union { + id: 0x286f60a3 + kind: STRUCT + name: "dm_stats" + definition { + bytesize: 80 + member_id: 0xad898302 + member_id: 0x7c00eec0 + member_id: 0x2660c5df + member_id: 0x552de7df + } +} +struct_union { + id: 0xb4683157 + kind: STRUCT + name: "dm_stats_aux" + definition { + bytesize: 16 + member_id: 0x037856c6 + member_id: 0x5e3459b5 + } +} +struct_union { + id: 0x154fffcf + kind: STRUCT + name: "dm_stats_last_position" + definition { + bytesize: 16 + member_id: 0x0d364652 + member_id: 0xaac934df + } +} +struct_union { + id: 0x96d270ba + kind: STRUCT + name: "dm_table" + definition { + bytesize: 296 + member_id: 0xff5d592e + member_id: 0x5cab8754 + member_id: 0x1b2184e9 + member_id: 0xb91305cd + member_id: 0xad7a9230 + member_id: 0x0e2a551a + member_id: 0x197cb73f + member_id: 0x6da33f40 + member_id: 0x1623d50f + member_id: 0xfa2d1749 + member_id: 0x6f52824f + member_id: 0xdf12b226 + member_id: 0xe590115b + member_id: 0x87085ac9 + member_id: 0x33ed565c + member_id: 0xd4abd33d + member_id: 0x5138cba7 + member_id: 0x1f686eb8 + member_id: 0x5497e4e5 + } +} +struct_union { + id: 0xdd8279d0 + kind: STRUCT + name: "dm_target" + definition { + bytesize: 96 + member_id: 0xb6c41435 + member_id: 0x5c60f365 + member_id: 0x38c2e7fb + member_id: 0xb8d56e3d + member_id: 0x09343eea + member_id: 0xf997f643 + member_id: 0xe8ffd602 + member_id: 0x772e5751 + member_id: 0x4fa0a319 + member_id: 0x319b41b8 + member_id: 0x917961c4 + member_id: 0x7f025c11 + member_id: 0xa1b9c8d2 + member_id: 0x7a833cf4 + member_id: 0x8bbdb526 + member_id: 0x4ccb6a85 + member_id: 0x1a19769d + member_id: 0xf55a45f8 + member_id: 0x2d08134b + member_id: 0x63760b9f + } +} +struct_union { + id: 0xd16b19a7 + kind: STRUCT + name: "dm_target_io" + definition { + bytesize: 200 + member_id: 0xd6baf777 + member_id: 0x2dccf0c8 + member_id: 0x6669afd1 + member_id: 0x9d69c21e + member_id: 0x1e282dde + member_id: 0x399dce5b + member_id: 0x1293b17d + member_id: 0xf6b3df73 + } +} struct_union { id: 0x906b8630 kind: STRUCT @@ -235382,6 +237088,15 @@ struct_union { member_id: 0xd590f436 } } +struct_union { + id: 0xc5d806af + kind: UNION + name: "map_info" + definition { + bytesize: 8 + member_id: 0x46e877b0 + } +} struct_union { id: 0xbd562aba kind: STRUCT @@ -235410,6 +237125,57 @@ struct_union { member_id: 0x7cfb135c } } +struct_union { + id: 0x9f9f2e37 + kind: STRUCT + name: "mapped_device" + definition { + bytesize: 1296 + member_id: 0x13692fb1 + member_id: 0x72b151f9 + member_id: 0x0d77c97c + member_id: 0x8deec674 + member_id: 0x2d5bf9c9 + member_id: 0xc5f5f87e + member_id: 0x5cab8146 + member_id: 0x0f379684 + member_id: 0xaddb4c9f + member_id: 0x1f2404cf + member_id: 0x3961e57f + member_id: 0x63660872 + member_id: 0xfa2d1f78 + member_id: 0x0d994b65 + member_id: 0x6071aa84 + member_id: 0x57d05926 + member_id: 0x202d9516 + member_id: 0x4c3543b9 + member_id: 0x3a26f97c + member_id: 0x22fae506 + member_id: 0xd6e6623f + member_id: 0xa9cf9302 + member_id: 0xf0efa471 + member_id: 0x37483f88 + member_id: 0xee14c6d9 + member_id: 0x3cd46820 + member_id: 0x9f773f87 + member_id: 0x56ec2c77 + member_id: 0x271c2c01 + member_id: 0x1704d15b + member_id: 0xdc003eed + member_id: 0xf51d09e4 + member_id: 0x0de002cb + member_id: 0xb95d079c + member_id: 0x1eb686c0 + member_id: 0x69e5d3c9 + member_id: 0xec6548f1 + member_id: 0xcec5b332 + member_id: 0x1f686bd1 + member_id: 0xd68a69a4 + member_id: 0x5fad2d83 + member_id: 0x42b6c2d1 + member_id: 0x2137fd7f + } +} struct_union { id: 0x29d77c73 kind: STRUCT @@ -253208,6 +254974,43 @@ struct_union { member_id: 0xd1fdbf5e } } +struct_union { + id: 0xf2cb0e35 + kind: STRUCT + name: "target_type" + definition { + bytesize: 248 + member_id: 0xc504f94b + member_id: 0x0de57809 + member_id: 0x965f1ffc + member_id: 0xa662981f + member_id: 0x64f1a684 + member_id: 0xb0de17e8 + member_id: 0x8d8ccb94 + member_id: 0xe7b15fc6 + member_id: 0x2e40d714 + member_id: 0xec54a25c + member_id: 0x37cf0b9e + member_id: 0x542288b2 + member_id: 0x8a92bcd2 + member_id: 0xc58884a8 + member_id: 0xc22f1b4d + member_id: 0xcae841ae + member_id: 0x20dd7873 + member_id: 0x9de5400c + member_id: 0xd1d88fb4 + member_id: 0x0d0ed2a2 + member_id: 0x60a635ef + member_id: 0x5a8eeaf5 + member_id: 0x4b3c38dc + member_id: 0x6b820536 + member_id: 0xc7158a13 + member_id: 0x830b1efa + member_id: 0x2d081217 + member_id: 0x63760fd1 + member_id: 0x7c00e44f + } +} struct_union { id: 0x4e9556c5 kind: STRUCT @@ -265307,6 +267110,23 @@ struct_union { member_id: 0x739d7255 } } +enumeration { + id: 0x42178190 + definition { + underlying_type_id: 0x4585663f + enumerator { + name: "STATUSTYPE_INFO" + } + enumerator { + name: "STATUSTYPE_TABLE" + value: 1 + } + enumerator { + name: "STATUSTYPE_IMA" + value: 2 + } + } +} enumeration { id: 0x4f34306c definition { @@ -270409,6 +272229,28 @@ enumeration { } } } +enumeration { + id: 0xfd56cb64 + name: "dm_queue_mode" + definition { + underlying_type_id: 0x4585663f + enumerator { + name: "DM_TYPE_NONE" + } + enumerator { + name: "DM_TYPE_BIO_BASED" + value: 1 + } + enumerator { + name: "DM_TYPE_REQUEST_BASED" + value: 2 + } + enumerator { + name: "DM_TYPE_DAX_BIO_BASED" + value: 3 + } + } +} enumeration { id: 0x3e09ba9c name: "dma_ctrl_flags" @@ -283729,6 +285571,11 @@ function { return_type_id: 0x48b5725f parameter_id: 0x074f1a14 } +function { + id: 0x11508453 + return_type_id: 0x9547a3da + parameter_id: 0x2f24a589 +} function { id: 0x1154b37f return_type_id: 0x0bfc9031 @@ -288211,6 +290058,12 @@ function { return_type_id: 0x48b5725f parameter_id: 0x1d25f132 } +function { + id: 0x17d74917 + return_type_id: 0x48b5725f + parameter_id: 0x1e820193 + parameter_id: 0x3be6380c +} function { id: 0x17d8b994 return_type_id: 0x48b5725f @@ -289458,6 +291311,11 @@ function { return_type_id: 0x48b5725f parameter_id: 0x2859d899 } +function { + id: 0x1a8f9ccc + return_type_id: 0x48b5725f + parameter_id: 0x285f357e +} function { id: 0x1a902728 return_type_id: 0x48b5725f @@ -289888,6 +291746,12 @@ function { parameter_id: 0xf435685e parameter_id: 0x27a7c613 } +function { + id: 0x1b603ccd + return_type_id: 0x48b5725f + parameter_id: 0x285f357e + parameter_id: 0x7be80061 +} function { id: 0x1b6452d7 return_type_id: 0x48b5725f @@ -290188,6 +292052,11 @@ function { parameter_id: 0x2131312a parameter_id: 0xc0a0d1f0 } +function { + id: 0x1bd82ebd + return_type_id: 0x48b5725f + parameter_id: 0x2d01fcba +} function { id: 0x1bdaff5e return_type_id: 0x48b5725f @@ -291117,6 +292986,11 @@ function { parameter_id: 0x391f15ea parameter_id: 0xf435685e } +function { + id: 0x1d10ef19 + return_type_id: 0x48b5725f + parameter_id: 0x3622fa2a +} function { id: 0x1d1662fd return_type_id: 0x48b5725f @@ -292632,6 +294506,12 @@ function { parameter_id: 0x3f222c68 parameter_id: 0x15b54c6f } +function { + id: 0x1f0b238f + return_type_id: 0x48b5725f + parameter_id: 0x3df0a7d3 + parameter_id: 0x3bd6fa3a +} function { id: 0x1f0d7714 return_type_id: 0x48b5725f @@ -292720,6 +294600,15 @@ function { return_type_id: 0x48b5725f parameter_id: 0x3ee88c45 } +function { + id: 0x1f269fb6 + return_type_id: 0x48b5725f + parameter_id: 0x3df0a7d3 + parameter_id: 0x34e17987 + parameter_id: 0x4585663f + parameter_id: 0x0483e6f8 + parameter_id: 0x4585663f +} function { id: 0x1f26df83 return_type_id: 0x48b5725f @@ -293327,6 +295216,11 @@ function { parameter_id: 0x3176a085 parameter_id: 0xc9082b19 } +function { + id: 0x1fe47867 + return_type_id: 0x48b5725f + parameter_id: 0x3df0a7d3 +} function { id: 0x1feaaebf return_type_id: 0x48b5725f @@ -295257,6 +297151,11 @@ function { return_type_id: 0xc9082b19 parameter_id: 0x0c0dfa25 } +function { + id: 0x47570b9f + return_type_id: 0x2131312a + parameter_id: 0x2d77f22a +} function { id: 0x4759fa3a return_type_id: 0x04ca9246 @@ -295409,6 +297308,17 @@ function { parameter_id: 0x4585663f parameter_id: 0x4585663f } +function { + id: 0x4b6ec637 + return_type_id: 0x2d01fcba + parameter_id: 0x0c2e195c + parameter_id: 0x4585663f + parameter_id: 0x4585663f + parameter_id: 0x4585663f + parameter_id: 0x0c33de94 + parameter_id: 0x0c33de94 + parameter_id: 0x4585663f +} function { id: 0x4bbafb54 return_type_id: 0x00c72527 @@ -296832,6 +298742,13 @@ function { parameter_id: 0xf435685e parameter_id: 0x11cfee5a } +function { + id: 0x5e9421aa + return_type_id: 0x18bd6530 + parameter_id: 0x2d01fcba + parameter_id: 0xd0b3a203 + parameter_id: 0x0087f4f8 +} function { id: 0x5ed273d9 return_type_id: 0x18bd6530 @@ -299069,6 +300986,11 @@ function { return_type_id: 0x6720d32f parameter_id: 0x36194830 } +function { + id: 0x90085da5 + return_type_id: 0x6720d32f + parameter_id: 0x3622fa2a +} function { id: 0x9009411d return_type_id: 0x6720d32f @@ -299644,6 +301566,13 @@ function { parameter_id: 0x295c7202 parameter_id: 0x7584e7da } +function { + id: 0x90917599 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x9ae406d4 + parameter_id: 0x18bd6530 +} function { id: 0x9093971b return_type_id: 0x6720d32f @@ -301842,6 +303771,13 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3e292ad1 } +function { + id: 0x920c1213 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x33756485 + parameter_id: 0xf435685e +} function { id: 0x920d0e3f return_type_id: 0x6720d32f @@ -301883,6 +303819,13 @@ function { parameter_id: 0x0483e6f8 parameter_id: 0xf435685e } +function { + id: 0x921502fa + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x3e2a5e3d + parameter_id: 0x4585663f +} function { id: 0x92153e12 return_type_id: 0xf435685e @@ -301934,6 +303877,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3e816a4b } +function { + id: 0x9221eee3 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x3e10b518 + parameter_id: 0x9547a3da + parameter_id: 0x0dc11255 +} function { id: 0x92222c71 return_type_id: 0x6720d32f @@ -302335,6 +304286,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3fac1d22 } +function { + id: 0x926c5025 + return_type_id: 0x6720d32f + parameter_id: 0x3d1364e9 + parameter_id: 0x2bae2afe + parameter_id: 0x1bf16028 + parameter_id: 0x0bb0c019 +} function { id: 0x926d0dd0 return_type_id: 0x6720d32f @@ -302496,6 +304455,14 @@ function { parameter_id: 0x3f37d9d5 parameter_id: 0x32a063f3 } +function { + id: 0x92880f91 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x1e820193 + parameter_id: 0x3be6380c + parameter_id: 0x0d30b9c3 +} function { id: 0x928c1332 return_type_id: 0x6720d32f @@ -302553,6 +304520,14 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3c5f865b } +function { + id: 0x9298d745 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x1e820193 + parameter_id: 0x7be80061 + parameter_id: 0x3be6380c +} function { id: 0x929a4d8e return_type_id: 0x6720d32f @@ -302643,6 +304618,12 @@ function { return_type_id: 0x6720d32f parameter_id: 0x3ca2533c } +function { + id: 0x92aa46db + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x15a30023 +} function { id: 0x92ab09cb return_type_id: 0x6720d32f @@ -302671,6 +304652,13 @@ function { parameter_id: 0x3ea2e6c1 parameter_id: 0x2124c9f1 } +function { + id: 0x92af5c55 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x15a30023 + parameter_id: 0x146a39bf +} function { id: 0x92b5578e return_type_id: 0x6720d32f @@ -302690,6 +304678,15 @@ function { parameter_id: 0x01c5a749 parameter_id: 0x3c2dd1ca } +function { + id: 0x92beb06d + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x1d44afc8 + parameter_id: 0xd0b3a203 + parameter_id: 0xd0b3a203 + parameter_id: 0x18bd6530 +} function { id: 0x92bf7ef1 return_type_id: 0x6720d32f @@ -302853,6 +304850,12 @@ function { parameter_id: 0xc9082b19 parameter_id: 0x0db138df } +function { + id: 0x92daa424 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x099bbff0 +} function { id: 0x92dc6e62 return_type_id: 0x6720d32f @@ -303023,6 +305026,11 @@ function { parameter_id: 0x3e10b518 parameter_id: 0x3e10b518 } +function { + id: 0x92fccadb + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 +} function { id: 0x92fce902 return_type_id: 0x6720d32f @@ -303954,6 +305962,22 @@ function { parameter_id: 0x33756485 parameter_id: 0x33756485 } +function { + id: 0x93e8301d + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x4585663f + parameter_id: 0x0bb0c019 + parameter_id: 0x0483e6f8 + parameter_id: 0x4585663f +} +function { + id: 0x93e83373 + return_type_id: 0x6720d32f + parameter_id: 0x3df0a7d3 + parameter_id: 0x4585663f + parameter_id: 0x0bb0c019 +} function { id: 0x93e8e7b0 return_type_id: 0x6720d32f @@ -306038,6 +308062,11 @@ function { parameter_id: 0x0483e6f8 parameter_id: 0x914dbfdc } +function { + id: 0x96c09c01 + return_type_id: 0x6720d32f + parameter_id: 0x2d01fcba +} function { id: 0x96c3b4e1 return_type_id: 0x6720d32f @@ -306619,6 +308648,14 @@ function { parameter_id: 0x2b21a696 parameter_id: 0x35f82503 } +function { + id: 0x97a0d8a7 + return_type_id: 0x15a30023 + parameter_id: 0x15a30023 + parameter_id: 0x6720d32f + parameter_id: 0xf1a6dfed + parameter_id: 0x0292b875 +} function { id: 0x97a3c07a return_type_id: 0x6720d32f @@ -307562,6 +309599,15 @@ function { parameter_id: 0x18bd6530 parameter_id: 0xc93e017b } +function { + id: 0x988bc164 + return_type_id: 0xf435685e + parameter_id: 0x3df0a7d3 + parameter_id: 0x33756485 + parameter_id: 0x18bd6530 + parameter_id: 0xf435685e + parameter_id: 0x2f73da3b +} function { id: 0x988f2c1b return_type_id: 0x6720d32f @@ -307730,6 +309776,11 @@ function { return_type_id: 0x6720d32f parameter_id: 0x14b9453b } +function { + id: 0x98af9d1c + return_type_id: 0x3e10b518 + parameter_id: 0x2bae2afe +} function { id: 0x98b3c900 return_type_id: 0x6720d32f @@ -320422,6 +322473,11 @@ function { parameter_id: 0x32a623d7 parameter_id: 0x2584a3b9 } +function { + id: 0xa7436d37 + return_type_id: 0x2d77f22a + parameter_id: 0x2f24a589 +} function { id: 0xa780332f return_type_id: 0x6720d32f @@ -320515,6 +322571,16 @@ function { parameter_id: 0x01d3d77e parameter_id: 0x6720d32f } +function { + id: 0xa8ae6b7a + return_type_id: 0xfc0e1dbd + parameter_id: 0x3df0a7d3 + parameter_id: 0x33756485 + parameter_id: 0xfc0e1dbd + parameter_id: 0x2b23aa9d + parameter_id: 0x0cbf60eb + parameter_id: 0x28eb23d4 +} function { id: 0xa8d53dcc return_type_id: 0x1253769c @@ -336539,6 +338605,15 @@ elf_symbol { type_id: 0x15f0919b full_name: "bio_put" } +elf_symbol { + id: 0xa8878d9e + name: "bio_split" + is_defined: true + symbol_type: FUNCTION + crc: 0x8e0ebb54 + type_id: 0x97a0d8a7 + full_name: "bio_split" +} elf_symbol { id: 0x1cb0de6c name: "bio_start_io_acct" @@ -345007,6 +347082,150 @@ elf_symbol { type_id: 0xa5be4b9b full_name: "divider_round_rate_parent" } +elf_symbol { + id: 0xf4cef372 + name: "dm_bufio_client_create" + is_defined: true + symbol_type: FUNCTION + crc: 0xb08df2d2 + type_id: 0x4b6ec637 + full_name: "dm_bufio_client_create" +} +elf_symbol { + id: 0xa2bba96c + name: "dm_bufio_client_destroy" + is_defined: true + symbol_type: FUNCTION + crc: 0xeca7949e + type_id: 0x1bd82ebd + full_name: "dm_bufio_client_destroy" +} +elf_symbol { + id: 0x7848fa66 + name: "dm_bufio_mark_buffer_dirty" + is_defined: true + symbol_type: FUNCTION + crc: 0x0ad0dc4f + type_id: 0x1a8f9ccc + full_name: "dm_bufio_mark_buffer_dirty" +} +elf_symbol { + id: 0x0db19b7a + name: "dm_bufio_new" + is_defined: true + symbol_type: FUNCTION + crc: 0xc0d7df85 + type_id: 0x5e9421aa + full_name: "dm_bufio_new" +} +elf_symbol { + id: 0xed0adecd + name: "dm_bufio_read" + is_defined: true + symbol_type: FUNCTION + crc: 0xb04f56ab + type_id: 0x5e9421aa + full_name: "dm_bufio_read" +} +elf_symbol { + id: 0xd3ad47e6 + name: "dm_bufio_release" + is_defined: true + symbol_type: FUNCTION + crc: 0xe6024e59 + type_id: 0x1a8f9ccc + full_name: "dm_bufio_release" +} +elf_symbol { + id: 0x042d9e44 + name: "dm_bufio_write_dirty_buffers" + is_defined: true + symbol_type: FUNCTION + crc: 0xa82b2066 + type_id: 0x96c09c01 + full_name: "dm_bufio_write_dirty_buffers" +} +elf_symbol { + id: 0x0991ae07 + name: "dm_disk" + is_defined: true + symbol_type: FUNCTION + crc: 0x6c18061f + type_id: 0x47570b9f + full_name: "dm_disk" +} +elf_symbol { + id: 0x650e9b1f + name: "dm_get_device" + is_defined: true + symbol_type: FUNCTION + crc: 0x1e1791d7 + type_id: 0x9221eee3 + full_name: "dm_get_device" +} +elf_symbol { + id: 0xd360b11b + name: "dm_kobject_release" + is_defined: true + symbol_type: FUNCTION + crc: 0x41e9f737 + type_id: 0x1864769e + full_name: "dm_kobject_release" +} +elf_symbol { + id: 0x8c40514f + name: "dm_read_arg_group" + is_defined: true + symbol_type: FUNCTION + crc: 0x39c74235 + type_id: 0x926c5025 + full_name: "dm_read_arg_group" +} +elf_symbol { + id: 0xe7718d4e + name: "dm_register_target" + is_defined: true + symbol_type: FUNCTION + crc: 0x99f64a0c + type_id: 0x90085da5 + full_name: "dm_register_target" +} +elf_symbol { + id: 0xb61b1afb + name: "dm_shift_arg" + is_defined: true + symbol_type: FUNCTION + crc: 0x7d27e504 + type_id: 0x98af9d1c + full_name: "dm_shift_arg" +} +elf_symbol { + id: 0xe96fb6a0 + name: "dm_table_get_md" + is_defined: true + symbol_type: FUNCTION + crc: 0xeba2f002 + type_id: 0xa7436d37 + full_name: "dm_table_get_md" +} +elf_symbol { + id: 0xf99054ab + name: "dm_table_get_mode" + is_defined: true + symbol_type: FUNCTION + crc: 0x925f0075 + type_id: 0x11508453 + full_name: "dm_table_get_mode" +} +elf_symbol { + id: 0x76f0e551 + name: "dm_unregister_target" + is_defined: true + symbol_type: FUNCTION + crc: 0x28405c27 + type_id: 0x1d10ef19 + full_name: "dm_unregister_target" +} elf_symbol { id: 0x6cb15207 name: "dma_alloc_attrs" @@ -388894,6 +391113,7 @@ interface { symbol_id: 0x61a552c6 symbol_id: 0x5a9da856 symbol_id: 0x1d853176 + symbol_id: 0xa8878d9e symbol_id: 0x1cb0de6c symbol_id: 0xe0e9f920 symbol_id: 0xfba0da8c @@ -389836,6 +392056,22 @@ interface { symbol_id: 0xedd83590 symbol_id: 0x840989b2 symbol_id: 0x57325158 + symbol_id: 0xf4cef372 + symbol_id: 0xa2bba96c + symbol_id: 0x7848fa66 + symbol_id: 0x0db19b7a + symbol_id: 0xed0adecd + symbol_id: 0xd3ad47e6 + symbol_id: 0x042d9e44 + symbol_id: 0x0991ae07 + symbol_id: 0x650e9b1f + symbol_id: 0xd360b11b + symbol_id: 0x8c40514f + symbol_id: 0xe7718d4e + symbol_id: 0xb61b1afb + symbol_id: 0xe96fb6a0 + symbol_id: 0xf99054ab + symbol_id: 0x76f0e551 symbol_id: 0x6cb15207 symbol_id: 0x12eaf956 symbol_id: 0xac4ecea5 diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index a245078f791d..73632e9e1b31 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -73,6 +73,7 @@ bin2hex bio_endio bio_end_io_acct_remapped + bio_split bio_start_io_acct bitmap_allocate_region __bitmap_and @@ -739,6 +740,22 @@ divider_recalc_rate divider_ro_round_rate_parent divider_round_rate_parent + dm_bufio_client_create + dm_bufio_client_destroy + dm_bufio_mark_buffer_dirty + dm_bufio_new + dm_bufio_read + dm_bufio_release + dm_bufio_write_dirty_buffers + dm_disk + dm_get_device + dm_kobject_release + dm_read_arg_group + dm_register_target + dm_shift_arg + dm_table_get_md + dm_table_get_mode + dm_unregister_target dma_alloc_attrs dma_alloc_noncontiguous dma_alloc_pages From 7024c9cd2887b048eb6891d01daeb8babb3cbfb1 Mon Sep 17 00:00:00 2001 From: Enlin Mu Date: Fri, 15 Sep 2023 16:16:48 +0800 Subject: [PATCH 103/113] ANDROID: ABI: Update symbols to unisoc whitelist Update whitelist for the symbols used by the unisoc device and update the ABI representation accordingly. 1 function symbol(s) added 'int pvclock_gtod_register_notifier(struct notifier_block*)' Bug: 300019103 Change-Id: Ice320a418069f24a27d14939a143ce01f50c0de8 Signed-off-by: Enlin Mu --- android/abi_gki_aarch64.stg | 10 ++++++++++ android/abi_gki_aarch64_unisoc | 2 ++ 2 files changed, 12 insertions(+) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index 125b8f0bc578..fd395f6b1af9 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -371286,6 +371286,15 @@ elf_symbol { type_id: 0x1f00dfeb full_name: "putback_movable_pages" } +elf_symbol { + id: 0x8dafa617 + name: "pvclock_gtod_register_notifier" + is_defined: true + symbol_type: FUNCTION + crc: 0xb4b97c90 + type_id: 0x9b6d4a33 + full_name: "pvclock_gtod_register_notifier" +} elf_symbol { id: 0x53ee2234 name: "pwm_apply_state" @@ -394743,6 +394752,7 @@ interface { symbol_id: 0x15848de9 symbol_id: 0xde695e5a symbol_id: 0x4e730977 + symbol_id: 0x8dafa617 symbol_id: 0x53ee2234 symbol_id: 0x227e051f symbol_id: 0x9a5fd229 diff --git a/android/abi_gki_aarch64_unisoc b/android/abi_gki_aarch64_unisoc index 8455aae21346..af9b8e60d708 100644 --- a/android/abi_gki_aarch64_unisoc +++ b/android/abi_gki_aarch64_unisoc @@ -1913,6 +1913,8 @@ # required by trusty-log.ko vm_map_ram vm_unmap_ram +# required by sprd_time_sync_cp.ko + pvclock_gtod_register_notifier # required by trusty-pm.ko unregister_syscore_ops From bbc9d3bc0b4866a857f0a65f72c4056a2cdb1dd4 Mon Sep 17 00:00:00 2001 From: "xiaosong.ma" Date: Fri, 8 Sep 2023 10:58:08 +0800 Subject: [PATCH 104/113] ANDROID: vendor_hooks: mm: Add tune_swappiness vendor hook in get_swappiness() Add hook in get_swappiness() for customized swappiness when lru_gen is enabled. Bug: 299548382 Test: buid pass Change-Id: If15cb4f71fda6c0b24359f8dc439a090a5434dc9 Signed-off-by: xiaosong.ma --- mm/vmscan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 647e4c0aa0bd..d1b9313ef88f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3221,6 +3221,7 @@ static struct lruvec *get_lruvec(struct mem_cgroup *memcg, int nid) static int get_swappiness(struct lruvec *lruvec, struct scan_control *sc) { + int swappiness; struct mem_cgroup *memcg = lruvec_memcg(lruvec); struct pglist_data *pgdat = lruvec_pgdat(lruvec); @@ -3231,7 +3232,10 @@ static int get_swappiness(struct lruvec *lruvec, struct scan_control *sc) mem_cgroup_get_nr_swap_pages(memcg) <= 0) return 0; - return mem_cgroup_swappiness(memcg); + swappiness = mem_cgroup_swappiness(memcg); + trace_android_vh_tune_swappiness(&swappiness); + + return swappiness; } static int get_nr_gens(struct lruvec *lruvec, int type) From e52e60e3ed8dff3fe0fb9d839c93819c91501560 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Sun, 20 Aug 2023 04:44:48 +0000 Subject: [PATCH 105/113] UPSTREAM: tcpm: Avoid soft reset when partner does not support get_status When partner does not support get_status message, tcpm right now responds with soft reset message. This causes PD renegotiation to happen and resets PPS link. Avoid soft resetting the link when partner does not support get_status message to mitigate PPS resets. [ 208.926752] Setting voltage/current limit 9500 mV 2450 mA [ 208.930407] set_auto_vbus_discharge_threshold mode:3 pps_active:y vbus:9500 ret:0 [ 208.930418] state change SNK_TRANSITION_SINK -> SNK_READY [rev3 POWER_NEGOTIATION] [ 208.930455] AMS POWER_NEGOTIATION finished // ALERT message from the Source [ 213.948442] PD RX, header: 0x19a6 [1] [ 213.948451] state change SNK_READY -> GET_STATUS_SEND [rev3 GETTING_SOURCE_SINK_STATUS] [ 213.948457] PD TX, header: 0x492 [ 213.950402] PD TX complete, status: 0 [ 213.950427] pending state change GET_STATUS_SEND -> GET_STATUS_SEND_TIMEOUT @ 60 ms [rev3 GETTING_SOURCE_SINK_STATUS] // NOT_SUPPORTED from the Source [ 213.959954] PD RX, header: 0xbb0 [1] // sink sends SOFT_RESET [ 213.959958] state change GET_STATUS_SEND -> SNK_SOFT_RESET [rev3 GETTING_SOURCE_SINK_STATUS] [ 213.959962] AMS GETTING_SOURCE_SINK_STATUS finished [ 213.959964] AMS SOFT_RESET_AMS start [ 213.959966] state change SNK_SOFT_RESET -> AMS_START [rev3 SOFT_RESET_AMS] [ 213.959969] state change AMS_START -> SOFT_RESET_SEND [rev3 SOFT_RESET_AMS] Cc: stable@vger.kernel.org Fixes: 8dea75e11380 ("usb: typec: tcpm: Protocol Error handling") Signed-off-by: Badhri Jagan Sridharan Acked-by: Heikki Krogerus Link: https://lore.kernel.org/r/20230820044449.1005889-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman Bug: 265339154 (cherry picked from commit 78e0ea4277546debf7e96797ac3b768539cc44f6) Change-Id: Ic485cf8ae80b26d717b2f22998b267cc07027085 Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/typec/tcpm/tcpm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index ecdfce81dadb..b5e4433a01c5 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2748,6 +2748,13 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, port->sink_cap_done = true; tcpm_set_state(port, ready_state(port), 0); break; + /* + * Some port partners do not support GET_STATUS, avoid soft reset the link to + * prevent redundant power re-negotiation + */ + case GET_STATUS_SEND: + tcpm_set_state(port, ready_state(port), 0); + break; case SRC_READY: case SNK_READY: if (port->vdm_state > VDM_STATE_READY) { From 85cada39d59b486a1cd86c5e4652903d1adda65c Mon Sep 17 00:00:00 2001 From: Neill Kapron Date: Tue, 26 Sep 2023 21:35:42 +0000 Subject: [PATCH 106/113] Revert "BACKPORT: FROMGIT: usb: gadget: udc: Handle gadget_connect failure during bind operation" This reverts commit 251aa28d1640b0ece15c4d4bd074d0449e858f90. Reason for revert: b/301670242 The connect_lock mutex is not being released in error path. This patch was reverted upstream. Signed-off-by: Neill Kapron (cherry picked from https://android-review.googlesource.com/q/commit:b374d94195756312b78fccd8104bcd52cfa486c6) Merged-In: I802a9a8afc9f23b1bf91fa4df4bfb5d207373b04 Change-Id: I802a9a8afc9f23b1bf91fa4df4bfb5d207373b04 --- drivers/usb/gadget/udc/core.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 93695ce5fef0..ed2129be43aa 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1099,16 +1099,12 @@ EXPORT_SYMBOL_GPL(usb_gadget_set_state); /* ------------------------------------------------------------------------- */ /* Acquire connect_lock before calling this function. */ -static int usb_udc_connect_control_locked(struct usb_udc *udc) __must_hold(&udc->connect_lock) +static void usb_udc_connect_control_locked(struct usb_udc *udc) __must_hold(&udc->connect_lock) { - int ret; - if (udc->vbus) - ret = usb_gadget_connect_locked(udc->gadget); + usb_gadget_connect_locked(udc->gadget); else - ret = usb_gadget_disconnect_locked(udc->gadget); - - return ret; + usb_gadget_disconnect_locked(udc->gadget); } static void vbus_event_work(struct work_struct *work) @@ -1582,21 +1578,12 @@ static int gadget_bind_driver(struct device *dev) } usb_gadget_enable_async_callbacks(udc); udc->allow_connect = true; - ret = usb_udc_connect_control_locked(udc); - if (ret) - goto err_connect_control; - + usb_udc_connect_control_locked(udc); mutex_unlock(&udc->connect_lock); kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); return 0; - err_connect_control: - usb_gadget_disable_async_callbacks(udc); - if (gadget->irq) - synchronize_irq(gadget->irq); - usb_gadget_udc_stop_locked(udc); - err_start: driver->unbind(udc->gadget); From a0a2bbee564655b9f866f55fb1e765cb1806b8fb Mon Sep 17 00:00:00 2001 From: Paul Lawrence Date: Tue, 29 Aug 2023 11:17:44 -0700 Subject: [PATCH 107/113] ANDROID: fuse-bpf: Get correct inode in mkdir We were getting the inode with the parent inode info Also change variable names to remove confusion Also set bpf correctly in new inode Bug: 293838958 Bug: 302674450 Bug: 302769221 Bug: 302777981 Test: fuse_test, atest ScopedStorageDeviceTest, atest CtsScopedStorageHostTest Change-Id: I0b6a6951599e0d211afd2243daacb98679503448 Signed-off-by: Paul Lawrence (cherry picked from commit 8fb9de0877bf733b0e7f4ef82037c904e1daa3f7) --- fs/fuse/backing.c | 29 +++++++++------- .../selftests/filesystems/fuse/fuse_test.c | 33 +++++++++++++++++++ .../selftests/filesystems/fuse/test_bpf.c | 22 +++++++++++++ 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 9df0535ad20f..303a78a63cd2 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -1446,32 +1446,34 @@ int fuse_mkdir_initialize( int fuse_mkdir_backing( struct fuse_bpf_args *fa, - struct inode *dir, struct dentry *entry, umode_t mode) + struct inode *dir_inode, struct dentry *entry, umode_t mode) { int err = 0; const struct fuse_mkdir_in *fmi = fa->in_args[0].value; - struct fuse_inode *fuse_inode = get_fuse_inode(dir); - struct inode *backing_inode = fuse_inode->backing_inode; + struct fuse_inode *dir_fuse_inode = get_fuse_inode(dir_inode); + struct inode *dir_backing_inode = dir_fuse_inode->backing_inode; struct path backing_path = {}; struct inode *inode = NULL; - struct dentry *d; //TODO Actually deal with changing the backing entry in mkdir get_fuse_backing_path(entry, &backing_path); if (!backing_path.dentry) return -EBADF; - inode_lock_nested(backing_inode, I_MUTEX_PARENT); + inode_lock_nested(dir_backing_inode, I_MUTEX_PARENT); mode = fmi->mode; - if (!IS_POSIXACL(backing_inode)) + if (!IS_POSIXACL(dir_backing_inode)) mode &= ~fmi->umask; - err = vfs_mkdir(&init_user_ns, backing_inode, backing_path.dentry, mode); + err = vfs_mkdir(&init_user_ns, dir_backing_inode, backing_path.dentry, + mode); if (err) goto out; if (d_really_is_negative(backing_path.dentry) || unlikely(d_unhashed(backing_path.dentry))) { - d = lookup_one_len(entry->d_name.name, backing_path.dentry->d_parent, - entry->d_name.len); + struct dentry *d = lookup_one_len(entry->d_name.name, + backing_path.dentry->d_parent, + entry->d_name.len); + if (IS_ERR(d)) { err = PTR_ERR(d); goto out; @@ -1479,14 +1481,19 @@ int fuse_mkdir_backing( dput(backing_path.dentry); backing_path.dentry = d; } - inode = fuse_iget_backing(dir->i_sb, fuse_inode->nodeid, backing_inode); + inode = fuse_iget_backing(dir_inode->i_sb, 0, + backing_path.dentry->d_inode); if (IS_ERR(inode)) { err = PTR_ERR(inode); goto out; } d_instantiate(entry, inode); + if (get_fuse_inode(inode)->bpf) + bpf_prog_put(get_fuse_inode(inode)->bpf); + get_fuse_inode(inode)->bpf = get_fuse_dentry(entry)->bpf; + get_fuse_dentry(entry)->bpf = NULL; out: - inode_unlock(backing_inode); + inode_unlock(dir_backing_inode); path_put(&backing_path); return err; } diff --git a/tools/testing/selftests/filesystems/fuse/fuse_test.c b/tools/testing/selftests/filesystems/fuse/fuse_test.c index 0bf1f030cbcd..01730e57dc51 100644 --- a/tools/testing/selftests/filesystems/fuse/fuse_test.c +++ b/tools/testing/selftests/filesystems/fuse/fuse_test.c @@ -2047,6 +2047,38 @@ out: return result; } +static int bpf_test_mkdir_and_remove_bpf(const char *mount_dir) +{ + const char *dir = "dir"; + + int result = TEST_FAILURE; + int src_fd = -1; + int bpf_fd = -1; + int fuse_dev = -1; + int fd = -1; + int fd2 = -1; + + TEST(src_fd = open(ft_src, O_DIRECTORY | O_RDONLY | O_CLOEXEC), + src_fd != -1); + TESTEQUAL(install_elf_bpf("test_bpf.bpf", "test_mkdir_remove", &bpf_fd, + NULL, NULL), 0); + TESTEQUAL(mount_fuse_no_init(mount_dir, bpf_fd, src_fd, &fuse_dev), 0); + TEST(fd = s_mkdir(s_path(s(mount_dir), s(dir)), 0777), + fd != -1); + TEST(fd2 = s_open(s_path(s(mount_dir), s(dir)), O_RDONLY), + fd2 != -1); + + result = TEST_SUCCESS; +out: + close(fd2); + close(fd); + close(fuse_dev); + close(bpf_fd); + close(src_fd); + umount(mount_dir); + return result; +} + static void parse_range(const char *ranges, bool *run_test, size_t tests) { size_t i; @@ -2175,6 +2207,7 @@ int main(int argc, char *argv[]) MAKE_TEST(bpf_test_lookup_postfilter), MAKE_TEST(flock_test), MAKE_TEST(bpf_test_create_and_remove_bpf), + MAKE_TEST(bpf_test_mkdir_and_remove_bpf), }; #undef MAKE_TEST diff --git a/tools/testing/selftests/filesystems/fuse/test_bpf.c b/tools/testing/selftests/filesystems/fuse/test_bpf.c index e02bdb4a9380..a014b915c059 100644 --- a/tools/testing/selftests/filesystems/fuse/test_bpf.c +++ b/tools/testing/selftests/filesystems/fuse/test_bpf.c @@ -530,4 +530,26 @@ int createremovebpf_test(struct fuse_bpf_args *fa) } } +SEC("test_mkdir_remove") +int mkdirremovebpf_test(struct fuse_bpf_args *fa) +{ + switch (fa->opcode) { + case FUSE_LOOKUP | FUSE_PREFILTER: { + return FUSE_BPF_BACKING | FUSE_BPF_POST_FILTER; + } + case FUSE_LOOKUP | FUSE_POSTFILTER: { + struct fuse_entry_bpf_out *febo = fa->out_args[1].value; + + febo->bpf_action = FUSE_ACTION_REMOVE; + return 0; + } + + case FUSE_OPENDIR | FUSE_PREFILTER: { + return -EIO; + } + + default: + return FUSE_BPF_BACKING; + } +} From 0904da5476801880f0f523f40be00bae3f48ed51 Mon Sep 17 00:00:00 2001 From: Paolo Abeni Date: Fri, 7 Jul 2023 10:11:10 +0200 Subject: [PATCH 108/113] UPSTREAM: net: prevent skb corruption on frag list segmentation [ Upstream commit c329b261afe71197d9da83c1f18eb45a7e97e089 ] Ian reported several skb corruptions triggered by rx-gro-list, collecting different oops alike: [ 62.624003] BUG: kernel NULL pointer dereference, address: 00000000000000c0 [ 62.631083] #PF: supervisor read access in kernel mode [ 62.636312] #PF: error_code(0x0000) - not-present page [ 62.641541] PGD 0 P4D 0 [ 62.644174] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 62.648629] CPU: 1 PID: 913 Comm: napi/eno2-79 Not tainted 6.4.0 #364 [ 62.655162] Hardware name: Supermicro Super Server/A2SDi-12C-HLN4F, BIOS 1.7a 10/13/2022 [ 62.663344] RIP: 0010:__udp_gso_segment (./include/linux/skbuff.h:2858 ./include/linux/udp.h:23 net/ipv4/udp_offload.c:228 net/ipv4/udp_offload.c:261 net/ipv4/udp_offload.c:277) [ 62.687193] RSP: 0018:ffffbd3a83b4f868 EFLAGS: 00010246 [ 62.692515] RAX: 00000000000000ce RBX: 0000000000000000 RCX: 0000000000000000 [ 62.699743] RDX: ffffa124def8a000 RSI: 0000000000000079 RDI: ffffa125952a14d4 [ 62.706970] RBP: ffffa124def8a000 R08: 0000000000000022 R09: 00002000001558c9 [ 62.714199] R10: 0000000000000000 R11: 00000000be554639 R12: 00000000000000e2 [ 62.721426] R13: ffffa125952a1400 R14: ffffa125952a1400 R15: 00002000001558c9 [ 62.728654] FS: 0000000000000000(0000) GS:ffffa127efa40000(0000) knlGS:0000000000000000 [ 62.736852] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 62.742702] CR2: 00000000000000c0 CR3: 00000001034b0000 CR4: 00000000003526e0 [ 62.749948] Call Trace: [ 62.752498] [ 62.779267] inet_gso_segment (net/ipv4/af_inet.c:1398) [ 62.787605] skb_mac_gso_segment (net/core/gro.c:141) [ 62.791906] __skb_gso_segment (net/core/dev.c:3403 (discriminator 2)) [ 62.800492] validate_xmit_skb (./include/linux/netdevice.h:4862 net/core/dev.c:3659) [ 62.804695] validate_xmit_skb_list (net/core/dev.c:3710) [ 62.809158] sch_direct_xmit (net/sched/sch_generic.c:330) [ 62.813198] __dev_queue_xmit (net/core/dev.c:3805 net/core/dev.c:4210) net/netfilter/core.c:626) [ 62.821093] br_dev_queue_push_xmit (net/bridge/br_forward.c:55) [ 62.825652] maybe_deliver (net/bridge/br_forward.c:193) [ 62.829420] br_flood (net/bridge/br_forward.c:233) [ 62.832758] br_handle_frame_finish (net/bridge/br_input.c:215) [ 62.837403] br_handle_frame (net/bridge/br_input.c:298 net/bridge/br_input.c:416) [ 62.851417] __netif_receive_skb_core.constprop.0 (net/core/dev.c:5387) [ 62.866114] __netif_receive_skb_list_core (net/core/dev.c:5570) [ 62.871367] netif_receive_skb_list_internal (net/core/dev.c:5638 net/core/dev.c:5727) [ 62.876795] napi_complete_done (./include/linux/list.h:37 ./include/net/gro.h:434 ./include/net/gro.h:429 net/core/dev.c:6067) [ 62.881004] ixgbe_poll (drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3191) [ 62.893534] __napi_poll (net/core/dev.c:6498) [ 62.897133] napi_threaded_poll (./include/linux/netpoll.h:89 net/core/dev.c:6640) [ 62.905276] kthread (kernel/kthread.c:379) [ 62.913435] ret_from_fork (arch/x86/entry/entry_64.S:314) [ 62.917119] In the critical scenario, rx-gro-list GRO-ed packets are fed, via a bridge, both to the local input path and to an egress device (tun). The segmentation of such packets unsafely writes to the cloned skbs with shared heads. This change addresses the issue by uncloning as needed the to-be-segmented skbs. Bug: 303965710 Reported-by: Ian Kumlien Tested-by: Ian Kumlien Fixes: 3a1296a38d0c ("net: Support GRO/GSO fraglist chaining.") Change-Id: I6e79a4d19751becd42ec486233f1a8de4a0f3f7e Signed-off-by: Paolo Abeni Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin (cherry picked from commit b548c046c7de4c427ac5a0d5008a995d5e304f9b) --- net/core/skbuff.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index cd4b3a610961..732ea19927a4 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4032,6 +4032,11 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb, skb_push(skb, -skb_network_offset(skb) + offset); + /* Ensure the head is writeable before touching the shared info */ + err = skb_unclone(skb, GFP_ATOMIC); + if (err) + goto err_linearize; + skb_shinfo(skb)->frag_list = NULL; while (list_skb) { From 424eb5aed068fdc23f74d6c808801dc378aa0792 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Fri, 2 Jun 2023 10:42:53 +0200 Subject: [PATCH 109/113] UPSTREAM: sched: Unconditionally use full-fat wait_task_inactive() While modifying wait_task_inactive() for PREEMPT_RT; the build robot noted that UP got broken. This led to audit and consideration of the UP implementation of wait_task_inactive(). It looks like the UP implementation is also broken for PREEMPT; consider task_current_syscall() getting preempted between the two calls to wait_task_inactive(). Therefore move the wait_task_inactive() implementation out of CONFIG_SMP and unconditionally use it. Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230602103731.GA630648%40hirez.programming.kicks-ass.net (cherry picked from commit d5e1586617be7093ea3419e3fa9387ed833cdbb1) Bug: 292064955 Bug: 304294320 Change-Id: Ief91cf48c27533fee47d5bd049c8a9be4010e6f6 Signed-off-by: Elliot Berman (cherry picked from commit b52b33e91249841e07540aab76abe329a5f5a18e) --- include/linux/sched.h | 7 +- kernel/sched/core.c | 216 +++++++++++++++++++++--------------------- 2 files changed, 110 insertions(+), 113 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 19a43aa5a021..431cb079f6a9 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2029,15 +2029,12 @@ static __always_inline void scheduler_ipi(void) */ preempt_fold_need_resched(); } -extern unsigned long wait_task_inactive(struct task_struct *, unsigned int match_state); #else static inline void scheduler_ipi(void) { } -static inline unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state) -{ - return 1; -} #endif +extern unsigned long wait_task_inactive(struct task_struct *, unsigned int match_state); + /* * Set thread flags in other task's structures. * See asm/thread_info.h for TIF_xxxx flags available: diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f27338be5f24..76b9e18af579 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2249,6 +2249,114 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags) } EXPORT_SYMBOL_GPL(check_preempt_curr); +/* + * wait_task_inactive - wait for a thread to unschedule. + * + * Wait for the thread to block in any of the states set in @match_state. + * If it changes, i.e. @p might have woken up, then return zero. When we + * succeed in waiting for @p to be off its CPU, we return a positive number + * (its total switch count). If a second call a short while later returns the + * same number, the caller can be sure that @p has remained unscheduled the + * whole time. + * + * The caller must ensure that the task *will* unschedule sometime soon, + * else this function might spin for a *long* time. This function can't + * be called with interrupts off, or it may introduce deadlock with + * smp_call_function() if an IPI is sent by the same process we are + * waiting to become inactive. + */ +unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state) +{ + int running, queued; + struct rq_flags rf; + unsigned long ncsw; + struct rq *rq; + + for (;;) { + /* + * We do the initial early heuristics without holding + * any task-queue locks at all. We'll only try to get + * the runqueue lock when things look like they will + * work out! + */ + rq = task_rq(p); + + /* + * If the task is actively running on another CPU + * still, just relax and busy-wait without holding + * any locks. + * + * NOTE! Since we don't hold any locks, it's not + * even sure that "rq" stays as the right runqueue! + * But we don't care, since "task_on_cpu()" will + * return false if the runqueue has changed and p + * is actually now running somewhere else! + */ + while (task_on_cpu(rq, p)) { + if (!(READ_ONCE(p->__state) & match_state)) + return 0; + cpu_relax(); + } + + /* + * Ok, time to look more closely! We need the rq + * lock now, to be *sure*. If we're wrong, we'll + * just go back and repeat. + */ + rq = task_rq_lock(p, &rf); + trace_sched_wait_task(p); + running = task_on_cpu(rq, p); + queued = task_on_rq_queued(p); + ncsw = 0; + if (READ_ONCE(p->__state) & match_state) + ncsw = p->nvcsw | LONG_MIN; /* sets MSB */ + task_rq_unlock(rq, p, &rf); + + /* + * If it changed from the expected state, bail out now. + */ + if (unlikely(!ncsw)) + break; + + /* + * Was it really running after all now that we + * checked with the proper locks actually held? + * + * Oops. Go back and try again.. + */ + if (unlikely(running)) { + cpu_relax(); + continue; + } + + /* + * It's not enough that it's not actively running, + * it must be off the runqueue _entirely_, and not + * preempted! + * + * So if it was still runnable (but just not actively + * running right now), it's preempted, and we should + * yield - it could be a while. + */ + if (unlikely(queued)) { + ktime_t to = NSEC_PER_SEC / HZ; + + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_hrtimeout(&to, HRTIMER_MODE_REL_HARD); + continue; + } + + /* + * Ahh, all good. It wasn't running, and it wasn't + * runnable, which means that it will never become + * running in the future either. We're all done! + */ + break; + } + + return ncsw; +} + #ifdef CONFIG_SMP static void @@ -3363,114 +3471,6 @@ out: } EXPORT_SYMBOL_GPL(migrate_swap); -/* - * wait_task_inactive - wait for a thread to unschedule. - * - * Wait for the thread to block in any of the states set in @match_state. - * If it changes, i.e. @p might have woken up, then return zero. When we - * succeed in waiting for @p to be off its CPU, we return a positive number - * (its total switch count). If a second call a short while later returns the - * same number, the caller can be sure that @p has remained unscheduled the - * whole time. - * - * The caller must ensure that the task *will* unschedule sometime soon, - * else this function might spin for a *long* time. This function can't - * be called with interrupts off, or it may introduce deadlock with - * smp_call_function() if an IPI is sent by the same process we are - * waiting to become inactive. - */ -unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state) -{ - int running, queued; - struct rq_flags rf; - unsigned long ncsw; - struct rq *rq; - - for (;;) { - /* - * We do the initial early heuristics without holding - * any task-queue locks at all. We'll only try to get - * the runqueue lock when things look like they will - * work out! - */ - rq = task_rq(p); - - /* - * If the task is actively running on another CPU - * still, just relax and busy-wait without holding - * any locks. - * - * NOTE! Since we don't hold any locks, it's not - * even sure that "rq" stays as the right runqueue! - * But we don't care, since "task_on_cpu()" will - * return false if the runqueue has changed and p - * is actually now running somewhere else! - */ - while (task_on_cpu(rq, p)) { - if (!(READ_ONCE(p->__state) & match_state)) - return 0; - cpu_relax(); - } - - /* - * Ok, time to look more closely! We need the rq - * lock now, to be *sure*. If we're wrong, we'll - * just go back and repeat. - */ - rq = task_rq_lock(p, &rf); - trace_sched_wait_task(p); - running = task_on_cpu(rq, p); - queued = task_on_rq_queued(p); - ncsw = 0; - if (READ_ONCE(p->__state) & match_state) - ncsw = p->nvcsw | LONG_MIN; /* sets MSB */ - task_rq_unlock(rq, p, &rf); - - /* - * If it changed from the expected state, bail out now. - */ - if (unlikely(!ncsw)) - break; - - /* - * Was it really running after all now that we - * checked with the proper locks actually held? - * - * Oops. Go back and try again.. - */ - if (unlikely(running)) { - cpu_relax(); - continue; - } - - /* - * It's not enough that it's not actively running, - * it must be off the runqueue _entirely_, and not - * preempted! - * - * So if it was still runnable (but just not actively - * running right now), it's preempted, and we should - * yield - it could be a while. - */ - if (unlikely(queued)) { - ktime_t to = NSEC_PER_SEC / HZ; - - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_hrtimeout(&to, HRTIMER_MODE_REL_HARD); - continue; - } - - /* - * Ahh, all good. It wasn't running, and it wasn't - * runnable, which means that it will never become - * running in the future either. We're all done! - */ - break; - } - - return ncsw; -} - /*** * kick_process - kick a running thread to enter/exit the kernel * @p: the to-be-kicked thread From c8bbfb7e22894dfa89b0da095c624eeb043b2268 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 31 May 2023 16:39:07 +0200 Subject: [PATCH 110/113] UPSTREAM: sched: Consider task_struct::saved_state in wait_task_inactive() With the introduction of task_struct::saved_state in commit 5f220be21418 ("sched/wakeup: Prepare for RT sleeping spin/rwlocks") matching the task state has gotten more complicated. That same commit changed try_to_wake_up() to consider both states, but wait_task_inactive() has been neglected. Sebastian noted that the wait_task_inactive() usage in ptrace_check_attach() can misbehave when ptrace_stop() is blocked on the tasklist_lock after it sets TASK_TRACED. Therefore extract a common helper from ttwu_state_match() and use that to teach wait_task_inactive() about the PREEMPT_RT locks. Originally-by: Sebastian Andrzej Siewior Signed-off-by: Peter Zijlstra (Intel) Tested-by: Sebastian Andrzej Siewior Link: https://lkml.kernel.org/r/20230601091234.GW83892@hirez.programming.kicks-ass.net (cherry picked from commit 1c06918788e8ae6e69e4381a2806617312922524) Bug: 292064955 Bug: 304294320 Change-Id: I2cc02dfdf3c04be146078f80d09c3a87979d79a6 Signed-off-by: Elliot Berman (cherry picked from commit ac9005946aec30cb976c451c227899560b02cc37) --- kernel/sched/core.c | 59 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 76b9e18af579..c033651150cc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2249,6 +2249,39 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags) } EXPORT_SYMBOL_GPL(check_preempt_curr); +static __always_inline +int __task_state_match(struct task_struct *p, unsigned int state) +{ + if (READ_ONCE(p->__state) & state) + return 1; + +#ifdef CONFIG_PREEMPT_RT + if (READ_ONCE(p->saved_state) & state) + return -1; +#endif + return 0; +} + +static __always_inline +int task_state_match(struct task_struct *p, unsigned int state) +{ +#ifdef CONFIG_PREEMPT_RT + int match; + + /* + * Serialize against current_save_and_set_rtlock_wait_state() and + * current_restore_rtlock_saved_state(). + */ + raw_spin_lock_irq(&p->pi_lock); + match = __task_state_match(p, state); + raw_spin_unlock_irq(&p->pi_lock); + + return match; +#else + return __task_state_match(p, state); +#endif +} + /* * wait_task_inactive - wait for a thread to unschedule. * @@ -2267,7 +2300,7 @@ EXPORT_SYMBOL_GPL(check_preempt_curr); */ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state) { - int running, queued; + int running, queued, match; struct rq_flags rf; unsigned long ncsw; struct rq *rq; @@ -2293,7 +2326,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state * is actually now running somewhere else! */ while (task_on_cpu(rq, p)) { - if (!(READ_ONCE(p->__state) & match_state)) + if (!task_state_match(p, match_state)) return 0; cpu_relax(); } @@ -2308,8 +2341,15 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state running = task_on_cpu(rq, p); queued = task_on_rq_queued(p); ncsw = 0; - if (READ_ONCE(p->__state) & match_state) + if ((match = __task_state_match(p, match_state))) { + /* + * When matching on p->saved_state, consider this task + * still queued so it will wait. + */ + if (match < 0) + queued = 1; ncsw = p->nvcsw | LONG_MIN; /* sets MSB */ + } task_rq_unlock(rq, p, &rf); /* @@ -4019,15 +4059,14 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags) static __always_inline bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) { + int match; + if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)) { WARN_ON_ONCE((state & TASK_RTLOCK_WAIT) && state != TASK_RTLOCK_WAIT); } - if (READ_ONCE(p->__state) & state) { - *success = 1; - return true; - } + *success = !!(match = __task_state_match(p, state)); #ifdef CONFIG_PREEMPT_RT /* @@ -4043,12 +4082,10 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) * p::saved_state to TASK_RUNNING so any further tests will * not result in false positives vs. @success */ - if (p->saved_state & state) { + if (match < 0) p->saved_state = TASK_RUNNING; - *success = 1; - } #endif - return false; + return match > 0; } /* From 8095efce6cf348479aea16b322ac9dd9e12cf9c9 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Fri, 8 Sep 2023 15:49:15 -0700 Subject: [PATCH 111/113] BACKPORT: FROMGIT: sched/core: Remove ifdeffery for saved_state In preparation for freezer to also use saved_state, remove the CONFIG_PREEMPT_RT compilation guard around saved_state. On the arm64 platform I tested which did not have CONFIG_PREEMPT_RT, there was no statistically significant deviation by applying this patch. Test methodology: perf bench sched message -g 40 -l 40 Signed-off-by: Elliot Berman Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar (cherry picked from commit fa14aa2c23d31eb39bc615feb920f28d32d2a87e https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core) Bug: 292064955 Bug: 304294320 Change-Id: I9c11ab7ce31ba3b48b304229898d4c7c18a6cb2c [eberman: Use KABI reservation to preserve CRC/ABI of struct task_struct and preserved raw_spin_(un)lock instead of new guard(...) syntax in task_state_match] Signed-off-by: Elliot Berman (cherry picked from commit 457e65696a45a985ae548d554fec213aa72e5789) --- include/linux/sched.h | 6 ++---- kernel/sched/core.c | 10 ++-------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 431cb079f6a9..cf3d130319cb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -758,10 +758,8 @@ struct task_struct { #endif unsigned int __state; -#ifdef CONFIG_PREEMPT_RT /* saved state for "spinlock sleepers" */ - unsigned int saved_state; -#endif + /* moved to ANDROID_KABI_USE(1, unsigned int saved_state) */ /* * This begins the randomizable portion of task_struct. Only @@ -1548,7 +1546,7 @@ struct task_struct { */ union rv_task_monitor rv[RV_PER_TASK_MONITORS]; #endif - ANDROID_KABI_RESERVE(1); + ANDROID_KABI_USE(1, unsigned int saved_state); ANDROID_KABI_RESERVE(2); ANDROID_KABI_RESERVE(3); ANDROID_KABI_RESERVE(4); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c033651150cc..0f1a8b497672 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2255,17 +2255,15 @@ int __task_state_match(struct task_struct *p, unsigned int state) if (READ_ONCE(p->__state) & state) return 1; -#ifdef CONFIG_PREEMPT_RT if (READ_ONCE(p->saved_state) & state) return -1; -#endif + return 0; } static __always_inline int task_state_match(struct task_struct *p, unsigned int state) { -#ifdef CONFIG_PREEMPT_RT int match; /* @@ -2277,9 +2275,6 @@ int task_state_match(struct task_struct *p, unsigned int state) raw_spin_unlock_irq(&p->pi_lock); return match; -#else - return __task_state_match(p, state); -#endif } /* @@ -4068,7 +4063,6 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) *success = !!(match = __task_state_match(p, state)); -#ifdef CONFIG_PREEMPT_RT /* * Saved state preserves the task state across blocking on * an RT lock. If the state matches, set p::saved_state to @@ -4084,7 +4078,7 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) */ if (match < 0) p->saved_state = TASK_RUNNING; -#endif + return match > 0; } From d4042ec34d35be028302fb57c9d46bbba0389ce7 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Fri, 8 Sep 2023 15:49:16 -0700 Subject: [PATCH 112/113] FROMGIT: freezer,sched: Use saved_state to reduce some spurious wakeups After commit f5d39b020809 ("freezer,sched: Rewrite core freezer logic"), tasks that transition directly from TASK_FREEZABLE to TASK_FROZEN are always woken up on the thaw path. Prior to that commit, tasks could ask freezer to consider them "frozen enough" via freezer_do_not_count(). The commit replaced freezer_do_not_count() with a TASK_FREEZABLE state which allows freezer to immediately mark the task as TASK_FROZEN without waking up the task. This is efficient for the suspend path, but on the thaw path, the task is always woken up even if the task didn't need to wake up and goes back to its TASK_(UN)INTERRUPTIBLE state. Although these tasks are capable of handling of the wakeup, we can observe a power/perf impact from the extra wakeup. We observed on Android many tasks wait in the TASK_FREEZABLE state (particularly due to many of them being binder clients). We observed nearly 4x the number of tasks and a corresponding linear increase in latency and power consumption when thawing the system. The latency increased from ~15ms to ~50ms. Avoid the spurious wakeups by saving the state of TASK_FREEZABLE tasks. If the task was running before entering TASK_FROZEN state (__refrigerator()) or if the task received a wake up for the saved state, then the task is woken on thaw. saved_state from PREEMPT_RT locks can be re-used because freezer would not stomp on the rtlock wait flow: TASK_RTLOCK_WAIT isn't considered freezable. Reported-by: Prakash Viswalingam Signed-off-by: Elliot Berman Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar (cherry picked from commit 8f0eed4a78a81668bc78923ea09f51a7a663c2b0) (cherry picked from commit e4d93065a5085dbb862aa4bd06fb3e51b02e8857 https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core) Bug: 292064955 Bug: 304294320 Change-Id: I121cfff46536a13e59b5eb60842984aed0d73faa Signed-off-by: Elliot Berman (cherry picked from commit 22cd8e0def4b56783ea66b10a619fbbc7a3bf634) --- kernel/freezer.c | 41 +++++++++++++++++++---------------------- kernel/sched/core.c | 23 ++++++++++++++--------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/kernel/freezer.c b/kernel/freezer.c index b672c614b1e9..abd7f58cfe04 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -74,7 +74,11 @@ bool __refrigerator(bool check_kthr_stop) for (;;) { bool freeze; + raw_spin_lock_irq(¤t->pi_lock); set_current_state(TASK_FROZEN); + /* unstale saved_state so that __thaw_task() will wake us up */ + current->saved_state = TASK_RUNNING; + raw_spin_unlock_irq(¤t->pi_lock); spin_lock_irq(&freezer_lock); freeze = freezing(current) && !(check_kthr_stop && kthread_should_stop()); @@ -133,6 +137,7 @@ static int __set_task_frozen(struct task_struct *p, void *arg) WARN_ON_ONCE(debug_locks && p->lockdep_depth); #endif + p->saved_state = p->__state; WRITE_ONCE(p->__state, TASK_FROZEN); return TASK_FROZEN; } @@ -174,42 +179,34 @@ bool freeze_task(struct task_struct *p) } /* - * The special task states (TASK_STOPPED, TASK_TRACED) keep their canonical - * state in p->jobctl. If either of them got a wakeup that was missed because - * TASK_FROZEN, then their canonical state reflects that and the below will - * refuse to restore the special state and instead issue the wakeup. + * Restore the saved_state before the task entered freezer. For typical task + * in the __refrigerator(), saved_state == TASK_RUNNING so nothing happens + * here. For tasks which were TASK_NORMAL | TASK_FREEZABLE, their initial state + * is restored unless they got an expected wakeup (see ttwu_state_match()). + * Returns 1 if the task state was restored. */ -static int __set_task_special(struct task_struct *p, void *arg) +static int __restore_freezer_state(struct task_struct *p, void *arg) { - unsigned int state = 0; + unsigned int state = p->saved_state; - if (p->jobctl & JOBCTL_TRACED) - state = TASK_TRACED; - - else if (p->jobctl & JOBCTL_STOPPED) - state = TASK_STOPPED; - - if (state) + if (state != TASK_RUNNING) { WRITE_ONCE(p->__state, state); + return 1; + } - return state; + return 0; } void __thaw_task(struct task_struct *p) { - unsigned long flags, flags2; + unsigned long flags; spin_lock_irqsave(&freezer_lock, flags); if (WARN_ON_ONCE(freezing(p))) goto unlock; - if (lock_task_sighand(p, &flags2)) { - /* TASK_FROZEN -> TASK_{STOPPED,TRACED} */ - bool ret = task_call_func(p, __set_task_special, NULL); - unlock_task_sighand(p, &flags2); - if (ret) - goto unlock; - } + if (task_call_func(p, __restore_freezer_state, NULL)) + goto unlock; wake_up_state(p, TASK_FROZEN); unlock: diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0f1a8b497672..16941a9cb5a9 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2267,8 +2267,8 @@ int task_state_match(struct task_struct *p, unsigned int state) int match; /* - * Serialize against current_save_and_set_rtlock_wait_state() and - * current_restore_rtlock_saved_state(). + * Serialize against current_save_and_set_rtlock_wait_state(), + * current_restore_rtlock_saved_state(), and __refrigerator(). */ raw_spin_lock_irq(&p->pi_lock); match = __task_state_match(p, state); @@ -4043,13 +4043,17 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags) * The caller holds p::pi_lock if p != current or has preemption * disabled when p == current. * - * The rules of PREEMPT_RT saved_state: + * The rules of saved_state: * * The related locking code always holds p::pi_lock when updating * p::saved_state, which means the code is fully serialized in both cases. * - * The lock wait and lock wakeups happen via TASK_RTLOCK_WAIT. No other - * bits set. This allows to distinguish all wakeup scenarios. + * For PREEMPT_RT, the lock wait and lock wakeups happen via TASK_RTLOCK_WAIT. + * No other bits set. This allows to distinguish all wakeup scenarios. + * + * For FREEZER, the wakeup happens via TASK_FROZEN. No other bits set. This + * allows us to prevent early wakeup of tasks before they can be run on + * asymmetric ISA architectures (eg ARMv9). */ static __always_inline bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) @@ -4065,10 +4069,11 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) /* * Saved state preserves the task state across blocking on - * an RT lock. If the state matches, set p::saved_state to - * TASK_RUNNING, but do not wake the task because it waits - * for a lock wakeup. Also indicate success because from - * the regular waker's point of view this has succeeded. + * an RT lock or TASK_FREEZABLE tasks. If the state matches, + * set p::saved_state to TASK_RUNNING, but do not wake the task + * because it waits for a lock wakeup or __thaw_task(). Also + * indicate success because from the regular waker's point of + * view this has succeeded. * * After acquiring the lock the task will restore p::__state * from p::saved_state which ensures that the regular From 7c8cdb3894d30a697255b8940719f9fde86e2741 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Tue, 26 Sep 2023 08:46:33 -0700 Subject: [PATCH 113/113] ANDROID: Update STG for ANDROID_KABI_USE(1, unsigned int saved_state) Update STG for commit f5c2fe80d11f ("BACKPORT: FROMGIT: sched/core: Remove ifdeffery for saved_state"). type 'struct task_struct' changed member 'union { unsigned int saved_state; struct { u64 android_kabi_reserved1; }; union { }; }' was added member 'u64 android_kabi_reserved1' was removed Bug: 292064955 Bug: 304294320 Change-Id: If3796ed8a5f7fb2be569c15b4f7c054ee786bc18 Signed-off-by: Elliot Berman (cherry picked from commit 4301901382bf140592f6fe37c67db1729cfd5e3c) --- android/abi_gki_aarch64.stg | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/android/abi_gki_aarch64.stg b/android/abi_gki_aarch64.stg index fd395f6b1af9..23b4bcc56ef3 100644 --- a/android/abi_gki_aarch64.stg +++ b/android/abi_gki_aarch64.stg @@ -38564,6 +38564,11 @@ member { type_id: 0x4f10779f offset: 192 } +member { + id: 0x3024ec51 + type_id: 0x4fbdc803 + offset: 28800 +} member { id: 0x302f914f type_id: 0x4f903dda @@ -45622,12 +45627,6 @@ member { type_id: 0x92233392 offset: 704 } -member { - id: 0x2d081767 - name: "android_kabi_reserved1" - type_id: 0x92233392 - offset: 28800 -} member { id: 0x2d0817b6 name: "android_kabi_reserved1" @@ -168907,6 +168906,11 @@ member { type_id: 0x92233392 offset: 64 } +member { + id: 0x653b6170 + name: "saved_state" + type_id: 0x4585663f +} member { id: 0x72f4c281 name: "saved_syn" @@ -210373,6 +210377,16 @@ struct_union { member_id: 0xca60e328 } } +struct_union { + id: 0x4fbdc803 + kind: UNION + definition { + bytesize: 8 + member_id: 0x653b6170 + member_id: 0x27000c61 + member_id: 0x36752b74 + } +} struct_union { id: 0x4fd8e877 kind: UNION @@ -255301,7 +255315,7 @@ struct_union { member_id: 0xedf50137 member_id: 0xd666cd53 member_id: 0x9a3ad7bf - member_id: 0x2d081767 + member_id: 0x3024ec51 member_id: 0x63760531 member_id: 0xac894e97 member_id: 0xe0f63fac