6.1.42-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 145/183 netfilter: nft_set_pipapo: fix improper element removal
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 87b5a5c209405cb6b57424cdfa226a6dbd349232 ]
end key should be equal to start unless NFT_SET_EXT_KEY_END is present.
Its possible to add elements that only have a start key ("{ 1.0.0.0 . 2.0.0.0 }") without an internval end.
Insertion treats this via:
if (nft_set_ext_exists(ext, NFT_SET_EXT_KEY_END))
end = (const u8 *)nft_set_ext_key_end(ext)->data;
else
end = start;
but removal side always uses nft_set_ext_key_end().
This is wrong and leads to garbage remaining in the set after removal next lookup/insert attempt will give:
BUG: KASAN: slab-use-after-free in pipapo_get+0x8eb/0xb90 Read of size 1 at addr ffff888100d50586 by task nft-pipapo_uaf_/1399 Call Trace: kasan_report+0x105/0x140 pipapo_get+0x8eb/0xb90 nft_pipapo_insert+0x1dc/0x1710 nf_tables_newsetelem+0x31f5/0x4e00 ..
--- net/netfilter/nft_set_pipapo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/netfilter/nft_set_pipapo.c +5 -1
@@ -1930,7 +1930,11 @@ static void nft_pipapo_remove(const struct net *net, const struct nft_set *set,int i, start, rules_fx; match_start = data; - match_end = (const u8 *)nft_set_ext_key_end (&e->ext)->data; + +if (nft_set_ext_exists (&e->ext,NFT_SET_EXT_KEY_END )) + match_end = (const u8 *)nft_set_ext_key_end (&e->ext)->data; +else + match_end = data; start = first_rule; rules_fx = rules_f0;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 146/183 netfilter: nf_tables: skip bound chain in netns release path
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 751d460ccff3137212f47d876221534bf0490996 ]
Skip bound chain from netns release path, the rule that owns this chain releases these objects.
--- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nf_tables_api.c +3 -0
@@ -10398,6 +10398,9 @@ static void __nft_release_table(struct net *net, struct nft_table *table) ctx.family = table->family; ctx.table = table;list_for_each_entry (chain, &table->chains, list) { +if (nft_chain_is_bound (chain)) +continue ; + ctx.chain = chain;list_for_each_entry_safe (rule, nr, &chain->rules, list) {list_del (&rule->list);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 147/183 netfilter: nf_tables: skip bound chain on rule flush
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 6eaf41e87a223ae6f8e7a28d6e78384ad7e407f8 ]
Skip bound chain when flushing table rules, the rule that owns this chain releases these objects.
Otherwise, the following warning is triggered:
WARNING: CPU: 2 PID: 1217 at net/netfilter/nf_tables_api.c:2013 nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] CPU: 2 PID: 1217 Comm: chain-flush Not tainted 6.1.39 #1 RIP: 0010:nf_tables_chain_destroy+0x1f7/0x210 [nf_tables]
--- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nf_tables_api.c +2 -0
@@ -3892,6 +3892,8 @@ static int nf_tables_delrule(struct sk_buff *skb, const struct nfnl_info *info,list_for_each_entry (chain, &table->chains, list) {if (!nft_is_active_next (net, chain))continue ; +if (nft_chain_is_bound (chain)) +continue ; ctx.chain = chain; err =nft_delrule_by_chain (&ctx);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 148/183 Bluetooth: use RCU for hci_conn_params and iterate safely in hci_sync
In reply to Greg Kroah-HartmanFrom: Pauli Virtanen <[email protected]>
[ Upstream commit 195ef75e19287b4bc413da3e3e3722b030ac881e ]
hci_update_accept_list_sync iterates over hdev->pend_le_conns and hdev->pend_le_reports, and waits for controller events in the loop body, without holding hdev lock.
Meanwhile, these lists and the items may be modified e.g. by le_scan_cleanup. This can invalidate the list cursor or any other item in the list, resulting to invalid behavior (eg use-after-free).
Use RCU for the hci_conn_params action lists. Since the loop bodies in hci_sync block and we cannot use RCU or hdev->lock for the whole loop, copy list items first and then iterate on the copy. Only the flags field is written from elsewhere, so READ_ONCE/WRITE_ONCE should guarantee we read valid values.
Free params everywhere with hci_conn_params_free so the cleanup is guaranteed to be done properly.
This fixes the following, which can be triggered e.g. by BlueZ new mgmt-tester case "Add + Remove Device Nowait - Success", or by changing hci_le_set_cig_params to always return false, and running iso-tester:
==================================================================
BUG: KASAN: slab-use-after-free in hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841) Read of size 8 at addr ffff888001265018 by task kworker/u3:0/32 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 Workqueue: hci0 hci_cmd_sync_work Call Trace: <TASK> dump_stack_lvl (./arch/x86/include/asm/irqflags.h:134 lib/dump_stack.c:107) print_report (mm/kasan/report.c:320 mm/kasan/report.c:430) ? __virt_addr_valid (./include/linux/mmzone.h:1915 ./include/linux/mmzone.h:2011 arch/x86/mm/physaddr.c:65) ? hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841) kasan_report (mm/kasan/report.c:538) ? hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841) hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2536 net/bluetooth/hci_sync.c:2723 net/bluetooth/hci_sync.c:2841)
? __pfx_hci_update_passive_scan_sync (net/bluetooth/hci_sync.c:2780) ? mutex_lock (kernel/locking/mutex.c:282)
? __pfx_mutex_lock (kernel/locking/mutex.c:282)
? __pfx_mutex_unlock (kernel/locking/mutex.c:538)
? __pfx_update_passive_scan_sync (net/bluetooth/hci_sync.c:2861) hci_cmd_sync_work (net/bluetooth/hci_sync.c:306)
process_one_work (./arch/x86/include/asm/preempt.h:27 kernel/workqueue.c:2399) worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2538)
? __pfx_worker_thread (kernel/workqueue.c:2480)
kthread (kernel/kthread.c:376)
? __pfx_kthread (kernel/kthread.c:331)ret_from_fork (arch/x86/entry/entry_64.S:314)
</TASK> Allocated by task 31: kasan_save_stack (mm/kasan/common.c:46) kasan_set_track (mm/kasan/common.c:52) __kasan_kmalloc (mm/kasan/common.c:374 mm/kasan/common.c:383) hci_conn_params_add (./include/linux/slab.h:580 ./include/linux/slab.h:720 net/bluetooth/hci_core.c:2277) hci_connect_le_scan (net/bluetooth/hci_conn.c:1419 net/bluetooth/hci_conn.c:1589)
hci_connect_cis (net/bluetooth/hci_conn.c:2266) iso_connect_cis (net/bluetooth/iso.c:390)iso_sock_connect (net/bluetooth/iso.c:899)__sys_connect (net/socket.c:2003 net/socket.c:2020) __x64_sys_connect (net/socket.c:2027)do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
Freed by task 15: kasan_save_stack (mm/kasan/common.c:46) kasan_set_track (mm/kasan/common.c:52) kasan_save_free_info (mm/kasan/generic.c:523) __kasan_slab_free (mm/kasan/common.c:238 mm/kasan/common.c:200 mm/kasan/common.c:244) __kmem_cache_free (mm/slub.c:1807 mm/slub.c:3787 mm/slub.c:3800) hci_conn_params_del (net/bluetooth/hci_core.c:2323) le_scan_cleanup (net/bluetooth/hci_conn.c:202) process_one_work (./arch/x86/include/asm/preempt.h:27 kernel/workqueue.c:2399) worker_thread (./include/linux/list.h:292 kernel/workqueue.c:2538)
kthread (kernel/kthread.c:376)ret_from_fork (arch/x86/entry/entry_64.S:314)
==================================================================
--- include/net/bluetooth/hci_core.h | 5 ++ net/bluetooth/hci_conn.c | 10 +-- net/bluetooth/hci_core.c | 38 ++++++++-- net/bluetooth/hci_event.c | 12 ++-- net/bluetooth/hci_sync.c | 117 ++++++++++++++++++++++++++++--- net/bluetooth/mgmt.c | 26 +++---- 6 files changed, 164 insertions(+), 44 deletions(-)
include/net/bluetooth/hci_core.h +5 -0
@@ -807,6 +807,7 @@ struct hci_conn_params {struct hci_conn *conn;bool explicit_connect; +/* Accessed without hdev->lock: */ hci_conn_flags_t flags;u8 privacy_mode; };
@@ -1536,7 +1537,11 @@ struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);void hci_conn_params_del (struct hci_dev *hdev,bdaddr_t *addr,u8 addr_type);void hci_conn_params_clear_disabled (struct hci_dev *hdev); +void hci_conn_params_free (struct hci_conn_params *param); +void hci_pend_le_list_del_init (struct hci_conn_params *param); +void hci_pend_le_list_add (struct hci_conn_params *param, +struct list_head *list);struct hci_conn_params *hci_pend_le_action_lookup (struct list_head *list,bdaddr_t *addr,u8 addr_type);
net/bluetooth/hci_conn.c +5 -5
@@ -117,7 +117,7 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn, u8 status)*/ params->explicit_connect = false; -list_del_init (¶ms->action); +hci_pend_le_list_del_init (params);switch (params->auto_connect) {case HCI_AUTO_CONN_EXPLICIT :
@@ -126,10 +126,10 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn, u8 status)return ;case HCI_AUTO_CONN_DIRECT :case HCI_AUTO_CONN_ALWAYS : -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_add (params, &hdev->pend_le_conns);break ;case HCI_AUTO_CONN_REPORT : -list_add (¶ms->action, &hdev->pend_le_reports); +hci_pend_le_list_add (params, &hdev->pend_le_reports);break ;default :break ;
@@ -1398,8 +1398,8 @@ static int hci_explicit_conn_params_set(struct hci_dev *hdev,if (params->auto_connect ==HCI_AUTO_CONN_DISABLED || params->auto_connect ==HCI_AUTO_CONN_REPORT || params->auto_connect ==HCI_AUTO_CONN_EXPLICIT ) { -list_del_init (¶ms->action); -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_del_init (params); +hci_pend_le_list_add (params, &hdev->pend_le_conns); } params->explicit_connect = true;
net/bluetooth/hci_core.c +31 -7
@@ -2249,21 +2249,45 @@ struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,return NULL ; } -/* This function requires the caller holds hdev->lock */ +/* This function requires the caller holds hdev->lock or rcu_read_lock */ struct hci_conn_params *hci_pend_le_action_lookup (struct list_head *list,bdaddr_t *addr,u8 addr_type) {struct hci_conn_params *param; -list_for_each_entry (param, list, action) { +rcu_read_lock (); + +list_for_each_entry_rcu (param, list, action) {if (bacmp (¶m->addr, addr) ==0 && - param->addr_type == addr_type) + param->addr_type == addr_type) { +rcu_read_unlock ();return param; + } } +rcu_read_unlock (); +return NULL ; } +/* This function requires the caller holds hdev->lock */ +void hci_pend_le_list_del_init (struct hci_conn_params *param) +{ +if (list_empty (¶m->action)) +return ; + +list_del_rcu (¶m->action); +synchronize_rcu (); +INIT_LIST_HEAD (¶m->action); +} + +/* This function requires the caller holds hdev->lock */ +void hci_pend_le_list_add (struct hci_conn_params *param, +struct list_head *list) +{ +list_add_rcu (¶m->action, list); +} +/* This function requires the caller holds hdev->lock */ struct hci_conn_params *hci_conn_params_add (struct hci_dev *hdev,bdaddr_t *addr,u8 addr_type)
@@ -2297,14 +2321,15 @@ struct hci_conn_params *hci_conn_params_add(struct hci_dev *hdev,return params; } -static void hci_conn_params_free (struct hci_conn_params *params) +void hci_conn_params_free (struct hci_conn_params *params) { +hci_pend_le_list_del_init (params); +if (params->conn) {hci_conn_drop (params->conn);hci_conn_put (params->conn); } -list_del (¶ms->action);list_del (¶ms->list);kfree (params); }
@@ -2342,8 +2367,7 @@ void hci_conn_params_clear_disabled(struct hci_dev *hdev)continue ; } -list_del (¶ms->list); -kfree (params); +hci_conn_params_free (params); }BT_DBG ("All LE disabled connection parameters were removed" );
net/bluetooth/hci_event.c +6 -6
@@ -1558,7 +1558,7 @@ static u8 hci_cc_le_set_privacy_mode(struct hci_dev *hdev, void *data, params =hci_conn_params_lookup (hdev, &cp->bdaddr, cp->bdaddr_type);if (params) - params->privacy_mode = cp->mode; +WRITE_ONCE (params->privacy_mode, cp->mode);hci_dev_unlock (hdev);
@@ -2809,8 +2809,8 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)case HCI_AUTO_CONN_DIRECT :case HCI_AUTO_CONN_ALWAYS : -list_del_init (¶ms->action); -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_del_init (params); +hci_pend_le_list_add (params, &hdev->pend_le_conns);break ;default :
@@ -3428,8 +3428,8 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,case HCI_AUTO_CONN_DIRECT :case HCI_AUTO_CONN_ALWAYS : -list_del_init (¶ms->action); -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_del_init (params); +hci_pend_le_list_add (params, &hdev->pend_le_conns);hci_update_passive_scan (hdev);break ;
@@ -5952,7 +5952,7 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, params =hci_pend_le_action_lookup (&hdev->pend_le_conns, &conn->dst, conn->dst_type);if (params) { -list_del_init (¶ms->action); +hci_pend_le_list_del_init (params);if (params->conn) {hci_conn_drop (params->conn);hci_conn_put (params->conn);
net/bluetooth/hci_sync.c +106 -11
205 lines not on this page · raw message
net/bluetooth/mgmt.c +11 -15
@@ -1297,15 +1297,15 @@ static void restart_le_actions(struct hci_dev *hdev)/* Needed for AUTO_OFF case where might not "really" * have been powered off. */ -list_del_init (&p->action); +hci_pend_le_list_del_init (p);switch (p->auto_connect) {case HCI_AUTO_CONN_DIRECT :case HCI_AUTO_CONN_ALWAYS : -list_add (&p->action, &hdev->pend_le_conns); +hci_pend_le_list_add (p, &hdev->pend_le_conns);break ;case HCI_AUTO_CONN_REPORT : -list_add (&p->action, &hdev->pend_le_reports); +hci_pend_le_list_add (p, &hdev->pend_le_reports);break ;default :break ;
@@ -5161,7 +5161,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data, goto unlock; } - params->flags = current_flags; +WRITE_ONCE (params->flags, current_flags); status =MGMT_STATUS_SUCCESS ;/* Update passive scan if HCI_CONN_FLAG_DEVICE_PRIVACY
@@ -7573,7 +7573,7 @@ static int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr,if (params->auto_connect == auto_connect)return 0 ; -list_del_init (¶ms->action); +hci_pend_le_list_del_init (params);switch (auto_connect) {case HCI_AUTO_CONN_DISABLED :
@@ -7582,18 +7582,18 @@ static int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr,* connect to device, keep connecting. */ if (params->explicit_connect) -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_add (params, &hdev->pend_le_conns);break ;case HCI_AUTO_CONN_REPORT :if (params->explicit_connect) -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_add (params, &hdev->pend_le_conns);else -list_add (¶ms->action, &hdev->pend_le_reports); +hci_pend_le_list_add (params, &hdev->pend_le_reports);break ;case HCI_AUTO_CONN_DIRECT :case HCI_AUTO_CONN_ALWAYS :if (!is_connected (hdev, addr, addr_type)) -list_add (¶ms->action, &hdev->pend_le_conns); +hci_pend_le_list_add (params, &hdev->pend_le_conns);break ; }
@@ -7816,9 +7816,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev, goto unlock; } -list_del (¶ms->action); -list_del (¶ms->list); -kfree (params); +hci_conn_params_free (params);device_removed (sk, hdev, &cp->addr.bdaddr, cp->addr.type); }else {
@@ -7849,9 +7847,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev, p->auto_connect =HCI_AUTO_CONN_EXPLICIT ;continue ; } -list_del (&p->action); -list_del (&p->list); -kfree (p); +hci_conn_params_free (p); }bt_dev_dbg (hdev,"All LE connection parameters were removed" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 149/183 Bluetooth: hci_event: call disconnect callback before deleting conn
In reply to Greg Kroah-HartmanFrom: Pauli Virtanen <[email protected]>
[ Upstream commit 7f7cfcb6f0825652973b780f248603e23f16ee90 ]
In hci_cs_disconnect, we do hci_conn_del even if disconnection failed.
ISO, L2CAP and SCO connections refer to the hci_conn without hci_conn_get, so disconn_cfm must be called so they can clean up their conn, otherwise use-after-free occurs.
ISO:
==========================================================
iso_sock_connect:880: sk 00000000eabd6557 iso_connect_cis:356: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da
...
iso_conn_add:140: hcon 000000001696f1fd conn 00000000b6251073 hci_dev_put:1487: hci0 orig refcnt 17 __iso_chan_add:214: conn 00000000b6251073 iso_sock_clear_timer:117: sock 00000000eabd6557 state 3
...
hci_rx_work:4085: hci0 Event packet hci_event_packet:7601: hci0: event 0x0f hci_cmd_status_evt:4346: hci0: opcode 0x0406 hci_cs_disconnect:2760: hci0: status 0x0c hci_sent_cmd_data:3107: hci0 opcode 0x0406 hci_conn_del:1151: hci0 hcon 000000001696f1fd handle 2560 hci_conn_unlink:1102: hci0: hcon 000000001696f1fd hci_conn_drop:1451: hcon 00000000d8521aaf orig refcnt 2 hci_chan_list_flush:2780: hcon 000000001696f1fd hci_dev_put:1487: hci0 orig refcnt 21
hci_dev_put:1487: hci0 orig refcnt 20 hci_req_cmd_complete:3978: opcode 0x0406 status 0x0c ... <no iso_* activity on sk/conn> ... iso_sock_sendmsg:1098: sock 00000000dea5e2e0, sk 00000000eabd6557
BUG: kernel NULL pointer dereference, address: 0000000000000668 PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 RIP: 0010:iso_sock_sendmsg (net/bluetooth/iso.c:1112) bluetooth ==========================================================
L2CAP:
==================================================================
hci_cmd_status_evt:4359: hci0: opcode 0x0406 hci_cs_disconnect:2760: hci0: status 0x0c hci_sent_cmd_data:3085: hci0 opcode 0x0406 hci_conn_del:1151: hci0 hcon ffff88800c999000 handle 3585 hci_conn_unlink:1102: hci0: hcon ffff88800c999000 hci_chan_list_flush:2780: hcon ffff88800c999000 hci_chan_del:2761: hci0 hcon ffff88800c999000 chan ffff888018ddd280
...
BUG: KASAN: slab-use-after-free in hci_send_acl+0x2d/0x540 [bluetooth] Read of size 8 at addr ffff888018ddd298 by task bluetoothd/1175 CPU: 0 PID: 1175 Comm: bluetoothd Tainted: G E 6.4.0-rc4+ #2 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x5b/0x90 print_report+0xcf/0x670 ? __virt_addr_valid+0xf8/0x180 ? hci_send_acl+0x2d/0x540 [bluetooth] kasan_report+0xa8/0xe0 ? hci_send_acl+0x2d/0x540 [bluetooth] hci_send_acl+0x2d/0x540 [bluetooth] ? __pfx___lock_acquire+0x10/0x10 l2cap_chan_send+0x1fd/0x1300 [bluetooth] ? l2cap_sock_sendmsg+0xf2/0x170 [bluetooth] ? __pfx_l2cap_chan_send+0x10/0x10 [bluetooth] ? lock_release+0x1d5/0x3c0 ? mark_held_locks+0x1a/0x90 l2cap_sock_sendmsg+0x100/0x170 [bluetooth] sock_write_iter+0x275/0x280 ? __pfx_sock_write_iter+0x10/0x10 ? __pfx___lock_acquire+0x10/0x10 do_iter_readv_writev+0x176/0x220 ? __pfx_do_iter_readv_writev+0x10/0x10 ? find_held_lock+0x83/0xa0 ? selinux_file_permission+0x13e/0x210 do_iter_write+0xda/0x340 vfs_writev+0x1b4/0x400 ? __pfx_vfs_writev+0x10/0x10 ? __seccomp_filter+0x112/0x750 ? populate_seccomp_data+0x182/0x220 ? __fget_light+0xdf/0x100 ? do_writev+0x19d/0x210 do_writev+0x19d/0x210 ? __pfx_do_writev+0x10/0x10 ? mark_held_locks+0x1a/0x90 do_syscall_64+0x60/0x90 ? lockdep_hardirqs_on_prepare+0x149/0x210 ? do_syscall_64+0x6c/0x90 ? lockdep_hardirqs_on_prepare+0x149/0x210 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7ff45cb23e64 Code: 15 d1 1f 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 80 3d 9d a7 0d 00 00 74 13 b8 14 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 48 83 ec 28 89 54 24 1c 48 89 RSP: 002b:00007fff21ae09b8 EFLAGS: 00000202 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007ff45cb23e64 RDX: 0000000000000001 RSI: 00007fff21ae0aa0 RDI: 0000000000000017 RBP: 00007fff21ae0aa0 R08: 000000000095a8a0 R09: 0000607000053f40 R10: 0000000000000001 R11: 0000000000000202 R12: 00007fff21ae0ac0 R13: 00000fffe435c150 R14: 00007fff21ae0a80 R15: 000060f000000040 </TASK> Allocated by task 771: kasan_save_stack+0x33/0x60 kasan_set_track+0x25/0x30 __kasan_kmalloc+0xaa/0xb0 hci_chan_create+0x67/0x1b0 [bluetooth] l2cap_conn_add.part.0+0x17/0x590 [bluetooth] l2cap_connect_cfm+0x266/0x6b0 [bluetooth] hci_le_remote_feat_complete_evt+0x167/0x310 [bluetooth] hci_event_packet+0x38d/0x800 [bluetooth] hci_rx_work+0x287/0xb20 [bluetooth] process_one_work+0x4f7/0x970 worker_thread+0x8f/0x620 kthread+0x17f/0x1c0 ret_from_fork+0x2c/0x50 Freed by task 771: kasan_save_stack+0x33/0x60 kasan_set_track+0x25/0x30 kasan_save_free_info+0x2e/0x50 ____kasan_slab_free+0x169/0x1c0 slab_free_freelist_hook+0x9e/0x1c0 __kmem_cache_free+0xc0/0x310 hci_chan_list_flush+0x46/0x90 [bluetooth] hci_conn_cleanup+0x7d/0x330 [bluetooth] hci_cs_disconnect+0x35d/0x530 [bluetooth] hci_cmd_status_evt+0xef/0x2b0 [bluetooth] hci_event_packet+0x38d/0x800 [bluetooth] hci_rx_work+0x287/0xb20 [bluetooth] process_one_work+0x4f7/0x970 worker_thread+0x8f/0x620 kthread+0x17f/0x1c0 ret_from_fork+0x2c/0x50 ==================================================================
--- net/bluetooth/hci_event.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/hci_event.c +3 -0
@@ -2789,6 +2789,9 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)hci_enable_advertising (hdev); } +/* Inform sockets conn is gone before we delete it */ +hci_disconn_cfm (conn,HCI_ERROR_UNSPECIFIED ); + goto done; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 150/183 Bluetooth: ISO: fix iso_conn related locking and validity issues
In reply to Greg Kroah-HartmanFrom: Pauli Virtanen <[email protected]>
[ Upstream commit d40ae85ee62e3666f45bc61864b22121346f88ef ]
sk->sk_state indicates whether iso_pi(sk)->conn is valid. Operations that check/update sk_state and access conn should hold lock_sock, otherwise they can race.
The order of taking locks is hci_dev_lock > lock_sock > iso_conn_lock, which is how it is in connect/disconnect_cfm -> iso_conn_del -> iso_chan_del.
Fix locking in iso_connect_cis/bis and sendmsg/recvmsg to take lock_sock around updating sk_state and conn.
iso_conn_del must not occur during iso_connect_cis/bis, as it frees the iso_conn. Hold hdev->lock longer to prevent that.
This should not reintroduce the issue fixed in commit 241f51931c35 ("Bluetooth: ISO: Avoid circular locking dependency"), since the we acquire locks in order. We retain the fix in iso_sock_connect to release lock_sock before iso_connect_* acquires hdev->lock.
Similarly for commit 6a5ad251b7cd ("Bluetooth: ISO: Fix possible circular locking dependency"). We retain the fix in iso_conn_ready to not acquire iso_conn_lock before lock_sock.
iso_conn_add shall return iso_conn with valid hcon. Make it so also when reusing an old CIS connection waiting for disconnect timeout (see __iso_sock_close where conn->hcon is set to NULL).
Trace with iso_conn_del after iso_chan_add in iso_connect_cis:
===============================================================
iso_sock_create:771: sock 00000000be9b69b7
iso_sock_init:693: sk 000000004dff667e
iso_sock_bind:827: sk 000000004dff667e 70:1a:b8:98:ff:a2 type 1 iso_sock_setsockopt:1289: sk 000000004dff667e iso_sock_setsockopt:1289: sk 000000004dff667e iso_sock_setsockopt:1289: sk 000000004dff667e iso_sock_connect:875: sk 000000004dff667e
iso_connect_cis:353: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da hci_get_route:1199: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da hci_conn_add:1005: hci0 dst 28:3d:c2:4a:7e:da
iso_conn_add:140: hcon 000000007b65d182 conn 00000000daf8625e __iso_chan_add:214: conn 00000000daf8625e
iso_connect_cfm:1700: hcon 000000007b65d182 bdaddr 28:3d:c2:4a:7e:da status 12 iso_conn_del:187: hcon 000000007b65d182 conn 00000000daf8625e, err 16 iso_sock_clear_timer:117: sock 000000004dff667e state 3
<Note: sk_state is BT_BOUND (3), so iso_connect_cis is still running at this point>
iso_chan_del:153: sk 000000004dff667e, conn 00000000daf8625e, err 16 hci_conn_del:1151: hci0 hcon 000000007b65d182 handle 65535 hci_conn_unlink:1102: hci0: hcon 000000007b65d182 hci_chan_list_flush:2780: hcon 000000007b65d182 iso_sock_getsockopt:1376: sk 000000004dff667e iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e iso_sock_getsockopt:1376: sk 000000004dff667e iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e iso_sock_getname:1070: sock 00000000be9b69b7, sk 000000004dff667e iso_sock_shutdown:1434: sock 00000000be9b69b7, sk 000000004dff667e, how 1 __iso_sock_close:632: sk 000000004dff667e state 5 socket 00000000be9b69b7
<Note: sk_state is BT_CONNECT (5), even though iso_chan_del sets BT_CLOSED (6). Only iso_connect_cis sets it to BT_CONNECT, so it must be that iso_chan_del occurred between iso_chan_add and end of iso_connect_cis.>
BUG: kernel NULL pointer dereference, address: 0000000000000000 PGD 8000000006467067 P4D 8000000006467067 PUD 3f5f067 PMD 0 Oops: 0000 [#1] PREEMPT SMP PTI Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 RIP: 0010:__iso_sock_close (net/bluetooth/iso.c:664) bluetooth ===============================================================
Trace with iso_conn_del before iso_chan_add in iso_connect_cis:
===============================================================
iso_connect_cis:356: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7e:da
...
iso_conn_add:140: hcon 0000000093bc551f conn 00000000768ae504 hci_dev_put:1487: hci0 orig refcnt 21
hci_event_packet:7607: hci0: event 0x0e hci_cmd_complete_evt:4231: hci0: opcode 0x2062 hci_cc_le_set_cig_params:3846: hci0: status 0x07 hci_sent_cmd_data:3107: hci0 opcode 0x2062
iso_connect_cfm:1703: hcon 0000000093bc551f bdaddr 28:3d:c2:4a:7e:da status 7 iso_conn_del:187: hcon 0000000093bc551f conn 00000000768ae504, err 12 hci_conn_del:1151: hci0 hcon 0000000093bc551f handle 65535 hci_conn_unlink:1102: hci0: hcon 0000000093bc551f hci_chan_list_flush:2780: hcon 0000000093bc551f __iso_chan_add:214: conn 00000000768ae504
<Note: this conn was already freed in iso_conn_del above>
iso_sock_clear_timer:117: sock 0000000098323f95 state 3
general protection fault, probably for non-canonical address 0x30b29c630930aec8: 0000 [#1] PREEMPT SMP PTI CPU: 1 PID: 1920 Comm: bluetoothd Tainted: G E 6.3.0-rc7+ #4 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 RIP: 0010:detach_if_pending+0x28/0xd0 Code: 90 90 0f 1f 44 00 00 48 8b 47 08 48 85 c0 0f 84 ad 00 00 00 55 89 d5 53 48 83 3f 00 48 89 fb 74 7d 66 90 48 8b 03 48 8b 53 08 <> RSP: 0018:ffffb90841a67d08 EFLAGS: 00010007 RAX: 0000000000000000 RBX: ffff9141bd5061b8 RCX: 0000000000000000 RDX: 30b29c630930aec8 RSI: ffff9141fdd21e80 RDI: ffff9141bd5061b8 RBP: 0000000000000001 R08: 0000000000000000 R09: ffffb90841a67b88 R10: 0000000000000003 R11: ffffffff8613f558 R12: ffff9141fdd21e80 R13: 0000000000000000 R14: ffff9141b5976010 R15: ffff914185755338 FS: 00007f45768bd840(0000) GS:ffff9141fdd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000619000424074 CR3: 0000000009f5e005 CR4: 0000000000170ee0 Call Trace: <TASK> timer_delete+0x48/0x80 try_to_grab_pending+0xdf/0x170 __cancel_work+0x37/0xb0 iso_connect_cis+0x141/0x400 [bluetooth] ===============================================================
Trace with NULL conn->hcon in state BT_CONNECT:
===============================================================
__iso_sock_close:619: sk 00000000f7c71fc5 state 1 socket 00000000d90c5fe5
...
__iso_sock_close:619: sk 00000000f7c71fc5 state 8 socket 00000000d90c5fe5 iso_chan_del:153: sk 00000000f7c71fc5, conn 0000000022c03a7e, err 104
...
iso_sock_connect:862: sk 00000000129b56c3 iso_connect_cis:348: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7d:2a hci_get_route:1199: 70:1a:b8:98:ff:a2 -> 28:3d:c2:4a:7d:2a hci_dev_hold:1495: hci0 orig refcnt 19
__iso_chan_add:214: conn 0000000022c03a7e
<Note: reusing old conn>
iso_sock_clear_timer:117: sock 00000000129b56c3 state 3
...
iso_sock_ready:1485: sk 00000000129b56c3
...
iso_sock_sendmsg:1077: sock 00000000e5013966, sk 00000000129b56c3
BUG: kernel NULL pointer dereference, address: 00000000000006a8 PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 1 PID: 1403 Comm: wireplumber Tainted: G E 6.3.0-rc7+ #4 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-1.fc38 04/01/2014 RIP: 0010:iso_sock_sendmsg+0x63/0x2a0 [bluetooth] ===============================================================
--- net/bluetooth/iso.c | 53 ++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 22 deletions(-)
net/bluetooth/iso.c +31 -22
@@ -116,8 +116,11 @@ static struct iso_conn *iso_conn_add(struct hci_conn *hcon) {struct iso_conn *conn = hcon->iso_data; -if (conn) +if (conn) { +if (!conn->hcon) + conn->hcon = hcon;return conn; + } conn =kzalloc (sizeof (*conn),GFP_KERNEL );if (!conn)
@@ -285,14 +288,13 @@ static int iso_connect_bis(struct sock *sk) goto unlock; } -hci_dev_unlock (hdev); -hci_dev_put (hdev); +lock_sock (sk); err =iso_chan_add (conn, sk,NULL ); -if (err) -return err; - -lock_sock (sk); +if (err) { +release_sock (sk); + goto unlock; + }/* Update source addr of the socket */ bacpy (&iso_pi (sk)->src, &hcon->src);
@@ -306,7 +308,6 @@ static int iso_connect_bis(struct sock *sk) }release_sock (sk); -return err; unlock:hci_dev_unlock (hdev);
@@ -367,14 +368,13 @@ static int iso_connect_cis(struct sock *sk) goto unlock; } -hci_dev_unlock (hdev); -hci_dev_put (hdev); +lock_sock (sk); err =iso_chan_add (conn, sk,NULL ); -if (err) -return err; - -lock_sock (sk); +if (err) { +release_sock (sk); + goto unlock; + }/* Update source addr of the socket */ bacpy (&iso_pi (sk)->src, &hcon->src);
@@ -391,7 +391,6 @@ static int iso_connect_cis(struct sock *sk) }release_sock (sk); -return err; unlock:hci_dev_unlock (hdev);
@@ -1036,8 +1035,8 @@ static int iso_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) {struct sock *sk = sock->sk; -struct iso_conn *conn =iso_pi (sk)->conn;struct sk_buff *skb, **frag; +size_t mtu;int err;BT_DBG ("sock %p, sk %p" , sock, sk);
@@ -1049,11 +1048,18 @@ static int iso_sock_sendmsg(struct socket *sock, struct msghdr *msg,if (msg->msg_flags &MSG_OOB )return -EOPNOTSUPP ; -if (sk->sk_state !=BT_CONNECTED ) +lock_sock (sk); + +if (sk->sk_state !=BT_CONNECTED ) { +release_sock (sk);return -ENOTCONN ; + } + + mtu =iso_pi (sk)->conn->hcon->hdev->iso_mtu; + +release_sock (sk); - skb =bt_skb_sendmsg (sk, msg, len, conn->hcon->hdev->iso_mtu, -HCI_ISO_DATA_HDR_SIZE ,0 ); + skb =bt_skb_sendmsg (sk, msg, len, mtu,HCI_ISO_DATA_HDR_SIZE ,0 );if (IS_ERR (skb))return PTR_ERR (skb);
@@ -1066,8 +1072,7 @@ static int iso_sock_sendmsg(struct socket *sock, struct msghdr *msg,while (len) {struct sk_buff *tmp; - tmp =bt_skb_sendmsg (sk, msg, len, conn->hcon->hdev->iso_mtu, -0 ,0 ); + tmp =bt_skb_sendmsg (sk, msg, len, mtu,0 ,0 );if (IS_ERR (tmp)) {kfree_skb (skb);return PTR_ERR (tmp);
@@ -1122,15 +1127,19 @@ static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,BT_DBG ("sk %p" , sk);if (test_and_clear_bit (BT_SK_DEFER_SETUP , &bt_sk (sk)->flags)) { +lock_sock (sk);switch (sk->sk_state) {case BT_CONNECT2 : -lock_sock (sk);iso_conn_defer_accept (pi->conn->hcon); sk->sk_state =BT_CONFIG ;release_sock (sk);return 0 ;case BT_CONNECT : +release_sock (sk);return iso_connect_cis (sk); +default : +release_sock (sk); +break ; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 151/183 Bluetooth: hci_sync: Avoid use-after-free in dbg for hci_remove_adv_monitor()
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit de6dfcefd107667ce2dbedf4d9337f5ed557a4a1 ]
KASAN reports that there's a use-after-free in hci_remove_adv_monitor(). Trawling through the disassembly, you can see that the complaint is from the access in bt_dev_dbg() under the HCI_ADV_MONITOR_EXT_MSFT case. The problem case happens because msft_remove_monitor() can end up freeing the monitor structure. Specifically:
hci_remove_adv_monitor() ->
msft_remove_monitor() ->
msft_remove_monitor_sync() -> msft_le_cancel_monitor_advertisement_cb() -> hci_free_adv_monitor()
Let's fix the problem by just stashing the relevant data when it's still valid.
--- net/bluetooth/hci_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/hci_core.c +3 -1
@@ -1972,6 +1972,7 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor) {int status =0 ; +int handle;switch (hci_get_adv_monitor_offload_ext (hdev)) {case HCI_ADV_MONITOR_EXT_NONE :/* also goes here when powered off */
@@ -1980,9 +1981,10 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev, goto free_monitor;case HCI_ADV_MONITOR_EXT_MSFT : + handle = monitor->handle; status =msft_remove_monitor (hdev, monitor);bt_dev_dbg (hdev,"%s remove monitor %d msft status %d" , - hdev->name, monitor->handle, status); + hdev->name, handle, status);break ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 152/183 tcp: annotate data-races around tp->tcp_tx_delay
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 348b81b68b13ebd489a3e6a46aa1c384c731c919 ]
do_tcp_getsockopt() reads tp->tcp_tx_delay while another cpu might change its value.
--- net/ipv4/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +2 -2
@@ -3780,7 +3780,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,case TCP_TX_DELAY :if (val)tcp_enable_tx_delay (); - tp->tcp_tx_delay = val; +WRITE_ONCE (tp->tcp_tx_delay, val);break ;default : err = -ENOPROTOOPT ;
@@ -4256,7 +4256,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,break ;case TCP_TX_DELAY : - val = tp->tcp_tx_delay; + val =READ_ONCE (tp->tcp_tx_delay);break ;case TCP_TIMESTAMP :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 153/183 tcp: annotate data-races around tp->tsoffset
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit dd23c9f1e8d5c1d2e3d29393412385ccb9c7a948 ]
do_tcp_getsockopt() reads tp->tsoffset while another cpu might change its value.
--- net/ipv4/tcp.c | 4 ++-- net/ipv4/tcp_ipv4.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +2 -2
@@ -3762,7 +3762,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,if (!tp->repair) err = -EPERM ;else - tp->tsoffset = val -tcp_time_stamp_raw (); +WRITE_ONCE (tp->tsoffset, val -tcp_time_stamp_raw ());break ;case TCP_REPAIR_WINDOW : err =tcp_repair_set_window (tp, optval, optlen);
@@ -4260,7 +4260,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,break ;case TCP_TIMESTAMP : - val =tcp_time_stamp_raw () + tp->tsoffset; + val =tcp_time_stamp_raw () +READ_ONCE (tp->tsoffset);break ;case TCP_NOTSENT_LOWAT : val = tp->notsent_lowat;
net/ipv4/tcp_ipv4.c +3 -2
@@ -307,8 +307,9 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) inet->inet_daddr, inet->inet_sport, usin->sin_port)); - tp->tsoffset =secure_tcp_ts_off (net, inet->inet_saddr, - inet->inet_daddr); +WRITE_ONCE (tp->tsoffset, +secure_tcp_ts_off (net, inet->inet_saddr, + inet->inet_daddr)); } inet->inet_id =get_random_u16 ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 154/183 tcp: annotate data-races around tp->keepalive_time
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 4164245c76ff906c9086758e1c3f87082a7f5ef5 ]
do_tcp_getsockopt() reads tp->keepalive_time while another cpu might change its value.
--- include/net/tcp.h | 7 +++++-- net/ipv4/tcp.c | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-)
include/net/tcp.h +5 -2
@@ -1519,9 +1519,12 @@ static inline int keepalive_intvl_when(const struct tcp_sock *tp)static inline int keepalive_time_when (const struct tcp_sock *tp) {struct net *net =sock_net ((struct sock *)tp); +int val; -return tp->keepalive_time ? : -READ_ONCE (net->ipv4.sysctl_tcp_keepalive_time); +/* Paired with WRITE_ONCE() in tcp_sock_set_keepidle_locked() */ + val =READ_ONCE (tp->keepalive_time); + +return val ? :READ_ONCE (net->ipv4.sysctl_tcp_keepalive_time); }static inline int keepalive_probes (const struct tcp_sock *tp)
net/ipv4/tcp.c +2 -1
@@ -3418,7 +3418,8 @@ int tcp_sock_set_keepidle_locked(struct sock *sk, int val)if (val <1 || val >MAX_TCP_KEEPIDLE )return -EINVAL ; - tp->keepalive_time = val *HZ ; +/* Paired with WRITE_ONCE() in keepalive_time_when() */ +WRITE_ONCE (tp->keepalive_time, val *HZ );if (sock_flag (sk,SOCK_KEEPOPEN ) && !((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN ))) {u32 elapsed =keepalive_time_elapsed (tp);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 155/183 tcp: annotate data-races around tp->keepalive_intvl
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5ecf9d4f52ff2f1d4d44c9b68bc75688e82f13b4 ]
do_tcp_getsockopt() reads tp->keepalive_intvl while another cpu might change its value.
--- include/net/tcp.h | 9 +++++++-- net/ipv4/tcp.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-)
include/net/tcp.h +7 -2
@@ -1511,9 +1511,14 @@ void tcp_leave_memory_pressure(struct sock *sk);static inline int keepalive_intvl_when (const struct tcp_sock *tp) {struct net *net =sock_net ((struct sock *)tp); +int val; + +/* Paired with WRITE_ONCE() in tcp_sock_set_keepintvl() +* and do_tcp_setsockopt(). +*/ + val =READ_ONCE (tp->keepalive_intvl); -return tp->keepalive_intvl ? : -READ_ONCE (net->ipv4.sysctl_tcp_keepalive_intvl); +return val ? :READ_ONCE (net->ipv4.sysctl_tcp_keepalive_intvl); }static inline int keepalive_time_when (const struct tcp_sock *tp)
net/ipv4/tcp.c +2 -2
@@ -3451,7 +3451,7 @@ int tcp_sock_set_keepintvl(struct sock *sk, int val)return -EINVAL ;lock_sock (sk); -tcp_sk (sk)->keepalive_intvl = val *HZ ; +WRITE_ONCE (tcp_sk (sk)->keepalive_intvl, val *HZ );release_sock (sk);return 0 ; }
@@ -3665,7 +3665,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,if (val <1 || val >MAX_TCP_KEEPINTVL ) err = -EINVAL ;else - tp->keepalive_intvl = val *HZ ; +WRITE_ONCE (tp->keepalive_intvl, val *HZ );break ;case TCP_KEEPCNT :if (val <1 || val >MAX_TCP_KEEPCNT )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 156/183 tcp: annotate data-races around tp->keepalive_probes
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6e5e1de616bf5f3df1769abc9292191dfad9110a ]
do_tcp_getsockopt() reads tp->keepalive_probes while another cpu might change its value.
--- include/net/tcp.h | 9 +++++++-- net/ipv4/tcp.c | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-)
include/net/tcp.h +7 -2
@@ -1535,9 +1535,14 @@ static inline int keepalive_time_when(const struct tcp_sock *tp)static inline int keepalive_probes (const struct tcp_sock *tp) {struct net *net =sock_net ((struct sock *)tp); +int val; + +/* Paired with WRITE_ONCE() in tcp_sock_set_keepcnt() +* and do_tcp_setsockopt(). +*/ + val =READ_ONCE (tp->keepalive_probes); -return tp->keepalive_probes ? : -READ_ONCE (net->ipv4.sysctl_tcp_keepalive_probes); +return val ? :READ_ONCE (net->ipv4.sysctl_tcp_keepalive_probes); }static inline u32 keepalive_time_elapsed (const struct tcp_sock *tp)
net/ipv4/tcp.c +3 -2
@@ -3463,7 +3463,8 @@ int tcp_sock_set_keepcnt(struct sock *sk, int val)return -EINVAL ;lock_sock (sk); -tcp_sk (sk)->keepalive_probes = val; +/* Paired with READ_ONCE() in keepalive_probes() */ +WRITE_ONCE (tcp_sk (sk)->keepalive_probes, val);release_sock (sk);return 0 ; }
@@ -3671,7 +3672,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,if (val <1 || val >MAX_TCP_KEEPCNT ) err = -EINVAL ;else - tp->keepalive_probes = val; +WRITE_ONCE (tp->keepalive_probes, val);break ;case TCP_SYNCNT :if (val <1 || val >MAX_TCP_SYNCNT )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 157/183 tcp: annotate data-races around icsk->icsk_syn_retries
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 3a037f0f3c4bfe44518f2fbb478aa2f99a9cd8bb ]
do_tcp_getsockopt() and reqsk_timer_handler() read icsk->icsk_syn_retries while another cpu might change its value.
--- net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/tcp.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/inet_connection_sock.c +1 -1
@@ -1016,7 +1016,7 @@ static void reqsk_timer_handler(struct timer_list *t) icsk =inet_csk (sk_listener); net =sock_net (sk_listener); - max_syn_ack_retries = icsk->icsk_syn_retries ? : + max_syn_ack_retries =READ_ONCE (icsk->icsk_syn_retries) ? :READ_ONCE (net->ipv4.sysctl_tcp_synack_retries);/* Normally all the openreqs are young and become mature * (i.e. converted to established socket) for first timeout.
net/ipv4/tcp.c +3 -3
@@ -3397,7 +3397,7 @@ int tcp_sock_set_syncnt(struct sock *sk, int val)return -EINVAL ;lock_sock (sk); -inet_csk (sk)->icsk_syn_retries = val; +WRITE_ONCE (inet_csk (sk)->icsk_syn_retries, val);release_sock (sk);return 0 ; }
@@ -3678,7 +3678,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,if (val <1 || val >MAX_TCP_SYNCNT ) err = -EINVAL ;else - icsk->icsk_syn_retries = val; +WRITE_ONCE (icsk->icsk_syn_retries, val);break ;case TCP_SAVE_SYN :
@@ -4095,7 +4095,7 @@ int do_tcp_getsockopt(struct sock *sk, int level, val =keepalive_probes (tp);break ;case TCP_SYNCNT : - val = icsk->icsk_syn_retries ? : + val =READ_ONCE (icsk->icsk_syn_retries) ? :READ_ONCE (net->ipv4.sysctl_tcp_syn_retries);break ;case TCP_LINGER2 :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 158/183 tcp: annotate data-races around tp->linger2
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 9df5335ca974e688389c875546e5819778a80d59 ]
do_tcp_getsockopt() reads tp->linger2 while another cpu might change its value.
--- net/ipv4/tcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +4 -4
@@ -3691,11 +3691,11 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,case TCP_LINGER2 :if (val <0 ) - tp->linger2 =-1 ; +WRITE_ONCE (tp->linger2,-1 );else if (val >TCP_FIN_TIMEOUT_MAX /HZ ) - tp->linger2 =TCP_FIN_TIMEOUT_MAX ; +WRITE_ONCE (tp->linger2,TCP_FIN_TIMEOUT_MAX );else - tp->linger2 = val *HZ ; +WRITE_ONCE (tp->linger2, val *HZ );break ;case TCP_DEFER_ACCEPT :
@@ -4099,7 +4099,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,READ_ONCE (net->ipv4.sysctl_tcp_syn_retries);break ;case TCP_LINGER2 : - val = tp->linger2; + val =READ_ONCE (tp->linger2);if (val >=0 ) val = (val ? :READ_ONCE (net->ipv4.sysctl_tcp_fin_timeout)) /HZ ;break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 159/183 tcp: annotate data-races around rskq_defer_accept
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ae488c74422fb1dcd807c0201804b3b5e8a322a3 ]
do_tcp_getsockopt() reads rskq_defer_accept while another cpu might change its value.
--- net/ipv4/tcp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv4/tcp.c +6 -5
@@ -3700,9 +3700,9 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,case TCP_DEFER_ACCEPT :/* Translate value in seconds to number of retransmits */ - icsk->icsk_accept_queue.rskq_defer_accept = -secs_to_retrans (val,TCP_TIMEOUT_INIT /HZ , -TCP_RTO_MAX /HZ ); +WRITE_ONCE (icsk->icsk_accept_queue.rskq_defer_accept, +secs_to_retrans (val,TCP_TIMEOUT_INIT /HZ , +TCP_RTO_MAX /HZ ));break ;case TCP_WINDOW_CLAMP :
@@ -4104,8 +4104,9 @@ int do_tcp_getsockopt(struct sock *sk, int level, val = (val ? :READ_ONCE (net->ipv4.sysctl_tcp_fin_timeout)) /HZ ;break ;case TCP_DEFER_ACCEPT : - val =retrans_to_secs (icsk->icsk_accept_queue.rskq_defer_accept, -TCP_TIMEOUT_INIT /HZ ,TCP_RTO_MAX /HZ ); + val =READ_ONCE (icsk->icsk_accept_queue.rskq_defer_accept); + val =retrans_to_secs (val,TCP_TIMEOUT_INIT /HZ , +TCP_RTO_MAX /HZ );break ;case TCP_WINDOW_CLAMP : val = tp->window_clamp;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 160/183 tcp: annotate data-races around tp->notsent_lowat
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b ]
tp->notsent_lowat can be read locklessly from do_tcp_getsockopt() and tcp_poll().
--- include/net/tcp.h | 6 +++++- net/ipv4/tcp.c | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-)
include/net/tcp.h +5 -1
@@ -2059,7 +2059,11 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);static inline u32 tcp_notsent_lowat (const struct tcp_sock *tp) {struct net *net =sock_net ((struct sock *)tp); -return tp->notsent_lowat ?:READ_ONCE (net->ipv4.sysctl_tcp_notsent_lowat); +u32 val; + + val =READ_ONCE (tp->notsent_lowat); + +return val ?:READ_ONCE (net->ipv4.sysctl_tcp_notsent_lowat); }bool tcp_stream_memory_free (const struct sock *sk,int wake);
net/ipv4/tcp.c +2 -2
@@ -3770,7 +3770,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname, err =tcp_repair_set_window (tp, optval, optlen);break ;case TCP_NOTSENT_LOWAT : - tp->notsent_lowat = val; +WRITE_ONCE (tp->notsent_lowat, val); sk->sk_write_space (sk);break ;case TCP_INQ :
@@ -4266,7 +4266,7 @@ int do_tcp_getsockopt(struct sock *sk, int level, val =tcp_time_stamp_raw () +READ_ONCE (tp->tsoffset);break ;case TCP_NOTSENT_LOWAT : - val = tp->notsent_lowat; + val =READ_ONCE (tp->notsent_lowat);break ;case TCP_INQ : val = tp->recvmsg_inq;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 161/183 tcp: annotate data-races around icsk->icsk_user_timeout
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 26023e91e12c68669db416b97234328a03d8e499 ]
This field can be read locklessly from do_tcp_getsockopt()
--- net/ipv4/tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/tcp.c +3 -3
@@ -3406,7 +3406,7 @@ EXPORT_SYMBOL(tcp_sock_set_syncnt);void tcp_sock_set_user_timeout (struct sock *sk,u32 val) {lock_sock (sk); -inet_csk (sk)->icsk_user_timeout = val; +WRITE_ONCE (inet_csk (sk)->icsk_user_timeout, val);release_sock (sk); }EXPORT_SYMBOL (tcp_sock_set_user_timeout);
@@ -3726,7 +3726,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,if (val <0 ) err = -EINVAL ;else - icsk->icsk_user_timeout = val; +WRITE_ONCE (icsk->icsk_user_timeout, val);break ;case TCP_FASTOPEN :
@@ -4243,7 +4243,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,break ;case TCP_USER_TIMEOUT : - val = icsk->icsk_user_timeout; + val =READ_ONCE (icsk->icsk_user_timeout);break ;case TCP_FASTOPEN :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 162/183 tcp: annotate data-races around fastopenq.max_qlen
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 70f360dd7042cb843635ece9d28335a4addff9eb ]
This field can be read locklessly.
--- include/linux/tcp.h | 2 +- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_fastopen.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-)
include/linux/tcp.h +1 -1
@@ -510,7 +510,7 @@ static inline void fastopen_queue_tune(struct sock *sk, int backlog)struct request_sock_queue *queue = &inet_csk (sk)->icsk_accept_queue;int somaxconn =READ_ONCE (sock_net (sk)->core.sysctl_somaxconn); - queue->fastopenq.max_qlen = min_t(unsigned int, backlog, somaxconn); + WRITE_ONCE(queue->fastopenq.max_qlen, min_t(unsigned int, backlog, somaxconn)); } static inline void tcp_move_syn(struct tcp_sock *tp,
net/ipv4/tcp.c +1 -1
@@ -4247,7 +4247,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,break ;case TCP_FASTOPEN : - val = icsk->icsk_accept_queue.fastopenq.max_qlen; + val =READ_ONCE (icsk->icsk_accept_queue.fastopenq.max_qlen);break ;case TCP_FASTOPEN_CONNECT :
net/ipv4/tcp_fastopen.c +4 -2
@@ -296,6 +296,7 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,static bool tcp_fastopen_queue_check (struct sock *sk) {struct fastopen_queue *fastopenq; +int max_qlen;/* Make sure the listener has enabled fastopen, and we don't * exceed the max # of pending TFO requests allowed before trying
@@ -308,10 +309,11 @@ static bool tcp_fastopen_queue_check(struct sock *sk)* temporarily vs a server not supporting Fast Open at all. */ fastopenq = &inet_csk (sk)->icsk_accept_queue.fastopenq; -if (fastopenq->max_qlen ==0 ) + max_qlen =READ_ONCE (fastopenq->max_qlen); +if (max_qlen ==0 )return false; -if (fastopenq->qlen >= fastopenq->max_qlen) { +if (fastopenq->qlen >= max_qlen) {struct request_sock *req1;spin_lock (&fastopenq->lock); req1 = fastopenq->rskq_rst_head;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 163/183 net: phy: prevent stale pointer dereference in phy_init()
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 1c613beaf877c0c0d755853dc62687e2013e55c4 ]
mdio_bus_init() and phy_driver_register() both have error paths, and if those are ever hit, ethtool will have a stale pointer to the phy_ethtool_phy_ops stub structure, which references memory from a module that failed to load (phylib).
It is probably hard to force an error in this code path even manually, but the error teardown path of phy_init() should be the same as phy_exit(), which is now simply not the case.
--- drivers/net/phy/phy_device.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/phy/phy_device.c +14 -7
@@ -3252,23 +3252,30 @@ static int __init phy_init(void) {int rc; +ethtool_set_ethtool_phy_ops (&phy_ethtool_phy_ops); + rc =mdio_bus_init ();if (rc) -return rc; + goto err_ethtool_phy_ops; -ethtool_set_ethtool_phy_ops (&phy_ethtool_phy_ops);features_init (); rc =phy_driver_register (&genphy_c45_driver,THIS_MODULE );if (rc) - goto err_c45; + goto err_mdio_bus; rc =phy_driver_register (&genphy_driver,THIS_MODULE ); -if (rc) { -phy_driver_unregister (&genphy_c45_driver); +if (rc) + goto err_c45; + +return 0 ; + err_c45: -mdio_bus_exit (); - } +phy_driver_unregister (&genphy_c45_driver); +err_mdio_bus: +mdio_bus_exit (); +err_ethtool_phy_ops: +ethtool_set_ethtool_phy_ops (NULL );return rc; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 164/183 jbd2: recheck chechpointing non-dirty buffer
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit c2d6fd9d6f35079f1669f0100f05b46708c74b7f upstream.
There is a long-standing metadata corruption issue that happens from time to time, but it's very difficult to reproduce and analyse, benefit from the JBD2_CYCLE_RECORD option, we found out that the problem is the checkpointing process miss to write out some buffers which are raced by another do_get_write_access(). Looks below for detail.
jbd2_log_do_checkpoint() //transaction X
//buffer A is dirty and not belones to any transaction __buffer_relink_io() //move it to the IO list __flush_batch()
write_dirty_buffer()
do_get_write_access()
clear_buffer_dirty
__jbd2_journal_file_buffer()
//add buffer A to a new transaction Y lock_buffer(bh)
//doesn't write out
__jbd2_journal_remove_checkpoint()
//finish checkpoint except buffer A
//filesystem corrupt if the new transaction Y isn't fully write out.
Due to the t_checkpoint_list walking loop in jbd2_log_do_checkpoint() have already handles waiting for buffers under IO and re-added new transaction to complete commit, and it also removing cleaned buffers, this makes sure the list will eventually get empty. So it's fine to leave buffers on the t_checkpoint_list while flushing out and completely stop using the t_checkpoint_io_list.
--- fs/jbd2/checkpoint.c | 102 ++++++++++++++------------------------------------- 1 file changed, 29 insertions(+), 73 deletions(-)
fs/jbd2/checkpoint.c +29 -73
@@ -58,28 +58,6 @@ static inline void __buffer_unlink(struc }/* -* Move a buffer from the checkpoint list to the checkpoint io list -* -* Called with j_list_lock held -*/ -static inline void __buffer_relink_io (struct journal_head *jh) -{ -transaction_t *transaction = jh->b_cp_transaction; - -__buffer_unlink_first (jh); - -if (!transaction->t_checkpoint_io_list) { - jh->b_cpnext = jh->b_cpprev = jh; - }else { - jh->b_cpnext = transaction->t_checkpoint_io_list; - jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev; - jh->b_cpprev->b_cpnext = jh; - jh->b_cpnext->b_cpprev = jh; - } - transaction->t_checkpoint_io_list = jh; -} - -/* * Check a checkpoint buffer could be release or not. * * Requires j_list_lock
@@ -183,6 +161,7 @@ __flush_batch(journal_t *journal, int *bstruct buffer_head *bh = journal->j_chkpt_bhs[i];BUFFER_TRACE (bh,"brelse" );__brelse (bh); + journal->j_chkpt_bhs[i] =NULL ; } *batch_count =0 ; }
@@ -242,6 +221,11 @@ restart: jh = transaction->t_checkpoint_list; bh =jh2bh (jh); +/* +* The buffer may be writing back, or flushing out in the +* last couple of cycles, or re-adding into a new transaction, +* need to check it again until it's unlocked. +*/ if (buffer_locked (bh)) {get_bh (bh);spin_unlock (&journal->j_list_lock);
@@ -287,28 +271,32 @@ restart: }if (!buffer_dirty (bh)) {BUFFER_TRACE (bh,"remove from checkpoint" ); -if (__jbd2_journal_remove_checkpoint (jh)) -/* The transaction was released; we're done */ +/* +* If the transaction was released or the checkpoint +* list was empty, we're done. +*/ +if (__jbd2_journal_remove_checkpoint (jh) || + !transaction->t_checkpoint_list) goto out; -continue ; + }else { +/* +* We are about to write the buffer, it could be +* raced by some other transaction shrink or buffer +* re-log logic once we release the j_list_lock, +* leave it on the checkpoint list and check status +* again to make sure it's clean. +*/ +BUFFER_TRACE (bh,"queue" ); +get_bh (bh); +J_ASSERT_BH (bh, !buffer_jwrite (bh)); + journal->j_chkpt_bhs[batch_count++] = bh; + transaction->t_chp_stats.cs_written++; + transaction->t_checkpoint_list = jh->b_cpnext; } -/* -* Important: we are about to write the buffer, and -* possibly block, while still holding the journal -* lock. We cannot afford to let the transaction -* logic start messing around with this buffer before -* we write it to disk, as that would break -* recoverability. -*/ -BUFFER_TRACE (bh,"queue" ); -get_bh (bh); -J_ASSERT_BH (bh, !buffer_jwrite (bh)); - journal->j_chkpt_bhs[batch_count++] = bh; -__buffer_relink_io (jh); - transaction->t_chp_stats.cs_written++; +if ((batch_count ==JBD2_NR_BATCH ) || -need_resched () || -spin_needbreak (&journal->j_list_lock)) +need_resched () ||spin_needbreak (&journal->j_list_lock) || +jh2bh (transaction->t_checkpoint_list) == journal->j_chkpt_bhs[0 ]) goto unlock_and_flush; }
@@ -322,38 +310,6 @@ restart: goto restart; } -/* -* Now we issued all of the transaction's buffers, let's deal -* with the buffers that are out for I/O. -*/ -restart2: -/* Did somebody clean up the transaction in the meanwhile? */ -if (journal->j_checkpoint_transactions != transaction || - transaction->t_tid != this_tid) - goto out; - -while (transaction->t_checkpoint_io_list) { - jh = transaction->t_checkpoint_io_list; - bh =jh2bh (jh); -if (buffer_locked (bh)) { -get_bh (bh); -spin_unlock (&journal->j_list_lock); -wait_on_buffer (bh); -/* the journal_head may have gone by now */ -BUFFER_TRACE (bh,"brelse" ); -__brelse (bh); -spin_lock (&journal->j_list_lock); - goto restart2; - } - -/* -* Now in whatever state the buffer currently is, we -* know that it has been written out and so we can -* drop it from the list -*/ -if (__jbd2_journal_remove_checkpoint (jh)) -break ; - } out:spin_unlock (&journal->j_list_lock); result =jbd2_cleanup_journal_tail (journal);
Greg Kroah-Hartman
maintainerPATCH 165/183 tracing/histograms: Return an error if we fail to add histogram to hist_vars list
In reply to Greg Kroah-HartmanFrom: Mohamed Khalfella <[email protected]>
commit 4b8b3905165ef98386a3c06f196c85d21292d029 upstream.
Commit 6018b585e8c6 ("tracing/histograms: Add histograms to hist_vars if they have referenced variables") added a check to fail histogram creation if save_hist_vars() failed to add histogram to hist_vars list. But the commit failed to set ret to failed return code before jumping to unregister histogram, fix it.
--- kernel/trace/trace_events_hist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +2 -1
@@ -6560,7 +6560,8 @@ static int event_hist_trigger_parse(stru goto out_unreg;if (has_hist_vars (hist_data) || hist_data->n_var_refs) { -if (save_hist_vars (hist_data)) + ret =save_hist_vars (hist_data); +if (ret) goto out_unreg; }
Greg Kroah-Hartman
maintainerPATCH 166/183 drm/ttm: fix bulk_move corruption when adding a entry
In reply to Greg Kroah-HartmanFrom: Yunxiang Li <[email protected]>
commit 4481913607e58196c48a4fef5e6f45350684ec3c upstream.
When the resource is the first in the bulk_move range, adding it again (thus moving it to the tail) will corrupt the list since the first pointer is not moved. This eventually lead to null pointer deref in ttm_lru_bulk_move_del()
--- drivers/gpu/drm/ttm/ttm_resource.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_resource.c +4 -1
@@ -85,6 +85,8 @@ static void ttm_lru_bulk_move_pos_tail(s struct ttm_resource *res) {if (pos->last != res) { +if (pos->first == res) + pos->first =list_next_entry (res, lru);list_move (&res->lru, &pos->last->lru); pos->last = res; }
@@ -110,7 +112,8 @@ static void ttm_lru_bulk_move_del(struct {struct ttm_lru_bulk_move_pos *pos =ttm_lru_bulk_move_pos (bulk, res); -if (unlikely (pos->first == res && pos->last == res)) { +if (unlikely (WARN_ON (!pos->first || !pos->last) || + (pos->first == res && pos->last == res))) { pos->first =NULL ; pos->last =NULL ; }else if (pos->first == res) {
Greg Kroah-Hartman
maintainerPATCH 167/183 spi: dw: Remove misleading comment for Mount Evans SoC
In reply to Greg Kroah-HartmanFrom: Abe Kohandel <[email protected]>
commit 5b6d0b91f84cff3f28724076f93f6f9e2ef8d775 upstream.
Remove a misleading comment about the DMA operations of the Intel Mount Evans SoC's SPI Controller as requested by Serge.
--- drivers/spi/spi-dw-mmio.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/spi/spi-dw-mmio.c +1 -8
@@ -223,14 +223,7 @@ static int dw_spi_intel_init(struct plat }/* -* The Intel Mount Evans SoC's Integrated Management Complex uses the -* SPI controller for access to a NOR SPI FLASH. However, the SoC doesn't -* provide a mechanism to override the native chip select signal. -* -* This driver doesn't use DMA for memory operations when a chip select -* override is not provided due to the native chip select timing behavior. -* As a result no DMA configuration is done for the controller and this -* configuration is not tested. +* DMA-based mem ops are not configured for this device and are not tested. */ static int dw_spi_mountevans_imc_init (struct platform_device *pdev,struct dw_spi_mmio *dwsmmio)
Greg Kroah-Hartman
maintainerPATCH 168/183 kallsyms: add kallsyms_seqs_of_names to list of special symbols
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit ced0f245ed951e2b8bd68f79c15238d7dd253662 upstream.
My randconfig build setup ran into another kallsyms warning:
Inconsistent kallsyms data
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
After adding some debugging code to kallsyms.c, I saw that the recently added kallsyms_seqs_of_names symbol can sometimes cause the second stage table to be slightly longer than the first stage, which makes the build inconsistent.
Add it to the exception table that contains all other kallsyms-generated symbols.
--- scripts/kallsyms.c | 1 + 1 file changed, 1 insertion(+)
scripts/kallsyms.c +1 -0
@@ -118,6 +118,7 @@ static bool is_ignored_symbol(const char"kallsyms_markers" ,"kallsyms_token_table" ,"kallsyms_token_index" , +"kallsyms_seqs_of_names" ,/* Exclude linker generated symbols which vary between passes */ "_SDA_BASE_" ,/* ppc */ "_SDA2_BASE_", /* ppc */
Greg Kroah-Hartman
maintainerPATCH 169/183 scripts/kallsyms.c Make the comment up-to-date with current implementation
In reply to Greg Kroah-HartmanFrom: Yuma Ueda <[email protected]>
commit adc40221bf676f3e722d135889a7b913b4162dc2 upstream.
The comment in scripts/kallsyms.c describing the usage of scripts/kallsyms does not reflect the latest implementation. Fix the comment to be equivalent to what the usage() function prints.
--- scripts/kallsyms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/kallsyms.c +2 -1
@@ -5,7 +5,8 @@* This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * -* Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S +* Usage: kallsyms [--all-symbols] [--absolute-percpu] +* [--base-relative] in.map > out.S * * Table compression uses all the unused char codes on the symbols and * maps these to the most used substrings (tokens). For instance, it might
Greg Kroah-Hartman
maintainerPATCH 170/183 scripts/kallsyms: update the usage in the comment block
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 79549da691edd4874c19d99c578a134471817c47 upstream.
Commit 010a0aad39fc ("kallsyms: Correctly sequence symbols when CONFIG_LTO_CLANG=y") added --lto-clang, and updated the usage() function, but not the comment. Update it in the same way.
--- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kallsyms.c +1 -1
@@ -6,7 +6,7 @@* of the GNU General Public License, incorporated herein by reference. * * Usage: kallsyms [--all-symbols] [--absolute-percpu] -* [--base-relative] in.map > out.S +* [--base-relative] [--lto-clang] in.map > out.S * * Table compression uses all the unused char codes on the symbols and * maps these to the most used substrings (tokens). For instance, it might
Greg Kroah-Hartman
maintainerPATCH 171/183 bpf: allow precision tracking for programs with subprogs
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit be2ef8161572ec1973124ebc50f56dafc2925e07 ]
Stop forcing precise=true for SCALAR registers when BPF program has any subprograms. Current restriction means that any BPF program, as soon as it uses subprograms, will end up not getting any of the precision tracking benefits in reduction of number of verified states.
This patch keeps the fallback mark_all_scalars_precise() behavior if precise marking has to cross function frames. E.g., if subprogram requires R1 (first input arg) to be marked precise, ideally we'd need to backtrack to the parent function and keep marking R1 and its dependencies as precise. But right now we give up and force all the SCALARs in any of the current and parent states to be forced to precise=true. We can lift that restriction in the future.
But this patch fixes two issues identified when trying to enable precision tracking for subprogs.
First, prevent "escaping" from top-most state in a global subprog. While with entry-level BPF program we never end up requesting precision for R1-R5 registers, because R2-R5 are not initialized (and so not readable in correct BPF program), and R1 is PTR_TO_CTX, not SCALAR, and so is implicitly precise. With global subprogs, though, it's different, as global subprog a) can have up to 5 SCALAR input arguments, which might get marked as precise=true and b) it is validated in isolation from its main entry BPF program. b) means that we can end up exhausting parent state chain and still not mark all registers in reg_mask as precise, which would lead to verifier bug warning.
To handle that, we need to consider two cases. First, if the very first state is not immediately "checkpointed" (i.e., stored in state lookup hashtable), it will get correct first_insn_idx and last_insn_idx instruction set during state checkpointing. As such, this case is already handled and __mark_chain_precision() already handles that by just doing nothing when we reach to the very first parent state. st->parent will be NULL and we'll just stop. Perhaps some extra check for reg_mask and stack_mask is due here, but this patch doesn't address that issue.
More problematic second case is when global function's initial state is immediately checkpointed before we manage to process the very first instruction. This is happening because when there is a call to global subprog from the main program the very first subprog's instruction is marked as pruning point, so before we manage to process first instruction we have to check and checkpoint state. This patch adds a special handling for such "empty" state, which is identified by having st->last_insn_idx set to -1. In such case, we check that we are indeed validating global subprog, and with some sanity checking we mark input args as precise if requested.
Note that we also initialize state->first_insn_idx with correct start insn_idx offset. For main program zero is correct value, but for any subprog it's quite confusing to not have first_insn_idx set. This doesn't have any functional impact, but helps with debugging and state printing. We also explicitly initialize state->last_insns_idx instead of relying on is_state_visited() to do this with env->prev_insns_idx, which will be -1 on the very first instruction. This concludes necessary changes to handle specifically global subprog's precision tracking.
Second identified problem was missed handling of BPF helper functions that call into subprogs (e.g., bpf_loop and few others). From precision tracking and backtracking logic's standpoint those are effectively calls into subprogs and should be called as BPF_PSEUDO_CALL calls.
This patch takes the least intrusive way and just checks against a short list of current BPF helpers that do call subprogs, encapsulated in is_callback_calling_function() function. But to prevent accidentally forgetting to add new BPF helpers to this "list", we also do a sanity check in __check_func_call, which has to be called for each such special BPF helper, to validate that BPF helper is indeed recognized as callback-calling one. This should catch any missed checks in the future. Adding some special flags to be added in function proto definitions seemed like an overkill in this case.
With the above changes, it's possible to remove forceful setting of reg->precise to true in __mark_reg_unknown, which turns on precision tracking both inside subprogs and entry progs that have subprogs. No warnings or errors were detected across all the selftests, but also when validating with veristat against internal Meta BPF objects and Cilium objects. Further, in some BPF programs there are noticeable reduction in number of states and instructions validated due to more effective precision tracking, especially benefiting syncookie test.
$ ./veristat -C -e file,prog,insns,states ~/baseline-results.csv ~/subprog-precise-results.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) ---------------------------------------- -------------------------- --------------- --------------- ------------------ ---------------- ---------------- ------------------- pyperf600_bpf_loop.bpf.linked1.o on_event 3966 3678 -288 (-7.26%) 306 276 -30 (-9.80%) pyperf_global.bpf.linked1.o on_event 7563 7530 -33 (-0.44%) 520 517 -3 (-0.58%) pyperf_subprogs.bpf.linked1.o on_event 36358 36934 +576 (+1.58%) 2499 2531 +32 (+1.28%) setget_sockopt.bpf.linked1.o skops_sockopt 3965 4038 +73 (+1.84%) 343 347 +4 (+1.17%) test_cls_redirect_subprogs.bpf.linked1.o cls_redirect 64965 64901 -64 (-0.10%) 4619 4612 -7 (-0.15%) test_misc_tcp_hdr_options.bpf.linked1.o misc_estab 1491 1307 -184 (-12.34%) 110 100 -10 (-9.09%) test_pkt_access.bpf.linked1.o test_pkt_access 354 349 -5 (-1.41%) 25 24 -1 (-4.00%) test_sock_fields.bpf.linked1.o egress_read_sock_fields 435 375 -60 (-13.79%) 22 20 -2 (-9.09%) test_sysctl_loop2.bpf.linked1.o sysctl_tcp_mem 1508 1501 -7 (-0.46%) 29 28 -1 (-3.45%) test_tc_dtime.bpf.linked1.o egress_fwdns_prio100 468 435 -33 (-7.05%) 45 41 -4 (-8.89%) test_tc_dtime.bpf.linked1.o ingress_fwdns_prio100 398 408 +10 (+2.51%) 42 39 -3 (-7.14%) test_tc_dtime.bpf.linked1.o ingress_fwdns_prio101 1096 842 -254 (-23.18%) 97 73 -24 (-24.74%) test_tcp_hdr_options.bpf.linked1.o estab 2758 2408 -350 (-12.69%) 208 181 -27 (-12.98%) test_urandom_usdt.bpf.linked1.o urand_read_with_sema 466 448 -18 (-3.86%) 31 28 -3 (-9.68%) test_urandom_usdt.bpf.linked1.o urand_read_without_sema 466 448 -18 (-3.86%) 31 28 -3 (-9.68%) test_urandom_usdt.bpf.linked1.o urandlib_read_with_sema 466 448 -18 (-3.86%) 31 28 -3 (-9.68%) test_urandom_usdt.bpf.linked1.o urandlib_read_without_sema 466 448 -18 (-3.86%) 31 28 -3 (-9.68%) test_xdp_noinline.bpf.linked1.o balancer_ingress_v6 4302 4294 -8 (-0.19%) 257 256 -1 (-0.39%) xdp_synproxy_kern.bpf.linked1.o syncookie_tc 583722 405757 -177965 (-30.49%) 35846 25735 -10111 (-28.21%) xdp_synproxy_kern.bpf.linked1.o syncookie_xdp 609123 479055 -130068 (-21.35%) 35452 29145 -6307 (-17.79%) ---------------------------------------- -------------------------- --------------- --------------- ------------------ ---------------- ---------------- -------------------
--- kernel/bpf/verifier.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-)
kernel/bpf/verifier.c +61 -1
@@ -511,6 +511,15 @@ static bool is_dynptr_ref_function(enumreturn func_id == BPF_FUNC_dynptr_data; } +static bool is_callback_calling_function (enum bpf_func_id func_id) +{ +return func_id == BPF_FUNC_for_each_map_elem || + func_id == BPF_FUNC_timer_set_callback || + func_id == BPF_FUNC_find_vma || + func_id == BPF_FUNC_loop || + func_id == BPF_FUNC_user_ringbuf_drain; +} +static bool helper_multiple_ref_obj_use (enum bpf_func_id func_id,const struct bpf_map *map) {
@@ -1693,7 +1702,7 @@ static void __mark_reg_unknown(const str reg->type =SCALAR_VALUE ; reg->var_off = tnum_unknown; reg->frameno =0 ; - reg->precise = env->subprog_cnt >1 || !env->bpf_capable; + reg->precise = !env->bpf_capable;__mark_reg_unbounded (reg); }
@@ -2670,6 +2679,11 @@ static int backtrack_insn(struct bpf_ver*/ if (insn->src_reg ==BPF_PSEUDO_KFUNC_CALL && insn->imm ==0 )return -ENOTSUPP ; +/* BPF helpers that invoke callback subprogs are +* equivalent to BPF_PSEUDO_CALL above +*/ +if (insn->src_reg ==0 &&is_callback_calling_function (insn->imm)) +return -ENOTSUPP ;/* regular helper call sets R0 */ *reg_mask &= ~1 ;if (*reg_mask &0x3f ) {
@@ -2848,12 +2862,42 @@ static int __mark_chain_precision(structreturn 0 ;if (!reg_mask && !stack_mask)return 0 ; +for (;;) {DECLARE_BITMAP (mask,64 );u32 history = st->jmp_history_cnt;if (env->log.level &BPF_LOG_LEVEL2 )verbose (env,"last_idx %d first_idx %d\n" , last_idx, first_idx); + +if (last_idx <0 ) { +/* we are at the entry into subprog, which +* is expected for global funcs, but only if +* requested precise registers are R1-R5 +* (which are global func's input arguments) +*/ +if (st->curframe ==0 && + st->frame[0 ]->subprogno >0 && + st->frame[0 ]->callsite ==BPF_MAIN_FUNC && + stack_mask ==0 && (reg_mask & ~0x3e ) ==0 ) { +bitmap_from_u64 (mask, reg_mask); +for_each_set_bit (i, mask,32 ) { + reg = &st->frame[0 ]->regs[i]; +if (reg->type !=SCALAR_VALUE ) { + reg_mask &= ~(1u << i); +continue ; + } + reg->precise = true; + } +return 0 ; + } + +verbose (env,"BUG backtracing func entry subprog %d reg_mask %x stack_mask %llx\n" , + st->frame[0 ]->subprogno, reg_mask, stack_mask); +WARN_ONCE (1 ,"verifier backtracking bug" ); +return -EFAULT ; + } +for (i = last_idx;;) {if (skip_first) { err =0 ;
@@ -6732,6 +6776,10 @@ typedef int (*set_callee_state_fn)(strucstruct bpf_func_state *callee, int insn_idx); +static int set_callee_state (struct bpf_verifier_env *env, +struct bpf_func_state *caller, +struct bpf_func_state *callee,int insn_idx); +static int __check_func_call (struct bpf_verifier_env *env,struct bpf_insn *insn,int *insn_idx,int subprog,set_callee_state_fn set_callee_state_cb)
@@ -6782,6 +6830,16 @@ static int __check_func_call(struct bpf_ } } +/* set_callee_state is used for direct subprog calls, but we are +* interested in validating only BPF helpers that can call subprogs as +* callbacks +*/ +if (set_callee_state_cb != set_callee_state && !is_callback_calling_function (insn->imm)) { +verbose (env,"verifier bug: helper %s#%d is not marked as callback-calling\n" , +func_id_name (insn->imm), insn->imm); +return -EFAULT ; + } +if (insn->code == (BPF_JMP |BPF_CALL ) && insn->src_reg ==0 && insn->imm == BPF_FUNC_timer_set_callback) {
@@ -14713,6 +14771,8 @@ static int do_check_common(struct bpf_veBPF_MAIN_FUNC /* callsite */ ,0 /* frameno */ , subprog); + state->first_insn_idx = env->subprog_info[subprog].start; + state->last_insn_idx =-1 ; regs = state->frame[state->curframe]->regs;if (subprog || env->prog->type ==BPF_PROG_TYPE_EXT ) {
Greg Kroah-Hartman
maintainerPATCH 172/183 bpf: stop setting precise in current state
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit f63181b6ae79fd3b034cde641db774268c2c3acf ]
Setting reg->precise to true in current state is not necessary from correctness standpoint, but it does pessimise the whole precision (or rather "imprecision", because that's what we want to keep as much as possible) tracking. Why is somewhat subtle and my best attempt to explain this is recorded in an extensive comment for __mark_chain_precise() function. Some more careful thinking and code reading is probably required still to grok this completely, unfortunately. Whiteboarding and a bunch of extra handwaiving in person would be even more helpful, but is deemed impractical in Git commit.
Next patch pushes this imprecision property even further, building on top of the insights described in this patch.
End results are pretty nice, we get reduction in number of total instructions and states verified due to a better states reuse, as some of the states are now more generic and permissive due to less unnecessary precise=true requirements.
SELFTESTS RESULTS
=================
$ ./veristat -C -e file,prog,insns,states ~/subprog-precise-results.csv ~/imprecise-early-results.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) --------------------------------------- ---------------------- --------------- --------------- ------------------ ---------------- ---------------- ------------------- bpf_iter_ksym.bpf.linked1.o dump_ksym 347 285 -62 (-17.87%) 20 19 -1 (-5.00%) pyperf600_bpf_loop.bpf.linked1.o on_event 3678 3736 +58 (+1.58%) 276 285 +9 (+3.26%) setget_sockopt.bpf.linked1.o skops_sockopt 4038 3947 -91 (-2.25%) 347 343 -4 (-1.15%) test_l4lb.bpf.linked1.o balancer_ingress 4559 2611 -1948 (-42.73%) 118 105 -13 (-11.02%) test_l4lb_noinline.bpf.linked1.o balancer_ingress 6279 6268 -11 (-0.18%) 237 236 -1 (-0.42%) test_misc_tcp_hdr_options.bpf.linked1.o misc_estab 1307 1303 -4 (-0.31%) 100 99 -1 (-1.00%) test_sk_lookup.bpf.linked1.o ctx_narrow_access 456 447 -9 (-1.97%) 39 38 -1 (-2.56%) test_sysctl_loop1.bpf.linked1.o sysctl_tcp_mem 1389 1384 -5 (-0.36%) 26 25 -1 (-3.85%) test_tc_dtime.bpf.linked1.o egress_fwdns_prio101 518 485 -33 (-6.37%) 51 46 -5 (-9.80%) test_tc_dtime.bpf.linked1.o egress_host 519 468 -51 (-9.83%) 50 44 -6 (-12.00%) test_tc_dtime.bpf.linked1.o ingress_fwdns_prio101 842 1000 +158 (+18.76%) 73 88 +15 (+20.55%) xdp_synproxy_kern.bpf.linked1.o syncookie_tc 405757 373173 -32584 (-8.03%) 25735 22882 -2853 (-11.09%) xdp_synproxy_kern.bpf.linked1.o syncookie_xdp 479055 371590 -107465 (-22.43%) 29145 22207 -6938 (-23.81%) --------------------------------------- ---------------------- --------------- --------------- ------------------ ---------------- ---------------- -------------------
Slight regression in test_tc_dtime.bpf.linked1.o/ingress_fwdns_prio101 is left for a follow up, there might be some more precision-related bugs in existing BPF verifier logic.
CILIUM RESULTS
==============
$ ./veristat -C -e file,prog,insns,states ~/subprog-precise-results-cilium.csv ~/imprecise-early-results-cilium.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) ------------- ------------------------------ --------------- --------------- ------------------ ---------------- ---------------- ------------------- bpf_host.o cil_from_host 762 556 -206 (-27.03%) 43 37 -6 (-13.95%) bpf_host.o tail_handle_nat_fwd_ipv4 23541 23426 -115 (-0.49%) 1538 1537 -1 (-0.07%) bpf_host.o tail_nodeport_nat_egress_ipv4 33592 33566 -26 (-0.08%) 2163 2161 -2 (-0.09%) bpf_lxc.o tail_handle_nat_fwd_ipv4 23541 23426 -115 (-0.49%) 1538 1537 -1 (-0.07%) bpf_overlay.o tail_nodeport_nat_egress_ipv4 33581 33543 -38 (-0.11%) 2160 2157 -3 (-0.14%) bpf_xdp.o tail_handle_nat_fwd_ipv4 21659 20920 -739 (-3.41%) 1440 1376 -64 (-4.44%) bpf_xdp.o tail_handle_nat_fwd_ipv6 17084 17039 -45 (-0.26%) 907 905 -2 (-0.22%) bpf_xdp.o tail_lb_ipv4 73442 73430 -12 (-0.02%) 4370 4369 -1 (-0.02%) bpf_xdp.o tail_lb_ipv6 152114 151895 -219 (-0.14%) 6493 6479 -14 (-0.22%) bpf_xdp.o tail_nodeport_nat_egress_ipv4 17377 17200 -177 (-1.02%) 1125 1111 -14 (-1.24%) bpf_xdp.o tail_nodeport_nat_ingress_ipv6 6405 6397 -8 (-0.12%) 309 308 -1 (-0.32%) bpf_xdp.o tail_rev_nodeport_lb4 7126 6934 -192 (-2.69%) 414 402 -12 (-2.90%) bpf_xdp.o tail_rev_nodeport_lb6 18059 17905 -154 (-0.85%) 1105 1096 -9 (-0.81%) ------------- ------------------------------ --------------- --------------- ------------------ ---------------- ---------------- -------------------
--- kernel/bpf/verifier.c | 103 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 12 deletions(-)
kernel/bpf/verifier.c +91 -12
@@ -2788,8 +2788,11 @@ static void mark_all_scalars_precise(str/* big hammer: mark all scalars precise in this path. * pop_stack may still get !precise scalars. +* We also skip current state and go straight to first parent state, +* because precision markings in current non-checkpointed state are +* not needed. See why in the comment in __mark_chain_precision below. */ -for (; st; st = st->parent) +for (st = st->parent; st; st = st->parent) {for (i =0 ; i <= st->curframe; i++) { func = st->frame[i];for (j =0 ; j <BPF_REG_FP ; j++) {
@@ -2807,8 +2810,88 @@ static void mark_all_scalars_precise(str reg->precise = true; } } + } } +/* +* __mark_chain_precision() backtracks BPF program instruction sequence and +* chain of verifier states making sure that register *regno* (if regno >= 0) +* and/or stack slot *spi* (if spi >= 0) are marked as precisely tracked +* SCALARS, as well as any other registers and slots that contribute to +* a tracked state of given registers/stack slots, depending on specific BPF +* assembly instructions (see backtrack_insns() for exact instruction handling +* logic). This backtracking relies on recorded jmp_history and is able to +* traverse entire chain of parent states. This process ends only when all the +* necessary registers/slots and their transitive dependencies are marked as +* precise. +* +* One important and subtle aspect is that precise marks *do not matter* in +* the currently verified state (current state). It is important to understand +* why this is the case. +* +* First, note that current state is the state that is not yet "checkpointed", +* i.e., it is not yet put into env->explored_states, and it has no children +* states as well. It's ephemeral, and can end up either a) being discarded if +* compatible explored state is found at some point or BPF_EXIT instruction is +* reached or b) checkpointed and put into env->explored_states, branching out +* into one or more children states. +* +* In the former case, precise markings in current state are completely +* ignored by state comparison code (see regsafe() for details). Only +* checkpointed ("old") state precise markings are important, and if old +* state's register/slot is precise, regsafe() assumes current state's +* register/slot as precise and checks value ranges exactly and precisely. If +* states turn out to be compatible, current state's necessary precise +* markings and any required parent states' precise markings are enforced +* after the fact with propagate_precision() logic, after the fact. But it's +* important to realize that in this case, even after marking current state +* registers/slots as precise, we immediately discard current state. So what +* actually matters is any of the precise markings propagated into current +* state's parent states, which are always checkpointed (due to b) case above). +* As such, for scenario a) it doesn't matter if current state has precise +* markings set or not. +* +* Now, for the scenario b), checkpointing and forking into child(ren) +* state(s). Note that before current state gets to checkpointing step, any +* processed instruction always assumes precise SCALAR register/slot +* knowledge: if precise value or range is useful to prune jump branch, BPF +* verifier takes this opportunity enthusiastically. Similarly, when +* register's value is used to calculate offset or memory address, exact +* knowledge of SCALAR range is assumed, checked, and enforced. So, similar to +* what we mentioned above about state comparison ignoring precise markings +* during state comparison, BPF verifier ignores and also assumes precise +* markings *at will* during instruction verification process. But as verifier +* assumes precision, it also propagates any precision dependencies across +* parent states, which are not yet finalized, so can be further restricted +* based on new knowledge gained from restrictions enforced by their children +* states. This is so that once those parent states are finalized, i.e., when +* they have no more active children state, state comparison logic in +* is_state_visited() would enforce strict and precise SCALAR ranges, if +* required for correctness. +* +* To build a bit more intuition, note also that once a state is checkpointed, +* the path we took to get to that state is not important. This is crucial +* property for state pruning. When state is checkpointed and finalized at +* some instruction index, it can be correctly and safely used to "short +* circuit" any *compatible* state that reaches exactly the same instruction +* index. I.e., if we jumped to that instruction from a completely different +* code path than original finalized state was derived from, it doesn't +* matter, current state can be discarded because from that instruction +* forward having a compatible state will ensure we will safely reach the +* exit. States describe preconditions for further exploration, but completely +* forget the history of how we got here. +* +* This also means that even if we needed precise SCALAR range to get to +* finalized state, but from that point forward *that same* SCALAR register is +* never used in a precise context (i.e., it's precise value is not needed for +* correctness), it's correct and safe to mark such register as "imprecise" +* (i.e., precise marking set to false). This is what we rely on when we do +* not set precise marking in current state. If no child state requires +* precision for any given SCALAR register, it's safe to dictate that it can +* be imprecise. If any child state does require this register to be precise, +* we'll mark it precise later retroactively during precise markings +* propagation from child state to parent states. +*/ static int __mark_chain_precision (struct bpf_verifier_env *env,int frame,int regno,int spi) {
@@ -2826,6 +2909,10 @@ static int __mark_chain_precision(structif (!env->bpf_capable)return 0 ; +/* Do sanity checks against current state of register and/or stack +* slot, but don't set precise flag in current state, as precision +* tracking in the current state is unnecessary. +*/ func = st->frame[frame];if (regno >=0 ) { reg = &func->regs[regno];
@@ -2833,11 +2920,7 @@ static int __mark_chain_precision(structWARN_ONCE (1 ,"backtracing misuse" );return -EFAULT ; } -if (!reg->precise) - new_marks = true; -else - reg_mask =0 ; - reg->precise = true; + new_marks = true; }while (spi >=0 ) {
@@ -2850,11 +2933,7 @@ static int __mark_chain_precision(struct stack_mask =0 ;break ; } -if (!reg->precise) - new_marks = true; -else - stack_mask =0 ; - reg->precise = true; + new_marks = true;break ; }
@@ -11668,7 +11747,7 @@ static bool regsafe(struct bpf_verifier_if (env->explore_alu_limits)return false;if (rcur->type ==SCALAR_VALUE ) { -if (!rold->precise && !rcur->precise) +if (!rold->precise)return true;/* new val must satisfy old val knowledge */ return range_within(rold, rcur) &&
Greg Kroah-Hartman
maintainerPATCH 173/183 bpf: aggressively forget precise markings during state checkpointing
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 7a830b53c17bbadcf99f778f28aaaa4e6c41df5f ]
Exploit the property of about-to-be-checkpointed state to be able to forget all precise markings up to that point even more aggressively. We now clear all potentially inherited precise markings right before checkpointing and branching off into child state. If any of children states require precise knowledge of any SCALAR register, those will be propagated backwards later on before this state is finalized, preserving correctness.
There is a single selftests BPF program change, but tremendous one: 25x reduction in number of verified instructions and states in trace_virtqueue_add_sgs.
Cilium results are more modest, but happen across wider range of programs.
SELFTESTS RESULTS
=================
$ ./veristat -C -e file,prog,insns,states ~/imprecise-early-results.csv ~/imprecise-aggressive-results.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) ------------------- ----------------------- --------------- --------------- ------------------ ---------------- ---------------- ------------------- loop6.bpf.linked1.o trace_virtqueue_add_sgs 398057 15114 -382943 (-96.20%) 8717 336 -8381 (-96.15%) ------------------- ----------------------- --------------- --------------- ------------------ ---------------- ---------------- -------------------
CILIUM RESULTS
==============
$ ./veristat -C -e file,prog,insns,states ~/imprecise-early-results-cilium.csv ~/imprecise-aggressive-results-cilium.csv | grep -v '+0' File Program Total insns (A) Total insns (B) Total insns (DIFF) Total states (A) Total states (B) Total states (DIFF) ------------- -------------------------------- --------------- --------------- ------------------ ---------------- ---------------- ------------------- bpf_host.o tail_handle_nat_fwd_ipv4 23426 23221 -205 (-0.88%) 1537 1515 -22 (-1.43%) bpf_host.o tail_handle_nat_fwd_ipv6 13009 12904 -105 (-0.81%) 719 708 -11 (-1.53%) bpf_host.o tail_nodeport_nat_ingress_ipv6 5261 5196 -65 (-1.24%) 247 243 -4 (-1.62%) bpf_host.o tail_nodeport_nat_ipv6_egress 3446 3406 -40 (-1.16%) 203 198 -5 (-2.46%) bpf_lxc.o tail_handle_nat_fwd_ipv4 23426 23221 -205 (-0.88%) 1537 1515 -22 (-1.43%) bpf_lxc.o tail_handle_nat_fwd_ipv6 13009 12904 -105 (-0.81%) 719 708 -11 (-1.53%) bpf_lxc.o tail_ipv4_ct_egress 5074 4897 -177 (-3.49%) 255 248 -7 (-2.75%) bpf_lxc.o tail_ipv4_ct_ingress 5100 4923 -177 (-3.47%) 255 248 -7 (-2.75%) bpf_lxc.o tail_ipv4_ct_ingress_policy_only 5100 4923 -177 (-3.47%) 255 248 -7 (-2.75%) bpf_lxc.o tail_ipv6_ct_egress 4558 4536 -22 (-0.48%) 188 187 -1 (-0.53%) bpf_lxc.o tail_ipv6_ct_ingress 4578 4556 -22 (-0.48%) 188 187 -1 (-0.53%) bpf_lxc.o tail_ipv6_ct_ingress_policy_only 4578 4556 -22 (-0.48%) 188 187 -1 (-0.53%) bpf_lxc.o tail_nodeport_nat_ingress_ipv6 5261 5196 -65 (-1.24%) 247 243 -4 (-1.62%) bpf_overlay.o tail_nodeport_nat_ingress_ipv6 5261 5196 -65 (-1.24%) 247 243 -4 (-1.62%) bpf_overlay.o tail_nodeport_nat_ipv6_egress 3482 3442 -40 (-1.15%) 204 201 -3 (-1.47%) bpf_xdp.o tail_nodeport_nat_egress_ipv4 17200 15619 -1581 (-9.19%) 1111 1010 -101 (-9.09%) ------------- -------------------------------- --------------- --------------- ------------------ ---------------- ---------------- -------------------
--- kernel/bpf/verifier.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
kernel/bpf/verifier.c +37 -0
@@ -2813,6 +2813,31 @@ static void mark_all_scalars_precise(str } } +static void mark_all_scalars_imprecise (struct bpf_verifier_env *env,struct bpf_verifier_state *st) +{ +struct bpf_func_state *func; +struct bpf_reg_state *reg; +int i, j; + +for (i =0 ; i <= st->curframe; i++) { + func = st->frame[i]; +for (j =0 ; j <BPF_REG_FP ; j++) { + reg = &func->regs[j]; +if (reg->type !=SCALAR_VALUE ) +continue ; + reg->precise = false; + } +for (j =0 ; j < func->allocated_stack /BPF_REG_SIZE ; j++) { +if (!is_spilled_reg (&func->stack[j])) +continue ; + reg = &func->stack[j].spilled_ptr; +if (reg->type !=SCALAR_VALUE ) +continue ; + reg->precise = false; + } + } +} +/* * __mark_chain_precision() backtracks BPF program instruction sequence and * chain of verifier states making sure that register *regno* (if regno >= 0)
@@ -2891,6 +2916,14 @@ static void mark_all_scalars_precise(str* be imprecise. If any child state does require this register to be precise, * we'll mark it precise later retroactively during precise markings * propagation from child state to parent states. +* +* Skipping precise marking setting in current state is a mild version of +* relying on the above observation. But we can utilize this property even +* more aggressively by proactively forgetting any precise marking in the +* current state (which we inherited from the parent state), right before we +* checkpoint it and branch off into new child state. This is done by +* mark_all_scalars_imprecise() to hopefully get more permissive and generic +* finalized states which help in short circuiting more future states. */ static int __mark_chain_precision (struct bpf_verifier_env *env,int frame,int regno,int spi)
@@ -12296,6 +12329,10 @@ next: env->prev_jmps_processed = env->jmps_processed; env->prev_insn_processed = env->insn_processed; +/* forget precise markings we inherited, see __mark_chain_precision */ +if (env->bpf_capable) +mark_all_scalars_imprecise (env, cur); +/* add new state to the head of linked list */ new = &new_sl->state; err =copy_verifier_state (new, cur);
Greg Kroah-Hartman
maintainerPATCH 174/183 selftests/bpf: make test_align selftest more robust
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 4f999b767769b76378c3616c624afd6f4bb0d99f ]
test_align selftest relies on BPF verifier log emitting register states for specific instructions in expected format. Unfortunately, BPF verifier precision backtracking log interferes with such expectations. And instruction on which precision propagation happens sometimes don't output full expected register states. This does indeed look like something to be improved in BPF verifier, but is beyond the scope of this patch set.
So to make test_align a bit more robust, inject few dummy R4 = R5 instructions which capture desired state of R5 and won't have precision tracking logs on them. This fixes tests until we can improve BPF verifier output in the presence of precision tracking.
--- tools/testing/selftests/bpf/prog_tests/align.c | 38 +++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-)
tools/testing/selftests/bpf/prog_tests/align.c +24 -14
@@ -2,7 +2,7 @@#include <test_progs.h> #define MAX_INSNS 512 -#define MAX_MATCHES 16 +#define MAX_MATCHES 24struct bpf_reg_match {unsigned int line;
@@ -267,6 +267,7 @@ static struct bpf_align_test tests[] = {*/ BPF_MOV64_REG (BPF_REG_5 ,BPF_REG_2 ),BPF_ALU64_REG (BPF_ADD ,BPF_REG_5 ,BPF_REG_6 ), +BPF_MOV64_REG (BPF_REG_4 ,BPF_REG_5 ),BPF_ALU64_IMM (BPF_ADD ,BPF_REG_5 ,14 ),BPF_MOV64_REG (BPF_REG_4 ,BPF_REG_5 ), BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 4),
@@ -280,6 +281,7 @@ static struct bpf_align_test tests[] = {BPF_MOV64_REG (BPF_REG_5 ,BPF_REG_2 ),BPF_ALU64_IMM (BPF_ADD ,BPF_REG_5 ,14 ),BPF_ALU64_REG (BPF_ADD ,BPF_REG_5 ,BPF_REG_6 ), +BPF_MOV64_REG (BPF_REG_4 ,BPF_REG_5 ),BPF_ALU64_IMM (BPF_ADD ,BPF_REG_5 ,4 ),BPF_ALU64_REG (BPF_ADD ,BPF_REG_5 ,BPF_REG_6 ), BPF_MOV64_REG(BPF_REG_4, BPF_REG_5),
@@ -311,44 +313,52 @@ static struct bpf_align_test tests[] = { {15, "R4=pkt(id=1,off=18,r=18,umax=1020,var_off=(0x0; 0x3fc))"}, {15, "R5=pkt(id=1,off=14,r=18,umax=1020,var_off=(0x0; 0x3fc))"},/* Variable offset is added to R5 packet pointer, -* resulting in auxiliary alignment of 4. +* resulting in auxiliary alignment of 4. To avoid BPF +* verifier's precision backtracking logging +* interfering we also have a no-op R4 = R5 +* instruction to validate R5 state. We also check +* that R4 is what it should be in such case. */ - {17, "R5_w=pkt(id=2,off=0,r=0,umax=1020,var_off=(0x0; 0x3fc))"}, + {18, "R4_w=pkt(id=2,off=0,r=0,umax=1020,var_off=(0x0; 0x3fc))"}, + {18, "R5_w=pkt(id=2,off=0,r=0,umax=1020,var_off=(0x0; 0x3fc))"},/* Constant offset is added to R5, resulting in * reg->off of 14. */ - {18, "R5_w=pkt(id=2,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"}, + {19, "R5_w=pkt(id=2,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off * (14) which is 16. Then the variable offset is 4-byte * aligned, so the total offset is 4-byte aligned and * meets the load's requirements. */ - {23, "R4=pkt(id=2,off=18,r=18,umax=1020,var_off=(0x0; 0x3fc))"}, - {23, "R5=pkt(id=2,off=14,r=18,umax=1020,var_off=(0x0; 0x3fc))"}, + {24, "R4=pkt(id=2,off=18,r=18,umax=1020,var_off=(0x0; 0x3fc))"}, + {24, "R5=pkt(id=2,off=14,r=18,umax=1020,var_off=(0x0; 0x3fc))"},/* Constant offset is added to R5 packet pointer, * resulting in reg->off value of 14. */ - {25, "R5_w=pkt(off=14,r=8"}, + {26, "R5_w=pkt(off=14,r=8"},/* Variable offset is added to R5, resulting in a -* variable offset of (4n). +* variable offset of (4n). See comment for insn #18 +* for R4 = R5 trick. */ - {26, "R5_w=pkt(id=3,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"}, + {28, "R4_w=pkt(id=3,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"}, + {28, "R5_w=pkt(id=3,off=14,r=0,umax=1020,var_off=(0x0; 0x3fc))"},/* Constant is added to R5 again, setting reg->off to 18. */ - {27, "R5_w=pkt(id=3,off=18,r=0,umax=1020,var_off=(0x0; 0x3fc))"}, + {29, "R5_w=pkt(id=3,off=18,r=0,umax=1020,var_off=(0x0; 0x3fc))"},/* And once more we add a variable; resulting var_off * is still (4n), fixed offset is not changed. * Also, we create a new reg->id. */ - {28, "R5_w=pkt(id=4,off=18,r=0,umax=2040,var_off=(0x0; 0x7fc)"}, + {31, "R4_w=pkt(id=4,off=18,r=0,umax=2040,var_off=(0x0; 0x7fc)"}, + {31, "R5_w=pkt(id=4,off=18,r=0,umax=2040,var_off=(0x0; 0x7fc)"},/* At the time the word size load is performed from R5, * its total fixed offset is NET_IP_ALIGN + reg->off (18) * which is 20. Then the variable offset is (4n), so * the total offset is 4-byte aligned and meets the * load's requirements. */ - {33, "R4=pkt(id=4,off=22,r=22,umax=2040,var_off=(0x0; 0x7fc)"}, - {33, "R5=pkt(id=4,off=18,r=22,umax=2040,var_off=(0x0; 0x7fc)"}, + {35, "R4=pkt(id=4,off=22,r=22,umax=2040,var_off=(0x0; 0x7fc)"}, + {35, "R5=pkt(id=4,off=18,r=22,umax=2040,var_off=(0x0; 0x7fc)"}, }, }, {
@@ -681,6 +691,6 @@ void test_align(void)if (!test__start_subtest (test->descr))continue ; -CHECK_FAIL (do_test_single (test)); +ASSERT_OK (do_test_single (test), test->descr); } }
Greg Kroah-Hartman
maintainerPATCH 175/183 selftests/bpf: Workaround verification failure for fexit_bpf2bpf/func_replace_return_code
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 63d78b7e8ca2d0eb8c687a355fa19d01b6fcc723 ]
With latest llvm17, selftest fexit_bpf2bpf/func_replace_return_code has the following verification failure:
0: R1=ctx(off=0,imm=0) R10=fp0
; int connect_v4_prog(struct bpf_sock_addr *ctx)
0: (bf) r7 = r1 ; R1=ctx(off=0,imm=0) R7_w=ctx(off=0,imm=0)
1: (b4) w6 = 0 ; R6_w=0
; memset(&tuple.ipv4.saddr, 0, sizeof(tuple.ipv4.saddr));
...
; return do_bind(ctx) ? 1 : 0;
179: (bf) r1 = r7 ; R1=ctx(off=0,imm=0) R7=ctx(off=0,imm=0)
180: (85) call pc+147
Func#3 is global and valid. Skipping.
181: R0_w=scalar()
181: (bc) w6 = w0 ; R0_w=scalar() R6_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff))
182: (05) goto pc-129
; }
54: (bc) w0 = w6 ; R0_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff)) R6_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff))
55: (95) exit
At program exit the register R0 has value (0x0; 0xffffffff) should have been in (0x0; 0x1) processed 281 insns (limit 1000000) max_states_per_insn 1 total_states 26 peak_states 26 mark_read 13 -- END PROG LOAD LOG --
libbpf: prog 'connect_v4_prog': failed to load: -22
The corresponding source code:
__attribute__ ((noinline))
int do_bind(struct bpf_sock_addr *ctx)
{
struct sockaddr_in sa = {}; sa.sin_family = AF_INET;
sa.sin_port = bpf_htons(0);
sa.sin_addr.s_addr = bpf_htonl(SRC_REWRITE_IP4);
if (bpf_bind(ctx, (struct sockaddr *)&sa, sizeof(sa)) != 0)
return 0;
return 1;
}
...
SEC("cgroup/connect4")
int connect_v4_prog(struct bpf_sock_addr *ctx)
{
...
return do_bind(ctx) ? 1 : 0;}
Insn 180 is a call to 'do_bind'. The call's return value is also the return value for the program. Since do_bind() returns 0/1, so it is legitimate for compiler to optimize 'return do_bind(ctx) ? 1 : 0' to 'return do_bind(ctx)'. However, such optimization breaks verifier as the return value of 'do_bind()' is marked as any scalar which violates the requirement of prog return value 0/1.
There are two ways to fix this problem, (1) changing 'return 1' in do_bind() to e.g. 'return 10' so the compiler has to do 'do_bind(ctx) ? 1 :0', or (2) suggested by Andrii, marking do_bind() with __weak attribute so the compiler cannot make any assumption on do_bind() return value.
This patch adopted adding __weak approach which is simpler and more resistant to potential compiler optimizations.
--- tools/testing/selftests/bpf/progs/connect4_prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/connect4_prog.c +1 -1
@@ -32,7 +32,7 @@#define IFNAMSIZ 16#endif -__attribute__ ((noinline)) +__attribute__ ((noinline))__weak int do_bind (struct bpf_sock_addr *ctx) {struct sockaddr_in sa = {};
Greg Kroah-Hartman
maintainerPATCH 176/183 selftests/bpf: Fix sk_assign on s390x
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 7ce878ca81bca7811e669db4c394b86780e0dbe4 ]
sk_assign is failing on an s390x machine running Debian "bookworm" for 2 reasons: legacy server_map definition and uninitialized addrlen in recvfrom() call.
Fix by adding a new-style server_map definition and dropping addrlen (recvfrom() allows NULL values for src_addr and addrlen).
Since the test should support tc built without libbpf, build the prog
twice: with the old-style definition and with the new-style definition, then select the right one at runtime. This could be done at compile time too, but this would not be cross-compilation friendly.
--- tools/testing/selftests/bpf/prog_tests/sk_assign.c | 25 ++++++++++---- tools/testing/selftests/bpf/progs/test_sk_assign.c | 11 ++++++ tools/testing/selftests/bpf/progs/test_sk_assign_libbpf.c | 3 + 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/test_sk_assign_libbpf.c
tools/testing/selftests/bpf/prog_tests/sk_assign.c +19 -6
@@ -29,7 +29,23 @@ static int stop, duration;static bool configure_stack (void ) { +char tc_version[128 ];char tc_cmd[BUFSIZ ]; +char *prog; +FILE *tc; + +/* Check whether tc is built with libbpf. */ + tc =popen ("tc -V" ,"r" ); +if (CHECK_FAIL (!tc)) +return false; +if (CHECK_FAIL (!fgets (tc_version,sizeof (tc_version), tc))) +return false; +if (strstr (tc_version,", libbpf " )) + prog ="test_sk_assign_libbpf.bpf.o" ; +else + prog ="test_sk_assign.bpf.o" ; +if (CHECK_FAIL (pclose (tc))) +return false;/* Move to a new networking namespace */ if (CHECK_FAIL (unshare (CLONE_NEWNET )))
@@ -46,8 +62,8 @@ configure_stack(void)/* Load qdisc, BPF program */ if (CHECK_FAIL (system ("tc qdisc add dev lo clsact" )))return false; -sprintf (tc_cmd,"%s %s %s %s" ,"tc filter add dev lo ingress bpf" , -"direct-action object-file ./test_sk_assign.bpf.o" , +sprintf (tc_cmd,"%s %s %s %s %s" ,"tc filter add dev lo ingress bpf" , +"direct-action object-file" , prog,"section tc" , (env.verbosity <VERBOSE_VERY ) ?" 2>/dev/null" :"verbose" ); if (CHECK(system(tc_cmd), "BPF load failed;",
@@ -129,15 +145,12 @@ get_port(int fd)static ssize_t rcv_msg (int srv_client,int type) { -struct sockaddr_storage ss;char buf[BUFSIZ ]; -socklen_t slen;if (type ==SOCK_STREAM )return read (srv_client, &buf,sizeof (buf));else -return recvfrom (srv_client, &buf,sizeof (buf),0 , - (struct sockaddr *)&ss, &slen); +return recvfrom (srv_client, &buf,sizeof (buf),0 ,NULL ,NULL ); } static int
tools/testing/selftests/bpf/progs/test_sk_assign.c +11 -0
@@ -16,6 +16,16 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> +#if defined(IPROUTE2_HAVE_LIBBPF ) +/* Use a new-style map definition. */ +struct { + __uint(type, BPF_MAP_TYPE_SOCKMAP); + __type(key, int); + __type(value, __u64); + __uint(pinning, LIBBPF_PIN_BY_NAME); + __uint(max_entries, 1); +} server_map SEC(".maps"); +#else /* Pin map under /sys/fs/bpf/tc/globals/<map name> */ #define PIN_GLOBAL_NS 2
@@ -35,6 +45,7 @@ struct { .max_elem = 1, .pinning = PIN_GLOBAL_NS, }; +#endif char _license[] SEC("license") = "GPL";
tools/testing/selftests/bpf/progs/test_sk_assign_libbpf.c new file +3 -0
@@ -0,0 +1,3 @@ +// SPDX-License-Identifier: GPL-2.0 +#define IPROUTE2_HAVE_LIBBPF +#include "test_sk_assign.c"
Greg Kroah-Hartman
maintainerPATCH 177/183 drm/amd/display: use max_dsc_bpp in amdgpu_dm
In reply to Greg Kroah-HartmanFrom: Hamza Mahfooz <[email protected]>
commit 6e5abe94c6eb9b281398e39819217e8fdd1c336f upstream.
Since, the quirk is handled in the DRM core now, we can use that value instead of the internal value.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++---- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 11 +++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -4
@@ -5714,16 +5714,14 @@ static void apply_dsc_policy_for_stream( {struct drm_connector *drm_connector = &aconnector->base;uint32_t link_bandwidth_kbps; -uint32_t max_dsc_target_bpp_limit_override =0 ;struct dc *dc = sink->ctx->dc;uint32_t max_supported_bw_in_kbps, timing_bw_in_kbps;uint32_t dsc_max_supported_bw_in_kbps; +uint32_t max_dsc_target_bpp_limit_override = + drm_connector->display_info.max_dsc_bpp; link_bandwidth_kbps =dc_link_bandwidth_kbps (aconnector->dc_link,dc_link_get_link_cap (aconnector->dc_link)); -if (stream->link && stream->link->local_sink) - max_dsc_target_bpp_limit_override = - stream->link->local_sink->edid_caps.panel_patch.max_dsc_target_bpp_limit;/* Set DSC policy according to dsc_clock_en */ dc_dsc_policy_set_enable_dsc_when_not_needed(
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +9 -2
@@ -673,15 +673,18 @@ static void set_dsc_configs_from_fairnes int count, int k) { +struct drm_connector *drm_connector;int i;for (i =0 ; i < count; i++) { + drm_connector = ¶ms[i].aconnector->base; +memset (¶ms[i].timing->dsc_cfg,0 ,sizeof (params[i].timing->dsc_cfg));if (vars[i + k].dsc_enabled &&dc_dsc_compute_config ( params[i].sink->ctx->dc->res_pool->dscs[0 ], ¶ms[i].sink->dsc_caps.dsc_dec_caps, params[i].sink->ctx->dc->debug.dsc_min_slice_height_override, - params[i].sink->edid_caps.panel_patch.max_dsc_target_bpp_limit, + drm_connector->display_info.max_dsc_bpp,0 , params[i].timing, ¶ms[i].timing->dsc_cfg)) {
@@ -723,12 +726,16 @@ static int bpp_x16_from_pbn(struct dsc_mstruct dc_dsc_config dsc_config;u64 kbps; +struct drm_connector *drm_connector = ¶m.aconnector->base; +uint32_t max_dsc_target_bpp_limit_override = + drm_connector->display_info.max_dsc_bpp; + kbps =div_u64 ((u64 )pbn *994 *8 *54 ,64 );dc_dsc_compute_config ( param.sink->ctx->dc->res_pool->dscs[0 ], ¶m.sink->dsc_caps.dsc_dec_caps, param.sink->ctx->dc->debug.dsc_min_slice_height_override, - param.sink->edid_caps.panel_patch.max_dsc_target_bpp_limit, + max_dsc_target_bpp_limit_override, (int ) kbps, param.timing, &dsc_config);return dsc_config.bits_per_pixel;
Greg Kroah-Hartman
maintainerPATCH 178/183 drm/amd/display: fix some coding style issues
In reply to Greg Kroah-HartmanFrom: Srinivasan Shanmugam <[email protected]>
commit ae67558be712237109100fd14f12378adcf24356 upstream.
Fix the following checkpatch checks in amdgpu_dm.c
CHECK: Prefer kernel type 'u8' over 'uint8_t'
CHECK: Prefer kernel type 'u32' over 'uint32_t'
CHECK: Prefer kernel type 'u64' over 'uint64_t'
CHECK: Prefer kernel type 's32' over 'int32_t'
[ PSR-SU support was introduced in kernel 6.2 with commits like
30ebe41582d1 ("drm/amd/display: add FB_DAMAGE_CLIPS support") but PSR-SU isn't enabled in 6.1.y, so this block needs to be skipped when backporting. ]
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 90 +++++++++++----------- 1 file changed, 45 insertions(+), 45 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +45 -45
@@ -211,7 +211,7 @@ static void amdgpu_dm_destroy_drm_devicestatic int amdgpu_dm_connector_init (struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *amdgpu_dm_connector, -uint32_t link_index, +u32 link_index,struct amdgpu_encoder *amdgpu_encoder); static int amdgpu_dm_encoder_init(struct drm_device *dev, struct amdgpu_encoder *aencoder,
@@ -263,7 +263,7 @@ static u32 dm_vblank_get_counter(structstatic int dm_crtc_get_scanoutpos (struct amdgpu_device *adev,int crtc,u32 *vbl,u32 *position) { -uint32_t v_blank_start, v_blank_end, h_position, v_position; +u32 v_blank_start, v_blank_end, h_position, v_position;if ((crtc <0 ) || (crtc >= adev->mode_info.num_crtc))return -EINVAL ;
@@ -391,7 +391,7 @@ static void dm_pflip_high_irq(void *intestruct amdgpu_device *adev = irq_params->adev;unsigned long flags;struct drm_pending_vblank_event *e; -uint32_t vpos, hpos, v_blank_start, v_blank_end; +u32 vpos, hpos, v_blank_start, v_blank_end;bool vrr_active; amdgpu_crtc =get_crtc_by_otg_inst (adev, irq_params->irq_src -IRQ_TYPE_PFLIP );
@@ -678,7 +678,7 @@ static void dmub_hpd_callback(struct amdstruct drm_connector *connector;struct drm_connector_list_iter iter;struct dc_link *link; -uint8_t link_index =0 ; +u8 link_index =0 ;struct drm_device *dev;if (adev ==NULL )
@@ -779,7 +779,7 @@ static void dm_dmub_outbox1_low_irq(voidstruct amdgpu_device *adev = irq_params->adev;struct amdgpu_display_manager *dm = &adev->dm;struct dmcub_trace_buf_entry entry = {0 }; -uint32_t count =0 ; +u32 count =0 ;struct dmub_hpd_work *dmub_hpd_wrk;struct dc_link *plink =NULL ;
@@ -1045,7 +1045,7 @@ static int dm_dmub_hw_init(struct amdgpustruct dmub_srv_hw_params hw_params;enum dmub_status status;const unsigned char *fw_inst_const, *fw_bss_data; -uint32_t i, fw_inst_const_size, fw_bss_data_size; +u32 i, fw_inst_const_size, fw_bss_data_size;bool has_hw_support;if (!dmub_srv)
@@ -1206,10 +1206,10 @@ static void dm_dmub_hw_resume(struct amdstatic void mmhub_read_system_context (struct amdgpu_device *adev,struct dc_phy_addr_space_config *pa_config) { -uint64_t pt_base; -uint32_t logical_addr_low; -uint32_t logical_addr_high; -uint32_t agp_base, agp_bot, agp_top; +u64 pt_base; +u32 logical_addr_low; +u32 logical_addr_high; +u32 agp_base, agp_bot, agp_top;PHYSICAL_ADDRESS_LOC page_table_start, page_table_end, page_table_base;memset (pa_config,0 ,sizeof (*pa_config));
@@ -2536,7 +2536,7 @@ struct amdgpu_dm_connector * amdgpu_dm_find_first_crtc_matching_connector(struct drm_atomic_state *state, struct drm_crtc *crtc) { - uint32_t i; + u32 i;struct drm_connector_state *new_con_state;struct drm_connector *connector;struct drm_crtc *crtc_from_state;
@@ -3172,8 +3172,8 @@ static void handle_hpd_irq(void *param)static void dm_handle_mst_sideband_msg (struct amdgpu_dm_connector *aconnector) { -uint8_t esi[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {0 }; -uint8_t dret; +u8 esi[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {0 }; +u8 dret;bool new_irq_handled = false;int dpcd_addr;int dpcd_bytes_to_read;
@@ -3201,7 +3201,7 @@ static void dm_handle_mst_sideband_msg(swhile (dret == dpcd_bytes_to_read && process_count < max_process_count) { -uint8_t retry; +u8 retry; dret =0 ; process_count++;
@@ -3220,7 +3220,7 @@ static void dm_handle_mst_sideband_msg(s dpcd_bytes_to_read -1 ;for (retry =0 ; retry <3 ; retry++) { -uint8_t wret; +u8 wret; wret = drm_dp_dpcd_write( &aconnector->dm_dp_aux.aux,
@@ -4236,12 +4236,12 @@ static void amdgpu_set_panel_orientationstatic int amdgpu_dm_initialize_drm_device (struct amdgpu_device *adev) {struct amdgpu_display_manager *dm = &adev->dm; -int32_t i; +s32 i;struct amdgpu_dm_connector *aconnector =NULL ;struct amdgpu_encoder *aencoder =NULL ;struct amdgpu_mode_info *mode_info = &adev->mode_info; -uint32_t link_cnt; -int32_t primary_planes; +u32 link_cnt; +s32 primary_planes;enum dc_connection_type new_connection_type = dc_connection_none;const struct dc_plane_cap *plane;bool psr_feature_enabled = false;
@@ -4768,7 +4768,7 @@ fill_plane_color_attributes(const struct static int fill_dc_plane_info_and_addr(struct amdgpu_device *adev, const struct drm_plane_state *plane_state, - const uint64_t tiling_flags, + const u64 tiling_flags, struct dc_plane_info *plane_info, struct dc_plane_address *address, bool tmz_surface,
@@ -4977,7 +4977,7 @@ static void fill_dc_dirty_rects(struct duint32_t num_clips;bool bb_changed;bool fb_changed; -uint32_t i =0 ; +u32 i =0 ; flip_addrs->dirty_rect_count =0 ;
@@ -5111,7 +5111,7 @@ static enum dc_color_depth convert_color_depth_from_display_info(const struct drm_connector *connector, bool is_y420, int requested_bpc) { - uint8_t bpc; + u8 bpc;if (is_y420) { bpc =8 ;
@@ -5655,8 +5655,8 @@ static void apply_dsc_policy_for_edp(str uint32_t max_dsc_target_bpp_limit_override) {const struct dc_link_settings *verified_link_cap =NULL ; -uint32_t link_bw_in_kbps; -uint32_t edp_min_bpp_x16, edp_max_bpp_x16; +u32 link_bw_in_kbps; +u32 edp_min_bpp_x16, edp_max_bpp_x16;struct dc *dc = sink->ctx->dc;struct dc_dsc_bw_range bw_range = {0 };struct dc_dsc_config dsc_cfg = {0 };
@@ -5713,11 +5713,11 @@ static void apply_dsc_policy_for_stream( struct dsc_dec_dpcd_caps *dsc_caps) {struct drm_connector *drm_connector = &aconnector->base; -uint32_t link_bandwidth_kbps; +u32 link_bandwidth_kbps;struct dc *dc = sink->ctx->dc; -uint32_t max_supported_bw_in_kbps, timing_bw_in_kbps; -uint32_t dsc_max_supported_bw_in_kbps; -uint32_t max_dsc_target_bpp_limit_override = +u32 max_supported_bw_in_kbps, timing_bw_in_kbps; +u32 dsc_max_supported_bw_in_kbps; +u32 max_dsc_target_bpp_limit_override = drm_connector->display_info.max_dsc_bpp; link_bandwidth_kbps = dc_link_bandwidth_kbps(aconnector->dc_link,
@@ -6871,7 +6871,7 @@ static uint add_fs_modes(struct amdgpu_dconst struct drm_display_mode *m;struct drm_display_mode *new_mode;uint i; -uint32_t new_modes_count =0 ; +u32 new_modes_count =0 ;/* Standard FPS values *
@@ -6885,7 +6885,7 @@ static uint add_fs_modes(struct amdgpu_d* 60 - Commonly used * 48,72,96,120 - Multiples of 24 */ -static const uint32_t common_rates[] = { +static const u32 common_rates[] = {23976 ,24000 ,25000 ,29970 ,30000 ,48000 ,50000 ,60000 ,72000 ,96000 ,120000 };
@@ -6901,8 +6901,8 @@ static uint add_fs_modes(struct amdgpu_dreturn 0 ;for (i =0 ; i <ARRAY_SIZE (common_rates); i++) { -uint64_t target_vtotal, target_vtotal_diff; -uint64_t num, den; +u64 target_vtotal, target_vtotal_diff; +u64 num, den;if (drm_mode_vrefresh (m) *1000 < common_rates[i])continue ;
@@ -7150,7 +7150,7 @@ create_i2c(struct ddc_service *ddc_servi*/ static int amdgpu_dm_connector_init (struct amdgpu_display_manager *dm,struct amdgpu_dm_connector *aconnector, -uint32_t link_index, +u32 link_index,struct amdgpu_encoder *aencoder) {int res =0 ;
@@ -7641,8 +7641,8 @@ static void amdgpu_dm_commit_planes(stru struct drm_crtc *pcrtc, bool wait_for_vblank) { - uint32_t i; -uint64_t timestamp_ns; +u32 i; +u64 timestamp_ns;struct drm_plane *plane;struct drm_plane_state *old_plane_state, *new_plane_state;struct amdgpu_crtc *acrtc_attach =to_amdgpu_crtc (pcrtc);
@@ -7653,7 +7653,7 @@ static void amdgpu_dm_commit_planes(struto_dm_crtc_state (drm_atomic_get_old_crtc_state (state, pcrtc));int planes_count =0 , vpos, hpos;unsigned long flags; -uint32_t target_vblank, last_flip_vblank; +u32 target_vblank, last_flip_vblank;bool vrr_active =amdgpu_dm_vrr_active (acrtc_state);bool cursor_update = false;bool pflip_present = false;
@@ -8102,7 +8102,7 @@ static void amdgpu_dm_atomic_commit_tailstruct amdgpu_display_manager *dm = &adev->dm;struct dm_atomic_state *dm_state;struct dc_state *dc_state =NULL , *dc_state_temp =NULL ; -uint32_t i, j; +u32 i, j;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state, *new_crtc_state;unsigned long flags;
@@ -8732,7 +8732,7 @@ is_timing_unchanged_for_freesync(struct }static void set_freesync_fixed_config (struct dm_crtc_state *dm_new_crtc_state) { -uint64_t num, den, res; +u64 num, den, res;struct drm_crtc_state *new_crtc_state = &dm_new_crtc_state->base; dm_new_crtc_state->freesync_config.state =VRR_STATE_ACTIVE_FIXED ;
@@ -9908,7 +9908,7 @@ fail:static bool is_dp_capable_without_timing_msa (struct dc *dc,struct amdgpu_dm_connector *amdgpu_dm_connector) { -uint8_t dpcd_data; +u8 dpcd_data;bool capable = false; if (amdgpu_dm_connector->dc_link &&
@@ -9927,7 +9927,7 @@ static bool is_dp_capable_without_timingstatic bool dm_edid_parser_send_cea (struct amdgpu_display_manager *dm,unsigned int offset,unsigned int total_length, -uint8_t *data, +u8 *data,unsigned int length,struct amdgpu_hdmi_vsdb_info *vsdb) {
@@ -9982,7 +9982,7 @@ static bool dm_edid_parser_send_cea(stru }static bool parse_edid_cea_dmcu (struct amdgpu_display_manager *dm, -uint8_t *edid_ext,int len, +u8 *edid_ext,int len,struct amdgpu_hdmi_vsdb_info *vsdb_info) {int i;
@@ -10023,7 +10023,7 @@ static bool parse_edid_cea_dmcu(struct a }static bool parse_edid_cea_dmub (struct amdgpu_display_manager *dm, -uint8_t *edid_ext,int len, +u8 *edid_ext,int len,struct amdgpu_hdmi_vsdb_info *vsdb_info) {int i;
@@ -10039,7 +10039,7 @@ static bool parse_edid_cea_dmub(struct a }static bool parse_edid_cea (struct amdgpu_dm_connector *aconnector, -uint8_t *edid_ext,int len, +u8 *edid_ext,int len,struct amdgpu_hdmi_vsdb_info *vsdb_info) {struct amdgpu_device *adev =drm_to_adev (aconnector->base.dev);
@@ -10053,7 +10053,7 @@ static bool parse_edid_cea(struct amdgpustatic int parse_hdmi_amd_vsdb (struct amdgpu_dm_connector *aconnector,struct edid *edid,struct amdgpu_hdmi_vsdb_info *vsdb_info) { -uint8_t *edid_ext =NULL ; +u8 *edid_ext =NULL ;int i;bool valid_vsdb_found = false;
@@ -10229,7 +10229,7 @@ void amdgpu_dm_trigger_timing_sync(struc }void dm_write_reg_func (const struct dc_context *ctx,uint32_t address, -uint32_t value,const char *func_name) +u32 value,const char *func_name) {#ifdef DM_CHECK_ADDR_0 if (address ==0 ) {
@@ -10244,7 +10244,7 @@ void dm_write_reg_func(const struct dc_cuint32_t dm_read_reg_func (const struct dc_context *ctx,uint32_t address,const char *func_name) { -uint32_t value; +u32 value;#ifdef DM_CHECK_ADDR_0 if (address ==0 ) {DC_ERR ("invalid register read; address = 0\n" );
Greg Kroah-Hartman
maintainerPATCH 179/183 drm/dp_mst: Clear MSG_RDY flag before sending new message
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
commit 72f1de49ffb90b29748284f27f1d6b829ab1de95 upstream.
[Why]
The sequence for collecting down_reply from source perspective should be:
Request_n->repeat (get partial reply of Request_n->clear message ready flag to ack DPRX that the message is received) till all partial replies for Request_n are received->new Request_n+1.
Now there is chance that drm_dp_mst_hpd_irq() will fire new down request in the tx queue when the down reply is incomplete. Source is restricted to generate interveleaved message transactions so we should avoid it.
Also, while assembling partial reply packets, reading out DPCD DOWN_REP Sideband MSG buffer + clearing DOWN_REP_MSG_RDY flag should be wrapped up as a complete operation for reading out a reply packet. Kicking off a new request before clearing DOWN_REP_MSG_RDY flag might be risky. e.g. If the reply of the new request has overwritten the DPRX DOWN_REP Sideband MSG buffer before source writing one to clear DOWN_REP_MSG_RDY flag, source then unintentionally flushes the reply for the new request. Should handle the up request in the same way.
[How]
Separete drm_dp_mst_hpd_irq() into 2 steps. After acking the MST IRQ event, driver calls drm_dp_mst_hpd_irq_send_new_request() and might trigger drm_dp_mst_kick_tx() only when there is no on going message transaction.
Changes since v1:
* Reworked on review comments received
-> Adjust the fix to let driver explicitly kick off new down request when mst irq event is handled and acked
-> Adjust the commit message
Changes since v2:
* Adjust the commit message
* Adjust the naming of the divided 2 functions and add a new input parameter "ack".
* Adjust code flow as per review comments.
Changes since v3:
* Update the function description of drm_dp_mst_hpd_irq_handle_event
Changes since v4:
* Change ack of drm_dp_mst_hpd_irq_handle_event() to be an array align the size of esi[]
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 30 ++++++------ drivers/gpu/drm/display/drm_dp_mst_topology.c | 54 +++++++++++++++++++--- drivers/gpu/drm/i915/display/intel_dp.c | 7 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 12 +++- include/drm/display/drm_dp_mst_helper.h | 7 ++ 5 files changed, 80 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +16 -14
@@ -3201,6 +3201,7 @@ static void dm_handle_mst_sideband_msg(swhile (dret == dpcd_bytes_to_read && process_count < max_process_count) { +u8 ack[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {};u8 retry; dret =0 ;
@@ -3209,28 +3210,29 @@ static void dm_handle_mst_sideband_msg(sDRM_DEBUG_DRIVER ("ESI %02x %02x %02x\n" , esi[0 ], esi[1 ], esi[2 ]);/* handle HPD short pulse irq */ if (aconnector->mst_mgr.mst_state) -drm_dp_mst_hpd_irq ( - &aconnector->mst_mgr, - esi, - &new_irq_handled); +drm_dp_mst_hpd_irq_handle_event (&aconnector->mst_mgr, + esi, + ack, + &new_irq_handled);if (new_irq_handled) {/* ACK at DPCD to notify down stream */ -const int ack_dpcd_bytes_to_write = - dpcd_bytes_to_read -1 ; -for (retry =0 ; retry <3 ; retry++) { -u8 wret; +ssize_t wret; - wret =drm_dp_dpcd_write ( - &aconnector->dm_dp_aux.aux, - dpcd_addr +1 , - &esi[1 ], - ack_dpcd_bytes_to_write); -if (wret == ack_dpcd_bytes_to_write) + wret =drm_dp_dpcd_writeb (&aconnector->dm_dp_aux.aux, + dpcd_addr +1 , + ack[1 ]); +if (wret ==1 )break ; } +if (retry ==3 ) { +DRM_ERROR ("Failed to ack MST event.\n" ); +return ; + } + +drm_dp_mst_hpd_irq_send_new_request (&aconnector->mst_mgr);/* check if there is new irq to be handled */ dret = drm_dp_dpcd_read( &aconnector->dm_dp_aux.aux,
drivers/gpu/drm/display/drm_dp_mst_topology.c +47 -7
82 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_dp.c +4 -3
@@ -3804,9 +3804,7 @@ intel_dp_mst_hpd_irq(struct intel_dp *in {bool handled = false; -drm_dp_mst_hpd_irq (&intel_dp->mst_mgr, esi, &handled); -if (handled) - ack[1 ] |= esi[1 ] & (DP_DOWN_REP_MSG_RDY |DP_UP_REQ_MSG_RDY ); +drm_dp_mst_hpd_irq_handle_event (&intel_dp->mst_mgr, esi, ack, &handled);if (esi[1 ] &DP_CP_IRQ ) {intel_hdcp_handle_cp_irq (intel_dp->attached_connector);
@@ -3881,6 +3879,9 @@ intel_dp_check_mst_status(struct intel_dif (!intel_dp_ack_sink_irq_esi (intel_dp, ack))drm_dbg_kms (&i915->drm,"Failed to ack ESI\n" ); + +if (ack[1 ] & (DP_DOWN_REP_MSG_RDY |DP_UP_REQ_MSG_RDY )) +drm_dp_mst_hpd_irq_send_new_request (&intel_dp->mst_mgr); }return link_ok;
drivers/gpu/drm/nouveau/dispnv50/disp.c +8 -4
@@ -1473,22 +1473,26 @@ nv50_mstm_service(struct nouveau_drm *dru8 esi[8 ] = {};while (handled) { +u8 ack[8 ] = {}; + rc =drm_dp_dpcd_read (aux,DP_SINK_COUNT_ESI , esi,8 );if (rc !=8 ) { ret = false;break ; } -drm_dp_mst_hpd_irq (&mstm->mgr, esi, &handled); +drm_dp_mst_hpd_irq_handle_event (&mstm->mgr, esi, ack, &handled);if (!handled)break ; - rc =drm_dp_dpcd_write (aux,DP_SINK_COUNT_ESI +1 , &esi[1 ], -3 ); -if (rc !=3 ) { + rc =drm_dp_dpcd_writeb (aux,DP_SINK_COUNT_ESI +1 , ack[1 ]); + +if (rc !=1 ) { ret = false;break ; } + +drm_dp_mst_hpd_irq_send_new_request (&mstm->mgr); }if (!ret)
include/drm/display/drm_dp_mst_helper.h +5 -2
@@ -815,8 +815,11 @@ void drm_dp_mst_topology_mgr_destroy(strbool drm_dp_read_mst_cap (struct drm_dp_aux *aux,const u8 dpcd[DP_RECEIVER_CAP_SIZE ]);int drm_dp_mst_topology_mgr_set_mst (struct drm_dp_mst_topology_mgr *mgr,bool mst_state); -int drm_dp_mst_hpd_irq (struct drm_dp_mst_topology_mgr *mgr,u8 *esi,bool *handled); - +int drm_dp_mst_hpd_irq_handle_event (struct drm_dp_mst_topology_mgr *mgr, +const u8 *esi, +u8 *ack, +bool *handled); +void drm_dp_mst_hpd_irq_send_new_request (struct drm_dp_mst_topology_mgr *mgr); int drm_dp_mst_detect_port(struct drm_connector *connector,
Greg Kroah-Hartman
maintainerPATCH 180/183 drm/amd/display: force connector state when bpc changes during compliance
In reply to Greg Kroah-HartmanFrom: Qingqing Zhuo <[email protected]>
commit 028c4ccfb8127255d60f8d9edde96cacf2958082 upstream.
[Why]
During DP DSC compliance tests, bpc requested would change between sub-tests, which requires stream to be recommited.
[How]
Force connector to disconnect and reconnect whenever there is a bpc change in automated test.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 55 +++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 5 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 125 ++++++++++++ drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 139 +------------- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 6 5 files changed, 209 insertions(+), 121 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +54 -1
@@ -40,6 +40,9 @@#include "dc/dc_stat.h" #include "amdgpu_dm_trace.h" #include "dc/inc/dc_link_ddc.h" +#include "dpcd_defs.h" +#include "dc/inc/link_dpcd.h" +#include "link_service_types.h" #include "vid.h" #include "amdgpu.h"
@@ -1273,6 +1276,21 @@ static void mmhub_read_system_context(st } +static void force_connector_state ( +struct amdgpu_dm_connector *aconnector, +enum drm_connector_force force_state) +{ +struct drm_connector *connector = &aconnector->base; + +mutex_lock (&connector->dev->mode_config.mutex); + aconnector->base.force = force_state; +mutex_unlock (&connector->dev->mode_config.mutex); + +mutex_lock (&aconnector->hpd_lock); +drm_kms_helper_connector_hotplug_event (connector); +mutex_unlock (&aconnector->hpd_lock); +} +static void dm_handle_hpd_rx_offload_work (struct work_struct *work) {struct hpd_rx_irq_offload_work *offload_work;
@@ -1281,6 +1299,9 @@ static void dm_handle_hpd_rx_offload_worstruct amdgpu_device *adev;enum dc_connection_type new_connection_type = dc_connection_none;unsigned long flags; +union test_response test_response; + +memset (&test_response,0 ,sizeof (test_response)); offload_work = container_of(work, struct hpd_rx_irq_offload_work, work); aconnector = offload_work->offload_wq->aconnector;
@@ -1305,8 +1326,24 @@ static void dm_handle_hpd_rx_offload_wor goto skip;mutex_lock (&adev->dm.dc_lock); -if (offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST) +if (offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST) {dc_link_dp_handle_automated_test (dc_link); + +if (aconnector->timing_changed) { +/* force connector disconnect and reconnect */ +force_connector_state (aconnector,DRM_FORCE_OFF ); +msleep (100 ); +force_connector_state (aconnector,DRM_FORCE_UNSPECIFIED ); + } + + test_response.bits.ACK =1 ; + +core_link_write_dpcd ( + dc_link, +DP_TEST_RESPONSE , + &test_response.raw, +sizeof (test_response)); + }else if ((dc_link->connector_signal !=SIGNAL_TYPE_EDP ) &&hpd_rx_irq_check_link_loss_status (dc_link, &offload_work->data) &&dc_link_dp_allow_hpd_rx_irq (dc_link)) {
@@ -3076,6 +3113,10 @@ void amdgpu_dm_update_connector_after_de aconnector->edid); } + aconnector->timing_requested =kzalloc (sizeof (struct dc_crtc_timing ),GFP_KERNEL ); +if (!aconnector->timing_requested) +dm_error ("%s: failed to create aconnector->requested_timing\n" , __func__); +drm_connector_update_edid_property (connector, aconnector->edid);amdgpu_dm_update_freesync_caps (connector, aconnector->edid);update_connector_ext_caps (aconnector);
@@ -3087,6 +3128,8 @@ void amdgpu_dm_update_connector_after_dedc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ; aconnector->edid =NULL ; +kfree (aconnector->timing_requested); + aconnector->timing_requested =NULL ;#ifdef CONFIG_DRM_AMD_DC_HDCP /* Set CP to DESIRED if it was ENABLED, so we can re-enable it again on hotplug */ if (connector->state->content_protection ==DRM_MODE_CONTENT_PROTECTION_ENABLED )
@@ -3131,6 +3174,8 @@ static void handle_hpd_irq_helper(structif (aconnector->fake_enable) aconnector->fake_enable = false; + aconnector->timing_changed = false; +if (!dc_link_detect_sink (aconnector->dc_link, &new_connection_type))DRM_ERROR ("KMS: Failed to detect connector\n" );
@@ -5896,6 +5941,14 @@ create_stream_for_sink(struct amdgpu_dm_ stream, &mode, &aconnector->base, con_state, old_stream, requested_bpc); +if (aconnector->timing_changed) { +DC_LOG_DEBUG ("%s: overriding timing for automated test, bpc %d, changing to %d\n" , + __func__, + stream->timing.display_color_depth, + aconnector->timing_requested->display_color_depth); + stream->timing = *aconnector->timing_requested; + } +#if defined(CONFIG_DRM_AMD_DC_DCN )/* SST DSC determination policy */ update_dsc_caps (aconnector, sink, stream, &dsc_caps);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +5 -0
@@ -31,6 +31,7 @@#include <drm/drm_connector.h> #include <drm/drm_crtc.h> #include <drm/drm_plane.h> +#include "link_service_types.h" /* * This file contains the definition for amdgpu_display_manager
@@ -650,6 +651,10 @@ struct amdgpu_dm_connector {/* Record progress status of mst*/ uint8_t mst_status; + +/* Automated testing */ +bool timing_changed; +struct dc_crtc_timing *timing_requested; }; static inline void amdgpu_dm_set_mst_status(uint8_t *status,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +125 -0
137 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +19 -120
151 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dm_helpers.h +6 -0
@@ -156,6 +156,12 @@ enum dc_edid_status dm_helpers_read_locastruct dc_link *link, struct dc_sink *sink); +bool dm_helpers_dp_handle_test_pattern_request ( +struct dc_context *ctx, +const struct dc_link *link, +union link_test_pattern dpcd_test_pattern, +union test_misc dpcd_test_params); +void dm_set_dcn_clocks (struct dc_context *ctx,struct dc_clocks *clks);
Greg Kroah-Hartman
maintainerPATCH 181/183 drm/amd/display: Clean up errors & warnings in amdgpu_dm.c
In reply to Greg Kroah-HartmanFrom: Srinivasan Shanmugam <[email protected]>
commit 87279fdf5ee0ad1360765ef70389d1c4d0f81bb6 upstream.
Fix the following errors & warnings reported by checkpatch:
ERROR: space required before the open brace '{'
ERROR: space required before the open parenthesis '('
ERROR: that open brace { should be on the previous line
ERROR: space prohibited before that ',' (ctx:WxW)
ERROR: else should follow close brace '}'
ERROR: open brace '{' following function definitions go on the next line
ERROR: code indent should use tabs where possible
WARNING: braces {} are not necessary for single statement blocks
WARNING: void function return statements are not generally useful
WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on a separate line
[ Modified for missing
c5a31f178e35 ("drm/amd/display: move dp irq handler functions from dc_link_dp to link_dp_irq_handler") which landed in 6.3]
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 133 ++++++++++------------ 1 file changed, 65 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +65 -68
@@ -408,12 +408,12 @@ static void dm_pflip_high_irq(void *intespin_lock_irqsave (&adev_to_drm (adev)->event_lock, flags); -if (amdgpu_crtc->pflip_status !=AMDGPU_FLIP_SUBMITTED ){ -DC_LOG_PFLIP ("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p] \n" , - amdgpu_crtc->pflip_status, -AMDGPU_FLIP_SUBMITTED , - amdgpu_crtc->crtc_id, - amdgpu_crtc); +if (amdgpu_crtc->pflip_status !=AMDGPU_FLIP_SUBMITTED ) { +DC_LOG_PFLIP ("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p]\n" , + amdgpu_crtc->pflip_status, +AMDGPU_FLIP_SUBMITTED , + amdgpu_crtc->crtc_id, + amdgpu_crtc);spin_unlock_irqrestore (&adev_to_drm (adev)->event_lock, flags);return ; }
@@ -861,7 +861,7 @@ static int dm_set_powergating_state(void }/* Prototypes of private functions */ -static int dm_early_init (void * handle); +static int dm_early_init (void *handle);/* Allocate memory for FBC compressed data */ static void amdgpu_dm_fbc_init (struct drm_connector *connector)
@@ -1260,7 +1260,7 @@ static void mmhub_read_system_context(st pa_config->system_aperture.start_addr = (uint64_t )logical_addr_low <<18 ; pa_config->system_aperture.end_addr = (uint64_t )logical_addr_high <<18 ; - pa_config->system_aperture.agp_base = (uint64_t )agp_base <<24 ; + pa_config->system_aperture.agp_base = (uint64_t )agp_base <<24 ; pa_config->system_aperture.agp_bot = (uint64_t )agp_bot <<24 ; pa_config->system_aperture.agp_top = (uint64_t )agp_top <<24 ;
@@ -1343,8 +1343,7 @@ static void dm_handle_hpd_rx_offload_worDP_TEST_RESPONSE , &test_response.raw, sizeof(test_response)); - } -else if ((dc_link->connector_signal !=SIGNAL_TYPE_EDP ) && + }else if ((dc_link->connector_signal !=SIGNAL_TYPE_EDP ) &&hpd_rx_irq_check_link_loss_status (dc_link, &offload_work->data) &&dc_link_dp_allow_hpd_rx_irq (dc_link)) {dc_link_dp_handle_link_loss (dc_link);
@@ -1519,7 +1518,7 @@ static int amdgpu_dm_init(struct amdgpu_mutex_init (&adev->dm.audio_lock);spin_lock_init (&adev->dm.vblank_lock); -if (amdgpu_dm_irq_init (adev)) { +if (amdgpu_dm_irq_init (adev)) {DRM_ERROR ("amdgpu: failed to initialize DM IRQ support.\n" ); goto error; }
@@ -1654,9 +1653,8 @@ static int amdgpu_dm_init(struct amdgpu_if (amdgpu_dc_debug_mask &DC_DISABLE_STUTTER ) adev->dm.dc->debug.disable_stutter = true; -if (amdgpu_dc_debug_mask &DC_DISABLE_DSC ) { +if (amdgpu_dc_debug_mask &DC_DISABLE_DSC ) adev->dm.dc->debug.disable_dsc = true; - }if (amdgpu_dc_debug_mask &DC_DISABLE_CLOCK_GATING ) adev->dm.dc->debug.disable_clock_gate = true;
@@ -1877,8 +1875,6 @@ static void amdgpu_dm_fini(struct amdgpumutex_destroy (&adev->dm.audio_lock);mutex_destroy (&adev->dm.dc_lock);mutex_destroy (&adev->dm.dpia_aux_lock); - -return ; }static int load_dmcu_fw (struct amdgpu_device *adev)
@@ -1887,7 +1883,7 @@ static int load_dmcu_fw(struct amdgpu_deint r;const struct dmcu_firmware_header_v1_0 *hdr; -switch (adev->asic_type) { +switch (adev->asic_type) {#if defined(CONFIG_DRM_AMD_DC_SI )case CHIP_TAHITI :case CHIP_PITCAIRN :
@@ -2679,7 +2675,7 @@ static void dm_gpureset_commit_state(strstruct dc_scaling_info scaling_infos[MAX_SURFACES ];struct dc_flip_addrs flip_addrs[MAX_SURFACES ];struct dc_stream_update stream_update; - } * bundle; + } *bundle;int k, m; bundle =kzalloc (sizeof (*bundle),GFP_KERNEL );
@@ -2709,8 +2705,6 @@ static void dm_gpureset_commit_state(str cleanup:kfree (bundle); - -return ; }static int dm_resume (void *handle)
@@ -2924,8 +2918,7 @@ static const struct amd_ip_funcs amdgpu_ .set_powergating_state = dm_set_powergating_state, }; -const struct amdgpu_ip_block_version dm_ip_block = -{ +const struct amdgpu_ip_block_version dm_ip_block = { .type =AMD_IP_BLOCK_TYPE_DCE , .major =1 , .minor =0 ,
@@ -2982,9 +2975,12 @@ static void update_connector_ext_caps(st caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps; caps->aux_support = false; -if (caps->ext_caps->bits.oled ==1 /*|| -caps->ext_caps->bits.sdr_aux_backlight_control == 1 || -caps->ext_caps->bits.hdr_aux_backlight_control == 1*/ ) +if (caps->ext_caps->bits.oled ==1 +/* +* || +* caps->ext_caps->bits.sdr_aux_backlight_control == 1 || +* caps->ext_caps->bits.hdr_aux_backlight_control == 1 +*/ ) caps->aux_support = true;if (amdgpu_backlight ==0 )
@@ -3248,6 +3244,7 @@ static void dm_handle_mst_sideband_msg(s process_count < max_process_count) {u8 ack[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {};u8 retry; + dret =0 ; process_count++;
@@ -3449,7 +3446,7 @@ static void register_hpd_handlers(struct aconnector =to_amdgpu_dm_connector (connector); dc_link = aconnector->dc_link; -if (DC_IRQ_SOURCE_INVALID != dc_link->irq_source_hpd) { +if (dc_link->irq_source_hpd !=DC_IRQ_SOURCE_INVALID ) { int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ; int_params.irq_source = dc_link->irq_source_hpd;
@@ -3458,7 +3455,7 @@ static void register_hpd_handlers(struct (void *) aconnector); } -if (DC_IRQ_SOURCE_INVALID != dc_link->irq_source_hpd_rx) { +if (dc_link->irq_source_hpd_rx !=DC_IRQ_SOURCE_INVALID ) {/* Also register for DP short pulse (hpd_rx). */ int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ;
@@ -3484,7 +3481,7 @@ static int dce60_register_irq_handlers(sstruct dc_interrupt_params int_params = {0 };int r;int i; -unsigned client_id =AMDGPU_IRQ_CLIENTID_LEGACY ; +unsigned int client_id =AMDGPU_IRQ_CLIENTID_LEGACY ; int_params.requested_polarity =INTERRUPT_POLARITY_DEFAULT ; int_params.current_polarity =INTERRUPT_POLARITY_DEFAULT ;
@@ -3498,11 +3495,12 @@ static int dce60_register_irq_handlers(s* Base driver will call amdgpu_dm_irq_handler() for ALL interrupts * coming from DC hardware. * amdgpu_dm_irq_handler() will re-direct the interrupt to DC -* for acknowledging and handling. */ +* for acknowledging and handling. +*/ /* Use VBLANK interrupt */ for (i =0 ; i < adev->mode_info.num_crtc; i++) { - r =amdgpu_irq_add_id (adev, client_id, i+1 , &adev->crtc_irq); + r =amdgpu_irq_add_id (adev, client_id, i +1 , &adev->crtc_irq);if (r) {DRM_ERROR ("Failed to add crtc irq id!\n" );return r;
@@ -3510,7 +3508,7 @@ static int dce60_register_irq_handlers(s int_params.int_context =INTERRUPT_HIGH_IRQ_CONTEXT ; int_params.irq_source = -dc_interrupt_to_irq_source (dc, i+1 ,0 ); +dc_interrupt_to_irq_source (dc, i +1 ,0 ); c_irq_params = &adev->dm.vblank_params[int_params.irq_source -DC_IRQ_SOURCE_VBLANK1 ];
@@ -3566,7 +3564,7 @@ static int dce110_register_irq_handlers(struct dc_interrupt_params int_params = {0 };int r;int i; -unsigned client_id =AMDGPU_IRQ_CLIENTID_LEGACY ; +unsigned int client_id =AMDGPU_IRQ_CLIENTID_LEGACY ;if (adev->family >=AMDGPU_FAMILY_AI ) client_id =SOC15_IH_CLIENTID_DCE ;
@@ -3583,7 +3581,8 @@ static int dce110_register_irq_handlers(* Base driver will call amdgpu_dm_irq_handler() for ALL interrupts * coming from DC hardware. * amdgpu_dm_irq_handler() will re-direct the interrupt to DC -* for acknowledging and handling. */ +* for acknowledging and handling. +*/ /* Use VBLANK interrupt */ for (i =VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0 ; i <=VISLANDS30_IV_SRCID_D6_VERTICAL_INTERRUPT0 ; i++) {
@@ -4032,7 +4031,7 @@ static void amdgpu_dm_update_backlight_c }static int get_brightness_range (const struct amdgpu_dm_backlight_caps *caps, -unsigned *min,unsigned *max) +unsigned int *min,unsigned int *max) {if (!caps)return 0 ;
@@ -4052,7 +4051,7 @@ static int get_brightness_range(const ststatic u32 convert_brightness_from_user (const struct amdgpu_dm_backlight_caps *caps,uint32_t brightness) { -unsigned min, max; +unsigned int min, max;if (!get_brightness_range (caps, &min, &max))return brightness;
@@ -4065,7 +4064,7 @@ static u32 convert_brightness_from_user(static u32 convert_brightness_to_user (const struct amdgpu_dm_backlight_caps *caps,uint32_t brightness) { -unsigned min, max; +unsigned int min, max;if (!get_brightness_range (caps, &min, &max))return brightness;
@@ -4546,7 +4545,6 @@ fail:static void amdgpu_dm_destroy_drm_device (struct amdgpu_display_manager *dm) {drm_atomic_private_obj_fini (&dm->atomic_obj); -return ; }/******************************************************************************
@@ -5272,6 +5270,7 @@ static bool adjust_colour_depth_from_dis {enum dc_color_depth depth = timing_out->display_color_depth;int normalized_clk; + do { normalized_clk = timing_out->pix_clk_100hz / 10; /* YCbCr 4:2:0 requires additional adjustment of 1/2 */
@@ -5487,6 +5486,7 @@ create_fake_sink(struct amdgpu_dm_connec {struct dc_sink_init_data sink_init_data = {0 };struct dc_sink *sink =NULL ; + sink_init_data.link = aconnector->dc_link; sink_init_data.sink_signal = aconnector->dc_link->connector_signal;
@@ -5610,7 +5610,7 @@ get_highest_refresh_rate_mode(struct amdreturn &aconnector->freesync_vid_base;/* Find the preferred mode */ - list_for_each_entry (m, list_head, head) { +list_for_each_entry (m, list_head, head) {if (m->type &DRM_MODE_TYPE_PREFERRED ) { m_pref = m;break ;
@@ -5634,7 +5634,7 @@ get_highest_refresh_rate_mode(struct amd* For some monitors, preferred mode is not the mode with highest * supported refresh rate. */ - list_for_each_entry (m, list_head, head) { +list_for_each_entry (m, list_head, head) { current_refresh =drm_mode_vrefresh (m); if (m->hdisplay == m_pref->hdisplay &&
@@ -5905,7 +5905,7 @@ create_stream_for_sink(struct amdgpu_dm_* This may not be an error, the use case is when we have no * usermode calls to reset and set mode upon hotplug. In this * case, we call set mode ourselves to restore the previous mode -* and the modelist may not be filled in in time. +* and the modelist may not be filled in time. */ DRM_DEBUG_DRIVER ("No preferred mode found\n" ); }else {
@@ -5929,9 +5929,9 @@ create_stream_for_sink(struct amdgpu_dm_drm_mode_set_crtcinfo (&mode,0 );/* -* If scaling is enabled and refresh rate didn't change -* we copy the vic and polarities of the old timings -*/ +* If scaling is enabled and refresh rate didn't change +* we copy the vic and polarities of the old timings +*/ if (!scale || mode_refresh != preferred_refresh) fill_stream_properties_from_drm_display_mode( stream, &mode, &aconnector->base, con_state, NULL,
@@ -6593,6 +6593,7 @@ static int dm_encoder_helper_atomic_checif (!state->duplicated) {int max_bpc = conn_state->max_requested_bpc; + is_y420 =drm_mode_is_420_also (&connector->display_info, adjusted_mode) && aconnector->force_yuv420_output; color_depth = convert_color_depth_from_display_info(connector,
@@ -6913,7 +6914,7 @@ static bool is_duplicate_mode(struct amd {struct drm_display_mode *m; - list_for_each_entry (m, &aconnector->base.probed_modes, head) { +list_for_each_entry (m, &aconnector->base.probed_modes, head) {if (drm_mode_equal (m, mode))return true; }
@@ -7216,7 +7217,6 @@ static int amdgpu_dm_connector_init(stru link->priv = aconnector; -DRM_DEBUG_DRIVER ("%s()\n" , __func__); i2c =create_i2c (link->ddc, link->link_index, &res);if (!i2c) {
@@ -7861,8 +7861,7 @@ static void amdgpu_dm_commit_planes(stru* DRI3/Present extension with defined target_msc. */ last_flip_vblank =amdgpu_get_vblank_counter_kms (pcrtc); - } -else { + }else {/* For variable refresh rate mode only: * Get vblank of last completed flip to avoid > 1 vrr * flips per video frame by use of throttling, but allow
@@ -8189,8 +8188,8 @@ static void amdgpu_dm_atomic_commit_taildc_resource_state_copy_construct_current (dm->dc, dc_state); } -for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, - new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, + new_crtc_state, i) {struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); dm_old_crtc_state =to_dm_crtc_state (old_crtc_state);
@@ -8213,9 +8212,7 @@ static void amdgpu_dm_atomic_commit_tail dm_old_crtc_state =to_dm_crtc_state (old_crtc_state); drm_dbg_state(state->dev, - "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, " - "planes_changed:%d, mode_changed:%d,active_changed:%d," - "connectors_changed:%d\n", + "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n", acrtc->crtc_id, new_crtc_state->enable, new_crtc_state->active,
@@ -8700,8 +8697,8 @@ static int do_aquire_global_lock(struct &commit->flip_done, 10*HZ);if (ret ==0 ) -DRM_ERROR ("[CRTC:%d:%s] hw_done or flip_done " -"timed out\n" , crtc->base.id, crtc->name); +DRM_ERROR ("[CRTC:%d:%s] hw_done or flip_done timed out\n" , + crtc->base.id, crtc->name);drm_crtc_commit_put (commit); }
@@ -8786,7 +8783,8 @@ is_timing_unchanged_for_freesync(structreturn false; } -static void set_freesync_fixed_config (struct dm_crtc_state *dm_new_crtc_state) { +static void set_freesync_fixed_config (struct dm_crtc_state *dm_new_crtc_state) +{u64 num, den, res;struct drm_crtc_state *new_crtc_state = &dm_new_crtc_state->base;
@@ -8909,9 +8907,7 @@ static int dm_update_crtc_state(struct a goto skip_modeset; drm_dbg_state(state->dev, - "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, " - "planes_changed:%d, mode_changed:%d,active_changed:%d," - "connectors_changed:%d\n", + "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n", acrtc->crtc_id, new_crtc_state->enable, new_crtc_state->active,
@@ -8940,8 +8936,7 @@ static int dm_update_crtc_state(struct a old_crtc_state)) { new_crtc_state->mode_changed = false;DRM_DEBUG_DRIVER ( -"Mode change not required for front porch change, " -"setting mode_changed to %d" , +"Mode change not required for front porch change, setting mode_changed to %d" , new_crtc_state->mode_changed);set_freesync_fixed_config (dm_new_crtc_state);
@@ -8953,9 +8948,8 @@ static int dm_update_crtc_state(struct astruct drm_display_mode *high_mode; high_mode =get_highest_refresh_rate_mode (aconnector, false); -if (!drm_mode_equal (&new_crtc_state->mode, high_mode)) { +if (!drm_mode_equal (&new_crtc_state->mode, high_mode))set_freesync_fixed_config (dm_new_crtc_state); - } } ret =dm_atomic_get_state (state, &dm_state);
@@ -9123,6 +9117,7 @@ static bool should_reset_plane(struct dr*/ for_each_oldnew_plane_in_state (state, other, old_other_state, new_other_state, i) {struct amdgpu_framebuffer *old_afb, *new_afb; +if (other->type ==DRM_PLANE_TYPE_CURSOR )continue ;
@@ -9221,11 +9216,12 @@ static int dm_check_cursor_fb(struct amd }/* Core DRM takes care of checking FB modifiers, so we only need to -* check tiling flags when the FB doesn't have a modifier. */ +* check tiling flags when the FB doesn't have a modifier. +*/ if (!(fb->flags &DRM_MODE_FB_MODIFIERS )) {if (adev->family <AMDGPU_FAMILY_AI ) { linear =AMDGPU_TILING_GET (afb->tiling_flags,ARRAY_MODE ) !=DC_ARRAY_2D_TILED_THIN1 && -AMDGPU_TILING_GET (afb->tiling_flags,ARRAY_MODE ) !=DC_ARRAY_1D_TILED_THIN1 && +AMDGPU_TILING_GET (afb->tiling_flags,ARRAY_MODE ) !=DC_ARRAY_1D_TILED_THIN1 &&AMDGPU_TILING_GET (afb->tiling_flags,MICRO_TILE_MODE ) ==0 ; }else { linear =AMDGPU_TILING_GET (afb->tiling_flags,SWIZZLE_MODE ) ==0 ;
@@ -9438,12 +9434,12 @@ static int dm_check_crtc_cursor(struct d/* On DCE and DCN there is no dedicated hardware cursor plane. We get a * cursor per pipe but it's going to inherit the scaling and * positioning from the underlying pipe. Check the cursor plane's -* blending properties match the underlying planes'. */ +* blending properties match the underlying planes'. +*/ new_cursor_state =drm_atomic_get_new_plane_state (state, cursor); -if (!new_cursor_state || !new_cursor_state->fb) { +if (!new_cursor_state || !new_cursor_state->fb)return 0 ; - }dm_get_oriented_plane_size (new_cursor_state, &cursor_src_w, &cursor_src_h); cursor_scale_w = new_cursor_state->crtc_w *1000 / cursor_src_w;
@@ -9489,6 +9485,7 @@ static int add_affected_mst_dsc_crtcs(ststruct drm_connector_state *conn_state, *old_conn_state;struct amdgpu_dm_connector *aconnector =NULL ;int i; +for_each_oldnew_connector_in_state (state, connector, old_conn_state, conn_state, i) {if (!conn_state->crtc) conn_state = old_conn_state;
@@ -9931,7 +9928,7 @@ static int amdgpu_dm_atomic_check(struct }/* Store the overall update type for use later in atomic check. */ - for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {struct dm_crtc_state *dm_new_crtc_state =to_dm_crtc_state (new_crtc_state);
@@ -9953,7 +9950,7 @@ fail:else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS )DRM_DEBUG_DRIVER ("Atomic check stopped due to signal.\n" );else -DRM_DEBUG_DRIVER ("Atomic check failed with err: %d \n" , ret); +DRM_DEBUG_DRIVER ("Atomic check failed with err: %d\n" , ret);trace_amdgpu_dm_atomic_check_finish (state, ret);
Greg Kroah-Hartman
maintainerPATCH 182/183 drm/amd/display: fix linux dp link lost handled only one time
In reply to Greg Kroah-HartmanFrom: Hersen Wu <[email protected]>
commit e322843e5e33e72ff218d661f3d15ff9c9f2f1b5 upstream.
[Why]
linux amdgpu defer handle link lost irq. dm add handle request to irq work queue for the first irq of link lost. if link training fails for link lost handle, link will not be enabled anymore.
[How]
allow adding handle request of link lost to work queue before running dp link training for link lost.
[ Modified due to not having
c5a31f178e352 ("drm/amd/display: move dp irq handler functions from dc_link_dp to link_dp_irq_handler") until kernel 6.3-rc1.]
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 +++++++++++++++++++--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 - drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h | 4 +++ 3 files changed, 26 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +21 -3
@@ -1346,10 +1346,28 @@ static void dm_handle_hpd_rx_offload_wor }else if ((dc_link->connector_signal !=SIGNAL_TYPE_EDP ) &&hpd_rx_irq_check_link_loss_status (dc_link, &offload_work->data) &&dc_link_dp_allow_hpd_rx_irq (dc_link)) { -dc_link_dp_handle_link_loss (dc_link); +/* offload_work->data is from handle_hpd_rx_irq-> +* schedule_hpd_rx_offload_work.this is defer handle +* for hpd short pulse. upon here, link status may be +* changed, need get latest link status from dpcd +* registers. if link status is good, skip run link +* training again. +*/ +union hpd_irq_data irq_data; + +memset (&irq_data,0 ,sizeof (irq_data)); + +/* before dc_link_dp_handle_link_loss, allow new link lost handle +* request be added to work queue if link lost at end of dc_link_ +* dp_handle_link_loss +*/ spin_lock_irqsave (&offload_work->offload_wq->offload_lock, flags); offload_work->offload_wq->is_handling_link_loss = false;spin_unlock_irqrestore (&offload_work->offload_wq->offload_lock, flags); + +if ((read_hpd_rx_irq_data (dc_link, &irq_data) ==DC_OK ) && +hpd_rx_irq_check_link_loss_status (dc_link, &irq_data)) +dc_link_dp_handle_link_loss (dc_link); }mutex_unlock (&adev->dm.dc_lock);
@@ -3324,7 +3342,7 @@ static void handle_hpd_rx_irq(void *paraunion hpd_irq_data hpd_irq_data;bool link_loss = false;bool has_left_work = false; -int idx = aconnector->base.index; +int idx = dc_link->link_index;struct hpd_rx_irq_offload_work_queue *offload_wq = &adev->dm.hpd_rx_offload_wq[idx];memset (&hpd_irq_data,0 ,sizeof (hpd_irq_data));
@@ -3466,7 +3484,7 @@ static void register_hpd_handlers(struct (void *) aconnector);if (adev->dm.hpd_rx_offload_wq) - adev->dm.hpd_rx_offload_wq[connector->index].aconnector = + adev->dm.hpd_rx_offload_wq[dc_link->link_index].aconnector = aconnector; } }
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -3115,7 +3115,7 @@ struct dc_link_settings dp_get_max_link_return max_link_cap; } -static enum dc_status read_hpd_rx_irq_data ( +enum dc_status read_hpd_rx_irq_data (struct dc_link *link,union hpd_irq_data *irq_data) {
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +4 -0
@@ -82,6 +82,10 @@ bool perform_link_training_with_retries(enum signal_type signal, bool do_fallback); +enum dc_status read_hpd_rx_irq_data ( +struct dc_link *link, +union hpd_irq_data *irq_data); +bool hpd_rx_irq_check_link_loss_status (struct dc_link *link,union hpd_irq_data *hpd_irq_dpcd_data);
Greg Kroah-Hartman
maintainerPATCH 183/183 drm/amd/display: Add polling method to handle MST reply packet
In reply to Greg Kroah-HartmanFrom: Wayne Lin <[email protected]>
commit 4f6d9e38c4d244ad106eb9ebd8c0e1215e866f35 upstream.
[Why]
Specific TBT4 dock doesn't send out short HPD to notify source that IRQ event DOWN_REP_MSG_RDY is set. Which violates the spec and cause source can't send out streams to mst sinks.
[How]
To cover this misbehavior, add an additional polling method to detect DOWN_REP_MSG_RDY is set. HPD driven handling method is still kept. Just hook up our handler to drm mgr->cbs->poll_hpd_irq().
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 117 +++--------- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 110 +++++++++++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h | 11 + 4 files changed, 159 insertions(+), 86 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +31 -86
@@ -1325,6 +1325,15 @@ static void dm_handle_hpd_rx_offload_worif (amdgpu_in_reset (adev)) goto skip; +if (offload_work->data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY || + offload_work->data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) { +dm_handle_mst_sideband_msg_ready_event (&aconnector->mst_mgr,DOWN_OR_UP_MSG_RDY_EVENT ); +spin_lock_irqsave (&offload_work->offload_wq->offload_lock, flags); + offload_work->offload_wq->is_handling_mst_msg_rdy_event = false; +spin_unlock_irqrestore (&offload_work->offload_wq->offload_lock, flags); + goto skip; + } +mutex_lock (&adev->dm.dc_lock);if (offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST) {dc_link_dp_handle_automated_test (dc_link);
@@ -3229,87 +3238,6 @@ static void handle_hpd_irq(void *param) } -static void dm_handle_mst_sideband_msg (struct amdgpu_dm_connector *aconnector) -{ -u8 esi[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {0 }; -u8 dret; -bool new_irq_handled = false; -int dpcd_addr; -int dpcd_bytes_to_read; - -const int max_process_count =30 ; -int process_count =0 ; - -const struct dc_link_status *link_status =dc_link_get_status (aconnector->dc_link); - -if (link_status->dpcd_caps->dpcd_rev.raw <0x12 ) { - dpcd_bytes_to_read =DP_LANE0_1_STATUS -DP_SINK_COUNT ; -/* DPCD 0x200 - 0x201 for downstream IRQ */ - dpcd_addr =DP_SINK_COUNT ; - }else { - dpcd_bytes_to_read =DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ; -/* DPCD 0x2002 - 0x2005 for downstream IRQ */ - dpcd_addr =DP_SINK_COUNT_ESI ; - } - - dret =drm_dp_dpcd_read ( - &aconnector->dm_dp_aux.aux, - dpcd_addr, - esi, - dpcd_bytes_to_read); - -while (dret == dpcd_bytes_to_read && - process_count < max_process_count) { -u8 ack[DP_PSR_ERROR_STATUS -DP_SINK_COUNT_ESI ] = {}; -u8 retry; - - dret =0 ; - - process_count++; - -DRM_DEBUG_DRIVER ("ESI %02x %02x %02x\n" , esi[0 ], esi[1 ], esi[2 ]); -/* handle HPD short pulse irq */ -if (aconnector->mst_mgr.mst_state) -drm_dp_mst_hpd_irq_handle_event (&aconnector->mst_mgr, - esi, - ack, - &new_irq_handled); - -if (new_irq_handled) { -/* ACK at DPCD to notify down stream */ -for (retry =0 ; retry <3 ; retry++) { -ssize_t wret; - - wret =drm_dp_dpcd_writeb (&aconnector->dm_dp_aux.aux, - dpcd_addr +1 , - ack[1 ]); -if (wret ==1 ) -break ; - } - -if (retry ==3 ) { -DRM_ERROR ("Failed to ack MST event.\n" ); -return ; - } - -drm_dp_mst_hpd_irq_send_new_request (&aconnector->mst_mgr); -/* check if there is new irq to be handled */ - dret =drm_dp_dpcd_read ( - &aconnector->dm_dp_aux.aux, - dpcd_addr, - esi, - dpcd_bytes_to_read); - - new_irq_handled = false; - }else { -break ; - } - } - -if (process_count == max_process_count) -DRM_DEBUG_DRIVER ("Loop exceeded max iterations\n" ); -} -static void schedule_hpd_rx_offload_work (struct hpd_rx_irq_offload_work_queue *offload_wq,union hpd_irq_data hpd_irq_data) {
@@ -3371,7 +3299,23 @@ static void handle_hpd_rx_irq(void *paraif (dc_link_dp_allow_hpd_rx_irq (dc_link)) {if (hpd_irq_data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY || hpd_irq_data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) { -dm_handle_mst_sideband_msg (aconnector); +bool skip = false; + +/* +* DOWN_REP_MSG_RDY is also handled by polling method +* mgr->cbs->poll_hpd_irq() +*/ +spin_lock (&offload_wq->offload_lock); + skip = offload_wq->is_handling_mst_msg_rdy_event; + +if (!skip) + offload_wq->is_handling_mst_msg_rdy_event = true; + +spin_unlock (&offload_wq->offload_lock); + +if (!skip) +schedule_hpd_rx_offload_work (offload_wq, hpd_irq_data); + goto out; }
@@ -3482,11 +3426,11 @@ static void register_hpd_handlers(structamdgpu_dm_irq_register_interrupt (adev, &int_params, handle_hpd_rx_irq, (void *) aconnector); - -if (adev->dm.hpd_rx_offload_wq) - adev->dm.hpd_rx_offload_wq[dc_link->link_index].aconnector = - aconnector; } + +if (adev->dm.hpd_rx_offload_wq) + adev->dm.hpd_rx_offload_wq[connector->index].aconnector = + aconnector; } }
@@ -7082,6 +7026,7 @@ void amdgpu_dm_connector_init_helper(str aconnector->hpd.hpd =AMDGPU_HPD_NONE ;/* not used */ aconnector->audio_inst =-1 ;mutex_init (&aconnector->hpd_lock); +mutex_init (&aconnector->handle_mst_msg_ready);/* * configure support HPD hot plug connector_>polled default value is 0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +7 -0
@@ -194,6 +194,11 @@ struct hpd_rx_irq_offload_work_queue {*/ bool is_handling_link_loss;/** +* @is_handling_mst_msg_rdy_event: Used to prevent inserting mst message +* ready event when we're already handling mst message ready event +*/ +bool is_handling_mst_msg_rdy_event; +/** * @aconnector: The aconnector that this work queue is attached to */ struct amdgpu_dm_connector *aconnector;
@@ -614,6 +619,8 @@ struct amdgpu_dm_connector {struct drm_dp_mst_port *port;struct amdgpu_dm_connector *mst_port;struct drm_dp_aux *dsc_aux; +struct mutex handle_mst_msg_ready; +/* TODO see if we can merge with ddc_bus or make a dm_connector */ struct amdgpu_i2c_adapter *i2c;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +110 -0
118 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +11 -0
@@ -49,6 +49,13 @@#define PBN_FEC_OVERHEAD_MULTIPLIER_8B_10B 1031#define PBN_FEC_OVERHEAD_MULTIPLIER_128B_132B 1000 +enum mst_msg_ready_type { +NONE_MSG_RDY_EVENT =0 , +DOWN_REP_MSG_RDY_EVENT =1 , +UP_REQ_MSG_RDY_EVENT =2 , +DOWN_OR_UP_MSG_RDY_EVENT =3 +}; +struct amdgpu_display_manager ;struct amdgpu_dm_connector ;
@@ -61,6 +68,10 @@ void amdgpu_dm_initialize_dp_connector(svoid dm_dp_create_fake_mst_encoders (struct amdgpu_device *adev); +void dm_handle_mst_sideband_msg_ready_event ( +struct drm_dp_mst_topology_mgr *mgr, +enum mst_msg_ready_type msg_rdy_type); +struct dsc_mst_fairness_vars {int pbn;bool dsc_enabled;
Hi Greg
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
6.1.42-rc1 tested.
Build successfully completed.
Boot successfully completed.
No dmesg regressions.
Video output normal.
Sound output normal.
Lenovo ThinkPad X1 Carbon Gen10(Intel i7-1260P(x86_64) arch linux)
Thanks
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.1:
11 builds: 11 pass, 0 fail
28 boots: 28 pass, 0 fail
130 tests: 130 pass, 0 failLinux version: 6.1.42-rc1-gb3f8a9d2b137
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Hi,
Quoted 5 lines · On Tue, 25 Jul 2023 12:43:48 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/awslabs/damon-tests/tree/next/corr
[2] commit b3f8a9d2b137 ("Linux 6.1.42-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: sysfs.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_m68k.sh
ok 12 selftests: damon-tests: build_arm64.sh
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
PASS
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Successfully compiled and installed bindeb-pkgs on my computer (Acer Aspire E15, Intel Core i3 Haswell). No noticeable regressions.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Thanks,
Conor.
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.1.42-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.1.y
* git commit: b3f8a9d2b13712777c36667183b782dd7efa5039
* git describe: v6.1.41-184-gb3f8a9d2b137
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.1.y/build/v6.1.41-184-gb3f8a9d2b137
## Test Regressions (compared to v6.1.40)
## Metric Regressions (compared to v6.1.40)
## Test Fixes (compared to v6.1.40)
## Metric Fixes (compared to v6.1.40)
## Test result summary
total: 129464, pass: 112241, fail: 1676, skip: 15398, xfail: 149
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 147 total, 146 passed, 1 failed
* arm64: 50 total, 50 passed, 0 failed
* i386: 37 total, 36 passed, 1 failed
* mips: 26 total, 26 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 34 total, 34 passed, 0 failed
* riscv: 12 total, 12 passed, 0 failed
* s390: 12 total, 12 passed, 0 failed
* sh: 12 total, 12 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 42 total, 42 passed, 0 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-lib
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* rcutorture
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 521 pass: 521 fail: 0
Guenter
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Thu, 27 Jul 2023 10:44:26 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.42-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.
All RCU testing passes,
thanks,
- Joel
Quoted 735 lines
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:Greg Kroah-Hartman <[email protected]>
Linux 6.1.42-rc1Wayne Lin <[email protected]>
drm/amd/display: Add polling method to handle MST reply packetHersen Wu <[email protected]>
drm/amd/display: fix linux dp link lost handled only one timeSrinivasan Shanmugam <[email protected]>
drm/amd/display: Clean up errors & warnings inamdgpu_dm.cQingqing Zhuo <[email protected]>
drm/amd/display: force connector state when bpc changes during complianceWayne Lin <[email protected]>
drm/dp_mst: ClearMSG_RDYflag before sending new messageSrinivasan Shanmugam <[email protected]>
drm/amd/display: fix some coding style issuesHamza Mahfooz <[email protected]>
drm/amd/display: usemax_dsc_bppinamdgpu_dmIlya Leoshkevich <[email protected]>
selftests/bpf: Fix sk_assign on s390xYonghong Song <[email protected]>
selftests/bpf: Workaround verification failure for fexit_bpf2bpf/func_replace_return_codeAndrii Nakryiko <[email protected]>
selftests/bpf: maketest_alignselftest more robustAndrii Nakryiko <[email protected]>
bpf: aggressively forget precise markings during state checkpointingAndrii Nakryiko <[email protected]>
bpf: stop setting precise in current stateAndrii Nakryiko <[email protected]>
bpf: allow precision tracking for programs with subprogsMasahiro Yamada <[email protected]>
scripts/kallsyms: update the usage in the comment blockYuma Ueda <[email protected]>
scripts/kallsyms.cMake the comment up-to-date with current implementationArnd Bergmann <[email protected]>
kallsyms: addkallsyms_seqs_of_namesto list of special symbolsAbe Kohandel <[email protected]>
spi: dw: Remove misleading comment for Mount Evans SoCYunxiang Li <[email protected]>
drm/ttm: fixbulk_movecorruption when adding a entryMohamed Khalfella <[email protected]>
tracing/histograms: Return an error if we fail to add histogram tohist_varslistZhang Yi <[email protected]>
jbd2: recheck chechpointing non-dirty bufferVladimir Oltean <[email protected]>
net: phy: prevent stale pointer dereference inphy_init()Eric Dumazet <[email protected]>
tcp: annotate data-races around fastopenq.max_qlenEric Dumazet <[email protected]>
tcp: annotate data-races around icsk->icsk_user_timeoutEric Dumazet <[email protected]>
tcp: annotate data-races around tp->notsent_lowatEric Dumazet <[email protected]>
tcp: annotate data-races aroundrskq_defer_acceptEric Dumazet <[email protected]>
tcp: annotate data-races around tp->linger2Eric Dumazet <[email protected]>
tcp: annotate data-races around icsk->icsk_syn_retriesEric Dumazet <[email protected]>
tcp: annotate data-races around tp->keepalive_probesEric Dumazet <[email protected]>
tcp: annotate data-races around tp->keepalive_intvlEric Dumazet <[email protected]>
tcp: annotate data-races around tp->keepalive_timeEric Dumazet <[email protected]>
tcp: annotate data-races around tp->tsoffsetEric Dumazet <[email protected]>
tcp: annotate data-races around tp->tcp_tx_delayDouglas Anderson <[email protected]>
Bluetooth:hci_sync: Avoid use-after-free in dbg forhci_remove_adv_monitor()Pauli Virtanen <[email protected]>
Bluetooth: ISO: fixiso_connrelated locking and validity issuesPauli Virtanen <[email protected]>
Bluetooth:hci_event: call disconnect callback before deleting connPauli Virtanen <[email protected]>
Bluetooth: use RCU forhci_conn_paramsand iterate safely inhci_syncPablo Neira Ayuso <[email protected]>
netfilter:nf_tables: skip bound chain on rule flushPablo Neira Ayuso <[email protected]>
netfilter:nf_tables: skip bound chain in netns release pathFlorian Westphal <[email protected]>
netfilter:nft_set_pipapo: fix improper element removalFlorian Westphal <[email protected]>
netfilter:nf_tables: can't schedule innft_chain_validateFlorian Westphal <[email protected]>
netfilter:nf_tables: fix spurious set element insertion failureVitaly Rodionov <[email protected]>
ALSA: hda/realtek: Fix generic fixup definition for cs35l41 ampKuniyuki Iwashima <[email protected]>
llc: Don't drop packet from non-root netns.Zhang Shurong <[email protected]>
fbdev: au1200fb: Fix missing IRQ check inau1200fb_drv_probeKuniyuki Iwashima <[email protected]>
Revert "tcp: avoid the lookup process failing to get sk in ehash table"Yuanjun Gong <[email protected]>
net:ipv6: check return value ofpskb_trim()Wang Ming <[email protected]>
net: ipv4: Usekfree_sensitiveinstead of kfreeEric Dumazet <[email protected]>
tcp: annotate data-races around tcp_rsk(req)->ts_recentEric Dumazet <[email protected]>
tcp: annotate data-races around tcp_rsk(req)->txhashAntoine Tenart <[email protected]>
net: ipv4: use consistent txhash inTIME_WAITandSYN_RECVFlorian Kauer <[email protected]>
igc: Prevent garbled TX queue with XDP ZEROCOPYKurt Kanzenbach <[email protected]>
igc: Avoid transmit queue timeout for XDPAlexander Duyck <[email protected]>
bpf, arm64: Fix BTI type used for freplace attached functionsKumar Kartikeya Dwivedi <[email protected]>
bpf: Repeatcheck_max_stack_depthfor async callbacksKumar Kartikeya Dwivedi <[email protected]>
bpf: Fix subprog idx logic incheck_max_stack_depthGeetha sowjanya <[email protected]>
octeontx2-pf: Dont allocate BPIDs for LBK interfacesJiapeng Chong <[email protected]>
security: keys: Modify mismatched function nameAhmed Zaki <[email protected]>
iavf: fix reset task race withiavf_remove()Ahmed Zaki <[email protected]>
iavf: fix a deadlock caused by rtnl and driver's lock circular dependenciesMarcin Szycik <[email protected]>
iavf: Wait for reset in callbacks which trigger itPrzemek Kitszel <[email protected]>
iavf: make functions static where possibleAhmed Zaki <[email protected]>
iavf: send VLAN offloading caps once after VFRMarcin Szycik <[email protected]>
iavf: Movenetdev_update_features()into watchdog taskAhmed Zaki <[email protected]>
iavf: use internal state to free traffic IRQsDing Hui <[email protected]>
iavf: Fix out-of-bounds when setting channels on removeDing Hui <[email protected]>
iavf: Fix use-after-free infree_netdevTristram Ha <[email protected]>
net: dsa: microchip: correct KSZ8795 static MAC table accessOleksij Rempel <[email protected]>
net: dsa: microchip:ksz8_r_sta_mac_table(): Avoid using error code for empty entriesOleksij Rempel <[email protected]>
net: dsa: microchip: ksz8: Makeksz8_r_sta_mac_table()staticOleksij Rempel <[email protected]>
net: dsa: microchip: ksz8: Separate static MAC table operations for code reuseVictor Nogueira <[email protected]>
net: sched:cls_bpf: Undotcf_bind_filterin case of an errorVictor Nogueira <[email protected]>
net: sched:cls_u32: Undo refcount decrement in case update failedVictor Nogueira <[email protected]>
net: sched:cls_u32: Undotcf_bind_filterifu32_replace_hw_knodeVictor Nogueira <[email protected]>
net: sched:cls_matchall: Undotcf_bind_filterin case of failure aftermall_set_parmsDan Carpenter <[email protected]>
ASoC: SOF: ipc3-dtrace: uninitialized data indfsentry_trace_filter_write()Shyam Prasad N <[email protected]>
cifs: fix mid leak during reconnection after timeout thresholdDaniel Golle <[email protected]>
net: ethernet:mtk_eth_soc: handle probe deferralKuniyuki Iwashima <[email protected]>
bridge: Add extack warning when enabling STP in netns.Tanmay Patil <[email protected]>
net: ethernet: ti:cpsw_ale: Fix cpsw_ale_get_field()/cpsw_ale_set_field()Linus Walleij <[email protected]>
dsa: mv88e6xxx: Do a final check before timing outYonghong Song <[email protected]>
kallsyms: strip LTO-only suffixes from promoted global functionsZhen Lei <[email protected]>
kallsyms: Correctly sequence symbols whenCONFIG_LTO_CLANG=yZhen Lei <[email protected]>
kallsyms: Improve the performance ofkallsyms_lookup_name()Jaewon Kim <[email protected]>
spi: s3c64xx: clear loopback bit after loopback testChristoph Hellwig <[email protected]>
btrfs: be a bit more careful when settingmirror_num_retinbtrfs_map_blockJames Clark <[email protected]>
perf build: Fix library not found error when using CSLIBSYangtao Li <[email protected]>
fbdev: imxfb: Removed unneededrelease_mem_regionMartin Kaiser <[email protected]>
fbdev: imxfb: warn about invalid left/right marginJonas Gorski <[email protected]>
spi: bcm63xx: fix max prepend lengthBiju Das <[email protected]>
pinctrl: renesas: rzg2l: Handle non-unique subnode namesGeert Uytterhoeven <[email protected]>
pinctrl: renesas: rzv2m: Handle non-unique subnode namesSuren Baghdasaryan <[email protected]>
sched/psi: use kernfs polling functions for PSI trigger pollingDomenico Cerasuolo <[email protected]>
sched/psi: Allow unprivileged polling of N*2s periodDomenico Cerasuolo <[email protected]>
sched/psi: Extractupdate_triggersside effectDomenico Cerasuolo <[email protected]>
sched/psi: Rename existing poll members in preparationDomenico Cerasuolo <[email protected]>
sched/psi: Rearrange polling code in preparationChengming Zhou <[email protected]>
sched/psi: Fixavgs_workre-arm inpsi_avgs_work()Miaohe Lin <[email protected]>
sched/fair: Use recent_used_cpu to test p->cpus_ptrSrinivas Kandagatla <[email protected]>
ASoC: qcom: q6apm: do not close GPR port before closing graphSrinivas Kandagatla <[email protected]>
ASoC: codecs: wcd938x: fix dB range for HPHL and HPHRJohan Hovold <[email protected]>
ASoC: codecs: wcd938x: fix mbhc impedance loglevelVijendar Mukunda <[email protected]>
ASoC: amd: acp: fix for invalid dai id handling inacp_get_byte_count()Hao Chen <[email protected]>
net: hns3: fixstrncpy()not using dest-buf length as length issueYing Hsu <[email protected]>
igb: Fixigb_downhung on surprise removalYi Kuo <[email protected]>
wifi: iwlwifi: pcie: add device id 51F1 for killer 1675Johannes Berg <[email protected]>
wifi: iwlwifi: mvm: avoid baid size integer overflowMukesh Sisodiya <[email protected]>
wifi: iwlwifi: Add support for new PCI IdGustavo A. R. Silva <[email protected]>
wifi: wext-core: Fix -Wstringop-overflow warning inioctl_standard_iw_point()Petr Oros <[email protected]>
devlink: reportdevlink_port_type_warnsource deviceJisheng Zhang <[email protected]>
net: ethernet: litex: add support for 64 bit statsP Praneesh <[email protected]>
wifi: ath11k: fix memory leak in WMI firmware statsAbe Kohandel <[email protected]>
spi: dw: Add compatible for Intel Mount Evans SoCIlan Peer <[email protected]>
wifi:mac80211_hwsim: Fix possible NULL dereferenceWen Gong <[email protected]>
wifi: ath11k: add support default regdb while searching board-2.bin for WCN6855Aditi Ghag <[email protected]>
bpf: tcp: Avoid taking fast sock lock in iteratorMartin KaFai Lau <[email protected]>
bpf: Address KCSAN report onbpf_lru_listKui-Feng Lee <[email protected]>
bpf: Print a warning only if writing tounprivileged_bpf_disabled.Maxime Bizon <[email protected]>
wifi: ath11k: fix registration of 6Ghz-only phy without the full channel rangeYicong Yang <[email protected]>
sched/fair: Don't balance task to its current running CPUPaul E. McKenney <[email protected]>
rcu: Mark additional concurrent load from ->cpu_no_qs.b.expShigeru Yoshida <[email protected]>
rcu-tasks: Avoidpr_info()with spin lock incblist_init_generic()Hans de Goede <[email protected]>
ACPI: video: Add backlight=native DMI quirk for Dell Studio 1569Immad Mir <[email protected]>
FS: JFS: Check for read-only mounted filesystem in txBeginImmad Mir <[email protected]>
FS: JFS: Fix null-ptr-deref Read in txBeginGustavo A. R. Silva <[email protected]>
MIPS: dec: prom: Address -Warray-bounds warningYogesh <[email protected]>
fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLevJan Kara <[email protected]>
udf: Fix uninitialized array access for some pathnamesChristian Brauner <[email protected]>
ovl: check type and offset of struct vfsmount inovl_entryMarco Morandini <[email protected]>
HID: add quirk for 03f0:464a HP Elite Presenter MouseYe Bin <[email protected]>
quota: fix warning indqgrab()Jan Kara <[email protected]>
quota: Properly disable quotas whenadd_dquot_ref()failsOswald Buddenhagen <[email protected]>
ALSA: emu10k1: roll up loops in DSP setup code for Audigyhackyzh002 <[email protected]>
drm/radeon: Fix integer overflow inradeon_cs_parser_initEric Whitney <[email protected]>
ext4: correct inline offset when handling xattrs in inode bodyJohan Hovold <[email protected]>
ASoC: codecs: wcd938x: fix soundwire initialisation raceJohan Hovold <[email protected]>
ASoC: codecs: wcd938x: fix codec initialisation raceJohan Hovold <[email protected]>
ASoC: codecs: wcd934x: fix resource leaks on component removeJohan Hovold <[email protected]>
ASoC: codecs: wcd938x: fix missing mbhc init error handlingJohan Hovold <[email protected]>
ASoC: codecs: wcd938x: fix resource leaks on component removeSheetal <[email protected]>
ASoC: tegra: Fix AMX byte mapJohan Hovold <[email protected]>
ASoC: qdsp6: audioreach: fix topology probe deferralJohan Hovold <[email protected]>
ASoC: codecs: wcd-mbhc-v2: fix resource leaks on component removeJohan Hovold <[email protected]>
ASoC: codecs: wcd938x: fix missing clsh ctrl error handlingThomas Petazzoni <[email protected]>
ASoC: cs42l51: fix driver to properly autoload with automatic module loadingSameer Pujar <[email protected]>
ASoC: rt5640: Fix sleep in atomic contextSheetal <[email protected]>
ASoC: tegra: Fix ADX byte mapFabio Estevam <[email protected]>
ASoC:fsl_sai: Revert "ASoC:fsl_sai: EnableMCTL_MCLK_ENbit for master mode"Matus Gajdos <[email protected]>
ASoC:fsl_sai: Disable bit clock with transmitterNicholas Kazlauskas <[email protected]>
drm/amd/display: Keep PHY active for DP displays on DCN31Taimur Hassan <[email protected]>
drm/amd/display: check TG is non-null before checking if enabledZhikai Zhai <[email protected]>
drm/amd/display: Disable MPC split by default on special asicSimon Ser <[email protected]>
drm/amd/display: only accept async flips for fast updatesJocelyn Falempe <[email protected]>
drm/client: Fix memory leak indrm_client_modeset_probeJocelyn Falempe <[email protected]>
drm/client: Fix memory leak indrm_client_target_clonedAlex Deucher <[email protected]>
drm/amdgpu/pm: make mclk consistent for smu 13.0.7Alex Deucher <[email protected]>
drm/amdgpu/pm: make gfxclock consistent for sienna cichlidGuchun Chen <[email protected]>
drm/amdgpu/vkms: relax timer deactivation byhrtimer_try_to_cancelVille Syrjälä <[email protected]>
dma-buf/dma-resv: Stop leaking onkrealloc()failureMatthieu Baerts <[email protected]>
selftests: tc: add ConnTrack procfs kconfigMarc Kleine-Budde <[email protected]>
can:gs_usb:gs_can_open(): improve error handlingYueHaibing <[email protected]>
can: bcm: Fix UAF inbcm_proc_show()Fedor Ross <[email protected]>
can: mcp251xfd:__mcp251xfd_chip_set_mode(): increase poll timeoutMark Brown <[email protected]>
arm64/fpsimd: Ensure SME storage is allocated after SVE VL changesMark Brown <[email protected]>
regmap: Account for register length in SMBus I/O limitsRob Herring <[email protected]>
of: Preserve "of-display" device name for compatibilityMark Brown <[email protected]>
regmap: Drop initial version of maximum transfer length fixesMatthieu Baerts <[email protected]>
selftests: tc: add 'ct' action kconfig depMatthieu Baerts <[email protected]>
selftests: tc: set timeout to 15 minutesJosef Bacik <[email protected]>
btrfs: fix race between balance and cancel/pauseMiklos Szeredi <[email protected]>
fuse: ioctl: translate ENOSYS in outargFilipe Manana <[email protected]>
btrfs: zoned: fix memory leak after finding block group with super blocksJosef Bacik <[email protected]>
btrfs:set_page_extent_mappedafterread_folioinbtrfs_cont_expandBernd Schubert <[email protected]>
fuse: Apply flags2 only when userspace set theFUSE_INIT_EXTMiklos Szeredi <[email protected]>
fuse: revalidate: don't invalidate if interruptedFilipe Manana <[email protected]>
btrfs: fix warning when putting transaction with qgroups enabled after abortGeorg Müller <[email protected]>
perf probe: Add test for regression introduced by switch todie_get_decl_file()Petr Pavlu <[email protected]>
keys: Fix linking a duplicate key to a keyring'sassoc_arrayLiam R. Howlett <[email protected]>
maple_tree: fix node allocation testing on 32 bitPeng Zhang <[email protected]>
maple_tree: set the node limit when creating a new root nodeLuka Guzenko <[email protected]>
ALSA: hda/realtek: Enable Mute LED on HP Laptop 15s-eq2xxxChristoffer Sandberg <[email protected]>
ALSA: hda/realtek: Add quirk for Clevo NS70AUKailang Yang <[email protected]>
ALSA: hda/realtek - remove 3k pull low procedureJens Axboe <[email protected]>
io_uring: treat-EAGAINforREQ_F_NOWAITas final for io-wq-------------
Diffstat:
Documentation/accounting/psi.rst | 4 + Makefile | 4 +- arch/arm64/kernel/fpsimd.c | 33 +- arch/arm64/net/bpf_jit_comp.c | 8 +- arch/mips/include/asm/dec/prom.h | 2 +- drivers/acpi/video_detect.c | 8 + drivers/base/regmap/regmap-i2c.c | 8 +- drivers/base/regmap/regmap-spi-avmm.c | 2 +- drivers/base/regmap/regmap.c | 6 +- drivers/dma-buf/dma-resv.c | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 415 ++++++++-------- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 12 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 12 + .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 125 +++++ .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 121 ++++- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.h | 11 + .../amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c | 5 + drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 141 +----- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 +- .../drm/amd/display/dc/dcn303/dcn303_resource.c | 2 +- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 6 + drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h | 4 + .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 8 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 2 +- drivers/gpu/drm/display/drm_dp_mst_topology.c | 54 ++- drivers/gpu/drm/drm_client_modeset.c | 6 + drivers/gpu/drm/i915/display/intel_dp.c | 7 +- drivers/gpu/drm/nouveau/dispnv50/disp.c | 12 +- drivers/gpu/drm/radeon/radeon_cs.c | 3 +- drivers/gpu/drm/ttm/ttm_resource.c | 5 +- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 10 +- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 1 + drivers/net/can/usb/gs_usb.c | 31 +- drivers/net/dsa/microchip/ksz8.h | 2 - drivers/net/dsa/microchip/ksz8795.c | 121 +++-- drivers/net/dsa/microchip/ksz_common.c | 8 +- drivers/net/dsa/microchip/ksz_common.h | 7 + drivers/net/dsa/mv88e6xxx/chip.c | 7 + drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 33 +- .../ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 29 +- drivers/net/ethernet/intel/iavf/iavf.h | 16 +- drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 39 +- drivers/net/ethernet/intel/iavf/iavf_main.c | 232 ++++++--- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 43 +- drivers/net/ethernet/intel/iavf/iavf_txrx.h | 4 - drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 8 +- drivers/net/ethernet/intel/igb/igb_main.c | 5 + drivers/net/ethernet/intel/igc/igc_main.c | 12 +- drivers/net/ethernet/litex/litex_liteeth.c | 19 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 5 +- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 29 +- drivers/net/ethernet/ti/cpsw_ale.c | 24 +- drivers/net/phy/phy_device.c | 21 +- drivers/net/wireless/ath/ath11k/core.c | 53 +- drivers/net/wireless/ath/ath11k/mac.c | 3 +- drivers/net/wireless/ath/ath11k/wmi.c | 5 + drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 +- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 4 + drivers/net/wireless/mac80211_hwsim.c | 4 +- drivers/of/platform.c | 2 +- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 28 +- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 28 +- drivers/spi/spi-bcm63xx.c | 2 +- drivers/spi/spi-dw-mmio.c | 22 + drivers/spi/spi-s3c64xx.c | 2 + drivers/video/fbdev/au1200fb.c | 3 + drivers/video/fbdev/imxfb.c | 5 +- fs/btrfs/block-group.c | 1 + fs/btrfs/inode.c | 14 +- fs/btrfs/qgroup.c | 1 + fs/btrfs/volumes.c | 20 +- fs/ext4/xattr.c | 14 + fs/fuse/dir.c | 2 +- fs/fuse/inode.c | 5 +- fs/fuse/ioctl.c | 21 +- fs/jbd2/checkpoint.c | 102 ++-- fs/jfs/jfs_dmap.c | 3 + fs/jfs/jfs_txnmgr.c | 5 + fs/jfs/namei.c | 5 + fs/overlayfs/ovl_entry.h | 9 + fs/quota/dquot.c | 5 +- fs/smb/client/connect.c | 19 +- fs/udf/unicode.c | 2 +- include/drm/display/drm_dp_mst_helper.h | 7 +- include/linux/psi.h | 5 +- include/linux/psi_types.h | 45 +- include/linux/tcp.h | 2 +- include/net/bluetooth/hci_core.h | 5 + include/net/ip.h | 2 +- include/net/tcp.h | 31 +- io_uring/io_uring.c | 8 + kernel/bpf/bpf_lru_list.c | 21 +- kernel/bpf/bpf_lru_list.h | 7 +- kernel/bpf/syscall.c | 3 +- kernel/bpf/verifier.c | 234 ++++++++- kernel/cgroup/cgroup.c | 2 +- kernel/kallsyms.c | 91 +++- kernel/kallsyms_internal.h | 1 + kernel/rcu/tasks.h | 5 +- kernel/rcu/tree_exp.h | 2 +- kernel/rcu/tree_plugin.h | 4 +- kernel/sched/fair.c | 4 +- kernel/sched/psi.c | 540 ++++++++++++--------- kernel/trace/trace_events_hist.c | 3 +- lib/maple_tree.c | 3 +- net/bluetooth/hci_conn.c | 10 +- net/bluetooth/hci_core.c | 42 +- net/bluetooth/hci_event.c | 15 +- net/bluetooth/hci_sync.c | 121 ++++- net/bluetooth/iso.c | 55 ++- net/bluetooth/mgmt.c | 26 +- net/bridge/br_stp_if.c | 3 + net/can/bcm.c | 12 +- net/core/devlink.c | 5 +- net/ipv4/esp4.c | 2 +- net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/inet_hashtables.c | 17 +- net/ipv4/inet_timewait_sock.c | 8 +- net/ipv4/ip_output.c | 4 +- net/ipv4/tcp.c | 57 +-- net/ipv4/tcp_fastopen.c | 6 +- net/ipv4/tcp_ipv4.c | 27 +- net/ipv4/tcp_minisocks.c | 11 +- net/ipv4/tcp_output.c | 6 +- net/ipv6/ip6_gre.c | 3 +- net/ipv6/tcp_ipv6.c | 4 +- net/llc/llc_input.c | 3 - net/netfilter/nf_tables_api.c | 12 +- net/netfilter/nft_set_pipapo.c | 6 +- net/sched/cls_bpf.c | 99 ++-- net/sched/cls_matchall.c | 35 +- net/sched/cls_u32.c | 48 +- net/wireless/wext-core.c | 6 + scripts/kallsyms.c | 75 ++- scripts/link-vmlinux.sh | 4 + security/keys/request_key.c | 35 +- security/keys/trusted-keys/trusted_tpm2.c | 2 +- sound/pci/emu10k1/emufx.c | 112 +---- sound/pci/hda/patch_realtek.c | 54 ++- sound/soc/amd/acp/amd.h | 7 +- sound/soc/codecs/cs42l51-i2c.c | 6 + sound/soc/codecs/cs42l51.c | 7 - sound/soc/codecs/cs42l51.h | 1 - sound/soc/codecs/rt5640.c | 12 +- sound/soc/codecs/wcd-mbhc-v2.c | 57 ++- sound/soc/codecs/wcd934x.c | 12 + sound/soc/codecs/wcd938x.c | 86 +++- sound/soc/fsl/fsl_sai.c | 8 +- sound/soc/fsl/fsl_sai.h | 1 + sound/soc/qcom/qdsp6/q6apm.c | 7 +- sound/soc/qcom/qdsp6/topology.c | 4 +- sound/soc/sof/ipc3-dtrace.c | 9 +- sound/soc/tegra/tegra210_adx.c | 34 +- sound/soc/tegra/tegra210_amx.c | 40 +- tools/perf/Makefile.config | 4 +- .../tests/shell/test_uprobe_from_different_cu.sh | 77 +++ tools/testing/radix-tree/maple.c | 6 +- tools/testing/selftests/bpf/prog_tests/align.c | 38 +- tools/testing/selftests/bpf/prog_tests/sk_assign.c | 25 +- tools/testing/selftests/bpf/progs/connect4_prog.c | 2 +- tools/testing/selftests/bpf/progs/test_sk_assign.c | 11 + .../selftests/bpf/progs/test_sk_assign_libbpf.c | 3 + tools/testing/selftests/tc-testing/config | 2 + tools/testing/selftests/tc-testing/settings | 1 + 167 files changed, 2997 insertions(+), 1561 deletions(-)
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.42 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
These should be dropped:
Quoted 2 lines
Arnd Bergmann <[email protected]>
kallsyms: addkallsyms_seqs_of_namesto list of special symbols
6.1.X does not have that symbol, we should not have this patch.
Quoted 2 lines
Masahiro Yamada <[email protected]>
scripts/kallsyms: update the usage in the comment block
This one is wrong. We don't have that option in 6.1.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany