qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] report read/write errors to IDE guest driver as ECC errors
Date: Tue, 05 Aug 2008 21:26:14 -0500	[thread overview]
Message-ID: <48990BC6.1050503@codemonkey.ws> (raw)
In-Reply-To: <20080805115506.GR4478@implementation.uk.xensource.com>

Samuel Thibault wrote:
> report read/write errors to IDE guest driver as ECC errors
> so that the guest knows that e.g. writes on read-only backends have
> failed.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
>   

I'm glad you sent this patch as I think it's something we really need to 
improve in QEMU.

A patch like this has appeared on the list a number of times, and each 
time it meets with a fair bit of criticism.  The most  cited issue is 
that indiscriminately passing IO errors to the guest is not really 
correct.  If you're passing through a drive, then EIO errors are pretty 
reasonable to pass through as an ECC error.  If you're dealing with a 
file, generating an ECC error on ENOSPC is not really accurate.  The 
guest cannot really do anything about that either and is likely to just 
further corrupt itself.

I think a patch like this is good in theory but it needs to do a better 
job only handling the case where an error occurs that ECC really makes 
sense.

For things like ENOSPC, there are better error handling strategies.  For 
instance, vm_stop()'ing the guest and printing out an error message.  
This would allow the admin to free up some space, and then resume the 
guest.  Even if you just stubbed these things out with FIXMEs, it would 
be better than pretending that these cases didn't exist :-)

Regards,

Anthony Liguori

> Index: hw/ide.c
> ===================================================================
> --- hw/ide.c	(révision 4985)
> +++ hw/ide.c	(copie de travail)
> @@ -891,7 +891,6 @@
>      return 1;
>  }
>  
> -/* XXX: handle errors */
>  static void ide_read_dma_cb(void *opaque, int ret)
>  {
>      BMDMAState *bm = opaque;
> @@ -899,6 +898,14 @@
>      int n;
>      int64_t sector_num;
>  
> +    if (ret) {
> +        s->status = READY_STAT | ERR_STAT;
> +        s->error = ABRT_ERR | ECC_ERR;
> +        s->nsector = 0;
> +        ide_set_irq(s);
> +        goto eot;
> +    }
> +
>      n = s->io_buffer_size >> 9;
>      sector_num = ide_get_sector(s);
>      if (n > 0) {
> @@ -992,7 +999,6 @@
>      }
>  }
>  
> -/* XXX: handle errors */
>  static void ide_write_dma_cb(void *opaque, int ret)
>  {
>      BMDMAState *bm = opaque;
> @@ -1000,6 +1006,14 @@
>      int n;
>      int64_t sector_num;
>  
> +    if (ret) {
> +        s->status = READY_STAT | ERR_STAT;
> +        s->error = ABRT_ERR | ECC_ERR;
> +        s->nsector = 0;
> +        ide_set_irq(s);
> +        goto eot;
> +    }
> +
>      n = s->io_buffer_size >> 9;
>      sector_num = ide_get_sector(s);
>      if (n > 0) {
>
>
>   

  reply	other threads:[~2008-08-06  2:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 11:55 [Qemu-devel] [PATCH] report read/write errors to IDE guest driver as ECC errors Samuel Thibault
2008-08-06  2:26 ` Anthony Liguori [this message]
2008-08-06  9:28   ` Daniel P. Berrange
2008-08-06 12:22     ` Jamie Lokier
2008-08-11 16:47     ` Ian Jackson
2008-08-11 17:01       ` [Qemu-devel] [PATCH] report read/write errors to IDE guest driver as ECC errorsj Samuel Thibault
2008-08-11 17:56         ` Jamie Lokier
2008-08-11 17:05       ` [Qemu-devel] [PATCH] report read/write errors to IDE guest driver as ECC errors Anthony Liguori
2008-08-06 16:21 ` [Qemu-devel] " Samuel Thibault

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=48990BC6.1050503@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.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).