Submit Search
Upload
EPT と TLB でしくじった話
•
4 likes
•
2,417 views
T
Takaaki Fukai
Follow
第12回 カーネル/VM探検隊 発表資料 http://kernelvm12.peatix.com/
Read less
Read more
Technology
Report
Share
Report
Share
1 of 16
Download now
Download to read offline
Recommended
Plan 9 MEETS "YUREX" 発動篇
Plan 9 MEETS "YUREX" 発動篇
Go Saito
ライブマイグレーション実装で体験したデバッグの解説
ライブマイグレーション実装で体験したデバッグの解説
Takaaki Fukai
Unsafe Nested Virtualization on Intel CPU
Unsafe Nested Virtualization on Intel CPU
Takaaki Fukai
そのベンチマークソフト本当に大丈夫ですか?
そのベンチマークソフト本当に大丈夫ですか?
Takaaki Fukai
kvm-clock に時間を尋ねるのは間違っているだろうか
kvm-clock に時間を尋ねるのは間違っているだろうか
Takaaki Fukai
Rancher.ioを試してみる
Rancher.ioを試してみる
Takaaki Fukai
僕の考えたさいきょーのVMM開発環境
僕の考えたさいきょーのVMM開発環境
Takaaki Fukai
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Recommended
Plan 9 MEETS "YUREX" 発動篇
Plan 9 MEETS "YUREX" 発動篇
Go Saito
ライブマイグレーション実装で体験したデバッグの解説
ライブマイグレーション実装で体験したデバッグの解説
Takaaki Fukai
Unsafe Nested Virtualization on Intel CPU
Unsafe Nested Virtualization on Intel CPU
Takaaki Fukai
そのベンチマークソフト本当に大丈夫ですか?
そのベンチマークソフト本当に大丈夫ですか?
Takaaki Fukai
kvm-clock に時間を尋ねるのは間違っているだろうか
kvm-clock に時間を尋ねるのは間違っているだろうか
Takaaki Fukai
Rancher.ioを試してみる
Rancher.ioを試してみる
Takaaki Fukai
僕の考えたさいきょーのVMM開発環境
僕の考えたさいきょーのVMM開発環境
Takaaki Fukai
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
osamut
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
Atomu Hidaka
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
Shota Ito
プレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツール
sugiuralab
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
danielhu54
プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価
sugiuralab
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
iPride Co., Ltd.
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
iPride Co., Ltd.
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
More Related Content
Recently uploaded
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
osamut
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
Atomu Hidaka
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
Shota Ito
プレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツール
sugiuralab
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
danielhu54
プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価
sugiuralab
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
iPride Co., Ltd.
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
iPride Co., Ltd.
Recently uploaded
(8)
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
プレイマットのパターン生成支援ツール
プレイマットのパターン生成支援ツール
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
プレイマットのパターン生成支援ツールの評価
プレイマットのパターン生成支援ツールの評価
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
Featured
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
Featured
(20)
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
EPT と TLB でしくじった話
1.
EPT と TLB
でしくじった話 @deep_tkkn 2016.10.08 Kernel/VM 探検隊
2.
自己紹介 • 氏名: 深井
貴明 • 所属: TKB大学 • Twitter: @deep_tkkn • BitVisor であれこれしてる人 2
3.
今日のお話 • EPT と
TLB 周りでハマって時間溶けて悲しかったお話 • 新規性はないと思う • 理屈としては教科書にも載ってそう • 同じような経験したことある人いると思う • しかし,実際起きるとどれくらい悲しいか伝えたい 3 EPT, TLB, マルチコア,ウッ頭が
4.
事の始まり • BitVisor でライブマイグレーションを実装 •
シングルコアでは動いた マルチコア対応 4 ライブマイグレーション! 移動元の物理マシン 移動先の物理マシン
5.
マイグレーションってどうやるの? VMを構成するハードウェアの状態をすべて転送 • CPU • メモリ •
デバイス 5
6.
マイグレーションってどうやるの? VMを構成するハードウェアの状態をすべて転送 • CPU • メモリ •
デバイス メモリ転送には時間がかかる “ライブ” にするには,OSのバックグラウンドでメモリ転送 6
7.
バックグラウンドでメモリ転送 7 Src RAM Dst
RAM転送 OS が メモリ更新 Dirty page を再送 Dirty page を再送 OS が メモリ更新 ・・・
8.
Dirty pages をどうやって追うか •
VT-x の メモリ管理機能 (EPT) の機能の一部を使う • EPT: ゲスト物理アドレス マシン物理アドレスへ変換する ページング機構 • 挙動は普通のページングとほぼ同じ • EPT エントリ (EPTE) にも Dirty bit がある • 該当ページが更新されると立つビット 8
9.
9 Intel® 64 and
IA-32 Architectures Software Developer’s Manual Volume 3C: System Programming Guide, Part 3 Order Number: 326019-048US
10.
何も考えずに実装してみた • メモリ転送は1コアでやる (並列にやるとロックがうざい) •
Dirty bit の操作も 1 コアでやる • Dirty page 送りきったら,すべてのコアの EPTE を走査 • Dirty bit が立ってるページを記録 10
11.
何が起きたか 11 20% の確率でエラー &&
エラーログが毎回違う 2~3カ月くらい
12.
TLB と EPT
の落とし穴 • TLB(Table Lookaside Buffer): アドレス変換のキャッシュ • 毎回ページテーブルを引くと遅いから • EPT による変換も TLB に載る • Dirty Bit の情報も TLB に載る • たぶん EPTE がキャッシュに載るイメージ • TLB はHW がコア間でコヒーレンシー取られない • CPU のデータキャッシュとは違う 12
13.
何が起きていたのか? • あるコアでほかのコアの EPT
エントリを読む • Dirty bit を読む • 一部の情報はTLBに載ってて古い • 該当ページを書き換えたのに dirty bit が立ってないように見 える • Dirty ページを見逃す • 一部のページだけ古い状態でマイグレーション 13
14.
修正版の実装 • EPTE 読む前に全コアで
TLB shootdown する • ちゃんと動く • コードとしては数行の変更 • これに2,3カ月取られたと思うと… 14
15.
大事なこと • 負けないこと投げ出さないこと逃げ出さないこと • メモリ周りの挙動が怪しければ
TLB も疑おう • 思い当たれば気付けるし直せる • 知らない & 周りに知ってる人がいないと祈るしかない • 知る者と知らざる者の差 15
16.
まとめ • EPTE は
TLB に載る • TLB は ハードウェアがコヒーレンシ―取らない • データキャッシュみたいな感覚だと痛い目を見る • TLB 絡みのバグはつらい • メモリが微妙に壊れる • メモリ周りの挙動が怪しいときは TLB を疑う 16
Download now