From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
Sergio Lopez <slp@redhat.com>,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [RFC 2/2] block/file-posix: verify page cache is not used
Date: Tue, 24 Apr 2018 16:29:15 +0200 [thread overview]
Message-ID: <20180424142915.GB4080@localhost.localdomain> (raw)
In-Reply-To: <20180424140411.GB5120@stefanha-x1.localdomain>
[-- Attachment #1: Type: text/plain, Size: 2925 bytes --]
Am 24.04.2018 um 16:04 hat Stefan Hajnoczi geschrieben:
> On Fri, Apr 20, 2018 at 08:25:13AM +0200, Kevin Wolf wrote:
> > Am 20.04.2018 um 05:02 hat Stefan Hajnoczi geschrieben:
> > > On Thu, Apr 19, 2018 at 10:05:47AM +0100, Dr. David Alan Gilbert wrote:
> > > > * Stefan Hajnoczi (stefanha@redhat.com) wrote:
> > > > > This commit is for debugging only. Do not merge it.
> > > > >
> > > > > mincore(2) checks whether pages are resident. Use it to verify that
> > > > > page cache has been dropped.
> > > > >
> > > > > You can trigger a verification failure by mmapping the image file from
> > > > > another process and loading a byte from a page so that it becomes
> > > > > resident. bdrv_co_invalidate_cache() will fail while the process is
> > > > > alive.
> > > >
> > > > It doesn't seem a bad diagnostic to keep in (with a switch to activate)
> > > > for when we're faced with some weird corruption on some weird storage
> > > > system.
> > >
> > > Okay. It's very slow to mmap an entire image file and query mincore(2)
> > > so it needs to be off by default.
> >
> > Also, having it enabled breaks localhost migration at least on tmpfs
> > (which was what I tried out first).
> >
> > I wonder if the kernel would add some way to query whether the "advice"
> > was actually acted upon if we asked. Either with a new function that
> > returns an error if not everything is dropped (basically
> > .bdrv_invalidate_cache on the kernel level), or a function that just
> > queries if any page is allocated (or maybe the address of the first
> > allocated page in a given range) without having to use mincore() and
> > iterating over all the pages in userspace.
>
> I'm trying to figure out how to expose the optional mincore check on the
> command-line/QMP:
>
> 1. Add a check_consistency bool argument to bdrv_invalidate_cache*().
> Add command-line/QMP option to -incoming and migrate_incoming. This
> is messy and won't be easy to access for libvirt users.
>
> 2. Add a BlockdevOptionsFile *check-cache-consistency bool field. This
> is specified at .bdrv_open() time. It can be changed at runtime with
> .bdrv_reopen*().
>
> 3. Add a 'blockdev-check-cache-consistency' QMP command that calls a new
> .bdrv_check_cache_consistency() callback that is implemented by
> file-posix.c. The problem is users might issue this command after
> I/O has resumed and pages have become resident again. It only makes
> sense if the guest is still paused. Probably a bad interface...
>
> Have I missed a good way to expose this optional check functionality?
>
> Which approach do you prefer? I'm leaning towards #2.
Yes, I think that makes the most sense.
In its current form, this can probably only be a debugging feature,
though, so maybe x-check-cache-consistency? I also don't think libvirt
should mess with this.
Kevin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2018-04-24 14:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 7:52 [Qemu-devel] [RFC 0/2] block/file-posix: allow -drive cache.direct=off live migration Stefan Hajnoczi
2018-04-19 7:52 ` [Qemu-devel] [RFC 1/2] block/file-posix: implement bdrv_co_invalidate_cache() on Linux Stefan Hajnoczi
2018-04-19 8:13 ` Fam Zheng
2018-04-20 3:15 ` Stefan Hajnoczi
2018-04-20 3:36 ` Fam Zheng
2018-04-20 6:13 ` Kevin Wolf
2018-04-19 9:18 ` Dr. David Alan Gilbert
2018-04-20 3:21 ` Stefan Hajnoczi
2018-04-20 6:27 ` Kevin Wolf
2018-04-19 7:52 ` [Qemu-devel] [RFC 2/2] block/file-posix: verify page cache is not used Stefan Hajnoczi
2018-04-19 9:05 ` Dr. David Alan Gilbert
2018-04-20 3:02 ` Stefan Hajnoczi
2018-04-20 6:25 ` Kevin Wolf
2018-04-24 14:04 ` Stefan Hajnoczi
2018-04-24 14:29 ` Kevin Wolf [this message]
2018-04-27 10:06 ` Stefan Hajnoczi
2018-04-19 16:09 ` [Qemu-devel] [RFC 0/2] block/file-posix: allow -drive cache.direct=off live migration Eric Blake
2018-04-20 3:05 ` Stefan Hajnoczi
2018-04-20 13:53 ` Eric Blake
2018-04-24 13:43 ` Stefan Hajnoczi
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=20180424142915.GB4080@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=dgilbert@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=slp@redhat.com \
--cc=stefanha@redhat.com \
/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).