linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] gup.c, gup_benchmark.c trivial fixes before the storm
@ 2019-10-13 22:11 John Hubbard
  2019-10-13 22:11 ` [PATCH 1/2] mm/gup_benchmark: add a missing "w" to getopt string John Hubbard
  2019-10-13 22:11 ` [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags" John Hubbard
  0 siblings, 2 replies; 11+ messages in thread
From: John Hubbard @ 2019-10-13 22:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Hellwig, Aneesh Kumar K . V, Keith Busch, Ira Weiny,
	LKML, linux-mm, John Hubbard, Christoph Hellwig,
	Kirill A . Shutemov, Shuah Khan, linux-kselftest

Hi,

These trivial fixes apply to today's linux.git (5.4-rc3, or maybe -rc4, by
the time I send this).

I found these while polishing up the Next And Final get_user_pages()+dma
tracking patchset (which is in final testing and passing nicely...so far).

Anyway, as these two patches apply cleanly both before and after the larger
gup/dma upcoming patchset, I thought it best to send this out separately,
in order to avoid muddying the waters more than usual.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org


John Hubbard (2):
  mm/gup_benchmark: add a missing "w" to getopt string
  mm/gup: fix a misnamed "write" argument: should be "flags"

 mm/gup.c                                   | 12 +++++++-----
 tools/testing/selftests/vm/gup_benchmark.c |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

-- 
2.23.0



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

* [PATCH 1/2] mm/gup_benchmark: add a missing "w" to getopt string
  2019-10-13 22:11 [PATCH 0/2] gup.c, gup_benchmark.c trivial fixes before the storm John Hubbard
@ 2019-10-13 22:11 ` John Hubbard
  2019-10-14 13:36   ` Kirill A. Shutemov
  2019-10-13 22:11 ` [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags" John Hubbard
  1 sibling, 1 reply; 11+ messages in thread
From: John Hubbard @ 2019-10-13 22:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Hellwig, Aneesh Kumar K . V, Keith Busch, Ira Weiny,
	LKML, linux-mm, John Hubbard, Kirill A . Shutemov, Shuah Khan,
	linux-kselftest

Even though gup_benchmark.c has code to handle the -w
command-line option, the "w" is not part of the getopt
string. It looks as if it has been missing the whole time.

On my machine, this leads naturally to the following
predictable result:

$ sudo ./gup_benchmark -w
./gup_benchmark: invalid option -- 'w'

...which is fixed, with this commit.

Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 tools/testing/selftests/vm/gup_benchmark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vm/gup_benchmark.c b/tools/testing/selftests/vm/gup_benchmark.c
index c0534e298b51..cb3fc09645c4 100644
--- a/tools/testing/selftests/vm/gup_benchmark.c
+++ b/tools/testing/selftests/vm/gup_benchmark.c
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
 	char *file = "/dev/zero";
 	char *p;
 
-	while ((opt = getopt(argc, argv, "m:r:n:f:tTLUSH")) != -1) {
+	while ((opt = getopt(argc, argv, "m:r:n:f:tTLUwSH")) != -1) {
 		switch (opt) {
 		case 'm':
 			size = atoi(optarg) * MB;
-- 
2.23.0



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

* [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-13 22:11 [PATCH 0/2] gup.c, gup_benchmark.c trivial fixes before the storm John Hubbard
  2019-10-13 22:11 ` [PATCH 1/2] mm/gup_benchmark: add a missing "w" to getopt string John Hubbard
@ 2019-10-13 22:11 ` John Hubbard
  2019-10-14  6:12   ` kbuild test robot
  1 sibling, 1 reply; 11+ messages in thread
From: John Hubbard @ 2019-10-13 22:11 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Hellwig, Aneesh Kumar K . V, Keith Busch, Ira Weiny,
	LKML, linux-mm, John Hubbard, Christoph Hellwig

In several routines, the "flags" argument is incorrectly
named "write". Change it to "flags".

You can see that this was a simple oversight, because the
calling code passes "flags" to the fifth argument:

gup_pgd_range():
    ...
    if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr,
		    PGDIR_SHIFT, next, flags, pages, nr))

...which, until this patch, the callees referred to as "write".

Also, change two lines to avoid checkpatch line length
complaints, and another line to fix another oversight
that checkpatch called out: missing "int" on pdshift.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 mm/gup.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 23a9f9c9d377..0438221d8c53 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1973,7 +1973,8 @@ static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
 }
 
 static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
-		       unsigned long end, int write, struct page **pages, int *nr)
+		       unsigned long end, int flags, struct page **pages,
+		       int *nr)
 {
 	unsigned long pte_end;
 	struct page *head, *page;
@@ -2023,7 +2024,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
 }
 
 static int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
-		unsigned int pdshift, unsigned long end, int write,
+		unsigned int pdshift, unsigned long end, int flags,
 		struct page **pages, int *nr)
 {
 	pte_t *ptep;
@@ -2033,7 +2034,7 @@ static int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
 	ptep = hugepte_offset(hugepd, addr, pdshift);
 	do {
 		next = hugepte_addr_end(addr, end, sz);
-		if (!gup_hugepte(ptep, sz, addr, end, write, pages, nr))
+		if (!gup_hugepte(ptep, sz, addr, end, flags, pages, nr))
 			return 0;
 	} while (ptep++, addr = next, addr != end);
 
@@ -2041,7 +2042,7 @@ static int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
 }
 #else
 static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
-		unsigned pdshift, unsigned long end, int write,
+		unsigned int pdshift, unsigned long end, int flags,
 		struct page **pages, int *nr)
 {
 	return 0;
@@ -2049,7 +2050,8 @@ static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
 #endif /* CONFIG_ARCH_HAS_HUGEPD */
 
 static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
-		unsigned long end, unsigned int flags, struct page **pages, int *nr)
+			unsigned long end, unsigned int flags,
+			struct page **pages, int *nr)
 {
 	struct page *head, *page;
 	int refs;
-- 
2.23.0



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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-13 22:11 ` [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags" John Hubbard
@ 2019-10-14  6:12   ` kbuild test robot
  2019-10-14  6:43     ` John Hubbard
  0 siblings, 1 reply; 11+ messages in thread
From: kbuild test robot @ 2019-10-14  6:12 UTC (permalink / raw)
  To: John Hubbard
  Cc: kbuild-all, Andrew Morton, Christoph Hellwig, Aneesh Kumar K . V,
	Keith Busch, Ira Weiny, LKML, linux-mm, John Hubbard,
	Christoph Hellwig

[-- Attachment #1: Type: text/plain, Size: 5424 bytes --]

Hi John,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.4-rc3 next-20191011]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   mm/gup.c: In function 'gup_hugepte':
>> mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
     if (!pte_access_permitted(pte, write))
                                    ^~~~~
                                    writeq
   mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in

vim +1990 mm/gup.c

cbd34da7dc9afd Christoph Hellwig 2019-07-11  1974  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1975  static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
cc492e4c15e804 John Hubbard      2019-10-13  1976  		       unsigned long end, int flags, struct page **pages,
cc492e4c15e804 John Hubbard      2019-10-13  1977  		       int *nr)
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1978  {
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1979  	unsigned long pte_end;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1980  	struct page *head, *page;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1981  	pte_t pte;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1982  	int refs;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1983  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1984  	pte_end = (addr + sz) & ~(sz-1);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1985  	if (pte_end < end)
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1986  		end = pte_end;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1987  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1988  	pte = READ_ONCE(*ptep);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1989  
cbd34da7dc9afd Christoph Hellwig 2019-07-11 @1990  	if (!pte_access_permitted(pte, write))
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1991  		return 0;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1992  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1993  	/* hugepages are never "special" */
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1994  	VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1995  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1996  	refs = 0;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1997  	head = pte_page(pte);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1998  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  1999  	page = head + ((addr & (sz-1)) >> PAGE_SHIFT);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2000  	do {
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2001  		VM_BUG_ON(compound_head(page) != head);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2002  		pages[*nr] = page;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2003  		(*nr)++;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2004  		page++;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2005  		refs++;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2006  	} while (addr += PAGE_SIZE, addr != end);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2007  
01a369160bbea4 Christoph Hellwig 2019-07-11  2008  	head = try_get_compound_head(head, refs);
01a369160bbea4 Christoph Hellwig 2019-07-11  2009  	if (!head) {
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2010  		*nr -= refs;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2011  		return 0;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2012  	}
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2013  
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2014  	if (unlikely(pte_val(pte) != pte_val(*ptep))) {
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2015  		/* Could be optimized better */
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2016  		*nr -= refs;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2017  		while (refs--)
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2018  			put_page(head);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2019  		return 0;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2020  	}
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2021  
520b4a4496f12b Christoph Hellwig 2019-07-11  2022  	SetPageReferenced(head);
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2023  	return 1;
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2024  }
cbd34da7dc9afd Christoph Hellwig 2019-07-11  2025  

:::::: The code at line 1990 was first introduced by commit
:::::: cbd34da7dc9afd521e0bea5e7d12701f4a9da7c7 mm: move the powerpc hugepd code to mm/gup.c

:::::: TO: Christoph Hellwig <hch@lst.de>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25422 bytes --]

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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-14  6:12   ` kbuild test robot
@ 2019-10-14  6:43     ` John Hubbard
  2019-10-14 13:52       ` Kirill A. Shutemov
  0 siblings, 1 reply; 11+ messages in thread
From: John Hubbard @ 2019-10-14  6:43 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Andrew Morton, Christoph Hellwig, Aneesh Kumar K . V,
	Keith Busch, Ira Weiny, LKML, linux-mm, Christoph Hellwig

On 10/13/19 11:12 PM, kbuild test robot wrote:
> Hi John,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on linus/master]
> [cannot apply to v5.4-rc3 next-20191011]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
> config: powerpc-defconfig (attached as .config)
> compiler: powerpc64-linux-gcc (GCC) 7.4.0
> reproduce:
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # save the attached .config to linux build tree
>          GCC_VERSION=7.4.0 make.cross ARCH=powerpc
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>     mm/gup.c: In function 'gup_hugepte':
>>> mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
>       if (!pte_access_permitted(pte, write))
>                                      ^~~~~
>                                      writeq
>     mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in
> 

OK, so this shows that my cross-compiler test scripts are faulty lately,
sorry I missed this.

But more importantly, the above missed case is an example of when "write" really
means "write", as opposed to meaning flags.

Please put this patch on hold or drop it, until we hear from the authors as to how
they would like to resolve this. I suspect it will end up as something like:

	bool write = (flags & FOLL_WRITE);

...perhaps?


thanks,
-- 
John Hubbard
NVIDIA


> vim +1990 mm/gup.c
> 
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1974
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1975  static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
> cc492e4c15e804 John Hubbard      2019-10-13  1976  		       unsigned long end, int flags, struct page **pages,
> cc492e4c15e804 John Hubbard      2019-10-13  1977  		       int *nr)
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1978  {
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1979  	unsigned long pte_end;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1980  	struct page *head, *page;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1981  	pte_t pte;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1982  	int refs;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1983
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1984  	pte_end = (addr + sz) & ~(sz-1);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1985  	if (pte_end < end)
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1986  		end = pte_end;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1987
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1988  	pte = READ_ONCE(*ptep);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1989
> cbd34da7dc9afd Christoph Hellwig 2019-07-11 @1990  	if (!pte_access_permitted(pte, write))
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1991  		return 0;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1992
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1993  	/* hugepages are never "special" */
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1994  	VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1995
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1996  	refs = 0;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1997  	head = pte_page(pte);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1998
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  1999  	page = head + ((addr & (sz-1)) >> PAGE_SHIFT);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2000  	do {
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2001  		VM_BUG_ON(compound_head(page) != head);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2002  		pages[*nr] = page;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2003  		(*nr)++;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2004  		page++;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2005  		refs++;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2006  	} while (addr += PAGE_SIZE, addr != end);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2007
> 01a369160bbea4 Christoph Hellwig 2019-07-11  2008  	head = try_get_compound_head(head, refs);
> 01a369160bbea4 Christoph Hellwig 2019-07-11  2009  	if (!head) {
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2010  		*nr -= refs;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2011  		return 0;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2012  	}
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2013
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2014  	if (unlikely(pte_val(pte) != pte_val(*ptep))) {
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2015  		/* Could be optimized better */
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2016  		*nr -= refs;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2017  		while (refs--)
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2018  			put_page(head);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2019  		return 0;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2020  	}
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2021
> 520b4a4496f12b Christoph Hellwig 2019-07-11  2022  	SetPageReferenced(head);
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2023  	return 1;
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2024  }
> cbd34da7dc9afd Christoph Hellwig 2019-07-11  2025
> 
> :::::: The code at line 1990 was first introduced by commit
> :::::: cbd34da7dc9afd521e0bea5e7d12701f4a9da7c7 mm: move the powerpc hugepd code to mm/gup.c
> 
> :::::: TO: Christoph Hellwig <hch@lst.de>
> :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 


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

* Re: [PATCH 1/2] mm/gup_benchmark: add a missing "w" to getopt string
  2019-10-13 22:11 ` [PATCH 1/2] mm/gup_benchmark: add a missing "w" to getopt string John Hubbard
@ 2019-10-14 13:36   ` Kirill A. Shutemov
  0 siblings, 0 replies; 11+ messages in thread
From: Kirill A. Shutemov @ 2019-10-14 13:36 UTC (permalink / raw)
  To: John Hubbard
  Cc: Andrew Morton, Christoph Hellwig, Aneesh Kumar K . V,
	Keith Busch, Ira Weiny, LKML, linux-mm, Kirill A . Shutemov,
	Shuah Khan, linux-kselftest

On Sun, Oct 13, 2019 at 03:11:54PM -0700, John Hubbard wrote:
> Even though gup_benchmark.c has code to handle the -w
> command-line option, the "w" is not part of the getopt
> string. It looks as if it has been missing the whole time.
> 
> On my machine, this leads naturally to the following
> predictable result:
> 
> $ sudo ./gup_benchmark -w
> ./gup_benchmark: invalid option -- 'w'
> 
> ...which is fixed, with this commit.
> 
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-kselftest@vger.kernel.org
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov


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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-14  6:43     ` John Hubbard
@ 2019-10-14 13:52       ` Kirill A. Shutemov
  2019-10-14 14:44         ` Aneesh Kumar K.V
  0 siblings, 1 reply; 11+ messages in thread
From: Kirill A. Shutemov @ 2019-10-14 13:52 UTC (permalink / raw)
  To: John Hubbard
  Cc: kbuild test robot, kbuild-all, Andrew Morton, Christoph Hellwig,
	Aneesh Kumar K . V, Keith Busch, Ira Weiny, LKML, linux-mm,
	Christoph Hellwig

On Sun, Oct 13, 2019 at 11:43:10PM -0700, John Hubbard wrote:
> On 10/13/19 11:12 PM, kbuild test robot wrote:
> > Hi John,
> > 
> > Thank you for the patch! Yet something to improve:
> > 
> > [auto build test ERROR on linus/master]
> > [cannot apply to v5.4-rc3 next-20191011]
> > [if your patch is applied to the wrong git tree, please drop us a note to help
> > improve the system. BTW, we also suggest to use '--base' option to specify the
> > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> > 
> > url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
> > config: powerpc-defconfig (attached as .config)
> > compiler: powerpc64-linux-gcc (GCC) 7.4.0
> > reproduce:
> >          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >          chmod +x ~/bin/make.cross
> >          # save the attached .config to linux build tree
> >          GCC_VERSION=7.4.0 make.cross ARCH=powerpc
> > 
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > All errors (new ones prefixed by >>):
> > 
> >     mm/gup.c: In function 'gup_hugepte':
> > > > mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
> >       if (!pte_access_permitted(pte, write))
> >                                      ^~~~~
> >                                      writeq
> >     mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in
> > 
> 
> OK, so this shows that my cross-compiler test scripts are faulty lately,
> sorry I missed this.
> 
> But more importantly, the above missed case is an example of when "write" really
> means "write", as opposed to meaning flags.
> 
> Please put this patch on hold or drop it, until we hear from the authors as to how
> they would like to resolve this. I suspect it will end up as something like:
> 
> 	bool write = (flags & FOLL_WRITE);
> 
> ...perhaps?

Just use

	if (!pte_access_permitted(pte, flags & FOLL_WRITE))

as we have in gup_pte_range().

And add:

Fixes: cbd34da7dc9a ("mm: move the powerpc hugepd code to mm/gup.c")

-- 
 Kirill A. Shutemov


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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-14 13:52       ` Kirill A. Shutemov
@ 2019-10-14 14:44         ` Aneesh Kumar K.V
  2019-10-14 14:51           ` Kirill A. Shutemov
  2019-10-14 16:45           ` Ira Weiny
  0 siblings, 2 replies; 11+ messages in thread
From: Aneesh Kumar K.V @ 2019-10-14 14:44 UTC (permalink / raw)
  To: Kirill A. Shutemov, John Hubbard
  Cc: kbuild test robot, kbuild-all, Andrew Morton, Christoph Hellwig,
	Keith Busch, Ira Weiny, LKML, linux-mm, Christoph Hellwig

On 10/14/19 7:22 PM, Kirill A. Shutemov wrote:
> On Sun, Oct 13, 2019 at 11:43:10PM -0700, John Hubbard wrote:
>> On 10/13/19 11:12 PM, kbuild test robot wrote:
>>> Hi John,
>>>
>>> Thank you for the patch! Yet something to improve:
>>>
>>> [auto build test ERROR on linus/master]
>>> [cannot apply to v5.4-rc3 next-20191011]
>>> [if your patch is applied to the wrong git tree, please drop us a note to help
>>> improve the system. BTW, we also suggest to use '--base' option to specify the
>>> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>>>
>>> url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
>>> config: powerpc-defconfig (attached as .config)
>>> compiler: powerpc64-linux-gcc (GCC) 7.4.0
>>> reproduce:
>>>           wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>           chmod +x ~/bin/make.cross
>>>           # save the attached .config to linux build tree
>>>           GCC_VERSION=7.4.0 make.cross ARCH=powerpc
>>>
>>> If you fix the issue, kindly add following tag
>>> Reported-by: kbuild test robot <lkp@intel.com>
>>>
>>> All errors (new ones prefixed by >>):
>>>
>>>      mm/gup.c: In function 'gup_hugepte':
>>>>> mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
>>>        if (!pte_access_permitted(pte, write))
>>>                                       ^~~~~
>>>                                       writeq
>>>      mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>
>> OK, so this shows that my cross-compiler test scripts are faulty lately,
>> sorry I missed this.
>>
>> But more importantly, the above missed case is an example of when "write" really
>> means "write", as opposed to meaning flags.
>>
>> Please put this patch on hold or drop it, until we hear from the authors as to how
>> they would like to resolve this. I suspect it will end up as something like:
>>
>> 	bool write = (flags & FOLL_WRITE);
>>
>> ...perhaps?
> 
> Just use
> 
> 	if (!pte_access_permitted(pte, flags & FOLL_WRITE))
> 
> as we have in gup_pte_range().
> 
> And add:
> 
> Fixes: cbd34da7dc9a ("mm: move the powerpc hugepd code to mm/gup.c")
> 

b798bec4741bdd80224214fdd004c8e52698e42 isn't this the commit that need 
to be mentioned in the Fixes: tag?

-aneesh


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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-14 14:44         ` Aneesh Kumar K.V
@ 2019-10-14 14:51           ` Kirill A. Shutemov
  2019-10-14 16:45           ` Ira Weiny
  1 sibling, 0 replies; 11+ messages in thread
From: Kirill A. Shutemov @ 2019-10-14 14:51 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: John Hubbard, kbuild test robot, kbuild-all, Andrew Morton,
	Christoph Hellwig, Keith Busch, Ira Weiny, LKML, linux-mm,
	Christoph Hellwig

On Mon, Oct 14, 2019 at 08:14:04PM +0530, Aneesh Kumar K.V wrote:
> On 10/14/19 7:22 PM, Kirill A. Shutemov wrote:
> > On Sun, Oct 13, 2019 at 11:43:10PM -0700, John Hubbard wrote:
> > > On 10/13/19 11:12 PM, kbuild test robot wrote:
> > > > Hi John,
> > > > 
> > > > Thank you for the patch! Yet something to improve:
> > > > 
> > > > [auto build test ERROR on linus/master]
> > > > [cannot apply to v5.4-rc3 next-20191011]
> > > > [if your patch is applied to the wrong git tree, please drop us a note to help
> > > > improve the system. BTW, we also suggest to use '--base' option to specify the
> > > > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> > > > 
> > > > url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
> > > > config: powerpc-defconfig (attached as .config)
> > > > compiler: powerpc64-linux-gcc (GCC) 7.4.0
> > > > reproduce:
> > > >           wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > >           chmod +x ~/bin/make.cross
> > > >           # save the attached .config to linux build tree
> > > >           GCC_VERSION=7.4.0 make.cross ARCH=powerpc
> > > > 
> > > > If you fix the issue, kindly add following tag
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > 
> > > > All errors (new ones prefixed by >>):
> > > > 
> > > >      mm/gup.c: In function 'gup_hugepte':
> > > > > > mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
> > > >        if (!pte_access_permitted(pte, write))
> > > >                                       ^~~~~
> > > >                                       writeq
> > > >      mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in
> > > > 
> > > 
> > > OK, so this shows that my cross-compiler test scripts are faulty lately,
> > > sorry I missed this.
> > > 
> > > But more importantly, the above missed case is an example of when "write" really
> > > means "write", as opposed to meaning flags.
> > > 
> > > Please put this patch on hold or drop it, until we hear from the authors as to how
> > > they would like to resolve this. I suspect it will end up as something like:
> > > 
> > > 	bool write = (flags & FOLL_WRITE);
> > > 
> > > ...perhaps?
> > 
> > Just use
> > 
> > 	if (!pte_access_permitted(pte, flags & FOLL_WRITE))
> > 
> > as we have in gup_pte_range().
> > 
> > And add:
> > 
> > Fixes: cbd34da7dc9a ("mm: move the powerpc hugepd code to mm/gup.c")
> > 
> 
> b798bec4741bdd80224214fdd004c8e52698e42 isn't this the commit that need to
> be mentioned in the Fixes: tag?

Ah. Okay, I see you point. Yes, this is the sourch of the breakage.

-- 
 Kirill A. Shutemov


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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-14 14:44         ` Aneesh Kumar K.V
  2019-10-14 14:51           ` Kirill A. Shutemov
@ 2019-10-14 16:45           ` Ira Weiny
  2019-10-14 18:39             ` John Hubbard
  1 sibling, 1 reply; 11+ messages in thread
From: Ira Weiny @ 2019-10-14 16:45 UTC (permalink / raw)
  To: Aneesh Kumar K.V
  Cc: Kirill A. Shutemov, John Hubbard, kbuild test robot, kbuild-all,
	Andrew Morton, Christoph Hellwig, Keith Busch, LKML, linux-mm,
	Christoph Hellwig

On Mon, Oct 14, 2019 at 08:14:04PM +0530, Aneesh Kumar K.V wrote:
> On 10/14/19 7:22 PM, Kirill A. Shutemov wrote:
> > On Sun, Oct 13, 2019 at 11:43:10PM -0700, John Hubbard wrote:
> > > On 10/13/19 11:12 PM, kbuild test robot wrote:
> > > > Hi John,
> > > > 
> > > > Thank you for the patch! Yet something to improve:
> > > > 
> > > > [auto build test ERROR on linus/master]
> > > > [cannot apply to v5.4-rc3 next-20191011]
> > > > [if your patch is applied to the wrong git tree, please drop us a note to help
> > > > improve the system. BTW, we also suggest to use '--base' option to specify the
> > > > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> > > > 
> > > > url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
> > > > config: powerpc-defconfig (attached as .config)
> > > > compiler: powerpc64-linux-gcc (GCC) 7.4.0
> > > > reproduce:
> > > >           wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > > >           chmod +x ~/bin/make.cross
> > > >           # save the attached .config to linux build tree
> > > >           GCC_VERSION=7.4.0 make.cross ARCH=powerpc
> > > > 
> > > > If you fix the issue, kindly add following tag
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > > 
> > > > All errors (new ones prefixed by >>):
> > > > 
> > > >      mm/gup.c: In function 'gup_hugepte':
> > > > > > mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
> > > >        if (!pte_access_permitted(pte, write))
> > > >                                       ^~~~~
> > > >                                       writeq
> > > >      mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in
> > > > 
> > > 
> > > OK, so this shows that my cross-compiler test scripts are faulty lately,
> > > sorry I missed this.
> > > 
> > > But more importantly, the above missed case is an example of when "write" really
> > > means "write", as opposed to meaning flags.
> > > 
> > > Please put this patch on hold or drop it, until we hear from the authors as to how
> > > they would like to resolve this. I suspect it will end up as something like:
> > > 
> > > 	bool write = (flags & FOLL_WRITE);
> > > 
> > > ...perhaps?
> > 
> > Just use
> > 
> > 	if (!pte_access_permitted(pte, flags & FOLL_WRITE))
> > 
> > as we have in gup_pte_range().
> > 
> > And add:
> > 
> > Fixes: cbd34da7dc9a ("mm: move the powerpc hugepd code to mm/gup.c")
> > 
> 
> b798bec4741bdd80224214fdd004c8e52698e42 isn't this the commit that need to
> be mentioned in the Fixes: tag?

Yes, and while we are at it the type should probably be changed to unsigned
int.

Ira

> 
> -aneesh


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

* Re: [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags"
  2019-10-14 16:45           ` Ira Weiny
@ 2019-10-14 18:39             ` John Hubbard
  0 siblings, 0 replies; 11+ messages in thread
From: John Hubbard @ 2019-10-14 18:39 UTC (permalink / raw)
  To: Ira Weiny, Aneesh Kumar K.V
  Cc: Kirill A. Shutemov, kbuild test robot, kbuild-all, Andrew Morton,
	Christoph Hellwig, Keith Busch, LKML, linux-mm,
	Christoph Hellwig

On 10/14/19 9:45 AM, Ira Weiny wrote:
> On Mon, Oct 14, 2019 at 08:14:04PM +0530, Aneesh Kumar K.V wrote:
>> On 10/14/19 7:22 PM, Kirill A. Shutemov wrote:
>>> On Sun, Oct 13, 2019 at 11:43:10PM -0700, John Hubbard wrote:
>>>> On 10/13/19 11:12 PM, kbuild test robot wrote:
>>>>> Hi John,
>>>>>
>>>>> Thank you for the patch! Yet something to improve:
>>>>>
>>>>> [auto build test ERROR on linus/master]
>>>>> [cannot apply to v5.4-rc3 next-20191011]
>>>>> [if your patch is applied to the wrong git tree, please drop us a note to help
>>>>> improve the system. BTW, we also suggest to use '--base' option to specify the
>>>>> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>>>>>
>>>>> url:    https://github.com/0day-ci/linux/commits/John-Hubbard/gup-c-gup_benchmark-c-trivial-fixes-before-the-storm/20191014-114158
>>>>> config: powerpc-defconfig (attached as .config)
>>>>> compiler: powerpc64-linux-gcc (GCC) 7.4.0
>>>>> reproduce:
>>>>>           wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>>>           chmod +x ~/bin/make.cross
>>>>>           # save the attached .config to linux build tree
>>>>>           GCC_VERSION=7.4.0 make.cross ARCH=powerpc
>>>>>
>>>>> If you fix the issue, kindly add following tag
>>>>> Reported-by: kbuild test robot <lkp@intel.com>
>>>>>
>>>>> All errors (new ones prefixed by >>):
>>>>>
>>>>>      mm/gup.c: In function 'gup_hugepte':
>>>>>>> mm/gup.c:1990:33: error: 'write' undeclared (first use in this function); did you mean 'writeq'?
>>>>>        if (!pte_access_permitted(pte, write))
>>>>>                                       ^~~~~
>>>>>                                       writeq
>>>>>      mm/gup.c:1990:33: note: each undeclared identifier is reported only once for each function it appears in
>>>>>
>>>>
>>>> OK, so this shows that my cross-compiler test scripts are faulty lately,
>>>> sorry I missed this.
>>>>
>>>> But more importantly, the above missed case is an example of when "write" really
>>>> means "write", as opposed to meaning flags.
>>>>
>>>> Please put this patch on hold or drop it, until we hear from the authors as to how
>>>> they would like to resolve this. I suspect it will end up as something like:
>>>>
>>>> 	bool write = (flags & FOLL_WRITE);
>>>>
>>>> ...perhaps?
>>>
>>> Just use
>>>
>>> 	if (!pte_access_permitted(pte, flags & FOLL_WRITE))
>>>
>>> as we have in gup_pte_range().
>>>
>>> And add:
>>>
>>> Fixes: cbd34da7dc9a ("mm: move the powerpc hugepd code to mm/gup.c")
>>>
>>
>> b798bec4741bdd80224214fdd004c8e52698e42 isn't this the commit that need to
>> be mentioned in the Fixes: tag?
> 
> Yes, and while we are at it the type should probably be changed to unsigned
> int.
> 

OK, I'm posting a v2 with all the above, thanks for these reviews!


thanks,

John Hubbard
NVIDIA


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

end of thread, other threads:[~2019-10-14 18:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-13 22:11 [PATCH 0/2] gup.c, gup_benchmark.c trivial fixes before the storm John Hubbard
2019-10-13 22:11 ` [PATCH 1/2] mm/gup_benchmark: add a missing "w" to getopt string John Hubbard
2019-10-14 13:36   ` Kirill A. Shutemov
2019-10-13 22:11 ` [PATCH 2/2] mm/gup: fix a misnamed "write" argument: should be "flags" John Hubbard
2019-10-14  6:12   ` kbuild test robot
2019-10-14  6:43     ` John Hubbard
2019-10-14 13:52       ` Kirill A. Shutemov
2019-10-14 14:44         ` Aneesh Kumar K.V
2019-10-14 14:51           ` Kirill A. Shutemov
2019-10-14 16:45           ` Ira Weiny
2019-10-14 18:39             ` John Hubbard

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