From: Frank Mehnert <Frank.Mehnert@Sun.COM>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PFs on pages pinned with get_user_pages()
Date: Thu, 29 Jan 2009 15:41:32 +0100 [thread overview]
Message-ID: <200901291541.32618.frank.mehnert@sun.com> (raw)
In-Reply-To: <1233238854.4495.93.camel@laptop>
[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]
On Thursday 29 January 2009, Peter Zijlstra wrote:
> On Thu, 2009-01-29 at 15:02 +0100, Frank Mehnert wrote:
> > I'm one of the VirtualBox developers. We are trying to fix the annoying
> > kerneloops warning 'BUG: sleeping function called from invalid context'
> > reported by the Fedora folks. This warning occurs when do_swap_page()
> > calls lock_page() and in_atomic() returns true.
> >
> > This warning appears when we touch into memory which is pinned with
> > get_user_pages(). In VT-x/AMD-V mode we are executing some code in the
> > context of the Linux kernel. To prevent scheduling of the current CPU
> > core we disable the interripts. preempt_disable() would be probably the
> > better choice but this would oops as well if CONFIG_PREEMPT is enabled.
>
> but to get there, you'd have to have called handle_mm_fault() which
> requires the mmap_sem, which should also give that might_sleep()
> warning.
The stacktrace is
__might_sleep()
lock_page()
handle_mm_fault()
do_page_fault()
error_code
So yes, handle_mm_fault() is called. But I assume that down_read_trylock()
succeeded before we were forced to call down_read().
> That aside, is there any reason you have to avoid scheduling? Otherwise
> I would just allow so and be done with it.
The reason is that our code expects that to ensure syncing of the CPU
state with the saved state. I fear it is quite difficult to change that...
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert Sun Microsystems http://www.sun.com/
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-01-29 14:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-29 8:05 Frank Mehnert
2009-01-29 12:28 ` Peter Zijlstra
2009-01-29 13:08 ` Frank Mehnert
2009-01-29 13:43 ` Peter Zijlstra
2009-01-29 14:02 ` Frank Mehnert
2009-01-29 14:20 ` Peter Zijlstra
2009-01-29 14:41 ` Frank Mehnert [this message]
2009-01-29 14:52 ` Peter Zijlstra
2009-01-29 16:03 ` Frank Mehnert
2009-01-29 16:11 ` Peter Zijlstra
2009-01-30 10:34 ` Frank Mehnert
2009-01-30 10:45 ` Peter Zijlstra
2009-01-29 14:56 ` [PATCH] x86: add might_sleep() to do_page_fault() Peter Zijlstra
2009-01-29 14:59 ` Ingo Molnar
2009-01-29 15:02 ` [PATCH v2] " Peter Zijlstra
2009-01-29 15:03 ` Ingo Molnar
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=200901291541.32618.frank.mehnert@sun.com \
--to=frank.mehnert@sun.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@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
all inboxes | Powered by JetHome®