From: Luis Henriques <luis.henriques@canonical.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
akpm@linux-foundation.org,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Russell King" <rmk+kernel@arm.linux.org.uk>,
"Simon Baatz" <gmbnomis@gmail.com>
Subject: Re: [04/26] ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page
Date: Wed, 26 Jun 2013 10:04:11 +0100 [thread overview]
Message-ID: <878v1x4510.fsf@canonical.com> (raw)
In-Reply-To: <lsq.1372214158.657310117@decadent.org.uk> (Ben Hutchings's message of "Wed, 26 Jun 2013 03:35:58 +0100")
Ben Hutchings <ben@decadent.org.uk> writes:
> 3.2.48-rc1 review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Simon Baatz <gmbnomis@gmail.com>
>
> commit 1bc39742aab09248169ef9d3727c9def3528b3f3 upstream.
Simon suggested Greg not to queue this patch for stable kernels as it
breaks no-MMU ARM configs. He will provide a follow-up patch that
should go together with this one.
Cheers,
--
Luis
>
> Commit f8b63c1 made flush_kernel_dcache_page a no-op assuming that
> the pages it needs to handle are kernel mapped only. However, for
> example when doing direct I/O, pages with user space mappings may
> occur.
>
> Thus, continue to do lazy flushing if there are no user space
> mappings. Otherwise, flush the kernel cache lines directly.
>
> Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> arch/arm/include/asm/cacheflush.h | 4 +---
> arch/arm/mm/flush.c | 33 +++++++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 3 deletions(-)
>
> --- a/arch/arm/include/asm/cacheflush.h
> +++ b/arch/arm/include/asm/cacheflush.h
> @@ -301,9 +301,7 @@ static inline void flush_anon_page(struc
> }
>
> #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
> -static inline void flush_kernel_dcache_page(struct page *page)
> -{
> -}
> +extern void flush_kernel_dcache_page(struct page *);
>
> #define flush_dcache_mmap_lock(mapping) \
> spin_lock_irq(&(mapping)->tree_lock)
> --- a/arch/arm/mm/flush.c
> +++ b/arch/arm/mm/flush.c
> @@ -304,6 +304,39 @@ void flush_dcache_page(struct page *page
> EXPORT_SYMBOL(flush_dcache_page);
>
> /*
> + * Ensure cache coherency for the kernel mapping of this page. We can
> + * assume that the page is pinned via kmap.
> + *
> + * If the page only exists in the page cache and there are no user
> + * space mappings, this is a no-op since the page was already marked
> + * dirty at creation. Otherwise, we need to flush the dirty kernel
> + * cache lines directly.
> + */
> +void flush_kernel_dcache_page(struct page *page)
> +{
> + if (cache_is_vivt() || cache_is_vipt_aliasing()) {
> + struct address_space *mapping;
> +
> + mapping = page_mapping(page);
> +
> + if (!mapping || mapping_mapped(mapping)) {
> + void *addr;
> +
> + addr = page_address(page);
> + /*
> + * kmap_atomic() doesn't set the page virtual
> + * address for highmem pages, and
> + * kunmap_atomic() takes care of cache
> + * flushing already.
> + */
> + if (!IS_ENABLED(CONFIG_HIGHMEM) || addr)
> + __cpuc_flush_dcache_area(addr, PAGE_SIZE);
> + }
> + }
> +}
> +EXPORT_SYMBOL(flush_kernel_dcache_page);
> +
> +/*
> * Flush an anonymous page so that users of get_user_pages()
> * can safely access the data. The expected sequence is:
> *
>
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-06-26 9:04 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 2:35 [00/26] 3.2.48-rc1 review Ben Hutchings
2013-06-26 2:35 ` [16/26] r8169: fix 8168evl frame padding Ben Hutchings
2013-06-26 8:51 ` Stefan Bader
2013-06-26 18:37 ` David Miller
2013-06-26 20:00 ` Stefan Bader
2013-06-26 2:35 ` [19/26] net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg Ben Hutchings
2013-06-26 2:35 ` [07/26] USB: serial: ti_usb_3410_5052: new device id for Abbot strip port cable Ben Hutchings
2013-06-26 8:21 ` Anders Hammarquist
2013-06-26 17:22 ` Greg Kroah-Hartman
2013-06-26 2:35 ` [06/26] x86: fix build error and kconfig for ia32_emulation and binfmt Ben Hutchings
2013-06-26 2:35 ` [04/26] ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page Ben Hutchings
2013-06-26 9:04 ` Luis Henriques [this message]
2013-06-26 22:35 ` Simon Baatz
2013-06-27 8:21 ` Luis Henriques
2013-06-29 3:01 ` Ben Hutchings
2013-06-26 2:35 ` [01/26] tilepro: work around module link error with gcc 4.7 Ben Hutchings
2013-06-26 2:35 ` [12/26] tcp: fix tcp_md5_hash_skb_data() Ben Hutchings
2013-06-26 2:35 ` [03/26] ALSA: usb-audio: Fix invalid volume resolution for Logitech HD Webcam c310 Ben Hutchings
2013-06-26 2:35 ` [10/26] Revert "drm/i915: GFX_MODE Flush TLB Invalidate Mode must be '1' for scanline waits" Ben Hutchings
2013-06-26 2:35 ` [13/26] gianfar: add missing iounmap() on error in gianfar_ptp_probe() Ben Hutchings
2013-06-26 2:35 ` [11/26] virtio-blk: Call revalidate_disk() upon online disk resize Ben Hutchings
2013-06-26 2:35 ` [15/26] netlabel: improve domain mapping validation Ben Hutchings
2013-06-26 2:35 ` [17/26] tcp: xps: fix reordering issues Ben Hutchings
2013-06-26 2:35 ` [05/26] KVM: x86: remove vcpu's CPL check in host-invoked XCR set Ben Hutchings
2013-06-26 2:35 ` [18/26] ip_tunnel: fix kernel panic with icmp_dest_unreach Ben Hutchings
2013-06-26 2:35 ` [09/26] x86/efi: Fix dummy variable buffer allocation Ben Hutchings
2013-06-26 2:35 ` [14/26] ipv6: fix possible crashes in ip6_cork_release() Ben Hutchings
2013-06-26 2:35 ` [02/26] ALSA: usb-audio: work around Android accessory firmware bug Ben Hutchings
2013-06-26 2:35 ` [26/26] ncpfs: fix rmdir returns Device or resource busy Ben Hutchings
2013-06-26 2:35 ` [25/26] l2tp: Fix sendmsg() return value Ben Hutchings
2013-06-26 2:35 ` [22/26] net: sctp: fix NULL pointer dereference in socket destruction Ben Hutchings
2013-06-26 2:35 ` [23/26] packet: packet_getname_spkt: make sure string is always 0-terminated Ben Hutchings
2013-06-26 2:35 ` [21/26] ipv6: assign rt6_info to inet6_ifaddr in init_loopback Ben Hutchings
2013-06-26 2:35 ` [20/26] net: force a reload of first item in hlist_nulls_for_each_entry_rcu Ben Hutchings
2013-06-26 2:35 ` [24/26] l2tp: Fix PPP header erasure and memory leak Ben Hutchings
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=878v1x4510.fsf@canonical.com \
--to=luis.henriques@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=ben@decadent.org.uk \
--cc=catalin.marinas@arm.com \
--cc=gmbnomis@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).