Thread (3 messages) flat view 3 messages, 3 authors, 2021-03-05

Re: [PATCH v1] ibmvnic: remove excessive irqsave

From: Lijun Pan <hidden>
Date: 2021-03-05 22:50:33

<html><head></head><body dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 5, 2021, at 2:48 AM, angkery &lt;<a href="mailto:angkery@163.com" class="">angkery@163.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">From: Junlin Yang &lt;<a href="mailto:yangjunlin@yulong.com" class="">yangjunlin@yulong.com</a>&gt;<br class=""><br class="">ibmvnic_remove locks multiple spinlocks while disabling interrupts:<br class="">spin_lock_irqsave(&amp;adapter-&gt;state_lock, flags);<br class="">spin_lock_irqsave(&amp;adapter-&gt;rwi_lock, flags);<br class=""><br class="">As reported by coccinelle, the second _irqsave() overwrites the value<br class="">saved in 'flags' by the first _irqsave(), &nbsp;&nbsp;therefore when the second<br class="">_irqrestore() comes,the value in 'flags' is not valid,the value saved<br class="">by the first _irqsave() has been lost.<br class="">This likely leads to IRQs remaining disabled. So remove the second<br class="">_irqsave():<br class="">spin_lock_irqsave(&amp;adapter-&gt;state_lock, flags);<br class="">spin_lock(&amp;adapter-&gt;rwi_lock);<br class=""><br class="">Generated by: ./scripts/coccinelle/locks/flags.cocci<br class="">./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18:<br class="">ERROR: nested lock+irqsave that reuses flags from line 5404.<br class=""><br class="">Fixes: 4a41c421f367 ("ibmvnic: serialize access to work queue on remove")<br class="">Signed-off-by: Junlin Yang &lt;<a href="mailto:yangjunlin@yulong.com" class="">yangjunlin@yulong.com</a>&gt;<br class="">---<br class=""></div></div></blockquote><div><br class=""></div><div>Acked-by: Lijun Pan &lt;<a href="mailto:ljp@linux.ibm" class="">ljp@linux.ibm</a>.com&gt;</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">Changes in v1:<br class=""><span class="Apple-tab-span" style="white-space:pre">	</span>a.According to Christophe Leroy's explanation, update the commit information.<br class=""><span class="Apple-tab-span" style="white-space:pre">	</span>b.Add fixes tags.<br class=""><br class=""> drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--<br class=""> 1 file changed, 2 insertions(+), 2 deletions(-)<br class=""><br class="">diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c<br class="">index 2464c8a..a52668d 100644<br class="">--- a/drivers/net/ethernet/ibm/ibmvnic.c<br class="">+++ b/drivers/net/ethernet/ibm/ibmvnic.c<br class="">@@ -5408,9 +5408,9 @@ static void ibmvnic_remove(struct vio_dev *dev)<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span> * after setting state, so __ibmvnic_reset() which is called<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span> * from the flush_work() below, can make progress.<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span> */<br class="">-<span class="Apple-tab-span" style="white-space:pre">	</span>spin_lock_irqsave(&amp;adapter-&gt;rwi_lock, flags);<br class="">+<span class="Apple-tab-span" style="white-space:pre">	</span>spin_lock(&amp;adapter-&gt;rwi_lock);<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>adapter-&gt;state = VNIC_REMOVING;<br class="">-<span class="Apple-tab-span" style="white-space:pre">	</span>spin_unlock_irqrestore(&amp;adapter-&gt;rwi_lock, flags);<br class="">+<span class="Apple-tab-span" style="white-space:pre">	</span>spin_unlock(&amp;adapter-&gt;rwi_lock);<br class=""><br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>spin_unlock_irqrestore(&amp;adapter-&gt;state_lock, flags);<br class=""><br class="">-- <br class="">1.9.1<br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></div></body></html>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help