Re: [PATCH v5 0/8] block, scsi, md: Improve suspend and resume

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 23:31 +0800, Ming Lei wrote: > On Wed, Oct 04, 2017 at 03:18:45PM +0000, Bart Van Assche wrote: > > On Wed, 2017-10-04 at 15:53 +0800, Ming Lei wrote: > > > 2) RCU read lock is missed in fast path > > > > Did you really post this as a rev

Re: [PATCH v5 2/8] md: Neither resync nor reshape while the system is frozen

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 03:16 +0200, Luis R. Rodriguez wrote: > On Mon, Oct 02, 2017 at 03:52:12PM -0700, Bart Van Assche wrote: > > diff --git a/drivers/md/md.c b/drivers/md/md.c > > index 3f7426120a3b..a2cf2a93b0cb 100644 > > --- a/drivers/md/md.c > > +++ b/drivers/md/m

Re: [PATCH v5 8/8] block: Make SCSI device suspend and resume work reliably

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 09:06 +0200, Christoph Hellwig wrote: > As mentioned before - if you pass BLK_MQ_REQ_* to blk_queue_enter > this should become a bit nicer without the need for two magic bool > parameters. Hello Christoph, I will make that change. Sorry that I missed it in v5 of this patch

Re: [PATCH v5 7/8] scsi: Set QUEUE_FLAG_PREEMPT_ONLY while quiesced

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 09:06 +0200, Christoph Hellwig wrote: > > + /* > > +* Ensure that the effect of blk_set_preempt_only() is globally > > +* visible before unfreezing the queue. > > +*/ > > + if (err == 0) > > + synchronize_rcu(); > > I don't understand why we'd need

Re: [PATCH v5 6/8] scsi: Reduce suspend latency

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 09:04 +0200, Christoph Hellwig wrote: > > + /* > > +* Do not attempt to freeze the queue of an already quiesced device > > +* because that could result in a deadlock. > > +*/ > > + freeze = sdev->sdev_state == SDEV_RUNNING; > > + if (freeze) > > +

Re: [PATCH v5 2/8] md: Neither resync nor reshape while the system is frozen

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 19:30 +0800, Ming Lei wrote: > Last time, I asked which issue is fixed by this patch, but > never get answered, so again, what is issue fixed by > this patch? That's not correct. I did answer your question. See e.g. https://marc.info/?l=linux-block=150695879309606. > Given

Re: [RFC 4/5] ext4: add fs freezing support on suspend/hibernation

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 18:05 +1100, Dave Chinner wrote: > Basically, before thawing filesystems the rest of the kernel > infrastructure needs to have been restarted. i.e. the order > needs to be: > > freeze userspace > freeze filesystems > freeze kernel threads > freeze workqueues > > thaw

Re: [PATCH v5 0/8] block, scsi, md: Improve suspend and resume

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 08:56 +0200, Christoph Hellwig wrote: > can you guys please work a little better together? We've now got two > patchsets that are getting very similar. > > Bart, please at least CC Ming when you send out the patches. Hello Christoph, Sorry for the low level of

Re: [PATCH v5 0/8] block, scsi, md: Improve suspend and resume

2017-10-04 Thread Bart Van Assche
On Wed, 2017-10-04 at 15:53 +0800, Ming Lei wrote: > I have commented on Bart's patchset before, but my comments > never gets addressed: > > 1) no MD changes required on this issue I did not address that comment because you have another view on how suspend and resume should work than the rest of

Re: [RFC 0/5] fs: replace kthread freezing with filesystem freeze/thaw

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 13:47 -0700, Matthew Wilcox wrote: > The SCSI layer can send SCSI commands; they aren't I/Os in the sense that > they do reads and writes to media, but they are block requests. Maybe those > should be allowed even to frozen devices? Hello Matthew, I think only RQF_PM

Re: [PATCH V6 13/14] block: mq-deadline: Limit write request dispatch for zoned block devices

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 09:19 +0900, Damien Le Moal wrote: > On 10/3/17 08:44, Bart Van Assche wrote: > > On Mon, 2017-10-02 at 16:15 +0900, Damien Le Moal wrote: > > > static void deadline_wunlock_zone(struct deadline_data *dd, > > >

Re: [RFC 2/5] fs: freeze on suspend and thaw on resume

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 22:23 +0200, Luis R. Rodriguez wrote: > On Tue, Oct 03, 2017 at 08:02:22PM +0000, Bart Van Assche wrote: > > On Tue, 2017-10-03 at 11:53 -0700, Luis R. Rodriguez wrote: > > > +static bool super_allows_freeze(struct super_block *sb) > > > +{ &

Re: [RFC 5/5] pm: remove kernel thread freezing

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 22:17 +0200, Jiri Kosina wrote: > On Tue, 3 Oct 2017, Bart Van Assche wrote: > > What about the many drivers outside filesystems that use the > > set_freezable() / try_to_freeze() / wait_event_freezable() API? > > Many/most of them are just completel

Re: [RFC 5/5] pm: remove kernel thread freezing

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 11:53 -0700, Luis R. Rodriguez wrote: > Now that all filesystems which used to rely on kthread > freezing have been converted to filesystem freeze/thawing > we can remove the kernel kthread freezer. Many subsystems use system_freezable_wq and/or

Re: [RFC 2/5] fs: freeze on suspend and thaw on resume

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 11:53 -0700, Luis R. Rodriguez wrote: > +static bool super_allows_freeze(struct super_block *sb) > +{ > + return !!(sb->s_type->fs_flags & FS_FREEZE_ON_SUSPEND); > +} A minor comment: if "!!" would be left out the compiler will perform the conversion from int to bool

Re: [PATCH V8 5/8] percpu-refcount: introduce __percpu_ref_tryget_live

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 22:04 +0800, Ming Lei wrote: > Block layer need to call this function after holding > rcu lock in a real hot path, so introduce this helper. Since it is allowed to nest rcu_read_lock_sched() calls I don't think that this patch is necessary. Bart.

Re: [PATCH 2/2] block: fix peeking requests during PM

2017-10-03 Thread Bart Van Assche
On Tue, 2017-10-03 at 10:47 +0200, Christoph Hellwig wrote: > -static struct request *blk_pm_peek_request(struct request_queue *q, > -struct request *rq) > +static bool blk_pm_allow_request(struct request *rq) > { > - if (q->dev && (q->rpm_status ==

Re: [PATCH V6 13/14] block: mq-deadline: Limit write request dispatch for zoned block devices

2017-10-02 Thread Bart Van Assche
On Mon, 2017-10-02 at 16:15 +0900, Damien Le Moal wrote: > When dispatching write requests to a zoned block device, only allow > requests targeting an unlocked zone. Requests targeting a locked zone > are left in the scheduler queue to preserve the initial write order. > If no write request can be

Re: [PATCH V6 12/14] block: mq-deadline: Introduce zone locking support

2017-10-02 Thread Bart Van Assche
e request is requeued (inserted). Anyway: Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

Re: [PATCH V6 10/14] block: mq-deadline: Add zoned block device data

2017-10-02 Thread Bart Van Assche
. per-zone write locking ..."? Anyway: Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

[PATCH v5 1/8] md: Introduce md_stop_all_writes()

2017-10-02 Thread Bart Van Assche
Introduce md_stop_all_writes() because the next patch will add a second caller for this function. Rename md_notifier into md_reboot_notifier to avoid that the name of this notifier will become confusing due to the next patch. This patch does not change any functionality. Signed-off-by: Bart Van

[PATCH v5 2/8] md: Neither resync nor reshape while the system is frozen

2017-10-02 Thread Bart Van Assche
will restart after the system is resumed and a message similar to the following will appear in the system log: md: md0: data-check interrupted. Additionally, only allow resync or reshape activity to be started after system freezing is over. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com&

[PATCH v5 3/8] block: Make q_usage_counter also track legacy requests

2017-10-02 Thread Bart Van Assche
ed a comment and made sure REQ_NOWAIT is handled properly in blk_old_get_request() ] Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Reviewed-by: Christoph Hellwig <h...@lst.de> Cc: Ming Lei <ming@redhat.com> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn

[PATCH v5 4/8] block: Convert RQF_PREEMPT into REQ_PREEMPT

2017-10-02 Thread Bart Van Assche
that corresponds to this request. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn <jthumsh...@suse.de> --- block/blk-mq-debugfs.c| 2 +-

Re: [PATCH V6 08/14] scsi: sd_zbc: Limit zone write locking to sequential zones

2017-10-02 Thread Bart Van Assche
On Mon, 2017-10-02 at 16:15 +0900, Damien Le Moal wrote: > + * There is no write constraints on conventional zones. So any write ^^ are? Anyway: Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

Re: [PATCH V6 07/14] scsi: sd_zbc: Initialize device request queue zoned data

2017-10-02 Thread Bart Van Assche
; the helper sd_zbc_alloc_zone_bitmap(). Using this helper, wait for the > disk capacity and number of zones to stabilize on the second > revalidation pass to allocate and initialize the bitmaps. Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

Re: [PATCH V6 02/14] scsi: sd_zbc: Fix comments and indentation

2017-10-02 Thread Bart Van Assche
On Mon, 2017-10-02 at 16:15 +0900, Damien Le Moal wrote: > Fix comments style (use kernel-doc style) and content to clarify some > functions. Also fix some functions signature indentation and remove a > useless blank line in sd_zbc_read_zones(). Reviewed-by: Bart Van Assche <

Re: [PATCH V7 5/6] block: support PREEMPT_ONLY

2017-10-02 Thread Bart Van Assche
On Sat, 2017-09-30 at 14:12 +0800, Ming Lei wrote: > +void blk_set_preempt_only(struct request_queue *q, bool preempt_only) > +{ > + blk_mq_freeze_queue(q); > + if (preempt_only) > + queue_flag_set_unlocked(QUEUE_FLAG_PREEMPT_ONLY, q); > + else > +

Re: [PATCH V7 2/6] block: tracking request allocation with q_usage_counter

2017-10-02 Thread Bart Van Assche
On Sat, 2017-09-30 at 14:12 +0800, Ming Lei wrote: > @@ -1395,16 +1401,21 @@ static struct request *blk_old_get_request(struct > request_queue *q, > unsigned int op, gfp_t gfp_mask) > { > struct request *rq; > + int ret = 0; > >

Re: [PATCH v4 4/7] block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag

2017-10-02 Thread Bart Van Assche
On Mon, 2017-10-02 at 15:47 +0200, Christoph Hellwig wrote: > > +void blk_set_preempt_only(struct request_queue *q, bool preempt_only) > > +{ > > + unsigned long flags; > > + > > + spin_lock_irqsave(q->queue_lock, flags); > > + if (preempt_only) > > +

Re: [PATCH] blk-mq: wire up completion notifier for laptop mode

2017-10-02 Thread Bart Van Assche
On Sat, 2017-09-30 at 10:06 +0200, Jens Axboe wrote: > For some reason, the laptop mode IO completion notified was never wired > up for blk-mq. Ensure that we trigger the callback appropriately, to arm > the laptop mode flush timer. Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

Re: [PATCH v4 1/7] md: Make md resync and reshape threads freezable

2017-10-02 Thread Bart Van Assche
On Wed, 2017-09-27 at 19:00 +0800, Ming Lei wrote: > With current linus tree, SCSI I/O is prevented from being dispatch to > device during suspend by SCSI quiesce, and will be dispatched again > in resume. With Safe SCSI quiesce[1], any underlying IO request will > stop at blk_queue_enter() during

Re: [PATCH V6 6/6] SCSI: set block queue at preempt only when SCSI device is put into quiesce

2017-09-27 Thread Bart Van Assche
On Wed, 2017-09-27 at 13:48 +0800, Ming Lei wrote: > @@ -2928,12 +2929,28 @@ scsi_device_quiesce(struct scsi_device *sdev) > { > int err; > > + /* > + * Simply quiesing SCSI device isn't safe, it is easy > + * to use up requests because all these allocated requests > +

Re: [PATCH v4 5/7] scsi: Reduce suspend latency

2017-09-26 Thread Bart Van Assche
On Wed, 2017-09-27 at 06:23 +0800, Ming Lei wrote: > mutex_lock(>state_mutex); > err = scsi_device_set_state(sdev, SDEV_QUIESCE); > if (err == 0) > blk_set_preempt_only(q, true); > mutex_unlock(>state_mutex); > > if (err) >

Re: [PATCH v4 1/7] md: Make md resync and reshape threads freezable

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 22:59 +0800, Ming Lei wrote: > On Tue, Sep 26, 2017 at 02:42:07PM +0000, Bart Van Assche wrote: > > On Tue, 2017-09-26 at 19:17 +0800, Ming Lei wrote: > > > Just test this patch a bit and the following failure of freezing task > > >

Re: [PATCH v4 0/7] Make suspend and resume safe for md-on-SCSI

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 22:54 +0800, Ming Lei wrote: > On Tue, Sep 26, 2017 at 02:29:06PM +0000, Bart Van Assche wrote: > > On Tue, 2017-09-26 at 17:15 +0800, Ming Lei wrote: > > > No, if you only address issue on MD device, that is definitely not > > >

Re: [PATCH v4 7/7] block: Make SCSI device suspend and resume work reliably

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 16:32 +0800, Ming Lei wrote: > On Mon, Sep 25, 2017 at 11:13:47PM +0000, Bart Van Assche wrote: > > Sorry but I disagree. I'm using RCU to achieve the same effect as a barrier > > and to move the cost of the barrier from the reader to the updater. See

Re: [PATCH v4 1/7] md: Make md resync and reshape threads freezable

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 19:17 +0800, Ming Lei wrote: > Just test this patch a bit and the following failure of freezing task > is triggered during suspend: [ ... ] What kernel version did you start from and which patches were applied on top of that kernel? Only patch 1/7 or all seven patches? What

Re: [PATCH v4 1/7] md: Make md resync and reshape threads freezable

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 16:13 +0800, Ming Lei wrote: > I am pretty sure that suspend/resume can survive when resync in progress > with my patchset applied on RAID1, without any MD change. The above shows that you do not understand how suspend and resume works. In the documents in the directory

Re: [PATCH v4 0/7] Make suspend and resume safe for md-on-SCSI

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 17:15 +0800, Ming Lei wrote: > No, if you only address issue on MD device, that is definitely not > alternative of my patchset. A clarification: my patch series not only fixes suspend and resume for md-on-SCSI but also for all other scenario's in which resume locks up due

Re: dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure

2017-09-26 Thread Bart Van Assche
On Tue, 2017-09-26 at 16:50 +0800, Ming Lei wrote: > If you don't consider to change mpath into block in .queue_rq() now, > please take this patch first, and I am sure this way is correct, and > even it can be thought as a fix. As I explained earlier, it would be wrong to take this patch upstream

Re: [PATCH v4 7/7] block: Make SCSI device suspend and resume work reliably

2017-09-25 Thread Bart Van Assche
On Tue, 2017-09-26 at 06:59 +0800, Ming Lei wrote: > On Mon, Sep 25, 2017 at 01:29:24PM -0700, Bart Van Assche wrote: > > +int blk_queue_enter(struct request_queue *q, bool nowait, bool preempt) > > { > > while (true) { > > int ret; > > > >

Re: [PATCH v4 1/7] md: Make md resync and reshape threads freezable

2017-09-25 Thread Bart Van Assche
On Tue, 2017-09-26 at 07:04 +0800, Ming Lei wrote: > On Mon, Sep 25, 2017 at 01:29:18PM -0700, Bart Van Assche wrote: > > Some people use the md driver on laptops and use the suspend and > > resume functionality. Since it is essential that submitting of > > new I/O request

Re: [PATCH v3 5/6] block: Make SCSI device suspend and resume work reliably

2017-09-25 Thread Bart Van Assche
On Tue, 2017-09-26 at 06:51 +0800, Ming Lei wrote: > On Mon, Sep 25, 2017 at 04:20:20PM +0000, Bart Van Assche wrote: > > So that means that you have not noticed that it is safe to leave out that > > smp_rmp() call because blk-mq queue freezing and unfreezing waits for a >

Re: [PATCH v3 1/6] md: Make md resync and reshape threads freezable

2017-09-25 Thread Bart Van Assche
On Tue, 2017-09-26 at 06:45 +0800, Ming Lei wrote: > On Mon, Sep 25, 2017 at 04:22:29PM +0000, Bart Van Assche wrote: > > On Mon, 2017-09-25 at 10:38 +0800, Ming Lei wrote: > > > On Fri, Sep 22, 2017 at 03:14:00PM -0700, Bart Van Assche wrote: > > > > Some peopl

Re: [PATCH V5 13/14] block: mq-deadline: Limit write request dispatch for zoned block devices

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > - return rq_entry_fifo(dd->fifo_list[data_dir].next); > + if (!dd->zones_wlock || data_dir == READ) > + return rq_entry_fifo(dd->fifo_list[data_dir].next); > + > + spin_lock_irqsave(>zone_lock, flags); > + > +

Re: [PATCH V5 12/14] block: mq-deadline: Introduce zone locking support

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > +static inline bool deadline_request_needs_zone_wlock(struct deadline_data > *dd, > + struct request *rq) > +{ > + > + if (!dd->zones_wlock) > + return false; > + > + if

Re: [PATCH V5 11/14] blokc: mq-deadline: Introduce dispatch helpers

2017-09-25 Thread Bart Van Assche
). Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

Re: [PATCH V5 10/14] block: mq-deadline: Add zoned block device data

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > Modify mq-dealine init_queue and exit_queue elevator methods to handle ^^ mq-deadline ? > +static int deadline_init_zones_wlock(struct request_queue *q, > + struct deadline_data

Re: [PATCH V5 07/14] scsi: sd_zbc: Initialize device request queue zoned data

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > + return kzalloc_node(BITS_TO_LONGS(sdkp->nr_zones) > + * sizeof(unsigned long), Does this perhaps fit on one line? > +/** > + * sd_zbc_get_seq_zones - Parse report zones reply to identify sequential > zones

Re: [PATCH V5 06/14] block: Add zoned block device information to request queue

2017-09-25 Thread Bart Van Assche
zed by stacking drivers (device mappers) handling zoned block > devices (e.g. dm-linear). Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

Re: [PATCH V5 03/14] scsi: sd_zbc: Rearrange code

2017-09-25 Thread Bart Van Assche
check_zone_size(). > > No functional change is introduced by this patch. > > Signed-off-by: Damien Le Moal <damien.lem...@wdc.com> > Reviewed-by: Christoph Hellwig <h...@lst.de> Reviewed-by: Bart Van Assche <bart.vanass...@wdc.com>

[PATCH v4 3/7] block: Convert RQF_PREEMPT into REQ_PREEMPT

2017-09-25 Thread Bart Van Assche
that corresponds to this request. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn <jthumsh...@suse.de> --- block/blk-mq-debugfs.c| 2 +-

[PATCH v4 5/7] scsi: Reduce suspend latency

2017-09-25 Thread Bart Van Assche
Avoid that it can take 200 ms too long to wait for requests to finish. Note: blk_mq_freeze_queue() uses a wait queue to wait for ongoing requests to finish. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Mi

[PATCH v4 7/7] block: Make SCSI device suspend and resume work reliably

2017-09-25 Thread Bart Van Assche
ferences: "I/O hangs after resuming from suspend-to-ram" (https://marc.info/?l=linux-block=150340235201348). Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Ming Lei <ming@redhat.com> Cc: Christ

[PATCH v4 1/7] md: Make md resync and reshape threads freezable

2017-09-25 Thread Bart Van Assche
Some people use the md driver on laptops and use the suspend and resume functionality. Since it is essential that submitting of new I/O requests stops before device quiescing starts, make the md resync and reshape threads freezable. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com&

[PATCH v4 4/7] block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag

2017-09-25 Thread Bart Van Assche
This flag will be used in the next patch to let the block layer core know whether or not a SCSI request queue has been quiesced. A quiesced SCSI queue namely only processes RQF_PREEMPT requests. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redha

[PATCH v4 6/7] scsi: Set QUEUE_FLAG_PREEMPT_ONLY while quiesced

2017-09-25 Thread Bart Van Assche
Make the quiesce state visible to the block layer for the next patch in this series. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de>

[PATCH v4 0/7] Make suspend and resume safe for md-on-SCSI

2017-09-25 Thread Bart Van Assche
ch series: - Changed the approach and rewrote the patch series. Bart Van Assche (6): md: Make md resync and reshape threads freezable block: Convert RQF_PREEMPT into REQ_PREEMPT block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag scsi-mq: Reduce suspend latency scsi: Set QUEUE_FLA

[PATCH v4 2/7] block: Make q_usage_counter also track legacy requests

2017-09-25 Thread Bart Van Assche
ed a comment and made sure REQ_NOWAIT is handled properly in blk_old_get_request() ] Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn <jt

Re: [PATCH v3 1/6] md: Make md resync and reshape threads freezable

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 10:38 +0800, Ming Lei wrote: > On Fri, Sep 22, 2017 at 03:14:00PM -0700, Bart Van Assche wrote: > > Some people use the md driver on laptops and use the suspend and > > resume functionality. Since it is essential that submitting of > > new I/O request

Re: [PATCH v3 5/6] block: Make SCSI device suspend and resume work reliably

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 10:26 +0800, Ming Lei wrote: > On Fri, Sep 22, 2017 at 03:14:04PM -0700, Bart Van Assche wrote: > > +int blk_queue_enter(struct request_queue *q, bool nowait, bool preempt) > > { > > while (true) { > > int ret; > > > >

Re: [PATCH v3 0/6] Make SCSI device suspend and resume work reliably

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 10:36 +0800, Ming Lei wrote: > On Sat, Sep 23, 2017 at 6:13 AM, Bart Van Assche <bart.vanass...@wdc.com> > wrote: > > It is known that during the resume following a hibernate sometimes the > > system hangs instead of coming up properly.

Re: [PATCH] dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 11:06 +0800, Ming Lei wrote: > On Fri, Sep 22, 2017 at 05:54:48PM +0000, Bart Van Assche wrote: > > On Sat, 2017-09-23 at 01:44 +0800, Ming Lei wrote: > > > On Fri, Sep 22, 2017 at 03:06:16PM +0000, Bart Van Assche wrote: > > > > On Fri, 2017-

[PATCH v3 2/6] block: Convert RQF_PREEMPT into REQ_PREEMPT

2017-09-22 Thread Bart Van Assche
that corresponds to this request. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn <jthumsh...@suse.de> --- block/blk-mq-debugfs.c| 2 +-

[PATCH v3 3/6] block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag

2017-09-22 Thread Bart Van Assche
This flag will be used in the next patch to let the block layer core know whether or not a SCSI request queue has been quiesced. A quiesced SCSI queue namely only processes RQF_PREEMPT requests. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redha

[PATCH v3 1/6] md: Make md resync and reshape threads freezable

2017-09-22 Thread Bart Van Assche
Some people use the md driver on laptops and use the suspend and resume functionality. Since it is essential that submitting of new I/O requests stops before device quiescing starts, make the md resync and reshape threads freezable. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com&

[PATCH v3 6/6] scsi-mq: Reduce suspend latency

2017-09-22 Thread Bart Van Assche
Avoid that it can take 200 ms too long to wait for requests to finish. Note: blk_mq_freeze_queue() uses a wait queue to wait for ongoing requests to finish. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Mi

[PATCH v3 5/6] block: Make SCSI device suspend and resume work reliably

2017-09-22 Thread Bart Van Assche
ferences: "I/O hangs after resuming from suspend-to-ram" (https://marc.info/?l=linux-block=150340235201348). Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Ming Lei <ming@redhat.com> Cc: Christ

[PATCH v3 0/6] Make SCSI device suspend and resume work reliably

2017-09-22 Thread Bart Van Assche
nsider these changes for kernel v4.15. Thanks, Bart. Changes between v2 and v3: - Made md kernel threads freezable. - Changed the approach for quiescing SCSI devices again. - Addressed Ming's review comments. Changes compared to v1 of this patch series: - Changed the approach and rewrote the pat

[PATCH v3 4/6] scsi: Set QUEUE_FLAG_PREEMPT_ONLY while quiesced

2017-09-22 Thread Bart Van Assche
Make the quiesce state visible to the block layer for the next patch in this series. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de>

Re: [PATCH] dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure

2017-09-22 Thread Bart Van Assche
On Sat, 2017-09-23 at 01:44 +0800, Ming Lei wrote: > On Fri, Sep 22, 2017 at 03:06:16PM +0000, Bart Van Assche wrote: > > On Fri, 2017-09-22 at 09:35 +0800, Ming Lei wrote: > > > + /* > > > + * blk-mq's SCHED_RESTART can cover this requeue, so > >

Re: [PATCH] dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure

2017-09-22 Thread Bart Van Assche
On Fri, 2017-09-22 at 09:35 +0800, Ming Lei wrote: > + /* > + * blk-mq's SCHED_RESTART can cover this requeue, so > + * we needn't to deal with it by DELAY_REQUEUE. More > + * importantly, we have to return DM_MAPIO_REQUEUE > + * so

Re: [PATCH v2 4/4] scsi-mq: Reduce suspend latency

2017-09-21 Thread Bart Van Assche
On Fri, 2017-09-22 at 07:53 +0800, Ming Lei wrote: > Then that is simply not enough since the issue is that request pool can > be used up easily when SCSI device is quiesced, then no request is left > for RQF_PREEMPT(PM), and I/O hang is triggered. > > It has been discussed for long time, I am

Re: [PATCH v2 4/4] scsi-mq: Reduce suspend latency

2017-09-21 Thread Bart Van Assche
On Fri, 2017-09-22 at 07:25 +0800, Ming Lei wrote: > On Thu, Sep 21, 2017 at 10:43:26PM +0000, Bart Van Assche wrote: > > On Fri, 2017-09-22 at 06:06 +0800, Ming Lei wrote: > > > On Thu, Sep 21, 2017 at 02:22:55PM -0700, Bart Van Assche wrote: >

Re: [PATCH v2 3/4] block, scsi: Make SCSI device suspend and resume work reliably

2017-09-21 Thread Bart Van Assche
On Fri, 2017-09-22 at 06:04 +0800, Ming Lei wrote: > On Thu, Sep 21, 2017 at 02:22:54PM -0700, Bart Van Assche wrote: > > --- a/block/blk-core.c > > +++ b/block/blk-core.c > > @@ -1429,11 +1429,18 @@ struct request *blk_get_request(struct > > reques

Re: [PATCH v2 4/4] scsi-mq: Reduce suspend latency

2017-09-21 Thread Bart Van Assche
On Fri, 2017-09-22 at 06:06 +0800, Ming Lei wrote: > On Thu, Sep 21, 2017 at 02:22:55PM -0700, Bart Van Assche wrote: > > + } else { > > scsi_run_queue(q); > > + while (atomic_read(>device_busy)) { > > +

[PATCH v2 0/4] Make SCSI device suspend and resume work reliably

2017-09-21 Thread Bart Van Assche
nsider these changes for kernel v4.15. Thanks, Bart. Changes compared to v1 of this patch series: - Changed the approach and rewrote the patch series. Bart Van Assche (4): block: Convert RQF_PREEMPT into REQ_PREEMPT block: Add the QUEUE_PREEMPT_ONLY request queue flag block, scsi: Make

[PATCH v2 1/4] block: Convert RQF_PREEMPT into REQ_PREEMPT

2017-09-21 Thread Bart Van Assche
that corresponds to this request. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn <jthumsh...@suse.de> --- block/blk-mq-debugfs.c| 2 +-

[PATCH v2 2/4] block: Add the QUEUE_PREEMPT_ONLY request queue flag

2017-09-21 Thread Bart Van Assche
This flag will be used in the next patch to let the block layer core know whether or not a SCSI request queue has been quiesced. A quiesced SCSI queue namely only processes RQF_PREEMPT requests. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redha

[PATCH v2 4/4] scsi-mq: Reduce suspend latency

2017-09-21 Thread Bart Van Assche
Avoid that it can take 200 ms too long to wait for ongoing requests to finish. Note: blk_mq_freeze_queue() uses a wait queue to wait for ongoing requests to finish. Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Mi

[PATCH v2 3/4] block, scsi: Make SCSI device suspend and resume work reliably

2017-09-21 Thread Bart Van Assche
;I/O hangs after resuming from suspend-to-ram" (https://marc.info/?l=linux-block=150340235201348). Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Martin K. Petersen <martin.peter...@oracle.com> Cc: Ming Lei <ming@redhat.com> Cc: Christoph Hellwig <h...@ls

[PATCH] blk-mq: Fix blk_mq_get_request() error path

2017-09-20 Thread Bart Van Assche
ned-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Ming Lei <ming@redhat.com> Cc: <sta...@vger.kernel.org> # v4.13+ --- block/blk-mq.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 3f18cff80050..fc2001

Re: [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2017-09-19 Thread Bart Van Assche
On Wed, 2017-09-20 at 06:44 +0800, Ming Lei wrote: > For this issue, it isn't same between SCSI and dm-rq. > > We don't need to run queue in .end_io of dm, and the theory is > simple, otherwise it isn't performance issue, and should be I/O hang. > > 1) every dm-rq's request is 1:1 mapped to

Re: [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2017-09-19 Thread Bart Van Assche
On Wed, 2017-09-20 at 00:55 +0800, Ming Lei wrote: > On Wed, Sep 20, 2017 at 12:49 AM, Bart Van Assche > <bart.vanass...@wdc.com> wrote: > > On Wed, 2017-09-20 at 00:04 +0800, Ming Lei wrote: > > > Run queue at end_io is definitely wrong, because blk-mq has SCHED_RESTA

Re: [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2017-09-19 Thread Bart Van Assche
On Wed, 2017-09-20 at 00:04 +0800, Ming Lei wrote: > Run queue at end_io is definitely wrong, because blk-mq has SCHED_RESTART > to do that already. Sorry but I disagree. If SCHED_RESTART is set that causes the blk-mq core to reexamine the software queues and the hctx dispatch list but not the

Re: [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2017-09-19 Thread Bart Van Assche
On Tue, 2017-09-19 at 11:48 -0400, Mike Snitzer wrote: > This thread proves that it is definitely brittle to be relying on fixed > delays like this: > https://patchwork.kernel.org/patch/9703249/ Hello Mike, Sorry but I think that's a misinterpretation of my patch. I came up with that patch

Re: [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2017-09-19 Thread Bart Van Assche
On Tue, 2017-09-19 at 13:43 +0800, Ming Lei wrote: > On Mon, Sep 18, 2017 at 03:18:16PM +0000, Bart Van Assche wrote: > > If you are still looking at removing the blk_mq_delay_run_hw_queue() calls > > then I think you are looking in the wrong direction. What kind of problem >

Re: [RFC PATCH] blk-mq: Fix lost request during timeout

2017-09-19 Thread Bart Van Assche
On Tue, 2017-09-19 at 11:07 -0400, Keith Busch wrote: > The problem is when blk-mq's timeout handler prevents the request from > completing, and doesn't leave any indication the driver requested to > complete it. Who is responsible for completing that request now? Hello Keith, My understanding

Re: [RFC PATCH] blk-mq: Fix lost request during timeout

2017-09-19 Thread Bart Van Assche
On Mon, 2017-09-18 at 21:55 -0400, Keith Busch wrote: > The only way to complete that request now is if the timeout > handler returns BLK_EH_HANDLED, but the scsi-mq abort path returns > BLK_EH_NOT_HANDLED on success (very few drivers actually return > BLK_EH_HANDLED). > > After the timeout

Re: [RFC PATCH] blk-mq: Fix lost request during timeout

2017-09-18 Thread Bart Van Assche
On Mon, 2017-09-18 at 19:08 -0400, Keith Busch wrote: > On Mon, Sep 18, 2017 at 10:53:12PM +0000, Bart Van Assche wrote: > > Are you sure that scenario can happen? The blk-mq core calls > > test_and_set_bit() > > for the REQ_ATOM_COMPLETE flag before any completi

Re: [RFC PATCH] blk-mq: Fix lost request during timeout

2017-09-18 Thread Bart Van Assche
On Mon, 2017-09-18 at 18:39 -0400, Keith Busch wrote: > The nvme driver's use of blk_mq_reinit_tagset only happens during > controller initialisation, but I'm seeing lost commands well after that > during normal and stable running. > > The timing is pretty narrow to hit, but I'm pretty sure this

Re: [RFC PATCH] blk-mq: Fix lost request during timeout

2017-09-18 Thread Bart Van Assche
On Mon, 2017-09-18 at 18:03 -0400, Keith Busch wrote: > I think we've always known it's possible to lose a request during timeout > handling, but just accepted that possibility. It seems to be causing > problems, though, leading to unnecessary error escalation and IO failures. > > The possiblity

Re: [PATCH v5] blktrace: Fix potentail deadlock between delete & sysfs ops

2017-09-18 Thread Bart Van Assche
On Sat, 2017-09-16 at 19:37 -0700, Waiman Long wrote: > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 339e737..330b572 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -448,7 +448,7 @@ struct block_device { > > /* The counter of freeze processes */ >

Re: [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE

2017-09-18 Thread Bart Van Assche
On Sun, 2017-09-17 at 20:40 +0800, Ming Lei wrote: > "if no request has completed before the delay has expired" can't be a > reason to rerun the queue, because the queue can still be busy. That statement of you shows that there are important aspects of the SCSI core and dm-mpath driver that you

Re: [PATCH V3 06/12] scsi: sd_zbc: Rearrange code

2017-09-15 Thread Bart Van Assche
On Sat, 2017-09-16 at 07:35 +0900, Damien Le Moal wrote: > rw16 is mandatory for ZBC drives. So it has to be set to true. If the > HBA does not support rw16 (why would that happen ?), then the disk > should not be used. It's good that all HBAs support rw16. But it's nontrivial to analyze whether

Re: [PATCH 5/5] dm-mpath: improve I/O schedule

2017-09-15 Thread Bart Van Assche
On Sat, 2017-09-16 at 00:44 +0800, Ming Lei wrote: > +static void save_path_queue_depth(struct pgpath *p) > +{ > + struct request_queue *q = bdev_get_queue(p->path.dev->bdev); > + > + p->old_nr_requests = q->nr_requests; > + p->queue_depth = q->queue_depth; > + > + /* one extra

Re: [PATCH 5/5] dm-mpath: improve I/O schedule

2017-09-15 Thread Bart Van Assche
On Sat, 2017-09-16 at 00:44 +0800, Ming Lei wrote: > 1) lpfc.lpfc_lun_queue_depth=3, so that it is same with .cmd_per_lun Nobody I know uses such a low queue depth for the lpfc driver. Please also include performance results for a more realistic queue depth. Thanks, Bart.

Re: [PATCH V3 06/12] scsi: sd_zbc: Rearrange code

2017-09-15 Thread Bart Van Assche
On Fri, 2017-09-15 at 19:51 +0200, h...@lst.de wrote: > On Fri, Sep 15, 2017 at 02:51:03PM +0000, Bart Van Assche wrote: > > On Fri, 2017-09-15 at 19:06 +0900, Damien Le Moal wrote: > > > Rearrange sd_zbc_setup() to include use_16_for_rw and use_10_for_rw > > > assignmen

Re: [PATCH 5/5] dm-mpath: improve I/O schedule

2017-09-15 Thread Bart Van Assche
On Sat, 2017-09-16 at 00:44 +0800, Ming Lei wrote: > --- > |v4.13+ |v4.13+ > |+scsi_mq_perf |+scsi_mq_perf+patches > - > IOPS(K) |MQ-DEADLINE|MQ-DEADLINE >

<    7   8   9   10   11   12   13   14   15   16   >