public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: fix wrong virtio id for balloon
@ 2011-08-17  9:44 Liming Wang
  2011-08-17  9:44 ` [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean Liming Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Liming Wang @ 2011-08-17  9:44 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, Ingo Molnar, kvm

Replace the wrong rng virtio id with the correct balloon id.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
---
 tools/kvm/virtio/balloon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/kvm/virtio/balloon.c b/tools/kvm/virtio/balloon.c
index c5853a5..aba52d6 100644
--- a/tools/kvm/virtio/balloon.c
+++ b/tools/kvm/virtio/balloon.c
@@ -356,7 +356,7 @@ void virtio_bln__init(struct kvm *kvm)
 
 	bdev.base_addr = bdev_base_addr;
 
-	if (irq__register_device(VIRTIO_ID_RNG, &dev, &pin, &line) < 0)
+	if (irq__register_device(VIRTIO_ID_BALLOON, &dev, &pin, &line) < 0)
 		return;
 
 	bdev.pci_hdr.irq_pin	= pin;
-- 
1.7.0.4


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

* [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean
  2011-08-17  9:44 [PATCH 1/2] kvm tools: fix wrong virtio id for balloon Liming Wang
@ 2011-08-17  9:44 ` Liming Wang
  2011-08-17 11:44   ` Pekka Enberg
  0 siblings, 1 reply; 6+ messages in thread
From: Liming Wang @ 2011-08-17  9:44 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, Ingo Molnar, kvm

Becasue virtio random generator is a single device, change its option
type to boolean.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
---
 tools/kvm/builtin-run.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 2816774..646ba21 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -60,7 +60,7 @@ __thread struct kvm_cpu *current_kvm_cpu;
 
 static u64 ram_size;
 static u8  image_count;
-static int virtio_rng;
+static bool virtio_rng;
 static const char *kernel_cmdline;
 static const char *kernel_filename;
 static const char *vmlinux_filename;
@@ -161,7 +161,7 @@ static const struct option options[] = {
 	OPT_BOOLEAN('\0', "balloon", &balloon, "Enable virtio balloon"),
 	OPT_BOOLEAN('\0', "vnc", &vnc, "Enable VNC framebuffer"),
 	OPT_BOOLEAN('\0', "sdl", &sdl, "Enable SDL framebuffer"),
-	OPT_INCR('\0', "rng", &virtio_rng, "Enable virtio Random Number Generator"),
+	OPT_BOOLEAN('\0', "rng", &virtio_rng, "Enable virtio Random Number Generator"),
 	OPT_CALLBACK('\0', "9p", NULL, "dir_to_share,tag_name",
 		     "Enable virtio 9p to share files between host and guest", virtio_9p_rootdir_parser),
 	OPT_STRING('\0', "console", &console, "serial or virtio",
@@ -641,8 +641,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 		virtio_console__init(kvm);
 
 	if (virtio_rng)
-		while (virtio_rng--)
-			virtio_rng__init(kvm);
+		virtio_rng__init(kvm);
 
 	if (balloon)
 		virtio_bln__init(kvm);
-- 
1.7.0.4


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

* Re: [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean
  2011-08-17  9:44 ` [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean Liming Wang
@ 2011-08-17 11:44   ` Pekka Enberg
  2011-08-17 12:02     ` Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Pekka Enberg @ 2011-08-17 11:44 UTC (permalink / raw)
  To: Liming Wang; +Cc: Sasha Levin, Ingo Molnar, kvm

On 8/17/11 12:44 PM, Liming Wang wrote:
> Becasue virtio random generator is a single device, change its option
> type to boolean.
>
> Signed-off-by: Liming Wang<walimisdev@gmail.com>

I suppose the idea here was to support multiple rng devices. Sasha?

> ---
>   tools/kvm/builtin-run.c |    7 +++----
>   1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
> index 2816774..646ba21 100644
> --- a/tools/kvm/builtin-run.c
> +++ b/tools/kvm/builtin-run.c
> @@ -60,7 +60,7 @@ __thread struct kvm_cpu *current_kvm_cpu;
>
>   static u64 ram_size;
>   static u8  image_count;
> -static int virtio_rng;
> +static bool virtio_rng;
>   static const char *kernel_cmdline;
>   static const char *kernel_filename;
>   static const char *vmlinux_filename;
> @@ -161,7 +161,7 @@ static const struct option options[] = {
>   	OPT_BOOLEAN('\0', "balloon",&balloon, "Enable virtio balloon"),
>   	OPT_BOOLEAN('\0', "vnc",&vnc, "Enable VNC framebuffer"),
>   	OPT_BOOLEAN('\0', "sdl",&sdl, "Enable SDL framebuffer"),
> -	OPT_INCR('\0', "rng",&virtio_rng, "Enable virtio Random Number Generator"),
> +	OPT_BOOLEAN('\0', "rng",&virtio_rng, "Enable virtio Random Number Generator"),
>   	OPT_CALLBACK('\0', "9p", NULL, "dir_to_share,tag_name",
>   		     "Enable virtio 9p to share files between host and guest", virtio_9p_rootdir_parser),
>   	OPT_STRING('\0', "console",&console, "serial or virtio",
> @@ -641,8 +641,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>   		virtio_console__init(kvm);
>
>   	if (virtio_rng)
> -		while (virtio_rng--)
> -			virtio_rng__init(kvm);
> +		virtio_rng__init(kvm);
>
>   	if (balloon)
>   		virtio_bln__init(kvm);


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

* Re: [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean
  2011-08-17 11:44   ` Pekka Enberg
@ 2011-08-17 12:02     ` Sasha Levin
  2011-08-17 15:14       ` walimis
  0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2011-08-17 12:02 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Liming Wang, Ingo Molnar, kvm

On Wed, Aug 17, 2011 at 2:44 PM, Pekka Enberg <penberg@kernel.org> wrote:
> On 8/17/11 12:44 PM, Liming Wang wrote:
>>
>> Becasue virtio random generator is a single device, change its option
>> type to boolean.
>>
>> Signed-off-by: Liming Wang<walimisdev@gmail.com>
>
> I suppose the idea here was to support multiple rng devices. Sasha?

I wrote the idea behind supporting multiple rng devices in the commit
message of that patch:

Since multiple hardware rng devices of the same type are currently
unsupported by the kernel, this serves more as an example of a basic
virtio driver under kvm tools and can be used to debug the PCI layer.

Currently I use it mostly to easily test the virtio-pci and related
code, for example - when I added MSI-X I've tried creating a bunch of
virtio-rng devices and seeing how the kernel handles them.

Since it having multiple virtio-rng devices doesn't really do anything
in the guest at the moment it could also be removed (unless we fix the
kernel to support them :) ).

IMO this can go either way, theres no reason to keep support for
multiple devices besides making development a bit easier.

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

* Re: [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean
  2011-08-17 12:02     ` Sasha Levin
@ 2011-08-17 15:14       ` walimis
  2011-08-17 15:53         ` Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: walimis @ 2011-08-17 15:14 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Pekka Enberg, Ingo Molnar, kvm

On Wed, Aug 17, 2011 at 03:02:55PM +0300, Sasha Levin wrote:
>On Wed, Aug 17, 2011 at 2:44 PM, Pekka Enberg <penberg@kernel.org> wrote:
>> On 8/17/11 12:44 PM, Liming Wang wrote:
>>>
>>> Becasue virtio random generator is a single device, change its option
>>> type to boolean.
>>>
>>> Signed-off-by: Liming Wang<walimisdev@gmail.com>
>>
>> I suppose the idea here was to support multiple rng devices. Sasha?
>
>I wrote the idea behind supporting multiple rng devices in the commit
>message of that patch:
>
>Since multiple hardware rng devices of the same type are currently
>unsupported by the kernel, this serves more as an example of a basic
>virtio driver under kvm tools and can be used to debug the PCI layer.
>
>Currently I use it mostly to easily test the virtio-pci and related
>code, for example - when I added MSI-X I've tried creating a bunch of
>virtio-rng devices and seeing how the kernel handles them.
I see.
I found this issue because kvm tools crashed when I used multiple rng devices
to test.
>
>Since it having multiple virtio-rng devices doesn't really do anything
>in the guest at the moment it could also be removed (unless we fix the
>kernel to support them :) ).
>
>IMO this can go either way, theres no reason to keep support for
>multiple devices besides making development a bit easier.
OK, as you said, we can keep it for development.

walimis

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

* Re: [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean
  2011-08-17 15:14       ` walimis
@ 2011-08-17 15:53         ` Sasha Levin
  0 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2011-08-17 15:53 UTC (permalink / raw)
  To: walimis; +Cc: Pekka Enberg, Ingo Molnar, kvm

On Wed, Aug 17, 2011 at 6:14 PM, walimis <walimisdev@gmail.com> wrote:
> On Wed, Aug 17, 2011 at 03:02:55PM +0300, Sasha Levin wrote:
>>On Wed, Aug 17, 2011 at 2:44 PM, Pekka Enberg <penberg@kernel.org> wrote:
>>> On 8/17/11 12:44 PM, Liming Wang wrote:
>>>>
>>>> Becasue virtio random generator is a single device, change its option
>>>> type to boolean.
>>>>
>>>> Signed-off-by: Liming Wang<walimisdev@gmail.com>
>>>
>>> I suppose the idea here was to support multiple rng devices. Sasha?
>>
>>I wrote the idea behind supporting multiple rng devices in the commit
>>message of that patch:
>>
>>Since multiple hardware rng devices of the same type are currently
>>unsupported by the kernel, this serves more as an example of a basic
>>virtio driver under kvm tools and can be used to debug the PCI layer.
>>
>>Currently I use it mostly to easily test the virtio-pci and related
>>code, for example - when I added MSI-X I've tried creating a bunch of
>>virtio-rng devices and seeing how the kernel handles them.
> I see.
> I found this issue because kvm tools crashed when I used multiple rng devices
> to test.

virtio-rng itself wasn't written to support multiple devices either,
what you see when you cat /dev/hwrng with more than one device is the
guest driver hitting a BUG(). Execution should resume within the
guest.

kvm tools is innocent :)

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

end of thread, other threads:[~2011-08-17 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17  9:44 [PATCH 1/2] kvm tools: fix wrong virtio id for balloon Liming Wang
2011-08-17  9:44 ` [PATCH 2/2] kvm tools: change option type of RNG from increment to boolean Liming Wang
2011-08-17 11:44   ` Pekka Enberg
2011-08-17 12:02     ` Sasha Levin
2011-08-17 15:14       ` walimis
2011-08-17 15:53         ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox