Re: [PATCH 2/9] lpfc: Maintain atomic consistency of queue_claimed flag

Hannes Reinecke
2020-05-07T09:12:40Z

On 5/1/20 11:43 PM, James Smart wrote:
> A previous change introduced the atomic use of queue_claimed flag for
> eq's and cq's. The code works fine, but the clearing of the
> queue_claimed flag is not atomic.
>
> Change queue_claimed = 0 into xchg(&queue_claimed, 0) to be consistent
> for change under atomicity.
>
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>
> ---
> drivers/scsi/lpfc/lpfc_sli.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
> index b6fb665e6ec4..9ce37560f4c0 100644
> --- a/drivers/scsi/lpfc/lpfc_sli.c
> +++ b/drivers/scsi/lpfc/lpfc_sli.c
> @@ -538,7 +538,7 @@ lpfc_sli4_process_eq(struct lpfc_hba *phba, struct lpfc_queue *eq,
> if (count > eq->EQ_max_eqe)
> eq->EQ_max_eqe = count;
>
> - eq->queue_claimed = 0;
> + xchg(&eq->queue_claimed, 0);
>
> rearm_and_exit:
> /* Always clear the EQ. */
> @@ -13694,7 +13694,7 @@ __lpfc_sli4_process_cq(struct lpfc_hba *phba, struct lpfc_queue *cq,
> "0369 No entry from completion queue "
> "qid=%d\n", cq->queue_id);
>
> - cq->queue_claimed = 0;
> + xchg(&cq->queue_claimed, 0);
>
> rearm_and_exit:
> phba->sli4_hba.sli4_write_cq_db(phba, cq, consumed,
>
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer