xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Andres Lagar-Cavilla" <andres@lagarcavilla.org>
To: Tim Deegan <tim@xen.org>
Cc: Olaf Hering <olaf@aepfle.de>,
	xen-devel@lists.xensource.com, ian.campbell@citrix.com
Subject: Re: 4.2 TODO update
Date: Wed, 15 Feb 2012 08:22:41 -0800	[thread overview]
Message-ID: <278a7245084d24bf76fe2f799d04d622.squirrel@webmail.lagarcavilla.org> (raw)
In-Reply-To: <20120214200528.GA13265@ocelot.phlegethon.org>

> At 08:47 -0800 on 14 Feb (1329209245), Andres Lagar-Cavilla wrote:
>> > On Tue, Feb 14, Andres Lagar-Cavilla wrote:
>> >
>> >> Why? Because it's really really hard to guarantee we'll go to sleep
>> in
>> >> an
>> >> atomic context. The main use for wait queues (imho) is in hvm_copy,
>> and
>> >> there's a zillion paths going into hvm_copy (copy_from/to_user!) with
>> >> all
>> >> ways of bumping the preemption count.
>> >
>> > If the guests pagetable is paged out this code path will trigger, then
>> > one of the hypercalls returns an error and the guest runs into a
>> BUG().
>> > I think it was decrease_reservation, or similar.
>>
>> Unlikely to be something specific about decrease_reservation. If the
>> guest
>> page table is paged out, then copy_from_user for any hypercall, or,
>> "virtual address to gfn" for any emulation will run into this.
>>
>> Now, even an innocent-looking rcu lock anywhere in this code path will
>> crash the host if we go into a wait queue. Hence my concern.
>
> OK, so the current code breaks the guest and you're worried about it
> crashing the host instead.   That seems fair.
>
> Maybe we can arrange that instead of bugging out if the cpu is
> in_atomic() it gdprintk()s a big ol' warning and crashes the guest?  It
> seems no worse than the current failure modes.

How about judiciously adding the following

get_gfn_sleep(d, gfn, type)
{
  if (d == current_domain && !in_atomic())
  {
    printk("Naughty");
    crash_domain(d);
    return INVALID_MFN;
  }

retry:
  mfn rval = get_gfn(d, gfn, type)
  if (d == current->domain && type == paging && !mfn_valid(mfn))
  {
    put_gfn(d, gfn);
    go to sleep on wait queue;
    goto retry;
  }

  return rval;
}

Then we could toss it in before vmx_load_pdptrs gets to do evil things,
for example.

Andres

>
>> > What other way exist to make paging 100% transparent to the guest?
>>
>> Don't page out page table pages? I know you were not expecting that...
>
> Sadly, it's not possible to reliably detect which pages are pagetables
> (or the shadow pagetable code would be more straightforward!).
>
> Cheers,
>
> Tim.
>

  reply	other threads:[~2012-02-15 16:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3388.1329129411.1471.xen-devel@lists.xensource.com>
2012-02-14 14:58 ` 4.2 TODO update Andres Lagar-Cavilla
2012-02-14 15:18   ` Olaf Hering
2012-02-14 16:47     ` Andres Lagar-Cavilla
2012-02-14 17:18       ` Olaf Hering
2012-02-14 17:34         ` Andres Lagar-Cavilla
2012-02-14 20:05       ` Tim Deegan
2012-02-15 16:22         ` Andres Lagar-Cavilla [this message]
2012-02-15 17:07           ` Tim Deegan
2012-03-12 12:11 Ian Campbell
2012-03-12 13:42 ` Ian Campbell
2012-03-12 13:51   ` Jan Beulich
2012-03-12 15:27     ` Ian Campbell
2012-03-12 13:55   ` Roger Pau Monné
2012-03-12 16:01 ` Stefano Stabellini
2012-03-13  8:57   ` Ian Campbell
2012-03-12 16:36 ` George Dunlap
2012-03-12 16:42   ` Ian Campbell
2012-03-13 10:50     ` George Dunlap
2012-03-14 16:48 ` Dario Faggioli
2012-03-14 16:51   ` Ian Campbell
     [not found] <mailman.4065.1329753857.1471.xen-devel@lists.xensource.com>
2012-02-20 20:00 ` Andres Lagar-Cavilla
  -- strict thread matches above, loose matches on Subject: below --
2012-02-20 15:52 Ian Campbell
2012-02-13 10:17 Ian Campbell
2012-02-13 10:24 ` Tim Deegan
2012-02-13 10:46 ` George Dunlap
2012-02-13 11:05 ` Fantu
2012-02-13 11:23   ` Ian Campbell
2012-02-13 11:50   ` Anthony PERARD
2012-02-13 11:56     ` Ian Campbell
2012-02-21  2:38       ` Michael A. Collins
2012-02-21  8:51         ` Ian Campbell
2012-02-13 11:29 ` Jan Beulich
2012-02-13 11:32   ` Ian Campbell
2012-02-13 12:04     ` Jan Beulich
2012-02-13 12:18       ` Stefano Stabellini
2012-02-14 14:56     ` Jan Beulich
2012-02-13 11:39 ` Anthony PERARD
2012-02-13 11:57 ` Stefano Stabellini
2012-02-13 19:11 ` Shriram Rajagopalan
2012-02-17 10:23 ` Ian Campbell

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=278a7245084d24bf76fe2f799d04d622.squirrel@webmail.lagarcavilla.org \
    --to=andres@lagarcavilla.org \
    --cc=ian.campbell@citrix.com \
    --cc=olaf@aepfle.de \
    --cc=tim@xen.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 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).