lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8e1ec6a0-38db-414e-90da-4d04ea8d6be2@acm.org>
Date: Tue, 22 Oct 2024 09:51:26 -0700
From: Bart Van Assche <bvanassche@....org>
To: Avri Altman <avri.altman@....com>,
 "Martin K . Petersen" <martin.petersen@...cle.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] scsi: ufs: core: Remove redundant host_lock calls
 around UTMRLDBR.

On 10/22/24 12:43 AM, Avri Altman wrote:
> @@ -6877,13 +6874,13 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba, u32 intr_status)
>    */
>   static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba)
>   {
> -	unsigned long flags, pending, issued;
> +	unsigned long flags;
> +	unsigned long pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL);
> +	unsigned long issued = hba->outstanding_tasks & ~pending;
>   	irqreturn_t ret = IRQ_NONE;
>   	int tag;
>   
>   	spin_lock_irqsave(hba->host->host_lock, flags);
> -	pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL);
> -	issued = hba->outstanding_tasks & ~pending;

Please keep the 'pending' and 'issued' assignments in the function body. 
Initializing variables in the declaration block is fine but adding code 
in the declaration block that has side effects is a bit controversial.

>   	for_each_set_bit(tag, &issued, hba->nutmrs) {
>   		struct request *req = hba->tmf_rqs[tag];
>   		struct completion *c = req->end_io_data;

Would it be sufficient to hold the SCSI host lock around the 
hba->outstanding_tasks read only? I don't think that the
for_each_set_bit() loop needs to be protected with the SCSI host lock.

Otherwise this patch looks good to me.

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ