Thread (9 messages) 9 messages, 2 authors, 2020-03-25

Re: [RFC PATCH 3/3] arm64: hibernate: idmap the single page that holds the copy page routines

From: Pavel Tatashin <pasha.tatashin@soleen.com>
Date: 2020-03-25 13:41:27

On Wed, Mar 25, 2020 at 9:29 AM Pavel Tatashin
[off-list ref] wrote:
Hi James,
quoted
You keep coming back to this because you are trying to idmap all memory
on arm64. You do not need to do this.
No, this is not what I am trying to do. That approach was done in my
first RFC, but I have since abandoned it, and I now have proper liner
copy configured in TTBR1:
See: https://lore.kernel.org/lkml/20191204155938.2279686-24-pasha.tatashin@soleen.com (local)
+/*
+ * Map source segments starting from KEXEC_SRC_START, and map destination
+ * segments starting from KEXEC_DST_START, and return size of copy in
+ * *copy_len argument.
+ * Relocation function essentially needs to do:
+ * memcpy(KEXEC_DST_START, KEXEC_SRC_START, copy_len);
+ */

Sorry, I made a misleading comment that kexec needs to idmap many
pages, in fact it actually needs to idmap only two pages with the
current approach:

1. relocation function
2. relocation function argument

I could fit both of them into a single pages (the relocation function
body is tiny, and argument only contains 9 fields, so 72 bytes), it
will be a little ugly though to have them setup like that, so if you
have a better suggestion please let me know.
Nevermind. I figured we do not really need to idmap argument. In
arm64_relocate_new_kernel() while MMU is off we have plenty of
registers. I will simply load all argument arguments into free
registers before turning MMU on.
quoted
You only need one page idmaped so you can switch TTBR1_EL1, and turn the
MMU off.


You can do the copy of memory using a copy of the linear map in
TTBR1_EL1. For an example: hibernate does exactly this.
Yes, this is exactly what I am currently doing.
quoted
The code in this RFC was particularly tricky to test as its behaviour
depends on which bits of a pointer are set.

This code is complicated, and impossible to debug if it goes wrong.
(photograph of a screen with the word 'Bye' on it anyone?). Worse: it
must not introduce coherency issues into the next kernel.

It must be as simple as possible. What you are proposing is not.
I agree. So, let me modify kexec to idmap exactly one page (I will
stuff argument and body into a single page), and re-use it with
hibernate as you proposed.

Thank you,
Pasha
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help