All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@poochiereds.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Tejun Heo <tj@kernel.org>, Steve French <sfrench@samba.org>,
	Chris Ball <cjb@laptop.org>, David Airlie <airlied@linux.ie>,
	David Howells <dhowells@redhat.com>,
	Linux-pm mailing list <linux-pm@vger.kernel.org>,
	<linux-cifs@vger.kernel.org>, <linux-mmc@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>, <keyrings@linux-nfs.org>
Subject: Re: system_nrt_wq, system suspend, and the freezer
Date: Thu, 16 Feb 2012 10:27:28 -0500	[thread overview]
Message-ID: <20120216102728.230b99ba@poochiereds.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1202160930010.1268-100000@iolanthe.rowland.org>

On Thu, 16 Feb 2012 09:41:34 -0500 (EST)
Alan Stern <stern@rowland.harvard.edu> wrote:

> Folks:
> 
> I recently uncovered a bug in the block layer.  It uses a workqueue to
> periodically probe removable drives for media or other state changes,
> and the workqueue it uses is system_nrt_wq.
> 
> The bug is that system_nrt_wq is not freezable, so it keeps on running
> even while the system is in the process of suspending or hibernating.  
> Doing I/O to a suspended drive doesn't work well and in some cases
> causes nasty problems.  Obviously these polls need to stop during a 
> suspend transition.
> 
> A search through the kernel shows that system_nrt_wq is also used in a
> few other subsystems:
> 
> ./fs/cifs/cifssmb.c:	queue_work(system_nrt_wq, &rdata->work);
> ./fs/cifs/cifssmb.c:	queue_work(system_nrt_wq, &wdata->work);
> ./fs/cifs/misc.c:				queue_work(system_nrt_wq,
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &server->echo, SMB_ECHO_INTERVAL);
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL);
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks,
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks,
> 

These should  all be freezable and we might even be able to get away
with WQ_UNBOUND for some of these.

I think we put most of these in system_nrt_wq because Tejun put an
earlier job into that queue when he converted it from slow_work and we
just cargo-cult copied that...

I'll spend some time looking at this in the next day or two, but I
suspect that the right answer is to just move these off of the "public"
workqueues altogether.

> ./drivers/mmc/core/host.c:		queue_work(system_nrt_wq, &host->clk_gate_work);
> 
> ./drivers/gpu/drm/drm_crtc_helper.c:		queue_delayed_work(system_nrt_wq, delayed_work, DRM_OUTPUT_POLL_PERIOD);
> ./drivers/gpu/drm/drm_crtc_helper.c:		queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD);
> ./drivers/gpu/drm/drm_crtc_helper.c:		queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0);
> 
> ./security/keys/gc.c:		queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/gc.c:	queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/gc.c:	queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/gc.c:		queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/key.c:			queue_work(system_nrt_wq, &key_gc_work);
> 
> My question to all of you: Should system_nrt_wq be made freezable, or 
> should I create a new workqueue that is both freezable and 
> non-reentrant?  And if I do, which of the usages above should be 
> converted to the new workqueue?
> 
> Thanks,
> 
> Alan Stern
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Jeff Layton <jlayton@poochiereds.net>

WARNING: multiple messages have this Message-ID (diff)
From: Jeff Layton <jlayton@poochiereds.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Tejun Heo <tj@kernel.org>, Steve French <sfrench@samba.org>,
	Chris Ball <cjb@laptop.org>, David Airlie <airlied@linux.ie>,
	David Howells <dhowells@redhat.com>,
	Linux-pm mailing list <linux-pm@vger.kernel.org>,
	linux-cifs@vger.kernel.org, linux-mmc@vger.kernel.org,
	dri-devel@lists.freedesktop.org, keyrings@linux-nfs.org
Subject: Re: system_nrt_wq, system suspend, and the freezer
Date: Thu, 16 Feb 2012 10:27:28 -0500	[thread overview]
Message-ID: <20120216102728.230b99ba@poochiereds.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1202160930010.1268-100000@iolanthe.rowland.org>

On Thu, 16 Feb 2012 09:41:34 -0500 (EST)
Alan Stern <stern@rowland.harvard.edu> wrote:

> Folks:
> 
> I recently uncovered a bug in the block layer.  It uses a workqueue to
> periodically probe removable drives for media or other state changes,
> and the workqueue it uses is system_nrt_wq.
> 
> The bug is that system_nrt_wq is not freezable, so it keeps on running
> even while the system is in the process of suspending or hibernating.  
> Doing I/O to a suspended drive doesn't work well and in some cases
> causes nasty problems.  Obviously these polls need to stop during a 
> suspend transition.
> 
> A search through the kernel shows that system_nrt_wq is also used in a
> few other subsystems:
> 
> ./fs/cifs/cifssmb.c:	queue_work(system_nrt_wq, &rdata->work);
> ./fs/cifs/cifssmb.c:	queue_work(system_nrt_wq, &wdata->work);
> ./fs/cifs/misc.c:				queue_work(system_nrt_wq,
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &server->echo, SMB_ECHO_INTERVAL);
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL);
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks,
> ./fs/cifs/connect.c:	queue_delayed_work(system_nrt_wq, &cifs_sb->prune_tlinks,
> 

These should  all be freezable and we might even be able to get away
with WQ_UNBOUND for some of these.

I think we put most of these in system_nrt_wq because Tejun put an
earlier job into that queue when he converted it from slow_work and we
just cargo-cult copied that...

I'll spend some time looking at this in the next day or two, but I
suspect that the right answer is to just move these off of the "public"
workqueues altogether.

> ./drivers/mmc/core/host.c:		queue_work(system_nrt_wq, &host->clk_gate_work);
> 
> ./drivers/gpu/drm/drm_crtc_helper.c:		queue_delayed_work(system_nrt_wq, delayed_work, DRM_OUTPUT_POLL_PERIOD);
> ./drivers/gpu/drm/drm_crtc_helper.c:		queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD);
> ./drivers/gpu/drm/drm_crtc_helper.c:		queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0);
> 
> ./security/keys/gc.c:		queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/gc.c:	queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/gc.c:	queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/gc.c:		queue_work(system_nrt_wq, &key_gc_work);
> ./security/keys/key.c:			queue_work(system_nrt_wq, &key_gc_work);
> 
> My question to all of you: Should system_nrt_wq be made freezable, or 
> should I create a new workqueue that is both freezable and 
> non-reentrant?  And if I do, which of the usages above should be 
> converted to the new workqueue?
> 
> Thanks,
> 
> Alan Stern
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Jeff Layton <jlayton@poochiereds.net>

  parent reply	other threads:[~2012-02-16 15:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 14:41 system_nrt_wq, system suspend, and the freezer Alan Stern
2012-02-16 14:41 ` Alan Stern
     [not found] ` <Pine.LNX.4.44L0.1202160930010.1268-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-02-16 15:22   ` David Howells
     [not found]     ` <32626.1329405744-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-02-16 16:26       ` Tejun Heo
     [not found]     ` <20120216162634.GE24986-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-02-16 16:35       ` David Howells
2012-02-16 16:37         ` Tejun Heo
2012-02-16 15:27 ` Jeff Layton [this message]
2012-02-16 15:27   ` Jeff Layton
     [not found]   ` <20120216102728.230b99ba-vpEMnDpepFuMZCB2o+C8xQ@public.gmane.org>
2012-02-16 16:29     ` Tejun Heo
     [not found]       ` <20120216162951.GF24986-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-02-16 16:42         ` Alan Stern
2012-02-16 16:42           ` Alan Stern
2012-02-16 18:59       ` Jeff Layton
     [not found]         ` <20120216135945.3dd3893a-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
2012-02-16 19:01           ` Tejun Heo
2012-02-17 21:22   ` [PATCH] Block: use a freezable workqueue for disk-event polling Alan Stern
2012-02-17 21:22     ` Alan Stern
2012-02-17 21:52     ` Tejun Heo
2012-02-17 22:11     ` Rafael J. Wysocki
2012-03-02  9:51     ` Jens Axboe
2012-02-16 16:25 ` system_nrt_wq, system suspend, and the freezer Tejun Heo
     [not found]   ` <20120216162529.GD24986-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-02-16 16:37     ` Alan Stern
2012-02-16 16:37       ` Alan Stern
     [not found]       ` <Pine.LNX.4.44L0.1202161131420.1268-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-02-16 16:45         ` Tejun Heo
2012-02-16 16:58           ` Alan Stern
2012-02-16 16:58             ` Alan Stern

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=20120216102728.230b99ba@poochiereds.net \
    --to=jlayton@poochiereds.net \
    --cc=airlied@linux.ie \
    --cc=cjb@laptop.org \
    --cc=dhowells@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tj@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 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.