811291 Commits

Author SHA1 Message Date
Shigeru Yoshida
600edf70c1 inet_diag: Initialize pad field in struct inet_diag_req_v2
[ Upstream commit 61cf1c739f08190a4cbf047b9fbb192a94d87e3f ]

KMSAN reported uninit-value access in raw_lookup() [1]. Diag for raw
sockets uses the pad field in struct inet_diag_req_v2 for the
underlying protocol. This field corresponds to the sdiag_raw_protocol
field in struct inet_diag_req_raw.

inet_diag_get_exact_compat() converts inet_diag_req to
inet_diag_req_v2, but leaves the pad field uninitialized. So the issue
occurs when raw_lookup() accesses the sdiag_raw_protocol field.

Fix this by initializing the pad field in
inet_diag_get_exact_compat(). Also, do the same fix in
inet_diag_dump_compat() to avoid the similar issue in the future.

[1]
BUG: KMSAN: uninit-value in raw_lookup net/ipv4/raw_diag.c:49 [inline]
BUG: KMSAN: uninit-value in raw_sock_get+0x657/0x800 net/ipv4/raw_diag.c:71
 raw_lookup net/ipv4/raw_diag.c:49 [inline]
 raw_sock_get+0x657/0x800 net/ipv4/raw_diag.c:71
 raw_diag_dump_one+0xa1/0x660 net/ipv4/raw_diag.c:99
 inet_diag_cmd_exact+0x7d9/0x980
 inet_diag_get_exact_compat net/ipv4/inet_diag.c:1404 [inline]
 inet_diag_rcv_msg_compat+0x469/0x530 net/ipv4/inet_diag.c:1426
 sock_diag_rcv_msg+0x23d/0x740 net/core/sock_diag.c:282
 netlink_rcv_skb+0x537/0x670 net/netlink/af_netlink.c:2564
 sock_diag_rcv+0x35/0x40 net/core/sock_diag.c:297
 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
 netlink_unicast+0xe74/0x1240 net/netlink/af_netlink.c:1361
 netlink_sendmsg+0x10c6/0x1260 net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg+0x332/0x3d0 net/socket.c:745
 ____sys_sendmsg+0x7f0/0xb70 net/socket.c:2585
 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2639
 __sys_sendmsg net/socket.c:2668 [inline]
 __do_sys_sendmsg net/socket.c:2677 [inline]
 __se_sys_sendmsg net/socket.c:2675 [inline]
 __x64_sys_sendmsg+0x27e/0x4a0 net/socket.c:2675
 x64_sys_call+0x135e/0x3ce0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd9/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Uninit was stored to memory at:
 raw_sock_get+0x650/0x800 net/ipv4/raw_diag.c:71
 raw_diag_dump_one+0xa1/0x660 net/ipv4/raw_diag.c:99
 inet_diag_cmd_exact+0x7d9/0x980
 inet_diag_get_exact_compat net/ipv4/inet_diag.c:1404 [inline]
 inet_diag_rcv_msg_compat+0x469/0x530 net/ipv4/inet_diag.c:1426
 sock_diag_rcv_msg+0x23d/0x740 net/core/sock_diag.c:282
 netlink_rcv_skb+0x537/0x670 net/netlink/af_netlink.c:2564
 sock_diag_rcv+0x35/0x40 net/core/sock_diag.c:297
 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline]
 netlink_unicast+0xe74/0x1240 net/netlink/af_netlink.c:1361
 netlink_sendmsg+0x10c6/0x1260 net/netlink/af_netlink.c:1905
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg+0x332/0x3d0 net/socket.c:745
 ____sys_sendmsg+0x7f0/0xb70 net/socket.c:2585
 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2639
 __sys_sendmsg net/socket.c:2668 [inline]
 __do_sys_sendmsg net/socket.c:2677 [inline]
 __se_sys_sendmsg net/socket.c:2675 [inline]
 __x64_sys_sendmsg+0x27e/0x4a0 net/socket.c:2675
 x64_sys_call+0x135e/0x3ce0 arch/x86/include/generated/asm/syscalls_64.h:47
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xd9/0x1e0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Local variable req.i created at:
 inet_diag_get_exact_compat net/ipv4/inet_diag.c:1396 [inline]
 inet_diag_rcv_msg_compat+0x2a6/0x530 net/ipv4/inet_diag.c:1426
 sock_diag_rcv_msg+0x23d/0x740 net/core/sock_diag.c:282

CPU: 1 PID: 8888 Comm: syz-executor.6 Not tainted 6.10.0-rc4-00217-g35bb670d65fc #32
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014

Fixes: 432490f9d455 ("net: ip, diag -- Add diag interface for raw sockets")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20240703091649.111773-1-syoshida@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7094a5fd20ab66028f1da7f06e0f2692d70346f9)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:50:05 +00:00
Zijian Zhang
3688bfa238 selftests: make order checking verbose in msg_zerocopy selftest
[ Upstream commit 7d6d8f0c8b700c9493f2839abccb6d29028b4219 ]

We find that when lock debugging is on, notifications may not come in
order. Thus, we have order checking outputs managed by cfg_verbose, to
avoid too many outputs in this case.

Fixes: 07b65c5b31ce ("test: add msg_zerocopy test")
Signed-off-by: Zijian Zhang <zijianzhang@bytedance.com>
Signed-off-by: Xiaochun Lu <xiaochun.lu@bytedance.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240701225349.3395580-3-zijianzhang@bytedance.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b1cb48187a6edc2ab72f5b3e6b4af7a232730d64)
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
2024-08-23 16:50:04 +00:00
Zijian Zhang
c75d2712b7 selftests: fix OOM in msg_zerocopy selftest
[ Upstream commit af2b7e5b741aaae9ffbba2c660def434e07aa241 ]

In selftests/net/msg_zerocopy.c, it has a while loop keeps calling sendmsg
on a socket with MSG_ZEROCOPY flag, and it will recv the notifications
until the socket is not writable. Typically, it will start the receiving
process after around 30+ sendmsgs. However, as the introduction of commit
dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale"), the sender is
always writable and does not get any chance to run recv notifications.
The selftest always exits with OUT_OF_MEMORY because the memory used by
opt_skb exceeds the net.core.optmem_max. Meanwhile, it could be set to a
different value to trigger OOM on older kernels too.

Thus, we introduce "cfg_notification_limit" to force sender to receive
notifications after some number of sendmsgs.

Fixes: 07b65c5b31ce ("test: add msg_zerocopy test")
Signed-off-by: Zijian Zhang <zijianzhang@bytedance.com>
Signed-off-by: Xiaochun Lu <xiaochun.lu@bytedance.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240701225349.3395580-2-zijianzhang@bytedance.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d6ab0198fb470e1a9948d08c610a94601a1fdb2c)
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
2024-08-23 16:50:04 +00:00
Sowmini Varadhan
a8987b87ff selftests/net: reap zerocopy completions passed up as ancillary data.
PF_RDS sockets pass up cookies for zerocopy completion as ancillary
data. Update msg_zerocopy to reap this information.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 6f3899e602b0f4ec3d62ff385bb805e7109defa4)
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
2024-08-23 16:50:04 +00:00
Sam Sun
ea462f7627 bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set()
[ Upstream commit e271ff53807e8f2c628758290f0e499dbe51cb3d ]

In function bond_option_arp_ip_targets_set(), if newval->string is an
empty string, newval->string+1 will point to the byte after the
string, causing an out-of-bound read.

BUG: KASAN: slab-out-of-bounds in strlen+0x7d/0xa0 lib/string.c:418
Read of size 1 at addr ffff8881119c4781 by task syz-executor665/8107
CPU: 1 PID: 8107 Comm: syz-executor665 Not tainted 6.7.0-rc7 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc1/0x5e0 mm/kasan/report.c:475
 kasan_report+0xbe/0xf0 mm/kasan/report.c:588
 strlen+0x7d/0xa0 lib/string.c:418
 __fortify_strlen include/linux/fortify-string.h:210 [inline]
 in4_pton+0xa3/0x3f0 net/core/utils.c:130
 bond_option_arp_ip_targets_set+0xc2/0x910
drivers/net/bonding/bond_options.c:1201
 __bond_opt_set+0x2a4/0x1030 drivers/net/bonding/bond_options.c:767
 __bond_opt_set_notify+0x48/0x150 drivers/net/bonding/bond_options.c:792
 bond_opt_tryset_rtnl+0xda/0x160 drivers/net/bonding/bond_options.c:817
 bonding_sysfs_store_option+0xa1/0x120 drivers/net/bonding/bond_sysfs.c:156
 dev_attr_store+0x54/0x80 drivers/base/core.c:2366
 sysfs_kf_write+0x114/0x170 fs/sysfs/file.c:136
 kernfs_fop_write_iter+0x337/0x500 fs/kernfs/file.c:334
 call_write_iter include/linux/fs.h:2020 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x96a/0xd80 fs/read_write.c:584
 ksys_write+0x122/0x250 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
---[ end trace ]---

Fix it by adding a check of string length before using it.

Fixes: f9de11a16594 ("bonding: add ip checks when store ip target")
Signed-off-by: Yue Sun <samsun1006219@gmail.com>
Signed-off-by: Simon Horman <horms@kernel.org>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20240702-bond-oob-v6-1-2dfdba195c19@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6a8a4fd082c439e19fede027e80c79bc4c84bb8e)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:48:28 +00:00
Jakub Kicinski
f8f32610da tcp_metrics: validate source addr length
[ Upstream commit 66be40e622e177316ae81717aa30057ba9e61dff ]

I don't see anything checking that TCP_METRICS_ATTR_SADDR_IPV4
is at least 4 bytes long, and the policy doesn't have an entry
for this attribute at all (neither does it for IPv6 but v6 is
manually validated).

Reviewed-by: Eric Dumazet <edumazet@google.com>
Fixes: 3e7013ddf55a ("tcp: metrics: Allow selective get/del of tcp-metrics based on src IP")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 19d997b59fa1fd7a02e770ee0881c0652b9c32c9)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:48:28 +00:00
Neal Cardwell
f1bac5dbfa UPSTREAM: tcp: fix DSACK undo in fast recovery to call tcp_try_to_open()
[ Upstream commit a6458ab7fd4f427d4f6f54380453ad255b7fde83 ]

In some production workloads we noticed that connections could
sometimes close extremely prematurely with ETIMEDOUT after
transmitting only 1 TLP and RTO retransmission (when we would normally
expect roughly tcp_retries2 = TCP_RETR2 = 15 RTOs before a connection
closes with ETIMEDOUT).

From tracing we determined that these workloads can suffer from a
scenario where in fast recovery, after some retransmits, a DSACK undo
can happen at a point where the scoreboard is totally clear (we have
retrans_out == sacked_out == lost_out == 0). In such cases, calling
tcp_try_keep_open() means that we do not execute any code path that
clears tp->retrans_stamp to 0. That means that tp->retrans_stamp can
remain erroneously set to the start time of the undone fast recovery,
even after the fast recovery is undone. If minutes or hours elapse,
and then a TLP/RTO/RTO sequence occurs, then the start_ts value in
retransmits_timed_out() (which is from tp->retrans_stamp) will be
erroneously ancient (left over from the fast recovery undone via
DSACKs). Thus this ancient tp->retrans_stamp value can cause the
connection to die very prematurely with ETIMEDOUT via
tcp_write_err().

The fix: we change DSACK undo in fast recovery (TCP_CA_Recovery) to
call tcp_try_to_open() instead of tcp_try_keep_open(). This ensures
that if no retransmits are in flight at the time of DSACK undo in fast
recovery then we properly zero retrans_stamp. Note that calling
tcp_try_to_open() is more consistent with other loss recovery
behavior, since normal fast recovery (CA_Recovery) and RTO recovery
(CA_Loss) both normally end when tp->snd_una meets or exceeds
tp->high_seq and then in tcp_fastretrans_alert() the "default" switch
case executes tcp_try_to_open(). Also note that by inspection this
change to call tcp_try_to_open() implies at least one other nice bug
fix, where now an ECE-marked DSACK that causes an undo will properly
invoke tcp_enter_cwr() rather than ignoring the ECE mark.

Fixes: c7d9d6a185a7 ("tcp: undo on DSACK during recovery")
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8b5fd51b3040ce2596d22a72767c66d7435853b6)
[Harshit: Minor conflict resolution due to missing commit: 737ff314563c
("tcp: use sequence distance to detect reordering") and more commits]
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
2024-08-23 16:48:28 +00:00
Holger Dengler
d232297f03 s390/pkey: Wipe sensitive data on failure
[ Upstream commit 1d8c270de5eb74245d72325d285894a577a945d9 ]

Wipe sensitive data from stack also if the copy_to_user() fails.

Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6e2e374403bf73140d0efc9541cb1b3bea55ac02)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:24 +00:00
Wang Yong
7523a69d10 jffs2: Fix potential illegal address access in jffs2_free_inode
[ Upstream commit af9a8730ddb6a4b2edd779ccc0aceb994d616830 ]

During the stress testing of the jffs2 file system,the following
abnormal printouts were found:
[ 2430.649000] Unable to handle kernel paging request at virtual address 0069696969696948
[ 2430.649622] Mem abort info:
[ 2430.649829]   ESR = 0x96000004
[ 2430.650115]   EC = 0x25: DABT (current EL), IL = 32 bits
[ 2430.650564]   SET = 0, FnV = 0
[ 2430.650795]   EA = 0, S1PTW = 0
[ 2430.651032]   FSC = 0x04: level 0 translation fault
[ 2430.651446] Data abort info:
[ 2430.651683]   ISV = 0, ISS = 0x00000004
[ 2430.652001]   CM = 0, WnR = 0
[ 2430.652558] [0069696969696948] address between user and kernel address ranges
[ 2430.653265] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 2430.654512] CPU: 2 PID: 20919 Comm: cat Not tainted 5.15.25-g512f31242bf6 #33
[ 2430.655008] Hardware name: linux,dummy-virt (DT)
[ 2430.655517] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 2430.656142] pc : kfree+0x78/0x348
[ 2430.656630] lr : jffs2_free_inode+0x24/0x48
[ 2430.657051] sp : ffff800009eebd10
[ 2430.657355] x29: ffff800009eebd10 x28: 0000000000000001 x27: 0000000000000000
[ 2430.658327] x26: ffff000038f09d80 x25: 0080000000000000 x24: ffff800009d38000
[ 2430.658919] x23: 5a5a5a5a5a5a5a5a x22: ffff000038f09d80 x21: ffff8000084f0d14
[ 2430.659434] x20: ffff0000bf9a6ac0 x19: 0169696969696940 x18: 0000000000000000
[ 2430.659969] x17: ffff8000b6506000 x16: ffff800009eec000 x15: 0000000000004000
[ 2430.660637] x14: 0000000000000000 x13: 00000001000820a1 x12: 00000000000d1b19
[ 2430.661345] x11: 0004000800000000 x10: 0000000000000001 x9 : ffff8000084f0d14
[ 2430.662025] x8 : ffff0000bf9a6b40 x7 : ffff0000bf9a6b48 x6 : 0000000003470302
[ 2430.662695] x5 : ffff00002e41dcc0 x4 : ffff0000bf9aa3b0 x3 : 0000000003470342
[ 2430.663486] x2 : 0000000000000000 x1 : ffff8000084f0d14 x0 : fffffc0000000000
[ 2430.664217] Call trace:
[ 2430.664528]  kfree+0x78/0x348
[ 2430.664855]  jffs2_free_inode+0x24/0x48
[ 2430.665233]  i_callback+0x24/0x50
[ 2430.665528]  rcu_do_batch+0x1ac/0x448
[ 2430.665892]  rcu_core+0x28c/0x3c8
[ 2430.666151]  rcu_core_si+0x18/0x28
[ 2430.666473]  __do_softirq+0x138/0x3cc
[ 2430.666781]  irq_exit+0xf0/0x110
[ 2430.667065]  handle_domain_irq+0x6c/0x98
[ 2430.667447]  gic_handle_irq+0xac/0xe8
[ 2430.667739]  call_on_irq_stack+0x28/0x54
The parameter passed to kfree was 5a5a5a5a, which corresponds to the target field of
the jffs_inode_info structure. It was found that all variables in the jffs_inode_info
structure were 5a5a5a5a, except for the first member sem. It is suspected that these
variables are not initialized because they were set to 5a5a5a5a during memory testing,
which is meant to detect uninitialized memory.The sem variable is initialized in the
function jffs2_i_init_once, while other members are initialized in
the function jffs2_init_inode_info.

The function jffs2_init_inode_info is called after iget_locked,
but in the iget_locked function, the destroy_inode process is triggered,
which releases the inode and consequently, the target member of the inode
is not initialized.In concurrent high pressure scenarios, iget_locked
may enter the destroy_inode branch as described in the code.

Since the destroy_inode functionality of jffs2 only releases the target,
the fix method is to set target to NULL in jffs2_i_init_once.

Signed-off-by: Wang Yong <wang.yong12@zte.com.cn>
Reviewed-by: Lu Zhongjun <lu.zhongjun@zte.com.cn>
Reviewed-by: Yang Tao <yang.tao172@zte.com.cn>
Cc: Xu Xin <xu.xin16@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b6c8b3e31eb88c85094d848a0bd8b4bafe67e4d8)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Greg Kurz
48d99fb324 powerpc/xmon: Check cpu id in commands "c#", "dp#" and "dx#"
[ Upstream commit 8873aab8646194a4446117bb617cc71bddda2dee ]

All these commands end up peeking into the PACA using the user
originated cpu id as an index. Check the cpu id is valid in order
to prevent xmon to crash. Instead of printing an error, this follows
the same behavior as the "lp s #" command : ignore the buggy cpu id
parameter and fall back to the #-less version of the command.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/161531347060.252863.10490063933688958044.stgit@bahia.lan
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 04b90b8d0b6929d7427551215b71901959c8e098)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Mike Marshall
b490b0a094 orangefs: fix out-of-bounds fsid access
[ Upstream commit 53e4efa470d5fc6a96662d2d3322cfc925818517 ]

Arnd Bergmann sent a patch to fsdevel, he says:

"orangefs_statfs() copies two consecutive fields of the superblock into
the statfs structure, which triggers a warning from the string fortification
helpers"

Jan Kara suggested an alternate way to do the patch to make it more readable.

I ran both ideas through xfstests and both seem fine. This patch
is based on Jan Kara's suggestion.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b90176a9553775e23966650e445b1866e62e4924)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Michael Ellerman
af94a2ea5b powerpc/64: Set _IO_BASE to POISON_POINTER_DELTA not 0 for CONFIG_PCI=n
[ Upstream commit be140f1732b523947425aaafbe2e37b41b622d96 ]

There is code that builds with calls to IO accessors even when
CONFIG_PCI=n, but the actual calls are guarded by runtime checks.

If not those calls would be faulting, because the page at virtual
address zero is (usually) not mapped into the kernel. As Arnd pointed
out, it is possible a large port value could cause the address to be
above mmap_min_addr which would then access userspace, which would be
a bug.

To avoid any such issues, set _IO_BASE to POISON_POINTER_DELTA. That
is a value chosen to point into unmapped space between the kernel and
userspace, so any access will always fault.

Note that on 32-bit POISON_POINTER_DELTA is 0, so the patch only has an
effect on 64-bit.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240503075619.394467-2-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 85cc3ecb0b1256d539bb6a58a5f995c802a331c4)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Heiner Kallweit
f5a529216e i2c: i801: Annotate apanel_addr as __ro_after_init
[ Upstream commit 355b1513b1e97b6cef84b786c6480325dfd3753d ]

Annotate this variable as __ro_after_init to protect it from being
overwritten later.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1a1f7053437d0f27534ecc9ec7e5d441c082b81c)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Ricardo Ribalda
cf654f32bb media: dvb-frontends: tda10048: Fix integer overflow
[ Upstream commit 1aa1329a67cc214c3b7bd2a14d1301a795760b07 ]

state->xtal_hz can be up to 16M, so it can overflow a 32 bit integer
when multiplied by pll_mfactor.

Create a new 64 bit variable to hold the calculations.

Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-25-3c4865f5a4b0@chromium.org
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8167e4d7dc086d4f7ca7897dcff3827e4d22c99a)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Ricardo Ribalda
909138842f media: s2255: Use refcount_t instead of atomic_t for num_channels
[ Upstream commit 6cff72f6bcee89228a662435b7c47e21a391c8d0 ]

Use an API that resembles more the actual use of num_channels.

Found by cocci:
drivers/media/usb/s2255/s2255drv.c:2362:5-24: WARNING: atomic_dec_and_test variation before object free at line 2363.
drivers/media/usb/s2255/s2255drv.c:1557:5-24: WARNING: atomic_dec_and_test variation before object free at line 1558.

Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-11-3c4865f5a4b0@chromium.org
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 32f2f5385eefa73aaebefda419147ac8599ba9e6)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Ricardo Ribalda
a65c17e8b9 media: dvb-frontends: tda18271c2dd: Remove casting during div
[ Upstream commit e9a844632630e18ed0671a7e3467431bd719952e ]

do_div() divides 64 bits by 32. We were adding a casting to the divider
to 64 bits, for a number that fits perfectly in 32 bits. Remove it.

Found by cocci:
drivers/media/dvb-frontends/tda18271c2dd.c:355:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
drivers/media/dvb-frontends/tda18271c2dd.c:331:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.

Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-8-3c4865f5a4b0@chromium.org
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2401cbc0f5d4bd1e327d247548cc6ee57bc76c53)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Simon Horman
9c1cb2b6cb net: dsa: mv88e6xxx: Correct check for empty list
[ Upstream commit 4c7f3950a9fd53a62b156c0fe7c3a2c43b0ba19b ]

Since commit a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO
busses") mv88e6xxx_default_mdio_bus() has checked that the
return value of list_first_entry() is non-NULL.

This appears to be intended to guard against the list chip->mdios being
empty.  However, it is not the correct check as the implementation of
list_first_entry is not designed to return NULL for empty lists.

Instead, use list_first_entry_or_null() which does return NULL if the
list is empty.

Flagged by Smatch.
Compile tested only.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240430-mv88e6xx-list_empty-v3-1-c35c69d88d2e@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 47d28dde172696031c880c5778633cdca30394ee)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Erick Archer
d2b33d0a14 Input: ff-core - prefer struct_size over open coded arithmetic
[ Upstream commit a08b8f8557ad88ffdff8905e5da972afe52e3307 ]

This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].

As the "ff" variable is a pointer to "struct ff_device" and this
structure ends in a flexible array:

struct ff_device {
	[...]
	struct file *effect_owners[] __counted_by(max_effects);
};

the preferred way in the kernel is to use the struct_size() helper to
do the arithmetic instead of the calculation "size + count * size" in
the kzalloc() function.

The struct_size() helper returns SIZE_MAX on overflow. So, refactor
the comparison to take advantage of this.

This way, the code is more readable and safer.

This code was detected with the help of Coccinelle, and audited and
modified manually.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer <erick.archer@outlook.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/AS8PR02MB72371E646714BAE2E51A6A378B152@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e52cfcf68df0b52565be68106e9f65ab8077b48a)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Jean Delvare
b0f4f0d200 firmware: dmi: Stop decoding on broken entry
[ Upstream commit 0ef11f604503b1862a21597436283f158114d77e ]

If a DMI table entry is shorter than 4 bytes, it is invalid. Due to
how DMI table parsing works, it is impossible to safely recover from
such an error, so we have to stop decoding the table.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Link: https://lore.kernel.org/linux-kernel/Zh2K3-HLXOesT_vZ@liuwe-devbox-debian-v2/T/
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c2a350a3fa622a174e3704691d05989cdfde4d51)
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:43:23 +00:00
Erick Archer
fca275dacc sctp: prefer struct_size over open coded arithmetic
[ Upstream commit e5c5f3596de224422561d48eba6ece5210d967b3 ]

This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].

As the "ids" variable is a pointer to "struct sctp_assoc_ids" and this
structure ends in a flexible array:

struct sctp_assoc_ids {
	[...]
	sctp_assoc_t	gaids_assoc_id[];
};

the preferred way in the kernel is to use the struct_size() helper to
do the arithmetic instead of the calculation "size + size * count" in
the kmalloc() function.

Also, refactor the code adding the "ids_size" variable to avoid sizing
twice.

This way, the code is more readable and safer.

This code was detected with the help of Coccinelle, and audited and
modified manually.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer <erick.archer@outlook.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/PAXPR02MB724871DB78375AB06B5171C88B152@PAXPR02MB7248.eurprd02.prod.outlook.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 03f37e56305156bd25c5c237d1cc7f5c75495ef2)
[Vegard: add #include that was pulled in through some other unknown
 header on 4.19.y]
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-08-23 16:40:43 +00:00
Tashfin Shakeer Rhythm
1668b4c520 incfs: Use ARM64 v8 ASM to accelerate lz4 decompression
Change-Id: Ied66bf0037e6669870667acdf55866bc61245508
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:56:56 -03:00
Tashfin Shakeer Rhythm
7bd5b033d5 lz4: Use ARM64 v8 ASM to accelerate decompression
Change-Id: I2c14ffc6ee9dcc0f2170f9f90169a08505dc43ed
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:56:56 -03:00
Dark-Matter7232
539a2175c0 lz4: Add ARM64 acceleration and enhance decompression
Extracted from Huawei's kernel source drop, this patch adds ARM64 optimizations for LZ4 decompression:

- Adds ARM64 acceleration support.
- Introduces new ARM64-specific files and updates the Makefile.
- Enhances __LZ4_decompress_generic for partial decompression.
- Adds bounds checks for safer decompression.

Originally intended as optimizations for Huawei's EROFS driver.

Change-Id: I438b79e43bbacd08a047d037a1eeac8ff89b4aff
Signed-off-by: Dark-Matter7232 <me@const.eu.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:56:56 -03:00
Tashfin Shakeer Rhythm
454dc2f706 lz4: Reduce memory usage to 1KB
As per Sony, 1KB of memory size for LZ4 is enough as we only
use LZ4 for zRAM and so our blocks are 4KB in size.

Therefore, reduce the LZ4 memory usage to 1KB. This can enhance
the speed of LZ4.

Change-Id: Iafead09b28c5989c9991163fcc1ce17cb06ba0fc
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:55:22 -03:00
Tashfin Shakeer Rhythm
42a7777993 lz4: Eliminate unused functions
This fixes the following warnings by Clang:

../lib/lz4/lz4_decompress.c:904:12: warning: unused function 'LZ4_decompress_fast' [-Wunused-function]
static int LZ4_decompress_fast(const char *source, char *dest, int originalSize)
           ^
../lib/lz4/lz4_decompress.c:941:12: warning: unused function 'LZ4_decompress_fast_extDict' [-Wunused-function]
static int LZ4_decompress_fast_extDict(const char *source, char *dest,
           ^
../lib/lz4/lz4_decompress.c:1052:12: warning: unused function 'LZ4_decompress_fast_continue' [-Wunused-function]
static int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode,
           ^
../lib/lz4/lz4_decompress.c:1099:12: warning: unused function 'LZ4_decompress_safe_usingDict' [-Wunused-function]
static int LZ4_decompress_safe_usingDict(const char *source, char *dest,
           ^
../lib/lz4/lz4_decompress.c:1118:12: warning: unused function 'LZ4_decompress_fast_usingDict' [-Wunused-function]
static int LZ4_decompress_fast_usingDict(const char *source, char *dest,
           ^

Change-Id: Ieea187c98a10ee55da02f67615f25b6cd0ed13ba
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:55:22 -03:00
Tashfin Shakeer Rhythm
cf980ad5d1 lz4: Staticize some functions
This fixes the following warnings by sparse:

../lib/lz4/lz4_compress.c:838:5: warning: symbol 'LZ4_compress_fast_extState' was not declared. Should it be static?
../lib/lz4/lz4_decompress.c:141:8: warning: symbol 'read_long_length_no_check' was not declared. Should it be static?
../lib/lz4/lz4_decompress.c:904:5: warning: symbol 'LZ4_decompress_fast' was not declared. Should it be static?
../lib/lz4/lz4_decompress.c:1052:5: warning: symbol 'LZ4_decompress_fast_continue' was not declared. Should it be static?
../lib/lz4/lz4_decompress.c:1099:5: warning: symbol 'LZ4_decompress_safe_usingDict' was not declared. Should it be static?
../lib/lz4/lz4_decompress.c:1118:5: warning: symbol 'LZ4_decompress_fast_usingDict' was not declared. Should it be static?

Since some of the functions have been marked as static now, there is no
need to export them. Remove the redundant export symbols as well.

Change-Id: Idf1e7a83ceba9f582e22df51ebe687585334abec
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:55:22 -03:00
Sultan Alsawaf
a7a26b3ec5 f2fs: Force strict fsync mode
To help mitigate data loss potential in the event of an unclean
shutdown. The small performance hit is worth the trade-off for improved
data integrity, especially since custom kernels are more susceptible to
unclean shutdowns (panics) during development.

Change-Id: I4d114ba632faaeb82ea1fdf8f354b0a2f46d8407
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:55:22 -03:00
liuchao12
a39604d402 f2fs: Avoid needless checkpoint during fsync
MIUI-1728660

This patch enhances the performance of fsync.

Doing checkpoint every time when setting xattr for dir can seriously
affect the performance of fsync. By adding the inode to the tracking
list when setting up xattr, we can avoid doing checkpoint when xattr
of the parent directory is not set.

Change-Id: I0ccf34212f77fb686dd86b705b78554c29bd38f8
Signed-off-by: liuchao12 <liuchao12@xiaomi.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-18 03:55:22 -03:00
Richard Raya
28d9baa9be Revert "sched/fair: Don't allow boosted tasks to be migrated to small cores"
This reverts commit d5afaaf78fc6335662448dcc3202c0b6f5917000.

Change-Id: Ifca9223a0b308bd3abe6628f3b34335d26313a99
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:45:07 -03:00
Richard Raya
5d8ec03b95 Revert "sched/fair: Make stune boost > 0 tasks stay in big cluster"
This reverts commit 9a96accad1fc2d228f2c3a7f527694fe42da7405.

Change-Id: I55d5c4034c19cc2d63e97611e2f7cd1d88188f13
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:45:06 -03:00
Richard Raya
2b7c0a9d8d Revert "sched/tune: only force UX tasks to big cores"
This reverts commit 89746abced305c81c70bb594445632743504b02c.

Change-Id: I903ace5520e79975fc3ad73822e193b2abaadaed
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:45:05 -03:00
Richard Raya
6603b051dd drm/msm/sde: Configure default KCAL parameters
Change-Id: Ifa7a6627fb717def9bd3bc30416e184a7ae42100
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:37:39 -03:00
Richard Raya
1af43dc9da msm-4.14: Run dos2unix treewide
find . -type f -print0 | xargs -0 -n 1 -P 12 dos2unix

Change-Id: I0a93052f5b83de7ee3d66ab372280f5401b8d00b
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:37:38 -03:00
Richard Raya
3ffdace992 exec: Guard SLMK hack
Change-Id: I863a9dfda9aeea6ec61aa9536c86838614520ece
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:05 -03:00
Andrzej Perczak
1efee42c5c defconfig: Disable DEBUG_ALIGN_RODATA
In recent Linux v5.7 release this option has been removed as its real
performance impact is doubtful.
What's more, disabling it can save memory.

Change-Id: Ie2f77ee5bd9e3e7fa7e0e22a2196cd2fc3e81a89
Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:05 -03:00
Panchajanya1999
d321a83c5c techpack/audio: Target user build variants
Change-Id: I481c891b8e853d272cfbe2b6b912dc767f74c710
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:05 -03:00
Richard Raya
3dc59ee906 ARM64/dts: sdmmagpie-thermal: Switch to user_space governor
Change-Id: Ic257d21c7907d6a0cad3a8b04fcf219ff6a4f693
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:05 -03:00
Kuba Wojciechowski
73f8afcbd5 power/supply: Report fast charging when a proprietary charger is attached
Android figures out if charging is "rapid" by checking
POWER_SUPPLY_PROP_CURRENT_MAX and when the proprietary charger tech
Xiaomi's using is active that value isn't always reported correctly.
Work around that by reporting an arbitrary value that's high enough to
qualify as "rapid" when a proprietary charger is attached and fully
authenticated (by checking smblib_get_fastcharge_mode() which is a
custom utility function added by Xiaomi). Other charger types (HVDCP/PD)
still use standard smblib_get_prop_input_current_max().

Test: original 33W charger is reported as "rapid" immediately after
plugging it in, a slow charger is still detected as "slow".

Change-Id: If9247081f2eae8132857be44487f83ba36b4c129
Signed-off-by: Kuba Wojciechowski <nullbytepl@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:05 -03:00
Richard Raya
d64ab44fec workqueue: Force non power efficient workqueues
Change-Id: If4f2f8de7bab5208f36c00fe6d3e55d8b5079fd1
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Richard Raya
5ba7c278e6 Revert "rcu: Fix a performance regression"
This reverts commit 462ce2c18d19552736842483f1c3ce1c7554ccba.

Change-Id: Ied28218b62fe2240483dfbb9a5193a586b76839e
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Kazuki Hashimoto
da73a77df7 qos: Inline latency critical functions
Change-Id: Ic534adc173689d96fd22b557822dee8844f46451
Signed-off-by: Kazuki Hashimoto <kaz205@tuta.io>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Sultan Alsawaf
a42bd2ac50 qos: Don't allow userspace to impose restrictions on CPU idle levels
Giving userspace intimate control over CPU latency requirements is
nonsense. Userspace can't even stop itself from being preempted, so
there's no reason for it to have access to a mechanism primarily used to
eliminate CPU delays on the order of microseconds.

Remove userspace's ability to send pm_qos requests so that it can't hurt
power consumption.

Change-Id: Ie505ac3647258c375387875199bb831a8c208e4f
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Richard Raya
4d98a55499 defconfig: Fine tune boost freqs
Change-Id: Ia8aec6f13537eca800233b89c1538a8786e78615
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Sultan Alsawaf
67de7a9c1d cpufreq: Kill userspace CPU boosting entirely
Kernel-based CPU boosting is used now, so stop userspace from messing with
it by turning scaling_min_freq into a no-op. Note that this is done instead
of making scaling_min_freq read-only so that userspace doesn't spit out
error messages when it can't do its boosting.

Change-Id: I7c8f07cfc02ba719bfc883c9ecd2954f9cbda76f
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Richard Raya
f110fe3f86 adreno_tz: Boost GPU target frequency at any refresh rate
Change-Id: Ia888f618686bc4a599b6fcbaf88ae69557b67eec
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Sultan Alsawaf
bd79183928 adreno_tz: Fix GPU target frequency calculation for high refresh rates
It seems that the black-box GPU frequency selection algorithm is unaware
of high refresh rates, and assumes a refresh rate of 60 Hz for its
target frequencies. This results in frequencies that are too low being
selected when a higher refresh rate, such as 90 Hz, is used.

To remedy this, multiply the GPU's busy time by a ratio of the current
refresh rate to 60 Hz. This makes msm-adreno-tz select the right
frequencies needed to avoid stuttering.

[ghostrider-reborn]
- Actually make it work with real-time dynamic refresh rate

Change-Id: Idb8e033bbbd1e6e6ebf1a47d4f9bd618df812658
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Richard Raya
8a4484ea84 adreno_tz: Revert some changes
Revert "adreno_tz: Adjust GPU target frequency calculation"

This reverts commit e13ea7323c674fa9a6b70b82c89e94bfb0008ae4.

Revert "adreno_tz: Util inflation improvements"

This reverts commit b2125a41832d2c94cf2b3c6b88d8c7b981eb1c2f.

Revert "devfreq/adreno_tz: make high refresh multiplier configurable"

This reverts commit 863f6821522d3ffbb1a598b75396ee357500614b.

Revert "adreno_tz: Fix GPU target frequency calculation for high refresh rates"

This reverts commit 9b7169dba8a882ad3a7584da337a2fb875e31174.

Change-Id: Idd139250e21efebead872ecbbdebc2529aec22b5
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
DespairFactor
3d6a41c6a4 cfq: Disable slice_idle
Change-Id: Icfd93f36cdf96fefa22d908eda899f13c1bf39b1
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Panchajanya1999
1b31da0cba cfq: Apply RedHat suggested tunings for fast storage
[1]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/pdf/performance_tuning_guide/red_hat_enterprise_linux-7-performance_tuning_guide-en-us.pdf
(Section 8.4.5.1)

Change-Id: Ie8e3f7898d661362212d3eac5fe854362048ce94
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00
Maciej S. Szmigiero
0c831197cc cfq: Clear queue pointers after unpinning them in cfq_pd_offline
BFQ is already doing a similar thing in its .pd_offline_fn() method
implementation.

While it seems that after commit 4c6994806f70
("blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()")
was reverted leaving these pointers intact no longer causes crashes
clearing them is still a sensible thing to do to make the code more robust.

Change-Id: I132ed621e2fbd6c61aae0564b1756202c7d944b2
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-08-17 19:36:04 -03:00