All of lore.kernel.org
 help / color / mirror / Atom feed
From: Derek Murray <Derek.Murray@cl.cam.ac.uk>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Jan Beulich <jbeulich@novell.com>,
	Glauber de Oliveira Costa <gcosta@redhat.com>,
	Chris Wright <chrisw@sous-sol.org>,
	"virtualization@lists.osdl.org" <virtualization@lists.osdl.org>
Subject: Re: [Xen-devel] Re: Next steps with pv_ops for Xen
Date: Wed, 05 Dec 2007 11:48:36 +0000	[thread overview]
Message-ID: <47569014.8080008__5383.70828512615$1196855453$gmane$org@cl.cam.ac.uk> (raw)
In-Reply-To: <4755B158.3030008@redhat.com>

Hi Gerd,

Gerd Hoffmann wrote:
Want reproduce?  Here we go:
> 
>   * grab xenner 0.8 from http://dl.bytesex.org/releases/xenner/
>   * grab a xenified dom0 kernel without blktap driver (either not
>     compiled or module not loaded).
>   * start xend
>   * start blkbackd from xenner package (you probably want the -d switch
>     for debug output, twice for more).
>   * run "xm block-attach 0 tap:aio:/path/to/some/file xvda r"
>   * watch it blow up ;)

Thanks for the repro details. I'll have a go at this later. One thing we 
haven't tested AFAIK is mapping grants in the same domain: could you 
check to see if the bug is the same if you attach a block device to a 
domain other than Dom0? Also, could you send any Xen console output, if 
it contains errors or warnings?

>> I can't help wondering if this is a hint that now is the time to find a
>> better API, which doesn't have the requirement (a) that seems to be
>> causing such trouble?  Are other PV guests --- *BSD, Solaris --- going
>> to have the same problems with their VM layers if they try to implement
>> this API?  Upstream Linux pv_ops certainly will, and it would be good if
>> we could avoid tying unprivileged guests to ABIs which cannot hope to be
>> merged into pv_ops.
> 
> And I fear the problems I've trapped into up to now is only the tip of
> the iceberg.  What happens if an application with active grant table
> mappings calls fork() ?

Ultimately, fork calls dup_mm, which calls, dup_mmap, which calls 
copy_{page,pud,pmd,pte}_range, which calls copy_one_pte, which calls 
set_pte_at, which hypercalls HYPERVISOR_update_va_mapping.

The hypercall will not succeed and will return an error code indicating 
the reason for this. Therefore the PTE will not be set. There appears to 
be no way to propagate this error through the Linux VM code, because 
there is no concept of a PTE update failing. I could add return codes to 
all those functions, but I don't fancy their chances upstream....

A possibility for solving that might be to carry out the mappings upon a 
page fault: I believe this would be compatible with copy_page_range.

(In fact, it's possible that a forked process would attempt to 
demand-page in the granted page, bypassing the copy_page_range code. 
Since there is no nopage handler for a gntdev VMA, that would lead to an 
anonymous page being mapped into memory instead.)

So, as far as I can tell, there would be no kernel BUG() or 
domain_crash() in the event of a fork(). It looks like implementing 
nopage in gntdev would enable grants to be remapped after a fork() and 
the correct behaviour to happen.

Regards,

Derek.

  reply	other threads:[~2007-12-05 11:48 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-21 22:05 Next steps with pv_ops for Xen Stephen C. Tweedie
2007-11-21 23:12 ` Jeremy Fitzhardinge
2007-11-26 14:02   ` Juan Quintela
2007-11-26 18:52     ` Jeremy Fitzhardinge
2007-11-27  8:30       ` Jan Beulich
2007-11-27 17:00         ` Jeremy Fitzhardinge
2007-11-27 17:14           ` Jan Beulich
2007-11-27 17:15           ` Stephen C. Tweedie
2007-12-03 12:54 ` Gerd Hoffmann
2007-12-03 13:19   ` Derek Murray
2007-12-03 14:16     ` Gerd Hoffmann
2007-12-03 14:51       ` Derek Murray
2007-12-03 17:18         ` Mark Williamson
2007-12-03 18:36           ` D.G. Murray
2007-12-03 19:08             ` Mark Williamson
2007-12-04  9:35               ` tgh
2007-12-05  3:42                 ` Mark Williamson
2007-12-06 15:21             ` Gerd Hoffmann
2007-12-06 15:32               ` Derek Murray
2007-12-06 15:55                 ` Gerd Hoffmann
2007-12-21 12:58             ` Gerd Hoffmann
2007-12-21 12:58             ` [Xen-devel] " Gerd Hoffmann
2007-12-03 20:38         ` Gerd Hoffmann
2007-12-04  9:40           ` Derek Murray
2007-12-04 12:01             ` Gerd Hoffmann
2007-12-04 12:39               ` Stephen C. Tweedie
2007-12-04 19:58                 ` Gerd Hoffmann
2007-12-05 11:48                   ` Derek Murray [this message]
2007-12-05 11:48                   ` Derek Murray
2007-12-05 14:12                     ` Gerd Hoffmann
2007-12-05 14:22                       ` Keir Fraser
2007-12-05 14:30                         ` Derek Murray
2007-12-05 16:58                           ` Keir Fraser
2007-12-05 17:17                             ` Derek Murray
2007-12-05 17:22                               ` Keir Fraser
2007-12-05 17:48                                 ` Derek Murray
2007-12-05 17:59                                   ` Keir Fraser
2007-12-05 18:15                                     ` Derek Murray
2007-12-12  8:27                                       ` Isaku Yamahata
2007-12-12  8:39                                         ` Keir Fraser
2007-12-12  8:44                                           ` Isaku Yamahata
2007-12-05 20:06                                     ` Gerd Hoffmann
2007-12-05 18:12                     ` Jeremy Fitzhardinge
2007-12-05 18:29                       ` Derek Murray
2007-12-05 20:15                         ` Jeremy Fitzhardinge
2007-12-05 20:35                           ` Geoffrey Lefebvre
2007-12-06 10:15                             ` Gerd Hoffmann
2007-12-05 20:44                           ` Keir Fraser
2007-12-06 10:00                             ` Derek Murray
2007-12-06 19:55                               ` [Xen-devel] " Jeremy Fitzhardinge
2007-12-05 13:19                   ` Derek Murray
2007-12-04 21:08                 ` Ian Main
2007-12-05 10:03                 ` Gerd Hoffmann
2007-12-05 12:51                   ` Gerd Hoffmann
2007-12-05 10:11                 ` Derek Murray
2007-12-04 20:59             ` Ian Main
2007-12-05 11:54               ` Derek Murray

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='47569014.8080008__5383.70828512615$1196855453$gmane$org@cl.cam.ac.uk' \
    --to=derek.murray@cl.cam.ac.uk \
    --cc=chrisw@sous-sol.org \
    --cc=ehabkost@redhat.com \
    --cc=gcosta@redhat.com \
    --cc=jbeulich@novell.com \
    --cc=kraxel@redhat.com \
    --cc=quintela@redhat.com \
    --cc=virtualization@lists.osdl.org \
    --cc=xen-devel@lists.xensource.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 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.