<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 06/26/2015 11:40 AM, Alistair Popple
      wrote:<br>
    </div>
    <blockquote cite="mid:2730144.jUjSsTh7mo@mexican" type="cite">
      <pre wrap="">Hi Neelesh,

I can't quite see the race here? The list (and the bt state) should only be 
updated with the lock held. Once we have read a response the bt device is idle 
and ready to send another message. It shouldn't matter if something gets added 
to the list as it will just be picked up for sending by the bt_poll() 
function.</pre>
    </blockquote>
    <br>
    <small>So, this patch depends upon [PATCH 1/2] of this series.</small>
    <small>If we set the state to IDLE<br>
      before ipmi_cmd_done() .. the current outstanding message is still
      there in the<br>
      queue and chances are to be picked up again by the bt_poll()..<br>
      <br>
      Neelesh.<br>
    </small><br>
    <blockquote cite="mid:2730144.jUjSsTh7mo@mexican" type="cite">
      <pre wrap="">

Regards,

Alistair

On Wed, 24 Jun 2015 22:40:59 Neelesh Gupta wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">It is racy to update the BT state before dequeuing the message
through ipmi_cmd_done() as there is chance of new message to
fiddle the list.

Signed-off-by: Neelesh Gupta <a class="moz-txt-link-rfc2396E" href="mailto:neelegup@linux.vnet.ibm.com"><neelegup@linux.vnet.ibm.com></a>
---
 hw/bt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/bt.c b/hw/bt.c
index 9aa86b9..5b523d3 100644
--- a/hw/bt.c
+++ b/hw/bt.c
@@ -262,8 +262,6 @@ static void bt_get_resp(void)
                ipmi_msg->data[i] = bt_inb(BT_HOST2BMC);
        bt_set_h_busy(false);
 
-       bt_set_state(BT_STATE_IDLE);
-
        unlock(&bt.lock);
 
        /*
@@ -276,6 +274,8 @@ static void bt_get_resp(void)
        ipmi_cmd_done(cmd, netfn, cc, ipmi_msg);
        lock(&bt.lock);
 
+       bt_set_state(BT_STATE_IDLE);
+
        return;
 }
 

_______________________________________________
Skiboot mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Skiboot@lists.ozlabs.org">Skiboot@lists.ozlabs.org</a>
<a class="moz-txt-link-freetext" href="https://lists.ozlabs.org/listinfo/skiboot">https://lists.ozlabs.org/listinfo/skiboot</a>

</pre>
      </blockquote>
      <pre wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>