linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing
@ 2017-04-27  7:43 Pingfan Liu
  2017-04-27 18:06 ` Hari Bathini
  2017-04-28 10:18 ` kbuild test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Pingfan Liu @ 2017-04-27  7:43 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Hari Bathini, kernelfans

E.g after fadump reserves mem regions, these regions should not be removed
before fadump explicitly free them.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index e104c71..201be23 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -346,6 +346,8 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
 
 	if (!pfn_valid(start_pfn))
 		goto out;
+	if (memblock_is_reserved(base))
+		return -EINVAL;
 
 	block_sz = pseries_memory_block_size();
 	sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
@@ -388,8 +390,7 @@ static int pseries_remove_mem_node(struct device_node *np)
 	base = be64_to_cpu(*(unsigned long *)regs);
 	lmb_size = be32_to_cpu(regs[3]);
 
-	pseries_remove_memblock(base, lmb_size);
-	return 0;
+	return pseries_remove_memblock(base, lmb_size);
 }
 
 static bool lmb_is_removable(struct of_drconf_cell *lmb)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing
  2017-04-27  7:43 [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing Pingfan Liu
@ 2017-04-27 18:06 ` Hari Bathini
  2017-04-28  4:29   ` Liu ping fan
  2017-04-28 10:18 ` kbuild test robot
  1 sibling, 1 reply; 5+ messages in thread
From: Hari Bathini @ 2017-04-27 18:06 UTC (permalink / raw)
  To: Pingfan Liu, linuxppc-dev
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	kernelfans

Hi Pingfan,


On Thursday 27 April 2017 01:13 PM, Pingfan Liu wrote:
> E.g after fadump reserves mem regions, these regions should not be removed
> before fadump explicitly free them.
> Signed-off-by: Pingfan Liu <piliu@redhat.com>
> ---
>   arch/powerpc/platforms/pseries/hotplug-memory.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index e104c71..201be23 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -346,6 +346,8 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
>
>   	if (!pfn_valid(start_pfn))
>   		goto out;
> +	if (memblock_is_reserved(base))
> +		return -EINVAL;

I think memblock reserved regions are not hot removed even without this 
patch.
So, can you elaborate on when/why this patch is needed?

Thanks
Hari

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing
  2017-04-27 18:06 ` Hari Bathini
@ 2017-04-28  4:29   ` Liu ping fan
  2017-05-02 18:37     ` Hari Bathini
  0 siblings, 1 reply; 5+ messages in thread
From: Liu ping fan @ 2017-04-28  4:29 UTC (permalink / raw)
  To: Hari Bathini
  Cc: Pingfan Liu, linuxppc-dev, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman

On Fri, Apr 28, 2017 at 2:06 AM, Hari Bathini
<hbathini@linux.vnet.ibm.com> wrote:
> Hi Pingfan,
>
>
> On Thursday 27 April 2017 01:13 PM, Pingfan Liu wrote:
>>
>> E.g after fadump reserves mem regions, these regions should not be removed
>> before fadump explicitly free them.
>> Signed-off-by: Pingfan Liu <piliu@redhat.com>
>> ---
>>   arch/powerpc/platforms/pseries/hotplug-memory.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c
>> b/arch/powerpc/platforms/pseries/hotplug-memory.c
>> index e104c71..201be23 100644
>> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
>> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
>> @@ -346,6 +346,8 @@ static int pseries_remove_memblock(unsigned long base,
>> unsigned int memblock_siz
>>
>>         if (!pfn_valid(start_pfn))
>>                 goto out;
>> +       if (memblock_is_reserved(base))
>> +               return -EINVAL;
>
>
> I think memblock reserved regions are not hot removed even without this
> patch.
> So, can you elaborate on when/why this patch is needed?
>
I have not found code to prevent the reserved regions from free. Do I
miss anything?
I will try to reserve a ppc to have a test.

Thx,
Pingfan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing
  2017-04-27  7:43 [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing Pingfan Liu
  2017-04-27 18:06 ` Hari Bathini
@ 2017-04-28 10:18 ` kbuild test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2017-04-28 10:18 UTC (permalink / raw)
  To: Pingfan Liu
  Cc: kbuild-all, linuxppc-dev, Hari Bathini, Paul Mackerras,
	kernelfans

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

Hi Pingfan,

[auto build test WARNING on powerpc/next]
[also build test WARNING on v4.11-rc8 next-20170428]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Pingfan-Liu/powerpc-pseries-hotplug-prevent-the-reserved-mem-from-removing/20170428-092644
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

>> WARNING: vmlinux.o(.text+0xd3108): Section mismatch in reference from the function .pseries_remove_memblock() to the function .init.text:.memblock_is_reserved()
   The function .pseries_remove_memblock() references
   the function __init .memblock_is_reserved().
   This is often because .pseries_remove_memblock lacks a __init
   annotation or the annotation of .memblock_is_reserved is wrong.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52839 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing
  2017-04-28  4:29   ` Liu ping fan
@ 2017-05-02 18:37     ` Hari Bathini
  0 siblings, 0 replies; 5+ messages in thread
From: Hari Bathini @ 2017-05-02 18:37 UTC (permalink / raw)
  To: Liu ping fan; +Cc: Paul Mackerras, linuxppc-dev, Pingfan Liu


On Friday 28 April 2017 09:59 AM, Liu ping fan wrote:
> On Fri, Apr 28, 2017 at 2:06 AM, Hari Bathini
> <hbathini@linux.vnet.ibm.com> wrote:
>> Hi Pingfan,
>>
>>
>> On Thursday 27 April 2017 01:13 PM, Pingfan Liu wrote:
>>> E.g after fadump reserves mem regions, these regions should not be removed
>>> before fadump explicitly free them.
>>> Signed-off-by: Pingfan Liu <piliu@redhat.com>
>>> ---
>>>    arch/powerpc/platforms/pseries/hotplug-memory.c | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c
>>> b/arch/powerpc/platforms/pseries/hotplug-memory.c
>>> index e104c71..201be23 100644
>>> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
>>> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
>>> @@ -346,6 +346,8 @@ static int pseries_remove_memblock(unsigned long base,
>>> unsigned int memblock_siz
>>>
>>>          if (!pfn_valid(start_pfn))
>>>                  goto out;
>>> +       if (memblock_is_reserved(base))
>>> +               return -EINVAL;
>>
>> I think memblock reserved regions are not hot removed even without this
>> patch.
>> So, can you elaborate on when/why this patch is needed?
>>
> I have not found code to prevent the reserved regions from free. Do I
> miss anything?

IIUC, during hot-remove,  while trying to offline reserved pages, it 
reports -EBUSY
thus failing to remove a lmb that has reserved memory. I was wondering 
if there would
be a case where that doesn't happen and this patch is necessary..

Thanks
Hari

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-02 18:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-27  7:43 [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing Pingfan Liu
2017-04-27 18:06 ` Hari Bathini
2017-04-28  4:29   ` Liu ping fan
2017-05-02 18:37     ` Hari Bathini
2017-04-28 10:18 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).