From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 1D7E01A027B for ; Sat, 5 Sep 2015 04:18:14 +1000 (AEST) Received: from /spool/local by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 Sep 2015 14:18:12 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 51B88C90048 for ; Fri, 4 Sep 2015 14:09:13 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t84II9g452822084 for ; Fri, 4 Sep 2015 18:18:09 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t84II70l030425 for ; Fri, 4 Sep 2015 14:18:08 -0400 Date: Fri, 4 Sep 2015 11:18:06 -0700 From: Nishanth Aravamudan To: Jan Stancek Cc: Michael Ellerman , Wei Yang , Alexey Kardashevskiy , Gavin Shan , Hari Bathini , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, David Gibson Subject: Re: powerpc/powernv/pci-ioda: fix kdump with non-power-of-2 crashkernel= Message-ID: <20150904181805.GM47557@linux.vnet.ibm.com> References: <20150904165938.GL47557@linux.vnet.ibm.com> <20150904180108.GA30660@dustball.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20150904180108.GA30660@dustball.brq.redhat.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 04.09.2015 [20:01:22 +0200], Jan Stancek wrote: > On Fri, Sep 04, 2015 at 09:59:38AM -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 > > Cc: stable@vger.kernel.org # 4.2 > > --- > > > > Michael, I did 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. > > > > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c > > index f1c74c28e564..73914f4bd1ab 100644 > > --- a/arch/powerpc/platforms/powernv/pci-ioda.c > > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c > > @@ -2084,6 +2084,12 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe) > > */ > > const u64 window_size = > > min((u64)pe->table_group.tce32_size, memory_hotplug_max()); > > + /* > > + * 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. > > + */ > > + window_size = __rounddown_pow_of_two(window_size); > > Hi, > > Just wondering if this won't hide potential alignment issues of > "table_group.tce32_size", that now trigger EINVAL down the road > and if it wouldn't be safer to round only "memory_hotplug_max()? > > const __u64 hotplug_max_p2 = __rounddown_pow_of_two(memory_hotplug_max()); > const __u64 window_size = > min((u64)pe->table_group.tce32_size, hotplug_max_p2); Fair point, v2 on its way.