Commit Graph

1159654 Commits

Author SHA1 Message Date
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
Pierre Couillaud
ac9706483e ANDROID: GKI: Add initial symbol list for bcmstb
Add initial symbol list for the bcmstb target that represents
the Broadcom Set Top Box SoCs.

INFO: 32 function symbol(s) added
  'u32 brcmstb_get_family_id()'
  'u32 brcmstb_get_product_id()'
  'int clk_hw_register_clkdev(struct clk_hw*, const char*, const char*)'
  'int device_get_ethdev_address(struct device*, struct net_device*)'
  'int ehci_resume(struct usb_hcd*, bool)'
  'int ehci_suspend(struct usb_hcd*, bool)'
  'int fixed_phy_set_link_update(struct phy_device*, int(*)(struct net_device*, struct fixed_phy_status*))'
  'int generic_access_phys(struct vm_area_struct*, unsigned long, void*, int, int)'
  'struct gpio_desc* gpiochip_request_own_desc(struct gpio_chip*, unsigned int, const char*, enum gpio_lookup_flags, enum gpiod_flags)'
  'void irq_gc_mask_disable_reg(struct irq_data*)'
  'void irq_gc_noop(struct irq_data*)'
  'void irq_gc_unmask_enable_reg(struct irq_data*)'
  'void netdev_crit(const struct net_device*, const char*, ...)'
  'bool of_device_is_big_endian(const struct device_node*)'
  'struct net_device* of_find_net_device_by_node(struct device_node*)'
  'int of_get_ethdev_address(struct device_node*, struct net_device*)'
  'const char* pci_speed_string(enum pci_bus_speed)'
  'struct phy_device* phy_attach(struct net_device*, const char*, phy_interface_t)'
  'int phy_resume(struct phy_device*)'
  'void phy_start_machine(struct phy_device*)'
  'bool phy_validate_pause(struct phy_device*, struct ethtool_pauseparam*)'
  'pgprot_t phys_mem_access_prot(struct file*, unsigned long, unsigned long, pgprot_t)'
  'const char* pinctrl_dev_get_devname(struct pinctrl_dev*)'
  'void recalc_sigpending()'
  'int restore_online_page_callback(online_page_callback_t)'
  'u16 sdhci_calc_clk(struct sdhci_host*, unsigned int, unsigned int*)'
  'int sdhci_pltfm_resume(struct device*)'
  'int sdhci_pltfm_suspend(struct device*)'
  'int serial8250_handle_irq(struct uart_port*, unsigned int)'
  'int set_online_page_callback(online_page_callback_t)'
  'int spi_split_transfers_maxsize(struct spi_controller*, struct spi_message*, size_t, gfp_t)'
  'void vm_unmap_aliases()'

4 variable symbol(s) added
  'unsigned long empty_zero_page[512]'
  'const unsigned char pcie_link_speed[16]'
  'unsigned long phy_basic_features[2]'
  'unsigned long phy_gbit_features[2]'

Bug: 343006993
Change-Id: Ia094cd3f5444ea60b273415990bceb7a523cfee8
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 17:19:37 +00:00
Danesh Petigara
b164ce27fa ANDROID: gki_defconfig: Enable Broadcom STB SoCs
Enable configs required for Broadcom Set Top Box SoCs.

Also explicitly disable the Broadcom Set Top Box SoC
drivers that we wish to build as loadable modules.

Bug: 343006993
Change-Id: Ia3e542d0eeb519539aba2990fb4eb4eb2970a867
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 09:06:09 -07:00
Jorge Ramirez-Ortiz
d385f8f23f UPSTREAM: mmc: core: Do not force a retune before RPMB switch
Requesting a retune before switching to the RPMB partition has been
observed to cause CRC errors on the RPMB reads (-EILSEQ).

Since RPMB reads can not be retried, the clients would be directly
affected by the errors.

This commit disables the retune request prior to switching to the RPMB
partition: mmc_retune_pause() no longer triggers a retune before the
pause period begins.

This was verified with the sdhci-of-arasan driver (ZynqMP) configured
for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both
cases, the error was easy to reproduce triggering every few tenths of
reads.

With this commit, systems that were utilizing OP-TEE to access RPMB
variables will experience an enhanced performance. Specifically, when
OP-TEE is configured to employ RPMB as a secure storage solution, it not
only writes the data but also the secure filesystem within the
partition. As a result, retrieving any variable involves multiple RPMB
reads, typically around five.

For context, on ZynqMP, each retune request consumed approximately
8ms. Consequently, reading any RPMB variable used to take at the very
minimum 40ms.

After droping the need to retune before switching to the RPMB partition,
this is no longer the case.

Change-Id: I2320a38436b05b435ac528c6656b621a1e2eaeb7
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Acked-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240103112911.2954632-1-jorge@foundries.io
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 67380251e8bbd3302c64fea07f95c31971b91c22)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 09:06:09 -07:00
Ilkka Koskinen
5c4b00b73e UPSTREAM: arm64/arm: arm_pmuv3: perf: Don't truncate 64-bit registers
The driver used to truncate several 64-bit registers such as PMCEID[n]
registers used to describe whether architectural and microarchitectural
events in range 0x4000-0x401f exist. Due to discarding the bits, the
driver made the events invisible, even if they existed.

Moreover, PMCCFILTR and PMCR registers have additional bits in the upper
32 bits. This patch makes them available although they aren't currently
used. Finally, functions handling PMXEVCNTR and PMXEVTYPER registers are
removed as they not being used at all.

Fixes: df29ddf4f0 ("arm64: perf: Abstract system register accesses away")
Reported-by: Carl Worth <carl@os.amperecomputing.com>
Change-Id: Ic2ec717caa2fdda2456c560a82490e374565eb2d
Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Acked-by: Will Deacon <will@kernel.org>
Closes: https://lore.kernel.org/..
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20231102183012.1251410-1-ilkka@os.amperecomputing.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 403edfa436286b21f5ffe6856ae5b36396e8966c)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 09:06:09 -07:00
Florian Fainelli
ad62d386c8 BACKPORT: net: phy: Allow drivers to always call into ->suspend()
A few PHY drivers are currently attempting to not suspend the PHY when
Wake-on-LAN is enabled, however that code is not currently executing at
all due to an early check in phy_suspend().

This prevents PHY drivers from making an appropriate decisions and put
the hardware into a low power state if desired.

In order to allow the PHY drivers to opt into getting their ->suspend
routine to be called, add a PHY_ALWAYS_CALL_SUSPEND bit which can be
set. A boolean that tracks whether the PHY or the attached MAC has
Wake-on-LAN enabled is also provided for convenience.

If phydev::wol_enabled then the PHY shall not prevent its own
Wake-on-LAN detection logic from working and shall not prevent the
Ethernet MAC from receiving packets for matching.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Change-Id: I9077fe16d2515b60a2cb58753e6914be95a6923a
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a7e3448086)
[danesh: Moved phydev->wol_enabled to avoid KMI-break]
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 09:05:51 -07:00
Geert Uytterhoeven
7c09ddbf94 UPSTREAM: ARM: perf: Mark all accessor functions inline
When just including <asm/arm_pmuv3.h>:

    arch/arm/include/asm/arm_pmuv3.h:110:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function]
      110 | static void write_pmevtypern(int n, unsigned long val)
	  |             ^~~~~~~~~~~~~~~~
    arch/arm/include/asm/arm_pmuv3.h:103:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function]
      103 | static void write_pmevcntrn(int n, unsigned long val)
	  |             ^~~~~~~~~~~~~~~
    arch/arm/include/asm/arm_pmuv3.h:95:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function]
       95 | static unsigned long read_pmevcntrn(int n)
	  |                      ^~~~~~~~~~~~~~

Fix this by adding the missing "inline" keywords to the three accessor
functions that lack them.

Fixes: 009d6dc87a ("ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM")
Change-Id: I0877fa9d337a59857c8480a219515e2c641cfc55
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/3a7d9bc7470aa2d85696ee9765c74f8c03fb5454.1683561482.git.geert+renesas@glider.be
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 68e3f61eb9)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Geert Uytterhoeven
f5e0452e91 UPSTREAM: arm64: perf: Mark all accessor functions inline
When just including <asm/arm_pmuv3.h>:

    arch/arm64/include/asm/arm_pmuv3.h:31:13: error: ‘write_pmevtypern’ defined but not used [-Werror=unused-function]
       31 | static void write_pmevtypern(int n, unsigned long val)
	  |             ^~~~~~~~~~~~~~~~
    arch/arm64/include/asm/arm_pmuv3.h:24:13: error: ‘write_pmevcntrn’ defined but not used [-Werror=unused-function]
       24 | static void write_pmevcntrn(int n, unsigned long val)
	  |             ^~~~~~~~~~~~~~~
    arch/arm64/include/asm/arm_pmuv3.h:16:22: error: ‘read_pmevcntrn’ defined but not used [-Werror=unused-function]
       16 | static unsigned long read_pmevcntrn(int n)
	  |                      ^~~~~~~~~~~~~~

Fix this by adding the missing "inline" keywords to the three accessor
functions that lack them.

Fixes: df29ddf4f0 ("arm64: perf: Abstract system register accesses away")
Change-Id: I36e1360fc3b187b5e68619386ae9c142a9dda3c6
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/d53a19043c0c3bd25f6c203e73a2fb08a9661824.1683561482.git.geert+renesas@glider.be
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 3bc879e355)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Marc Zyngier
6d7eea37f7 UPSTREAM: perf/core: Drop __weak attribute from arch_perf_update_userpage() prototype
Reiji reports that the arm64 implementation of arch_perf_update_userpage()
is now ignored and replaced by the dummy stub in core code.
This seems to happen since the PMUv3 driver was moved to driver/perf.

As it turns out, dropping the __weak attribute from the *prototype*
of the function solves the problem. You're right, this doesn't seem
to make much sense. And yet... It appears that both symbols get
flagged as weak, and that the first one to appear in the link order
wins:

$ nm drivers/perf/arm_pmuv3.o|grep arch_perf_update_userpage
0000000000001db0 W arch_perf_update_userpage

Dropping the attribute from the prototype restores the expected
behaviour, and arm64 is able to enjoy arch_perf_update_userpage()
again.

Fixes: 7755cec63a ("arm64: perf: Move PMUv3 driver to drivers/perf")
Fixes: f1ec3a517b ("kernel/events: Add a missing prototype for arch_perf_update_userpage()")
Reported-by: Reiji Watanabe <reijiw@google.com>
Change-Id: I497041999776e66ac77c3fccdd09ce47aae544e9
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Reiji Watanabe <reijiw@google.com>
Link: https://lkml.kernel.org/r/20230616114831.3186980-1-maz@kernel.org
(cherry picked from commit b50f26a448)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Marc Zyngier
bf3022d3c3 UPSTREAM: ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM
The only thing stopping the PMUv3 driver from compiling on 32bit
is the lack of defined system registers names and the handful of
required helpers.

This is easily solved by providing the sysreg accessors and updating
the Kconfig entry.

Change-Id: I3f7f46feaeac69bb7d20c86b013e4a3091fb4bce
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Co-developed-by: Zaid Al-Bassam <zalbassam@google.com>
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-8-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 009d6dc87a)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Marc Zyngier
393be9f6d0 UPSTREAM: ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations
ARMv8 is a superset of ARMv7, and all the ARMv8 features are
discoverable with a set of ID registers. It means that we can
use CPU_V7 to guard ARMv8 features at compile time.

This commit simply amends the CPU_V7 configuration symbol comment
to reflect that CPU_V7 also covers ARMv8.

Change-Id: Ibfa141b7fcf77619cea6f95d562b8ddf959187a3
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-7-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 252309adc8)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Zaid Al-Bassam
9d0a91c993 UPSTREAM: perf: pmuv3: Change GENMASK to GENMASK_ULL
GENMASK macro uses "unsigned long" (32-bit wide on arm and 64-bit
on arm64), This causes build issues when enabling PMUv3 on arm as
it tries to access bits > 31. This patch switches the GENMASK to
GENMASK_ULL, which uses "unsigned long long" (64-bit on both arm
and arm64).

Change-Id: I44e30f5326202a4e691bf70ce15ac5c946cca19a
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-6-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit b3a070869f)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Zaid Al-Bassam
ab26945ffd UPSTREAM: perf: pmuv3: Move inclusion of kvm_host.h to the arch-specific helper
KVM host support is available only on arm64.

By moving the inclusion of kvm_host.h to an arm64-specific file,
the 32bit architecture will be able to implement dummy helpers.

Change-Id: I219958c7d95fa89b3fadcfaa73eec7392717a534
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-5-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 11fba29a8a)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Zaid Al-Bassam
3e7e6fa4da UPSTREAM: perf: pmuv3: Abstract PMU version checks
The current PMU version definitions are available for arm64 only,
As we want to add PMUv3 support to arm (32-bit), abstracts
these definitions by using arch-specific helpers.

Change-Id: I4d487c354c5b1384d2e8c95d097c0d3864907787
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-4-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 711432770f)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:56 -07:00
Marc Zyngier
55cfecdaaa UPSTREAM: arm64: perf: Abstract system register accesses away
As we want to enable 32bit support, we need to distanciate the
PMUv3 driver from the AArch64 system register names.

This patch moves all system register accesses to an architecture
specific include file, allowing the 32bit counterpart to be
slotted in at a later time.

Change-Id: Ib5c22a45d2b0ed844ee7d03cb7a7fa855230fcca
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Co-developed-by: Zaid Al-Bassam <zalbassam@google.com>
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-3-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit df29ddf4f0)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:55 -07:00
Marc Zyngier
278e973f01 UPSTREAM: arm64: perf: Move PMUv3 driver to drivers/perf
Having the ARM PMUv3 driver sitting in arch/arm64/kernel is getting
in the way of being able to use perf on ARMv8 cores running a 32bit
kernel, such as 32bit KVM guests.

This patch moves it into drivers/perf/arm_pmuv3.c, with an include
file in include/linux/perf/arm_pmuv3.h. The only thing left in
arch/arm64 is some mundane perf stuff.

Change-Id: I1928ceb684a107ef991401175458f2ea6c711826
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Zaid Al-Bassam <zalbassam@google.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20230317195027.3746949-2-zalbassam@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 7755cec63a)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:55 -07:00
Anshuman Khandual
222a79a1bb UPSTREAM: arm64/perf: Replace PMU version number '0' with ID_AA64DFR0_EL1_PMUVer_NI
__armv8pmu_probe_pmu() returns if detected PMU is either not implemented or
implementation defined. Extracted ID_AA64DFR0_EL1_PMUVer value, when PMU is
not implemented is '0' which can be replaced with ID_AA64DFR0_EL1_PMUVer_NI
defined as '0b0000'.

Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-perf-users@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Change-Id: I1d3b7e35313b967b19fb4370fde4ad3392f28db2
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20221128025449.39085-1-anshuman.khandual@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit cc91b94816)
Signed-off-by: Danesh Petigara <danesh.petigara@broadcom.com>
2024-06-07 04:37:55 -07:00
Wei Liu
62a4d78dda ANDROID: GKI: Update oplus symbol list
17 function symbol(s) added
  'void __netif_schedule(struct Qdisc*)'
  'void __qdisc_calculate_pkt_len(struct sk_buff*, const struct qdisc_size_table*)'
  'void gnet_stats_add_queue(struct gnet_stats_queue*, const struct gnet_stats_queue*, const struct gnet_stats_queue*)'
  'int gnet_stats_copy_basic(struct gnet_dump*, struct gnet_stats_basic_sync*, struct gnet_stats_basic_sync*, bool)'
  'int gnet_stats_copy_queue(struct gnet_dump*, struct gnet_stats_queue*, struct gnet_stats_queue*, __u32)'
  'void psched_ratecfg_precompute(struct psched_ratecfg*, const struct tc_ratespec*, u64)'
  'struct Qdisc* qdisc_create_dflt(struct netdev_queue*, const struct Qdisc_ops*, unsigned int, struct netlink_ext_ack*)'
  'void qdisc_hash_add(struct Qdisc*, bool)'
  'void qdisc_put(struct Qdisc*)'
  'void qdisc_reset(struct Qdisc*)'
  'void qdisc_tree_reduce_backlog(struct Qdisc*, int, int)'
  'void qdisc_watchdog_cancel(struct qdisc_watchdog*)'
  'void qdisc_watchdog_init(struct qdisc_watchdog*, struct Qdisc*)'
  'void qdisc_watchdog_schedule_range_ns(struct qdisc_watchdog*, u64, u64)'
  'int tcf_block_get(struct tcf_block**, struct tcf_proto**, struct Qdisc*, struct netlink_ext_ack*)'
  'void tcf_block_put(struct tcf_block*)'
  'int tcf_classify(struct sk_buff*, const struct tcf_block*, const struct tcf_proto*, struct tcf_result*, bool)'

2 variable symbol(s) added
  'struct Qdisc noop_qdisc'
  'struct Qdisc_ops pfifo_qdisc_ops'

Bug: 344702684
Change-Id: I42fa44b9e95c24b0ef3347f837561e79913878b9
Signed-off-by: Wei Liu <liuwei.a@oppo.com>
2024-06-06 17:22:56 +00:00
Qais Yousef
bfacfd198e UPSTREAM: block/blk-mq: Don't complete locally if capacities are different
The logic in blk_mq_complete_need_ipi() assumes SMP systems where all
CPUs have equal compute capacities and only LLC cache can make
a different on perceived performance. But this assumption falls apart on
HMP systems where LLC is shared, but the CPUs have different capacities.
Staying local then can have a big performance impact if the IO request
was done from a CPU with higher capacity but the interrupt is serviced
on a lower capacity CPU.

Use the new cpus_equal_capacity() function to check if we need to send
an IPI.

Without the patch I see the BLOCK softirq always running on little cores
(where the hardirq is serviced). With it I can see it running on all
cores.

This was noticed after the topology change [1] where now on a big.LITTLE
we truly get that the LLC is shared between all cores where as in the
past it was being misrepresented for historical reasons. The logic
exposed a missing dependency on capacities for such systems where there
can be a big performance difference between the CPUs.

This of course introduced a noticeable change in behavior depending on
how the topology is presented. Leading to regressions in some workloads
as the performance of the BLOCK softirq on littles can be noticeably
worse on some platforms.

Worth noting that we could have checked for capacities being greater
than or equal instead for equality. This will lead to favouring higher
performance always. But opted for equality instead to match the
performance of the requester without making an assumption that can lead
to power trade-offs which these systems tend to be sensitive about. If
the requester would like to run faster, it's better to rely on the
scheduler to give the IO requester via some facility to run on a faster
core; and then if the interrupt triggered on a CPU with different
capacity we'll make sure to match the performance the requester is
supposed to run at.

[1] https://lpc.events/event/16/contributions/1342/attachments/962/1883/LPC-2022-Android-MC-Phantom-Domains.pdf

Bug: 341551538
Signed-off-by: Qais Yousef <qyousef@layalina.io>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240223155749.2958009-3-qyousef@layalina.io
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit af550e4c968294398fc76b075f12d51c76caf753)
Signed-off-by: Qais Yousef <qyousef@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:d01dc1c7d020f49f31194254a89694bd23ad3dd5)
Merged-In: Iefed6a19b9d25102642e264118431f5e12e23fea
Change-Id: Iefed6a19b9d25102642e264118431f5e12e23fea
2024-06-06 15:43:07 +00:00
Qais Yousef
cf4893eb95 BACKPORT: sched: Add a new function to compare if two cpus have the same capacity
The new helper function is needed to help blk-mq check if it needs to
dispatch the softirq on another CPU to match the performance level the
IO requester is running at. This is important on HMP systems where not
all CPUs have the same compute capacity.

Bug: 341551538
Signed-off-by: Qais Yousef <qyousef@layalina.io>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240223155749.2958009-2-qyousef@layalina.io
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit b361c9027b4e4159e7bcca4eb64fd26507c19994)
[Trivial clash due to some code shuffling between versions]
Signed-off-by: Qais Yousef <qyousef@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:ee8168e00c6e4fb04bea953bacb61ff017a39f63)
Merged-In: I58f3f3e3560f4800b5c73b3c85bbfdf628e9764e
Change-Id: I58f3f3e3560f4800b5c73b3c85bbfdf628e9764e
2024-06-06 15:43:07 +00:00
Bian Jin chen
e4622d460e ANDROID: GKI: Update rockchip symbols for rndis_host.
3 function symbol(s) added
  'void usbnet_cdc_unbind(struct usbnet*, struct usb_interface*)'
  'int usbnet_cdc_zte_rx_fixup(struct usbnet*, struct sk_buff*)'
  'int usbnet_generic_cdc_bind(struct usbnet*, struct usb_interface*)'

Bug: 300024866
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: Ibd1798bc17f99767507eec2fb8ca7e1608e16488
2024-06-05 22:14:49 +00:00
Bian Jin chen
f601b06a7e ANDROID: GKI: Update rockchip symbols for snd multi dais.
2 function symbol(s) added
  'void snd_pcm_stream_lock_irq(struct snd_pcm_substream*)'
  'void snd_pcm_stream_unlock_irq(struct snd_pcm_substream*)'

Bug: 300024866
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: Ic35b2fc03132b0fb7edd5df3e4393109d7b47302
2024-06-05 22:14:49 +00:00