All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Heiko Carstens <hca@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Pankaj Gupta <pankaj.gupta.linux@gmail.com>,
	Wei Yang <richard.weiyang@linux.alibaba.com>,
	Oscar Salvador <osalvador@suse.de>,
	Michal Hocko <mhocko@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Catalin Marinas <catalin.marinas@arm.com>,
	virtualization@lists.linux-foundation.org,
	linux-acpi@vger.kernel.org, Andy Lutomirski <luto@kernel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Anton Blanchard <anton@ozlabs.org>,
	Ard Biesheuvel <ardb@kernel.org>, Baoquan He <bhe@redhat.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Borislav Petkov <bp@alien8.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Christophe Leroy <christophe.leroy@c-s.fr>,
	Dave Jiang <dave.jiang@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Jia He <justin.he@arm.com>, Joe Perches <joe@perches.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Michel Lespinasse <michel@lespinasse.org>,
	Nathan Lynch <nathanl@linux.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Pierre Morel <pmorel@linux.ibm.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Rich Felker <dalias@libc.org>,
	Scott Cheloha <cheloha@linux.ibm.com>,
	Sergei Trofimovich <slyfox@gentoo.org>,
	Thiago Jung Bauermann <bauerman@linux.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Will Deacon <will@kernel.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>
Subject: Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
Date: Thu, 15 Jul 2021 11:42:21 +0200	[thread overview]
Message-ID: <99c59db8-4c3d-6bee-9acc-41a8f76899ef@redhat.com> (raw)
In-Reply-To: <YO9FWrT9h21e/G8X@osiris>

On 14.07.21 22:13, Heiko Carstens wrote:
> On Mon, Jul 12, 2021 at 02:40:49PM +0200, David Hildenbrand wrote:
>> Checkpatch complained on a follow-up patch that we are using "unsigned"
>> here, which defaults to "unsigned int" and checkpatch is correct.
>>
>> Use "unsigned long" instead, just as we do in other places when handling
>> PFNs. This can bite us once we have physical addresses in the range of
>> multiple TB.
>>
>> Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering")
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>   include/linux/memory_hotplug.h | 4 ++--
>>   mm/memory_hotplug.c            | 4 ++--
>>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> I'd propose to add Cc: <stable@vger.kernel.org> since I actually had
> the fun to try to debug something like this a couple of years ago:
> 6cdb18ad98a4 ("mm/vmstat: fix overflow in mod_zone_page_state()")
> 

Good point, and thinking again what can go wrong, I tend to agree. We 
are trying to keep zones contiguous and it could happen that we end up 
with something like ZONE_DMA here (via default_kernel_zone_for_pfn()) 
and would consequently online something to ZONE_DMA that doesn't belong 
there, resulting in crashes.

@Andrew can you add  Cc: <stable@vger.kernel.org> and

"As we will search for a fitting zone using the wrong pfn, we might end 
up onlining memory to one of the special kernel zones, such as ZONE_DMA, 
which can end badly as the onlined memory does not satisfy properties of 
these zones."

Thanks Heiko!

-- 
Thanks,

David / dhildenb


WARNING: multiple messages have this Message-ID (diff)
From: David Hildenbrand <david@redhat.com>
To: Heiko Carstens <hca@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Michel Lespinasse <michel@lespinasse.org>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Rich Felker <dalias@libc.org>,
	Wei Yang <richard.weiyang@linux.alibaba.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Michal Hocko <mhocko@kernel.org>,
	linux-mm@kvack.org, Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Will Deacon <will@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Dave Jiang <dave.jiang@intel.com>, Baoquan He <bhe@redhat.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-acpi@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Anton Blanchard <anton@ozlabs.org>, Len Brown <lenb@kernel.org>,
	Nathan Lynch <nathanl@linux.ibm.com>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Borislav Petkov <bp@alien8.de>,
	Sergei Trofimovich <slyfox@gentoo.org>,
	Andy Lutomirski <luto@kernel.org>, Jia He <justin.he@arm.com>,
	Dan Williams <dan.j.williams@intel.com>,
	virtualization@lists.linux-foundation.org,
	Vlastimil Babka <vbabka@suse.cz>,
	Oscar Salvador <osalvador@suse.de>,
	Christophe Leroy <christophe.leroy@c-s.fr>,
	Pankaj Gupta <pankaj.gupta.linux@gmail.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Pierre Morel <pmorel@linux.ibm.com>,
	Scott Cheloha <cheloha@linux.ibm.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Thiago Jung Bauermann <bauerman@linux.ibm.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Joe Perches <joe@perches.com>, Mike Rapoport <rppt@kernel.org>
Subject: Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
Date: Thu, 15 Jul 2021 11:42:21 +0200	[thread overview]
Message-ID: <99c59db8-4c3d-6bee-9acc-41a8f76899ef@redhat.com> (raw)
In-Reply-To: <YO9FWrT9h21e/G8X@osiris>

On 14.07.21 22:13, Heiko Carstens wrote:
> On Mon, Jul 12, 2021 at 02:40:49PM +0200, David Hildenbrand wrote:
>> Checkpatch complained on a follow-up patch that we are using "unsigned"
>> here, which defaults to "unsigned int" and checkpatch is correct.
>>
>> Use "unsigned long" instead, just as we do in other places when handling
>> PFNs. This can bite us once we have physical addresses in the range of
>> multiple TB.
>>
>> Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering")
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>   include/linux/memory_hotplug.h | 4 ++--
>>   mm/memory_hotplug.c            | 4 ++--
>>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> I'd propose to add Cc: <stable@vger.kernel.org> since I actually had
> the fun to try to debug something like this a couple of years ago:
> 6cdb18ad98a4 ("mm/vmstat: fix overflow in mod_zone_page_state()")
> 

Good point, and thinking again what can go wrong, I tend to agree. We 
are trying to keep zones contiguous and it could happen that we end up 
with something like ZONE_DMA here (via default_kernel_zone_for_pfn()) 
and would consequently online something to ZONE_DMA that doesn't belong 
there, resulting in crashes.

@Andrew can you add  Cc: <stable@vger.kernel.org> and

"As we will search for a fitting zone using the wrong pfn, we might end 
up onlining memory to one of the special kernel zones, such as ZONE_DMA, 
which can end badly as the onlined memory does not satisfy properties of 
these zones."

Thanks Heiko!

-- 
Thanks,

David / dhildenb

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-07-15  9:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 12:40 mm/memory_hotplug: preparatory patches for new online policy and memory David Hildenbrand
2021-07-12 12:40 ` David Hildenbrand
2021-07-12 12:40 ` [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand
2021-07-14 20:13   ` Heiko Carstens
2021-07-15  9:42     ` David Hildenbrand [this message]
2021-07-15  9:42       ` David Hildenbrand
2021-07-15 18:12       ` Andrew Morton
2021-07-15 18:12         ` Andrew Morton
2021-07-14 20:41   ` Pankaj Gupta
2021-07-14 20:41     ` Pankaj Gupta
2021-07-15  9:31   ` Oscar Salvador
2021-07-15  9:34   ` Muchun Song
2021-07-15  9:34     ` Muchun Song
2021-07-12 12:40 ` [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory() David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand
2021-07-14 20:47   ` Pankaj Gupta
2021-07-14 20:47     ` Pankaj Gupta
2021-07-14 20:47     ` Pankaj Gupta
2021-07-14 20:47     ` Pankaj Gupta
2021-07-12 12:40 ` [PATCH v1 3/4] mm/memory_hotplug: remove nid parameter from remove_memory() and friends David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand
2021-07-12 12:40 ` [PATCH v1 4/4] ACPI: memhotplug: memory resources cannot be enabled yet David Hildenbrand
2021-07-12 12:40   ` David Hildenbrand

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=99c59db8-4c3d-6bee-9acc-41a8f76899ef@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=anton@ozlabs.org \
    --cc=ardb@kernel.org \
    --cc=bauerman@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhe@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=cheloha@linux.ibm.com \
    --cc=christophe.leroy@c-s.fr \
    --cc=dalias@libc.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jasowang@redhat.com \
    --cc=joe@perches.com \
    --cc=justin.he@arm.com \
    --cc=ldufour@linux.ibm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mhocko@kernel.org \
    --cc=michel@lespinasse.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=mst@redhat.com \
    --cc=nathanl@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=osalvador@suse.de \
    --cc=pankaj.gupta.linux@gmail.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=pmorel@linux.ibm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=richard.weiyang@linux.alibaba.com \
    --cc=rjw@rjwysocki.net \
    --cc=rppt@kernel.org \
    --cc=slyfox@gentoo.org \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vishal.l.verma@intel.com \
    --cc=vkuznets@redhat.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=ysato@users.sourceforge.jp \
    /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.