Re: [PATCH 03/18] arm64: hyp-stub: Move elx_sync into the vectors

From: Pavel Tatashin
Date: Tue Jun 08 2021 - 13:46:50 EST


On Tue, Jun 1, 2021 at 9:18 PM Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> wrote:
>
> > > It cannot call mutate_to_vhe because #HVC_VHE_RESTART is not used
> > > here. But, if it had to it would not work as we cannot return to the
> > > old kernel text after relocation.
> >
> > OK, so you are happy with having a dangling branch pointing to
> > nowhere? Something in me screams that it isn't a good idea, in
> > general.
> >
> > If HVC_SOFT_RESTART is all you need, I'd rather you have a small stub
> > that implements exactly that and nothing else. Feel free to extract it
> > as a reusable macro if you want.

Using macro won't help here to save kernel text. Optimally, we would
want to use only one vector table to reduce kernel text memory usage.
I could do that by overwriting sync entries in
trans_pgd_copy_el2_vectors(). But, that would be ugly, as I would need
to have some specific assumptions about what entries need to be
overwritten. Therefore, I decided to move the vector table that we
currently have in hibernate code, and make it common between kexec and
hibernate; trans_pgd_copy_el2_vectors() will use that table's body to
create copies.

Thanks,
Pasha