From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v5 03/10] xen/blkfront: pseudo support for multi hardware queues/rings Date: Mon, 16 Nov 2015 15:38:38 -0500 Message-ID: <20151116203838.GF25235@char.us.oracle.com> References: <1447470739-18136-1-git-send-email-bob.liu@oracle.com> <1447470739-18136-4-git-send-email-bob.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1447470739-18136-4-git-send-email-bob.liu@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Bob Liu Cc: jonathan.davies@citrix.com, felipe.franciosi@citrix.com, rafal.mielniczuk@citrix.com, linux-kernel@vger.kernel.org, xen-devel@lists.xen.org, axboe@fb.com, david.vrabel@citrix.com, avanzini.arianna@gmail.com, roger.pau@citrix.com List-Id: xen-devel@lists.xenproject.org > +static void blkif_free(struct blkfront_info *info, int suspend) > +{ > + struct grant *persistent_gnt, *n; > + unsigned int i; > + > + /* Prevent new requests being issued until we fix things up. */ > + spin_lock_irq(&info->io_lock); > + info->connected = suspend ? > + BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; > + /* No more blkif_request(). */ > + if (info->rq) > + blk_mq_stop_hw_queues(info->rq); > + > + /* Remove all persistent grants */ > + if (!list_empty(&info->grants)) { > + list_for_each_entry_safe(persistent_gnt, n, > + &info->grants, node) { > + list_del(&persistent_gnt->node); > + if (persistent_gnt->gref != GRANT_INVALID_REF) { > + gnttab_end_foreign_access(persistent_gnt->gref, > + 0, 0UL); > + info->persistent_gnts_c--; > + } > + if (info->feature_persistent) > + __free_page(persistent_gnt->page); > + kfree(persistent_gnt); > + } > + } > + BUG_ON(info->persistent_gnts_c != 0); > + > + for (i = 0; i < info->nr_rings; i++) > + blkif_free_ring(&info->rinfo[i]); > + kfree(info->rinfo); ?? That should be inside the loop. Anyhow did this change: diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index d73734f..6b46d4d 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -611,7 +611,7 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri max_grefs += INDIRECT_GREFS(max_grefs); /* - * We have to reserve 'max_grefs' grants at first because persistent + * We have to reserve 'max_grefs' grants because persistent * grants are shared by all rings. */ if (max_grefs > 0) @@ -1212,9 +1212,11 @@ static void blkif_free(struct blkfront_info *info, int suspend) } BUG_ON(info->persistent_gnts_c != 0); - for (i = 0; i < info->nr_rings; i++) + for (i = 0; i < info->nr_rings; i++) { blkif_free_ring(&info->rinfo[i]); - kfree(info->rinfo); + kfree(info->rinfo); + info->ring = NULL; + } info->nr_rings = 0; spin_unlock_irq(&info->io_lock); } and put in my 'for-jens-4.5' branch.