Re: [PATCH] virtio_balloon: set DRIVER_OK before using device

2015-03-09 Thread Rusty Russell
"Michael S. Tsirkin"  writes:
> On Thu, Mar 05, 2015 at 01:24:47PM +1030, Rusty Russell wrote:
>> "Michael S. Tsirkin"  writes:
>> > virtio spec requires that all drivers set DRIVER_OK
>> > before using devices. While balloon isn't yet
>> > included in the virtio 1 spec, previous spec versions
>> > also required this.
>> >
>> > virtio balloon might violate this rule: probe calls
>> > kthread_run before setting DRIVER_OK, which might run
>> > immediately and cause balloon to inflate/deflate.
>> >
>> > To fix, call virtio_device_ready before running the kthread.
>> >
>> > Signed-off-by: Michael S. Tsirkin 
>> 
>> Replied, CC'd stable.
>
> Did you mean applied?

I stand erected.

Franks,
Rusty.
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [PATCH] virtio_balloon: set DRIVER_OK before using device

2015-03-05 Thread Michael S. Tsirkin
On Thu, Mar 05, 2015 at 01:24:47PM +1030, Rusty Russell wrote:
> "Michael S. Tsirkin"  writes:
> > virtio spec requires that all drivers set DRIVER_OK
> > before using devices. While balloon isn't yet
> > included in the virtio 1 spec, previous spec versions
> > also required this.
> >
> > virtio balloon might violate this rule: probe calls
> > kthread_run before setting DRIVER_OK, which might run
> > immediately and cause balloon to inflate/deflate.
> >
> > To fix, call virtio_device_ready before running the kthread.
> >
> > Signed-off-by: Michael S. Tsirkin 
> 
> Replied, CC'd stable.

Did you mean applied?

> Thanks,
> Rusty.
> 
> 
> > ---
> >  drivers/virtio/virtio_balloon.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/virtio/virtio_balloon.c 
> > b/drivers/virtio/virtio_balloon.c
> > index 5a6ad6d..6a356e3 100644
> > --- a/drivers/virtio/virtio_balloon.c
> > +++ b/drivers/virtio/virtio_balloon.c
> > @@ -508,6 +508,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
> > if (err < 0)
> > goto out_oom_notify;
> >  
> > +   virtio_device_ready(vdev);
> > +
> > vb->thread = kthread_run(balloon, vb, "vballoon");
> > if (IS_ERR(vb->thread)) {
> > err = PTR_ERR(vb->thread);
> > -- 
> > MST
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


Re: [PATCH] virtio_balloon: set DRIVER_OK before using device

2015-03-04 Thread Rusty Russell
"Michael S. Tsirkin"  writes:
> virtio spec requires that all drivers set DRIVER_OK
> before using devices. While balloon isn't yet
> included in the virtio 1 spec, previous spec versions
> also required this.
>
> virtio balloon might violate this rule: probe calls
> kthread_run before setting DRIVER_OK, which might run
> immediately and cause balloon to inflate/deflate.
>
> To fix, call virtio_device_ready before running the kthread.
>
> Signed-off-by: Michael S. Tsirkin 

Replied, CC'd stable.

Thanks,
Rusty.


> ---
>  drivers/virtio/virtio_balloon.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 5a6ad6d..6a356e3 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -508,6 +508,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
>   if (err < 0)
>   goto out_oom_notify;
>  
> + virtio_device_ready(vdev);
> +
>   vb->thread = kthread_run(balloon, vb, "vballoon");
>   if (IS_ERR(vb->thread)) {
>   err = PTR_ERR(vb->thread);
> -- 
> MST
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[PATCH] virtio_balloon: set DRIVER_OK before using device

2015-03-04 Thread Michael S. Tsirkin
virtio spec requires that all drivers set DRIVER_OK
before using devices. While balloon isn't yet
included in the virtio 1 spec, previous spec versions
also required this.

virtio balloon might violate this rule: probe calls
kthread_run before setting DRIVER_OK, which might run
immediately and cause balloon to inflate/deflate.

To fix, call virtio_device_ready before running the kthread.

Signed-off-by: Michael S. Tsirkin 
---
 drivers/virtio/virtio_balloon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 5a6ad6d..6a356e3 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -508,6 +508,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
if (err < 0)
goto out_oom_notify;
 
+   virtio_device_ready(vdev);
+
vb->thread = kthread_run(balloon, vb, "vballoon");
if (IS_ERR(vb->thread)) {
err = PTR_ERR(vb->thread);
-- 
MST
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization