Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2347586pxb; Mon, 11 Jan 2021 07:25:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXypVn/lS5xmMeowYVllevY67pn8mKvAPE5zpmVEX3Fedostw5zTt4kI61CQmJnu9ubgs1 X-Received: by 2002:a17:906:ca08:: with SMTP id jt8mr9899ejb.368.1610378744340; Mon, 11 Jan 2021 07:25:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610378744; cv=none; d=google.com; s=arc-20160816; b=AaouFEgGF/kDlQvJYrs0j70xTcwE9owFkKOO0/i5Btq6sQBTiw2uLHfT1wLp+l2h8d kGMXQeL/EMO1avb5rXQYKdrzRYGTN6xTiROqfgwnkC4Bn2D+AnR7uNOo+cU729ipdkBy VwgJ53g8dsMt25o9TSsFF96N/4pIL2dO0kmUMCVA00wy8J3erp8fT9dBaVKjzgdNFrBg +JZEdEoQEYeAMQYpgK4imO/nWth5lTIfuWheP6y9nUFTM5o4pobF4qbtRyMF//hul6v4 GU9gk5jtEEAOpQ7+DuEROvmTaZ+034gNqAEbBAB002GNuOl2B6T4t29bSIC28K2tevBn P9SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:date :subject:cc:to:from; bh=O/09vXVKA3sWM1r5+3P6j8NT3sLbHYnbimJCbVV0NHo=; b=K4GO+uAeCy20/D9E0UYhSWcyTZTKxop2z8NorKAVoOK2IYephr6ikRte6GX6CzC/He Lu5T3AmKN/AUYbHsi8jgxTvLCq6U2dBBkDCWOcaE/1VnbHnwOM0UR4gqO/Y6rUES+cJs EiKdQlOtR1icuCRR8PgT/niPfTrkFwQhzvQbUOKxf83dvbvH3CprQCdqta2A8iCe3muS c2GGCU4qMWiFAXMJRTgiQkL9dm1WqexrjqBGvxfFBqle9bpuY0u6cNjTVuzz6/JDCTJw 4yWVmXbKDH9aMcP5ORsaV9Zpp9ck7CkQdcxyWdZp5WLZvO6bhyDj9DaMaBINOoOb7J2t VkDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg3si5033610ejc.744.2021.01.11.07.25.19; Mon, 11 Jan 2021 07:25:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731470AbhAKPWF (ORCPT + 99 others); Mon, 11 Jan 2021 10:22:05 -0500 Received: from comms.puri.sm ([159.203.221.185]:56910 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731265AbhAKPWF (ORCPT ); Mon, 11 Jan 2021 10:22:05 -0500 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id D9A30DFC6D; Mon, 11 Jan 2021 07:20:54 -0800 (PST) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sGzUa2dyemW6; Mon, 11 Jan 2021 07:20:54 -0800 (PST) From: Martin Kepplinger To: jejb@linux.ibm.com, martin.petersen@oracle.com, stern@rowland.harvard.edu, bvanassche@acm.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH 0/3] scsi: add runtime PM workaround for SD cardreaders Date: Mon, 11 Jan 2021 16:20:26 +0100 Message-Id: <20210111152029.28426-1-martin.kepplinger@puri.sm> Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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