https://bugs.dragonflybsd.org/https://bugs.dragonflybsd.org/favicon.ico?16293952082012-11-21T20:40:35ZDragonFlyBSD bugtrackerDragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111142012-11-21T20:40:35ZJohannes.Hofmann
<ul></ul><p>So far I wasn't able to reproduce it with SMP disabled in the BIOS, so it could be SMP related.</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111152012-11-22T20:55:09ZJohannes.Hofmann
<ul></ul><p>With some wlan_assert_serialized() added I found that ath_start is called without serializer held via ieee80211_handoff->ifq_dispatch->ath_start.</p>
<p>With following changes I didn't see the problem so far:</p>
<p>diff --git a/sys/dev/netif/ath/ath/if_ath.c b/sys/dev/netif/ath/ath/if_ath.c<br />index 2f22372..9b1ca66 100644<br />--- a/sys/dev/netif/ath/ath/if_ath.c<br />+++ b/sys/dev/netif/ath/ath/if_ath.c<br /><code>@ -452,9 +452,7 </code>@ ath_attach(u_int16_t devid, struct ath_softc *sc)
* Allocate tx+rx descriptors and populate the lists.<br /> */<br /> wlan_assert_serialized();<br />- wlan_serialize_exit();<br /> error = ath_desc_alloc(sc);<br />- wlan_serialize_enter();<br /> if (error != 0) {<br /> if_printf(ifp, "failed to allocate descriptors: %d\n", error);<br /> goto bad;<br />diff --git a/sys/netproto/802_11/wlan/ieee80211_dragonfly.c b/sys/netproto/802_11/wlan/ieee80211_dragonfly.c<br />index 098598e..302a189 100644<br />--- a/sys/netproto/802_11/wlan/ieee80211_dragonfly.c<br />+++ b/sys/netproto/802_11/wlan/ieee80211_dragonfly.c<br /><code>@ -812,7 +812,6 </code>@ ieee80211_handoff(struct ifnet *dst_ifp, struct mbuf *m)</p>
<pre><code>/* We may be sending a fragment so traverse the mbuf */<br /> wlan_assert_serialized();<br />- wlan_serialize_exit();<br /> for (; m; m = m0) {<br /> struct altq_pktattr pktattr;</code></pre>
<p><code>@ -824,7 +823,6 </code>@ ieee80211_handoff(struct ifnet *dst_ifp, struct mbuf *m)</p>
<pre><code>ifq_dispatch(dst_ifp, m, &pktattr);<br /> }<br />- wlan_serialize_enter();</code></pre>
<pre><code>return (0);<br /> }</code></pre>
<p>I don't know whether this might create issues with other drivers and I'm not yet 100% certain<br />that it really fixes the problem in my case.</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111162012-11-22T21:27:22ZJohannes.Hofmann
<ul><li><strong>File</strong> <a href="/attachments/961">ath_lock.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/961/ath_lock.diff">ath_lock.diff</a> added</li></ul><p>After looking at if_iwn.c a more appropriate approach is probabely to leave ieee80211_dragonfly.c alone and change the locking in if_ath.c like in attached patch.</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111282012-11-28T09:00:50Zsepherosa
<ul></ul><p>On Fri, Nov 23, 2012 at 5:27 AM, Johannes Hofmann via Redmine<br /><<a class="email" href="mailto:bugtracker-admin@leaf.dragonflybsd.org">bugtracker-admin@leaf.dragonflybsd.org</a>> wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-3 priority-4 priority-default closed" title="Bug: ath: ran out of descriptors (Resolved)" href="https://bugs.dragonflybsd.org/issues/2458">#2458</a> has been updated by Johannes Hofmann.</p>
<p>File ath_lock.diff added</p>
<p>After looking at if_iwn.c a more appropriate approach is probabely to leave ieee80211_dragonfly.c alone and change the locking in if_ath.c like in attached patch.<br />----------------------------------------<br />Bug <a class="issue tracker-1 status-3 priority-4 priority-default closed" title="Bug: ath: ran out of descriptors (Resolved)" href="https://bugs.dragonflybsd.org/issues/2458">#2458</a>: ath: ran out of descriptors<br /><a class="external" href="http://bugs.dragonflybsd.org/issues/2458">http://bugs.dragonflybsd.org/issues/2458</a></p>
<p>Author: Johannes Hofmann<br />Status: New<br />Priority: Normal<br />Assignee:<br />Category:<br />Target version:</p>
<p>After running for a while in a WPA secured WLAN with an ath(4) card, I get:<br />ath: ran out of descriptors<br />and the network stops working.<br />Sometimes destroying wlan0 and kldunload if_ath; kldload if_ath<br />restores network, but in some cases I get</p>
</blockquote>
<p>Well, I believe the problem is actually more serious: the ifnet's<br />if_serializer is not properly setup to wlan_global_serializer<br />(ieee80211_ifattach->if_attach, wlan_global_serializer should be<br />passed as the second parameter to if_attach instead of NULL). If you<br />are interested, that could be a good project. I will have to note<br />that you may experience many panics before the things work. However,<br />once it works, it will no longer cause further problems. If anyone<br />want to pick it up, please feel free to contact me, if you need the<br />ifnet serializer working mechanism.</p>
<p>As about the patch, if other folks w/ the proper hardware could<br />confirm it works, we could just commit it as workaround.</p>
<p>Best Regards,<br />sephe</p>
<blockquote>
<p>Nov 18 12:45:06 plop kernel: Trace beginning at frame 0xd6264ca8<br />Nov 18 12:45:06 plop kernel: m_free(ffffffff,d47f1c00,0,d936dc00,d5a94400) at m_free+0xc6 0x<br />c01f26ed<br />Nov 18 12:45:06 plop kernel: m_free(d47f7800,d6264cfc,c09c8846,d47f7800,c47576f0) at m_free+<br />0xc6 0xc01f26ed<br />Nov 18 12:45:06 plop kernel: m_freem(d47f7800,c47576f0,d6264cfc,c09e8e58,d5cf9f80) at m_free<br />m+0x15 0xc01f29c6<br />Nov 18 12:45:06 plop kernel: ieee80211_flush_ifq(d5a94400,d4c46500,ffffffff,d5e35478,c47576f<br />0) at ieee80211_flush_ifq+0x70 0xc09c8846<br />Nov 18 12:45:06 plop kernel: ieee80211_newstate_task(d4c46500,1,c47576f4,1,c475770c) at ieee<br />80211_newstate_task+0x231 0xc09e74e3<br />Nov 18 12:45:06 plop kernel: taskqueue_run(c47576f0,c475770c,0,c03d27b3,0) at taskqueue_run+<br />0x93 0xc01dd304<br />Nov 18 12:45:06 plop kernel: taskqueue_thread_loop(d5e3544c,0,0,0,0) at taskqueue_thread_loo<br />p+0x4b 0xc01dd5ed<br />Nov 18 12:45:06 plop kernel: lwkt_exit() at lwkt_exit 0xc01bbab3</p>
<p>and the system freezes on kldunload if_ath</p>
<p>--<br />You have received this notification because you have either subscribed to it, or are involved in it.<br />To change your notification preferences, please click here: <a class="external" href="http://bugs.dragonflybsd.org/my/account">http://bugs.dragonflybsd.org/my/account</a></p>
</blockquote>
<p>--<br />Tomorrow Will Never Die</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111332012-11-28T22:23:41ZJohannes.Hofmann
<ul></ul><p>Thanks for looking into this! I tried to implement it as you suggested<br />and simply doing:</p>
<p>diff --git a/sys/netproto/802_11/wlan/ieee80211.c b/sys/netproto/802_11/wlan/ieee80211.c<br />index c4084d4..d6be645 100644<br />--- a/sys/netproto/802_11/wlan/ieee80211.c<br />+++ b/sys/netproto/802_11/wlan/ieee80211.c<br /><code>@ -304,7 +304,7 </code>@ ieee80211_ifattach(struct ieee80211com *ic,</p>
<pre><code>ifp->if_addrlen = IEEE80211_ADDR_LEN;<br /> ifp->if_hdrlen = 0;<br />- if_attach(ifp, NULL);<br />+ if_attach(ifp, &wlan_global_serializer);<br /> ifp->if_mtu = IEEE80211_MTU_MAX;<br /> ifp->if_broadcastaddr = ieee80211broadcastaddr;<br /> ifp->if_output = null_output;<br />diff --git a/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br />b/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br />index a31dad7..d7f2d92 100644<br />--- a/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br />+<ins>+ b/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br /><code>@ -3201,7 +3201,9 </code>@ ieee80211_ioctl_updatemulti(struct ieee80211com *ic)<br /> TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {<br /> if (ifma->ifma_addr->sa_family != AF_LINK)<br /> continue;<br /></ins> wlan_serialize_exit();<br /> (void) if_addmulti(parent, ifma->ifma_addr, NULL);<br />+ wlan_serialize_enter();<br /> }<br /> }<br /> parent->if_ioctl = ioctl;</code></pre>
<p>seems to work for ath so far. Do you have a better idea how to deal<br />with the recursive call to if_addmulti()?<br />Of course the other wlan drivers would also need to be adjusted. I<br />can work on that if you confirm that this is the way to go.</p>
<p>Best Regards,<br />Johannes</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111352012-11-29T01:53:55Zsepherosa
<ul></ul><p>On Thu, Nov 29, 2012 at 6:23 AM, Johannes Hofmann via Redmine<br /><<a class="email" href="mailto:bugtracker-admin@leaf.dragonflybsd.org">bugtracker-admin@leaf.dragonflybsd.org</a>> wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-3 priority-4 priority-default closed" title="Bug: ath: ran out of descriptors (Resolved)" href="https://bugs.dragonflybsd.org/issues/2458">#2458</a> has been updated by Johannes Hofmann.</p>
<p>Thanks for looking into this! I tried to implement it as you suggested<br />and simply doing:</p>
<p>diff --git a/sys/netproto/802_11/wlan/ieee80211.c b/sys/netproto/802_11/wlan/ieee80211.c<br />index c4084d4..d6be645 100644<br />--- a/sys/netproto/802_11/wlan/ieee80211.c<br />+++ b/sys/netproto/802_11/wlan/ieee80211.c<br /><code>@ -304,7 +304,7 </code>@ ieee80211_ifattach(struct ieee80211com *ic,</p>
<p>ifp->if_addrlen = IEEE80211_ADDR_LEN;<br />ifp->if_hdrlen = 0;<br />- if_attach(ifp, NULL);<br />+ if_attach(ifp, &wlan_global_serializer);<br />ifp->if_mtu = IEEE80211_MTU_MAX;<br />ifp->if_broadcastaddr = ieee80211broadcastaddr;<br />ifp->if_output = null_output;<br />diff --git a/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br />b/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br />index a31dad7..d7f2d92 100644<br />--- a/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br />+<ins>+ b/sys/netproto/802_11/wlan/ieee80211_ioctl.c<br /><code>@ -3201,7 +3201,9 </code>@ ieee80211_ioctl_updatemulti(struct ieee80211com *ic)<br />TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {<br />if (ifma->ifma_addr->sa_family != AF_LINK)<br />continue;<br /></ins> wlan_serialize_exit();<br />(void) if_addmulti(parent, ifma->ifma_addr, NULL);<br />+ wlan_serialize_enter();<br />}<br />}<br />parent->if_ioctl = ioctl;</p>
<p>seems to work for ath so far. Do you have a better idea how to deal<br />with the recursive call to if_addmulti()?</p>
</blockquote>
<p>Hmm, not much, but I believe you should release the serializer at the<br />beginning of ieee80211_ioctl_updatemulti() (if_delallmulti will try<br />holding serializer too). Since multicast address alteration/accessing<br />are serialized by netisr0, releasing serializer here probably will not<br />hurt.</p>
<p>Best Regards,<br />sephe</p>
<blockquote>
<p>Of course the other wlan drivers would also need to be adjusted. I<br />can work on that if you confirm that this is the way to go.</p>
<p>Best Regards,<br />Johannes</p>
<p>----------------------------------------<br />Bug <a class="issue tracker-1 status-3 priority-4 priority-default closed" title="Bug: ath: ran out of descriptors (Resolved)" href="https://bugs.dragonflybsd.org/issues/2458">#2458</a>: ath: ran out of descriptors<br /><a class="external" href="http://bugs.dragonflybsd.org/issues/2458">http://bugs.dragonflybsd.org/issues/2458</a></p>
<p>Author: Johannes Hofmann<br />Status: New<br />Priority: Normal<br />Assignee:<br />Category:<br />Target version:</p>
<p>After running for a while in a WPA secured WLAN with an ath(4) card, I get:<br />ath: ran out of descriptors<br />and the network stops working.<br />Sometimes destroying wlan0 and kldunload if_ath; kldload if_ath<br />restores network, but in some cases I get</p>
<p>Nov 18 12:45:06 plop kernel: Trace beginning at frame 0xd6264ca8<br />Nov 18 12:45:06 plop kernel: m_free(ffffffff,d47f1c00,0,d936dc00,d5a94400) at m_free+0xc6 0x<br />c01f26ed<br />Nov 18 12:45:06 plop kernel: m_free(d47f7800,d6264cfc,c09c8846,d47f7800,c47576f0) at m_free+<br />0xc6 0xc01f26ed<br />Nov 18 12:45:06 plop kernel: m_freem(d47f7800,c47576f0,d6264cfc,c09e8e58,d5cf9f80) at m_free<br />m+0x15 0xc01f29c6<br />Nov 18 12:45:06 plop kernel: ieee80211_flush_ifq(d5a94400,d4c46500,ffffffff,d5e35478,c47576f<br />0) at ieee80211_flush_ifq+0x70 0xc09c8846<br />Nov 18 12:45:06 plop kernel: ieee80211_newstate_task(d4c46500,1,c47576f4,1,c475770c) at ieee<br />80211_newstate_task+0x231 0xc09e74e3<br />Nov 18 12:45:06 plop kernel: taskqueue_run(c47576f0,c475770c,0,c03d27b3,0) at taskqueue_run+<br />0x93 0xc01dd304<br />Nov 18 12:45:06 plop kernel: taskqueue_thread_loop(d5e3544c,0,0,0,0) at taskqueue_thread_loo<br />p+0x4b 0xc01dd5ed<br />Nov 18 12:45:06 plop kernel: lwkt_exit() at lwkt_exit 0xc01bbab3</p>
<p>and the system freezes on kldunload if_ath</p>
<p>--<br />You have received this notification because you have either subscribed to it, or are involved in it.<br />To change your notification preferences, please click here: <a class="external" href="http://bugs.dragonflybsd.org/my/account">http://bugs.dragonflybsd.org/my/account</a></p>
</blockquote>
<p>--<br />Tomorrow Will Never Die</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111422012-12-02T17:06:25ZJohannes.Hofmann
<ul></ul><p>I created a wlan_serialize branch in my leaf repo (~hofmann).<br />It's tested with ath an iwn so far.</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111512012-12-11T01:45:23Zsepherosa
<ul></ul><p>On Mon, Dec 3, 2012 at 1:06 AM, Johannes Hofmann via Redmine<br /><<a class="email" href="mailto:bugtracker-admin@leaf.dragonflybsd.org">bugtracker-admin@leaf.dragonflybsd.org</a>> wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-1 status-3 priority-4 priority-default closed" title="Bug: ath: ran out of descriptors (Resolved)" href="https://bugs.dragonflybsd.org/issues/2458">#2458</a> has been updated by Johannes Hofmann.</p>
<p>I created a wlan_serialize branch in my leaf repo (~hofmann).<br />It's tested with ath an iwn so far.</p>
</blockquote>
<p>Cool. Do you have time to bring it one step further? I would like to<br />put ASSERT_SERIALIZED(ifp->if_serializer) in both vap's and physical<br />interface's public methods (if_init, if_start, if_ioctl, etc)</p>
<p>Best Regards,<br />sephe</p>
<blockquote>
<p>----------------------------------------<br />Bug <a class="issue tracker-1 status-3 priority-4 priority-default closed" title="Bug: ath: ran out of descriptors (Resolved)" href="https://bugs.dragonflybsd.org/issues/2458">#2458</a>: ath: ran out of descriptors<br /><a class="external" href="http://bugs.dragonflybsd.org/issues/2458">http://bugs.dragonflybsd.org/issues/2458</a></p>
<p>Author: Johannes Hofmann<br />Status: New<br />Priority: Normal<br />Assignee:<br />Category:<br />Target version:</p>
<p>After running for a while in a WPA secured WLAN with an ath(4) card, I get:<br />ath: ran out of descriptors<br />and the network stops working.<br />Sometimes destroying wlan0 and kldunload if_ath; kldload if_ath<br />restores network, but in some cases I get</p>
<p>Nov 18 12:45:06 plop kernel: Trace beginning at frame 0xd6264ca8<br />Nov 18 12:45:06 plop kernel: m_free(ffffffff,d47f1c00,0,d936dc00,d5a94400) at m_free+0xc6 0x<br />c01f26ed<br />Nov 18 12:45:06 plop kernel: m_free(d47f7800,d6264cfc,c09c8846,d47f7800,c47576f0) at m_free+<br />0xc6 0xc01f26ed<br />Nov 18 12:45:06 plop kernel: m_freem(d47f7800,c47576f0,d6264cfc,c09e8e58,d5cf9f80) at m_free<br />m+0x15 0xc01f29c6<br />Nov 18 12:45:06 plop kernel: ieee80211_flush_ifq(d5a94400,d4c46500,ffffffff,d5e35478,c47576f<br />0) at ieee80211_flush_ifq+0x70 0xc09c8846<br />Nov 18 12:45:06 plop kernel: ieee80211_newstate_task(d4c46500,1,c47576f4,1,c475770c) at ieee<br />80211_newstate_task+0x231 0xc09e74e3<br />Nov 18 12:45:06 plop kernel: taskqueue_run(c47576f0,c475770c,0,c03d27b3,0) at taskqueue_run+<br />0x93 0xc01dd304<br />Nov 18 12:45:06 plop kernel: taskqueue_thread_loop(d5e3544c,0,0,0,0) at taskqueue_thread_loo<br />p+0x4b 0xc01dd5ed<br />Nov 18 12:45:06 plop kernel: lwkt_exit() at lwkt_exit 0xc01bbab3</p>
<p>and the system freezes on kldunload if_ath</p>
<p>--<br />You have received this notification because you have either subscribed to it, or are involved in it.<br />To change your notification preferences, please click here: <a class="external" href="http://bugs.dragonflybsd.org/my/account">http://bugs.dragonflybsd.org/my/account</a></p>
</blockquote>
<p>--<br />Tomorrow Will Never Die</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=111572012-12-11T22:20:48ZJohannes.Hofmann
<ul></ul><p>Sure. I've updated the wlan_serialize branch in my leaf repo (~hofmann).<br />I've added the checks in ath and iwn (the devices I can test). <br />So far no problems for me.<br />But on irc I got a negative report for ral.<br />It didn't work anymore with wlan_global_serializer as if_serializer.</p>
<p>Regards,<br />Johannes</p>
<p>PS: I also had wlan_assert_serialized() in the if_output functions, but it triggered.<br /> I guess it's ok for those to be called without the if_serializer?</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=112692013-02-17T20:45:25ZJohannes.Hofmann
<ul></ul><p>After releasing the wlan serialzer when loading the firmware image ral also seems to work<br />(tested-by: luxh). <br />The wlan_serialize branch at leaf/~hofmann is updated accordingly.</p> DragonFlyBSD - Bug #2458: ath: ran out of descriptorshttps://bugs.dragonflybsd.org/issues/2458?journal_id=114412013-04-07T20:24:01ZJohannes.Hofmann
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li></ul>