01 / English script
Welcome and Goals
01 · Daniel ChoKernel & BSP
Okay, let's get started. Welcome to the first of our Friday tech shares. I see people from four teams, which is exactly what I hoped for. The idea is simple: once a week, someone shares a technique they use in their daily work, and we have an open discussion afterward. No slides are required, and questions are welcome at any time. Today, Yuna and I will talk about debugging lockups, because it's the type of issue where teams waste the most time pointing at each other.
02 · Yuna KwakKernel & BSP
And it's also the type of issue where a little bit of knowledge goes a long way. Most lockups can be narrowed down to the right team in fifteen minutes if you know where to look in the dump. Our goal today is that by the end of this hour, everyone here can at least do that first triage step on their own.
03 · Tom AhnSQE
That would make my life much easier. Right now, when the stress lab sees a hang, we basically attach the dump and assign it to kernel by default. I suspect that's not always fair.
04 · Daniel ChoKernel & BSP
It's not, but don't worry, we're not keeping score. Let's go around very quickly so I know who's in the room. Elena, Seojin?
05 · Elena ParkPlatform Framework
Elena from Platform Framework. I mostly debug system server hangs, so I'm curious where the line is between a framework hang and a kernel lockup.
06 · Seojin LimModem Software
Seojin, Modem Software. We just had an incident where a debug restart policy ended up in a production build, so I'm here to understand the policies better, honestly.
Types of Lockups
07 · Daniel ChoKernel & BSP
Great, Elena's question is a perfect starting point. Let's define our terms, because people use 'hang' to mean five different things. At the bottom, we have a hard lockup: a CPU is stuck with interrupts disabled, so it can't even respond to the timer. Above that, a soft lockup: a CPU is stuck in kernel code with interrupts enabled, but it hasn't let the scheduler run anything else for more than twenty seconds, by default.
08 · Yuna KwakKernel & BSP
Then there's a hung task, which is different. The CPU is fine, but a specific task has been sleeping in an uninterruptible state for too long, usually waiting for a lock or for I/O that never completes. The CPU is happily running other things. It's just that one task, and everything waiting for it, is stuck.
09 · Elena ParkPlatform Framework
And the system server watchdog sits on top of all that, right? When our watchdog fires, it's because a thread in the system server didn't check in for sixty seconds.
10 · Daniel ChoKernel & BSP
Exactly. And here's the key insight: a framework watchdog can be caused by any of the layers below it. If a kernel driver holds a mutex forever, the system server thread that needs it shows up as a hung task, and sixty seconds later, the framework watchdog fires. The framework is the messenger, not necessarily the culprit.
11 · Tom AhnSQE
Can I ask about the hardware watchdog? In our reset reasons, we see 'watchdog bark' and 'watchdog bite'. I've always assumed they're the same thing.
12 · Yuna KwakKernel & BSP
Good question, and it's a common confusion. The hardware watchdog is a timer that the kernel has to pet regularly. If it isn't petted in time, first it barks: it raises an interrupt, and the kernel gets one last chance to save its state, usually by triggering a panic and collecting a ramdump. If the kernel can't even handle that interrupt, because the CPU is completely locked, the watchdog bites: it resets the chip immediately, and you often get very little information.
13 · Tom AhnSQE
So a bite is a much worse sign than a bark, from a debugging point of view.
14 · Daniel ChoKernel & BSP
In terms of how much data you get, yes. A bite usually means interrupts were disabled on the CPU that should have handled the bark. So the reset reason alone already tells you to look for code that disables interrupts for too long, which narrows things down a lot.
15 · Elena ParkPlatform Framework
Is there any way to get more information out of a bite? It feels like those are the cases where we need it most.
16 · Yuna KwakKernel & BSP
There are a couple of tricks. On most chipsets, the bootloader can preserve a small region of memory across the reset, and the kernel writes its log there continuously. So after a bite, the next boot can still recover the last few seconds of kernel messages. It's not a full dump, but it often shows which driver was active right before the reset. We call it the last kernel log, and SQE should always attach it.
17 · Tom AhnSQE
Noted. I'll make that mandatory in our filing template.
Walking Through a Real Ramdump
18 · Yuna KwakKernel & BSP
Let me make this concrete with a real case from Orion last spring. The symptom was that the screen froze during a video call, and after about sixty seconds, the device rebooted. SQE filed it as a display issue, and the display team spent a week on it. When I finally looked at the dump, here's the order I followed, and I'd recommend everyone use the same order.
19 · Yuna KwakKernel & BSP
Step one: read the panic reason and the last kernel log lines. In this case, the panic was triggered by the framework watchdog, which killed the system server, and the log said the main thread was blocked. That tells us the framework detected the problem, but not who caused it. Step two: look at what the blocked thread is waiting on. Here, it was waiting in the kernel, inside the binder driver, for a reply from the camera hardware service.
20 · Elena ParkPlatform Framework
So you follow the chain of who is waiting for whom, until you find the thread that isn't waiting for anything but is still stuck.
21 · Yuna KwakKernel & BSP
Exactly, that's step three. The camera service thread was waiting on a mutex in the camera driver. The crash utility can tell you the owner of a mutex, so I looked up the owner, and it was a kernel worker thread that was running, not sleeping, on CPU five. When I looked at that CPU's stack, it was spinning in a loop inside the image processor driver, waiting for a hardware status bit that never got set.
22 · Tom AhnSQE
So in the end, it was the camera driver, not the display. The display just stopped updating because the whole framework was blocked behind it.
23 · Yuna KwakKernel & BSP
Right. And the fix was a timeout on that polling loop plus a hardware reset path for the image processor. The display team had done nothing wrong. With the right order, that triage takes about fifteen minutes. Without it, it took a week and three teams.
24 · Seojin LimModem Software
A quick question about step two. Binder transactions cross process boundaries. How do you find which thread in the other process is handling the call? In the modem service, we've had cases where we couldn't figure that out.
25 · Daniel ChoKernel & BSP
The binder driver keeps a record of every outstanding transaction, including the source and target threads. In the dump, you can print the binder state, and it shows something like: thread A in process X is waiting for transaction number such-and-such, which is being handled by thread B in process Y. It's one of the most useful things in the whole dump, and very few people know it's there.
26 · Seojin LimModem Software
That would have saved us days last month. Could you add the exact command to the wiki page?
27 · Daniel ChoKernel & BSP
Absolutely. That's actually one of today's action items.
Debate: Panic on Soft Lockup in User Builds
28 · Daniel ChoKernel & BSP
Now for the discussion part. There's a configuration option that makes the kernel panic, and therefore reboot, as soon as a soft lockup is detected. In our engineering builds, it's on. In user builds, the ones customers get, it's off. Yuna and I disagree on whether it should be on for user builds, and we thought it would be fun to argue about it in public.
29 · Yuna KwakKernel & BSP
My position is that it should be on. Today, when a soft lockup happens on a customer device, the kernel prints a warning and keeps going. Sometimes the device recovers, but often it ends up half-dead: the screen is frozen, the user has to hold the power button, and we get no dump at all. If we panicked immediately, we'd collect a ramdump, the device would reboot in about a minute, and we'd actually be able to fix the root cause.
30 · Daniel ChoKernel & BSP
And my position is that it's too aggressive for customers. Not every soft lockup is fatal. Some are caused by very long but legitimate operations, like a huge memory compaction on a device under pressure. In those cases, the system recovers on its own after a few seconds. If we panic, we turn a short stutter into a full reboot, which is far worse for the user. A reboot also shows up in our quality metrics, while a stutter doesn't.
31 · Tom AhnSQE
Isn't that last point a bit of a red flag, though? If we're choosing a policy partly because it keeps a metric looking good, we might be hiding real problems from ourselves.
32 · Daniel ChoKernel & BSP
Fair challenge, and I'll take that back. The metric shouldn't drive the decision. The user experience should. And for the user, a two-second stutter is better than a sixty-second reboot.
33 · Elena ParkPlatform Framework
From the framework side, I'd add that the half-dead state Yuna described is the worst outcome of all. When the kernel recovers partially, the system server often ends up in a weird state, and we see strange bugs for hours afterward. A clean reboot is sometimes kinder than limping along.
34 · Seojin LimModem Software
Is there a middle ground? For example, don't panic on the first soft lockup, but if the same CPU is still stuck after, say, sixty seconds, then panic. Short stalls recover on their own, and real lockups get a dump.
35 · Yuna KwakKernel & BSP
I actually like that a lot. It addresses Daniel's concern about legitimate long operations, and it addresses my concern about half-dead devices. We'd need to check whether the kernel supports that kind of escalation out of the box, or whether we'd have to carry a patch.
36 · Daniel ChoKernel & BSP
I can live with that, as long as we roll it out carefully. Let's not change the policy on all devices at once. We could enable it on the internal dogfood population first, compare the reboot rate and the number of useful dumps for a month, and then decide based on data rather than on who argued more convincingly today.
37 · Tom AhnSQE
SQE would be happy to help with the comparison. We can mirror the setting in the stress lab too, which would give us a much faster signal than dogfood alone.
Tooling and Data Collection
38 · Seojin LimModem Software
Before we close, I want to go back to my original reason for being here. After our incident, I'm nervous about any debug-related setting reaching a production build. How do we make sure the ramdump collection policy itself is correct for each build type?
39 · Daniel ChoKernel & BSP
Good question. In user builds, a full ramdump is disabled, because it can contain personal data, and it's too big to upload anyway. What we collect instead is a minidump: only the kernel log, the registers and stacks of each CPU, and a few key data structures, with all user memory excluded. It's usually a few megabytes, and in my experience, it's enough to triage about seventy percent of lockups.
40 · Yuna KwakKernel & BSP
And for the remaining thirty percent, we usually need the lock owner information, which isn't in the minidump today. That's something I'd like to add: the list of tasks in uninterruptible sleep and what each one is waiting on. It's small, it doesn't contain user data, and it would have made the camera case I described solvable from a minidump alone.
41 · Elena ParkPlatform Framework
If you add that, please include the binder transaction state as well. Half of the framework hangs I see are blocked binder calls, and that's exactly the information that would point me to the right process.
42 · Daniel ChoKernel & BSP
Noted. We'll need a privacy review for any change to what's collected, even if it's just kernel metadata, so let's propose both additions together in one review.
Action Items
43 · Daniel ChoKernel & BSP
Let's turn this into action items. Yuna: write a wiki page with the four-step triage order and the exact crash utility commands, including the binder state, by next Wednesday. Me: check whether the kernel supports escalating a soft lockup to a panic after a configurable delay, and draft a proposal for the dogfood experiment. Tom: set up a matching configuration in the stress lab once we have the proposal. Elena and Yuna: draft the minidump additions for privacy review together.
44 · Tom AhnSQE
And from SQE, I'll update our triage checklist so testers look at the reset reason and the blocked thread before assigning an issue to a team. If it saves even one wrong assignment a week, it's worth it.
45 · Seojin LimModem Software
I'll share the release check we're adding for debug settings in carrier configurations. It might be useful for kernel configuration options too.
Closing and Next Session
46 · Daniel ChoKernel & BSP
Thank you all. This was more lively than I expected, in a good way. Next Friday, August 14th, same time, 4 p.m. Korea time in the large meeting room, we'll have a session on the generic kernel image and how vendor modules should be split. That one will probably be even more controversial, so bring your opinions.
47 · Elena ParkPlatform Framework
I'll be there. And thanks for the binder tip; I'm going to try it on a hang I've been stuck on since Tuesday.
48 · Yuna KwakKernel & BSP
Let me know how it goes. If it works, that's a great example for the wiki page.
03 / Business expressions
pointing at each other
서로 손가락질하는, 서로 탓하는 · 팀 간에 책임을 떠넘기는 상황을 묘사할 때
Today, Yuna and I will talk about debugging lockups, because it's the type of issue where teams waste the most time pointing at each other.
응용 연습
Instead of pointing at each other, let's look at the trace together.
narrowed down
범위가 좁혀진 · 원인이나 담당 범위를 좁혀 갈 때
Most lockups can be narrowed down to the right team in fifteen minutes if you know where to look in the dump.
응용 연습
The regression has been narrowed down to three commits.
on their own
스스로, 혼자서 · 다른 도움 없이 할 수 있음을 말할 때
Our goal today is that by the end of this hour, everyone here can at least do that first triage step on their own.
응용 연습
New team members should be able to flash a device on their own.
keeping score
(누가 잘못했는지) 점수를 매기는 · 비난하려는 게 아님을 가볍게 강조할 때
It's not, but don't worry, we're not keeping score.
응용 연습
We're not keeping score; we just want the bug fixed.
define our terms
용어를 정의하다 · 논의 전에 용어의 의미를 통일할 때
Let's define our terms, because people use 'hang' to mean five different things.
응용 연습
Before we compare numbers, let's define our terms for crash rate.
the messenger, not necessarily the culprit
범인이 아니라 소식을 전하는 쪽 · 문제를 감지한 구성 요소가 원인은 아닐 수 있다고 설명할 때
The framework is the messenger, not necessarily the culprit.
응용 연습
The watchdog is the messenger, not necessarily the culprit.
a common confusion
흔히 헷갈리는 부분 · 자주 오해되는 개념을 설명하기 전에
Good question, and it's a common confusion.
응용 연습
It's a common confusion, but SELinux denials don't always cause crashes.
make this concrete
구체적으로 설명하다 · 추상적인 설명을 실제 사례로 보여 줄 때
Let me make this concrete with a real case from Orion last spring.
응용 연습
Let me make this concrete with last week's boot failure.
had done nothing wrong
잘못한 게 없었다 · 오해받은 팀의 책임이 없음을 분명히 할 때
The display team had done nothing wrong.
응용 연습
It turned out the vendor had done nothing wrong; our config was outdated.
argue about it in public
공개적으로 논쟁하다 · 의견 차이를 건강한 토론으로 다루자고 제안할 때
Yuna and I disagree on whether it should be on for user builds, and we thought it would be fun to argue about it in public.
응용 연습
Let's argue about it in public so everyone hears both sides.
a red flag
위험 신호 · 논리나 상황에서 문제가 될 만한 점을 지적할 때
Isn't that last point a bit of a red flag, though?
응용 연습
A test that never fails is a bit of a red flag.
I'll take that back
그 말은 철회하겠다 · 자신의 발언이 잘못됐음을 인정할 때
Fair challenge, and I'll take that back.
응용 연습
I said it was a hardware issue, but I'll take that back.
limping along
절뚝거리며 버티는, 불완전하게 겨우 동작하는 · 시스템이 비정상 상태로 간신히 동작하는 모습을 표현할 때
A clean reboot is sometimes kinder than limping along.
응용 연습
The build server has been limping along since the disk filled up.
out of the box
기본 기능으로, 별도 수정 없이 · 추가 작업 없이 지원되는지 확인할 때
We'd need to check whether the kernel supports that kind of escalation out of the box, or whether we'd have to carry a patch.
응용 연습
Does the tracing tool support this kernel version out of the box?
based on data
데이터에 근거해 · 주장이 아닌 데이터로 결정하자고 할 때
We could enable it on the internal dogfood population first, compare the reboot rate and the number of useful dumps for a month, and then decide based on data rather than on who argued more convincingly today.
응용 연습
Let's decide the timeout value based on data from the lab.
it's worth it
그만한 가치가 있다 · 작은 효과라도 노력할 가치가 있다고 말할 때
If it saves even one wrong assignment a week, it's worth it.
응용 연습
It takes an extra day, but it's worth it.