Re: [PATCH v2] scsi: core: pair EH runtime PM get and put

Alan Stern <[email protected]>
Newsgroups org.kernel.vger.linux-scsi,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Tue, Jul 28, 2026 at 02:22:29AM +0000, Fang Hongjie(方洪杰) wrote:
> Thanks Alan.
> I agree that a plain local variable is not enough for a compiler-level
> snapshot.
> There is one extra detail here: shost->eh_noresume is currently a
> bitfield:
>         unsigned eh_noresume:1;
> so READ_ONCE(shost->eh_noresume) cannot be used directly because
> READ_ONCE() takes the address of its argument.
> 
> My plan for v3 is to first make eh_noresume a regular bool, then use
> READ_ONCE() in scsi_error_handler() to snapshot it once per EH iteration.
> I will also use WRITE_ONCE() for the writer that changes eh_noresume while
> SCSI EH may observe it.
> 
> Does this approach look reasonable to you?

That should be fine.

Alan Stern
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.