[Skiboot] [PATCH 2/2] hw/bt: Update the BT state after completion

Alistair Popple alistair at popple.id.au
Fri Jun 26 16:10:48 AEST 2015


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.

Regards,

Alistair

On Wed, 24 Jun 2015 22:40:59 Neelesh Gupta wrote:
> 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 <neelegup at linux.vnet.ibm.com>
> ---
>  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
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
> 



More information about the Skiboot mailing list