Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-27 Thread Oleksii
On Thu, 2023-07-27 at 09:25 +0200, Jan Beulich wrote: > On 26.07.2023 20:39, Oleksii wrote: > > On Wed, 2023-07-26 at 17:59 +0200, Jan Beulich wrote: > > > On 26.07.2023 17:54, Oleksii wrote: > > > > On Wed, 2023-07-26 at 17:00 +0200, Jan Beulich wrote: > > > > > On 26.07.2023 15:12, Oleksii wrote:

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-27 Thread Jan Beulich
On 26.07.2023 20:39, Oleksii wrote: > On Wed, 2023-07-26 at 17:59 +0200, Jan Beulich wrote: >> On 26.07.2023 17:54, Oleksii wrote: >>> On Wed, 2023-07-26 at 17:00 +0200, Jan Beulich wrote: On 26.07.2023 15:12, Oleksii wrote: > On Wed, 2023-07-26 at 13:58 +0200, Jan Beulich wrote: >> On

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Oleksii
On Wed, 2023-07-26 at 17:59 +0200, Jan Beulich wrote: > On 26.07.2023 17:54, Oleksii wrote: > > On Wed, 2023-07-26 at 17:00 +0200, Jan Beulich wrote: > > > On 26.07.2023 15:12, Oleksii wrote: > > > > On Wed, 2023-07-26 at 13:58 +0200, Jan Beulich wrote: > > > > > On 26.07.2023 13:23, Oleksii wrote:

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Jan Beulich
On 26.07.2023 17:54, Oleksii wrote: > On Wed, 2023-07-26 at 17:00 +0200, Jan Beulich wrote: >> On 26.07.2023 15:12, Oleksii wrote: >>> On Wed, 2023-07-26 at 13:58 +0200, Jan Beulich wrote: On 26.07.2023 13:23, Oleksii wrote: > I would like to ask for advice on whether it would be easier, >

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Oleksii
On Wed, 2023-07-26 at 17:00 +0200, Jan Beulich wrote: > On 26.07.2023 15:12, Oleksii wrote: > > On Wed, 2023-07-26 at 13:58 +0200, Jan Beulich wrote: > > > On 26.07.2023 13:23, Oleksii wrote: > > > > I would like to ask for advice on whether it would be easier, > > > > less > > > > bug- > > > > pro

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Jan Beulich
On 26.07.2023 15:12, Oleksii wrote: > On Wed, 2023-07-26 at 13:58 +0200, Jan Beulich wrote: >> On 26.07.2023 13:23, Oleksii wrote: >>> I would like to ask for advice on whether it would be easier, less >>> bug- >>> provoking ( during identity mapping to remove of whole Xen ) to >>> have a >>> separ

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Oleksii
On Wed, 2023-07-26 at 13:58 +0200, Jan Beulich wrote: > On 26.07.2023 13:23, Oleksii wrote: > > I would like to ask for advice on whether it would be easier, less > > bug- > > provoking ( during identity mapping to remove of whole Xen ) to > > have a > > separate identity section that won't be more

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Jan Beulich
On 26.07.2023 13:23, Oleksii wrote: > I would like to ask for advice on whether it would be easier, less bug- > provoking ( during identity mapping to remove of whole Xen ) to have a > separate identity section that won't be more than PAGE_SIZE. I'm afraid you can't safely do this in C, or at leas

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-26 Thread Oleksii
Hi all, I would like to ask for advice on whether it would be easier, less bug- provoking ( during identity mapping to remove of whole Xen ) to have a separate identity section that won't be more than PAGE_SIZE. Please take a look at the changes below. Comments are welcome. diff --git a/xen/arch

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-25 Thread Oleksii
On Tue, 2023-07-25 at 10:16 +0200, Jan Beulich wrote: > On 24.07.2023 18:00, Oleksii wrote: > > On Mon, 2023-07-24 at 16:11 +0200, Jan Beulich wrote: > > > On 24.07.2023 11:42, Oleksii Kurochko wrote: > > > > +void __init remove_identity_mapping(void) > > > > +{ > > > > +    static pte_t *pgtbl = s

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-25 Thread Jan Beulich
On 24.07.2023 18:00, Oleksii wrote: > On Mon, 2023-07-24 at 16:11 +0200, Jan Beulich wrote: >> On 24.07.2023 11:42, Oleksii Kurochko wrote: >>> +void __init remove_identity_mapping(void) >>> +{ >>> +    static pte_t *pgtbl = stage1_pgtbl_root; >>> +    static unsigned long load_start = XEN_VIRT_STA

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-24 Thread Oleksii
On Mon, 2023-07-24 at 16:11 +0200, Jan Beulich wrote: > On 24.07.2023 11:42, Oleksii Kurochko wrote: > > @@ -35,8 +36,10 @@ unsigned long __ro_after_init phys_offset; > >   * > >   * It might be needed one more page table in case when Xen load > > address > >   * isn't 2 MB aligned. > > + * > > + *

Re: [PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-24 Thread Jan Beulich
On 24.07.2023 11:42, Oleksii Kurochko wrote: > @@ -35,8 +36,10 @@ unsigned long __ro_after_init phys_offset; > * > * It might be needed one more page table in case when Xen load address > * isn't 2 MB aligned. > + * > + * CONFIG_PAGING_LEVELS page tables are needed for identity mapping. > *

[PATCH v4 2/2] xen/riscv: introduce identity mapping

2023-07-24 Thread Oleksii Kurochko
The way how switch to virtual address was implemented in the commit e66003e7be ("xen/riscv: introduce setup_initial_pages") isn't safe enough as: * enable_mmu() depends on hooking all exceptions and pagefault. * Any exception other than pagefault, or not taking a pagefault causes it to malfunct