Linux-parisc archive on lore.kernel.org
 help / color / Atom feed
From: Mike Rapoport <rppt@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kbuild test robot <lkp@intel.com>,
	kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org
Subject: Re: [linux-next:master 10668/10701] include/linux/pgtable.h:203:2: note: in expansion of macro 'pte_clear'
Date: Thu, 21 May 2020 21:58:57 +0300
Message-ID: <20200521185857.GV1059226@linux.ibm.com> (raw)
In-Reply-To: <20200521111013.4002031df75532cca1f27d46@linux-foundation.org>

On Thu, May 21, 2020 at 11:10:13AM -0700, Andrew Morton wrote:
> On Thu, 21 May 2020 17:30:52 +0800 kbuild test robot <lkp@intel.com> wrote:
> 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   fb57b1fabcb28f358901b2df90abd2b48abc1ca8
> > commit: ef03574dee21524cbdbbf2af29fe06a62610570d [10668/10701] mm: introduce include/linux/pgtable.h
> > config: parisc-randconfig-r011-20200521 (attached as .config)
> > compiler: hppa-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         git checkout ef03574dee21524cbdbbf2af29fe06a62610570d
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > In file included from include/linux/pgtable.h:6,
> > from include/linux/mm.h:95,
> > from include/linux/pid_namespace.h:7,
> > from include/linux/ptrace.h:10,
> > from arch/parisc/kernel/asm-offsets.c:20:
> > include/linux/pgtable.h: In function 'pte_clear_not_present_full':
> > arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
> > 96 |   pte_t old_pte;              |         ^~~~~~~
> > arch/parisc/include/asm/pgtable.h:322:34: note: in expansion of macro 'set_pte_at'
> > 322 | #define pte_clear(mm, addr, xp)  set_pte_at(mm, addr, xp, __pte(0))
> > |                                  ^~~~~~~~~~
> > >> include/linux/pgtable.h:203:2: note: in expansion of macro 'pte_clear'
> > 203 |  pte_clear(mm, address, ptep);
> > |  ^~~~~~~~~
> > include/linux/pgtable.h: In function '__ptep_modify_prot_commit':
> > arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
> 
> I can't reproduce this.  And I can't see anything in -mm whcih would
> have triggered this warning.
> 
> arch/parisc/include/asm/pgtable.h has
> 
> #define set_pte_at(mm, addr, ptep, pteval)			\
> 	do {							\
> 		pte_t old_pte;					\
> 		unsigned long flags;				\
> 		spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);\
> 		old_pte = *ptep;				\
> 		set_pte(ptep, pteval);				\
> 		purge_tlb_entries(mm, addr);			\
> 		spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);\
> 	} while (0)
> 
> and old_pte has been set-but-not-used for a long time.
> 
> Obviously we can fix it, but I'm worried that parisc's set_pte_at() was
> previously unused and we've now done something to cause it to be used,
> so we're now running previously untested code.
 
I can reporduce it with

make W=1 ARCH=parisc CROSS_COMPILE=/opt/gcc-8.1.0-nolibc/hppa-linux/bin/hppa-linux-

on both the v5.7-rc6 and linux-next.

The only difference in the header names:

--- build-master.log	2020-05-21 21:44:03.064168815 +0300
+++ build-next.log	2020-05-21 21:44:52.372330747 +0300
@@ -2,25 +2,26 @@
   GEN     Makefile
   CALL    scripts/atomic/check-atomics.sh
   CC      arch/parisc/kernel/asm-offsets.s
-In file included from include/linux/mm.h:95,
+In file included from include/linux/pgtable.h:6,
+                 from include/linux/mm.h:31,
                  from include/linux/pid_namespace.h:7,
                  from include/linux/ptrace.h:10,
                  from arch/parisc/kernel/asm-offsets.c:20:
-include/asm-generic/pgtable.h: In function 'pte_clear_not_present_full':
+include/linux/pgtable.h: In function 'pte_clear_not_present_full':
 arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
    pte_t old_pte;     \
          ^~~~~~~
 arch/parisc/include/asm/pgtable.h:322:34: note: in expansion of macro 'set_pte_at'
  #define pte_clear(mm, addr, xp)  set_pte_at(mm, addr, xp, __pte(0))
                                   ^~~~~~~~~~
...

I think moving asm-generic/pgtable.h to linux/pgtable.h triggered the
"new warning" notification.

And the fix is obviously:

From 6de5f02d11fef8894836168c3e7bede05916d02d Mon Sep 17 00:00:00 2001
From: Mike Rapoport <rppt@linux.ibm.com>
Date: Thu, 21 May 2020 21:49:01 +0300
Subject: [PATCH] parisc: set_pte_at: remove unused old_pte variable.

kbuild test robot complains about unused variable old_pte in set_pte_at()
macro:

arch/parisc/include/asm/pgtable.h:96:9: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
96 |   pte_t old_pte;              |         ^~~~~~~
arch/parisc/include/asm/pgtable.h:322:34: note: in expansion of macro 'set_pte_at'
322 | #define pte_clear(mm, addr, xp)  set_pte_at(mm, addr, xp, __pte(0))

Remove the old_pte variable.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/parisc/include/asm/pgtable.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 097d19007f2e..75cf84070fc9 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -93,10 +93,8 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
 
 #define set_pte_at(mm, addr, ptep, pteval)			\
 	do {							\
-		pte_t old_pte;					\
 		unsigned long flags;				\
 		spin_lock_irqsave(pgd_spinlock((mm)->pgd), flags);\
-		old_pte = *ptep;				\
 		set_pte(ptep, pteval);				\
 		purge_tlb_entries(mm, addr);			\
 		spin_unlock_irqrestore(pgd_spinlock((mm)->pgd), flags);\
-- 
2.26.2


-- 
Sincerely yours,
Mike.

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <202005211742.H2jPhSbF%lkp@intel.com>
2020-05-21 18:10 ` Andrew Morton
2020-05-21 18:58   ` Mike Rapoport [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200521185857.GV1059226@linux.ibm.com \
    --to=rppt@linux.ibm.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=deller@gmx.de \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-parisc archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-parisc/0 linux-parisc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-parisc linux-parisc/ https://lore.kernel.org/linux-parisc \
		linux-parisc@vger.kernel.org
	public-inbox-index linux-parisc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-parisc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git