The Pragmatic Engineer - Greg Kroah-Hartman 谈 Linux 的构建 封面

Greg Kroah-Hartman 谈 Linux 的构建

How Linux is built with Greg Kroah-Hartman

本集简介

由我们的合作伙伴支持 • WorkOS —— 面向 B2B SaaS 的现代身份平台。 • Vanta —— 使用 Vanta 自动化合规流程并简化安全工作。 — Linux 是全球最广泛使用的操作系统,但它究竟是如何构建的?很少有人比 Greg Kroah-Hartman 更适合回答这个问题:他担任 Linux 内核维护者已有 25 年,是 Linux 内核基金会三位院士之一(另外两位是 Linus Torvalds 和 Shuah Khan)。Greg 负责管理 Linux 内核的稳定版本发布,并维护多个内核子系统。 我们深入探讨 Linux 内核开发的内部运作机制,从变更如何实施到其社区驱动的方法为何能产出如此可靠的软件,无所不包。Greg 分享了关于内核独特信任模型的见解,并阐述了工程师为何应该为开源项目做出贡献。本期节目内容包括: • Linux 的应用有多广泛? • Linux 内核负责什么——以及为何它被视为一个单体? • 内核变更如何合并?全程解析 • Linux 内核的九周开发周期 • Linux 内核测试 • Linux 为何如此普及? • 参与开源的职业收益 • 更多内容! — 时间戳 (00:00) 简介 (02:23) Linux 的应用有多广泛? (06:00) 不同 Linux 设备的复杂性差异 (09:20) 什么是 Linux 内核? (14:00) 为什么信任在 Linux 内核开发中如此重要 (16:02) 内核变更的 walkthrough(逐步解析) (23:20) Linux 内核开发周期的运作方式 (29:55) Kernel CI 的内核测试流程 (31:55) 开源开发流程的优势论证 (35:44) Linux 内核分支:稳定版与开发版 (38:32) 维护旧版 Linux 代码的挑战 (40:30) Linux 如何处理漏洞修复 (44:40) Linux 内核工程师的工作范围 (48:33) Greg 的代码审查流程及其与 Uber RFC 流程的相似之处 (51:48) IBM 等公司内部使用的 Linux 内核 (53:52) Linux 为何如此普及 (56:50) Linux 内核学院如何在没有产品经理的情况下运营 (1:02:01) 在 Linux 内核中使用 Rust 的优缺点 (1:09:55) LLM(大语言模型)如何用于 Linux 中的漏洞修复和编码 (1:12:13) 为 Linux 内核或任何开源项目贡献的价值 (1:16:40) 快问快答环节 — 本期相关的《Pragmatic Engineer》深度文章: TPM 的职责以及软件工程师能从中汲取的经验 现代后端实践的过去与未来 Backstage:一个开源开发者门户 — 请在以下链接查看本节目的文稿和其他参考资料:⁠⁠https://newsletter.pragmaticengineer.com/podcast⁠⁠ — 制作与营销由 https://penname.co/ 负责。如需咨询播客赞助事宜,请发送邮件至 podcast@pragmaticengineer.com。 在 newsletter.pragmaticengineer.com/subscribe 获取 The Pragmatic Engineer 的完整访问权限

双语字幕

仅展示文本字幕,不包含中文音频;想边听边看,请使用 Bayt 播客 App。

Speaker 0

每九周会发布一次新版本。

There's a nine week release.

Speaker 0

因为每九周就会推出一个新版本。

Because every nine weeks, there's a new release going out.

Speaker 0

对吧?

Right?

Speaker 1

所以是林纳斯负责发布。

So there's Linus does a release.

Speaker 1

就是一个时间节点。

Just point in time.

Speaker 1

然后合并窗口就打开了。

And then merge window is considered open.

Speaker 1

接下来的两周,所有维护者都会把上个版本以来积压的代码全部提交给林纳斯。

And then for two weeks, all the maintainers send Linus all the stuff they've had pending from the last release.

Speaker 1

我们有两周时间添加新功能,之后他就发布第一个候选版本。

We have two weeks to add all new features, and then he does release candidate one.

Speaker 1

从那以后,接下来的七周就只修bug了。

From there on, it's bug fixes only for the next seven weeks.

Speaker 1

对。

Mhmm.

Speaker 1

就只修bug,修bug,全是修bug。

So it's bug fixes only, bug fixes only, bug fixes.

Speaker 0

主要是修复回归问题。

It's regression fixes.

Speaker 0

有问题的代码我们会直接回滚。

We'll revert things.

Speaker 0

绝对不加新功能。

No new features.

Speaker 0

我理解得对吗?Linux是不是每九周就发一个版本?

Do I understand correctly that in the case of Linux, is this a thing where every nine weeks there will be a release?

Speaker 0

这是按时间来的。

It's time based.

Speaker 0

所以我们

So we

Speaker 1

在这之前有两周时间,把所有已经进入我们仓库、被认可并验证稳定的新增功能合并到林纳斯那边。

have that two week window of merging all the new features to Linus that have been in our tree and accepted already and proven to work.

Speaker 1

这个窗口期很短,只有九周。

And the window is short, nine weeks.

Speaker 1

以前我们开发周期长达三年。

We used to have three year long development cycles.

Speaker 1

周期。

Cycles.

Speaker 1

问题是,哪怕你有六个月的开发周期,也会担心:有个功能不错,但还没完全准备好。

And the problem there is even if you have six month development cycles, there's that fear of you have a feature.

Speaker 1

我想用你的功能,可它还没到位。

I wanna take your feature, but it's not quite ready.

Speaker 1

我该不该等呢?

Do I wanna wait?

Speaker 1

还有类似这样的情况。

And things like that.

Speaker 1

但如果你知道,九周后就能把你的功能合并进去,而它现在还没准备好,那就别急,真的别急。

But if you know that you can get your feature in in nine weeks from now and it's just not ready, it's not ready.

Speaker 1

作为维护者,我不用赶着把你的新功能塞进来,等它准备好了再说。

The pressure's off me as a maintainer to take your new feature until it's ready.

Speaker 0

Linux 是全球使用最广泛的操作系统,因为它支撑了绝大多数安卓设备、服务器、智能电视和嵌入式系统。

Linux is the world's most widely used operating system, thanks to powering most Android devices, servers, smart TVs, and embedded systems.

Speaker 0

但它是怎么被构建出来的呢?

But how is it actually built?

Speaker 0

今天我们请到了格雷格·克罗哈-哈特曼,他当了十三年的 Linux 内核维护者,也是 Linux 基金会三位院士之一。

Today we sat down with Greg Kroah-Hartman, a Linux Kernel maintainer for thirteen years, who is one of the three Linux Foundation fellows.

Speaker 0

今天的对话我们会聊到:Linux 到底有多普及,为什么手机端的 Linux 代码量是服务器端的三倍;到底要满足什么条件,你的修改才能被 Linus Torvalds 本人接受并合并;Linux 怎么做到每年有四千名贡献者,却没有任何产品经理或项目经理;还有更多细节。

In today's conversation we cover: Details on how widespread Linux is and why mobile versions of Linux have three times the lines of code as the server versions What exactly it takes to get a change accepted to the Linux Kernel and merged by Linus Torvalds himself How Linux manages to have 4,000 contributors per year yet have no product managers or project managers, and many more details.

Speaker 0

如果你是软件工程师,你一定会直接或间接用到 Linux,这期节目会帮你理解,为什么它这么普及,以及为什么参与贡献其实比大多数人想的要简单得多。

If you're a software engineer, you will use Linux directly or indirectly, and this episode will help you understand why it's so widespread and how it's a lot easier contribute than most people would assume.

Speaker 0

如果你喜欢这个节目,记得在任何播客平台或者YouTube上订阅我们。

If you enjoy the show, please subscribe to the podcast on any podcast platform and on YouTube.

Speaker 0

谢谢。

Thank you.

Speaker 0

Greg,真的很高兴你能来,你是最知名、资历最老的Linux贡献者之一。

So Greg, it's really just nice to to have you here because you're one of the most well known Linux contributors, one of the longest standing ones as well.

Speaker 0

欢迎来到我们的播客。

So just welcome to the podcast.

Speaker 1

谢谢你们邀请我。

Thanks, thanks for having me.

Speaker 0

作为软件工程师,我们都明白Linux很重要,毕竟我们用的大部分网页服务器都跑在Linux上。

I think as software engineers, we know Linux is important in the sense of it's running on most web servers that we use and run.

Speaker 0

它也是有些人用的桌面系统。

It's a desktop OS that some people use.

Speaker 0

当然,Android就是基于Linux的一个分支。

And it's, of course, you know, powering, a fork of it is powering Android.

Speaker 0

但Linux到底有什么好了解的呢?

But what is there to know about Linux?

Speaker 0

这东西有多大啊?

How big is this thing?

Speaker 0

它有多复杂?

How complex is this thing?

Speaker 1

嗯,确实如此。

Well, it's yeah.

Speaker 1

它是个操作系统,本质上是个内核。

We took it's an operating system, so it's a Kernel.

Speaker 1

我们悄无声息地占领了整个世界。

We took over the world without anybody noticing.

Speaker 1

我常开玩笑说,全球有四十亿台安卓设备在跑Linux,可用户根本不知道。

I joke it's, Android devices are 4,000,000,000 Android Linux users out there or and they don't realize it.

Speaker 1

其他所有加起来都微不足道,不过这话可让服务器圈的人不高兴了。

That's everything else is a rounding error, which doesn't make the server people happy with me.

Speaker 1

但这是真的。

But it's true.

Speaker 1

它无处不在。

It's in everything.

Speaker 1

所有嵌入式设备里都有它。

We it's in all the embedded devices.

Speaker 1

空调、电动汽车充电桩、卫星,连国际空间站都在用它。

It's in the air conditioning units, car electric charging ports, satellites, runs international space station.

Speaker 1

真的吗?

Really?

Speaker 1

对啊。

Yeah.

Speaker 1

没错。

Yeah.

Speaker 1

欧洲的空中交通管制系统,还有美国的,大概也是。

Air traffic control for Europe and probably The US.

Speaker 1

所有金融市场都是,我觉得我们用的摄像头倒不一定有。

All the financial markets, I don't think it's in the cameras that we're using.

Speaker 1

所以,确实是这样。

So, it's yeah.

Speaker 1

我实在想不出还有哪儿没被它占领。

I don't know of any place that hasn't taken over.

Speaker 1

过去十五年、十年,卖得最好的五款笔记本,全是Chromebook。

The number the top five selling laptops for the past fifteen, ten, fifteen years, Chromebooks.

Speaker 1

这些全都是基于Linux的。

Those are all Linux based.

Speaker 1

不是苹果,是Chromebook。

Not Apple, but Chromebooks are.

Speaker 1

对。

Yeah.

Speaker 1

哦,还有iPhone。

Oh, iPhones.

Speaker 1

现在市面上所有的5G调制解调器,跑的都是Linux系统。

So every five g modem out there is running a copy of Linux.

Speaker 0

真的吗?

Really?

Speaker 0

对啊。

Yeah.

Speaker 0

哇塞。

Wow.

Speaker 1

现在我在帮苹果做他们的新芯片。

So now with Apple, I'm doing their new chip.

Speaker 1

我不确定是不是全新的,但高通的5G调制解调器,还有4G的,应该都是这样。

I don't know if it's a new one, but Qualcomm, all the five g modems probably the four g.

Speaker 1

我不太确定。

I'm not sure.

Speaker 1

但我敢肯定,所有5G调制解调器里面都装着Linux。

But I know all the five g modems have Linux inside it.

Speaker 0

本期节目由 WorkOS 赞助。

This episode is brought to you by WorkOS.

Speaker 0

如果你在开发 SaaS 应用,迟早你的客户会要求添加企业级功能,比如 SAML 认证、SCIM 配置和细粒度权限控制。

If you're building a SaaS app, at some point your customers will start asking for enterprise features like SAM authentication, SCIM provisioning, and fine grained authorization.

Speaker 0

这时候 WorkOS 就派上用场了,它能让你快速、轻松地把这些企业功能集成到你的应用里。

That's where WorkOS comes in, making it fast and painless to add enterprise features to your app.

Speaker 0

他们的 API 设计得很直观,你很快就能上线,然后继续专注开发其他功能。

Their APIs are easy to understand and you can ship quickly and get back to building other features.

Speaker 0

WorkOS 还提供一个免费的用户管理方案叫 Authkit,最多支持一百万月活跃用户。

WorkOS also provides a free user management solution called Authkit for up to 1,000,000 monthly active users.

Speaker 0

它可以无缝替代 Auth0,自带一堆实用功能,比如域名验证、基于角色的访问控制、防机器人和多因素认证。

It's a drop in replacement for Auth0 and comes standard with useful features like domain verification, role based access control, bot protection and MFA.

Speaker 0

它基于 Radix 组件构建,设计上完全不妥协,原生就很好看。

It's powered by Radix components, which means zero compromises in design.

Speaker 0

你既能自由定制,也能直接用现成的模块化模板,集成起来特别快。

You get Linus customizations as well as modular templates designed for quick integrations.

Speaker 0

现在,成百上千家快速增长的初创公司都在用WorkOS,其中一些你肯定听说过,比如Cursor、Vercel和Perplexity。

Today, hundreds of fast growing startups are powered by WorkOS, including ones you probably know, like Cursor, Vercel, and Perplexity.

Speaker 0

想去了解更多信息?去workos.com看看吧。

Check it out at workos.com to learn more.

Speaker 0

就是workos.com。

That is workos.com.

Speaker 0

说真的,我刚在想,为啥我以前从来没这么想过呢?在我印象里,Debbie戴红帽子,那不就是服务器端的事儿吗?

Well, first of all, I'm just reflecting on why I never kind of, you know, like thought about it like this because in my mind it was always like, you know, Debbie on the red hat, it's on a server side.

Speaker 0

可能是因为,我平时看到的确实就是在那儿。

And maybe that's because that's where I actually see where it is.

Speaker 0

当然啦,我现在用的是Mac,系统底下的Unix影响无处不在,这确实是个重要因素。

Now, of course, you know, there's the I'm a right now, I'm a Mac user and there's the the Unix influence, which which is an influence.

Speaker 0

说起来,其实已经挺接近了。

You know, it gets pretty close.

Speaker 0

我觉得现在真该好好想想,它到底支撑了多少东西在跑。

I think it's a time to reflect on how many things it actually runs.

Speaker 0

那内核本身有多大呢?

In terms of the kernel itself, like how large is it?

Speaker 0

我知道不同设备用的内核部分不一样,比如服务器上的 Linux 和安卓设备,用的模块都不一样。

And I know, you know, for different devices, it'll be spread differently for a server side Linux, for an Android device, It'll use different parts of the kernel.

Speaker 0

那参与贡献的人数和代码行数大概有多少?

How about how big is this in terms of contributors, lines of code?

Speaker 0

我知道代码行数这指标不完美,但至少能参考一下。

I know lines of code is not a great measure, but is a measure.

Speaker 1

代码这事儿挺有意思的。

Code is interesting.

Speaker 1

目前内核代码量差不多有四千万行。

So we have just under 40,000,000 lines of code right now.

Speaker 1

这数量可真不小。

That's a lot.

Speaker 1

这全是内核的代码,就光是内核。

That's all the Kernel that's a Kernel.

Speaker 1

核心部分其实就占了大概5%,所有人都在用。

The core part is, like, 5% of that that everybody runs.

Speaker 1

剩下的全是硬件支持的东西。

And then everybody the rest of it is hardware support.

Speaker 1

各种驱动、设备、架构、芯片,都不一样。

Different drivers, different devices, different architectures, different chips.

Speaker 1

你的笔记本电脑大概跑着两百到两百五十万行代码。

So your laptop runs about two, two and a half million lines of code.

Speaker 1

你的服务器大概只跑一百五十万行左右。

Your server runs about one and a half million.

Speaker 1

服务器其实特别简单。

Servers are really easy.

Speaker 1

那些机器结构非常单一。

Those are very simple machines.

Speaker 1

你的手机倒是差不多要跑四百万行代码。

Your phone runs about 4,000,000.

Speaker 1

你的手机芯片是目前最复杂的CPU和交互系统了。

Your phone SoCs are the most complex pieces of CPU and interaction out there.

Speaker 1

这些芯片简直复杂到离谱。

They're just crazy complex chips.

Speaker 0

等等,咱们能先停一下吗?

Why why is like, can we just pause for a second?

Speaker 0

我知道代码行数不是衡量复杂度的完美标准,但拿同一个代码库来对比的话,还是能说明点问题的。

So so, like, again, lines of code we know is not a perfect measure of complexity, but but in in this sense, comparing it between the two of them with the same code base is somewhat.

Speaker 0

你刚才说,服务器大概是一百五十万行代码,对吧?

So you said roughly, give or take, a server is one and a half million.

Speaker 0

手机是四百万行。

A phone is 4,000,000.

Speaker 0

手机的代码量几乎是服务器的三倍。

Like, three times the lines of code for a phone.

Speaker 0

这中间的差距到底在哪?

Why the difference?

Speaker 0

我本来还以为服务器干的都是关键任务,应该更复杂才对。

Even though I I would I would think that the server, you know, does all this mission critical stuff.

Speaker 1

服务器其实很简单。

A server is really simple.

Speaker 1

就一个CPU,加个网卡,再加点存储,完了。

It's CPU and a network card and storage and storage.

Speaker 1

就这些。

That's it.

Speaker 1

手机的SoC可不一样,得管电源控制。

SOC on a phone has you have power control.

Speaker 1

还得管时钟。

You have clocks.

Speaker 1

上面有五条不同的总线,各自连着不同的设备。

You have five different buses on there talking to different types of devices.

Speaker 1

还得管电池。

You have battery control.

Speaker 1

你还得跟调制解调器通信呢。

You have talking to your modem.

Speaker 1

调制解调器里头还跑着另一套Linux系统。

Have another version of Linux in the modem.

Speaker 1

后面还带着USB接口。

You got USB out the back.

Speaker 1

还有USB直通,连着音频部分。

You got USB bypass to talk to the audio side.

Speaker 1

你得有音频驱动。

You have audio drivers.

Speaker 1

里头各种时钟、PHY,乱七八糟的东西一大堆。

You have a zillion different clocks and PHYs and all sorts of stuff in there.

Speaker 1

SoC是个八核的机器。

The SS and it's a eight core machine.

Speaker 1

有八个处理器,别的啥都没有。

It's there's eight processors and nothing.

Speaker 1

这些都不是小事儿。

Those are not trivial things.

Speaker 1

而且这些处理器的大小还不一样。

And sometimes those processors are different sizes.

Speaker 1

所以有大核和小核之分,搞这些主要是为了控制和省电,但它们跑的都是同一个 Linux 内核。

So you have big and little sizes, which add the complexity just for some control, for some power management, but they all run the same core of the Linux.

Speaker 1

真正麻烦的是驱动和各种硬件设备这些东西。

But it's the drivers and the devices, things like that.

Speaker 1

就拿你的 Pixel 手机来说。

So your Pixel phone.

Speaker 1

我看看 Pixel 手机。

I I look at Pixel phone.

Speaker 1

谷歌给所有安卓设备都提供一个通用内核,不针对特定硬件,就只是 ARM64 的。

Google ships a core kernel that all Android devices pick, not hardware specific, just ARM 64.

Speaker 1

Pixel 手机还得额外加三百多个驱动,才能让机器正常工作。

Pixel has 300 other drivers they add to get the Pixel phone working.

Speaker 1

我的意思是,这些组件有些小得惊人。

I mean, some of these are tiny.

Speaker 1

这个是给那个 tiny 芯片用的。

This is for this tiny chip.

Speaker 1

这个也是那个 tiny 芯片的。

This is this tiny chip.

Speaker 1

但你的手机,从软件角度来说,其实是目前最复杂的玩意儿之一。

But your phone is is really one of the most complex beasts out there for software.

Speaker 0

这么说吧,复杂度和代码量,多多少少跟硬件能力和配置有关,而不是看它是不是关键任务系统。

Is it safe to say that, you know, the complexity and, you know, the lines of code will, to some extent, scale, what that has to do with the hardware, the capabilities, you know, not about, you know, like how mission critical.

Speaker 0

毕竟手机系统要稳,服务器要稳,我的电视也得稳。

Because of course, the phone OS needs to be stable, the server needs to be stable, my TV needs to be stable.

Speaker 0

所以这些基本都是默认要求,对吧?

So, you know, that's just kind of a given, right?

Speaker 1

是的。

Yeah.

Speaker 1

哦,过去十五年所有的电视都在运行

Oh, and all TVs for the past fifteen years are all running

Speaker 0

所以我的三星电视也在用Linux?

So that's Oh, so my Samsung TV is running Linux?

Speaker 1

是的。

Yeah.

Speaker 1

对啊。

Oh, yeah.

Speaker 1

三星。

Samsung.

Speaker 1

我的三星洗衣机和烘干机也在跑Linux。

My your Samsung my Samsung washer and dryer are running Linux.

Speaker 1

你的三星手表也在用Linux。

So your Samsung watch is running Linux.

Speaker 1

所以三星有自己的Linux发行版,没错。

So Samsung has their own, yeah, distro.

Speaker 1

所有东西用起来都特别顺手。

All works really nice.

Speaker 1

这全靠硬件本身的复杂性。

It's all due down to the complexity of the hardware.

Speaker 1

内核负责控制硬件。

So the Kernel controls the hardware.

Speaker 1

Linux 的作用就是让所有程序觉得硬件都一模一样。

The job of Linux is to make all the hardware look agnostic to programs.

Speaker 1

你写一个用户程序,不管换什么硬件,都能直接跑,一点问题没有。

So you can write the same user space program and run it on the same on different hardware, and it does it just works.

Speaker 1

内核的任务就是用统一的方式管理内存和设备,然后把这些提供给用户程序。

A a kernel's job is to manage memory and devices in a common way and provide that to user space.

Speaker 1

我们开玩笑说内核空间就是个测试负载,其实不是这么回事。

It's not a we joke from the kernel, like, space is just a test load.

Speaker 1

但说到底,它就是个帮你解决问题的工具。

But, I mean, it's a tool there for you to actually solve your problems.

Speaker 1

所以当你在运行服务器时,你得处理消息、网络和存储这些事儿。

So when you're running servers, you're wanting to put message through and network and storage and stuff.

Speaker 1

这些就是你的负载。

That's that's your load.

Speaker 1

它们的存在就是为了干这个。

And that's what they're there.

Speaker 1

对于手机来说,你得控制屏幕显示。

For a phone, you wanna control the display.

Speaker 1

你得跟调制解调器通信。

You wanna talk out the modem.

Speaker 1

你得跟各种设备打交道。

You wanna talk on the thing.

Speaker 1

你得听音频。

You wanna listen to audio.

Speaker 1

对。

Yep.

Speaker 1

那边有好多不同的东西。

Lots of different things there.

Speaker 0

我想再回过头聊聊内核,因为说实话,我不是Linux开发者。

And I'm just wanna touch back on on the Kernel because, like, I I I'm not a Linux developer.

Speaker 0

我知道内核这东西,听说过,但不算特别了解。

Like, I I know, you know, I've I've heard of the Kernel.

Speaker 0

我理解它就是那些核心部分,就像你说的,一开机就跑起来,然后用户空间都搭在它上面。

I In my assumption, it is the critical parts, as you said, the, you know, the thing that runs immediately and then it will, you know, the user space will run on top of it.

Speaker 0

那到底什么才是关键区别呢?

But what is the differentiator?

Speaker 0

到底什么才算得上是内核?

What makes a Kernel?

Speaker 0

你说它只占所有这些东西的5%左右。

And you said it's about 5% of all of these things.

Speaker 0

那你是怎么划分这个界限的?

How do you split this?

Speaker 0

或者说,有没有一个明确的定义,比如你是个内核开发者?

Or like, is there a definition of, again, you're a Kernel developer.

Speaker 0

我想搞清楚,如果我想给 Linux 做贡献,想真正理解它,那我该怎么去认识这个内核到底是什么?

So I'm trying to get a sense, how can, like, someone who I'm, you know, let's say I'd like to contribute to Linux and understand how it is, eventually I'm gonna out what what what this kernel is.

Speaker 0

但内核到底是什么东西?

But what is it?

Speaker 0

到底什么才算内核,什么不算内核?

What what makes Kernel and and non Kernel?

Speaker 1

内核和用户空间的区别。

So Kernel versus user space.

Speaker 1

对,没错。

So Yep.

Speaker 1

芯片有保护模式和非保护模式,简单来说是这样。

There's an idea chips have a protected mode and a not protected mode Yep.

Speaker 1

这只是个非常简化的说法。

In a very simplified way.

Speaker 1

保护级别有好几种。

There's different levels protection.

Speaker 1

保护模式就是操作系统和内核运行的地方。

So the protected mode is where the operating system runs, the Kernel.

Speaker 1

对。

Yep.

Speaker 1

所有资源都在这儿共享。

And that is where we share all the resources.

Speaker 1

用的是同一块连续的地址空间。

It's one flat address space.

Speaker 1

明白了。

Got it.

Speaker 1

进程之间并没有隔离。

And we are not isolating processes.

Speaker 1

明白了。

Got it.

Speaker 1

所以用户空间的进程跑在上面,系统把它们隔离开,每个进程都觉得自己独占整台机器,其实并没有。

So a user space process then runs on top of that and we isolate them and they they all individually think they have the whole machine, but they don't.

Speaker 1

是的。

Yep.

Speaker 1

这就是多任务处理。

So it's multitasking.

Speaker 1

你可以同时运行多个程序。

You can run multiple programs at the same time.

Speaker 1

内核负责统一提供内存、存储访问、网络访问,还有各种管道,让用户空间能顺畅地跟网络栈交互。

And the kernel is there to give you memory, to give access to storage, to give access in a common way, to give access to a network in a common way, to give or provide the pipes to go around the network stack in the user space.

Speaker 1

有些人不喜欢用 Linux 的网络栈。

Some people don't like using Linux as network stack.

Speaker 1

他们用自己搞的。

They have their own.

Speaker 1

让所有不同的鼠标设备都能以统一的方式在用户空间显示出来。

To provide a way for all your different mice to show up to user space in the common way.

Speaker 1

我们了解所有不同的鼠标设备。

We know all the different mice.

Speaker 1

USB存储设备、显卡控制器这些我们都懂。

USB to storage devices, your graphics controller.

Speaker 1

我们提供一种通用的方式,让用户空间能跟内核通信,这样他们的程序就能正常运行,因为所有显卡都用同样的接口。

We provide a way to make it so that user space can talk to the Kernel in an agnostic way and it'll their stuff will just work because it all the graphics work at the same interface.

Speaker 1

键盘之类的设备,我们也是用统一的方式处理。

We talk to keyboards all the same way, things like that.

Speaker 1

所以这其实是在硬件之上加了一层抽象层,统一了接口。

So it's a commonality of providing a a shim layer above the hardware.

Speaker 0

那比如驱动程序呢?

And then, for example, drivers

Speaker 1

驱动程序呢,

Drivers are

Speaker 0

它们是不是总在Azure服务里?

Do they always live in the Azure service?

Speaker 1

是的。

Yeah.

Speaker 1

都不是。

All no.

Speaker 1

所有的驱动程序都运行在内核里。

All their drivers live in the Kernel.

Speaker 1

所以内核和驱动程序都在一起,Linux 不是微内核架构。

So the Kernel and drivers are all Linux is not a microkernel architecture.

Speaker 1

它是单体内核。

It's a monolithic.

Speaker 1

对。

So Mhmm.

Speaker 1

所有代码都在同一个地址空间里。

The the code is all in the same address space.

Speaker 1

所以任何一个组件出错,都有可能让整个内核崩溃。

So a bug in any one of them has a chance to take any part of the kernel down.

Speaker 1

对。

Mhmm.

Speaker 1

所以 Linux 把所有架构的驱动都打包在一个大压缩包里。

So Linux ships all the drivers for all the architecture in one big tarball.

Speaker 1

咱们这代码量有四千万行。

We use that's 40,000,000 lines of code.

Speaker 1

其他操作系统则试着把东西拆开搞。

Other operating systems try and go out there and had split things off.

Speaker 1

Windows 的核心是内核,驱动可以额外往上加。

So the core of Windows is their Kernel and then you could put drivers additional on the top.

Speaker 1

对。

Mhmm.

Speaker 1

我们呢,把所有东西都搅在一起,搞成一个超级大杂烩。

We tie everything together in one big giant blob.

Speaker 1

他们的其实也是单体内核。

Theirs is still monolithic.

Speaker 1

他们系统的任何一个驱动出问题,都可能让内核崩溃,这在所难免。

Any driver in theirs will can crash the kernel within reason.

Speaker 1

这样一来,我们就能重新设计驱动和内核之间的接口方式。

In that way, we can refactor the way the interfaces between drivers and the kernel are.

Speaker 1

Linux的驱动平均比其他系统的要小三分之一,因为我们能看出来,三个看似不同的驱动其实都是在支持差不多的硬件。

Linux drivers are on average one third smaller than other operating system drivers because we can see the commonalities of you send, oh, three different drivers for three kind of same hardware.

Speaker 1

那干脆把它们合并起来吧。

Well, let's combine them all.

Speaker 1

对啊。

Mhmm.

Speaker 1

让它更精简,重构一下,变得更简单,顺便把这个API也改了。

Make it smaller and refactor things and make it easier and, oh, let's change this API.

Speaker 0

这跟开源的思路有关,你是这么看的吧?

And this has to do with the open source approach, That you see it like

Speaker 1

没错。

Yeah.

Speaker 1

我们能看到这些共同的代码,就能重构它,让它变得更棒、更干净。

As a we see all this common code and we can refactor it and we can make it better and cleaner.

Speaker 1

而且我们不会被任何固定的接口绑死。

And we're not tied to any fixed interface.

Speaker 1

我们固定的接口只在用户空间和内核之间。

Our fixed interface is between the user space and the Kernel.

Speaker 1

这个我们绝不会动。

We will not break that.

Speaker 1

这是我们保证的。

That's our guarantee.

Speaker 1

这个保证我们已经维持了很长时间了。

We've guaranteed it for a long long time.

Speaker 1

所以我们一直希望你升级内核时,不用担心旧程序会崩溃。

And so we always want you to be able to upgrade your Kernel and not feel worried that your old programs are gonna crash.

Speaker 1

所以你随时都可以放心升级。

So you should always be able to upgrade.

Speaker 1

这是我们对用户的承诺,如果真出了问题,那肯定是我们的责任。

That's our guarantee to If it does break, then it's our fault.

Speaker 1

我们会回退修复。

We'll regress.

Speaker 1

当然也有少数例外情况。

There are some exceptions.

Speaker 1

有些地方确实比较模糊。

There's some gray areas.

Speaker 1

在用户空间和内核之间,有一些底层部分我们只能绕着走,这些话题我们天天都在争论。

There's some really low level parts between the user space and Kernel that we kind of work around and we argue about these all the time.

Speaker 1

但我们从不会故意去破坏用户空间的程序。

But we never try and break user space on purpose.

Speaker 1

是的。

Yeah.

Speaker 1

很多时候我们是不小心搞砸了,但发现后马上就会修复。

A lot times we do accidentally, we'll fix it up.

Speaker 1

这是我们内核开发唯一真正的准则。

That's our number that's our only really rule of of kernel development.

Speaker 1

绝不能故意破坏用户空间。

Don't break user space on purpose.

Speaker 0

当我们说服务器大概有一百五十万行代码时,指的是内核加驱动程序。

And and so when we're talking about the, you know, the 1,500,000 lines roughly for server, we're talking about the Yes, Kernel plus drivers.

Speaker 0

内核加驱动程序。

Kernel plus drivers.

Speaker 0

因为驱动本来就是内核的一部分。

Well, because it is part of the Kernel.

Speaker 0

然后还有四千万行乱七八糟的代码,每个平台都会挑自己需要的部分。

And then, you have this 40,000,000 line of Terrible, and then every platform will kind of take their parts of it.

Speaker 0

他们会选自己用得上的功能、驱动,还有其他组件。

They'll take what is relevant for their use case capabilities, drivers, you know, other parts.

Speaker 0

所以这就是为什么,像树莓派这种设备,你说它跑的是Linux,对吧?

And then this is why I guess, you know, Raspberry Pi, you're gonna say it's gonna run, it's laying on Linux, right?

Speaker 1

当然。

Of course.

Speaker 1

对啊,没错。

Oh yeah, yeah.

Speaker 1

那是树莓派,确实挺大的。

That's a Raspberry Pi, yeah, huge.

Speaker 1

这些东西到处都是。

Those things are everywhere.

Speaker 1

所有电动车充电桩里用的都是这个。

That's what's in all the electric charge charging stations.

Speaker 1

那些都是树莓派。

Those are Raspberry Pis.

Speaker 1

真的吗?电动车?

Oh, electric really?

Speaker 1

对。

Yeah.

Speaker 1

就是你插车的那个地方?

Where you plug your car into?

Speaker 0

对。

Yeah.

Speaker 0

里面用的都是树莓派。

It's Raspberry Pis.

Speaker 1

是啊。

Yeah.

Speaker 1

全是树莓派。

It's all Raspberry.

Speaker 1

哇塞。

Wow.

Speaker 1

因为这玩意儿是特别便宜的工业级设备。

Because it's a really cheap industrial thing.

Speaker 1

对。

Yeah.

Speaker 1

现在路上的标识牌可真多。

Lots of signages now.

Speaker 1

这些全都是用树莓派运行的。

Those all those are all running Raspberry Pi's.

Speaker 0

说真的,可以合理推测它们根本没用Windows系统。

I guess it was safe to assume they're not running Windows, to be fair.

Speaker 0

那当然没有。

So No.

Speaker 1

对。

Yeah.

Speaker 1

荷兰火车站的那些指示牌,全都是跑Linux的。

So the Dutch signage for the train, those are all running Linux.

Speaker 1

有时候你还能看到上面的Linux系统直接崩溃了。

Sometimes you'll see a crash Linux machine up there.

Speaker 0

咱们能具体看看某个补丁是怎么实际开发和推进的吗?

Can we look at a specific example of how development actually flows through with a specific patch?

Speaker 1

在给你看具体例子之前,我先说一下,去年我们有四千名开发者。

Before I show the specific example, so I'll say, so we had 4,000 developers last year.

Speaker 1

他们一改代码,

So they make a change.

Speaker 1

这四千人就会发邮件给对应的维护者,每个维护者负责内核的一部分。

So those 4,000 developers will send an email to a maintainer, and the maintainer maintains a subset of the kernel.

Speaker 1

内核的每个模块都有专人负责。

Every part of the kernel is owned by somebody.

Speaker 0

那你就是这些维护者之一了?

And then you are one of these maintainers

Speaker 1

对,没错。

So then, yeah.

Speaker 1

我主要负责一些驱动程序之类的部分。

I'll entertain some drivers and things like that.

Speaker 1

然后这些维护者会把改动往上提交给子系统维护者。

But then those maintainers send things off up the tree to a subsystem maintainer.

Speaker 1

比如 USB 串口,先往上送到 USB 子系统,再由 USB 子系统提交给林纳斯。

So, like, USB serial, then we'll get sent up to USB, and then USB will go to to Linus.

Speaker 1

对。

Mhmm.

Speaker 1

所以这整个结构就像个金字塔。

So it's kind of a pyramid scheme that way.

Speaker 1

没错。

Mhmm.

Speaker 1

我们就是这么运作的。

We have that.

Speaker 1

我们大概有八百个维护者,中间还有一层。

And so we we have, like, 800 maintainers, and we have the middle section.

Speaker 1

那一层大概有两百个不同的代码树。

We maybe have about 200 different trees there.

Speaker 1

每天,我们的测试环境都会对所有这些代码树进行测试。

And then in our testing environment, all those trees are tested every day.

Speaker 1

全都合并到一起了,各种事情也就跟着来了。

They're all merged together and things that happen, whatnot.

Speaker 1

所以我们这儿有一套层层递进的开发者和维护者体系。

So we have this kind of hierarchy of developers and maintainers that way.

Speaker 1

这套体系里头,人也是重要的一环。

And part of the hierarchy is the human aspect.

Speaker 1

要是我作为维护者拿了你的代码,那这代码出了问题,我就得担着,毕竟我名字签在上面了。

So I'd if I take code from you as a maintainer, I'm now responsible for it because my name's on it.

Speaker 1

要是就改个简单的小地方,或者是个没人关心的驱动,只有你用,那没问题。

So if it's a simple one off or it's a simple driver that nobody cares about except you, great.

Speaker 1

我知道这事儿只会影响你一个人。

I know you're the only one that's gonna be affected by it.

Speaker 1

这样就挺好。

It's fine.

Speaker 1

是的。

Yeah.

Speaker 1

但如果这是内核的核心部分,我从你那儿拿了代码,万一你以后不干了,这责任就落我头上了。

But if it's the core part of the Kernel and I take changes from you, now I'm responsible for it if you disappear.

Speaker 1

对。

Mhmm.

Speaker 1

所以我得相信,你要么一直在这儿,要么我得真能搞懂这代码,自己能接着维护。

So I have to trust that either you're gonna be here or that I understand it good enough that I can maintain it.

Speaker 1

对。

Mhmm.

Speaker 1

Linux 开发里头,信任、问题、模式,归根结底都是人与人之间的信任。

So part of Linux development trust or issue or model is trust, and it's trust in human interaction.

Speaker 1

比如,我确实会收别人的东西。

Like, I will take stuff from people.

Speaker 1

我收他们的代码,不是因为觉得他们写得完美,而是我相信,万一出错了,他们会回来修——毕竟谁还没写错过代码呢。

If they whatever they send me, because I trust, not that they got it right, but they'll be there to fix it when they get it wrong, because we all get it wrong.

Speaker 1

没错。

Yep.

Speaker 1

这就是关键所在。

And that's the that's the part.

Speaker 1

所以我们现在的信任模式就是这样。

So that's that's the trust model we have.

Speaker 1

过去我们吃过不少亏,有些重要功能很早就被合并到了网络核心子系统里。

And then we've been burned in the past by some major features where it landed in the networking core subsystem a long time ago.

Speaker 1

结果一合并进去,原作者的邮箱就再也联系不上了。

And then once they landed and were merged and taken, the email address behind it disappeared.

Speaker 1

网络团队花了整整六个月才把这摊烂事理清楚。

And the network developers had to took six months to unwind the mess.

Speaker 1

对。

Mhmm.

Speaker 1

所以内核的核心部分很难随便改,因为一改影响全系统。

So it's hard to change the core part of the Kernel for a good reason because it affects everybody.

Speaker 1

而且我们之所以这么谨慎,也是希望你能在出问题的时候挺身而出,帮忙修复。

And also good reason in that we wanna make sure that you are gonna be there to fix it if it breaks.

展开剩余字幕(还有 480 条)
Speaker 1

是的

Yeah.

Speaker 1

但像驱动程序这类东西,我们来者不拒。

But for drivers and things like that, we'll take anything.

Speaker 1

随手提交的,只要简单我们就收。

Drive by, we'll take it's really simple.

Speaker 1

对

Yeah.

Speaker 1

这种情况下,事情确实很简单。

It's very simple thing that way.

Speaker 1

但这就是我们的层级结构。

But that's the hierarchy.

Speaker 1

所以改动是这么往上层层推进的。

So a change flows up the tree that way.

Speaker 1

是的

Yeah.

Speaker 1

所以我来演示一下。

So I can show that.

Speaker 0

好的。

Alright.

Speaker 0

那咱们待会儿能看到什么?

So what what are we gonna see?

Speaker 1

这是个改动。

So here is a change.

Speaker 1

这个改动是一个叫切斯特的人做的。

So this was written by someone named Chester.

Speaker 1

他嗯,

He Mhmm.

Speaker 1

修改了USB串口驱动。

Made a change to the USB serial driver.

Speaker 1

这是一个可选项。

It's an option.

Speaker 1

这个芯片叫Option。

The chip is called option.

Speaker 1

这些都是USB转串口的设备。

These are USB to serial devices.

Speaker 1

它们用在调制解调器里。

They're in modems.

Speaker 1

还有各种各样的设备里都有。

They're in Yeah.

Speaker 1

用途可多了。

Lots of different things.

Speaker 1

型号多得数不清。

There's a ton of different ones.

Speaker 1

这类设备根本没有统一标准。

And there's no standard for these types of devices.

Speaker 1

所以每当你想用一个新的,都得单独加一个自定义设备ID。

So you had to add a custom device ID for every single one that you wanna use.

Speaker 1

是的

Mhmm.

Speaker 1

本来就是这样工作的。

It's just the way they work.

Speaker 1

这是个补丁,下面是它的说明。

So here's a patch and here's the description of it.

Speaker 1

这其实就是一封邮件。

So, this is just an email.

Speaker 0

这里的说明是

The description here is

Speaker 1

这是主题行。

There's the subject line.

Speaker 0

对

Yeah.

Speaker 0

USB串口选项,加上各种东西。

USB serial option, adding whatever.

Speaker 1

加上去之后,写内核改动最难的部分其实是描述清楚到底发生了什么。

Adding And that then here's so good part about hardest part about writing a Kernel change is the description of what's going on.

Speaker 1

真的吗?

Really?

Speaker 1

是的。

Yeah.

Speaker 1

我的意思是,代码本身其实挺简单的。

I mean, the code is easy.

Speaker 1

难的是把改动的原因解释清楚。

It's the description explaining it is hard.

Speaker 1

对吧?

Right?

Speaker 1

你不是要说明它在做什么,而是要说明你为什么这么做。

You don't explain usually what it's doing, you have to explain why you're doing it.

Speaker 1

对。

Mhmm.

Speaker 1

像这种简单的改动,其实特别好弄。

For something as simple as this, it's like, it's really easy.

Speaker 1

这个人说,这个驱动是猫六调制解调器的一部分。

So this person says, this driver is part of a cat six modem.

Speaker 1

这个产品ID在好几个调制解调器上都是共用的。

The product ID is shared across multiple modems.

Speaker 1

它会给你展示一下设备里这个东西长啥样。

It gives them a little dump of what it looks like in the device.

Speaker 1

然后还有一堆额外的信息。

And then there's some more information.

Speaker 1

后面有个‘经签署’的行。

There's a signed off by line.

Speaker 1

‘经签署’是我们很久以前搞出来的,用来表明我确实是这个代码的作者,拥有权在我这儿,我也授权给这个项目,按项目用的许可证来走。

And signed off by is what we created a long time ago that shows that I have the proper authorship of this and ownership and I give it to this project under the license by which the project is run.

Speaker 1

所以意思就是,我把这个东西以GPL协议开源了。

So it's saying I'm licensing this thing under the GPL.

Speaker 1

再往下看,大概就是那一行补丁了。

And then way down below is probably the one line patch.

Speaker 1

这整个都是……

This is all just

Speaker 0

所以这整个是描述部分。

So this is all the description.

Speaker 0

这个人是在说明,关于这个调制解调器到底该做点啥,各种细节。

This this person is giving context on, like, here's what needs to do about the modem, the different Yes.

Speaker 0

就是规格啊,之类的。

You know, specifications or what.

Speaker 1

这是改动的部分。

And here's the change.

Speaker 1

有人改了,删了这一行。

So somebody changed this, remove that line.

Speaker 1

红色的是删掉的,绿色的是新加的。

The red is removed, the green is add.

Speaker 1

对。

Yep.

Speaker 1

所以有人加了新内容,还得根据新加的行重新调整格式。

So somebody added and had to reformat the lines based on some new ones they added.

Speaker 1

就这些了。

And that's it.

Speaker 1

他们新增了几个设备ID。

So they had a few new device IDs.

Speaker 0

然后有个设备ID,接着就看到几个十六进制数字。

And and then there's a device ID and then we see a hex a few hex numbers.

Speaker 0

这些就是一些标识符。

Those are like some IDs here.

Speaker 1

对于USB设备来说,它们都有厂商ID、产品ID这些信息。

So for USB, USB devices have a product and a vendor and a product ID.

Speaker 1

这就是它们的识别方式。

That's how they're

Speaker 0

是的

Yeah.

Speaker 1

厂商,然后是产品。

Vendor and then they have products.

Speaker 1

还有子设备和子产品的ID。

And then there's some sub device and sub product IDs as well.

Speaker 1

明白了。

Got it.

Speaker 1

所以这就是它的用途。

Got So that's what this is for.

Speaker 0

好的。

Okay.

Speaker 0

我们的意思是,

We're saying,

Speaker 1

我们只是在为驱动添加支持,这些芯片本来就已经支持了,但因为新来了个厂商,想用自己的厂商ID,所以我们得加个新ID。

we're just adding support for some the driver already works for these chips, for this chip, but we just have a new ID because a new vendor came along and they wanted to put their own vendor ID on it.

Speaker 1

这很常见。

Very common.

Speaker 0

所以听起来,这个代码改动本身简单到极点,但说明文档却写得特别长。

So it sounds like this change is as simple as it get in terms of the code change, but still the description was very extensive.

Speaker 0

对吧?

Right?

Speaker 1

确实特别长。

So very extensive.

Speaker 1

文档里还有一部分,直接贴了硬件的原始说明。

Part of the description was also just here is a dump of the description of the hardware.

Speaker 1

对的。

Mhmm.

Speaker 1

就是为了确认一下,没错,这个和硬件信息是一致的。

Just so that we can verify, yeah, that is gonna match with this.

Speaker 0

明白了。

Got

Speaker 1

就是它。

it.

Speaker 1

所以我们有工具能自动生成这些东西,但说实话,做这种改动还是挺费劲的。

So just it's a we have tools that create those things and but, yeah, it's a lot of work for for like change.

Speaker 0

但你看,要是用GitHub的术语来说,虽然我不太确定是不是这样。

Well, but but this is, like, if if, you know, if if we talk GitHub language, although I'm not sure No.

Speaker 0

这应该是个PR。

This this this will be a PR.

Speaker 0

对吧?

Right?

Speaker 1

这个内容应该放在补丁里,而不是PR里。

This is this should be in the patch itself, not the PR.

Speaker 1

啊,明白了。

Ah.

Speaker 1

比如说,一个PR可以包含你想要做的十项改动。

So, a PR would be so say you have 10 changes you wanna make.

Speaker 1

所以,一个PR就是10个改动里的第0个补丁。

So, a PR would be the patch zero out of 10.

Speaker 0

明白了。

Got it.

Speaker 0

懂了。

Got it.

Speaker 0

是的。

Yeah.

Speaker 0

这个才是提交记录。

This this is the commit.

Speaker 1

这才是真正的提交记录,这也是我不喜欢GitHub模式的主要原因——大家都不把改动真正写进Git提交里。

This is the commit itself, which is a big problem of why I don't like the GitHub model is because people don't put the changes in the GitHub in the Git commit.

Speaker 1

对。

No.

Speaker 1

因为Git

Because the Git

Speaker 0

我们仓库里不这么做。

repo we don't.

Speaker 1

所以这就有个问题。

So there's a problem.

Speaker 1

当你提交代码,以后再回头看仓库里的变更时,你看不到拉取请求的信息。

When you commit the when you're looking at the repo later and you look at the change, you don't see the pull you can't see the pull request information.

Speaker 1

是的。

Yeah.

Speaker 1

信息就没了。

And it's gone.

Speaker 1

我觉得这正是GitHub模式的一大问题。

And that's a big problem I feel with the GitHub model.

Speaker 0

但我觉得这其实归根结底是,你用的工具,比如Linux团队开发的,本来就是为他们的使用场景设计的,你们也按原意在用。

Well, I I feel this goes back to, you know, like you built the tool or, you know, Linux group built the tool for your use case and you're using it the way you intend to use it.

Speaker 0

而GitHub是在此基础上加了拉取请求的工作流,但这些压根就不属于Git本身,不知道为啥。

Whereas GitHub built the pull request workflows built on top of this, and it is not part of Git for whatever reason.

Speaker 0

也许GitHub本可以把这个功能整合进Git里,但事实就是没整合。

You maybe GitHub could have made it part of Git whatnot, but it's not.

Speaker 0

对吧?

Right?

Speaker 1

其实也不是。

Well, no.

Speaker 1

我们确实有拉取请求这个流程。

So we have pull requests.

Speaker 1

在Linux里,我们也会用拉取请求。

We create a pull request for in Linux.

Speaker 1

我们是通过邮件来提交补丁,用git工具来管理。

We have we email those git create

Speaker 0

拉取请求。

pull requests.

Speaker 0

哦,原来如此。

Oh, okay.

Speaker 1

那命令真不错。

That was a that was a good command.

Speaker 1

它会生成一个

It makes Is an

Speaker 0

这是 git 的一部分吗?

that part of the git?

Speaker 0

对。

Yeah.

Speaker 1

它会发一封邮件,内容是‘从这个仓库拉取代码’,并附上这个仓库的所有变更。

It makes an email that says pull from this repo and here's everything that's in this repo.

Speaker 1

合并的时候,这个合并提交里会保留所有这些信息。

And when we do a merge of that, we that merge commit has all that information in it.

Speaker 0

明白了。

Okay.

Speaker 1

如果你去看 Linux 内核的提交记录,就会发现,当 Linus 合并 USB 那个分支时,他能看到我写在最上面的那条消息,说明这次拉取请求里都包含了什么。

And then so you'll if you look at the Linux Kernel and you see when you merge when Linus merges in the USB tree, he sees my little message at the top saying, here's everything that's gonna be in this pull request.

Speaker 1

明白了。

Got it.

Speaker 1

因为 Git 才是源头,所有数据都存这儿呢。

And because Git is the source and that's where all the data is.

Speaker 1

对吧?

Right?

Speaker 1

所以你看,我们根本不需要 pull request。

And so you can see that we don't have pull requests.

Speaker 1

这事儿不是外头搞的。

It's not external.

Speaker 1

GitHub 本来可以改一改,把这信息加到合并请求里,但他们没这么做。

GitHub could change that model and put that in the merge request, but it doesn't.

Speaker 0

我正想说呢,既然你都这么做了,他们其实也能照着做,但说到底,就是个习惯问题,嗯,差不多吧。

I I I was about to say that, like, because you did it, they they could do but it's it's a matter of, yeah, guess yeah.

Speaker 0

这是偏好问题,没啥大不了的。

Preferences and That's fine.

Speaker 0

总之。

Anyway.

Speaker 1

好的。

Okay.

Speaker 1

好处是,每一行代码都能追溯到是谁写的、做了什么改动、改动记录是什么。

The good thing about it is is you can track every single line of code back to who made it and what they did and what was the change what was the change log?

Speaker 1

当时为什么这么改的?

What was the reasoning behind this?

Speaker 1

没错。

Yep.

Speaker 1

这挺好的。

Which is great.

Speaker 0

明白了。

Okay.

Speaker 0

所以,这个人是把代码提交到这个模块里的?

So so this comes into this person sends it to the the module?

Speaker 1

所以他把东西发给了那个……

So he sends it to the yeah.

Speaker 1

这个模块的负责人是约汉。

So the owner to this is Yohan.

Speaker 1

我们有个脚本,能自动分析任何补丁,找出谁对这部分代码负责,还有对应的邮件列表。

He there's a script we have that says, take any patch and give me the people who are responsible for this and the mailing list.

Speaker 1

所以我和约汉选了这个,因为是咱们这边的,就发到了USB邮件组,还抄送了一堆可能参与过这个驱动开发的人。

So, Johan and me, picked this because it's US and sent it to the USB list and copies a bunch of other people that, I guess, they worked with and that have changed this driver in the

Speaker 0

而且抄送也是用工具自动完成的。

And and then the the copy is also done with the tool.

Speaker 0

就像你说的,工具会追踪谁修改过这段代码,或者谁最有可能……没错。

As you said, it kind of looks to who who touched this code or or who might Exactly.

Speaker 1

是的。

Yep.

Speaker 1

挺好的。

All nice.

Speaker 1

没错。

Exactly.

Speaker 0

全是自动的。

It's all automated.

Speaker 1

对的。

Yep.

Speaker 1

全都是自动的。

All automated.

Speaker 1

我们一搞定就马上这么做了,效果特别好。

We do that as So soon as it's that was great.

Speaker 1

他发出去之后,邮件列表里就自动抄送了两份。

He sent it and just the mailing list says two copies of it.

Speaker 1

那是因为他们想发到两个不同的邮件列表里。

That's just because they wanted two different mailing lists.

Speaker 1

结果他们说:哎呀,出错了。

But then they said, oops.

Speaker 1

我搞砸了。

I messed up.

Speaker 1

他发完之后,立马就收到一封邮件。

There's an email from the person instantly after he sent it off.

Speaker 1

啊?

Oh.

Speaker 1

然后说:我弄错了。

And said, I messed up.

Speaker 1

有个界面。

There's an interface.

Speaker 1

我觉得最好改一下这个备注。

I need to maybe it'd be a good idea to change this comment.

Speaker 1

于是他们就把备注改了。

So they go and change the comment.

Speaker 1

对。

Yep.

Speaker 1

然后他们再发一遍。

And then they resend it.

Speaker 1

你就直接发个新版本。

And you just send a new version.

Speaker 1

然后——

And then

Speaker 0

那在这种情况下,他们是发一个新的补丁吗?

And then in this case, they send a new patch?

Speaker 0

还是说他们就再加一个?不,不是。

Or or do they do they do they just add one more no.

Speaker 0

你得保持提交记录干净整洁。

You you want to have a clean commit.

Speaker 0

对吧?

Right?

Speaker 1

是的。

Yeah.

Speaker 1

我们这儿不是这样,他们发的是第二版补丁,你要是能看到的话。

We don't do so here they sent a version two patch, if you can see that.

Speaker 1

上面写着第二版。

It says version two.

Speaker 1

对吧?

Right?

Speaker 1

哦,在这儿呢。

Oh, there.

Speaker 1

第二版。

Version two.

Speaker 0

明白了。

Got it.

Speaker 1

然后这儿是同样的信息。

And then here's the same information.

Speaker 1

接着应该会有一些说明,讲清楚这两个版本之间改了什么。

And then there should be some comments about what changed between the two versions.

Speaker 1

希望吧,第二版跟上一版相比有些改动。

Hopefully, yes, changes in version two from the previous one.

Speaker 1

而且这里还有个链接可以回看第一个版本。

And there's a link back to the first one.

Speaker 0

对。

Mhmm.

Speaker 0

不错。

Nice.

Speaker 1

确实不错。

Very nice.

Speaker 1

我们就是这么做的。

That's we do.

Speaker 1

所以我们得看看具体改了啥,毕竟我每天要收一千封邮件。

So we wanna see the changes because, I mean, I get a thousand emails a day.

Speaker 1

是的。

Yeah.

Speaker 1

我审补丁的时候,看完了就过去了,因为马上得看下一个。

And I when I review patches and stuff, I'll review them and then they're gone because I'm reviewing the next one.

Speaker 1

对。

Yeah.

Speaker 1

但下次你发新版本的时候,我想能一眼看出跟上一版有什么不同,不想再翻一堆旧东西。

But if I I want when you send the next version, I wanna remember what see what changed from the previous one because I don't wanna go back and dig through all the old stuff.

Speaker 1

好的。

Okay.

Speaker 1

所以他们加了一些说明进去。

So they added some information to it.

Speaker 1

太棒了。

Wonderful.

Speaker 1

那后来呢?

And then what happened?

Speaker 1

Johan,就是这个子系统的维护者,对。

Johan, who is the maintainer of the subsystem Yep.

Speaker 1

他说:‘谢谢你提交补丁,还帮忙写了文档。’

Wrote said, hey, thanks for the patch and help for documenting it.

Speaker 1

哦,我觉得他还做了别的事。

Oh, I think it did something else.

Speaker 1

我有点乱了。

I got out of order.

Speaker 1

一开始他说:‘嘿,请在两周后应用这个补丁。’

First, said, oh, he gesture wrote, hey, please please apply this after two weeks.

Speaker 1

一周后。

After a week.

Speaker 1

对。

Mhmm.

Speaker 1

他说,因为一周或两周后,效果挺好的。

He said, because after a week or after two weeks, it's nice.

Speaker 1

诶,这事儿后来怎么样了?

Hey, what happened to this?

Speaker 1

这怎么回事?

What's going on?

Speaker 1

Johan说,你得在合并窗口期内提交这个补丁。

Johan said, you submit this patch during the merge window.

Speaker 1

我待会儿讲讲我们的开发模式,但每次发布前都有个两周的合并窗口。

I'll talk about how we do our development model, but there's a two week merge window for when we do releases.

Speaker 1

对。

Mhmm.

Speaker 1

Linus会把所有维护者在他们开发分支里的改动都收进来。

That Linus takes all the changes from all the maintainers that have been in their development trees.

Speaker 1

到这时候就不能再加新改动了。

We can't add new changes at that point in time.

Speaker 0

嗯。

Mhmm.

Speaker 1

所以这两周基本上是冻结新开发的。

So there's a two week kind of blackout for new development.

Speaker 1

但这个时候,所有东西都会集中到 Linus 那儿,为下一个版本做准备。

But this is where all the stuff is flowing into Linus for the next release.

Speaker 1

所以在这段时间里,你要是给我发补丁,我其实啥也干不了,只能先搁在邮箱里,等窗口开了再说。

So during that time, if you send me a patch, I can't really do anything with it, but it'll stick in my mailbox until then.

Speaker 1

对。

Mhmm.

Speaker 1

结果这事儿正好撞上了那个短暂的空窗期。

So this happened to hit that little So so window of time.

Speaker 0

我有点不明白,你们的发布周期是九周吗?

Just to understand, there's a nine week release.

Speaker 0

因为每九周就会出一个新版本,对吧?

Because every nine weeks, there's a new release going out.

Speaker 0

是吧?

Right?

Speaker 0

然后中间会有一段收集补丁的时间。

And then there's a window where patches are gathered.

Speaker 0

对,没错。

So, yeah.

Speaker 0

来,咱们聊聊这个。

Here, let's talk about that.

Speaker 1

林纳斯作为发布负责人,是这样的。

So there's Linus as a release Yeah.

Speaker 1

现在这个时候。

At this point in time.

Speaker 1

然后合并窗口就打开了。

And then the win merge window is considered open.

Speaker 1

接下来两周,所有维护者都会把上一版以来积压的改动全部发给林纳斯。

And then for two weeks, all the maintainers send Linus all the stuff they've had pending from the last release.

Speaker 1

没错。

Yep.

Speaker 1

我们有两周时间来加入所有新功能。

We have two weeks to add all new features.

Speaker 1

对。

Yep.

Speaker 1

然后他就会发布第一个候选版本。

And then he does release candidate one.

Speaker 1

从那以后,接下来的七周就只修bug了。

And then from there on, it's bug fixes only for the next seven weeks.

Speaker 1

没错。

Mhmm.

Speaker 1

就只修bug,只修回归性问题。

So it's bug fixes only, bug fixes only, bug It's regression fixes.

Speaker 1

有问题的代码我们会直接回退。

We'll revert things.

Speaker 1

所以绝对不能再加新功能了。

And so it's no new features.

Speaker 1

是的。

Yeah.

Speaker 1

但在这七周里,老有人给我发新功能。

But during that seven weeks, people are sending me new features.

Speaker 1

对。

Yeah.

Speaker 1

所以我另外开了一个分支。

So I have a separate tree.

Speaker 1

等等。

Wait.

Speaker 1

就是我下一个要搞的分支。

Which is Which is my next tree.

Speaker 0

你现在是把它们攒着,等窗口一开再统一放进去。

You're now you're now batching it for when the the window will open.

Speaker 1

是的。

Yeah.

Speaker 1

所以我们管它叫 next,Linux next。

So we call it next, Linux next.

Speaker 1

所以我们有个 next 树,每天都会把所有这些改动合并进去

So we have a next tree where all these are merged together on a daily basis

Speaker 0

是的

Yeah.

Speaker 1

就是为了确认它们都能正常运行

To see, to make sure they work.

Speaker 1

对

Yeah.

Speaker 1

因为得为 Linus 下一次更新做好准备

Because be prepared for Linus' next one.

Speaker 1

等他发布完,一切稳定了,我们又会在两周后把一堆新东西扔给他

And then when he does a release after everything's good, we all throw things at him again in another two weeks.

Speaker 1

Linus 并不会自动从所有这些合并树里拉代码

Now, Linus doesn't pull automatically from all those merge trees.

Speaker 1

我们得主动去请求他

We have to explicitly ask them.

Speaker 1

对的。

Yep.

Speaker 1

因为有时候我们的分支根本不行。

Because sometimes our trees aren't good.

Speaker 1

没错。

Yeah.

Speaker 1

比如说,我负责维护TTY和串口部分。

So sometimes, like, I maintain the TTY and serial.

Speaker 1

有一次特别惨,简直一团糟。

One time famously, it was a mess.

Speaker 1

我们那个分支根本跑不起来。

Our tree it just wasn't working.

Speaker 1

当时还加了新功能。

There was new features added.

Speaker 1

所以我决定这次直接跳过这个发布周期。

So I'm like, I'm skipping this release cycle.

Speaker 1

我先把这几个bug修复单独抽出来发给你,然后就先撤了。

I'm gonna pull out some these bug fixes send them to you off the side and then go.

Speaker 1

但要是这些代码会被自动合并进来的话,我们就得收拾这个烂摊子了。

But if it was like automatically being merged in, we'd have to deal with that mess.

Speaker 0

这件事其实挺有意思的,我也在琢磨这事——大部分用Git的公司,尤其是大型科技公司,你想啊,就拿原生移动端开发来说吧,因为要过App Store审核,一般也就一两周发一次版,桌面端应用其实也差不多,根本没法想更就更。

It's it's just interesting because most companies just, you know, reflecting on, you know, the companies that use Git, large tech companies, they often have, let's say, let's talk about native mobile development where there is a concept of releasing every week or two weeks because of the App Store review process or same with like desktop apps, actually, you can't really just continue to release.

Speaker 0

一般大家也会定个发布目标,但不会卡得这么死。

There's usually an aim for something, but it's not as strict.

Speaker 0

所以偶尔要是确实稳定性不够,我们就会把发布推迟,这种情况也时有发生。

So every now and then it would also happen that it's just not stable enough, we'll push it back.

Speaker 0

但我们也不会死守着死板的时间节点不放。

But there is not this rigid clockwork.

Speaker 0

我见过的大多数公司处理这件事都灵活得多,毕竟嘛,他们自己规划的那些...

I think most companies that I've seen, they just treat it a bit more flexible because, again, they come up with the thing that they're

Speaker 1

本来要负责推进的里程碑节点。

in Your charge milestone.

Speaker 1

你那个功能,肯定想赶紧加上去吧。

With Your feature you wanna have at it.

Speaker 0

对吧?

Right?

Speaker 0

没错。

Yeah.

Speaker 0

咱们都知道,到了里程碑阶段,功能可能会砍,截止日期也可能调整,这事儿太常见了。

And then as we know, when you have a milestone, features might be cut, deadline might be moved, you know, like like Yeah.

Speaker 1

公司里这事儿多了去了。

Companies are Tell me about it.

Speaker 0

我理解得对吗?Linux 这种情况,是不是每九周就发一个版本?

Do I understand correctly that in the case of Linux, like, is this a thing where every nine weeks there will be

Speaker 1

是啊,是按时间来的。

a release?

Speaker 1

我们这边就是时间驱动的。

We it's time based.

Speaker 1

所以我们有两个星期的时间,把那些已经进入我们代码库、被认可的全新功能合并到林纳斯那边,没错。

So we have that two week window of merging all the new features to Linus that have been in our tree and accepted already Yeah.

Speaker 1

而且这些功能都经过验证,运行稳定。

And proven to work.

Speaker 1

这个窗口期很短。

And the window is short.

Speaker 1

大概八到九周。

Eight, nine weeks.

Speaker 1

对。

Yeah.

Speaker 1

这样其实挺好的,因为以前我们开发周期动不动就是两年、三年。

And that's good because we had we used to have two year long development cycles, three year long development cycles.

Speaker 1

问题就在于,哪怕你有六个月的开发周期,也会担心:有个功能,

And the problem there is if you have even if you have six month development cycles, there's that fear of you have a feature.

Speaker 1

我想用你的这个功能,但它还没准备好。

I wanna take your feature, but it's not quite ready.

Speaker 1

我有必要等吗?

Do I wanna wait?

Speaker 0

我知道。

I I know

Speaker 1

但如果你知道,你的功能再过九周就能合并进去,可现在还没准备好,那就是真没准备好。

what But if if I if you know that you can get your feature in in nine weeks from now and it's it's just not ready, it's not ready.

Speaker 1

这样一来,作为维护者,我也没那么大压力非得现在就接受你的新功能了。

And it's it's much more like, okay, the pressure's off me as a maintainer to take your new feature Yeah.

Speaker 1

等它准备好了再说。

Until it's ready.

Speaker 0

你可以说,嘿,要是它能赶上下一个版本,或者咱们先确保它够稳定,特别是功能比较复杂的时候。

You you you can say, like, look, if if it'll make it into the next one or or, you know, let's make sure it's gonna work properly if it's more complex.

Speaker 1

对。

Yeah.

Speaker 1

我们有很多功能。

We have lots of features.

Speaker 1

你知道吗,有个USB功能都快打到第35个补丁版本了。

I mean, famously, there's a USB feature that's on patch version number 35.

Speaker 1

这已经是第25轮补丁系列了。

There's 25 patch series.

Speaker 1

现在都到第35版了,还是没搞定。

It's on the thirty fifth version.

Speaker 1

就是还没准备好。

And it's just not ready.

Speaker 1

今天我还收到一封邮件,说可能得换个方式来实现。

And then I just got an email today saying, well, maybe we need to change this to this other way.

Speaker 1

我真的替那个开发者感到心疼。

I mean, so I feel feel so bad for that developer.

Speaker 1

他确实很拼命,这功能太复杂了,折腾了一年半才走到这一步。

But he's been working hard and it's a it's a complicated feature and it's taken him a year and a half to get there.

Speaker 1

我这儿还有几个补丁,才到第3版,可这一拖就是两年了。

I have other patches that are in version three, but that's version three and it's been two years.

Speaker 1

因为这位开发者中间隔了挺长时间。

Because the developer just took a lot of time in between.

Speaker 0

明白了。

Okay.

Speaker 0

所以这个例子挺好的,那个贡献者就说:嘿。

So so in this case, this is a good example that, you know, the person, the contributor said, like, hey.

Speaker 0

提醒一下,我想让这个补丁被合并。

A reminder, I'd like this patch applied.

Speaker 0

对。

Yeah.

Speaker 0

没问题。

That's fine.

Speaker 0

然后乔安回复了,提醒大家这个流程的时间安排。

And and then Johan replied, reminding of the of the timeline on how it works.

Speaker 0

对吧?

Right?

Speaker 0

是的

Yeah.

Speaker 0

没错

Exactly.

Speaker 0

然后切斯特回了消息。

And Chester wrote back.

Speaker 0

而且他态度特别友好,说下个版本就加上。

And then really friendly, it'll be in the next one.

Speaker 0

别担心。

Don't worry.

Speaker 0

对啊

Yeah.

Speaker 0

这就挺好的。

Just Which is nice.

Speaker 0

特别积极。

Very positive.

Speaker 1

是的。

Yeah.

Speaker 1

但我们真不是那种刻薄的人。

But this is we're not mean people.

Speaker 1

我们当然。

We yeah.

Speaker 1

要是我两周没审你的补丁,你随时提醒我,千万别觉得不好意思。

And then reminding, don't ever feel bad about reminding me that I haven't reviewed your patch in two weeks.

Speaker 1

要是两天没审,那我确实会有点急躁。

Now, if I haven't reviewed it in two days, yeah, I'll I'll be a little testy.

Speaker 1

但两周提醒一次,挺合适的。

But two weeks is a good idea.

Speaker 1

另外,Justin Robax,特别感谢你一直盯着这事。

And then, Justin Robax, thanks a lot for keeping an eye on it.

Speaker 1

继续加油!

Keep up the good work.

Speaker 1

就这样了。

And that's it.

Speaker 1

那现在交给Johan了。

So then Johan has it.

Speaker 1

对。

Yeah.

Speaker 1

Johan已经把补丁合并到他的分支里了,他还特意发消息说:嘿。

Johan applied it to his tree because he then wrote saying, hey.

Speaker 1

Johan这人真够体贴的。

And Johan is very nice here.

Speaker 1

他说:你写的注释格式有点不太对。

He said, you kinda didn't do the comments in the proper format.

Speaker 1

我帮你改好了。

I fixed it up for you.

Speaker 0

哦,太好了。

Oh, nice.

Speaker 1

所以对于这种小改动,我们得让流程特别简单。

So for drive by changes like that, we wanna make it really easy.

Speaker 1

我们有时候是挺苛刻的。

And we're mean people.

Speaker 0

我的意思是,很明显,这个人不太可能成为长期贡献者。

I mean I mean I mean, clearly, this this feels like it's a person who is unlikely to become a regular contributor.

Speaker 0

他只是把活儿干完了而已。

They're getting their work done.

Speaker 0

对吧?

Right?

Speaker 0

他是在加东西……

They're they're adding

Speaker 1

他们有个设备得用,是的。

They have a device that they have to Yeah.

Speaker 1

不过我们还是想对所有人都友好、开放、好相处,毕竟每个人第一次提交补丁的时候都是新手。

Pretty But we wanna be friendly and open and easy to everybody because everybody submits their first patch at one time.

Speaker 1

对吧?

Right?

Speaker 1

是的。

Yeah.

Speaker 1

我记得特别清楚,我第一次提交补丁的时候,发邮件问:‘我该怎么弄补丁啊?’

Famously, I said, when I did my very first patch, I wrote an email saying, how do I make a patch?

Speaker 1

因为那时候我们没有好的文档。

Because we didn't have good documentation.

Speaker 1

有人回了我一封邮件,说:‘嘿,我来告诉你怎么做。’

Somebody wrote back and said, hey, here's how you do it.

Speaker 1

八年后,他成了我的老板。

He became my boss eight years later.

Speaker 1

结果我先是给他干活,后来就直接在他手下干了。

It was like, worked for him, ended up working for him.

Speaker 1

想起来真挺有意思的。

And it's just funny.

Speaker 1

这世界真小,诸如此类吧。

It's just like a small world and whatnot.

Speaker 1

但,没错。

But, but yeah.

Speaker 1

我们就是想让它变得简单。

And we wanna make it easy.

Speaker 1

对的。

Yep.

Speaker 1

所以约翰就接手了。

So Johann takes this.

Speaker 1

他把补丁收进自己的代码树里了。

And he's got the patch, and it's in his tree now.

Speaker 1

是啊。

Yeah.

Speaker 1

这太好了。

Which is great.

Speaker 1

所以这事儿就发生在他本地的那个小分支里。

So but that's in his local little tree.

Speaker 1

然后他得把这东西推到别的地方去。

Then he has to get it off somewhere else.

Speaker 1

Johan接着给我提了个合并请求。

Johan then makes a pull request to me.

Speaker 1

对。

Mhmm.

Speaker 1

这其实就是 git 提交合并请求时的界面长这样。

So this is an output of the git make pull request.

Speaker 1

我也不太记得具体命令咋写。

I'm I don't know what the actual command.

Speaker 1

这呢,就是一个合并请求的样例,

And it this is what a pull request from

Speaker 0

git 的合并请求就是这样,因为 Johan 是子系统维护者。

git will And this is because Johan is a subsystem maintainer.

Speaker 0

对,Johan。

Yes, Johan.

Speaker 1

他负责维护USB转串口的驱动。

Maintains the USB to serial drivers.

Speaker 1

这种类型的驱动有一大堆呢。

There's a bunch of drivers for this types of Yep.

Speaker 1

对,就是这些。

Things.

Speaker 1

然后他把东西发给我,我是USB模块的维护者。

And then he sends it off to me, the USB maintainer.

Speaker 0

明白了。

Got it.

Speaker 1

他会说:拿这个补丁吧,或者从这个标签的分支里拉取。

And he says, take this patch or pull from this tree at this tag.

Speaker 1

而且是个带签名的标签。

And it's a signed tag.

Speaker 1

所以他是用他的GBG密钥签名的,我拉取的时候就能确认这真是他本人。

So it's signed with his GBG key, so I can verify that it's really him Yeah.

Speaker 1

我拉取的时候就能验证。

When I pull from it.

Speaker 1

他会说,拿这些补丁吧,这是相关信息。

And it says, take these patches and here's the information.

Speaker 1

里面是一些USB设备ID,全都已经在Linux Next里测试过,没出过问题。

It's gonna be some USB device IDs and they have all been in Linux Next with no reported issues.

Speaker 1

所以这些都已经经过我们集成测试的验证了。

So they've been tested in our integrated testing.

Speaker 1

我们每天都会测试这些东西。

We test all this stuff every day.

Speaker 0

那测试具体是指什么?

And what does testing mean?

Speaker 0

是自动化测试吗?

Is is it automated testing?

Speaker 0

是在实际设备和设备实验室里推送测试吗?

Is it pushing it out on on devices and device labs?

Speaker 0

是各种方式都有吗?

Is a mix?

Speaker 1

对,都有。

Yes.

Speaker 1

全都有。

It's all of that.

Speaker 1

我们有个开发者在澳大利亚,Linux Next 每天都会合并他的代码。

So we have one so Linux Next gets merged every day as a developer in Australia.

Speaker 1

他把所有代码树合并起来,编译、启动,都没问题。

He merges all the trees together and builds them and boots them Yep.

Speaker 1

还有虚拟机。

And virtual machines.

Speaker 1

对。

Yep.

Speaker 1

内核能做到这一点可不简单。

That's a nontrivial thing for a Kernel to do.

Speaker 1

光能开机就不错了。

Just to boot.

Speaker 1

只要能开机,通常就意味着情况还不错。

If it can boot, it's usually, hey, things are going well.

Speaker 1

它没在真实设备上做测试。

It isn't testing on real devices.

Speaker 1

对。

Yep.

Speaker 1

现在还有其他实验室也在用我们的CI系统跑内核测试,能把代码推过去,有人在自己的真实硬件上测试Linux Next。

Now, are other labs out there with Kernel CI, which is our CI infrastructure, that can run on all individual labs, and we do push things out there, and there are people testing Linux Next on their real hardware

Speaker 0

是的。

Yeah.

Speaker 1

然后自动把测试结果发回来。

Sending reports back in an automatic fashion.

Speaker 1

这些情况没那么少见了。

Those are less rare.

Speaker 1

林纳斯的主干分支在这上面测试得更多。

Linus' tree gets tested more on that.

Speaker 1

稳定版分支我稍后再讲,它们在真实硬件上的测试也更频繁。

The stable trees, I can talk about stable trees in a little bit, get main tested more on the real hardware more.

Speaker 1

Linux Next 的编译和启动测试做得挺到位的。

Linux Next gets build and boot tested pretty well.

Speaker 1

对的。

Yep.

Speaker 1

我不用 Linux Next。

I don't run Linux Next.

Speaker 1

我用的是我自己的开发分支,所以不会把所有版本混在一起跑。

I run the my development tree is online, so I don't run all of the mix mix of them all.

Speaker 1

有时候它们会互相影响,因为我们没有各自为政的情况。

Sometimes they interact, because we don't have any fiefdoms.

Speaker 1

如果我有个USB相关的改动需要经过网络模块,我就可以直接改网络代码之类的。

If I have a USB change that needs to actually go through the networking stuff, I can change the networking code and whatnot like that.

Speaker 1

然后他们可能会说:嘿,你这么改不太合适。

And they can say, hey, maybe you shouldn't do that.

Speaker 1

我们一般都会尽量争取通过审核。

And we try and get approval.

Speaker 1

你得帮我审一下这些补丁。

You review my patches.

Speaker 1

但现在大家其实都能碰任何部分的代码,谁都能改内核的任何地方。

But it's now we can touch any any but he can touch any part of the kernel in a way.

Speaker 1

但他给我发了个拉取请求。

But he sent me a pull request.

Speaker 1

所谓的拉取请求,其实我并不会去逐行看里面改了啥。

And I a pull request is that I don't actually review the changes in it.

Speaker 1

我不会一封一封邮件去审每个小补丁。

I'm not reviewing each individual patch through email.

Speaker 1

我信任他发来的这四个补丁都是没问题的。

I'm trusting that he sent me four patches here and that they're good.

Speaker 1

对。

Yep.

Speaker 1

我认识Johan,我知道如果出问题他一定会在的。

And I have known Johan, and I know that he will be there if something goes wrong.

Speaker 0

没错。

Yeah.

Speaker 0

你会先看下描述,然后偶尔会决定,比如深入研究某个补丁。

And and, like, you will you read the kind of the the description, and then every now and then you might decide, for example, to, like, deep dive into a Yes.

Speaker 0

改动?

A change?

Speaker 1

当然。

Totally.

Speaker 1

就拿USB设备ID来说吧,它们都挂在一个驱动上,所以没问题。

I mean, for USB device IDs, it's like, okay, yeah, well, they're all attached to the same driver.

Speaker 1

是的

Yeah.

Speaker 1

这些都很常见。

These are common.

Speaker 1

它们可不简单。

They're nothing simple.

Speaker 1

有时候会更复杂一点。

Sometimes they're a little more complex.

Speaker 1

我不会从太多不同地方拉代码,但会从一些我信得过的仓库里取。

I don't pull from a lot of different trees, but I pull from some that I trust.

Speaker 0

对

Mhmm.

Speaker 1

对于一些我不太放心的子系统,我会让你发邮件通知他们。

Some subsystems that I don't necessarily trust as well, I will make you send them an email.

Speaker 1

是的

Yeah.

Speaker 1

我会仔细审阅这些内容,反复检查,最后再签上我的确认意见。

And I'll actually review them, and then I'll review them, and then when I review them, I add my signed off by to it.

Speaker 0

我想,信任这部分就体现在这儿了。

And and I I guess part of trust will be here.

Speaker 0

我直接假设,因为你和约安很熟,又一起工作了这么久,约安偶尔也会跟你说:‘格雷格,有个改动你得再看看。’

I'm just gonna assume that since you and Johan know each other well and you work for a while, Johan will probably also, every now and then, give a comment saying, hey, Greg.

Speaker 0

就是这个改动。

There's this change.

Speaker 0

你能不能再仔细看看这个东西之类的?

Can you take an extra look on on this thing, etcetera?

Speaker 1

是的。

Yeah.

Speaker 1

有时候约安会直接改代码。

So sometimes Johan makes changes to the code himself.

Speaker 1

对。

Mhmm.

Speaker 1

或者我自己直接改代码。

Or I make changes to the code myself.

Speaker 1

然后提交出去让人审一下。

I put it out for review.

Speaker 1

对。

Mhmm.

Speaker 1

我也会让别人帮我审查我的改动。

And I have other people review my changes.

Speaker 0

所以,跟你讲讲人与人之间、维护者之间的信任,对高效开发有多重要,这事儿真让我觉得特别有意思。

So This is just fascinating for me to tell you, explain how trust between people, maintainers, is so important for efficient development?

Speaker 1

是的。

Yeah.

Speaker 1

全靠内在的默契,没错。

It's all, it's inner, yeah.

Speaker 1

还有人曾经跟我说,参与Linux开发是他做过最吓人的事——不是因为代码多难,而是因为改完之后,名字就挂上去了,而且是公开的。

It's, and then also the trust is, somebody once told me that Linux development was the scariest thing they ever did, because not because it was, like, difficult or whatnot, but it's because my name is on this change and it's public.

Speaker 1

这会让你作为一名工程师,做出特别特别棒的工作。

That's makes you, as an engineer, do really, really good work.

Speaker 1

对。

Mhmm.

Speaker 1

我的意思是,那个说这话的人,看到这个补丁后立马回头重看,心想:等等。

I mean, so much for so that this person who said this patch went back and looked at it instantly and said, oh, wait.

Speaker 1

这个注释其实还能再改进一点。

The comment could be made a little bit better.

Speaker 1

然后他们就说:哦,对啊。

And they're like, oh yeah.

Speaker 1

这在一般公司里可不常见,你懂的,正常情况根本不是这样的。

So, I mean, that's not a normal development process in a company that like you meant to No.

Speaker 0

这让我开始想一些我以前觉得理所当然的事。

It makes me, you know, wonder about a few things that I kind of took for granted.

Speaker 0

比如说,是不是因为闭源软件外面的人看不到内部怎么做的,所以大家也就没那么大动力去追求极致的质量?

For example, you know, could like, this mean that, you know, closed source software where the outside world does not know how it's done, maybe there's just a bit less incentive to do, you know, like such great work.

Speaker 0

这其实只是一种反思。

And actually it's just a reflection.

Speaker 0

我记得以前在公司的时候,我们团队开源了一个自己开发的组件。

Like I do remember when I worked at a company and when we, actually my team, we open sourced a component that we built.

Speaker 0

那时候我特别用心,花了很多功夫去打磨,不仅界面要好看,代码还得干净利落。

And I just remember how I put in way more work into that to make it look good, have the document, not just look good, but to make it clean.

Speaker 0

在发布之前,我们甚至把一堆技术债务都清理掉了。

We cleaned up actual tech debt before we published it.

Speaker 0

但对我们自己的内部代码,就没这么讲究了。

And we didn't do that with our stuff.

Speaker 0

那时候就是……

It was

Speaker 1

开源开发,光是来自外界的期待和压力,就能让工程品质提升不少。

So open source development by virtue of just human pressure makes a better engineering product.

Speaker 1

这种开发模式确实能造出更好的软件,这么多年我们已经看得清清楚楚了。

It's a better engineering and we've kind of shown that through the years that this development model creates a better software.

Speaker 0

你看,我其实是在重新思考一些事,不是什么假设吧,但我真没这么想过,现在看到这样,简直太棒了。

See, I'm I'm kinda revisiting some of my like, not assumptions, but I I never thought of it like this, but it's it's just it's awesome to to see this.

Speaker 0

那之后呢?Yohan 把这个发给我之后,接下来会发生什么?

So so then what what what happens next after after Yohan sends this to sends it to me,

Speaker 1

然后我拿过来,放进我的代码树里。

and then I take it, and I put it in my tree.

Speaker 1

我记得我还跟他说过,我收下了。

I think I send I sent him saying I took it.

Speaker 0

然后如果——

And then and then if

Speaker 1

你要是收了,

you take

Speaker 0

那你就要负责了。

it if you take it, you're responsible.

Speaker 0

对吧?

Right?

Speaker 1

我把它拉来拉去的。

I pulled it and pushed it about.

Speaker 1

对。

Yes.

Speaker 1

没错。

Yep.

Speaker 1

我那儿还有封邮件,上面写着这事。

And there's my email that says that.

Speaker 1

所以现在这事儿归我管了。

So now I'm responsible.

Speaker 1

它现在在我这儿了。

It's in my tree.

Speaker 1

是的。

Yeah.

Speaker 1

既然这是设备ID,随时都可以转给林纳斯。

So now the since this is a device ID, these can go to Linus at any time.

Speaker 1

我们可以加上补丁或者新的设备ID。

We can add bug fixes or new device IDs.

Speaker 1

这些都没问题。

These are true.

Speaker 1

是的。

Yeah.

Speaker 1

过了几天,我就把这批改动发给了Linus。

So then a few days later, I send this change off to Linus.

Speaker 1

我就把改动发给Linus了。

So I send Linus.

Speaker 1

我跟Linus说:嘿,Linus,

I said, hey, Linus.

Speaker 1

把这些改动全收了吧,还有这一大堆USB的修复补丁。

Take all these following changes, these changes, and here's a whole bunch of USB fixes.

Speaker 1

对。

Mhmm.

关于 Bayt 播客

Bayt 提供中文+原文双语音频和字幕,帮助你打破语言障碍,轻松听懂全球优质播客。

继续浏览更多播客