From: Oleksii <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Bob Eshleman <bobbyeshleman@gmail.com>,
Alistair Francis <alistair.francis@wdc.com>,
Connor Davis <connojdavis@gmail.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1 1/8] xen/riscv: make sure that identity mapping isn't bigger then page size
Date: Tue, 13 Jun 2023 20:40:30 +0300 [thread overview]
Message-ID: <8611e975cb4788ef9e06162b6b70dbf509ff2d71.camel@gmail.com> (raw)
In-Reply-To: <bcb3e4a2-2aa0-efac-1879-f2c30de540b5@suse.com>
On Mon, 2023-06-12 at 09:09 +0200, Jan Beulich wrote:
> On 06.06.2023 21:55, Oleksii Kurochko wrote:
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>
> Such commits without description are worrying. This may be okay for
> entirely trivial and obvious changes, but that's going to be the
> exception.
>
> > --- a/xen/arch/riscv/xen.lds.S
> > +++ b/xen/arch/riscv/xen.lds.S
> > @@ -20,6 +20,7 @@ SECTIONS
> > . = XEN_VIRT_START;
> > _start = .;
> > .text : {
> > + _idmap_start = .;
> > _stext = .; /* Text section */
> > *(.text.header)
> >
> > @@ -35,6 +36,7 @@ SECTIONS
> > *(.gnu.warning)
> > . = ALIGN(POINTER_ALIGN);
> > _etext = .; /* End of text section */
> > + _idmap_end = .;
> > } :text
>
> So this covers all of .text. Why is it expected that .text will be
> (and
> remain) ...
>
> > @@ -174,3 +176,10 @@ ASSERT(!SIZEOF(.got), ".got non-empty")
> > ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty")
> >
> > ASSERT(_end - _start <= MB(2), "Xen too large for early-boot
> > assumptions")
> > +
> > +/*
> > + * We require that Xen is loaded at a page boundary, so this
> > ensures that any
> > + * code running on the identity map cannot cross a page boundary.
> > + */
> > +ASSERT(IS_ALIGNED(_idmap_start, PAGE_SIZE), "_idmap_start should
> > be page-aligned")
> > +ASSERT(_idmap_end - _idmap_start <= PAGE_SIZE, "Identity mapped
> > code is larger than a page size")
>
> ... less than 4k in size? And why is only .text of interest, but not
> other sections?
An idea was to keep identity mapping as small as possible because
basically identity mapping is needed only for a few instructions.
(probably it will be better to create a separate section and put all
necessary functions there)
Another point was to map the necessary code for switching from 1:1
mapping in one cycle. ( we are using 4K as a page size )
But it looks like PAGE_SIZE isn't enough. I rebased all my patches that
are needed to run Dom0 and compiler complains that _idmap is bigger
than PAGE_SIZE so I probably have to reject this idea ( to map only
PAGE_SIZE ).
Actually not only .text section is needed but also stack should be 1:1
mapped. ( what is done in setup_initial_pagetables() )
>
> I find the other assertion a little puzzling too: Isn't that merely
> checking that XEN_VIRT_START is page aligned?
Yeah, you are right.
~ Oleksii
next prev parent reply other threads:[~2023-06-13 17:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 19:55 [PATCH v1 0/8] xen/riscv: introduce identity mapping Oleksii Kurochko
2023-06-06 19:55 ` [PATCH v1 1/8] xen/riscv: make sure that identity mapping isn't bigger then page size Oleksii Kurochko
2023-06-12 5:08 ` Alistair Francis
2023-06-12 7:09 ` Jan Beulich
2023-06-13 17:40 ` Oleksii [this message]
2023-06-06 19:55 ` [PATCH v1 2/8] xen/riscv: add .sbss section to .bss Oleksii Kurochko
2023-06-12 5:09 ` Alistair Francis
2023-06-12 7:04 ` Jan Beulich
2023-06-13 17:41 ` Oleksii
2023-06-06 19:55 ` [PATCH v1 3/8] xen/riscv: introduce reset_stack() function Oleksii Kurochko
2023-06-12 5:10 ` Alistair Francis
2023-06-12 7:12 ` Jan Beulich
2023-06-13 17:46 ` Oleksii
2023-06-14 12:19 ` Oleksii
2023-06-14 12:46 ` Jan Beulich
2023-06-06 19:55 ` [PATCH v1 4/8] xen/riscv: introduce function for physical offset calculation Oleksii Kurochko
2023-06-12 7:15 ` Jan Beulich
2023-06-13 17:48 ` Oleksii
2023-06-06 19:55 ` [PATCH v1 5/8] xen/riscv: introduce identity mapping Oleksii Kurochko
2023-06-12 13:48 ` Jan Beulich
2023-06-12 14:24 ` Jan Beulich
2023-06-14 9:53 ` Oleksii
2023-06-14 9:47 ` Oleksii
2023-06-14 10:04 ` Jan Beulich
2023-06-14 11:06 ` Oleksii
2023-06-14 11:38 ` Jan Beulich
2023-06-06 19:55 ` [PATCH v1 6/8] xen/riscv: add SPDX tags Oleksii Kurochko
2023-06-07 10:20 ` Julien Grall
2023-06-08 8:10 ` Oleksii
2023-06-06 19:55 ` [PATCH v1 7/8] xen/riscv: add __ASSEMBLY__ guards Oleksii Kurochko
2023-06-13 6:52 ` Alistair Francis
2023-06-06 19:55 ` [PATCH v1 8/8] xen/riscv: move extern of cpu0_boot_stack to header Oleksii Kurochko
2023-06-07 7:49 ` [PATCH v1 0/8] xen/riscv: introduce identity mapping Jan Beulich
2023-06-07 10:15 ` Oleksii
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=8611e975cb4788ef9e06162b6b70dbf509ff2d71.camel@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=bobbyeshleman@gmail.com \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--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 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).