linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] riscv: mm: fix build errors caused by mk_pmd()
@ 2021-05-24  7:02 Nanyong Sun
  2021-05-29 22:45 ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Nanyong Sun @ 2021-05-24  7:02 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou
  Cc: linux-riscv, linux-kernel, palmerdabbelt, atish.patra,
	wangkefeng.wang, sunnanyong

With "riscv: mm: add THP support on 64-bit", mk_pmd() function
introduce build errors,
1.build with CONFIG_ARCH_RV32I=y:
arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration of function 'pfn_pmd';
 did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]

2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section';
 did you mean 'present_section'? [-Werror=implicit-function-declaration]

Use macro definition instead of inline function for mk_pmd
to fix the above problems.It is similar to the mk_pte macro.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
---
 arch/riscv/include/asm/pgtable.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 4b708ae08910..f35d9c90d4cb 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -508,10 +508,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
 	return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
 }
 
-static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
-{
-	return pfn_pmd(page_to_pfn(page), prot);
-}
+#define mk_pmd(page, prot)    pfn_pmd(page_to_pfn(page), prot)
 
 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
 {
-- 
2.18.0.huawei.25


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH -next] riscv: mm: fix build errors caused by mk_pmd()
  2021-05-24  7:02 [PATCH -next] riscv: mm: fix build errors caused by mk_pmd() Nanyong Sun
@ 2021-05-29 22:45 ` Palmer Dabbelt
  2021-05-30  1:21   ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2021-05-29 22:45 UTC (permalink / raw)
  To: sunnanyong
  Cc: Paul Walmsley, aou, linux-riscv, linux-kernel, Atish Patra,
	wangkefeng.wang, sunnanyong

On Mon, 24 May 2021 00:02:20 PDT (-0700), sunnanyong@huawei.com wrote:
> With "riscv: mm: add THP support on 64-bit", mk_pmd() function
> introduce build errors,
> 1.build with CONFIG_ARCH_RV32I=y:
> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
> arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration of function 'pfn_pmd';
>  did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]
>
> 2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section';
>  did you mean 'present_section'? [-Werror=implicit-function-declaration]
>
> Use macro definition instead of inline function for mk_pmd
> to fix the above problems.It is similar to the mk_pte macro.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
> ---
>  arch/riscv/include/asm/pgtable.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 4b708ae08910..f35d9c90d4cb 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -508,10 +508,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
>  	return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
>  }
>
> -static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
> -{
> -	return pfn_pmd(page_to_pfn(page), prot);
> -}
> +#define mk_pmd(page, prot)    pfn_pmd(page_to_pfn(page), prot)
>
>  static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
>  {

Thanks, this is on for-next.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH -next] riscv: mm: fix build errors caused by mk_pmd()
  2021-05-29 22:45 ` Palmer Dabbelt
@ 2021-05-30  1:21   ` Palmer Dabbelt
  2021-06-01  3:27     ` Sunnanyong (Nanyong Sun, Intelligent Computing Solution Development Dep)
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2021-05-30  1:21 UTC (permalink / raw)
  To: sunnanyong
  Cc: Paul Walmsley, aou, linux-riscv, linux-kernel, Atish Patra,
	wangkefeng.wang, sunnanyong

On Sat, 29 May 2021 15:45:04 PDT (-0700), Palmer Dabbelt wrote:
> On Mon, 24 May 2021 00:02:20 PDT (-0700), sunnanyong@huawei.com wrote:
>> With "riscv: mm: add THP support on 64-bit", mk_pmd() function
>> introduce build errors,
>> 1.build with CONFIG_ARCH_RV32I=y:
>> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
>> arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration of function 'pfn_pmd';
>>  did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]
>>
>> 2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
>> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
>> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section';
>>  did you mean 'present_section'? [-Werror=implicit-function-declaration]
>>
>> Use macro definition instead of inline function for mk_pmd
>> to fix the above problems.It is similar to the mk_pte macro.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
>> ---
>>  arch/riscv/include/asm/pgtable.h | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
>> index 4b708ae08910..f35d9c90d4cb 100644
>> --- a/arch/riscv/include/asm/pgtable.h
>> +++ b/arch/riscv/include/asm/pgtable.h
>> @@ -508,10 +508,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
>>  	return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
>>  }
>>
>> -static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
>> -{
>> -	return pfn_pmd(page_to_pfn(page), prot);
>> -}
>> +#define mk_pmd(page, prot)    pfn_pmd(page_to_pfn(page), prot)
>>
>>  static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
>>  {
>
> Thanks, this is on for-next.

Sorry, I wasn't looking closely enough.  I think the actual problem here 
is that mk_pmd() should be in pgtable-64.h.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH -next] riscv: mm: fix build errors caused by mk_pmd()
  2021-05-30  1:21   ` Palmer Dabbelt
@ 2021-06-01  3:27     ` Sunnanyong (Nanyong Sun, Intelligent Computing Solution Development Dep)
  0 siblings, 0 replies; 4+ messages in thread
From: Sunnanyong (Nanyong Sun, Intelligent Computing Solution Development Dep) @ 2021-06-01  3:27 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Paul Walmsley, aou, linux-riscv, linux-kernel, Atish Patra,
	wangkefeng.wang

On 2021/5/30 9:21, Palmer Dabbelt wrote:

> On Sat, 29 May 2021 15:45:04 PDT (-0700), Palmer Dabbelt wrote:
>> On Mon, 24 May 2021 00:02:20 PDT (-0700), sunnanyong@huawei.com wrote:
>>> With "riscv: mm: add THP support on 64-bit", mk_pmd() function
>>> introduce build errors,
>>> 1.build with CONFIG_ARCH_RV32I=y:
>>> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
>>> arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration 
>>> of function 'pfn_pmd';
>>>  did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]
>>>
>>> 2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
>>> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
>>> include/asm-generic/memory_model.h:64:14: error: implicit 
>>> declaration of function 'page_to_section';
>>>  did you mean 'present_section'? 
>>> [-Werror=implicit-function-declaration]
>>>
>>> Use macro definition instead of inline function for mk_pmd
>>> to fix the above problems.It is similar to the mk_pte macro.
>>>
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
>>> ---
>>>  arch/riscv/include/asm/pgtable.h | 5 +----
>>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/arch/riscv/include/asm/pgtable.h 
>>> b/arch/riscv/include/asm/pgtable.h
>>> index 4b708ae08910..f35d9c90d4cb 100644
>>> --- a/arch/riscv/include/asm/pgtable.h
>>> +++ b/arch/riscv/include/asm/pgtable.h
>>> @@ -508,10 +508,7 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
>>>      return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
>>>  }
>>>
>>> -static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
>>> -{
>>> -    return pfn_pmd(page_to_pfn(page), prot);
>>> -}
>>> +#define mk_pmd(page, prot)    pfn_pmd(page_to_pfn(page), prot)
>>>
>>>  static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
>>>  {
>>
>> Thanks, this is on for-next.
>
> Sorry, I wasn't looking closely enough.  I think the actual problem 
> here is that mk_pmd() should be in pgtable-64.h.
> .

Moving mk_pmd() to pgtable-64.h can only solve the first problem, but 
not the second.

The second one need mk_pmd() defined as a macro, like this previous 
solution:

https://patchwork.kernel.org/project/linux-riscv/patch/20191023032302.160388-1-wangkefeng.wang@huawei.com/

Or do i need to move the '#define mk_pmd(page, prot) ...' to pgtable-64.h ?


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2021-06-01  3:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  7:02 [PATCH -next] riscv: mm: fix build errors caused by mk_pmd() Nanyong Sun
2021-05-29 22:45 ` Palmer Dabbelt
2021-05-30  1:21   ` Palmer Dabbelt
2021-06-01  3:27     ` Sunnanyong (Nanyong Sun, Intelligent Computing Solution Development Dep)

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).