[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a6zzcedg.fsf@morokweng.localdomain>
Date: Thu, 16 Jul 2020 18:57:15 -0300
From: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
To: Hari Bathini <hbathini@...ux.ibm.com>
Cc: Pingfan Liu <piliu@...hat.com>, Nayna Jain <nayna@...ux.ibm.com>,
Kexec-ml <kexec@...ts.infradead.org>,
Mahesh J Salgaonkar <mahesh@...ux.ibm.com>,
Mimi Zohar <zohar@...ux.ibm.com>,
lkml <linux-kernel@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...abs.org>,
Sourabh Jain <sourabhjain@...ux.ibm.com>,
Petr Tesarik <ptesarik@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Young <dyoung@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>,
Eric Biederman <ebiederm@...ssion.com>
Subject: Re: [PATCH v3 10/12] ppc64/kexec_file: prepare elfcore header for crashing kernel
Hari Bathini <hbathini@...ux.ibm.com> writes:
> On 16/07/20 7:52 am, Thiago Jung Bauermann wrote:
>>
>> Hari Bathini <hbathini@...ux.ibm.com> writes:
>>
>>> /**
>>> + * get_crash_memory_ranges - Get crash memory ranges. This list includes
>>> + * first/crashing kernel's memory regions that
>>> + * would be exported via an elfcore.
>>> + * @mem_ranges: Range list to add the memory ranges to.
>>> + *
>>> + * Returns 0 on success, negative errno on error.
>>> + */
>>> +static int get_crash_memory_ranges(struct crash_mem **mem_ranges)
>>> +{
>>> + struct memblock_region *reg;
>>> + struct crash_mem *tmem;
>>> + int ret;
>>> +
>>> + for_each_memblock(memory, reg) {
>>> + u64 base, size;
>>> +
>>> + base = (u64)reg->base;
>>> + size = (u64)reg->size;
>>> +
>>> + /* Skip backup memory region, which needs a separate entry */
>>> + if (base == BACKUP_SRC_START) {
>>> + if (size > BACKUP_SRC_SIZE) {
>>> + base = BACKUP_SRC_END + 1;
>>> + size -= BACKUP_SRC_SIZE;
>>> + } else
>>> + continue;
>>> + }
>>> +
>>> + ret = add_mem_range(mem_ranges, base, size);
>>> + if (ret)
>>> + goto out;
>>> +
>>> + /* Try merging adjacent ranges before reallocation attempt */
>>> + if ((*mem_ranges)->nr_ranges == (*mem_ranges)->max_nr_ranges)
>>> + sort_memory_ranges(*mem_ranges, true);
>>> + }
>>> +
>>> + /* Reallocate memory ranges if there is no space to split ranges */
>>> + tmem = *mem_ranges;
>>> + if (tmem && (tmem->nr_ranges == tmem->max_nr_ranges)) {
>>> + tmem = realloc_mem_ranges(mem_ranges);
>>> + if (!tmem)
>>> + goto out;
>>> + }
>>> +
>>> + /* Exclude crashkernel region */
>>> + ret = crash_exclude_mem_range(tmem, crashk_res.start, crashk_res.end);
>>> + if (ret)
>>> + goto out;
>>> +
>>> + ret = add_rtas_mem_range(mem_ranges);
>>> + if (ret)
>>> + goto out;
>>> +
>>> + ret = add_opal_mem_range(mem_ranges);
>>> + if (ret)
>>> + goto out;
>>
>> Maybe I'm confused, but don't you add the RTAS and OPAL regions as
>> usable memory for the crashkernel? In that case they shouldn't show up
>> in the core file.
>
> kexec-tools does the same thing. I am not endorsing it but I was trying to stay
> in parity to avoid breaking any userspace tools/commands. But as you rightly
> pointed, this is NOT right. The right thing to do, to get the rtas/opal data at
> the time of crash, is to have a backup region for them just like we have for
> the first 64K memory. I was hoping to do that later.
>
> Will check how userspace tools respond to dropping these regions. If that makes
> the tools unhappy, will retain the regions with a FIXME. Sorry about the confusion.
No problem, thanks for the clarification.
--
Thiago Jung Bauermann
IBM Linux Technology Center
Powered by blists - more mailing lists