Re: [PATCH 4/4] x86: use pte_none() to test for empty PTE

From: Dave Hansen
Date: Wed Jul 13 2016 - 12:29:38 EST


On 07/13/2016 08:49 AM, Julia Lawall wrote:
> My results are below. There are a couple of cases in arch/mn10300/mm that
> were not in the original patch.

Yeah, so mn10300 is obviously unaffected by the erratum in question, and
I didn't look for non-x86 architectures for this patch.

But, this code definitely _looks_ like it should be using pte_none(),
especially since mn10300 defines it the same way as x86 (well, as x86
_did_ before this series).

#define pte_none(x) (!pte_val(x))

> diff -u -p a/arch/mn10300/mm/cache-inv-icache.c b/arch/mn10300/mm/cache-inv-icache.c
> --- a/arch/mn10300/mm/cache-inv-icache.c
> +++ b/arch/mn10300/mm/cache-inv-icache.c
> @@ -45,11 +45,11 @@ static void flush_icache_page_range(unsi
> return;
>
> pud = pud_offset(pgd, start);
> - if (!pud || !pud_val(*pud))
> + if (!pud || pud_none(*pud))
> return;
>
> pmd = pmd_offset(pud, start);
> - if (!pmd || !pmd_val(*pmd))
> + if (!pmd || pmd_none(*pmd))
> return;