All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org,
	Dan Williams <dan.j.williams@intel.com>,
	Christoph Hellwig <hch@lst.de>,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Dave Chinner <david@fromorbit.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org
Subject: Re: [PATCH v3 5/7] pmem: add copy_from_iter_pmem() and clear_pmem()
Date: Mon, 17 Aug 2015 21:10:16 +0200	[thread overview]
Message-ID: <20150817191016.GC6752@lst.de> (raw)
In-Reply-To: <1439836211-4719-6-git-send-email-ross.zwisler@linux.intel.com>

>  #include <linux/uaccess.h>
> +#include <linux/uio.h>
> +

Can we keep this in linux/pmem.h?  I'm pretty sure the stubs would need
it as well, and even if they don't it'll keep the includes consistent.

> +{
> +	size_t len;
> +
> +	len = copy_from_iter_nocache((void __force *)addr, bytes, i);
> +
> +	/*
> +	 * copy_from_iter_nocache() on x86 only uses non-temporal stores for
> +	 * iovec iterators, so for other types (bvec & kvec) we must do a
> +	 * cache write-back.

Shouldn't we fi that?

> +	 */
> +	if (iter_is_iovec(i) == false)
> +		__arch_wb_cache_pmem(addr, bytes);

And if not and iter_needs_pmem_wb helper to encode this knowledge would
be useful.

> +static inline void arch_clear_pmem(void __pmem *addr, size_t size)
> +{
> +	/* TODO: implement the zeroing via non-temporal writes */
> +	if (size == PAGE_SIZE && ((unsigned long)addr & ~PAGE_MASK) == 0)
> +		clear_page((void __force *)addr);
> +	else
> +		memset((void __force *)addr, 0, size);
> +
> +	__arch_wb_cache_pmem(addr, size);

Please add a local vaiable so that the __force casting is only needed
once.  Same for other functions with this pattern.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-nvdimm@ml01.01.org,
	Dan Williams <dan.j.williams@intel.com>,
	Christoph Hellwig <hch@lst.de>,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Dave Chinner <david@fromorbit.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org
Subject: Re: [PATCH v3 5/7] pmem: add copy_from_iter_pmem() and clear_pmem()
Date: Mon, 17 Aug 2015 21:10:16 +0200	[thread overview]
Message-ID: <20150817191016.GC6752@lst.de> (raw)
In-Reply-To: <1439836211-4719-6-git-send-email-ross.zwisler@linux.intel.com>

>  #include <linux/uaccess.h>
> +#include <linux/uio.h>
> +

Can we keep this in linux/pmem.h?  I'm pretty sure the stubs would need
it as well, and even if they don't it'll keep the includes consistent.

> +{
> +	size_t len;
> +
> +	len = copy_from_iter_nocache((void __force *)addr, bytes, i);
> +
> +	/*
> +	 * copy_from_iter_nocache() on x86 only uses non-temporal stores for
> +	 * iovec iterators, so for other types (bvec & kvec) we must do a
> +	 * cache write-back.

Shouldn't we fi that?

> +	 */
> +	if (iter_is_iovec(i) == false)
> +		__arch_wb_cache_pmem(addr, bytes);

And if not and iter_needs_pmem_wb helper to encode this knowledge would
be useful.

> +static inline void arch_clear_pmem(void __pmem *addr, size_t size)
> +{
> +	/* TODO: implement the zeroing via non-temporal writes */
> +	if (size == PAGE_SIZE && ((unsigned long)addr & ~PAGE_MASK) == 0)
> +		clear_page((void __force *)addr);
> +	else
> +		memset((void __force *)addr, 0, size);
> +
> +	__arch_wb_cache_pmem(addr, size);

Please add a local vaiable so that the __force casting is only needed
once.  Same for other functions with this pattern.

  reply	other threads:[~2015-08-17 19:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 18:30 [PATCH v3 0/7] dax: I/O path enhancements Ross Zwisler
2015-08-17 18:30 ` Ross Zwisler
2015-08-17 18:30 ` Ross Zwisler
2015-08-17 18:30 ` [PATCH v3 1/7] brd: make rd_size static Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 19:03   ` Christoph Hellwig
2015-08-17 19:03     ` Christoph Hellwig
2015-08-17 18:30 ` [PATCH v3 2/7] pmem, x86: move x86 PMEM API to new pmem.h header Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 18:30 ` [PATCH v3 3/7] pmem: remove layer when calling arch_has_wmb_pmem() Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 18:30 ` [PATCH v3 4/7] pmem, x86: clean up conditional pmem includes Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 19:04   ` Christoph Hellwig
2015-08-17 19:04     ` Christoph Hellwig
2015-08-17 18:30 ` [PATCH v3 5/7] pmem: add copy_from_iter_pmem() and clear_pmem() Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 19:10   ` Christoph Hellwig [this message]
2015-08-17 19:10     ` Christoph Hellwig
2015-08-17 22:23     ` Ross Zwisler
2015-08-17 22:23       ` Ross Zwisler
2015-08-17 18:30 ` [PATCH v3 6/7] dax: update I/O path to do proper PMEM flushing Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 19:11   ` Christoph Hellwig
2015-08-17 19:11     ` Christoph Hellwig
2015-08-17 18:30 ` [PATCH v3 7/7] pmem, dax: have direct_access use __pmem annotation Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 18:30   ` Ross Zwisler
2015-08-17 19:11   ` Christoph Hellwig
2015-08-17 19:11     ` Christoph Hellwig
2015-08-17 19:11     ` 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=20150817191016.GC6752@lst.de \
    --to=hch@lst.de \
    --cc=dan.j.williams@intel.com \
    --cc=david@fromorbit.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=matthew.r.wilcox@intel.com \
    --cc=mingo@redhat.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=tglx@linutronix.de \
    --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 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.