All of lore.kernel.org
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org,
	hongwus@codeaurora.org, linux-scsi@vger.kernel.org,
	kernel-team@android.com, Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/6] scsi: ufs: Let host_sem cover the entire system suspend/resume
Date: Tue, 25 May 2021 10:04:23 +0800	[thread overview]
Message-ID: <423285a089b7dc3fcfcb169e0a553e8a@codeaurora.org> (raw)
In-Reply-To: <19b44731-1a4f-c88c-58fd-05eca5df2c2e@acm.org>

Hi Bart,

On 2021-05-25 00:56, Bart Van Assche wrote:
> On 5/24/21 1:47 AM, Can Guo wrote:
>> UFS error handling now is doing more than just re-probing, but also 
>> sending
>> scsi cmds, e.g., for clearing UACs, and recovering runtime PM error, 
>> which
>> may change runtime status of scsi devices. To protect system 
>> suspend/resume
>> from being disturbed by error handling, move the host_sem from wl pm 
>> ops
>> to ufshcd_suspend_prepare() and ufshcd_resume_complete().
> 
> Other SCSI LLDs can perform error handling while system suspend/resume
> is in progress. Why can't the UFS driver do this?

I don't know about other SCSI LLDs, but UFS error handling is basically
doing a re-probe/re-initialization to UFS device. Having UFS error 
handling
running in parallel with system suspend/resume, neither of them will end
up well.

I didn't design all this, it is just happening, I am trying to fix it 
and
semaphore works well for me. I am really glad to see someone cares about
error handling and fix it with better ideas (maybe using WQ_FREEZABLE) 
later.

> 
> Additionally, please document what the purpose of host_sem is before
> making any changes to how host_sem is used. The only documentation I
> have found of host_sem is the following: "* @host_sem: semaphore used 
> to
> serialize concurrent contexts". To me that text is less than useful
> since semaphores are almost always used to serialize concurrent code.
> 

Sure, host_sem is actually preventing cocurrency happens among any of
contexts, such as sysfs access, shutdown, error handling, system
suspend/resume and async probe, I will update its message in next 
version.

Thanks,

Can Guo.

> Thanks,
> 
> Bart.

  reply	other threads:[~2021-05-25  2:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24  8:47 [PATCH v2 0/6] Complementary changes for error handling Can Guo
2021-05-24  8:47 ` [PATCH v2 1/6] scsi: ufs: Differentiate status between hba pm ops and wl pm ops Can Guo
2021-05-24  8:47 ` [PATCH v2 2/6] scsi: ufs: Update the return value of supplier " Can Guo
2021-05-24  8:47 ` [PATCH v2 3/6] scsi: ufs: Simplify error handling preparation Can Guo
2021-05-24  8:47 ` [PATCH v2 4/6] scsi: ufs: Update ufshcd_recover_pm_error() Can Guo
2021-05-24  8:47 ` [PATCH v2 5/6] scsi: ufs: Let host_sem cover the entire system suspend/resume Can Guo
2021-05-24 16:56   ` Bart Van Assche
2021-05-25  2:04     ` Can Guo [this message]
2021-05-24  8:47 ` [PATCH v2 6/6] scsi: ufs: Update the fast abort path in ufshcd_abort() for PM requests Can Guo

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=423285a089b7dc3fcfcb169e0a553e8a@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=hongwus@codeaurora.org \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nguyenb@codeaurora.org \
    --cc=stanley.chu@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.