linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Dexuan Cui <decui@microsoft.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"hch@lst.de" <hch@lst.de>, "hare@suse.de" <hare@suse.de>,
	Michael Kelley <mikelley@microsoft.com>,
	Long Li <longli@microsoft.com>,
	"ming.lei@redhat.com" <ming.lei@redhat.com>,
	Balsundar P <Balsundar.P@microchip.com>
Cc: "linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>
Subject: Re: [PATCH] scsi: storvsc: Fix a panic in the hibernation procedure
Date: Thu, 23 Apr 2020 16:25:11 -0700	[thread overview]
Message-ID: <f23cb660-13e4-8466-4c78-163fcc857caa@acm.org> (raw)
In-Reply-To: <HK0P153MB02731F9C5FC61C466715362CBFD30@HK0P153MB0273.APCP153.PROD.OUTLOOK.COM>

On 2020-04-23 11:29, Dexuan Cui wrote:
> So it looks the below patch also works for me:
> 
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -898,6 +898,11 @@ static int software_resume(void)
>         error = freeze_processes();
>         if (error)
>                 goto Close_Finish;
> +
> +       error = freeze_kernel_threads();
> +       if (error)
> +               goto Close_Finish;
> +
>         error = load_image_and_restore();
>         thaw_processes();
>   Finish:
> 
> Just to be sure, I'll do more tests, but I believe the panic can be fixed
> by this according to my tests I have done so far.

If a freeze_kernel_threads() call is added in software_resume(), should
a thaw_kernel_threads() call be added too?

Anyway, please Cc me if a patch for software_resume() is submitted.

> I'm still not sure what the comment before scsi_device_quiesce() means:
>  *  ... Since special requests may also be requeued requests,
>  *      a successful return doesn't guarantee the device will be
>  *      totally quiescent.
> 
> I don't know if there can be some other I/O submitted after
> scsi_device_quiesce() returns in the case of hibernation, and I don't
> know if aac_suspend() -> scsi_host_block() should be fixed/removed,
> but as far as the panic is concerned, I'm very glad I have found a better
> fix with your help. 

The function blk_set_pm_only() increments the q->pm_only counter while
the blk_clear_pm_only() function decrements the q->pm_only counter.
If q->pm_only > 0, blk_queue_enter() only succeeds if the flag
BLK_MQ_REQ_PREEMPT is set in the second argument passed to that
function. blk_get_request() calls blk_queue_enter(). The result is that
while q->pm_only > 0 blk_get_request() only submits a request without
waiting if the BLK_MQ_REQ_PREEMPT flag is set in its second argument.
scsi_execute() sets the BLK_MQ_REQ_PREEMPT flag. In other words,
scsi_device_quiesce() blocks requests submitted by filesystems but still
allows SCSI commands submitted by the SCSI core to be executed.
"special" refers to requests with the BLK_MQ_REQ_PREEMPT flag set.

Bart.

  reply	other threads:[~2020-04-23 23:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  0:17 [PATCH] scsi: storvsc: Fix a panic in the hibernation procedure Dexuan Cui
2020-04-22  1:28 ` Ming Lei
2020-04-22  1:48   ` Dexuan Cui
2020-04-22  2:01     ` Ming Lei
2020-04-22  3:08       ` Paul E. McKenney
2020-04-22  4:16         ` Ming Lei
2020-04-22  4:58           ` Dexuan Cui
2020-04-22  9:23             ` Ming Lei
2020-04-22 16:19               ` Paul E. McKenney
2020-04-22 18:01               ` Dexuan Cui
2020-04-22  2:06     ` Ming Lei
2020-04-22  5:02 ` Bart Van Assche
2020-04-22  6:24   ` Dexuan Cui
2020-04-22 19:56     ` Bart Van Assche
2020-04-23  7:04       ` Dexuan Cui
2020-04-23 16:37         ` Bart Van Assche
2020-04-23 18:29           ` Dexuan Cui
2020-04-23 23:25             ` Bart Van Assche [this message]
2020-04-24  2:40               ` Dexuan Cui
2020-04-24  3:45               ` Dexuan Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f23cb660-13e4-8466-4c78-163fcc857caa@acm.org \
    --to=bvanassche@acm.org \
    --cc=Balsundar.P@microchip.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=martin.petersen@oracle.com \
    --cc=mikelley@microsoft.com \
    --cc=ming.lei@redhat.com \
    --cc=sthemmin@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).