Skip to contentSkip to conversation

include: asm-generic: Notice about 80 columns in pgtable-no*.h

PATCH Superseded Chen Gang 4 participants 9 messages Dec 15, 2015 Generic include/asm header files

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 include: asm-generic: Notice about 80 columns in pgtable-no*.h

It is a trivial patch.

---
 include/asm-generic/pgtable-nopmd.h | 3 ++-
 include/asm-generic/pgtable-nopud.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
include/asm-generic/pgtable-nopmd.h +2 -1
index 725612b..7a81185 100644
@@ -38,7 +38,8 @@ static inline void pud_clear(pud_t *pud)	{ }
  * (pmds are folded into puds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
  */
-#define set_pud(pudptr, pudval)			set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
+#define set_pud(pudptr, pudval)			(set_pmd((pmd_t *)(pudptr), \
+							(pmd_t) { pudval }))
 
 static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
 {
include/asm-generic/pgtable-nopud.h +2 -1
index 810431d..bc78818 100644
@@ -33,7 +33,8 @@ static inline void pgd_clear(pgd_t *pgd)	{ }
  * (puds are folded into pgds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
  */
-#define set_pgd(pgdptr, pgdval)			set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
+#define set_pgd(pgdptr, pgdval)			(set_pud((pud_t *)(pgdptr), \
+							(pud_t) { pgdval }))
 
 static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
 {
Signature · 1 line
1.9.3
author
#1 lore raw

After this patch, I finish 'scanning' mm related headers in "include/asm-genric/*".

Next I shall continue 'scanning' mm related headers in "include/linux/*" to know about the common sense information.

Thanks.

Quoted 38 lines · Chen Gang

It is a trivial patch.

---
 include/asm-generic/pgtable-nopmd.h | 3 ++-
 include/asm-generic/pgtable-nopud.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
include/asm-generic/pgtable-nopmd.h +2 -1
index 725612b..7a81185 100644
@@ -38,7 +38,8 @@ static inline void pud_clear(pud_t *pud)	{ }
  * (pmds are folded into puds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
  */
-#define set_pud(pudptr, pudval)			set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
+#define set_pud(pudptr, pudval)			(set_pmd((pmd_t *)(pudptr), \
+							(pmd_t) { pudval }))
 
 static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
 {
include/asm-generic/pgtable-nopud.h +2 -1
index 810431d..bc78818 100644
@@ -33,7 +33,8 @@ static inline void pgd_clear(pgd_t *pgd)	{ }
  * (puds are folded into pgds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
  */
-#define set_pgd(pgdptr, pgdval)			set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
+#define set_pgd(pgdptr, pgdval)			(set_pud((pud_t *)(pgdptr), \
+							(pud_t) { pgdval }))
 
 static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
 {
Signature · 3 lines
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed
#2 lore raw
In reply to Chen Gang
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Chen,

[auto build test ERROR on v4.4-rc5]
[also build test ERROR on next-20151215]

url:    https://github.com/0day-ci/linux/commits/Chen-Gang/include-asm-generic-Notice-about-80-columns-in-pgtable-no-h/20151215-221607
config: mips-xway_defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips

All error/warnings (new ones prefixed by >>):

In file included from include/linux/mm.h:55:0,

                    from include/linux/pid_namespace.h:6,
                    from include/linux/ptrace.h:8,
                    from arch/mips/mm/fault.c:16:
   arch/mips/mm/fault.c: In function '__do_page_fault':
>> arch/mips/include/asm/pgtable.h:241:33: error: expected expression before 'do'
    #define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
                                    ^
>> include/asm-generic/pgtable-nopmd.h:41:36: note: in expansion of macro 'set_pmd'
    #define set_pud(pudptr, pudval)   (set_pmd((pmd_t *)(pudptr), \
                                       ^
>> include/asm-generic/pgtable-nopud.h:36:36: note: in expansion of macro 'set_pud'
    #define set_pgd(pgdptr, pgdval)   (set_pud((pud_t *)(pgdptr), \
                                       ^
>> arch/mips/mm/fault.c:314:3: note: in expansion of macro 'set_pgd'
      set_pgd(pgd, *pgd_k);
      ^

vim +/set_pmd +41 include/asm-generic/pgtable-nopmd.h

    25	 * The "pud_xxx()" functions here are trivial for a folded two-level
    26	 * setup: the pmd is never bad, and a pmd always exists (as it's folded
    27	 * into the pud entry)
    28	 */
    29	static inline int pud_none(pud_t pud)		{ return 0; }
    30	static inline int pud_bad(pud_t pud)		{ return 0; }
    31	static inline int pud_present(pud_t pud)	{ return 1; }
    32	static inline void pud_clear(pud_t *pud)	{ }
    33	#define pmd_ERROR(pmd)				(pud_ERROR((pmd).pud))
    34	
    35	#define pud_populate(mm, pmd, pte)		do { } while (0)
    36	
    37	/*
    38	 * (pmds are folded into puds so this doesn't get actually called,
    39	 * but the define is needed for a generic inline function.)
    40	 */
  > 41	#define set_pud(pudptr, pudval)			(set_pmd((pmd_t *)(pudptr), \
    42								(pmd_t) { pudval }))
    43	
    44	static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
    45	{
    46		return (pmd_t *)pud;
    47	}
    48	
    49	#define pmd_val(x)				(pud_val((x).pud))

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

#3 lore raw
In reply to Chen Gang
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Chen,

[auto build test ERROR on v4.4-rc5]
[also build test ERROR on next-20151215]

url:    https://github.com/0day-ci/linux/commits/Chen-Gang/include-asm-generic-Notice-about-80-columns-in-pgtable-no-h/20151215-221607
config: arm-shannon_defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All error/warnings (new ones prefixed by >>):

In file included from arch/arm/include/asm/pgtable.h:33:0,

                    from include/linux/mm.h:55,
                    from arch/arm/mm/fault.c:13:
   arch/arm/mm/fault.c: In function 'do_translation_fault':
>> arch/arm/include/asm/pgtable-2level.h:187:27: error: expected expression before 'do'
    #define set_pud(pud,pudp) do { } while (0)
                              ^
   include/asm-generic/pgtable-nopud.h:36:36: note: in expansion of macro 'set_pud'
    #define set_pgd(pgdptr, pgdval)   (set_pud((pud_t *)(pgdptr), \
                                       ^
>> arch/arm/mm/fault.c:444:3: note: in expansion of macro 'set_pgd'
      set_pgd(pgd, *pgd_k);
      ^

vim +/set_pgd +444 arch/arm/mm/fault.c

^1da177e Linus Torvalds 2005-04-16  428  	pmd_t *pmd, *pmd_k;
^1da177e Linus Torvalds 2005-04-16  429  
^1da177e Linus Torvalds 2005-04-16  430  	if (addr < TASK_SIZE)
^1da177e Linus Torvalds 2005-04-16  431  		return do_page_fault(addr, fsr, regs);
^1da177e Linus Torvalds 2005-04-16  432  
5e27fb78 Anfei          2010-06-08  433  	if (user_mode(regs))
5e27fb78 Anfei          2010-06-08  434  		goto bad_area;
5e27fb78 Anfei          2010-06-08  435  
^1da177e Linus Torvalds 2005-04-16  436  	index = pgd_index(addr);
^1da177e Linus Torvalds 2005-04-16  437  
^1da177e Linus Torvalds 2005-04-16  438  	pgd = cpu_get_pgd() + index;
^1da177e Linus Torvalds 2005-04-16  439  	pgd_k = init_mm.pgd + index;
^1da177e Linus Torvalds 2005-04-16  440  
^1da177e Linus Torvalds 2005-04-16  441  	if (pgd_none(*pgd_k))
^1da177e Linus Torvalds 2005-04-16  442  		goto bad_area;
^1da177e Linus Torvalds 2005-04-16  443  	if (!pgd_present(*pgd))
^1da177e Linus Torvalds 2005-04-16 @444  		set_pgd(pgd, *pgd_k);
^1da177e Linus Torvalds 2005-04-16  445  
516295e5 Russell King   2010-11-21  446  	pud = pud_offset(pgd, addr);
516295e5 Russell King   2010-11-21  447  	pud_k = pud_offset(pgd_k, addr);
516295e5 Russell King   2010-11-21  448  
516295e5 Russell King   2010-11-21  449  	if (pud_none(*pud_k))
516295e5 Russell King   2010-11-21  450  		goto bad_area;
516295e5 Russell King   2010-11-21  451  	if (!pud_present(*pud))
516295e5 Russell King   2010-11-21  452  		set_pud(pud, *pud_k);

:::::: The code at line 444 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

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

maintainer
#4 lore raw
Quoted 9 lines · On Tuesday 15 December 2015 23:47:28 kbuild test robot wrote:
                    from include/linux/mm.h:55,
                    from arch/arm/mm/fault.c:13:

arch/arm/mm/fault.c: In function 'do_translation_fault':

Quoted 1 line
Quoted 1 line

arch/arm/include/asm/pgtable-2level.h:187:27: error: expected expression before 'do'

    #define set_pud(pud,pudp) do { } while (0)
                              ^
   include/asm-generic/pgtable-nopud.h:36:36: note: in expansion of macro 'set_pud'
    #define set_pgd(pgdptr, pgdval)   (set_pud((pud_t *)(pgdptr), \

This is a result of the added braces, please redo the patch.

Arnd

#6 lore raw
In reply to Chen Gang
Quoted 1 line · Chen Gang

It is a trivial patch.

[]

include/asm-generic/pgtable-nopmd.h

Quoted 1 line
include/asm-generic/pgtable-nopmd.h +0 -0

[]

include/asm-generic/pgtable-nopmd.h static inline void pud_clear(pud_t *pud) { } · line 42

Quoted 7 lines
include/asm-generic/pgtable-nopmd.h +2 -1
@@ -38,7 +38,8 @@ static inline void pud_clear(pud_t *pud)	{ }
   * (pmds are folded into puds so this doesn't get actually called,
   * but the define is needed for a generic inline function.)
   */
-#define set_pud(pudptr, pudval)			set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
+#define set_pud(pudptr, pudval)			(set_pmd((pmd_t *)(pudptr), \
+							(pmd_t) { pudval }))

Not quite so trivial.

If you _really_ want to break this up for 80 columns, and I don't think it's necessary, it might be better to use something like:

#define set_pud(pudptr, pudval)					\
	set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
#8 lore raw
In reply to Chen Gang
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Chen,

[auto build test ERROR on v4.4-rc5]
[also build test ERROR on next-20151215]

url:    https://github.com/0day-ci/linux/commits/Chen-Gang/include-asm-generic-Notice-about-80-columns-in-pgtable-no-h/20151215-221607
config: arm-axm55xx_defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

In file included from arch/arm/include/asm/pgtable.h:31:0,

                    from include/linux/mm.h:55,
                    from arch/arm/mm/fault.c:13:
   arch/arm/mm/fault.c: In function 'do_translation_fault':
>> arch/arm/include/asm/pgtable-3level.h:158:2: error: expected expression before 'do'
     do {    \
     ^
   include/asm-generic/pgtable-nopud.h:36:36: note: in expansion of macro 'set_pud'
    #define set_pgd(pgdptr, pgdval)   (set_pud((pud_t *)(pgdptr), \
                                       ^
   arch/arm/mm/fault.c:444:3: note: in expansion of macro 'set_pgd'
      set_pgd(pgd, *pgd_k);
      ^

vim +/do +158 arch/arm/include/asm/pgtable-3level.h

da028779 Catalin Marinas  2011-11-22  142  #define pud_none(pud)		(!pud_val(pud))
da028779 Catalin Marinas  2011-11-22  143  #define pud_bad(pud)		(!(pud_val(pud) & 2))
da028779 Catalin Marinas  2011-11-22  144  #define pud_present(pud)	(pud_val(pud))
cc577c26 Christoffer Dall 2013-01-20  145  #define pmd_table(pmd)		((pmd_val(pmd) & PMD_TYPE_MASK) == \
cc577c26 Christoffer Dall 2013-01-20  146  						 PMD_TYPE_TABLE)
cc577c26 Christoffer Dall 2013-01-20  147  #define pmd_sect(pmd)		((pmd_val(pmd) & PMD_TYPE_MASK) == \
cc577c26 Christoffer Dall 2013-01-20  148  						 PMD_TYPE_SECT)
1fd15b87 Russell King     2013-10-23  149  #define pmd_large(pmd)		pmd_sect(pmd)
da028779 Catalin Marinas  2011-11-22  150  
da028779 Catalin Marinas  2011-11-22  151  #define pud_clear(pudp)			\
da028779 Catalin Marinas  2011-11-22  152  	do {				\
da028779 Catalin Marinas  2011-11-22  153  		*pudp = __pud(0);	\
da028779 Catalin Marinas  2011-11-22  154  		clean_pmd_entry(pudp);	\
da028779 Catalin Marinas  2011-11-22  155  	} while (0)
da028779 Catalin Marinas  2011-11-22  156  
da028779 Catalin Marinas  2011-11-22  157  #define set_pud(pudp, pud)		\
da028779 Catalin Marinas  2011-11-22 @158  	do {				\
da028779 Catalin Marinas  2011-11-22  159  		*pudp = pud;		\
da028779 Catalin Marinas  2011-11-22  160  		flush_pmd_entry(pudp);	\
da028779 Catalin Marinas  2011-11-22  161  	} while (0)
da028779 Catalin Marinas  2011-11-22  162  
da028779 Catalin Marinas  2011-11-22  163  static inline pmd_t *pud_page_vaddr(pud_t pud)
da028779 Catalin Marinas  2011-11-22  164  {
da028779 Catalin Marinas  2011-11-22  165  	return __va(pud_val(pud) & PHYS_MASK & (s32)PAGE_MASK);
da028779 Catalin Marinas  2011-11-22  166  }

:::::: The code at line 158 was first introduced by commit
:::::: da02877987e6e173ebba137d4e1e155e1f1151cd ARM: LPAE: Page table maintenance for the 3-level format

:::::: TO: Catalin Marinas <[email protected]> :::::: CC: Catalin Marinas <[email protected]>

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

author
#5 lore raw
In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann
Quoted 3 lines · On Tuesday 15 December 2015 23:47:28 kbuild test robot wrote:
                    from include/linux/mm.h:55,
                    from arch/arm/mm/fault.c:13:

arch/arm/mm/fault.c: In function 'do_translation_fault':

Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

arch/arm/include/asm/pgtable-2level.h:187:27: error: expected expression before 'do'

    #define set_pud(pud,pudp) do { } while (0)
                              ^
   include/asm-generic/pgtable-nopud.h:36:36: note: in expansion of macro 'set_pud'
    #define set_pgd(pgdptr, pgdval)   (set_pud((pud_t *)(pgdptr), \

This is a result of the added braces, please redo the patch.

OK, thanks.

Signature · 3 lines
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed
author
#7 lore raw
In reply to Joe Perches
Quoted 15 lines · Joe Perches
Quoted 1 line · Chen Gang

It is a trivial patch.

[]

include/asm-generic/pgtable-nopmd.h

Quoted 1 line
include/asm-generic/pgtable-nopmd.h +0 -0

[]

include/asm-generic/pgtable-nopmd.h static inline void pud_clear(pud_t *pud) { } · line 42

Quoted 7 lines
include/asm-generic/pgtable-nopmd.h +2 -1
@@ -38,7 +38,8 @@ static inline void pud_clear(pud_t *pud)	{ }
  * (pmds are folded into puds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
  */
-#define set_pud(pudptr, pudval)			set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
+#define set_pud(pudptr, pudval)			(set_pmd((pmd_t *)(pudptr), \
+							(pmd_t) { pudval }))

Not quite so trivial.

Quoted 7 lines

If you _really_ want to break this up for 80 columns, and I don't think it's necessary, it might be better to use something like:

#define set_pud(pudptr, pudval)					\
	set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })

OK, thanks. For me, it is better.

Signature · 3 lines
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed