All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Alexander Graf <agraf@suse.de>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	jszhang@marvell.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	stable <stable@vger.kernel.org>,
	stable-commits@vger.kernel.org
Subject: Re: Patch "arm64: Fix swiotlb fallback allocation" has been added to the 4.9-stable tree
Date: Tue, 24 Jan 2017 08:30:15 +0100	[thread overview]
Message-ID: <20170124073015.GA14303@kroah.com> (raw)
In-Reply-To: <20170123163307.GH22417@e104818-lin.cambridge.arm.com>

On Mon, Jan 23, 2017 at 04:33:08PM +0000, Catalin Marinas wrote:
> On Mon, Jan 23, 2017 at 05:15:39PM +0100, Geert Uytterhoeven wrote:
> > On Mon, Jan 23, 2017 at 5:02 PM,  <gregkh@linuxfoundation.org> wrote:
> > > This is a note to let you know that I've just added the patch titled
> > >
> > >     arm64: Fix swiotlb fallback allocation
> > >
> > > to the 4.9-stable tree which can be found at:
> > >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > >
> > > The filename of the patch is:
> > >      arm64-fix-swiotlb-fallback-allocation.patch
> > > and it can be found in the queue-4.9 subdirectory.
> > >
> > > If you, or anyone else, feels it should not be added to the stable tree,
> > > please let <stable@vger.kernel.org> know about it.
> > >
> > >
> > > From 524dabe1c68e0bca25ce7b108099e5d89472a101 Mon Sep 17 00:00:00 2001
> > > From: Alexander Graf <agraf@suse.de>
> > > Date: Mon, 16 Jan 2017 12:46:33 +0100
> > > Subject: arm64: Fix swiotlb fallback allocation
> > >
> > > From: Alexander Graf <agraf@suse.de>
> > >
> > > commit 524dabe1c68e0bca25ce7b108099e5d89472a101 upstream.
> > >
> > > Commit b67a8b29df introduced logic to skip swiotlb allocation when all memory
> > > is DMA accessible anyway.
> > >
> > > While this is a great idea, __dma_alloc still calls swiotlb code unconditionally
> > > to allocate memory when there is no CMA memory available. The swiotlb code is
> > > called to ensure that we at least try get_free_pages().
> > >
> > > Without initialization, swiotlb allocation code tries to access io_tlb_list
> > > which is NULL. That results in a stack trace like this:
> > >
> > >   Unable to handle kernel NULL pointer dereference at virtual address 00000000
> > >   [...]
> > >   [<ffff00000845b908>] swiotlb_tbl_map_single+0xd0/0x2b0
> > >   [<ffff00000845be94>] swiotlb_alloc_coherent+0x10c/0x198
> > >   [<ffff000008099dc0>] __dma_alloc+0x68/0x1a8
> > >   [<ffff000000a1b410>] drm_gem_cma_create+0x98/0x108 [drm]
> > >   [<ffff000000abcaac>] drm_fbdev_cma_create_with_funcs+0xbc/0x368 [drm_kms_helper]
> > >   [<ffff000000abcd84>] drm_fbdev_cma_create+0x2c/0x40 [drm_kms_helper]
> > >   [<ffff000000abc040>] drm_fb_helper_initial_config+0x238/0x410 [drm_kms_helper]
> > >   [<ffff000000abce88>] drm_fbdev_cma_init_with_funcs+0x98/0x160 [drm_kms_helper]
> > >   [<ffff000000abcf90>] drm_fbdev_cma_init+0x40/0x58 [drm_kms_helper]
> > >   [<ffff000000b47980>] vc4_kms_load+0x90/0xf0 [vc4]
> > >   [<ffff000000b46a94>] vc4_drm_bind+0xec/0x168 [vc4]
> > >   [...]
> > >
> > > Thankfully swiotlb code just learned how to not do allocations with the FORCE_NO
> > > option. This patch configures the swiotlb code to use that if we decide not to
> > > initialize the swiotlb framework.
> > >
> > > Fixes: b67a8b29df ("arm64: mm: only initialize swiotlb when necessary")
> > > Signed-off-by: Alexander Graf <agraf@suse.de>
> > > CC: Jisheng Zhang <jszhang@marvell.com>
> > > CC: Geert Uytterhoeven <geert+renesas@glider.be>
> > > CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > >
> > > ---
> > >  arch/arm64/mm/init.c |    2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > --- a/arch/arm64/mm/init.c
> > > +++ b/arch/arm64/mm/init.c
> > > @@ -403,6 +403,8 @@ void __init mem_init(void)
> > >  {
> > >         if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
> > >                 swiotlb_init(1);
> > > +       else
> > > +               swiotlb_force = SWIOTLB_NO_FORCE;
> > 
> > The above definition depends on:
> > 
> > commit ae7871be189cb411 ("swiotlb: Convert swiotlb_force from int to enum")
> > commit fff5d99225107f5f ("swiotlb: Add swiotlb=noforce debug option")
> 
> If these are not suitable for stable (too big, new feature), we can just
> drop the arm64 commit from 4.9-stable (and we could fix it in a
> different way).

Those look fine, I've queued them up now (took a bit of manual work),
and will let the autobuilder have fun with it...

thanks,

greg k-h

      reply	other threads:[~2017-01-24  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 16:02 Patch "arm64: Fix swiotlb fallback allocation" has been added to the 4.9-stable tree gregkh
2017-01-23 16:15 ` Geert Uytterhoeven
2017-01-23 16:33   ` Catalin Marinas
2017-01-24  7:30     ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170124073015.GA14303@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=agraf@suse.de \
    --cc=catalin.marinas@arm.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=jszhang@marvell.com \
    --cc=konrad.wilk@oracle.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.