nvmw 2021 | 12th annual non-volatile memories workshop...

41
Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei Zuo, Yu Hua, Ming Zhao*, Wen Zhou, Yuncheng Guo Huazhong University of Science and Technology (HUST), China *Arizona State University (ASU), USA

Upload: others

Post on 19-Mar-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Improving the Performance and Endurance ofEncrypted Non-volatile Main Memory through

Deduplicating Writes

Pengfei Zuo, Yu Hua, Ming Zhao*, Wen Zhou, Yuncheng GuoHuazhong University of Science and Technology (HUST), China

*Arizona State University (ASU), USA

Page 2: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Non-volatile Memory (NVM)

Non-volatile memory is expected to replace or complement DRAM in memory hierarchy

Non-volatility, low power, high density, large capacity

PCM ReRAM DRAMRead (ns) 20-70 20-50 10Write (ns) 150-220 70-140 10

Non-volatility √ √ ×

Standby Power ~0 ~0 HighEndurance 107~109 108~1012 1015

Density (Gb/cm2) 13.5 24.5 9.1

PCM

ReRAM2K. Suzuki and S. Swanson. “A Survey of Trends in Non-Volatile Memory Technologies: 2000-2014”, IMW 2015.

C. Xu et al. “Overcoming the Challenges of Crossbar Resistive Memory Architectures”, HPCA, 2015.

Page 3: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Endurance and Security in Non-volatile Memory

NVM typically has limited endurance– 107~109 for PCM, 108~1012 for ReRAM– Writes have much higher latency than reads– Write reduction matters for NVM

3

NVM is vulnerable to stolen DIMM attack– NVM still retains data after systems power down– An attacker can directly read data from the stolen NVM – Memory encryption matters for NVM

Page 4: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

44

Encryption Increases Bit Flips to NVM

Diffusion property of encryption– The change of one bit in the original data has to

modify half of bits in the encrypted data

4

00000000…000000000000

10000000…000000000000

01011010…000010110100

10101100…000100101001Encryption

Encryption

1 of 512 bits modified 256 of 512 bits modified

Old data in NVM:

New data:

Overwrite Overwrite

Page 5: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Encryption Increases Bit Flips to NVM

5

Young et al. “DEUCE: Write-efficient encryption for non-volatile memories”, in Proc. of ASPLOS, 2015.

4X

Encryption renders existing bit-level write reduction techniques ineffective

Page 6: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Observation and Motivation

A large number of entire-line duplicates exist in real-world applications6

SPEC CPU2006 PARSEC 2.1

Page 7: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

DeWrite

Lightweight cache-line-level deduplication for NVMM– Employ lightweight hashing– Leverage NVM read/write asymmetry– Eliminate a write at the cost of a read

7

Last Level Cache

MetadataCache

AES-ctr

Memory Controller

Dedup Logic

Metadata:Direct encryption

MetadataStorage Encrypted NVMM

Data: CME

Data

OTPNon-duplicate

Hardware Architecture

Efficient synergization between deduplication and encryption – Opportunistic parallelism– Metadata storage co-location

Page 8: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

8

Detect Duplication

Is duplicate ?

Encrypt Data

Write to NVM

Cancel the Write

No

Yes

A Write Request

The direct way

Be inefficient for non-duplicate writes• Serial execution latency

Page 9: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

9

Detect Duplication

Is duplicate ?

Encrypt Data

Write to NVM

Cancel the Write

No

Yes

A Write Request

The direct way

Detect Duplication

Is duplicate ?

Write to NVM

Discard the Ciphertext

No

Encrypt Data

Yes

A Write Request

The parallel way

Be inefficient for non-duplicate writes• Serial execution latency

Be inefficient for duplicate writes• Unnecessary encryption

Page 10: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

10

Detect Duplication

Is duplicate ?

Encrypt Data

Write to NVM

Cancel the Write

No

Yes

A Write Request

The direct way

Detect Duplication

Is duplicate ?

Write to NVM

Discard the Ciphertext

No

Encrypt Data

Yes

A Write Request

The parallel way

Be inefficient for non-duplicate writes• Serial execution latency

Be inefficient for duplicate writes• Unnecessary encryption

Page 11: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

11

Detect Duplication

Is duplicate ?

Encrypt Data

Write to NVM

Cancel the Write

No

Yes

A Write Request

The direct way

Detect Duplication

Is duplicate ?

Write to NVM

Discard the Ciphertext

No

Encrypt Data

Yes

A Write Request

The parallel way

PredictionDuplicate Non-duplicate

Page 12: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

12

MemoryCPU

ABCD

1: duplicate 0: non-duplicate

History window

Page 13: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

13

MemoryCPUA

BCD

1: duplicate 0: non-duplicate

History window

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 14: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

14

MemoryCPU

1: duplicate 0: non-duplicate

A

0

BCD

History window

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 15: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

15

MemoryCPU

1: duplicate 0: non-duplicate

A

0

B

CD

History window

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 16: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

16

MemoryCPU

1: duplicate 0: non-duplicate

A

0

B

CD

History window

Predict

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 17: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

17

MemoryCPU

1: duplicate 0: non-duplicate

A

0

BCD

History window0

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 18: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

18

MemoryCPU

1: duplicate 0: non-duplicate

ABD

History window00

C

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 19: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

19

MemoryCPU

1: duplicate 0: non-duplicate

AB

C

D

History window

Predict00

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 20: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

20

MemoryCPU

1: duplicate 0: non-duplicate

ABCD

History window

92.1% accuracy

000

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 21: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

21

MemoryCPU

1: duplicate 0: non-duplicate

ABCD

History window0 00

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 22: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

22

MemoryCPU

1: duplicate 0: non-duplicate

ABC

D

History window0 00

Predict

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 23: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

23

MemoryCPU

1: duplicate 0: non-duplicate

ABC

D

History window0 0

92.1% 93.6%

0Predict

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 24: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

24

MemoryCPU

1: duplicate 0: non-duplicate

ABC

D

History window0 0

92.1% 93.6%

0Predict

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Page 25: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Prediction-based Parallelism

How to know whether a cache line is duplicate beforehand?Observation: duplication states of most memory writes are the same as those of their previous onesA prediction scheme:

Rationale: the size of duplicate (non-duplicate) data is usually much larger than a cache line – E.g., a page (4KB) is duplicate or non-duplicate: 100% accuracy

25

Why can we achieve such a high prediction accuracy?

92.1% 93.6%

Page 26: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Lightweight Deduplication for NVMM

Traditional deduplication

26

SHA1/MD5

SHA1/MD5

Non-duplicate

Duplicate

Hash computation latency: >300ns ≈ NVM write latencyMatch?Match?

Y

N

Page 27: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Lightweight Deduplication for NVMM

Traditional deduplication

27

SHA1/MD5

SHA1/MD5

Non-duplicate

Duplicate

Hash computation latency: >300ns ≈ NVM write latency

DeWrite

CRC-32CRC-32 Match?Match?

Non-duplicate

Read data and compare

Read data and compare Match?Match? Duplicate

Match?Match?

15ns75ns+1ns

Y

N

Y Y

NN

The latency is 91ns at most

Page 28: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Metadata Colocation

Encryption metadata: per-line counter

28

AES-ctr

LineAddr Counter

Key +Plaintext Plaintext

+Ciphertext Ciphertext

Encryption Decryption

OTP

Page 29: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Metadata Colocation

Encryption metadata: per-line counter

Deduplication metadata: address mapping, reverted hash

29

Page 30: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Metadata Colocation

30

- - a2 - a4 a5 an…

0 1 2 3 4 5 ninitAddr:realAddr:

h0 h1 - h3 - - hn…

0 1 2 3 4 5 ninitAddr:hash:

(b) The address mapping table

(a) The inverted hash table

Deduplicated

Encryption metadata: per-line counter

Deduplication metadata: address mapping, reverted hash

‘-’: empty

Page 31: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Metadata Colocation

31

c0 c1 a2 c3 a4 a5 an…

0 1 2 3 4 5 ninitAddr:realAddr:

h0 h1 c2 h3 c5 hn…

0 1 2 3 4 5 ninitAddr:

c4hash:

Encryption metadata: per-line counter

Deduplication metadata: address mapping, reverted hash

(b) The address mapping table

(a) The inverted hash table

Page 32: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Metadata Colocation

32

c0 c1 a2 c3 a4 a5 an…

0 1 2 3 4 5 ninitAddr:realAddr:

h0 h1 c2 h3 c5 hn…

0 1 2 3 4 5 ninitAddr:

c4

Flag

hash:

Encryption metadata: per-line counter

Deduplication metadata: address mapping, reverted hash

(b) The address mapping table

(a) The inverted hash table

Page 33: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Evaluation

Benchmarks– 12 Benchmarks from SPEC CPU2006: single-threaded– 8 benchmarks from m PARSEC 2.1: multiple-threaded

33

Simulation: gem5 + NVMain

Page 34: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

NVM Endurance

DeWrite reduces 54% writes to secure NVM on average

34

Page 35: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Write Speedup

35

DeWrite speeds up NVM writes by 4.2X on average

Page 36: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Read Speedup

36

DeWrite speeds up NVM reads by 3.1X on average

Page 37: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Instructions per Cycle

37

DeWrite improves the IPC by 80% on average

Page 38: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Energy Consumption

38

DeWrite reduces energy consumption by 40% on average

Page 39: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Space Overheads of Metadata Storage & Cache

39

Metadata storage– 6.25%

Metadata cache– (a) 512KB– (b) 512KB– (c) 512KB– (d) 128KB– Total <2MB

Page 40: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

ConclusionMemory encryption renders the bit-level write reduction techniques ineffective for secure NVMM

This paper proposes DeWrite, a line-level write reduction technique to enhance the endurance and performance– Lightweight cahe-line-level deduplication – Efficient synergization of deduplication and encryption

Reduce 54% writes, speed up memory writes and reads of secure NVMM by 4.2× and 3.1×, on average

40

Page 41: NVMW 2021 | 12th Annual Non-Volatile Memories Workshop ...nvmw.ucsd.edu/nvmw2019-program/unzip/current/nvmw2019...Non-volatile Memory (NVM) ¾Non-volatile memory is expected to replace

Thanks! Q&A