diff mbox series

linux-next: manual merge of the akpm-current tree with the powerpc tree

Message ID 20210415194417.498e71b7@canb.auug.org.au (mailing list archive)
State Not Applicable
Headers show
Series linux-next: manual merge of the akpm-current tree with the powerpc tree | expand
Related show

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (0702e74703f57173e70cfab2a79a3e682e9e96ec)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (7098f8f0cf0387443fd8702f24a8a2521d5133f3)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (7f75285ca572eaabc028cf78c6ab5473d0d160be)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (791f9e36599d94af5a76d3f74d04e16326761aae)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (50987beca096a7ed4f453a6da245fd6a2fadedeb)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Stephen Rothwell April 15, 2021, 9:44 a.m. UTC
Hi all,

Today's linux-next merge of the akpm-current tree got a conflict in:

  arch/powerpc/kernel/module.c

between commit:

  2ec13df16704 ("powerpc/modules: Load modules closer to kernel text")

from the powerpc tree and commit:

  4930ba789f8d ("powerpc/64s/radix: enable huge vmalloc mappings")

from the akpm-current tree.

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

Comments

Stephen Rothwell April 15, 2021, 9:58 a.m. UTC | #1
Hi all,

On Thu, 15 Apr 2021 19:44:17 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> Today's linux-next merge of the akpm-current tree got a conflict in:
> 
>   arch/powerpc/kernel/module.c
> 
> between commit:
> 
>   2ec13df16704 ("powerpc/modules: Load modules closer to kernel text")
> 
> from the powerpc tree and commit:
> 
>   4930ba789f8d ("powerpc/64s/radix: enable huge vmalloc mappings")
> 
> from the akpm-current tree.
> 
> I fixed it up (I think - see below) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc arch/powerpc/kernel/module.c
> index fab84024650c,cdb2d88c54e7..000000000000
> --- a/arch/powerpc/kernel/module.c
> +++ b/arch/powerpc/kernel/module.c
> @@@ -88,29 -88,26 +89,42 @@@ int module_finalize(const Elf_Ehdr *hdr
>   	return 0;
>   }
>   
> - #ifdef MODULES_VADDR
>  -void *module_alloc(unsigned long size)
>  +static __always_inline void *
>  +__module_alloc(unsigned long size, unsigned long start, unsigned long end)
>   {
>  -	unsigned long start = VMALLOC_START;
>  -	unsigned long end = VMALLOC_END;
>  -
>  -#ifdef MODULES_VADDR
>  -	BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>  -	start = MODULES_VADDR;
>  -	end = MODULES_END;
>  -#endif
>  -
> + 	/*
> + 	 * Don't do huge page allocations for modules yet until more testing
> + 	 * is done. STRICT_MODULE_RWX may require extra work to support this
> + 	 * too.
> + 	 */
> + 
>   	return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL,
> - 				    PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
> + 				    PAGE_KERNEL_EXEC,
> + 				    VM_NO_HUGE_VMAP | VM_FLUSH_RESET_PERMS,
> + 				    NUMA_NO_NODE,
>   				    __builtin_return_address(0));
>   }
>  +
> ++
>  +void *module_alloc(unsigned long size)
>  +{
> ++	unsigned long start = VMALLOC_START;
> ++	unsigned long end = VMALLOC_END;
>  +	unsigned long limit = (unsigned long)_etext - SZ_32M;
>  +	void *ptr = NULL;
>  +
> ++#ifdef MODULES_VADDR
>  +	BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
> ++	start = MODULES_VADDR;
> ++	end = MODULES_END;
>  +
>  +	/* First try within 32M limit from _etext to avoid branch trampolines */
>  +	if (MODULES_VADDR < PAGE_OFFSET && MODULES_END > limit)
> - 		ptr = __module_alloc(size, limit, MODULES_END);
> ++		ptr = __module_alloc(size, limit, end);
>  +
>  +	if (!ptr)
> - 		ptr = __module_alloc(size, MODULES_VADDR, MODULES_END);
> ++#endif
> ++		ptr = __module_alloc(size, start, end);
>  +
>  +	return ptr;
>  +}
> - #endif

Unfortunately, it also needs this:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 15 Apr 2021 19:53:58 +1000
Subject: [PATCH] merge fix up for powerpc merge fix

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/module.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index d8ab1ad2eb05..c060f99afd4d 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -110,7 +110,9 @@ void *module_alloc(unsigned long size)
 {
 	unsigned long start = VMALLOC_START;
 	unsigned long end = VMALLOC_END;
+#ifdef MODULES_VADDR
 	unsigned long limit = (unsigned long)_etext - SZ_32M;
+#endif
 	void *ptr = NULL;
 
 #ifdef MODULES_VADDR
Christophe Leroy April 15, 2021, 10:07 a.m. UTC | #2
Le 15/04/2021 à 11:58, Stephen Rothwell a écrit :
> Hi all,
> 
> On Thu, 15 Apr 2021 19:44:17 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>>
>> Today's linux-next merge of the akpm-current tree got a conflict in:
>>
>>    arch/powerpc/kernel/module.c
>>
>> between commit:
>>
>>    2ec13df16704 ("powerpc/modules: Load modules closer to kernel text")
>>
>> from the powerpc tree and commit:
>>
>>    4930ba789f8d ("powerpc/64s/radix: enable huge vmalloc mappings")
>>
>> from the akpm-current tree.
>>
>> I fixed it up (I think - see below) and can carry the fix as
>> necessary. This is now fixed as far as linux-next is concerned, but any
>> non trivial conflicts should be mentioned to your upstream maintainer
>> when your tree is submitted for merging.  You may also want to consider
>> cooperating with the maintainer of the conflicting tree to minimise any
>> particularly complex conflicts.
>>
>> -- 
>> Cheers,
>> Stephen Rothwell
>>
>> diff --cc arch/powerpc/kernel/module.c
>> index fab84024650c,cdb2d88c54e7..000000000000
>> --- a/arch/powerpc/kernel/module.c
>> +++ b/arch/powerpc/kernel/module.c
>> @@@ -88,29 -88,26 +89,42 @@@ int module_finalize(const Elf_Ehdr *hdr
>>    	return 0;
>>    }
>>    
>> - #ifdef MODULES_VADDR
>>   -void *module_alloc(unsigned long size)
>>   +static __always_inline void *
>>   +__module_alloc(unsigned long size, unsigned long start, unsigned long end)
>>    {
>>   -	unsigned long start = VMALLOC_START;
>>   -	unsigned long end = VMALLOC_END;
>>   -
>>   -#ifdef MODULES_VADDR
>>   -	BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>>   -	start = MODULES_VADDR;
>>   -	end = MODULES_END;
>>   -#endif
>>   -
>> + 	/*
>> + 	 * Don't do huge page allocations for modules yet until more testing
>> + 	 * is done. STRICT_MODULE_RWX may require extra work to support this
>> + 	 * too.
>> + 	 */
>> +
>>    	return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL,
>> - 				    PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
>> + 				    PAGE_KERNEL_EXEC,
>> + 				    VM_NO_HUGE_VMAP | VM_FLUSH_RESET_PERMS,
>> + 				    NUMA_NO_NODE,
>>    				    __builtin_return_address(0));
>>    }
>>   +
>> ++
>>   +void *module_alloc(unsigned long size)
>>   +{
>> ++	unsigned long start = VMALLOC_START;
>> ++	unsigned long end = VMALLOC_END;
>>   +	unsigned long limit = (unsigned long)_etext - SZ_32M;
>>   +	void *ptr = NULL;
>>   +
>> ++#ifdef MODULES_VADDR
>>   +	BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>> ++	start = MODULES_VADDR;
>> ++	end = MODULES_END;

The #endif should be here.


>>   +
>>   +	/* First try within 32M limit from _etext to avoid branch trampolines */
>>   +	if (MODULES_VADDR < PAGE_OFFSET && MODULES_END > limit)
>> - 		ptr = __module_alloc(size, limit, MODULES_END);
>> ++		ptr = __module_alloc(size, limit, end);
>>   +
>>   +	if (!ptr)
>> - 		ptr = __module_alloc(size, MODULES_VADDR, MODULES_END);
>> ++#endif
>> ++		ptr = __module_alloc(size, start, end);
>>   +
>>   +	return ptr;
>>   +}
>> - #endif
> 
> Unfortunately, it also needs this:

Before the #endif is too far.

> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Thu, 15 Apr 2021 19:53:58 +1000
> Subject: [PATCH] merge fix up for powerpc merge fix
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>   arch/powerpc/kernel/module.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
> index d8ab1ad2eb05..c060f99afd4d 100644
> --- a/arch/powerpc/kernel/module.c
> +++ b/arch/powerpc/kernel/module.c
> @@ -110,7 +110,9 @@ void *module_alloc(unsigned long size)
>   {
>   	unsigned long start = VMALLOC_START;
>   	unsigned long end = VMALLOC_END;
> +#ifdef MODULES_VADDR
>   	unsigned long limit = (unsigned long)_etext - SZ_32M;
> +#endif
>   	void *ptr = NULL;
>   
>   #ifdef MODULES_VADDR
>
Christophe Leroy April 15, 2021, 10:08 a.m. UTC | #3
Le 15/04/2021 à 12:07, Christophe Leroy a écrit :
> 
> 
> Le 15/04/2021 à 11:58, Stephen Rothwell a écrit :
>> Hi all,
>>
>> On Thu, 15 Apr 2021 19:44:17 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>>>
>>> Today's linux-next merge of the akpm-current tree got a conflict in:
>>>
>>>    arch/powerpc/kernel/module.c
>>>
>>> between commit:
>>>
>>>    2ec13df16704 ("powerpc/modules: Load modules closer to kernel text")
>>>
>>> from the powerpc tree and commit:
>>>
>>>    4930ba789f8d ("powerpc/64s/radix: enable huge vmalloc mappings")
>>>
>>> from the akpm-current tree.
>>>
>>> I fixed it up (I think - see below) and can carry the fix as
>>> necessary. This is now fixed as far as linux-next is concerned, but any
>>> non trivial conflicts should be mentioned to your upstream maintainer
>>> when your tree is submitted for merging.  You may also want to consider
>>> cooperating with the maintainer of the conflicting tree to minimise any
>>> particularly complex conflicts.
>>>
>>> -- 
>>> Cheers,
>>> Stephen Rothwell
>>>
>>> diff --cc arch/powerpc/kernel/module.c
>>> index fab84024650c,cdb2d88c54e7..000000000000
>>> --- a/arch/powerpc/kernel/module.c
>>> +++ b/arch/powerpc/kernel/module.c
>>> @@@ -88,29 -88,26 +89,42 @@@ int module_finalize(const Elf_Ehdr *hdr
>>>        return 0;
>>>    }
>>> - #ifdef MODULES_VADDR
>>>   -void *module_alloc(unsigned long size)
>>>   +static __always_inline void *
>>>   +__module_alloc(unsigned long size, unsigned long start, unsigned long end)
>>>    {
>>>   -    unsigned long start = VMALLOC_START;
>>>   -    unsigned long end = VMALLOC_END;
>>>   -
>>>   -#ifdef MODULES_VADDR
>>>   -    BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>>>   -    start = MODULES_VADDR;
>>>   -    end = MODULES_END;
>>>   -#endif
>>>   -
>>> +     /*
>>> +      * Don't do huge page allocations for modules yet until more testing
>>> +      * is done. STRICT_MODULE_RWX may require extra work to support this
>>> +      * too.
>>> +      */
>>> +
>>>        return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL,
>>> -                     PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
>>> +                     PAGE_KERNEL_EXEC,
>>> +                     VM_NO_HUGE_VMAP | VM_FLUSH_RESET_PERMS,
>>> +                     NUMA_NO_NODE,
>>>                        __builtin_return_address(0));
>>>    }
>>>   +
>>> ++
>>>   +void *module_alloc(unsigned long size)
>>>   +{
>>> ++    unsigned long start = VMALLOC_START;
>>> ++    unsigned long end = VMALLOC_END;
>>>   +    unsigned long limit = (unsigned long)_etext - SZ_32M;
>>>   +    void *ptr = NULL;
>>>   +
>>> ++#ifdef MODULES_VADDR
>>>   +    BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>>> ++    start = MODULES_VADDR;
>>> ++    end = MODULES_END;
> 
> The #endif should be here.
> 
> 
>>>   +
>>>   +    /* First try within 32M limit from _etext to avoid branch trampolines */
>>>   +    if (MODULES_VADDR < PAGE_OFFSET && MODULES_END > limit)

Should also use start and end here instead of MODULES_VADDR  and MODULES_END

>>> -         ptr = __module_alloc(size, limit, MODULES_END);
>>> ++        ptr = __module_alloc(size, limit, end);
>>>   +
>>>   +    if (!ptr)
>>> -         ptr = __module_alloc(size, MODULES_VADDR, MODULES_END);
>>> ++#endif
>>> ++        ptr = __module_alloc(size, start, end);
>>>   +
>>>   +    return ptr;
>>>   +}
>>> - #endif
>>
>> Unfortunately, it also needs this:
> 
> Before the #endif is too far.
> 
>>
>> From: Stephen Rothwell <sfr@canb.auug.org.au>
>> Date: Thu, 15 Apr 2021 19:53:58 +1000
>> Subject: [PATCH] merge fix up for powerpc merge fix
>>
>> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>> ---
>>   arch/powerpc/kernel/module.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
>> index d8ab1ad2eb05..c060f99afd4d 100644
>> --- a/arch/powerpc/kernel/module.c
>> +++ b/arch/powerpc/kernel/module.c
>> @@ -110,7 +110,9 @@ void *module_alloc(unsigned long size)
>>   {
>>       unsigned long start = VMALLOC_START;
>>       unsigned long end = VMALLOC_END;
>> +#ifdef MODULES_VADDR
>>       unsigned long limit = (unsigned long)_etext - SZ_32M;
>> +#endif
>>       void *ptr = NULL;
>>   #ifdef MODULES_VADDR
>>
Christophe Leroy April 15, 2021, 10:15 a.m. UTC | #4
Le 15/04/2021 à 12:08, Christophe Leroy a écrit :
> 
> 
> Le 15/04/2021 à 12:07, Christophe Leroy a écrit :
>>
>>
>> Le 15/04/2021 à 11:58, Stephen Rothwell a écrit :
>>> Hi all,
>>>
>>> On Thu, 15 Apr 2021 19:44:17 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>>>>
>>>> Today's linux-next merge of the akpm-current tree got a conflict in:
>>>>
>>>>    arch/powerpc/kernel/module.c
>>>>
>>>> between commit:
>>>>
>>>>    2ec13df16704 ("powerpc/modules: Load modules closer to kernel text")
>>>>
>>>> from the powerpc tree and commit:
>>>>
>>>>    4930ba789f8d ("powerpc/64s/radix: enable huge vmalloc mappings")
>>>>
>>>> from the akpm-current tree.
>>>>
>>>> I fixed it up (I think - see below) and can carry the fix as
>>>> necessary. This is now fixed as far as linux-next is concerned, but any
>>>> non trivial conflicts should be mentioned to your upstream maintainer
>>>> when your tree is submitted for merging.  You may also want to consider
>>>> cooperating with the maintainer of the conflicting tree to minimise any
>>>> particularly complex conflicts.
>>>>
>>>> -- 
>>>> Cheers,
>>>> Stephen Rothwell
>>>>
>>>> diff --cc arch/powerpc/kernel/module.c
>>>> index fab84024650c,cdb2d88c54e7..000000000000
>>>> --- a/arch/powerpc/kernel/module.c
>>>> +++ b/arch/powerpc/kernel/module.c
>>>> @@@ -88,29 -88,26 +89,42 @@@ int module_finalize(const Elf_Ehdr *hdr
>>>>        return 0;
>>>>    }
>>>> - #ifdef MODULES_VADDR
>>>>   -void *module_alloc(unsigned long size)
>>>>   +static __always_inline void *
>>>>   +__module_alloc(unsigned long size, unsigned long start, unsigned long end)
>>>>    {
>>>>   -    unsigned long start = VMALLOC_START;
>>>>   -    unsigned long end = VMALLOC_END;
>>>>   -
>>>>   -#ifdef MODULES_VADDR
>>>>   -    BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>>>>   -    start = MODULES_VADDR;
>>>>   -    end = MODULES_END;
>>>>   -#endif
>>>>   -
>>>> +     /*
>>>> +      * Don't do huge page allocations for modules yet until more testing
>>>> +      * is done. STRICT_MODULE_RWX may require extra work to support this
>>>> +      * too.
>>>> +      */
>>>> +
>>>>        return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL,
>>>> -                     PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
>>>> +                     PAGE_KERNEL_EXEC,
>>>> +                     VM_NO_HUGE_VMAP | VM_FLUSH_RESET_PERMS,
>>>> +                     NUMA_NO_NODE,
>>>>                        __builtin_return_address(0));
>>>>    }
>>>>   +
>>>> ++
>>>>   +void *module_alloc(unsigned long size)
>>>>   +{
>>>> ++    unsigned long start = VMALLOC_START;
>>>> ++    unsigned long end = VMALLOC_END;
>>>>   +    unsigned long limit = (unsigned long)_etext - SZ_32M;
>>>>   +    void *ptr = NULL;
>>>>   +
>>>> ++#ifdef MODULES_VADDR
>>>>   +    BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
>>>> ++    start = MODULES_VADDR;
>>>> ++    end = MODULES_END;
>>
>> The #endif should be here.
>>
>>
>>>>   +
>>>>   +    /* First try within 32M limit from _etext to avoid branch trampolines */
>>>>   +    if (MODULES_VADDR < PAGE_OFFSET && MODULES_END > limit)
> 
> Should also use start and end here instead of MODULES_VADDR  and MODULES_END


The cleanest however should be to define MODULES_VADDR and MODULES_END all the time with a fallback 
to VMALLOC_START/VMALLOC_END, to avoid the #ifdef.

The #ifdef was OK when we wanted to define modules_alloc() only when module area was different from 
vmalloc area, but now that we want modules_alloc() at all time, MODULES_VADDR and MODULES_END should 
be defined all the time.


> 
>>>> -         ptr = __module_alloc(size, limit, MODULES_END);
>>>> ++        ptr = __module_alloc(size, limit, end);
>>>>   +
>>>>   +    if (!ptr)
>>>> -         ptr = __module_alloc(size, MODULES_VADDR, MODULES_END);
>>>> ++#endif
>>>> ++        ptr = __module_alloc(size, start, end);
>>>>   +
>>>>   +    return ptr;
>>>>   +}
>>>> - #endif
>>>
>>> Unfortunately, it also needs this:
>>
>> Before the #endif is too far.
>>
>>>
>>> From: Stephen Rothwell <sfr@canb.auug.org.au>
>>> Date: Thu, 15 Apr 2021 19:53:58 +1000
>>> Subject: [PATCH] merge fix up for powerpc merge fix
>>>
>>> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>>> ---
>>>   arch/powerpc/kernel/module.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
>>> index d8ab1ad2eb05..c060f99afd4d 100644
>>> --- a/arch/powerpc/kernel/module.c
>>> +++ b/arch/powerpc/kernel/module.c
>>> @@ -110,7 +110,9 @@ void *module_alloc(unsigned long size)
>>>   {
>>>       unsigned long start = VMALLOC_START;
>>>       unsigned long end = VMALLOC_END;
>>> +#ifdef MODULES_VADDR
>>>       unsigned long limit = (unsigned long)_etext - SZ_32M;
>>> +#endif
>>>       void *ptr = NULL;
>>>   #ifdef MODULES_VADDR
>>>
diff mbox series

Patch

diff --cc arch/powerpc/kernel/module.c
index fab84024650c,cdb2d88c54e7..000000000000
--- a/arch/powerpc/kernel/module.c