From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Do not call flush_cache_user_range with mmap_sem held
Date: Wed, 18 Apr 2012 18:15:29 +0100 [thread overview]
Message-ID: <20120418171529.GK1505@arm.com> (raw)
In-Reply-To: <20120418152726.GB24211@n2100.arm.linux.org.uk>
On Wed, Apr 18, 2012 at 04:27:26PM +0100, Russell King - ARM Linux wrote:
> On Wed, Apr 18, 2012 at 04:05:08PM +0100, Will Deacon wrote:
> > The cacheflush syscall can fail for two reasons:
> >
> > (1) The arguments are invalid (nonsensical address range or no VMA)
>
> That's a good reason...
>
> > (2) The region generates a translation fault on a VIPT or PIPT cache
>
> But I don't think this is, for two reasons:
>
> 1. Remember that the purpose of this operation is to allow userspace to
> write code into pages and then execute that code - so all that we're
> concerned about in this call is to ensure that the I/D caches for the
> memory region are synchronized.
>
> 2. We'll fault at the cache operation on v6 and v7 because the page was
> not present, and that will make the system try and bring the page back
> into the memory space.
With the current mainline kernel, if a fault happens during the cache
flushing operation we will deadlock since we try to re-acquire the
mmap_sem in do_page_fault() (that's what the original patch tries to
fix).
> Only if that fails (eg, because we're running
> low on memory) will we fail to replace the page, and use the exception
> handling.
>
> I think the original intention for (2) was that the page would merely get
> skipped and we'd move onto the next page without trying to bring the
> previous page back into the memory space - this won't work because of the
> way the page fault handler works. If we want that behaviour, we need to
> use pagefault_disable()..pagefault_enable() around the cache flushing to
> ensure that the page fault handler does not try to replace the missing
> page, but instead immediately calls the fixup function.
That's not always desirable as we may fault on an old pte and the
mkyoung path does not necessarily flush the caches. So processing the
page fault is still required in some cases.
--
Catalin
next prev parent reply other threads:[~2012-04-18 17:15 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 17:33 [PATCH] ARM: Do not call flush_cache_user_range with mmap_sem held Catalin Marinas
2011-11-16 21:23 ` Olof Johansson
2011-11-16 23:50 ` Russell King - ARM Linux
2011-11-17 0:16 ` Olof Johansson
2011-11-17 0:20 ` Olof Johansson
2011-11-17 10:26 ` Catalin Marinas
2011-11-17 10:49 ` Russell King - ARM Linux
2011-11-17 10:45 ` Russell King - ARM Linux
2011-11-20 17:54 ` Olof Johansson
2011-11-17 10:22 ` Catalin Marinas
2011-11-17 10:42 ` Russell King - ARM Linux
2011-11-17 10:59 ` Catalin Marinas
2011-11-17 11:03 ` Russell King - ARM Linux
2011-11-17 11:25 ` Catalin Marinas
2012-04-09 5:58 ` Dirk Behme
2012-04-09 14:24 ` Olof Johansson
2012-04-10 17:17 ` Will Deacon
2012-04-18 15:05 ` Will Deacon
2012-04-18 15:27 ` Russell King - ARM Linux
2012-04-18 16:27 ` Will Deacon
2012-04-18 17:15 ` Catalin Marinas [this message]
2012-04-18 8:40 ` Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2010-04-28 7:32 [PATCH] [ARM] " Dima Zavin
2010-04-28 7:35 ` Dima Zavin
2010-04-29 13:00 ` Russell King - ARM Linux
2010-04-29 18:16 ` Jamie Lokier
2010-04-29 18:24 ` Russell King - ARM Linux
2010-04-29 19:23 ` Dima Zavin
2010-05-04 4:07 ` Dima Zavin
2010-05-04 7:40 ` Russell King - ARM Linux
2010-05-06 15:08 ` Catalin Marinas
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=20120418171529.GK1505@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.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 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.