linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	virtio-dev@lists.oasis-open.org,
	virtualization@lists.linux-foundation.org,
	David Herrmann <dh.herrmann@gmail.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:ABI/API" <linux-api@vger.kernel.org>
Subject: Re: [PATCH v3] Add virtio-input driver.
Date: Wed, 25 Mar 2015 06:36:11 +0100	[thread overview]
Message-ID: <20150325063245-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <20150324172805.GA16445@dtor-ws>

On Tue, Mar 24, 2015 at 10:28:05AM -0700, Dmitry Torokhov wrote:
> > > > > +	err = input_register_device(vi->idev);
> > > > > +	if (err)
> > > > > +		goto err_input_register;
> > > > > +
> > > > > +	return 0;
> > > > > +
> > > > > +err_input_register:
> > > > 
> > > > > +	input_free_device(vi->idev);
> > > > 
> > > > At this point you can already get interrupts
> > > > since you called virtio_device_ready, and
> > > > getting events from a freed device likely won't
> > > > DTRT.
> > > 
> > > Right. I guess you want to mark the virtio device ready only after
> > > registering input device.
> > 
> > No that's broken since you can get events after this
> > point, and you won't be able to forward them.
> 
> Who cares?

virtio cares: guest will crash if you attempt to
kick virtqueue before device ready call.

> What makes these events needed compared to ones sent 1 ms
> earlier before we had input device registered?
> 
> But I guess if you can call virtio_device_ready/virtio_device_broken
> several times then the best option is putting them into input_dev->open
> and input_dev->close callbacks.
> 
> Thanks.
> -- 
> Dmitry

      reply	other threads:[~2015-03-25  5:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24  7:32 [PATCH v3] Add virtio-input driver Gerd Hoffmann
2015-03-24 10:26 ` Gerd Hoffmann
2015-03-24 10:40   ` Michael S. Tsirkin
2015-03-24 10:48   ` Michael S. Tsirkin
2015-03-24 10:36 ` Michael S. Tsirkin
2015-03-24 11:46   ` [virtio-dev] " Gerd Hoffmann
2015-03-24 13:02     ` Michael S. Tsirkin
2015-03-24 13:37       ` Gerd Hoffmann
2015-03-24 14:14         ` Michael S. Tsirkin
2015-03-24 15:25           ` Gerd Hoffmann
2015-03-24 16:05             ` Dmitry Torokhov
2015-03-24 16:23   ` Dmitry Torokhov
2015-03-24 17:22     ` Michael S. Tsirkin
2015-03-24 17:28       ` Dmitry Torokhov
2015-03-25  5:36         ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150325063245-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=dh.herrmann@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).