From: Michael Ellerman Subject: Re: [PATCH 1/5] mm/resource: return real error codes from walk failures Date: Tue, 29 Jan 2019 12:18:05 +1100 Message-ID: <87k1ios1ma.fsf@concordia.ellerman.id.au> References: <20190124231441.37A4A305@viggo.jf.intel.com> <20190124231442.EFD29EE0@viggo.jf.intel.com> <4898e064-5298-6a82-83ea-23d16f3dfb3d@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4898e064-5298-6a82-83ea-23d16f3dfb3d-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" To: Dave Hansen , Bjorn Helgaas , Dave Hansen Cc: thomas.lendacky-5C7GfCeVMHo@public.gmane.org, mhocko-IBi9RG/b67k@public.gmane.org, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org, Takashi Iwai , Huang Ying , Linux Kernel Mailing List , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Jerome Glisse , Benjamin Herrenschmidt , Borislav Petkov , baiyaowei-0p4V/sDNsUmm0O/7XYngnFaTQe2KTcn/@public.gmane.org, zwisler-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Paul Mackerras , Wu Fengguang , Andrew Morton List-Id: linux-nvdimm@lists.01.org Dave Hansen writes: > On 1/25/19 1:02 PM, Bjorn Helgaas wrote: >>> @@ -453,7 +453,7 @@ int walk_system_ram_range(unsigned long >>> unsigned long flags; >>> struct resource res; >>> unsigned long pfn, end_pfn; >>> - int ret = -1; >>> + int ret = -EINVAL; >> Can you either make a similar change to the powerpc version of >> walk_system_ram_range() in arch/powerpc/mm/mem.c or explain why it's >> not needed? It *seems* like we'd want both versions of >> walk_system_ram_range() to behave similarly in this respect. > > Sure. A quick grep shows powerpc being the only other implementation. Ugh gross, why are we reimplementing it? ... Oh right, memblock vs iomem. We should fix that one day :/ > I'll just add this hunk: > >> diff -puN arch/powerpc/mm/mem.c~memory-hotplug-walk_system_ram_range-returns-neg-1 arch/powerpc/mm/mem.c >> --- a/arch/powerpc/mm/mem.c~memory-hotplug-walk_system_ram_range-returns-neg-1 2019-01-25 12:57:00.000004446 -0800 >> +++ b/arch/powerpc/mm/mem.c 2019-01-25 12:58:13.215004263 -0800 >> @@ -188,7 +188,7 @@ walk_system_ram_range(unsigned long star >> struct memblock_region *reg; >> unsigned long end_pfn = start_pfn + nr_pages; >> unsigned long tstart, tend; >> - int ret = -1; >> + int ret = -EINVAL; > > I'll also dust off the ol' cross-compiler and make sure I didn't > fat-finger anything. Modern Fedora & Ubuntu have packaged cross toolchains. Otherwise there's the kernel.org ones, or bootlin has versions with libc if you need it. Patch looks fine. That value could only get to userspace if we have no memory, which would be interesting. Acked-by: Michael Ellerman (powerpc) cheers