Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and...

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 The 51st IEEE/ACM International Symposium on Microarchitecture (MICRO), 2018

Transcript of Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and...

Page 1: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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

The 51st IEEE/ACM International Symposium on Microarchitecture (MICRO), 2018

Page 2: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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

However, memory encryption increases writes to NVM

Page 4: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Observation and Motivation

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

SPEC CPU2006 PARSEC 2.1

Improving performance and endurance of encrypted NVM through deduplicating entire-line writes

Page 7: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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

Optimal: use the direct way for duplicate writes and the parallel way for non-duplicate writes

Page 11: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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:

Why can we achieve such a high prediction accuracy?

Page 25: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Metadata Colocation

Encryption metadata: per-line counter

28

AES-ctr

LineAddr Counter

Key +Plaintext Plaintext

+Ciphertext Ciphertext

Encryption Decryption

OTP

Page 29: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Metadata Colocation

Encryption metadata: per-line counter

Deduplication metadata: address mapping, reverted hash

29

Page 30: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Evaluation

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

33

Simulation: gem5 + NVMain

Page 34: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

NVM Endurance

DeWrite reduces 54% writes to secure NVM on average

34

Page 35: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Write Speedup

35

DeWrite speeds up NVM writes by 4.2X on average

Page 36: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Read Speedup

36

DeWrite speeds up NVM reads by 3.1X on average

Page 37: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Instructions per Cycle

37

DeWrite improves the IPC by 80% on average

Page 38: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Energy Consumption

38

DeWrite reduces energy consumption by 40% on average

Page 39: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

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: Improving the Performance and Endurance of Encrypted Non ... · Improving the Performance and Endurance of Encrypted Non-volatile Main Memory through Deduplicating Writes Pengfei

Thanks! Q&A