Make it possible to reserve memory on 64bit platform
v2 cover Make it possible to reserve memory on 64bit platform
I was trying to reserve some memory to save logs incase that Android panic or hang and then I can read the logs from QNX side from the memory reserved before on the Qualcomm 8155 hypervisor platform, and I find the "reserve=" parameter only support 32bit,so I made some change and send these patches.
testcase:
I test on the qemu with some cmdline like[qemu-system-x86_64 -kernel linux-next/arch/x86_64/boot/bzImage -hda ubuntu-system.ext4 -append "root=/dev/sda init=/bin/bash console=ttyS0 reserve=0x180000000,0x123456" -nographic] and check the /proc/iomem with 180000000-180123455 : reserved. And some other tests with the get_option with the parameter(-12345678) and so on
Wesley Zhao (2):
lib/cmdline: add new function get_option_ull()
resource: Make it possible to reserve memory on 64bit platform
include/linux/kernel.h | 2 ++ kernel/resource.c | 6 ++-- lib/cmdline.c | 94 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 85 insertions(+), 17 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 lib/cmdline: add new function get_option_ull()
In the future we would pass the unsigned long long parameter like(0x123456781234) in cmdline on the 64bit platform, so add a new option parse function get_option_ull()
--- include/linux/kernel.h | 2 ++ lib/cmdline.c | 94 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 82 insertions(+), 14 deletions(-)
include/linux/kernel.h +2 -0
@@ -348,6 +348,8 @@ extern __scanf(2, 0)int vsscanf (const char *,const char *,va_list );extern int get_option (char **str,int *pint); +extern int get_option_ll (char **str,long long *pll); +extern int get_option_ull (char **str,unsigned long long *pull);extern char *get_options (const char *str,int nints,int *ints);extern unsigned long long memparse (const char *ptr,char **retptr);extern bool parse_option_str (const char *str,const char *option);
lib/cmdline.c +80 -14
112 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 4 lines · Wesley Zhao
I was trying to reserve some memory to save logs incase that Android panic or hang and then I can read the logs from QNX side from the memory reserved before on the Qualcomm 8155 hypervisor platform, and I find the "reserve=" parameter only support 32bit,so I made some change and send these patches.
See Documentation/admin-guide/kernel-parameters.txt
memmap=nn[KMG]$ss[KMG]
[KNL,ACPI] Mark specific memory as reserved.
Region of memory to be reserved is from ss to ss+nn.
Example: Exclude memory from 0x18690000-0x1869ffff
memmap=64K$0x18690000
or
memmap=0x10000$0x18690000
Some bootloaders may need an escape characterbefore '$',
like Grub2, otherwise '$' and the following number will be eaten.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 24 lines · On 18.01.21 04:51, [email protected] wrote:
On Sat, Jan 16, 2021 at 2:43 AM Wesley Zhao <[email protected]> wrote:
>>
>> I was trying to reserve some memory to save logs incase that Android panic or hang and then
>> I can read the logs from QNX side from the memory reserved before on the Qualcomm 8155 hypervisor platform,
>> and I find the "reserve=" parameter only support 32bit,so I made some change and send these patches.
>
>SeeDocumentation/admin-guide/kernel-parameters.txt
>
> memmap=nn[KMG]$ss[KMG]
> [KNL,ACPI] Mark specific memory as reserved. > Region of memory to be reserved is from ss to ss+nn.
> Example: Exclude memory from 0x18690000-0x1869ffff
> memmap=64K$0x18690000
> or
> memmap=0x10000$0x18690000 > Some bootloaders may need an escape character >before '$',
> like Grub2, otherwise '$' and the following
Quoted 9 lines
number
> will be eaten.
Sorry,what is your point:
static int__initreserve_setup(char *str)
static struct resource reserve[MAXRESERVE];
for (;;) {
unsigned intio_start, io_num;* // these code is not compatible with 64bit,i start from here*
Dan's point is that you should look into using "memmap=" instead of "reserve=".
Signature · 3 lines
Thanks, David / dhildenb
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · On Fri, Jan 22, 2021 at 03:36:19PM +0800, [email protected] wrote:
Quoted 5 lines · On 18.01.21 04:51, [email protected] wrote:
Quoted 2 lines
On Sat, Jan 16, 2021 at 2:43 AM Wesley Zhao <[email protected]> wrote:Dan's point is that you should look into using "memmap=" instead of "reserve=".
Oh~,sorry miss understand,i can try this, thanks!!
And AFAICS you don't need to alter cmdline.c. But if you are going to, don't forget test cases (and FYI: I have few patches pending against it here [1]).
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel.git/log/?h=for-next
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Wesley Zhao
I was trying to reserve some memory to save logs incase that Android panic or hang and then I can read the logs from QNX side from the memory reserved before on the Qualcomm 8155 hypervisor platform, and I find the "reserve=" parameter only support 32bit,so I made some change and send these patches.
Your series has disrupter in-reply-to change, can you fix your tools to have all patches in one email thread?
Quoted 5 lines
testcase:
I test on the qemu with some cmdline like[qemu-system-x86_64 -kernel linux-next/arch/x86_64/boot/bzImage -hda ubuntu-system.ext4 -append "root=/dev/sda init=/bin/bash console=ttyS0 reserve=0x180000000,0x123456" -nographic] and check the /proc/iomem with 180000000-180123455 : reserved. And some other tests with the get_option with the parameter(-12345678) and so on
It's good but I was talking about unit test. Look into cmdline_kunit.c.
Quoted 3 lines
Wesley Zhao (2):
lib/cmdline: add new functionget_option_ull()
resource: Make it possible to reserve memory on 64bit platform
Signature · 2 lines
With Best Regards, Andy Shevchenko