mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ZhangHui <zhanghui31@xiaomi.com>
To: <ebiggers@kernel.org>
Cc: <James.Bottomley@hansenpartnership.com>,
	<alim.akhtar@samsung.com>, <avri.altman@wdc.com>,
	<bvanassche@acm.org>, <linux-kernel@vger.kernel.org>,
	<linux-scsi@vger.kernel.org>, <martin.petersen@oracle.com>,
	<peter.griffin@linaro.org>, <zhanghui31@xiaomi.com>
Subject: Re: [PATCH] ufs: crypto: add host_sem lock in ufshcd_program_key
Date: Fri, 21 Mar 2025 15:45:23 +0800	[thread overview]
Message-ID: <20250321074524.126338-1-zhanghui31@xiaomi.com> (raw)
In-Reply-To: <20250321044455.GB98513@sol.localdomain>

On Thu, Mar 20, 2025 at 09:44:55PM -0700, Eric Biggers wrote:
> It seems broken that the filesystem doesn't get unmounted until after the UFS is
> shut down.  It would be helpful to get a clearer picture of exactly why things
> are happening in that order.
> 
> But disregarding that, it's indeed logical for blk_crypto_evict_key() to return
> an error if it cannot fulfill the request.
> 
> But I'm wondering if this needs to be solved in the UFS driver itself or whether
> the blk-crypto framework should handle this (so that it also gets fixed for
> other drivers that may have the same problem).  In block/blk-crypto-profile.c,
> pm_runtime_get_sync() is already called before ->keyslot_evict.  So
> ->keyslot_evict is supposed to be called only when the device is resumed.
> 
> The blk-crypto code (in blk_crypto_hw_enter()) doesn't check the return value of
> pm_runtime_get_sync(), though.  That seems like a bug.  Is it possible this
> issue would be fixed if it checked the return value?
> 

hi Eric,

I have checked the device_shutdown process and it seems only wait for the resume
that has not been processed to be completed, and then continue. It does not seem
to cause pm_runtime_get_sync to return an error.

> Or does the UFS driver still need to check ufshcd_is_user_access_allowed() too?
> If that's the case, I'm also wondering whether it's okay to nest host_sem inside
> pm_runtime_get_sync().  Elsewhere in the UFS driver they are called in the
> opposite order.

I found that ufshcd_is_user_access_allowed is used in many places in the ufs driver
code. What is the historical reason for this?

thanks
zhanghui


  reply	other threads:[~2025-03-21  7:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 11:01 ZhangHui
2025-03-17 22:32 ` Bart Van Assche
2025-03-19  3:17   ` ZhangHui
2025-03-21  4:44 ` Eric Biggers
2025-03-21  7:45   ` ZhangHui [this message]
2025-03-21 16:53     ` Bart Van Assche

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=20250321074524.126338-1-zhanghui31@xiaomi.com \
    --to=zhanghui31@xiaomi.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=ebiggers@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=peter.griffin@linaro.org \
    /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®