From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755871AbcG0LV2 (ORCPT ); Wed, 27 Jul 2016 07:21:28 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:23058 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754200AbcG0LV0 (ORCPT ); Wed, 27 Jul 2016 07:21:26 -0400 Message-ID: <57989921.5040504@oracle.com> Date: Wed, 27 Jul 2016 19:21:05 +0800 From: Bob Liu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= CC: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, konrad.wilk@oracle.com Subject: Re: [PATCH v3] xen-blkfront: dynamic configuration of per-vbd resources References: <1469589685-31630-1-git-send-email-bob.liu@oracle.com> <20160727105949.3rtlnl2zr4lpsvbc@mac> In-Reply-To: <20160727105949.3rtlnl2zr4lpsvbc@mac> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/27/2016 06:59 PM, Roger Pau Monné wrote: > On Wed, Jul 27, 2016 at 11:21:25AM +0800, Bob Liu wrote: > [...] >> +static ssize_t dynamic_reconfig_device(struct blkfront_info *info, ssize_t count) >> +{ >> + /* >> + * Prevent new requests even to software request queue. >> + */ >> + blk_mq_freeze_queue(info->rq); >> + >> + /* >> + * Guarantee no uncompleted reqs. >> + */ > > I'm also wondering, why do you need to guarantee that there are no > uncompleted requests? The resume procedure is going to call blkif_recover > that will take care of requeuing any unfinished requests that are on the > ring. > Because there may have requests in the software request queue with more segments than we can handle(if info->max_indirect_segments is reduced). The blkif_recover() can't handle this since blk-mq was introduced, because there is no way to iterate the sw-request queues(blk_fetch_request() can't be used by blk-mq). So there is a bug in blkif_recover(), I was thinking implement the suspend function of blkfront_driver like: +static int blkfront_suspend(struct xenbus_device *dev) +{ + blk_mq_freeze_queue(info->rq); + .. +} static struct xenbus_driver blkfront_driver = { .ids = blkfront_ids, .probe = blkfront_probe, .remove = blkfront_remove, + .suspend = blkfront_suspend, .resume = blkfront_resume,