Linux wireless drivers development
 help / color / mirror / Atom feed
* Disable post-backoff
From: Dennis Borgmann @ 2010-06-22 12:09 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless

Hello ath5k-list and linux-wireless-list!

I am sorry, if this is a double-post. I sent this message to the wrong
address before. I apologize.

For testing reasons I would like to disable backoff times in ath5k.

In the code of ath5k we have the macro AR5K_TXQ_FLAG_BACKOFF_DISABLE in
file linux-2.6.34/drivers/net/wireless/ath/ath5k/ath5k.h. It is issued
in the file linux-2.6.34/drivers/net/wireless/ath/ath5k/qcu.c in line 384.

How can this option be activated?

Kind regards, Dennis

^ permalink raw reply

* [PATCH 0/2] at76c50x-usb.c: Fix broken authentication process
From: Sebastian Smolorz @ 2010-06-22 14:51 UTC (permalink / raw)
  To: kalle.valo; +Cc: linux-wireless

Fix authentication process of wireless driver at76c50x-usb.c which was broken
since kernel 2.6.31

Sebastian Smolorz (2):
  at76c50x-usb: Move function at76_join() several lines up
  at76c50x-usb: Extract bssid from authentication frame

 drivers/net/wireless/at76c50x-usb.c |  108 +++++++++++++++++++++++------------
 drivers/net/wireless/at76c50x-usb.h |    1 +
 2 files changed, 73 insertions(+), 36 deletions(-)


^ permalink raw reply

* [PATCH 1/2] at76c50x-usb: Move function at76_join() several lines up
From: Sebastian Smolorz @ 2010-06-22 14:53 UTC (permalink / raw)
  To: kalle.valo; +Cc: linux-wireless
In-Reply-To: <201006221651.24853.Sebastian.Smolorz@gmx.de>

This patch does a simple code move of at76_join() so that
at76_mac80211_tx() follows at76_join() in the driver's source file.

This is a preparatory patch for the following patch where we need
to call at76_join() from at76_mac80211_tx() in order to
authenticate successfully with a bssid.

Signed-off-by: Sebastian Smolorz <sesmo@gmx.net>
---
 drivers/net/wireless/at76c50x-usb.c |   72 +++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 8a2d4af..cb3d4b7 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -1649,6 +1649,42 @@ exit:
 		return NULL;
 }
 
+static int at76_join(struct at76_priv *priv)
+{
+	struct at76_req_join join;
+	int ret;
+
+	memset(&join, 0, sizeof(struct at76_req_join));
+	memcpy(join.essid, priv->essid, priv->essid_size);
+	join.essid_size = priv->essid_size;
+	memcpy(join.bssid, priv->bssid, ETH_ALEN);
+	join.bss_type = INFRASTRUCTURE_MODE;
+	join.channel = priv->channel;
+	join.timeout = cpu_to_le16(2000);
+
+	at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__);
+	ret = at76_set_card_command(priv->udev, CMD_JOIN, &join,
+				    sizeof(struct at76_req_join));
+
+	if (ret < 0) {
+		printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
+		       wiphy_name(priv->hw->wiphy), ret);
+		return 0;
+	}
+
+	ret = at76_wait_completion(priv, CMD_JOIN);
+	at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret);
+	if (ret != CMD_STATUS_COMPLETE) {
+		printk(KERN_ERR "%s: at76_wait_completion failed: %d\n",
+		       wiphy_name(priv->hw->wiphy), ret);
+		return 0;
+	}
+
+	at76_set_pm_mode(priv);
+
+	return 0;
+}
+
 static void at76_mac80211_tx_callback(struct urb *urb)
 {
 	struct at76_priv *priv = urb->context;
@@ -1818,42 +1854,6 @@ static void at76_remove_interface(struct ieee80211_hw *hw,
 	at76_dbg(DBG_MAC80211, "%s()", __func__);
 }
 
-static int at76_join(struct at76_priv *priv)
-{
-	struct at76_req_join join;
-	int ret;
-
-	memset(&join, 0, sizeof(struct at76_req_join));
-	memcpy(join.essid, priv->essid, priv->essid_size);
-	join.essid_size = priv->essid_size;
-	memcpy(join.bssid, priv->bssid, ETH_ALEN);
-	join.bss_type = INFRASTRUCTURE_MODE;
-	join.channel = priv->channel;
-	join.timeout = cpu_to_le16(2000);
-
-	at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__);
-	ret = at76_set_card_command(priv->udev, CMD_JOIN, &join,
-				    sizeof(struct at76_req_join));
-
-	if (ret < 0) {
-		printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
-		       wiphy_name(priv->hw->wiphy), ret);
-		return 0;
-	}
-
-	ret = at76_wait_completion(priv, CMD_JOIN);
-	at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret);
-	if (ret != CMD_STATUS_COMPLETE) {
-		printk(KERN_ERR "%s: at76_wait_completion failed: %d\n",
-		       wiphy_name(priv->hw->wiphy), ret);
-		return 0;
-	}
-
-	at76_set_pm_mode(priv);
-
-	return 0;
-}
-
 static void at76_dwork_hw_scan(struct work_struct *work)
 {
 	struct at76_priv *priv = container_of(work, struct at76_priv,
-- 
1.6.4.4


^ permalink raw reply related

* [PATCH 2/2] at76c50x-usb: Extract bssid from authentication frame
From: Sebastian Smolorz @ 2010-06-22 14:55 UTC (permalink / raw)
  To: kalle.valo; +Cc: linux-wireless
In-Reply-To: <201006221651.24853.Sebastian.Smolorz@gmx.de>

The driver at76c50x-usb is unable to authenticate with an AP since
kernel 2.6.31 for the following reason: The join command of the firmware
needs to be sent with the right bssid before any transmission can start.
Before kernel 2.6.31 mac80211 informed its drivers about the changing
bssid early enough for at76c50x-usb but during the development of 2.6.31
mac80211's behaviour changed. Now a new bssid is set after the
association.

This patch changes the tx routine of the driver at76c50x-usb in such a
way that a new bssid is extracted from an authentication frame and the
join command with that bssid is processed.

Signed-off-by: Sebastian Smolorz <sesmo@gmx.net>
---
 drivers/net/wireless/at76c50x-usb.c |   36 +++++++++++++++++++++++++++++++++++
 drivers/net/wireless/at76c50x-usb.h |    1 +
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index cb3d4b7..98328b7 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -7,6 +7,7 @@
  * Copyright (c) 2004 Balint Seeber <n0_5p4m_p13453@hotmail.com>
  * Copyright (c) 2007 Guido Guenther <agx@sigxcpu.org>
  * Copyright (c) 2007 Kalle Valo <kalle.valo@iki.fi>
+ * Copyright (c) 2010 Sebastian Smolorz <sesmo@gmx.net>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -1685,6 +1686,22 @@ static int at76_join(struct at76_priv *priv)
 	return 0;
 }
 
+static void at76_work_join_bssid(struct work_struct *work)
+{
+	struct at76_priv *priv = container_of(work, struct at76_priv,
+					      work_join_bssid);
+
+	if (priv->device_unplugged)
+		return;
+
+	mutex_lock(&priv->mtx);
+
+	if (is_valid_ether_addr(priv->bssid))
+		at76_join(priv);
+
+	mutex_unlock(&priv->mtx);
+}
+
 static void at76_mac80211_tx_callback(struct urb *urb)
 {
 	struct at76_priv *priv = urb->context;
@@ -1722,6 +1739,7 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 	struct at76_priv *priv = hw->priv;
 	struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
 	int padding, submit_len, ret;
 
 	at76_dbg(DBG_MAC80211, "%s()", __func__);
@@ -1732,6 +1750,21 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 		return NETDEV_TX_BUSY;
 	}
 
+	/* The following code lines are important when the device is going to
+	 * authenticate with a new bssid. The driver must send CMD_JOIN before
+	 * an authentication frame is transmitted. For this to succeed, the
+	 * correct bssid of the AP must be known. As mac80211 does not inform
+	 * drivers about the bssid prior to the authentication process the
+	 * following workaround is necessary. If the TX frame is an
+	 * authentication frame extract the bssid and send the CMD_JOIN. */
+	if (mgmt->frame_control & cpu_to_le16(IEEE80211_STYPE_AUTH)) {
+		if (compare_ether_addr(priv->bssid, mgmt->bssid)) {
+			memcpy(priv->bssid, mgmt->bssid, ETH_ALEN);
+			ieee80211_queue_work(hw, &priv->work_join_bssid);
+			return NETDEV_TX_BUSY;
+		}
+	}
+
 	ieee80211_stop_queues(hw);
 
 	at76_ledtrig_tx_activity();	/* tell ledtrigger we send a packet */
@@ -1806,6 +1839,7 @@ static void at76_mac80211_stop(struct ieee80211_hw *hw)
 	at76_dbg(DBG_MAC80211, "%s()", __func__);
 
 	cancel_delayed_work(&priv->dwork_hw_scan);
+	cancel_work_sync(&priv->work_join_bssid);
 	cancel_work_sync(&priv->work_set_promisc);
 
 	mutex_lock(&priv->mtx);
@@ -2107,6 +2141,7 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
 	mutex_init(&priv->mtx);
 	INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc);
 	INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx);
+	INIT_WORK(&priv->work_join_bssid, at76_work_join_bssid);
 	INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan);
 
 	tasklet_init(&priv->rx_tasklet, at76_rx_tasklet, 0);
@@ -2508,5 +2543,6 @@ MODULE_AUTHOR("Balint Seeber <n0_5p4m_p13453@hotmail.com>");
 MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>");
 MODULE_AUTHOR("Guido Guenther <agx@sigxcpu.org>");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@iki.fi>");
+MODULE_AUTHOR("Sebastian Smolorz <sesmo@gmx.net>");
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/at76c50x-usb.h b/drivers/net/wireless/at76c50x-usb.h
index 1ec5ccf..db89d72 100644
--- a/drivers/net/wireless/at76c50x-usb.h
+++ b/drivers/net/wireless/at76c50x-usb.h
@@ -387,6 +387,7 @@ struct at76_priv {
 	/* work queues */
 	struct work_struct work_set_promisc;
 	struct work_struct work_submit_rx;
+	struct work_struct work_join_bssid;
 	struct delayed_work dwork_hw_scan;
 
 	struct tasklet_struct rx_tasklet;
-- 
1.6.4.4


^ permalink raw reply related

* Recent results with BCM4312 on Netbook
From: Larry Finger @ 2010-06-22 15:36 UTC (permalink / raw)
  To: Michael Buesch; +Cc: b43-dev, wireless, John Linville

Michael,

I have some good news. The Netbook that came from John is suddenly
developing DMA errors for the BCM4312, even though it does not have a
Phoenix BIOS. I have no idea why it did not fail this way earlier, but at
least I have a machine to debug that failure.

My first discovery is that if PIO mode is to be used, it is not sufficient
to load the module with the "pio=1" option, but that both "qos=0" and
"nohwcrypt=1" options must also be used, at least for WPA/WPA2 networks.
No other combination works. In addition, the automatic failover to PIO
mode does not work unless those two options were used when the module was
loaded. Thus both of the following work:

modprobe b43 pio=1 qos=0 nohwcrypt=1
modprobe b43 qos=0 hwcrypt=1

The second example gets a fatal DMA error and resets the controller before
the network comes up. I tried setting the latter two options before the
controller reset call in the failover, but that did not work.

If you have suggestions on changes in the switch from DMA to PIO mode,
please send them to me. In the meantime, I will be looking at differences
in the MMIO traces between wl and b43 to try to fix the DMA problem at the
source of the trouble.

Larry

^ permalink raw reply

* Re: ASPM status for iwlwifi and power-management (in general)
From: Luis R. Rodriguez @ 2010-06-22 15:54 UTC (permalink / raw)
  To: sedat.dilek; +Cc: wireless, Reinette Chatre, Johannes Berg, John Linville
In-Reply-To: <AANLkTilpqUnWG2CnMNZR7a45rY9cbqks3W-gkjsMbYOQ@mail.gmail.com>

On Tue, Jun 22, 2010 at 3:44 AM, Sedat Dilek <sedat.dilek@googlemail.com> wrote:
> Hi,
>
> yesterday, I was playing with PowerTop and my iwl3945 still is in the
> TOP 3 of energy user.
>
> Inspired by the recently published ASPM doc from Luis [2] I played a
> bit with ASPM.
>
> Currently, I am using a 2.6.35-rc3 Linux-kernel with latest
> acpi-2.6/release fixes.
>
> # dmesg | grep -i aspm
> [    0.226963] pci 0000:01:00.0: disabling ASPM on pre-1.1 PCIe
> device.  You can enable it with 'pcie_aspm=force'
> [    0.227629] pci 0000:08:00.0: disabling ASPM on pre-1.1 PCIe
> device.  You can enable it with 'pcie_aspm=force'
> [    0.228205] pci 0000:10:00.0: disabling ASPM on pre-1.1 PCIe
> device.  You can enable it with 'pcie_aspm=force'
>
> # for i in 01:00.0 08:00.0 10:00.0 ; do lspci -v | grep $i ; done
> 01:00.0 VGA compatible controller: ATI Technologies Inc M52 [Mobility
> Radeon X1300] (prog-if 00 [VGA controller])
> 08:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5753M
> Gigabit Ethernet PCI Express (rev 21)
> 10:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG
> [Golan] Network Connection (rev 02)
>
> # lspci -vvvv -s 10:00.0 | grep -i aspm
>                LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0
> <128ns, L1 <64us
>                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
>
> Before I will try 'pcie_aspm=force' cheat-code

I should note I discourage the usage of pcie_aspm=force, it will try
to enable ASPM for all devices which do have the capability, and this
means when you are enabling it you are not only testing ASPM on the
device you had in mind but *all* devices capable of it.

> I wanted to ask about
> the status of iwlwifi and ASPM.
> Is there code available. yet?

Driver code for ASPM only exists to help tweak it if for whatever
reason it does need tweaking. An example is ath9k which disables the
PLL when it uses ASPM to save power. iwlagn or iwl3945 might have
similar stuff, but not sure. Technically drivers should not need any
code for ASPM unless its driver specific tweaks.

> Which kernel has it - linux-next,
> wireless-testing GIT, iwlwifi GIT?

ASPM can be used so long as you just have a PCIE bus. If the driver
has ASPM tweaks that's a different thing.

> Which user-space apps are required?

None.

> IIRC iw [3] from GIT has already "iw: add set/get power_save commands" [4].

That's different. Read:

http://wireless.kernel.org/en/users/Documentation/Power-consumption

  Luis

> Anyone tested ASPM with iwlwifi hardware? Experiences?
>
> Beyond ASPM code, what is the actual status on power-mangement for
> wifi-hardware in general?
> IIRC it was turned off by default (with 2.6.33?)?
>
> Thanks for any help in advance.
>
>
> Kind Regards,
> - Sedat -
>
>
> [1] http://wireless.kernel.org/en/users/Documentation/ASPM
> [2] http://marc.info/?l=linux-wireless&m=127716115227206&w=2
> [3] http://git.sipsolutions.net/?p=iw.git
> [4] http://git.sipsolutions.net/?p=iw.git;a=commit;h=cf40ef379fd6c74a01092d1dfdd936385ea402b0
>

^ permalink raw reply

* Re: Recent results with BCM4312 on Netbook
From: Michael Büsch @ 2010-06-22 16:31 UTC (permalink / raw)
  To: Larry Finger; +Cc: b43-dev, wireless, John Linville
In-Reply-To: <4C20D884.3010501@lwfinger.net>

On 06/22/2010 05:36 PM, Larry Finger wrote:
> My first discovery is that if PIO mode is to be used, it is not sufficient
> to load the module with the "pio=1" option, but that both "qos=0" and
> "nohwcrypt=1" options must also be used, at least for WPA/WPA2 networks.

That is known. I posted it once or twice. It is b43 making bad
assumptions about mac80211 behavior. And mac80211 behavior changed...
b43 does modify the number of queues in the data structure after it
registered things to mac80211. That used to work properly in the past.
But it breaks now. The init does have to be re-ordered and implementation
of async firmware loading is required to fix that.

> No other combination works. In addition, the automatic failover to PIO
> mode does not work unless those two options were used when the module was
> loaded. Thus both of the following work:

It only works by accident anyway. But I already said that several times.

-- 
Greetings Michael.

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Matthew Garrett @ 2010-06-22 16:31 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel
In-Reply-To: <AANLkTikkt4dqYWrwtTCJ8tJZLB1kZXgF1KvaPsIOO3Dl@mail.gmail.com>

On Mon, Jun 21, 2010 at 01:39:07PM -0700, Luis R. Rodriguez wrote:
> Last I reviewed CONFIG_PCIEASPM won't buy you *anything* other than
> debugging knobs. With it you can force all devices to enable ASPM
> completely on or disable it. Both of which I think are not really
> useful and instead should be done in userspace given that if you are
> testing ASPM you likely want to test only one one device and its
> respective root complex, not all at the same time.

It buys you enabling of ASPM on devices that the BIOS hasn't configured, 
which is legitimate and useful.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply

* Re: intel 5100/iwlagn bug in 2.6.35-rc2 during large file transfer
From: reinette chatre @ 2010-06-22 16:48 UTC (permalink / raw)
  To: Richard Farina; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <4C198EF0.5080807@gmail.com>

On Wed, 2010-06-16 at 19:56 -0700, Richard Farina wrote:
> The repeated line appears ad infinitum filling my dmesg buffer.  This of 
> hangcheck timer seem to trigger with every large file transfer on my 
> intel 5100.  What would you like me to do to provide a more useful 
> output as this is currently extremely easy to reproduce.  Kernel 2.6.34 
> using compat-wireless stable 2.6.35-rc2
> 
> Thanks,
> Rick Farina
> 
> phy0: failed to reallocate TX buffer
> phy0: failed to reallocate TX buffer
> phy0: failed to reallocate TX buffer
> phy0: failed to reallocate TX buffer
> phy0: failed to reallocate TX buffer
> phy0: failed to reallocate TX buffer
> phy0: failed to reallocate TX buffer

First mac80211 runs out of memory ... it cannot even allocate enough
memory for a skb header.

> net_ratelimit: 22 callbacks suppressed
> __alloc_pages_slowpath: 3799 callbacks suppressed
> swapper: page allocation failure. order:1, mode:0x4020
> Pid: 0, comm: swapper Not tainted 2.6.34-pentoo #5
> Call Trace:
>  <IRQ>  [<ffffffff8109cb74>] __alloc_pages_nodemask+0x571/0x5b9
>  [<ffffffff816732e9>] ? skb_release_data+0xc4/0xc9
>  [<ffffffffa04701e4>] iwlagn_rx_allocate+0x98/0x25a [iwlagn]

Next driver runs out of memory.

Note that the above are all atomic allocations that fail and should be
able to recover. 

Is your system low on memory? Are you running applications that take a
lot of memory? Does your wifi connection drop or otherwise suffer at the
time you see these messages?

Reinette




^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Luis R. Rodriguez @ 2010-06-22 16:48 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel
In-Reply-To: <20100622163138.GD20668@srcf.ucam.org>

On Tue, Jun 22, 2010 at 9:31 AM, Matthew Garrett <mjg@redhat.com> wrote:
> On Mon, Jun 21, 2010 at 01:39:07PM -0700, Luis R. Rodriguez wrote:
>> Last I reviewed CONFIG_PCIEASPM won't buy you *anything* other than
>> debugging knobs. With it you can force all devices to enable ASPM
>> completely on or disable it. Both of which I think are not really
>> useful and instead should be done in userspace given that if you are
>> testing ASPM you likely want to test only one one device and its
>> respective root complex, not all at the same time.
>
> It buys you enabling of ASPM on devices that the BIOS hasn't configured,
> which is legitimate and useful.

Sure, I agree with that, but it also will enable ASPM for *all*
devices which have the capability which IMHO is a terrible idea for
users when all they want to do is enable ASPM for one device. Instead
I recommend users to enable ASPM for their devices selectively and
from userspace.

  Luis

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Matthew Garrett @ 2010-06-22 16:52 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel
In-Reply-To: <AANLkTikQkLFdpusfcLVOpyZHFrxwB5akr-ggFB7Fjm08@mail.gmail.com>

On Tue, Jun 22, 2010 at 09:48:40AM -0700, Luis R. Rodriguez wrote:

> Sure, I agree with that, but it also will enable ASPM for *all*
> devices which have the capability which IMHO is a terrible idea for
> users when all they want to do is enable ASPM for one device. Instead
> I recommend users to enable ASPM for their devices selectively and
> from userspace.

Why would you only want to enable ASPM for one device?

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply

* Re: ASPM status for iwlwifi and power-management (in general)
From: reinette chatre @ 2010-06-22 17:12 UTC (permalink / raw)
  To: sedat.dilek@gmail.com
  Cc: wireless, Luis R. Rodriguez, Berg, Johannes, John Linville
In-Reply-To: <AANLkTilpqUnWG2CnMNZR7a45rY9cbqks3W-gkjsMbYOQ@mail.gmail.com>

On Tue, 2010-06-22 at 03:44 -0700, Sedat Dilek wrote:

> Before I will try 'pcie_aspm=force' cheat-code I wanted to ask about
> the status of iwlwifi and ASPM.
> Is there code available. yet? Which kernel has it - linux-next,
> wireless-testing GIT, iwlwifi GIT?

iwl3945 will disable L0s if L1 enabled, and enable L0s if L1 disabled.
Please see iwl_apm_init which is called by iwl3945_apm_init

Reinette



^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Luis R. Rodriguez @ 2010-06-22 17:17 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel
In-Reply-To: <20100622165213.GA21842@srcf.ucam.org>

On Tue, Jun 22, 2010 at 9:52 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Tue, Jun 22, 2010 at 09:48:40AM -0700, Luis R. Rodriguez wrote:
>
>> Sure, I agree with that, but it also will enable ASPM for *all*
>> devices which have the capability which IMHO is a terrible idea for
>> users when all they want to do is enable ASPM for one device. Instead
>> I recommend users to enable ASPM for their devices selectively and
>> from userspace.
>
> Why would you only want to enable ASPM for one device?

ASPM doesn't always work for all devices even if they do advertise
ASPM capability so turning it on selectively by device is what I
recommend since otherwise you may get hangs and you will then have to
do the selective enabling. Furthermore laptops tend to disable ASPM
for cards not built-in to it, an example is Cardbus slots or internal
PCI-E slots. This is often done because to enable ASPM for some cards
you often need to tune the host controller in addition to enabling
ASPM for the endpoint, so this will vary depending on vendor, chipset,
and host controller combination. This is documentation that the OEM /
ODM typically end up getting, but not end users.

So given the complexity its best to be selective about it on each
platform until you verify ASPM works well for all devices present.

  Luis

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Matthew Garrett @ 2010-06-22 17:25 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel
In-Reply-To: <AANLkTikHLBBWrhCP_1f5Jv7zE9RKPvdsl5nSyfkeMfLl@mail.gmail.com>

On Tue, Jun 22, 2010 at 10:17:11AM -0700, Luis R. Rodriguez wrote:
> On Tue, Jun 22, 2010 at 9:52 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > Why would you only want to enable ASPM for one device?
> 
> ASPM doesn't always work for all devices even if they do advertise
> ASPM capability so turning it on selectively by device is what I
> recommend since otherwise you may get hangs and you will then have to
> do the selective enabling.

Right, which we have to deal with by having drivers disable ASPM on 
broken devices.

> Furthermore laptops tend to disable ASPM for cards not built-in to it, 
> an example is Cardbus slots or internal PCI-E slots. This is often 
> done because to enable ASPM for some cards you often need to tune the 
> host controller in addition to enabling ASPM for the endpoint, so this 
> will vary depending on vendor, chipset, and host controller 
> combination. This is documentation that the OEM / ODM typically end up 
> getting, but not end users.

Having looked into this, Windows will enable ASPM on external 
controllers unless there's some reason for it not to - where that may be 
either the appropriate bit in the FADT being set, the device not being 
PCIe 1.1 or later, there being no _OSC method on the appropriate root 
bridge or the _OSC method not giving it full control over PCIe, the 
driver disabling ASPM or the device not advertising it in the first 
place. Are you aware of any other cases where Windows will refuse to 
enable ASPM?
 
-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Luis R. Rodriguez @ 2010-06-22 17:40 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel,
	Jonathan May
In-Reply-To: <20100622172545.GA22680@srcf.ucam.org>

On Tue, Jun 22, 2010 at 10:25 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Tue, Jun 22, 2010 at 10:17:11AM -0700, Luis R. Rodriguez wrote:
>> On Tue, Jun 22, 2010 at 9:52 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
>> > Why would you only want to enable ASPM for one device?
>>
>> ASPM doesn't always work for all devices even if they do advertise
>> ASPM capability so turning it on selectively by device is what I
>> recommend since otherwise you may get hangs and you will then have to
>> do the selective enabling.
>
> Right, which we have to deal with by having drivers disable ASPM on
> broken devices.

Agreed, but then the assumption would be drivers are ASPM bug free
which is expect to be false with Video and 802.11 given that only a
handful of vendors do actually get involved with their drivers
upstream. Safe thing of course is to just disable it, of course, but
if you are going to use pcie_aspm=force good luck!

>> Furthermore laptops tend to disable ASPM for cards not built-in to it,
>> an example is Cardbus slots or internal PCI-E slots. This is often
>> done because to enable ASPM for some cards you often need to tune the
>> host controller in addition to enabling ASPM for the endpoint, so this
>> will vary depending on vendor, chipset, and host controller
>> combination. This is documentation that the OEM / ODM typically end up
>> getting, but not end users.
>
> Having looked into this, Windows will enable ASPM on external
> controllers unless there's some reason for it not to - where that may be
> either the appropriate bit in the FADT being set, the device not being
> PCIe 1.1 or later, there being no _OSC method on the appropriate root
> bridge or the _OSC method not giving it full control over PCIe, the
> driver disabling ASPM or the device not advertising it in the first
> place.

I was unaware of all this root complex sanity checks on Windows,
thanks for sharing.

> Are you aware of any other cases where Windows will refuse to
> enable ASPM?

My point was not whether or not ASPM typically got enabled on Windows
Vs Linux, my point was more of the fact that for some endpoint devices
you may have to tweak the root complex to get ASPM properly working
and that these tweaks *are* implemented on the BIOS by the ODM / OEM
for those devices and that the documentation for such tweaks is not
typically public. So, if you are like me and cannot stand the internal
802.11 card on your laptop and want to replace it with something else
you are stuck to hoping such BIOS tweaks are either not required or
figuring out what the tweaks are yourself and doing them through
userspace for the root complex *prior* to enabling ASPM through
userspace as well for the endpoint.

I suspect these tweaks will go away as the industry produces cards
with both L1 and L0s enabled all the time (devices being produced
today), but for devices caught in that middle of time between whether
or not L0s would be *required*  (last 2 years) I suspect we'll run
into these issues.

  Luis

^ permalink raw reply

* pull request: wireless-2.6 2010-06-22
From: John W. Linville @ 2010-06-22 17:41 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev, linux-kernel

Dave,

Just a single fix this time, a patch for ath5k to avoid a null pointer
dereference that can happen when executing certain operations against a
newly created interface.  This is, of course, intended for 2.6.35.

Please let me know if there are problems!

Thanks,

John


---

The following changes since commit 25442e06d20aaba7d7b16438078a562b3e4cf19b:
  stephen hemminger (1):
        bridge: fdb cleanup runs too often

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git master

Bob Copeland (1):
      ath5k: initialize ah->ah_current_channel

 drivers/net/wireless/ath/ath5k/attach.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index e0c244b..31c0080 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -126,6 +126,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
 	ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
 	ah->ah_noise_floor = -95;	/* until first NF calibration is run */
 	sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO;
+	ah->ah_current_channel = &sc->channels[0];
 
 	/*
 	 * Find the mac version
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply related

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Matthew Garrett @ 2010-06-22 17:50 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel,
	Jonathan May
In-Reply-To: <AANLkTilEHJ5qRD8ov0gIK0Zc4o-gJUPYkvHdyD1uZUon@mail.gmail.com>

On Tue, Jun 22, 2010 at 10:40:15AM -0700, Luis R. Rodriguez wrote:
> On Tue, Jun 22, 2010 at 10:25 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > Right, which we have to deal with by having drivers disable ASPM on
> > broken devices.
> 
> Agreed, but then the assumption would be drivers are ASPM bug free
> which is expect to be false with Video and 802.11 given that only a
> handful of vendors do actually get involved with their drivers
> upstream. Safe thing of course is to just disable it, of course, but
> if you are going to use pcie_aspm=force good luck!

People who use "force" deserve whatever they get, but "powersave" really 
ought to work. Fedora's defaulted to that for a while now - we've hit 
issues with aacraid, but that's pretty much it in terms of cases where 
the heuristics don't work. Maxim's problems wouldn't be triggered 
because CONFIG_PCIE_ASPM disables it on pre-1.1 devices regardless of 
the BIOS setup.

> > Having looked into this, Windows will enable ASPM on external
> > controllers unless there's some reason for it not to - where that may be
> > either the appropriate bit in the FADT being set, the device not being
> > PCIe 1.1 or later, there being no _OSC method on the appropriate root
> > bridge or the _OSC method not giving it full control over PCIe, the
> > driver disabling ASPM or the device not advertising it in the first
> > place.
> 
> I was unaware of all this root complex sanity checks on Windows,
> thanks for sharing.

With the patch I've just sent, they should also all be used for Linux as 
well.

> I suspect these tweaks will go away as the industry produces cards
> with both L1 and L0s enabled all the time (devices being produced
> today), but for devices caught in that middle of time between whether
> or not L0s would be *required*  (last 2 years) I suspect we'll run
> into these issues.

If the same problems would appear under Windows then it's not a problem 
that I'm hugely concerned about as yet - we'll wait a bit longer and 
then change the ASPM defaults to be more aggressive under Linux, and if 
it turns out to be a significant problem in the real world we'll have to 
reconsider it. But I don't think we should be depending on userspace 
bashing hardware registers in order to be able to enable power 
management.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply

* Re: pull request: wireless-2.6 2010-06-22
From: David Miller @ 2010-06-22 17:54 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20100622174136.GC2583@tuxdriver.com>

From: "John W. Linville" <linville@tuxdriver.com>
Date: Tue, 22 Jun 2010 13:41:37 -0400

> Just a single fix this time, a patch for ath5k to avoid a null pointer
> dereference that can happen when executing certain operations against a
> newly created interface.  This is, of course, intended for 2.6.35.
> 
> Please let me know if there are problems!

Pulled, thanks John.

^ permalink raw reply

* Re: [PATCH 1/5 v2]wireless:hostap_main.c warning: variable 'iface' set but not used
From: John W. Linville @ 2010-06-22 18:13 UTC (permalink / raw)
  To: Justin P. Mattock; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <1277157733-14071-1-git-send-email-justinmattock@gmail.com>

On Mon, Jun 21, 2010 at 03:02:13PM -0700, Justin P. Mattock wrote:
> This is a resend from version one due to trying a different approach
> than the original(probably important to leave netdev_priv() in).
> 
> In any case have a look, if there's another approach let me know
> and ill test it out. The below patch fixes a warning im seeing
> when compiling with gcc 4.6.0
> 
> CC [M]  drivers/net/wireless/hostap/hostap_main.o
> drivers/net/wireless/hostap/hostap_main.c: In function 'hostap_set_multicast_list_queue':
> drivers/net/wireless/hostap/hostap_main.c:744:27: warning: variable 'iface' set but not used
>  Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

I already applied the other version to wireless-next-2.6.  I can't
imagine what you mean to accomplish by leaving in a call to netdev_priv
w/o assigning the result to something.

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Luis R. Rodriguez @ 2010-06-22 18:28 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel,
	Jonathan May, Tim Gardner
In-Reply-To: <20100622175058.GA23499@srcf.ucam.org>

On Tue, Jun 22, 2010 at 10:50 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Tue, Jun 22, 2010 at 10:40:15AM -0700, Luis R. Rodriguez wrote:
>> On Tue, Jun 22, 2010 at 10:25 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
>> > Right, which we have to deal with by having drivers disable ASPM on
>> > broken devices.
>>
>> Agreed, but then the assumption would be drivers are ASPM bug free
>> which is expect to be false with Video and 802.11 given that only a
>> handful of vendors do actually get involved with their drivers
>> upstream. Safe thing of course is to just disable it, of course, but
>> if you are going to use pcie_aspm=force good luck!
>
> People who use "force" deserve whatever they get,

Heh, this whole patch and thread was started because Jussi tested
ath5k with  pcie_aspm=force (on a pre PCIE 1.1 device (?)) . I have
been trying to explain all along why this is a terrible idea to the
point we should probably just remove that code from the kernel. Hence
my side rants and explanations to justify my reasonings.

> but "powersave" really ought to work.

Interesting, as per Documentation/kernel-parameters.txt we have:

        pcie_aspm=      [PCIE] Forcibly enable or disable PCIe Active
State Power
                        Management.
                off     Disable ASPM.
                force   Enable ASPM even on devices that claim not to
support it.
                        WARNING: Forcing ASPM on may cause system lockups.

I was unaware of a "powersave" option to the pcie_aspm kernel
parameter. In fact:

static int __init pcie_aspm_disable(char *str)
{
        if (!strcmp(str, "off")) {
                aspm_disabled = 1;
                printk(KERN_INFO "PCIe ASPM is disabled\n");
        } else if (!strcmp(str, "force")) {
                aspm_force = 1;
                printk(KERN_INFO "PCIe ASPM is forcedly enabled\n");
        }
        return 1;
}

__setup("pcie_aspm=", pcie_aspm_disable);

Where is "powersave"?

I do see a "powersave" but its an ASPM policy string and it implies
you want to enable L1 and L0s when the device's LinkCap supports it,
see pcie_config_aspm_link() and its users. So in other words powersave
seems to imply you are using pcie_aspm=force, no?

> Fedora's defaulted to that for a while now - we've hit
> issues with aacraid, but that's pretty much it in terms of cases where
> the heuristics don't work. Maxim's problems wouldn't be triggered
> because CONFIG_PCIE_ASPM disables it on pre-1.1 devices regardless of
> the BIOS setup.

I don't expect all distributions to have CONFIG_PCIE_ASPM enabled, in
fact I was unaware of this sanity check being included as part of
CONFIG_PCIE_ASPM, I recommend we consider just enabling the sanity
check all the time. The fact that CONFIG_PCIE_ASPM is even an option
seems confusing to me given that apart from this sanity check the only
other thing that I see useful in it is the forcing of ASPM settings
and as I noted I think pcie_aspm=force is pretty dangerous.

>> > Having looked into this, Windows will enable ASPM on external
>> > controllers unless there's some reason for it not to - where that may be
>> > either the appropriate bit in the FADT being set, the device not being
>> > PCIe 1.1 or later, there being no _OSC method on the appropriate root
>> > bridge or the _OSC method not giving it full control over PCIe, the
>> > driver disabling ASPM or the device not advertising it in the first
>> > place.
>>
>> I was unaware of all this root complex sanity checks on Windows,
>> thanks for sharing.
>
> With the patch I've just sent, they should also all be used for Linux as
> well.

Oh nice! It'll be part of 2.6.36?

>> I suspect these tweaks will go away as the industry produces cards
>> with both L1 and L0s enabled all the time (devices being produced
>> today), but for devices caught in that middle of time between whether
>> or not L0s would be *required*  (last 2 years) I suspect we'll run
>> into these issues.
>
> If the same problems would appear under Windows then it's not a problem
> that I'm hugely concerned about as yet

Yes, these issues would also be part of Windows. But should also note
this also means for those people working on their own BIOSes it means
you also have to take these things into more serious consideration.

> - we'll wait a bit longer and
> then change the ASPM defaults to be more aggressive under Linux, and if
> it turns out to be a significant problem in the real world we'll have to
> reconsider it.

The problem is the tweaks in question are device specific. I can see
if I can get you concrete examples.

> But I don't think we should be depending on userspace
> bashing hardware registers in order to be able to enable power
> management.

Me neither, ASPM should just work with default settings, which is why
I also do not like that the sanity check on the PCIE 1.1 spec is done
through CONFIG_PCIE_ASPM, it makes no sense given that ASPM *will*
work even if you do not have CONFIG_PCIE_ASPM but the device has
functional ASPM.

I do think we should be depending on userspace to do development
testing and forcing ASPM on, because the only other alternative is
pcie_aspm=force and as noted this is just not a good idea unless you
*seriously* know what you are doing.

  Luis

^ permalink raw reply

* Re: [PATCH 1/5 v2]wireless:hostap_main.c warning: variable 'iface' set but not used
From: Justin P. Mattock @ 2010-06-22 18:34 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20100622181320.GD2583@tuxdriver.com>

On 06/22/2010 11:13 AM, John W. Linville wrote:
> On Mon, Jun 21, 2010 at 03:02:13PM -0700, Justin P. Mattock wrote:
>> This is a resend from version one due to trying a different approach
>> than the original(probably important to leave netdev_priv() in).
>>
>> In any case have a look, if there's another approach let me know
>> and ill test it out. The below patch fixes a warning im seeing
>> when compiling with gcc 4.6.0
>>
>> CC [M]  drivers/net/wireless/hostap/hostap_main.o
>> drivers/net/wireless/hostap/hostap_main.c: In function 'hostap_set_multicast_list_queue':
>> drivers/net/wireless/hostap/hostap_main.c:744:27: warning: variable 'iface' set but not used
>>   Signed-off-by: Justin P. Mattock<justinmattock@gmail.com>
>
> I already applied the other version to wireless-next-2.6.  I can't
> imagine what you mean to accomplish by leaving in a call to netdev_priv
> w/o assigning the result to something.
>
> John

alright..
as for the netdev_priv, I was getting confused on this one.

Thanks for taking the time to look at this.

Justin P. Mattock

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Matthew Garrett @ 2010-06-22 18:44 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Jussi Kivilinna, Maxim Levitsky, David Quan, Bob Copeland,
	Luis R. Rodriguez, ath5k-devel, linux-wireless, linux-kernel,
	Jonathan May, Tim Gardner
In-Reply-To: <AANLkTinE0BiOa5cpcIerbias7K-aDzj3x4qaeDpzy2CQ@mail.gmail.com>

On Tue, Jun 22, 2010 at 11:28:20AM -0700, Luis R. Rodriguez wrote:
> On Tue, Jun 22, 2010 at 10:50 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > People who use "force" deserve whatever they get,
> 
> Heh, this whole patch and thread was started because Jussi tested
> ath5k with  pcie_aspm=force (on a pre PCIE 1.1 device (?)) . I have
> been trying to explain all along why this is a terrible idea to the
> point we should probably just remove that code from the kernel. Hence
> my side rants and explanations to justify my reasonings.

Well, there's two things here. If you use force then you might get 
inappropriate ASPM. But if your BIOS enables ASPM on an old device, then 
booting *without* CONFIG_PCIE_ASPM will leave it turned on, and booting 
*with* CONFIG_PCIE_ASPM will turn it off. The Kconfig description is 
confusing - reality is that CONFIG_PCIE_ASPM enables logic that allows 
the kernel to modify the BIOS default, and disabling it makes the 
assumption that your BIOS did something sensible.

> Where is "powersave"?
> 
> I do see a "powersave" but its an ASPM policy string and it implies
> you want to enable L1 and L0s when the device's LinkCap supports it,
> see pcie_config_aspm_link() and its users. So in other words powersave
> seems to imply you are using pcie_aspm=force, no?

No. pcie_aspm=force will enable ASPM even if (a) the device is pre-1.1, 
(b) the firmware has the FADT flag set to tell you not to and (c) the 
firmware doesn't grant control via _OSC. The powersave policy will 
enable ASPM even if the BIOS didn't, but only if something else doesn't 
tell us not to.

> > Fedora's defaulted to that for a while now - we've hit
> > issues with aacraid, but that's pretty much it in terms of cases where
> > the heuristics don't work. Maxim's problems wouldn't be triggered
> > because CONFIG_PCIE_ASPM disables it on pre-1.1 devices regardless of
> > the BIOS setup.
> 
> I don't expect all distributions to have CONFIG_PCIE_ASPM enabled, in
> fact I was unaware of this sanity check being included as part of
> CONFIG_PCIE_ASPM, I recommend we consider just enabling the sanity
> check all the time. The fact that CONFIG_PCIE_ASPM is even an option
> seems confusing to me given that apart from this sanity check the only
> other thing that I see useful in it is the forcing of ASPM settings
> and as I noted I think pcie_aspm=force is pretty dangerous.

You're right, it shouldn't be an option. It's vital for making sure that 
ASPM is disabled when it should be. I'd be happy with pcie_aspm=force 
tainting the kernel.

> > With the patch I've just sent, they should also all be used for Linux as
> > well.
> 
> Oh nice! It'll be part of 2.6.36?

As long as Jesse picks it up.

> > If the same problems would appear under Windows then it's not a problem
> > that I'm hugely concerned about as yet
> 
> Yes, these issues would also be part of Windows. But should also note
> this also means for those people working on their own BIOSes it means
> you also have to take these things into more serious consideration.

There's a standardised mechanism for BIOS authors to tell us not to 
touch their ASPM configuration, and people that ignore that really do 
deserve to have things break.

> Me neither, ASPM should just work with default settings, which is why
> I also do not like that the sanity check on the PCIE 1.1 spec is done
> through CONFIG_PCIE_ASPM, it makes no sense given that ASPM *will*
> work even if you do not have CONFIG_PCIE_ASPM but the device has
> functional ASPM.

I agree. I'll send a patch that moves it under CONFIG_EMBEDDED and 
defaults to on.

> I do think we should be depending on userspace to do development
> testing and forcing ASPM on, because the only other alternative is
> pcie_aspm=force and as noted this is just not a good idea unless you
> *seriously* know what you are doing.

If you set the powersave policy and ASPM doesn't get enabled, then 
that's because we've got a really strong belief that ASPM shouldn't be 
enabled. Is your concern just that pcie_aspm=force is too easy for users 
to get at?

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply

* Compat-wireless release for 2010-06-22 is baked
From: Compat-wireless cronjob account @ 2010-06-22 19:04 UTC (permalink / raw)
  To: linux-wireless, linux-bluetooth

>From git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat-wireless-2.6
   75bb510..7df472d  master     -> origin/master
   3eaa500..8e2a8ea  wl         -> origin/wl
>From git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next
   fd729ff..41d99c6  history    -> origin/history
 + 13f4704...d82e647 master     -> origin/master  (forced update)
 * [new tag]         next-20100622 -> next-20100622

compat-wireless code metrics

    498619 - Total upstream lines of code being pulled
      1410 - backport code changes
      1177 - backport code additions
       233 - backport code deletions
      5748 - backport from compat module
      7158 - total backport code
    1.4356 - % of code consists of backport work
      1218 - Crap changes not yet posted
      1179 - Crap additions not yet merged
        39 - Crap deletions not yet posted
    0.2443 - % of crap code

Base tree: linux-next.git
Base tree version: next-20100622
compat-wireless release: compat-wireless-2010-06-17-3-g7df472d

^ permalink raw reply

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Luis R. Rodriguez @ 2010-06-22 19:13 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Luis R. Rodriguez, linux-wireless@vger.kernel.org, David Quan,
	Luis R. Rodriguez, linux-kernel, ath5k-devel@venema.h4ckr.net,
	Jonathan May, Jussi Kivilinna, Tim Gardner
In-Reply-To: <20100622184426.GA24546@srcf.ucam.org>

On Tue, Jun 22, 2010 at 11:44:26AM -0700, Matthew Garrett wrote:
> On Tue, Jun 22, 2010 at 11:28:20AM -0700, Luis R. Rodriguez wrote:
> > On Tue, Jun 22, 2010 at 10:50 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> > > People who use "force" deserve whatever they get,
> > 
> > Heh, this whole patch and thread was started because Jussi tested
> > ath5k with  pcie_aspm=force (on a pre PCIE 1.1 device (?)) . I have
> > been trying to explain all along why this is a terrible idea to the
> > point we should probably just remove that code from the kernel. Hence
> > my side rants and explanations to justify my reasonings.
> 
> Well, there's two things here. If you use force then you might get 
> inappropriate ASPM. But if your BIOS enables ASPM on an old device, then 
> booting *without* CONFIG_PCIE_ASPM will leave it turned on, and booting 
> *with* CONFIG_PCIE_ASPM will turn it off. The Kconfig description is 
> confusing - reality is that CONFIG_PCIE_ASPM enables logic that allows 
> the kernel to modify the BIOS default, and disabling it makes the 
> assumption that your BIOS did something sensible.

Agreed, given that you also mentioned you would put it under embeeded
how about something like this:

diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index b8b494b..9c76b70 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -31,14 +31,29 @@ source "drivers/pci/pcie/aer/Kconfig"
 # PCI Express ASPM
 #
 config PCIEASPM
-	bool "PCI Express ASPM support(Experimental)"
-	depends on PCI && EXPERIMENTAL && PCIEPORTBUS
-	default n
+	bool "PCI Express ASPM sanity check support" if EMBEDDED
+	depends on PCI && PCIEPORTBUS
+	default y
 	help
-	  This enables PCI Express ASPM (Active State Power Management) and
-	  Clock Power Management. ASPM supports state L0/L0s/L1.
+	  This enables some sanity checks for PCI Express ASPM.
+	  ASPM supports the states L0/L0s/L1. The sanity checks are to
+	  disable ASPM if:
+
+	  a) the device is pre-1.1
+	  b) the firmware has the FADT flag set to tell you not to
+	  c) the firmware doesn't grant control via _OSC
+
+	  Without this option your BIOS's defaults will be respected
+	  and while although this should always be correct it typically
+	  is not. If your ASPM settings are incorrect you may experience
+	  odd hangs which are hard to debug. These sanity checks should
+	  help avoid these odd hangs by only enabling ASPM if we are
+	  sure we can enable it.
+
+	  For more information you can refer to this documentation:
+
+	  http://wireless.kernel.org/en/users/Documentation/ASPM
 
-	  When in doubt, say N.
 config PCIEASPM_DEBUG
 	bool "Debug PCI Express ASPM"
 	depends on PCIEASPM

> > Where is "powersave"?
> > 
> > I do see a "powersave" but its an ASPM policy string and it implies
> > you want to enable L1 and L0s when the device's LinkCap supports it,
> > see pcie_config_aspm_link() and its users. So in other words powersave
> > seems to imply you are using pcie_aspm=force, no?
> 
> No. pcie_aspm=force will enable ASPM even if (a) the device is pre-1.1, 
> (b) the firmware has the FADT flag set to tell you not to and (c) the 
> firmware doesn't grant control via _OSC. The powersave policy will 
> enable ASPM even if the BIOS didn't, but only if something else doesn't 
> tell us not to.

So if any of the above (a) (b) or (c) are true powersave will keep
it disabled? Is pcie_aspm=forcepowersave this a new option with your
patches?

> > > Fedora's defaulted to that for a while now - we've hit
> > > issues with aacraid, but that's pretty much it in terms of cases where
> > > the heuristics don't work. Maxim's problems wouldn't be triggered
> > > because CONFIG_PCIE_ASPM disables it on pre-1.1 devices regardless of
> > > the BIOS setup.
> > 
> > I don't expect all distributions to have CONFIG_PCIE_ASPM enabled, in
> > fact I was unaware of this sanity check being included as part of
> > CONFIG_PCIE_ASPM, I recommend we consider just enabling the sanity
> > check all the time. The fact that CONFIG_PCIE_ASPM is even an option
> > seems confusing to me given that apart from this sanity check the only
> > other thing that I see useful in it is the forcing of ASPM settings
> > and as I noted I think pcie_aspm=force is pretty dangerous.
> 
> You're right, it shouldn't be an option. It's vital for making sure that 
> ASPM is disabled when it should be. I'd be happy with pcie_aspm=force 
> tainting the kernel.

:) !

> > > With the patch I've just sent, they should also all be used for Linux as
> > > well.
> > 
> > Oh nice! It'll be part of 2.6.36?
> 
> As long as Jesse picks it up.

Nice.

> > > If the same problems would appear under Windows then it's not a problem
> > > that I'm hugely concerned about as yet
> > 
> > Yes, these issues would also be part of Windows. But should also note
> > this also means for those people working on their own BIOSes it means
> > you also have to take these things into more serious consideration.
> 
> There's a standardised mechanism for BIOS authors to tell us not to 
> touch their ASPM configuration, and people that ignore that really do 
> deserve to have things break.

Oh, I was more concerned about open bios hackers. If a device requires
PCI host controller tweaks should *we* be doing those tweaks and sanity
checks oursevles upstream or should we rely on the open-bios guys to
do it accordingly in their code?

> > Me neither, ASPM should just work with default settings, which is why
> > I also do not like that the sanity check on the PCIE 1.1 spec is done
> > through CONFIG_PCIE_ASPM, it makes no sense given that ASPM *will*
> > work even if you do not have CONFIG_PCIE_ASPM but the device has
> > functional ASPM.
> 
> I agree. I'll send a patch that moves it under CONFIG_EMBEDDED and 
> defaults to on.

:D

> > I do think we should be depending on userspace to do development
> > testing and forcing ASPM on, because the only other alternative is
> > pcie_aspm=force and as noted this is just not a good idea unless you
> > *seriously* know what you are doing.
> 
> If you set the powersave policy and ASPM doesn't get enabled, then 
> that's because we've got a really strong belief that ASPM shouldn't be 
> enabled. Is your concern just that pcie_aspm=force is too easy for users 
> to get at?

Yes! I think people are starting to use it like to magically save
more power without taking into consideration the implications. This is
why I was suggesting maybe we nuke that option all together. Does it
*really* give us any benefit? The only benefit I see is if we *are*
100% sure our system should work with all our root complexes and
endpoints having ASPM enabled. That I do not see happening until
a few years from now.

Maybe we should have another type of module parameter type, a
I_know_what_Im_doing_module_parameter and taint whenever any of
those are on, not just pcie_aspm=force ? :)

  Luis

^ permalink raw reply related

* Re: [ath5k-devel] [PATCH v2] ath5k: disable ASPM
From: Johannes Stezenbach @ 2010-06-22 19:31 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Luis R. Rodriguez, Jussi Kivilinna, Maxim Levitsky, David Quan,
	Bob Copeland, Luis R. Rodriguez, ath5k-devel, linux-wireless,
	linux-kernel, Jonathan May, Tim Gardner
In-Reply-To: <20100622184426.GA24546@srcf.ucam.org>

On Tue, Jun 22, 2010 at 07:44:26PM +0100, Matthew Garrett wrote:
> On Tue, Jun 22, 2010 at 11:28:20AM -0700, Luis R. Rodriguez wrote:
> > 
> > Heh, this whole patch and thread was started because Jussi tested
> > ath5k with  pcie_aspm=force (on a pre PCIE 1.1 device (?)) . I have
> > been trying to explain all along why this is a terrible idea to the
> > point we should probably just remove that code from the kernel. Hence
> > my side rants and explanations to justify my reasonings.
> 
> Well, there's two things here. If you use force then you might get 
> inappropriate ASPM. But if your BIOS enables ASPM on an old device, then 
> booting *without* CONFIG_PCIE_ASPM will leave it turned on, and booting 
> *with* CONFIG_PCIE_ASPM will turn it off. The Kconfig description is 
> confusing - reality is that CONFIG_PCIE_ASPM enables logic that allows 
> the kernel to modify the BIOS default, and disabling it makes the 
> assumption that your BIOS did something sensible.

Does CONFIG_PCIEASPM provide a way for the user to modifiy
the settings at runtime?

I have a Samsung N130 netbook which has a BIOS setting
called "CPU Power Saving Mode".  When enabled it activates
ASPM L1 and L0s for the ethernet chip (Realtek RTL8102e, 100Mbit)
and the PCIE bridge (with the BIOS setting off it's just L1).
The result is that the ethernet througput is reduced to 25Mbit/s.
(The BIOS setting does not activa L0s for the Atheros AR9285 WLAN.)

99,9% of the time I want to enjoy the power savings,
but occationally I have to transfer some bulk data and would
like to switch the setting for a few minutes.

Or, well, ideally I'd like to have power savings _and_ performance
at the same time without any manual intervention.  I'm not sure
if this is a quirk of the N130 or if ASPM L0s always causes
performance degradation?


Thanks
Johannes

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox