Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752984AbdDKPtT (ORCPT ); Tue, 11 Apr 2017 11:49:19 -0400 Received: from mga11.intel.com ([192.55.52.93]:15646 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752805AbdDKPtQ (ORCPT ); Tue, 11 Apr 2017 11:49:16 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,186,1488873600"; d="scan'208";a="954809079" Date: Tue, 11 Apr 2017 09:49:13 -0600 From: Ross Zwisler To: Dan Williams Cc: linux-nvdimm@ml01.01.org, Jan Kara , Toshi Kani , Matthew Wilcox , x86@kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Christoph Hellwig , Jeff Moyer , Ingo Molnar , Al Viro , "H. Peter Anvin" , Thomas Gleixner , Ross Zwisler Subject: Re: [PATCH v3] x86, pmem: fix broken __copy_user_nocache cache-bypass assumptions Message-ID: <20170411154913.GA20725@linux.intel.com> References: <149187075199.40875.9829505688202257056.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <149187075199.40875.9829505688202257056.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1461 Lines: 32 On Mon, Apr 10, 2017 at 05:35:02PM -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: > Cc: > Cc: Jan Kara > Cc: Jeff Moyer > Cc: Ingo Molnar > Cc: Christoph Hellwig > Cc: "H. Peter Anvin" > Cc: Al Viro > Cc: Thomas Gleixner > Cc: Matthew Wilcox > Cc: Ross Zwisler > Signed-off-by: Toshi Kani > Signed-off-by: Dan Williams This looks good to me, thanks for fixing this. Reviewed-by: Ross Zwisler