From 2cfefe22b999a24970508dc43ae9079673af419b Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Wed, 27 Oct 2021 14:11:36 +0800 Subject: [PATCH 01/23] ANDROID: GKI: Add symbols to abi_gki_aarch64_oplus Add some file nodes to control and tune the memcg status in the memory cgroup, need add some symbols to abi_gki_aarch64_oplus. Leaf changes summary: 5 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 3 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 2 Added variables 3 Added functions: [A] 'function int cgroup_add_legacy_cftypes(cgroup_subsys*, cftype*)' [A] 'function mem_cgroup* mem_cgroup_from_id(unsigned short int)' [A] 'function void unregister_memory_notifier(notifier_block*)' 2 Added variables: [A] 'cgroup_subsys memory_cgrp_subsys' [A] 'static_key_true memory_cgrp_subsys_enabled_key' Bug: 204860045 Signed-off-by: Liujie Xie Change-Id: I69805dcdfbe363c13031ae0a9556761b71a67428 --- android/abi_gki_aarch64.xml | 20 ++++++++++++++++++++ android/abi_gki_aarch64_oplus | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index f621d304fe1b..cac6507ea5d7 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -947,6 +947,7 @@ + @@ -3042,6 +3043,7 @@ + @@ -5050,6 +5052,7 @@ + @@ -6042,6 +6045,8 @@ + + @@ -118675,6 +118680,11 @@ + + + + + @@ -129621,6 +129631,10 @@ + + + + @@ -129649,6 +129663,8 @@ + + @@ -139889,6 +139905,10 @@ + + + + diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 5476614fa58e..793058c27644 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -134,6 +134,7 @@ cdev_device_del cdev_init __cfi_slowpath + cgroup_add_legacy_cftypes cgroup_path_ns cgroup_taskset_first cgroup_taskset_next @@ -1421,6 +1422,7 @@ memblock_end_of_DRAM __memcat_p memcg_kmem_enabled_key + mem_cgroup_from_id memchr memchr_inv memcmp @@ -1430,6 +1432,8 @@ memdup_user memmove memory_block_size_bytes + memory_cgrp_subsys + memory_cgrp_subsys_enabled_key memory_read_from_buffer memparse mempool_alloc @@ -1575,6 +1579,7 @@ of_count_phandle_with_args of_cpufreq_cooling_register of_cpu_node_to_id + of_css of_devfreq_cooling_register of_device_get_match_data of_device_is_available @@ -2898,6 +2903,7 @@ trace_seq_putc tracing_off try_module_get + try_to_free_mem_cgroup_pages try_wait_for_completion tty_flip_buffer_push __tty_insert_flip_char @@ -2991,6 +2997,7 @@ unregister_inetaddr_notifier unregister_kprobe unregister_kretprobe + unregister_memory_notifier unregister_module_notifier unregister_netdev unregister_netdevice_many From 8c2c4d12bbfa67ab6f055ded5089e8f91d2e6692 Mon Sep 17 00:00:00 2001 From: JianMin Liu Date: Tue, 2 Nov 2021 16:32:07 +0800 Subject: [PATCH 02/23] ANDROID: sched: Add vendor hooks for sync_entity_load_avg Add vendor hooks to monitor more update load-avg point where tasks on the run-queue will go through. Bug: 204857484 Signed-off-by: JianMin Liu Change-Id: I440d7b9686a37508bd7568454472ab014ba0d0c9 --- kernel/sched/fair.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 939cdcbbf780..74ee2d1d16ce 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3871,7 +3871,9 @@ static void sync_entity_load_avg(struct sched_entity *se) u64 last_update_time; last_update_time = cfs_rq_last_update_time(cfs_rq); + trace_android_vh_prepare_update_load_avg_se(se, 0); __update_load_avg_blocked_se(last_update_time, se); + trace_android_vh_finish_update_load_avg_se(se, 0); } /* From d05410851914a96dbac3e5608384530f211069d1 Mon Sep 17 00:00:00 2001 From: Avri Altman Date: Thu, 29 Jul 2021 15:18:23 +0300 Subject: [PATCH 03/23] FROMGIT: scsi: ufshpb: rewind the read timeout on every read The "cold"-timer purpose is not to hang-on to active regions with no reads. Therefore the read-timeout should be re-wind on every read, and not just when the region is activated. Link: https://lore.kernel.org/r/20210808090024.21721-2-avri.altman@wdc.com Fixes: 13c044e91678 (scsi: ufs: ufshpb: Add "cold" regions timer) (cherry picked from commit 283e61c5a9bed2c2acde3f50a3f76f09816c0aab git: //git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Signed-off-by: Avri Altman Change-Id: If174a161028cf2382538d69e30181cda979a12de --- drivers/scsi/ufs/ufshpb.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 3cce91d1e63f..49348b8ea57a 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -184,9 +184,19 @@ next_srgn: set_bit_len = cnt; spin_lock_irqsave(&hpb->rgn_state_lock, flags); - if (set_dirty && rgn->rgn_state != HPB_RGN_INACTIVE && - srgn->srgn_state == HPB_SRGN_VALID) - bitmap_set(srgn->mctx->ppn_dirty, srgn_offset, set_bit_len); + if (rgn->rgn_state != HPB_RGN_INACTIVE) { + if (set_dirty) { + if (srgn->srgn_state == HPB_SRGN_VALID) + bitmap_set(srgn->mctx->ppn_dirty, srgn_offset, + set_bit_len); + } else if (hpb->is_hcm) { + /* rewind the read timer for lru regions */ + rgn->read_timeout = ktime_add_ms(ktime_get(), + rgn->hpb->params.read_timeout_ms); + rgn->read_timeout_expiries = + rgn->hpb->params.read_timeout_expiries; + } + } spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); if (hpb->is_hcm && prev_srgn != srgn) { From 193f33d061d2e8b8297a1870f3134491a9251874 Mon Sep 17 00:00:00 2001 From: Avri Altman Date: Thu, 20 May 2021 15:04:35 +0300 Subject: [PATCH 04/23] FROMGIT: scsi: ufshpb: Use a correct max multi chunk In HPB2.0, if pre_req_min_tr_len < transfer_len < pre_req_max_tr_len the driver is expected to send a HPB-WRITE-BUFFER companion to HPB-READ. The upper bound should fit into a single byte, regardless of bMAX_ DATA_SIZE_FOR_HPB_SINGLE_CMD which being an attribute (u32) can be significantly larger. To further illustrate the issue let us consider the following scenario: - SCSI_DEFAULT_MAX_SECTORS is 1024 limiting the IO chunks to 512KB - The OEM changes scsi_host_template .max_sectors to be 2048, which allows a 1M requests: transfer_len = 256 - pre_req_max_tr_len = HPB_MULTI_CHUNK_HIGH = 256 - ufshpb_is_supported_chunk returns true (256 <= 256) - WARN_ON_ONCE(transfer_len > HPB_MULTI_CHUNK_HIGH) doesn't warn - ufshpb_set_hpb_read_to_upiu cast transfer_len to u8: transfer_len = 0 - the command is failing with illegal request Link: https://lore.kernel.org/r/20210808090024.21721-3-avri.altman@wdc.com Fixes: 41d8a9333cc9 (scsi: ufs: ufshpb: Add HPB 2.0 support) (cherry picked from commit 07106f86ae13d9197bfd38c2d47743304b14099e git: //git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Signed-off-by: Avri Altman Change-Id: I0dc568020a0fe6c4ddf6952f89ad5230770fd7f3 --- drivers/scsi/ufs/ufshpb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h index c74a6c35a446..6df317dfe034 100644 --- a/drivers/scsi/ufs/ufshpb.h +++ b/drivers/scsi/ufs/ufshpb.h @@ -32,7 +32,7 @@ /* hpb support chunk size */ #define HPB_LEGACY_CHUNK_HIGH 1 #define HPB_MULTI_CHUNK_LOW 7 -#define HPB_MULTI_CHUNK_HIGH 256 +#define HPB_MULTI_CHUNK_HIGH 255 /* hpb vender defined opcode */ #define UFSHPB_READ 0xF8 From e2766208d745c54eef7c0deee8eb5b1ba0a475eb Mon Sep 17 00:00:00 2001 From: Avri Altman Date: Tue, 20 Jul 2021 11:56:53 +0300 Subject: [PATCH 05/23] FROMGIT: scsi: ufshpb: Verify that num_inflight_map_req is non-negative num_inflight_map_req should not be negative. It is incremented and decremented without any protection, allowing it theoretically to be negative, should some weird unbalanced count occur. Verify that the those calls are properly serielized. Link: https://lore.kernel.org/r/20210808090024.21721-4-avri.altman@wdc.com Fixes: 33845a2d844b (scsi: ufs: ufshpb: Limit the number of in-flight map requests) (cherry picked from commit 22aede9f48b6766fb67441610120db9b04adf109 git: //git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Signed-off-by: Avri Altman Change-Id: I8a8252c919e6678752b60bcd950cb08e765e6aed --- drivers/scsi/ufs/ufshpb.c | 10 ++++++++++ drivers/scsi/ufs/ufshpb.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 49348b8ea57a..2bcc4e1dc506 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -763,6 +763,7 @@ static struct ufshpb_req *ufshpb_get_map_req(struct ufshpb_lu *hpb, { struct ufshpb_req *map_req; struct bio *bio; + unsigned long flags; if (hpb->is_hcm && hpb->num_inflight_map_req >= hpb->params.inflight_map_req) { @@ -787,7 +788,10 @@ static struct ufshpb_req *ufshpb_get_map_req(struct ufshpb_lu *hpb, map_req->rb.srgn_idx = srgn->srgn_idx; map_req->rb.mctx = srgn->mctx; + + spin_lock_irqsave(&hpb->param_lock, flags); hpb->num_inflight_map_req++; + spin_unlock_irqrestore(&hpb->param_lock, flags); return map_req; } @@ -795,9 +799,14 @@ static struct ufshpb_req *ufshpb_get_map_req(struct ufshpb_lu *hpb, static void ufshpb_put_map_req(struct ufshpb_lu *hpb, struct ufshpb_req *map_req) { + unsigned long flags; + bio_put(map_req->bio); ufshpb_put_req(hpb, map_req); + + spin_lock_irqsave(&hpb->param_lock, flags); hpb->num_inflight_map_req--; + spin_unlock_irqrestore(&hpb->param_lock, flags); } static int ufshpb_clear_dirty_bitmap(struct ufshpb_lu *hpb, @@ -2396,6 +2405,7 @@ static int ufshpb_lu_hpb_init(struct ufs_hba *hba, struct ufshpb_lu *hpb) spin_lock_init(&hpb->rgn_state_lock); spin_lock_init(&hpb->rsp_list_lock); + spin_lock_init(&hpb->param_lock); INIT_LIST_HEAD(&hpb->lru_info.lh_lru_rgn); INIT_LIST_HEAD(&hpb->lh_act_srgn); diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h index 6df317dfe034..a79e07398970 100644 --- a/drivers/scsi/ufs/ufshpb.h +++ b/drivers/scsi/ufs/ufshpb.h @@ -237,7 +237,9 @@ struct ufshpb_lu { struct ufshpb_req *pre_req; int num_inflight_pre_req; int throttle_pre_req; - int num_inflight_map_req; + int num_inflight_map_req; /* hold param_lock */ + spinlock_t param_lock; + struct list_head lh_pre_req_free; int cur_read_id; int pre_req_min_tr_len; From 335046583cd13e7bc687e953b1ea4262d7086914 Mon Sep 17 00:00:00 2001 From: Avri Altman Date: Tue, 20 Jul 2021 13:15:58 +0300 Subject: [PATCH 06/23] FROMGIT: scsi: ufshpb: Do not report victim error in HCM In host control mode, eviction is precieved as an extreme measure. There are several conditions that both the entering and exiting regions should meet, so that eviction will take place. The common case however, is that those conditions are rarely met, so it is normal that the act of eviction fails. Therefore, Do not report an error in host control mode if eviction fails. Link: https://lore.kernel.org/r/20210808090024.21721-5-avri.altman@wdc.com Fixes: 6c59cb501b86 (scsi: ufs: ufshpb: Make eviction depend on region's reads) (cherry picked from commit 10163cee1f06fc2e17bcf7bbc2982337202d1d5c git: //git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Signed-off-by: Avri Altman Change-Id: Id6aa444ea5e2efd15c507bbd586c421018c75998 --- drivers/scsi/ufs/ufshpb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 2bcc4e1dc506..a869668f3061 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -1391,7 +1391,8 @@ static int ufshpb_add_region(struct ufshpb_lu *hpb, struct ufshpb_region *rgn) victim_rgn = ufshpb_victim_lru_info(hpb); if (!victim_rgn) { dev_warn(&hpb->sdev_ufs_lu->sdev_dev, - "cannot get victim region error\n"); + "cannot get victim region %s\n", + hpb->is_hcm ? "" : "error"); ret = -ENOMEM; goto out; } From e35a305d19a29e1c2ba3359afb31047511bf11d9 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Wed, 13 Oct 2021 21:52:17 -0700 Subject: [PATCH 07/23] UPSTREAM: tracing/cfi: Fix cmp_entries_* functions signature mismatch If CONFIG_CFI_CLANG=y, attempting to read an event histogram will cause the kernel to panic due to failed CFI check. 1. echo 'hist:keys=common_pid' >> events/sched/sched_switch/trigger 2. cat events/sched/sched_switch/hist 3. kernel panics on attempting to read hist This happens because the sort() function expects a generic int (*)(const void *, const void *) pointer for the compare function. To prevent this CFI failure, change tracing map cmp_entries_* function signatures to match this. Also, fix the build error reported by the kernel test robot [1]. [1] https://lore.kernel.org/r/202110141140.zzi4dRh4-lkp@intel.com/ Link: https://lkml.kernel.org/r/20211014045217.3265162-1-kaleshsingh@google.com Signed-off-by: Kalesh Singh Reported-by: kernel test robot Signed-off-by: Steven Rostedt (VMware) Bug: 204946901 (cherry picked from commit 7ce1bb83a14019f8c396d57ec704d19478747716) Signed-off-by: Elliot Berman Change-Id: I4a1a39b086b5e306ddecabd9a6076e2fb14c3f70 --- kernel/trace/tracing_map.c | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c index 4b50fc0cb12c..d63e51dde0d2 100644 --- a/kernel/trace/tracing_map.c +++ b/kernel/trace/tracing_map.c @@ -834,29 +834,35 @@ int tracing_map_init(struct tracing_map *map) return err; } -static int cmp_entries_dup(const struct tracing_map_sort_entry **a, - const struct tracing_map_sort_entry **b) +static int cmp_entries_dup(const void *A, const void *B) { + const struct tracing_map_sort_entry *a, *b; int ret = 0; - if (memcmp((*a)->key, (*b)->key, (*a)->elt->map->key_size)) + a = *(const struct tracing_map_sort_entry **)A; + b = *(const struct tracing_map_sort_entry **)B; + + if (memcmp(a->key, b->key, a->elt->map->key_size)) ret = 1; return ret; } -static int cmp_entries_sum(const struct tracing_map_sort_entry **a, - const struct tracing_map_sort_entry **b) +static int cmp_entries_sum(const void *A, const void *B) { const struct tracing_map_elt *elt_a, *elt_b; + const struct tracing_map_sort_entry *a, *b; struct tracing_map_sort_key *sort_key; struct tracing_map_field *field; tracing_map_cmp_fn_t cmp_fn; void *val_a, *val_b; int ret = 0; - elt_a = (*a)->elt; - elt_b = (*b)->elt; + a = *(const struct tracing_map_sort_entry **)A; + b = *(const struct tracing_map_sort_entry **)B; + + elt_a = a->elt; + elt_b = b->elt; sort_key = &elt_a->map->sort_key; @@ -873,18 +879,21 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a, return ret; } -static int cmp_entries_key(const struct tracing_map_sort_entry **a, - const struct tracing_map_sort_entry **b) +static int cmp_entries_key(const void *A, const void *B) { const struct tracing_map_elt *elt_a, *elt_b; + const struct tracing_map_sort_entry *a, *b; struct tracing_map_sort_key *sort_key; struct tracing_map_field *field; tracing_map_cmp_fn_t cmp_fn; void *val_a, *val_b; int ret = 0; - elt_a = (*a)->elt; - elt_b = (*b)->elt; + a = *(const struct tracing_map_sort_entry **)A; + b = *(const struct tracing_map_sort_entry **)B; + + elt_a = a->elt; + elt_b = b->elt; sort_key = &elt_a->map->sort_key; @@ -989,10 +998,8 @@ static void sort_secondary(struct tracing_map *map, struct tracing_map_sort_key *primary_key, struct tracing_map_sort_key *secondary_key) { - int (*primary_fn)(const struct tracing_map_sort_entry **, - const struct tracing_map_sort_entry **); - int (*secondary_fn)(const struct tracing_map_sort_entry **, - const struct tracing_map_sort_entry **); + int (*primary_fn)(const void *, const void *); + int (*secondary_fn)(const void *, const void *); unsigned i, start = 0, n_sub = 1; if (is_key(map, primary_key->field_idx)) @@ -1061,8 +1068,7 @@ int tracing_map_sort_entries(struct tracing_map *map, unsigned int n_sort_keys, struct tracing_map_sort_entry ***sort_entries) { - int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, - const struct tracing_map_sort_entry **); + int (*cmp_entries_fn)(const void *, const void *); struct tracing_map_sort_entry *sort_entry, **entries; int i, n_entries, ret; From cde1d53cc9b62bdf7cbb8e5cc4887b28e9314983 Mon Sep 17 00:00:00 2001 From: Wesley Cheng Date: Tue, 26 Oct 2021 19:30:38 -0700 Subject: [PATCH 08/23] FROMGIT: usb: gadget: udc: core: Revise comments for USB ep enable/disable The usb_ep_disable() and usb_ep_enable() routines are being widely used in atomic/interrupt context by function drivers. Hence, the statement about it being able to only run in process context may not be true. Add an explicit comment mentioning that it can be used in atomic context. Signed-off-by: Wesley Cheng Acked-by: Alan Stern Bug: 204343836 (cherry picked from commit b0d5d2a71641bb50cada708cc8fdca946a837e9a https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing) Change-Id: I1adb5d074fe2f9e33ebfdb30d335283c56bc7b39 Signed-off-by: Wesley Cheng --- drivers/usb/gadget/udc/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index edb83c8825de..24d0ace3ed3c 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -89,7 +89,7 @@ EXPORT_SYMBOL_GPL(usb_ep_set_maxpacket_limit); * configurable, with more generic names like "ep-a". (remember that for * USB, "in" means "towards the USB host".) * - * This routine must be called in process context. + * This routine may be called in an atomic (interrupt) context. * * returns zero, or a negative error code. */ @@ -134,7 +134,7 @@ EXPORT_SYMBOL_GPL(usb_ep_enable); * gadget drivers must call usb_ep_enable() again before queueing * requests to the endpoint. * - * This routine must be called in process context. + * This routine may be called in an atomic (interrupt) context. * * returns zero, or a negative error code. */ From 8c9d9d8e44aa69102ed589e66a55e6ef93b834ef Mon Sep 17 00:00:00 2001 From: Wesley Cheng Date: Wed, 27 Oct 2021 13:00:37 -0700 Subject: [PATCH 09/23] FROMGIT: usb: gadget: f_mass_storage: Disable eps during disconnect When receiving a disconnect event from the UDC, the mass storage function driver currently runs the handle_exception() routine asynchronously. For UDCs that support runtime PM, there is a possibility the UDC is already suspended by the time the do_set_interface() is executed. This can lead to HW register access while the UDC is already suspended. Signed-off-by: Wesley Cheng Acked-by: Alan Stern Bug: 204343836 (cherry picked from commit 9fff139aeb11186fd8e75860c959c86cb43ab2f6 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing) Change-Id: I6c8011baddf02d6b0eadb5934416bc24b8a93f4a Signed-off-by: Wesley Cheng --- drivers/usb/gadget/function/f_mass_storage.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 950c9435beec..73a28f8a38a7 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -2301,6 +2301,16 @@ static void fsg_disable(struct usb_function *f) { struct fsg_dev *fsg = fsg_from_func(f); + /* Disable the endpoints */ + if (fsg->bulk_in_enabled) { + usb_ep_disable(fsg->bulk_in); + fsg->bulk_in_enabled = 0; + } + if (fsg->bulk_out_enabled) { + usb_ep_disable(fsg->bulk_out); + fsg->bulk_out_enabled = 0; + } + __raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL); } From dd78ccadc46f86c0cfebcfc38c4939bf9a9c7ff0 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Fri, 5 Nov 2021 10:11:15 +0800 Subject: [PATCH 10/23] ANDROID: GKI: Update symbol list for VIVO Leaf changes summary: 6 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 3 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 3 Added variables 3 Added functions: [A] 'function int __traceiter_android_vh_blk_alloc_rqs(void*, size_t*, blk_mq_tag_set*, blk_mq_tags*)' [A] 'function int __traceiter_android_vh_blk_rq_ctx_init(void*, request*, blk_mq_tags*, blk_mq_alloc_data*, u64)' [A] 'function int __traceiter_android_vh_mm_dirty_limits(void*, dirty_throttle_control* const, bool, unsigned long int, unsigned long int, unsigned long int, unsigned long int)' 3 Added variables: [A] 'tracepoint __tracepoint_android_vh_blk_alloc_rqs' [A] 'tracepoint __tracepoint_android_vh_blk_rq_ctx_init' [A] 'tracepoint __tracepoint_android_vh_mm_dirty_limits' Bug: 205166460 Change-Id: Iec948f354fe142576525a2f35769077d8c63788d Signed-off-by: Yang Yang --- android/abi_gki_aarch64.xml | 37 ++++++++++++++++++++++++++++++++++++ android/abi_gki_aarch64_vivo | 9 +++++++++ 2 files changed, 46 insertions(+) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index cac6507ea5d7..476d11871e69 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -370,6 +370,8 @@ + + @@ -437,6 +439,7 @@ + @@ -5733,6 +5736,8 @@ + + @@ -5802,6 +5807,7 @@ + @@ -11275,6 +11281,7 @@ + @@ -28069,6 +28076,7 @@ + @@ -83751,6 +83759,7 @@ + @@ -115061,6 +115070,21 @@ + + + + + + + + + + + + + + + @@ -115478,6 +115502,16 @@ + + + + + + + + + + @@ -116416,6 +116450,8 @@ + + @@ -116485,6 +116521,7 @@ + diff --git a/android/abi_gki_aarch64_vivo b/android/abi_gki_aarch64_vivo index d8703539183d..f464cbad7f17 100644 --- a/android/abi_gki_aarch64_vivo +++ b/android/abi_gki_aarch64_vivo @@ -54,6 +54,8 @@ __bitmap_set blk_alloc_queue blk_bio_list_merge + blkcg_policy_register + blkcg_policy_unregister blk_cleanup_queue blk_execute_rq blk_execute_rq_nowait @@ -1001,6 +1003,7 @@ of_count_phandle_with_args of_cpufreq_cooling_register of_cpu_node_to_id + of_css of_devfreq_cooling_register of_device_get_match_data of_device_is_available @@ -1711,6 +1714,8 @@ __traceiter_android_vh_binder_restore_priority __traceiter_android_vh_binder_set_priority __traceiter_android_vh_binder_wakeup_ilocked + __traceiter_android_vh_blk_alloc_rqs + __traceiter_android_vh_blk_rq_ctx_init __traceiter_android_vh_cpu_idle_enter __traceiter_android_vh_cpu_idle_exit __traceiter_android_vh_filemap_fault_cache_page @@ -1728,6 +1733,7 @@ __traceiter_android_vh_mmc_blk_mq_rw_recovery __traceiter_android_vh_mmc_blk_reset __traceiter_android_vh_mmc_gpio_cd_irqt + __traceiter_android_vh_mm_dirty_limits __traceiter_android_vh_printk_hotplug __traceiter_android_vh_scheduler_tick __traceiter_android_vh_sdhci_get_cd @@ -1806,6 +1812,8 @@ __tracepoint_android_vh_binder_set_priority __tracepoint_android_vh_binder_trans __tracepoint_android_vh_binder_wakeup_ilocked + __tracepoint_android_vh_blk_alloc_rqs + __tracepoint_android_vh_blk_rq_ctx_init __tracepoint_android_vh_cpu_idle_enter __tracepoint_android_vh_cpu_idle_exit __tracepoint_android_vh_dup_task_struct @@ -1825,6 +1833,7 @@ __tracepoint_android_vh_mmc_blk_mq_rw_recovery __tracepoint_android_vh_mmc_blk_reset __tracepoint_android_vh_mmc_gpio_cd_irqt + __tracepoint_android_vh_mm_dirty_limits __tracepoint_android_vh_printk_hotplug __tracepoint_android_vh_scheduler_tick __tracepoint_android_vh_sdhci_get_cd From a7d87a08b44a4b88936b78b4bb307e3b9fdbadf8 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 25 Oct 2021 13:31:12 +0200 Subject: [PATCH 11/23] UPSTREAM: cfg80211: fix management registrations locking The management registrations locking was broken, the list was locked for each wdev, but cfg80211_mgmt_registrations_update() iterated it without holding all the correct spinlocks, causing list corruption. Rather than trying to fix it with fine-grained locking, just move the lock to the wiphy/rdev (still need the list on each wdev), we already need to hold the wdev lock to change it, so there's no contention on the lock in any case. This trivially fixes the bug since we hold one wdev's lock already, and now will hold the lock that protects all lists. Cc: stable@vger.kernel.org Reported-by: Jouni Malinen Fixes: 6cd536fe62ef ("cfg80211: change internal management frame registration API") Link: https://lore.kernel.org/r/20211025133111.5cf733eab0f4.I7b0abb0494ab712f74e2efcd24bb31ac33f7eee9@changeid Signed-off-by: Johannes Berg Bug: 204384349 (cherry picked from commit 09b1d5dc6ce1c9151777f6c4e128a59457704c97) Signed-off-by: Veerendranath Jakkam Signed-off-by: Greg Kroah-Hartman Change-Id: Id1bca68277be3a5f7c7329a8195018946f686bdb --- include/net/cfg80211.h | 2 -- net/wireless/core.c | 2 +- net/wireless/core.h | 2 ++ net/wireless/mlme.c | 26 ++++++++++++++------------ 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 81d5b2486c04..bb86217d853e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5259,7 +5259,6 @@ struct cfg80211_cqm_config; * netdev and may otherwise be used by driver read-only, will be update * by cfg80211 on change_interface * @mgmt_registrations: list of registrations for management frames - * @mgmt_registrations_lock: lock for the list * @mgmt_registrations_need_update: mgmt registrations were updated, * need to propagate the update to the driver * @mtx: mutex used to lock data in this struct, may be used by drivers @@ -5306,7 +5305,6 @@ struct wireless_dev { u32 identifier; struct list_head mgmt_registrations; - spinlock_t mgmt_registrations_lock; u8 mgmt_registrations_need_update:1; struct mutex mtx; diff --git a/net/wireless/core.c b/net/wireless/core.c index 240282c083aa..3f4554723761 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -501,6 +501,7 @@ use_default_name: INIT_WORK(&rdev->propagate_cac_done_wk, cfg80211_propagate_cac_done_wk); INIT_WORK(&rdev->mgmt_registrations_update_wk, cfg80211_mgmt_registrations_update_wk); + spin_lock_init(&rdev->mgmt_registrations_lock); #ifdef CONFIG_CFG80211_DEFAULT_PS rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; @@ -1256,7 +1257,6 @@ void cfg80211_init_wdev(struct wireless_dev *wdev) INIT_LIST_HEAD(&wdev->event_list); spin_lock_init(&wdev->event_lock); INIT_LIST_HEAD(&wdev->mgmt_registrations); - spin_lock_init(&wdev->mgmt_registrations_lock); INIT_LIST_HEAD(&wdev->pmsr_list); spin_lock_init(&wdev->pmsr_lock); INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk); diff --git a/net/wireless/core.h b/net/wireless/core.h index 7df91f940212..a3362a32acb3 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -101,6 +101,8 @@ struct cfg80211_registered_device { struct work_struct propagate_cac_done_wk; struct work_struct mgmt_registrations_update_wk; + /* lock for all wdev lists */ + spinlock_t mgmt_registrations_lock; /* must be last because of the way we do wiphy_priv(), * and it should at least be aligned to NETDEV_ALIGN */ diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 0ac820780437..6dcfc5a34874 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -448,9 +448,9 @@ static void cfg80211_mgmt_registrations_update(struct wireless_dev *wdev) ASSERT_RTNL(); - spin_lock_bh(&wdev->mgmt_registrations_lock); + spin_lock_bh(&rdev->mgmt_registrations_lock); if (!wdev->mgmt_registrations_need_update) { - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); return; } @@ -475,7 +475,7 @@ static void cfg80211_mgmt_registrations_update(struct wireless_dev *wdev) rcu_read_unlock(); wdev->mgmt_registrations_need_update = 0; - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); rdev_update_mgmt_frame_registrations(rdev, wdev, &upd); } @@ -499,6 +499,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, int match_len, bool multicast_rx, struct netlink_ext_ack *extack) { + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_mgmt_registration *reg, *nreg; int err = 0; u16 mgmt_type; @@ -544,7 +545,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, if (!nreg) return -ENOMEM; - spin_lock_bh(&wdev->mgmt_registrations_lock); + spin_lock_bh(&rdev->mgmt_registrations_lock); list_for_each_entry(reg, &wdev->mgmt_registrations, list) { int mlen = min(match_len, reg->match_len); @@ -579,7 +580,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, list_add(&nreg->list, &wdev->mgmt_registrations); } wdev->mgmt_registrations_need_update = 1; - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); cfg80211_mgmt_registrations_update(wdev); @@ -587,7 +588,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, out: kfree(nreg); - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); return err; } @@ -598,7 +599,7 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); struct cfg80211_mgmt_registration *reg, *tmp; - spin_lock_bh(&wdev->mgmt_registrations_lock); + spin_lock_bh(&rdev->mgmt_registrations_lock); list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) { if (reg->nlportid != nlportid) @@ -611,7 +612,7 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) schedule_work(&rdev->mgmt_registrations_update_wk); } - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); if (nlportid && rdev->crit_proto_nlportid == nlportid) { rdev->crit_proto_nlportid = 0; @@ -624,15 +625,16 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev) { + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_mgmt_registration *reg, *tmp; - spin_lock_bh(&wdev->mgmt_registrations_lock); + spin_lock_bh(&rdev->mgmt_registrations_lock); list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) { list_del(®->list); kfree(reg); } wdev->mgmt_registrations_need_update = 1; - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); cfg80211_mgmt_registrations_update(wdev); } @@ -780,7 +782,7 @@ bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm, data = buf + ieee80211_hdrlen(mgmt->frame_control); data_len = len - ieee80211_hdrlen(mgmt->frame_control); - spin_lock_bh(&wdev->mgmt_registrations_lock); + spin_lock_bh(&rdev->mgmt_registrations_lock); list_for_each_entry(reg, &wdev->mgmt_registrations, list) { if (reg->frame_type != ftype) @@ -804,7 +806,7 @@ bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm, break; } - spin_unlock_bh(&wdev->mgmt_registrations_lock); + spin_unlock_bh(&rdev->mgmt_registrations_lock); trace_cfg80211_return_bool(result); return result; From 5b87b8d669da327a1f75928d016465a9fbeccba0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 3 Nov 2021 10:28:52 +0100 Subject: [PATCH 12/23] ANDROID: GKI: fix up abi breakage from "cfg80211: fix management registrations locking" Commit 4c22227e39c7 ("cfg80211: fix management registrations locking") in 5.10.77, which is commit 09b1d5dc6ce1 ("cfg80211: fix management registrations locking") upstream, moved the mgmt_registrations_lock out of struct wireless_dev. This did not change the structure size, but caused a CRC change in the structure pointer, which tripped the abi checker. So restore the variable, and comment that this is not used anymore. No driver should ever be touching this so it is safe. Note, using a __GENKSYMS__ hack would work, as the overall structure size remains the same when this variable is removed, BUT the warning that the field is gone is reported by libabigail correctly, which would require a .xml update, so it's not worth it. Bug: 161946584 Signed-off-by: Greg Kroah-Hartman Change-Id: Ibcfe743833860e6f75611d7ebed1036a77be0a69 --- include/net/cfg80211.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index bb86217d853e..7abdf1aaf650 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5305,6 +5305,13 @@ struct wireless_dev { u32 identifier; struct list_head mgmt_registrations; + /* + * ANDROID: mgmt_registrations_lock was restored to preserve ABI in + * 5.10.77 due to backport of 09b1d5dc6ce1 ("cfg80211: fix management + * registrations locking") but it is not used for anything so do not + * touch this variable! + */ + spinlock_t mgmt_registrations_lock; u8 mgmt_registrations_need_update:1; struct mutex mtx; From 94ca15ec921852eef91af21830de74a31ce8ec5e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 5 Nov 2021 13:30:52 -0700 Subject: [PATCH 13/23] BACKPORT: FROMLIST: scsi: ufs: Limit the queue depth to host->can_queue Before reducing 'can_queue' from 32 to 31, make ufshcd_change_queue_depth() restrict the queue depth to 'can_queue' instead of hba->nutrs (32). This is a backport of a subset of the following patch: "[PATCH 2/2] scsi: ufs: Fix a deadlock in the error handler". Bug: 205080886 Link: https://lore.kernel.org/linux-scsi/20211103000529.1549411-3-bvanassche@acm.org/ Change-Id: I6e694a9698f91293fc2987217e3f939726c397dd Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index cede7163b8d8..7f48823dd38a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4904,11 +4904,7 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev) */ static int ufshcd_change_queue_depth(struct scsi_device *sdev, int depth) { - struct ufs_hba *hba = shost_priv(sdev->host); - - if (depth > hba->nutrs) - depth = hba->nutrs; - return scsi_change_queue_depth(sdev, depth); + return scsi_change_queue_depth(sdev, min(depth, sdev->host->can_queue)); } static void ufshcd_hpb_destroy(struct ufs_hba *hba, struct scsi_device *sdev) From ff748ee298193e3c9cf9a4e8751ae5c4df9b1227 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 5 Nov 2021 13:30:59 -0700 Subject: [PATCH 14/23] BACKPORT: FROMLIST: scsi: core: Reserve one tag for the UFS driver This is a GKI-compatible version of the following patch: "scsi: core: Add support for reserved tags". Bug: 205080886 Link: https://lore.kernel.org/linux-scsi/20211103000529.1549411-2-bvanassche@acm.org. Change-Id: I6273114ae8cc6c2a74c72f7bc090eb0319ec5772 Signed-off-by: Bart Van Assche --- drivers/scsi/hosts.c | 7 ++++--- drivers/scsi/scsi_lib.c | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index da3920a19d53..ae9feac2106e 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -220,9 +220,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } - shost->cmd_per_lun = min_t(short, shost->cmd_per_lun, - shost->can_queue); - error = scsi_init_sense_cache(shost); if (error) goto fail; @@ -231,6 +228,10 @@ 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; + shost->cmd_per_lun = min_t(short, 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 d89db29fa829..ffe075dae0ef 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1909,6 +1909,10 @@ 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; From 56cc81bb39cba1791c46c31de789ad370dde9fcd Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 5 Nov 2021 13:31:05 -0700 Subject: [PATCH 15/23] BACKPORT: FROMLIST: scsi: ufs: Fix a deadlock in the error handler The following deadlock has been observed on a test setup: * All tags allocated. * The SCSI error handler calls ufshcd_eh_host_reset_handler() * ufshcd_eh_host_reset_handler() queues work that calls ufshcd_err_handler() * ufshcd_err_handler() locks up as follows: Workqueue: ufs_eh_wq_0 ufshcd_err_handler.cfi_jt Call trace: __switch_to+0x298/0x5d8 __schedule+0x6cc/0xa94 schedule+0x12c/0x298 blk_mq_get_tag+0x210/0x480 __blk_mq_alloc_request+0x1c8/0x284 blk_get_request+0x74/0x134 ufshcd_exec_dev_cmd+0x68/0x640 ufshcd_verify_dev_init+0x68/0x35c ufshcd_probe_hba+0x12c/0x1cb8 ufshcd_host_reset_and_restore+0x88/0x254 ufshcd_reset_and_restore+0xd0/0x354 ufshcd_err_handler+0x408/0xc58 process_one_work+0x24c/0x66c worker_thread+0x3e8/0xa4c kthread+0x150/0x1b4 ret_from_fork+0x10/0x30 Fix this lockup by making ufshcd_exec_dev_cmd() allocate a reserved request. This patch is closely related to the upstream patch with the same title. Bug: 205080886 Link: https://lore.kernel.org/linux-scsi/700f0463-23a9-8465-f712-1188cb884dea@acm.org/T/#u Change-Id: I9e9ba3f45ba23ecf576380aa19701d3437af6cdd Signed-off-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 7f48823dd38a..d2fdd9f9097d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2932,12 +2932,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, down_read(&hba->clk_scaling_lock); - /* - * Get free slot, sleep if slots are unavailable. - * Even though we use wait_event() which sleeps indefinitely, - * the maximum wait time is bounded by SCSI request timeout. - */ - req = blk_get_request(q, REQ_OP_DRV_OUT, 0); + req = blk_mq_alloc_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); if (IS_ERR(req)) { err = PTR_ERR(req); goto out_unlock; From 14eae186e431f5a8d17e84e4f7132b188fdc60d8 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Wed, 27 Oct 2021 16:58:37 -0700 Subject: [PATCH 16/23] ANDROID: rproc: Add vendor hook when setting recovery mode Add vendor hook when setting recovery mode to notify coprocessor when mode is changed. Bug: 205534894 Signed-off-by: Elliot Berman Change-Id: Ie41170deb0426a7bcfeed8a51cc4e8e1a427592a --- drivers/android/vendor_hooks.c | 1 + drivers/remoteproc/remoteproc_sysfs.c | 3 +++ include/trace/hooks/remoteproc.h | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 46f71a3def2b..e3506cdeacb0 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -364,6 +364,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_force_compatible_post); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_print_transaction_info); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_setscheduler_uclamp); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery_set); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kfree_skb); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index d1cf7bf277c4..e3dc6ee27e58 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -5,6 +5,7 @@ #include #include +#include #include "remoteproc_internal.h" @@ -51,9 +52,11 @@ static ssize_t recovery_store(struct device *dev, if (sysfs_streq(buf, "enabled")) { /* change the flag and begin the recovery process if needed */ rproc->recovery_disabled = false; + trace_android_vh_rproc_recovery_set(rproc); rproc_trigger_recovery(rproc); } else if (sysfs_streq(buf, "disabled")) { rproc->recovery_disabled = true; + trace_android_vh_rproc_recovery_set(rproc); } else if (sysfs_streq(buf, "recover")) { /* begin the recovery process without changing the flag */ rproc_trigger_recovery(rproc); diff --git a/include/trace/hooks/remoteproc.h b/include/trace/hooks/remoteproc.h index 7cc5e93d2ebe..c39c2c1bffb3 100644 --- a/include/trace/hooks/remoteproc.h +++ b/include/trace/hooks/remoteproc.h @@ -12,10 +12,16 @@ struct rproc; +/* When recovery succeeds */ DECLARE_HOOK(android_vh_rproc_recovery, TP_PROTO(struct rproc *rproc), TP_ARGS(rproc)); +/* When recovery mode is enabled or disabled by sysfs */ +DECLARE_HOOK(android_vh_rproc_recovery_set, + TP_PROTO(struct rproc *rproc), + TP_ARGS(rproc)); + #endif /* _TRACE_HOOK_RPROC_H */ /* This part must be outside protection */ #include From fb247ebba9d30374c123eb875354aa991c98146a Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Mon, 8 Nov 2021 10:11:44 -0800 Subject: [PATCH 17/23] ANDROID: Add android_vh_rproc_recovery_set Leaf changes summary: 2 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable 1 Added function: [A] 'function int __traceiter_android_vh_rproc_recovery_set(void*, rproc*)' 1 Added variable: [A] 'tracepoint __tracepoint_android_vh_rproc_recovery_set' Bug: 205534894 Signed-off-by: Elliot Berman Change-Id: Ibd421d3b1b756f3c7f6283e1d697b865ea89b480 --- android/abi_gki_aarch64.xml | 273 ++++++++++++----------------------- android/abi_gki_aarch64_qcom | 2 + 2 files changed, 97 insertions(+), 178 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 476d11871e69..958441573b01 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -458,6 +458,7 @@ + @@ -5829,6 +5830,7 @@ + @@ -14268,89 +14270,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -28826,141 +28745,141 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -65914,14 +65833,7 @@ - - - - - - - - + @@ -90670,7 +90582,6 @@ - @@ -115618,9 +115529,14 @@ - - - + + + + + + + + @@ -116542,7 +116458,8 @@ - + + @@ -125811,32 +125728,32 @@ - - - + + + - - - - + + + + - - - - + + + + - - - + + + - - - - + + + + @@ -135357,38 +135274,38 @@ - - + + - - + + - - - - + + + + - - + + - - + + - - + + - - + + - - + + diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index 65fefcad59f9..be9112998f23 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -2569,6 +2569,7 @@ __traceiter_android_vh_logbuf_pr_cont __traceiter_android_vh_printk_hotplug __traceiter_android_vh_rproc_recovery + __traceiter_android_vh_rproc_recovery_set __traceiter_android_vh_scheduler_tick __traceiter_android_vh_show_max_freq __traceiter_android_vh_show_resume_epoch_val @@ -2686,6 +2687,7 @@ __tracepoint_android_vh_psi_event __tracepoint_android_vh_psi_group __tracepoint_android_vh_rproc_recovery + __tracepoint_android_vh_rproc_recovery_set __tracepoint_android_vh_scheduler_tick __tracepoint_android_vh_shmem_alloc_page __tracepoint_android_vh_show_max_freq From 68a3d0062d7f10f455b442b0e289f700b54278af Mon Sep 17 00:00:00 2001 From: Woogeun Lee Date: Mon, 8 Nov 2021 12:54:43 +0900 Subject: [PATCH 18/23] ANDROID: ABI: update allowed list for galaxy Leaf changes summary: 3 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 3 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 3 Added functions: [A] 'function int kern_path(const char*, unsigned int, path*)' [A] 'function int kstrtos16(const char*, unsigned int, s16*)' [A] 'function void path_put(const path*)' Bug: 205492131 Signed-off-by: Woogeun Lee Change-Id: Ice467d47203335bccb9a3a7006e0ecfb97d01714 --- android/abi_gki_aarch64.xml | 20 ++++++++++++++++++++ android/abi_gki_aarch64_galaxy | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index 958441573b01..c16d9b62d819 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -2838,6 +2838,7 @@ + @@ -2910,6 +2911,7 @@ + @@ -3478,6 +3480,7 @@ + @@ -56806,6 +56809,7 @@ + @@ -128529,6 +128533,12 @@ + + + + + + @@ -128925,6 +128935,12 @@ + + + + + + @@ -131771,6 +131787,10 @@ + + + + diff --git a/android/abi_gki_aarch64_galaxy b/android/abi_gki_aarch64_galaxy index 8fc8f58f678d..343a40594e66 100644 --- a/android/abi_gki_aarch64_galaxy +++ b/android/abi_gki_aarch64_galaxy @@ -2354,6 +2354,9 @@ irq_work_sync is_dma_buf_file is_vmalloc_addr + iwe_stream_add_event + iwe_stream_add_point + iwe_stream_add_value jiffies jiffies64_to_msecs jiffies_64_to_clock_t @@ -2362,6 +2365,7 @@ kasan_flag_enabled kasprintf kern_mount + kern_path kern_unmount kernel_bind kernel_connect @@ -2430,6 +2434,7 @@ kstrtoint_from_user kstrtol_from_user kstrtoll + kstrtos16 kstrtos8 kstrtos8_from_user kstrtou16 @@ -2887,6 +2892,7 @@ part_end_io_acct part_start_io_acct passthru_features_check + path_put pause_cpus pci_alloc_irq_vectors_affinity pci_assign_resource From f72f41f50c6218c40729d288b5e6e45c3bd7e500 Mon Sep 17 00:00:00 2001 From: Vijayanand Jitta Date: Thu, 29 Apr 2021 22:59:07 -0700 Subject: [PATCH 19/23] UPSTREAM: mm: vmalloc: prevent use after free in _vm_unmap_aliases A potential use after free can occur in _vm_unmap_aliases where an already freed vmap_area could be accessed, Consider the following scenario: Process 1 Process 2 __vm_unmap_aliases __vm_unmap_aliases purge_fragmented_blocks_allcpus rcu_read_lock() rcu_read_lock() list_del_rcu(&vb->free_list) list_for_each_entry_rcu(vb .. ) __purge_vmap_area_lazy kmem_cache_free(va) va_start = vb->va->va_start Here Process 1 is in purge path and it does list_del_rcu on vmap_block and later frees the vmap_area, since Process 2 was holding the rcu lock at this time vmap_block will still be present in and Process 2 accesse it and thereby it tries to access vmap_area of that vmap_block which was already freed by Process 1 and this results in use after free. Fix this by adding a check for vb->dirty before accessing vmap_area structure since vb->dirty will be set to VMAP_BBMAP_BITS in purge path checking for this will prevent the use after free. Link: https://lkml.kernel.org/r/1616062105-23263-1-git-send-email-vjitta@codeaurora.org Reviewed-by: Uladzislau Rezki (Sony) Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Bug: 205658047 (cherry picked from commit ad216c0316ad6391d90f4de0a7f59396b2925a06 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) Change-Id: I450781b5734570d1b9e8c63ac29ad3635c8e49bb Signed-off-by: Vijayanand Jitta --- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0d1e0b97d1c9..d5615977e7f3 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1749,7 +1749,7 @@ static void _vm_unmap_aliases(unsigned long start, unsigned long end, int flush) rcu_read_lock(); list_for_each_entry_rcu(vb, &vbq->free, free_list) { spin_lock(&vb->lock); - if (vb->dirty) { + if (vb->dirty && vb->dirty != VMAP_BBMAP_BITS) { unsigned long va_start = vb->va->va_start; unsigned long s, e; From 129e04dc199ef790bd0c2bd31e8d9ae909e44b57 Mon Sep 17 00:00:00 2001 From: Manaf Meethalavalappu Pallikunhi Date: Wed, 3 Nov 2021 01:30:40 +0530 Subject: [PATCH 20/23] FROMLIST: drivers: thermal: Reset previous low and high trip during thermal zone init During the suspend is in process, thermal_zone_device_update bails out thermal zone re-evaluation for any sensor trip violation without setting next valid trip to that sensor. It assumes during resume it will re-evaluate same thermal zone and update trip. But when it is in suspend temperature goes down and on resume path while updating thermal zone if temperature is less than previously violated trip, thermal zone set trip function evaluates the same previous high and previous low trip as new high and low trip. Since there is no change in high/low trip, it bails out from thermal zone set trip API without setting any trip. It leads to a case where sensor high trip or low trip is disabled forever even though thermal zone has a valid high or low trip. During thermal zone device init, reset thermal zone previous high and low trip. It resolves above mentioned scenario. Signed-off-by: Manaf Meethalavalappu Pallikunhi Reviewed-by: Thara Gopinath Bug: 205496325 Link: https://lore.kernel.org/linux-pm/51de966a-9c9e-88a8-5c2c-96773a64d527@linaro.org/T/#u Change-Id: Ib57ac6164811a566b497964701f23a3c209915e3 Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/thermal/thermal_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 17825b47738d..17e94f3aa966 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -477,6 +477,8 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz) { struct thermal_instance *pos; tz->temperature = THERMAL_TEMP_INVALID; + tz->prev_low_trip = -INT_MAX; + tz->prev_high_trip = INT_MAX; list_for_each_entry(pos, &tz->thermal_instances, tz_node) pos->initialized = false; } From 06d074249fa373865805136b3d34aeb7c20ee5d2 Mon Sep 17 00:00:00 2001 From: Sangmoon Kim Date: Fri, 15 Oct 2021 20:45:13 +0900 Subject: [PATCH 21/23] ANDROID: arm64: add vendor hooks for bti and pauth fault Add hooks to gather data of unusual aborts and summarize it with other information. Bug: 203187389 Signed-off-by: Sangmoon Kim Change-Id: I37b3047e72f64dc210d3d3bffe5ee207daeba8d6 --- arch/arm64/kernel/traps.c | 2 ++ drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/traps.h | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index e5e65f785c43..6c39a61ec115 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -414,6 +414,7 @@ NOKPROBE_SYMBOL(do_undefinstr); void do_bti(struct pt_regs *regs) { + trace_android_rvh_do_bti(regs, user_mode(regs)); BUG_ON(!user_mode(regs)); force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0); } @@ -425,6 +426,7 @@ void do_ptrauth_fault(struct pt_regs *regs, unsigned int esr) * Unexpected FPAC exception or pointer authentication failure in * the kernel: kill the task before it does any more harm. */ + trace_android_rvh_do_ptrauth_fault(regs, esr, user_mode(regs)); BUG_ON(!user_mode(regs)); force_signal_inject(SIGILL, ILL_ILLOPN, regs->pc, esr); } diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index e3506cdeacb0..1f6ac9318411 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -243,6 +243,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_undefinstr); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_bti); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_ptrauth_fault); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_bad_mode); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_arm64_serror_panic); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_selinux_avc_insert); diff --git a/include/trace/hooks/traps.h b/include/trace/hooks/traps.h index 350a14369acc..f8d56a207afc 100644 --- a/include/trace/hooks/traps.h +++ b/include/trace/hooks/traps.h @@ -17,6 +17,16 @@ DECLARE_RESTRICTED_HOOK(android_rvh_do_undefinstr, TP_ARGS(regs, user), TP_CONDITION(!user)); +DECLARE_RESTRICTED_HOOK(android_rvh_do_bti, + TP_PROTO(struct pt_regs *regs, bool user), + TP_ARGS(regs, user), + TP_CONDITION(!user)); + +DECLARE_RESTRICTED_HOOK(android_rvh_do_ptrauth_fault, + TP_PROTO(struct pt_regs *regs, unsigned int esr, bool user), + TP_ARGS(regs, esr, user), + TP_CONDITION(!user)); + DECLARE_RESTRICTED_HOOK(android_rvh_bad_mode, TP_PROTO(struct pt_regs *regs, unsigned int esr, int reason), TP_ARGS(regs, reason, esr), 1); From 45ebb9628e49418f30d182a8af06cff34a0a06e8 Mon Sep 17 00:00:00 2001 From: Steve Muckle Date: Sat, 30 Oct 2021 00:35:04 +0000 Subject: [PATCH 22/23] ANDROID: GKI: add required symbols for btusb to virtual device Leaf changes summary: 18 artifacts changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 18 Added functions Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 18 Added functions: [A] 'function sk_buff* __hci_cmd_sync(hci_dev*, u16, u32, void*, u32)' [A] 'function sk_buff* __hci_cmd_sync_ev(hci_dev*, u16, u32, void*, u8, u32)' [A] 'function int bit_wait_timeout(wait_bit_key*, int)' [A] 'function int bt_to_errno(unsigned short int)' [A] 'function void bt_warn(const char*, ...)' [A] 'function int btbcm_set_bdaddr(hci_dev*, const bdaddr_t*)' [A] 'function int btbcm_setup_apple(hci_dev*)' [A] 'function int btbcm_setup_patchram(hci_dev*)' [A] 'function void gpiod_put(gpio_desc*)' [A] 'function sk_buff* hci_cmd_sync(hci_dev*, u16, u32, void*, u32)' [A] 'function int hci_recv_diag(hci_dev*, sk_buff*)' [A] 'function int out_of_line_wait_on_bit_timeout(void*, int, wait_bit_action_f*, unsigned int, unsigned long int)' [A] 'function int usb_driver_claim_interface(usb_driver*, usb_interface*, void*)' [A] 'function void usb_driver_release_interface(usb_driver*, usb_interface*)' [A] 'function urb* usb_get_from_anchor(usb_anchor*)' [A] 'function void usb_queue_reset_device(usb_interface*)' [A] 'function void usb_scuttle_anchored_urbs(usb_anchor*)' [A] 'function void wake_up_bit(void*, int)' Bug: 202405948 Signed-off-by: Steve Muckle Signed-off-by: Greg Kroah-Hartman Change-Id: I412d3bc46bc343b89f6fc28e55386def69b0d34c --- android/abi_gki_aarch64.xml | 540 ++++++++++++++++--------- android/abi_gki_aarch64_virtual_device | 77 +++- 2 files changed, 411 insertions(+), 206 deletions(-) diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index c16d9b62d819..a3abbe5acc40 100644 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -108,6 +108,8 @@ + + @@ -751,6 +753,7 @@ + @@ -895,6 +898,11 @@ + + + + + @@ -2450,6 +2458,7 @@ + @@ -2477,7 +2486,9 @@ + + @@ -3459,6 +3470,7 @@ + @@ -5124,6 +5136,8 @@ + + @@ -5163,6 +5177,7 @@ + @@ -5209,6 +5224,7 @@ + @@ -5223,6 +5239,7 @@ + @@ -5531,6 +5548,7 @@ + @@ -9092,14 +9110,7 @@ - - - - - - - - + @@ -9107,6 +9118,13 @@ + + + + + + + @@ -14273,6 +14291,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -22506,6 +22607,17 @@ + + + + + + + + + + + @@ -22772,59 +22884,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -24353,6 +24413,7 @@ + @@ -25606,7 +25667,7 @@ - + @@ -36337,6 +36398,7 @@ + @@ -49353,7 +49415,7 @@ - + @@ -55750,6 +55812,11 @@ + + + + + @@ -65837,7 +65904,14 @@ - + + + + + + + + @@ -90586,6 +90660,7 @@ + @@ -91414,6 +91489,7 @@ + @@ -91439,14 +91515,6 @@ - - - - - - - - @@ -94611,7 +94679,7 @@ - + @@ -109869,7 +109937,7 @@ - + @@ -110077,9 +110145,6 @@ - - - @@ -113378,6 +113443,23 @@ + + + + + + + + + + + + + + + + + @@ -117533,6 +117615,11 @@ + + + + + @@ -118343,6 +118430,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -126528,6 +126637,10 @@ + + + + @@ -126648,10 +126761,23 @@ + + + + + + + + + + + + + @@ -131664,6 +131790,14 @@ + + + + + + + + @@ -135396,8 +135530,8 @@ - - + + @@ -135431,8 +135565,8 @@ - - + + @@ -135449,17 +135583,17 @@ - - - + + + - - + + - - + + @@ -135474,8 +135608,8 @@ - - + + @@ -135519,8 +135653,8 @@ - - + + @@ -139600,28 +139734,28 @@ - - - + + + - - - + + + - - - + + + - - - + + + - - + + @@ -139629,19 +139763,19 @@ - - - - - + + + + + - - - - - - + + + + + + @@ -139651,9 +139785,9 @@ - - - + + + @@ -139666,12 +139800,12 @@ - - + + - - + + @@ -139679,18 +139813,18 @@ - - + + - - + + - - - - + + + + @@ -139722,91 +139856,91 @@ - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - + + + + @@ -140181,6 +140315,17 @@ + + + + + + + + + + + @@ -140364,6 +140509,10 @@ + + + + @@ -140581,6 +140730,10 @@ + + + + @@ -140643,6 +140796,10 @@ + + + + @@ -142281,6 +142438,11 @@ + + + + + diff --git a/android/abi_gki_aarch64_virtual_device b/android/abi_gki_aarch64_virtual_device index 33752fac64a8..3b7e4f52cab4 100644 --- a/android/abi_gki_aarch64_virtual_device +++ b/android/abi_gki_aarch64_virtual_device @@ -34,6 +34,9 @@ bpf_trace_run4 bpf_trace_run5 bpf_trace_run6 + bt_err + bt_info + bt_warn bus_register bus_unregister cancel_delayed_work @@ -90,6 +93,7 @@ device_create device_del device_initialize + device_init_wakeup device_register device_release_driver device_unregister @@ -145,6 +149,12 @@ get_random_bytes get_unused_fd_flags gic_nonsecure_priorities + hci_alloc_dev + __hci_cmd_sync + hci_free_dev + hci_recv_frame + hci_register_dev + hci_unregister_dev hwrng_register hwrng_unregister ida_alloc_range @@ -313,6 +323,7 @@ pm_runtime_set_autosuspend_delay __pm_runtime_suspend __pm_runtime_use_autosuspend + pm_wakeup_dev_event preempt_schedule preempt_schedule_notrace prepare_to_wait @@ -490,6 +501,15 @@ unregister_virtio_driver up_read up_write + usb_alloc_urb + usb_anchor_urb + usb_control_msg + usb_deregister + usb_free_urb + usb_kill_anchored_urbs + usb_register_driver + usb_submit_urb + usb_unanchor_urb __usecs_to_jiffies usleep_range vabits_actual @@ -562,6 +582,46 @@ sg_miter_start sg_miter_stop +# required by btintel.ko + bt_to_errno + hci_cmd_sync + request_firmware_direct + +# required by btusb.ko + bit_wait_timeout + btbcm_set_bdaddr + btbcm_setup_apple + btbcm_setup_patchram + device_wakeup_disable + disable_irq + disable_irq_nosync + enable_irq + gpiod_get_optional + gpiod_put + gpiod_set_value_cansleep + __hci_cmd_sync_ev + hci_recv_diag + irq_modify_status + irq_set_irq_wake + of_irq_get_byname + of_match_device + of_property_read_variable_u16_array + out_of_line_wait_on_bit_timeout + pm_system_wakeup + usb_autopm_get_interface + usb_autopm_put_interface + usb_bulk_msg + usb_driver_claim_interface + usb_driver_release_interface + usb_enable_autosuspend + usb_get_from_anchor + usb_ifnum_to_if + usb_match_id + usb_queue_reset_device + usb_scuttle_anchored_urbs + usb_set_interface + wake_up_bit + # required by cfg80211.ko bpf_trace_run10 bpf_trace_run7 @@ -669,25 +729,10 @@ register_candev unregister_candev usb_alloc_coherent - usb_alloc_urb - usb_anchor_urb - usb_control_msg - usb_deregister usb_free_coherent - usb_free_urb - usb_kill_anchored_urbs - usb_register_driver - usb_submit_urb - usb_unanchor_urb # required by hci_vhci.ko - bt_err _copy_from_iter_full - hci_alloc_dev - hci_free_dev - hci_recv_frame - hci_register_dev - hci_unregister_dev # required by ledtrig-audio.ko led_set_brightness_nosleep @@ -901,7 +946,6 @@ input_mt_sync_frame input_set_capability kstrtou8 - pm_wakeup_dev_event ps2_begin_command ps2_cmd_aborted ps2_command @@ -930,7 +974,6 @@ # required by rtc-test.ko add_timer - device_init_wakeup devm_rtc_allocate_device platform_device_add platform_device_alloc From 1ba7c99bd35599519e6f0c1a1d8d8e71c965328c Mon Sep 17 00:00:00 2001 From: zhengding chen Date: Wed, 3 Nov 2021 11:40:01 +0800 Subject: [PATCH 23/23] ANDROID: cpufreq: times: record fast switch frequency transitions cpufreq_times_record_transition() is not called when fast switch is enabled, leading /proc/[pid]/time_in_state to attribute all time on a cluster to a single frequency. To fix this, add a call to cpufreq_times_record_transition() in the fast switch path. Test: /proc/[pid]/time_in_state shows times for more than one freq per cluster Bug: 204726690 Signed-off-by: zhengding chen Change-Id: Ief47ffb49fcc7fbf5408eea3056930e8791d2820 --- drivers/cpufreq/cpufreq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a7b43780ebf0..f0ec98dbfc96 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2106,6 +2106,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, arch_set_freq_scale(policy->related_cpus, freq, policy->cpuinfo.max_freq); cpufreq_stats_record_transition(policy, freq); + cpufreq_times_record_transition(policy, freq); trace_android_rvh_cpufreq_transition(policy); if (trace_cpu_frequency_enabled()) {