mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 13/16] ARM: LPAE: Add identity mapping support for the 3-level page table format
Date: Thu, 10 Nov 2011 22:55:17 +0000	[thread overview]
Message-ID: <20111110225517.GW12913@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1320682618-1182-14-git-send-email-catalin.marinas@arm.com>

On Mon, Nov 07, 2011 at 04:16:55PM +0000, Catalin Marinas wrote:
> With LPAE, the pgd is a separate page table with entries pointing to the
> pmd. The identity_mapping_add() function needs to ensure that the pgd is
> populated before populating the pmd level. The do..while blocks now loop
> over the pmd in order to have the same implementation for the two page
> table formats. The pmd_addr_end() definition has been removed and the
> generic one used instead. The pmd clean-up is done in the pgd_free()
> function.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  arch/arm/mm/idmap.c |   36 ++++++++++++++++++++++++++++++++++--
>  1 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
> index 2be9139..24e0655 100644
> --- a/arch/arm/mm/idmap.c
> +++ b/arch/arm/mm/idmap.c
> @@ -1,9 +1,36 @@
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +

I don't like this kind of thing in core files, it doesn't really provide
much additional inforamtion above the message given.

>  #include <linux/kernel.h>
>  
>  #include <asm/cputype.h>
>  #include <asm/pgalloc.h>
>  #include <asm/pgtable.h>
>  
> +#ifdef CONFIG_ARM_LPAE
> +static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
> +	unsigned long prot)
> +{
> +	pmd_t *pmd;
> +	unsigned long next;
> +
> +	if (pud_none_or_clear_bad(pud) || (pud_val(*pud) & L_PGD_SWAPPER)) {
> +		pmd = pmd_alloc_one(NULL, addr);

This should be &init_mm, not NULL.

> +		if (!pmd) {
> +			pr_warning("Failed to allocate identity pmd.\n");

This message implies its from idmap - "identity pmd".

> +			return;
> +		}
> +		pud_populate(NULL, pud, pmd);

This should be &init_mm, not NULL.

> +		pmd += pmd_index(addr);
> +	} else
> +		pmd = pmd_offset(pud, addr);
> +
> +	do {
> +		next = pmd_addr_end(addr, end);
> +		*pmd = __pmd((addr & PMD_MASK) | prot);
> +		flush_pmd_entry(pmd);
> +	} while (pmd++, addr = next, addr != end);
> +}
> +#else	/* !CONFIG_ARM_LPAE */

I'm not convinced about the wiseness of this.  One of the places where
this code is called is from the reboot paths, which can happen in atomic
context.  Trying to allocate memory in such a context is going to lead
to problems, especially if support for panic'ing on OOM, and rebooting
on panic'ing are both enabled.

Therefore, I think this patch depends on the work Will has been doing to
re-structure the kexec and restart support.

  reply	other threads:[~2011-11-10 22:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 16:16 [PATCH v8 00/16] ARM: Add support for the Large Physical Address Extensions Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 01/16] ARM: pgtable: switch to use pgtable-nopud.h Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 02/16] ARM: pgtable: Fix compiler warning in ioremap.c introduced by nopud Catalin Marinas
2011-11-10 22:42   ` Russell King - ARM Linux
2011-11-07 16:16 ` [PATCH v8 03/16] ARM: LPAE: Move page table maintenance macros to pgtable-2level.h Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 04/16] ARM: LPAE: Move the FSR definitions to separate files Catalin Marinas
2011-11-10 22:45   ` Russell King - ARM Linux
2011-11-10 23:44   ` Tony Lindgren
2011-11-07 16:16 ` [PATCH v8 05/16] ARM: LPAE: Factor out classic-MMU specific code into proc-v7-2level.S Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 06/16] ARM: LPAE: add ISBs around MMU enabling code Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 07/16] ARM: LPAE: Introduce the 3-level page table format definitions Catalin Marinas
2011-11-10 21:53   ` Nicolas Pitre
2011-11-11 10:49     ` Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 08/16] ARM: LPAE: Page table maintenance for the 3-level format Catalin Marinas
2011-11-10 21:59   ` Nicolas Pitre
2011-11-11 10:54     ` Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 09/16] ARM: LPAE: MMU setup for the 3-level page table format Catalin Marinas
2011-11-10 22:24   ` Nicolas Pitre
2011-11-10 22:38     ` Russell King - ARM Linux
2011-11-11 11:17       ` Catalin Marinas
2011-11-11 11:00     ` Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 10/16] ARM: LPAE: Invalidate the TLB before freeing the PMD Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 11/16] ARM: LPAE: Add fault handling support Catalin Marinas
2011-11-10 22:46   ` Russell King - ARM Linux
2011-11-07 16:16 ` [PATCH v8 12/16] ARM: LPAE: Add context switching support Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 13/16] ARM: LPAE: Add identity mapping support for the 3-level page table format Catalin Marinas
2011-11-10 22:55   ` Russell King - ARM Linux [this message]
2011-11-11 11:36     ` Catalin Marinas
2011-11-11 11:58       ` Will Deacon
2011-11-07 16:16 ` [PATCH v8 14/16] ARM: LPAE: mark memory banks with start > ULONG_MAX as highmem Catalin Marinas
2011-11-09 20:41   ` Nicolas Pitre
2011-11-07 16:16 ` [PATCH v8 15/16] ARM: LPAE: add support for ATAG_MEM64 Catalin Marinas
2011-11-08 16:54   ` Stephen Boyd
2011-11-08 16:59     ` Catalin Marinas
2011-11-08 23:38   ` Nicolas Pitre
2011-11-09  0:24     ` Will Deacon
2011-11-09 10:44     ` Catalin Marinas
2011-11-07 16:16 ` [PATCH v8 16/16] ARM: LPAE: Add the Kconfig entries Catalin Marinas
2011-11-10 22:57   ` Russell King - ARM Linux
2011-11-11 11:46     ` Catalin Marinas
2011-11-11 13:24       ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111110225517.GW12913@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®