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

On Mon, 21 Jan 2013, Alex Bligh wrote:
> Ian, Stefano,
> 
> --On 21 January 2013 16:51:13 +0000 Ian Campbell <Ian.Campbell@citrix.com> 
> wrote:
> 
> > Not as far as I know, but Trond zero-copy == O_DIRECT so if you aren't
> > using O_DIRECT then you aren't using zero copy -- and that agrees with
> > my recollection. In that case your issue is something totally unrelated.
> 
> Further investigation suggests that Stefano's commit
>   47982cb00584371928e44ab6dfc6865d605a52fd
> (attached below) may have somewhat surprising results.
> 
> Firstly, changing the cache=writeback settings as passed to the QEMU
> command line probably only affects emulated disks, as the parameters
> for the PV disk appear to be hard coded per this commit, assuming I've
> understood correctly. I am guessing my fiddling with the cache=
> setting merely caused the emulated disk (used in HVM until the kernel
> has loaded) to break.

That is correct.


> Secondly, the chosen mode of cache operation is:
>   BDRV_O_NOCACHE | BDRV_O_CACHE_WB
> This appears to be the same as "cache=none" produces (see code
> fragment from bdrv_parse_cache_flags below), which is somewhat
> counterintuitive given the name of the second flag. "cache=writeback"
> (as appears on the command line) uses BDRV_O_CACHE_WB only.
>
> BDRV_O_NOCACHE appears to map on Linux to O_DIRECT, and BDRV_O_CACHE_WB
> to writeback caching. This implies O_DIRECT will always be used. This
> is somewhat surprising as qemu by default only uses O_DIRECT with
> cache=none, and yet the emulated devices are set up with the
> equivalent of cache=writeback.

Yes, it is counterintuitive, but you got it right: BDRV_O_NOCACHE |
BDRV_O_CACHE_WB means O_DIRECT.


> But this would explain why I'm still seeing the crash with O_DIRECT
> apparently off (cache=writeback), as the cache setting is being ignored.
> 
> This would also explain why Ian might not have seen it (it went in
> late and without O_DIRECT we think this crash can't happen).
> 
> Is the BDRV_O_NOCACHE | BDRV_O_CACHE_WB combination intentional or
> should BDRV_O_NOCACHE be removed? Why would the default be different
> for emulated and PV disks?

The setting is different from the one of emulated devices because after
analyzing the IDE code, we thought that using BDRV_O_CACHE_WB would be
safe enough because when the guest wants to make sure that the data hits
the disk, it issues an IDE FLUSH_CACHE operation.

In the xen_disk case instead, we weren't quite sure about the
assumptions of all the possible different PV frontend drivers, so we
went for the safe choice, that is O_DIRECT.

In fact if we wanted to change the cache setting for xen_disk, we would
probably have to go back to write-through (this setting is selected by
passing neither BDRV_O_NOCACHE nor BDRV_O_CACHE_WB) that is quite slow.

Recently, thanks to Konrad's work on blkfront cache flushes, a new flush
operation has been implemented in the block protocol:
BLKIF_OP_FLUSH_DISKCACHE. BLKIF_OP_FLUSH_DISKCACHE was introduced in
xen_disk by 7e7b7cba16faa7b721b822fa9ed8bebafa35700f "xen_disk:
implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER".
Thanks to the new operation, maybe it is now safe to use write-back
caching.
Konrad, what do you think? Is blkback using the Linux disk cache by
default? Or is it using O_DIRECT?

  parent reply	other threads:[~2013-01-22 15:42 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 [this message]
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
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=alpine.DEB.2.02.1301221531040.29727@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=alex@alex.org.uk \
    --cc=konrad.wilk@oracle.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.