[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8d268fec-98e9-ab70-5b82-3a492895e565@quicinc.com>
Date: Tue, 18 Mar 2025 23:56:55 -0700
From: "Bao D. Nguyen" <quic_nguyenb@...cinc.com>
To: Bart Van Assche <bvanassche@....org>, <quic_cang@...cinc.com>,
<quic_nitirawa@...cinc.com>, <avri.altman@....com>,
<peter.wang@...iatek.com>, <manivannan.sadhasivam@...aro.org>,
<minwoo.im@...sung.com>, <adrian.hunter@...el.com>,
<martin.petersen@...cle.com>
CC: <linux-scsi@...r.kernel.org>, Alim Akhtar <alim.akhtar@...sung.com>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
Bean Huo
<beanhuo@...ron.com>, Ziqi Chen <quic_ziqichen@...cinc.com>,
Keoseong Park
<keosung.park@...sung.com>,
Gwendal Grignou <gwendal@...omium.org>,
Al Viro
<viro@...iv.linux.org.uk>, Eric Biggers <ebiggers@...gle.com>,
open list
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] scsi: ufs: core: add device level exception
support
On 3/18/2025 2:21 PM, Bart Van Assche wrote:
> On 3/14/25 3:55 PM, Bao D. Nguyen wrote:
>> + if (status & hba->ee_drv_mask & MASK_EE_DEV_LVL_EXCEPTION) {
>> + hba->dev_lvl_exception_count++;
>> + sysfs_notify(&hba->dev->kobj, NULL,
>> "device_lvl_exception_count");
>> + }
> This increment can race with the code in
> device_lvl_exception_count_store() for clearing
> hba->dev_lvl_exception_count. Shouldn't the clearing code and the
> code for incrementing hba->dev_lvl_exception_count be serialized in
> some way?
Thank you for the good catch, Bart. I do need to protect this racing
condition in the functions you mentioned. This dev_lvl_exception_count
variable is also initialized in the ufshcd_device_lvl_exception_probe()
function at which point the sysfs nodes have already been initialized,
but since both the device_lvl_exception_count_store() and the
ufshcd_device_lvl_exception_probe() write 0 to dev_lvl_exception_count,
it should be no problem there.
I will fix it.
Thanks, Bao
Powered by blists - more mailing lists