mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
To: Bart Van Assche <bvanassche@acm.org>, <quic_cang@quicinc.com>,
	<quic_nitirawa@quicinc.com>, <avri.altman@wdc.com>,
	<peter.wang@mediatek.com>, <manivannan.sadhasivam@linaro.org>,
	<minwoo.im@samsung.com>, <adrian.hunter@intel.com>,
	<martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Bean Huo <beanhuo@micron.com>,
	Ziqi Chen <quic_ziqichen@quicinc.com>,
	Keoseong Park <keosung.park@samsung.com>,
	Gwendal Grignou <gwendal@chromium.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Eric Biggers <ebiggers@google.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] scsi: ufs: core: add device level exception support
Date: Tue, 18 Mar 2025 23:56:55 -0700	[thread overview]
Message-ID: <8d268fec-98e9-ab70-5b82-3a492895e565@quicinc.com> (raw)
In-Reply-To: <98b420e3-87ee-4034-8cb4-76b8e30d7920@acm.org>

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

      reply	other threads:[~2025-03-19  6:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 22:55 Bao D. Nguyen
2025-03-18  2:40 ` Peter Wang (王信友)
2025-03-18 21:21 ` Bart Van Assche
2025-03-19  6:56   ` Bao D. Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d268fec-98e9-ab70-5b82-3a492895e565@quicinc.com \
    --to=quic_nguyenb@quicinc.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=ebiggers@google.com \
    --cc=gwendal@chromium.org \
    --cc=keosung.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=minwoo.im@samsung.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_ziqichen@quicinc.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®