qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Dave Airlie <airlied@gmail.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] virtio device error reporting best practice?
Date: Thu, 20 Mar 2014 08:51:58 +0200	[thread overview]
Message-ID: <20140320065158.GA31889@redhat.com> (raw)
In-Reply-To: <87lhw7rppw.fsf@rustcorp.com.au>

On Wed, Mar 19, 2014 at 11:04:19AM +1030, Rusty Russell wrote:
> Dave Airlie <airlied@gmail.com> writes:
> > So I'm looking at how best to do virtio gpu device error reporting,
> > and how to deal with illegal stuff,
> >
> > I've two levels of errors I want to support,
> >
> > a) unrecoverable or bad guest kernel programming errors,
> 
> The QEMU standard approach is to exit at this point.  No, really.

It's easy on the hypervisor but often not very friendly for driver writers
who might not be qemu experts.
QEMU's moving away from exiting on errors and it would be nice
to have a robust way to report driver bugs.
How about setting VIRTIO_CONFIG_S_DEVICE_FAILED ?

Another idea that windows driver implemented is reporting
failure reason hint. They wrote it out to ISR, specifically
they notified host about watchdog timer expiration for net device
in this way.

> > b) per 3D context errors from the renderer backend,
> >
> > (b) I can easily report in an event queue and the guest kernel can in
> > theory blow away the offenders, this is how GL works with some
> > extensions,
> 
> That's probably sanest.

If it's possible to identify the offenders, I agree
a VQ is better than config space for that.
Need to make sure the queue is big enough to avoid
underrun of that queue though. Is that always possible?

> > GPU control queue, the response should always be no error, but in some
> > cases it will be because the guest hit some host resource error, or
> > asked for something insane, (guest kernel drivers would be broken in
> > most of these cases).
> >
> > Alternately I can use the separate event queue to send async errors
> > when the guest does something bad,
> >
> > I'm also considering adding some sort of flag in config space saying
> > the device needs a reset before it will continue doing anything,
> 
> I generally dislike error codes which Never Happen; it's like making
> every void function return int just in case: the caller has no idea what
> to do if it fails.
> 
> The litmus test: does *your* guest handle failures other than by giving
> up on the device?  If so, sure, you need to have a sane error-reporting
> strategy.

Right but driver development is also a valid need.

> > The main reason I'm considering this stuff is for security reasons if
> > the guest asks for something really illegal or crazy what should the
> > expected behaviour of the host be? (at least secure I know that).
> 
> If the guest userspace can do it, don't exit.  If the kernel only, and
> it's should have known better, abort is OK.

I second that, at least for now.
Maybe we will add more capabilities in virtio 1.0, or
after that.

> Sure that doesn't help much!
> Rusty.

  parent reply	other threads:[~2014-03-20  6:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-17  6:02 [Qemu-devel] virtio device error reporting best practice? Dave Airlie
2014-03-17 14:28 ` Laszlo Ersek
2014-03-17 14:40   ` Peter Maydell
2014-03-17 14:49     ` Laszlo Ersek
2014-03-17 14:54       ` Peter Maydell
2014-03-17 14:57       ` Gerd Hoffmann
2014-03-17 19:05       ` Andreas Färber
2014-03-18 12:45       ` Kevin Wolf
2014-03-17 14:57     ` Richard W.M. Jones
2014-03-17 14:59       ` Richard W.M. Jones
2014-03-26 12:49   ` Stefan Hajnoczi
2014-03-17 14:50 ` Gerd Hoffmann
2014-03-19  0:34 ` Rusty Russell
2014-03-19  8:12   ` Markus Armbruster
2014-03-20  3:40     ` Rusty Russell
2014-03-20  6:39       ` Markus Armbruster
2014-03-20 12:53         ` Peter Maydell
2014-03-26 14:34           ` Markus Armbruster
2014-03-27  0:54             ` Venkatesh Srinivas
2014-03-20  6:51   ` Michael S. Tsirkin [this message]
2014-03-21  9:44     ` Yan Vugenfirer

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=20140320065158.GA31889@redhat.com \
    --to=mst@redhat.com \
    --cc=airlied@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    /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).