linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: axie <axie@amd.com>, Alex Deucher <alexander.deucher@amd.com>,
	"Writer, Tim" <Tim.Writer@amd.com>,
	linux-mm@kvack.org
Subject: Re: A possible bug: Calling mutex_lock while holding spinlock
Date: Fri, 4 Aug 2017 16:49:29 +0300	[thread overview]
Message-ID: <20170804134928.l4klfcnqatni7vsc@black.fi.intel.com> (raw)
In-Reply-To: <20170803153902.71ceaa3b435083fc2e112631@linux-foundation.org>

On Thu, Aug 03, 2017 at 03:39:02PM -0700, Andrew Morton wrote:
> 
> (cc Kirill)
> 
> On Thu, 3 Aug 2017 12:35:28 -0400 axie <axie@amd.com> wrote:
> 
> > Hi Andrew,
> > 
> > 
> > I got a report yesterday with "BUG: sleeping function called from 
> > invalid context at kernel/locking/mutex.c"
> > 
> > I checked the relevant functions for the issue. Function 
> > page_vma_mapped_walk did acquire spinlock. Later, in MMU notifier, 
> > amdgpu_mn_invalidate_page called function mutex_lock, which triggered 
> > the "bug".
> > 
> > Function page_vma_mapped_walk was introduced recently by you in commit
> > c7ab0d2fdc840266b39db94538f74207ec2afbf6 and 
> > ace71a19cec5eb430207c3269d8a2683f0574306.
> > 
> > Would you advise how to proceed with this bug? Change 
> > page_vma_mapped_walk not to use spinlock? Or change 
> > amdgpu_mn_invalidate_page to use spinlock to meet the change, or 
> > something else?
> > 
> 
> hm, as far as I can tell this was an unintended side-effect of
> c7ab0d2fd ("mm: convert try_to_unmap_one() to use
> page_vma_mapped_walk()").  Before that patch,
> mmu_notifier_invalidate_page() was not called under page_table_lock. 
> After that patch, mmu_notifier_invalidate_page() is called under
> page_table_lock.
> 
> Perhaps Kirill can suggest a fix?

Sorry for this.

What about the patch below?

       reply	other threads:[~2017-08-04 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2d442de2-c5d4-ecce-2345-4f8f34314247@amd.com>
     [not found] ` <20170803153902.71ceaa3b435083fc2e112631@linux-foundation.org>
2017-08-04 13:49   ` Kirill A. Shutemov [this message]
2017-08-04 14:03     ` axie
2017-08-08 16:51       ` axie
2017-08-08 17:01         ` Kirill A. Shutemov
2017-08-08 20:29           ` Kirill A. Shutemov

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=20170804134928.l4klfcnqatni7vsc@black.fi.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=Tim.Writer@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=axie@amd.com \
    --cc=linux-mm@kvack.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