Patchwork MM: Make Contiguous Memory Allocator depends on MMU

login
register
mail settings
Submitter Manjunath Goudar
Date Aug. 4, 2013, 5:11 a.m.
Message ID <1375593061-11350-1-git-send-email-manjunath.goudar@linaro.org>
Download mbox | patch
Permalink /patch/264457/
State New
Headers show

Comments

Manjunath Goudar - Aug. 4, 2013, 5:11 a.m.
s patch adds a Kconfig dependency on an MMU being available before
CMA can be enabled.  Without this patch, CMA can be enabled on an
MMU-less system which can lead to issues. This was discovered during
randconfig testing, in which CMA was enabled w/o MMU being enabled,
leading to the following error:

 CC      mm/migrate.o
mm/migrate.c: In function ‘remove_migration_pte’:
mm/migrate.c:134:3: error: implicit declaration of function ‘pmd_trans_huge’
[-Werror=implicit-function-declaration]
   if (pmd_trans_huge(*pmd))
   ^
mm/migrate.c:137:3: error: implicit declaration of function ‘pte_offset_map’
[-Werror=implicit-function-declaration]
   ptep = pte_offset_map(pmd, addr);

Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Arnd Bergmann <arnd@linaro.org>
Cc: Deepak Saxena <dsaxena@linaro.org>
Cc: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Cc: Hirokazu Takahashi <taka@valinux.co.jp>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: linux-mm@kvack.org
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Wanpeng Li - Aug. 4, 2013, 7:54 a.m.
On Sun, Aug 04, 2013 at 10:41:01AM +0530, Manjunath Goudar wrote:
>s patch adds a Kconfig dependency on an MMU being available before
>CMA can be enabled.  Without this patch, CMA can be enabled on an
>MMU-less system which can lead to issues. This was discovered during
>randconfig testing, in which CMA was enabled w/o MMU being enabled,
>leading to the following error:
>
> CC      mm/migrate.o
>mm/migrate.c: In function ‘remove_migration_pte’:
>mm/migrate.c:134:3: error: implicit declaration of function ‘pmd_trans_huge’
>[-Werror=implicit-function-declaration]
>   if (pmd_trans_huge(*pmd))
>   ^
>mm/migrate.c:137:3: error: implicit declaration of function ‘pte_offset_map’
>[-Werror=implicit-function-declaration]
>   ptep = pte_offset_map(pmd, addr);
>

Similar one.

http://marc.info/?l=linux-mm&m=137532486405085&w=2

>Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
>Acked-by: Arnd Bergmann <arnd@linaro.org>
>Cc: Deepak Saxena <dsaxena@linaro.org>
>Cc: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
>Cc: Hirokazu Takahashi <taka@valinux.co.jp>
>Cc: Dave Hansen <haveblue@us.ibm.com>
>Cc: linux-mm@kvack.org
>Cc: Johannes Weiner <hannes@cmpxchg.org>
>Cc: Michal Hocko <mhocko@suse.cz>
>Cc: Balbir Singh <bsingharora@gmail.com>
>Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>---
> mm/Kconfig |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/mm/Kconfig b/mm/Kconfig
>index 256bfd0..ad6b98e 100644
>--- a/mm/Kconfig
>+++ b/mm/Kconfig
>@@ -522,7 +522,7 @@ config MEM_SOFT_DIRTY
>
> config CMA
> 	bool "Contiguous Memory Allocator"
>-	depends on HAVE_MEMBLOCK
>+	depends on MMU && HAVE_MEMBLOCK
> 	select MIGRATION
> 	select MEMORY_ISOLATION
> 	help
>-- 
>1.7.9.5
>
>--
>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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Michal Hocko - Aug. 4, 2013, 8:09 a.m.
On Sun 04-08-13 10:41:01, Manjunath Goudar wrote:
> s patch adds a Kconfig dependency on an MMU being available before
> CMA can be enabled.  Without this patch, CMA can be enabled on an
> MMU-less system which can lead to issues. This was discovered during
> randconfig testing, in which CMA was enabled w/o MMU being enabled,
> leading to the following error:
> 
>  CC      mm/migrate.o
> mm/migrate.c: In function ‘remove_migration_pte’:
> mm/migrate.c:134:3: error: implicit declaration of function ‘pmd_trans_huge’
> [-Werror=implicit-function-declaration]
>    if (pmd_trans_huge(*pmd))
>    ^
> mm/migrate.c:137:3: error: implicit declaration of function ‘pte_offset_map’
> [-Werror=implicit-function-declaration]
>    ptep = pte_offset_map(pmd, addr);

This is a migration code but you are updating configuration for CMA
which doesn't make much sense to me.
I guess you wanted to disable migration for CMA instead?

> Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
> Acked-by: Arnd Bergmann <arnd@linaro.org>
> Cc: Deepak Saxena <dsaxena@linaro.org>
> Cc: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
> Cc: Hirokazu Takahashi <taka@valinux.co.jp>
> Cc: Dave Hansen <haveblue@us.ibm.com>
> Cc: linux-mm@kvack.org
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Balbir Singh <bsingharora@gmail.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  mm/Kconfig |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 256bfd0..ad6b98e 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -522,7 +522,7 @@ config MEM_SOFT_DIRTY
>  
>  config CMA
>  	bool "Contiguous Memory Allocator"
> -	depends on HAVE_MEMBLOCK
> +	depends on MMU && HAVE_MEMBLOCK
>  	select MIGRATION
>  	select MEMORY_ISOLATION
>  	help
> -- 
> 1.7.9.5
> 
> --
> 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Michal Hocko - Aug. 5, 2013, 7:32 a.m.
On Mon 05-08-13 10:10:08, Manjunath Goudar wrote:
> On 4 August 2013 13:24, Wanpeng Li <liwanp@linux.vnet.ibm.com> wrote:
> 
> > On Sun, Aug 04, 2013 at 10:41:01AM +0530, Manjunath Goudar wrote:
> > >s patch adds a Kconfig dependency on an MMU being available before
> > >CMA can be enabled.  Without this patch, CMA can be enabled on an
> > >MMU-less system which can lead to issues. This was discovered during
> > >randconfig testing, in which CMA was enabled w/o MMU being enabled,
> > >leading to the following error:
> > >
> > > CC      mm/migrate.o
> > >mm/migrate.c: In function ‘remove_migration_pte’:
> > >mm/migrate.c:134:3: error: implicit declaration of function
> > ‘pmd_trans_huge’
> > >[-Werror=implicit-function-declaration]
> > >   if (pmd_trans_huge(*pmd))
> > >   ^
> > >mm/migrate.c:137:3: error: implicit declaration of function
> > ‘pte_offset_map’
> > >[-Werror=implicit-function-declaration]
> > >   ptep = pte_offset_map(pmd, addr);
> > >
> >
> > Similar one.
> >
> > http://marc.info/?l=linux-mm&m=137532486405085&w=2
> 
> 
> In this patch MIGRATION config is not required MMU, because already CMA
> config depends
> on MMU and HAVE_MEMBLOCK if both are true then only selecting MIGRATION and
> MEMORY_ISOLATION.

No, I think it should be config MIGRATION that should depend on MMU
explicitly because that is where the problem exists. It shouldn't rely
on other configs to not select it automatically.

The question is. Does CMA need to depend on MMU as well? Why?
But please comment on the original thread instead.
Michal Hocko - Aug. 5, 2013, 9:04 a.m.
On Mon 05-08-13 14:07:41, Manjunath Goudar wrote:
> On 5 August 2013 13:02, Michal Hocko <mhocko@suse.cz> wrote:
> 
> > On Mon 05-08-13 10:10:08, Manjunath Goudar wrote:
> > > On 4 August 2013 13:24, Wanpeng Li <liwanp@linux.vnet.ibm.com> wrote:
> > >
> > > > On Sun, Aug 04, 2013 at 10:41:01AM +0530, Manjunath Goudar wrote:
> > > > >s patch adds a Kconfig dependency on an MMU being available before
> > > > >CMA can be enabled.  Without this patch, CMA can be enabled on an
> > > > >MMU-less system which can lead to issues. This was discovered during
> > > > >randconfig testing, in which CMA was enabled w/o MMU being enabled,
> > > > >leading to the following error:
> > > > >
> > > > > CC      mm/migrate.o
> > > > >mm/migrate.c: In function ‘remove_migration_pte’:
> > > > >mm/migrate.c:134:3: error: implicit declaration of function
> > > > ‘pmd_trans_huge’
> > > > >[-Werror=implicit-function-declaration]
> > > > >   if (pmd_trans_huge(*pmd))
> > > > >   ^
> > > > >mm/migrate.c:137:3: error: implicit declaration of function
> > > > ‘pte_offset_map’
> > > > >[-Werror=implicit-function-declaration]
> > > > >   ptep = pte_offset_map(pmd, addr);
> > > > >
> > > >
> > > > Similar one.
> > > >
> > > > http://marc.info/?l=linux-mm&m=137532486405085&w=2
> > >
> > >
> > > In this patch MIGRATION config is not required MMU, because already CMA
> > > config depends
> > > on MMU and HAVE_MEMBLOCK if both are true then only selecting MIGRATION
> > and
> > > MEMORY_ISOLATION.
> >
> > No, I think it should be config MIGRATION that should depend on MMU
> > explicitly because that is where the problem exists. It shouldn't rely
> > on other configs to not select it automatically.
> >
> >  Yes you are correct.
> 
> > The question is. Does CMA need to depend on MMU as well? Why?
> > But please comment on the original thread instead.
> >
> 
> I went through the mm/Kconfig, I think MMU dependence is not required
> for CMA.

OK, it turned out that it is needed in the end. Kcofing forces selects
so CMA config would force MIGRATION even if that one depends on MMU.

Patch

diff --git a/mm/Kconfig b/mm/Kconfig
index 256bfd0..ad6b98e 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -522,7 +522,7 @@  config MEM_SOFT_DIRTY
 
 config CMA
 	bool "Contiguous Memory Allocator"
-	depends on HAVE_MEMBLOCK
+	depends on MMU && HAVE_MEMBLOCK
 	select MIGRATION
 	select MEMORY_ISOLATION
 	help