SlideShare a Scribd company logo
1 of 23
Download to read offline
To crash or not to crash:
If you do, at least recover fast!
Guilherme G. Piccoli
2023-08-26 / Fosforums
1
Bio
Always loved computers, since childhood
BSc Mathematics, MSc Computer Sc.(IC/Unicamp!)
IBM/LTC
Linux kernel, PPC64, kdump, PCI
Canonical
Sustaining eng., kernel, Ubuntu, kdump
Igalia
Cooperative, kdump, x86, btrfs
2
What's a kernel crash / panic?
Linux kernel is a regular SW in the end
Written in C (and a bit of Rust)
Oops is not (necessarily) a panic
NULL pointers (concurrency / SMP), lockups
(soft/hard), sysrq
OOM (out-of-memory), invalid memory, BUG() call
3
Portrait of a kernel panic
amdgpu 0000:04:00.0: amdgpu: SMU is initialized successfully!
[drm] failed to load ucode VCN0_RAM(0x3A)
[drm] psp gfx command LOAD_IP_FW(0x6) failed and response status is (0xF
amdgpu 0000:04:00.0: amdgpu: amdgpu_device_ip_init failed
amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU init
amdgpu: probe of 0000:04:00.0 failed with error -110
BUG: kernel NULL pointer dereference, address: 0000000000000090
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
Oops: 0002 [#1] PREEMPT SMP NOPTI
CPU: 6 PID: 685 Comm: systemd-udevd Not tainted 6.1.2-valve1-1-neptune-6
RIP: 0010:drm_sched_fini+0x84/0xa0 [gpu_sched]
RSP: 0018:ffffba3fc0f6fa90 EFLAGS: 00010207
RAX: 0000000000000000 RBX: ffff9373dca69b10 RCX: ffff9373d51db380
RDX: 0000000000000001 RSI: ffff9373d51db3a8 RDI: ffff9373dca69b00
CR2: 0000000000000090 CR3: 000000010bdf6000 CR4: 0000000000350ee0
Call Trace:
amdgpu_fence_driver_sw_fini+0xc8/0xd0 [amdgpu]
amdgpu_device_fini_sw+0x33/0x3c0 [amdgpu]
driver_probe_device+0x1f/0x90
driver_register+0x8d/0xe0
4
And how does it happen?
Kernel detects a bad condition
Panic on oops (or live with the oops at your own risk)
Other settings like panic_on_oom, or on lockups, etc
Arch-dependent, "abrupt" condition usually
5
Panic (over-simplified) code flow
local IRQ and
preempt disable
dump stack
kdump?
crash_kexec()
disable the
other CPUs
panic notifiers
and kmsg_dump()
arch code / reboot
arch code / kexec
YES NO
6
But...what can we do?
Reboot (and pretend nothing happened!)
Collect data: vmcore (memory image) / dmesg
(kernel log)
Console (net/serial) / kdump / pstore
kgdb / xmon / other debuggers
7
Collecting (all the) data: kdump
kexec the crash kernel, using only special RAM area
Preserves the memory contents of old/broken
kernel
The new kernel collects and compresses the old
kernel memory (vmcore)
The memory dump can be inspected later
Quite standard for servers in the field
8
Advantages of kdump
(Almost) full copy of memory
Lots of data to debug
Post-mortem analysis, easy to share with others
Network (and other esoteric ways for) data saving
9
Challenges of kdump
Pre-reserved memory required (more and more lately)
Risks during:
Broken kernel shutdown
Crash kernel booting
The data collecting phase
PCI devices reset: a nightmare
No graphics on kdump, (potential) long boot delay
vmcore compatibility with new kernel features
10
Interrupt storm: a true story
PCI resets are arch-dependent (if any! PPC64 vs x86)
Real case: Intel NIC running under DPDK
Custom SW piece triggered (likely) a NIC FW bug -
interrupt storm!
kdump kernel unable to boot (stuck at APIC interrupt
enabling)
x86 early PCI infra to the rescue! [discussion]
11
Collecting (most) data: pstore
Lightweight mechanism - save the kernel log in a
persistent storage
Multiple backends: RAM, UEFI, ACPI ERST, block
device
Also many frontends: dmesg, console, ftrace(!)
More common in embedded devices (and
chromebooks!)
12
Benefits of pstore
Very fast and (hopefully) transparent process
Not much memory required (ramoops)
NO memory reserved if UEFI backend is used
Less prone to failures (citation needed)
Doesn't require kexec support
Not only for crashes: console / pmsg / ftrace
13
Challenges of pstore
Cannot collect a full vmcore
dmesg presents "limited" information
(Kinda) circumvented with panic_print
For , runs after panic notifiers - increased risk
now
14
Available tools
kdump (or pstore) alone are kernel technologies
Requires userspace counter-part
No(?) pstore collecting tools
/ kdump-only tools
/ kdump-only tools
vmcore analysis tools: ,
Arch Linux?
Debian Ubuntu
Fedora OpenSUSE
crash drgn
15
Wait, a Linux game console? Oh yeah
Steam Deck, from Valve
CPU/APU AMD Zen 2 (custom), 4-cores/8-threads,
7" display
16 GB of RAM, 3 models of NVMe storage (64G,
256G, 512G)
16
Steam Deck
SteamOS 3: Arch-based distro with gamescope
(games) and KDE Plasma (desktop)
Sophisticated stack for games: Steam, Proton (Wine),
DXVK, VKD3D, etc
17
Presenting: kdumpst
is an Arch Linux kdump and pstore tool
Available on , supports GRUB and initcpio /
dracut
Default to pstore mode; currently only ramoops
backend (UEFI plans)
Simple / customizable: sysctls, crashkernel and log
compression
Present on SteamOS as Deck's crash collecting tool
kdumpst
AUR
18
The missing pieces
Panic notifiers: necessary evil?
Refactor
Split in multiple lists, purpose-based
Polemic / tough consensus
Better ramoops memory reservation mechanism
proposed
19
More missing pieces
Graphical output during kdump
Is it possible? GPU interrupts
UEFI hinting - logo change idea
Reliable PCI reset for kdump kernels
Maintainers communication / awareness
attempt
20
Conclusion
Kernel crashes DO happen - need to be prepared
Multiple ways to react to them / trade-offs of data
collecting mechanisms
Still have lots of core things to improve
Linux gaming bumping kdump/pstore techs (unexpected)
21
22
To crash or not to crash: if you do, at least recover fast!

More Related Content

Similar to To crash or not to crash: if you do, at least recover fast!

gpuprogram_lecture,architecture_designsn
gpuprogram_lecture,architecture_designsngpuprogram_lecture,architecture_designsn
gpuprogram_lecture,architecture_designsnARUNACHALAM468781
 
[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practicalMoabi.com
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machinesAnne Nicolas
 
Linux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisLinux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisPaul V. Novarese
 
Trip down the GPU lane with Machine Learning
Trip down the GPU lane with Machine LearningTrip down the GPU lane with Machine Learning
Trip down the GPU lane with Machine LearningRenaldas Zioma
 
Challenges in GPU compilers
Challenges in GPU compilersChallenges in GPU compilers
Challenges in GPU compilersAnastasiaStulova
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http acceleratorno no
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzerDmitry Vyukov
 
DefCon 2012 - Hardware Backdooring (Slides)
DefCon 2012 - Hardware Backdooring (Slides)DefCon 2012 - Hardware Backdooring (Slides)
DefCon 2012 - Hardware Backdooring (Slides)Michael Smith
 
ACPI and FreeBSD (Part 1)
ACPI and FreeBSD (Part 1)ACPI and FreeBSD (Part 1)
ACPI and FreeBSD (Part 1)Nate Lawson
 
Making GPU resets less painful on Linux
Making GPU resets less painful on LinuxMaking GPU resets less painful on Linux
Making GPU resets less painful on LinuxIgalia
 
Computer systems|Computer Networking & Communication System Assignment - Netw...
Computer systems|Computer Networking & Communication System Assignment - Netw...Computer systems|Computer Networking & Communication System Assignment - Netw...
Computer systems|Computer Networking & Communication System Assignment - Netw...freeassignmenthelp
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisBuland Singh
 
UKUUG presentation about µCLinux on Pluto 6
UKUUG presentation about µCLinux on Pluto 6UKUUG presentation about µCLinux on Pluto 6
UKUUG presentation about µCLinux on Pluto 6edlangley
 
“Linux Kernel CPU Hotplug in the Multicore System”
“Linux Kernel CPU Hotplug in the Multicore System”“Linux Kernel CPU Hotplug in the Multicore System”
“Linux Kernel CPU Hotplug in the Multicore System”GlobalLogic Ukraine
 
Gpu and The Brick Wall
Gpu and The Brick WallGpu and The Brick Wall
Gpu and The Brick Wallugur candan
 
Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.J On The Beach
 

Similar to To crash or not to crash: if you do, at least recover fast! (20)

gpuprogram_lecture,architecture_designsn
gpuprogram_lecture,architecture_designsngpuprogram_lecture,architecture_designsn
gpuprogram_lecture,architecture_designsn
 
[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machines
 
Linux Crash Dump Capture and Analysis
Linux Crash Dump Capture and AnalysisLinux Crash Dump Capture and Analysis
Linux Crash Dump Capture and Analysis
 
Trip down the GPU lane with Machine Learning
Trip down the GPU lane with Machine LearningTrip down the GPU lane with Machine Learning
Trip down the GPU lane with Machine Learning
 
Challenges in GPU compilers
Challenges in GPU compilersChallenges in GPU compilers
Challenges in GPU compilers
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
 
Kdump
KdumpKdump
Kdump
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
 
DefCon 2012 - Hardware Backdooring (Slides)
DefCon 2012 - Hardware Backdooring (Slides)DefCon 2012 - Hardware Backdooring (Slides)
DefCon 2012 - Hardware Backdooring (Slides)
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
ACPI and FreeBSD (Part 1)
ACPI and FreeBSD (Part 1)ACPI and FreeBSD (Part 1)
ACPI and FreeBSD (Part 1)
 
Making GPU resets less painful on Linux
Making GPU resets less painful on LinuxMaking GPU resets less painful on Linux
Making GPU resets less painful on Linux
 
Computer systems|Computer Networking & Communication System Assignment - Netw...
Computer systems|Computer Networking & Communication System Assignment - Netw...Computer systems|Computer Networking & Communication System Assignment - Netw...
Computer systems|Computer Networking & Communication System Assignment - Netw...
 
Jslinux
JslinuxJslinux
Jslinux
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
 
UKUUG presentation about µCLinux on Pluto 6
UKUUG presentation about µCLinux on Pluto 6UKUUG presentation about µCLinux on Pluto 6
UKUUG presentation about µCLinux on Pluto 6
 
“Linux Kernel CPU Hotplug in the Multicore System”
“Linux Kernel CPU Hotplug in the Multicore System”“Linux Kernel CPU Hotplug in the Multicore System”
“Linux Kernel CPU Hotplug in the Multicore System”
 
Gpu and The Brick Wall
Gpu and The Brick WallGpu and The Brick Wall
Gpu and The Brick Wall
 
Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.Using GPUs to handle Big Data with Java by Adam Roberts.
Using GPUs to handle Big Data with Java by Adam Roberts.
 

More from Igalia

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEIgalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesIgalia
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceIgalia
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfIgalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 
Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Igalia
 

More from Igalia (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 
Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...
 

Recently uploaded

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

To crash or not to crash: if you do, at least recover fast!

  • 1. To crash or not to crash: If you do, at least recover fast! Guilherme G. Piccoli 2023-08-26 / Fosforums 1
  • 2. Bio Always loved computers, since childhood BSc Mathematics, MSc Computer Sc.(IC/Unicamp!) IBM/LTC Linux kernel, PPC64, kdump, PCI Canonical Sustaining eng., kernel, Ubuntu, kdump Igalia Cooperative, kdump, x86, btrfs 2
  • 3. What's a kernel crash / panic? Linux kernel is a regular SW in the end Written in C (and a bit of Rust) Oops is not (necessarily) a panic NULL pointers (concurrency / SMP), lockups (soft/hard), sysrq OOM (out-of-memory), invalid memory, BUG() call 3
  • 4. Portrait of a kernel panic amdgpu 0000:04:00.0: amdgpu: SMU is initialized successfully! [drm] failed to load ucode VCN0_RAM(0x3A) [drm] psp gfx command LOAD_IP_FW(0x6) failed and response status is (0xF amdgpu 0000:04:00.0: amdgpu: amdgpu_device_ip_init failed amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU init amdgpu: probe of 0000:04:00.0 failed with error -110 BUG: kernel NULL pointer dereference, address: 0000000000000090 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page Oops: 0002 [#1] PREEMPT SMP NOPTI CPU: 6 PID: 685 Comm: systemd-udevd Not tainted 6.1.2-valve1-1-neptune-6 RIP: 0010:drm_sched_fini+0x84/0xa0 [gpu_sched] RSP: 0018:ffffba3fc0f6fa90 EFLAGS: 00010207 RAX: 0000000000000000 RBX: ffff9373dca69b10 RCX: ffff9373d51db380 RDX: 0000000000000001 RSI: ffff9373d51db3a8 RDI: ffff9373dca69b00 CR2: 0000000000000090 CR3: 000000010bdf6000 CR4: 0000000000350ee0 Call Trace: amdgpu_fence_driver_sw_fini+0xc8/0xd0 [amdgpu] amdgpu_device_fini_sw+0x33/0x3c0 [amdgpu] driver_probe_device+0x1f/0x90 driver_register+0x8d/0xe0 4
  • 5. And how does it happen? Kernel detects a bad condition Panic on oops (or live with the oops at your own risk) Other settings like panic_on_oom, or on lockups, etc Arch-dependent, "abrupt" condition usually 5
  • 6. Panic (over-simplified) code flow local IRQ and preempt disable dump stack kdump? crash_kexec() disable the other CPUs panic notifiers and kmsg_dump() arch code / reboot arch code / kexec YES NO 6
  • 7. But...what can we do? Reboot (and pretend nothing happened!) Collect data: vmcore (memory image) / dmesg (kernel log) Console (net/serial) / kdump / pstore kgdb / xmon / other debuggers 7
  • 8. Collecting (all the) data: kdump kexec the crash kernel, using only special RAM area Preserves the memory contents of old/broken kernel The new kernel collects and compresses the old kernel memory (vmcore) The memory dump can be inspected later Quite standard for servers in the field 8
  • 9. Advantages of kdump (Almost) full copy of memory Lots of data to debug Post-mortem analysis, easy to share with others Network (and other esoteric ways for) data saving 9
  • 10. Challenges of kdump Pre-reserved memory required (more and more lately) Risks during: Broken kernel shutdown Crash kernel booting The data collecting phase PCI devices reset: a nightmare No graphics on kdump, (potential) long boot delay vmcore compatibility with new kernel features 10
  • 11. Interrupt storm: a true story PCI resets are arch-dependent (if any! PPC64 vs x86) Real case: Intel NIC running under DPDK Custom SW piece triggered (likely) a NIC FW bug - interrupt storm! kdump kernel unable to boot (stuck at APIC interrupt enabling) x86 early PCI infra to the rescue! [discussion] 11
  • 12. Collecting (most) data: pstore Lightweight mechanism - save the kernel log in a persistent storage Multiple backends: RAM, UEFI, ACPI ERST, block device Also many frontends: dmesg, console, ftrace(!) More common in embedded devices (and chromebooks!) 12
  • 13. Benefits of pstore Very fast and (hopefully) transparent process Not much memory required (ramoops) NO memory reserved if UEFI backend is used Less prone to failures (citation needed) Doesn't require kexec support Not only for crashes: console / pmsg / ftrace 13
  • 14. Challenges of pstore Cannot collect a full vmcore dmesg presents "limited" information (Kinda) circumvented with panic_print For , runs after panic notifiers - increased risk now 14
  • 15. Available tools kdump (or pstore) alone are kernel technologies Requires userspace counter-part No(?) pstore collecting tools / kdump-only tools / kdump-only tools vmcore analysis tools: , Arch Linux? Debian Ubuntu Fedora OpenSUSE crash drgn 15
  • 16. Wait, a Linux game console? Oh yeah Steam Deck, from Valve CPU/APU AMD Zen 2 (custom), 4-cores/8-threads, 7" display 16 GB of RAM, 3 models of NVMe storage (64G, 256G, 512G) 16
  • 17. Steam Deck SteamOS 3: Arch-based distro with gamescope (games) and KDE Plasma (desktop) Sophisticated stack for games: Steam, Proton (Wine), DXVK, VKD3D, etc 17
  • 18. Presenting: kdumpst is an Arch Linux kdump and pstore tool Available on , supports GRUB and initcpio / dracut Default to pstore mode; currently only ramoops backend (UEFI plans) Simple / customizable: sysctls, crashkernel and log compression Present on SteamOS as Deck's crash collecting tool kdumpst AUR 18
  • 19. The missing pieces Panic notifiers: necessary evil? Refactor Split in multiple lists, purpose-based Polemic / tough consensus Better ramoops memory reservation mechanism proposed 19
  • 20. More missing pieces Graphical output during kdump Is it possible? GPU interrupts UEFI hinting - logo change idea Reliable PCI reset for kdump kernels Maintainers communication / awareness attempt 20
  • 21. Conclusion Kernel crashes DO happen - need to be prepared Multiple ways to react to them / trade-offs of data collecting mechanisms Still have lots of core things to improve Linux gaming bumping kdump/pstore techs (unexpected) 21
  • 22. 22