All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Will Deacon <will.deacon@arm.com>,
	yong.wu@mediatek.com, iommu@lists.linux-foundation.org,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v3 1/3] iommu/io-pgtable: Add ARMv7 short descriptor support
Date: Tue, 1 Mar 2016 13:51:26 +0000	[thread overview]
Message-ID: <56D59E5E.6040408@arm.com> (raw)
In-Reply-To: <CAMuHMdUH-_pxzjR2r7NAtv=Dc3SKGoy1L9UqETFD_6bXWMpKfg@mail.gmail.com>

Hi Geert,

On 01/03/16 12:01, Geert Uytterhoeven wrote:
> Hi Robin,
>
> On Tue, Jan 26, 2016 at 6:13 PM, Robin Murphy <robin.murphy@arm.com> wrote:
>> Add a nearly-complete ARMv7 short descriptor implementation, omitting
>> only a few legacy and CPU-centric aspects which shouldn't be necessary
>> for IOMMU API use anyway.
>>
>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   drivers/iommu/Kconfig              |  19 +
>>   drivers/iommu/Makefile             |   1 +
>>   drivers/iommu/io-pgtable-arm-v7s.c | 849 +++++++++++++++++++++++++++++++++++++
>>   drivers/iommu/io-pgtable.c         |   3 +
>>   drivers/iommu/io-pgtable.h         |  14 +-
>>   5 files changed, 885 insertions(+), 1 deletion(-)
>>   create mode 100644 drivers/iommu/io-pgtable-arm-v7s.c
>>
>> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>> index a1e75cb..dc1aaa5 100644
>> --- a/drivers/iommu/Kconfig
>> +++ b/drivers/iommu/Kconfig
>> @@ -39,6 +39,25 @@ config IOMMU_IO_PGTABLE_LPAE_SELFTEST
>>
>>            If unsure, say N here.
>>
>> +config IOMMU_IO_PGTABLE_ARMV7S
>> +       bool "ARMv7/v8 Short Descriptor Format"
>> +       select IOMMU_IO_PGTABLE
>> +       depends on HAS_DMA && (ARM || ARM64 || COMPILE_TEST)
>> +       help
>> +         Enable support for the ARM Short-descriptor pagetable format.
>> +         This supports 32-bit virtual and physical addresses mapped using
>> +         2-level tables with 4KB pages/1MB sections, and contiguous entries
>> +         for 64KB pages/16MB supersections if indicated by the IOMMU driver.
>> +
>> +config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
>> +       bool "ARMv7s selftests"
>> +       depends on IOMMU_IO_PGTABLE_ARMV7S
>> +       help
>> +         Enable self-tests for ARMv7s page table allocator. This performs
>> +         a series of page-table consistency checks during boot.
>> +
>> +         If unsure, say N here.
>> +
>
> When enabling IOMMU_IO_PGTABLE_ARMV7S_SELFTEST on r8a7791 (dual Cortex A15),
> the kernel crashes with:
>
> kernel BUG at mm/slab.c:2536!
> Internal error: Oops - BUG: 0 [#1] SMP ARM
> Modules linked in:[    1.299311] Modules linked in:
>
> CPU: 1 PID: 1 Comm: swapper/0 Not tainted
> 4.5.0-rc6-koelsch-05892-ge7e45ad53ab6795e #2270
> Hardware name: Generic R8A7791 (Flattened Device Tree)
> task: ef422040 ti: ef442000 task.ti: ef442000
> PC is at cache_alloc_refill+0x2a0/0x530
> LR is at _raw_spin_unlock+0x8/0xc
> pc : [<c02c6928>]    lr : [<c067f97c>]    psr: 00000093
> sp : ef443d88  ip : d0a7b1f0  fp : 02000020
> r10: 00000010  r9 : 00000000  r8 : 02088020
> r7 : 00000000  r6 : ef5172c0  r5 : 00000000  r4 : ef5d7f40
> r3 : 00004001  r2 : 00000001  r1 : 00020001  r0 : ef5172c0
> Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> Control: 30c5387d  Table: 40003000  DAC: 55555555
> Process swapper/0 (pid: 1, stack limit = 0xef442210)
> Stack: (0xef443d88 to 0xef444000)
> 3d80:                   ef48b4c0 00000000 ef5172d0 c0e38280 00000000 00001000
> 3da0: 02088020 60000013 ef5d7f40 c0445010 00000000 ef517340 00001000 c02c6630
> 3dc0: 00000008 00001000 00000000 00000400 00000002 c04444bc 00000000 00000000
> 3de0: 024000c0 ef517340 00000000 00004000 00000001 00000001 c0e3b000 ef517340
> 3e00: 00000000 00001000 00000000 ef5f8000 ef517340 c0445010 00000000 0000000f
> 3e20: 00001000 c0444e1c 00000000 00000000 ef517350 00000000 ef520f15 ef517340
> 3e40: ef443ea0 ef517390 00000000 00000000 00001000 c0445010 00000000 ef517390
> 3e60: 00001000 c0445044 00001000 0000000f ef5f8000 ef443ea0 c0e92a00 c0e92a00
> 3e80: 00000000 00000000 0000000c c0c18ee4 00001000 0000000f 00000001 00000014
> 3ea0: 00000001 01111000 00000020 00000020 c0e25bc8 00000000 6f5f806a 00000000
> 3ec0: 00000020 40004000 800b8204 00000000 00000000 00000000 00000000 00000000
> 3ee0: c0c3ce94 ef520f00 c0c18da4 00000000 c0e05550 c0e05550 c0e3b000 c0c2d848
> 3f00: 00000000 c0201760 ef5036c0 c0804b44 c0e5fdd0 00000000 c0e0be00 c0e0be7c
> 3f20: 00000000 60000013 00000000 efffec51 efffec59 c023893c c09dc204 00000004
> 3f40: 00000004 c09dce98 000000a0 c09dce98 c0e09e78 00000004 c0c2d834 00000004
> 3f60: c0c2d838 000000a1 c0c3ce94 c0e3b000 c0e3b000 c0c00d4c 00000004 00000004
> 3f80: 00000000 c0c0058c 00000000 c067a35c 00000000 00000000 00000000 00000000
> 3fa0: 00000000 c067a364 00000000 c0206b68 00000000 00000000 00000000 00000000
> 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ef443ff4 00000000
> [<c02c6928>] (cache_alloc_refill) from [<c02c6630>] (kmem_cache_alloc+0x7c/0xd4)
> [<c02c6630>] (kmem_cache_alloc) from [<c04444bc>]
> (__arm_v7s_alloc_table+0x5c/0x278)
> [<c04444bc>] (__arm_v7s_alloc_table) from [<c0444e1c>]
> (__arm_v7s_map.constprop.6+0x68/0x25c)
> [<c0444e1c>] (__arm_v7s_map.constprop.6) from [<c0445044>]
> (arm_v7s_map+0x34/0xa4)
> [<c0445044>] (arm_v7s_map) from [<c0c18ee4>] (arm_v7s_do_selftests+0x140/0x418)
> [<c0c18ee4>] (arm_v7s_do_selftests) from [<c0201760>]
> (do_one_initcall+0x100/0x1b4)
> [<c0201760>] (do_one_initcall) from [<c0c00d4c>]
> (kernel_init_freeable+0x120/0x1e8)
> [<c0c00d4c>] (kernel_init_freeable) from [<c067a364>] (kernel_init+0x8/0xec)
> [<c067a364>] (kernel_init) from [<c0206b68>] (ret_from_fork+0x14/0x2c)
> Code: 1a000003 e7f001f2 e3130001 0a000000 (e7f001f2)
> ---[ end trace 190f6f6b84352efd ]---
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> I don't know if r8a7791 supports v7s. Still, I don't expect a crash.
> The LPAE selftest runs fine.
>
> On r8a7795 (arm64), both the LPAE and V7S selftests run fine.

The hardware itself shouldn't matter, as the selftests run without 
reference to any device at all. At a glance this looks like a difference 
in behaviour between SLAB and SLUB - I see shmobile_defconfig sets 
CONFIG_SLAB=y. I'll reproduce it locally to make sure.

Thanks for the report,
Robin.

> Gr{oetje,eeting}s,
>
>                          Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds
>

WARNING: multiple messages have this Message-ID (diff)
From: robin.murphy@arm.com (Robin Murphy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/3] iommu/io-pgtable: Add ARMv7 short descriptor support
Date: Tue, 1 Mar 2016 13:51:26 +0000	[thread overview]
Message-ID: <56D59E5E.6040408@arm.com> (raw)
In-Reply-To: <CAMuHMdUH-_pxzjR2r7NAtv=Dc3SKGoy1L9UqETFD_6bXWMpKfg@mail.gmail.com>

Hi Geert,

On 01/03/16 12:01, Geert Uytterhoeven wrote:
> Hi Robin,
>
> On Tue, Jan 26, 2016 at 6:13 PM, Robin Murphy <robin.murphy@arm.com> wrote:
>> Add a nearly-complete ARMv7 short descriptor implementation, omitting
>> only a few legacy and CPU-centric aspects which shouldn't be necessary
>> for IOMMU API use anyway.
>>
>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
>> ---
>>   drivers/iommu/Kconfig              |  19 +
>>   drivers/iommu/Makefile             |   1 +
>>   drivers/iommu/io-pgtable-arm-v7s.c | 849 +++++++++++++++++++++++++++++++++++++
>>   drivers/iommu/io-pgtable.c         |   3 +
>>   drivers/iommu/io-pgtable.h         |  14 +-
>>   5 files changed, 885 insertions(+), 1 deletion(-)
>>   create mode 100644 drivers/iommu/io-pgtable-arm-v7s.c
>>
>> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>> index a1e75cb..dc1aaa5 100644
>> --- a/drivers/iommu/Kconfig
>> +++ b/drivers/iommu/Kconfig
>> @@ -39,6 +39,25 @@ config IOMMU_IO_PGTABLE_LPAE_SELFTEST
>>
>>            If unsure, say N here.
>>
>> +config IOMMU_IO_PGTABLE_ARMV7S
>> +       bool "ARMv7/v8 Short Descriptor Format"
>> +       select IOMMU_IO_PGTABLE
>> +       depends on HAS_DMA && (ARM || ARM64 || COMPILE_TEST)
>> +       help
>> +         Enable support for the ARM Short-descriptor pagetable format.
>> +         This supports 32-bit virtual and physical addresses mapped using
>> +         2-level tables with 4KB pages/1MB sections, and contiguous entries
>> +         for 64KB pages/16MB supersections if indicated by the IOMMU driver.
>> +
>> +config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
>> +       bool "ARMv7s selftests"
>> +       depends on IOMMU_IO_PGTABLE_ARMV7S
>> +       help
>> +         Enable self-tests for ARMv7s page table allocator. This performs
>> +         a series of page-table consistency checks during boot.
>> +
>> +         If unsure, say N here.
>> +
>
> When enabling IOMMU_IO_PGTABLE_ARMV7S_SELFTEST on r8a7791 (dual Cortex A15),
> the kernel crashes with:
>
> kernel BUG at mm/slab.c:2536!
> Internal error: Oops - BUG: 0 [#1] SMP ARM
> Modules linked in:[    1.299311] Modules linked in:
>
> CPU: 1 PID: 1 Comm: swapper/0 Not tainted
> 4.5.0-rc6-koelsch-05892-ge7e45ad53ab6795e #2270
> Hardware name: Generic R8A7791 (Flattened Device Tree)
> task: ef422040 ti: ef442000 task.ti: ef442000
> PC is at cache_alloc_refill+0x2a0/0x530
> LR is at _raw_spin_unlock+0x8/0xc
> pc : [<c02c6928>]    lr : [<c067f97c>]    psr: 00000093
> sp : ef443d88  ip : d0a7b1f0  fp : 02000020
> r10: 00000010  r9 : 00000000  r8 : 02088020
> r7 : 00000000  r6 : ef5172c0  r5 : 00000000  r4 : ef5d7f40
> r3 : 00004001  r2 : 00000001  r1 : 00020001  r0 : ef5172c0
> Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> Control: 30c5387d  Table: 40003000  DAC: 55555555
> Process swapper/0 (pid: 1, stack limit = 0xef442210)
> Stack: (0xef443d88 to 0xef444000)
> 3d80:                   ef48b4c0 00000000 ef5172d0 c0e38280 00000000 00001000
> 3da0: 02088020 60000013 ef5d7f40 c0445010 00000000 ef517340 00001000 c02c6630
> 3dc0: 00000008 00001000 00000000 00000400 00000002 c04444bc 00000000 00000000
> 3de0: 024000c0 ef517340 00000000 00004000 00000001 00000001 c0e3b000 ef517340
> 3e00: 00000000 00001000 00000000 ef5f8000 ef517340 c0445010 00000000 0000000f
> 3e20: 00001000 c0444e1c 00000000 00000000 ef517350 00000000 ef520f15 ef517340
> 3e40: ef443ea0 ef517390 00000000 00000000 00001000 c0445010 00000000 ef517390
> 3e60: 00001000 c0445044 00001000 0000000f ef5f8000 ef443ea0 c0e92a00 c0e92a00
> 3e80: 00000000 00000000 0000000c c0c18ee4 00001000 0000000f 00000001 00000014
> 3ea0: 00000001 01111000 00000020 00000020 c0e25bc8 00000000 6f5f806a 00000000
> 3ec0: 00000020 40004000 800b8204 00000000 00000000 00000000 00000000 00000000
> 3ee0: c0c3ce94 ef520f00 c0c18da4 00000000 c0e05550 c0e05550 c0e3b000 c0c2d848
> 3f00: 00000000 c0201760 ef5036c0 c0804b44 c0e5fdd0 00000000 c0e0be00 c0e0be7c
> 3f20: 00000000 60000013 00000000 efffec51 efffec59 c023893c c09dc204 00000004
> 3f40: 00000004 c09dce98 000000a0 c09dce98 c0e09e78 00000004 c0c2d834 00000004
> 3f60: c0c2d838 000000a1 c0c3ce94 c0e3b000 c0e3b000 c0c00d4c 00000004 00000004
> 3f80: 00000000 c0c0058c 00000000 c067a35c 00000000 00000000 00000000 00000000
> 3fa0: 00000000 c067a364 00000000 c0206b68 00000000 00000000 00000000 00000000
> 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ef443ff4 00000000
> [<c02c6928>] (cache_alloc_refill) from [<c02c6630>] (kmem_cache_alloc+0x7c/0xd4)
> [<c02c6630>] (kmem_cache_alloc) from [<c04444bc>]
> (__arm_v7s_alloc_table+0x5c/0x278)
> [<c04444bc>] (__arm_v7s_alloc_table) from [<c0444e1c>]
> (__arm_v7s_map.constprop.6+0x68/0x25c)
> [<c0444e1c>] (__arm_v7s_map.constprop.6) from [<c0445044>]
> (arm_v7s_map+0x34/0xa4)
> [<c0445044>] (arm_v7s_map) from [<c0c18ee4>] (arm_v7s_do_selftests+0x140/0x418)
> [<c0c18ee4>] (arm_v7s_do_selftests) from [<c0201760>]
> (do_one_initcall+0x100/0x1b4)
> [<c0201760>] (do_one_initcall) from [<c0c00d4c>]
> (kernel_init_freeable+0x120/0x1e8)
> [<c0c00d4c>] (kernel_init_freeable) from [<c067a364>] (kernel_init+0x8/0xec)
> [<c067a364>] (kernel_init) from [<c0206b68>] (ret_from_fork+0x14/0x2c)
> Code: 1a000003 e7f001f2 e3130001 0a000000 (e7f001f2)
> ---[ end trace 190f6f6b84352efd ]---
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
>
> I don't know if r8a7791 supports v7s. Still, I don't expect a crash.
> The LPAE selftest runs fine.
>
> On r8a7795 (arm64), both the LPAE and V7S selftests run fine.

The hardware itself shouldn't matter, as the selftests run without 
reference to any device at all. At a glance this looks like a difference 
in behaviour between SLAB and SLUB - I see shmobile_defconfig sets 
CONFIG_SLAB=y. I'll reproduce it locally to make sure.

Thanks for the report,
Robin.

> Gr{oetje,eeting}s,
>
>                          Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds
>

  parent reply	other threads:[~2016-03-01 13:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26 17:13 [PATCH v3 0/3] io-pgtable ARM short descriptor format Robin Murphy
2016-01-26 17:13 ` Robin Murphy
     [not found] ` <cover.1453723096.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-01-26 17:13   ` [PATCH v3 1/3] iommu/io-pgtable: Add ARMv7 short descriptor support Robin Murphy
2016-01-26 17:13     ` Robin Murphy
     [not found]     ` <066c4af0e29c9cc658bd5e48edc5e2d7ba7140a1.1453723096.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-01-27  1:16       ` Yong Wu
2016-01-27  1:16         ` Yong Wu
2016-01-28 13:41         ` Robin Murphy
2016-01-28 13:41           ` Robin Murphy
     [not found]           ` <56AA1A89.6080706-5wv7dgnIgG8@public.gmane.org>
2016-02-17 14:31             ` Will Deacon
2016-02-17 14:31               ` Will Deacon
     [not found]               ` <20160217143106.GC1459-5wv7dgnIgG8@public.gmane.org>
2016-02-17 14:34                 ` Robin Murphy
2016-02-17 14:34                   ` Robin Murphy
2016-02-10 15:48       ` Will Deacon
2016-02-10 15:48         ` Will Deacon
     [not found]         ` <20160210154815.GO1052-5wv7dgnIgG8@public.gmane.org>
2016-02-11 16:13           ` [PATCH 4/3] iommu/io-pgtable: Rationalise quirk handling Robin Murphy
2016-02-11 16:13             ` Robin Murphy
     [not found]             ` <ea1f3d3feec0dc9c18d43393678370b50b1275f5.1455206840.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-02-11 20:39               ` Laurent Pinchart
2016-02-11 20:39                 ` Laurent Pinchart
2016-02-12 12:08               ` Will Deacon
2016-02-12 12:08                 ` Will Deacon
     [not found]                 ` <20160212120857.GN25087-5wv7dgnIgG8@public.gmane.org>
2016-02-12 12:32                   ` Laurent Pinchart
2016-02-12 12:32                     ` Laurent Pinchart
2016-02-12 15:23                     ` Robin Murphy
2016-02-12 15:23                       ` Robin Murphy
     [not found]                       ` <56BDF8D8.4010200-5wv7dgnIgG8@public.gmane.org>
2016-02-12 15:55                         ` Will Deacon
2016-02-12 15:55                           ` Will Deacon
2016-03-01 12:01     ` [PATCH v3 1/3] iommu/io-pgtable: Add ARMv7 short descriptor support Geert Uytterhoeven
2016-03-01 12:01       ` Geert Uytterhoeven
2016-03-01 13:13       ` Laurent Pinchart
2016-03-01 13:13         ` Laurent Pinchart
2016-03-01 13:51       ` Robin Murphy [this message]
2016-03-01 13:51         ` Robin Murphy
2016-01-26 17:13   ` [PATCH v3 2/3] iommu/io-pgtable: Add helper functions for TLB ops Robin Murphy
2016-01-26 17:13     ` Robin Murphy
2016-01-26 17:13   ` [PATCH v3 3/3] iommu/io-pgtable: Avoid redundant TLB syncs Robin Murphy
2016-01-26 17:13     ` Robin Murphy
     [not found]     ` <81a5e784494a04713e152659c95b34e92d944f32.1453723096.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-02-10 14:21       ` Will Deacon
2016-02-10 14:21         ` Will Deacon
2016-02-12 17:09   ` [PATCH v2] iommu/io-pgtable: Rationalise quirk handling Robin Murphy
2016-02-12 17:09     ` Robin Murphy
     [not found]     ` <62860b753f304beef7b4b6f1e13d7094252f2f37.1455294748.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-02-12 17:24       ` Laurent Pinchart
2016-02-12 17:24         ` Laurent Pinchart
2016-02-12 17:25         ` Robin Murphy
2016-02-12 17:25           ` Robin Murphy
2016-02-12 17:27       ` Will Deacon
2016-02-12 17:27         ` Will Deacon

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=56D59E5E.6040408@arm.com \
    --to=robin.murphy@arm.com \
    --cc=geert@linux-m68k.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=will.deacon@arm.com \
    --cc=yong.wu@mediatek.com \
    /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.