public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] scsi: add runtime PM workaround for SD cardreaders
@ 2021-01-11 15:20 Martin Kepplinger
  2021-01-11 15:20 ` [PATCH 1/3] scsi: add expecting_media_change flag to error path Martin Kepplinger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin Kepplinger @ 2021-01-11 15:20 UTC (permalink / raw)
  To: jejb, martin.petersen, stern, bvanassche
  Cc: linux-scsi, linux-kernel, Martin Kepplinger

hi,

In short: there are SD cardreaders that send MEDIA_CHANGED on
runtime resume. We cannot use runtime PM with these devices as
I/O basically always fails. I'd like to discuss a way to fix this
or at least allow users to work around this problem:

For the full background, the discussion started in June 2020 here:
https://lore.kernel.org/linux-scsi/20200623111018.31954-1-martin.kepplinger@puri.sm/

and I sent the first of these patches in August, as a reference:
https://lore.kernel.org/linux-scsi/20200824190400.12339-1-martin.kepplinger@puri.sm/
so this is where I'm following up on.

I'm not sure whether maintaining an in-kernel quirk for specific devices
makes sense so here I suggest adding a userspace setting. Of course we should
document it properly if this makes sense to you. But this way there's at least
a chance to use runtime PM for sd cardreaders that send MEDIA_CHANGED.

Questions would be:
* Do you like the approach of a user+internal flag?
* what to do in scsi drivers that ignore the flag? Is documentation enough?
* review the *clearing* of the (internal) flag once again. the first
  occurrence of MEDIA_CHANGED should do that only. (note to myself)

I'd appreciate any feedback.


Martin Kepplinger (3):
  scsi: add expecting_media_change flag to error path
  scsi: add expect_media_change_suspend sysfs device setting
  scsi: sd: add support for expect_media_change_suspend flag

 drivers/scsi/scsi_error.c  | 36 +++++++++++++++++++++++++++++++-----
 drivers/scsi/scsi_sysfs.c  | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/scsi/sd.c          | 21 ++++++++++++++++++++-
 include/scsi/scsi_device.h |  3 +++
 4 files changed, 92 insertions(+), 6 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-11 17:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-11 15:20 [PATCH 0/3] scsi: add runtime PM workaround for SD cardreaders Martin Kepplinger
2021-01-11 15:20 ` [PATCH 1/3] scsi: add expecting_media_change flag to error path Martin Kepplinger
2021-01-11 15:20 ` [PATCH 2/3] scsi: add expect_media_change_suspend sysfs device setting Martin Kepplinger
2021-01-11 15:20 ` [PATCH 3/3] scsi: sd: add support for expect_media_change_suspend flag Martin Kepplinger
2021-01-11 15:31   ` Martin Kepplinger
2021-01-11 17:37   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox