From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by kanga.kvack.org (Postfix) with ESMTP id 4B6006B014A for ; Wed, 11 Jun 2014 05:13:03 -0400 (EDT) Received: by mail-pa0-f44.google.com with SMTP id bj1so1704428pad.17 for ; Wed, 11 Jun 2014 02:13:03 -0700 (PDT) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com. [119.145.14.65]) by mx.google.com with ESMTPS id ye4si37427539pbc.19.2014.06.11.02.12.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 02:13:02 -0700 (PDT) Message-ID: <53981D81.5060708@huawei.com> Date: Wed, 11 Jun 2014 17:12:33 +0800 From: Zhang Zhen MIME-Version: 1.0 Subject: Proposal to realize hot-add *several sections one time* Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan Hi, Now we can hot-add memory by % echo start_address_of_new_memory > /sys/devices/system/memory/probe Then, [start_address_of_new_memory, start_address_of_new_memory + memory_block_size] memory range is hot-added. But we can only hot-add *one section one time* by this way. Whether we can add an argument on behalf of the count of the sections to add ? So we can can hot-add *several sections one time*. Just like: % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_sections * memory_block_size] memory range is hot-added. If this proposal is reasonable, i will send a patch to realize it. Any suggestions ? Best regards. -- 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 Return-Path: Received: from mail-ie0-f178.google.com (mail-ie0-f178.google.com [209.85.223.178]) by kanga.kvack.org (Postfix) with ESMTP id D826F6B017B for ; Wed, 11 Jun 2014 18:08:42 -0400 (EDT) Received: by mail-ie0-f178.google.com with SMTP id rd18so390801iec.9 for ; Wed, 11 Jun 2014 15:08:42 -0700 (PDT) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [2607:f8b0:4001:c03::22f]) by mx.google.com with ESMTPS id le20si25138745icc.96.2014.06.11.15.08.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 15:08:42 -0700 (PDT) Received: by mail-ie0-f175.google.com with SMTP id tp5so388557ieb.34 for ; Wed, 11 Jun 2014 15:08:41 -0700 (PDT) Date: Wed, 11 Jun 2014 15:08:39 -0700 (PDT) From: David Rientjes Subject: Re: Proposal to realize hot-add *several sections one time* In-Reply-To: <53981D81.5060708@huawei.com> Message-ID: References: <53981D81.5060708@huawei.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Zhang Zhen Cc: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan On Wed, 11 Jun 2014, Zhang Zhen wrote: > Hi, > > Now we can hot-add memory by > > % echo start_address_of_new_memory > /sys/devices/system/memory/probe > > Then, [start_address_of_new_memory, start_address_of_new_memory + > memory_block_size] memory range is hot-added. > > But we can only hot-add *one section one time* by this way. > Whether we can add an argument on behalf of the count of the sections to add ? > So we can can hot-add *several sections one time*. Just like: > Not necessarily true, it depends on sections_per_block. Don't believe Documentation/memory-hotplug.txt that suggests this is only for powerpc, x86 and sh allow this interface as well. > % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe > > Then, [start_address_of_new_memory, start_address_of_new_memory + > count_of_sections * memory_block_size] memory range is hot-added. > > If this proposal is reasonable, i will send a patch to realize it. > The problem is knowing how much memory is being onlined so that you can definitively determine what count_of_sections should be. The number of pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which differ depending on the architectures that support this interface. So if you support count_of_sections, it would return errno even though you have onlined some sections. -- 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 Return-Path: Received: from mail-ie0-f174.google.com (mail-ie0-f174.google.com [209.85.223.174]) by kanga.kvack.org (Postfix) with ESMTP id 093EE6B017D for ; Wed, 11 Jun 2014 18:15:16 -0400 (EDT) Received: by mail-ie0-f174.google.com with SMTP id lx4so399745iec.19 for ; Wed, 11 Jun 2014 15:15:15 -0700 (PDT) Received: from mail-ig0-x22d.google.com (mail-ig0-x22d.google.com [2607:f8b0:4001:c05::22d]) by mx.google.com with ESMTPS id ii4si46367629icc.34.2014.06.11.15.15.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Jun 2014 15:15:15 -0700 (PDT) Received: by mail-ig0-f173.google.com with SMTP id r2so5043673igi.6 for ; Wed, 11 Jun 2014 15:15:15 -0700 (PDT) Date: Wed, 11 Jun 2014 15:15:13 -0700 (PDT) From: David Rientjes Subject: [patch] mm, hotplug: probe interface is available on several platforms In-Reply-To: Message-ID: References: <53981D81.5060708@huawei.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Dave Hansen , Zhang Zhen , Greg Kroah-Hartman , laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan Documentation/memory-hotplug.txt incorrectly states that the memory driver "probe" interface is only supported on powerpc and is vague about its application on x86. Clarify the platforms that make this interface available if memory hotplug is enabled. Signed-off-by: David Rientjes --- Documentation/memory-hotplug.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt --- a/Documentation/memory-hotplug.txt +++ b/Documentation/memory-hotplug.txt @@ -209,15 +209,12 @@ If memory device is found, memory hotplug code will be called. 4.2 Notify memory hot-add event by hand ------------ -On powerpc, the firmware does not notify a memory hotplug event to the kernel. -Therefore, "probe" interface is supported to notify the event to the kernel. -This interface depends on CONFIG_ARCH_MEMORY_PROBE. - -CONFIG_ARCH_MEMORY_PROBE is supported on powerpc only. On x86, this config -option is disabled by default since ACPI notifies a memory hotplug event to -the kernel, which performs its hotplug operation as the result. Please -enable this option if you need the "probe" interface for testing purposes -on x86. +On some architectures, the firmware may not notify the kernel of a memory +hotplug event. Therefore, the memory "probe" interface is supported to +explicitly notify the kernel. This interface depends on +CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86 +if hotplug is supported, although for x86 this should be handled by ACPI +notification. Probe interface is located at /sys/devices/system/memory/probe -- 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 Return-Path: Received: from mail-pb0-f48.google.com (mail-pb0-f48.google.com [209.85.160.48]) by kanga.kvack.org (Postfix) with ESMTP id 9175C6B017F for ; Wed, 11 Jun 2014 18:22:35 -0400 (EDT) Received: by mail-pb0-f48.google.com with SMTP id rr13so270595pbb.7 for ; Wed, 11 Jun 2014 15:22:35 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com. [134.134.136.20]) by mx.google.com with ESMTP id wv10si39487732pbc.39.2014.06.11.15.22.34 for ; Wed, 11 Jun 2014 15:22:34 -0700 (PDT) Message-ID: <5398D691.7050202@intel.com> Date: Wed, 11 Jun 2014 15:22:09 -0700 From: Dave Hansen MIME-Version: 1.0 Subject: Re: [patch] mm, hotplug: probe interface is available on several platforms References: <53981D81.5060708@huawei.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes , Andrew Morton Cc: Zhang Zhen , Greg Kroah-Hartman , laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan On 06/11/2014 03:15 PM, David Rientjes wrote: > +CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86 > +if hotplug is supported, although for x86 this should be handled by ACPI > +notification. Looks like a good change, in general. My only nit is that this implies that all hotplug on x86 is ACPI-based, which isn't true. Xen, at least, has an extension to its ballooning that does hotplugs without ACPI. -- 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 Return-Path: Received: from mail-oa0-f51.google.com (mail-oa0-f51.google.com [209.85.219.51]) by kanga.kvack.org (Postfix) with ESMTP id 9EEDD6B018A for ; Wed, 11 Jun 2014 22:41:40 -0400 (EDT) Received: by mail-oa0-f51.google.com with SMTP id j17so693213oag.38 for ; Wed, 11 Jun 2014 19:41:40 -0700 (PDT) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com. [119.145.14.66]) by mx.google.com with ESMTPS id sz9si38048644obc.33.2014.06.11.19.41.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Jun 2014 19:41:40 -0700 (PDT) Message-ID: <53991353.5040607@huawei.com> Date: Thu, 12 Jun 2014 10:41:23 +0800 From: Zhang Zhen MIME-Version: 1.0 Subject: Re: Proposal to realize hot-add *several sections one time* References: <53981D81.5060708@huawei.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan On 2014/6/12 6:08, David Rientjes wrote: > On Wed, 11 Jun 2014, Zhang Zhen wrote: > >> Hi, >> >> Now we can hot-add memory by >> >> % echo start_address_of_new_memory > /sys/devices/system/memory/probe >> >> Then, [start_address_of_new_memory, start_address_of_new_memory + >> memory_block_size] memory range is hot-added. >> >> But we can only hot-add *one section one time* by this way. >> Whether we can add an argument on behalf of the count of the sections to add ? >> So we can can hot-add *several sections one time*. Just like: >> > > Not necessarily true, it depends on sections_per_block. Don't believe > Documentation/memory-hotplug.txt that suggests this is only for powerpc, > x86 and sh allow this interface as well. > >> % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe >> >> Then, [start_address_of_new_memory, start_address_of_new_memory + >> count_of_sections * memory_block_size] memory range is hot-added. >> >> If this proposal is reasonable, i will send a patch to realize it. >> > > The problem is knowing how much memory is being onlined so that you can > definitively determine what count_of_sections should be. The number of > pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which > differ depending on the architectures that support this interface. So if > you support count_of_sections, it would return errno even though you have > onlined some sections. > Hum, sorry. My expression is not right. The count of sections one time hot-added depends on sections_per_block. Now we are porting the memory-hotplug to arm. But we can only hot-add *fixed number of sections one time* on particular architecture. Whether we can add an argument on behalf of the count of the blocks to add ? % echo start_address_of_new_memory count_of_blocks > /sys/devices/system/memory/probe Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_blocks * memory_block_size] memory range is hot-added. So user don't need execute several times of echo when they want to hot add multi-block size memory. Any comments are welcome. Best regards! > -- 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 Return-Path: Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) by kanga.kvack.org (Postfix) with ESMTP id 1FC2D900002 for ; Thu, 12 Jun 2014 03:07:31 -0400 (EDT) Received: by mail-ig0-f171.google.com with SMTP id h18so3857218igc.10 for ; Thu, 12 Jun 2014 00:07:30 -0700 (PDT) Received: from mail-ig0-x232.google.com (mail-ig0-x232.google.com [2607:f8b0:4001:c05::232]) by mx.google.com with ESMTPS id p4si1777354igx.8.2014.06.12.00.07.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 00:07:30 -0700 (PDT) Received: by mail-ig0-f178.google.com with SMTP id hn18so1699327igb.17 for ; Thu, 12 Jun 2014 00:07:30 -0700 (PDT) Date: Thu, 12 Jun 2014 00:07:28 -0700 (PDT) From: David Rientjes Subject: Re: Proposal to realize hot-add *several sections one time* In-Reply-To: <53991353.5040607@huawei.com> Message-ID: References: <53981D81.5060708@huawei.com> <53991353.5040607@huawei.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Zhang Zhen Cc: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan On Thu, 12 Jun 2014, Zhang Zhen wrote: > >> % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe > >> > >> Then, [start_address_of_new_memory, start_address_of_new_memory + > >> count_of_sections * memory_block_size] memory range is hot-added. > >> > >> If this proposal is reasonable, i will send a patch to realize it. > >> > > > > The problem is knowing how much memory is being onlined so that you can > > definitively determine what count_of_sections should be. The number of > > pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which > > differ depending on the architectures that support this interface. So if > > you support count_of_sections, it would return errno even though you have > > onlined some sections. > > > Hum, sorry. > My expression is not right. The count of sections one time hot-added > depends on sections_per_block. > Ok, so you know specifically what sections_per_block is for your platform so you know exactly how many sections need to be added. > Now we are porting the memory-hotplug to arm. > But we can only hot-add *fixed number of sections one time* on particular architecture. > > Whether we can add an argument on behalf of the count of the blocks to add ? > > % echo start_address_of_new_memory count_of_blocks > /sys/devices/system/memory/probe > > Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_blocks * memory_block_size] > memory range is hot-added. > As I said, if the above returns errno at some point, it still can result in some sections being onlined. To be clear: if "echo 0x10000000 > /sys/devices/system/memory/probe" fails, the section starting at address 0x10000000 failed to be onlined for the reason specified by errno. If we follow your suggestion to specify how many sections to online, if "echo '0x10000000 16' > /sys/devices/system/memory/probe" fails, eight sections could have been successfully onlined at address 0x10000000 and then we encountered a failure (perhaps because the next sections were already onlined, we get an -EEXIST). We don't know what we successfully onlined. This could be mitigated, but there would have to be a convincing reason that this is better than using the currently functionally in a loop and properly handling your error codes. -- 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 Return-Path: Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by kanga.kvack.org (Postfix) with ESMTP id 78F4F6B00A0 for ; Fri, 13 Jun 2014 03:32:32 -0400 (EDT) Received: by mail-lb0-f179.google.com with SMTP id u10so1315594lbd.38 for ; Fri, 13 Jun 2014 00:32:31 -0700 (PDT) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com. [119.145.14.65]) by mx.google.com with ESMTPS id wt9si1396045lbb.8.2014.06.13.00.32.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 13 Jun 2014 00:32:30 -0700 (PDT) Message-ID: <539AA8DF.4060805@huawei.com> Date: Fri, 13 Jun 2014 15:31:43 +0800 From: Zhang Zhen MIME-Version: 1.0 Subject: Re: Proposal to realize hot-add *several sections one time* References: <53981D81.5060708@huawei.com> <53991353.5040607@huawei.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: David Rientjes Cc: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan On 2014/6/12 15:07, David Rientjes wrote: > On Thu, 12 Jun 2014, Zhang Zhen wrote: > >>>> % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe >>>> >>>> Then, [start_address_of_new_memory, start_address_of_new_memory + >>>> count_of_sections * memory_block_size] memory range is hot-added. >>>> >>>> If this proposal is reasonable, i will send a patch to realize it. >>>> >>> >>> The problem is knowing how much memory is being onlined so that you can >>> definitively determine what count_of_sections should be. The number of >>> pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which >>> differ depending on the architectures that support this interface. So if >>> you support count_of_sections, it would return errno even though you have >>> onlined some sections. >>> >> Hum, sorry. >> My expression is not right. The count of sections one time hot-added >> depends on sections_per_block. >> > > Ok, so you know specifically what sections_per_block is for your platform > so you know exactly how many sections need to be added. > >> Now we are porting the memory-hotplug to arm. >> But we can only hot-add *fixed number of sections one time* on particular architecture. >> >> Whether we can add an argument on behalf of the count of the blocks to add ? >> >> % echo start_address_of_new_memory count_of_blocks > /sys/devices/system/memory/probe >> >> Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_blocks * memory_block_size] >> memory range is hot-added. >> > > As I said, if the above returns errno at some point, it still can result > in some sections being onlined. To be clear: if > "echo 0x10000000 > /sys/devices/system/memory/probe" fails, the section > starting at address 0x10000000 failed to be onlined for the reason > specified by errno. If we follow your suggestion to specify how many > sections to online, if > "echo '0x10000000 16' > /sys/devices/system/memory/probe" fails, eight > sections could have been successfully onlined at address 0x10000000 and > then we encountered a failure (perhaps because the next sections were > already onlined, we get an -EEXIST). We don't know what we successfully > onlined. > > This could be mitigated, but there would have to be a convincing reason > that this is better than using the currently functionally in a loop and > properly handling your error codes. Hi David, I think you are right. We had better to use the currently functionally in a loop if we need to add several blocks. In this way, we can get an errno in time if a block failed to be onlined. Thanks for your comments. I got it. > > -- > 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 > > -- 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 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755878AbaFKJNi (ORCPT ); Wed, 11 Jun 2014 05:13:38 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:7245 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752127AbaFKJNf (ORCPT ); Wed, 11 Jun 2014 05:13:35 -0400 Message-ID: <53981D81.5060708@huawei.com> Date: Wed, 11 Jun 2014 17:12:33 +0800 From: Zhang Zhen User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: , , CC: , , Wang Nan Subject: Proposal to realize hot-add *several sections one time* Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.77] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Now we can hot-add memory by % echo start_address_of_new_memory > /sys/devices/system/memory/probe Then, [start_address_of_new_memory, start_address_of_new_memory + memory_block_size] memory range is hot-added. But we can only hot-add *one section one time* by this way. Whether we can add an argument on behalf of the count of the sections to add ? So we can can hot-add *several sections one time*. Just like: % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_sections * memory_block_size] memory range is hot-added. If this proposal is reasonable, i will send a patch to realize it. Any suggestions ? Best regards. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754281AbaFKWIo (ORCPT ); Wed, 11 Jun 2014 18:08:44 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:51357 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752811AbaFKWIm (ORCPT ); Wed, 11 Jun 2014 18:08:42 -0400 Date: Wed, 11 Jun 2014 15:08:39 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Zhang Zhen cc: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan Subject: Re: Proposal to realize hot-add *several sections one time* In-Reply-To: <53981D81.5060708@huawei.com> Message-ID: References: <53981D81.5060708@huawei.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) 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 On Wed, 11 Jun 2014, Zhang Zhen wrote: > Hi, > > Now we can hot-add memory by > > % echo start_address_of_new_memory > /sys/devices/system/memory/probe > > Then, [start_address_of_new_memory, start_address_of_new_memory + > memory_block_size] memory range is hot-added. > > But we can only hot-add *one section one time* by this way. > Whether we can add an argument on behalf of the count of the sections to add ? > So we can can hot-add *several sections one time*. Just like: > Not necessarily true, it depends on sections_per_block. Don't believe Documentation/memory-hotplug.txt that suggests this is only for powerpc, x86 and sh allow this interface as well. > % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe > > Then, [start_address_of_new_memory, start_address_of_new_memory + > count_of_sections * memory_block_size] memory range is hot-added. > > If this proposal is reasonable, i will send a patch to realize it. > The problem is knowing how much memory is being onlined so that you can definitively determine what count_of_sections should be. The number of pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which differ depending on the architectures that support this interface. So if you support count_of_sections, it would return errno even though you have onlined some sections. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753735AbaFKWPS (ORCPT ); Wed, 11 Jun 2014 18:15:18 -0400 Received: from mail-ie0-f171.google.com ([209.85.223.171]:60793 "EHLO mail-ie0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbaFKWPQ (ORCPT ); Wed, 11 Jun 2014 18:15:16 -0400 Date: Wed, 11 Jun 2014 15:15:13 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Andrew Morton cc: Dave Hansen , Zhang Zhen , Greg Kroah-Hartman , laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan Subject: [patch] mm, hotplug: probe interface is available on several platforms In-Reply-To: Message-ID: References: <53981D81.5060708@huawei.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) 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 Documentation/memory-hotplug.txt incorrectly states that the memory driver "probe" interface is only supported on powerpc and is vague about its application on x86. Clarify the platforms that make this interface available if memory hotplug is enabled. Signed-off-by: David Rientjes --- Documentation/memory-hotplug.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt --- a/Documentation/memory-hotplug.txt +++ b/Documentation/memory-hotplug.txt @@ -209,15 +209,12 @@ If memory device is found, memory hotplug code will be called. 4.2 Notify memory hot-add event by hand ------------ -On powerpc, the firmware does not notify a memory hotplug event to the kernel. -Therefore, "probe" interface is supported to notify the event to the kernel. -This interface depends on CONFIG_ARCH_MEMORY_PROBE. - -CONFIG_ARCH_MEMORY_PROBE is supported on powerpc only. On x86, this config -option is disabled by default since ACPI notifies a memory hotplug event to -the kernel, which performs its hotplug operation as the result. Please -enable this option if you need the "probe" interface for testing purposes -on x86. +On some architectures, the firmware may not notify the kernel of a memory +hotplug event. Therefore, the memory "probe" interface is supported to +explicitly notify the kernel. This interface depends on +CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86 +if hotplug is supported, although for x86 this should be handled by ACPI +notification. Probe interface is located at /sys/devices/system/memory/probe From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754152AbaFKWWP (ORCPT ); Wed, 11 Jun 2014 18:22:15 -0400 Received: from mga09.intel.com ([134.134.136.24]:26131 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbaFKWWO (ORCPT ); Wed, 11 Jun 2014 18:22:14 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,460,1400050800"; d="scan'208";a="555981221" Message-ID: <5398D691.7050202@intel.com> Date: Wed, 11 Jun 2014 15:22:09 -0700 From: Dave Hansen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: David Rientjes , Andrew Morton CC: Zhang Zhen , Greg Kroah-Hartman , laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan Subject: Re: [patch] mm, hotplug: probe interface is available on several platforms References: <53981D81.5060708@huawei.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/2014 03:15 PM, David Rientjes wrote: > +CONFIG_ARCH_MEMORY_PROBE and can be configured on powerpc, sh, and x86 > +if hotplug is supported, although for x86 this should be handled by ACPI > +notification. Looks like a good change, in general. My only nit is that this implies that all hotplug on x86 is ACPI-based, which isn't true. Xen, at least, has an extension to its ballooning that does hotplugs without ACPI. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755422AbaFLClx (ORCPT ); Wed, 11 Jun 2014 22:41:53 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:56487 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754332AbaFLClw (ORCPT ); Wed, 11 Jun 2014 22:41:52 -0400 Message-ID: <53991353.5040607@huawei.com> Date: Thu, 12 Jun 2014 10:41:23 +0800 From: Zhang Zhen User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: David Rientjes CC: , , , , , Wang Nan Subject: Re: Proposal to realize hot-add *several sections one time* References: <53981D81.5060708@huawei.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.77] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2014/6/12 6:08, David Rientjes wrote: > On Wed, 11 Jun 2014, Zhang Zhen wrote: > >> Hi, >> >> Now we can hot-add memory by >> >> % echo start_address_of_new_memory > /sys/devices/system/memory/probe >> >> Then, [start_address_of_new_memory, start_address_of_new_memory + >> memory_block_size] memory range is hot-added. >> >> But we can only hot-add *one section one time* by this way. >> Whether we can add an argument on behalf of the count of the sections to add ? >> So we can can hot-add *several sections one time*. Just like: >> > > Not necessarily true, it depends on sections_per_block. Don't believe > Documentation/memory-hotplug.txt that suggests this is only for powerpc, > x86 and sh allow this interface as well. > >> % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe >> >> Then, [start_address_of_new_memory, start_address_of_new_memory + >> count_of_sections * memory_block_size] memory range is hot-added. >> >> If this proposal is reasonable, i will send a patch to realize it. >> > > The problem is knowing how much memory is being onlined so that you can > definitively determine what count_of_sections should be. The number of > pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which > differ depending on the architectures that support this interface. So if > you support count_of_sections, it would return errno even though you have > onlined some sections. > Hum, sorry. My expression is not right. The count of sections one time hot-added depends on sections_per_block. Now we are porting the memory-hotplug to arm. But we can only hot-add *fixed number of sections one time* on particular architecture. Whether we can add an argument on behalf of the count of the blocks to add ? % echo start_address_of_new_memory count_of_blocks > /sys/devices/system/memory/probe Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_blocks * memory_block_size] memory range is hot-added. So user don't need execute several times of echo when they want to hot add multi-block size memory. Any comments are welcome. Best regards! > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932310AbaFLHHc (ORCPT ); Thu, 12 Jun 2014 03:07:32 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:54224 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbaFLHHa (ORCPT ); Thu, 12 Jun 2014 03:07:30 -0400 Date: Thu, 12 Jun 2014 00:07:28 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Zhang Zhen cc: gregkh@linuxfoundation.org, laijs@cn.fujitsu.com, sjenning@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wang Nan Subject: Re: Proposal to realize hot-add *several sections one time* In-Reply-To: <53991353.5040607@huawei.com> Message-ID: References: <53981D81.5060708@huawei.com> <53991353.5040607@huawei.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) 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 On Thu, 12 Jun 2014, Zhang Zhen wrote: > >> % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe > >> > >> Then, [start_address_of_new_memory, start_address_of_new_memory + > >> count_of_sections * memory_block_size] memory range is hot-added. > >> > >> If this proposal is reasonable, i will send a patch to realize it. > >> > > > > The problem is knowing how much memory is being onlined so that you can > > definitively determine what count_of_sections should be. The number of > > pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which > > differ depending on the architectures that support this interface. So if > > you support count_of_sections, it would return errno even though you have > > onlined some sections. > > > Hum, sorry. > My expression is not right. The count of sections one time hot-added > depends on sections_per_block. > Ok, so you know specifically what sections_per_block is for your platform so you know exactly how many sections need to be added. > Now we are porting the memory-hotplug to arm. > But we can only hot-add *fixed number of sections one time* on particular architecture. > > Whether we can add an argument on behalf of the count of the blocks to add ? > > % echo start_address_of_new_memory count_of_blocks > /sys/devices/system/memory/probe > > Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_blocks * memory_block_size] > memory range is hot-added. > As I said, if the above returns errno at some point, it still can result in some sections being onlined. To be clear: if "echo 0x10000000 > /sys/devices/system/memory/probe" fails, the section starting at address 0x10000000 failed to be onlined for the reason specified by errno. If we follow your suggestion to specify how many sections to online, if "echo '0x10000000 16' > /sys/devices/system/memory/probe" fails, eight sections could have been successfully onlined at address 0x10000000 and then we encountered a failure (perhaps because the next sections were already onlined, we get an -EEXIST). We don't know what we successfully onlined. This could be mitigated, but there would have to be a convincing reason that this is better than using the currently functionally in a loop and properly handling your error codes. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751460AbaFMHck (ORCPT ); Fri, 13 Jun 2014 03:32:40 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:49033 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbaFMHcj (ORCPT ); Fri, 13 Jun 2014 03:32:39 -0400 Message-ID: <539AA8DF.4060805@huawei.com> Date: Fri, 13 Jun 2014 15:31:43 +0800 From: Zhang Zhen User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: David Rientjes CC: , , , , , Wang Nan Subject: Re: Proposal to realize hot-add *several sections one time* References: <53981D81.5060708@huawei.com> <53991353.5040607@huawei.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.69.77] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2014/6/12 15:07, David Rientjes wrote: > On Thu, 12 Jun 2014, Zhang Zhen wrote: > >>>> % echo start_address_of_new_memory count_of_sections > /sys/devices/system/memory/probe >>>> >>>> Then, [start_address_of_new_memory, start_address_of_new_memory + >>>> count_of_sections * memory_block_size] memory range is hot-added. >>>> >>>> If this proposal is reasonable, i will send a patch to realize it. >>>> >>> >>> The problem is knowing how much memory is being onlined so that you can >>> definitively determine what count_of_sections should be. The number of >>> pages per memory section depends on PAGE_SIZE and SECTION_SIZE_BITS which >>> differ depending on the architectures that support this interface. So if >>> you support count_of_sections, it would return errno even though you have >>> onlined some sections. >>> >> Hum, sorry. >> My expression is not right. The count of sections one time hot-added >> depends on sections_per_block. >> > > Ok, so you know specifically what sections_per_block is for your platform > so you know exactly how many sections need to be added. > >> Now we are porting the memory-hotplug to arm. >> But we can only hot-add *fixed number of sections one time* on particular architecture. >> >> Whether we can add an argument on behalf of the count of the blocks to add ? >> >> % echo start_address_of_new_memory count_of_blocks > /sys/devices/system/memory/probe >> >> Then, [start_address_of_new_memory, start_address_of_new_memory + count_of_blocks * memory_block_size] >> memory range is hot-added. >> > > As I said, if the above returns errno at some point, it still can result > in some sections being onlined. To be clear: if > "echo 0x10000000 > /sys/devices/system/memory/probe" fails, the section > starting at address 0x10000000 failed to be onlined for the reason > specified by errno. If we follow your suggestion to specify how many > sections to online, if > "echo '0x10000000 16' > /sys/devices/system/memory/probe" fails, eight > sections could have been successfully onlined at address 0x10000000 and > then we encountered a failure (perhaps because the next sections were > already onlined, we get an -EEXIST). We don't know what we successfully > onlined. > > This could be mitigated, but there would have to be a convincing reason > that this is better than using the currently functionally in a loop and > properly handling your error codes. Hi David, I think you are right. We had better to use the currently functionally in a loop if we need to add several blocks. In this way, we can get an errno in time if a block failed to be onlined. Thanks for your comments. I got it. > > -- > 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 > >