From: Pavel Tatashin <pasha.tatashin@soleen.com>
To: James Morse <james.morse@arm.com>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC PATCH 3/3] arm64: hibernate: idmap the single page that holds the copy page routines
Date: Wed, 25 Mar 2020 09:29:32 -0400 [thread overview]
Message-ID: <CA+CK2bD1fEY-NY8rCYi3Se9VTTzU5PVmDZyk2tWoSNP6rGZmJA@mail.gmail.com> (raw)
In-Reply-To: <b983dfbf-49e2-d32c-e3a5-781df4f9ea4e@arm.com>
Hi James,
> 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
+/*
+ * 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.
> 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.
> 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
next prev parent reply other threads:[~2020-03-25 13:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 14:33 [RFC PATCH 0/3] arm64: hibernate: idmap the single page that holds the copy page routines James Morse
2020-01-15 14:33 ` [RFC PATCH 1/3] arm64: mm: Always update TCR_EL1 from __cpu_set_tcr_t0sz() James Morse
2020-01-15 14:33 ` [RFC PATCH 2/3] arm64: hibernate: Split create_safe_exec_page() and its mapping code James Morse
2020-01-15 14:33 ` [RFC PATCH 3/3] arm64: hibernate: idmap the single page that holds the copy page routines James Morse
2020-03-20 21:22 ` Pavel Tatashin
2020-03-25 9:58 ` James Morse
2020-03-25 13:29 ` Pavel Tatashin [this message]
2020-03-25 13:41 ` Pavel Tatashin
2020-03-25 17:08 ` James Morse
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=CA+CK2bD1fEY-NY8rCYi3Se9VTTzU5PVmDZyk2tWoSNP6rGZmJA@mail.gmail.com \
--to=pasha.tatashin@soleen.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.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.