[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190409100148.24703-1-david@redhat.com>
Date: Tue, 9 Apr 2019 12:01:44 +0200
From: David Hildenbrand <david@...hat.com>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org, David Hildenbrand <david@...hat.com>,
Andrew Banman <andrew.banman@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Arun KS <arunks@...eaurora.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Borislav Petkov <bp@...en8.de>,
Christophe Leroy <christophe.leroy@....fr>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Heiko Carstens <heiko.carstens@...ibm.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Mathieu Malaterre <malat@...ian.org>,
Michael Ellerman <mpe@...erman.id.au>,
Michal Hocko <mhocko@...e.com>,
Mike Rapoport <rppt@...ux.ibm.com>,
"mike.travis@....com" <mike.travis@....com>,
Nicholas Piggin <npiggin@...il.com>,
Oscar Salvador <osalvador@...e.com>,
Oscar Salvador <osalvador@...e.de>,
Paul Mackerras <paulus@...ba.org>,
Pavel Tatashin <pasha.tatashin@...een.com>,
Peter Zijlstra <peterz@...radead.org>, Qian Cai <cai@....pw>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Rich Felker <dalias@...c.org>, Rob Herring <robh@...nel.org>,
Stefan Agner <stefan@...er.ch>,
Thomas Gleixner <tglx@...utronix.de>,
Tony Luck <tony.luck@...el.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Wei Yang <richard.weiyang@...il.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>
Subject: [PATCH v1 0/4] mm/memory_hotplug: Better error handling when removing memory
Error handling when removing memory is somewhat messed up right now. Some
errors result in warnings, others are completely ignored. Memory unplug
code can essentially not deal with errors properly as of now.
remove_memory() will never fail.
We have basically two choices:
1. Allow arch_remov_memory() and friends to fail, propagating errors via
remove_memory(). Might be problematic (e.g. DIMMs consisting of multiple
pieces added/removed separately).
2. Don't allow the functions to fail, handling errors in a nicer way.
It seems like most errors that can theoretically happen are really corner
cases and mostly theoretical (e.g. "section not valid"). However e.g.
aborting removal of sections while all callers simply continue in case of
errors is not nice.
If we can gurantee that removal of memory always works (and WARN/skip in
case of theoretical errors so we can figure out what is going on), we can
go ahead and implement better error handling when adding memory.
E.g. via add_memory():
arch_add_memory()
ret = do_stuff()
if (ret) {
arch_remove_memory();
goto error;
}
Handling here that arch_remove_memory() might fail is basically impossible.
So I suggest, let's avoid reporting errors while removing memory, warning
on theoretical errors instead and continuing instead of aborting.
Compile-tested on x86-64, powerpc, s390x. Tested on x86-64 with DIMMs.
Based on git://git.cmpxchg.org/linux-mmots.git
David Hildenbrand (4):
mm/memory_hotplug: Release memory resource after arch_remove_memory()
mm/memory_hotplug: Make unregister_memory_section() never fail
mm/memory_hotplug: Make __remove_section() never fail
mm/memory_hotplug: Make __remove_pages() and arch_remove_memory()
never fail
arch/ia64/mm/init.c | 11 ++----
arch/powerpc/mm/mem.c | 11 +++---
arch/s390/mm/init.c | 5 +--
arch/sh/mm/init.c | 11 ++----
arch/x86/mm/init_32.c | 5 +--
arch/x86/mm/init_64.c | 10 ++----
drivers/base/memory.c | 16 +++------
include/linux/memory.h | 2 +-
include/linux/memory_hotplug.h | 8 ++---
mm/memory_hotplug.c | 63 +++++++++++++++++-----------------
10 files changed, 60 insertions(+), 82 deletions(-)
--
2.17.2
Powered by blists - more mailing lists