diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index c46fbd2d1133..858dd038499d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -939,6 +939,10 @@ can be useful when debugging issues that require an SLB miss to occur. + disable_dma32= [KNL] + Dynamically disable ZONE_DMA32 on kernels compiled with + CONFIG_ZONE_DMA32=y. + stress_slb [PPC] Limits the number of kernel SLB entries, and flushes them frequently to increase the rate of SLB faults diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index c4f6337a6687..13e355956e3c 100755 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -426,6 +426,7 @@ + @@ -484,6 +485,7 @@ + @@ -590,6 +592,7 @@ + @@ -4982,6 +4985,7 @@ + @@ -5770,6 +5774,10 @@ + + + + @@ -6014,6 +6022,7 @@ + @@ -6040,6 +6049,7 @@ + @@ -6075,6 +6085,7 @@ + @@ -6197,6 +6208,7 @@ + @@ -6400,6 +6412,7 @@ + @@ -10266,24 +10279,24 @@ - + - + - + - + - + - + - + @@ -18163,42 +18176,42 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -18678,27 +18691,27 @@ - + - + - + - + - + - + - + - + @@ -20651,21 +20664,21 @@ - + - + - + - + - + - + @@ -22981,21 +22994,21 @@ - + - + - + - + - + - + @@ -25803,33 +25816,33 @@ - + - + - + - + - + - + - + - + - + - + @@ -26452,15 +26465,15 @@ - + - + - + - + @@ -26739,33 +26752,33 @@ - + - + - + - + - + - + - + - + - + - + @@ -29530,12 +29543,12 @@ - + - + - + @@ -29652,21 +29665,21 @@ - + - + - + - + - + - + @@ -32137,15 +32150,15 @@ - + - + - + - + @@ -32677,30 +32690,30 @@ - + - + - + - + - + - + - + - + - + @@ -32970,7 +32983,7 @@ - + @@ -33048,12 +33061,12 @@ - + - + - + @@ -33380,7 +33393,7 @@ - + @@ -39455,30 +39468,30 @@ - + - + - + - + - + - + - + - + - + @@ -45318,9 +45331,9 @@ - + - + @@ -45470,21 +45483,21 @@ - + - + - + - + - + - + @@ -45724,15 +45737,15 @@ - + - + - + - + @@ -47048,7 +47061,7 @@ - + @@ -51198,54 +51211,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -51811,18 +51824,18 @@ - + - + - + - + - + @@ -52097,18 +52110,18 @@ - + - + - + - + - + @@ -52506,42 +52519,42 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -53407,12 +53420,12 @@ - + - + - + @@ -55426,18 +55439,18 @@ - + - + - + - + - + @@ -56230,21 +56243,21 @@ - + - + - + - + - + - + @@ -56727,15 +56740,15 @@ - + - + - + - + @@ -57689,36 +57702,36 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -58757,15 +58770,15 @@ - + - + - + - + @@ -60458,24 +60471,24 @@ - + - + - + - + - + - + - + @@ -62655,15 +62668,15 @@ - + - + - + - + @@ -68193,15 +68206,15 @@ - + - + - + - + @@ -70134,15 +70147,15 @@ - + - + - + - + @@ -73187,12 +73200,12 @@ - + - + - + @@ -73261,36 +73274,36 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -74239,18 +74252,18 @@ - + - + - + - + - + @@ -79791,7 +79804,7 @@ - + @@ -80927,228 +80940,228 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -81162,15 +81175,15 @@ - + - + - + - + @@ -83340,291 +83353,291 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -86530,21 +86543,21 @@ - + - + - + - + - + - + @@ -86862,18 +86875,18 @@ - + - + - + - + - + @@ -88759,9 +88772,9 @@ - + - + @@ -89135,21 +89148,21 @@ - + - + - + - + - + - + @@ -91649,15 +91662,15 @@ - + - + - + - + @@ -93137,24 +93150,24 @@ - + - + - + - + - + - + - + @@ -94302,27 +94315,27 @@ - + - + - + - + - + - + - + - + @@ -95975,36 +95988,36 @@ - + - + - + - + - + - + - + - + - + - + - + @@ -99125,63 +99138,63 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -99460,18 +99473,18 @@ - + - + - + - + - + @@ -100351,18 +100364,18 @@ - + - + - + - + - + @@ -102741,15 +102754,15 @@ - + - + - + - + @@ -108720,60 +108733,60 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -109011,27 +109024,27 @@ - + - + - + - + - + - + - + - + @@ -109386,15 +109399,15 @@ - + - + - + - + @@ -110228,12 +110241,12 @@ - + - + - + @@ -113520,11 +113533,11 @@ - - - - - + + + + + @@ -114128,9 +114141,9 @@ - - - + + + @@ -114138,9 +114151,9 @@ - - - + + + @@ -114381,9 +114394,9 @@ - - - + + + @@ -114671,8 +114684,8 @@ - - + + @@ -114705,8 +114718,8 @@ - - + + @@ -114930,8 +114943,8 @@ - - + + @@ -115772,35 +115785,35 @@ - - - - + + + + - - - - - - + - - - + - - - - + + + + + - - - - - + + + + + + + + + + + @@ -115809,12 +115822,12 @@ - - - - - - + + + + + + @@ -115823,30 +115836,30 @@ - - - - - - - - - - - + + - - - - - + + + + + + + + + + + + + + @@ -115869,17 +115882,17 @@ - - - - - + + + + + - - - - + + + + @@ -116076,6 +116089,16 @@ + + + + + + + + + + @@ -116435,6 +116458,14 @@ + + + + + + + + @@ -117093,6 +117124,12 @@ + + + + + + @@ -117392,22 +117429,22 @@ - - - - - + + + + + - + - - - + + + - - + + @@ -117438,6 +117475,7 @@ + @@ -117464,6 +117502,7 @@ + @@ -117499,6 +117538,7 @@ + @@ -117553,7 +117593,7 @@ - + @@ -117621,6 +117661,7 @@ + @@ -117849,63 +117890,63 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -118046,12 +118087,12 @@ - - - - - - + + + + + + @@ -118122,9 +118163,9 @@ - - - + + + @@ -118241,17 +118282,17 @@ - - - + + + - - - - - - + + + + + + @@ -118339,8 +118380,8 @@ - - + + @@ -118382,8 +118423,8 @@ - - + + @@ -118556,8 +118597,8 @@ - - + + @@ -118565,9 +118606,9 @@ - - - + + + @@ -119175,22 +119216,22 @@ - - - + + + - - - + + + - - + + - - + + @@ -119521,9 +119562,9 @@ - - - + + + @@ -120397,8 +120438,8 @@ - - + + @@ -120407,8 +120448,8 @@ - - + + @@ -121489,11 +121530,11 @@ - - - - - + + + + + @@ -121573,14 +121614,14 @@ - - + + - - - - + + + + @@ -121941,17 +121982,17 @@ - - - - + + + + - - - - + + + + @@ -121970,9 +122011,9 @@ - - - + + + @@ -121990,11 +122031,11 @@ - - - - - + + + + + @@ -122099,8 +122140,8 @@ - - + + @@ -122109,9 +122150,9 @@ - - - + + + @@ -122122,54 +122163,54 @@ - - - - - - + + + + + + - - - + + + - - - + + + - - - - - - - + + + + + + + - - + + - - - + + + - - - - + + + + - - - - + + + + @@ -122204,13 +122245,13 @@ - - - + + + - - + + @@ -122228,19 +122269,19 @@ - - - + + + - - - + + + - - - + + + @@ -122286,90 +122327,90 @@ - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - + + - - + + - - + + @@ -122483,19 +122524,19 @@ - - - + + + - - - + + + - - - + + + @@ -122964,20 +123005,20 @@ - - - - - - - - + + + + + + + + - - - - + + + + @@ -126299,10 +126340,10 @@ - - - - + + + + @@ -126964,10 +127005,10 @@ - - - - + + + + @@ -127018,14 +127059,14 @@ - - - + + + - - - + + + @@ -127340,8 +127381,8 @@ - - + + @@ -127392,9 +127433,9 @@ - - - + + + @@ -127528,8 +127569,8 @@ - - + + @@ -127625,9 +127666,9 @@ - - - + + + @@ -127705,8 +127746,8 @@ - - + + @@ -128961,13 +129002,13 @@ - - - - - - - + + + + + + + @@ -129284,64 +129325,64 @@ - + - - + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -129384,42 +129425,42 @@ - - + + - - + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - + + @@ -129427,100 +129468,100 @@ - + - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - - - + + + + - - - + + + - - - + + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + - - - - + + + + - - - + + + - - - - + + + + - - - - + + + + - - + + @@ -129532,53 +129573,53 @@ - - - + + + - - + + - - - - - - + + + + + + - - - - - + + + + + - - - + + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + @@ -130123,7 +130164,7 @@ - + @@ -130224,8 +130265,8 @@ - - + + @@ -130290,15 +130331,15 @@ - - - + + + - - - - + + + + @@ -130323,9 +130364,9 @@ - - - + + + @@ -130449,7 +130490,7 @@ - + @@ -133570,8 +133611,8 @@ - - + + @@ -134108,12 +134149,12 @@ - - - - - - + + + + + + @@ -134157,20 +134198,20 @@ - - - - + + + + - - - - + + + + - - + + @@ -134179,15 +134220,15 @@ - - - - - - - - - + + + + + + + + + @@ -134951,15 +134992,15 @@ - - - + + + - - + + @@ -135008,30 +135049,30 @@ - - + + - + - - - - + + + + - - - - + + + + - + @@ -135147,10 +135188,10 @@ - + - + @@ -135223,36 +135264,36 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -135377,8 +135418,8 @@ - - + + @@ -135908,13 +135949,13 @@ - - - - - - - + + + + + + + @@ -135947,9 +135988,9 @@ - - - + + + @@ -135974,13 +136015,13 @@ - - + + - - - + + + @@ -136317,10 +136358,10 @@ - - - - + + + + @@ -136338,11 +136379,11 @@ - - - - - + + + + + @@ -136522,62 +136563,62 @@ - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - - + + - + @@ -137025,43 +137066,43 @@ - - - - - + - - - + + - - - + + + + + + + + - - - + + + - - - - + + + + - - - - + + + + - - + + @@ -137099,7 +137140,7 @@ - + @@ -137166,8 +137207,8 @@ - - + + @@ -137201,8 +137242,8 @@ - - + + @@ -137219,17 +137260,17 @@ - - - + + + - - + + - - + + @@ -137244,8 +137285,8 @@ - - + + @@ -137289,8 +137330,8 @@ - - + + @@ -137890,9 +137931,9 @@ - - - + + + @@ -138090,11 +138131,11 @@ - + - - + + @@ -138225,11 +138266,11 @@ - - - - - + + + + + @@ -138248,8 +138289,8 @@ - - + + @@ -138259,9 +138300,9 @@ - - - + + + @@ -138309,9 +138350,9 @@ - - - + + + @@ -138325,10 +138366,10 @@ - - - - + + + + @@ -138336,9 +138377,9 @@ - - - + + + @@ -138389,11 +138430,11 @@ - - - - - + + + + + @@ -138401,9 +138442,9 @@ - - - + + + @@ -140166,8 +140207,8 @@ - - + + @@ -140320,6 +140361,13 @@ + + + + + + + @@ -140406,7 +140454,7 @@ - + @@ -140417,8 +140465,8 @@ - - + + @@ -140872,11 +140920,11 @@ - - - - - + + + + + @@ -141563,48 +141611,48 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - - - - + + + + + - - - - - - + + + + + + @@ -141614,162 +141662,162 @@ - - - + + + - - + + - - - - + + + + - - + + - - + + - - - + + + - - + + - - + + - - - - + + + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - + + + + @@ -142085,16 +142133,16 @@ - - + + - - + + - - + + @@ -142136,8 +142184,8 @@ - - + + @@ -142291,8 +142339,8 @@ - - + + @@ -142321,8 +142369,8 @@ - - + + @@ -142467,6 +142515,7 @@ + @@ -144320,31 +144369,45 @@ - - + + - - + + - - + + - - - + + + - - + + - - + + + + + + + + + + + + + + + + @@ -144529,15 +144592,15 @@ - - - - + + + + - - - + + + @@ -144561,19 +144624,19 @@ - - - + + + - - - - + + + + @@ -144586,13 +144649,13 @@ - - - + + + - - + + @@ -144610,9 +144673,9 @@ - - - + + + @@ -144635,14 +144698,14 @@ - - - + + + - - - + + + @@ -144663,8 +144726,8 @@ - - + + @@ -144672,9 +144735,9 @@ - - - + + + @@ -144687,8 +144750,8 @@ - - + + diff --git a/android/abi_gki_aarch64_galaxy b/android/abi_gki_aarch64_galaxy index f8d07776abc9..f35385449132 100644 --- a/android/abi_gki_aarch64_galaxy +++ b/android/abi_gki_aarch64_galaxy @@ -343,6 +343,7 @@ __traceiter_dwc3_readl __traceiter_dwc3_writel __traceiter_gpu_mem_total + __traceiter_kfree_skb __traceiter_sched_util_est_se_tp __traceiter_xdp_exception __tracepoint_android_rvh_account_irq @@ -494,6 +495,7 @@ __tracepoint_ipi_raise __tracepoint_irq_handler_entry __tracepoint_irq_handler_exit + __tracepoint_kfree_skb __tracepoint_pelt_cfs_tp __tracepoint_pelt_dl_tp __tracepoint_pelt_irq_tp @@ -4278,6 +4280,7 @@ usb_hcd_start_port_resume usb_hcd_unlink_urb_from_ep usb_hcds_loaded + usb_hid_driver usb_hub_clear_tt_buffer usb_hub_find_child usb_ifnum_to_if diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 2c5078428d3e..c01dfbccd138 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -2692,6 +2692,8 @@ __traceiter_android_vh_tune_inactive_ratio __traceiter_android_vh_tune_scan_type __traceiter_android_vh_tune_swappiness + __traceiter_android_vh_page_referenced_check_bypass + __traceiter_android_vh_drain_all_pages_bypass __traceiter_android_vh_ufs_compl_command __traceiter_android_vh_ufs_send_command __traceiter_android_vh_ufs_send_tm_command @@ -2894,6 +2896,8 @@ __tracepoint_android_vh_tune_inactive_ratio __tracepoint_android_vh_tune_scan_type __tracepoint_android_vh_tune_swappiness + __tracepoint_android_vh_page_referenced_check_bypass + __tracepoint_android_vh_drain_all_pages_bypass __tracepoint_android_vh_ufs_compl_command __tracepoint_android_vh_ufs_send_command __tracepoint_android_vh_ufs_send_tm_command diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index e26f08dfe1c4..bcfc4c9ef782 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -2430,6 +2430,7 @@ sysfs_create_groups sysfs_create_link sysfs_emit + sysfs_group_change_owner __sysfs_match_string sysfs_notify sysfs_remove_bin_file @@ -2687,6 +2688,7 @@ __tracepoint_android_vh_ftrace_size_check __tracepoint_android_vh_gic_resume __tracepoint_android_vh_gpio_block_read + __tracepoint_android_vh_handle_tlb_conf __tracepoint_android_vh_iommu_setup_dma_ops __tracepoint_android_vh_ipi_stop __tracepoint_android_vh_jiffies_update diff --git a/android/abi_gki_aarch64_xiaomi b/android/abi_gki_aarch64_xiaomi index b6b8934aa985..a162683958cd 100644 --- a/android/abi_gki_aarch64_xiaomi +++ b/android/abi_gki_aarch64_xiaomi @@ -194,3 +194,9 @@ #extend_reclaim.ko try_to_free_mem_cgroup_pages + +##required by xm_power_debug.ko module + wakeup_sources_read_lock + wakeup_sources_read_unlock + wakeup_sources_walk_start + wakeup_sources_walk_next diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index 8f59bbeba7a7..f2b6a8f90d57 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h @@ -112,6 +112,7 @@ #define ESR_ELx_FSC_ACCESS (0x08) #define ESR_ELx_FSC_FAULT (0x04) #define ESR_ELx_FSC_PERM (0x0C) +#define ESR_ELx_FSC_TLBCONF (0x30) /* ISS field definitions for Data Aborts */ #define ESR_ELx_ISV_SHIFT (24) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 37806735f722..cbec7bc70095 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -711,7 +711,11 @@ static int do_alignment_fault(unsigned long far, unsigned int esr, static int do_bad(unsigned long far, unsigned int esr, struct pt_regs *regs) { - return 1; /* "fault" */ + unsigned long addr = untagged_addr(far); + int ret = 1; + + trace_android_vh_handle_tlb_conf(addr, esr, &ret); + return ret; } static int do_sea(unsigned long far, unsigned int esr, struct pt_regs *regs) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 24f9cb5da6db..052a1e590e9f 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2490,6 +2490,7 @@ static int binder_proc_transaction(struct binder_transaction *t, struct binder_priority node_prio; bool oneway = !!(t->flags & TF_ONE_WAY); bool pending_async = false; + bool skip = false; BUG_ON(!node); binder_node_lock(node); @@ -2517,7 +2518,10 @@ static int binder_proc_transaction(struct binder_transaction *t, return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY; } - if (!thread && !pending_async) + trace_android_vh_binder_proc_transaction_entry(proc, t, + &thread, node->debug_id, pending_async, !oneway, &skip); + + if (!thread && !pending_async && !skip) thread = binder_select_thread_ilocked(proc); trace_android_vh_binder_proc_transaction(current, proc->tsk, @@ -2701,8 +2705,8 @@ static void binder_transaction(struct binder_proc *proc, ref->node, &target_proc, &return_error); } else { - binder_user_error("%d:%d got transaction to invalid handle\n", - proc->pid, thread->pid); + binder_user_error("%d:%d got transaction to invalid handle, %u\n", + proc->pid, thread->pid, tr->target.handle); return_error = BR_FAILED_REPLY; } binder_proc_unlock(proc); @@ -4032,6 +4036,10 @@ retry: size_t trsize = sizeof(*trd); binder_inner_proc_lock(proc); + trace_android_vh_binder_select_worklist_ilocked(&list, thread, + proc, wait_for_proc_work); + if (list) + goto skip; if (!binder_worklist_empty_ilocked(&thread->todo)) list = &thread->todo; else if (!binder_worklist_empty_ilocked(&proc->todo) && @@ -4045,7 +4053,7 @@ retry: goto retry; break; } - +skip: if (end - ptr < sizeof(tr) + 4) { binder_inner_proc_unlock(proc); break; diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ef6b8e851608..3e26777a54c2 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -277,8 +277,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_binder_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_end); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_select_worklist_ilocked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); @@ -289,6 +291,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf_pr_cont); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_slab_bypass); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_check_bypass); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drain_all_pages_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork); @@ -388,3 +392,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_proc); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_thread_release); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_has_work_ilocked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_read_done); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); diff --git a/drivers/md/dm-bow.c b/drivers/md/dm-bow.c index cfd1fa63ff97..e666ca01d220 100644 --- a/drivers/md/dm-bow.c +++ b/drivers/md/dm-bow.c @@ -236,6 +236,7 @@ static void set_type(struct bow_context *bc, struct bow_range **br, int type) (*br)->type = type; + mutex_lock(&bc->ranges_lock); if (next->type == type) { if (type == TRIMMED) list_del(&next->trimmed_list); @@ -249,6 +250,7 @@ static void set_type(struct bow_context *bc, struct bow_range **br, int type) rb_erase(&(*br)->node, &bc->ranges); kfree(*br); } + mutex_unlock(&bc->ranges_lock); *br = NULL; } @@ -599,6 +601,7 @@ static void dm_bow_dtr(struct dm_target *ti) struct bow_context *bc = (struct bow_context *) ti->private; struct kobject *kobj; + mutex_lock(&bc->ranges_lock); while (rb_first(&bc->ranges)) { struct bow_range *br = container_of(rb_first(&bc->ranges), struct bow_range, node); @@ -606,6 +609,8 @@ static void dm_bow_dtr(struct dm_target *ti) rb_erase(&br->node, &bc->ranges); kfree(br); } + mutex_unlock(&bc->ranges_lock); + if (bc->workqueue) destroy_workqueue(bc->workqueue); if (bc->bufio) @@ -1181,6 +1186,7 @@ static void dm_bow_tablestatus(struct dm_target *ti, char *result, return; } + mutex_lock(&bc->ranges_lock); for (i = rb_first(&bc->ranges); i; i = rb_next(i)) { struct bow_range *br = container_of(i, struct bow_range, node); @@ -1188,11 +1194,11 @@ static void dm_bow_tablestatus(struct dm_target *ti, char *result, readable_type[br->type], (unsigned long long)br->sector); if (result >= end) - return; + goto unlock; result += scnprintf(result, end - result, "\n"); if (result >= end) - return; + goto unlock; if (br->type == TRIMMED) ++trimmed_range_count; @@ -1214,19 +1220,22 @@ static void dm_bow_tablestatus(struct dm_target *ti, char *result, if (!rb_next(i)) { scnprintf(result, end - result, "\nERROR: Last range not of type TOP"); - return; + goto unlock; } if (br->sector > range_top(br)) { scnprintf(result, end - result, "\nERROR: sectors out of order"); - return; + goto unlock; } } if (trimmed_range_count != trimmed_list_length) scnprintf(result, end - result, "\nERROR: not all trimmed ranges in trimmed list"); + +unlock: + mutex_unlock(&bc->ranges_lock); } static void dm_bow_status(struct dm_target *ti, status_type_t type, diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index 1bbe4a34ef4c..9594367a4ef0 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include #include @@ -39,6 +41,105 @@ static unsigned kcopyd_subjob_size_kb = DEFAULT_SUB_JOB_SIZE_KB; module_param(kcopyd_subjob_size_kb, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(kcopyd_subjob_size_kb, "Sub-job size for dm-kcopyd clients"); +static bool rsm_enabled; +static phys_addr_t rsm_mem_base, rsm_mem_size; + +#ifndef MODULE +static DEFINE_SPINLOCK(rsm_lock); +static int *rsm_mem; +static int rsm_page_cnt; +static int rsm_tbl_idx; +static struct reserved_mem *rmem; + +static void __init kcopyd_rsm_init(void) +{ + static struct device_node *rsm_node; + int ret = 0; + + if (!rsm_enabled) + return; + + rsm_node = of_find_compatible_node(NULL, NULL, "mediatek,dm_ota"); + if (!rsm_node) { + ret = -ENODEV; + goto out; + } + + rmem = of_reserved_mem_lookup(rsm_node); + if (!rmem) { + ret = -EINVAL; + goto out_put_node; + } + + rsm_mem_base = rmem->base; + rsm_mem_size = rmem->size; + rsm_page_cnt = rsm_mem_size / PAGE_SIZE; + rsm_mem = kcalloc(rsm_page_cnt, sizeof(int), GFP_KERNEL); + if (!rsm_mem) + ret = -ENOMEM; + +out_put_node: + of_node_put(rsm_node); +out: + if (ret) + pr_warn("kcopyd: failed to init rsm: %d", ret); +} + +static int __init kcopyd_rsm_enable(char *str) +{ + rsm_enabled = true; + + return 0; +} +early_param("mtk_kcopyd_quirk", kcopyd_rsm_enable); + +static void kcopyd_rsm_get_page(struct page **p) +{ + int i; + unsigned long flags; + + *p = NULL; + spin_lock_irqsave(&rsm_lock, flags); + for (i = 0 ; i < rsm_page_cnt ; i++) { + rsm_tbl_idx = (rsm_tbl_idx + 1 == rsm_page_cnt) ? 0 : rsm_tbl_idx + 1; + + if (rsm_mem[rsm_tbl_idx] == 0) { + rsm_mem[rsm_tbl_idx] = 1; + *p = virt_to_page(phys_to_virt(rsm_mem_base + PAGE_SIZE + * rsm_tbl_idx)); + break; + } + } + spin_unlock_irqrestore(&rsm_lock, flags); +} + +static void kcopyd_rsm_drop_page(struct page **p) +{ + u64 off; + unsigned long flags; + + if (*p) { + off = page_to_phys(*p) - rsm_mem_base; + spin_lock_irqsave(&rsm_lock, flags); + rsm_mem[off >> PAGE_SHIFT] = 0; + spin_unlock_irqrestore(&rsm_lock, flags); + *p = NULL; + } +} + +static void kcopyd_rsm_destroy(void) +{ + if (rsm_enabled) + kfree(rsm_mem); +} + +#else +#define kcopyd_rsm_destroy(...) +#define kcopyd_rsm_drop_page(...) +#define kcopyd_rsm_get_page(...) +#define kcopyd_rsm_init(...) +#endif + static unsigned dm_get_kcopyd_subjob_size(void) { unsigned sub_job_size_kb; @@ -211,7 +312,7 @@ static void wake(struct dm_kcopyd_client *kc) /* * Obtain one page for the use of kcopyd. */ -static struct page_list *alloc_pl(gfp_t gfp) +static struct page_list *alloc_pl(gfp_t gfp, unsigned long job_flags) { struct page_list *pl; @@ -219,7 +320,12 @@ static struct page_list *alloc_pl(gfp_t gfp) if (!pl) return NULL; - pl->page = alloc_page(gfp); + if (rsm_enabled && test_bit(DM_KCOPYD_SNAP_MERGE, &job_flags)) { + kcopyd_rsm_get_page(&pl->page); + } else { + pl->page = alloc_page(gfp); + } + if (!pl->page) { kfree(pl); return NULL; @@ -230,7 +336,14 @@ static struct page_list *alloc_pl(gfp_t gfp) static void free_pl(struct page_list *pl) { - __free_page(pl->page); + struct page *p = pl->page; + phys_addr_t pa = page_to_phys(p); + + if (rsm_enabled && pa >= rsm_mem_base && pa < rsm_mem_base + rsm_mem_size) + kcopyd_rsm_drop_page(&pl->page); + else + __free_page(pl->page); + kfree(pl); } @@ -258,14 +371,15 @@ static void kcopyd_put_pages(struct dm_kcopyd_client *kc, struct page_list *pl) } static int kcopyd_get_pages(struct dm_kcopyd_client *kc, - unsigned int nr, struct page_list **pages) + unsigned int nr, struct page_list **pages, + unsigned long job_flags) { struct page_list *pl; *pages = NULL; do { - pl = alloc_pl(__GFP_NOWARN | __GFP_NORETRY | __GFP_KSWAPD_RECLAIM); + pl = alloc_pl(__GFP_NOWARN | __GFP_NORETRY | __GFP_KSWAPD_RECLAIM, job_flags); if (unlikely(!pl)) { /* Use reserved pages */ pl = kc->pages; @@ -309,7 +423,7 @@ static int client_reserve_pages(struct dm_kcopyd_client *kc, unsigned nr_pages) struct page_list *pl = NULL, *next; for (i = 0; i < nr_pages; i++) { - next = alloc_pl(GFP_KERNEL); + next = alloc_pl(GFP_KERNEL, 0); if (!next) { if (pl) drop_pages(pl); @@ -395,6 +509,8 @@ int __init dm_kcopyd_init(void) zero_page_list.next = &zero_page_list; zero_page_list.page = ZERO_PAGE(0); + kcopyd_rsm_init(); + return 0; } @@ -402,6 +518,7 @@ void dm_kcopyd_exit(void) { kmem_cache_destroy(_job_cache); _job_cache = NULL; + kcopyd_rsm_destroy(); } /* @@ -586,7 +703,7 @@ static int run_pages_job(struct kcopyd_job *job) int r; unsigned nr_pages = dm_div_up(job->dests[0].count, PAGE_SIZE >> 9); - r = kcopyd_get_pages(job->kc, nr_pages, &job->pages); + r = kcopyd_get_pages(job->kc, nr_pages, &job->pages, job->flags); if (!r) { /* this job is ready for io */ push(&job->kc->io_jobs, job); diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 41735a25d50a..b2d8b37b202d 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -1117,7 +1117,8 @@ static void snapshot_merge_next_chunks(struct dm_snapshot *s) for (i = 0; i < linear_chunks; i++) __check_for_conflicting_io(s, old_chunk + i); - dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, merge_callback, s); + dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 1 << DM_KCOPYD_SNAP_MERGE, + merge_callback, s); return; shut: diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 6d5a8c5835e1..d664c4650b2d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -220,6 +220,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } + /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ + shost->cmd_per_lun = min_t(int, shost->cmd_per_lun, + shost->can_queue); + error = scsi_init_sense_cache(shost); if (error) goto fail; @@ -228,12 +232,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, if (error) goto fail; - shost->can_queue = shost->tag_set.queue_depth; - - /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */ - shost->cmd_per_lun = min_t(int, shost->cmd_per_lun, - shost->can_queue); - if (!shost->shost_gendev.parent) shost->shost_gendev.parent = dev ? dev : &platform_bus; if (!dma_dev) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3dfdc7daa664..6f3d29d16d1f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1907,10 +1907,6 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) tag_set->ops = &scsi_mq_ops_no_commit; tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1; tag_set->queue_depth = shost->can_queue; - if (shost->hostt->name && strcmp(shost->hostt->name, "ufshcd") == 0) { - tag_set->queue_depth--; - tag_set->reserved_tags++; - } tag_set->cmd_size = cmd_size; tag_set->numa_node = NUMA_NO_NODE; tag_set->flags = BLK_MQ_F_SHOULD_MERGE; diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c index 6cf2ae508205..abb0ce04baca 100644 --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -642,6 +642,7 @@ static int rndis_set_response(struct rndis_params *params, BufLength = le32_to_cpu(buf->InformationBufferLength); BufOffset = le32_to_cpu(buf->InformationBufferOffset); if ((BufLength > RNDIS_MAX_TOTAL_SIZE) || + (BufOffset > RNDIS_MAX_TOTAL_SIZE) || (BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE)) return -EINVAL; diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index 24d0ace3ed3c..e1e243e52a2d 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1437,7 +1437,6 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) usb_gadget_udc_stop(udc); udc->driver = NULL; - udc->dev.driver = NULL; udc->gadget->dev.driver = NULL; } @@ -1499,7 +1498,6 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri driver->function); udc->driver = driver; - udc->dev.driver = &driver->driver; udc->gadget->dev.driver = &driver->driver; usb_gadget_udc_set_speed(udc, driver->max_speed); @@ -1522,7 +1520,6 @@ err1: dev_err(&udc->dev, "failed to start %s: %d\n", udc->driver->function, ret); udc->driver = NULL; - udc->dev.driver = NULL; udc->gadget->dev.driver = NULL; return ret; } diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 0f7e96df7055..fb741ff58b26 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -681,7 +681,7 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci) } pm_runtime_allow(xhci_to_hcd(xhci)->self.controller); xhci->test_mode = 0; - return xhci_reset(xhci); + return xhci_reset(xhci, XHCI_RESET_SHORT_USEC); } void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port, diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 4324fd31b2c4..644ddcb26e76 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2695,7 +2695,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) fail: xhci_halt(xhci); - xhci_reset(xhci); + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); xhci_mem_cleanup(xhci); return -ENOMEM; } diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e559e1242180..d6a8f5ae2d7a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -65,7 +65,7 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) * handshake done). There are two failure modes: "usec" have passed (major * hardware flakeout), or the register reads as all-ones (hardware removed). */ -int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) +int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us) { u32 result; int ret; @@ -73,7 +73,7 @@ int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) ret = readl_poll_timeout_atomic(ptr, result, (result & mask) == done || result == U32_MAX, - 1, usec); + 1, timeout_us); if (result == U32_MAX) /* card removed */ return -ENODEV; @@ -162,7 +162,7 @@ int xhci_start(struct xhci_hcd *xhci) * Transactions will be terminated immediately, and operational registers * will be set to their defaults. */ -int xhci_reset(struct xhci_hcd *xhci) +int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us) { u32 command; u32 state; @@ -195,8 +195,7 @@ int xhci_reset(struct xhci_hcd *xhci) if (xhci->quirks & XHCI_INTEL_HOST) udelay(1000); - ret = xhci_handshake(&xhci->op_regs->command, - CMD_RESET, 0, 10 * 1000 * 1000); + ret = xhci_handshake(&xhci->op_regs->command, CMD_RESET, 0, timeout_us); if (ret) return ret; @@ -209,8 +208,7 @@ int xhci_reset(struct xhci_hcd *xhci) * xHCI cannot write to any doorbells or operational registers other * than status until the "Controller Not Ready" flag is cleared. */ - ret = xhci_handshake(&xhci->op_regs->status, - STS_CNR, 0, 10 * 1000 * 1000); + ret = xhci_handshake(&xhci->op_regs->status, STS_CNR, 0, timeout_us); xhci->usb2_rhub.bus_state.port_c_suspend = 0; xhci->usb2_rhub.bus_state.suspended_ports = 0; @@ -731,7 +729,7 @@ static void xhci_stop(struct usb_hcd *hcd) xhci->xhc_state |= XHCI_STATE_HALTED; xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; xhci_halt(xhci); - xhci_reset(xhci); + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); spin_unlock_irq(&xhci->lock); xhci_cleanup_msix(xhci); @@ -784,7 +782,7 @@ void xhci_shutdown(struct usb_hcd *hcd) xhci_halt(xhci); /* Workaround for spurious wakeups at shutdown with HSW */ if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) - xhci_reset(xhci); + xhci_reset(xhci, XHCI_RESET_SHORT_USEC); spin_unlock_irq(&xhci->lock); xhci_cleanup_msix(xhci); @@ -1170,7 +1168,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) xhci_dbg(xhci, "Stop HCD\n"); xhci_halt(xhci); xhci_zero_64b_regs(xhci); - retval = xhci_reset(xhci); + retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC); spin_unlock_irq(&xhci->lock); if (retval) return retval; @@ -5282,7 +5280,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) xhci_dbg(xhci, "Resetting HCD\n"); /* Reset the internal HC memory state and registers. */ - retval = xhci_reset(xhci); + retval = xhci_reset(xhci, XHCI_RESET_LONG_USEC); if (retval) return retval; xhci_dbg(xhci, "Reset complete\n"); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2bba700a7805..2a71477fab71 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -230,6 +230,9 @@ struct xhci_op_regs { #define CMD_ETE (1 << 14) /* bits 15:31 are reserved (and should be preserved on writes). */ +#define XHCI_RESET_LONG_USEC (10 * 1000 * 1000) +#define XHCI_RESET_SHORT_USEC (250 * 1000) + /* IMAN - Interrupt Management Register */ #define IMAN_IE (1 << 1) #define IMAN_IP (1 << 0) @@ -2097,11 +2100,11 @@ void xhci_free_container_ctx(struct xhci_hcd *xhci, /* xHCI host controller glue */ typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); -int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec); +int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us); void xhci_quiesce(struct xhci_hcd *xhci); int xhci_halt(struct xhci_hcd *xhci); int xhci_start(struct xhci_hcd *xhci); -int xhci_reset(struct xhci_hcd *xhci); +int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us); int xhci_run(struct usb_hcd *hcd); int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); void xhci_shutdown(struct usb_hcd *hcd); diff --git a/fs/buffer.c b/fs/buffer.c index d3916df01380..dd992943b270 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3189,7 +3189,7 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags) } return ret; } -EXPORT_SYMBOL_NS(__sync_dirty_buffer, ANDROID_GKI_VFS_EXPORT_ONLY); +EXPORT_SYMBOL(__sync_dirty_buffer); int sync_dirty_buffer(struct buffer_head *bh) { diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 72ed44ffc89f..66f655595d0e 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2081,9 +2081,17 @@ static inline bool enabled_nat_bits(struct f2fs_sb_info *sbi, return (cpc) ? (cpc->reason & CP_UMOUNT) && set : set; } -static inline void init_f2fs_rwsem(struct f2fs_rwsem *sem) +#define init_f2fs_rwsem(sem) \ +do { \ + static struct lock_class_key __key; \ + \ + __init_f2fs_rwsem((sem), #sem, &__key); \ +} while (0) + +static inline void __init_f2fs_rwsem(struct f2fs_rwsem *sem, + const char *sem_name, struct lock_class_key *key) { - init_rwsem(&sem->internal_rwsem); + __init_rwsem(&sem->internal_rwsem, sem_name, key); init_waitqueue_head(&sem->read_waiters); } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 6a96362882b9..532d2546b0a3 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2525,7 +2525,7 @@ int f2fs_quota_sync(struct super_block *sb, int type) struct f2fs_sb_info *sbi = F2FS_SB(sb); struct quota_info *dqopt = sb_dqopt(sb); int cnt; - int ret; + int ret = 0; /* * Now when everything is written we can discard the pagecache so @@ -2536,8 +2536,8 @@ int f2fs_quota_sync(struct super_block *sb, int type) if (type != -1 && cnt != type) continue; - if (!sb_has_quota_active(sb, type)) - return 0; + if (!sb_has_quota_active(sb, cnt)) + continue; inode_lock(dqopt->files[cnt]); diff --git a/fs/incfs/data_mgmt.c b/fs/incfs/data_mgmt.c index a383c5b5ad7f..fbab68a280d5 100644 --- a/fs/incfs/data_mgmt.c +++ b/fs/incfs/data_mgmt.c @@ -175,7 +175,6 @@ void incfs_free_mount_info(struct mount_info *mi) kfree(mi->pseudo_file_xattr[i].data); kfree(mi->mi_per_uid_read_timeouts); incfs_free_sysfs_node(mi->mi_sysfs_node); - kfree(mi->mi_options.sysfs_name); kfree(mi); } diff --git a/fs/namei.c b/fs/namei.c index d7b609a6f6dc..342bc7d4cbc7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2533,7 +2533,7 @@ int kern_path(const char *name, unsigned int flags, struct path *path) return filename_lookup(AT_FDCWD, getname_kernel(name), flags, path, NULL); } -EXPORT_SYMBOL_NS(kern_path, ANDROID_GKI_VFS_EXPORT_ONLY); +EXPORT_SYMBOL(kern_path); /** * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h index e42de7750c88..3a594ab9b563 100644 --- a/include/linux/dm-kcopyd.h +++ b/include/linux/dm-kcopyd.h @@ -21,6 +21,7 @@ #define DM_KCOPYD_IGNORE_ERROR 1 #define DM_KCOPYD_WRITE_SEQ 2 +#define DM_KCOPYD_SNAP_MERGE 3 struct dm_kcopyd_throttle { unsigned throttle; diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h index ed69618cf1fc..80f0dbac77c4 100644 --- a/include/linux/dma-direct.h +++ b/include/linux/dma-direct.h @@ -37,11 +37,16 @@ static inline bool zone_dma32_is_empty(int node) static inline bool zone_dma32_are_empty(void) { +#ifdef CONFIG_NUMA int node; for_each_node(node) if (!zone_dma32_is_empty(node)) return false; +#else + if (!zone_dma32_is_empty(numa_node_id())) + return false; +#endif return true; } diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 9f67e4653af5..a2738944340c 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -795,7 +795,7 @@ PAGE_TYPE_OPS(Guard, guard) extern bool is_free_buddy_page(struct page *page); -__PAGEFLAG(Isolated, isolated, PF_ANY); +PAGEFLAG(Isolated, isolated, PF_ANY); /* * If network-based swap is enabled, sl*b must keep track of whether pages diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index fa75f325dad5..cea4bdfd0f05 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -55,8 +55,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev); extern void init_idle(struct task_struct *idle, int cpu); extern int sched_fork(unsigned long clone_flags, struct task_struct *p); -extern void sched_post_fork(struct task_struct *p, - struct kernel_clone_args *kargs); +extern void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs); +extern void sched_post_fork(struct task_struct *p); extern void sched_dead(struct task_struct *p); void __noreturn do_task_dead(void); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index 42d974f76573..a5c090f38388 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -59,6 +59,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction, DECLARE_HOOK(android_vh_binder_preset, TP_PROTO(struct hlist_head *hhead, struct mutex *lock), TP_ARGS(hhead, lock)); +DECLARE_HOOK(android_vh_binder_proc_transaction_entry, + TP_PROTO(struct binder_proc *proc, struct binder_transaction *t, + struct binder_thread **thread, int node_debug_id, bool pending_async, + bool sync, bool *skip), + TP_ARGS(proc, t, thread, node_debug_id, pending_async, sync, skip)); DECLARE_HOOK(android_vh_binder_proc_transaction, TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, struct task_struct *binder_th_task, int node_debug_id, @@ -69,6 +74,10 @@ DECLARE_HOOK(android_vh_binder_proc_transaction_end, struct task_struct *binder_th_task, unsigned int code, bool pending_async, bool sync), TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync)); +DECLARE_HOOK(android_vh_binder_select_worklist_ilocked, + TP_PROTO(struct list_head **list, struct binder_thread *thread, struct binder_proc *proc, + int wait_for_proc_work), + TP_ARGS(list, thread, proc, wait_for_proc_work)); DECLARE_HOOK(android_vh_binder_new_ref, TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id), TP_ARGS(proc, ref_desc, node_debug_id)); diff --git a/include/trace/hooks/fault.h b/include/trace/hooks/fault.h index 1daf2d250f31..2c4176001ead 100644 --- a/include/trace/hooks/fault.h +++ b/include/trace/hooks/fault.h @@ -29,6 +29,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_do_sp_pc_abort, TP_ARGS(regs, esr, addr, user), TP_CONDITION(!user)); +DECLARE_HOOK(android_vh_handle_tlb_conf, + TP_PROTO(unsigned long addr, unsigned int esr, int *ret), + TP_ARGS(addr, esr, ret)); + /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_FAULT_H */ diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 1e7c0a0811de..cc00dcecfd71 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -117,6 +117,11 @@ DECLARE_HOOK(android_vh_mmap_region, DECLARE_HOOK(android_vh_try_to_unmap_one, TP_PROTO(struct vm_area_struct *vma, struct page *page, unsigned long addr, bool ret), TP_ARGS(vma, page, addr, ret)); +DECLARE_HOOK(android_vh_drain_all_pages_bypass, + TP_PROTO(gfp_t gfp_mask, unsigned int order, unsigned long alloc_flags, + int migratetype, unsigned long did_some_progress, + bool *bypass), + TP_ARGS(gfp_mask, order, alloc_flags, migratetype, did_some_progress, bypass)); struct device; DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, TP_PROTO(bool *allow_subpage_alloc, struct device *dev, size_t *size), diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index ecbff00093ee..95fb17af29e8 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -25,6 +25,10 @@ DECLARE_HOOK(android_vh_tune_inactive_ratio, DECLARE_RESTRICTED_HOOK(android_rvh_set_balance_anon_file_reclaim, TP_PROTO(bool *balance_anon_file_reclaim), TP_ARGS(balance_anon_file_reclaim), 1); +DECLARE_HOOK(android_vh_page_referenced_check_bypass, + TP_PROTO(struct page *page, unsigned long nr_to_scan, int lru, bool *bypass), + TP_ARGS(page, nr_to_scan, lru, bypass)); + #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 6f58cde1558b..8ca84610d4d4 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -62,7 +62,7 @@ static gfp_t dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, if (*phys_limit <= DMA_BIT_MASK(zone_dma_bits)) return GFP_DMA; if (*phys_limit <= DMA_BIT_MASK(32) && - !zone_dma32_is_empty(dev_to_node(dev))) + !zone_dma32_are_empty()) return GFP_DMA32; return 0; } @@ -103,7 +103,7 @@ again: if (IS_ENABLED(CONFIG_ZONE_DMA32) && phys_limit < DMA_BIT_MASK(64) && !(gfp & (GFP_DMA32 | GFP_DMA)) && - !zone_dma32_is_empty(node)) { + !zone_dma32_are_empty()) { gfp |= GFP_DMA32; goto again; } diff --git a/kernel/fork.c b/kernel/fork.c index b77eeb801ae2..3b281326c0e1 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2249,6 +2249,17 @@ static __latent_entropy struct task_struct *copy_process( if (retval) goto bad_fork_put_pidfd; + /* + * Now that the cgroups are pinned, re-clone the parent cgroup and put + * the new task on the correct runqueue. All this *before* the task + * becomes visible. + * + * This isn't part of ->can_fork() because while the re-cloning is + * cgroup specific, it unconditionally needs to place the task on a + * runqueue. + */ + sched_cgroup_fork(p, args); + /* * From this point on we must avoid any synchronous user-space * communication until we take the tasklist-lock. In particular, we do @@ -2356,7 +2367,7 @@ static __latent_entropy struct task_struct *copy_process( fd_install(pidfd, pidfile); proc_fork_connector(p); - sched_post_fork(p, args); + sched_post_fork(p); cgroup_post_fork(p, args); perf_event_fork(p); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4477bf655649..461eb4cb59fe 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -880,9 +880,8 @@ int tg_nop(struct task_group *tg, void *data) } #endif -static void set_load_weight(struct task_struct *p) +static void set_load_weight(struct task_struct *p, bool update_load) { - bool update_load = !(READ_ONCE(p->state) & TASK_NEW); int prio = p->static_prio - MAX_RT_PRIO; struct load_weight *load = &p->se.load; @@ -3485,7 +3484,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) p->static_prio = NICE_TO_PRIO(0); p->prio = p->normal_prio = p->static_prio; - set_load_weight(p); + set_load_weight(p, false); /* * We don't need the reset flag anymore after the fork. It has @@ -3504,6 +3503,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) init_entity_runnable_average(&p->se); trace_android_rvh_finish_prio_fork(p); + #ifdef CONFIG_SCHED_INFO if (likely(sched_info_on())) memset(&p->sched_info, 0, sizeof(p->sched_info)); @@ -3519,18 +3519,24 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) return 0; } -void sched_post_fork(struct task_struct *p, struct kernel_clone_args *kargs) +void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs) { unsigned long flags; -#ifdef CONFIG_CGROUP_SCHED - struct task_group *tg; -#endif + /* + * Because we're not yet on the pid-hash, p->pi_lock isn't strictly + * required yet, but lockdep gets upset if rules are violated. + */ raw_spin_lock_irqsave(&p->pi_lock, flags); #ifdef CONFIG_CGROUP_SCHED - tg = container_of(kargs->cset->subsys[cpu_cgrp_id], - struct task_group, css); - p->sched_task_group = autogroup_task_group(p, tg); + if (1) { + struct task_group *tg; + + tg = container_of(kargs->cset->subsys[cpu_cgrp_id], + struct task_group, css); + tg = autogroup_task_group(p, tg); + p->sched_task_group = tg; + } #endif rseq_migrate(p); /* @@ -3541,7 +3547,10 @@ void sched_post_fork(struct task_struct *p, struct kernel_clone_args *kargs) if (p->sched_class->task_fork) p->sched_class->task_fork(p); raw_spin_unlock_irqrestore(&p->pi_lock, flags); +} +void sched_post_fork(struct task_struct *p) +{ uclamp_post_fork(p); } @@ -5253,7 +5262,7 @@ void set_user_nice(struct task_struct *p, long nice) put_prev_task(rq, p); p->static_prio = NICE_TO_PRIO(nice); - set_load_weight(p); + set_load_weight(p, true); old_prio = p->prio; p->prio = effective_prio(p); @@ -5427,7 +5436,7 @@ static void __setscheduler_params(struct task_struct *p, */ p->rt_priority = attr->sched_priority; p->normal_prio = normal_prio(p); - set_load_weight(p); + set_load_weight(p, true); } /* @@ -7570,7 +7579,7 @@ void __init sched_init(void) atomic_set(&rq->nr_iowait, 0); } - set_load_weight(&init_task); + set_load_weight(&init_task, false); /* * The boot idle thread does lazy MMU switching as well: diff --git a/mm/memory.c b/mm/memory.c index dfe88223c483..c05b1f22f20e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5033,11 +5033,15 @@ static vm_fault_t ___handle_speculative_fault(struct mm_struct *mm, goto out_walk; p4d = p4d_offset(pgd, address); + if (pgd_val(READ_ONCE(*pgd)) != pgd_val(pgdval)) + goto out_walk; p4dval = READ_ONCE(*p4d); if (p4d_none(p4dval) || unlikely(p4d_bad(p4dval))) goto out_walk; vmf.pud = pud_offset(p4d, address); + if (p4d_val(READ_ONCE(*p4d)) != p4d_val(p4dval)) + goto out_walk; pudval = READ_ONCE(*vmf.pud); if (pud_none(pudval) || unlikely(pud_bad(pudval))) goto out_walk; @@ -5047,6 +5051,8 @@ static vm_fault_t ___handle_speculative_fault(struct mm_struct *mm, goto out_walk; vmf.pmd = pmd_offset(vmf.pud, address); + if (pud_val(READ_ONCE(*vmf.pud)) != pud_val(pudval)) + goto out_walk; vmf.orig_pmd = READ_ONCE(*vmf.pmd); /* * pmd_none could mean that a hugepage collapse is in progress @@ -5074,6 +5080,11 @@ static vm_fault_t ___handle_speculative_fault(struct mm_struct *mm, */ vmf.pte = pte_offset_map(vmf.pmd, address); + if (pmd_val(READ_ONCE(*vmf.pmd)) != pmd_val(vmf.orig_pmd)) { + pte_unmap(vmf.pte); + vmf.pte = NULL; + goto out_walk; + } vmf.orig_pte = READ_ONCE(*vmf.pte); barrier(); /* See comment in handle_pte_fault() */ if (pte_none(vmf.orig_pte)) { diff --git a/mm/migrate.c b/mm/migrate.c index 7137465caf40..26f8595de076 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -105,7 +105,7 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode) /* Driver shouldn't use PG_isolated bit of page->flags */ WARN_ON_ONCE(PageIsolated(page)); - __SetPageIsolated(page); + SetPageIsolated(page); unlock_page(page); return 0; @@ -129,7 +129,7 @@ void putback_movable_page(struct page *page) mapping = page_mapping(page); mapping->a_ops->putback_page(page); - __ClearPageIsolated(page); + ClearPageIsolated(page); } /* @@ -162,7 +162,7 @@ void putback_movable_pages(struct list_head *l) if (PageMovable(page)) putback_movable_page(page); else - __ClearPageIsolated(page); + ClearPageIsolated(page); unlock_page(page); put_page(page); } else { @@ -952,7 +952,7 @@ static int move_to_new_page(struct page *newpage, struct page *page, VM_BUG_ON_PAGE(!PageIsolated(page), page); if (!PageMovable(page)) { rc = MIGRATEPAGE_SUCCESS; - __ClearPageIsolated(page); + ClearPageIsolated(page); goto out; } @@ -974,7 +974,7 @@ static int move_to_new_page(struct page *newpage, struct page *page, * We clear PG_movable under page_lock so any compactor * cannot try to migrate this page. */ - __ClearPageIsolated(page); + ClearPageIsolated(page); } /* @@ -1160,7 +1160,7 @@ static int unmap_and_move(new_page_t get_new_page, if (unlikely(__PageMovable(page))) { lock_page(page); if (!PageMovable(page)) - __ClearPageIsolated(page); + ClearPageIsolated(page); unlock_page(page); } goto out; @@ -1215,7 +1215,7 @@ out: if (PageMovable(page)) putback_movable_page(page); else - __ClearPageIsolated(page); + ClearPageIsolated(page); unlock_page(page); put_page(page); } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9f4b74244b15..a9822a2175c5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4478,13 +4478,12 @@ __perform_reclaim(gfp_t gfp_mask, unsigned int order, const struct alloc_context *ac) { unsigned int noreclaim_flag; - unsigned long pflags, progress; + unsigned long progress; cond_resched(); /* We now go into synchronous reclaim */ cpuset_memory_pressure_bump(); - psi_memstall_enter(&pflags); fs_reclaim_acquire(gfp_mask); noreclaim_flag = memalloc_noreclaim_save(); @@ -4493,7 +4492,6 @@ __perform_reclaim(gfp_t gfp_mask, unsigned int order, memalloc_noreclaim_restore(noreclaim_flag); fs_reclaim_release(gfp_mask); - psi_memstall_leave(&pflags); cond_resched(); @@ -4507,11 +4505,14 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, unsigned long *did_some_progress) { struct page *page = NULL; + unsigned long pflags; bool drained = false; + bool skip_pcp_drain = false; + psi_memstall_enter(&pflags); *did_some_progress = __perform_reclaim(gfp_mask, order, ac); if (unlikely(!(*did_some_progress))) - return NULL; + goto out; retry: page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); @@ -4523,10 +4524,15 @@ retry: */ if (!page && !drained) { unreserve_highatomic_pageblock(ac, false); - drain_all_pages(NULL); + trace_android_vh_drain_all_pages_bypass(gfp_mask, order, + alloc_flags, ac->migratetype, *did_some_progress, &skip_pcp_drain); + if (!skip_pcp_drain) + drain_all_pages(NULL); drained = true; goto retry; } +out: + psi_memstall_leave(&pflags); return page; } diff --git a/mm/page_pinner.c b/mm/page_pinner.c index f4a141aafac6..8bccb54fbbd3 100644 --- a/mm/page_pinner.c +++ b/mm/page_pinner.c @@ -328,7 +328,6 @@ void __dump_page_pinner(struct page *page) void __page_pinner_migration_failed(struct page *page) { struct page_ext *page_ext = lookup_page_ext(page); - struct page_pinner *page_pinner; struct captured_pinner record; unsigned long flags; unsigned int idx; @@ -336,7 +335,6 @@ void __page_pinner_migration_failed(struct page *page) if (unlikely(!page_ext)) return; - page_pinner = get_page_pinner(page_ext); if (!test_bit(PAGE_EXT_PINNER_MIGRATION_FAILED, &page_ext->flags)) return; diff --git a/mm/slub.c b/mm/slub.c index 229136a8ef70..135d1be1c2ac 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -599,7 +599,9 @@ unsigned long get_each_object_track(struct kmem_cache *s, slab_lock(page); for_each_object(p, s, page_address(page), page->objects) { t = get_track(s, p, alloc); + metadata_access_enable(); ret = fn(s, p, t, private); + metadata_access_disable(); if (ret < 0) break; num_track += 1; diff --git a/mm/vmscan.c b/mm/vmscan.c index 3f5a834dd764..46d8e65071d8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2083,6 +2083,7 @@ static void shrink_active_list(unsigned long nr_to_scan, unsigned nr_rotated = 0; int file = is_file_lru(lru); struct pglist_data *pgdat = lruvec_pgdat(lruvec); + bool bypass = false; lru_add_drain(); @@ -2117,6 +2118,10 @@ static void shrink_active_list(unsigned long nr_to_scan, } } + trace_android_vh_page_referenced_check_bypass(page, nr_to_scan, lru, &bypass); + if (bypass) + goto skip_page_referenced; + if (page_referenced(page, 0, sc->target_mem_cgroup, &vm_flags)) { /* @@ -2134,7 +2139,7 @@ static void shrink_active_list(unsigned long nr_to_scan, continue; } } - +skip_page_referenced: ClearPageActive(page); /* we are de-activating */ SetPageWorkingset(page); list_add(&page->lru, &l_inactive);