All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Bligh <alex@alex.org.uk>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Cc: Konrad Wilk <konrad.wilk@oracle.com>,
	Alex Bligh <alex@alex.org.uk>, Jan Beulich <JBeulich@suse.com>,
	Xen Devel <xen-devel@lists.xen.org>
Subject: Re: Fatal crash on xen4.2 HVM + qemu-xen dm + NFS
Date: Wed, 23 Jan 2013 15:19:01 +0000	[thread overview]
Message-ID: <DEBAB6AE486E0674778F7C2D@nimrod.local> (raw)
In-Reply-To: <alpine.DEB.2.02.1301231144300.29727@kaball.uk.xensource.com>

Ian, Stefano,

First bit of good news: Avoiding using O_DIRECT in xen_disk.c
fixes the problem (see patch below for what we tested).

Therefore I think this problem will potentially occur:

* Using qemu-xen or qemu-traditional (both of which use O_DIRECT)

* With anything that uses a grant of another domX's memory (I
  suspect that includes PV guests as well as HVM).

* Whenever the dom0 uses TCP to the backing device. That includes
  NFS and iSCSI.

Disabling O_DIRECT is therefore a workaround, but I suspect not
an attractive workaround performance-wise. Fixing it properly
would appear to require Ian C's skbuff page tracking stuff.

>> I suspect the best possible answer is a
>>   cache=[qemu-cache-identifier]
>> config key, which gets put in xenstore, and which xen_disk.c then
>> interprets using the same routine QEMU does itself for cache= on the
>> command line, then uses exactly those BDEV flags.
>
> that would be nice to have

Good

>> For completeness one could also add an emulcache= option and just
>> pass that straight through to the qemu command line for the emulated
>> drives.
>
> In qemu-xen it should be already possible to change the cache setting
> for the IDE disk by passing the right command line option to QEMU. Not
> ideal, but it would work.

It would indeed, but 'cache=writeback' is currently hard coded. I was
planning to change that to 'cache=%s' and pass the value of
emulcache=.

>> I had a quick look at this on the train and it appears that to do it
>> properly requires fiddling with lex file and possibly xenstore, i.e.
>> is not completely trivial.
>>
>> An alternative more disgusting arrangement would be to overload one
>> of the existing options.
>>
>> What's the right approach here, and have I any hope of getting a patch
>> into 4.2.2? Not a disaster if not as I already need to maintain a local
>> tree due to the absence of HVM live migrate on qemu-upstream.
>
> Backports are only for bug fixes.

Sure - and it would seem to me dom0 crashing horribly is a bug! I
have a reliable way to replicate it, but it can happen to others.

In terms of a local fix, a one line change to xen_disk is all I need.

What I'm asking is what is the right way to fix this bug in 4.2.
At one extreme, I can probably cook up a 'let's do it properly' patch
which takes the proposed cache= option (most useful, most intrusive).
At the other extreme, we could just apply the patch below or a variant
of it conditional on a configure flag (least useful, least intrusive).

> However it might be possible to
> backport a simple patch that in case of opening failure with O_DIRECT,
> tries again without it (see appended). I don't think that would work
> for you though, unless you manage to mount NFS in a way that would
> return EINVAL on open(O_DIRECT), like it used to.

I don't think that will work for any of the problem cases I've identified
above as NFS always permits O_DIRECT opens (I'm not even sure whether
CONFIG_NFS_DIRECTIO still exists), and so does iSCSI.

-- 
Alex Bligh

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index a402ac8..1c3a6f5 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -603,7 +603,7 @@ static int blk_init(struct XenDevice *xendev)
     }

     /* read-only ? */
-    qflags = BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO;
+    qflags = /* BDRV_O_NOCACHE | */ BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO;
     if (strcmp(blkdev->mode, "w") == 0) {
         qflags |= BDRV_O_RDWR;
     } else {

  reply	other threads:[~2013-01-23 15:19 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 14:54 Fatal crash on xen4.2 HVM + qemu-xen dm + NFS Alex Bligh
2012-12-17 10:10 ` Jan Beulich
2012-12-17 17:09   ` Alex Bligh
2013-01-16 10:56   ` Alex Bligh
2013-01-16 14:34     ` Stefano Stabellini
2013-01-16 15:06       ` Alex Bligh
2013-01-16 16:00         ` Alex Bligh
2013-01-16 16:27         ` Stefano Stabellini
2013-01-16 17:13           ` Alex Bligh
2013-01-16 17:33             ` Stefano Stabellini
2013-01-16 17:39               ` Stefano Stabellini
2013-01-16 18:14                 ` Alex Bligh
2013-01-16 18:49                   ` Stefano Stabellini
2013-01-16 19:00                     ` Stefano Stabellini
2013-01-17  7:58                       ` Alex Bligh
2013-01-16 18:12               ` Alex Bligh
2013-01-21 15:15               ` Alex Bligh
2013-01-21 15:23                 ` Ian Campbell
2013-01-21 15:35                   ` Alex Bligh
2013-01-21 15:50                     ` Ian Campbell
2013-01-21 16:33                       ` Alex Bligh
2013-01-21 16:51                         ` Ian Campbell
2013-01-21 17:06                           ` Alex Bligh
2013-01-21 17:29                             ` Ian Campbell
2013-01-21 17:31                           ` Alex Bligh
2013-01-21 17:32                             ` Ian Campbell
2013-01-21 18:14                               ` Alex Bligh
2013-01-22 10:05                                 ` Ian Campbell
2013-01-22 13:02                                   ` Alex Bligh
2013-01-22 13:13                                     ` Ian Campbell
2013-01-21 20:37                           ` Alex Bligh
2013-01-22 10:07                             ` Ian Campbell
2013-01-22 13:01                               ` Alex Bligh
2013-01-22 13:14                                 ` Ian Campbell
2013-01-22 13:18                                   ` Alex Bligh
2013-01-22 10:13                             ` Ian Campbell
2013-01-22 12:59                               ` Alex Bligh
2013-01-22 15:46                                 ` Stefano Stabellini
2013-01-22 15:42                             ` Stefano Stabellini
2013-01-22 16:09                               ` Stefano Stabellini
2013-01-22 20:31                                 ` Alex Bligh
2013-01-23 11:52                                   ` Stefano Stabellini
2013-01-23 15:19                                     ` Alex Bligh [this message]
2013-01-23 16:29                                       ` Stefano Stabellini
2013-01-25 11:28                                         ` Alex Bligh
2013-02-05 15:40                                           ` Alex Bligh
2013-02-22 17:28                                             ` Alex Bligh
2013-02-22 17:41                                               ` Konrad Rzeszutek Wilk
2013-02-22 18:00                                                 ` Stefano Stabellini
2013-02-22 19:53                                                 ` Alex Bligh
2013-03-06 11:50                                                   ` Alex Bligh
2013-03-07  1:01                                                     ` Konrad Rzeszutek Wilk
2013-03-07  4:15                                                       ` Stefano Stabellini
2013-03-07 10:47                                                         ` [PATCH] QEMU(upstream): Disable xen's use of O_DIRECT by default as it results in crashes Alex Bligh
2013-03-08  3:18                                                           ` Stefano Stabellini
2013-03-08  9:25                                                             ` [PATCHv2] " Alex Bligh
2013-03-08  9:26                                                             ` [PATCH] " Alex Bligh
2013-03-08 10:17                                                             ` George Dunlap
2013-03-08 10:27                                                               ` Alex Bligh
2013-03-08 10:35                                                                 ` George Dunlap
2013-03-08 10:50                                                                   ` Alex Bligh
2013-03-08 11:18                                                                     ` George Dunlap
2013-03-08 11:40                                                                       ` [PATCHv3] " Alex Bligh
2013-03-08 12:54                                                                         ` George Dunlap
2013-03-11 14:02                                                                           ` Alex Bligh
2013-03-11 14:42                                                                             ` George Dunlap
2013-03-11 17:48                                                                               ` Konrad Rzeszutek Wilk
2013-03-11 17:55                                                                                 ` Ian Jackson
2013-03-14 17:06                                                                                   ` Alex Bligh
2013-03-14 18:26                                                                                     ` Ian Jackson
2013-03-12 12:08                                                                               ` Ian Campbell
2013-03-14 18:37                                                                         ` Stefano Stabellini
2013-03-14 19:30                                                                           ` Ian Jackson
2013-03-14 19:56                                                                             ` Alex Bligh
2013-03-15  9:28                                                                             ` Ian Campbell
2013-03-15 10:43                                                                               ` Stefano Stabellini
2013-03-15 11:21                                                                                 ` Ian Jackson
2013-03-15 11:28                                                                                   ` Stefano Stabellini
2013-03-15 11:37                                                                                     ` Ian Jackson
2013-03-15 11:43                                                                                       ` Stefano Stabellini
2013-03-15 12:43                                                                                         ` Alex Bligh
2013-03-15 12:50                                                                                           ` Ian Campbell
2013-03-15 18:31                                                                                         ` Ian Jackson
2013-03-18 10:29                                                                                         ` Alex Bligh
2013-03-18 11:47                                                                                           ` Stefano Stabellini
2013-03-18 12:21                                                                                             ` Alex Bligh
2013-03-08 11:41                                                                       ` [PATCH] " Alex Bligh
2013-03-08 10:28                                                               ` George Dunlap
2013-03-08 10:45                                                                 ` Alex Bligh
2013-03-07 10:51                                                         ` Fatal crash on xen4.2 HVM + qemu-xen dm + NFS Alex Bligh
2013-03-07  8:16                                                       ` Alex Bligh

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=DEBAB6AE486E0674778F7C2D@nimrod.local \
    --to=alex@alex.org.uk \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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 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.