linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Baoquan He <bhe@redhat.com>
Cc: Pingfan Liu <kernelfans@gmail.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Oscar Salvador <osalvador@suse.de>,
	Michal Hocko <mhocko@kernel.org>,
	kexec@lists.infradead.org, Kazuhito Hagio <k-hagio@ab.jp.nec.com>
Subject: Re: [PATCH] mm/sparse: reset section's mem_map when fully deactivated
Date: Thu, 16 Jan 2020 09:57:13 +0100	[thread overview]
Message-ID: <c928ace3-71bb-979a-d2f5-4df75a7dc8ed@redhat.com> (raw)
In-Reply-To: <20200116082451.GC26758@MiWiFi-R3L-srv>

On 16.01.20 09:24, Baoquan He wrote:
> On 01/16/20 at 09:14am, David Hildenbrand wrote:
>> On 16.01.20 09:06, David Hildenbrand wrote:
>>> On 16.01.20 04:01, Pingfan Liu wrote:
>>>> When fully deactivated, it is meaningless to keep the value of a section's
>>>> mem_map. And its mem_map will be reassigned during re-added.
>>>>
>>>> Beside this, it breaks the user space tool "makedumpfile", which makes
>>>> assumption that a hot-removed section having mem_map as NULL.
>>>>
>>>> The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" ,
>>>> trigger a crash, and save vmcore by makedumpfile
>>>
>>> Are you using an up-to-date makedumfile and did kdump.service properly
>>> get reloaded on the udev events? I remember that this works.
>>>
>>> makedumpfile will not dump memory sections that a) are not marked
>>> offline (SECTION_IS_ONLINE) - after offlining b) are not part of an
>>> iomem resource - after memory unplug.
> 
> Makedumpfile seems to only check SECTION_MARKED_PRESENT. Then the NULL
> memmap will fail vmcore dumping, I guess.

But why should the section be marked SECTION_MARKED_PRESENT? After
unplugging a section, the flag will be cleared.

validate_mem_section() seems to iterate over all sections 0..num_section
- 1 and validates them.

section = nr_to_section(section_nr, mem_sec);
if (section == NOT_KV_ADDR) {
	mem_map = NOT_MEMMAP_ADDR:
} else {
	mem_map = section_mem_map_addr(section, &map_mask)
	if (!(map_mask & SECTION_MARKED_PRESENT)) {
		return FALSE;
	}
	if (mem_map == 0) {
		mem_map = NOT_MEMMAP_ADDR;
	} else {
	...

But here it is:

section_mem_map_addr():

map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
mask = SECTION_MAP_MASK;
*map_mask = map & ~mask;
if (map == 0x0)
	*map_mask |= SECTION_MARKED_PRESENT;

If the map is zero, the section is assumed to be present. The way the
map is calculated, it will be zero due to the changes in the kernel.

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2020-01-16  8:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16  3:01 Pingfan Liu
2020-01-16  3:18 ` Qian Cai
2020-01-16  3:34   ` Pingfan Liu
2020-01-16  7:50 ` Michal Hocko
2020-01-17  6:22   ` Pingfan Liu
2020-01-17  7:14     ` Dan Williams
2020-01-17  7:47       ` Michal Hocko
2020-01-17  9:49         ` Pingfan Liu
2020-01-17  9:52           ` David Hildenbrand
2020-01-20  2:31             ` Pingfan Liu
2020-01-16  8:06 ` David Hildenbrand
2020-01-16  8:14   ` David Hildenbrand
2020-01-16  8:24     ` Baoquan He
2020-01-16  8:57       ` David Hildenbrand [this message]
2020-01-17  6:20       ` Pingfan Liu
2020-01-17  6:18   ` Pingfan Liu

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=c928ace3-71bb-979a-d2f5-4df75a7dc8ed@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=k-hagio@ab.jp.nec.com \
    --cc=kernelfans@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox