<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>b4 on GPUers</title><link>https://gpuers.cn/tags/b4/</link><description>Recent content in b4 on GPUers</description><image><title>GPUers</title><url>https://gpuers.cn/assets/img/og-cover.png</url><link>https://gpuers.cn/assets/img/og-cover.png</link></image><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Fri, 20 Nov 2026 00:00:00 +0800</lastBuildDate><atom:link href="https://gpuers.cn/tags/b4/index.xml" rel="self" type="application/rss+xml"/><item><title>内核邮件列表回复指南：b4 + neomutt</title><link>https://gpuers.cn/notes/9000-001/</link><pubDate>Fri, 20 Nov 2026 00:00:00 +0800</pubDate><guid>https://gpuers.cn/notes/9000-001/</guid><description>内核开发全部通过纯文本邮件协作：提交 patch、review、讨论都在邮件列表上进行。回复邮件需要遵守严格的格式规范：</description><content:encoded><![CDATA[<h2 id="1-背景">1. 背景</h2>
<p>内核开发全部通过<strong>纯文本邮件</strong>协作：提交 patch、review、讨论都在邮件列表上进行。回复邮件需要遵守严格的格式规范：</p>
<ul>
<li><strong>纯文本</strong>（不能用 HTML）</li>
<li><strong>Interleaved reply</strong>（在引用中间插入回复，不能 top-post）</li>
<li><strong>正确的 <code>In-Reply-To</code> / <code>References</code> 头</strong>（保证线程串联）</li>
<li><strong><code>&gt;</code> 引用格式</strong>（标记原文）</li>
<li><strong>正文行宽不超过 72 字符</strong></li>
</ul>
<p>Outlook 等商业邮件客户端不适合这个工作流——它们默认 HTML 格式、top-posting、不生成 <code>&gt;</code> 引用。本指南使用两个内核社区主流工具来完成回复。</p>
<h2 id="2-工具链">2. 工具链</h2>
<h3 id="21-b4--内核邮件工作流工具">2.1 b4 — 内核邮件工作流工具</h3>
<p><a href="https://b4.docs.kernel.org">b4</a> 是专为 Linux 内核开发设计的命令行工具。主要功能：</p>
<ul>
<li><strong><code>b4 mbox</code></strong>: 从 lore.kernel.org 下载完整邮件线程为本地 mbox 文件，包含所有回复和 review</li>
<li><strong><code>b4 am</code></strong>: 将 patch 系列下载为可直接 <code>git am</code> 应用的 mbox</li>
<li><strong><code>b4 send</code></strong>: 提交 patch 到邮件列表（替代 <code>git send-email</code>）</li>
<li><strong><code>b4 trailers</code></strong>: 收集邮件列表上的 Reviewed-by / Acked-by 标签</li>
</ul>
<p>在本指南中，我们用 <code>b4 mbox</code> 将 lore 上的 review 邮件下载到本地，然后交给 neomutt 处理。</p>
<h3 id="22-neomutt--终端邮件客户端">2.2 neomutt — 终端邮件客户端</h3>
<p><a href="https://neomutt.org">neomutt</a> 是经典 mutt 邮件客户端的现代分支，是内核开发者最常用的邮件工具之一（另一个是 Thunderbird）。它的优势：</p>
<ul>
<li><strong>原生纯文本</strong>：不会产生 HTML，天然符合内核邮件规范</li>
<li><strong>自动引用</strong>：回复时自动用 <code>&gt;</code> 引用原文，支持 interleaved reply</li>
<li><strong>自动设置邮件头</strong>：<code>In-Reply-To</code>、<code>References</code>、<code>Subject</code> 全部从原邮件自动提取</li>
<li><strong>Reply All（<code>g</code> 键）</strong>：自动将原邮件的所有 To/Cc 收件人填入，不会遗漏</li>
<li><strong>vim 集成</strong>：用 vim 编辑邮件，对内核开发者零学习成本</li>
<li><strong>轻量级</strong>：TUI 界面，SSH 远程也能用</li>
</ul>
<p>简单说：neomutt 做了所有你之前手动做的事情（构造 headers、加 <code>&gt;</code> 引用、填 In-Reply-To），而且是自动的。</p>
<h2 id="3-软件安装与配置">3. 软件安装与配置</h2>
<h3 id="31-b4-安装">3.1 b4 安装</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">pip3 install b4
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># 验证安装</span>
</span></span><span class="line"><span class="cl">b4 --version
</span></span></code></pre></div><h3 id="32-neomutt-安装与配置">3.2 neomutt 安装与配置</h3>
<p>neomutt 安装：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt install -y neomutt
</span></span></code></pre></div><p>neomutt 配置（一次性）：打开 ~/.neomuttrc，填入下面的内容：</p>
<pre tabindex="0"><code>set from = &#34;Your email&#34;
set realname = &#34;Your name&#34;
set smtp_url = &#34;smtp server:port&#34;
set smtp_authenticators = &#34;&#34;
set ssl_starttls = no
set ssl_force_tls = no
set editor = &#34;vim&#34;
set attribution = &#34;On %d, %n wrote:&#34;
set include = yes
set indent_string = &#34;&gt; &#34;
set edit_headers = yes
set text_flowed = no
set wrap = 72
set content_type = &#34;text/plain&#34;
set charset = &#34;utf-8&#34;
set send_charset = &#34;utf-8&#34;
alternative_order text/plain text/html
auto_view text/html
</code></pre><h2 id="4-回复流程">4. 回复流程</h2>
<h3 id="1-下载邮件线程">1. 下载邮件线程</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> /tmp
</span></span><span class="line"><span class="cl">b4 mbox &lt;message-id&gt;
</span></span></code></pre></div><p>示例：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">b4 mbox 6a2d7506-c474-4619-a3d5-e729468d68f4@google.com
</span></span></code></pre></div><p>输出：<code>./6a2d7506-c474-4619-a3d5-e729468d68f4@google.com.mbx</code></p>
<h3 id="2-用-neomutt-打开">2. 用 neomutt 打开</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">neomutt -f /tmp/&lt;message-id&gt;.mbx
</span></span></code></pre></div><p>看到邮件列表后，用方向键选中要回复的那封邮件。</p>
<h3 id="3-按-g-发起-group-reply">3. 按 <code>g</code> 发起 group reply</h3>
<ul>
<li>底部提示 <code>To: xxx</code> → 按 <strong>Enter</strong> 确认</li>
<li>提示 <code>Subject: Re: xxx</code> → 按 <strong>Enter</strong> 确认</li>
<li>自动打开 vim，邮件已带完整 <code>&gt;</code> 引用</li>
</ul>
<h3 id="4-在-vim-中编辑回复">4. 在 vim 中编辑回复</h3>
<p>vim 打开后，顶部是邮件 headers，下面是引用内容：</p>
<pre tabindex="0"><code>From: Your name &lt;Your email&gt;
To: somebody &lt;***@***.com&gt;
Cc: ...
Subject: Re: [PATCH v1 2/5] ...

On Mon, 11 Apr 2025, somebody wrote:
&gt; On 2026-04-27 06:05, your name wrote:
&gt; &gt; +	function_name(a,b, ...
&gt;
&gt; How do you ensure that the parameter a and ...
&gt; ...without warning.

（在这里写你的回复）

&gt; &gt; +	while(a) {
...
</code></pre><p><strong>编辑要点：</strong></p>
<table>
	<thead>
			<tr>
					<th>操作</th>
					<th>说明</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td>删掉不需要的引用</td>
					<td>可选，很多人不删</td>
			</tr>
			<tr>
					<td>删掉 somebody 签名 (<code>&gt; Regards, &gt; somebody</code>)</td>
					<td>可选</td>
			</tr>
			<tr>
					<td>在问题后面插入回复</td>
					<td><strong>必须</strong>，这是 interleaved reply</td>
			</tr>
			<tr>
					<td>回复正文控制在 72 字符以内</td>
					<td><strong>必须</strong></td>
			</tr>
			<tr>
					<td>引用的代码行不要折行</td>
					<td>保持原样</td>
			</tr>
	</tbody>
</table>
<p><strong>修改 Cc 列表：</strong></p>
<p>在 vim 的 header 区域直接编辑 <code>Cc:</code> 行，添加或删除收件人：</p>
<pre tabindex="0"><code>Cc: a@amd.com, b@google.com,
	   ..., dri-devel@lists.freedesktop.org
</code></pre><p>编辑完成后 <code>:wq</code> 保存退出。</p>
<h3 id="5-发送前检查--测试发送">5. 发送前检查 / 测试发送</h3>
<p>回到 neomutt 发送界面，可用的按键：</p>
<table>
	<thead>
			<tr>
					<th>按键</th>
					<th>功能</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><code>e</code></td>
					<td>重新编辑邮件（再次打开 vim）</td>
			</tr>
			<tr>
					<td><code>t</code></td>
					<td>修改 To 地址</td>
			</tr>
			<tr>
					<td><code>c</code></td>
					<td>修改 Cc 地址</td>
			</tr>
			<tr>
					<td><code>y</code></td>
					<td><strong>发送</strong></td>
			</tr>
			<tr>
					<td><code>q</code></td>
					<td>取消不发送</td>
			</tr>
	</tbody>
</table>
<p>可以在正式发送前先发送给自己进行测试。</p>
<p><strong>测试发送：</strong> 按 <code>e</code> 进入 vim，把 To 改成自己 <code>your email</code>，删掉 Cc，<code>:wq</code> 后按 <code>y</code> 发送。检查邮箱确认格式无误。</p>
<h3 id="6-正式发送">6. 正式发送</h3>
<p>测试没问题后，重新 <code>neomutt -f xxx.mbx</code>，按 <code>g</code> → 编辑回复 → 确认 To/Cc 正确 → 按 <code>y</code> 发送。</p>
<h2 id="快速参考">快速参考</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># 完整流程（3 条命令）</span>
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> /tmp
</span></span><span class="line"><span class="cl">b4 mbox &lt;message-id&gt;
</span></span><span class="line"><span class="cl">neomutt -f /tmp/&lt;message-id&gt;.mbx
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># neomutt 内操作</span>
</span></span><span class="line"><span class="cl"><span class="c1"># ↑↓ 选邮件 → g (group reply) → Enter → Enter → vim 编辑 → :wq → y 发送</span>
</span></span></code></pre></div><h2 id="7-阅读内核邮件的技巧">7. 阅读内核邮件的技巧</h2>
<h3 id="71-理解引用层级-的含义">7.1 理解引用层级（<code>&gt;</code> 的含义）</h3>
<p>内核邮件使用 <code>&gt;</code> 符号表示引用，每多一层 <code>&gt;</code> 代表对话往前追溯一轮。阅读时从 <code>&gt;</code> 最多的（最早的）读到最少的（最新的）：</p>
<pre tabindex="0"><code>&gt; &gt; &gt; 这是第一个人说的话（最早，3 层引用）
&gt; &gt;
&gt; &gt; 这是第二个人的回复（中间，2 层引用）
&gt;
&gt; 这是第三个人的回复（较新，1 层引用）

这是当前邮件作者的回复（最新，无引用）
</code></pre><p><strong>实际示例：</strong> 一封 4 人参与的 review 邮件</p>
<pre tabindex="0"><code>&gt; &gt; &gt; +static int
&gt; &gt; &gt; +do_something(struct device *dev, unsigned long count,
&gt; &gt; &gt; +             unsigned long *result)
&gt; &gt; &gt; +{
&gt; &gt; &gt; +    ret = lock_resource(dev, false);
&gt; &gt;
&gt; &gt; How do you ensure that the resource stays valid here?
&gt;
&gt; Good question. I think we need a refcount or fence here.

I agree. The resource must be pinned or have a callback
to handle invalidation before it gets reclaimed.
</code></pre><p>解读：</p>
<ul>
<li><code>&gt; &gt; &gt;</code> — 原始 patch 作者提交的代码（第 1 人）</li>
<li><code>&gt; &gt;</code> — reviewer 在代码处提出问题（第 2 人）</li>
<li><code>&gt;</code> — 另一位开发者跟帖评论（第 3 人）</li>
<li>无 <code>&gt;</code> — 当前邮件作者的回复（第 4 人，也就是你正在读的这封邮件的作者）</li>
</ul>
<h3 id="72-引用层级速查表">7.2 引用层级速查表</h3>
<table>
	<thead>
			<tr>
					<th>引用层级</th>
					<th>含义</th>
					<th>时间</th>
			</tr>
	</thead>
	<tbody>
			<tr>
					<td><code>&gt; &gt; &gt; &gt;</code></td>
					<td>最早的内容（4 轮前）</td>
					<td>最旧</td>
			</tr>
			<tr>
					<td><code>&gt; &gt; &gt;</code></td>
					<td>3 轮前的内容</td>
					<td>↑</td>
			</tr>
			<tr>
					<td><code>&gt; &gt;</code></td>
					<td>2 轮前的内容</td>
					<td>↑</td>
			</tr>
			<tr>
					<td><code>&gt;</code></td>
					<td>上一封邮件的内容</td>
					<td>↓</td>
			</tr>
			<tr>
					<td>无引用</td>
					<td>当前邮件作者写的</td>
					<td>最新</td>
			</tr>
	</tbody>
</table>
<h3 id="73-阅读长邮件的技巧">7.3 阅读长邮件的技巧</h3>
<p><strong>1. 先看无引用的部分</strong></p>
<p>跳过所有 <code>&gt;</code> 开头的行，只看没有 <code>&gt;</code> 的段落——这些是当前作者的观点和结论，是这封邮件的核心内容。</p>
<p><strong>2. 向上追溯上下文</strong></p>
<p>如果不理解某段回复，看它紧上方的 <code>&gt;</code> 引用——那是它在回应的内容。再不理解就看 <code>&gt; &gt;</code>，逐层向上追溯。</p>
<p><strong>3. 识别 interleaved reply 的结构</strong></p>
<p>内核邮件不是&quot;一段引用 + 一段回复&quot;，而是交替出现的：</p>
<pre tabindex="0"><code>&gt; 引用问题 1
回复问题 1

&gt; 引用问题 2
回复问题 2

&gt; &gt; 引用的代码片段
&gt; reviewer 对这段代码的评论
我对 reviewer 评论的回应
</code></pre><p>每个 &ldquo;引用 → 回复&rdquo; 对都是一个独立的讨论点，可以分开理解。</p>
<p><strong>4. 在 lore.kernel.org 上阅读</strong></p>
<p>lore 提供了更好的阅读体验：</p>
<ul>
<li>线程视图：清晰展示邮件之间的回复关系</li>
<li>高亮：不同引用层级有颜色区分</li>
<li>URL 格式：<code>https://lore.kernel.org/all/&lt;message-id&gt;/</code></li>
</ul>
<p><strong>5. 用 b4 在本地阅读</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># 下载整个线程</span>
</span></span><span class="line"><span class="cl">b4 mbox &lt;message-id&gt;
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># 用 neomutt 打开，线程视图阅读</span>
</span></span><span class="line"><span class="cl">neomutt -f /tmp/&lt;message-id&gt;.mbx
</span></span></code></pre></div><p>neomutt 中按 <code>t</code> 可以切换线程视图，清晰看到邮件的层级关系。</p>
]]></content:encoded></item></channel></rss>