diff mbox

mmotm 2015-01-22-15-04: qemu failures due to 'mm: account pmd page tables to the process'

Message ID 20150124055207.GA8926@roeck-us.net (mailing list archive)
State New, archived
Headers show

Commit Message

Guenter Roeck Jan. 24, 2015, 5:52 a.m. UTC
On Fri, Jan 23, 2015 at 01:55:19PM -0800, Andrew Morton wrote:
> On Fri, 23 Jan 2015 07:07:56 -0800 Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > >>
> > >> qemu:microblaze generates warnings to the console.
> > >>
> > >> WARNING: CPU: 0 PID: 32 at mm/mmap.c:2858 exit_mmap+0x184/0x1a4()
> > >>
> > >> with various call stacks. See
> > >> http://server.roeck-us.net:8010/builders/qemu-microblaze-mmotm/builds/15/steps/qemubuildcommand/logs/stdio
> > >> for details.
> > >
> > > Could you try patch below? Completely untested.
> > >
> > >>From b584bb8d493794f67484c0b57c161d61c02599bc Mon Sep 17 00:00:00 2001
> > > From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> > > Date: Fri, 23 Jan 2015 13:08:26 +0200
> > > Subject: [PATCH] microblaze: define __PAGETABLE_PMD_FOLDED
> > >
> > > Microblaze uses custom implementation of PMD folding, but doesn't define
> > > __PAGETABLE_PMD_FOLDED, which generic code expects to see. Let's fix it.
> > >
> > > Defining __PAGETABLE_PMD_FOLDED will drop out unused __pmd_alloc().
> > > It also fixes problems with recently-introduced pmd accounting.
> > >
> > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > 
> > Tested working.
> > 
> > Tested-by: Guenter Roeck <linux@roeck-us.net>
> > 
> > Any idea how to fix the sh problem ?
> 
> Can you tell us more about it?  All I'm seeing is "qemu:sh fails to
> shut down", which isn't very clear.

Turns out that the include file defining __PAGETABLE_PMD_FOLDED
was not always included where used, resulting in a messed up mm_struct.

The patch below fixes the problem for the sh architecture.
No idea if the patch is correct/acceptable for other architectures.

Guenter

---
>From 2a11491a5d0642c924db1d78f2b8f21985459062 Mon Sep 17 00:00:00 2001
From: Guenter Roeck <linux@roeck-us.net>
Date: Fri, 23 Jan 2015 21:44:06 -0800
Subject: [PATCH] mm_types: include asm/pgtable.h

Commit 22310c209483 ("mm: account pmd page tables to the process") starts using
__PAGETABLE_PMD_FOLDED in mm_types.h. This define is usually declared in
pgtable.h, so pgtable.h neeeds to be included.

Fixes runtime error with sh targets.

Fixes: 22310c209483 ("mm: account pmd page tables to the process")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 include/linux/mm_types.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Kirill A . Shutemov Jan. 26, 2015, 12:29 p.m. UTC | #1
On Fri, Jan 23, 2015 at 09:52:07PM -0800, Guenter Roeck wrote:
> On Fri, Jan 23, 2015 at 01:55:19PM -0800, Andrew Morton wrote:
> > On Fri, 23 Jan 2015 07:07:56 -0800 Guenter Roeck <linux@roeck-us.net> wrote:
> > 
> > > >>
> > > >> qemu:microblaze generates warnings to the console.
> > > >>
> > > >> WARNING: CPU: 0 PID: 32 at mm/mmap.c:2858 exit_mmap+0x184/0x1a4()
> > > >>
> > > >> with various call stacks. See
> > > >> http://server.roeck-us.net:8010/builders/qemu-microblaze-mmotm/builds/15/steps/qemubuildcommand/logs/stdio
> > > >> for details.
> > > >
> > > > Could you try patch below? Completely untested.
> > > >
> > > >>From b584bb8d493794f67484c0b57c161d61c02599bc Mon Sep 17 00:00:00 2001
> > > > From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> > > > Date: Fri, 23 Jan 2015 13:08:26 +0200
> > > > Subject: [PATCH] microblaze: define __PAGETABLE_PMD_FOLDED
> > > >
> > > > Microblaze uses custom implementation of PMD folding, but doesn't define
> > > > __PAGETABLE_PMD_FOLDED, which generic code expects to see. Let's fix it.
> > > >
> > > > Defining __PAGETABLE_PMD_FOLDED will drop out unused __pmd_alloc().
> > > > It also fixes problems with recently-introduced pmd accounting.
> > > >
> > > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > 
> > > Tested working.
> > > 
> > > Tested-by: Guenter Roeck <linux@roeck-us.net>
> > > 
> > > Any idea how to fix the sh problem ?
> > 
> > Can you tell us more about it?  All I'm seeing is "qemu:sh fails to
> > shut down", which isn't very clear.
> 
> Turns out that the include file defining __PAGETABLE_PMD_FOLDED
> was not always included where used, resulting in a messed up mm_struct.

What means "messed up" here? It should only affect size of mm_struct.
 
> The patch below fixes the problem for the sh architecture.
> No idea if the patch is correct/acceptable for other architectures.

That's pain. Some archs includes <linux/mm_types.h> from <asm/pgtable.h>.
I don't see obvious way to fix this. Urghh.
Guenter Roeck Jan. 26, 2015, 2:03 p.m. UTC | #2
On 01/26/2015 04:29 AM, Kirill A. Shutemov wrote:
> On Fri, Jan 23, 2015 at 09:52:07PM -0800, Guenter Roeck wrote:
>> On Fri, Jan 23, 2015 at 01:55:19PM -0800, Andrew Morton wrote:
>>> On Fri, 23 Jan 2015 07:07:56 -0800 Guenter Roeck <linux@roeck-us.net> wrote:
>>>
>>>>>>
>>>>>> qemu:microblaze generates warnings to the console.
>>>>>>
>>>>>> WARNING: CPU: 0 PID: 32 at mm/mmap.c:2858 exit_mmap+0x184/0x1a4()
>>>>>>
>>>>>> with various call stacks. See
>>>>>> http://server.roeck-us.net:8010/builders/qemu-microblaze-mmotm/builds/15/steps/qemubuildcommand/logs/stdio
>>>>>> for details.
>>>>>
>>>>> Could you try patch below? Completely untested.
>>>>>
>>>>> >From b584bb8d493794f67484c0b57c161d61c02599bc Mon Sep 17 00:00:00 2001
>>>>> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>>>>> Date: Fri, 23 Jan 2015 13:08:26 +0200
>>>>> Subject: [PATCH] microblaze: define __PAGETABLE_PMD_FOLDED
>>>>>
>>>>> Microblaze uses custom implementation of PMD folding, but doesn't define
>>>>> __PAGETABLE_PMD_FOLDED, which generic code expects to see. Let's fix it.
>>>>>
>>>>> Defining __PAGETABLE_PMD_FOLDED will drop out unused __pmd_alloc().
>>>>> It also fixes problems with recently-introduced pmd accounting.
>>>>>
>>>>> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>>>>> Reported-by: Guenter Roeck <linux@roeck-us.net>
>>>>
>>>> Tested working.
>>>>
>>>> Tested-by: Guenter Roeck <linux@roeck-us.net>
>>>>
>>>> Any idea how to fix the sh problem ?
>>>
>>> Can you tell us more about it?  All I'm seeing is "qemu:sh fails to
>>> shut down", which isn't very clear.
>>
>> Turns out that the include file defining __PAGETABLE_PMD_FOLDED
>> was not always included where used, resulting in a messed up mm_struct.
>
> What means "messed up" here? It should only affect size of mm_struct.
>
Plus the offset of all variables after the #ifndef.

>> The patch below fixes the problem for the sh architecture.
>> No idea if the patch is correct/acceptable for other architectures.
>
> That's pain. Some archs includes <linux/mm_types.h> from <asm/pgtable.h>.
> I don't see obvious way to fix this. Urghh.
>
Does it matter ? Circular includes are normally ok and happen all over the place.
I could run a full build / qemu test cycle for all architectures if that helps.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck Jan. 26, 2015, 2:17 p.m. UTC | #3
On 01/26/2015 06:03 AM, Guenter Roeck wrote:
> On 01/26/2015 04:29 AM, Kirill A. Shutemov wrote:
>> On Fri, Jan 23, 2015 at 09:52:07PM -0800, Guenter Roeck wrote:
>>> On Fri, Jan 23, 2015 at 01:55:19PM -0800, Andrew Morton wrote:
>>>> On Fri, 23 Jan 2015 07:07:56 -0800 Guenter Roeck <linux@roeck-us.net> wrote:
>>>>
>>>>>>>
>>>>>>> qemu:microblaze generates warnings to the console.
>>>>>>>
>>>>>>> WARNING: CPU: 0 PID: 32 at mm/mmap.c:2858 exit_mmap+0x184/0x1a4()
>>>>>>>
>>>>>>> with various call stacks. See
>>>>>>> http://server.roeck-us.net:8010/builders/qemu-microblaze-mmotm/builds/15/steps/qemubuildcommand/logs/stdio
>>>>>>> for details.
>>>>>>
>>>>>> Could you try patch below? Completely untested.
>>>>>>
>>>>>> >From b584bb8d493794f67484c0b57c161d61c02599bc Mon Sep 17 00:00:00 2001
>>>>>> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>>>>>> Date: Fri, 23 Jan 2015 13:08:26 +0200
>>>>>> Subject: [PATCH] microblaze: define __PAGETABLE_PMD_FOLDED
>>>>>>
>>>>>> Microblaze uses custom implementation of PMD folding, but doesn't define
>>>>>> __PAGETABLE_PMD_FOLDED, which generic code expects to see. Let's fix it.
>>>>>>
>>>>>> Defining __PAGETABLE_PMD_FOLDED will drop out unused __pmd_alloc().
>>>>>> It also fixes problems with recently-introduced pmd accounting.
>>>>>>
>>>>>> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>>>>>> Reported-by: Guenter Roeck <linux@roeck-us.net>
>>>>>
>>>>> Tested working.
>>>>>
>>>>> Tested-by: Guenter Roeck <linux@roeck-us.net>
>>>>>
>>>>> Any idea how to fix the sh problem ?
>>>>
>>>> Can you tell us more about it?  All I'm seeing is "qemu:sh fails to
>>>> shut down", which isn't very clear.
>>>
>>> Turns out that the include file defining __PAGETABLE_PMD_FOLDED
>>> was not always included where used, resulting in a messed up mm_struct.
>>
>> What means "messed up" here? It should only affect size of mm_struct.
>>
> Plus the offset of all variables after the #ifndef.
>
>>> The patch below fixes the problem for the sh architecture.
>>> No idea if the patch is correct/acceptable for other architectures.
>>
>> That's pain. Some archs includes <linux/mm_types.h> from <asm/pgtable.h>.
>> I don't see obvious way to fix this. Urghh.
>>
> Does it matter ? Circular includes are normally ok and happen all over the place.

Ah yes, it does, because mm_struct will not see the define in that case
since it comes later. Hmm, that is really tricky. You could of course
just drop the conditional from mm_struct. That would result in an unused
variable for some architectures, but at least it would work.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 79cdf6f..65db573 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -13,6 +13,7 @@ 
 #include <linux/uprobes.h>
 #include <linux/page-flags-layout.h>
 #include <asm/page.h>
+#include <asm/pgtable.h>
 #include <asm/mmu.h>
 
 #ifndef AT_VECTOR_SIZE_ARCH