All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	 xen-devel@lists.xenproject.org, marco.solieri@minervasys.tech,
	 lucmiccio@gmail.com, Julien Grall <jgrall@amazon.com>,
	 Bertrand Marquis <bertrand.marquis@arm.com>,
	 Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH early-RFC 4/5] xen/arm: mm: Rework switch_ttbr()
Date: Wed, 16 Mar 2022 14:58:43 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2203161457410.3497@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <26d41f77-085a-62e4-088b-49dcda63c100@xen.org>

On Tue, 15 Mar 2022, Julien Grall wrote:
> On 14/03/2022 23:48, Stefano Stabellini wrote:
> > > > - we save the current mapping
> > > > - update it with the Xen 1:1
> > > > - switch_ttbr
> > > > - remove Xen 1:1
> > > > - restore mapping
> > > > 
> > > > It should work, right? Basically, a mapping conflict shouldn't be an
> > > > issue given that the mapping has only to live long enough to call
> > > > switch_ttbr_id.
> > > 
> > > Today switch_ttbr() is called before we initialized most of the memory
> > > layout.
> > > So clashing with the VMAP and frametable is not a problem.
> > > 
> > > However, the identity mapping may also clash with the region used to map
> > > Xen.
> > > That said, technically, we are not able to handle Xen when its start
> > > address
> > > is in region 2MB + 4K to 4MB (Xen is loaded at a 4KB aligned address).
> > > 
> > > The trouble is some features (e.g. UBSAN, GCOV) can generate Xen image
> > > over
> > > 2MB. IOW, the range where Xen cannot be loaded will increase.
> > > 
> > > This is an issue because AFAIK, there is no away to tell GRUB "You can't
> > > load
> > > Xen at this region". But even if there were one, I feel this restriction
> > > is
> > > sort of random.
> > > 
> > > I already wrote a patch to get rid of the restriction. The code is not too
> > > bad
> > > (we only need an extra indirection). But I haven't sent it yet because it
> > > is
> > > less critical with the re-shuffling of the memory layout.
> > 
> > Interesting! I am curious: how did you manage to do it?
> 
> When the identity mapping is clashing with Xen runtime address, I am creating
> a temporary mapping for Xen at a different fixed address.
> 
> Once the MMU is turned on, we can jump to the temporary mapping. After that we
> are safe to remove the identity mapping and create the runtime Xen mapping.
> The last step is to jump on the runtime mapping and then remove the temporary
> mapping.

Cool! I was guessing something along those lines.



  reply	other threads:[~2022-03-16 21:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09 11:20 [PATCH early-RFC 0/5] xen/arm: Don't switch TTBR while the MMU is on Julien Grall
2022-03-09 11:20 ` [PATCH early-RFC 1/5] xen/arm: Clean-up the memory layout Julien Grall
2022-03-17 15:23   ` Bertrand Marquis
2022-03-17 20:32     ` Julien Grall
2022-03-18  8:45       ` Bertrand Marquis
2022-03-09 11:20 ` [PATCH early-RFC 2/5] xen/arm64: Rework " Julien Grall
2022-03-17 20:46   ` Julien Grall
2022-03-25 13:17   ` Bertrand Marquis
2022-03-25 13:35     ` Julien Grall
2022-03-25 14:05       ` Bertrand Marquis
2022-03-25 14:36         ` Julien Grall
2022-05-21 15:49           ` Julien Grall
2022-03-09 11:20 ` [PATCH early-RFC 3/5] xen/arm: mm: Introduce helpers to prepare/enable/disable the identity mapping Julien Grall
2022-03-25 13:32   ` Bertrand Marquis
2022-03-25 13:48     ` Julien Grall
2022-03-25 14:11       ` Bertrand Marquis
2022-03-09 11:20 ` [PATCH early-RFC 4/5] xen/arm: mm: Rework switch_ttbr() Julien Grall
2022-03-12  1:17   ` Stefano Stabellini
2022-03-12 18:20     ` Julien Grall
2022-03-14 23:27       ` Stefano Stabellini
2022-03-12  1:31   ` Stefano Stabellini
2022-03-12 18:54     ` Julien Grall
2022-03-14 23:48       ` Stefano Stabellini
2022-03-15 19:01         ` Julien Grall
2022-03-16 21:58           ` Stefano Stabellini [this message]
2022-03-25 13:47   ` Bertrand Marquis
2022-03-25 14:24     ` Julien Grall
2022-03-25 14:35       ` Bertrand Marquis
2022-03-25 14:42         ` Julien Grall
2022-03-25 14:48           ` Bertrand Marquis
2022-04-07 15:38             ` Julien Grall
2022-04-13 14:02               ` Bertrand Marquis
2022-03-09 11:20 ` [PATCH early-RFC 5/5] xen/arm: smpboot: Directly switch to the runtime page-tables Julien Grall

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=alpine.DEB.2.22.394.2203161457410.3497@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jgrall@amazon.com \
    --cc=julien@xen.org \
    --cc=lucmiccio@gmail.com \
    --cc=marco.solieri@minervasys.tech \
    --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.