linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
@ 2015-09-04 18:22 Nishanth Aravamudan
  2015-09-04 19:03 ` Jan Stancek
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nishanth Aravamudan @ 2015-09-04 18:22 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Hari Bathini, Gavin Shan, Alexey Kardashevskiy,
	Ben Herrenschmidt, Paul Mackerras, David Gibson, Wei Yang,
	linuxppc-dev, Jan Stancek

The 32-bit TCE table initialization relies on the DMA window having a
size equal to a power of 2 (and checks for it explicitly). But
crashkernel= has no constraint that requires a power-of-2 be specified.
This causes the kdump kernel to fail to boot as none of the PCI devices
(including the disk controller) are successfully initialized.

After this change, the PCI devices successfully set up the 32-bit TCE
table and kdump succeeds.

Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # 4.2

---

Michael, I kept this as a follow-on patch to my previous one. If you'd
rather I made a v3 of that patch with the two fixes combined, I can
resend. Also, I fixed up the context on my end to be u64, but not sure
if that will match your tree (next doesn't have my prior patch applied
yet, that I can see).

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index f1c74c28e564..d5e635f2c3aa 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2078,12 +2078,18 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe)
 	struct iommu_table *tbl = NULL;
 	long rc;
 	/*
+	 * crashkernel= specifies the kdump kernel's maximum memory at
+	 * some offset and there is no guaranteed the result is a power
+	 * of 2, which will cause errors later.
+	 */
+	const u64 max_memory = __rounddown_pow_of_two(memory_hotplug_max());
+	/*
 	 * In memory constrained environments, e.g. kdump kernel, the
 	 * DMA window can be larger than available memory, which will
 	 * cause errors later.
 	 */
 	const u64 window_size =
-		min((u64)pe->table_group.tce32_size, memory_hotplug_max());
+		min((u64)pe->table_group.tce32_size, max_memory);
 
 	rc = pnv_pci_ioda2_create_table(&pe->table_group, 0,
 			iommu_page_shift_4k,

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

* Re: [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
  2015-09-04 18:22 [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Nishanth Aravamudan
@ 2015-09-04 19:03 ` Jan Stancek
  2015-09-07  9:19 ` Michael Ellerman
  2015-09-08 12:05 ` [v2] " Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2015-09-04 19:03 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Michael Ellerman, Hari Bathini, Gavin Shan, Alexey Kardashevskiy,
	Ben Herrenschmidt, Paul Mackerras, David Gibson, Wei Yang,
	linuxppc-dev





----- Original Message -----
> From: "Nishanth Aravamudan" <nacc@linux.vnet.ibm.com>
> To: "Michael Ellerman" <mpe@ellerman.id.au>
> Cc: "Hari Bathini" <hbathini@in.ibm.com>, "Gavin Shan" <gwshan@linux.vnet.ibm.com>, "Alexey Kardashevskiy"
> <aik@ozlabs.ru>, "Ben Herrenschmidt" <benh@kernel.crashing.org>, "Paul Mackerras" <paulus@samba.org>, "David Gibson"
> <david@gibson.dropbear.id.au>, "Wei Yang" <weiyang@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org, "Jan Stancek"
> <jstancek@redhat.com>
> Sent: Friday, 4 September, 2015 8:22:52 PM
> Subject: [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
> 
> The 32-bit TCE table initialization relies on the DMA window having a
> size equal to a power of 2 (and checks for it explicitly). But
> crashkernel= has no constraint that requires a power-of-2 be specified.
> This causes the kdump kernel to fail to boot as none of the PCI devices
> (including the disk controller) are successfully initialized.
> 
> After this change, the PCI devices successfully set up the 32-bit TCE
> table and kdump succeeds.
> 
> Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate
> TCE pages")
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org # 4.2

Tested-by: Jan Stancek <jstancek@redhat.com>

I can confirm, that this patch along with 
  http://patchwork.ozlabs.org/patch/513229/
applied on top of 4.2 is fixing kdump for me on Power S812L.
(ppc64le bare metal, crashkernel=1024M)

Regards,
Jan

> 
> ---
> 
> Michael, I kept this as a follow-on patch to my previous one. If you'd
> rather I made a v3 of that patch with the two fixes combined, I can
> resend. Also, I fixed up the context on my end to be u64, but not sure
> if that will match your tree (next doesn't have my prior patch applied
> yet, that I can see).
> 
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c
> b/arch/powerpc/platforms/powernv/pci-ioda.c
> index f1c74c28e564..d5e635f2c3aa 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -2078,12 +2078,18 @@ static long pnv_pci_ioda2_setup_default_config(struct
> pnv_ioda_pe *pe)
>  	struct iommu_table *tbl = NULL;
>  	long rc;
>  	/*
> +	 * crashkernel= specifies the kdump kernel's maximum memory at
> +	 * some offset and there is no guaranteed the result is a power
> +	 * of 2, which will cause errors later.
> +	 */
> +	const u64 max_memory = __rounddown_pow_of_two(memory_hotplug_max());
> +	/*
>  	 * In memory constrained environments, e.g. kdump kernel, the
>  	 * DMA window can be larger than available memory, which will
>  	 * cause errors later.
>  	 */
>  	const u64 window_size =
> -		min((u64)pe->table_group.tce32_size, memory_hotplug_max());
> +		min((u64)pe->table_group.tce32_size, max_memory);
>  
>  	rc = pnv_pci_ioda2_create_table(&pe->table_group, 0,
>  			iommu_page_shift_4k,
> 
> 

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

* Re: [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
  2015-09-04 18:22 [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Nishanth Aravamudan
  2015-09-04 19:03 ` Jan Stancek
@ 2015-09-07  9:19 ` Michael Ellerman
  2015-09-08  3:10   ` Nishanth Aravamudan
  2015-09-08 12:05 ` [v2] " Michael Ellerman
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2015-09-07  9:19 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Hari Bathini, Gavin Shan, Alexey Kardashevskiy,
	Ben Herrenschmidt, Paul Mackerras, David Gibson, Wei Yang,
	linuxppc-dev, Jan Stancek

On Fri, 2015-09-04 at 11:22 -0700, Nishanth Aravamudan wrote:
> The 32-bit TCE table initialization relies on the DMA window having a
> size equal to a power of 2 (and checks for it explicitly). But
> crashkernel= has no constraint that requires a power-of-2 be specified.
> This causes the kdump kernel to fail to boot as none of the PCI devices
> (including the disk controller) are successfully initialized.
> 
> After this change, the PCI devices successfully set up the 32-bit TCE
> table and kdump succeeds.
> 
> Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org # 4.2
> 
> Michael, I kept this as a follow-on patch to my previous one. If you'd
> rather I made a v3 of that patch with the two fixes combined, I can
> resend.

No that's fine. I guess they could have been a single fix, but it's not a big deal.

> Also, I fixed up the context on my end to be u64, but not sure
> if that will match your tree (next doesn't have my prior patch applied
> yet, that I can see).

next isn't open yet, because we're still in the merge window, ie. rc1 hasn't
come out yet.

This is a fix so it'll go to my fixes branch. Whether I send that to Linus
before or after rc1 depends on how urgent the fixes people send me are. Sounds
like you'd like these two to go in asap?

cheers

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

* Re: [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
  2015-09-07  9:19 ` Michael Ellerman
@ 2015-09-08  3:10   ` Nishanth Aravamudan
  0 siblings, 0 replies; 5+ messages in thread
From: Nishanth Aravamudan @ 2015-09-08  3:10 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Hari Bathini, Gavin Shan, Alexey Kardashevskiy,
	Ben Herrenschmidt, Paul Mackerras, David Gibson, Wei Yang,
	linuxppc-dev, Jan Stancek

On 07.09.2015 [19:19:09 +1000], Michael Ellerman wrote:
> On Fri, 2015-09-04 at 11:22 -0700, Nishanth Aravamudan wrote:
> > The 32-bit TCE table initialization relies on the DMA window having a
> > size equal to a power of 2 (and checks for it explicitly). But
> > crashkernel= has no constraint that requires a power-of-2 be specified.
> > This causes the kdump kernel to fail to boot as none of the PCI devices
> > (including the disk controller) are successfully initialized.
> > 
> > After this change, the PCI devices successfully set up the 32-bit TCE
> > table and kdump succeeds.
> > 
> > Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
> > Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> > Cc: stable@vger.kernel.org # 4.2
> > 
> > Michael, I kept this as a follow-on patch to my previous one. If you'd
> > rather I made a v3 of that patch with the two fixes combined, I can
> > resend.
> 
> No that's fine. I guess they could have been a single fix, but it's
> not a big deal.

Ok, thanks for understanding.

> > Also, I fixed up the context on my end to be u64, but not sure
> > if that will match your tree (next doesn't have my prior patch applied
> > yet, that I can see).
> 
> next isn't open yet, because we're still in the merge window, ie. rc1
> hasn't come out yet.

Ah got it. I did mean your next branch, not linux-next itself, fwiw.

> This is a fix so it'll go to my fixes branch. Whether I send that to
> Linus before or after rc1 depends on how urgent the fixes people send
> me are. Sounds like you'd like these two to go in asap?

If at all possible, yes please.

-Nish

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

* Re: [v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel=
  2015-09-04 18:22 [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Nishanth Aravamudan
  2015-09-04 19:03 ` Jan Stancek
  2015-09-07  9:19 ` Michael Ellerman
@ 2015-09-08 12:05 ` Michael Ellerman
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2015-09-08 12:05 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Wei Yang, Alexey Kardashevskiy, Gavin Shan, Hari Bathini,
	Paul Mackerras, linuxppc-dev, Jan Stancek, David Gibson

On Fri, 2015-04-09 at 18:22:52 UTC, Nishanth Aravamudan wrote:
> The 32-bit TCE table initialization relies on the DMA window having a
> size equal to a power of 2 (and checks for it explicitly). But
> crashkernel= has no constraint that requires a power-of-2 be specified.
> This causes the kdump kernel to fail to boot as none of the PCI devices
> (including the disk controller) are successfully initialized.
> 
> After this change, the PCI devices successfully set up the 32-bit TCE
> table and kdump succeeds.
> 
> Fixes: aca6913f5551 ("powerpc/powernv/ioda2: Introduce helpers to allocate TCE pages")
> Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
> Cc: stable@vger.kernel.org # 4.2
> Tested-by: Jan Stancek <jstancek@redhat.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/fa14486979b3a47307bcdb10

cheers

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

end of thread, other threads:[~2015-09-08 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 18:22 [PATCH v2] powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Nishanth Aravamudan
2015-09-04 19:03 ` Jan Stancek
2015-09-07  9:19 ` Michael Ellerman
2015-09-08  3:10   ` Nishanth Aravamudan
2015-09-08 12:05 ` [v2] " Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).