All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@globallogic.com>,
	andrii.anisov@ti.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] xen: arm: add missing flushing dcache to the copy to/clean guest functions
Date: Mon, 25 Nov 2013 17:06:07 +0000	[thread overview]
Message-ID: <5293837F.1030906@citrix.com> (raw)
In-Reply-To: <1385397228.22002.93.camel@kazak.uk.xensource.com>

On 11/25/2013 04:33 PM, Ian Campbell wrote:
> On Mon, 2013-11-25 at 18:21 +0200, Oleksandr Dmytryshyn wrote:
> 
> Thanks for the patch.
> 
>> Without flushing dcache the hypervisor couldn't copy the device tree
>> correctly when booting the kernel dom0 Image (memory with device tree
>> is corrupted). As the result - when we try to load the kernel dom0
>> Image - dom0 hungs frequently. This issue is not reproduced with the
>> kernel dom0 zImage because the zImage decompressor code flushes all
>> dcache before starting the decompressed kernel Image. When the
>> hypervisor loads the kernel uImage or initrd, this memory region
>> isn't corrupted because the hypervisor code flushes the dcache.
> 
> So if not then when/how is this reproduced?
> 
> In general I would like to try and keep flushes out of this code path
> because they are used in the hypercall path, we have decreed that
> guest's must have caching enabled to make hypercalls (at least those
> which take in-memory arguments).
> 
> I think the right fix is to do the flushes domain_build.c, similar to
> how kernel_zimage_load does it. This might need an opencoded version of
> copy_to_user. Or better, introduce a flushing variant which shares most
> code with the normal one via a common internal function.
> 
> Or perhaps we should flush all of the new guest's RAM after building. I
> think Julien was looking at doing something along those lines for the
> domU building case.
> 

I was planning to handle only domU, but the issue can also happen with
dom0 (which is finally a guest as another :)).

The main reason behind the both issues is because Linux is starting with
cache disabled. So if Xen/Dom0 are copying data in a guest, some data
can stay in the cache for a while. In this case the guest will see
corrupted data.

Flushing all the new RAM seems a bit complicated and slow (AFAIK, you
can only flush data cache page by page). I would stay on a similar
solution and check if the guest is already running or not.

Ian, what do you think?

-- 
Julien Grall

  parent reply	other threads:[~2013-11-25 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 16:21 [PATCH] xen: arm: add missing flushing dcache to the copy to/clean guest functions Oleksandr Dmytryshyn
2013-11-25 16:33 ` Ian Campbell
2013-11-25 17:04   ` Oleksandr Dmytryshyn
2013-11-25 17:06   ` Julien Grall [this message]
2013-11-26  8:15     ` Oleksandr Dmytryshyn
2013-12-01 16:21       ` Stefano Stabellini
2013-12-02 10:10         ` 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=5293837F.1030906@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=andrii.anisov@ti.com \
    --cc=oleksandr.dmytryshyn@globallogic.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.