mm: fix is_pinnable_page against on cma page
Subsystems (2)
PATCH v5 1/1 mm: fix is_pinnable_page against on cma page
Pages on CMA area could have MIGRATE_ISOLATE as well as MIGRATE_CMA so current is_pinnable_page could miss CMA pages which has MIGRATE_ ISOLATE. It ends up pinning CMA pages as longterm at pin_user_pages APIs so CMA allocation keep failed until the pin is released.
CPU 0 CPU 1 - Task B
cma_allocalloc_contig_range
pin_user_pages_fast(FOLL_LONGTERM)
change pageblock as MIGRATE_ISOLATE
internal_get_user_pages_fast lockless_pages_from_mm gup_pte_range try_grab_folio is_pinnable_page
return true;
So, pinned the page successfully.
page migration failure with pinned page
..
.. After 30 sec
unpin_user_page(page)CMA allocation succeeded after 30 sec.
The CMA allocation path protects the migration type change race using zone->lock but what GUP path need to know is just whether the page is on CMA area or not rather than exact migration type. Thus, we don't need zone->lock but just checks migration type in either of (MIGRATE_ISOLATE and MIGRATE_CMA).
Adding the MIGRATE_ISOLATE check in is_pinnable_page could cause rejecting of pinning pages on MIGRATE_ISOLATE pageblocks even though it's neither CMA nor movable zone if the page is temporarily unmovable. However, such a migration failure by unexpected temporal refcount holding is general issue, not only come from MIGRATE_ISOLATE and the MIGRATE_ISOLATE is also transient state like other temporal elevated refcount problem.
---
* from v4 - https://lore.kernel.org/all/[email protected]/
* clarification why we need READ_ONCE - Paul
* Adding a comment about READ_ONCE - John
* from v3 - https://lore.kernel.org/all/[email protected]/
* Fix typo and adding more description - akpm
* from v2 - https://lore.kernel.org/all/[email protected]/
* Use __READ_ONCE instead of volatile - akpm
* from v1 - https://lore.kernel.org/all/[email protected]/
* fix build warning - lkp
* fix refetching issue of migration type
* add side effect on !ZONE_MOVABLE and !MIGRATE_CMA in description - david
include/linux/mm.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
include/linux/mm.h +14 -2
@@ -1625,8 +1625,20 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,#ifdef CONFIG_MIGRATION static inline bool is_pinnable_page (struct page *page) { -return !(is_zone_movable_page (page) ||is_migrate_cma_page (page)) || -is_zero_pfn (page_to_pfn (page)); +#ifdef CONFIG_CMA +/* +* Defend against future compiler LTO features, or code refactoring +* that inlines the above function, by forcing a single read. Because, +* this routine races with set_pageblock_migratetype(), and we want to +* avoid reading zero, when actually one or the other flags was set. +*/ +int mt =__READ_ONCE (__mt); + +if (mt & (MIGRATE_CMA |MIGRATE_ISOLATE )) +return false; +#endif + +return !(is_zone_movable_page (page) ||is_zero_pfn (page_to_pfn (page))); }#else static inline bool is_pinnable_page (struct page *page)
Signature · 1 line
2.36.0.550.gb090851708-goog
Quoted 69 lines · Minchan Kim
Pages on CMA area could have
MIGRATE_ISOLATEas well asMIGRATE_CMAso currentis_pinnable_pagecould miss CMA pages which hasMIGRATE_ISOLATE. It ends up pinning CMA pages as longterm atpin_user_pagesAPIs so CMA allocation keep failed until the pin is released.CPU 0 CPU 1 - Task B
cma_allocalloc_contig_range
pin_user_pages_fast(FOLL_LONGTERM)
change pageblock asMIGRATE_ISOLATE
internal_get_user_pages_fastlockless_pages_from_mmgup_pte_rangetry_grab_foliois_pinnable_page
return true;
So, pinned the page successfully.
page migration failure with pinned page.. .. After 30 sec unpin_user_page(page)CMA allocation succeeded after 30 sec.
The CMA allocation path protects the migration type change race using
zone->lockbut what GUP path need to know is just whether the page is on CMA area or not rather than exact migration type. Thus, we don't needzone->lockbut just checks migration type in either of (MIGRATE_ISOLATEandMIGRATE_CMA).Adding the
MIGRATE_ISOLATEcheck inis_pinnable_pagecould cause rejecting of pinning pages onMIGRATE_ISOLATEpageblocks even though it's neither CMA nor movable zone if the page is temporarily unmovable. However, such a migration failure by unexpected temporal refcount holding is general issue, not only come fromMIGRATE_ISOLATEand theMIGRATE_ISOLATEis also transient state like other temporal elevated refcount problem.Cc "Paul E . McKenney" <[email protected]>Cc John Hubbard <[email protected]>Cc David Hildenbrand <[email protected]>Signed-off-by Minchan Kim <[email protected]>---
* from v4 - https://lore.kernel.org/all/[email protected]/
* clarification why we needREAD_ONCE- Paul
* Adding a comment aboutREAD_ONCE- John* from v3 - https://lore.kernel.org/all/[email protected]/
* Fix typo and adding more description - akpm* from v2 - https://lore.kernel.org/all/[email protected]/
* Use__READ_ONCEinstead of volatile - akpm* from v1 - https://lore.kernel.org/all/[email protected]/
* fix build warning - lkp
* fix refetching issue of migration type
* add side effect on !ZONE_MOVABLE and !MIGRATE_CMA in description - davidinclude/linux/mm.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)include/linux/mm.h +0
-0@@ -1625,8 +1625,20 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,#ifdef CONFIG_MIGRATION static inline bool is_pinnable_page (struct page *page)
include/linux/mm.h static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma, · line 1634
Quoted 10 lines
include/linux/mm.h +7
-2{ -return !(is_zone_movable_page (page) ||is_migrate_cma_page (page)) || -is_zero_pfn (page_to_pfn (page)); +#ifdef CONFIG_CMA +/* +* Defend against future compiler LTO features, or code refactoring +* that inlines the above function, by forcing a single read. Because, +* this routine races with set_pageblock_migratetype(), and we want to +* avoid reading zero, when actually one or the other flags was set. +*/
The most interesting line got dropped in this version. :)
This is missing:
int __mt = get_pageblock_migratetype(page);
Assuming that that is restored, please feel free to add:
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Quoted 10 lines
include/linux/mm.h +7
-0+int mt =__READ_ONCE (__mt); + +if (mt & (MIGRATE_CMA |MIGRATE_ISOLATE )) +return false; +#endif + +return !(is_zone_movable_page (page) ||is_zero_pfn (page_to_pfn (page))); }#else static inline bool is_pinnable_page (struct page *page)
Minchan Kim
Reviewed-by John HubbardQuoted 83 lines · John Hubbard
Quoted 69 lines · Minchan Kim
Pages on CMA area could have
MIGRATE_ISOLATEas well asMIGRATE_CMAso currentis_pinnable_pagecould miss CMA pages which hasMIGRATE_ISOLATE. It ends up pinning CMA pages as longterm atpin_user_pagesAPIs so CMA allocation keep failed until the pin is released.CPU 0 CPU 1 - Task B
cma_allocalloc_contig_range
pin_user_pages_fast(FOLL_LONGTERM)
change pageblock asMIGRATE_ISOLATE
internal_get_user_pages_fastlockless_pages_from_mmgup_pte_rangetry_grab_foliois_pinnable_page
return true;
So, pinned the page successfully.
page migration failure with pinned page.. .. After 30 sec unpin_user_page(page)CMA allocation succeeded after 30 sec.
The CMA allocation path protects the migration type change race using
zone->lockbut what GUP path need to know is just whether the page is on CMA area or not rather than exact migration type. Thus, we don't needzone->lockbut just checks migration type in either of (MIGRATE_ISOLATEandMIGRATE_CMA).Adding the
MIGRATE_ISOLATEcheck inis_pinnable_pagecould cause rejecting of pinning pages onMIGRATE_ISOLATEpageblocks even though it's neither CMA nor movable zone if the page is temporarily unmovable. However, such a migration failure by unexpected temporal refcount holding is general issue, not only come fromMIGRATE_ISOLATEand theMIGRATE_ISOLATEis also transient state like other temporal elevated refcount problem.Cc "Paul E . McKenney" <[email protected]>Cc John Hubbard <[email protected]>Cc David Hildenbrand <[email protected]>Signed-off-by Minchan Kim <[email protected]>---
* from v4 - https://lore.kernel.org/all/[email protected]/
* clarification why we needREAD_ONCE- Paul
* Adding a comment aboutREAD_ONCE- John* from v3 - https://lore.kernel.org/all/[email protected]/
* Fix typo and adding more description - akpm* from v2 - https://lore.kernel.org/all/[email protected]/
* Use__READ_ONCEinstead of volatile - akpm* from v1 - https://lore.kernel.org/all/[email protected]/
* fix build warning - lkp
* fix refetching issue of migration type
* add side effect on !ZONE_MOVABLE and !MIGRATE_CMA in description - davidinclude/linux/mm.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)include/linux/mm.h +0
-0@@ -1625,8 +1625,20 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,#ifdef CONFIG_MIGRATION static inline bool is_pinnable_page (struct page *page)include/linux/mm.h static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma, · line 1634
Quoted 10 lines
include/linux/mm.h +7
-2{ -return !(is_zone_movable_page (page) ||is_migrate_cma_page (page)) || -is_zero_pfn (page_to_pfn (page)); +#ifdef CONFIG_CMA +/* +* Defend against future compiler LTO features, or code refactoring +* that inlines the above function, by forcing a single read. Because, +* this routine races with set_pageblock_migratetype(), and we want to +* avoid reading zero, when actually one or the other flags was set. +*/ The most interesting line got dropped in this version. :)
Quoted 7 lines
This is missing:
int __mt = get_pageblock_migratetype(page);Assuming that that is restored, please feel free to add:
Reviewed-by John Hubbard <[email protected]>
Just caught after clicked the button with my fat finger :(
Thanks, John!
Andrew, Could you pick this up?
From 90ad049d48f5c36075f17ac996dfe3c33127aeb6 Mon Sep 17 00:00:00 2001
From: Minchan Kim <[email protected]>
Date: Mon, 2 May 2022 10:03:48 -0700
Subject: [PATCH v5] mm: fix is_pinnable_page against on cma page
Pages on CMA area could have MIGRATE_ISOLATE as well as MIGRATE_CMA so current is_pinnable_page could miss CMA pages which has MIGRATE_ ISOLATE. It ends up pinning CMA pages as longterm at pin_user_pages APIs so CMA allocation keep failed until the pin is released.
CPU 0 CPU 1 - Task B
cma_allocalloc_contig_range
pin_user_pages_fast(FOLL_LONGTERM)
change pageblock as MIGRATE_ISOLATE
internal_get_user_pages_fast lockless_pages_from_mm gup_pte_range try_grab_folio is_pinnable_page
return true;
So, pinned the page successfully.
page migration failure with pinned page
..
.. After 30 sec
unpin_user_page(page)CMA allocation succeeded after 30 sec.
The CMA allocation path protects the migration type change race using zone->lock but what GUP path need to know is just whether the page is on CMA area or not rather than exact migration type. Thus, we don't need zone->lock but just checks migration type in either of (MIGRATE_ISOLATE and MIGRATE_CMA).
Adding the MIGRATE_ISOLATE check in is_pinnable_page could cause rejecting of pinning pages on MIGRATE_ISOLATE pageblocks even though it's neither CMA nor movable zone if the page is temporarily unmovable. However, such a migration failure by unexpected temporal refcount holding is general issue, not only come from MIGRATE_ISOLATE and the MIGRATE_ISOLATE is also transient state like other temporal elevated refcount problem.
---
* from v4 - https://lore.kernel.org/all/[email protected]/
* clarification why we need READ_ONCE - Paul
* Adding a comment about READ_ONCE - John
* from v3 - https://lore.kernel.org/all/[email protected]/
* Fix typo and adding more description - akpm
* from v2 - https://lore.kernel.org/all/[email protected]/
* Use __READ_ONCE instead of volatile - akpm
* from v1 - https://lore.kernel.org/all/[email protected]/
* fix build warning - lkp
* fix refetching issue of migration type
* add side effect on !ZONE_MOVABLE and !MIGRATE_CMA in description - david
include/linux/mm.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
include/linux/mm.h +15 -2
@@ -1625,8 +1625,21 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,#ifdef CONFIG_MIGRATION static inline bool is_pinnable_page (struct page *page) { -return !(is_zone_movable_page (page) ||is_migrate_cma_page (page)) || -is_zero_pfn (page_to_pfn (page)); +#ifdef CONFIG_CMA +/* +* Defend against future compiler LTO features, or code refactoring +* that inlines the above function, by forcing a single read. Because, +* this routine races with set_pageblock_migratetype(), and we want to +* avoid reading zero, when actually one or the other flags was set. +*/ +int __mt =get_pageblock_migratetype (page); +int mt =__READ_ONCE (__mt); + +if (mt & (MIGRATE_CMA |MIGRATE_ISOLATE )) +return false; +#endif + +return !(is_zone_movable_page (page) ||is_zero_pfn (page_to_pfn (page))); }#else static inline bool is_pinnable_page (struct page *page)
Signature · 1 line
2.36.0.550.gb090851708-goog
kernel test robot
build botI love your patch! Yet something to improve:
Hi Minchan,
I love your patch! Yet something to improve:
[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.18-rc6]
[cannot apply to akpm-mm/mm-everything next-20220512]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Minchan-Kim/mm-fix-is_pinnable_page-against-on-cma-page/20220513-044258 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0ac824f379fba2c2b17b75fd5ada69cd68c66348 config: mips-randconfig-c004-20220512 (https://download.01.org/0day-ci/archive/20220513/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9519dacab7b8afd537811fc2abaceb4d14f4e16a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/cde6db32b52d5224e61443e12ccbc4c11fc583b0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Minchan-Kim/mm-fix-is_pinnable_page-against-on-cma-page/20220513-044258 git checkout cde6db32b52d5224e61443e12ccbc4c11fc583b0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips prepare
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
In file included from arch/mips/kernel/asm-offsets.c:15:
>> include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
int mt = __READ_ONCE(__mt);
^
>> include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
arch/mips/kernel/asm-offsets.c:26:6: warning: no previous prototype for function 'output_ptreg_defines' [-Wmissing-prototypes]
void output_ptreg_defines(void)
^
arch/mips/kernel/asm-offsets.c:26:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_ptreg_defines(void)
^
static
arch/mips/kernel/asm-offsets.c:78:6: warning: no previous prototype for function 'output_task_defines' [-Wmissing-prototypes]
void output_task_defines(void)
^
arch/mips/kernel/asm-offsets.c:78:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_task_defines(void)
^
static
arch/mips/kernel/asm-offsets.c:92:6: warning: no previous prototype for function 'output_thread_info_defines' [-Wmissing-prototypes]
void output_thread_info_defines(void)
^
arch/mips/kernel/asm-offsets.c:92:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_thread_info_defines(void)
^
static
arch/mips/kernel/asm-offsets.c:108:6: warning: no previous prototype for function 'output_thread_defines' [-Wmissing-prototypes]
void output_thread_defines(void)
^
arch/mips/kernel/asm-offsets.c:108:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_thread_defines(void)
^
static
arch/mips/kernel/asm-offsets.c:179:6: warning: no previous prototype for function 'output_mm_defines' [-Wmissing-prototypes]
void output_mm_defines(void)
^
arch/mips/kernel/asm-offsets.c:179:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_mm_defines(void)
^
static
arch/mips/kernel/asm-offsets.c:218:6: warning: no previous prototype for function 'output_sc_defines' [-Wmissing-prototypes]
void output_sc_defines(void)
^
arch/mips/kernel/asm-offsets.c:218:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_sc_defines(void)
^
static
arch/mips/kernel/asm-offsets.c:253:6: warning: no previous prototype for function 'output_signal_defined' [-Wmissing-prototypes]
void output_signal_defined(void)
^
arch/mips/kernel/asm-offsets.c:253:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void output_signal_defined(void)
^
static
arch/mips/kernel/asm-offsets.c:332:6: warning: no previous prototype for function 'output_pm_defines' [-Wmissing-prototypes]
void output_pm_defines(void)
^ arch/mips/kernel/asm-offsets.c:332:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void output_pm_defines(void)
^
static
8 warnings and 2 errors generated.
make[2]: *** [scripts/Makefile.build:120: arch/mips/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1194: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:219: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.
vim +/__mt +1603 include/linux/mm.h
1591
1592 /* MIGRATE_CMA and ZONE_MOVABLE do not allow pin pages */
1593 #ifdef CONFIG_MIGRATION
1594 static inline bool is_pinnable_page(struct page *page)
1595 {
1596 #ifdef CONFIG_CMA
1597 /*
1598 * Defend against future compiler LTO features, or code refactoring
1599 * that inlines the above function, by forcing a single read. Because,
1600 * this routine races with set_pageblock_migratetype(), and we want to
1601 * avoid reading zero, when actually one or the other flags was set.
1602 */
> 1603 int mt = __READ_ONCE(__mt);
1604
1605 if (mt & (MIGRATE_CMA | MIGRATE_ISOLATE))
1606 return false;
1607 #endif
1608
1609 return !(is_zone_movable_page(page) || is_zero_pfn(page_to_pfn(page)));
1610 }
1611 #else
1612 static inline bool is_pinnable_page(struct page *page)
1613 {
1614 return true;
1615 }
1616 #endif
1617
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi Minchan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.18-rc6]
[cannot apply to akpm-mm/mm-everything next-20220512]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Minchan-Kim/mm-fix-is_pinnable_page-against-on-cma-page/20220513-044258 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0ac824f379fba2c2b17b75fd5ada69cd68c66348 config: hexagon-randconfig-r045-20220512 (https://download.01.org/0day-ci/archive/20220513/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9519dacab7b8afd537811fc2abaceb4d14f4e16a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/cde6db32b52d5224e61443e12ccbc4c11fc583b0
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Minchan-Kim/mm-fix-is_pinnable_page-against-on-cma-page/20220513-044258
git checkout cde6db32b52d5224e61443e12ccbc4c11fc583b0
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/adc/ drivers/mmc/core/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from drivers/iio/adc/fsl-imx25-gcq.c:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:20:
include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
int mt = __READ_ONCE(__mt);
^
include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
>> drivers/iio/adc/fsl-imx25-gcq.c:115:8: warning: shift count is negative [-Wshift-count-negative]
MX25_ADCQ_ITEM(0, chan->channel));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/mfd/imx25-tsadc.h:54:3: note: expanded from macro 'MX25_ADCQ_ITEM'
_MX25_ADCQ_ITEM((item) - 8, (x)) : _MX25_ADCQ_ITEM((item), (x)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/mfd/imx25-tsadc.h:52:39: note: expanded from macro '_MX25_ADCQ_ITEM'
#define _MX25_ADCQ_ITEM(item, x) ((x) << ((item) * 4))
^ ~~~~~~~~~~~~ 1 warning and 2 errors generated.
--
In file included from drivers/mmc/core/mmc.c:17:
In file included from include/linux/mmc/host.h:18:
In file included from include/linux/blk-crypto-profile.h:9:
In file included from include/linux/bio.h:10:
In file included from include/linux/blk_types.h:10:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:9:
include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
int mt = __READ_ONCE(__mt);
^
include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
>> drivers/mmc/core/mmc.c:108:22: warning: shift count >= width of type [-Wshift-count-overflow]
card->cid.serial = UNSTUFF_BITS(resp, 16, 32);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/core/mmc.c:56:39: note: expanded from macro 'UNSTUFF_BITS'
const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
^ ~~~~~~ 1 warning and 2 errors generated.
--
In file included from drivers/mmc/core/sd.c:15:
In file included from include/linux/scatterlist.h:8:
include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
int mt = __READ_ONCE(__mt);
^
include/linux/mm.h:1603:23: error: use of undeclared identifier '__mt'
>> drivers/mmc/core/sd.c:99:22: warning: shift count >= width of type [-Wshift-count-overflow]
card->cid.serial = UNSTUFF_BITS(resp, 24, 32);
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/core/sd.c:60:39: note: expanded from macro 'UNSTUFF_BITS'
const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
^ ~~~~~~1 warning and 2 errors generated.
vim +115 drivers/iio/adc/fsl-imx25-gcq.c
6df2e98c3ea567 Markus Pargmann 2015-12-14 104
6df2e98c3ea567 Markus Pargmann 2015-12-14 105 static int mx25_gcq_get_raw_value(struct device *dev,
6df2e98c3ea567 Markus Pargmann 2015-12-14 106 struct iio_chan_spec const *chan,
6df2e98c3ea567 Markus Pargmann 2015-12-14 107 struct mx25_gcq_priv *priv,
6df2e98c3ea567 Markus Pargmann 2015-12-14 108 int *val)
6df2e98c3ea567 Markus Pargmann 2015-12-14 109 {
6df2e98c3ea567 Markus Pargmann 2015-12-14 110 long timeout;
6df2e98c3ea567 Markus Pargmann 2015-12-14 111 u32 data;
6df2e98c3ea567 Markus Pargmann 2015-12-14 112
6df2e98c3ea567 Markus Pargmann 2015-12-14 113 /* Setup the configuration we want to use */
6df2e98c3ea567 Markus Pargmann 2015-12-14 114 regmap_write(priv->regs, MX25_ADCQ_ITEM_7_0,
6df2e98c3ea567 Markus Pargmann 2015-12-14 @115 MX25_ADCQ_ITEM(0, chan->channel));
6df2e98c3ea567 Markus Pargmann 2015-12-14 116
6df2e98c3ea567 Markus Pargmann 2015-12-14 117 regmap_update_bits(priv->regs, MX25_ADCQ_MR, MX25_ADCQ_MR_EOQ_IRQ, 0);
6df2e98c3ea567 Markus Pargmann 2015-12-14 118
6df2e98c3ea567 Markus Pargmann 2015-12-14 119 /* Trigger queue for one run */
6df2e98c3ea567 Markus Pargmann 2015-12-14 120 regmap_update_bits(priv->regs, MX25_ADCQ_CR, MX25_ADCQ_CR_FQS,
6df2e98c3ea567 Markus Pargmann 2015-12-14 121 MX25_ADCQ_CR_FQS);
6df2e98c3ea567 Markus Pargmann 2015-12-14 122
6df2e98c3ea567 Markus Pargmann 2015-12-14 123 timeout = wait_for_completion_interruptible_timeout(
6df2e98c3ea567 Markus Pargmann 2015-12-14 124 &priv->completed, MX25_GCQ_TIMEOUT);
6df2e98c3ea567 Markus Pargmann 2015-12-14 125 if (timeout < 0) {
6df2e98c3ea567 Markus Pargmann 2015-12-14 126 dev_err(dev, "ADC wait for measurement failed\n");
6df2e98c3ea567 Markus Pargmann 2015-12-14 127 return timeout;
6df2e98c3ea567 Markus Pargmann 2015-12-14 128 } else if (timeout == 0) {
6df2e98c3ea567 Markus Pargmann 2015-12-14 129 dev_err(dev, "ADC timed out\n");
6df2e98c3ea567 Markus Pargmann 2015-12-14 130 return -ETIMEDOUT;
6df2e98c3ea567 Markus Pargmann 2015-12-14 131 }
6df2e98c3ea567 Markus Pargmann 2015-12-14 132
6df2e98c3ea567 Markus Pargmann 2015-12-14 133 regmap_read(priv->regs, MX25_ADCQ_FIFO, &data);
6df2e98c3ea567 Markus Pargmann 2015-12-14 134
6df2e98c3ea567 Markus Pargmann 2015-12-14 135 *val = MX25_ADCQ_FIFO_DATA(data);
6df2e98c3ea567 Markus Pargmann 2015-12-14 136
6df2e98c3ea567 Markus Pargmann 2015-12-14 137 return IIO_VAL_INT;
6df2e98c3ea567 Markus Pargmann 2015-12-14 138 }
6df2e98c3ea567 Markus Pargmann 2015-12-14 139 Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp