From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751865AbbHQTKT (ORCPT ); Mon, 17 Aug 2015 15:10:19 -0400 Received: from verein.lst.de ([213.95.11.211]:35498 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbbHQTKS (ORCPT ); Mon, 17 Aug 2015 15:10:18 -0400 Date: Mon, 17 Aug 2015 21:10:16 +0200 From: Christoph Hellwig To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, linux-nvdimm@ml01.01.org, Dan Williams , Christoph Hellwig , Matthew Wilcox , Dave Chinner , "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , x86@kernel.org Subject: Re: [PATCH v3 5/7] pmem: add copy_from_iter_pmem() and clear_pmem() Message-ID: <20150817191016.GC6752@lst.de> References: <1439836211-4719-1-git-send-email-ross.zwisler@linux.intel.com> <1439836211-4719-6-git-send-email-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1439836211-4719-6-git-send-email-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > #include > +#include > + 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.