Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1226320ybg; Wed, 29 Jul 2020 08:47:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwejFVBiFVbdAbogJKyTZ5SIc8YlukNIcTxnI+XFJMiHNxRMAArp7mZUjzk1+vfsfyyvE53 X-Received: by 2002:a05:6402:cb9:: with SMTP id cn25mr32433326edb.247.1596037659727; Wed, 29 Jul 2020 08:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596037659; cv=none; d=google.com; s=arc-20160816; b=bitfSz3X/HoTouW8G+toX7GKYogiWgKK+2Jy1HtlbYpK/rZzJYde9lcx0/OP6tW+XU 5P8vx1XhWeJ/neRn3pUNDMNWcesKTvu5SIy+e7sYA9EEXYvlQFuIMbr+AGiUTo2/tILX qxNAizNIIxC8+JLi49d8X0Wb0fkUXO/lQKcf0PXLX6zDiVfR8WpOLw9kQgfuJ8/+IM0U 1FaGMsve5NVXse6pWsq6a0rTWvcvTEaUVutQkkmGHxemyAcc9tYbA5O4cRj2h35rUj68 /0oJNsYkhdJX7Lyc+gGyUJI1gfWoaUkqpGLg++q7nD0LlkmtdhqeFq7Yo0kegQODDoef wiFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=z1UBgfeyVt/aQQiSnaQuGdSDiyF2XjRiIbOKjA6uYxU=; b=L83mrTmQmEH4uZrPF5MNgj2jSYk4aocgzRLMXKreCub0O+sHbbQD7JmX8uzW7MekQ1 rWJRlabbWBgFnNiM/CrrO5yt5dkAe/EirWNH3pPBMjbcMhXdmA+lMdfhHiaR/Q9+Iq/z 0OItEjkjNJuVQE1Mw2uP6pYN8p6icEbvknUEw8qikbY6UnM+lzXlTju1bt0FJlaIYMyd L7LiasQ1fWSnGN9OcW4Ul5Sqmj0LYq0bbGWl7Si+m4QA71UgFCdz7eS4e5+//8KFX9IJ 7KJzvuxSLOIXNn7P14XuV/cXbg1uL59Rfs+DKK9lZ618c+5flEtHX7aGZt9LGg0nIjgF h46Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b="L/xA8fPm"; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=HWYHAw9U; 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=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l23si1415756ejb.632.2020.07.29.08.47.17; Wed, 29 Jul 2020 08:47:39 -0700 (PDT) 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; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b="L/xA8fPm"; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=HWYHAw9U; 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=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbgG2Por (ORCPT + 99 others); Wed, 29 Jul 2020 11:44:47 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:34838 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbgG2Poq (ORCPT ); Wed, 29 Jul 2020 11:44:46 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 445AA8EE207; Wed, 29 Jul 2020 08:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1596037485; bh=3mOIs2ifi3nTeb9BjuImOqvUaL8Iv8D1+iiZHrYapUU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=L/xA8fPmwryXUcwkoKaOIQykeQbgLmTup47RtrHu81/zNaG3Gzl3YCEKFJKIWgMPU plCnLaFu9XP/zUHUXkDMaiP0II3pfZwrFrNwNXzIaaY5ZzCw/ukXTmdzifYIknFJAU dfjlMLRzlnLURsr4OgwvkEjo3cvteL/jM5M8JGgQ= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cEySqEXtdr8Z; Wed, 29 Jul 2020 08:44:45 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.35.76.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 4208A8EE100; Wed, 29 Jul 2020 08:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1596037484; bh=3mOIs2ifi3nTeb9BjuImOqvUaL8Iv8D1+iiZHrYapUU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=HWYHAw9UfcsTXYRSYP02AUyh84X9B2lk92U19rYJJcvEukkbWDiL1zNgeWI9opm/l ST5q3a++TE8UqtAMoABHEitYaniGY/dHm6bFSDC0p19sMiu/FG2uQA3XR4azFz/fhq fMIthf9k1Vz8hb4UNcO/mZIayMq9nR8IG7dKj38Q= Message-ID: <1596037482.4356.37.camel@HansenPartnership.com> Subject: Re: [PATCH] scsi: sd: add runtime pm to open / release From: James Bottomley To: Martin Kepplinger , Alan Stern Cc: Bart Van Assche , Can Guo , martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@puri.sm Date: Wed, 29 Jul 2020 08:44:42 -0700 In-Reply-To: References: <20200706164135.GE704149@rowland.harvard.edu> <20200728200243.GA1511887@rowland.harvard.edu> <20200729143213.GC1530967@rowland.harvard.edu> <1596033995.4356.15.camel@linux.ibm.com> <1596034432.4356.19.camel@HansenPartnership.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-07-29 at 17:40 +0200, Martin Kepplinger wrote: > On 29.07.20 16:53, James Bottomley wrote: > > On Wed, 2020-07-29 at 07:46 -0700, James Bottomley wrote: > > > On Wed, 2020-07-29 at 10:32 -0400, Alan Stern wrote: [...] > > > > This error report comes from the SCSI layer, not the block > > > > layer. > > > > > > That sense code means "NOT READY TO READY CHANGE, MEDIUM MAY HAVE > > > CHANGED" so it sounds like it something we should be > > > ignoring. Usually this signals a problem, like you changed the > > > medium manually (ejected the CD). But in this case you can tell > > > us to expect this by setting > > > > > > sdev->expecting_cc_ua > > > > > > And we'll retry. I think you need to set this on all resumed > > > devices. > > > > Actually, it's not quite that easy, we filter out this ASC/ASCQ > > combination from the check because we should never ignore medium > > might have changed events on running devices. We could ignore it > > if we had a flag to say the power has been yanked (perhaps an > > additional sdev flag you set on resume) but we would still miss the > > case where you really had powered off the drive and then changed > > the media ... if you can regard this as the user's problem, then we > > might have a solution. > > > > James > > > > oh I see what you mean now, thanks for the ellaboration. > > if I do the following change, things all look normal and runtime pm > works. I'm not 100% sure if just setting expecting_cc_ua in resume() > is "correct" but that looks like it is what you're talking about: > > (note that this is of course with the one block layer diff applied > that Alan posted a few emails back) > > > --- 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