diff mbox series

wifi: wext: Eliminate log spamming in wireless_warn_cfg80211_wext()

Message ID 20230222204945.6716-1-Larry.Finger@lwfinger.net (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series wifi: wext: Eliminate log spamming in wireless_warn_cfg80211_wext() | expand

Commit Message

Larry Finger Feb. 22, 2023, 8:49 p.m. UTC
Commit dc09766c755c {"wifi: wireless: warn on most wireless extension
usage") introduces a warning when wireless extensions are used with
cfg80211 drivers. Although such a warning is desirable, the current
implementation overflows the dmesg buffer with thousands of warnings,
all of which are the same. A WARN_ONCE() call is sufficient.

Fixes: dc09766c755c {"wifi: wireless: warn on most wireless extension usage")
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---

Kalle,

If accepted, this patch should be send to kernel 6.3.

Larry
---
 net/wireless/wext-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Johannes Berg Feb. 23, 2023, 8:12 a.m. UTC | #1
On Wed, 2023-02-22 at 14:49 -0600, Larry Finger wrote:
> Commit dc09766c755c {"wifi: wireless: warn on most wireless extension
> usage") introduces a warning when wireless extensions are used with
> cfg80211 drivers. Although such a warning is desirable, the current
> implementation overflows the dmesg buffer with thousands of warnings,
> all of which are the same.
> 

What are you seeing them from?

This is rate-limited, so not sure why you're getting so many?

>  A WARN_ONCE() call is sufficient.

I think a WARN is inappropriate (it's a userspace 'issue', not an in-
kernel consistency problem), but I guess we could pr_once().

But that's not great because it only shows a single application that was
still using it, not if there are multiple.

Hmm. Not sure what to do. Let's start with "why are you getting it so
much". Maybe we can somehow print it less, or try to do per application
once, or something.

johannes
Larry Finger Feb. 23, 2023, 4:07 p.m. UTC | #2
On 2/23/23 02:12, Johannes Berg wrote:
> On Wed, 2023-02-22 at 14:49 -0600, Larry Finger wrote:
>> Commit dc09766c755c {"wifi: wireless: warn on most wireless extension
>> usage") introduces a warning when wireless extensions are used with
>> cfg80211 drivers. Although such a warning is desirable, the current
>> implementation overflows the dmesg buffer with thousands of warnings,
>> all of which are the same.
>>
> 
> What are you seeing them from?
> 
> This is rate-limited, so not sure why you're getting so many?
> 
>>   A WARN_ONCE() call is sufficient.
> 
> I think a WARN is inappropriate (it's a userspace 'issue', not an in-
> kernel consistency problem), but I guess we could pr_once().
> 
> But that's not great because it only shows a single application that was
> still using it, not if there are multiple.
> 
> Hmm. Not sure what to do. Let's start with "why are you getting it so
> much". Maybe we can somehow print it less, or try to do per application
> once, or something.

Booting a kernel generated from a wireless-next pull yesterday, my log shows the 
following:

[   22.362531] warning: `kded5' uses wireless extensions that are deprecated for 
modern drivers; use nl80211
[   22.406929] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   22.408054] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   22.953271] Bluetooth: RFCOMM TTY layer initialized
[   22.953284] Bluetooth: RFCOMM socket layer initialized
[   22.953297] Bluetooth: RFCOMM ver 1.11
[   25.015996] wlp4s0: authenticate with 84:1b:5e:f7:6b:02
[   25.019642] wlp4s0: send auth to 84:1b:5e:f7:6b:02 (try 1/3)
[   25.124583] wlp4s0: send auth to 84:1b:5e:f7:6b:02 (try 2/3)
[   25.125135] wlp4s0: authenticated
[   25.125347] wlp4s0: VHT capa missing/short, disabling VHT/HE/EHT
[   25.132592] wlp4s0: associate with 84:1b:5e:f7:6b:02 (try 1/3)
[   25.133570] wlp4s0: RX AssocResp from 84:1b:5e:f7:6b:02 (capab=0x11 status=0 
aid=1)
[   25.135268] wlp4s0: associated
[   26.477742] warning: `akonadi_followu' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   26.563342] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   26.564152] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.251816] warning: `akonadi_notes_a' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.319352] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.319614] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.399084] warning: `akonadi_mailmer' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.423482] warning: `akonadi_maildis' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.461984] warning: `akonadi_sendlat' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.498341] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.498974] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.539437] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   29.540317] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   37.023881] wireless_warn_cfg80211_wext: 4 callbacks suppressed
[   37.023887] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   37.024151] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   38.739633] wlp4s0: deauthenticating from 84:1b:5e:f7:6b:02 by local choice 
(Reason: 3=DEAUTH_LEAVING)
[   39.020061] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   39.020096] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   39.020279] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   39.020330] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   40.020849] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   40.021068] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   40.024152] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   40.024339] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   47.021033] wireless_warn_cfg80211_wext: 2 callbacks suppressed
[   47.021042] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   47.021529] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   49.021028] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   49.021035] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   49.021183] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   49.021226] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   50.016001] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   50.016748] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   50.025271] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   50.025824] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   54.754126] rtw_8821ce 0000:02:00.0: Firmware version 24.11.0, H2C version 12
[   54.793028] rtw_8821ce 0000:02:00.0 wls1: renamed from wlan0
[   57.017048] wireless_warn_cfg80211_wext: 2 callbacks suppressed
[   57.017051] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   57.017056] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   57.017249] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   57.017253] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   59.017069] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   59.017078] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   59.017394] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   59.017399] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   59.017560] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   59.017568] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   60.202444] wls1: authenticate with 84:1b:5e:f7:6b:02
[   60.740887] wls1: send auth to 84:1b:5e:f7:6b:02 (try 1/3)
[   60.844938] wls1: send auth to 84:1b:5e:f7:6b:02 (try 2/3)
[   60.845879] wls1: authenticated
[   60.846069] wls1: VHT capa missing/short, disabling VHT/HE/EHT
[   60.852850] wls1: associate with 84:1b:5e:f7:6b:02 (try 1/3)
[   60.853804] wls1: RX AssocResp from 84:1b:5e:f7:6b:02 (capab=0x11 status=0 aid=1)
[   60.854594] wls1: associated
[   67.020942] wireless_warn_cfg80211_wext: 14 callbacks suppressed
[   67.020945] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   67.020950] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   67.021136] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   67.021141] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   69.020978] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   69.020985] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   69.020989] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   69.020991] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   69.021244] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   69.021248] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   77.015878] wireless_warn_cfg80211_wext: 14 callbacks suppressed
[   77.015888] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   77.015902] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   77.016408] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   77.016418] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   79.016374] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   79.016388] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   79.016786] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   79.016794] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   79.021806] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   79.021814] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   82.022287] wireless_warn_cfg80211_wext: 10 callbacks suppressed
[   82.022297] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   82.022310] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   82.022818] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   82.022829] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   87.026245] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   87.026262] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   87.026715] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   87.026725] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   89.022467] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   89.022483] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   89.022489] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   89.022527] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   89.022979] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   89.022990] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211

For explanation, device wlp4s0 shows "Network controller [0280]: Intel 
Corporation Wireless 7260 [8086:08b1] (rev 73)" in an 'lspci -nn' listing, and 
wls1 shows "Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8821CE 
802.11ac PCIe Wireless Network Adapter [10ec:c821]" in the same listing.

There are various tasks/applications that generate this warning early after 
startup, but the ones from `Qt bearer threa' are the ones that persist. Those 
were the only ones that I had seen once the dmesg buffer wrapped around. 
Obviously any kind on "once" restriction would lose information.

In my case, I support devices that need WEXT, thus disabling it in the 
configuration would not work. Logging one per application would entail a bit of 
work, but that would clear up the log spamming and work for me.

Larry
Larry Finger Feb. 23, 2023, 11:09 p.m. UTC | #3
On 2/23/23 02:12, Johannes Berg wrote:
> On Wed, 2023-02-22 at 14:49 -0600, Larry Finger wrote:
>> Commit dc09766c755c {"wifi: wireless: warn on most wireless extension
>> usage") introduces a warning when wireless extensions are used with
>> cfg80211 drivers. Although such a warning is desirable, the current
>> implementation overflows the dmesg buffer with thousands of warnings,
>> all of which are the same.
>>
> 
> What are you seeing them from?
> 
> This is rate-limited, so not sure why you're getting so many?
> 
>>   A WARN_ONCE() call is sufficient.
> 
> I think a WARN is inappropriate (it's a userspace 'issue', not an in-
> kernel consistency problem), but I guess we could pr_once().
> 
> But that's not great because it only shows a single application that was
> still using it, not if there are multiple.
> 
> Hmm. Not sure what to do. Let's start with "why are you getting it so
> much". Maybe we can somehow print it less, or try to do per application
> once, or something.

Johannes,

This patch has a magic number, but it does the job:

diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index 13a72b17248e..22a67172a163 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -637,12 +637,27 @@ void wireless_send_event(struct net_device *      dev,
  EXPORT_SYMBOL(wireless_send_event);

  #ifdef CONFIG_CFG80211_WEXT
+
+#define ARRAY_MAX  15
+static char name_array[ARRAY_MAX][TASK_COMM_LEN];
+static int array_count = 0;
+
  static void wireless_warn_cfg80211_wext(void)
  {
         char name[sizeof(current->comm)];
+       int i;

-       pr_warn_ratelimited("warning: `%s' uses wireless extensions that are 
deprecated for modern drivers; use nl80211\n",
-                           get_task_comm(name, current));
+       get_task_comm(name, current);
+       for (i = 0; i < array_count; i++) {
+               if (!strncmp(name, name_array[i], TASK_COMM_LEN))
+                       return;
+       }
+       /* Found new one - print warning and add to array */
+       strncpy(name_array[array_count], name, TASK_COMM_LEN);
+       if (array_count < ARRAY_MAX)
+               array_count++;
+       pr_warn("warning: `%s' uses wireless extensions that are deprecated for 
modern drivers; use nl80211\n",
+               name);
  }
  #endif

Looking at my log, I do get only one for each application.

finger@localhost:~>dmesg | grep warning | grep nl80211
[    8.826056] warning: `nspr-2' uses wireless extensions that are deprecated 
for modern drivers; use nl80211
[   17.212260] warning: `kded5' uses wireless extensions that are deprecated for 
modern drivers; use nl80211
[   17.252420] warning: `Qt bearer threa' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   22.664380] warning: `akonadi_notes_a' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   23.058001] warning: `akonadi_maildis' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   23.175135] warning: `akonadi_mailmer' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   23.329265] warning: `akonadi_followu' uses wireless extensions that are 
deprecated for modern drivers; use nl80211
[   24.075119] warning: `akonadi_sendlat' uses wireless extensions that are 
deprecated for modern drivers; use nl80211

I have no idea why most, if not all, of those applications even care about 
wireless. As you can see, I get 8 messages in a relatively short time, thus I 
selected 15 as the size of the array.

Larry
Nicolas Cavallari Feb. 24, 2023, 9:05 a.m. UTC | #4
On 23/02/2023 17:07, Larry Finger wrote:
> There are various tasks/applications that generate this warning early after
> startup, but the ones from `Qt bearer threa' are the ones that persist. Those
> were the only ones that I had seen once the dmesg buffer wrapped around.
> Obviously any kind on "once" restriction would lose information.
> 
> In my case, I support devices that need WEXT, thus disabling it in the
> configuration would not work. Logging one per application would entail a bit of
> work, but that would clear up the log spamming and work for me.

Wouldn't it be simpler to use custom rate limit parameters ? I see the defaults 
hardcoded in pr_warn_ratelimited() are 10 messages every 5 seconds before the 
rate limit triggers.

Changing them would require some layer busting, but it is still significantly 
simpler than caching names in an array.
Kalle Valo Feb. 24, 2023, 1:09 p.m. UTC | #5
Larry Finger <Larry.Finger@lwfinger.net> writes:

> On 2/23/23 02:12, Johannes Berg wrote:
>> On Wed, 2023-02-22 at 14:49 -0600, Larry Finger wrote:
>>> Commit dc09766c755c {"wifi: wireless: warn on most wireless extension
>>> usage") introduces a warning when wireless extensions are used with
>>> cfg80211 drivers. Although such a warning is desirable, the current
>>> implementation overflows the dmesg buffer with thousands of warnings,
>>> all of which are the same.
>>>
>>
>> What are you seeing them from?
>>
>> This is rate-limited, so not sure why you're getting so many?
>>
>>>   A WARN_ONCE() call is sufficient.
>>
>> I think a WARN is inappropriate (it's a userspace 'issue', not an in-
>> kernel consistency problem), but I guess we could pr_once().
>>
>> But that's not great because it only shows a single application that was
>> still using it, not if there are multiple.
>>
>> Hmm. Not sure what to do. Let's start with "why are you getting it so
>> much". Maybe we can somehow print it less, or try to do per application
>> once, or something.
>
> Johannes,
>
> This patch has a magic number, but it does the job:
>
> diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
> index 13a72b17248e..22a67172a163 100644
> --- a/net/wireless/wext-core.c
> +++ b/net/wireless/wext-core.c
> @@ -637,12 +637,27 @@ void wireless_send_event(struct net_device *      dev,
>  EXPORT_SYMBOL(wireless_send_event);
>
>  #ifdef CONFIG_CFG80211_WEXT
> +
> +#define ARRAY_MAX  15
> +static char name_array[ARRAY_MAX][TASK_COMM_LEN];
> +static int array_count = 0;
> +
>  static void wireless_warn_cfg80211_wext(void)
>  {
>         char name[sizeof(current->comm)];
> +       int i;
>
> -       pr_warn_ratelimited("warning: `%s' uses wireless extensions
> that are deprecated for modern drivers; use nl80211\n",
> -                           get_task_comm(name, current));
> +       get_task_comm(name, current);
> +       for (i = 0; i < array_count; i++) {
> +               if (!strncmp(name, name_array[i], TASK_COMM_LEN))
> +                       return;
> +       }
> +       /* Found new one - print warning and add to array */
> +       strncpy(name_array[array_count], name, TASK_COMM_LEN);
> +       if (array_count < ARRAY_MAX)
> +               array_count++;
> +       pr_warn("warning: `%s' uses wireless extensions that are
> deprecated for modern drivers; use nl80211\n",
> +               name);
>  }
>  #endif

This looks a bit complicated. What about printing the warning once per
boot using pr_warn_once()? That way we would not annoy people too much
but hopefully still motivate the applications to switch to using
nl80211.

> Looking at my log, I do get only one for each application.
>
> finger@localhost:~>dmesg | grep warning | grep nl80211
> [    8.826056] warning: `nspr-2' uses wireless extensions that are
> deprecated for modern drivers; use nl80211
> [   17.212260] warning: `kded5' uses wireless extensions that are
> deprecated for modern drivers; use nl80211
> [   17.252420] warning: `Qt bearer threa' uses wireless extensions
> that are deprecated for modern drivers; use nl80211
> [   22.664380] warning: `akonadi_notes_a' uses wireless extensions
> that are deprecated for modern drivers; use nl80211
> [   23.058001] warning: `akonadi_maildis' uses wireless extensions
> that are deprecated for modern drivers; use nl80211
> [   23.175135] warning: `akonadi_mailmer' uses wireless extensions
> that are deprecated for modern drivers; use nl80211
> [   23.329265] warning: `akonadi_followu' uses wireless extensions
> that are deprecated for modern drivers; use nl80211
> [   24.075119] warning: `akonadi_sendlat' uses wireless extensions
> that are deprecated for modern drivers; use nl80211
>
> I have no idea why most, if not all, of those applications even care
> about wireless. As you can see, I get 8 messages in a relatively short
> time, thus I selected 15 as the size of the array.

Oh man, that's a lot of applications. Are these all KDE or QT
applications, maybe libqt uses Wireless Extensions for something?

Linus also reported that he is seeing spam from google-chrome:

https://lore.kernel.org/all/CAHk-=wjTMgB0=PQt8synf1MRTfetVXAWWLOibnMKvv1ETn_1uw@mail.gmail.com/

So there are a lot more applications using the outdated Wireless
Extension interface as we originally thought. It will take a long time
to get rid of WE usage :(
Larry Finger Feb. 24, 2023, 3:55 p.m. UTC | #6
On 2/24/23 07:09, Kalle Valo wrote:
> Larry Finger <Larry.Finger@lwfinger.net> writes:
> 
>> On 2/23/23 02:12, Johannes Berg wrote:
>>> On Wed, 2023-02-22 at 14:49 -0600, Larry Finger wrote:
>>>> Commit dc09766c755c {"wifi: wireless: warn on most wireless extension
>>>> usage") introduces a warning when wireless extensions are used with
>>>> cfg80211 drivers. Although such a warning is desirable, the current
>>>> implementation overflows the dmesg buffer with thousands of warnings,
>>>> all of which are the same.
>>>>
>>>
>>> What are you seeing them from?
>>>
>>> This is rate-limited, so not sure why you're getting so many?
>>>
>>>>    A WARN_ONCE() call is sufficient.
>>>
>>> I think a WARN is inappropriate (it's a userspace 'issue', not an in-
>>> kernel consistency problem), but I guess we could pr_once().
>>>
>>> But that's not great because it only shows a single application that was
>>> still using it, not if there are multiple.
>>>
>>> Hmm. Not sure what to do. Let's start with "why are you getting it so
>>> much". Maybe we can somehow print it less, or try to do per application
>>> once, or something.
>>
>> Johannes,
>>
>> This patch has a magic number, but it does the job:
>>
>> diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
>> index 13a72b17248e..22a67172a163 100644
>> --- a/net/wireless/wext-core.c
>> +++ b/net/wireless/wext-core.c
>> @@ -637,12 +637,27 @@ void wireless_send_event(struct net_device *      dev,
>>   EXPORT_SYMBOL(wireless_send_event);
>>
>>   #ifdef CONFIG_CFG80211_WEXT
>> +
>> +#define ARRAY_MAX  15
>> +static char name_array[ARRAY_MAX][TASK_COMM_LEN];
>> +static int array_count = 0;
>> +
>>   static void wireless_warn_cfg80211_wext(void)
>>   {
>>          char name[sizeof(current->comm)];
>> +       int i;
>>
>> -       pr_warn_ratelimited("warning: `%s' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211\n",
>> -                           get_task_comm(name, current));
>> +       get_task_comm(name, current);
>> +       for (i = 0; i < array_count; i++) {
>> +               if (!strncmp(name, name_array[i], TASK_COMM_LEN))
>> +                       return;
>> +       }
>> +       /* Found new one - print warning and add to array */
>> +       strncpy(name_array[array_count], name, TASK_COMM_LEN);
>> +       if (array_count < ARRAY_MAX)
>> +               array_count++;
>> +       pr_warn("warning: `%s' uses wireless extensions that are
>> deprecated for modern drivers; use nl80211\n",
>> +               name);
>>   }
>>   #endif
> 
> This looks a bit complicated. What about printing the warning once per
> boot using pr_warn_once()? That way we would not annoy people too much
> but hopefully still motivate the applications to switch to using
> nl80211.
> 
>> Looking at my log, I do get only one for each application.
>>
>> finger@localhost:~>dmesg | grep warning | grep nl80211
>> [    8.826056] warning: `nspr-2' uses wireless extensions that are
>> deprecated for modern drivers; use nl80211
>> [   17.212260] warning: `kded5' uses wireless extensions that are
>> deprecated for modern drivers; use nl80211
>> [   17.252420] warning: `Qt bearer threa' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211
>> [   22.664380] warning: `akonadi_notes_a' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211
>> [   23.058001] warning: `akonadi_maildis' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211
>> [   23.175135] warning: `akonadi_mailmer' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211
>> [   23.329265] warning: `akonadi_followu' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211
>> [   24.075119] warning: `akonadi_sendlat' uses wireless extensions
>> that are deprecated for modern drivers; use nl80211
>>
>> I have no idea why most, if not all, of those applications even care
>> about wireless. As you can see, I get 8 messages in a relatively short
>> time, thus I selected 15 as the size of the array.
> 
> Oh man, that's a lot of applications. Are these all KDE or QT
> applications, maybe libqt uses Wireless Extensions for something?
> 
> Linus also reported that he is seeing spam from google-chrome:
> 
> https://lore.kernel.org/all/CAHk-=wjTMgB0=PQt8synf1MRTfetVXAWWLOibnMKvv1ETn_1uw@mail.gmail.com/
> 
> So there are a lot more applications using the outdated Wireless
> Extension interface as we originally thought. It will take a long time
> to get rid of WE usage :(

Kalle,

Yes, my patch is a bit complicated, but it provides information that can be sent 
upstream to get proper fixes for all applications - a "feature" lacking if a 
simple pr_warn_once() is used. As I told Johannes and Linus in my previous 
E-mail, I will keep my patch locally to accumulate usage info for more than the 
first instance of this warning.

I do not know anything about Akonadi internals, but the rest of the warnings 
seem to come from KDE or QT. I agree that libqt is a likely culprit.

Larry


Larry

>
diff mbox series

Patch

diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index 13a72b17248e..9589ba5dafc2 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -641,8 +641,8 @@  static void wireless_warn_cfg80211_wext(void)
 {
 	char name[sizeof(current->comm)];
 
-	pr_warn_ratelimited("warning: `%s' uses wireless extensions that are deprecated for modern drivers; use nl80211\n",
-			    get_task_comm(name, current));
+	WARN_ONCE(1, "warning: `%s' uses wireless extensions that are deprecated for modern drivers; use nl80211\n",
+		  get_task_comm(name, current));
 }
 #endif