All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@in.ibm.com>
To: Bernhard Walle <bwalle@suse.de>
Cc: akpm@linux-foundation.org, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, ak@suse.de
Subject: Re: [patch 2/3] Introduce BOOTMEM_EXCLUSIVE
Date: Wed, 17 Oct 2007 16:35:51 +0530	[thread overview]
Message-ID: <20071017110550.GB17565@in.ibm.com> (raw)
In-Reply-To: <20071016162858.545617122@strauss.suse.de>


[..]
> +/*
> + * If flags is 0, then the return value is always 0 (success). If
> + * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
> + * memory already was reserved.
> + */
> +extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
>  #define alloc_bootmem(x) \
>  	__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
>  #define alloc_bootmem_low(x) \
> --- a/mm/bootmem.c
> +++ b/mm/bootmem.c
> @@ -111,8 +111,8 @@ static unsigned long __init init_bootmem
>   * might be used for boot-time allocations - or it might get added
>   * to the free page pool later on.
>   */
> -static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
> -					unsigned long size)
> +static int __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
> +					unsigned long size, int flags)
>  {
>  	unsigned long sidx, eidx;
>  	unsigned long i;
> @@ -133,7 +133,11 @@ static void __init reserve_bootmem_core(
>  #ifdef CONFIG_DEBUG_BOOTMEM
>  			printk("hm, page %08lx reserved twice.\n", i*PAGE_SIZE);
>  #endif
> +			if (flags & BOOTMEM_EXCLUSIVE)
> +				return -EBUSY;

I think we should unreserve the chunks of memory we have reserved so
far (Memory reserved from sidx to i), in case of error.

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Vivek Goyal <vgoyal@in.ibm.com>
To: Bernhard Walle <bwalle@suse.de>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	akpm@linux-foundation.org, ak@suse.de
Subject: Re: [patch 2/3] Introduce BOOTMEM_EXCLUSIVE
Date: Wed, 17 Oct 2007 16:35:51 +0530	[thread overview]
Message-ID: <20071017110550.GB17565@in.ibm.com> (raw)
In-Reply-To: <20071016162858.545617122@strauss.suse.de>


[..]
> +/*
> + * If flags is 0, then the return value is always 0 (success). If
> + * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
> + * memory already was reserved.
> + */
> +extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
>  #define alloc_bootmem(x) \
>  	__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
>  #define alloc_bootmem_low(x) \
> --- a/mm/bootmem.c
> +++ b/mm/bootmem.c
> @@ -111,8 +111,8 @@ static unsigned long __init init_bootmem
>   * might be used for boot-time allocations - or it might get added
>   * to the free page pool later on.
>   */
> -static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
> -					unsigned long size)
> +static int __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
> +					unsigned long size, int flags)
>  {
>  	unsigned long sidx, eidx;
>  	unsigned long i;
> @@ -133,7 +133,11 @@ static void __init reserve_bootmem_core(
>  #ifdef CONFIG_DEBUG_BOOTMEM
>  			printk("hm, page %08lx reserved twice.\n", i*PAGE_SIZE);
>  #endif
> +			if (flags & BOOTMEM_EXCLUSIVE)
> +				return -EBUSY;

I think we should unreserve the chunks of memory we have reserved so
far (Memory reserved from sidx to i), in case of error.

Thanks
Vivek

  parent reply	other threads:[~2007-10-17 11:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16 16:28 [patch 0/3] Protect crashkernel against BSS overlap Bernhard Walle
2007-10-16 16:28 ` Bernhard Walle
2007-10-16 16:28 ` [patch 1/3] Add BSS to resource tree Bernhard Walle
2007-10-16 16:28   ` Bernhard Walle
2007-10-16 16:28 ` [patch 2/3] Introduce BOOTMEM_EXCLUSIVE Bernhard Walle
2007-10-16 16:28   ` Bernhard Walle
2007-10-16 18:08   ` Dave Hansen
2007-10-16 18:08     ` Dave Hansen
2007-10-16 18:44     ` Bernhard Walle
2007-10-16 18:44       ` Bernhard Walle
2007-10-16 18:58       ` Dave Hansen
2007-10-16 18:58         ` Dave Hansen
2007-10-17 11:05   ` Vivek Goyal [this message]
2007-10-17 11:05     ` Vivek Goyal
2007-10-17 11:36     ` Bernhard Walle
2007-10-17 11:36       ` Bernhard Walle
2007-10-18  4:32       ` Vivek Goyal
2007-10-18  4:32         ` Vivek Goyal
2007-10-18 11:15     ` Bernhard Walle
2007-10-18 11:15       ` Bernhard Walle
2007-10-16 16:29 ` [patch 3/3] Use BOOTMEM_EXCLUSIVE on x86 Bernhard Walle
2007-10-16 16:29   ` Bernhard Walle
  -- strict thread matches above, loose matches on Subject: below --
2007-10-18 11:15 [patch 0/3] Protect crashkernel against BSS overlap Bernhard Walle
2007-10-18 11:15 ` [patch 2/3] Introduce BOOTMEM_EXCLUSIVE Bernhard Walle
2007-10-18 11:15   ` Bernhard Walle

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=20071017110550.GB17565@in.ibm.com \
    --to=vgoyal@in.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=bwalle@suse.de \
    --cc=kexec@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 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.