* Re: [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
2010-07-08 9:07 ` [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr Milton Miller
@ 2010-07-08 10:49 ` Benjamin Herrenschmidt
2010-07-08 12:40 ` Kumar Gala
2010-07-08 14:27 ` Matthew McClintock
2010-07-09 5:37 ` [PATCH 1/2] " Matthew McClintock
2 siblings, 1 reply; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2010-07-08 10:49 UTC (permalink / raw)
To: Milton Miller; +Cc: Matthew McClintock, kumar.gala, linuxppc-dev
On Thu, 2010-07-08 at 04:07 -0500, Milton Miller wrote:
> On Wed, 07 Jul 2010 around 10:51:20 -0000 Matthew McClintock wrote:
> >
> > Fix sizes of variables so correct values are exported via /proc.
> > Cast variable in comparison to avoid compiler error.
> >
I'm afraid I already pulled that in. Please send a fixup patch.
Cheers,
Ben.
> > Signed-off-by: Matthew McClintock <msm@freescale.com>
> >
> >
> > - csize = min(csize, PAGE_SIZE);
> > + csize = min(csize, (size_t)PAGE_SIZE);
>
> no use min_t
>
> >
> > - if (pfn < max_pfn) {
> > + if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
> > vaddr = __va(pfn << PAGE_SHIFT);
> > csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
> > } else {
> > diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> > index bb3d893..ec7f054 100644
> > --- a/arch/powerpc/kernel/machine_kexec.c
> > +++ b/arch/powerpc/kernel/machine_kexec.c
> > @@ -145,6 +145,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
> >
> > /* Values we need to export to the second kernel via the device tree. */
> > static unsigned long kernel_end;
> > +static unsigned long crashk_start;
> > static unsigned long crashk_size;
> >
> > static struct property kernel_end_prop = {
> > @@ -156,7 +157,7 @@ static struct property kernel_end_prop = {
> > static struct property crashk_base_prop = {
> > .name = "linux,crashkernel-base",
> > .length = sizeof(unsigned long),
> > - .value = &crashk_res.start,
> > + .value = &crashk_start,
> > };
> >
>
> This is wrong, its truncating the start and size.
>
> Change the variables to be physaddr_t and the length to be sizeof(physaddr_t).
>
> Since these properites only contain one variable, the number of cells
> can be inferred from the property size like we do for reading the initrd-size.
>
> Technically they should be an array of be32 but we can make that a comment.
>
> By the way, why does 32 bit care about the running kernel's size? aka
> linux,kernel-end? 64 bit book 3S needs it because we use mmu hooks
> to copy the pages to their destination, but I thought ppc32 was using
> a relocatable copy routine. Are we missing the code to create
> temp ref tlbs on the fly for book 3E?
>
> > static struct property crashk_size_prop = {
> > @@ -180,6 +181,7 @@ static void __init export_crashk_values(struct device_node *node)
> > prom_remove_property(node, prop);
> >
> > if (crashk_res.start != 0) {
> > + crashk_start = crashk_res.start;
> > prom_add_property(node, &crashk_base_prop);
> > crashk_size = crashk_res.end - crashk_res.start + 1;
> > prom_add_property(node, &crashk_size_prop);
>
> I guess we use the reuse of the resources varables, but such is
> common code vs userspace.
>
> milton
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
2010-07-08 10:49 ` Benjamin Herrenschmidt
@ 2010-07-08 12:40 ` Kumar Gala
2010-07-09 1:30 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 8+ messages in thread
From: Kumar Gala @ 2010-07-08 12:40 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Matthew McClintock, linuxppc-dev, Milton Miller
On Jul 8, 2010, at 5:49 AM, Benjamin Herrenschmidt wrote:
> On Thu, 2010-07-08 at 04:07 -0500, Milton Miller wrote:
>> On Wed, 07 Jul 2010 around 10:51:20 -0000 Matthew McClintock wrote:
>>>
>>> Fix sizes of variables so correct values are exported via /proc.
>>> Cast variable in comparison to avoid compiler error.
>>>
>
> I'm afraid I already pulled that in. Please send a fixup patch.
>
> Cheers,
> Ben.
pulled into which tree?
- k
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
2010-07-08 12:40 ` Kumar Gala
@ 2010-07-09 1:30 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2010-07-09 1:30 UTC (permalink / raw)
To: Kumar Gala; +Cc: Matthew McClintock, linuxppc-dev, Milton Miller
On Thu, 2010-07-08 at 07:40 -0500, Kumar Gala wrote:
> On Jul 8, 2010, at 5:49 AM, Benjamin Herrenschmidt wrote:
>
> > On Thu, 2010-07-08 at 04:07 -0500, Milton Miller wrote:
> >> On Wed, 07 Jul 2010 around 10:51:20 -0000 Matthew McClintock wrote:
> >>>
> >>> Fix sizes of variables so correct values are exported via /proc.
> >>> Cast variable in comparison to avoid compiler error.
> >>>
> >
> > I'm afraid I already pulled that in. Please send a fixup patch.
> >
> pulled into which tree?
My confusion. It was in my to-be-posted -next but I hadn't actually
uploaded it yet so I've dropped the patch for now. Matthew, don't send
an incremental fixup, a whole new patch will do. I've also dropped the
second patch that enables building of crash dump kernels for now.
I've left the MPIC CPU reset one though.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
2010-07-08 9:07 ` [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr Milton Miller
2010-07-08 10:49 ` Benjamin Herrenschmidt
@ 2010-07-08 14:27 ` Matthew McClintock
2010-07-09 5:37 ` [PATCH 1/2] " Matthew McClintock
2 siblings, 0 replies; 8+ messages in thread
From: Matthew McClintock @ 2010-07-08 14:27 UTC (permalink / raw)
To: Milton Miller; +Cc: kumar.gala, linuxppc-dev
On Thu, 2010-07-08 at 04:07 -0500, Milton Miller wrote:
> On Wed, 07 Jul 2010 around 10:51:20 -0000 Matthew McClintock wrote:
> >
> > Fix sizes of variables so correct values are exported via /proc.
> > Cast variable in comparison to avoid compiler error.
> >
> > Signed-off-by: Matthew McClintock <msm@freescale.com>
> >
> >
> > - csize = min(csize, PAGE_SIZE);
> > + csize = min(csize, (size_t)PAGE_SIZE);
>
> no use min_t
Ok
>
> >
> > - if (pfn < max_pfn) {
> > + if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
> > vaddr = __va(pfn << PAGE_SHIFT);
> > csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
> > } else {
> > diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> > index bb3d893..ec7f054 100644
> > --- a/arch/powerpc/kernel/machine_kexec.c
> > +++ b/arch/powerpc/kernel/machine_kexec.c
> > @@ -145,6 +145,7 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
> >
> > /* Values we need to export to the second kernel via the device tree. */
> > static unsigned long kernel_end;
> > +static unsigned long crashk_start;
> > static unsigned long crashk_size;
> >
> > static struct property kernel_end_prop = {
> > @@ -156,7 +157,7 @@ static struct property kernel_end_prop = {
> > static struct property crashk_base_prop = {
> > .name = "linux,crashkernel-base",
> > .length = sizeof(unsigned long),
> > - .value = &crashk_res.start,
> > + .value = &crashk_start,
> > };
> >
>
> This is wrong, its truncating the start and size.
>
> Change the variables to be physaddr_t and the length to be sizeof(physaddr_t).
>
> Since these properites only contain one variable, the number of cells
> can be inferred from the property size like we do for reading the initrd-size.
>
> Technically they should be an array of be32 but we can make that a comment.
I don't disagree but this can break kexec if phys_addr_t != unsigned
long. Also, doesn't the crash kernel have to live below 2GB so unsigned
long is always fine?
Will still change unless I hear otherwise.
>
> By the way, why does 32 bit care about the running kernel's size? aka
> linux,kernel-end? 64 bit book 3S needs it because we use mmu hooks
> to copy the pages to their destination, but I thought ppc32 was using
> a relocatable copy routine. Are we missing the code to create
> temp ref tlbs on the fly for book 3E?
This is not really in this patch or did I miss something? Kexec uses
kernel-end just to add as a invalid region. Not crucial though for 32
bit.
>
> > static struct property crashk_size_prop = {
> > @@ -180,6 +181,7 @@ static void __init export_crashk_values(struct device_node *node)
> > prom_remove_property(node, prop);
> >
> > if (crashk_res.start != 0) {
> > + crashk_start = crashk_res.start;
> > prom_add_property(node, &crashk_base_prop);
> > crashk_size = crashk_res.end - crashk_res.start + 1;
> > prom_add_property(node, &crashk_size_prop);
>
> I guess we use the reuse of the resources varables, but such is
> common code vs userspace.
>
> milton
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr
2010-07-08 9:07 ` [1/2] powerpc/crashdump: Fix issues with kexec and 36bit physical addr Milton Miller
2010-07-08 10:49 ` Benjamin Herrenschmidt
2010-07-08 14:27 ` Matthew McClintock
@ 2010-07-09 5:37 ` Matthew McClintock
2 siblings, 0 replies; 8+ messages in thread
From: Matthew McClintock @ 2010-07-09 5:37 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Kumar Gala, Milton Miller, Matthew McClintock
Fix sizes of variables so correct values are exported via /proc.
Cast variable in comparison to avoid compiler error.
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
arch/powerpc/kernel/crash_dump.c | 4 ++--
arch/powerpc/kernel/machine_kexec.c | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 5fb667a..d254132 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -128,9 +128,9 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
if (!csize)
return 0;
- csize = min(csize, PAGE_SIZE);
+ csize = min_t(size_t, csize, PAGE_SIZE);
- if (pfn < max_pfn) {
+ if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
vaddr = __va(pfn << PAGE_SHIFT);
csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
} else {
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index bb3d893..6ff15f0 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -144,24 +144,24 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
}
/* Values we need to export to the second kernel via the device tree. */
-static unsigned long kernel_end;
-static unsigned long crashk_size;
+static phys_addr_t kernel_end;
+static phys_addr_t crashk_size;
static struct property kernel_end_prop = {
.name = "linux,kernel-end",
- .length = sizeof(unsigned long),
+ .length = sizeof(phys_addr_t),
.value = &kernel_end,
};
static struct property crashk_base_prop = {
.name = "linux,crashkernel-base",
- .length = sizeof(unsigned long),
+ .length = sizeof(phys_addr_t),
.value = &crashk_res.start,
};
static struct property crashk_size_prop = {
.name = "linux,crashkernel-size",
- .length = sizeof(unsigned long),
+ .length = sizeof(phys_addr_t),
.value = &crashk_size,
};
--
1.6.6.1
^ permalink raw reply related [flat|nested] 8+ messages in thread