lkml.org 
[lkml]   [2020]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] dma-pool: Do not allocate pool memory from CMA
    On Tue, 21 Jul 2020 at 18:15, Nicolas Saenz Julienne
    <nsaenzjulienne@suse.de> wrote:
    >
    > On Tue, 2020-07-21 at 17:45 +0530, Amit Pundir wrote:
    > > On Tue, 21 Jul 2020 at 16:45, Nicolas Saenz Julienne
    > > <nsaenzjulienne@suse.de> wrote:
    > > > On Tue, 2020-07-21 at 14:24 +0530, Amit Pundir wrote:
    > > > > On Tue, 21 Jul 2020 at 14:09, Nicolas Saenz Julienne
    > > > > <nsaenzjulienne@suse.de> wrote:
    > > > > > Hi Amit,
    > > > > > > Hi Nicolas,
    > > > > > >
    > > > > > > I see a boot regression with this commit d9765e41d8e9 "dma-
    > > > > > > pool:
    > > > > > > Do not allocate pool memory from CMA" on my Xiaomi Poco F1
    > > > > > > (Qcom sdm845) phone running v5.8-rc6. I can't boot past the
    > > > > > > bootloader splash screen with this patch.
    > > > > > >
    > > > > > > Phone boots fine if I revert this patch. I carry only one out
    > > > > > > of
    > > > > > > tree
    > > > > > > dts patch https://lkml.org/lkml/2020/6/25/52. And since this
    > > > > > > is a
    > > > > > > stock
    > > > > > > phone, I don't have access to serial/dmesg logs until I boot
    > > > > > > to
    > > > > > > AOSP
    > > > > > > (adb) shell.
    > > > > > >
    > > > > > > Any thoughts as to what might be going wrong here? I'd be
    > > > > > > happy
    > > > > > > to
    > > > > > > help debug things. For what it's worth, I don't see this
    > > > > > > regression
    > > > > > > on
    > > > > > > other two sdm845 devices (db845c and Pixel 3) I tested on.
    > > > > >
    > > > > > Can you provide a boot log (even if without my patch) and the
    > > > > > device-
    > > > > > tree files? It'd help a lot figuring things out.
    > > > >
    > > > > Thank you for the prompt reply Nicolas.
    > > > >
    > > > > Here is the boot log with the reverted patch
    > > > > https://pastebin.ubuntu.com/p/BrhPf83nKF/
    > > > >
    > > > > Here is my phone's dts
    > > > > https://github.com/pundiramit/linux/commit/2a394c199deeaf4c91e0e008e8fba2a72f494d8c
    > > >
    > > > I'm at loss at what could be failing here. Your device should be
    > > > able
    > > > to address the whole 8GB memory space, which AFAIK is the max
    > > > available
    > > > on that smartphone family. But maybe the device-tree is lying, who
    > > > knows...
    > >
    > > If it helps, my phone has 6GB memory space.
    > >
    > > > Can you try booting *without* my patch and this in the kernel
    > > > command
    > > > line: "cma=16M@0x100000000-0x200000000".
    > >
    > > It doesn't boot with this added kernel command line.
    >
    >
    > For the record, this placed the CMA in the [4GB, 8GB] address space
    > instead of you setup's default: [3GB, 4GB]. All atomic pools fall in
    > that memory area without my patch, which makes me think some of the
    > devices on your board might not like higher addresses.
    >

    Thank you Nicolas for the details. Though we don't set the CMA
    alloc-ranges explicitly in upstream sdm845 dts, but I dug around and
    found that CMA alloc-ranges in the downstream kernel are indeed in
    lower address space.
    https://github.com/MiCode/Xiaomi_Kernel_OpenSource/blob/dipper-q-oss/arch/arm64/boot/dts/qcom/sdm845.dtsi#L662

    /* global autoconfigured region for contiguous allocations */
    linux,cma {
    compatible = "shared-dma-pool";
    alloc-ranges = <0 0x00000000 0 0xffffffff>;
    reusable;
    alignment = <0 0x400000>;
    size = <0 0x2000000>;
    linux,cma-default;
    };

    > What happens if you boot with my troublesome patch with this in your
    > device tree? (insert it at the bottom of sdm845-beryllium.dts)
    >
    > &soc {
    > dma-ranges = <0 0 0 0 0x1 0>;
    > };
    >

    Device still doesn't boot up to adb shell.

    Regards,
    Amit Pundir

    > Regards,
    > Nicolas
    >
    > > Regards,
    > > Amit Pundir
    > >
    > > > Regards,
    > > > Nicolas
    > > >
    > > > And here is my kernel tree just in case
    > > > > https://github.com/pundiramit/linux/commits/beryllium-mainline
    > > > >
    > > > > Regards,
    > > > > Amit Pundir
    > > > >
    > > > >
    > > > > > Regards,
    > > > > > Nicolas
    > > > > >
    > > > > > > Regards,
    > > > > > > Amit Pundir
    > > > > > >
    > > > > > > > Reported-by: Jeremy Linton <jeremy.linton@arm.com>
    > > > > > > > Signed-off-by: Nicolas Saenz Julienne <
    > > > > > > > nsaenzjulienne@suse.de>
    > > > > > > > ---
    > > > > > > >
    > > > > > > > An more costly alternative would be adding an option to
    > > > > > > > dma_alloc_from_contiguous() so it fails when the allocation
    > > > > > > > doesn't
    > > > > > > > fall
    > > > > > > > in a specific zone.
    > > > > > > >
    > > > > > > > kernel/dma/pool.c | 11 ++---------
    >

    \
     
     \ /
      Last update: 2020-07-21 17:23    [W:2.825 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site