lkml.org 
[lkml]   [2020]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] scsi: sd: add runtime pm to open / release
From
Date
On Wed, 2020-07-29 at 14:25 -0400, Alan Stern wrote:
> On Wed, Jul 29, 2020 at 06:43:48PM +0200, Martin Kepplinger wrote:
[...]
> > > > --- a/drivers/scsi/scsi_error.c
> > > > +++ b/drivers/scsi/scsi_error.c
> > > > @@ -554,16 +554,8 @@ int scsi_check_sense(struct scsi_cmnd
> > > > *scmd)
> > > > * so that we can deal with it there.
> > > > */
> > > > if (scmd->device->expecting_cc_ua) {
> > > > - /*
> > > > - * Because some device does not queue
> > > > unit
> > > > - * attentions correctly, we carefully
> > > > check
> > > > - * additional sense code and qualifier
> > > > so as
> > > > - * not to squash media change unit
> > > > attention.
> > > > - */
> > > > - if (sshdr.asc != 0x28 || sshdr.ascq !=
> > > > 0x00)
> > > > {
> > > > - scmd->device->expecting_cc_ua =
> > > > 0;
> > > > - return NEEDS_RETRY;
> > > > - }
> > > > + scmd->device->expecting_cc_ua = 0;
> > > > + return NEEDS_RETRY;
> > >
> > > Well, yes, but you can't do this because it would lose us media
> > > change events in the non-suspend/resume case which we really
> > > don't want. That's why I was suggesting a new flag.
> > >
> > > James
> >
> > also if I set expecting_cc_ua in resume() only, like I did?
>
> That wouldn't make any difference. The information sent by your
> card reader has sshdr.asc == 0x28 and sshdr.ascq == 0x00 (you can see
> it in the log). So because of the code here in scsi_check_sense(),
> which you can't change, the Unit Attention sent by the card reader
> would not be retried even if you do set the flag in resume().

But if we had a new flag, like expecting_media_change, you could set
that in resume and we could condition the above test in the code on it
and reset it and do a retry if it gets set. I'm not saying we have to
do it this way, but it sounds like we have to do something in the
kernel, so I think the flag will become necessary but there might be a
bit of policy based dance around how it gets set in the kernel (to
avoid losing accurate media change events).

James

\
 
 \ /
  Last update: 2020-07-29 20:30    [W:1.208 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site