Bug 87191

Summary: iwlwifi dvm - hardware rfkill unblock doesn't work (x230) - MWG100221081
Product: Drivers Reporter: Oleksii Shevchuk (alxchk)
Component: network-wirelessAssignee: drivers_network-wireless (drivers_network-wireless)
Status: CLOSED CODE_FIX    
Severity: normal CC: ilw, linville
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.17.2 Subsystem:
Regression: No Bisected commit-id:
Attachments: Output with debug=0xffffffff
Yet another output with debug=0xffffffff (without NM, probably smaller)
After enabling radio
After enabling radio.
While toggling radio off
Trace record while toggling wifi off then on (after 10 secs)
Trace for comment 28
Trace for comment 30
trace io + csr dump
trace io + csr dump

Description Oleksii Shevchuk 2014-10-30 21:57:32 UTC
How to reproduce:
# rfkill list wlan
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: no
% Enable RFKILL with hardware switch
# rfkill list wlan
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
% Disable RFKILL with hardware switch
# rfkill list wlan
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# rmmod iwldvm iwlwifi
# modprobe iwlwifi
# rfkill list wlan
4: phy2: Wireless LAN
	Soft blocked: no
	Hard blocked: no
Comment 1 Emmanuel Grumbach 2014-11-01 19:03:04 UTC
please reproduce while recording tracing.
Comment 2 Oleksii Shevchuk 2014-11-01 22:16:59 UTC
What should I do for that?
Comment 3 Oleksii Shevchuk 2014-11-01 22:59:32 UTC
Ok, i built all the things. The problem is, I couldn't reproduce it while tracing now.
Comment 4 Oleksii Shevchuk 2014-11-01 23:04:16 UTC
So, I only managed to catch the bug when I switch on rfkill (i.e. disable wifi) without tracing, then enable tracing and record the rfkill switch off (i.e. enable wifi).

trace-cmd record -e mac80211 -e mac80211_msg -e iwlwifi -e iwlwifi_msg -e iwlwifi_data

trace-cmd report -i trace.dat
version = 6
CPU 0 is empty
CPU 1 is empty
CPU 2 is empty
CPU 3 is empty
cpus=4
Comment 5 Emmanuel Grumbach 2014-11-02 05:25:12 UTC
well... this means that you haven't caught anything.
Apparently, you don't have IWLWIFI_TRACING compiled.

Can you please try with debug=0xffffffff as a module parameter to iwlwifi?
For this, you need CONFIG_IWLWIFI_DEBUG.
Comment 6 Oleksii Shevchuk 2014-11-02 07:20:40 UTC
# START=`date +%s`
# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: no
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: no
# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: yes
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: yes
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: yes
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: yes
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: no
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: no
3: phy1: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# END=`date +%s`
# journalctl -t kernel --since @1414912587 --until @1414912610 >debug.txt
Comment 7 Oleksii Shevchuk 2014-11-02 07:21:19 UTC
Created attachment 156101 [details]
Output with debug=0xffffffff
Comment 8 Emmanuel Grumbach 2014-11-02 20:32:44 UTC
ok - that doesn't work.

Please clear the log before you do the operation that fails - I am getting lost.

Also - please use debug=0x0002000f

Let's try with this and add more debug if needed.

Thanks.
Comment 9 Oleksii Shevchuk 2014-11-03 05:50:53 UTC
Ok. The problem with the large log was because of NetworkManager. I stopped it, and now I have the next picture.

First of all, hardware rfkill now totaly ignored.

# ip l show wlan0
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 6c:88:14:49:8a:90 brd ff:ff:ff:ff:ff:ff
I enable/disable hardware switch, and rfkill is always in this state:

# rfkill list wlan
5: phy3: Wireless LAN
	Soft blocked: no
	Hard blocked: no

Also, with debug=0x0002000f there is nothing in dmesg.

 # dmesg -c
 # date +%s
1414993212
 # rfkill list wlan
5: phy3: Wireless LAN
	Soft blocked: no
	Hard blocked: no
 # rfkill list wlan
5: phy3: Wireless LAN
	Soft blocked: no
	Hard blocked: no

So, i enable wlan card with:
ip l set wlan0 up

Now I can reproduce the bug:
# date +%s
1414993523
# rfkill list wlan
5: phy3: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# rfkill list wlan
5: phy3: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# date +%s
1414993577
# 

Here is the log:
# journalctl -t kernel --since @1414993523 --until @1414993577 | cut -f 4- -d ':'
 iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
 iwlwifi 0000:03:00.0: I iwlagn_rx_card_state_notif Card state received: HW:Kill SW:On CT:Not reached
 iwlwifi 0000:03:00.0: U iwlagn_mac_remove_interface enter
 iwlwifi 0000:03:00.0: U iwlagn_set_rxon_chain rx_chain=0x2406 active=2 idle=1
 iwlwifi 0000:03:00.0: U iwl_full_rxon_required need full RXON - !iwl_is_associated_ctx(ctx)
 iwlwifi 0000:03:00.0: U iwlagn_commit_rxon Going to commit RXON
                                        * without RXON_FILTER_ASSOC_MSK
                                        * channel = 1
 iwlwifi 0000:03:00.0: Not sending command - RF KILL
 iwlwifi 0000:03:00.0: U iwlagn_mac_remove_interface leave
 iwlwifi 0000:03:00.0: Not sending command - RF KILL
 iwlwifi 0000:03:00.0: U iwlagn_mac_stop enter
 iwlwifi 0000:03:00.0: U iwl_down iwlwifi is going down
 iwlwifi 0000:03:00.0: U iwl_clear_ucode_stations Clearing ucode stations in driver
 iwlwifi 0000:03:00.0: I iwl_clear_ucode_stations Clearing ucode active for station 15
 iwlwifi 0000:03:00.0: U iwl_pcie_apm_stop Stop card, put in low power state
 iwlwifi 0000:03:00.0: U iwl_pcie_apm_stop_master stop master
 iwlwifi 0000:03:00.0: U iwlagn_mac_stop leave

FYI, in the attach with the full debug
Comment 10 Oleksii Shevchuk 2014-11-03 05:51:48 UTC
Created attachment 156351 [details]
Yet another output with debug=0xffffffff (without NM, probably smaller)
Comment 11 Emmanuel Grumbach 2014-11-03 06:18:03 UTC
I don't follow - in the last log, I can see that you disable the radio:

 iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.

so we can't work in that state and rightfully stop any WiFi activity.

What is the bug then?
Comment 12 Oleksii Shevchuk 2014-11-03 06:43:33 UTC
The bug is, that the radio is not enabled when I toggle on hardware rfkill switch. To have it work I need to unload module and load it again.
Comment 13 Emmanuel Grumbach 2014-11-03 06:46:09 UTC
So the log you pasted in comment9 is from the moment you try to re-enable WiFi?
Comment 14 Oleksii Shevchuk 2014-11-03 06:51:04 UTC
The log covers my actions:
Disabling wifi
Showing rfkill state
Enabling wifi
Showing rfkill state
Comment 15 Emmanuel Grumbach 2014-11-03 06:53:20 UTC
I am not talking about the log you attached, I am talking about the part you pasted in comment9.
Comment 16 Oleksii Shevchuk 2014-11-03 06:58:03 UTC
Yes. It's from there.

Once again:
# dmesg -c; rfkill list wifi
9: phy7: Wireless LAN
	Soft blocked: no
	Hard blocked: no
# dmesg -c; rfkill list wifi
[57268.874011] iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
[57268.874032] iwlwifi 0000:03:00.0: I iwlagn_rx_card_state_notif Card state received: HW:Kill SW:On CT:Not reached
[57268.874977] iwlwifi 0000:03:00.0: U iwlagn_mac_remove_interface enter
[57268.874985] iwlwifi 0000:03:00.0: U iwlagn_set_rxon_chain rx_chain=0x2406 active=2 idle=1
[57268.874991] iwlwifi 0000:03:00.0: U iwl_full_rxon_required need full RXON - !iwl_is_associated_ctx(ctx)
[57268.874996] iwlwifi 0000:03:00.0: U iwlagn_commit_rxon Going to commit RXON
  * without RXON_FILTER_ASSOC_MSK
  * channel = 1
  * bssid = 00:00:00:00:00:00
[57268.875001] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[57268.875005] iwlwifi 0000:03:00.0: U iwlagn_mac_remove_interface leave
[57268.875041] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[57268.875046] iwlwifi 0000:03:00.0: U iwlagn_mac_stop enter
[57268.875049] iwlwifi 0000:03:00.0: U iwl_down iwlwifi is going down
[57268.875054] iwlwifi 0000:03:00.0: U iwl_clear_ucode_stations Clearing ucode stations in driver
[57268.875058] iwlwifi 0000:03:00.0: I iwl_clear_ucode_stations Clearing ucode active for station 15
[57268.876048] iwlwifi 0000:03:00.0: U iwl_pcie_apm_stop Stop card, put in low power state
[57268.876091] iwlwifi 0000:03:00.0: U iwl_pcie_apm_stop_master stop master
[57268.876178] iwlwifi 0000:03:00.0: U iwlagn_mac_stop leave
9: phy7: Wireless LAN
	Soft blocked: no
	Hard blocked: yes

%% HERE I ENABLED RADIO %%

# dmesg -c; rfkill list wifi
9: phy7: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# dmesg -c; rfkill list wifi
9: phy7: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# dmesg -c; rfkill list wifi
9: phy7: Wireless LAN
	Soft blocked: no
	Hard blocked: yes
# 

Looks like when device goes into the powersaving state, it just ignores all the things..
Comment 17 Emmanuel Grumbach 2014-11-03 17:49:19 UTC
Please do the following before you re-enable the radio:

dmesg -c > /dev/null

echo 1 > /sys/kernel/debug/iwlwifi/*/trans/csr
echo 0xffffffff > /sys/modules/iwlwifi/parameters/debug

%% re-enable the radio %%

dump the dmesg and paste it here / attach it.


---

For this, you'll need to have CONFIG_IWLWIFI_DEBUG and CONFIG_IWLWIFI_DEBUGFS Kconfig options selected.
Comment 18 Oleksii Shevchuk 2014-11-03 20:31:11 UTC
Created attachment 156411 [details]
After enabling radio
Comment 19 Oleksii Shevchuk 2014-11-03 20:35:58 UTC
Created attachment 156421 [details]
After enabling radio.

Wrong file were uploaded.
Comment 20 Emmanuel Grumbach 2014-11-03 20:42:34 UTC
ok this is what I feared.
The RKFILL interrupt bit is clear in the interrupt mask... Need to check.
Comment 21 Emmanuel Grumbach 2014-11-03 20:55:01 UTC
please let me know what device you have:

lspci will make it
Comment 22 Oleksii Shevchuk 2014-11-03 21:20:05 UTC
# lspci -vvv -s 03:00.0
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)
	Subsystem: Intel Corporation Centrino Advanced-N 6205 AGN
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 32
	Region 0: Memory at f1c00000 (64-bit, non-prefetchable) [size=8K]
	Capabilities: [c8] Power Management version 3
		Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee00438  Data: 0000
	Capabilities: [e0] Express (v1) Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s <512ns, L1 unlimited
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ FLReset-
			MaxPayload 128 bytes, MaxReadReq 128 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <4us, L1 <32us
			ClockPM+ Surprise- LLActRep- BwNot-
		LnkCtl:	ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
	Capabilities: [140 v1] Device Serial Number 6c-88-14-ff-ff-49-8a-90
	Kernel driver in use: iwlwifi
	Kernel modules: iwlwifi
Comment 23 Emmanuel Grumbach 2014-11-04 11:02:36 UTC
can you please disable the radio while recording tracing:

sudo trace-cmd record -e iwlwifi -e iwlwifi_io

and send me trace.dat?

thanks.
I guess I'll have to send a patch to get further information based on what the tracing will tell me.
Comment 24 Oleksii Shevchuk 2014-11-04 21:13:23 UTC
Created attachment 156551 [details]
While toggling radio off
Comment 25 Emmanuel Grumbach 2014-11-05 06:50:10 UTC
Something doesn't make sense here.
The recording you sent looks fine - you toggled rfkill off, I can see that.
I can also see that we enable the rfkill interrupt (in the masks) to be able to get the rfkill interrupt when someone toggle rfkill back to on.

After we enable the rfkill interrupt, we make sure that rfkill was not asserted to avoid a case in which we might have missed the interrupt. Fine.

But if so, how come that I can see in your log from comment19:

[57961.406745] iwlwifi 0000:03:00.0:                     CSR_INT: 0X00000080
[57961.406772] iwlwifi 0000:03:00.0:                CSR_INT_MASK: 0X00000000

Which basically means that there was an RFKILL interrupt, but it was masked?

Can you please record while toggling radio off and then on?

Please wait 10 seconds between off and on so that I can understand when you do what.

Thank you.
Comment 26 Oleksii Shevchuk 2014-11-05 19:55:50 UTC
Created attachment 156791 [details]
Trace record while toggling wifi off then on (after 10 secs)

Unfortunately, there is nothing after I toggled wifi off. I waited 10 sec after toggling it off, then toggle it on. There is nothing in trace.

Btw, trace-cmd eat 100% of CPU at that time.
Comment 27 Emmanuel Grumbach 2014-11-05 19:58:44 UTC
I'll check. In any case, please take into account that I will travelling the next 2 weeks and that I'll very little time to handle this.
I'll do my best, but I can't promise much.
Comment 28 Emmanuel Grumbach 2014-11-06 12:11:43 UTC
Can you please try this?


diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 5e33e43..2a916a3 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -953,6 +953,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
        clear_bit(STATUS_TPOWER_PMI, &trans->status);
        clear_bit(STATUS_RFKILL, &trans->status);

+       udelay(20);
+
        /*
         * Even if we stop the HW, we still want the RF kill
         * interrupt
Comment 29 Oleksii Shevchuk 2014-11-06 17:32:01 UTC
I increase that value to 100, and looks like it works all the time. Thanks!
Works for me.
Comment 30 Emmanuel Grumbach 2014-11-06 20:21:31 UTC
100... Hm. I'd like to avoid that.

What about this:



diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 5e33e43..ae0e46a 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -945,7 +945,9 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
        spin_unlock(&trans_pcie->irq_lock);

        /* stop and reset the on-board processor */
-       iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
+       iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+
+       udelay(20);

        /* clear all status bits */
        clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
Comment 31 Oleksii Shevchuk 2014-11-07 18:57:45 UTC
This works for me too
Comment 32 Oleksii Shevchuk 2014-11-09 09:15:35 UTC
OK. Not always. Sometimes it still reproduces, but I couldn't reproduce it when I need
Comment 33 Oleksii Shevchuk 2014-11-09 09:37:01 UTC
So, if I wait enough, rfkill doesn't work neither with first variant, nor in second
Comment 34 Emmanuel Grumbach 2014-11-09 22:06:56 UTC
Please record tracing again.
Thank you.
Comment 35 Emmanuel Grumbach 2014-11-12 13:43:58 UTC
Do we have news here?

I really didn't understand your last 2 reports.
Comment 36 Emmanuel Grumbach 2014-11-14 23:23:41 UTC
The patch above (comment 30) has been published to our internal repository and will be submitted upstream soon.
Comment 37 Oleksii Shevchuk 2014-11-15 05:25:12 UTC
Created attachment 157661 [details]
Trace for comment 28

Ok, I was in the BT overseas, so couldn't response. Here are the traces for patches in comment 28 and comment 30.

The picture is.
1. Toggle off radio with hardware rfkill
2. Wait for a minute
3. Toggle on radio with hardware rfkill
4. Radio marked as disabled

(This is in the trace)

If at step 2 I reduce time to seconds, then all works with both patches.

Before patching any time at step 2 doesn't help.
Comment 38 Oleksii Shevchuk 2014-11-15 05:25:34 UTC
Created attachment 157671 [details]
Trace for comment 30
Comment 39 Emmanuel Grumbach 2014-11-16 14:45:18 UTC
Please dump the csr before step 3:

echo 1 > /sys/kernel/debug/iwlwifi/*/trans/csr


then paste / attach the dmesg output.

thanks
Comment 40 Oleksii Shevchuk 2014-11-16 15:36:34 UTC
# echo 1 > /sys/kernel/debug/iwlwifi/*/trans/csr; dmesg -c
[23385.051549] iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
[23385.051683] wlan0: deauthenticating from 54:e6:fc:fb:b9:78 by local choice (Reason: 3=DEAUTH_LEAVING)
[23385.051749] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.051757] wlan0: HW problem - can not stop rx aggregation for 54:e6:fc:fb:b9:78 tid 0
[23385.051762] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.051764] wlan0: HW problem - can not stop rx aggregation for 54:e6:fc:fb:b9:78 tid 2
[23385.051768] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.051770] wlan0: HW problem - can not stop rx aggregation for 54:e6:fc:fb:b9:78 tid 3
[23385.052324] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.052331] wlan0: failed to remove key (0, 54:e6:fc:fb:b9:78) from hardware (-5)
[23385.052607] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.052617] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.052626] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.052635] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.052651] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.061413] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.061430] wlan0: failed to remove key (1, ff:ff:ff:ff:ff:ff) from hardware (-5)
[23385.061531] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.061546] wlan0: failed to remove key (2, ff:ff:ff:ff:ff:ff) from hardware (-5)
[23385.061744] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.061793] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[23385.063218] iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
[23385.067273] cfg80211: Calling CRDA to update world regulatory domain
[23385.082276] cfg80211: World regulatory domain updated:
[23385.082280] cfg80211:  DFS Master region: unset
[23385.082282] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[23385.082286] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[23385.082289] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[23385.082291] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[23385.082295] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[23385.082298] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[23385.082301] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[23385.082303] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[23385.082306] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[23425.480829] iwlwifi 0000:03:00.0: CSR values:
[23425.480833] iwlwifi 0000:03:00.0: (2nd byte of CSR_INT_COALESCING is CSR_INT_PERIODIC_REG)
[23425.480866] iwlwifi 0000:03:00.0:        CSR_HW_IF_CONFIG_REG: 0X02000000
[23425.480892] iwlwifi 0000:03:00.0:          CSR_INT_COALESCING: 0X00000000
[23425.480918] iwlwifi 0000:03:00.0:                     CSR_INT: 0X00000080
[23425.480944] iwlwifi 0000:03:00.0:                CSR_INT_MASK: 0X00000000
[23425.480969] iwlwifi 0000:03:00.0:           CSR_FH_INT_STATUS: 0X00000000
[23425.480995] iwlwifi 0000:03:00.0:                 CSR_GPIO_IN: 0X00000030
[23425.481020] iwlwifi 0000:03:00.0:                   CSR_RESET: 0X00000001
[23425.481082] iwlwifi 0000:03:00.0:                CSR_GP_CNTRL: 0X000003d0
[23425.481123] iwlwifi 0000:03:00.0:                  CSR_HW_REV: 0X000000b0
[23425.481164] iwlwifi 0000:03:00.0:              CSR_EEPROM_REG: 0X00000000
[23425.481196] iwlwifi 0000:03:00.0:               CSR_EEPROM_GP: 0X90000001
[23425.481221] iwlwifi 0000:03:00.0:              CSR_OTP_GP_REG: 0X00030001
[23425.481247] iwlwifi 0000:03:00.0:                 CSR_GIO_REG: 0X00080042
[23425.481273] iwlwifi 0000:03:00.0:            CSR_GP_UCODE_REG: 0X00000000
[23425.481299] iwlwifi 0000:03:00.0:           CSR_GP_DRIVER_REG: 0X00000000
[23425.481324] iwlwifi 0000:03:00.0:           CSR_UCODE_DRV_GP1: 0X00000000
[23425.481350] iwlwifi 0000:03:00.0:           CSR_UCODE_DRV_GP2: 0X00000000
[23425.481376] iwlwifi 0000:03:00.0:                 CSR_LED_REG: 0X00000018
[23425.481402] iwlwifi 0000:03:00.0:        CSR_DRAM_INT_TBL_REG: 0X00000000
[23425.481427] iwlwifi 0000:03:00.0:        CSR_GIO_CHICKEN_BITS: 0X27800200
[23425.481453] iwlwifi 0000:03:00.0:             CSR_ANA_PLL_CFG: 0X00000000
[23425.481479] iwlwifi 0000:03:00.0:      CSR_MONITOR_STATUS_REG: 0X2bffff1f
[23425.481504] iwlwifi 0000:03:00.0:           CSR_HW_REV_WA_REG: 0X0001001a
[23425.481530] iwlwifi 0000:03:00.0:        CSR_DBG_HPET_MEM_REG: 0X82000500
Comment 41 Emmanuel Grumbach 2014-11-16 15:40:28 UTC
that again explains everything, but it makes no sense.

Can you please do the same while recording tracing:

dump the CSRs while recording?

thanks
Comment 42 Oleksii Shevchuk 2014-11-16 16:44:19 UTC
Created attachment 157811 [details]
trace io + csr dump

[  421.619628] iwlwifi 0000:03:00.0: CSR values:
[  421.619630] iwlwifi 0000:03:00.0: (2nd byte of CSR_INT_COALESCING is CSR_INT_PERIODIC_REG)
[  421.619662] iwlwifi 0000:03:00.0:        CSR_HW_IF_CONFIG_REG: 0X00488700
[  421.619689] iwlwifi 0000:03:00.0:          CSR_INT_COALESCING: 0X00000040
[  421.619726] iwlwifi 0000:03:00.0:                     CSR_INT: 0X00000000
[  421.619759] iwlwifi 0000:03:00.0:                CSR_INT_MASK: 0Xba00008b
[  421.619786] iwlwifi 0000:03:00.0:           CSR_FH_INT_STATUS: 0X00000000
[  421.619812] iwlwifi 0000:03:00.0:                 CSR_GPIO_IN: 0X00000030
[  421.619838] iwlwifi 0000:03:00.0:                   CSR_RESET: 0X00000000
[  421.619864] iwlwifi 0000:03:00.0:                CSR_GP_CNTRL: 0X080403c5
[  421.619889] iwlwifi 0000:03:00.0:                  CSR_HW_REV: 0X000000b0
[  421.619915] iwlwifi 0000:03:00.0:              CSR_EEPROM_REG: 0Xcafb0ffd
[  421.619941] iwlwifi 0000:03:00.0:               CSR_EEPROM_GP: 0X90000001
[  421.619967] iwlwifi 0000:03:00.0:              CSR_OTP_GP_REG: 0X00030001
[  421.619992] iwlwifi 0000:03:00.0:                 CSR_GIO_REG: 0X00080042
[  421.620018] iwlwifi 0000:03:00.0:            CSR_GP_UCODE_REG: 0X0000ca89
[  421.620044] iwlwifi 0000:03:00.0:           CSR_GP_DRIVER_REG: 0X00000000
[  421.620069] iwlwifi 0000:03:00.0:           CSR_UCODE_DRV_GP1: 0X00000000
[  421.620095] iwlwifi 0000:03:00.0:           CSR_UCODE_DRV_GP2: 0X00000000
[  421.620121] iwlwifi 0000:03:00.0:                 CSR_LED_REG: 0X00000040
[  421.620146] iwlwifi 0000:03:00.0:        CSR_DRAM_INT_TBL_REG: 0X880fffff
[  421.620172] iwlwifi 0000:03:00.0:        CSR_GIO_CHICKEN_BITS: 0X27800200
[  421.620197] iwlwifi 0000:03:00.0:             CSR_ANA_PLL_CFG: 0X00000000
[  421.620223] iwlwifi 0000:03:00.0:      CSR_MONITOR_STATUS_REG: 0X6bf7ff57
[  421.620249] iwlwifi 0000:03:00.0:           CSR_HW_REV_WA_REG: 0X0001001a
[  421.620274] iwlwifi 0000:03:00.0:        CSR_DBG_HPET_MEM_REG: 0Xffff0000
WinterMute ~ # dmesg -c
[  434.761157] iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
[  434.763073] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[  434.763109] iwlwifi 0000:03:00.0: Not sending command - RF KILL
[  434.765674] iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
WinterMute ~ # echo 1 > /sys/kernel/debug/iwlwifi/*/trans/csr; dmesg -c; rfkill list
[  494.669203] iwlwifi 0000:03:00.0: CSR values:
[  494.669206] iwlwifi 0000:03:00.0: (2nd byte of CSR_INT_COALESCING is CSR_INT_PERIODIC_REG)
[  494.669246] iwlwifi 0000:03:00.0:        CSR_HW_IF_CONFIG_REG: 0X02000000
[  494.669278] iwlwifi 0000:03:00.0:          CSR_INT_COALESCING: 0X00000000
[  494.669305] iwlwifi 0000:03:00.0:                     CSR_INT: 0X04000000
[  494.669337] iwlwifi 0000:03:00.0:                CSR_INT_MASK: 0X00000000
[  494.669369] iwlwifi 0000:03:00.0:           CSR_FH_INT_STATUS: 0X00000000
[  494.669394] iwlwifi 0000:03:00.0:                 CSR_GPIO_IN: 0X00000030
[  494.669420] iwlwifi 0000:03:00.0:                   CSR_RESET: 0X00000001
[  494.669446] iwlwifi 0000:03:00.0:                CSR_GP_CNTRL: 0X080403d0
[  494.669472] iwlwifi 0000:03:00.0:                  CSR_HW_REV: 0X000000b0
[  494.669497] iwlwifi 0000:03:00.0:              CSR_EEPROM_REG: 0X00000000
[  494.669523] iwlwifi 0000:03:00.0:               CSR_EEPROM_GP: 0X90000001
[  494.669550] iwlwifi 0000:03:00.0:              CSR_OTP_GP_REG: 0X00030001
[  494.669576] iwlwifi 0000:03:00.0:                 CSR_GIO_REG: 0X00080042
[  494.669601] iwlwifi 0000:03:00.0:            CSR_GP_UCODE_REG: 0X00000000
[  494.669627] iwlwifi 0000:03:00.0:           CSR_GP_DRIVER_REG: 0X00000000
[  494.669653] iwlwifi 0000:03:00.0:           CSR_UCODE_DRV_GP1: 0X00000000
[  494.669679] iwlwifi 0000:03:00.0:           CSR_UCODE_DRV_GP2: 0X00000000
[  494.669704] iwlwifi 0000:03:00.0:                 CSR_LED_REG: 0X00000018
[  494.669730] iwlwifi 0000:03:00.0:        CSR_DRAM_INT_TBL_REG: 0X00000000
[  494.669756] iwlwifi 0000:03:00.0:        CSR_GIO_CHICKEN_BITS: 0X27800200
[  494.669781] iwlwifi 0000:03:00.0:             CSR_ANA_PLL_CFG: 0X00000000
[  494.669807] iwlwifi 0000:03:00.0:      CSR_MONITOR_STATUS_REG: 0X6bffffd7
[  494.669834] iwlwifi 0000:03:00.0:           CSR_HW_REV_WA_REG: 0X0001001a
[  494.669861] iwlwifi 0000:03:00.0:        CSR_DBG_HPET_MEM_REG: 0X82000500
Comment 43 Emmanuel Grumbach 2014-11-19 15:37:23 UTC
I am travelling - I will take a look next week.
Comment 44 Emmanuel Grumbach 2014-11-25 11:21:44 UTC
what I see here is that you stopped the tracing to early.
I can't see the second dump in the trace.
Please stop the trace only after you run
"echo 1 > /sys/kernel/debug/iwlwifi/*/trans/csr; dmesg -c; rfkill list"

thanks
Comment 45 Oleksii Shevchuk 2014-11-28 22:49:27 UTC
Created attachment 159111 [details]
trace io + csr dump

The trace covers:
Toggling wifi off
dump csr + rfkill list
Toggle wifi on
dump csr + rfkill list
Comment 46 Emmanuel Grumbach 2014-11-30 12:25:58 UTC
Please try this:


diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index ddb416a..4960d0a 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1000,6 +1000,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
                clear_bit(STATUS_RFKILL, &trans->status);
        if (hw_rfkill != was_hw_rfkill)
                iwl_trans_pcie_rf_kill(trans, hw_rfkill);
+
+       iwl_pcie_prepare_card_hw(trans);
 }

 void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state)
Comment 47 Oleksii Shevchuk 2014-11-30 14:29:27 UTC
Wow. I couldn't reproduce the bug with latest patch for now. Thanks.
Comment 48 Emmanuel Grumbach 2014-11-30 14:59:22 UTC
Do you have a V-PRO platform?
Does this computer belong to a big company?
Comment 49 Oleksii Shevchuk 2014-11-30 15:18:05 UTC
Yes. I have active AMT/vPro.
No. It's my own laptop.
Comment 50 Emmanuel Grumbach 2014-11-30 15:24:13 UTC
(In reply to Oleksii Shevchuk from comment #49)
> Yes. I have active AMT/vPro.
that explains it all :)

> No. It's my own laptop.
In that case, I don't see why you want AMT/vPRO active, but that's another discussion :)

Anyway - patch will be sent upstream through the regular process.
Note that since you are probably the only AMT / vPRO Linux user, this patch will be sent to 3.19 and will *not* be backported.


Thanks.
Comment 51 Oleksii Shevchuk 2014-11-30 15:36:36 UTC
> I don't see why you want AMT/vPRO active

To find new bugs, obviously ^_^