From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751381AbcFRWKk (ORCPT ); Sat, 18 Jun 2016 18:10:40 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35163 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbcFRWKj (ORCPT ); Sat, 18 Jun 2016 18:10:39 -0400 Subject: Re: [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes To: Bob Liu , linux-kernel@vger.kernel.org References: <1465811906-24510-1-git-send-email-bob.liu__9616.24590349874$1465832216$gmane$org@oracle.com> Cc: virtualization@lists.linux-foundation.org, mst@redhat.com From: Paolo Bonzini Message-ID: <3cd56d3a-85f0-9cce-d42f-f4eace84667b@redhat.com> Date: Sun, 19 Jun 2016 00:10:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1465811906-24510-1-git-send-email-bob.liu__9616.24590349874$1465832216$gmane$org@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/06/2016 11:58, Bob Liu wrote: > A guest might be migrated to other hosts with different num_queues, the > blk-core should aware of that else the reference of &vblk->vqs[qid] may be wrong. > > Signed-off-by: Bob Liu > --- > drivers/block/virtio_blk.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index 42758b5..c169238 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -819,6 +819,9 @@ static int virtblk_restore(struct virtio_device *vdev) > if (ret) > return ret; > > + if (vblk->num_vqs != vblk->tag_set.nr_hw_queues) > + blk_mq_update_nr_hw_queues(&vblk->tag_set, vblk->num_vqs); > + > virtio_device_ready(vdev); > > blk_mq_start_stopped_hw_queues(vblk->disk->queue, true); > This should never happen; it'd be a configuration problem. Paolo