All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Avoid that a kernel warning appears during system resume
@ 2019-03-15 23:27 Bart Van Assche
  2019-03-16 10:43 ` Martin Steigerwald
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bart Van Assche @ 2019-03-15 23:27 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Jens Axboe, Bart Van Assche, Christoph Hellwig,
	Hannes Reinecke, Ming Lei, Johannes Thumshirn,
	Oleksandr Natalenko, Martin Steigerwald, stable, Jisheng Zhang

Since scsi_device_quiesce() skips SCSI devices that have another state
than RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume() should
not complain about SCSI devices that have been skipped. Hence this patch.
This patch avoids that the following warning appears during resume:

WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30
CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1
Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 ) 05/10/2013
Workqueue: events_unbound async_run_entry_fn
RIP: 0010:blk_clear_pm_only+0x2a/0x30
Call Trace:
 ? scsi_device_resume+0x28/0x50
 ? scsi_dev_type_resume+0x2b/0x80
 ? async_run_entry_fn+0x2c/0xd0
 ? process_one_work+0x1f0/0x3f0
 ? worker_thread+0x28/0x3c0
 ? process_one_work+0x3f0/0x3f0
 ? kthread+0x10c/0x130
 ? __kthread_create_on_node+0x150/0x150
 ? ret_from_fork+0x1f/0x30

Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
Cc: Martin Steigerwald <martin@lichtvoll.de>
Cc: <stable@vger.kernel.org>
Reported-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Tested-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work reliably") # v4.15
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 324f830ee9fa..54ad751b42b8 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2541,8 +2541,10 @@ void scsi_device_resume(struct scsi_device *sdev)
 	 * device deleted during suspend)
 	 */
 	mutex_lock(&sdev->state_mutex);
-	sdev->quiesced_by = NULL;
-	blk_clear_pm_only(sdev->request_queue);
+	if (sdev->quiesced_by) {
+		sdev->quiesced_by = NULL;
+		blk_clear_pm_only(sdev->request_queue);
+	}
 	if (sdev->sdev_state == SDEV_QUIESCE)
 		scsi_device_set_state(sdev, SDEV_RUNNING);
 	mutex_unlock(&sdev->state_mutex);
-- 
2.21.0.155.ge902e9bcae20


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

* Re: [PATCH] Avoid that a kernel warning appears during system resume
  2019-03-15 23:27 [PATCH] Avoid that a kernel warning appears during system resume Bart Van Assche
@ 2019-03-16 10:43 ` Martin Steigerwald
  2019-03-16 21:28   ` Bart Van Assche
  2019-03-19 18:27 ` Martin K. Petersen
       [not found] ` <20190325003830.8BA272147C@mail.kernel.org>
  2 siblings, 1 reply; 7+ messages in thread
From: Martin Steigerwald @ 2019-03-16 10:43 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	Jens Axboe, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Johannes Thumshirn, Oleksandr Natalenko, stable, Jisheng Zhang

Hi Bart.

Bart Van Assche - 16.03.19, 00:27:
> Since scsi_device_quiesce() skips SCSI devices that have another state
> than RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume()
> should not complain about SCSI devices that have been skipped. Hence
> this patch. This patch avoids that the following warning appears
> during resume:

Am I on CC cause one of those warnings appeared in bug reports from me 
from quite some time ago?

> WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30
> CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1
> Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 )

This at least does not appear to be this ThinkPad T520, as I have BIOS 
version 1.49 already.

Thanks and have good weekend,
Martin

> 05/10/2013 Workqueue: events_unbound async_run_entry_fn
> RIP: 0010:blk_clear_pm_only+0x2a/0x30
> Call Trace:
>  ? scsi_device_resume+0x28/0x50
>  ? scsi_dev_type_resume+0x2b/0x80
>  ? async_run_entry_fn+0x2c/0xd0
>  ? process_one_work+0x1f0/0x3f0
>  ? worker_thread+0x28/0x3c0
>  ? process_one_work+0x3f0/0x3f0
>  ? kthread+0x10c/0x130
>  ? __kthread_create_on_node+0x150/0x150
>  ? ret_from_fork+0x1f/0x30
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
> Cc: Martin Steigerwald <martin@lichtvoll.de>
> Cc: <stable@vger.kernel.org>
> Reported-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> Tested-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work
> reliably") # v4.15 Signed-off-by: Bart Van Assche
> <bvanassche@acm.org>
> ---
>  drivers/scsi/scsi_lib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 324f830ee9fa..54ad751b42b8 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2541,8 +2541,10 @@ void scsi_device_resume(struct scsi_device
> *sdev) * device deleted during suspend)
>  	 */
>  	mutex_lock(&sdev->state_mutex);
> -	sdev->quiesced_by = NULL;
> -	blk_clear_pm_only(sdev->request_queue);
> +	if (sdev->quiesced_by) {
> +		sdev->quiesced_by = NULL;
> +		blk_clear_pm_only(sdev->request_queue);
> +	}
>  	if (sdev->sdev_state == SDEV_QUIESCE)
>  		scsi_device_set_state(sdev, SDEV_RUNNING);
>  	mutex_unlock(&sdev->state_mutex);


-- 
Martin



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

* Re: [PATCH] Avoid that a kernel warning appears during system resume
  2019-03-16 10:43 ` Martin Steigerwald
@ 2019-03-16 21:28   ` Bart Van Assche
  2019-03-17 14:20     ` Martin Steigerwald
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2019-03-16 21:28 UTC (permalink / raw)
  To: Martin Steigerwald
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	Jens Axboe, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Johannes Thumshirn, Oleksandr Natalenko, stable, Jisheng Zhang

On 3/16/19 3:43 AM, Martin Steigerwald wrote:
> Bart Van Assche - 16.03.19, 00:27:
>> Since scsi_device_quiesce() skips SCSI devices that have another state
>> than RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume()
>> should not complain about SCSI devices that have been skipped. Hence
>> this patch. This patch avoids that the following warning appears
>> during resume:
> 
> Am I on CC cause one of those warnings appeared in bug reports from me
> from quite some time ago?

Hi Martin,

That's correct. I hope that you don't mind that I cc'ed you?

>> WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30
>> CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1
>> Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 )
> 
> This at least does not appear to be this ThinkPad T520, as I have BIOS
> version 1.49 already.

The call trace in the patch description is only an example. I think the 
problem description and the patch applies to all systems that have one 
or more SCSI disks.

Best regards,

Bart.

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

* Re: [PATCH] Avoid that a kernel warning appears during system resume
  2019-03-16 21:28   ` Bart Van Assche
@ 2019-03-17 14:20     ` Martin Steigerwald
  2019-03-17 17:19       ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Steigerwald @ 2019-03-17 14:20 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	Jens Axboe, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Johannes Thumshirn, Oleksandr Natalenko, stable, Jisheng Zhang

Hi Bart.

Bart Van Assche - 16.03.19, 22:28:
> On 3/16/19 3:43 AM, Martin Steigerwald wrote:
> > Bart Van Assche - 16.03.19, 00:27:
> >> Since scsi_device_quiesce() skips SCSI devices that have another
> >> state than RUNNING, OFFLINE or TRANSPORT_OFFLINE,
> >> scsi_device_resume() should not complain about SCSI devices that
> >> have been skipped. Hence this patch. This patch avoids that the
> >> following warning appears> 
> >> during resume:
> > Am I on CC cause one of those warnings appeared in bug reports from
> > me from quite some time ago?
[…]
> That's correct. I hope that you don't mind that I cc'ed you?

No, I don't mind.

Would you like me to apply the patch in order to test it? As it is just 
about suppressing a kernel warning and not changing any major 
functionality, I wondered whether you like me to do with this or whether 
the CC is more JFYI.

> >> WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30
> >> CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1
> >> Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 )
> > 
> > This at least does not appear to be this ThinkPad T520, as I have
> > BIOS version 1.49 already.
> 
> The call trace in the patch description is only an example. I think
> the problem description and the patch applies to all systems that
> have one or more SCSI disks.

Best,
-- 
Martin



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

* Re: [PATCH] Avoid that a kernel warning appears during system resume
  2019-03-17 14:20     ` Martin Steigerwald
@ 2019-03-17 17:19       ` Bart Van Assche
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2019-03-17 17:19 UTC (permalink / raw)
  To: Martin Steigerwald
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	Jens Axboe, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Johannes Thumshirn, Oleksandr Natalenko, stable, Jisheng Zhang

On 3/17/19 7:20 AM, Martin Steigerwald wrote:
> Bart Van Assche - 16.03.19, 22:28:
>> On 3/16/19 3:43 AM, Martin Steigerwald wrote:
>>> Bart Van Assche - 16.03.19, 00:27:
>>>> Since scsi_device_quiesce() skips SCSI devices that have another
>>>> state than RUNNING, OFFLINE or TRANSPORT_OFFLINE,
>>>> scsi_device_resume() should not complain about SCSI devices that
>>>> have been skipped. Hence this patch. This patch avoids that the
>>>> following warning appears>
>>>> during resume:
>>> Am I on CC cause one of those warnings appeared in bug reports from
>>> me from quite some time ago?
> […]
>> That's correct. I hope that you don't mind that I cc'ed you?
> 
> No, I don't mind.
> 
> Would you like me to apply the patch in order to test it? As it is just
> about suppressing a kernel warning and not changing any major
> functionality, I wondered whether you like me to do with this or whether
> the CC is more JFYI.

Hi Martin,

I had cc'd you in case you would have hit the same warning. If you have 
not yet encountered this warning it's probably not that important that 
you test this patch.

Best regards,

Bart.

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

* Re: [PATCH] Avoid that a kernel warning appears during system resume
  2019-03-15 23:27 [PATCH] Avoid that a kernel warning appears during system resume Bart Van Assche
  2019-03-16 10:43 ` Martin Steigerwald
@ 2019-03-19 18:27 ` Martin K. Petersen
       [not found] ` <20190325003830.8BA272147C@mail.kernel.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2019-03-19 18:27 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, James E . J . Bottomley, linux-scsi,
	Jens Axboe, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Johannes Thumshirn, Oleksandr Natalenko, Martin Steigerwald,
	stable, Jisheng Zhang


Bart,

> Since scsi_device_quiesce() skips SCSI devices that have another state
> than RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume()
> should not complain about SCSI devices that have been skipped. Hence
> this patch.  This patch avoids that the following warning appears
> during resume:

Applied to 5.1/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] Avoid that a kernel warning appears during system resume
       [not found] ` <20190325003830.8BA272147C@mail.kernel.org>
@ 2019-03-25  4:47   ` Bart Van Assche
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2019-03-25  4:47 UTC (permalink / raw)
  To: Sasha Levin, Martin K . Petersen
  Cc: linux-scsi, Jens Axboe, Christoph Hellwig, Hannes Reinecke,
	Ming Lei, Johannes Thumshirn, Oleksandr Natalenko,
	Martin Steigerwald, stable

On 3/24/19 5:38 PM, Sasha Levin wrote:
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: 3a0a529971ec block, scsi: Make SCSI quiesce and resume work reliably.
> 
> The bot has tested the following trees: v5.0.3, v4.19.30.
> 
> v5.0.3: Build OK!
> v4.19.30: Failed to apply! Possible dependencies:
>      cd84a62e0078 ("block, scsi: Change the preempt-only flag into a counter")
> 
> 
> How should we proceed with this patch?

I think if you want to backport that patch that you will also have to 
backport commit cd84a62e0078 ("block, scsi: Change the preempt-only flag 
into a counter") (kernel v4.20).

Bart.

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

end of thread, other threads:[~2019-03-25  4:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 23:27 [PATCH] Avoid that a kernel warning appears during system resume Bart Van Assche
2019-03-16 10:43 ` Martin Steigerwald
2019-03-16 21:28   ` Bart Van Assche
2019-03-17 14:20     ` Martin Steigerwald
2019-03-17 17:19       ` Bart Van Assche
2019-03-19 18:27 ` Martin K. Petersen
     [not found] ` <20190325003830.8BA272147C@mail.kernel.org>
2019-03-25  4:47   ` Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.