All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio_balloon: set DRIVER_OK before using device
@ 2015-03-04 13:14 ` Michael S. Tsirkin
  0 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2015-03-04 13:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rusty Russell, virtualization

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 <mst@redhat.com>
---
 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

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

* [PATCH] virtio_balloon: set DRIVER_OK before using device
@ 2015-03-04 13:14 ` Michael S. Tsirkin
  0 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2015-03-04 13:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: virtualization

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 <mst@redhat.com>
---
 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

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

* Re: [PATCH] virtio_balloon: set DRIVER_OK before using device
  2015-03-04 13:14 ` Michael S. Tsirkin
  (?)
@ 2015-03-05  2:54 ` Rusty Russell
  2015-03-05  8:39   ` Michael S. Tsirkin
  2015-03-05  8:39   ` Michael S. Tsirkin
  -1 siblings, 2 replies; 7+ messages in thread
From: Rusty Russell @ 2015-03-05  2:54 UTC (permalink / raw)
  To: Michael S. Tsirkin, linux-kernel; +Cc: virtualization

"Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>

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

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

* Re: [PATCH] virtio_balloon: set DRIVER_OK before using device
  2015-03-05  2:54 ` Rusty Russell
@ 2015-03-05  8:39   ` Michael S. Tsirkin
  2015-03-09  7:03     ` Rusty Russell
  2015-03-09  7:03     ` Rusty Russell
  2015-03-05  8:39   ` Michael S. Tsirkin
  1 sibling, 2 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2015-03-05  8:39 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, virtualization

On Thu, Mar 05, 2015 at 01:24:47PM +1030, Rusty Russell wrote:
> "Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>
> 
> 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

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

* Re: [PATCH] virtio_balloon: set DRIVER_OK before using device
  2015-03-05  2:54 ` Rusty Russell
  2015-03-05  8:39   ` Michael S. Tsirkin
@ 2015-03-05  8:39   ` Michael S. Tsirkin
  1 sibling, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2015-03-05  8:39 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, virtualization

On Thu, Mar 05, 2015 at 01:24:47PM +1030, Rusty Russell wrote:
> "Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>
> 
> 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

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

* Re: [PATCH] virtio_balloon: set DRIVER_OK before using device
  2015-03-05  8:39   ` Michael S. Tsirkin
  2015-03-09  7:03     ` Rusty Russell
@ 2015-03-09  7:03     ` Rusty Russell
  1 sibling, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2015-03-09  7:03 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, virtualization

"Michael S. Tsirkin" <mst@redhat.com> writes:
> On Thu, Mar 05, 2015 at 01:24:47PM +1030, Rusty Russell wrote:
>> "Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>
>> 
>> Replied, CC'd stable.
>
> Did you mean applied?

I stand erected.

Franks,
Rusty.

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

* Re: [PATCH] virtio_balloon: set DRIVER_OK before using device
  2015-03-05  8:39   ` Michael S. Tsirkin
@ 2015-03-09  7:03     ` Rusty Russell
  2015-03-09  7:03     ` Rusty Russell
  1 sibling, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2015-03-09  7:03 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, virtualization

"Michael S. Tsirkin" <mst@redhat.com> writes:
> On Thu, Mar 05, 2015 at 01:24:47PM +1030, Rusty Russell wrote:
>> "Michael S. Tsirkin" <mst@redhat.com> 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 <mst@redhat.com>
>> 
>> Replied, CC'd stable.
>
> Did you mean applied?

I stand erected.

Franks,
Rusty.

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

end of thread, other threads:[~2015-03-09  7:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 13:14 [PATCH] virtio_balloon: set DRIVER_OK before using device Michael S. Tsirkin
2015-03-04 13:14 ` Michael S. Tsirkin
2015-03-05  2:54 ` Rusty Russell
2015-03-05  8:39   ` Michael S. Tsirkin
2015-03-09  7:03     ` Rusty Russell
2015-03-09  7:03     ` Rusty Russell
2015-03-05  8:39   ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.