lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130117051325.GA31469@aaronlu.sh.intel.com>
Date:	Thu, 17 Jan 2013 13:13:25 +0800
From:	Aaron Lu <aaron.lu@...el.com>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	Jens Axboe <axboe@...nel.dk>, "Rafael J. Wysocki" <rjw@...k.pl>,
	James Bottomley <James.Bottomley@...senpartnership.com>,
	linux-pm@...r.kernel.org, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org, Aaron Lu <aaron.lwe@...il.com>,
	Shane Huang <shane.huang@....com>
Subject: Re: [PATCH v7 3/4] block: implement runtime pm strategy

On Wed, Jan 16, 2013 at 10:30:45AM -0500, Alan Stern wrote:
> On Wed, 16 Jan 2013, Aaron Lu wrote:
> 
> > From: Lin Ming <ming.m.lin@...el.com>
> > 
> > When a request is added:
> >     If device is suspended or is suspending and the request is not a
> >     PM request, resume the device.
> > 
> > When the last request finishes:
> >     Call pm_runtime_mark_last_busy().
> > 
> > When pick a request:
> >     If device is resuming/suspending, then only PM request is allowed
> >     to go.
> > 
> > Signed-off-by: Lin Ming <ming.m.lin@...el.com>
> > Signed-off-by: Aaron Lu <aaron.lu@...el.com>
> 
> Just a couple of minor problems remaining...
> 
> > --- a/block/blk-core.c
> > +++ b/block/blk-core.c
> 
> > @@ -2051,6 +2063,28 @@ static void blk_account_io_done(struct request *req)
> >  	}
> >  }
> >  
> > +#ifdef CONFIG_PM_RUNTIME
> > +/*
> > + * Don't process normal requests when queue is suspended
> > + * or in the process of suspending/resuming
> > + */
> > +static struct request *blk_pm_peek_request(struct request_queue *q,
> > +					   struct request *rq)
> > +{
> > +	if (q->rpm_status == RPM_SUSPENDED ||
> > +	    (q->rpm_status != RPM_ACTIVE && !(rq->cmd_flags & REQ_PM)))
> > +		return NULL;
> > +	else
> > +		return rq;
> > +}
> 
> You don't check q->dev here, so the result is indefinite for devices
> that don't use runtime PM.  (Actually it will work out because
> RPM_ACTIVE is defined as 0, but that's a pretty fragile approach.)
> 
> Either do check q->dev here, or else explicitly initialize
> q->rpm_status when the queue is created.

I think I'll check q->dev, which is more clear.

> 
> 
> > --- a/block/elevator.c
> > +++ b/block/elevator.c
> > @@ -34,6 +34,7 @@
> >  #include <linux/blktrace_api.h>
> >  #include <linux/hash.h>
> >  #include <linux/uaccess.h>
> > +#include <linux/pm_runtime.h>
> >  
> >  #include <trace/events/block.h>
> >  
> > @@ -515,6 +516,27 @@ void elv_bio_merged(struct request_queue *q, struct request *rq,
> >  		e->type->ops.elevator_bio_merged_fn(q, rq, bio);
> >  }
> >  
> > +#ifdef CONFIG_PM_RUNTIME
> > +static void blk_pm_requeue_request(struct request *rq)
> > +{
> > +	if (!(rq->cmd_flags & REQ_PM))
> > +		rq->q->nr_pending--;
> > +}
> 
> You don't check q->dev here.  That's okay, but it means that
> q->nr_pending will be meaningless or wrong if any I/O takes place
> before blk_pm_runtime_init is called.

Right, so I had better check q->dev here too.

> 
> Therefore the kerneldoc for blk_pm_runtime_init should mention that it
> must not be called after any requests have been submitted.  Also

So with the q->dev check added above, I believe this is not needed.

> mention that blk_pm_runtime_init enables runtime PM for q->dev, so the 
> caller shouldn't do it.

OK, thanks for the suggestion.

-Aaron

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ