* [akpm-mm:mm-unstable 39/428] include/linux/pgtable.h:235:36: error: expected expression before 'do'
@ 2025-09-13 4:53 kernel test robot
2025-09-13 6:03 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2025-09-13 4:53 UTC (permalink / raw)
To: Balbir Singh; +Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List
tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head: 8ded915c4409a5190b1c9c57c172d62ab5534274
commit: f6748cc302fdca7c486c6098f315bd4174f5c614 [39/428] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode()
config: s390-randconfig-002-20250913 (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509131255.x9EfvIGt-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/kasan.h:37,
from mm/kasan/shadow.c:14:
mm/kasan/shadow.c: In function 'kasan_populate_vmalloc_pte':
>> include/linux/pgtable.h:235:36: error: expected expression before 'do'
#define arch_enter_lazy_mmu_mode() do {} while (0)
^~
mm/kasan/shadow.c:322:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
(void)arch_enter_lazy_mmu_mode();
^~~~~~~~~~~~~~~~~~~~~~~~
mm/kasan/shadow.c: In function 'kasan_depopulate_vmalloc_pte':
>> include/linux/pgtable.h:235:36: error: expected expression before 'do'
#define arch_enter_lazy_mmu_mode() do {} while (0)
^~
mm/kasan/shadow.c:497:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
(void)arch_enter_lazy_mmu_mode();
^~~~~~~~~~~~~~~~~~~~~~~~
vim +/do +235 include/linux/pgtable.h
533c67e63584067 Kinsey Ho 2023-12-27 214
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 215) /*
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 216) * A facility to provide lazy MMU batching. This allows PTE updates and
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 217) * page invalidations to be delayed until a call to leave lazy MMU mode
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 218) * is issued. Some architectures may benefit from doing this, and it is
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 219) * beneficial for both shadow and direct mode hypervisors, which may batch
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 220) * the PTE updates which happen during this window. Note that using this
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 221) * interface requires that read hazards be removed from the code. A read
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 222) * hazard could result in the direct mode hypervisor case, since the actual
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 223) * write to the page tables may not yet have taken place, so reads though
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 224) * a raw PTE pointer after it has been modified are not guaranteed to be
691ee97e1a9de0c Ryan Roberts 2025-03-03 225 * up to date.
691ee97e1a9de0c Ryan Roberts 2025-03-03 226 *
691ee97e1a9de0c Ryan Roberts 2025-03-03 227 * In the general case, no lock is guaranteed to be held between entry and exit
691ee97e1a9de0c Ryan Roberts 2025-03-03 228 * of the lazy mode. So the implementation must assume preemption may be enabled
691ee97e1a9de0c Ryan Roberts 2025-03-03 229 * and cpu migration is possible; it must take steps to be robust against this.
691ee97e1a9de0c Ryan Roberts 2025-03-03 230 * (In practice, for user PTE updates, the appropriate page table lock(s) are
691ee97e1a9de0c Ryan Roberts 2025-03-03 231 * held, but for kernel PTE updates, no lock is held). Nesting is not permitted
691ee97e1a9de0c Ryan Roberts 2025-03-03 232 * and the mode cannot be used in interrupt context.
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 233) */
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 234) #ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 @235) #define arch_enter_lazy_mmu_mode() do {} while (0)
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 236) #define arch_leave_lazy_mmu_mode() do {} while (0)
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 237) #define arch_flush_lazy_mmu_mode() do {} while (0)
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 238) #endif
bcc6cc832573a99 Matthew Wilcox (Oracle 2023-08-02 239)
:::::: The code at line 235 was first introduced by commit
:::::: bcc6cc832573a99d1f935c89a28e2c71fd1aaf0c mm: add default definition of set_ptes()
:::::: TO: Matthew Wilcox (Oracle) <willy@infradead.org>
:::::: CC: Andrew Morton <akpm@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [akpm-mm:mm-unstable 39/428] include/linux/pgtable.h:235:36: error: expected expression before 'do'
2025-09-13 4:53 [akpm-mm:mm-unstable 39/428] include/linux/pgtable.h:235:36: error: expected expression before 'do' kernel test robot
@ 2025-09-13 6:03 ` Andrew Morton
2025-09-13 22:57 ` Balbir Singh
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2025-09-13 6:03 UTC (permalink / raw)
To: kernel test robot
Cc: Balbir Singh, oe-kbuild-all, Linux Memory Management List
On Sat, 13 Sep 2025 12:53:27 +0800 kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> head: 8ded915c4409a5190b1c9c57c172d62ab5534274
> commit: f6748cc302fdca7c486c6098f315bd4174f5c614 [39/428] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode()
> config: s390-randconfig-002-20250913 (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/config)
> compiler: s390-linux-gcc (GCC) 8.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202509131255.x9EfvIGt-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/kasan.h:37,
> from mm/kasan/shadow.c:14:
> mm/kasan/shadow.c: In function 'kasan_populate_vmalloc_pte':
> >> include/linux/pgtable.h:235:36: error: expected expression before 'do'
> #define arch_enter_lazy_mmu_mode() do {} while (0)
> ^~
> mm/kasan/shadow.c:322:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
> (void)arch_enter_lazy_mmu_mode();
> ^~~~~~~~~~~~~~~~~~~~~~~~
> mm/kasan/shadow.c: In function 'kasan_depopulate_vmalloc_pte':
> >> include/linux/pgtable.h:235:36: error: expected expression before 'do'
> #define arch_enter_lazy_mmu_mode() do {} while (0)
> ^~
Huh, thanks. Another reason why static inlines are better than macros.
> mm/kasan/shadow.c:497:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
> (void)arch_enter_lazy_mmu_mode();
> ^~~~~~~~~~~~~~~~~~~~~~~~
You can't do that with them!
I'll add this.
--- a/mm/kasan/shadow.c~kasan-fix-warnings-caused-by-use-of-arch_enter_lazy_mmu_mode-fix
+++ a/mm/kasan/shadow.c
@@ -319,7 +319,7 @@ static int kasan_populate_vmalloc_pte(pt
}
spin_unlock(&init_mm.page_table_lock);
- (void)arch_enter_lazy_mmu_mode();
+ arch_enter_lazy_mmu_mode();
return 0;
}
@@ -494,7 +494,7 @@ static int kasan_depopulate_vmalloc_pte(
if (likely(!none))
__free_page(pfn_to_page(pte_pfn(pte)));
- (void)arch_enter_lazy_mmu_mode();
+ arch_enter_lazy_mmu_mode();
return 0;
}
_
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [akpm-mm:mm-unstable 39/428] include/linux/pgtable.h:235:36: error: expected expression before 'do'
2025-09-13 6:03 ` Andrew Morton
@ 2025-09-13 22:57 ` Balbir Singh
2025-09-14 0:06 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Balbir Singh @ 2025-09-13 22:57 UTC (permalink / raw)
To: Andrew Morton, kernel test robot
Cc: oe-kbuild-all, Linux Memory Management List
On 9/13/25 16:03, Andrew Morton wrote:
> On Sat, 13 Sep 2025 12:53:27 +0800 kernel test robot <lkp@intel.com> wrote:
>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
>> head: 8ded915c4409a5190b1c9c57c172d62ab5534274
>> commit: f6748cc302fdca7c486c6098f315bd4174f5c614 [39/428] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode()
>> config: s390-randconfig-002-20250913 (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/config)
>> compiler: s390-linux-gcc (GCC) 8.5.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202509131255.x9EfvIGt-lkp@intel.com/
>>
>> All errors (new ones prefixed by >>):
>>
>> In file included from include/linux/kasan.h:37,
>> from mm/kasan/shadow.c:14:
>> mm/kasan/shadow.c: In function 'kasan_populate_vmalloc_pte':
>>>> include/linux/pgtable.h:235:36: error: expected expression before 'do'
>> #define arch_enter_lazy_mmu_mode() do {} while (0)
>> ^~
>> mm/kasan/shadow.c:322:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
>> (void)arch_enter_lazy_mmu_mode();
>> ^~~~~~~~~~~~~~~~~~~~~~~~
>> mm/kasan/shadow.c: In function 'kasan_depopulate_vmalloc_pte':
>>>> include/linux/pgtable.h:235:36: error: expected expression before 'do'
>> #define arch_enter_lazy_mmu_mode() do {} while (0)
>> ^~
>
> Huh, thanks. Another reason why static inlines are better than macros.
>
>> mm/kasan/shadow.c:497:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
>> (void)arch_enter_lazy_mmu_mode();
>> ^~~~~~~~~~~~~~~~~~~~~~~~
>
> You can't do that with them!
>
[...]
AFAICT, The issue I saw and fixed only occurs on top of
commit 116191f326bce79aefa0ed540caade5a55fbd33f
Author: Kevin Brodsky <kevin.brodsky@arm.com>
Date: Mon Sep 8 08:39:26 2025 +0100
mm: introduce local state for lazy_mmu sections
Which changes the definition of arch_*_lazy_mmu_mode
-#define arch_enter_lazy_mmu_mode() do {} while (0)
-#define arch_leave_lazy_mmu_mode() do {} while (0)
+typedef int lazy_mmu_state_t;
+
+#define arch_enter_lazy_mmu_mode() (LAZY_MMU_DEFAULT)
+#define arch_leave_lazy_mmu_mode(state) ((void)(state))
so I am a little confused with the bug report
Balbir Singh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [akpm-mm:mm-unstable 39/428] include/linux/pgtable.h:235:36: error: expected expression before 'do'
2025-09-13 22:57 ` Balbir Singh
@ 2025-09-14 0:06 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2025-09-14 0:06 UTC (permalink / raw)
To: Balbir Singh
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List
On Sun, 14 Sep 2025 08:57:29 +1000 Balbir Singh <balbirs@nvidia.com> wrote:
> On 9/13/25 16:03, Andrew Morton wrote:
> > On Sat, 13 Sep 2025 12:53:27 +0800 kernel test robot <lkp@intel.com> wrote:
> >
> >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> >> head: 8ded915c4409a5190b1c9c57c172d62ab5534274
> >> commit: f6748cc302fdca7c486c6098f315bd4174f5c614 [39/428] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode()
> >> config: s390-randconfig-002-20250913 (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/config)
> >> compiler: s390-linux-gcc (GCC) 8.5.0
> >> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250913/202509131255.x9EfvIGt-lkp@intel.com/reproduce)
> >>
> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> >> the same patch/commit), kindly add following tags
> >> | Reported-by: kernel test robot <lkp@intel.com>
> >> | Closes: https://lore.kernel.org/oe-kbuild-all/202509131255.x9EfvIGt-lkp@intel.com/
> >>
> >> All errors (new ones prefixed by >>):
> >>
> >> In file included from include/linux/kasan.h:37,
> >> from mm/kasan/shadow.c:14:
> >> mm/kasan/shadow.c: In function 'kasan_populate_vmalloc_pte':
> >>>> include/linux/pgtable.h:235:36: error: expected expression before 'do'
> >> #define arch_enter_lazy_mmu_mode() do {} while (0)
> >> ^~
> >> mm/kasan/shadow.c:322:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
> >> (void)arch_enter_lazy_mmu_mode();
> >> ^~~~~~~~~~~~~~~~~~~~~~~~
> >> mm/kasan/shadow.c: In function 'kasan_depopulate_vmalloc_pte':
> >>>> include/linux/pgtable.h:235:36: error: expected expression before 'do'
> >> #define arch_enter_lazy_mmu_mode() do {} while (0)
> >> ^~
> >
> > Huh, thanks. Another reason why static inlines are better than macros.
> >
> >> mm/kasan/shadow.c:497:8: note: in expansion of macro 'arch_enter_lazy_mmu_mode'
> >> (void)arch_enter_lazy_mmu_mode();
> >> ^~~~~~~~~~~~~~~~~~~~~~~~
> >
> > You can't do that with them!
> >
>
> [...]
>
> AFAICT, The issue I saw and fixed only occurs on top of
>
> commit 116191f326bce79aefa0ed540caade5a55fbd33f
> Author: Kevin Brodsky <kevin.brodsky@arm.com>
> Date: Mon Sep 8 08:39:26 2025 +0100
>
> mm: introduce local state for lazy_mmu sections
>
> Which changes the definition of arch_*_lazy_mmu_mode
>
> -#define arch_enter_lazy_mmu_mode() do {} while (0)
> -#define arch_leave_lazy_mmu_mode() do {} while (0)
> +typedef int lazy_mmu_state_t;
> +
> +#define arch_enter_lazy_mmu_mode() (LAZY_MMU_DEFAULT)
> +#define arch_leave_lazy_mmu_mode(state) ((void)(state))
>
No, this error happens on maainline + this-patch
#define arch_enter_lazy_mmu_mode() do {} while (0)
plus
(void)arch_enter_lazy_mmu_mode();
expands to
(void)do {} while (0)
which is nonsensical.
In fact let's do this:
From: Andrew Morton <akpm@linux-foundation.org>
Subject: include/linux/pgtable.h: convert arch_enter_lazy_mmu_mode() and friends to static inlines
Date: Sat Sep 13 05:03:39 PM PDT 2025
For all the usual reasons, plus a new one. Calling
(void)arch_enter_lazy_mmu_mode();
deservedly blows up.
Cc: Balbir Singh <balbirs@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/pgtable.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/include/linux/pgtable.h~include-linux-pgtableh-convert-arch_enter_lazy_mmu_mode-and-friends-to-static-inlines
+++ a/include/linux/pgtable.h
@@ -232,9 +232,9 @@ static inline int pmd_dirty(pmd_t pmd)
* and the mode cannot be used in interrupt context.
*/
#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
-#define arch_enter_lazy_mmu_mode() do {} while (0)
-#define arch_leave_lazy_mmu_mode() do {} while (0)
-#define arch_flush_lazy_mmu_mode() do {} while (0)
+static inline void arch_enter_lazy_mmu_mode(void) {}
+static inline void arch_leave_lazy_mmu_mode(void) {}
+static inline void arch_flush_lazy_mmu_mode(void) {}
#endif
#ifndef pte_batch_hint
_
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-14 0:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13 4:53 [akpm-mm:mm-unstable 39/428] include/linux/pgtable.h:235:36: error: expected expression before 'do' kernel test robot
2025-09-13 6:03 ` Andrew Morton
2025-09-13 22:57 ` Balbir Singh
2025-09-14 0:06 ` Andrew Morton
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).