All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Davidlohr Bueso <davidlohr@hp.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Rik van Riel <riel@redhat.com>, Vlastimil Babka <vbabka@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: mm: mmap_sem lock assertion failure in __mlock_vma_pages_range
Date: Tue, 11 Mar 2014 16:12:51 -0400	[thread overview]
Message-ID: <531F6E43.40901@oracle.com> (raw)
In-Reply-To: <1394568453.2786.28.camel@buesod1.americas.hpqcorp.net>

On 03/11/2014 04:07 PM, Davidlohr Bueso wrote:
> On Tue, 2014-03-11 at 15:39 -0400, Sasha Levin wrote:
>> Hi all,
>>
>> I've ended up deleting the log file by mistake, but this bug does seem to be important
>> so I'd rather not wait before the same issue is triggered again.
>>
>> The call chain is:
>>
>> 	mlock (mm/mlock.c:745)
>> 		__mm_populate (mm/mlock.c:700)
>> 			__mlock_vma_pages_range (mm/mlock.c:229)
>> 				VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
>
> So __mm_populate() is only called by mlock(2) and this VM_BUG_ON seems
> wrong as we call it without the lock held:
>
> 	up_write(&current->mm->mmap_sem);
> 	if (!error)
> 		error = __mm_populate(start, len, 0);
> 	return error;
> }
>
>>
>> It seems to be a rather simple trace triggered from userspace. The only recent patch
>> in the area (that I've noticed) was "mm/mlock: prepare params outside critical region".
>> I've reverted it and trying to testing without it.
>
> Odd, this patch should definitely *not* cause this. In any case every
> operation removed from the critical region is local to the function:
>
> 	lock_limit = rlimit(RLIMIT_MEMLOCK);
> 	lock_limit >>= PAGE_SHIFT;
> 	locked = len >> PAGE_SHIFT;
>
> 	down_write(&current->mm->mmap_sem);

Yeah, this patch doesn't look like it's causing it, I guess it was more of a "you touched this
code last - do you still remember what's going on here?" :).

It's semi-odd because it seems like an obvious issue to hit with trinity but it's the first time
I've seen it and it's probably been there for a while (that BUG_ON is there from 2009).


Thanks,
Sasha

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sasha.levin@oracle.com>
To: Davidlohr Bueso <davidlohr@hp.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michel Lespinasse <walken@google.com>,
	Rik van Riel <riel@redhat.com>, Vlastimil Babka <vbabka@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: mm: mmap_sem lock assertion failure in __mlock_vma_pages_range
Date: Tue, 11 Mar 2014 16:12:51 -0400	[thread overview]
Message-ID: <531F6E43.40901@oracle.com> (raw)
In-Reply-To: <1394568453.2786.28.camel@buesod1.americas.hpqcorp.net>

On 03/11/2014 04:07 PM, Davidlohr Bueso wrote:
> On Tue, 2014-03-11 at 15:39 -0400, Sasha Levin wrote:
>> Hi all,
>>
>> I've ended up deleting the log file by mistake, but this bug does seem to be important
>> so I'd rather not wait before the same issue is triggered again.
>>
>> The call chain is:
>>
>> 	mlock (mm/mlock.c:745)
>> 		__mm_populate (mm/mlock.c:700)
>> 			__mlock_vma_pages_range (mm/mlock.c:229)
>> 				VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
>
> So __mm_populate() is only called by mlock(2) and this VM_BUG_ON seems
> wrong as we call it without the lock held:
>
> 	up_write(&current->mm->mmap_sem);
> 	if (!error)
> 		error = __mm_populate(start, len, 0);
> 	return error;
> }
>
>>
>> It seems to be a rather simple trace triggered from userspace. The only recent patch
>> in the area (that I've noticed) was "mm/mlock: prepare params outside critical region".
>> I've reverted it and trying to testing without it.
>
> Odd, this patch should definitely *not* cause this. In any case every
> operation removed from the critical region is local to the function:
>
> 	lock_limit = rlimit(RLIMIT_MEMLOCK);
> 	lock_limit >>= PAGE_SHIFT;
> 	locked = len >> PAGE_SHIFT;
>
> 	down_write(&current->mm->mmap_sem);

Yeah, this patch doesn't look like it's causing it, I guess it was more of a "you touched this
code last - do you still remember what's going on here?" :).

It's semi-odd because it seems like an obvious issue to hit with trinity but it's the first time
I've seen it and it's probably been there for a while (that BUG_ON is there from 2009).


Thanks,
Sasha

  reply	other threads:[~2014-03-11 20:12 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 19:39 mm: mmap_sem lock assertion failure in __mlock_vma_pages_range Sasha Levin
2014-03-11 19:39 ` Sasha Levin
2014-03-11 20:07 ` Davidlohr Bueso
2014-03-11 20:07   ` Davidlohr Bueso
2014-03-11 20:12   ` Sasha Levin [this message]
2014-03-11 20:12     ` Sasha Levin
2014-03-11 20:21     ` Davidlohr Bueso
2014-03-11 20:21       ` Davidlohr Bueso
2014-03-11 20:30   ` Andrew Morton
2014-03-11 20:30     ` Andrew Morton
2014-03-11 20:35     ` Sasha Levin
2014-03-11 20:35       ` Sasha Levin
2014-03-11 20:42     ` Davidlohr Bueso
2014-03-11 20:42       ` Davidlohr Bueso
2014-03-11 20:45     ` Sasha Levin
2014-03-11 20:45       ` Sasha Levin
2014-03-11 20:47       ` Davidlohr Bueso
2014-03-11 20:47         ` Davidlohr Bueso
2014-03-11 20:57         ` Dave Jones
2014-03-11 20:57           ` Dave Jones
2014-03-11 21:02         ` Sasha Levin
2014-03-11 21:02           ` Sasha Levin
2014-03-11 21:45           ` Davidlohr Bueso
2014-03-11 21:45             ` Davidlohr Bueso
2014-03-11 22:20             ` Sasha Levin
2014-03-11 22:20               ` Sasha Levin
2014-03-13 19:00               ` Davidlohr Bueso
2014-03-13 19:00                 ` Davidlohr Bueso
2014-03-13 20:57                 ` Hugh Dickins
2014-03-13 20:57                   ` Hugh Dickins
2014-03-14 16:14                   ` Sasha Levin
2014-03-14 16:14                     ` Sasha Levin
2014-03-11 21:59   ` Michel Lespinasse
2014-03-11 21:59     ` Michel Lespinasse

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=531F6E43.40901@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidlohr@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=vbabka@suse.cz \
    --cc=walken@google.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.