All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: Mike Kravetz <kravetz@us.ibm.com>
Cc: linux-mm <linux-mm@kvack.org>, "Luck, Tony" <tony.luck@intel.com>,
	linux-ia64@vger.kernel.org, "Martin J. Bligh" <mbligh@mbligh.org>
Subject: Re: [PATCH] gurantee DMA area for alloc_bootmem_low()
Date: Fri, 15 Jul 2005 02:43:27 +0000	[thread overview]
Message-ID: <20050715113303.2EB8.Y-GOTO@jp.fujitsu.com> (raw)
In-Reply-To: <20050713220351.GA19439@w-mikek2.ibm.com>

> I was thinking more about something like the following to eliminate
> all the users of __pa(MAX_DMA_ADDRESS).  This patch is NOT complete
> as I didn't change arch dependent code using __pa(MAX_DMA_ADDRESS).
> 
> Just curious if people think this is overkill, or is there a better
> way to address this?

There is no objection at present, I suppose this patch is 
the best way. :)

Thanks.

> diff -Naupr linux-2.6.13-rc2-mm2/include/linux/bootmem.h linux-2.6.13-rc2-mm2.work/include/linux/bootmem.h
> --- linux-2.6.13-rc2-mm2/include/linux/bootmem.h	2005-07-06 03:46:33.000000000 +0000
> +++ linux-2.6.13-rc2-mm2.work/include/linux/bootmem.h	2005-07-13 21:14:14.000000000 +0000
> @@ -40,6 +40,14 @@ typedef struct bootmem_data {
>  					 * up searching */
>  } bootmem_data_t;
>  
> +#ifndef MAX_DMA_PHYSADDR
> +#if MAX_DMA_ADDRESS = ~0UL
> +#define MAX_DMA_PHYSADDR MAX_DMA_ADDRESS
> +#else
> +#define MAX_DMA_PHYSADDR (__pa(MAX_DMA_ADDRESS))
> +#endif
> +#endif
> +
>  extern unsigned long __init bootmem_bootmap_pages (unsigned long);
>  extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
>  extern void __init free_bootmem (unsigned long addr, unsigned long size);
> @@ -47,11 +55,11 @@ extern void * __init __alloc_bootmem (un
>  #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
>  extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
>  #define alloc_bootmem(x) \
> -	__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem((x), SMP_CACHE_BYTES, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_low(x) \
>  	__alloc_bootmem((x), SMP_CACHE_BYTES, 0)
>  #define alloc_bootmem_pages(x) \
> -	__alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem((x), PAGE_SIZE, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_low_pages(x) \
>  	__alloc_bootmem((x), PAGE_SIZE, 0)
>  #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
> @@ -64,9 +72,9 @@ extern unsigned long __init free_all_boo
>  extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal);
>  #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
>  #define alloc_bootmem_node(pgdat, x) \
> -	__alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_pages_node(pgdat, x) \
> -	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_low_pages_node(pgdat, x) \
>  	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
>  #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
> diff -Naupr linux-2.6.13-rc2-mm2/mm/bootmem.c linux-2.6.13-rc2-mm2.work/mm/bootmem.c
> --- linux-2.6.13-rc2-mm2/mm/bootmem.c	2005-07-06 03:46:33.000000000 +0000
> +++ linux-2.6.13-rc2-mm2.work/mm/bootmem.c	2005-07-13 21:18:40.000000000 +0000
> @@ -387,10 +387,16 @@ void * __init __alloc_bootmem (unsigned 
>  	pg_data_t *pgdat = pgdat_list;
>  	void *ptr;
>  
> -	for_each_pgdat(pgdat)
> +	for_each_pgdat(pgdat){
> +
> +		if (goal < MAX_DMA_PHYSADDR &&
> +		    pgdat->bdata->node_boot_start >= MAX_DMA_PHYSADDR)
> +			continue; /* Skip No DMA node */
> +
>  		if ((ptr = __alloc_bootmem_core(pgdat->bdata, size,
>  						align, goal)))
>  			return(ptr);
> +	}
>  
>  	/*
>  	 * Whoops, we cannot satisfy the allocation request.

-- 
Yasunori Goto 


WARNING: multiple messages have this Message-ID (diff)
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: Mike Kravetz <kravetz@us.ibm.com>
Cc: linux-mm <linux-mm@kvack.org>, "Luck, Tony" <tony.luck@intel.com>,
	linux-ia64@vger.kernel.org, "Martin J. Bligh" <mbligh@mbligh.org>
Subject: Re: [PATCH] gurantee DMA area for alloc_bootmem_low()
Date: Fri, 15 Jul 2005 11:43:27 +0900	[thread overview]
Message-ID: <20050715113303.2EB8.Y-GOTO@jp.fujitsu.com> (raw)
In-Reply-To: <20050713220351.GA19439@w-mikek2.ibm.com>

> I was thinking more about something like the following to eliminate
> all the users of __pa(MAX_DMA_ADDRESS).  This patch is NOT complete
> as I didn't change arch dependent code using __pa(MAX_DMA_ADDRESS).
> 
> Just curious if people think this is overkill, or is there a better
> way to address this?

There is no objection at present, I suppose this patch is 
the best way. :)

Thanks.

> diff -Naupr linux-2.6.13-rc2-mm2/include/linux/bootmem.h linux-2.6.13-rc2-mm2.work/include/linux/bootmem.h
> --- linux-2.6.13-rc2-mm2/include/linux/bootmem.h	2005-07-06 03:46:33.000000000 +0000
> +++ linux-2.6.13-rc2-mm2.work/include/linux/bootmem.h	2005-07-13 21:14:14.000000000 +0000
> @@ -40,6 +40,14 @@ typedef struct bootmem_data {
>  					 * up searching */
>  } bootmem_data_t;
>  
> +#ifndef MAX_DMA_PHYSADDR
> +#if MAX_DMA_ADDRESS == ~0UL
> +#define MAX_DMA_PHYSADDR MAX_DMA_ADDRESS
> +#else
> +#define MAX_DMA_PHYSADDR (__pa(MAX_DMA_ADDRESS))
> +#endif
> +#endif
> +
>  extern unsigned long __init bootmem_bootmap_pages (unsigned long);
>  extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
>  extern void __init free_bootmem (unsigned long addr, unsigned long size);
> @@ -47,11 +55,11 @@ extern void * __init __alloc_bootmem (un
>  #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
>  extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
>  #define alloc_bootmem(x) \
> -	__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem((x), SMP_CACHE_BYTES, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_low(x) \
>  	__alloc_bootmem((x), SMP_CACHE_BYTES, 0)
>  #define alloc_bootmem_pages(x) \
> -	__alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem((x), PAGE_SIZE, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_low_pages(x) \
>  	__alloc_bootmem((x), PAGE_SIZE, 0)
>  #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
> @@ -64,9 +72,9 @@ extern unsigned long __init free_all_boo
>  extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal);
>  #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
>  #define alloc_bootmem_node(pgdat, x) \
> -	__alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_pages_node(pgdat, x) \
> -	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
> +	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, MAX_DMA_PHYSADDR)
>  #define alloc_bootmem_low_pages_node(pgdat, x) \
>  	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
>  #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
> diff -Naupr linux-2.6.13-rc2-mm2/mm/bootmem.c linux-2.6.13-rc2-mm2.work/mm/bootmem.c
> --- linux-2.6.13-rc2-mm2/mm/bootmem.c	2005-07-06 03:46:33.000000000 +0000
> +++ linux-2.6.13-rc2-mm2.work/mm/bootmem.c	2005-07-13 21:18:40.000000000 +0000
> @@ -387,10 +387,16 @@ void * __init __alloc_bootmem (unsigned 
>  	pg_data_t *pgdat = pgdat_list;
>  	void *ptr;
>  
> -	for_each_pgdat(pgdat)
> +	for_each_pgdat(pgdat){
> +
> +		if (goal < MAX_DMA_PHYSADDR &&
> +		    pgdat->bdata->node_boot_start >= MAX_DMA_PHYSADDR)
> +			continue; /* Skip No DMA node */
> +
>  		if ((ptr = __alloc_bootmem_core(pgdat->bdata, size,
>  						align, goal)))
>  			return(ptr);
> +	}
>  
>  	/*
>  	 * Whoops, we cannot satisfy the allocation request.

-- 
Yasunori Goto 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2005-07-15  2:43 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-12  6:50 [PATCH] gurantee DMA area for alloc_bootmem_low() Yasunori Goto
2005-07-12  6:50 ` Yasunori Goto
2005-07-12 14:39 ` Martin J. Bligh
2005-07-12 14:39   ` Martin J. Bligh
2005-07-13  5:09   ` Yasunori Goto
2005-07-13  5:09     ` Yasunori Goto
2005-07-12 18:30 ` Mike Kravetz
2005-07-12 18:30   ` Mike Kravetz
2005-07-12 19:29   ` Dave Hansen
2005-07-12 19:29     ` Dave Hansen
2005-07-12 20:37     ` Mike Kravetz
2005-07-12 20:37       ` Mike Kravetz
2005-07-13  6:34   ` Yasunori Goto
2005-07-13  6:34     ` Yasunori Goto
2005-07-13 22:03     ` Mike Kravetz
2005-07-13 22:03       ` Mike Kravetz
2005-07-15  2:43       ` Yasunori Goto [this message]
2005-07-15  2:43         ` Yasunori Goto
2005-08-09 11:11 ` [PATCH] gurantee DMA area for alloc_bootmem_low() ver. 2 Yasunori Goto
2005-08-09 11:11   ` Yasunori Goto
2005-08-09 15:05   ` Martin J. Bligh
2005-08-09 15:05     ` Martin J. Bligh
2005-08-09 21:15   ` Mike Kravetz
2005-08-09 21:15     ` Mike Kravetz
2005-08-10  3:06     ` Dave Hansen
2005-08-10  3:06       ` Dave Hansen
2005-08-10 16:23       ` Dave Hansen
2005-08-10 16:23         ` Dave Hansen
2005-08-11 20:46     ` Christoph Lameter
2005-08-11 20:46       ` Christoph Lameter
2005-08-11 21:14       ` Mike Kravetz
2005-08-11 21:14         ` Mike Kravetz
2005-08-11 22:37         ` Christoph Lameter
2005-08-11 22:37           ` Christoph Lameter
2005-08-09 23:02   ` Peter Chubb
2005-08-09 23:02     ` Peter Chubb
2005-08-10  6:10     ` Yasunori Goto
2005-08-10  6:10       ` Yasunori Goto
2005-08-18 19:52       ` Andrew Morton
2005-08-18 19:52         ` Andrew Morton
2005-08-18 21:39         ` Andi Kleen
2005-08-18 21:39           ` Andi Kleen
2005-08-19  2:29           ` Yasunori Goto
2005-08-19  2:29             ` Yasunori Goto
2005-08-19  3:03             ` Andi Kleen
2005-08-19  3:03               ` Andi Kleen
2005-08-19  1:26         ` Yasunori Goto
2005-08-19  1:26           ` Yasunori Goto
2005-08-25  9:15         ` Yasunori Goto

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=20050715113303.2EB8.Y-GOTO@jp.fujitsu.com \
    --to=y-goto@jp.fujitsu.com \
    --cc=kravetz@us.ibm.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mbligh@mbligh.org \
    --cc=tony.luck@intel.com \
    /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.