今日重点:📖 阅读——cover letter 里最难写的一类不是「我加了什么新东西」, 而是「我要替换一个还活着的老驱动」:评审会问「为什么不在原地上改」, 用户会问「我的程序还能跑吗」,发行版会问「切换那天会不会断」。高通 Ekansh Gupta 的 [PATCH v4 00/25] accel/qda: Qualcomm DSP Accelerator driver(替换 drivers/misc/fastrpc.c)把这三个问题全答了。精读它的说辞结构。
📖 阅读:开场两段,各管一件事
/ sectionThis series adds QDA, a DRM accel driver for the Hexagon DSPs on Qualcomm SoCs. It is meant to replace drivers/misc/fastrpc.c. It speaks the same FastRPC protocol to the same DSP firmware over the same RPMsg channel, and it binds the same device-tree nodes. It adds no new DT binding or compatible. Existing user space keeps working. The series also adds a separate module, qda_fastrpc_shim, which serves the full /dev/fastrpc-* ioctl interface on top of QDA. A distribution can therefore switch from CONFIG_QCOM_FASTRPC to CONFIG_DRM_ACCEL_QDA without breaking FastRPC users.
第一段 = 宣告 + 消除戒心。第二句 It is meant to replace drivers/misc/fastrpc.c 直接亮出「替代宣言」——be meant to 是「意图宣告」的标准句式,比 replaces(陈述事实,还没发生)诚实, 比 will replace(打包票)留有余地。紧接着是整封信最漂亮的一句: the same FastRPC protocol to the same DSP firmware over the same RPMsg channel——三个 the same 排比,把「换驱动」听起来像 「什么都没换」;再补一刀 It adds no new DT binding or compatible, 告诉设备树维护者「没你的事」。替代类 cover letter 的第一要务: 先消灭「变化感」,再谈变化。
第二段 = 安抚,用了一个单句段开场。Existing user space keeps working. 一句话独立成句、五个词——在正式技术写作里,单句段 是刻意为之的强调位,意思是「这条最重要,先看这条」。然后才引出 qda_fastrpc_shim(兼容层模块),并给出发行版视角的关键句:A distribution can therefore switch from CONFIG_QCOM_FASTRPC to CONFIG_DRM_ACCEL_QDA without breaking FastRPC users——注意 therefore(因此)把 shim 的 存在和「切换无感」接成因果链,落脚点是两个内核配置项,发行版维护者一看就懂 自己要做的事只是改一个 Kconfig。
📖 阅读:「Why a new driver」——先定罪,再引判决
/ columndrivers/misc/fastrpc.c predates the accel subsystem. As a miscdevice it implements its own buffer tracking, buffer sharing and per-process state, all of which DRM already provides as common, well-reviewed code. It keeps buffers in driver-private per-file lists. It accepts raw DMA-BUF fds, user pointers and inline data as invocation arguments. It keys state on the calling process. Each of these has needed driver-specific fixes over time, and none of the code is shared with any other driver. Converting fastrpc.c in place into an accel driver was discussed on v3. The conclusion was to build the core cleanly on accel, and to keep the historical interface in a separate shim module that can later be deprecated and dropped.
这一节是「为什么要新驱动」的辩护章,结构是先定罪、再引判决。 定罪从第一个词开始:predates the accel subsystem——一个 predate(早于……存在)把老驱动定位成「历史遗留」,不骂人但立场 已明。接着四个排比短句列罪状:buffer 管理自带一套、参数接受裸指针、状态 按进程键控——每条都是一行一个 It ...,节奏像起诉书。收尾句 Each of these has needed driver-specific fixes over time, and none of the code is shared 把「罪状」换算成「维护成本」:这才是评审真正关心 的论据——不是丑,是贵。
判决部分两句解决战斗。Converting fastrpc.c in place ... was discussed on v3. The conclusion was to ...——引用历史评审记录是 替代类 cover letter 的关键动作:它把「另起炉灶」从作者的个人主张变成 社区已有共识,后面再用被动语态 The conclusion was to 隐去主语,谁提的方案已经不重要,重要的是「这事讨论过、有结论」。 顺手注意一个写作惯例:本信的章节标题用 ==== 下划线(Why a new driver / Design overview / Changes in v4 / Testing),是纯文本邮件里的 「章节号」,读长 cover letter 时先扫这些下划线就能拿到目录。
★ 阅读拆点 · 四个值得内化的说法
be meant to do 表「意图/设计目标」,自带「还没做死、欢迎评审」的谦逊。替换/移除类系列的封面信几乎都能找到它或同义句 is intended to replace / aims to replace。读到它就知道:后面一定跟着「为什么老的该走」。 No user-space breakage is expected. X predates Y(X 早于 Y 而存在)是「这个东西出生在好时代之前」的礼貌说法,言下之意「它没见过后来的最佳实践」。比 is outdated / is a mess 体面得多,批评既有代码时的首选动词。 No flag day for users or distributions。flag day 源自 1983 年 ARPANET 切 NCP 到 TCP 的「一刀切日」,后来泛指「某天起旧东西全废」的硬切换。No flag day = 新旧并存、平滑迁移——读替代类方案时看到这个词,等于作者承诺「不会某天醒来发现不能用了」。 🔗 原文
✨ 辅助彩蛋(写作)
/ column★ 写作彩蛋 · 「退役路径」一句话模板 + 两个署名惯例
Proposed plan: merge QDA together with the shim, then remove drivers/misc/fastrpc.c, then deprecate the shim and eventually drop it once user space has moved to the accel interface. Proposed plan: merge <A>, then remove <B>, then deprecate <C> and eventually drop it once <condition>.——「合并 → 移除 → 弃用 → 最终删除」四段式,每个阶段一个 then,最后用 once + 完成时(once user space has moved)给出最终阶段的触发条件。任何「逐步退役旧实现」的方案都能套这条链。 Rewrite commit messages to explain why ... (Dmitry)、... (Krzysztof)。这是内核评审的记功惯例:哪条修改响应了哪位评审的意见,括号里写他的名字——既致谢,也让评审秒查「我上次的意见处理了吗」。 Parts of this patch were written with the help of an AI coding assistant (Claude, claude-sonnet-5) and reviewed by the author.——写明工具与模型、并强调「作者已人工评审」。这正是社区正在形成的 AI 辅助披露格式:披露 + 人工负责,两要素缺一不可。 🔗 原文
✍️ 今日练习
/ column💡 显示答案
Replacing a living driver is a sales job: kill the fear of change first, then argue cost, then show the exit path.
素材:lore.kernel.org linux-media · qda v4 cover letter(Ekansh Gupta,〔11-02 06:21 北京〕,原文经 lore git 协议逐字提取)· 内核英语 · 每日一篇