Commit Graph

1159675 Commits

Author SHA1 Message Date
Todd Kjos
76d91af9da ANDROID: fix kernelci build breaks due to hid/uhid cyclic dependency
An android-only patch to work around frozen KMI for android14 kernels
allows a dependency between hid and uhid if both modules are enabled:

if (IS_ENABLED(CONFIG_UHID) && parser->device->ll_driver == &uhid_hid_driver)
    max_buffer_size = UHID_DATA_MAX;

For allmodconfig builds, both hid and uhid are modules so this creates
a cyclic dependancy and we see this error in kernelci tests:

    ERROR: Cycle detected: hid -> uhid -> hid

Fix by changeing to IS_BUILTIN() instead of IS_ENABLED() since Android
builds always build uhid into the core kernel.

Fixes: 7668cef283 ("ANDROID: HID: Only utilise UHID provided exports if UHID is enabled")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I622466a42ad94e3606820cf506188bd679078cbf
2024-06-29 19:55:29 +00:00
Todd Kjos
c2dad37627 ANDROID: fix kernelci GCC builds of fips140.ko
GCC builds of fips140.ko all fail with these errors. This causes
allmodconfig builds to fail in kernelci.

aarch64-linux-gnu-objcopy: crypto/fips140.ko:
        can't dump section '.rela.rodata'
	- it does not exist: file format not recognized

Since the Android use-cases for fips140 are clang only, suppress
fips140.ko builds for GCC

Bug: 350087876
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I742d19bc5172d43a19acd48a248bc2a194f67ca2
2024-06-28 23:05:20 +00:00
Pierre Gondois
8bffcfee7a UPSTREAM: sched/fair: Use all little CPUs for CPU-bound workloads
Running N CPU-bound tasks on an N CPUs platform:

- with asymmetric CPU capacity

- not being a DynamIq system (i.e. having a PKG level sched domain
  without the SD_SHARE_PKG_RESOURCES flag set)

.. might result in a task placement where two tasks run on a big CPU
and none on a little CPU. This placement could be more optimal by
using all CPUs.

Testing platform:

  Juno-r2:
    - 2 big CPUs (1-2), maximum capacity of 1024
    - 4 little CPUs (0,3-5), maximum capacity of 383

Testing workload ([1]):

  Spawn 6 CPU-bound tasks. During the first 100ms (step 1), each tasks
  is affine to a CPU, except for:

    - one little CPU which is left idle.
    - one big CPU which has 2 tasks affine.

  After the 100ms (step 2), remove the cpumask affinity.

Behavior before the patch:

  During step 2, the load balancer running from the idle CPU tags sched
  domains as:

  - little CPUs: 'group_has_spare'. Cf. group_has_capacity() and
    group_is_overloaded(), 3 CPU-bound tasks run on a 4 CPUs
    sched-domain, and the idle CPU provides enough spare capacity
    regarding the imbalance_pct

  - big CPUs: 'group_overloaded'. Indeed, 3 tasks run on a 2 CPUs
    sched-domain, so the following path is used:

      group_is_overloaded()
      \-if (sgs->sum_nr_running <= sgs->group_weight) return true;

    The following path which would change the migration type to
    'migrate_task' is not taken:

      calculate_imbalance()
      \-if (env->idle != CPU_NOT_IDLE && env->imbalance == 0)

    as the local group has some spare capacity, so the imbalance
    is not 0.

  The migration type requested is 'migrate_util' and the busiest
  runqueue is the big CPU's runqueue having 2 tasks (each having a
  utilization of 512). The idle little CPU cannot pull one of these
  task as its capacity is too small for the task. The following path
  is used:

   detach_tasks()
   \-case migrate_util:
     \-if (util > env->imbalance) goto next;

After the patch:

As the number of failed balancing attempts grows (with
'nr_balance_failed'), progressively make it easier to migrate
a big task to the idling little CPU. A similar mechanism is
used for the 'migrate_load' migration type.

Improvement:

Running the testing workload [1] with the step 2 representing
a ~10s load for a big CPU:

  Before patch: ~19.3s
  After patch:  ~18s (-6.7%)

Similar issue reported at:

  https://lore.kernel.org/lkml/20230716014125.139577-1-qyousef@layalina.io/

Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Qais Yousef <qyousef@layalina.io>
Link: https://lore.kernel.org/r/20231206090043.634697-1-pierre.gondois@arm.com
(cherry picked from commit 3af7524b14198f5159a86692d57a9f28ec9375ce)
Change-Id: I916aa7e56af6addf0eb3a78ec77119324172d9d9
Signed-off-by: John Stultz <jstultz@google.com>
2024-06-28 22:50:37 +00:00
Anton Altaparmakov
a1926c3f2b ANDROID: GKI: Extend Tuxera symbol list
This list covers Tuxera HFS+ file system driver.

16 function symbol(s) added
  'int _atomic_dec_and_lock(atomic_t*, spinlock_t*)'
  'int blkdev_issue_zeroout(struct block_device*, sector_t, sector_t, gfp_t, unsigned int)'
  'int cont_write_begin(struct file*, struct address_space*, loff_t, unsigned int, struct page**, void**, get_block_t*, loff_t*)'
  'void fileattr_fill_flags(struct fileattr*, u32)'
  'bool filemap_release_folio(struct folio*, gfp_t)'
  'int generic_cont_expand_simple(struct inode*, loff_t)'
  'struct inode* iget_locked(struct super_block*, unsigned long)'
  'void inode_add_bytes(struct inode*, loff_t)'
  'struct timespec64 inode_set_ctime_current(struct inode*)'
  'int match_octal(substring_t*, int*)'
  'char* match_strdup(const substring_t*)'
  'int migrate_folio(struct address_space*, struct folio*, struct folio*, enum migrate_mode)'
  'const char* page_get_link(struct dentry*, struct inode*, struct delayed_call*)'
  'int page_symlink(struct inode*, const char*, int)'
  'bool try_to_free_buffers(struct folio*)'
  'int utf32_to_utf8(unicode_t, u8*, int)'

1 variable symbol(s) added
  'unsigned int dirty_writeback_interval'

Bug: 349994203
Change-Id: Idd44e7c08a223772312d63a0c814616361b15437
Signed-off-by: Anton Altaparmakov <anton@tuxera.com>
2024-06-28 21:08:17 +01:00
John Stultz
6aaa06c15d FROMLIST: locking/rwsem: Add __always_inline annotation to __down_write_common() and inlined callers
Apparently despite it being marked inline, the compiler
may not inline __down_write_common() which makes it difficult
to identify the cause of lock contention, as the wchan of the
blocked function will always be listed as __down_write_common().

So add __always_inline annotation to the common function (as
well as the inlined helper callers) to force it to be inlined
so a more useful blocking function will be listed (via wchan).

This mirrors commit 92cc5d00a4 ("locking/rwsem: Add
__always_inline annotation to __down_read_common() and inlined
callers") which did the same for __down_read_common.

I sort of worry that I'm playing wack-a-mole here, and talking
with compiler people, they tell me inline means nothing, which
makes me want to cry a little. So I'm wondering if we need to
replace all the inlines with __always_inline, or remove them
because either we mean something by it, or not.

Cc: Tim Murray <timmurray@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Will Deacon <will@kernel.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: kernel-team@android.com
Fixes: c995e638cc ("locking/rwsem: Fold __down_{read,write}*()")
Reported-by: Tim Murray <timmurray@google.com>
Acked-by: Waiman Long <longman@redhat.com>
Change-Id: I72b273149577b8125ea3a5053befbd5cf66bf8ad
Signed-off-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/lkml/20240620174204.1802235-1-jstultz@google.com/
Bug: 332722989
---
v2:
* Add ack tags & minor tweaks to commit message
2024-06-28 16:25:32 +00:00
Eric Biggers
7682e638eb ANDROID: fips140: remove unnecessary no_sanitize(cfi)
gcc segfaults when compiling fips140-module.c because it doesn't like
__attribute__((__no_sanitize__("cfi"))) on fips140_init().  But since
Linux's CFI now uses the kcfi sanitizer instead of cfi, this no
attribute longer did anything anyway.  Remove it.

fips140_init() does work with kcfi, though this relies on the initcall
function pointers being typed correctly.  They were correct, but for
futureproofing also make it use initcall_t from <linux/init.h>.

Bug: 349612732
Change-Id: Ic5cfaef177b58abf21f1737579d75b4df4d0d09c
Signed-off-by: Eric Biggers <ebiggers@google.com>
2024-06-27 21:04:34 +00:00
Xiaofeng Yuan
681c91500c ANDROID: GKI: Add symbol to symbol list for vivo.
5 function symbol(s) added
  'int __traceiter_android_vh_do_anonymous_page(void*, struct vm_area_struct*, struct page*)'
  'int __traceiter_android_vh_do_swap_page(void*, struct folio*, pte_t*, struct vm_fault*, swp_entry_t)'
  'int __traceiter_android_vh_do_wp_page(void*, struct folio*)'
  'int __traceiter_android_vh_shmem_swapin_folio(void*, struct folio*)'
  'int __traceiter_android_vh_uprobes_replace_page(void*, struct folio*, struct folio*)'

5 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_do_anonymous_page'
  'struct tracepoint __tracepoint_android_vh_do_swap_page'
  'struct tracepoint __tracepoint_android_vh_do_wp_page'
  'struct tracepoint __tracepoint_android_vh_shmem_swapin_folio'
  'struct tracepoint __tracepoint_android_vh_uprobes_replace_page'

Bug: 336964184

Change-Id: Ie2364fba2569d2514e77eb4fc450c343d8cd4a94
Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@vivo.com>
2024-06-27 19:02:20 +00:00
Xiaofeng Yuan
88b8a0c173 ANDROID: vendor_hooks: add hooks to modify pageflags
These hooks are designed to set or clear OEM reserved pageflags when the
memory state may change.

Bug: 336964184

Change-Id: I9cb288ef6eef7a719d4f4748d6b71010645b7d50
Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@vivo.com>
2024-06-27 19:02:20 +00:00
Xiaofeng Yuan
85a0c4bef6 ANDROID: GKI: Add pageflags for OEM
Add PG_oem_reserved_x pageflags for OEM on 64-bit platform.

These new flags can be used to indicate different states of page.
For example, we can use these pageflags to identify anonymous pages
at different ZRAM compression rates.
These flags will be used in conjunction with different Android
application states. Therefore, I think this is not a generic
modification for all Linux devices and is not suitable for upstream
submission.

Bug: 336964184

Change-Id: Ie68087248866af63ac516d96e3af85222e7a0b50
Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@vivo.com>
2024-06-27 19:02:20 +00:00
zhujingpeng
724b50f143 ANDROID: GKI: Update symbol list for vivo
1 function symbol(s) added
  'int __traceiter_sys_exit(void*, struct pt_regs*, long)'
1 variable symbol(s) added
  'struct tracepoint __tracepoint_sys_exit'

Bug: 349739225

Change-Id: Ie95f7c4b3bd2879dddee188bff5845bcac84484f
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
2024-06-27 17:13:48 +00:00
zhujingpeng
a5329424ea ANDROID: GKI: export sys_exit tracepoint
This patch export a sys_exit tracepoint for
task state-tracking and performance tuning.

Bug: 339912146

Change-Id: I951ac6034e80691f092c0ba41b6af1fdaf8be49c
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
(cherry picked from commit 53c7feb8b4829376b678b7cb8d501f48b2b47286)
2024-06-27 17:13:48 +00:00
Norihiko Hama
616650627d ANDROID: gki_defconfig: enable CONFIG_SYN_COOKIES
Enable CONFIG_SYN_COOKIES to support SYN cookies against attack "SYN flooding".
This also makes GKI on arm64 consistent with GKI on x86.

According to kernel dev-team, this does not affect the KMI.

Bug: 349649090
Bug: 278043288
Change-Id: If43951b0ce3028e65799f9b6e68106ca98ee980e
Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
2024-06-27 13:21:45 +09:00
zhujingpeng
74a3c59c80 ANDROID: GKI: Update symbol list for vivo
update vivo symbol list for adding hooks for rwsem

4 function symbol(s) added
  'int __traceiter_android_vh_clear_rwsem_reader_owned(void*, struct
  rw_semaphore*)'
  'int __traceiter_android_vh_clear_rwsem_writer_owned(void*, struct
  rw_semaphore*)'
  'int __traceiter_android_vh_record_rwsem_reader_owned(void*, struct
  rw_semaphore*, struct list_head*)'
  'int __traceiter_android_vh_record_rwsem_writer_owned(void*, struct
  rw_semaphore*)'

4 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_clear_rwsem_reader_owned'
  'struct tracepoint __tracepoint_android_vh_clear_rwsem_writer_owned'
  'struct tracepoint __tracepoint_android_vh_record_rwsem_reader_owned'
  'struct tracepoint __tracepoint_android_vh_record_rwsem_writer_owned'

Bug: 349494518

Change-Id: I0580e16d4c70d923ec5d8269f5b8fead952979d3
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
2024-06-26 14:25:00 +08:00
zhujingpeng
1df05952a1 ANDROID: vendor_hooks: add hooks in rwsem
these hooks are required by the following features:
1.For rwsem readers, currently only the latest reader will be
recorded in sem->owner. We add hooks to record all readers which
have acquired the lock, once there are UX threads blocked in the
rwsem waiting list, these read_owners will be given high
priority in scheduling.
2.For rwsem writer, when a writer acquires the lock, we check
whether there are UX threads blocked in the rwsem wait list. If
so, we give this writer a high priority in scheduling so that it
can release the lock as soon as possible.

Both of these features can optimize the priority inversion
problem caused by rwsem and improve system responsiveness and
performance.

Bug: 335408185
Change-Id: I82a6fbb6acd2ce05d049e686b61e34e4d3b39a5e
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
[jstultz: Rebased and resolved minor conflict]
Signed-off-by: John Stultz <jstultz@google.com>
(cherry picked from commit 188c41744ddcccef6daf6dcd4d6a444dabdc2f94)
2024-06-26 11:11:34 +08:00
Hsiu-Chang Chen
5747d79ab0 ANDROID: Update the ABI symbol list
wlan vendor propose a feature to check the refcnt of netdev when
interface register/unregister. Add `netdev_refcnt_read` into symbol
list.

Adding the following symbols:
  - netdev_refcnt_read

Bug: 340118509
Change-Id: I6a2ad4bbfa13d01011729b764dfe92f4945a829e
Signed-off-by: Hsiu-Chang Chen <hsiuchangchen@google.com>
(cherry picked from commit 51cc4ca498)
2024-06-25 20:14:03 +00:00
zhujingpeng
a7daeb4de8 ANDROID: GKI: Update symbol list for vivo
update vivo symbol list for adding hooks for percpu_rwsem

3 function symbol(s) added
  'int __traceiter_android_rvh_percpu_rwsem_wait_complete(void*, struct
  percpu_rw_semaphore*, long, bool*)'
  'int __traceiter_android_vh_percpu_rwsem_down_read(void*, struct
  percpu_rw_semaphore*, bool, bool*)'
  'int __traceiter_android_vh_percpu_rwsem_up_write(void*, struct
  percpu_rw_semaphore*)'
3 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_percpu_rwsem_wait_complete'
  'struct tracepoint __tracepoint_android_vh_percpu_rwsem_down_read'
  'struct tracepoint __tracepoint_android_vh_percpu_rwsem_up_write'

Bug: 348699616

Change-Id: I854f8080e527fd144539dda9859d333537c2db89
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
2024-06-25 20:06:17 +00:00
zhujingpeng
2870c78530 ANDROID: GKI: add percpu_rwsem vendor hooks
When a writer has set sem->block and is waiting for active readers
to complete, we still allow some specific new readers to entry
the critical section, which can help prevent priority inversion
from impacting system responsiveness and performance.

Bug: 334851707

Change-Id: I9e2a7df1efb326763487423d64bcf74d8dec23f8
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
(cherry picked from commit 458cdb59f7719f81504d392daa95a8c99c30c276)
2024-06-25 20:06:17 +00:00
Sandeep Dhavale
49203a2850 FROMGIT: erofs: fix possible memory leak in z_erofs_gbuf_exit()
Because we incorrectly reused of variable `i` in `z_erofs_gbuf_exit()`
for inner loop, we may exit early from outer loop resulting in memory
leak. Fix this by using separate variable for iterating through inner loop.

Bug: 348591003
Change-Id: I70b4301a80b5282d1167e09de866c3764fd0f8d4
Fixes: f36f3010f676 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable")
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240624220206.3373197-1-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit e41f107428237224fd51d99a4dc4358aba3b7d5f
 https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test)
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Chunhai Guo
0013c55474 BACKPORT: erofs: add a reserved buffer pool for lz4 decompression
This adds a special global buffer pool (in the end) for reserved pages.

Using a reserved pool for LZ4 decompression significantly reduces the
time spent on extra temporary page allocation for the extreme cases in
low memory scenarios.

The table below shows the reduction in time spent on page allocation for
LZ4 decompression when using a reserved pool. The results were obtained
from multi-app launch benchmarks on ARM64 Android devices running the
5.15 kernel with an 8-core CPU and 8GB of memory. In the benchmark, we
launched 16 frequently-used apps, and the camera app was the last one in
each round. The data in the table is the average time of camera app for
each round.

After using the reserved pool, there was an average improvement of 150ms
in the overall launch time of our camera app, which was obtained from
the systrace log.

+--------------+---------------+--------------+---------+
|              | w/o page pool | w/ page pool |  diff   |
+--------------+---------------+--------------+---------+
| Average (ms) |     3434      |      21      | -99.38% |
+--------------+---------------+--------------+---------+

Based on the benchmark logs, 64 pages are sufficient for 95% of
scenarios. This value can be adjusted with a module parameter
`reserved_pages`. The default value is 0.

This pool is currently only used for the LZ4 decompressor, but it can be
applied to more decompressors if needed.

Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240402131523.2703948-1-guochunhai@vivo.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Bug: 348591003
Change-Id: I5ed7fe7de3f8dbf20c555b25129120ecc0f6fb54
(cherry picked from commit 0f6273ab46375b62c8dd5c987ce7c15877602831)
[Chunhai: Resolved minor conflict in fs/erofs/internal.h ]
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Chunhai Guo
a35a90635c BACKPORT: erofs: do not use pagepool in z_erofs_gbuf_growsize()
Let's use alloc_pages_bulk_array() for simplicity and get rid of
unnecessary pagepool.

Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240402092757.2635257-1-guochunhai@vivo.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Bug: 348591003
Change-Id: Ib286b3331cb032e21bdf4dc12514ec85b6a979c7
(cherry picked from commit d6db47e571dcaecaeaafa8840d00ae849ae3907b)
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Chunhai Guo
2a23d59fd9 BACKPORT: erofs: rename per-CPU buffers to global buffer pool and make it configurable
It will cost more time if compressed buffers are allocated on demand for
low-latency algorithms (like lz4) so EROFS uses per-CPU buffers to keep
compressed data if in-place decompression is unfulfilled.  While it is kind
of wasteful of memory for a device with hundreds of CPUs, and only a small
number of CPUs concurrently decompress most of the time.

This patch renames it as 'global buffer pool' and makes it configurable.
This allows two or more CPUs to share a common buffer to reduce memory
occupation.

Suggested-by: Gao Xiang <xiang@kernel.org>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Link: https://lore.kernel.org/r/20240402100036.2673604-1-guochunhai@vivo.com
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Link: https://lore.kernel.org/r/20240408215231.3376659-1-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Bug: 348591003
Change-Id: I319248d41ce346e840bd292a80b0a0a6bb2a7359
(cherry picked from commit f36f3010f67611a45d66e773bc91e4c66a9abab5)
[Chunhai: Resolved minor conflict in fs/erofs/Makefile,
fs/erofs/internal.h, fs/erofs/super.c, and fs/erofs/zutil.c ]
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Chunhai Guo
bb687ee6b6 BACKPORT: erofs: rename utils.c to zutil.c
Currently, utils.c is only useful if CONFIG_EROFS_FS_ZIP is on.
So let's rename it to zutil.c as well as avoid its inclusion if
CONFIG_EROFS_FS_ZIP is explicitly disabled.

Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240401135550.2550043-1-guochunhai@vivo.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Bug: 348591003
Change-Id: Iace477719fb803084955218a3e5ace74338f5ec8
(cherry picked from commit cacd5b04e24c74a813c694ec7b26a1a370b5d666)
[Chunhai: Resolved minor conflict in fs/erofs/Makefile and
fs/erofs/utils.c ]
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Chunhai Guo
bab4765e5f BACKPORT: erofs: relaxed temporary buffers allocation on readahead
Even with inplace decompression, sometimes very few temporary buffers
may be still needed for a single decompression shot (e.g. 16 pages for
64k sliding window or 4 pages for 16k sliding window).  In low-memory
scenarios, it would be better to try to allocate with GFP_NOWAIT on
readahead first.  That can help reduce the time spent on page allocation
under durative memory pressure.

Here are detailed performance numbers under multi-app launch benchmark
workload [1] on ARM64 Android devices (8-core CPU and 8GB of memory)
running a 5.15 LTS kernel with EROFS of 4k pclusters:

+----------------------------------------------+
|      LZ4       | vanilla | patched |  diff   |
|----------------+---------+---------+---------|
|  Average (ms)  |  3364   |  2684   | -20.21% | [64k sliding window]
|----------------+---------+---------+---------|
|  Average (ms)  |  2079   |  1610   | -22.56% | [16k sliding window]
+----------------------------------------------+

The total size of system images for 4k pclusters is almost unchanged:
(64k sliding window)  9,117,044 KB
(16k sliding window)  9,113,096 KB

Therefore, in addition to switch the sliding window from 64k to 16k,
after applying this patch, it can eventually save 52.14% (3364 -> 1610)
on average with no memory reservation.  That is particularly useful for
embedded devices with limited resources.

[1] https://lore.kernel.org/r/20240109074143.4138783-1-guochunhai@vivo.com

Suggested-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Link: https://lore.kernel.org/r/20240126140142.201718-1-hsiangkao@linux.alibaba.com

Bug: 348591003
Change-Id: I84cf5b5dbccbd707b6f4339e525ca52efbcf167f
(cherry picked from commit d9281660ff3ffb4a05302b485cc59a87e709aefc)
[Chunhai: Resolved minor conflict in fs/erofs/zdata.c and remove
modification on fs/erofs/decompressor_deflate.c as it is not existed in
6.1 kernel ]
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Yue Hu
a3fb83b3f5 BACKPORT: erofs: avoid pcpubuf.c inclusion if CONFIG_EROFS_FS_ZIP is off
The function of pcpubuf.c is just for low-latency decompression
algorithms (e.g. lz4).

Bug: 348591003
Change-Id: I15651e5b7d66b6072ffb3f9985f7a828e0cad37e
Signed-off-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20230515095758.10391-1-zbestahu@gmail.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit 285d0f85da)
[Chunhai: Resolved minor conflict in fs/erofs/internal.h]
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
2024-06-25 18:40:14 +00:00
Bian Jin chen
91f4830fba ANDROID: GKI: Update rockchip symbols for bcmdhd sdio wifi.
4 function symbol(s) added
  'void sdio_retune_crc_disable(struct sdio_func*)'
  'void sdio_retune_crc_enable(struct sdio_func*)'
  'void sdio_retune_hold_now(struct sdio_func*)'
  'void sdio_retune_release(struct sdio_func*)'

Bug: 300024866
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: Ic0b236833490779901b027b3d0225c4fb79459ba
2024-06-25 15:03:40 +08:00
Kalesh Singh
a8b3ebe7f9 ANDROID: 16K: Avoid mmap lock assertions for padding VMAs
The padding VMA is never inserted into the VMA tree; therefore we
don't need to have the mmap lock in exclusive mode to modify it.

Test: v2/android-gki/ack_platform_integration_main_cf_arm64_boot_test
      on kernel_virt_debug_aarch64
Bug: 346741763
Change-Id: I4ca3ed22dab45b6bb895cb41c5c6792344188b61
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-06-24 18:12:53 +00:00
Peter Wang
caa8ffe476 BACKPORT: scsi: ufs: core: Fix handling of lrbp->cmd
ufshcd_queuecommand() may be called two times in a row for a SCSI command
before it is completed. Hence make the following changes:

 - In the functions that submit a command, do not check the old value of
   lrbp->cmd nor clear lrbp->cmd in error paths.

 - In ufshcd_release_scsi_cmd(), do not clear lrbp->cmd.

See also scsi_send_eh_cmnd().

This commit prevents that the following appears if a command times out:

WARNING: at drivers/ufs/core/ufshcd.c:2965 ufshcd_queuecommand+0x6f8/0x9a8
Call trace:
 ufshcd_queuecommand+0x6f8/0x9a8
 scsi_send_eh_cmnd+0x2c0/0x960
 scsi_eh_test_devices+0x100/0x314
 scsi_eh_ready_devs+0xd90/0x114c
 scsi_error_handler+0x2b4/0xb70
 kthread+0x16c/0x1e0

Fixes: 5a0b0cb9be ("[SCSI] ufs: Add support for sending NOP OUT UPIU")
Change-Id: Iebc077bc8ae8d8004519ebfc93a1c76a4807b6f2
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230524203659.1394307-3-bvanassche@acm.org
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 549e91a9bb)
[Peter: Resolved minor conflict in drivers/ufs/core/ufshcd.c ]
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
2024-06-24 17:28:25 +00:00
wang qiankun
d682bd3b2f ANDROID: GKI: Update symbol list for xiaomi
1 function symbol(s) added
  'int __traceiter_android_vh_rwsem_read_trylock_failed(void*, struct rw_semaphore*, long*, int*)'
1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_rwsem_read_trylock_failed'

Bug: 348699619

Change-Id: If1c0ff19a6fac2885912d8b406d1a0ceb4406f41
Signed-off-by: wang qiankun <wangqiankun3@xiaomi.corp-partner.google.com>
2024-06-22 21:23:15 +08:00
zhujingpeng
e270773646 ANDROID: vendor_hooks: add hooks in rwsem read trylock
When the lock is owned by readers and there is no RWSEM_FLAG_HANDOFF set,
we allow some specific new readers to acquire the lock immediately
in this hook, event if there are some writer tasks in the wait_list.
This features can optimize the priority inversion problem caused by
rwsem and improve system responsiveness and
performance.

Bug: 348699619
Bug: 336506800

Change-Id: I7e8fded73579933d1f61faa9fb6e5f300ffd71bf
Signed-off-by: zhujingpeng <zhujingpeng@vivo.com>
[jstultz: rebased, resolved collision]
Signed-off-by: John Stultz <jstultz@google.com>
2024-06-22 18:46:05 +08:00
sunshijie
1a72e2f692 ANDROID: GKI: update symbol list file for xiaomi
1 function symbol(s) added
  'struct folio* __filemap_get_folio(struct address_space*, unsigned long, int, gfp_t)'

Bug: 348207246

Change-Id: Ic2e06000526b4274496c3a4c931f18397c7cc682
Signed-off-by: sunshijie <sunshijie@xiaomi.corp-partner.google.com>
2024-06-20 15:51:58 +00:00
liliangliang
cd89d4fa07 ANDROID: GKI: Update symbol list for vivo
update vivo symbol list for adding hooks for fuse request

2 function symbol(s) added
  'int __traceiter_android_vh_fuse_request_end(void*, struct task_struct*)'
  'int __traceiter_android_vh_queue_request_and_unlock(void*, struct wait_queue_head*, bool)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_fuse_request_end'
  'struct tracepoint __tracepoint_android_vh_queue_request_and_unlock'

Bug: 348109269
Change-Id: I8d2b08b7afbca85f4b766bbe658005aa740b6285
Signed-off-by: liliangliang <liliangliang@vivo.com>
2024-06-19 19:02:44 +00:00
liliangliang
40f3c9d658 ANDROID: vendor_hooks: add vendor hooks for fuse request
Add hooks to fuse queue request and request end so we can do boost
to those background tasks which block the UX related task.

Bug: 333220630
Change-Id: I9be59ed88675c5102c57ba9cbd26cf4df3d2fd7f
Signed-off-by: liliangliang <liliangliang@vivo.com>
(cherry picked from commit e520c2932df0d1bbf83ae45c82ac01fd41655d77)
2024-06-19 19:02:44 +00:00
nischaljain
f9840ee562 ANDROID: Update the ABI symbol list
Adding the following symbols:
 - dev_pm_opp_remove_all_dynamic
 - devm_devfreq_add_device
 - devm_devfreq_remove_device

Bug: 347848156
Change-Id: I917b23e4a3d84e7779e4443aa7ee450d44cf4585
Signed-off-by: nischaljain <nischaljain@google.com>
2024-06-19 06:31:29 +00:00
luoyongjie
12709c5c1e ANDROID: GKI: add symbol list for meizu
INFO: 4 function symbol(s) added
  'int clk_set_duty_cycle(struct clk*, unsigned int, unsigned int)'
  'void console_verbose()'
  'int gpiod_get_direction(struct gpio_desc*)'
  'int register_sysrq_key(int, const struct sysrq_key_op*)'

Bug: 347789958

Change-Id: I4d05058f0be53b26fece99bbb843a9aa1a438294
Signed-off-by: luoyongjie <luoyongjie1@meizu.com>
2024-06-18 09:00:52 +00:00
Ian Rogers
bda57805ab UPSTREAM: objtool: Fix HOSTCC flag usage
HOSTCC is always wanted when building objtool. Setting CC to HOSTCC
happens after tools/scripts/Makefile.include is included, meaning
flags (like CFLAGS) are set assuming say CC is gcc, but then it can be
later set to HOSTCC which may be clang. tools/scripts/Makefile.include
is needed for host set up and common macros in objtool's
Makefile. Rather than override the CC variable to HOSTCC, just pass CC
as HOSTCC to the sub-makes of Makefile.build, the libsubcmd builds and
also to the linkage step.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230126190606.40739-4-irogers@google.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Bug: 336872347
Bug: 335829879
Test: build x86_64 kernel with glibc 2.38
Change-Id: I1d672d0bb64f72d3fc571537de5f75d4068e79cc
(cherry picked from commit cd955bdd6a)
Signed-off-by: Yifan Hong <elsk@google.com>
2024-06-17 18:15:32 +00:00
Ian Rogers
b5164fdc98 UPSTREAM: objtool: Properly support make V=1
The Q variable was being used but never correctly set up. Add the
setting up and use in place of @.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230126190606.40739-3-irogers@google.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Bug: 336872347
Bug: 335829879
Test: build x86_64 kernel with glibc 2.38
Change-Id: I2ac9a1d0c3a56c6109375e92b3d46e08fd5a71cd
(cherry picked from commit 8c4526ca6a)
Signed-off-by: Yifan Hong <elsk@google.com>
2024-06-17 18:15:32 +00:00
Ian Rogers
fd5c2e1399 UPSTREAM: objtool: Install libsubcmd in build
Including from tools/lib can create inadvertent dependencies. Install
libsubcmd in the objtool build and then include the headers from
there.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230126190606.40739-2-irogers@google.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>

Bug: 336872347
Bug: 335829879
Test: build x86_64 kernel with glibc 2.38
Change-Id: Id09c5b222519073214dbc01e151e59b18afb1ea8
(cherry picked from commit bdb8bf7d56)
Signed-off-by: Yifan Hong <elsk@google.com>
2024-06-17 18:15:32 +00:00
Kuniyuki Iwashima
de6fb073c6 UPSTREAM: af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock.
[ Upstream commit 9841991a446c87f90f66f4b9fee6fe934c1336a2 ]

Billy Jheng Bing-Jhong reported a race between __unix_gc() and
queue_oob().

__unix_gc() tries to garbage-collect close()d inflight sockets,
and then if the socket has MSG_OOB in unix_sk(sk)->oob_skb, GC
will drop the reference and set NULL to it locklessly.

However, the peer socket still can send MSG_OOB message and
queue_oob() can update unix_sk(sk)->oob_skb concurrently, leading
NULL pointer dereference. [0]

To fix the issue, let's update unix_sk(sk)->oob_skb under the
sk_receive_queue's lock and take it everywhere we touch oob_skb.

Note that we defer kfree_skb() in manage_oob() to silence lockdep
false-positive (See [1]).

[0]:
BUG: kernel NULL pointer dereference, address: 0000000000000008
 PF: supervisor write access in kernel mode
 PF: error_code(0x0002) - not-present page
PGD 8000000009f5e067 P4D 8000000009f5e067 PUD 9f5d067 PMD 0
Oops: 0002 [#1] PREEMPT SMP PTI
CPU: 3 PID: 50 Comm: kworker/3:1 Not tainted 6.9.0-rc5-00191-gd091e579b864 #110
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Workqueue: events delayed_fput
RIP: 0010:skb_dequeue (./include/linux/skbuff.h:2386 ./include/linux/skbuff.h:2402 net/core/skbuff.c:3847)
Code: 39 e3 74 3e 8b 43 10 48 89 ef 83 e8 01 89 43 10 49 8b 44 24 08 49 c7 44 24 08 00 00 00 00 49 8b 14 24 49 c7 04 24 00 00 00 00 <48> 89 42 08 48 89 10 e8 e7 c5 42 00 4c 89 e0 5b 5d 41 5c c3 cc cc
RSP: 0018:ffffc900001bfd48 EFLAGS: 00000002
RAX: 0000000000000000 RBX: ffff8880088f5ae8 RCX: 00000000361289f9
RDX: 0000000000000000 RSI: 0000000000000206 RDI: ffff8880088f5b00
RBP: ffff8880088f5b00 R08: 0000000000080000 R09: 0000000000000001
R10: 0000000000000003 R11: 0000000000000001 R12: ffff8880056b6a00
R13: ffff8880088f5280 R14: 0000000000000001 R15: ffff8880088f5a80
FS:  0000000000000000(0000) GS:ffff88807dd80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000008 CR3: 0000000006314000 CR4: 00000000007506f0
PKRU: 55555554
Call Trace:
 <TASK>
 unix_release_sock (net/unix/af_unix.c:654)
 unix_release (net/unix/af_unix.c:1050)
 __sock_release (net/socket.c:660)
 sock_close (net/socket.c:1423)
 __fput (fs/file_table.c:423)
 delayed_fput (fs/file_table.c:444 (discriminator 3))
 process_one_work (kernel/workqueue.c:3259)
 worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
 kthread (kernel/kthread.c:388)
 ret_from_fork (arch/x86/kernel/process.c:153)
 ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
 </TASK>
Modules linked in:
CR2: 0000000000000008

Bug: 342490466
Link: https://lore.kernel.org/netdev/a00d3993-c461-43f2-be6d-07259c98509a@rbox.co/ [1]
Fixes: 1279f9d9dec2 ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")
Reported-by: Billy Jheng Bing-Jhong <billy@starlabs.sg>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240516134835.8332-1-kuniyu@amazon.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 518a994aa0b87d96f1bc6678a7035df5d1fcd7a1)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ibf78b113496b5388a63207e7e582f77ddda8dec5
2024-06-17 09:58:14 +00:00
Kuniyuki Iwashima
0e9ee9221f UPSTREAM: af_unix: Don't peek OOB data without MSG_OOB.
[ Upstream commit 22dd70eb2c3d754862964377a75abafd3167346b ]

Currently, we can read OOB data without MSG_OOB by using MSG_PEEK
when OOB data is sitting on the front row, which is apparently
wrong.

  >>> from socket import *
  >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
  >>> c1.send(b'a', MSG_OOB)
  1
  >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
  b'a'

If manage_oob() is called when no data has been copied, we only
check if the socket enables SO_OOBINLINE or MSG_PEEK is not used.
Otherwise, the skb is returned as is.

However, here we should return NULL if MSG_PEEK is set and no data
has been copied.

Also, in such a case, we should not jump to the redo label because
we will be caught in the loop and hog the CPU until normal data
comes in.

Then, we need to handle skb == NULL case with the if-clause below
the manage_oob() block.

With this patch:

  >>> from socket import *
  >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
  >>> c1.send(b'a', MSG_OOB)
  1
  >>> c2.recv(1, MSG_PEEK | MSG_DONTWAIT)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  BlockingIOError: [Errno 11] Resource temporarily unavailable

Bug: 342490466
Fixes: 314001f0bf ("af_unix: Add OOB support")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20240410171016.7621-3-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 022d81a709)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I4728977f8f908c19dfa5c861c7381a50499b7fe0
2024-06-17 09:58:10 +00:00
Kuniyuki Iwashima
30d168eb06 UPSTREAM: af_unix: Clear stale u->oob_skb.
[ Upstream commit b46f4eaa4f0ec38909fb0072eea3aeddb32f954e ]

syzkaller started to report deadlock of unix_gc_lock after commit
4090fa373f0e ("af_unix: Replace garbage collection algorithm."), but
it just uncovers the bug that has been there since commit 314001f0bf
("af_unix: Add OOB support").

The repro basically does the following.

  from socket import *
  from array import array

  c1, c2 = socketpair(AF_UNIX, SOCK_STREAM)
  c1.sendmsg([b'a'], [(SOL_SOCKET, SCM_RIGHTS, array("i", [c2.fileno()]))], MSG_OOB)
  c2.recv(1)  # blocked as no normal data in recv queue

  c2.close()  # done async and unblock recv()
  c1.close()  # done async and trigger GC

A socket sends its file descriptor to itself as OOB data and tries to
receive normal data, but finally recv() fails due to async close().

The problem here is wrong handling of OOB skb in manage_oob().  When
recvmsg() is called without MSG_OOB, manage_oob() is called to check
if the peeked skb is OOB skb.  In such a case, manage_oob() pops it
out of the receive queue but does not clear unix_sock(sk)->oob_skb.
This is wrong in terms of uAPI.

Let's say we send "hello" with MSG_OOB, and "world" without MSG_OOB.
The 'o' is handled as OOB data.  When recv() is called twice without
MSG_OOB, the OOB data should be lost.

  >>> from socket import *
  >>> c1, c2 = socketpair(AF_UNIX, SOCK_STREAM, 0)
  >>> c1.send(b'hello', MSG_OOB)  # 'o' is OOB data
  5
  >>> c1.send(b'world')
  5
  >>> c2.recv(5)  # OOB data is not received
  b'hell'
  >>> c2.recv(5)  # OOB date is skipped
  b'world'
  >>> c2.recv(5, MSG_OOB)  # This should return an error
  b'o'

In the same situation, TCP actually returns -EINVAL for the last
recv().

Also, if we do not clear unix_sk(sk)->oob_skb, unix_poll() always set
EPOLLPRI even though the data has passed through by previous recv().

To avoid these issues, we must clear unix_sk(sk)->oob_skb when dequeuing
it from recv queue.

The reason why the old GC did not trigger the deadlock is because the
old GC relied on the receive queue to detect the loop.

When it is triggered, the socket with OOB data is marked as GC candidate
because file refcount == inflight count (1).  However, after traversing
all inflight sockets, the socket still has a positive inflight count (1),
thus the socket is excluded from candidates.  Then, the old GC lose the
chance to garbage-collect the socket.

With the old GC, the repro continues to create true garbage that will
never be freed nor detected by kmemleak as it's linked to the global
inflight list.  That's why we couldn't even notice the issue.

Bug: 342490466
Fixes: 314001f0bf ("af_unix: Add OOB support")
Reported-by: syzbot+7f7f201cc2668a8fd169@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=7f7f201cc2668a8fd169
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20240405221057.2406-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 601a89ea24)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ib4a11eed6b5710d9934d4f31cd29dfd4c7b3658f
2024-06-17 09:58:07 +00:00
Jaegeuk Kim
c0618d182a Revert "f2fs: fix to tag gcing flag on page during block migration"
This reverts commit 7c972c8945.

[  146.693904][ T8878] WARNING: CPU: 2 PID: 8878 at fs/f2fs/segment.c:3335 f2fs_allocate_data_block+0x130/0xd08

panic in:

f2fs_write_data_pages
 -> f2fs_write_multi_pages
  -> f2fs_write_single_data_page
   -> f2fs_do_write_data_page
    -> f2fs_outplace_write_data
     -> do_write_page
      -> f2fs_allocate_data_block

 if (from_gc) {
         f2fs_bug_on(sbi, GET_SEGNO(sbi, old_blkaddr) == NULL_SEGNO);
         se = get_seg_entry(sbi, GET_SEGNO(sbi, old_blkaddr));
         sanity_check_seg_type(sbi, se->type);
         f2fs_bug_on(sbi, IS_NODESEG(se->type));
 }

Bug: 345273844
Change-Id: I62732bbcb37a7864588886b862b590a463b4d1d9
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2024-06-16 07:24:12 -07:00
Yifan Hong
25216be1ac ANDROID: Delete obsolete 16k_gki.fragment.
The correct fragment is the one in build/kernel,
enabled by --page_size or kernel_build.page_size.
This fragment:

- Does not correctly enable incremental FS
- Does not correctly clear LOCALVERSION that
  has 4k for the 4k build.

Bug: 347036722
Bug: 340631213
Bug: 338659380
Change-Id: I31cb004ca639d8ec3dd6201112391c7214971eba
Signed-off-by: Yifan Hong <elsk@google.com>
2024-06-13 17:56:12 -07:00
Jaegeuk Kim
4c45e2f340 UPSTREAM: f2fs: clear writeback when compression failed
Let's stop issuing compressed writes and clear their writeback flags.

Bug: 345273844
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Change-Id: I69835bbcf0ac993cc03b11bcd7bdcfa2ff2bbd4a
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 2174035a7f1148a52f5a3f371f04224168b5b00a)
2024-06-13 19:21:22 +00:00
Ajit Singh Raghav
7c734edeaa ANDROID: GKI: Add symbol list for exynosauto
dev_forward_skb
  dev_mc_sync
  dev_pre_changeaddr_notify
  dev_set_allmulti
  dev_uc_sync
  ip6_route_input_lookup
  ip_route_input_noref
  netdev_is_rx_handler_busy
  register_inet6addr_validator_notifier
  register_inetaddr_validator_notifier
  unregister_inet6addr_validator_notifier
  unregister_inetaddr_validator_notifier

These symbols are required so that our vendor can use IPVLAN and IP_NF_TARGET_TTL modules. These are not custom modules and are already part of android.

9 function symbol(s) added
  'int dev_forward_skb(struct net_device*, struct sk_buff*)'
  'int dev_pre_changeaddr_notify(struct net_device*, const char*, struct netlink_ext_ack*)'
  'struct dst_entry* ip6_route_input_lookup(struct net*, struct net_device*, struct flowi6*, const struct sk_buff*, int)'
  'int ip_route_input_noref(struct sk_buff*, __be32, __be32, u8, struct net_device*)'
  'bool netdev_is_rx_handler_busy(struct net_device*)'
  'int register_inet6addr_validator_notifier(struct notifier_block*)'
  'int register_inetaddr_validator_notifier(struct notifier_block*)'
  'int unregister_inet6addr_validator_notifier(struct notifier_block*)'
  'int unregister_inetaddr_validator_notifier(struct notifier_block*)'

Bug: 345881188

Change-Id: I2d129c0174844e692b1eb4dbbe54f4790fdeda40
Signed-off-by: Ajit Singh Raghav <ajit.raghav@samsung.com>
2024-06-13 08:53:38 +00:00
Peter Collingbourne
b22d7c4ca0 FROMGIT: arm64: mte: Make mte_check_tfsr_*() conditional on KASAN instead of MTE
The check in mte_check_tfsr_el1() is only necessary if HW tag
based KASAN is enabled. However, we were also executing the check
if MTE is enabled and KASAN is enabled at build time but disabled
at runtime. This turned out to cause a measurable increase in
power consumption on a specific microarchitecture after enabling
MTE. Moreover, on the same system, an increase in invalid syscall
latency (as measured by [1]) of around 20-30% (depending on the
cluster) was observed after enabling MTE; this almost entirely goes
away after removing this check. Therefore, make the check conditional
on whether KASAN is enabled rather than on whether MTE is enabled.

[1] https://lore.kernel.org/all/CAMn1gO4MwRV8bmFJ_SeY5tsYNPn2ZP56LjAhafygjFaKuu5ouw@mail.gmail.com/

Bug: 331979504
(cherry picked from commit 26ca4423604f15930d96088dc5238f29dc11d5bc
 https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mte)
Signed-off-by: Peter Collingbourne <pcc@google.com>
Change-Id: I22d98d1483dd400a95595946552b769a5a1ad7bd
Link: https://linux-review.googlesource.com/id/I22d98d1483dd400a95595946552b769a5a1ad7bd
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20240528225131.3577704-1-pcc@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2024-06-12 11:25:46 -07:00
Danesh Petigara
1331956fb5 ANDROID: gki_defconfig: Disable CONFIG_BRCMSTB_DPFE and CONFIG_BRCMSTB_MEMC
Recent changes to gki_defconfig enable CONFIG_MEMORY which results
in CONFIG_BRCMSTB_DPFE and CONFIG_BRCMSTB_MEMC being enabled as
builtin modules. Disable the two drivers as the Broadcom STB SoCs
expect them to be configured as loadable modules.

Bug: 346510475
Fixes: 974a6f430e ("ANDROID: gki_defconfig: Enable Tegra SoCs")
Change-Id: I80bf0ce419992d947468b7054327ba80f611d316
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
2024-06-12 13:15:55 +00:00
Zhiguo Niu
002be199aa FROMGIT: f2fs: fix to avoid use SSR allocate when do defragment
SSR allocate mode will be used when doing file defragment
if ATGC is working at the same time, that is because
set_page_private_gcing may make CURSEG_ALL_DATA_ATGC segment
type got in f2fs_allocate_data_block when defragment page
is writeback, which may cause file fragmentation is worse.

A file with 2 fragmentations is changed as following after defragment:

----------------file info-------------------
sensorsdata :
--------------------------------------------
dev       [254:48]
ino       [0x    3029 : 12329]
mode      [0x    81b0 : 33200]
nlink     [0x       1 : 1]
uid       [0x    27e6 : 10214]
gid       [0x    27e6 : 10214]
size      [0x  242000 : 2367488]
blksize   [0x    1000 : 4096]
blocks    [0x    1210 : 4624]
--------------------------------------------

file_pos   start_blk     end_blk        blks
       0    11361121    11361207          87
  356352    11361215    11361216           2
  364544    11361218    11361218           1
  368640    11361220    11361221           2
  376832    11361224    11361225           2
  385024    11361227    11361238          12
  434176    11361240    11361252          13
  487424    11361254    11361254           1
  491520    11361271    11361279           9
  528384     3681794     3681795           2
  536576     3681797     3681797           1
  540672     3681799     3681799           1
  544768     3681803     3681803           1
  548864     3681805     3681805           1
  552960     3681807     3681807           1
  557056     3681809     3681809           1

Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Bug: 345273844
(cherry picked from commit 9e2fc0b6f2cd47f4bbed67c2828d67149b96039f
 https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test)
Change-Id: I1c68e1d2c289482db31c7e882e4300423d4c97f3
Signed-off-by: Daeho Jeong <daehojeong@google.com>
2024-06-12 10:15:44 +00:00
Kalesh Singh
dda68b1657 ANDROID: 16K: Only check basename of linker context
Depending on the platform binary being executed, the linker
(interpreter) requested can be one of:

    1) /system/bin/bootstrap/linker64
    2) /system/bin/linker64
    3) /apex/com.android.runtime/bin/linker64

Relax the check to the basename (linker64), instead of the path.

Bug: 330767927
Bug: 335584973
Change-Id: I4a1f95b7cecd126f85ad8cefd9ff10d272947f9e
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-06-11 15:51:46 -07:00
Kalesh Singh
65aed0e2f7 ANDROID: 16K: Avoid and document padding madvise lock warning
Usually to modify vm_flags we need to take exclusive mmap_lock but here
only have the lock in read mode, to avoid all DONTNEED/DONTNEED_LOCKED
calls needing the write lock.

A race to the flags update can only happen with another MADV_DONTNEED on
the same process and same range (VMA).

In practice, this specific scenario is not possible  because the action
that could cause it is usually performed at most once per VMA and only by the dynamic linker.

Forego protection for this case, to avoid penalties in the common cases.

Bug: 344634072
Change-Id: I54ac1f204e0445291f3df3872fbaa16b37722812
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-06-11 16:26:56 +00:00
Giuliano Procida
ec795e4eaa ANDROID: arm64: vdso32: support user-supplied flags
This introduces a new environment variable, KCPPFLAGS_COMPAT.

One use-case is to ensure -ffile-prefix-map is passed to the arm32
compiler to normalise compilation directory and make the ELF build ID
reproducible.

Bug: 345452375
Change-Id: I6ae1df58172f4dadeac1dbbee2e3241b704a9256
Signed-off-by: Giuliano Procida <gprocida@google.com>
2024-06-10 16:22:50 +00:00