Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638311

Re: [PATCH 4.4 26/28] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions

From Dan Williams <dan.j.williams@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4.4 26/28] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions
Date 2017-05-09 19:20 +0200
Message-ID <tFgXM-4Lx-17@gated-at.bofh.it> (permalink)
References <tAagh-6jY-5@gated-at.bofh.it> <tAaJk-6y9-25@gated-at.bofh.it> <tFgO6-4HS-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, May 9, 2017 at 10:00 AM, Ben Hutchings
<ben.hutchings@codethink.co.uk> wrote:
> On Tue, 2017-04-25 at 16:08 +0100, Greg Kroah-Hartman wrote:
>> 4.4-stable review patch.  If anyone has any objections, please let me know.
>>
>> ------------------
>>
>> From: Dan Williams <dan.j.williams@intel.com>
>>
>> commit 11e63f6d920d6f2dfd3cd421e939a4aec9a58dcd upstream.
> [...]
>> +     if (iter_is_iovec(i)) {
>> +             unsigned long flushed, dest = (unsigned long) addr;
>> +
>> +             if (bytes < 8) {
>> +                     if (!IS_ALIGNED(dest, 4) || (bytes != 4))
>> +                             __arch_wb_cache_pmem(addr, 1);
> [...]
>
> What if the write crosses a cache line boundary?  I think you need the
> following fix-up (untested, I don't have this kind of hardware).
>
> Ben.
>
> ---
> From: Ben Hutchings <ben.hutchings@codethink.co.uk>
> Subject: x86, pmem: Fix cache flushing for iovec write < 8 bytes
>
> Commit 11e63f6d920d added cache flushing for unaligned writes from an
> iovec, covering the first and last cache line of a >= 8 byte write and
> the first cache line of a < 8 byte write.  But an unaligned write of
> 2-7 bytes can still cover two cache lines, so make sure we flush both
> in that case.
>
> Fixes: 11e63f6d920d ("x86, pmem: fix broken __copy_user_nocache ...")
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> ---
>  arch/x86/include/asm/pmem.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/pmem.h b/arch/x86/include/asm/pmem.h
> index d5a22bac9988..0ff8fe71b255 100644
> --- a/arch/x86/include/asm/pmem.h
> +++ b/arch/x86/include/asm/pmem.h
> @@ -98,7 +98,7 @@ static inline size_t arch_copy_from_iter_pmem(void *addr, size_t bytes,
>
>                 if (bytes < 8) {
>                         if (!IS_ALIGNED(dest, 4) || (bytes != 4))
> -                               arch_wb_cache_pmem(addr, 1);
> +                               arch_wb_cache_pmem(addr, bytes);

Yes, this looks correct to me. I deeply appreciate your attention to
detail, Ben.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/28] 4.4.64-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:10 +0200
  [PATCH 4.4 12/28] VSOCK: Detach QP check should filter out non matching QPs. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 14/28] ACPI / power: Avoid maybe-uninitialized warning Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 24/28] Drivers: hv: balloon: account for gaps in hot add regions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 13/28] Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 06/28] cifs: Do not send echoes before Negotiate is complete Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
    Re: [PATCH 4.4 06/28] cifs: Do not send echoes before Negotiate is  complete Ben Hutchings <ben.hutchings@codethink.co.uk> - 2017-05-09 14:20 +0200
      RE: [PATCH 4.4 06/28] cifs: Do not send echoes before Negotiate is  complete Pavel Shilovskiy <pshilov@microsoft.com> - 2017-05-10 03:10 +0200
  [PATCH 4.4 25/28] hv: dont reset hv_context.tsc_page on crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 16/28] mac80211: reject ToDS broadcast data frames Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 21/28] powerpc/64: Fix flush_(d|i)cache_range() called from modules Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 19/28] x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 08/28] s390/mm: fix CMMA vs KSM vs others Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:20 +0200
  [PATCH 4.4 15/28] mmc: sdhci-esdhc-imx: increase the pad I/O drive strength for DDR50 card Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 05/28] ring-buffer: Have ring_buffer_iter_empty() return true when empty Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 11/28] Drivers: hv: vmbus: Reduce the delay between retries in vmbus_post_msg() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 28/28] tipc: fix crash during node removal Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 07/28] CIFS: remove bad_network_name flag Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 04/28] tracing: Allocate the snapshot buffer before enabling probe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 17/28] ubi/upd: Always flush after prepared for an update Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 22/28] Tools: hv: kvp: ensure kvp device fd is closed on exec Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 27/28] block: fix del_gendisk() vs blkdev_ioctl crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 26/28] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
    Re: [PATCH 4.4 26/28] x86, pmem: fix broken __copy_user_nocache  cache-bypass assumptions Ben Hutchings <ben.hutchings@codethink.co.uk> - 2017-05-09 19:10 +0200
      Re: [PATCH 4.4 26/28] x86, pmem: fix broken __copy_user_nocache  cache-bypass assumptions Dan Williams <dan.j.williams@intel.com> - 2017-05-09 19:20 +0200
  [PATCH 4.4 23/28] Drivers: hv: balloon: keep track of where ha_region starts Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 02/28] KEYS: Change the name of the dead type to ".dead" to prevent user access Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 09/28] Drivers: hv: dont leak memory in vmbus_establish_gpadl() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 18/28] powerpc/kprobe: Fix oops when kprobed on stdu instruction Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 20/28] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  [PATCH 4.4 03/28] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-25 17:40 +0200
  Re: [PATCH 4.4 00/28] 4.4.64-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-04-25 20:20 +0200
    Re: [PATCH 4.4 00/28] 4.4.64-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-26 10:40 +0200
  Re: [PATCH 4.4 00/28] 4.4.64-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-25 23:30 +0200
  Re: [PATCH 4.4 00/28] 4.4.64-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-26 04:30 +0200
    Re: [PATCH 4.4 00/28] 4.4.64-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-26 10:40 +0200
      Re: [PATCH 4.4 00/28] 4.4.64-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-26 15:20 +0200
        Re: [PATCH 4.4 00/28] 4.4.64-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-26 15:20 +0200
      Re: [PATCH 4.4 00/28] 4.4.64-stable review Guenter Roeck <linux@roeck-us.net> - 2017-04-26 16:40 +0200
        Re: [PATCH 4.4 00/28] 4.4.64-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-04-26 18:00 +0200

csiph-web