From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, dan.j.wiilliams@intel.com, hch@lst.de,
hpa@zytor.com, jack@suse.cz, jmoyer@redhat.com,
linux-mm@kvack.org, mawilcox@microsoft.com, mingo@elte.hu,
mingo@redhat.com, mm-commits@vger.kernel.org,
mpatocka@redhat.com, ross.zwisler@linux.intel.com,
stable@vger.kernel.org, tglx@linutronix.de,
torvalds@linux-foundation.org, toshi.kani@hpe.com,
viro@zeniv.linux.org.uk
Subject: [patch 7/9] arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback
Date: Fri, 25 Sep 2020 21:19:24 -0700 [thread overview]
Message-ID: <20200926041924.JrUcL1D_9%akpm@linux-foundation.org> (raw)
In-Reply-To: <20200925211725.0fea54be9e9715486efea21f@linux-foundation.org>
From: Mikulas Patocka <mpatocka@redhat.com>
Subject: arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback
If we copy less than 8 bytes and if the destination crosses a cache line,
__copy_user_flushcache would invalidate only the first cache line. This
patch makes it invalidate the second cache line as well.
Link: https://lkml.kernel.org/r/alpine.LRH.2.02.2009161451140.21915@file01.intranet.prod.int.rdu2.redhat.com
Fixes: 0aed55af88345b ("x86, uaccess: introduce copy_from_iter_flushcache for pmem / cache-bypass operations")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Dan Williams <dan.j.wiilliams@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/x86/lib/usercopy_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/lib/usercopy_64.c~arch-x86-lib-usercopy_64c-fix-__copy_user_flushcache-cache-writeback
+++ a/arch/x86/lib/usercopy_64.c
@@ -120,7 +120,7 @@ long __copy_user_flushcache(void *dst, c
*/
if (size < 8) {
if (!IS_ALIGNED(dest, 4) || size != 4)
- clean_cache_range(dst, 1);
+ clean_cache_range(dst, size);
} else {
if (!IS_ALIGNED(dest, 8)) {
dest = ALIGN(dest, boot_cpu_data.x86_clflush_size);
_
next prev parent reply other threads:[~2020-09-26 4:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-26 4:17 incoming Andrew Morton
2020-09-26 4:19 ` [patch 1/9] mm, THP, swap: fix allocating cluster for swapfile by mistake Andrew Morton
2020-09-26 4:19 ` [patch 2/9] mm: memcontrol: fix missing suffix of workingset_restore Andrew Morton
2020-09-26 4:19 ` [patch 3/9] mm/gup: fix gup_fast with dynamic page table folding Andrew Morton
2020-09-26 4:19 ` [patch 4/9] mm/migrate: correct thp migration stats Andrew Morton
2020-09-26 4:19 ` [patch 5/9] lib/string.c: implement stpcpy Andrew Morton
2020-09-26 4:19 ` [patch 6/9] lib/memregion.c: include memregion.h Andrew Morton
2020-09-26 4:19 ` Andrew Morton [this message]
2020-09-26 4:19 ` [patch 8/9] mm: replace memmap_context by meminit_context Andrew Morton
2020-09-26 17:32 ` Linus Torvalds
2020-09-29 6:55 ` Michal Hocko
2020-09-29 16:28 ` Laurent Dufour
2020-09-29 20:37 ` Andrew Morton
2020-09-30 16:00 ` Linus Torvalds
2020-09-30 17:30 ` Michal Hocko
2020-09-26 4:19 ` [patch 9/9] mm: don't rely on system state to detect hot-plug operations Andrew Morton
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=20200926041924.JrUcL1D_9%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.j.wiilliams@intel.com \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=jack@suse.cz \
--cc=jmoyer@redhat.com \
--cc=linux-mm@kvack.org \
--cc=mawilcox@microsoft.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=mm-commits@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=ross.zwisler@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=toshi.kani@hpe.com \
--cc=viro@zeniv.linux.org.uk \
/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