virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes
@ 2016-06-13  9:58 Bob Liu
  2016-06-18 22:10 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Liu @ 2016-06-13  9:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Bob Liu, virtualization, mst

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 <bob.liu@oracle.com>
---
 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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes
  2016-06-13  9:58 [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes Bob Liu
@ 2016-06-18 22:10 ` Paolo Bonzini
  2016-07-28  8:18   ` Bob Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2016-06-18 22:10 UTC (permalink / raw)
  To: Bob Liu, linux-kernel; +Cc: mst, virtualization



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 <bob.liu@oracle.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes
  2016-06-18 22:10 ` Paolo Bonzini
@ 2016-07-28  8:18   ` Bob Liu
  2016-08-01  9:58     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Liu @ 2016-07-28  8:18 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: mst, linux-kernel, virtualization


On 06/19/2016 06:10 AM, Paolo Bonzini wrote:
> 
> 
> 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 <bob.liu@oracle.com>
>> ---
>>  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.
> 

Do you mean all hosts have to be configured with the same number of ->num_vqs?
What about cases like migrating a guest from HostA to HostB while HostB is much more powerful
and would like to run more hardware queues to get better performance.

Thanks,
Bob Liu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes
  2016-07-28  8:18   ` Bob Liu
@ 2016-08-01  9:58     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2016-08-01  9:58 UTC (permalink / raw)
  To: Bob Liu; +Cc: mst, linux-kernel, virtualization



On 28/07/2016 10:18, 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 <bob.liu@oracle.com>
>>> >> ---
>>> >>  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.
>> > 
> Do you mean all hosts have to be configured with the same number of ->num_vqs?
> What about cases like migrating a guest from HostA to HostB while HostB is much more powerful
> and would like to run more hardware queues to get better performance.

The number of queues should be equal to the number of CPUs for the
guest, not to the number of CPUs or queues on the host.  The idea is to
have one queue per guest vCPU.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-01  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13  9:58 [PATCH] drivers: virtio_blk: notify blk-core when hw-queue number changes Bob Liu
2016-06-18 22:10 ` Paolo Bonzini
2016-07-28  8:18   ` Bob Liu
2016-08-01  9:58     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).