[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <303bbfad-edde-1197-679e-4a09175fb1f3@suse.de>
Date: Mon, 20 Jun 2022 08:00:38 +0200
From: Hannes Reinecke <hare@...e.de>
To: John Garry <john.garry@...wei.com>, jinpu.wang@...ud.ionos.com,
jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
damien.lemoal@...nsource.wdc.com, Ajish.Koshy@...rochip.com
Subject: Re: [PATCH 3/4] scsi: pm8001: Use non-atomic bitmap ops for tag alloc
+ free
On 6/10/22 18:46, John Garry wrote:
> In pm8001_tag_alloc() we don't require atomic set_bit() as we are already
> in atomic context. In pm8001_tag_free() we should use the same host
> spinlock to protect clearing the tag (and then don't require the atomic
> clear_bit()).
>
> Signed-off-by: John Garry <john.garry@...wei.com>
> ---
> drivers/scsi/pm8001/pm8001_sas.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index 3a863d776724..8e3f2f9ddaac 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -66,7 +66,11 @@ static int pm8001_find_tag(struct sas_task *task, u32 *tag)
> void pm8001_tag_free(struct pm8001_hba_info *pm8001_ha, u32 tag)
> {
> void *bitmap = pm8001_ha->tags;
> - clear_bit(tag, bitmap);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&pm8001_ha->bitmap_lock, flags);
> + __clear_bit(tag, bitmap);
> + spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags);
> }
>
This spin lock is pretty much pointless; clear_bit() is always atomic.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@...e.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman
Powered by blists - more mailing lists