From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: [PATCH 8/10] memory-hotplug : remove page table of x86_64 architecture Date: Sun, 07 Oct 2012 21:37:00 -0700 Message-ID: References: <506E43E0.70507@jp.fujitsu.com> <506E4799.30407@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: In-Reply-To: <506E4799.30407@jp.fujitsu.com> (Yasuaki Ishimatsu's message of "Fri, 5 Oct 2012 11:36:09 +0900") Sender: owner-linux-mm@kvack.org To: Yasuaki Ishimatsu Cc: x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-ia64@vger.kernel.org, cmetcalf@tilera.com, sparclinux@vger.kernel.org, rientjes@google.com, liuj97@gmail.com, len.brown@intel.com, cl@linux.com, minchan.kim@gmail.com, akpm@linux-foundation.org, kosaki.motohiro@jp.fujitsu.com, wency@cn.fujitsu.com List-Id: linux-acpi@vger.kernel.org Yasuaki Ishimatsu writes: > + } > + > + /* > + * We use 2M page, but we need to remove part of them, > + * so split 2M page to 4K page. > + */ > + pte = alloc_low_page(&pte_phys); What happens when the allocation fails? alloc_low_page seems to be buggy there too, it would __pa a NULL pointer. > + if (pud_large(*pud)) { > + if ((addr & ~PUD_MASK) == 0 && next <= end) { > + set_pud(pud, __pud(0)); > + pages++; > + continue; > + } > + > + /* > + * We use 1G page, but we need to remove part of them, > + * so split 1G page to 2M page. > + */ > + pmd = alloc_low_page(&pmd_phys); Same here > + __split_large_page((pte_t *)pud, addr, (pte_t *)pmd); > + > + spin_lock(&init_mm.page_table_lock); > + pud_populate(&init_mm, pud, __va(pmd_phys)); > + spin_unlock(&init_mm.page_table_lock); > + } > + > + pmd = map_low_page(pmd_offset(pud, 0)); > + phys_pmd_remove(pmd, addr, end); > + unmap_low_page(pmd); > + __flush_tlb_all(); > + } > + __flush_tlb_all(); This doesn't flush the other CPUs doesn't it? -Andi -- ak@linux.intel.com -- Speaking for myself only -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Date: Mon, 08 Oct 2012 04:37:00 +0000 Subject: Re: [PATCH 8/10] memory-hotplug : remove page table of x86_64 architecture Message-Id: List-Id: References: <506E43E0.70507@jp.fujitsu.com> <506E4799.30407@jp.fujitsu.com> In-Reply-To: <506E4799.30407@jp.fujitsu.com> (Yasuaki Ishimatsu's message of "Fri, 5 Oct 2012 11:36:09 +0900") MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Yasuaki Ishimatsu Cc: x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-ia64@vger.kernel.org, cmetcalf@tilera.com, sparclinux@vger.kernel.org, rientjes@google.com, liuj97@gmail.com, len.brown@intel.com, cl@linux.com, minchan.kim@gmail.com, akpm@linux-foundation.org, kosaki.motohiro@jp.fujitsu.com, wency@cn.fujitsu.com Yasuaki Ishimatsu writes: > + } > + > + /* > + * We use 2M page, but we need to remove part of them, > + * so split 2M page to 4K page. > + */ > + pte = alloc_low_page(&pte_phys); What happens when the allocation fails? alloc_low_page seems to be buggy there too, it would __pa a NULL pointer. > + if (pud_large(*pud)) { > + if ((addr & ~PUD_MASK) = 0 && next <= end) { > + set_pud(pud, __pud(0)); > + pages++; > + continue; > + } > + > + /* > + * We use 1G page, but we need to remove part of them, > + * so split 1G page to 2M page. > + */ > + pmd = alloc_low_page(&pmd_phys); Same here > + __split_large_page((pte_t *)pud, addr, (pte_t *)pmd); > + > + spin_lock(&init_mm.page_table_lock); > + pud_populate(&init_mm, pud, __va(pmd_phys)); > + spin_unlock(&init_mm.page_table_lock); > + } > + > + pmd = map_low_page(pmd_offset(pud, 0)); > + phys_pmd_remove(pmd, addr, end); > + unmap_low_page(pmd); > + __flush_tlb_all(); > + } > + __flush_tlb_all(); This doesn't flush the other CPUs doesn't it? -Andi -- ak@linux.intel.com -- Speaking for myself only From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ozlabs.org (Postfix) with ESMTP id 10FEB2C00C8 for ; Mon, 8 Oct 2012 15:37:03 +1100 (EST) From: Andi Kleen To: Yasuaki Ishimatsu Subject: Re: [PATCH 8/10] memory-hotplug : remove page table of x86_64 architecture References: <506E43E0.70507@jp.fujitsu.com> <506E4799.30407@jp.fujitsu.com> Date: Sun, 07 Oct 2012 21:37:00 -0700 In-Reply-To: <506E4799.30407@jp.fujitsu.com> (Yasuaki Ishimatsu's message of "Fri, 5 Oct 2012 11:36:09 +0900") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, wency@cn.fujitsu.com, len.brown@intel.com, linux-acpi@vger.kernel.org, linux-sh@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, cmetcalf@tilera.com, linux-mm@kvack.org, minchan.kim@gmail.com, kosaki.motohiro@jp.fujitsu.com, rientjes@google.com, sparclinux@vger.kernel.org, cl@linux.com, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, liuj97@gmail.com List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Yasuaki Ishimatsu writes: > + } > + > + /* > + * We use 2M page, but we need to remove part of them, > + * so split 2M page to 4K page. > + */ > + pte = alloc_low_page(&pte_phys); What happens when the allocation fails? alloc_low_page seems to be buggy there too, it would __pa a NULL pointer. > + if (pud_large(*pud)) { > + if ((addr & ~PUD_MASK) == 0 && next <= end) { > + set_pud(pud, __pud(0)); > + pages++; > + continue; > + } > + > + /* > + * We use 1G page, but we need to remove part of them, > + * so split 1G page to 2M page. > + */ > + pmd = alloc_low_page(&pmd_phys); Same here > + __split_large_page((pte_t *)pud, addr, (pte_t *)pmd); > + > + spin_lock(&init_mm.page_table_lock); > + pud_populate(&init_mm, pud, __va(pmd_phys)); > + spin_unlock(&init_mm.page_table_lock); > + } > + > + pmd = map_low_page(pmd_offset(pud, 0)); > + phys_pmd_remove(pmd, addr, end); > + unmap_low_page(pmd); > + __flush_tlb_all(); > + } > + __flush_tlb_all(); This doesn't flush the other CPUs doesn't it? -Andi -- ak@linux.intel.com -- Speaking for myself only From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751275Ab2JHEhK (ORCPT ); Mon, 8 Oct 2012 00:37:10 -0400 Received: from mga11.intel.com ([192.55.52.93]:4542 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807Ab2JHEhE (ORCPT ); Mon, 8 Oct 2012 00:37:04 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,549,1344236400"; d="scan'208";a="231085063" From: Andi Kleen To: Yasuaki Ishimatsu Cc: , , , , , , , , , , , , , , , , , Subject: Re: [PATCH 8/10] memory-hotplug : remove page table of x86_64 architecture References: <506E43E0.70507@jp.fujitsu.com> <506E4799.30407@jp.fujitsu.com> Date: Sun, 07 Oct 2012 21:37:00 -0700 In-Reply-To: <506E4799.30407@jp.fujitsu.com> (Yasuaki Ishimatsu's message of "Fri, 5 Oct 2012 11:36:09 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yasuaki Ishimatsu writes: > + } > + > + /* > + * We use 2M page, but we need to remove part of them, > + * so split 2M page to 4K page. > + */ > + pte = alloc_low_page(&pte_phys); What happens when the allocation fails? alloc_low_page seems to be buggy there too, it would __pa a NULL pointer. > + if (pud_large(*pud)) { > + if ((addr & ~PUD_MASK) == 0 && next <= end) { > + set_pud(pud, __pud(0)); > + pages++; > + continue; > + } > + > + /* > + * We use 1G page, but we need to remove part of them, > + * so split 1G page to 2M page. > + */ > + pmd = alloc_low_page(&pmd_phys); Same here > + __split_large_page((pte_t *)pud, addr, (pte_t *)pmd); > + > + spin_lock(&init_mm.page_table_lock); > + pud_populate(&init_mm, pud, __va(pmd_phys)); > + spin_unlock(&init_mm.page_table_lock); > + } > + > + pmd = map_low_page(pmd_offset(pud, 0)); > + phys_pmd_remove(pmd, addr, end); > + unmap_low_page(pmd); > + __flush_tlb_all(); > + } > + __flush_tlb_all(); This doesn't flush the other CPUs doesn't it? -Andi -- ak@linux.intel.com -- Speaking for myself only