From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Cc: "jack@suse.cz" <jack@suse.cz>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"hpa@zytor.com" <hpa@zytor.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH v3] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions
Date: Tue, 11 Apr 2017 15:15:16 +0000 [thread overview]
Message-ID: <1491923701.9118.34.camel@hpe.com> (raw)
In-Reply-To: <149187075199.40875.9829505688202257056.stgit@dwillia2-desk3.amr.corp.intel.com>
On Mon, 2017-04-10 at 17:35 -0700, Dan Williams wrote:
> Before we rework the "pmem api" to stop abusing __copy_user_nocache()
> for memcpy_to_pmem() we need to fix cases where we may strand dirty
> data in the cpu cache. The problem occurs when copy_from_iter_pmem()
> is used for arbitrary data transfers from userspace. There is no
> guarantee that these transfers, performed by dax_iomap_actor(), will
> have aligned destinations or aligned transfer lengths. Backstop the
> usage __copy_user_nocache() with explicit cache management in these
> unaligned cases.
>
> Yes, copy_from_iter_pmem() is now too big for an inline, but
> addressing that is saved for a later patch that moves the entirety of
> the "pmem api" into the pmem driver directly.
>
> Fixes: 5de490daec8b ("pmem: add copy_from_iter_pmem() and
> clear_pmem()")
> Cc: <stable@vger.kernel.org>
> Cc: <x86@kernel.org>
> 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: "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>
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Changes in v3:
> * match the implementation to the notes at the top of
> __copy_user_nocache (Toshi)
>
> * Switch to using the IS_ALIGNED() macro to make alignment checks
> easier to read and harder to get wrong like they were in v2. (Toshi,
> Dan)
Thanks Dan! It looks good.
-Toshi
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jmoyer@redhat.com" <jmoyer@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"hch@lst.de" <hch@lst.de>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"x86@kernel.org" <x86@kernel.org>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"ross.zwisler@linux.intel.com" <ross.zwisler@linux.intel.com>,
"jack@suse.cz" <jack@suse.cz>
Subject: Re: [PATCH v3] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions
Date: Tue, 11 Apr 2017 15:15:16 +0000 [thread overview]
Message-ID: <1491923701.9118.34.camel@hpe.com> (raw)
In-Reply-To: <149187075199.40875.9829505688202257056.stgit@dwillia2-desk3.amr.corp.intel.com>
On Mon, 2017-04-10 at 17:35 -0700, Dan Williams wrote:
> Before we rework the "pmem api" to stop abusing __copy_user_nocache()
> for memcpy_to_pmem() we need to fix cases where we may strand dirty
> data in the cpu cache. The problem occurs when copy_from_iter_pmem()
> is used for arbitrary data transfers from userspace. There is no
> guarantee that these transfers, performed by dax_iomap_actor(), will
> have aligned destinations or aligned transfer lengths. Backstop the
> usage __copy_user_nocache() with explicit cache management in these
> unaligned cases.
>
> Yes, copy_from_iter_pmem() is now too big for an inline, but
> addressing that is saved for a later patch that moves the entirety of
> the "pmem api" into the pmem driver directly.
>
> Fixes: 5de490daec8b ("pmem: add copy_from_iter_pmem() and
> clear_pmem()")
> Cc: <stable@vger.kernel.org>
> Cc: <x86@kernel.org>
> 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: "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>
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Changes in v3:
> * match the implementation to the notes at the top of
> __copy_user_nocache (Toshi)
>
> * Switch to using the IS_ALIGNED() macro to make alignment checks
> easier to read and harder to get wrong like they were in v2. (Toshi,
> Dan)
Thanks Dan! It looks good.
-Toshi
WARNING: multiple messages have this Message-ID (diff)
From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jmoyer@redhat.com" <jmoyer@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"hch@lst.de" <hch@lst.de>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"x86@kernel.org" <x86@kernel.org>,
"mawilcox@microsoft.com" <mawilcox@microsoft.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"ross.zwisler@linux.intel.com" <ross.zwisler@linux.intel.com>,
"jack@suse.cz" <jack@suse.cz>
Subject: Re: [PATCH v3] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions
Date: Tue, 11 Apr 2017 15:15:16 +0000 [thread overview]
Message-ID: <1491923701.9118.34.camel@hpe.com> (raw)
In-Reply-To: <149187075199.40875.9829505688202257056.stgit@dwillia2-desk3.amr.corp.intel.com>
On Mon, 2017-04-10 at 17:35 -0700, Dan Williams wrote:
> Before we rework the "pmem api" to stop abusing __copy_user_nocache()
> for memcpy_to_pmem() we need to fix cases where we may strand dirty
> data in the cpu cache. The problem occurs when copy_from_iter_pmem()
> is used for arbitrary data transfers from userspace. There is no
> guarantee that these transfers, performed by dax_iomap_actor(), will
> have aligned destinations or aligned transfer lengths. Backstop the
> usage __copy_user_nocache() with explicit cache management in these
> unaligned cases.
>
> Yes, copy_from_iter_pmem() is now too big for an inline, but
> addressing that is saved for a later patch that moves the entirety of
> the "pmem api" into the pmem driver directly.
>
> Fixes: 5de490daec8b ("pmem: add copy_from_iter_pmem() and
> clear_pmem()")
> Cc: <stable@vger.kernel.org>
> Cc: <x86@kernel.org>
> 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: "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>
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Changes in v3:
> * match the implementation to the notes at the top of
> __copy_user_nocache (Toshi)
>
> * Switch to using the IS_ALIGNED() macro to make alignment checks
> easier to read and harder to get wrong like they were in v2. (Toshi,
> Dan)
Thanks Dan! It looks good.
-Toshi
next prev parent reply other threads:[~2017-04-11 15:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 0:35 [PATCH v3] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions Dan Williams
2017-04-11 0:35 ` Dan Williams
2017-04-11 0:35 ` Dan Williams
2017-04-11 15:15 ` Kani, Toshimitsu [this message]
2017-04-11 15:15 ` Kani, Toshimitsu
2017-04-11 15:15 ` Kani, Toshimitsu
2017-04-11 15:49 ` Ross Zwisler
2017-04-11 15:49 ` Ross Zwisler
2017-04-11 15:49 ` Ross Zwisler
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=1491923701.9118.34.camel@hpe.com \
--to=toshi.kani@hpe.com \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=mawilcox@microsoft.com \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--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 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.