linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: peter@hurleysoftware.com (Peter Hurley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] n_tty: use kmalloc() instead of vmalloc() to avoid crash on armada-xp
Date: Tue, 10 Mar 2015 13:35:01 -0400	[thread overview]
Message-ID: <54FF2B45.8060407@hurleysoftware.com> (raw)
In-Reply-To: <54FF21BE.2040506@list.ru>

On 03/10/2015 12:54 PM, Stas Sergeev wrote:
> Hello, the patch below is needed for a successful boot on armada-xp.
> 
> 
> -=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
> This fixes the following crash at boot:
> 
>  Unhandled fault: external abort on non-linefetch (0x808) at 0xf00ca018
>  Internal error: : 808 [#1] SMP ARM
> 
>  CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc1 #3
>  Hardware name: Marvell Armada 370/XP (Device Tree)
>  task: ed41e800 ti: ed43e000 task.ti: ed43e000
>  PC is at _set_bit+0x28/0x50
>  LR is at n_tty_set_termios+0x328/0x358
>  pc : [<c01bc858>]    lr : [<c0207314>]    psr: 40000113
>  sp : ed43fd00  ip : 00000000  fp : 00000000
>  r10: 00000002  r9 : 00000000  r8 : ec930200
>  r7 : 00000000  r6 : f00ca018  r5 : f00ca000  r4 : ed69cc00
>  r3 : 00002000  r2 : 00002000  r1 : f00ca018  r0 : 00000000
>  Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
>  Control: 10c5387d  Table: 0000406a  DAC: 00000015
>  Process swapper/0 (pid: 1, stack limit = 0xed43e220)
> 
> The offending instruction in _set_bit() is "strex r0, r2, [r1]"
> For some reason the exclusive access instructions do not like the
> vmalloc() space... While there may be another fix to make them
> fine about vmalloc() space, it still looks like a good idea to
> use kmalloc() for allocating a small (sub-page) struct.

NAK.

struct n_tty_data is order 2, not sub-page.

The abort means something else is wrong; that's what needs
tracking down and fixing.

AFAIK this is not happening on any other ARM platform.

Regards,
Peter Hurley

> Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net>
> ---
>  drivers/tty/n_tty.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
> index cf6e0f2..e03622e 100644
> --- a/drivers/tty/n_tty.c
> +++ b/drivers/tty/n_tty.c
> @@ -50,7 +50,6 @@
>  #include <linux/uaccess.h>
>  #include <linux/module.h>
>  #include <linux/ratelimit.h>
> -#include <linux/vmalloc.h>
>  
>  
>  /* number of characters left in xmit buffer before select has we have
> room */
> @@ -1892,7 +1891,7 @@ static void n_tty_close(struct tty_struct *tty)
>      if (tty->link)
>          n_tty_packet_mode_flush(tty);
>  
> -    vfree(ldata);
> +    kfree(ldata);
>      tty->disc_data = NULL;
>  }
>  
> @@ -1911,7 +1910,7 @@ static int n_tty_open(struct tty_struct *tty)
>      struct n_tty_data *ldata;
>  
>      /* Currently a malloc failure here can panic */
> -    ldata = vmalloc(sizeof(*ldata));
> +    ldata = kmalloc(sizeof(*ldata), GFP_KERNEL);
>      if (!ldata)
>          goto err;
>  
> 

  parent reply	other threads:[~2015-03-10 17:35 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 16:54 [PATCH] n_tty: use kmalloc() instead of vmalloc() to avoid crash on armada-xp Stas Sergeev
2015-03-10 17:17 ` Catalin Marinas
2015-03-10 17:27   ` Stas Sergeev
2015-03-10 17:38     ` Russell King - ARM Linux
2015-03-10 18:31       ` Stas Sergeev
2015-03-10 18:54         ` Russell King - ARM Linux
2015-03-11 12:30       ` Stas Sergeev
2015-03-11 12:47         ` Russell King - ARM Linux
2015-03-11 14:24           ` Stas Sergeev
2015-03-11 16:30             ` Peter Hurley
2015-03-11 16:39               ` Stas Sergeev
2015-03-12 12:33             ` Peter Hurley
2015-03-12 12:47               ` Stas Sergeev
2015-03-12 13:04                 ` Russell King - ARM Linux
2015-03-12 13:11                   ` Stas Sergeev
2015-03-12 15:34                     ` Vladimir Murzin
2015-03-12 12:59               ` Russell King - ARM Linux
2015-03-10 17:29 ` Russell King - ARM Linux
2015-03-10 17:35 ` Peter Hurley [this message]
2015-03-10 17:51   ` Stas Sergeev
2015-03-10 18:45     ` Peter Hurley
2015-03-11 12:44 ` Gregory CLEMENT
2015-03-11 12:57   ` Stas Sergeev
2015-03-11 13:14   ` Russell King - ARM Linux
2015-03-11 14:33     ` Stas Sergeev
2015-03-11 15:01     ` Stas Sergeev
2015-03-11 15:13       ` Gregory CLEMENT
2015-03-11 15:22         ` Stas Sergeev
2015-03-12 13:06           ` Russell King - ARM Linux
2015-03-11 16:52 ` Thomas Petazzoni
2015-03-11 17:26   ` Stas Sergeev
2015-03-11 17:46     ` Russell King - ARM Linux
2015-03-11 17:56       ` Stas Sergeev
2015-03-11 18:11         ` Thomas Petazzoni
2015-03-11 18:38           ` Stas Sergeev
2015-03-11 18:41             ` Russell King - ARM Linux
2015-03-11 18:08       ` Stas Sergeev
2015-03-11 18:33         ` Thomas Petazzoni
2015-03-12 12:44           ` Stas Sergeev
2015-03-12 12:47             ` Thomas Petazzoni
2015-03-12 13:03               ` Stas Sergeev
2015-03-12 13:12                 ` Russell King - ARM Linux
2015-03-12 13:16                   ` Stas Sergeev
2015-03-12 13:55                 ` Thomas Petazzoni

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=54FF2B45.8060407@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=linux-arm-kernel@lists.infradead.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 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).