All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey G <x1917x@gmail.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Tamas K Lengyel <tamas@tklengyel.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>,
	George Dunlap <george.dunlap@citrix.com>,
	Jun Nakajima <jun.nakajima@intel.com>,
	xen-devel@lists.xenproject.org
Subject: Re: Weird altp2m behaviour when switching early to a new view
Date: Tue, 10 Apr 2018 01:40:13 +1000	[thread overview]
Message-ID: <20180410014013.00005ee1@gmail.com> (raw)
In-Reply-To: <a592fcb3-c2c6-bd83-01a4-0ac7ba9f3fa5@bitdefender.com>

On Sun, 8 Apr 2018 23:38:31 +0300
Razvan Cojocaru <rcojocaru@bitdefender.com> wrote:
>I've noticed altp2m behaviour I can't explain yet - I'm not all that
>familiar with all the ways the new views corellate with the previous
>EPT-based "view 0".
>
>In short, if we create a new view and simply switch to it early in the
>boot process of the guest, something goes wrong and the guest either
>freezes, becomes unresponsive to input, or has something wrong with the
>display (most often the latter, with a black band on top of the image):
>
>https://ibb.co/eUPJ6c
>https://ibb.co/etCXXH
>
>That guest is a 64-bit Windows 7 system with nothing special about it.
>It's easy to reproduce this:
>
>1. Start the guest paused (I've used "xl create -p myguest.conf").
>2. Patch xen-access like this: https://pastebin.com/67PpQ9fu (just
>remove the part of the code that modifies the new view before switching
>to it).
>3. Hook xen-access to the guest ("./xen-access <domid> altp2m_write").
>4. Unpause the guest ("xl unpause <domid>").
>
>I think that's a valid scenario and supposed to work.
>
>I've also noticed that if I wait to do this until the OS is
>up-and-running (e.g. after logging into Windows), there seems to be no
>problem. I don't know if this is just coincidence (as is bound to
>happen with race-condition situations), or means something, but I can
>get the problems every time when switching views early, and never when
>switching the views late.
>
>Suggestions on what the problem could be are, as always, greatly
>appreciated.

The difference between starting the domain paused and switching altp2m
views later (in this particular case) is likely the fact whether
the emulated LFB backing storage (aka VRAM) was "deployed" to the guest
domain or not.

QEMU uses special ranges to maintain the state of some emulated
devices with memories. These are VRAM and Option ROMs, but latter are
emulated as MMIO currently for some reason (either a bug or
intentionally). VRAM area is used to hold the LFB content for the
emulated videocard (stdvga/cirrus/etc) and its usage depends on whether
the emulated LFB is currently mapped or not.

When you start the domain paused, VRAM is not mapped to the guest
address space yet -- it is allocated to the location outside the guest
memory map, known to QEMU. In order to map VRAM to the guest's address
space, the emulated QEMU videocard needs to be initialized, which
happens when hvmloader or guest OS allocates MMIO BARs for the emulated
videocard.
Upon writing the corresponding BAR register, the VRAM area is relocated
to the guest's visible address space (via add_to_physmap hypercall).
Disabling MMIO decoding may cause to relocate the VRAM range back
to its hidden backing storage (again via add_to_physmap).

So, it's basically the same appearance of the problem of different
Xen/QEMU views on guest's memory layout.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-04-09 15:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08 20:38 Weird altp2m behaviour when switching early to a new view Razvan Cojocaru
2018-04-09 14:12 ` George Dunlap
2018-04-11  6:39   ` Razvan Cojocaru
2018-04-11  8:04     ` Razvan Cojocaru
2018-04-12 16:15       ` Razvan Cojocaru
2018-04-13 14:44       ` Razvan Cojocaru
2018-04-13 16:38         ` Tamas K Lengyel
2018-04-13 17:04           ` Razvan Cojocaru
2018-04-16 17:47         ` George Dunlap
2018-04-16 18:46           ` Razvan Cojocaru
2018-04-16 20:21             ` George Dunlap
2018-04-17  7:24               ` Razvan Cojocaru
2018-04-17  8:24               ` Razvan Cojocaru
2018-04-17 10:49                 ` Razvan Cojocaru
2018-04-17 10:50                   ` Razvan Cojocaru
2018-04-17 13:53                     ` George Dunlap
2018-04-17 14:21                       ` Razvan Cojocaru
2018-04-17 14:58                         ` George Dunlap
2018-04-17 15:13                           ` Razvan Cojocaru
2018-04-17 17:07                             ` Tamas K Lengyel
2018-04-18  8:20                       ` Razvan Cojocaru
2018-04-18 10:45                         ` George Dunlap
2018-04-18 10:49                           ` Razvan Cojocaru
2018-04-11 20:17     ` Tamas K Lengyel
2018-04-12  7:19       ` Razvan Cojocaru
2018-04-09 15:40 ` Alexey G [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-10-02 16:29 Сергей
2018-10-02 17:59 ` Razvan Cojocaru
2018-10-03 10:56   ` Сергей
2018-10-03 11:02     ` Razvan Cojocaru
2018-10-04  9:17     ` Razvan Cojocaru

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=20180410014013.00005ee1@gmail.com \
    --to=x1917x@gmail.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=tamas@tklengyel.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.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.