[PATCH v4 3/5] powerpc/mce: Hookup derror (load/store) UE errors

Michael Ellerman mpe at ellerman.id.au
Mon Oct 16 16:36:02 AEDT 2017


Balbir Singh <bsingharora at gmail.com> writes:

> diff --git a/arch/powerpc/kernel/mce_power.c b/arch/powerpc/kernel/mce_power.c
> index b76ca19..0e584d5 100644
> --- a/arch/powerpc/kernel/mce_power.c
> +++ b/arch/powerpc/kernel/mce_power.c
> @@ -27,6 +27,36 @@
>  #include <asm/mmu.h>
>  #include <asm/mce.h>
>  #include <asm/machdep.h>
> +#include <asm/pgtable.h>
> +#include <asm/pte-walk.h>
> +#include <asm/sstep.h>
> +#include <asm/exception-64s.h>
> +
> +/*
> + * Convert an address related to an mm to a PFN. NOTE: we are in real
> + * mode, we could potentially race with page table updates.
> + */

That will blow some serious chunks if we're on pseries.

It seems it can't be triggered on pseries at the moment, but only
because of the feature section around the call to
machine_check_handle_early().

We should maybe move the powernv only code in here inside an #ifdef
POWERNV, just for documentation purposes. But we can do that later.

> +static unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr)
> +{
> +	pte_t *ptep;
> +	unsigned long flags;
> +	struct mm_struct *mm;
> +
> +	if (user_mode(regs))
> +		mm = current->mm;
> +	else
> +		mm = &init_mm;
> +
> +	local_irq_save(flags);
> +	if (mm == current->mm)
> +		ptep = find_current_mm_pte(mm->pgd, addr, NULL, NULL);
> +	else
> +		ptep = find_init_mm_pte(addr, NULL);
> +	local_irq_restore(flags);
> +	if (!ptep || pte_special(*ptep))
> +		return ULONG_MAX;
> +	return pte_pfn(*ptep);
> +}

cheers


More information about the Linuxppc-dev mailing list