今日重点:📖 阅读——今天 linux-media 来了一封教科书级的 cover letter: Daniel Scally(Ideas on Board)的 [PATCH 00/16] Allow a running stream to survive suspend and resume in rkisp1。Rockchip ISP 在内核挂起/恢复时把正在跑的 视频流弄死的问题,他用 16 个补丁修,但 cover letter 只用了 3 段话就把 「现状、目标、怎么修」讲清楚。精读这一封,你以后读任何大系列的 cover letter 都知道 该往哪儿看。
📖 阅读:3 段话 = 一篇完整叙事
/ sectionAt the moment a stream that's running from the rkisp1 when the device is suspended to RAM or disk is dead when the device is resumed. This series is an attempt to make the stream survive that event so that if it was running before the device is suspended, it will continue running once it is resumed. To acheieve that this series: 1. Creates device links between the notifer and subdevices in v4l2 async. This is to ensure that the Power Management .suspend() and .resume() operations happen in the right order. I think this is a universally applicable change so it's in core rather than the driver specific .bound() callbacks. 2. Updates the rkisp1 driver to cleanly stop stream across the pipe line on .suspend() and resume it (assuming it was running before the device was suspended) on .resume() 3. Updates the rkisp1 driver to store and re-apply the last of the params buffers on resume. There's also a change to videobuf2 core without which I found it more complicated to do the "was a stream running" check. There are also a number of commits that do some tidying and preparatory work to make the later commits cleaner.
这封 cover letter 的骨架极其工整,三段各管一件事——第一段 = 现状+目标。 开头 At the moment(眼下、目前)是「现状陈述」的标志性开场,紧跟一个长句 把 bug 描述完:从 rkisp1 跑的流,在设备挂起到 RAM 或磁盘后,恢复时已经死了。注意他 不堆术语,也不解释什么是 suspend-to-RAM——默认读者懂。第二句立刻切到目标: This series is an attempt to make the stream survive that event (本系列试图让这条流能撑过这个事件)。an attempt to 是 cover letter 的 高频套话,比 this series makes 谦逊,比 this series tries to 正式——「试图做成」不等于「已经做成」,给评审留了余地。 so that if it was running before ..., it will continue running once ... 是一个工整的条件结果句,把「修复成功的验收标准」也顺手写出来了。
第二段 = 三步计划。To achieve that this series: 一个冒号引出编号列表,三条动宾结构——Creates / Updates / Updates,每条开头动词对齐, 读者扫一眼就知道系列要动哪三处。第一条最关键:他不只报「做了什么」,还顺手交代 「为什么放在 core 而不是 driver」——I think this is a universally applicable change so it's in core rather than the driver specific .bound() callbacks。universally applicable(普遍适用)+ rather than(而不是)这组搭配是「设计决策辩护」的标准句式, 等于在 cover letter 里预演了一次评审问答。第三段 = 补遗, 用 There's also ... 引出两个收尾信息:一个对 videobuf2 core 的辅助改动, 一句「还有一些 tidying/preparatory commits」。There's also 出现两次 是作者的真实口语习惯,不算修辞错误,但正式写作里更稳的是 Additionally / Separately。顺带两处原文拼写 acheieve(应为 achieve)与 notifer(应为 notifier) 是作者的笔误——lore 上的邮件没人改,引用时保持原样,自己写时别学。
★ 阅读拆点 · 四个值得内化的信号词
Currently / At present / Right now。读到这词就知道后面在描述 bug 或缺失能力,不是问题诊断。 an attempt to 比 makes / fixes / implements 多一分克制——承认「路是我铺的,但能不能成要看评审」。这是内核 cover letter 里出现频率最高的目标句型之一,直接背下来可复用。 To achieve that 回扣上一段的目标,this series: 冒号引出编号列表。三步以内写完——多于三条读者就开始跳读。如果你的系列真有 10 步,应该合并同类项,不是把列表拉长。 I think 软化断言、universally applicable 把改动从「我这个驱动需要」升格到「大家都该用」、rather than 显式排除被否掉的替代方案。三件套一起用,等于在文字里完成了「为什么这么做」的辩护,不让评审追着问。 🔗 原文
✨ 辅助彩蛋(写作)
/ column★ 写作彩蛋 · 「问题→动作→原因」的复句模板
At present the rkisp1 driver makes no provision in its suspend and resume operations for a live stream. The effect of this is that if userspace is streaming images through the ISP and suspends to RAM, upon resuming the system that stream has died, but userspace has no visibility of that. // To resolve the problem check if a VB2 queue is streaming in runtime suspend and if so, tell connected subdevices to stop streaming and mark all buffers as returned to userspace. At present <driver> makes no provision in <X> for <Y>. The effect of this is that ..., but ... has no visibility of that. // To resolve the problem <verb phrase>.——「目前 X 在 Y 上没做任何准备;其影响是 A,但 B 看不到这一点。// 为解决这个问题,[做 Z]」。三句话讲完痛点、影响、方案,commit message 的开场黄金三句。 makes no provision for(未做任何准备/未做处理)比 doesn't handle 正式、比 lacks support for 准确——它强调的是「连预案都没有」,不只是「没实现」。写 bug fix 类 commit message 时直接套用,评审一眼就看出这是「缺失能力」而非「实现错了」。 🔗 原文
✍️ 今日练习
/ column💡 显示答案
Read the skeleton, not the words — every cover letter answers three questions: what's broken, what's the goal, what's the plan.
素材:lore.kernel.org linux-media · rkisp1 suspend/resume 系列 cover letter + 16/16 补丁(Daniel Scally,〔11-03 15:41 北京〕)· 内核英语 · 每日一篇