Skip to contentSkip to conversation

Power saving features for iwl4965

DISCUSSION Tino Keitel 6 participants 33 messages Apr 18, 2012 – Feb 25, 2014 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

Hi,

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig <interface> power on", at least when unsetting the broken_powersave variable.

2.6.39 introduced a new iwlegacy driver for iwl4965 hardware, which was missing power saving. I was able to port the 2.6.38 driver up to kernel 3.1, but it got too complicated for me with 3.2.

Are there any plans to fix this power usage regression at some point in the iwlegacy driver? I think there are still a lot of iwl4965 users out there.

Please include my address in any replies, as I'm not subscribed.

Regards,
Tino

maintainer
#1 lore raw
Quoted 3 lines · Tino Keitel

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig<interface> power on", at least when unsetting the broken_powersave variable.

This isn't quite correct. Yes, power saving was enabled there, but relatively frequently it caused the device to crash. Therefore, it was disabled as a stability fix, not to remove powersaving from you :)

johannes

author
#2 lore raw

------- Original message -------

Quoted 11 lines

From: Johannes Berg <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: 19.4.'12, 16:25

Quoted 3 lines · Tino Keitel

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig<interface> power on", at least when unsetting the broken_powersave variable.

This isn't quite correct. Yes, power saving was enabled there, but relatively frequently it caused the device to crash. Therefore, it was disabled as a stability fix, not to remove powersaving from you :)

Hi,

I was aware that it was disabled because of stability issues in certain setups. I never experienced any issue when running with power saving enabled, though. Other people did the same and even suggested patches to clear broken_powersave with a module parameter.

Regards,
Tino

#3 lore raw
In reply to Tino Keitel
Quoted 11 lines · Tino Keitel

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig <interface> power on", at least when unsetting the broken_powersave variable.

2.6.39 introduced a new iwlegacy driver for iwl4965 hardware, which was missing power saving. I was able to port the 2.6.38 driver up to kernel 3.1, but it got too complicated for me with 3.2.

Are there any plans to fix this power usage regression at some point in the iwlegacy driver? I think there are still a lot of iwl4965 users out there.

Yes, adding PS support is on my iwlegacy TODO list.

Stanislaw

#4 lore raw
Quoted 5 lines · Stanislaw Gruszka
Quoted 4 lines · Tino Keitel

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig <interface> power on", at least when unsetting the broken_powersave variable.

Quoted 8 lines
Quoted 7 lines

2.6.39 introduced a new iwlegacy driver for iwl4965 hardware, which was missing power saving. I was able to port the 2.6.38 driver up to kernel 3.1, but it got too complicated for me with 3.2.

Are there any plans to fix this power usage regression at some point in the iwlegacy driver? I think there are still a lot of iwl4965 users out there.

Yes, adding PS support is on my iwlegacy TODO list.

Thanks, I'd be glad if I could help, testing etc.

Regards,
Tino

#5 lore raw
Quoted 10 lines · Tino Keitel
Quoted 9 lines · Stanislaw Gruszka
Quoted 8 lines · Tino Keitel

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig <interface> power on", at least when unsetting the broken_powersave variable.

2.6.39 introduced a new iwlegacy driver for iwl4965 hardware, which was missing power saving. I was able to port the 2.6.38 driver up to kernel 3.1, but it got too complicated for me with 3.2.

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

Are there any plans to fix this power usage regression at some point in the iwlegacy driver? I think there are still a lot of iwl4965 users out there.

Yes, adding PS support is on my iwlegacy TODO list.

Thanks, I'd be glad if I could help, testing etc.

Hi Stanislaw,

is there any progress regarding this? If not, I could try to implement it in the current kernel. However, I don't have any knowlegde about hardware related features. If you have, maybe I could use your knowledge to do it myself.

Regards,
Tino

#6 lore raw

Hi

Quoted 16 lines · Tino Keitel
Quoted 15 lines · Tino Keitel
Quoted 13 lines · Stanislaw Gruszka
Quoted 11 lines · Tino Keitel

up to 2.6.38, the iwl4965 driver was able to use power saving features by invoking "iwconfig <interface> power on", at least when unsetting the broken_powersave variable.

2.6.39 introduced a new iwlegacy driver for iwl4965 hardware, which was missing power saving. I was able to port the 2.6.38 driver up to kernel 3.1, but it got too complicated for me with 3.2.

Are there any plans to fix this power usage regression at some point in the iwlegacy driver? I think there are still a lot of iwl4965 users out there.

Yes, adding PS support is on my iwlegacy TODO list.

Quoted 8 lines
Quoted 1 line

Thanks, I'd be glad if I could help, testing etc.

Hi Stanislaw,

is there any progress regarding this? If not, I could try to implement it in the current kernel. However, I don't have any knowlegde about hardware related features. If you have, maybe I could use your knowledge to do it myself.

I posted patch here
http://marc.info/?l=linux-wireless&m=135601033021616&w=2

But I did not review code regarding power save to catch possible problems. Testing are bug reporting are welcome ...

Thanks
Stanislaw

#7 lore raw
Quoted 11 lines · Stanislaw Gruszka

Hi

Quoted 7 lines · Tino Keitel

Hi Stanislaw,

is there any progress regarding this? If not, I could try to implement it in the current kernel. However, I don't have any knowlegde about hardware related features. If you have, maybe I could use your knowledge to do it myself.

Quoted 5 lines

I posted patch here
http://marc.info/?l=linux-wireless&m=135601033021616&w=2

But I did not review code regarding power save to catch possible problems. Testing are bug reporting are welcome ...

Is the firmware crashing only after suspend? Or 'always'? (iwl3945)

#8 lore raw
Quoted 12 lines · Pedro Francisco
Quoted 11 lines · Stanislaw Gruszka

Hi

Quoted 7 lines · Tino Keitel

Hi Stanislaw,

is there any progress regarding this? If not, I could try to implement it in the current kernel. However, I don't have any knowlegde about hardware related features. If you have, maybe I could use your knowledge to do it myself.

Quoted 7 lines
Quoted 5 lines

I posted patch here
http://marc.info/?l=linux-wireless&m=135601033021616&w=2

But I did not review code regarding power save to catch possible problems. Testing are bug reporting are welcome ...

Is the firmware crashing only after suspend? Or 'always'? (iwl3945)

I don't have 3945 crashes on my local machine when I enable PS. The only documented issue on 3945 I found is this bug:
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2125
It stands that problem happen just after associate.

BTW: PS is still disabled by default, to test it need to be enabled by iw or iwconfig tool.

Stanislaw

#9 lore raw
In reply to Stanislaw Gruszka

On Mon, Jan 07, 2013 at 12:08:00 +0100, Stanislaw Gruszka wrote:

[...]

Quoted 5 lines

I posted patch here
http://marc.info/?l=linux-wireless&m=135601033021616&w=2

But I did not review code regarding power save to catch possible problems. Testing are bug reporting are welcome ...

Hi,

the patch is surprisingly small. To me it looks like it only contains the code to make "iwconfig wlan0 power on" work, the actual power management is missing.

I just did some tests using powertop to see if I'm right. With the old pre-iwlegacy driver, the difference between "iwconfig wlan0 power on" and "... power off" is more then 0,8W, which is ~10% of the total idle power usage of my X61s with dimmed screen. With a current kernel and your patch, I can't measure a difference between "iwconfig wlan0 power on" and "... power off". To me it seems that the patch is pretty useless, at least on 4965AGN hardware.

It would be really nice to have proper power management in a current kernel, as the laptop gets noticeably hotter with the current iwlegacy driver. That's why I still use a 3.1.10 kernel with an old forward-ported iwlagn driver.

Regards,
Tino

#10 lore raw
Quoted 16 lines · Tino Keitel

On Mon, Jan 07, 2013 at 12:08:00 +0100, Stanislaw Gruszka wrote:

[...]

Quoted 5 lines

I posted patch here
http://marc.info/?l=linux-wireless&m=135601033021616&w=2

But I did not review code regarding power save to catch possible problems. Testing are bug reporting are welcome ...

Hi,

the patch is surprisingly small. To me it looks like it only contains the code to make "iwconfig wlan0 power on" work, the actual power management is missing.

Quoted 7 lines

I just did some tests using powertop to see if I'm right. With the old pre-iwlegacy driver, the difference between "iwconfig wlan0 power on" and "... power off" is more then 0,8W, which is ~10% of the total idle power usage of my X61s with dimmed screen. With a current kernel and your patch, I can't measure a difference between "iwconfig wlan0 power on" and "... power off". To me it seems that the patch is pretty useless, at least on 4965AGN hardware.

Yes, we do not send any command to put hardware in sleep mode when mac80211 enable PS.

Quoted 4 lines

It would be really nice to have proper power management in a current kernel, as the laptop gets noticeably hotter with the current iwlegacy driver. That's why I still use a 3.1.10 kernel with an old forward-ported iwlagn driver.

Could you try this experimental patch?

drivers/net/wireless/iwlegacy/commands.h +2 -1
index 3b6c994..baf3ae7 100644
@@ -2278,7 +2278,8 @@ struct il_spectrum_notification {
  */
 #define IL_POWER_VEC_SIZE 5
 
-#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK	cpu_to_le16(BIT(0))
+#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK		cpu_to_le16(BIT(0))
+#define IL_POWER_SLEEP_OVER_DTIM_MSK		cpu_to_le16(BIT(2))
 #define IL_POWER_PCI_PM_MSK			cpu_to_le16(BIT(3))
 
 struct il3945_powertable_cmd {
drivers/net/wireless/iwlegacy/common.c +67 -14

109 lines not on this page · raw message

drivers/net/wireless/iwlegacy/common.h +1 -0
index f8246f2..8f81983 100644
@@ -1123,6 +1123,7 @@ struct il_power_mgr {
 	struct il_powertable_cmd sleep_cmd_next;
 	int debug_sleep_level_override;
 	bool pci_pm;
+	bool ps_disabled;
 };
 
 struct il_priv {
#11 lore raw
Quoted 28 lines · Stanislaw Gruszka
Quoted 16 lines · Tino Keitel

On Mon, Jan 07, 2013 at 12:08:00 +0100, Stanislaw Gruszka wrote:

[...]

Quoted 5 lines

I posted patch here
http://marc.info/?l=linux-wireless&m=135601033021616&w=2

But I did not review code regarding power save to catch possible problems. Testing are bug reporting are welcome ...

Hi,

the patch is surprisingly small. To me it looks like it only contains the code to make "iwconfig wlan0 power on" work, the actual power management is missing.

Quoted 7 lines

I just did some tests using powertop to see if I'm right. With the old pre-iwlegacy driver, the difference between "iwconfig wlan0 power on" and "... power off" is more then 0,8W, which is ~10% of the total idle power usage of my X61s with dimmed screen. With a current kernel and your patch, I can't measure a difference between "iwconfig wlan0 power on" and "... power off". To me it seems that the patch is pretty useless, at least on 4965AGN hardware.

Yes, we do not send any command to put hardware in sleep mode when mac80211 enable PS.

Quoted 6 lines
Quoted 4 lines

It would be really nice to have proper power management in a current kernel, as the laptop gets noticeably hotter with the current iwlegacy driver. That's why I still use a 3.1.10 kernel with an old forward-ported iwlagn driver.

Could you try this experimental patch? (...)

I am trying the iwlegacy powersave patch along with CPU scheduler BFS and IO scheduler BFQ.

I've got this today:

Jun 09 00:51:34 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 51 is out of range [0-256] 51 51
Jun 09 00:51:34 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 52 is out of range [0-256] 51 51
(...)
Jun 09 00:51:38 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 219 is out of range [0-256] 57 51
Jun 09 00:51:38 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA

queue txq_id (2) idx 220 is out of range [0-256] 57 51

Jun 09 00:51:34 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 51 is out of range [0-256] 51 51
Jun 09 00:51:34 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 52 is out of range [0-256] 51 51
(...)
Jun 09 00:51:38 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 254 is out of range [0-256] 58 51
Jun 09 00:51:38 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 255 is out of range [0-256] 58 51
Jun 09 00:51:38 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 0 is out of range [0-256] 58 51
Jun 09 00:51:38 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 1 is out of range [0-256] 58 51
(...)
Jun 09 00:51:39 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA
queue txq_id (2) idx 49 is out of range [0-256] 58 51
Jun 09 00:51:39 s2 kernel: iwl3945 0000:02:00.0: Read idx for DMA

queue txq_id (2) idx 50 is out of range [0-256] 58 51

$ uname -a
Linux s2 3.9.4-301.local.fc19.i686

I have just made a clean boot (as in, this has not happened after a resume for suspend or hibernation).

May it be related to the patch? Or may heavy IO with out-of-tree CPU scheduler BFS and out-of-tree IO scheduler BFQ be responsible for the warnings?

Thanks in Advance,

Signature · 1 line
Pedro Francisco
#12 lore raw
Quoted 18 lines · Pedro Francisco
Quoted 8 lines · Stanislaw Gruszka
Quoted 5 lines · Tino Keitel

(...)
It would be really nice to have proper power management in a current kernel, as the laptop gets noticeably hotter with the current iwlegacy driver. That's why I still use a 3.1.10 kernel with an old forward-ported iwlagn driver.

Could you try this experimental patch? (...)

I am trying the iwlegacy powersave patch along with CPU scheduler BFS and IO scheduler BFQ.

I've got this today: (...)

$ uname -a
Linux s2 3.9.4-301.local.fc19.i686
Quoted 6 lines

I have just made a clean boot (as in, this has not happened after a resume for suspend or hibernation).

May it be related to the patch? Or may heavy IO with out-of-tree CPU scheduler BFS and out-of-tree IO scheduler BFQ be responsible for the warnings?

I also got a SYSASSERT:
[Jun 9 10:35] iwl3945 0000:02:00.0: Read idx for DMA queue txq_id (2) idx 186 is out of range [0-256] 186 186
(...)
[ +0,000164] iwl3945 0000:02:00.0: Read idx for DMA queue txq_id (2) idx 185 is out of range [0-256] 186 186
[Jun 9 10:36] iwl3945 0000:02:00.0: Microcode SW error detected. Restarting 0x82000008.

[  +0,000008] iwl3945 0000:02:00.0: Loaded firmware version: 15.32.2.9
[  +0,000034] iwl3945 0000:02:00.0: Start IWL Error Log Dump:
[  +0,000004] iwl3945 0000:02:00.0: Status: 0x000302E4, count: 1
[  +0,000004] iwl3945 0000:02:00.0: Desc       Time       asrtPC

blink2 ilink1 nmiPC Line
[ +0,000224] iwl3945 0000:02:00.0: SYSASSERT (0x5) 0228106348
0x008B6 0x0035E 0x0031C 0x00000 267

[ +0,000010] iwl3945 0000:02:00.0: Error Reply type 0x00000001 cmd UNKNOWN (0xFC) seq 0x2099 ser 0x00FC0000
[ +0,000466] iwl3945 0000:02:00.0: Can't stop Rx DMA.
[ +0,001647] ieee80211 phy0: Hardware restart was requested [Jun 9 10:38] iwl3945 0000:02:00.0: Read idx for DMA queue txq_id (2) idx 186 is out of range [0-256] 186 186
(...)

I disabled powersave (but kept running the same kernel) and none of the errors appeared again.

#13 lore raw
Quoted 51 lines · Pedro Francisco
Quoted 18 lines · Pedro Francisco
Quoted 8 lines · Stanislaw Gruszka
Quoted 5 lines · Tino Keitel

(...)
It would be really nice to have proper power management in a current kernel, as the laptop gets noticeably hotter with the current iwlegacy driver. That's why I still use a 3.1.10 kernel with an old forward-ported iwlagn driver.

Could you try this experimental patch? (...)

I am trying the iwlegacy powersave patch along with CPU scheduler BFS and IO scheduler BFQ.

I've got this today: (...)

$ uname -a
Linux s2 3.9.4-301.local.fc19.i686
Quoted 6 lines

I have just made a clean boot (as in, this has not happened after a resume for suspend or hibernation).

May it be related to the patch? Or may heavy IO with out-of-tree CPU scheduler BFS and out-of-tree IO scheduler BFQ be responsible for the warnings?

I also got a SYSASSERT:
[Jun 9 10:35] iwl3945 0000:02:00.0: Read idx for DMA queue txq_id (2) idx 186 is out of range [0-256] 186 186
(...)
[ +0,000164] iwl3945 0000:02:00.0: Read idx for DMA queue txq_id (2) idx 185 is out of range [0-256] 186 186
[Jun 9 10:36] iwl3945 0000:02:00.0: Microcode SW error detected. Restarting 0x82000008.

[  +0,000008] iwl3945 0000:02:00.0: Loaded firmware version: 15.32.2.9
[  +0,000034] iwl3945 0000:02:00.0: Start IWL Error Log Dump:
[  +0,000004] iwl3945 0000:02:00.0: Status: 0x000302E4, count: 1
[  +0,000004] iwl3945 0000:02:00.0: Desc       Time       asrtPC

blink2 ilink1 nmiPC Line
[ +0,000224] iwl3945 0000:02:00.0: SYSASSERT (0x5) 0228106348
0x008B6 0x0035E 0x0031C 0x00000 267

[ +0,000010] iwl3945 0000:02:00.0: Error Reply type 0x00000001 cmd UNKNOWN (0xFC) seq 0x2099 ser 0x00FC0000
[ +0,000466] iwl3945 0000:02:00.0: Can't stop Rx DMA.
[ +0,001647] ieee80211 phy0: Hardware restart was requested [Jun 9 10:38] iwl3945 0000:02:00.0: Read idx for DMA queue txq_id (2) idx 186 is out of range [0-256] 186 186
(...)

Quoted 2 lines

I disabled powersave (but kept running the same kernel) and none of the errors appeared again.

Yes, this seems to be iwlegacy PS issue and has to be fixed before this patch could be applied.

Thanks for testing.
Stanislaw

#27 lore raw
In reply to Stanislaw Gruszka
Quoted 1 line · Stanislaw Gruszka

Could you try this experimental patch?

Hi,

on top of kernel 3.9.4 (with TuxOnIce patch), iwconfig wlan0 power on now saves more than 1 W on my ThinkPad X61s with iwl4965. I can finally switch to a recent kernel. Thanks a lot.

Regards,
Tino

#14 lore raw
In reply to Stanislaw Gruszka

Hi,

in my kernel log, I also see a SYSASSERT, but only once after resume from suspend to RAM.

2013-06-11_18:40:58.80553 kern.notice: sd 0:0:0:0: [sda] Starting disk 2013-06-11_18:40:58.80554 kern.err: iwl4965 0000:03:00.0: Microcode SW error detected. Restarting 0x82000000. 2013-06-11_18:40:58.80555 kern.err: iwl4965 0000:03:00.0: Loaded firmware version: 228.61.2.24
2013-06-11_18:40:58.80556 kern.err: iwl4965 0000:03:00.0: Start IWL Error Log Dump:
2013-06-11_18:40:58.80557 kern.err: iwl4965 0000:03:00.0: Status:
0x000313E4, count: 5
2013-06-11_18:40:58.80558 kern.err: iwl4965 0000:03:00.0: Desc
Time data1 data2 line
2013-06-11_18:40:58.80559 kern.err: iwl4965 0000:03:00.0: SYSASSERT (0x0005) 0000000095 0x00000000 0x00000000 262 2013-06-11_18:40:58.80560 kern.err: iwl4965 0000:03:00.0: pc blink1 blink2 ilink1 ilink2 hcmd 2013-06-11_18:40:58.80561 kern.err: iwl4965 0000:03:00.0: 0x0C924 0x0C90E 0x0C93A 0x006DA 0x00000 0x4090010 2013-06-11_18:40:58.80562 kern.err: iwl4965 0000:03:00.0: FH register values:
2013-06-11_18:40:58.80563 kern.err: iwl4965 0000:03:00.0:
FH49_RSCSR_CHNL0_STTS_WPTR_REG: 0X0b101300 2013-06-11_18:40:58.80564 kern.err: iwl4965 0000:03:00.0:
FH49_RSCSR_CHNL0_RBDCB_BASE_REG: 0X00b10120 2013-06-11_18:40:58.80565 kern.err: iwl4965 0000:03:00.0:
FH49_RSCSR_CHNL0_WPTR: 0X00000008
2013-06-11_18:40:58.80565 kern.err: iwl4965 0000:03:00.0:
FH49_MEM_RCSR_CHNL0_CONFIG_REG: 0X80819000 2013-06-11_18:40:58.80566 kern.err: iwl4965 0000:03:00.0:
FH49_MEM_RSSR_SHARED_CTRL_REG: 0X0000003c 2013-06-11_18:40:58.80567 kern.err: iwl4965 0000:03:00.0:
FH49_MEM_RSSR_RX_STATUS_REG: 0X07030000 2013-06-11_18:40:58.80569 kern.err: iwl4965 0000:03:00.0:
FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV: 0X00000000 2013-06-11_18:40:58.80570 kern.err: iwl4965 0000:03:00.0:
FH49_TSSR_TX_STATUS_REG: 0X07ff0002 2013-06-11_18:40:58.80571 kern.err: iwl4965 0000:03:00.0:
FH49_TSSR_TX_ERROR_REG: 0X00000000
2013-06-11_18:40:58.80572 kern.err: iwl4965 0000:03:00.0: Command C_RXON failed: FW Error
2013-06-11_18:40:58.80575 kern.err: iwl4965 0000:03:00.0: Error setting new RXON (-5)
2013-06-11_18:40:58.80576 kern.warn: iwl4965 0000:03:00.0: Try to add interface when device not ready

Regards,
Tino

#15 lore raw
In reply to Stanislaw Gruszka
Quoted 19 lines · Stanislaw Gruszka
Quoted 18 lines · Pedro Francisco
Quoted 16 lines · Pedro Francisco
Quoted 8 lines · Stanislaw Gruszka
Quoted 5 lines · Tino Keitel

(...)
It would be really nice to have proper power management in a current kernel, as the laptop gets noticeably hotter with the current iwlegacy driver. That's why I still use a 3.1.10 kernel with an old forward-ported iwlagn driver.

Could you try this experimental patch? (...)

I am trying the iwlegacy powersave patch along with CPU scheduler BFS and IO scheduler BFQ.

I've got this today: (...)

(...)

Quoted 8 lines
Quoted 5 lines

I also got a SYSASSERT:
(...)

I disabled powersave (but kept running the same kernel) and none of the errors appeared again.

Yes, this seems to be iwlegacy PS issue and has to be fixed before this patch could be applied.

But is it a driver-only issue? I had assumed it was some sort of fireware+driver issue...

Will running with debug on help? Or is it easily reproducible on any iwl3945 / iwl4465 ?

Because in my case (iwl3945) it happens after boot, no prior suspend to RAM is required to trigger the issues.

P.S.: the demise of bugzilla.intellinuxwireless.org it's very difficult to find useful info about this. It would appear 4465 is just affected after suspend, believing the patch which disabled PS in 2009.

#16 lore raw
Quoted 11 lines · Pedro Francisco
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Quoted 1 line

Could you try this experimental patch? (...)

I am trying the iwlegacy powersave patch along with CPU scheduler BFS and IO scheduler BFQ.

I've got this today: (...)

(...)

I also got a SYSASSERT:
(...)

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I disabled powersave (but kept running the same kernel) and none of the errors appeared again.

Yes, this seems to be iwlegacy PS issue and has to be fixed before this patch could be applied.

But is it a driver-only issue? I had assumed it was some sort of fireware+driver issue...

Looks like driver issue or firmware issue that can be workaround in the driver.

Quoted 5 lines

Will running with debug on help? Or is it easily reproducible on any iwl3945 / iwl4465 ?

Because in my case (iwl3945) it happens after boot, no prior suspend to RAM is required to trigger the issues.

I can reproduce microcode error on iwl4965 by reloading modules. Looks like we put device in sleep mode and it can not be properly booted when driver initalize. I did not yet test patch on iwl3945. When I'll do this, I think I'll be able to reproduce problems you discovered. If not I'll ask for more debug info.

Thanks
Stanislaw

#17 lore raw
Quoted 17 lines · Stanislaw Gruszka
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

I also got a SYSASSERT:
(...)

I disabled powersave (but kept running the same kernel) and none of the errors appeared again.

Yes, this seems to be iwlegacy PS issue and has to be fixed before this patch could be applied.

But is it a driver-only issue? I had assumed it was some sort of fireware+driver issue...

Looks like driver issue or firmware issue that can be workaround in the driver.

Quoted 3 lines

Will running with debug on help? Or is it easily reproducible on any iwl3945 / iwl4465 ?

Quoted 7 lines
Quoted 2 lines

Because in my case (iwl3945) it happens after boot, no prior suspend to RAM is required to trigger the issues.

I can reproduce microcode error on iwl4965 by reloading modules. Looks like we put device in sleep mode and it can not be properly booted when driver initalize. I did not yet test patch on iwl3945. When I'll do this, I think I'll be able to reproduce problems you discovered. If not I'll ask for more debug info.

I found problem on 4965, we have to send power configuration command to device earlier, before some other commands. Attached patch solved microcode errors I have on 4965.

Regarding iwl3945. Display on my 3945 laptop no longer works. I took 3945 device from that laptop and installed it on two different machines. Unfortunately on none of them device was detected by pci system :-/ I have figure out how to get working 3945 testing environment, but for now, perhaps you could provide me some more debug information.

Pedro, please do the fallowing:

Add this line in /etc/rsyslog.conf:
kern.* /var/log/kernel

Restart rsyslog services:

# systemctl restart rsyslog.service

Restart iwl3945 module with verbose debug enabled:
modprobe -r iwl3945
modprobe iwl3945 debug=0x47ffffff

Reproduce the problem.

Unload module:
modprobe -r iwl3945

Then provide me generated /var/log/kernel file (compressed if needed).

Thanks
Stanislaw

drivers/net/wireless/iwlegacy/4965-mac.c +3 -3
index d287fd2..e7821f6 100644
@@ -5334,6 +5334,9 @@ il4965_alive_start(struct il_priv *il)
 
 	il->active_rate = RATES_MASK;
 
+	il_power_update_mode(il, true);
+	D_INFO("Updated power mode\n");
+
 	if (il_is_associated(il)) {
 		struct il_rxon_cmd *active_rxon =
 		    (struct il_rxon_cmd *)&il->active;
@@ -5364,9 +5367,6 @@ il4965_alive_start(struct il_priv *il)
 	D_INFO("ALIVE processing complete.\n");
 	wake_up(&il->wait_command_queue);
 
-	il_power_update_mode(il, true);
-	D_INFO("Updated power mode\n");
-
 	return;
 
 restart:
#18 lore raw
Quoted 48 lines · Stanislaw Gruszka
Quoted 17 lines · Stanislaw Gruszka
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

I also got a SYSASSERT:
(...)

I disabled powersave (but kept running the same kernel) and none of the errors appeared again.

Yes, this seems to be iwlegacy PS issue and has to be fixed before this patch could be applied.

But is it a driver-only issue? I had assumed it was some sort of fireware+driver issue...

Looks like driver issue or firmware issue that can be workaround in the driver.

Quoted 3 lines

Will running with debug on help? Or is it easily reproducible on any iwl3945 / iwl4465 ?

Quoted 7 lines
Quoted 2 lines

Because in my case (iwl3945) it happens after boot, no prior suspend to RAM is required to trigger the issues.

I can reproduce microcode error on iwl4965 by reloading modules. Looks like we put device in sleep mode and it can not be properly booted when driver initalize. I did not yet test patch on iwl3945. When I'll do this, I think I'll be able to reproduce problems you discovered. If not I'll ask for more debug info.

I found problem on 4965, we have to send power configuration command to device earlier, before some other commands. Attached patch solved microcode errors I have on 4965.

Regarding iwl3945. Display on my 3945 laptop no longer works. I took 3945 device from that laptop and installed it on two different machines. Unfortunately on none of them device was detected by pci system :-/ I have figure out how to get working 3945 testing environment, but for now, perhaps you could provide me some more debug information.

Pedro, please do the fallowing:

Add this line in /etc/rsyslog.conf:
kern.* /var/log/kernel

Restart rsyslog services:

# systemctl restart rsyslog.service

Restart iwl3945 module with verbose debug enabled:
modprobe -r iwl3945
modprobe iwl3945 debug=0x47ffffff

Quoted 6 lines

Reproduce the problem.

Unload module:
modprobe -r iwl3945

Then provide me generated /var/log/kernel file (compressed if needed).

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).
--
Pedro

#19 lore raw
Quoted 25 lines · Pedro Francisco
Quoted 12 lines

Pedro, please do the fallowing:

Add this line in /etc/rsyslog.conf:
kern.* /var/log/kernel

Restart rsyslog services:

# systemctl restart rsyslog.service

Restart iwl3945 module with verbose debug enabled:
modprobe -r iwl3945
modprobe iwl3945 debug=0x47ffffff

Quoted 6 lines

Reproduce the problem.

Unload module:
modprobe -r iwl3945

Then provide me generated /var/log/kernel file (compressed if needed).

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Quoted 3 lines

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).

To test that patch powersave has to be explicitly enabled, since it is disabled by default.

As this is not causing troubles with default disable_hw_scan option, I'll post that patch.

You can provide me logs with disable_hw_scan=0, if you manage to trigger a Microcode error.

Thanks
Stanislaw

Quoted 2 lines

--
Pedro

#20 lore raw
Quoted 2 lines · Stanislaw Gruszka

You can provide me logs with disable_hw_scan=0, if you manage to trigger a Microcode error.

I can't trigger the microcode error with the debug. The firmware however gets corrupted and reloading the module does not fix it (firmware validation fails until I restart) -- curiously after a 'power info' RXON (? or similar, can't access the logs now) is sent to the card.

I'll test again tomorrow.

#21 lore raw
In reply to Stanislaw Gruszka
Quoted 6 lines · Stanislaw Gruszka
Quoted 6 lines

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Quoted 6 lines
Quoted 3 lines

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).

As this is not causing troubles with default disable_hw_scan option, I'll post that patch.

My mistake, I can trigger error conditions _independently_ of disable_hw_scan option being enabled or disabled, as long as powersave is enabled.

I'll send you a private email with the logs.

#22 lore raw
Quoted 11 lines · Pedro Francisco
Quoted 10 lines · Stanislaw Gruszka
Quoted 9 lines

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).

Quoted 8 lines
Quoted 2 lines

As this is not causing troubles with default disable_hw_scan option, I'll post that patch.

My mistake, I can trigger error conditions _independently_ of disable_hw_scan option being enabled or disabled, as long as powersave is enabled.

I'll send you a private email with the logs.

I think I found bug which couse this firmware crash. We have only 5 queues so updating write_ptr for txq[5] can cause random value write to HBUS_TARG_WRPTR register. I also added spin_lock to do not abuse writes we do in tx skb.

Please test attached patch (with powersave on :-)

Stanislaw

drivers/net/wireless/iwlegacy/3945-mac.c +3 -1
index b37a582..afa5c6e 100644
@@ -1495,12 +1495,14 @@ il3945_irq_tasklet(struct il_priv *il)
 	if (inta & CSR_INT_BIT_WAKEUP) {
 		D_ISR("Wakeup interrupt\n");
 		il_rx_queue_update_write_ptr(il, &il->rxq);
+
+		spin_lock_irqsave(&il->lock, flags);
 		il_txq_update_write_ptr(il, &il->txq[0]);
 		il_txq_update_write_ptr(il, &il->txq[1]);
 		il_txq_update_write_ptr(il, &il->txq[2]);
 		il_txq_update_write_ptr(il, &il->txq[3]);
 		il_txq_update_write_ptr(il, &il->txq[4]);
-		il_txq_update_write_ptr(il, &il->txq[5]);
+		spin_unlock_irqrestore(&il->lock, flags);
 
 		il->isr_stats.wakeup++;
 		handled |= CSR_INT_BIT_WAKEUP;
#23 lore raw
Quoted 19 lines · Stanislaw Gruszka
Quoted 18 lines · Pedro Francisco
Quoted 6 lines · Stanislaw Gruszka
Quoted 6 lines

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Quoted 6 lines
Quoted 3 lines

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).

As this is not causing troubles with default disable_hw_scan option, I'll post that patch.

My mistake, I can trigger error conditions _independently_ of disable_hw_scan option being enabled or disabled, as long as powersave is enabled.

Quoted 8 lines
Quoted 1 line

I'll send you a private email with the logs.

I think I found bug which couse this firmware crash. We have only 5 queues so updating write_ptr for txq[5] can cause random value write to HBUS_TARG_WRPTR register. I also added spin_lock to do not abuse writes we do in tx skb.

Please test attached patch (with powersave on :-)

Still not working :( I tested for two nights, first one was fine, second was not (the only difference was I had kernel parameter slub_debug on the second night, but my guess it shouldn't affect anything?).

Snippet of log follows, full logs I'll send privately (beware, unzipped it's 423MB).

Anyway, any idea what is the value 0xa5a5a5a2 ? It's always the same value which makes the reloaded firmware to fail... And in other firmware failures around the Web, both iwlegacy and iwlwifi.

Aug  4 09:23:58 s2 kernel: [32309.937084] iwl3945 0000:02:00.0: Queue
4 stuck for 2004 ms.
Aug  4 09:23:58 s2 kernel: [32309.937106] iwl3945 0000:02:00.0: On
demand firmware reload
Aug  4 09:23:58 s2 kernel: [32309.937128] ieee80211 phy1: U
__il3945_down iwl3945 is going down
Aug  4 09:23:58 s2 kernel: [32309.937137] ieee80211 phy1: U
il_scan_cancel_timeout Scan cancel timeout
Aug  4 09:23:58 s2 kernel: [32309.937143] ieee80211 phy1: U
il_do_scan_abort Not performing scan to abort
Aug  4 09:23:58 s2 kernel: [32309.937149] ieee80211 phy1: U
il_clear_ucode_stations Clearing ucode stations in driver
Aug  4 09:23:58 s2 kernel: [32309.937155] ieee80211 phy1: U
il_clear_ucode_stations Clearing ucode active for station 0
Aug  4 09:23:58 s2 kernel: [32309.937162] ieee80211 phy1: U
il_clear_ucode_stations Clearing ucode active for station 24
Aug  4 09:23:58 s2 kernel: [32309.938116] ieee80211 phy1: U
_il_apm_stop Stop card, put in low power state
Aug  4 09:23:58 s2 kernel: [32309.938116] iwl3945 0000:02:00.0: Master
Disable Timed Out, 100 usec
Aug  4 09:23:58 s2 kernel: [32309.938116] ieee80211 phy1: U
_il_apm_stop_master stop master
Aug  4 09:23:58 s2 kernel: [32309.954705] ieee80211 phy1: U
il3945_clear_free_frames 0 frames on pre-allocated heap on clear.
Aug  4 09:23:58 s2 kernel: [32309.954740] ieee80211 phy1: Hardware
restart was requested
Aug  4 09:23:58 s2 kernel: [32309.954757] ieee80211 phy1: U
il3945_mac_start enter
Aug  4 09:23:58 s2 kernel: [32309.954763] ieee80211 phy1: U
il_prep_station Add STA to driver ID 24: ff:ff:ff:ff:ff:ff
Aug  4 09:23:58 s2 kernel: [32309.954774] ieee80211 phy1: U
il_apm_init Init card's basic functions
Aug  4 09:23:58 s2 kernel: [32309.955111] ieee80211 phy1: U
il3945_nic_config HW Revision ID = 0x2
Aug  4 09:23:58 s2 kernel: [32309.955117] ieee80211 phy1: U
il3945_nic_config 3945 RADIO-MM type
Aug  4 09:23:58 s2 kernel: [32309.955127] ieee80211 phy1: U
il3945_nic_config SKU OP mode is basic
Aug  4 09:23:58 s2 kernel: [32309.955131] ieee80211 phy1: U
il3945_nic_config 3945ABG revision is 0xF1
Aug  4 09:23:58 s2 kernel: [32309.955140] ieee80211 phy1: U
il3945_nic_config Card M type B version is 0x3
Aug  4 09:23:58 s2 kernel: [32309.955150] ieee80211 phy1: U
il3945_nic_config SW RF KILL supported in EEPROM.
Aug  4 09:23:58 s2 kernel: [32309.955153] ieee80211 phy1: U
il3945_nic_config HW RF KILL supported in EEPROM.
Aug  4 09:23:58 s2 kernel: [32309.974318] ieee80211 phy1: U
il3945_load_bsm Begin load bsm
Aug  4 09:23:58 s2 kernel: [32310.018857] ieee80211 phy1: U
il3945_verify_bsm Begin verify bsm
Aug  4 09:23:58 s2 kernel: [32310.020628] iwl3945 0000:02:00.0: BSM
uCode verification failed at addr 0x00003800+0 (of 900), is
0xa5a5a5a2, s/b 0xf802020
Aug  4 09:23:58 s2 kernel: [32310.020632] iwl3945 0000:02:00.0: Unable
to set up bootstrap uCode: -5
Aug  4 09:23:58 s2 kernel: [32310.020636] ieee80211 phy1: U
il3945_load_bsm Begin load bsm
Aug  4 09:23:58 s2 kernel: [32310.041691] hrtimer: interrupt took 3021833 ns
Aug  4 09:23:58 s2 kernel: [32310.065681] ieee80211 phy1: U
il3945_verify_bsm Begin verify bsm
Aug  4 09:23:58 s2 kernel: [32310.067345] iwl3945 0000:02:00.0: BSM

uCode verification failed at addr 0x00003800+0 (of 900), is 0xa5a5a5a2, s/b 0xf802020

Signature · 1 line
Pedro
#24 lore raw
Quoted 102 lines · Pedro Francisco
Quoted 19 lines · Stanislaw Gruszka
Quoted 18 lines · Pedro Francisco
Quoted 6 lines · Stanislaw Gruszka
Quoted 6 lines

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Quoted 6 lines
Quoted 3 lines

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).

As this is not causing troubles with default disable_hw_scan option, I'll post that patch.

My mistake, I can trigger error conditions _independently_ of disable_hw_scan option being enabled or disabled, as long as powersave is enabled.

Quoted 8 lines
Quoted 1 line

I'll send you a private email with the logs.

I think I found bug which couse this firmware crash. We have only 5 queues so updating write_ptr for txq[5] can cause random value write to HBUS_TARG_WRPTR register. I also added spin_lock to do not abuse writes we do in tx skb.

Please test attached patch (with powersave on :-)

Still not working :( I tested for two nights, first one was fine, second was not (the only difference was I had kernel parameter slub_debug on the second night, but my guess it shouldn't affect anything?).

Snippet of log follows, full logs I'll send privately (beware, unzipped it's 423MB).

Anyway, any idea what is the value 0xa5a5a5a2 ? It's always the same value which makes the reloaded firmware to fail... And in other firmware failures around the Web, both iwlegacy and iwlwifi.

Aug  4 09:23:58 s2 kernel: [32309.937084] iwl3945 0000:02:00.0: Queue
4 stuck for 2004 ms.
Aug  4 09:23:58 s2 kernel: [32309.937106] iwl3945 0000:02:00.0: On
demand firmware reload
Aug  4 09:23:58 s2 kernel: [32309.937128] ieee80211 phy1: U
__il3945_down iwl3945 is going down
Aug  4 09:23:58 s2 kernel: [32309.937137] ieee80211 phy1: U
il_scan_cancel_timeout Scan cancel timeout
Aug  4 09:23:58 s2 kernel: [32309.937143] ieee80211 phy1: U
il_do_scan_abort Not performing scan to abort
Aug  4 09:23:58 s2 kernel: [32309.937149] ieee80211 phy1: U
il_clear_ucode_stations Clearing ucode stations in driver
Aug  4 09:23:58 s2 kernel: [32309.937155] ieee80211 phy1: U
il_clear_ucode_stations Clearing ucode active for station 0
Aug  4 09:23:58 s2 kernel: [32309.937162] ieee80211 phy1: U
il_clear_ucode_stations Clearing ucode active for station 24
Aug  4 09:23:58 s2 kernel: [32309.938116] ieee80211 phy1: U
_il_apm_stop Stop card, put in low power state
Aug  4 09:23:58 s2 kernel: [32309.938116] iwl3945 0000:02:00.0: Master
Disable Timed Out, 100 usec
Aug  4 09:23:58 s2 kernel: [32309.938116] ieee80211 phy1: U
_il_apm_stop_master stop master
Aug  4 09:23:58 s2 kernel: [32309.954705] ieee80211 phy1: U
il3945_clear_free_frames 0 frames on pre-allocated heap on clear.
Aug  4 09:23:58 s2 kernel: [32309.954740] ieee80211 phy1: Hardware
restart was requested
Aug  4 09:23:58 s2 kernel: [32309.954757] ieee80211 phy1: U
il3945_mac_start enter
Aug  4 09:23:58 s2 kernel: [32309.954763] ieee80211 phy1: U
il_prep_station Add STA to driver ID 24: ff:ff:ff:ff:ff:ff
Aug  4 09:23:58 s2 kernel: [32309.954774] ieee80211 phy1: U
il_apm_init Init card's basic functions
Aug  4 09:23:58 s2 kernel: [32309.955111] ieee80211 phy1: U
il3945_nic_config HW Revision ID = 0x2
Aug  4 09:23:58 s2 kernel: [32309.955117] ieee80211 phy1: U
il3945_nic_config 3945 RADIO-MM type
Aug  4 09:23:58 s2 kernel: [32309.955127] ieee80211 phy1: U
il3945_nic_config SKU OP mode is basic
Aug  4 09:23:58 s2 kernel: [32309.955131] ieee80211 phy1: U
il3945_nic_config 3945ABG revision is 0xF1
Aug  4 09:23:58 s2 kernel: [32309.955140] ieee80211 phy1: U
il3945_nic_config Card M type B version is 0x3
Aug  4 09:23:58 s2 kernel: [32309.955150] ieee80211 phy1: U
il3945_nic_config SW RF KILL supported in EEPROM.
Aug  4 09:23:58 s2 kernel: [32309.955153] ieee80211 phy1: U
il3945_nic_config HW RF KILL supported in EEPROM.
Aug  4 09:23:58 s2 kernel: [32309.974318] ieee80211 phy1: U
il3945_load_bsm Begin load bsm
Aug  4 09:23:58 s2 kernel: [32310.018857] ieee80211 phy1: U
il3945_verify_bsm Begin verify bsm
Aug  4 09:23:58 s2 kernel: [32310.020628] iwl3945 0000:02:00.0: BSM
uCode verification failed at addr 0x00003800+0 (of 900), is
0xa5a5a5a2, s/b 0xf802020
Aug  4 09:23:58 s2 kernel: [32310.020632] iwl3945 0000:02:00.0: Unable
to set up bootstrap uCode: -5
Aug  4 09:23:58 s2 kernel: [32310.020636] ieee80211 phy1: U
il3945_load_bsm Begin load bsm
Aug  4 09:23:58 s2 kernel: [32310.041691] hrtimer: interrupt took 3021833 ns
Aug  4 09:23:58 s2 kernel: [32310.065681] ieee80211 phy1: U
il3945_verify_bsm Begin verify bsm
Aug  4 09:23:58 s2 kernel: [32310.067345] iwl3945 0000:02:00.0: BSM
Quoted 2 lines

uCode verification failed at addr 0x00003800+0 (of 900), is 0xa5a5a5a2, s/b 0xf802020

Other thing, which may or may not be relevant. The 'script':
rmmod iwl3945; modprobe iwl3945 debug=0x47ffffff ; sleep 10; rmmod iwl3945; modprobe iwl3945

At the end of this 'script', shouldn't debug mode be disabled? I thought it would be disabled, but until modprobe iwl3945 debug=0 is done, debug is still active. Does this mean firmware reload/module reload isn't completely resetting the card, as I suppose it was supposed to do?

Signature · 1 line
Pedro
#25 lore raw
Quoted 31 lines · Pedro Francisco
Quoted 29 lines · Pedro Francisco
Quoted 27 lines · Stanislaw Gruszka
Quoted 11 lines · Pedro Francisco
Quoted 10 lines · Stanislaw Gruszka
Quoted 9 lines

I seem only to be able to trigger it with disable_hw_scan=0, I need further testing with disable_hw_scan=1 (I use disable_hw_scan=0 because it prevents me from getting disconnected from eduroam Cisco APs -- haven't tested disable_hw_scan=0 since the VOIP-friendly SW scanning patch, however).

Do you want the log anyway? (modprobe iwl3945 debug=0x47ffffff disable_hw_scan=0 and runtime PCI powersave also enabled -- I don't know if it matters).

Quoted 8 lines
Quoted 2 lines

As this is not causing troubles with default disable_hw_scan option, I'll post that patch.

My mistake, I can trigger error conditions _independently_ of disable_hw_scan option being enabled or disabled, as long as powersave is enabled.

I'll send you a private email with the logs.

I think I found bug which couse this firmware crash. We have only 5 queues so updating write_ptr for txq[5] can cause random value write to HBUS_TARG_WRPTR register. I also added spin_lock to do not abuse writes we do in tx skb.

Please test attached patch (with powersave on :-)

Quoted 7 lines
Quoted 7 lines

Still not working :( I tested for two nights, first one was fine, second was not (the only difference was I had kernel parameter slub_debug on the second night, but my guess it shouldn't affect anything?).

Snippet of log follows, full logs I'll send privately (beware, unzipped it's 423MB).

Sorry for late answer. I have two more patches, which perhaps make powersave stop crashing on 3945. Please test them (note that I only compile tested, be carefull :-)

Thanks
Stanislaw

Quoted 1 line

From c9da2966ce58ed1446367a0b14b0953ebc3fbfbe Mon Sep 17 00:00:00 2001

From: Stanislaw Gruszka <[email protected]>
Date: Thu, 17 Oct 2013 10:48:44 +0200
Subject: [PATCH 1/2] iwlegacy poke device when waiting for hcmd

---
 drivers/net/wireless/iwlegacy/common.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlegacy/common.c +20 -7
index b03e22e..7ada864 100644
@@ -254,8 +254,6 @@ il_get_cmd_string(u8 cmd)
 }
 EXPORT_SYMBOL(il_get_cmd_string);
 
-#define HOST_COMPLETE_TIMEOUT (HZ / 2)
-
 static void
 il_generic_cmd_callback(struct il_priv *il, struct il_device_cmd *cmd,
 			struct il_rx_pkt *pkt)
@@ -305,11 +303,15 @@ il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd)
 	return 0;
 }
 
+#define HOST_COMPLETE_TIMEOUT (HZ / 2)
+#define COMMAND_POKE_TIMEOUT  (HZ / 10)
+
 int
 il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
 {
-	int cmd_idx;
-	int ret;
+	unsigned long flags;
+	int cmd_idx, ret;
+	int timeout = HOST_COMPLETE_TIMEOUT;
 
 	lockdep_assert_held(&il->mutex);
 
@@ -333,9 +335,20 @@ il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
 		goto out;
 	}
 
-	ret = wait_event_timeout(il->wait_command_queue,
-				 !test_bit(S_HCMD_ACTIVE, &il->status),
-				 HOST_COMPLETE_TIMEOUT);
+	while (timeout) {
+		ret = wait_event_timeout(il->wait_command_queue,
+					 !test_bit(S_HCMD_ACTIVE, &il->status),
+					 COMMAND_POKE_TIMEOUT);
+		if (ret)
+			break;
+
+		/* Poke the device, it may have lost the command. */
+		spin_lock_irqsave(&il->reg_lock, flags);
+		_il_grab_nic_access(il);
+		_il_release_nic_access(il);
+		spin_unlock_irqrestore(&il->reg_lock, flags);
+	}
+
 	if (!ret) {
 		if (test_bit(S_HCMD_ACTIVE, &il->status)) {
 			IL_ERR("Error sending %s: time out after %dms.\n",
Signature · 1 line
1.7.1
Quoted 1 line

From 05b86620fcec5f18293b0df2a4dddbe34ae24125 Mon Sep 17 00:00:00 2001

From: Stanislaw Gruszka <[email protected]>
Date: Thu, 17 Oct 2013 11:03:21 +0200
Subject: [PATCH 2/2] iwlegacy: merge and fix reclaim for 3945

---
 drivers/net/wireless/iwlegacy/3945-mac.c |    9 +--------
 drivers/net/wireless/iwlegacy/4965-mac.c |   12 +-----------
 drivers/net/wireless/iwlegacy/common.h   |   14 ++++++++++++++
 3 files changed, 16 insertions(+), 19 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +1 -8
index dea3b50..d7c8dd3 100644
@@ -1248,14 +1248,7 @@ il3945_rx_handle(struct il_priv *il)
 		len = le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK;
 		len += sizeof(u32);	/* account for status word */
 
-		/* Reclaim a command buffer only if this packet is a response
-		 *   to a (driver-originated) command.
-		 * If the packet (e.g. Rx frame) originated from uCode,
-		 *   there is no command buffer to reclaim.
-		 * Ucode should set SEQ_RX_FRAME bit if ucode-originated,
-		 *   but apparently a few don't get set; catch them here. */
-		reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
-		    pkt->hdr.cmd != N_STATS && pkt->hdr.cmd != C_TX;
+		reclaim = il_need_reclaim(il, pkt);
 
 		/* Based on type of command response or notification,
 		 *   handle those that need handling via function in
drivers/net/wireless/iwlegacy/4965-mac.c +1 -11
index 86812b9..97cfaa9 100644
@@ -4274,17 +4274,7 @@ il4965_rx_handle(struct il_priv *il)
 		len = le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK;
 		len += sizeof(u32);	/* account for status word */
 
-		/* Reclaim a command buffer only if this packet is a response
-		 *   to a (driver-originated) command.
-		 * If the packet (e.g. Rx frame) originated from uCode,
-		 *   there is no command buffer to reclaim.
-		 * Ucode should set SEQ_RX_FRAME bit if ucode-originated,
-		 *   but apparently a few don't get set; catch them here. */
-		reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
-		    (pkt->hdr.cmd != N_RX_PHY) && (pkt->hdr.cmd != N_RX) &&
-		    (pkt->hdr.cmd != N_RX_MPDU) &&
-		    (pkt->hdr.cmd != N_COMPRESSED_BA) &&
-		    (pkt->hdr.cmd != N_STATS) && (pkt->hdr.cmd != C_TX);
+		reclaim = il_need_reclaim(il, pkt);
 
 		/* Based on type of command response or notification,
 		 *   handle those that need handling via function in
drivers/net/wireless/iwlegacy/common.h +14 -0
index 83f8ed8..eccd6a4 100644
@@ -1978,6 +1978,20 @@ extern void il_wr_prph(struct il_priv *il, u32 addr, u32 val);
 extern u32 il_read_targ_mem(struct il_priv *il, u32 addr);
 extern void il_write_targ_mem(struct il_priv *il, u32 addr, u32 val);
 
+static inline bool il_need_reclaim(struct il_priv *il, struct il_rx_pkt *pkt)
+{
+	/* Reclaim a command buffer only if this packet is a response
+	 * to a (driver-originated) command. If the packet (e.g. Rx frame)
+	 * originated from uCode, there is no command buffer to reclaim.
+	 * Ucode should set SEQ_RX_FRAME bit if ucode-originated, but
+	 * apparently a few don't get set; catch them here.
+	 */
+	return !(pkt->hdr.sequence & SEQ_RX_FRAME) &&
+	       pkt->hdr.cmd != N_STATS && pkt->hdr.cmd != C_TX &&
+	       pkt->hdr.cmd != N_RX_PHY && pkt->hdr.cmd != N_RX &&
+	       pkt->hdr.cmd != N_RX_MPDU && pkt->hdr.cmd != N_COMPRESSED_BA;
+}
+
 static inline void
 _il_write8(struct il_priv *il, u32 ofs, u8 val)
 {
Signature · 1 line
1.7.1
#26 lore raw
Quoted 3 lines · Stanislaw Gruszka

Sorry for late answer. I have two more patches, which perhaps make powersave stop crashing on 3945. Please test them (note that I only compile tested, be carefull :-)

First patch has a bug. I'm attaching improved version.

Stanislaw

Quoted 1 line

From dae9f167853f266d5efe688f965968725375e2ae Mon Sep 17 00:00:00 2001

From: Stanislaw Gruszka <[email protected]>
Date: Thu, 17 Oct 2013 15:30:07 +0200
Subject: [PATCH] iwlegacy poke device when waiting for hcmd

---
 drivers/net/wireless/iwlegacy/common.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlegacy/common.c +22 -7
index b03e22e..3d8dae3c 100644
@@ -254,8 +254,6 @@ il_get_cmd_string(u8 cmd)
 }
 EXPORT_SYMBOL(il_get_cmd_string);
 
-#define HOST_COMPLETE_TIMEOUT (HZ / 2)
-
 static void
 il_generic_cmd_callback(struct il_priv *il, struct il_device_cmd *cmd,
 			struct il_rx_pkt *pkt)
@@ -305,11 +303,15 @@ il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd)
 	return 0;
 }
 
+#define HOST_COMPLETE_TIMEOUT (HZ / 2)
+#define COMMAND_POKE_TIMEOUT  (HZ / 10)
+
 int
 il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
 {
-	int cmd_idx;
-	int ret;
+	unsigned long flags;
+	int cmd_idx, ret;
+	int timeout = HOST_COMPLETE_TIMEOUT;
 
 	lockdep_assert_held(&il->mutex);
 
@@ -333,9 +335,22 @@ il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
 		goto out;
 	}
 
-	ret = wait_event_timeout(il->wait_command_queue,
-				 !test_bit(S_HCMD_ACTIVE, &il->status),
-				 HOST_COMPLETE_TIMEOUT);
+	while (timeout > 0) {
+		ret = wait_event_timeout(il->wait_command_queue,
+					 !test_bit(S_HCMD_ACTIVE, &il->status),
+					 COMMAND_POKE_TIMEOUT);
+		if (ret)
+			break;
+
+		/* Poke the device, it may have lost the command. */
+		spin_lock_irqsave(&il->reg_lock, flags);
+		_il_grab_nic_access(il);
+		_il_release_nic_access(il);
+		spin_unlock_irqrestore(&il->reg_lock, flags);
+
+		timeout -= COMMAND_POKE_TIMEOUT;
+	}
+
 	if (!ret) {
 		if (test_bit(S_HCMD_ACTIVE, &il->status)) {
 			IL_ERR("Error sending %s: time out after %dms.\n",
Signature · 1 line
1.8.3.1
#28 lore raw
In reply to Tino Keitel
Quoted 9 lines · Tino Keitel
Quoted 1 line · Stanislaw Gruszka

Could you try this experimental patch?

Hi,

on top of kernel 3.9.4 (with TuxOnIce patch), iwconfig wlan0 power on now saves more than 1 W on my ThinkPad X61s with iwl4965. I can finally switch to a recent kernel. Thanks a lot.

This patch stuck on mailing list far too long, I'll post it. Even if it crash firmware on 3945, power save is disabled by default.

Stanislaw

#29 lore raw
Quoted 5 lines · Stanislaw Gruszka
Quoted 4 lines · Tino Keitel
Quoted 1 line · Stanislaw Gruszka

Could you try this experimental patch?

Quoted 9 lines
Quoted 5 lines

Hi,

on top of kernel 3.9.4 (with TuxOnIce patch), iwconfig wlan0 power on now saves more than 1 W on my ThinkPad X61s with iwl4965. I can finally switch to a recent kernel. Thanks a lot.

This patch stuck on mailing list far too long, I'll post it. Even if it crash firmware on 3945, power save is disabled by default.

I'd be very surprised if this patch helped. I guess you took the code from iwlwifi in which we have enabled shadow registers for 7000 series. This HW is problematic but it doesn't exit on 4965.

#30 lore raw
Quoted 12 lines · Emmanuel Grumbach
Quoted 11 lines · Stanislaw Gruszka
Quoted 9 lines · Tino Keitel
Quoted 1 line · Stanislaw Gruszka

Could you try this experimental patch?

Hi,

on top of kernel 3.9.4 (with TuxOnIce patch), iwconfig wlan0 power on now saves more than 1 W on my ThinkPad X61s with iwl4965. I can finally switch to a recent kernel. Thanks a lot.

Quoted 7 lines
Quoted 3 lines

This patch stuck on mailing list far too long, I'll post it. Even if it crash firmware on 3945, power save is disabled by default.

I'd be very surprised if this patch helped. I guess you took the code from iwlwifi in which we have enabled shadow registers for 7000 series. This HW is problematic but it doesn't exit on 4965.

It is besed on old iwlwifi code (when iwlwifi & iwlegacy were one driver).

Stanislaw

#31 lore raw
In reply to Stanislaw Gruszka
Quoted 5 lines · Stanislaw Gruszka
Quoted 4 lines · Tino Keitel
Quoted 1 line · Stanislaw Gruszka

Could you try this experimental patch?

Quoted 8 lines
Quoted 5 lines

Hi,

on top of kernel 3.9.4 (with TuxOnIce patch), iwconfig wlan0 power on now saves more than 1 W on my ThinkPad X61s with iwl4965. I can finally switch to a recent kernel. Thanks a lot.

This patch stuck on mailing list far too long, I'll post it. Even if it crash firmware on 3945, power save is disabled by default.

Ok!
The patch was not forgotten, just indefinitely delayed :/ Now that I can compile a kernel in 10 minutes instead of >1h, I'll try to test it :)

Signature · 1 line
Pedro
#32 lore raw

2014-02-20 12:08 GMT+00:00 Pedro Francisco <[email protected]>:

Quoted 12 lines · Stanislaw Gruszka
Quoted 11 lines · Tino Keitel
Quoted 9 lines · Stanislaw Gruszka
Quoted 2 lines

Could you try this experimental patch?

Hi,

on top of kernel 3.9.4 (with TuxOnIce patch), iwconfig wlan0 power on now saves more than 1 W on my ThinkPad X61s with iwl4965. I can finally switch to a recent kernel. Thanks a lot.

Quoted 7 lines
Quoted 2 lines

This patch stuck on mailing list far too long, I'll post it. Even if it crash firmware on 3945, power save is disabled by default.

Ok!
The patch was not forgotten, just indefinitely delayed :/ Now that I can compile a kernel in 10 minutes instead of >1h, I'll try to test it :)

Leaving the computer running for 24h gave no signs of any kind of issues, besides a few AP timeout after 500ms.

If you wish me to further test more patches, please do include me in CC. However, my access to the 3945 hardware is now very reduced, so I'll probably take several weeks to test the patches, if at all.

Thank you for your patience, time and code since my first half-made debugging of the HW scan crash in the iwl3945 firmware :)

Signature · 1 line
Pedro