From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbcFWRRc (ORCPT ); Thu, 23 Jun 2016 13:17:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:1471 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750785AbcFWRRb (ORCPT ); Thu, 23 Jun 2016 13:17:31 -0400 X-IBM-Helo: d01dlp01.pok.ibm.com X-IBM-MailFrom: aneesh.kumar@linux.vnet.ibm.com From: "Aneesh Kumar K.V" To: Reza Arbab , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Dan Williams , Balbir Singh , Gavin Shan , David Gibson , Vasant Hegde , Scott Wood , "Oliver O'Halloran" , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/mm: update arch_{add,remove}_memory() for radix In-Reply-To: <1466699962-22412-1-git-send-email-arbab@linux.vnet.ibm.com> References: <1466699962-22412-1-git-send-email-arbab@linux.vnet.ibm.com> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 23 Jun 2016 22:47:20 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16062317-0040-0000-0000-000000A4A261 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062317-0041-0000-0000-0000047E916F Message-Id: <87mvmbygdb.fsf@skywalker.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-23_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606230180 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reza Arbab writes: > These functions are making direct calls to the hash table APIs, > leading to a BUG() on systems using radix. > > Switch them to the vmemmap_{create,remove}_mapping() wrappers, and > move to the __meminit section. They are really not the same. They can possibly end up using different base page size. Also vmemmap is available only with SPARSEMEM_VMEMMAP enabled. Does hotplug depend on sparsemem vmemmap ? > > Signed-off-by: Reza Arbab > --- > arch/powerpc/mm/mem.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c > index 2fd57fa..80c6ee7 100644 > --- a/arch/powerpc/mm/mem.c > +++ b/arch/powerpc/mm/mem.c > @@ -116,7 +116,7 @@ int memory_add_physaddr_to_nid(u64 start) > } > #endif > > -int arch_add_memory(int nid, u64 start, u64 size, bool for_device) > +int __meminit arch_add_memory(int nid, u64 start, u64 size, bool for_device) > { > struct pglist_data *pgdata; > struct zone *zone; > @@ -127,7 +127,7 @@ int arch_add_memory(int nid, u64 start, u64 size, bool for_device) > pgdata = NODE_DATA(nid); > > start = (unsigned long)__va(start); > - rc = create_section_mapping(start, start + size); > + rc = vmemmap_create_mapping(start, size, __pa(start)); > if (rc) { > pr_warning( > "Unable to create mapping for hot added memory 0x%llx..0x%llx: %d\n", > @@ -143,7 +143,7 @@ int arch_add_memory(int nid, u64 start, u64 size, bool for_device) > } > > #ifdef CONFIG_MEMORY_HOTREMOVE > -int arch_remove_memory(u64 start, u64 size) > +int __meminit arch_remove_memory(u64 start, u64 size) > { > unsigned long start_pfn = start >> PAGE_SHIFT; > unsigned long nr_pages = size >> PAGE_SHIFT; > @@ -157,7 +157,7 @@ int arch_remove_memory(u64 start, u64 size) > > /* Remove htab bolted mappings for this section of memory */ > start = (unsigned long)__va(start); > - ret = remove_section_mapping(start, start + size); > + vmemmap_remove_mapping(start, size); > > /* Ensure all vmalloc mappings are flushed in case they also > * hit that section of memory > -- > 1.8.3.1 We really want to look at memory hotplug to fully understand the radix impact. The unplug operation needs to do some additional freeing. I did put in comments around that with the idea of coming back to that later #ifdef CONFIG_MEMORY_HOTPLUG void radix__vmemmap_remove_mapping(unsigned long start, unsigned long page_size) { /* FIXME!! intel does more. We should free page tables mapping vmemmap ? */ } #endif -aneesh