[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1596047349.4356.84.camel@HansenPartnership.com>
Date: Wed, 29 Jul 2020 11:29:09 -0700
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Alan Stern <stern@...land.harvard.edu>,
Martin Kepplinger <martin.kepplinger@...i.sm>
Cc: Bart Van Assche <bvanassche@....org>,
Can Guo <cang@...eaurora.org>, martin.petersen@...cle.com,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...i.sm
Subject: Re: [PATCH] scsi: sd: add runtime pm to open / release
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
Powered by blists - more mailing lists