From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm@ml01.01.org, Tony Luck <tony.luck@intel.com>,
Jan Kara <jack@suse.cz>, Toshi Kani <toshi.kani@hpe.com>,
Matthew Wilcox <mawilcox@microsoft.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Christoph Hellwig <hch@lst.de>,
Brian Boylston <brian.boylston@hpe.com>,
Jeff Moyer <jmoyer@redhat.com>, Ingo Molnar <mingo@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-fsdevel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ross Zwisler <ross.zwisler@linux.intel.com>
Subject: Re: [PATCH 08/13] x86, libnvdimm, dax: stop abusing __copy_user_nocache
Date: Tue, 28 Mar 2017 10:21:35 -0600 [thread overview]
Message-ID: <20170328162135.GA27993@linux.intel.com> (raw)
In-Reply-To: <148488425640.37913.8286479292337338357.stgit@dwillia2-desk3.amr.corp.intel.com>
On Thu, Jan 19, 2017 at 07:50:56PM -0800, Dan Williams wrote:
<>
> diff --git a/drivers/nvdimm/x86-asm.S b/drivers/nvdimm/x86-asm.S
> new file mode 100644
> index 000000000000..23c5ec94e896
> --- /dev/null
> +++ b/drivers/nvdimm/x86-asm.S
> @@ -0,0 +1,71 @@
> +/*
> + * Copyright (c) 2017, Intel Corporation.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + */
> +#include <linux/linkage.h>
> +
> +/*
> + * __arch_memcpy_to_pmem - non-temporal + unordered memory copy
> + *
> + * 8-byte alignment for destination, source, and len. The results of
> + * this transfer are not persistent or globally visible until a
> + * sub-sequent sfence (REQ_FLUSH) to the pmem driver.
> + *
> + * Derived from __copy_user_nocache.
> + */
> +ENTRY(__arch_memcpy_to_pmem)
> + /* Set 4x8-byte copy count and remainder */
> + movl %edx,%ecx
> + andl $63,%edx
> + shrl $6,%ecx
> + jz .L_8b_pmem_copy_entry /* jump if count is 0 */
> +
> + /* Perform 4x8-byte pmem loop-copy */
> +.L_4x8b_pmem_copy_loop:
> + movq (%rsi),%r8
> + movq 1*8(%rsi),%r9
> + movq 2*8(%rsi),%r10
> + movq 3*8(%rsi),%r11
> + movnti %r8,(%rdi)
> + movnti %r9,1*8(%rdi)
> + movnti %r10,2*8(%rdi)
> + movnti %r11,3*8(%rdi)
> + movq 4*8(%rsi),%r8
> + movq 5*8(%rsi),%r9
> + movq 6*8(%rsi),%r10
> + movq 7*8(%rsi),%r11
> + movnti %r8,4*8(%rdi)
> + movnti %r9,5*8(%rdi)
> + movnti %r10,6*8(%rdi)
> + movnti %r11,7*8(%rdi)
> + leaq 64(%rsi),%rsi
> + leaq 64(%rdi),%rdi
> + decl %ecx
> + jnz .L_4x8b_pmem_copy_loop
> +
> + /* Set 8-byte copy count and remainder */
> +.L_8b_pmem_copy_entry:
> + movl %edx,%ecx
> + andl $7,%edx
I don't think you need to andl %edx here - in __copy_user_nocache() %edx was
used to keep the remaining count that couldn't be handled with the size of
transfers we were doing in a given loop, so in .L_8b_nocache_copy_entry we
mask with 7 so we can use the remaining count in .L_4b_nocache_copy_entry
and/or .L_1b_cache_copy_entry.
In the PMEM case, though, the 8 byte loop is the end of the line, so we just
ignore any trailing data that isn't 8 byte aligned.
I'm not sure if it's important to use %ecx as your local loop variable - is
this a widely held convention? If not, you could just leave %ecx out of it
and use %edx directly in the 8 byte copy, i.e.:
/* Set 8-byte copy count and remainder */
.L_8b_pmem_copy_entry:
shrl $3,%edx
jnz .L_8b_pmem_copy_loop /* continue if count non-zero */
ret
/* Perform 8-byte pmem loop-copy */
.L_8b_pmem_copy_loop:
movq (%rsi),%r8
movnti %r8,(%rdi)
leaq 8(%rsi),%rsi
leaq 8(%rdi),%rdi
decl %edx
jnz .L_8b_pmem_copy_loop
ret
ENDPROC(__arch_memcpy_to_pmem)
next prev parent reply other threads:[~2017-03-28 16:25 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 3:50 [PATCH 00/13] dax, pmem: move cpu cache maintenance to libnvdimm Dan Williams
2017-01-20 3:50 ` [PATCH 01/13] x86, dax, pmem: remove indirection around memcpy_from_pmem() Dan Williams
2017-01-20 3:50 ` [PATCH 02/13] block, dax: introduce dax_operations Dan Williams
2017-01-20 17:28 ` Dan Williams
2017-01-20 3:50 ` [PATCH 03/13] x86, dax, pmem: introduce 'copy_from_iter' dax operation Dan Williams
2017-02-03 1:52 ` [lkp-robot] [x86, dax, pmem] 2e12109d1c: fio.write_bw_MBps -75% regression kernel test robot
2017-02-17 3:52 ` [PATCH 03/13] x86, dax, pmem: introduce 'copy_from_iter' dax operation Ross Zwisler
2017-02-17 3:56 ` Dan Williams
2017-01-20 3:50 ` [PATCH 04/13] dax, pmem: introduce an optional 'flush' " Dan Williams
2017-01-20 3:50 ` [PATCH 05/13] x86, dax: replace clear_pmem() with open coded memset + dax_ops->flush Dan Williams
2017-01-20 10:27 ` Jan Kara
2017-01-20 15:33 ` Dan Williams
2017-01-20 3:50 ` [PATCH 06/13] x86, dax, libnvdimm: move wb_cache_pmem() to libnvdimm Dan Williams
2017-01-20 3:50 ` [PATCH 07/13] x86, libnvdimm, pmem: move arch_invalidate_pmem() " Dan Williams
2017-01-20 3:50 ` [PATCH 08/13] x86, libnvdimm, dax: stop abusing __copy_user_nocache Dan Williams
2017-03-28 16:21 ` Ross Zwisler [this message]
2017-03-28 16:26 ` Dan Williams
2017-01-20 3:51 ` [PATCH 09/13] libnvdimm, pmem: implement cache bypass for all copy_from_iter() operations Dan Williams
2017-01-20 3:51 ` [PATCH 10/13] libnvdimm, pmem: fix persistence warning Dan Williams
2017-01-20 3:51 ` [PATCH 11/13] libnvdimm, nfit: enable support for volatile ranges Dan Williams
2017-01-20 3:51 ` [PATCH 12/13] libnvdimm, pmem: disable dax flushing when pmem is fronting a volatile region Dan Williams
2017-01-20 3:51 ` [PATCH 13/13] libnvdimm, pmem: disable dax flushing for 'cache flush on fail' platforms Dan Williams
2017-01-21 16:28 ` [PATCH 00/13] dax, pmem: move cpu cache maintenance to libnvdimm Matthew Wilcox
2017-01-21 17:52 ` Christoph Hellwig
2017-01-22 15:43 ` Matthew Wilcox
2017-01-22 16:29 ` Christoph Hellwig
2017-01-22 18:19 ` Matthew Wilcox
2017-01-22 18:30 ` Christoph Hellwig
2017-01-22 18:39 ` Matthew Wilcox
2017-01-22 18:44 ` Christoph Hellwig
2017-01-23 6:37 ` Matthew Wilcox
2017-01-23 7:10 ` Dan Williams
2017-01-23 16:00 ` Christoph Hellwig
2017-01-23 17:14 ` Dan Williams
2017-01-23 18:03 ` Christoph Hellwig
2017-01-23 18:31 ` Dan Williams
2017-01-23 15:58 ` Christoph Hellwig
2017-01-22 17:30 ` Dan Williams
2017-01-23 16:01 ` Christoph Hellwig
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=20170328162135.GA27993@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=brian.boylston@hpe.com \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=jack@suse.cz \
--cc=jmoyer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@ml01.01.org \
--cc=mawilcox@microsoft.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=toshi.kani@hpe.com \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@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