Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1292168 > unrolled thread
| Started by | Borislav Petkov <bp@alien8.de> |
|---|---|
| First post | 2015-12-15 14:20 +0100 |
| Last post | 2015-12-15 20:30 +0100 |
| Articles | 11 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 14:20 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-15 18:50 +0100
RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks "Luck, Tony" <tony.luck@intel.com> - 2015-12-15 19:00 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 19:30 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-15 19:30 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-15 19:40 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 19:40 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-15 20:30 +0100
RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> - 2015-12-15 21:30 +0100
Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-21 18:40 +0100
RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> - 2015-12-15 20:30 +0100
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2015-12-15 14:20 +0100 |
| Subject | Re: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks |
| Message-ID | <qFXGi-4AF-13@gated-at.bofh.it> |
On Thu, Dec 10, 2015 at 04:21:50PM -0800, Tony Luck wrote:
> Using __copy_user_nocache() as inspiration create a memory copy
> routine for use by kernel code with annotations to allow for
> recovery from machine checks.
>
> Notes:
> 1) Unlike the original we make no attempt to copy all the bytes
> up to the faulting address. The original achieves that by
> re-executing the failing part as a byte-by-byte copy,
> which will take another page fault. We don't want to have
> a second machine check!
> 2) Likewise the return value for the original indicates exactly
> how many bytes were not copied. Instead we provide the physical
> address of the fault (thanks to help from do_machine_check()
> 3) Provide helpful macros to decode the return value.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
> arch/x86/include/asm/uaccess_64.h | 5 +++
> arch/x86/kernel/x8664_ksyms_64.c | 2 +
> arch/x86/lib/copy_user_64.S | 91 +++++++++++++++++++++++++++++++++++++++
> 3 files changed, 98 insertions(+)
...
> + * mcsafe_memcpy - Uncached memory copy with machine check exception handling
> + * Note that we only catch machine checks when reading the source addresses.
> + * Writes to target are posted and don't generate machine checks.
> + * This will force destination/source out of cache for more performance.
... and the non-temporal version is the optimal one even though we're
defaulting to copy_user_enhanced_fast_string for memcpy on modern Intel
CPUs...?
Btw, it should be also inside an ifdef if we're going to ifdef
CONFIG_MCE_KERNEL_RECOVERY everywhere else.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
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/
[toc] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2015-12-15 18:50 +0100 |
| Message-ID | <qG1Tz-7mv-5@gated-at.bofh.it> |
| In reply to | #1292168 |
On Tue, Dec 15, 2015 at 5:11 AM, Borislav Petkov <bp@alien8.de> wrote: > On Thu, Dec 10, 2015 at 04:21:50PM -0800, Tony Luck wrote: >> Using __copy_user_nocache() as inspiration create a memory copy >> routine for use by kernel code with annotations to allow for >> recovery from machine checks. >> >> Notes: >> 1) Unlike the original we make no attempt to copy all the bytes >> up to the faulting address. The original achieves that by >> re-executing the failing part as a byte-by-byte copy, >> which will take another page fault. We don't want to have >> a second machine check! >> 2) Likewise the return value for the original indicates exactly >> how many bytes were not copied. Instead we provide the physical >> address of the fault (thanks to help from do_machine_check() >> 3) Provide helpful macros to decode the return value. >> >> Signed-off-by: Tony Luck <tony.luck@intel.com> >> --- >> arch/x86/include/asm/uaccess_64.h | 5 +++ >> arch/x86/kernel/x8664_ksyms_64.c | 2 + >> arch/x86/lib/copy_user_64.S | 91 +++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 98 insertions(+) > > ... > >> + * mcsafe_memcpy - Uncached memory copy with machine check exception handling >> + * Note that we only catch machine checks when reading the source addresses. >> + * Writes to target are posted and don't generate machine checks. >> + * This will force destination/source out of cache for more performance. > > ... and the non-temporal version is the optimal one even though we're > defaulting to copy_user_enhanced_fast_string for memcpy on modern Intel > CPUs...? At least the pmem driver use case does not want caching of the source-buffer since that is the raw "disk" media. I.e. in pmem_do_bvec() we'd use this to implement memcpy_from_pmem(). However, caching the destination-buffer may prove beneficial since that data is likely to be consumed immediately by the thread that submitted the i/o. -- 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/
[toc] | [prev] | [next] | [standalone]
| From | "Luck, Tony" <tony.luck@intel.com> |
|---|---|
| Date | 2015-12-15 19:00 +0100 |
| Message-ID | <qG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N0aW5hdGlvbiBtb3Zlcy4gIERvZXMgIm50aSIgd29yaw0Kb24gdGhl IGxvYWQgZnJvbSBzb3VyY2UgYWRkcmVzcyBzaWRlIHRvIGF2b2lkIGNhY2hlIGFsbG9jYXRpb24/ DQoNCk9uIGFub3RoZXIgdG9waWMgcmFpc2VkIGJ5IEJvcmlzIC4uLiBpcyB0aGVyZSBzb21lIENP TkZJR19QTUVNKg0KdGhhdCBJIHNob3VsZCB1c2UgYXMgYSBkZXBlbmRlbmN5IHRvIGVuYWJsZSBh bGwgdGhpcz8NCg0KLVRvbnkNCg== -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2015-12-15 19:30 +0100 |
| Message-ID | <qG2wi-7PJ-3@gated-at.bofh.it> |
| In reply to | #1292417 |
On Tue, Dec 15, 2015 at 05:53:31PM +0000, Luck, Tony wrote:
> My current generation cpu has a bit of an issue with recovering from a
> machine check in a "rep mov" ... so I'm working with a version of memcpy
> that unrolls into individual mov instructions for now.
Ah.
> I can drop the "nti" from the destination moves. Does "nti" work
> on the load from source address side to avoid cache allocation?
I don't think so:
+1: movq (%rsi),%r8
+2: movq 1*8(%rsi),%r9
+3: movq 2*8(%rsi),%r10
+4: movq 3*8(%rsi),%r11
...
You need to load the data into registers first because MOVNTI needs them
there as it does reg -> mem movement. That first load from memory into
registers with a normal MOV will pull the data into the cache.
Perhaps the first thing to try would be to see what slowdown normal MOVs
bring and if not really noticeable, use those instead.
> On another topic raised by Boris ... is there some CONFIG_PMEM*
> that I should use as a dependency to enable all this?
I found CONFIG_LIBNVDIMM only today:
drivers/nvdimm/Kconfig:1:menuconfig LIBNVDIMM
drivers/nvdimm/Kconfig:2: tristate "NVDIMM (Non-Volatile Memory Device) Support"
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2015-12-15 19:30 +0100 |
| Message-ID | <qG2wi-7PJ-5@gated-at.bofh.it> |
| In reply to | #1292417 |
On Tue, Dec 15, 2015 at 9:53 AM, Luck, Tony <tony.luck@intel.com> wrote: >>> ... and the non-temporal version is the optimal one even though we're >>> defaulting to copy_user_enhanced_fast_string for memcpy on modern Intel >>> CPUs...? > > My current generation cpu has a bit of an issue with recovering from a > machine check in a "rep mov" ... so I'm working with a version of memcpy > that unrolls into individual mov instructions for now. > >> At least the pmem driver use case does not want caching of the >> source-buffer since that is the raw "disk" media. I.e. in >> pmem_do_bvec() we'd use this to implement memcpy_from_pmem(). >> However, caching the destination-buffer may prove beneficial since >> that data is likely to be consumed immediately by the thread that >> submitted the i/o. > > I can drop the "nti" from the destination moves. Does "nti" work > on the load from source address side to avoid cache allocation? My mistake, I don't think we have an uncached load capability, only store. > On another topic raised by Boris ... is there some CONFIG_PMEM* > that I should use as a dependency to enable all this? I'd rather make this a "select ARCH_MCSAFE_MEMCPY". Since it's not a hard dependency and the details will be hidden behind memcpy_from_pmem(). Specifically, the details will be handled by a new arch_memcpy_from_pmem() in arch/x86/include/asm/pmem.h to supplement the existing arch_memcpy_to_pmem(). -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2015-12-15 19:40 +0100 |
| Message-ID | <qG2FX-7U3-1@gated-at.bofh.it> |
| In reply to | #1292438 |
On Tue, Dec 15, 2015 at 10:27 AM, Dan Williams <dan.j.williams@intel.com> wrote: > On Tue, Dec 15, 2015 at 9:53 AM, Luck, Tony <tony.luck@intel.com> wrote: >>>> ... and the non-temporal version is the optimal one even though we're >>>> defaulting to copy_user_enhanced_fast_string for memcpy on modern Intel >>>> CPUs...? >> >> My current generation cpu has a bit of an issue with recovering from a >> machine check in a "rep mov" ... so I'm working with a version of memcpy >> that unrolls into individual mov instructions for now. >> >>> At least the pmem driver use case does not want caching of the >>> source-buffer since that is the raw "disk" media. I.e. in >>> pmem_do_bvec() we'd use this to implement memcpy_from_pmem(). >>> However, caching the destination-buffer may prove beneficial since >>> that data is likely to be consumed immediately by the thread that >>> submitted the i/o. >> >> I can drop the "nti" from the destination moves. Does "nti" work >> on the load from source address side to avoid cache allocation? > > My mistake, I don't think we have an uncached load capability, only store. Correction we have MOVNTDQA, but that requires saving the fpu state and marking the memory as WC, i.e. probably not worth it. -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2015-12-15 19:40 +0100 |
| Message-ID | <qG2FY-7U3-23@gated-at.bofh.it> |
| In reply to | #1292448 |
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.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
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/
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2015-12-15 20:30 +0100 |
| Message-ID | <qG3sm-8qM-27@gated-at.bofh.it> |
| In reply to | #1292455 |
On Tue, Dec 15, 2015 at 07:19:58PM +0000, Elliott, Robert (Persistent Memory) wrote:
...
> 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:
That's the theory...
Do you also have some actual performance numbers where non-temporal
operations are better than the REP; MOVSB and *actually* show
improvements? And no microbenchmarks please.
Thanks.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> |
|---|---|
| Date | 2015-12-15 21:30 +0100 |
| Message-ID | <qG4op-Bj-1@gated-at.bofh.it> |
| In reply to | #1292489 |
DQoNCi0tLQ0KUm9iZXJ0IEVsbGlvdHQsIEhQRSBQZXJzaXN0ZW50IE1lbW9yeQ0KDQoNCj4gLS0t LS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogQm9yaXNsYXYgUGV0a292IFttYWlsdG86 YnBAYWxpZW44LmRlXQ0KPiBTZW50OiBUdWVzZGF5LCBEZWNlbWJlciAxNSwgMjAxNSAxOjI5IFBN DQo+IFRvOiBFbGxpb3R0LCBSb2JlcnQgKFBlcnNpc3RlbnQgTWVtb3J5KSA8ZWxsaW90dEBocGUu Y29tPg0KPiBDYzogRGFuIFdpbGxpYW1zIDxkYW4uai53aWxsaWFtc0BpbnRlbC5jb20+OyBMdWNr LCBUb255DQo+IDx0b255Lmx1Y2tAaW50ZWwuY29tPjsgbGludXgtbnZkaW1tIDxsaW51eC1udmRp bW1AbWwwMS4wMS5vcmc+OyBYODYgTUwNCj4gPHg4NkBrZXJuZWwub3JnPjsgbGludXgta2VybmVs QH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AgLS18DQp8 LS0gICAgICAgICAgICAgICAgICBTeXN0ZW0gV3JpdGUgVGhyb3VnaHB1dChNQi9zKTogIDQ3NTkx LjM5ICAgICAgICAgICAgICAgICAgLS18DQp8LS0gICAgICAgICAgICAgICAgIFN5c3RlbSBNZW1v cnkgVGhyb3VnaHB1dChNQi9zKTogMTA0Njk3LjI3ICAgICAgICAgICAgICAgICAgLS18DQp8LS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tfHwtLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS18DQoNCg0K -- 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/
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2015-12-21 18:40 +0100 |
| Message-ID | <qIcBc-11j-17@gated-at.bofh.it> |
| In reply to | #1292520 |
On Tue, Dec 15, 2015 at 08:25:37PM +0000, Elliott, Robert (Persistent Memory) wrote:
> This isn't exactly what you're looking for, but here is
> an example of fio doing reads from pmem devices (reading
> from NVDIMMs, writing to DIMMs) with various transfer
> sizes.
... and "fio" is?
> At 256 KiB, all the main memory buffers fit in the CPU
> caches, so no write traffic appears on DDR (just the reads
> from the NVDIMMs). At 1 MiB, the data spills out of the
> caches, and writes to the DIMMs end up on DDR.
>
> Although DDR is busier, fio gets a lot less work done:
> * 256 KiB: 90 GiB/s by fio
> * 1 MiB: 49 GiB/s by fio
Yeah, I don't think that answers the question I had: whether REP; MOVSB
is faster/better than using non-temporal stores. But you say that
already above.
Also, if you do non-temporal stores then you're expected to have *more*
memory controller and DIMM traffic as you're pushing everything out
through the WCC.
What would need to be measured instead is, IMO, two things:
* compare NTI vs REP; MOVSB data movement to see the differences in
performance aspects
* run a benchmark (no idea which one) which would measure the positive
impact of the NTI versions which do not pollute the cache and thus do
not hurt other workloads' working set being pushed out of the cache.
Also, we don't really know (at least I don't) what REP; MOVSB
improvements hide behind those enhanced fast string optimizations.
It could be that microcode is doing some aggregation into cachelines
and doing much bigger writes which could compensate for the cache
pollution.
Questions over questions...
> We could try modifying pmem to use its own non-temporal
> memcpy functions (I've posted experimental patches
> before that did this) to see if that transition point
> shifts. We can also watch the CPU cache statistics
> while running.
>
> Here are statistics from Intel's pcm-memory.x
> (pardon the wide formatting):
>
> 256 KiB
> =======
> pmem0: (groupid=0, jobs=40): err= 0: pid=20867: Tue Nov 24 18:20:08 2015
> read : io=5219.1GB, bw=89079MB/s, iops=356314, runt= 60006msec
> cpu : usr=1.74%, sys=96.16%, ctx=49576, majf=0, minf=21997
>
> Run status group 0 (all jobs):
> READ: io=5219.1GB, aggrb=89079MB/s, minb=89079MB/s, maxb=89079MB/s, mint=60006msec, maxt=60006msec
>
> |---------------------------------------||---------------------------------------|
> |-- Socket 0 --||-- Socket 1 --|
> |---------------------------------------||---------------------------------------|
> |-- Memory Channel Monitoring --||-- Memory Channel Monitoring --|
> |---------------------------------------||---------------------------------------|
> |-- Mem Ch 0: Reads (MB/s): 11778.11 --||-- Mem Ch 0: Reads (MB/s): 11743.99 --|
> |-- Writes(MB/s): 51.83 --||-- Writes(MB/s): 43.25 --|
> |-- Mem Ch 1: Reads (MB/s): 11779.90 --||-- Mem Ch 1: Reads (MB/s): 11736.06 --|
> |-- Writes(MB/s): 48.73 --||-- Writes(MB/s): 37.86 --|
> |-- Mem Ch 4: Reads (MB/s): 11784.79 --||-- Mem Ch 4: Reads (MB/s): 11746.94 --|
> |-- Writes(MB/s): 52.90 --||-- Writes(MB/s): 43.73 --|
> |-- Mem Ch 5: Reads (MB/s): 11778.48 --||-- Mem Ch 5: Reads (MB/s): 11741.55 --|
> |-- Writes(MB/s): 47.62 --||-- Writes(MB/s): 37.80 --|
> |-- NODE 0 Mem Read (MB/s) : 47121.27 --||-- NODE 1 Mem Read (MB/s) : 46968.53 --|
> |-- NODE 0 Mem Write(MB/s) : 201.08 --||-- NODE 1 Mem Write(MB/s) : 162.65 --|
> |-- NODE 0 P. Write (T/s): 190927 --||-- NODE 1 P. Write (T/s): 182961 --|
What does T/s mean?
> |-- NODE 0 Memory (MB/s): 47322.36 --||-- NODE 1 Memory (MB/s): 47131.17 --|
> |---------------------------------------||---------------------------------------|
> |---------------------------------------||---------------------------------------|
> |-- System Read Throughput(MB/s): 94089.80 --|
> |-- System Write Throughput(MB/s): 363.73 --|
> |-- System Memory Throughput(MB/s): 94453.52 --|
> |---------------------------------------||---------------------------------------|
>
> 1 MiB
> =====
> |---------------------------------------||---------------------------------------|
> |-- Socket 0 --||-- Socket 1 --|
> |---------------------------------------||---------------------------------------|
> |-- Memory Channel Monitoring --||-- Memory Channel Monitoring --|
> |---------------------------------------||---------------------------------------|
> |-- Mem Ch 0: Reads (MB/s): 7227.83 --||-- Mem Ch 0: Reads (MB/s): 7047.45 --|
> |-- Writes(MB/s): 5894.47 --||-- Writes(MB/s): 6010.66 --|
> |-- Mem Ch 1: Reads (MB/s): 7229.32 --||-- Mem Ch 1: Reads (MB/s): 7041.79 --|
> |-- Writes(MB/s): 5891.38 --||-- Writes(MB/s): 6003.19 --|
> |-- Mem Ch 4: Reads (MB/s): 7230.70 --||-- Mem Ch 4: Reads (MB/s): 7052.44 --|
> |-- Writes(MB/s): 5888.63 --||-- Writes(MB/s): 6012.49 --|
> |-- Mem Ch 5: Reads (MB/s): 7229.16 --||-- Mem Ch 5: Reads (MB/s): 7047.19 --|
> |-- Writes(MB/s): 5882.45 --||-- Writes(MB/s): 6008.11 --|
> |-- NODE 0 Mem Read (MB/s) : 28917.01 --||-- NODE 1 Mem Read (MB/s) : 28188.87 --|
> |-- NODE 0 Mem Write(MB/s) : 23556.93 --||-- NODE 1 Mem Write(MB/s) : 24034.46 --|
> |-- NODE 0 P. Write (T/s): 238713 --||-- NODE 1 P. Write (T/s): 228040 --|
> |-- NODE 0 Memory (MB/s): 52473.94 --||-- NODE 1 Memory (MB/s): 52223.33 --|
> |---------------------------------------||---------------------------------------|
> |---------------------------------------||---------------------------------------|
> |-- System Read Throughput(MB/s): 57105.87 --|
> |-- System Write Throughput(MB/s): 47591.39 --|
> |-- System Memory Throughput(MB/s): 104697.27 --|
> |---------------------------------------||---------------------------------------|
Looks to me like, because writes have increased, the read bandwidth has
dropped too, which makes sense.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
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/
[toc] | [prev] | [next] | [standalone]
| From | "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> |
|---|---|
| Date | 2015-12-15 20:30 +0100 |
| Message-ID | <qG3sm-8qM-29@gated-at.bofh.it> |
| In reply to | #1292455 |
> -----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 <dan.j.williams@intel.com>
> Cc: Luck, Tony <tony.luck@intel.com>; linux-nvdimm <linux-
> nvdimm@ml01.01.org>; X86 ML <x86@kernel.org>; linux-
> kernel@vger.kernel.org; Linux MM <linux-mm@kvack.org>; Andy Lutomirski
> <luto@kernel.org>; Andrew Morton <akpm@linux-foundation.org>; Ingo Molnar
> <mingo@kernel.org>
> 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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web