All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Execute WP test after interrupts are enabled
Date: Tue, 25 Aug 2009 12:34:21 -0700	[thread overview]
Message-ID: <4A943CBD.60808@goop.org> (raw)
In-Reply-To: <1251227779-24347-1-git-send-email-penberg@cs.helsinki.fi>

On 08/25/09 12:16, Pekka Enberg wrote:
> Commit 83b519e8b9572c319c8e0c615ee5dd7272856090 ("slab: setup allocators
> earlier in the boot sequence") changed the boot sequence to call
> mem_init() early. Unfortunately Xen is not prepared to handle the WP test at
> that point so we need to make the test run later.
>
> This patch fixes the Xen boot failures reported by Arnd Hannemann.
>   

I don't think this is the real fix, and it seems a bit ugly.  I'm OK
with it as a workaround, but I think it will end up getting reverted if
applied.

    J

> Reported-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> Tested-by: Arnd Hannemann <hannemann@nets.rwth-aachen.de>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
>  arch/x86/Kconfig      |    5 +++++
>  arch/x86/mm/init_32.c |   10 +++++++---
>  include/linux/mm.h    |    8 ++++++++
>  init/main.c           |    1 +
>  4 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 13ffa5d..b6ff185 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -50,6 +50,7 @@ config X86
>  	select HAVE_KERNEL_BZIP2
>  	select HAVE_KERNEL_LZMA
>  	select HAVE_ARCH_KMEMCHECK
> +	select HAVE_ARCH_MEM_INIT_LATE if X86_32
>  
>  config OUTPUT_FORMAT
>  	string
> @@ -86,6 +87,10 @@ config STACKTRACE_SUPPORT
>  config HAVE_LATENCYTOP_SUPPORT
>  	def_bool y
>  
> +config HAVE_ARCH_MEM_INIT_LATE
> +	def_bool y
> +	depends on X86_32
> +
>  config FAST_CMPXCHG_LOCAL
>  	bool
>  	default y
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 3cd7711..488ed4b 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -956,13 +956,17 @@ void __init mem_init(void)
>  	BUG_ON(VMALLOC_START				>= VMALLOC_END);
>  	BUG_ON((unsigned long)high_memory		> VMALLOC_START);
>  
> -	if (boot_cpu_data.wp_works_ok < 0)
> -		test_wp_bit();
> -
>  	save_pg_dir();
>  	zap_low_mappings(true);
>  }
>  
> +void __init mem_init_late(void)
> +{
> +	/* Interrupts are enabled at this point. */
> +	if (boot_cpu_data.wp_works_ok < 0)
> +		test_wp_bit();
> +}
> +
>  #ifdef CONFIG_MEMORY_HOTPLUG
>  int arch_add_memory(int nid, u64 start, u64 size)
>  {
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 9a72cc7..eefcfbe 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1052,6 +1052,14 @@ extern void si_meminfo(struct sysinfo * val);
>  extern void si_meminfo_node(struct sysinfo *val, int nid);
>  extern int after_bootmem;
>  
> +#ifdef CONFIG_HAVE_ARCH_MEM_INIT_LATE
> +extern void mem_init_late(void);
> +#else
> +static inline void mem_init_late(void)
> +{
> +}
> +#endif
> +
>  #ifdef CONFIG_NUMA
>  extern void setup_per_cpu_pageset(void);
>  #else
> diff --git a/init/main.c b/init/main.c
> index 2d9d6bd..45d8dbd 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -643,6 +643,7 @@ asmlinkage void __init start_kernel(void)
>  	set_gfp_allowed_mask(__GFP_BITS_MASK);
>  
>  	kmem_cache_init_late();
> +	mem_init_late();
>  
>  	/*
>  	 * HACK ALERT! This is early. We're enabling the console before
>   


  reply	other threads:[~2009-08-25 19:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25 19:16 [PATCH] x86: Execute WP test after interrupts are enabled Pekka Enberg
2009-08-25 19:34 ` Jeremy Fitzhardinge [this message]
2009-08-25 19:38   ` Pekka Enberg
2009-08-25 19:53     ` Jeremy Fitzhardinge
2009-08-25 19:58       ` Pekka Enberg
2009-08-25 20:03         ` Ingo Molnar
2009-08-25 20:03       ` Arnd Hannemann
2009-08-25 19:37 ` Brian Gerst
2009-08-25 19:53   ` Jeremy Fitzhardinge

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=4A943CBD.60808@goop.org \
    --to=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.