Commit graph

1149396 commits

Author SHA1 Message Date
zhengding chen
fdfaf852cd ANDROID: vendor_hooks: Add hooks for cpufreq_acct_update_power
We want to record the cputime of each running process by adding
hooks for cpufreq_acct_update_power.

Bug: 186604985

Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I35e38be4680781df3338b4a01041922294aecaa0
(cherry picked from commit 3983753280987d68138ce249232b3d1b775ab1e6)
2023-05-22 20:26:30 +00:00
Junki Min
e6c15792a6 ANDROID: ABI: Update symbol list for Exynos SoC
Update symbols of Exynos driver.
No function/variable symbols newly added/removed on ABI, but only
update list of Exynos.

Bug: 283658626
Signed-off-by: Junki Min <joonki.min@samsung.com>
Change-Id: Ib471bafa11943d7388de593712b114d17c72436c
2023-05-22 10:32:36 +09:00
xieliujie
cffbdd825e ANDROID: ABI: Update oplus symbol list
5 function symbol(s) added
  'int __traceiter_android_vh_dup_task_struct(void*, struct task_struct*, struct task_struct*)'
  'int __traceiter_android_vh_exit_signal(void*, struct task_struct*)'
  'int __traceiter_android_vh_irqtime_account_process_tick(void*, struct task_struct*, struct rq*, int, int)'
  'int __traceiter_android_vh_sched_stat_runtime_rt(void*, struct task_struct*, u64)'
  'int __traceiter_sched_stat_runtime(void*, struct task_struct*, u64, u64)'

5 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_dup_task_struct'
  'struct tracepoint __tracepoint_android_vh_exit_signal'
  'struct tracepoint __tracepoint_android_vh_irqtime_account_process_tick'
  'struct tracepoint __tracepoint_android_vh_sched_stat_runtime_rt'
  'struct tracepoint __tracepoint_sched_stat_runtime'

Bug: 283132152
Change-Id: Ia6e1b49df5e66b51d49e9a642b0dcf13598c6faa
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-19 19:41:20 +00:00
Liangliang Li
527e7b1ee8 ANDROID: vendor_hooks: Add hooks for account irqtime process tick
Add a hook in irqtime_account_process_tick, which helps to get
information about the high load task.

Bug: 187904818

Change-Id: I644f7d66b09d047ca6b0a0fbd2915a6387c8c007
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
(cherry picked from commit fe580539f6cec43ddb0d6ecfd39aa2f4e45754ca)
(cherry picked from commit bf3b384e0876a3111d114392b405ed269dcb9c9e)
2023-05-19 19:41:20 +00:00
Liangliang Li
3b573277d4 ANDROID: vendor_hooks: Add hooks to dup_task_struct
Add hook to dup_task_struct for vendor data fields initialisation.

Bug: 188004638

Change-Id: I4b58604ee822fb8d1e0cc37bec72e820e7318427
Signed-off-by: Liangliang Li <liliangliang@vivo.com>
(cherry picked from commit f66d96b14aab5051fdf6b5054d87362c17a7b365)
(cherry picked from commit bafafe0ec46160573bef46d3d0f5d6c65fadaa3b)
2023-05-19 19:41:20 +00:00
Liujie Xie
310995a546 ANDROID: vendor_hooks: Add hooks to record the time of the process in various states
These hooks will do the following works:
a) record the time of the process in various states
b) Make corresponding optimization strategies in different hooks

Bug: 205938967

Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: Ia3c47bbf0aadd17337ce18fd910343b1b8c3ef93
(cherry picked from commit a61d61bab7c3d221d5d2250eacab2e4e9f59b252)
Signed-off-by: Carlos Llamas <cmllamas@google.com>
(cherry picked from commit b7a1174cc5dfc68cf769547b91958df407e55981)
(cherry picked from commit e1f430a48702844c01933a925c92b077ba14ec3f)
2023-05-19 19:41:20 +00:00
xieliujie
bf8bbc3ff8 ANDROID: vendor_hooks: Add hooks for signal
Add hook to boost thread when process killed.

Bug: 237749933
Signed-off-by: xieliujie <xieliujie@oppo.com>
Change-Id: I7cc6f248397021f3a8271433144a0e582ed27cfa
(cherry picked from commit 709679142d583b0b7338d931fdd43b27b1bbf9e0)
(cherry picked from commit 226f36edddc3ad523dbb901ca3d5683f5f4e1707)
2023-05-19 19:41:20 +00:00
Thierry Strudel
bfbebce3f7 ANDROID: power: wakeup_reason: change abort log
Logging callback symbolic name is generating too many different
messages making Abort analysis miss big trends.
Stick to console reported message providing sufficient information.

Bug: 280678242
Signed-off-by: Thierry Strudel <tstrudel@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:9f8f2ea03ede21d8928793c4be87eeb76d81bc7f)
Merged-In: Ic0ea662a60919454060e3a085aeabd8a4099e0b4
Change-Id: Ic0ea662a60919454060e3a085aeabd8a4099e0b4
2023-05-19 06:57:11 +00:00
xiaofeng
295ed6f497 ANDROID: GKI: Update symbol list for xiaomi
2 function symbol(s) added
  'int __traceiter_android_vh_psi_event(struct psi_trigger *t)'
  'int __traceiter_android_vh_psi_group(struct psi_group *group)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_psi_event'
  'struct tracepoint __tracepoint_android_vh_psi_group'

Bug: 282873533
Change-Id: I8ea4ac7d986b18d41a42afb57f5fc6e90a9b3961
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
2023-05-18 21:53:34 +00:00
Georgi Djakov
d39f39ccb9 ANDROID: psi: Add vendor hooks for PSI tracing
Add hooks to capture various per-zone memory stats when
a trigger threshold is hit.

Bug: 268290366
Change-Id: Ibe39263ddb05ffc3fa63b5225497a90c6480c8d7
Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
2023-05-18 21:53:34 +00:00
Theodore Ts'o
dbc72667a2 UPSTREAM: ext4: fix invalid free tracking in ext4_xattr_move_to_block()
commit b87c7cdf2bed4928b899e1ce91ef0d147017ba45 upstream.

In ext4_xattr_move_to_block(), the value of the extended attribute
which we need to move to an external block may be allocated by
kvmalloc() if the value is stored in an external inode.  So at the end
of the function the code tried to check if this was the case by
testing entry->e_value_inum.

However, at this point, the pointer to the xattr entry is no longer
valid, because it was removed from the original location where it had
been stored.  So we could end up calling kvfree() on a pointer which
was not allocated by kvmalloc(); or we could also potentially leak
memory by not freeing the buffer when it should be freed.  Fix this by
storing whether it should be freed in a separate variable.

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230430160426.581366-1-tytso@mit.edu
Link: https://syzkaller.appspot.com/bug?id=5c2aee8256e30b55ccf57312c16d88417adbd5e1
Link: https://syzkaller.appspot.com/bug?id=41a6b5d4917c0412eb3b3c3c604965bed7d7420b
Reported-by: syzbot+64b645917ce07d89bde5@syzkaller.appspotmail.com
Reported-by: syzbot+0d042627c4f2ad332195@syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 281332515
Bug: 281333738
Change-Id: Id1fbcc337821d66df53c2826bf3158963f8b0673
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
2023-05-18 21:46:56 +00:00
Alice Chao
7ce023f185 FROMGIT: scsi: ufs: core: mcq: Fix &hwq->cq_lock deadlock issue
When ufshcd_err_handler() is executed, CQ event interrupt can enter waiting
for the same lock. This can happen in ufshcd_handle_mcq_cq_events() and
also in ufs_mtk_mcq_intr(). The following warning message will be generated
when &hwq->cq_lock is used in IRQ context with IRQ enabled. Use
ufshcd_mcq_poll_cqe_lock() with spin_lock_irqsave instead of spin_lock to
resolve the deadlock issue.

[name:lockdep&]WARNING: inconsistent lock state
[name:lockdep&]--------------------------------
[name:lockdep&]inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
[name:lockdep&]kworker/u16:4/260 [HC0[0]:SC0[0]:HE1:SE1] takes:
  ffffff8028444600 (&hwq->cq_lock){?.-.}-{2:2}, at:
ufshcd_mcq_poll_cqe_lock+0x30/0xe0
[name:lockdep&]{IN-HARDIRQ-W} state was registered at:
  lock_acquire+0x17c/0x33c
  _raw_spin_lock+0x5c/0x7c
  ufshcd_mcq_poll_cqe_lock+0x30/0xe0
  ufs_mtk_mcq_intr+0x60/0x1bc [ufs_mediatek_mod]
  __handle_irq_event_percpu+0x140/0x3ec
  handle_irq_event+0x50/0xd8
  handle_fasteoi_irq+0x148/0x2b0
  generic_handle_domain_irq+0x4c/0x6c
  gic_handle_irq+0x58/0x134
  call_on_irq_stack+0x40/0x74
  do_interrupt_handler+0x84/0xe4
  el1_interrupt+0x3c/0x78
<snip>

Possible unsafe locking scenario:
       CPU0
       ----
  lock(&hwq->cq_lock);
  <Interrupt>
    lock(&hwq->cq_lock);
  *** DEADLOCK ***
2 locks held by kworker/u16:4/260:

[name:lockdep&]
 stack backtrace:
CPU: 7 PID: 260 Comm: kworker/u16:4 Tainted: G S      W  OE
6.1.17-mainline-android14-2-g277223301adb #1
Workqueue: ufs_eh_wq_0 ufshcd_err_handler

 Call trace:
  dump_backtrace+0x10c/0x160
  show_stack+0x20/0x30
  dump_stack_lvl+0x98/0xd8
  dump_stack+0x20/0x60
  print_usage_bug+0x584/0x76c
  mark_lock_irq+0x488/0x510
  mark_lock+0x1ec/0x25c
  __lock_acquire+0x4d8/0xffc
  lock_acquire+0x17c/0x33c
  _raw_spin_lock+0x5c/0x7c
  ufshcd_mcq_poll_cqe_lock+0x30/0xe0
  ufshcd_poll+0x68/0x1b0
  ufshcd_transfer_req_compl+0x9c/0xc8
  ufshcd_err_handler+0x3bc/0xea0
  process_one_work+0x2f4/0x7e8
  worker_thread+0x234/0x450
  kthread+0x110/0x134
  ret_from_fork+0x10/0x20

Bug: 267974767
(cherry picked from commit 948afc69615167a3c82430f99bfd046332b89912
 https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 6.4/scsi-staging)
Fixes: ed975065c31c ("scsi: ufs: core: mcq: Add completion support in poll")
Reviewed-by: Can Guo <quic_cang@quicinc.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Alice Chao <alice.chao@mediatek.com>
Link: https://lore.kernel.org/r/20230424080400.8955-1-alice.chao@mediatek.com
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Change-Id: Ib75c41579138a14e820eba19b876cd4ae786dd67
Signed-off-by: Alice Chao <alice.chao@mediatek.com>
2023-05-18 21:32:33 +00:00
xieliujie
bae70267ba ANDROID: ABI: Update oplus symbol list
1 variable symbol(s) added
  'struct update_util_data* cpufreq_update_util_data'

Bug: 283132152
Change-Id: Icc09071a8d19608dd16a629980722dc958f54385
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-18 20:39:10 +00:00
Liujie Xie
2878003246 ANDROID: android: Export symbols for invoking cpufreq_update_util()
In order to update cpufreq, vendor modules invoke cpufreq_update_util(),
but when we build our modules, report error:
ERROR: modpost: "cpufreq_update_util_data" [xxx.ko] undefined!

Bug: 192218676
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Change-Id: Ib1da70229f04b08d8d812d065021dec0bf891e0e
(cherry picked from commit 8943a2e7a33e33fd89614ac83b33b30f8d8c6b96)
(cherry picked from commit d1bc61dd85e8d28f1df0e22e2d73aa9e99cb645e)
2023-05-18 20:39:10 +00:00
xieliujie
546b0f9d8b ANDROID: ABI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_task_rename(void*, struct task_struct*, const char*)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_task_rename'

Bug: 283132152
Change-Id: Idbb6e338e0959b3cd2f5f4cc2f1e1ff17e4a9b72
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-18 20:38:34 +00:00
Liujie Xie
e3e91e9f2a ANDROID: vendor_hooks: Export the tracepoints task_rename
Export the tracepoint task_rename to identify specific new task,
to customize task's util for power and performance, or optimize
task schedule parameters.

Bug: 189985971

Change-Id: I3bb71eae316e3096d361e7b47012ba46ea4be509
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
(cherry picked from commit 016d3f7b6986d0ca0acef18c59a47cf6eaa4f562)
(cherry picked from commit cfc14a391adb4d44d8186694b4884815bd85be6c)
2023-05-18 20:38:34 +00:00
Veerendranath Jakkam
42b899d573 ANDROID: Add macros to create reserved data fields to backport upstream changes
Adds various macros to create reserved data fields in kernel data
structures before the freeze and to use reserved data fields to backport
upstream changes after the freeze.

Bug: 233387627
Change-Id: Ifbf8444861fa805593ce9b4837cd2653b7b7a0b0
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
2023-05-18 18:16:11 +00:00
Minchan Kim
718da042d1 ANDROID: retry page allocation from buddy on lock contention
spin_trylock may fail due to a parallel drain in rmqueue_pcplist.
In the case, it should retry to allocate with buddy.
It matches with upstream policy.

Fixes: 433445e9a1 ("ANDROID: mm: add cma pcp list")
Change-Id: I07367888d7ede38e09f9d882fc2485baa175fe64
Signed-off-by: Minchan Kim <minchan@google.com>
2023-05-18 17:41:28 +00:00
Dan Carpenter
0ef5d2caad UPSTREAM: KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()
commit a25bc8486f9c01c1af6b6c5657234b2eee2c39d6 upstream.

The KVM_REG_SIZE() comes from the ioctl and it can be a power of two
between 0-32768 but if it is more than sizeof(long) this will corrupt
memory.

Fixes: 99adb56763 ("KVM: arm/arm64: Add save/restore support for firmware workaround state")
Change-Id: I37107d3a62db584e9d026d5ecaf7d0cc15a4b716
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/4efbab8c-640f-43b2-8ac6-6d68e08280fe@kili.mountain
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8d6a870a42)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-05-18 16:17:42 +00:00
Quentin Perret
270a77dd07 ANDROID: arm64: Check FGT cap before touching HFGWTR_EL2
Writing to HFGWTR_EL2 is undefined on CPUs without the capability,
so make sure not to touch the register when that is the case.

Bug: 282917063
Bug: 282993310
Change-Id: I85211105d6b1fbee854b4f13f037b8573c5a211c
Signed-off-by: Quentin Perret <qperret@google.com>
2023-05-18 09:10:22 +00:00
Quentin Perret
95cd5f8f94 Revert "ANDROID: Partially Revert "ANDROID: KVM: arm64: Allow tweaking HFGWTR_EL2 from modules""
This reverts commit 6cf9fb45795ab6b557101cc759e77aa547a4cbe9. It was a
temporary workaround which will be replaced a proper fix shortly.

Bug: 282917063
Bug: 282993310
Change-Id: I0caec4a63aabaecbf3fa7ec5d5b4c6930ea6efcd
Signed-off-by: Quentin Perret <qperret@google.com>
2023-05-18 09:10:22 +00:00
Jaegeuk Kim
630b104caa FROMGIT: f2fs: fix the wrong condition to determine atomic context
Should use !in_task for irq context.

Bug: 281085599
Cc: stable@vger.kernel.org
Fixes: 1aa161e43106 ("f2fs: fix scheduling while atomic in decompression path")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit f063fa43995667dbdf5b46406774a0ad58310dae
 https://git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
Change-Id: I5ce9286cc380309ee5e294f54ec357a4bfa47d6f
2023-05-18 02:41:06 +00:00
Dezhi Huang
cab47c81b5 ANDROID: GKI: update symbol list file for honor
Create the symbol list file for Honor Device Co.

Bug: 279793369
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
Change-Id: I11bca937366428bc87a174a64b7d6843e3d92339
2023-05-17 21:26:09 +00:00
Zhipeng Wang
3368eaf934 ANDROID: ABI: Update symbol list for imx
3 function symbol(s) added
  'int clocksource_mmio_init(void*, const char*, unsigned long, int, unsigned int, u64(*)(struct clocksource*))'
  'u64 clocksource_mmio_readl_up(struct clocksource*)'
  'int timer_of_init(struct device_node*, struct timer_of*)'

Bug: 283014063

Change-Id: I8c35bfd05da64d2c00c444c6bc0a53a30a12e91c
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
2023-05-17 21:15:03 +00:00
Charan Teja Kalla
a26891749b ANDROID: mm: shmem: initialize the vendor data
Vendor data is not initialized which can make the drivers to see the
junk. Initialize it.

Bug: 273448633
Fixes: a033dd393f ("ANDROID: mm: shmem: add vendor data in 'shmem_inode_info'")
Change-Id: I44379c97831324e8dd439a27c6326706eb0bcadf
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2023-05-17 17:54:56 +00:00
Giuliano Procida
112bf65cbc ANDROID: GKI: refresh STG ABI to new version
prebuilts/kernel-build-tools/linux-x86/bin/stg \
  --stg common/android/abi_gki_aarch64.stg \
  --output common/android/abi_gki_aarch64.stg

Bug: 274744378
Change-Id: I186d187a0272a5bce9015ab0b407830ca2f077db
Signed-off-by: Giuliano Procida <gprocida@google.com>
2023-05-17 12:50:40 +01:00
Jiewen Wang
22406c7dbb ANDROID: GKI: Add symbols to symbol list for vivo
INFO: 2 function symbol(s) added
  'int __traceiter_android_vh_mmap_region(void*, struct vm_area_struct*, unsigned long)'
  'int __traceiter_android_vh_try_to_unmap_one(void*, struct folio*, struct vm_area_struct*, unsigned long, void*, bool)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_mmap_region'
  'struct tracepoint __tracepoint_android_vh_try_to_unmap_one'

Bug: 198385827
Change-Id: Iaf77526f33e865c8f48c47fae14a1e3eb5b3e1a5
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
2023-05-17 12:48:51 +01:00
xieliujie
eb9264dd96 ANDROID: ABI: Update oplus symbol list
2 function symbol(s) added
  'int __traceiter_android_vh_account_process_tick_gran(void*, int, int*)'
  'int __traceiter_android_vh_account_task_time(void*, struct task_struct*, struct rq*, int, int)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_account_process_tick_gran'
  'struct tracepoint __tracepoint_android_vh_account_task_time'

Bug: 279549765
Change-Id: I7f56e7d19352acab04be659bb63a8ad6e42fbeb9
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-05-17 11:31:51 +00:00
Liujie Xie
c92b19e8e4 ANDROID: vendor_hooks: Add hooks for account process tick
Add a hook in account_process_tick, which help us to get information
about the high load task and the cpu they running on.

Bug: 183260319
Change-Id: I54162ce3c65bd69e08d2d4747e4d4883efe4c442
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2023-05-17 11:31:51 +00:00
Liujie Xie
32ff609a32 ANDROID: ABI: Update oplus symbol list
1 function symbol(s) added
  'int __traceiter_android_vh_account_process_tick_gran(void*, int, int*)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_account_process_tick_gran'

Bug: 279549765
Change-Id: Ibdb9638b6e225c8326a255b2c3b141498c625942
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2023-05-17 11:31:51 +00:00
Liujie Xie
ec8c8f6e33 ANDROID: vendor_hooks: add hook account_process_tick_gran
this hook will allow to account tick in every third of more ticks
to save cpu time for accounting

Bug: 279549765
Change-Id: I5d18e0167fdce076d13aecc653dcf6387bcb25f2
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
2023-05-17 11:31:51 +00:00
Jiewen Wang
1a40d683e8 ANDROID: vendor_hooks: Add hook in try_to_unmap_one()
Add hook in try_to_unmap_one() to trace this function for debug memory
swap bugs.

Bug: 198385827
Change-Id: I1fdbe60e09bb491b949e06a07133710453ecca03
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
(cherry picked from commit 5a70133febf92e1269f98b533ce9f188c2e3b135)
2023-05-17 10:04:17 +00:00
Jiewen Wang
190af40844 ANDROID: vendor_hooks: Add hook in mmap_region()
Add hook in mmap_region() to record the vma and address information
of monitored processes.

Bug: 198385827
Change-Id: I0bde29113b47ca7f4a9f5d42a54188e791ca3b7e
Signed-off-by: Jiewen Wang <jiewen.wang@vivo.com>
(cherry picked from commit 73c9d4a9d575107b90a6d9f415fa56f963264d06)
2023-05-17 10:04:17 +00:00
Will McVicker
1b160e2a0e ANDROID: Partially Revert "ANDROID: KVM: arm64: Allow tweaking HFGWTR_EL2 from modules"
This is a partial revert of commit 444b34b83a in order to fix booting
this kernel on devices that don't support FEAT_FGT due to direct
accesses of HFGWTR_EL2 being UNDEFINED. We are retaining the KMI part of
the commit until the next KMI breakage window.

Bug: 282917063
Change-Id: I6c156ef40a5584dc41e4d9d09c80736e30348802
Signed-off-by: Will McVicker <willmcvicker@google.com>
2023-05-17 07:59:36 +00:00
wang qiankun
7d346b229c ANDROID: GKI: update the ABI symbol list
INFO: ABI DIFFERENCES HAVE BEEN DETECTED!
INFO: 1 function symbol(s) added
  'int __traceiter_android_rvh_refrigerator(void*, bool)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_refrigerator'
  'struct cgroup_subsys freezer_cgrp_subsys'

Bug: 281920779

Change-Id: I58d1bfba887b7f0b6af471e8b18fab368b119b7d
Signed-off-by: wang qiankun <wangqiankun3@xiaomi.corp-partner.google.com>
2023-05-17 00:25:38 +00:00
heshuai1
a9a44851ec ANDROID: freezer: Add vendor hook to freezer for GKI purpose.
Add the vendor hook to freezer.c so that OEM's logic can be executed
when the process is about to be frozen. We need to clear the flag for
some tasks and rebind task dependencies for optimization purposes.

Bug: 187458531
Bug: 281920779

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: Iea42fd9604d6b33ccd6502425416f0dd28eecebb
(cherry picked from commit a1580311c36ca28344b2f03b3c8a72d9f8db5bde)
2023-05-17 00:25:38 +00:00
Zhuguangqing
632ec01905 ANDROID: freezer: export the freezer_cgrp_subsys for GKI purpose.
Exporting the symbol freezer_cgrp_subsys, in that vendor module can
add can_attach & cancel_attach member function. It is vendor-specific
tuning.

Bug: 182496370
Bug: 281920779

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: I153682b9d1015eed3f048b45ea6495ebb8f3c261
(cherry picked from commit ee3f4d2821f5b2a794f0a1f5ed423f561a01adae)
(cherry picked from commit 8a90e4d4e555dd5484213c6fec5061958016a194)
2023-05-17 00:25:38 +00:00
wang qiankun
fdd7d6fbac ANDROID: GKI: update the ABI symbol list
INFO: ABI DIFFERENCES HAVE BEEN DETECTED!
INFO: 4 function symbol(s) added
  'int __traceiter_android_vh_binder_alloc_new_buf_locked(void*, size_t, size_t*, int)'
  'int __traceiter_android_vh_binder_reply(void*, struct binder_proc*, struct binder_proc*, struct binder_thread*, struct binder_transaction_data*)'
  'int __traceiter_android_vh_binder_trans(void*, struct binder_proc*, struct binder_proc*, struct binder_thread*, struct binder_transaction_data*)'
  'int __traceiter_android_vh_do_send_sig_info(void*, int, struct task_struct*, struct task_struct*)'

4 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_binder_alloc_new_buf_locked'
  'struct tracepoint __tracepoint_android_vh_binder_reply'
  'struct tracepoint __tracepoint_android_vh_binder_trans'
  'struct tracepoint __tracepoint_android_vh_do_send_sig_info'

function symbol 'int snd_usb_power_domain_set(struct snd_usb_audio*, struct snd_usb_power_domain*, unsigned char)' changed
  CRC changed from 0xf4ff4ee5 to 0xb29e40d5

Bug: 281920779

Change-Id: I3e6cd71847ee2eeee26fc8aef985055c00504d14
Signed-off-by: wang qiankun <wangqiankun3@xiaomi.corp-partner.google.com>
2023-05-16 21:47:18 +00:00
Zhuguangqing
17fff41db8 ANDROID: Add vendor hooks for binder perf tuning
Add some hooks in the binder module so that we can do task dependency analysis and statistical work in OEM's module for further optimization.

Bug: 235925535
Bug: 281920779

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: Id47e59c4e3ccd07b26eef758ada147b98cd1964e
Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
[ cmllamas: don't export complete private definition struct binder_alloc
  in vendor hooks, instead just pass member alloc->free_async_space as
  implemented by heshuai1 and squashed here ]
(cherry picked from commit 254fb1f4034fde523378ee58a501d212a59047b7)
2023-05-16 21:44:18 +00:00
Zhuguangqing
bf4922727c ANDROID: Add vendor hooks to signal.
This hook will allow us to get signal messages so that we can set
limitations for certain tasks and restore them when receiving important signals.

Bug: 184898838
Bug: 281920779

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: I83a28b0a6eb413976f4c57f2314d008ad792fa0d
(cherry picked from commit 58e3f869fc3fe84fb7062496ccd049db47f3ed7f)
2023-05-16 21:44:18 +00:00
Minchan Kim
27dfd1c13e ANDROID: Update the ABI symbol list
1 function symbol(s) added
  'void __page_pinner_put_page(struct page*)'

1 variable symbol(s) added
  'struct static_key_false page_pinner_inited'
Bug: 274967172
Change-Id: I458edf7089b44696fa270be0ed538441c99ab5e6
Signed-off-by: Minchan Kim <minchan@google.com>
2023-05-16 21:34:27 +00:00
Minchan Kim
2488e2e472 ANDROID: page_pinner: add missing page_pinner_put_page
aosp/2369528 missed page_pinner_put_page in put_page_testzero
path. Fix it.

Bug: 274967172
Change-Id: Ia2af2ffb752f8405b4289ca88cde09f201548e1f
Signed-off-by: Minchan Kim <minchan@google.com>
2023-05-16 21:34:27 +00:00
Charan Teja Kalla
d47c9481da ANDROID: page_pinner: prevent pp_buffer uninitialized access
There is a race window between page_pinner_inited set and the pp_buffer
initialization which cause accessing the pp_buffer->lock. Avoid this by
moving the pp_buffer initialization to page_ext_ops->init() which sets
the page_pinner_inited only after the pp_buffer is initialized.

Race scenario:
1) init_page_pinner is called --> page_pinner_inited is set.

2) __alloc_contig_migrate_range --> __page_pinner_failure_detect()
accesses the pp_buffer->lock(yet to be initialized).

3) Then the pp_buffer is allocated and initialized.

Below is the issue call stack:
 spin_bug+0x0
 _raw_spin_lock_irqsave+0x3c
 __page_pinner_failure_detect+0x110
 __alloc_contig_migrate_range+0x1c4
 alloc_contig_range+0x130
 cma_alloc+0x170
 dma_alloc_contiguous+0xa0
 __dma_direct_alloc_pages+0x16c
 dma_direct_alloc+0x88

Bug: 259024332
Change-Id: I6849ac4d944498b9a431b47cad7adc7903c9bbaa
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2023-05-16 21:34:27 +00:00
Suren Baghdasaryan
83b784c3d7 ANDROID: page_pinner: prevent pp_buffer access before initialization
If page_pinner is configured with page_pinner_enabled=false and
failure_tracking=true, pp_buffer will be accessed without being
initialized. Prevent this by adding page_pinner_inited checks in
functions that access it.

Fixes: 898cfbf094a2 ("ANDROID: mm: introduce page_pinner")
Bug: 259024332
Bug: 260179017
Change-Id: I8f612cae3e74d36e8a4eee5edec25281246cbe5e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 23fb3111f63e5fe239a769668275c20493a5849c)
2023-05-16 21:34:27 +00:00
Charan Teja Kalla
231a4cccec ANDROID: mm: fix use-after free of page_ext in page_pinner
Apply new page_ext refcounting scheme to page_pinner.

Bug: 236222283
Bug: 240196534
[surenb: extracted from aosp/2369529]
Change-Id: I3b64caf5a7e8ff316507cc3933f5b3696142268d
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-05-16 21:34:27 +00:00
Minchan Kim
e6e6e1273d ANDROID: mm: introduce page_pinner
For CMA allocation, it's really critical to migrate a page but
sometimes it fails. One of the reasons is some driver holds a
page refcount for a long time so VM couldn't migrate the page
at that time.

The concern here is there is no way to find the who hold the
refcount of the page effectively. This patch introduces feature
to keep tracking page's pinner. All get_page sites are vulnerable
to pin a page for a long time but the cost to keep track it would
be significat since get_page is the most frequent kernel operation.
Furthermore, the page could be not user page but kernel page which
is not related to the page migration failure.

Thus, this patch keeps tracks of only migration failed pages to
reduce runtime cost. Once page migration fails in CMA allocation
path, those pages are marked as "migration failure" and every
put_page operation against those pages, callstack of the put
are recorded into page_pinner buffer. Later, admin can see
what pages were failed and who released the refcount since the
failure. It really helps effectively to find out longtime refcount
holder to prevent the page migration.

note: page_pinner doesn't guarantee attributing/unattributing are
atomic if they happen at the same time. It's just best effort so
false-positive could happen.

Bug: 183414571
BUg: 240196534
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I603d0c0122734c377db6b1eb95848a6f734173a0
(cherry picked from commit 898cfbf094a2fc13c67fab5b5d3c916f0139833a)
2023-05-16 21:34:27 +00:00
Elliot Berman
4c868837fa ANDROID: abi_gki_aarch64_qcom: Add gh_rm_register_platform_ops
From commit 80dfafb2b9b6 ("ANDROID: gunyah: Sync with latest "firmware:
qcom_scm: Register Gunyah platform ops""), the QCOM platform extensions
now use gh_rm_(un)register_platform_ops instead of the devm_ equivalent
because the platform extensions are no longer directly backed by a
device.

 2 function symbol(s) added
  'int gh_rm_register_platform_ops(struct gh_rm_platform_ops*)'
  'void gh_rm_unregister_platform_ops(struct gh_rm_platform_ops*)'

Bug: 279506910
Change-Id: I7ad36387a9d254691ecf9b769e058d972bd41c42
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-05-16 20:35:28 +00:00
Elliot Berman
9a9fc8d1b2 ANDROID: gunyah: Sync remaining gunyah drivers with latest
Apply remaining minor fixups from Gunyah v13 patches:

https://lore.kernel.org/all/20230509204801.2824351-1-quic_eberman@quicinc.com/

Bug: 279506910
Change-Id: I1a596b9df29d210c51b612845e4a1aafbea00441
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-05-16 20:35:28 +00:00
Elliot Berman
afaf163329 ANDROID: gunyah: Sync with latest "mailbox: Add Gunyah message queue mailbox"
Align msgq mailbox implementation to version 13 of Gunyah patches:

https://lore.kernel.org/all/20230509204801.2824351-6-quic_eberman@quicinc.com/

Bug: 279506910
Change-Id: I017873310e6c8650afa3e6dae379c7e7048b7197
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-05-16 20:35:28 +00:00
Elliot Berman
016d92266e ANDROID: gunyah: Sync with latest "gunyah: Common types and error codes for Gunyah hypercalls"
Rename gh_remap_error to gh_error_remap to align with Gunyah v13
patches:

https://lore.kernel.org/all/20230509204801.2824351-3-quic_eberman@quicinc.com/

Bug: 279506910
Change-Id: Id3e033108a6a42868dc12a9c20c1a06775418979
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-05-16 20:35:28 +00:00