x86/hyperv/vtl: Stop kernel from probing VTL0 low memory
Subsystems (10)
Sasha Levin
maintainerPATCH 1/8 x86/hyperv/vtl: Stop kernel from probing VTL0 low memory
From: Naman Jain <[email protected]>
[ Upstream commit 59115e2e25f42924181055ed7cc1d123af7598b7 ]
For Linux, running in Hyper-V VTL (Virtual Trust Level), kernel in VTL2 tries to access VTL0 low memory in probe_roms. This memory is not described in the e820 map. Initialize probe_roms call to no-ops during boot for VTL2 kernel to avoid this. The issue got identified in OpenVMM which detects invalid accesses initiated from kernel running in VTL2.
Message-ID: <[email protected]>
--- arch/x86/hyperv/hv_vtl.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/hyperv/hv_vtl.c +1 -0
@@ -30,6 +30,7 @@ void __init hv_vtl_init_platform(void) x86_platform.realmode_init = x86_init_noop; x86_init.irqs.pre_vector_init = x86_init_noop; x86_init.timers.timer_init = x86_init_noop; + x86_init.resources.probe_roms = x86_init_noop;/* Avoid searching for BIOS MP tables */ x86_init.mpparse.find_smp_config = x86_init_noop;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/8 wifi: mac80211: flush the station before moving it to UN-AUTHORIZED state
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 43e04077170799d0e6289f3e928f727e401b3d79 ]
We first want to flush the station to make sure we no longer have any frames being Tx by the station before the station is moved to un-authorized state. Failing to do that will lead to races: a frame may be sent after the station's state has been changed.
Since the API clearly states that the driver can't fail the sta_state() transition down the list of state, we can easily flush the station first, and only then call the driver's sta_state().
--- net/mac80211/sta_info.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
net/mac80211/sta_info.c +17 -3
@@ -4,7 +4,7 @@* Copyright 2006-2007 Jiri Benc <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright (C) 2015 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018-2023 Intel Corporation +* Copyright (C) 2018-2024 Intel Corporation */ #include <linux/module.h>
@@ -1321,9 +1321,13 @@ static int _sta_info_move_state(struct sta_info *sta, sta->sta.addr, new_state);/* notify the driver before the actual changes so it can -* fail the transition +* fail the transition if the state is increasing. +* The driver is required not to fail when the transition +* is decreasing the state, so first, do all the preparation +* work and only then, notify the driver. */ -if (test_sta_flag (sta,WLAN_STA_INSERTED )) { +if (new_state > sta->sta_state && +test_sta_flag (sta,WLAN_STA_INSERTED )) {int err =drv_sta_state (sta->local, sta->sdata, sta, sta->sta_state, new_state);if (err)
@@ -1399,6 +1403,16 @@ static int _sta_info_move_state(struct sta_info *sta,break ; } +if (new_state < sta->sta_state && +test_sta_flag (sta,WLAN_STA_INSERTED )) { +int err =drv_sta_state (sta->local, sta->sdata, sta, + sta->sta_state, new_state); + +WARN_ONCE (err, +"Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n" , + err); + } + sta->sta_state = new_state;return 0 ;
Signature · 1 line
2.39.5
RFC PATCH 1/1 mac80211: clip ADDBA instead of bailing out
When a Linux Wifi{4,5} device talks to a Wifi6 AP, if the AP proposes a Block Acknowledgement aggregation size (ADDBA) exceeding its expectations, the code in mac80211 just bails out, rejecting the aggregation. This yields a big performance penalty on the ack path, which is observable in comparison with other OSes (Windows and MacOS) which "play smarter" and accept the proposal with a "clipped" size.
A typical scenario would be:
AP -> Device : ADDBA_request(size=256)
Current Linux reaction:
Device -> AP : ADDBA_reply(failure)
Other OSes reaction:
Device -> AP : ADDBA_reply(size=64)
Note that the IEEE802.11 standard allows for both reactions, but it sounds really suboptimal to be bailing out instead of clipping. The patch below does the latter.
---
net/mac80211/agg-rx.c +3 -5
@@ -317,18 +317,20 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, max_buf_size =IEEE80211_MAX_AMPDU_BUF_HT ;/* sanity check for incoming parameters: -* check if configuration can support the BA policy -* and if buffer size does not exceeds max value */ +* check if configuration can support the BA policy */ /* XXX: check own ht delayed BA capability?? */ if (((ba_policy !=1 ) && - (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) || - (buf_size > max_buf_size)) { - status =WLAN_STATUS_INVALID_QOS_PARAM ; + (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA )))) { + status =WLAN_STATUS_INVALID_QOS_PARAM ; ht_dbg_ratelimited(sta->sdata, "AddBA Req with bad params from %pM on tid
%u. policy %d, buffer size %d\n",
sta->sta.addr, tid, ba_policy, buf_size);
goto end;
}+ if (buf_size > max_buf_size) {
+ buf_size = max_buf_size ; // Clip instead of bailing out
+ }
+
/* determine default buffer size */
if (buf_size == 0)
buf_size = max_buf_size;Re: [RFC PATCH] mac80211: clip ADDBA instead of bailing out
Hi Alexandre,
Quoted 6 lines · Alexandre Ferrieux
When a Linux Wifi{4,5} device talks to a Wifi6 AP, if the AP proposes a Block Acknowledgement aggregation size (ADDBA) exceeding its expectations, the code in mac80211 just bails out, rejecting the aggregation. This yields a big performance penalty on the ack path, which is observable in comparison with other OSes (Windows and MacOS) which "play smarter" and accept the proposal with a "clipped" size.
Out of curiosity do you have any performance numbers for this, like Linux vs Windows vs MacOS? We ran into a significant performance hit after I added multicast RX support on ath10k (after ~30 clients were on the same channel). After looking into the pcaps we saw many ADDBA failures and ultimately had to disable multicast RX. I want to give this patch a try either way, but I was curious if you had any data on performance improvements.
Quoted 53 lines
A typical scenario would be:
AP -> Device : ADDBA_request(size=256)Current Linux reaction:
Device -> AP : ADDBA_reply(failure)Other OSes reaction:
Device -> AP : ADDBA_reply(size=64)Note that the IEEE802.11 standard allows for both reactions, but it sounds really suboptimal to be bailing out instead of clipping. The patch below does the latter.
Signed-off-by Alexandre Ferrieux <[email protected]>---
net/mac80211/agg-rx.c +7
-5@@ -317,18 +317,20 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, max_buf_size =IEEE80211_MAX_AMPDU_BUF_HT ;/* sanity check for incoming parameters: -* check if configuration can support the BA policy -* and if buffer size does not exceeds max value */ +* check if configuration can support the BA policy */ /* XXX: check own ht delayed BA capability?? */ if (((ba_policy !=1 ) && - (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) || - (buf_size > max_buf_size)) { - status =WLAN_STATUS_INVALID_QOS_PARAM ; + (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA )))) { + status =WLAN_STATUS_INVALID_QOS_PARAM ;ht_dbg_ratelimited (sta->sdata, "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", sta->sta.addr, tid, ba_policy, buf_size); goto end; } +if (buf_size > max_buf_size) { + buf_size = max_buf_size ;// Clip instead of bailing out + } +/* determine default buffer size */ if (buf_size ==0 )buf_size = max_buf_size;
Re: [RFC PATCH] mac80211: clip ADDBA instead of bailing out
Hi James,
There is roughly a 8x slowdown :}
I got these numbers from the colleagues who detected the issue
- physical available bandwidth 1.733 Gbps (as per iwconfig)
- ADDBA offer size=256
- effective bandwidth observed 1.2Gbps with accept-and-clip-ADDBA (size=64)
- vs. 150 Mbps with reject-ADDBA
Note, as a Wifi rookie it is not immediately obvious to me how the semantics of ack aggregation would interfere with broadcast actions, as ADDBA are supposedly unicast. But you're the expert :)
Quoted 67 lines · James Prestwood
--------------------------------------------------------------------------------------------------------------
CAUTION : This email originated outside the company. Do not click on any links or open attachments unless you are expecting them from the sender.ATTENTION : Cet e-mail provient de l'extérieur de l'entreprise. Ne cliquez pas sur les liens ou n'ouvrez pas les pièces jointes à moins de connaitre l'expéditeur.
--------------------------------------------------------------------------------------------------------------Hi Alexandre,
Quoted 6 lines · Alexandre Ferrieux
When a Linux Wifi{4,5} device talks to a Wifi6 AP, if the AP proposes a Block Acknowledgement aggregation size (ADDBA) exceeding its expectations, the code in mac80211 just bails out, rejecting the aggregation. This yields a big performance penalty on the ack path, which is observable in comparison with other OSes (Windows and MacOS) which "play smarter" and accept the proposal with a "clipped" size.
Out of curiosity do you have any performance numbers for this, like Linux vs Windows vs MacOS? We ran into a significant performance hit after I added multicast RX support on ath10k (after ~30 clients were on the same channel). After looking into the pcaps we saw many ADDBA failures and ultimately had to disable multicast RX. I want to give this patch a try either way, but I was curious if you had any data on performance improvements.
Quoted 45 lines
A typical scenario would be:
AP -> Device : ADDBA_request(size=256)Current Linux reaction:
Device -> AP : ADDBA_reply(failure)Other OSes reaction:
Device -> AP : ADDBA_reply(size=64)Note that the IEEE802.11 standard allows for both reactions, but it sounds really suboptimal to be bailing out instead of clipping. The patch below does the latter.
Signed-off-by Alexandre Ferrieux <[email protected]>---
net/mac80211/agg-rx.c +4
-5@@ -317,18 +317,20 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, max_buf_size =IEEE80211_MAX_AMPDU_BUF_HT ;/* sanity check for incoming parameters: -* check if configuration can support the BA policy -* and if buffer size does not exceeds max value */ +* check if configuration can support the BA policy */ /* XXX: check own ht delayed BA capability?? */ if (((ba_policy !=1 ) && - (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) || - (buf_size > max_buf_size)) { - status =WLAN_STATUS_INVALID_QOS_PARAM ; + (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA )))) { + status =WLAN_STATUS_INVALID_QOS_PARAM ;ht_dbg_ratelimited (sta->sdata, "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", sta->sta.addr, tid, ba_policy, buf_size); goto end; } +if (buf_size > max_buf_size) {
Quoted 8 lines
Quoted 8 lines
net/mac80211/agg-rx.c +3
-0+ buf_size = max_buf_size ;// Clip instead of bailing out + } +/* determine default buffer size */ if (buf_size ==0 )buf_size = max_buf_size;
____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.
This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
Re: [RFC PATCH] mac80211: clip ADDBA instead of bailing out
Quoted 5 lines · On 3/19/25 7:18 AM, [email protected] wrote:
Hi James,
There is roughly a 8x slowdown :}
I got these numbers from the colleagues who detected the issue
Quoted 8 lines
- physical available bandwidth 1.733 Gbps (as per iwconfig)
- ADDBA offer size=256
- effective bandwidth observed 1.2Gbps with accept-and-clip-ADDBA (size=64)
- vs. 150 Mbps with reject-ADDBANote, as a Wifi rookie it is not immediately obvious to me how the semantics of ack aggregation would interfere with broadcast actions, as ADDBA are supposedly unicast. But you're the expert :)
"expert", your giving me too much credit :) My running theory is that allowing multicast RX inadvertently caused the driver/firmware to receive more than just the action frames we registered for, and in turn bogged down the RX path, and introduced packet loss. We saw this externally as ADDBA retries in the pcaps.
So it may have nothing to do with ADDBA rejections/failures, but when I saw this patch it got me thinking. Thanks for the numbers, either way this seems like a huge performance gain so I'm eager to test it out even if it has no effect on the multicast action RX performance.
Thanks,
James
Quoted 89 lines · James Prestwood
Quoted 66 lines
--------------------------------------------------------------------------------------------------------------
CAUTION : This email originated outside the company. Do not click on any links or open attachments unless you are expecting them from the sender.ATTENTION : Cet e-mail provient de l'extérieur de l'entreprise. Ne cliquez pas sur les liens ou n'ouvrez pas les pièces jointes à moins de connaitre l'expéditeur.
--------------------------------------------------------------------------------------------------------------Hi Alexandre,
Quoted 6 lines · Alexandre Ferrieux
When a Linux Wifi{4,5} device talks to a Wifi6 AP, if the AP proposes a Block Acknowledgement aggregation size (ADDBA) exceeding its expectations, the code in mac80211 just bails out, rejecting the aggregation. This yields a big performance penalty on the ack path, which is observable in comparison with other OSes (Windows and MacOS) which "play smarter" and accept the proposal with a "clipped" size.
Out of curiosity do you have any performance numbers for this, like Linux vs Windows vs MacOS? We ran into a significant performance hit after I added multicast RX support on ath10k (after ~30 clients were on the same channel). After looking into the pcaps we saw many ADDBA failures and ultimately had to disable multicast RX. I want to give this patch a try either way, but I was curious if you had any data on performance improvements.
Quoted 44 lines
A typical scenario would be:
AP -> Device : ADDBA_request(size=256)Current Linux reaction:
Device -> AP : ADDBA_reply(failure)Other OSes reaction:
Device -> AP : ADDBA_reply(size=64)Note that the IEEE802.11 standard allows for both reactions, but it sounds really suboptimal to be bailing out instead of clipping. The patch below does the latter.
Signed-off-by Alexandre Ferrieux <[email protected]>---
net/mac80211/agg-rx.c +4
-5@@ -317,18 +317,20 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, max_buf_size =IEEE80211_MAX_AMPDU_BUF_HT ;/* sanity check for incoming parameters: -* check if configuration can support the BA policy -* and if buffer size does not exceeds max value */ +* check if configuration can support the BA policy */ /* XXX: check own ht delayed BA capability?? */ if (((ba_policy !=1 ) && - (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) || - (buf_size > max_buf_size)) { - status =WLAN_STATUS_INVALID_QOS_PARAM ; + (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA )))) { + status =WLAN_STATUS_INVALID_QOS_PARAM ;ht_dbg_ratelimited (sta->sdata, "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", sta->sta.addr, tid, ba_policy, buf_size); goto end; } +if (buf_size > max_buf_size) {Quoted 8 lines
Quoted 8 lines
net/mac80211/agg-rx.c +3
-0+ buf_size = max_buf_size ;// Clip instead of bailing out + } +/* determine default buffer size */ if (buf_size ==0 )buf_size = max_buf_size;____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
Re: [RFC PATCH] mac80211: clip ADDBA instead of bailing out
In reply to [email protected]Hi Alexandre,
Quoted 9 lines · On 3/19/25 7:18 AM, [email protected] wrote:
Hi James,
There is roughly a 8x slowdown :}
I got these numbers from the colleagues who detected the issue- physical available bandwidth 1.733 Gbps (as per iwconfig)
- ADDBA offer size=256
- effective bandwidth observed 1.2Gbps with accept-and-clip-ADDBA (size=64)
- vs. 150 Mbps with reject-ADDBA
Fwiw I didn't see any difference in throughput with and without this patch. We do use wifi 6/6e APs and wifi 5 clients (ath10k), but I suspect it has something to do with our configuration not taking full advantage of 6/6e speeds, so the APs may not be proposing an ADDBA size that the client rejects. But I'll keep this in mind if we ever notice the behavior.
Overall though I didn't observe and regression-type behavior.
Thanks,
James
Quoted 93 lines
Note, as a Wifi rookie it is not immediately obvious to me how the semantics of ack aggregation would interfere with broadcast actions, as ADDBA are supposedly unicast. But you're the expert :)
Quoted 66 lines · James Prestwood
--------------------------------------------------------------------------------------------------------------
CAUTION : This email originated outside the company. Do not click on any links or open attachments unless you are expecting them from the sender.ATTENTION : Cet e-mail provient de l'extérieur de l'entreprise. Ne cliquez pas sur les liens ou n'ouvrez pas les pièces jointes à moins de connaitre l'expéditeur.
--------------------------------------------------------------------------------------------------------------Hi Alexandre,
Quoted 6 lines · Alexandre Ferrieux
When a Linux Wifi{4,5} device talks to a Wifi6 AP, if the AP proposes a Block Acknowledgement aggregation size (ADDBA) exceeding its expectations, the code in mac80211 just bails out, rejecting the aggregation. This yields a big performance penalty on the ack path, which is observable in comparison with other OSes (Windows and MacOS) which "play smarter" and accept the proposal with a "clipped" size.
Out of curiosity do you have any performance numbers for this, like Linux vs Windows vs MacOS? We ran into a significant performance hit after I added multicast RX support on ath10k (after ~30 clients were on the same channel). After looking into the pcaps we saw many ADDBA failures and ultimately had to disable multicast RX. I want to give this patch a try either way, but I was curious if you had any data on performance improvements.
Quoted 44 lines
A typical scenario would be:
AP -> Device : ADDBA_request(size=256)Current Linux reaction:
Device -> AP : ADDBA_reply(failure)Other OSes reaction:
Device -> AP : ADDBA_reply(size=64)Note that the IEEE802.11 standard allows for both reactions, but it sounds really suboptimal to be bailing out instead of clipping. The patch below does the latter.
Signed-off-by Alexandre Ferrieux <[email protected]>---
net/mac80211/agg-rx.c +4
-5@@ -317,18 +317,20 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, max_buf_size =IEEE80211_MAX_AMPDU_BUF_HT ;/* sanity check for incoming parameters: -* check if configuration can support the BA policy -* and if buffer size does not exceeds max value */ +* check if configuration can support the BA policy */ /* XXX: check own ht delayed BA capability?? */ if (((ba_policy !=1 ) && - (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA ))) || - (buf_size > max_buf_size)) { - status =WLAN_STATUS_INVALID_QOS_PARAM ; + (!(sta->sta.deflink.ht_cap.cap &IEEE80211_HT_CAP_DELAY_BA )))) { + status =WLAN_STATUS_INVALID_QOS_PARAM ;ht_dbg_ratelimited (sta->sdata, "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", sta->sta.addr, tid, ba_policy, buf_size); goto end; } +if (buf_size > max_buf_size) {Quoted 8 lines
Quoted 8 lines
net/mac80211/agg-rx.c +3
-0+ buf_size = max_buf_size ;// Clip instead of bailing out + } +/* determine default buffer size */ if (buf_size ==0 )buf_size = max_buf_size;____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
Sasha Levin
maintainerPATCH 3/8 locking/semaphore: Use wake_q to wake up processes outside lock critical section
In reply to Sasha LevinFrom: Waiman Long <[email protected]>
[ Upstream commit 85b2b9c16d053364e2004883140538e73b333cdb ]
A circular lock dependency splat has been seen involving down_trylock():
======================================================
WARNING: possible circular locking dependency detected 6.12.0-41.el10.s390x+debug
------------------------------------------------------
dd/32479 is trying to acquire lock:
0015a20accd0d4f8 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0x26/0x90
but task is already holding lock:
000000017e461698 (&zone->lock){-.-.}-{2:2}, at: rmqueue_bulk+0xac/0x8f0
the existing dependency chain (in reverse order) is:
-> #4 (&zone->lock){-.-.}-{2:2}:
-> #3 (hrtimer_bases.lock){-.-.}-{2:2}:
-> #2 (&rq->__lock){-.-.}-{2:2}:
-> #1 (&p->pi_lock){-.-.}-{2:2}:
-> #0 ((console_sem).lock){-.-.}-{2:2}:
The console_sem -> pi_lock dependency is due to calling try_to_wake_up() while holding the console_sem raw_spinlock. This dependency can be broken by using wake_q to do the wakeup instead of calling try_to_wake_up() under the console_sem lock. This will also make the semaphore's raw_spinlock become a terminal lock without taking any further locks underneath it.
The hrtimer_bases.lock is a raw_spinlock while zone->lock is a spinlock. The hrtimer_bases.lock -> zone->lock dependency happens via the debug_objects_fill_pool() helper function in the debugobjects code.
-> #4 (&zone->lock){-.-.}-{2:2}:
__lock_acquire+0xe86/0x1cc0
lock_acquire.part.0+0x258/0x630
lock_acquire+0xb8/0xe0
_raw_spin_lock_irqsave+0xb4/0x120
rmqueue_bulk+0xac/0x8f0
__rmqueue_pcplist+0x580/0x830
rmqueue_pcplist+0xfc/0x470
rmqueue.isra.0+0xdec/0x11b0
get_page_from_freelist+0x2ee/0xeb0
__alloc_pages_noprof+0x2c2/0x520
alloc_pages_mpol_noprof+0x1fc/0x4d0
alloc_pages_noprof+0x8c/0xe0
allocate_slab+0x320/0x460
___slab_alloc+0xa58/0x12b0
__slab_alloc.isra.0+0x42/0x60
kmem_cache_alloc_noprof+0x304/0x350
fill_pool+0xf6/0x450
debug_object_activate+0xfe/0x360
enqueue_hrtimer+0x34/0x190
__run_hrtimer+0x3c8/0x4c0
__hrtimer_run_queues+0x1b2/0x260
hrtimer_interrupt+0x316/0x760
do_IRQ+0x9a/0xe0
do_irq_async+0xf6/0x160Normally a raw_spinlock to spinlock dependency is not legitimate and will be warned if CONFIG_PROVE_RAW_LOCK_NESTING is enabled, but debug_objects_fill_pool() is an exception as it explicitly allows this dependency for non-PREEMPT_RT kernel without causing PROVE_RAW_LOCK_NESTING lockdep splat. As a result, this dependency is legitimate and not a bug.
Anyway, semaphore is the only locking primitive left that is still using try_to_wake_up() to do wakeup inside critical section, all the other locking primitives had been migrated to use wake_q to do wakeup outside of the critical section. It is also possible that there are other circular locking dependencies involving printk/console_sem or other existing/new semaphores lurking somewhere which may show up in the future. Let just do the migration now to wake_q to avoid headache like this.
--- kernel/locking/semaphore.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/locking/semaphore.c +9 -4
@@ -29,6 +29,7 @@#include <linux/export.h> #include <linux/sched.h> #include <linux/sched/debug.h> +#include <linux/sched/wake_q.h> #include <linux/semaphore.h> #include <linux/spinlock.h> #include <linux/ftrace.h>
@@ -38,7 +39,7 @@ static noinline void __down(struct semaphore *sem); static noinline int __down_interruptible(struct semaphore *sem); static noinline int __down_killable(struct semaphore *sem); static noinline int __down_timeout(struct semaphore *sem, long timeout); -static noinline void __up(struct semaphore *sem); +static noinline void __up(struct semaphore *sem, struct wake_q_head *wake_q);/** * down - acquire the semaphore
@@ -183,13 +184,16 @@ EXPORT_SYMBOL(down_timeout); void __sched up(struct semaphore *sem) {unsigned long flags; +DEFINE_WAKE_Q (wake_q);raw_spin_lock_irqsave (&sem->lock, flags);if (likely (list_empty (&sem->wait_list))) sem->count++;else -__up (sem); +__up (sem, &wake_q);raw_spin_unlock_irqrestore (&sem->lock, flags); +if (!wake_q_empty (&wake_q)) +wake_up_q (&wake_q); }EXPORT_SYMBOL (up);
@@ -269,11 +273,12 @@ static noinline int __sched __down_timeout(struct semaphore *sem, long timeout)return __down_common (sem,TASK_UNINTERRUPTIBLE , timeout); } -static noinline void __sched __up(struct semaphore *sem) +static noinline void __sched __up(struct semaphore *sem, +struct wake_q_head *wake_q) {struct semaphore_waiter *waiter =list_first_entry (&sem->wait_list, struct semaphore_waiter, list);list_del (&waiter->list); waiter->up = true; -wake_up_process (waiter->task); +wake_q_add (wake_q, waiter->task); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/8 x86/hyperv: Fix output argument to hypercall that changes page visibility
In reply to Sasha LevinFrom: Michael Kelley <[email protected]>
[ Upstream commit 09beefefb57bbc3a06d98f319d85db4d719d7bcb ]
The hypercall in hv_mark_gpa_visibility() is invoked with an input argument and an output argument. The output argument ostensibly returns the number of pages that were processed. But in fact, the hypercall does not provide any output, so the output argument is spurious.
The spurious argument is harmless because Hyper-V ignores it, but in the interest of correctness and to avoid the potential for future problems, remove it.
Message-ID: <[email protected]>
--- arch/x86/hyperv/ivm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/hyperv/ivm.c +1 -2
@@ -464,7 +464,6 @@ static int hv_mark_gpa_visibility(u16 count, const u64 pfn[], enum hv_mem_host_visibility visibility) {struct hv_gpa_range_for_visibility *input; -u16 pages_processed;u64 hv_status;unsigned long flags;
@@ -493,7 +492,7 @@ static int hv_mark_gpa_visibility(u16 count, const u64 pfn[],memcpy ((void *)input->gpa_page_list, pfn, count *sizeof (*pfn)); hv_status =hv_do_rep_hypercall (HVCALL_MODIFY_SPARSE_GPA_PAGE_HOST_VISIBILITY , count, -0 , input, &pages_processed); +0 , input,NULL );local_irq_restore (flags);if (hv_result_success (hv_status))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/8 x86/sgx: Warn explicitly if X86_FEATURE_SGX_LC is not enabled
In reply to Sasha LevinFrom: Vladis Dronov <[email protected]>
[ Upstream commit 65be5c95d08eedda570a6c888a12384c77fe7614 ]
The kernel requires X86_FEATURE_SGX_LC to be able to create SGX enclaves, not just X86_FEATURE_SGX.
There is quite a number of hardware which has X86_FEATURE_SGX but not X86_FEATURE_SGX_LC. A kernel running on such hardware does not create the /dev/sgx_enclave file and does so silently.
Explicitly warn if X86_FEATURE_SGX_LC is not enabled to properly notify users that the kernel disabled the SGX driver.
The X86_FEATURE_SGX_LC, a.k.a. SGX Launch Control, is a CPU feature that enables LE (Launch Enclave) hash MSRs to be writable (with additional opt-in required in the 'feature control' MSR) when running enclaves, i.e. using a custom root key rather than the Intel proprietary key for enclave signing.
I've hit this issue myself and have spent some time researching where my /dev/sgx_enclave file went on SGX-enabled hardware.
Related links:
https://github.com/intel/linux-sgx/issues/837
https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/
[ mingo: Made the error message a bit more verbose, and added other cases
where the kernel fails to create the /dev/sgx_enclave device node. ]
--- arch/x86/kernel/cpu/sgx/driver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/sgx/driver.c +7 -3
@@ -150,13 +150,15 @@ int __init sgx_drv_init(void)u64 xfrm_mask;int ret; -if (!cpu_feature_enabled (X86_FEATURE_SGX_LC )) +if (!cpu_feature_enabled (X86_FEATURE_SGX_LC )) { +pr_info ("SGX disabled: SGX launch control CPU feature is not available, /dev/sgx_enclave disabled.\n" );return -ENODEV ; + }cpuid_count (SGX_CPUID ,0 , &eax, &ebx, &ecx, &edx);if (!(eax &1 )) { -pr_err ("SGX disabled: SGX1 instruction support not available.\n" ); +pr_info ("SGX disabled: SGX1 instruction support not available, /dev/sgx_enclave disabled.\n" );return -ENODEV ; }
@@ -173,8 +175,10 @@ int __init sgx_drv_init(void) } ret =misc_register (&sgx_dev_enclave); -if (ret) +if (ret) { +pr_info ("SGX disabled: Unable to register the /dev/sgx_enclave driver (%d).\n" , ret);return ret; + }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/8 nvme-pci: fix stuck reset on concurrent DPC and HP
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit 3f674e7b670b7b7d9261935820e4eba3c059f835 ]
The PCIe error handling has the nvme driver quiesce the device, attempt to restart it, then wait for that restart to complete.
A PCIe DPC event also toggles the PCIe link. If the slot doesn't have out-of-band presence detection, this will trigger a pciehp re-enumeration.
The error handling that calls nvme_error_resume is holding the device lock while this happens. This lock blocks pciehp's request to disconnect the driver from proceeding.
Meanwhile the nvme's reset can't make forward progress because its device isn't there anymore with outstanding IO, and the timeout handler won't do anything to fix it because the device is undergoing error handling.
End result: deadlocked.
Fix this by having the timeout handler short cut the disabling for a disconnected PCIe device. The downside is that we're relying on an IO timeout to clean up this mess, which could be a minute by default.
--- drivers/nvme/host/pci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +12 -1
@@ -1282,8 +1282,19 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)struct nvme_dev *dev = nvmeq->dev;struct request *abort_req;struct nvme_command cmd = { }; +struct pci_dev *pdev =to_pci_dev (dev->dev);u32 csts =readl (dev->bar +NVME_REG_CSTS ); +/* +* Shutdown the device immediately if we see it is disconnected. This +* unblocks PCIe error handling if the nvme driver is waiting in +* error_resume for a device that has been removed. We can't unbind the +* driver while the driver's error callback is waiting to complete, so +* we're relying on a timeout to break that deadlock if a removal +* occurs while reset work is running. +*/ +if (pci_dev_is_disconnected (pdev)) +nvme_change_ctrl_state (&dev->ctrl,NVME_CTRL_DELETING );if (nvme_state_terminal (&dev->ctrl)) goto disable;
@@ -1291,7 +1302,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)* the recovery mechanism will surely fail. */ mb (); -if (pci_channel_offline (to_pci_dev (dev->dev))) +if (pci_channel_offline (pdev))return BLK_EH_RESET_TIMER ;/*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/8 drm/amd: Keep display off while going into S4
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 4afacc9948e1f8fdbca401d259ae65ad93d298c0 ]
When userspace invokes S4 the flow is:
1) amdgpu_pmops_prepare()
2) amdgpu_pmops_freeze()
3) Create hibernation image
4) amdgpu_pmops_thaw()
5) Write out image to disk
6) Turn off system
Then on resume amdgpu_pmops_restore() is called.
This flow has a problem that because amdgpu_pmops_thaw() is called it will call amdgpu_device_resume() which will resume all of the GPU.
This includes turning the display hardware back on and discovering connectors again.
This is an unexpected experience for the display to turn back on. Adjust the flow so that during the S4 sequence display hardware is not turned back on.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++-- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9 -2
@@ -2461,7 +2461,6 @@ static int amdgpu_pmops_freeze(struct device *dev) adev->in_s4 = true; r =amdgpu_device_suspend (drm_dev, true); - adev->in_s4 = false;if (r)return r;
@@ -2473,8 +2472,13 @@ static int amdgpu_pmops_freeze(struct device *dev)static int amdgpu_pmops_thaw (struct device *dev) {struct drm_device *drm_dev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (drm_dev); +int r; -return amdgpu_device_resume (drm_dev, true); + r =amdgpu_device_resume (drm_dev, true); + adev->in_s4 = false; + +return r; }static int amdgpu_pmops_poweroff (struct device *dev)
@@ -2487,6 +2491,9 @@ static int amdgpu_pmops_poweroff(struct device *dev)static int amdgpu_pmops_restore (struct device *dev) {struct drm_device *drm_dev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (drm_dev); + + adev->in_s4 = false;return amdgpu_device_resume (drm_dev, true); }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
@@ -2881,6 +2881,11 @@ static int dm_resume(void *handle)return 0 ; } + +/* leave display off for S4 sequence */ +if (adev->in_s4) +return 0 ; +/* Recreate dc_state - DC invalidates it when setting power state to S3. */ dc_release_state (dm_state->context); dm_state->context =dc_create_state (dm->dc);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/8 ALSA: hda/realtek: Add mute LED quirk for HP Pavilion x360 14-dy1xxx
In reply to Sasha LevinFrom: Navon John Lukose <[email protected]>
[ Upstream commit b11a74ac4f545626d0dc95a8ca8c41df90532bf3 ]
Add a fixup to enable the mute LED on HP Pavilion x360 Convertible 14-dy1xxx with ALC295 codec. The appropriate coefficient index and bits were identified through a brute-force method, as detailed in
https://bbs.archlinux.org/viewtopic.php?pid=2079504#p2079504.
--- sound/pci/hda/patch_realtek.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
sound/pci/hda/patch_realtek.c +21 -0
@@ -4783,6 +4783,21 @@ static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, } } +static void alc295_fixup_hp_mute_led_coefbit11 (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef.idx =0xb ; + spec->mute_led_coef.mask =3 <<3 ; + spec->mute_led_coef.on =1 <<3 ; + spec->mute_led_coef.off =1 <<4 ; +snd_hda_gen_add_mute_led_cdev (codec, coef_mute_led_set); + } +} +static void alc285_fixup_hp_mute_led (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -7331,6 +7346,7 @@ enum {ALC290_FIXUP_MONO_SPEAKERS_HSJACK ,ALC290_FIXUP_SUBWOOFER ,ALC290_FIXUP_SUBWOOFER_HSJACK , +ALC295_FIXUP_HP_MUTE_LED_COEFBIT11 ,ALC269_FIXUP_THINKPAD_ACPI ,ALC269_FIXUP_DMIC_THINKPAD_ACPI , ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13,
@@ -9068,6 +9084,10 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC283_FIXUP_INT_MIC, }, + [ALC295_FIXUP_HP_MUTE_LED_COEFBIT11] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc295_fixup_hp_mute_led_coefbit11, + }, [ALC298_FIXUP_SAMSUNG_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc298_fixup_samsung_amp,
@@ -9976,6 +9996,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8519 ,"HP Spectre x360 15-df0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360 ),SND_PCI_QUIRK (0x103c ,0x8537 ,"HP ProBook 440 G6" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x85c6 ,"HP Pavilion x360 Convertible 14-dy1xxx" ,ALC295_FIXUP_HP_MUTE_LED_COEFBIT11 ),SND_PCI_QUIRK (0x103c ,0x85de ,"HP Envy x360 13-ar0xxx" ,ALC285_FIXUP_HP_ENVY_X360 ),SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Signature · 1 line
2.39.5