All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about kimage_alloc_page in kexec.c, bug?
@ 2010-10-11 14:46 wilbur.chan
  2010-10-18 10:26 ` Américo Wang
  0 siblings, 1 reply; 5+ messages in thread
From: wilbur.chan @ 2010-10-11 14:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linux MIPS Mailing List

Hi all !

I have a question on kimage_alloc_page:


page = kimage_alloc_pages(gfp_mask, 0);
...

/* If the page cannot be used file it away */
if (page_to_pfn(page) > (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
	list_add(&page->lru, &image->unuseable_pages);
	continue;
}


If  a page frame is right at physical address 0x20000000 ,  then when calling

machine_kexec , the following code:

*ptr = (unsigned long) phys_to_virt(*ptr);

will generate an virtual address of 0xa0000000 = 0x20000000+0x80000000 , which

results in physical address 0.



should it be like this?  :

--- kexec.c     2010-08-27 07:47:12.000000000 +0800
+++ kexec.changed.c     2010-10-11 22:04:08.000000000 +0800
@@ -723,7 +723,7 @@
                if (!page)
                        return NULL;
                /* If the page cannot be used file it away */
-               if (page_to_pfn(page) >
+               if (page_to_pfn(page) >=
                                (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
                        list_add(&page->lru, &image->unuseable_pages);
                        continue;


Thank you

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Question about kimage_alloc_page in kexec.c, bug?
@ 2010-10-11 15:02 ` wilbur.chan
  0 siblings, 0 replies; 5+ messages in thread
From: wilbur.chan @ 2010-10-11 15:02 UTC (permalink / raw)
  To: Linux MIPS Mailing List; +Cc: kexec

Hi all !

I have a question on kimage_alloc_page:


page = kimage_alloc_pages(gfp_mask, 0);
...

/* If the page cannot be used file it away */
if (page_to_pfn(page) > (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
       list_add(&page->lru, &image->unuseable_pages);
       continue;
}


If  a page frame is right at physical address 0x20000000 ,  then when calling

machine_kexec , the following code:

*ptr = (unsigned long) phys_to_virt(*ptr);

will generate an virtual address of 0xa0000000 = 0x20000000+0x80000000 , which

results in physical address 0.



should it be like this?  :

--- kexec.c     2010-08-27 07:47:12.000000000 +0800
+++ kexec.changed.c     2010-10-11 22:04:08.000000000 +0800
@@ -723,7 +723,7 @@
               if (!page)
                       return NULL;
               /* If the page cannot be used file it away */
-               if (page_to_pfn(page) >
+               if (page_to_pfn(page) >=
                               (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
                       list_add(&page->lru, &image->unuseable_pages);
                       continue;


Thank you

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Question about kimage_alloc_page in kexec.c, bug?
@ 2010-10-11 15:02 ` wilbur.chan
  0 siblings, 0 replies; 5+ messages in thread
From: wilbur.chan @ 2010-10-11 15:02 UTC (permalink / raw)
  To: Linux MIPS Mailing List; +Cc: kexec

Hi all !

I have a question on kimage_alloc_page:


page = kimage_alloc_pages(gfp_mask, 0);
...

/* If the page cannot be used file it away */
if (page_to_pfn(page) > (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
       list_add(&page->lru, &image->unuseable_pages);
       continue;
}


If  a page frame is right at physical address 0x20000000 ,  then when calling

machine_kexec , the following code:

*ptr = (unsigned long) phys_to_virt(*ptr);

will generate an virtual address of 0xa0000000 = 0x20000000+0x80000000 , which

results in physical address 0.



should it be like this?  :

--- kexec.c     2010-08-27 07:47:12.000000000 +0800
+++ kexec.changed.c     2010-10-11 22:04:08.000000000 +0800
@@ -723,7 +723,7 @@
               if (!page)
                       return NULL;
               /* If the page cannot be used file it away */
-               if (page_to_pfn(page) >
+               if (page_to_pfn(page) >=
                               (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
                       list_add(&page->lru, &image->unuseable_pages);
                       continue;


Thank you

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question about kimage_alloc_page in kexec.c, bug?
  2010-10-11 14:46 Question about kimage_alloc_page in kexec.c, bug? wilbur.chan
@ 2010-10-18 10:26 ` Américo Wang
  2010-10-18 10:40   ` Bernhard Walle
  0 siblings, 1 reply; 5+ messages in thread
From: Américo Wang @ 2010-10-18 10:26 UTC (permalink / raw)
  To: wilbur.chan; +Cc: linux-kernel, Linux MIPS Mailing List

On Mon, Oct 11, 2010 at 10:46:59PM +0800, wilbur.chan wrote:
>Hi all !
>
>I have a question on kimage_alloc_page:
>
...

You can Cc me on kexec/kdump issues. :)

>
>
>If  a page frame is right at physical address 0x20000000 ,  then when calling
>
>machine_kexec , the following code:
>
>*ptr = (unsigned long) phys_to_virt(*ptr);
>
>will generate an virtual address of 0xa0000000 = 0x20000000+0x80000000 , which
>
>results in physical address 0.
>
>
>
>should it be like this?  :
>
>--- kexec.c     2010-08-27 07:47:12.000000000 +0800
>+++ kexec.changed.c     2010-10-11 22:04:08.000000000 +0800
>@@ -723,7 +723,7 @@
>                if (!page)
>                        return NULL;
>                /* If the page cannot be used file it away */
>-               if (page_to_pfn(page) >
>+               if (page_to_pfn(page) >=
>                                (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) {
>                        list_add(&page->lru, &image->unuseable_pages);
>                        continue;
>

No, this could break x86_64.

IMHO, what needs to fix is the definition of KEXEC_SOURCE_MEMORY_LIMIT
on MIPS, something like:

- #define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
+ #define KEXEC_SOURCE_MEMORY_LIMIT (0x1FFFFFFF)


Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question about kimage_alloc_page in kexec.c, bug?
  2010-10-18 10:26 ` Américo Wang
@ 2010-10-18 10:40   ` Bernhard Walle
  0 siblings, 0 replies; 5+ messages in thread
From: Bernhard Walle @ 2010-10-18 10:40 UTC (permalink / raw)
  To: Américo Wang; +Cc: wilbur.chan, linux-kernel, Linux MIPS Mailing List

Am 18.10.2010 12:26, schrieb Américo Wang:
> 
> You can Cc me on kexec/kdump issues. :)

Better (or in addition) cc kexec@lists.infradead.org.

Regards,
Bernhard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-18 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 14:46 Question about kimage_alloc_page in kexec.c, bug? wilbur.chan
2010-10-18 10:26 ` Américo Wang
2010-10-18 10:40   ` Bernhard Walle
  -- strict thread matches above, loose matches on Subject: below --
2010-10-11 15:02 wilbur.chan
2010-10-11 15:02 ` wilbur.chan

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.