Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754240AbbLOTUy (ORCPT ); Tue, 15 Dec 2015 14:20:54 -0500 Received: from g9t5009.houston.hp.com ([15.240.92.67]:60610 "EHLO g9t5009.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbbLOTUx convert rfc822-to-8bit (ORCPT ); Tue, 15 Dec 2015 14:20:53 -0500 From: "Elliott, Robert (Persistent Memory)" To: Borislav Petkov , Dan Williams CC: "Luck, Tony" , linux-nvdimm , X86 ML , "linux-kernel@vger.kernel.org" , Linux MM , Andy Lutomirski , Andrew Morton , Ingo Molnar Subject: RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Thread-Topic: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Thread-Index: AQHRNEq4ghk1LvWIwU2qH4H+2NJLyJ7MC6mAgABMagCAAAJcgIAACYCAgAACUYCAAAEBAIAAATVQ Date: Tue, 15 Dec 2015 19:19:58 +0000 Message-ID: <94D0CD8314A33A4D9D801C0FE68B40295BE9F290@G4W3202.americas.hpqcorp.net> References: <23b2515da9d06b198044ad83ca0a15ba38c24e6e.1449861203.git.tony.luck@intel.com> <20151215131135.GE25973@pd.tnic> <3908561D78D1C84285E8C5FCA982C28F39F8566E@ORSMSX114.amr.corp.intel.com> <20151215183924.GJ25973@pd.tnic> In-Reply-To: <20151215183924.GJ25973@pd.tnic> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [16.210.48.36] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2939 Lines: 77 > -----Original Message----- > From: Linux-nvdimm [mailto:linux-nvdimm-bounces@lists.01.org] On Behalf > Of Borislav Petkov > Sent: Tuesday, December 15, 2015 12:39 PM > To: Dan Williams > Cc: Luck, Tony ; linux-nvdimm nvdimm@ml01.01.org>; X86 ML ; linux- > kernel@vger.kernel.org; Linux MM ; Andy Lutomirski > ; Andrew Morton ; Ingo Molnar > > Subject: Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to > recover from machine checks > > On Tue, Dec 15, 2015 at 10:35:49AM -0800, Dan Williams wrote: > > Correction we have MOVNTDQA, but that requires saving the fpu state > > and marking the memory as WC, i.e. probably not worth it. > > Not really. Last time I tried an SSE3 memcpy in the kernel like glibc > does, it wasn't worth it. The enhanced REP; MOVSB is hands down faster. Reading from NVDIMM, rep movsb is efficient, but it fills the CPU caches with the NVDIMM addresses. For large data moves (not uncommon for storage) this will crowd out more important cacheable data. For normal block device reads made through the pmem block device driver, this CPU cache consumption is wasteful, since it is unlikely the application will ask pmem to read the same addresses anytime soon. Due to the historic long latency of storage devices, applications don't re-read from storage again; they save the results. So, the streaming-load instructions are beneficial: * movntdqa (16-byte xmm registers) * vmovntdqa (32-byte ymm registers) * vmovntdqa (64-byte zmm registers) Dan Williams wrote: > Correction we have MOVNTDQA, but that requires > saving the fpu state and marking the memory as WC > i.e. probably not worth it. Although the WC memory type is described in the SDM in the most detail: "An implementation may also make use of the non-temporal hint associated with this instruction if the memory source is WB (write back) memory type. ... may optimize cache reads generated by (V)MOVNTDQA on WB memory type to reduce cache evictions." For applications doing loads from mmap() DAX memory, the CPU cache usage could be worthwhile, because applications expect mmap() regions to consist of traditional writeback-cached memory and might do lots of loads/stores. Writing to the NVDIMM requires either: * non-temporal stores; or * normal stores + cache flushes + fences movnti is OK for small transfers, but these are better for bulk moves: * movntdq (16-byte xmm registers) * vmovntdq (32-byte ymm registers) * vmovntdq (64-byte zmm registers) --- Robert Elliott, HPE Persistent Memory -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/