What happens to kernel staging-tree code
By Jonathan Corbet
staging tree是2008年在2.6.28版本开发周期中加到kernel里的,目的是希望能帮助那些尚未标准化的驱动程序逐步完善并合入mainline( kernel主线)。这么多年来它一直存在争议。最新的关于EROFS和exFAT文件系统的争论,再一次引起大家讨论这个staging tree具体是不是真的对kernel社区有价值。LWN也无法回答这个问题,不过我们可以分析一下过去11年里加入staging tree的东西来看看是否能有一些结论。
staging tree的主要特点是它对加入的代码持有更开放的态度,不用参照通常合入kernel代码时所需要的严格标准。如果某个驱动程序加入staging tree了,任何人只要胆子够大就可以直接试用。不过它其实更深层次的目标是让开发者能继续改进代码从而最终以更正式的方式合入kernel合适的位置。新加入的开发者可以在这里试一些简单的改动,如果效果不错,Linux就能得以支持这种新的硬件设备。没有staging tree的话,这些试验性的东西可能就永远无法合入kernel了。
有些人并不赞同这种工作方式(先把代码放进kernel再改善)。以exFAT为例,其实很多开发者都认为如果把它合入staging tree的话,它自己改善的速度可能还不如拒绝合入。正如Dave Chinner所说:“这类改动在mailing list上会更容易完善以及进行review。并不需要把这个代码合入staging tree。其实如果真把它先合入了,那么后续很难进行架构改动,因为它只能慢慢的随着kernel开发周期来慢慢迭代。”
Greg Kroah-Hartman是staging tree的maintainer(维护者),他的回复指出合入代码能够给各位开发者一个很好的平台来进行合作。他也承认可能会让开发进程变慢一些,不过他认为这个代价很值得,尤其适合有很多人需要配合来改进这部分代码的情况。
LWN编辑发现其实没有人真正审查过去11年曾经进入过staging tree的这些模块。于是我简单写了脚本以及对Git进行各种查找,拿到了不少数据,展示了每个模块进入staging tree还有从中删除的时间。然后进行大量的人工分析,来调查每个模块离开staging tree的原因。现在终于昨晚了,结果如下。
Graduations (特指从staging tree毕业进入正常kernel代码库)
统计中有247个模块进入了staging tree。其中有52个“毕业”了,占总数的21%,包括:
Module | Entry | Exit | Releases | Fate |
---|---|---|---|---|
altera-stapl | v3.0 | v3.2 | 3 | Graduated |
ath6kl | v2.6.37 | v3.2 | 5 | Graduated |
batman-adv | v2.6.33 | v2.6.38 | 6 | Graduated |
brcm80211 | v2.6.37 | v3.2 | 5 | Graduated |
ccree | v4.12 | v4.17 | 6 | Graduated |
cx25821 | v2.6.32 | v3.2 | 10 | Graduated |
dwc2 | v3.10 | v3.14 | 5 | Graduated |
echo | v2.6.28 | v3.15 | 27 | Graduated |
et131x | v2.6.28 | v3.18 | 30 | Graduated |
fsl-mc | v4.1 | v4.19 | 19 | Graduated |
gma500 | v3.0 | v3.3 | 4 | Graduated |
hv | v2.6.32 | v3.4 | 12 | Graduated |
iio/dac | v2.6.38 | v3.6 | 8 | Graduated |
iio/imu | v2.6.35 | v3.9 | 14 | Graduated |
iio/light | v2.6.32 | v4.18 | 46 | Graduated |
iio/magnetometer | v2.6.35 | v4.6 | 31 | Graduated |
imx-drm | v3.7 | v3.19 | 13 | Graduated |
ipack | v3.5 | v3.8 | 4 | Graduated |
line6 | v2.6.30 | v4.0 | 30 | Graduated |
media/as102 | v3.2 | v3.18 | 17 | Graduated |
media/cec | v4.8 | v4.10 | 3 | Graduated |
media/cxd2099 | v3.2 | v4.17 | 36 | Graduated |
media/dt3155v4l | v2.6.35 | v4.2 | 27 | Graduated |
media/go7007 | v2.6.28 | v3.17 | 29 | Graduated |
media/mn88472 | v3.19 | v4.8 | 10 | Graduated |
media/mn88473 | v3.19 | v4.6 | 8 | Graduated |
media/msi3101 | v3.12 | v3.17 | 6 | Graduated |
media/pulse8-cec | v4.8 | v4.10 | 3 | Graduated |
media/rtl2832u_sdr | v3.15 | v3.17 | 3 | Graduated |
media/s5p-cec | v4.8 | v4.12 | 5 | Graduated |
media/solo6x10 | v2.6.36 | v3.17 | 21 | Graduated |
media/st-cec | v4.9 | v4.12 | 4 | Graduated |
mei | v3.0 | v3.5 | 6 | Graduated |
mrst-touchscreen | v2.6.35 | v2.6.37 | 3 | Graduated |
mt7621-gpio | v4.17 | v4.19 | 3 | Graduated |
mt7621-spi | v4.17 | v5.2 | 7 | Graduated |
omapdrm | v3.3 | v3.9 | 7 | Graduated |
panel | v2.6.29 | v4.6 | 37 | Graduated |
rar_register | v2.6.32 | v2.6.36 | 5 | Graduated |
rdma/hfi1 | v4.3 | v4.7 | 5 | Graduated |
samsung-laptop | v2.6.33 | v3.0 | 7 | Graduated |
sm7xxfb | v2.6.33 | v4.3 | 31 | Graduated |
ti-soc-thermal | v3.6 | v3.11 | 6 | Graduated |
ti-st | v2.6.35 | v3.0 | 5 | Graduated |
tm6000 | v2.6.35 | v3.2 | 7 | Graduated |
typec | v4.12 | v4.19 | 8 | Graduated |
udlfb | v2.6.31 | v2.6.38 | 8 | Graduated |
usbip | v2.6.28 | v3.17 | 29 | Graduated |
vboxvideo | v4.13 | v5.2 | 11 | Graduated |
xillybus | v3.12 | v3.18 | 7 | Graduated |
zram | v2.6.33 | v3.14 | 21 | Graduated |
zsmalloc | v3.4 | v3.14 | 11 | Graduated |
(注:releases列包括了把这个模块从staging tree中拿掉的那个release版本,因为这个动作属于那次release cycle)。
有些模块比其他的更快的毕业了。例如altera-stapl驱动,经过3此发布周期就毕业了。相对应的,industrial I/O light模块则经过了46个发布周期,将近9年的时间。不管它们都经历了多长时间吧,每个模块都在不断改善之后得到了相应子系统维护者的接受。
这里成功率才21%,看起来并不高。不过这种看法并不全面。大量staging tree中的驱动程序最终都被删掉了,因为mainline里面有其他的驱动程序实现了它的功能。这类被替代的模块是:
Module | Entry | Exit | Releases | Fate |
---|---|---|---|---|
adis16255 | v2.6.35 | v2.6.38 | 4 | Superseded |
android/switch | v3.3 | v3.5 | 3 | Superseded |
at76_usb | v2.6.28 | v2.6.32 | 5 | Superseded |
cpc-usb | v2.6.31 | v2.6.32 | 2 | Superseded |
cptm1217 | v2.6.38 | v4.0 | 22 | Superseded |
cs5535_gpio | v2.6.38 | v3.1 | 3 | Superseded |
dt3155 | v2.6.34 | v2.6.36 | 3 | Superseded |
me4000 | v2.6.28 | v2.6.32 | 5 | Superseded |
media/easycap | v2.6.36 | v3.7 | 11 | Superseded |
media/tw686x-kh | v4.7 | v4.9 | 3 | Superseded |
meilhaus | v2.6.29 | v2.6.32 | 4 | Superseded |
mimio | v2.6.29 | v2.6.34 | 6 | Superseded |
msm | v2.6.35 | v3.1 | 6 | Superseded |
mt29f_spinand | v3.13 | v5.0 | 29 | Superseded |
mt7621-eth | v4.17 | v5.1 | 6 | Superseded |
otus | v2.6.29 | v2.6.37 | 9 | Superseded |
pata_rdc | v2.6.31 | v2.6.32 | 2 | Superseded |
quatech_usb2 | v2.6.32 | v3.5 | 13 | Superseded |
rt2860 | v2.6.29 | v3.0 | 11 | Superseded |
rt2870 | v2.6.29 | v3.0 | 11 | Superseded |
rt3070 | v2.6.30 | v2.6.36 | 7 | Superseded |
rt3090 | v2.6.32 | v2.6.34 | 3 | Superseded |
rtl8187se | v2.6.29 | v3.15 | 26 | Superseded |
rtl8192ee | v3.16 | v3.18 | 3 | Superseded |
rtl8192su | v2.6.31 | v2.6.37 | 7 | Superseded |
rtl8723au | v3.15 | v4.9 | 15 | Superseded |
rtl8821ae | v3.14 | v3.18 | 5 | Superseded |
rtlwifi | v4.14 | v5.2 | 10 | Superseded |
rts5139 | v3.2 | v3.16 | 15 | Superseded |
rts_pstor | v3.0 | v3.8 | 9 | Superseded |
serqt_usb | v2.6.30 | v2.6.31 | 2 | Superseded |
slicoss | v2.6.28 | v4.10 | 42 | Superseded |
ste_rmi4 | v2.6.38 | v4.6 | 28 | Superseded |
stlc45xx | v2.6.30 | v2.6.32 | 3 | Superseded |
uc2322 | v2.6.30 | v2.6.31 | 2 | Superseded |
usbvideo | v2.6.38 | v3.0 | 2 | Superseded |
zcache | v3.0 | v3.12 | 13 | Superseded |
所以有37个驱动程序有替代模块合入了mainline,占比15%,当然它们每个都有不同的情况,各有成败。有些staging的驱动太难看了,所以激发了其他开发者的完美主义情结,从头写了一个更好的驱动提交上去,这种情况下我们可以认为这个staging驱动也是成功的,毕竟达成了它的目标。另外一种情况下是相应的硬件供应商提供了官方驱动,例如很多Realtek驱动都是这么来的。还有一类情况是staging驱动提供了很多信息,帮助其他人写出了更好的驱动,这也是有价值的。
上述的驱动程序最终都在某种意义上进入了mainline。虽然很难估计把各个驱动放到staging tree究竟有多大帮助,不过最终能支持这类硬件,应该就是社区的成功了。
Failures
还有很多驱动最终就从staging tree里删除了,相应的功能也就不再存在了。
Module | Entry | Exit | Releases | Fate |
---|---|---|---|---|
agnx | v2.6.29 | v2.6.32 | 4 | Failed |
altpciechdma | v2.6.29 | v2.6.34 | 6 | Failed |
arlan | v2.6.33 | v2.6.35 | 3 | Failed |
asus_oled | v2.6.29 | v3.12 | 23 | Failed |
b3dfg | v2.6.30 | v2.6.34 | 5 | Failed |
bcm | v2.6.37 | v3.19 | 22 | Failed |
btmtk_usb | v3.11 | v3.14 | 4 | Failed |
ccg | v3.5 | v3.10 | 6 | Failed |
ced1401 | v3.7 | v3.17 | 11 | Failed |
crystalhd | v2.6.34 | v3.17 | 23 | Failed |
csr | v3.6 | v3.11 | 6 | Failed |
cxt1e1 | v2.6.35 | v3.17 | 22 | Failed |
dabusb | v2.6.38 | v3.0 | 2 | Failed |
dgap | v3.12 | v4.6 | 15 | Failed |
dgnc | v3.12 | v4.20 | 29 | Failed |
dgrp | v3.7 | v3.17 | 11 | Failed |
dream | v2.6.32 | v2.6.37 | 6 | Failed |
dst | v2.6.30 | v2.6.33 | 4 | Failed |
epl | v2.6.29 | v2.6.32 | 4 | Failed |
frontier | v2.6.29 | v3.17 | 28 | Failed |
ft1000 | v2.6.37 | v4.4 | 27 | Failed |
gdm72xx | v3.5 | v4.6 | 22 | Failed |
heci | v2.6.30 | v2.6.32 | 3 | Failed |
i2o | v4.0 | v4.2 | 3 | Failed |
i4l | v4.6 | v4.11 | 6 | Failed |
iio/gyro | v2.6.35 | v4.19 | 44 | Failed |
iio/trigger | v2.6.32 | v4.17 | 45 | Failed |
intel_sst | v2.6.37 | v3.3 | 6 | Failed |
keucr | v2.6.37 | v3.17 | 20 | Failed |
lttng | v2.6.33 | v2.6.33 | 1 | Failed |
lustre | v3.11 | v4.18 | 28 | Failed |
media/atomisp | v4.12 | v4.18 | 7 | Failed |
memrar | v2.6.35 | v3.0 | 5 | Failed |
mt7621-mmc | v4.17 | v5.2 | 7 | Failed |
net | v3.5 | v3.10 | 6 | Failed |
netwave | v2.6.33 | v2.6.35 | 3 | Failed |
nokia_h4p | v3.15 | v3.18 | 4 | Failed |
ozwpan | v3.4 | v4.3 | 20 | Failed |
p9auth | v2.6.30 | v2.6.34 | 5 | Failed |
phison | v2.6.30 | v3.17 | 27 | Failed |
poch | v2.6.28 | v2.6.35 | 8 | Failed |
pohmelfs | v2.6.30 | v3.3 | 13 | Failed |
quickstart | v2.6.36 | v3.17 | 21 | Failed |
rspiusb | v2.6.29 | v2.6.32 | 4 | Failed |
sb105x | v3.8 | v3.15 | 8 | Failed |
sbe-2t3e3 | v2.6.37 | v3.16 | 19 | Failed |
sep | v2.6.38 | v3.17 | 19 | Failed |
serqt_usb2 | v2.6.31 | v3.17 | 26 | Failed |
silicom | v3.7 | v3.17 | 11 | Failed |
skein | v3.16 | v4.19 | 24 | Failed |
spectra | v2.6.36 | v3.3 | 7 | Failed |
strip | v2.6.33 | v2.6.35 | 3 | Failed |
sxg | v2.6.28 | v2.6.32 | 5 | Failed |
tidspbridge | v2.6.36 | v3.17 | 21 | Failed |
wavelan | v2.6.33 | v2.6.35 | 3 | Failed |
westbridge | v2.6.37 | v3.1 | 4 | Failed |
winbond | v2.6.28 | v3.17 | 29 | Failed |
wlags49_h2 | v2.6.33 | v3.17 | 24 | Failed |
wlags49_h25 | v2.6.33 | v3.17 | 24 | Failed |
xgifb | v2.6.35 | v5.1 | 47 | Failed |
这里有60个模块,占比24%。绝大多数最后一个commit都是说“很久没人继续开发这个模块了,该放弃了”。其中有的是支持了从未量产的硬件,或者是某些太古老没人用了的硬件导致没法继续开发。有些情况,例如LTTng tracing模块,这个代码基本上马上就被拿掉了,因为开发者不赞成放入staging tree。还有至少一例是因为license问题拿掉的。
无论如何,上述每个模块都代表了一段没能最终孵化出成果的工作。staging tree不可能把100%的模块都最终放入mainline,至于这24%的失败率算不算高,大家就见仁见智吧。
Staging out
2008年设立staging tree的时候,起始并没有想到它还会成为某些开发者希望拿掉的代码的最终栖息地。现在,如果看起来没人在用的驱动程序,就会被放到staging tree里,过几个版本之后,如果没有人抱怨,就会彻底删除。如下驱动都是这样离开kernel代码的:
Module | Entry | Exit | Releases | Fate |
---|---|---|---|---|
autofs | v2.6.37 | v3.0 | 3 | Staged out |
cpia | v2.6.37 | v2.6.38 | 2 | Staged out |
generic_serial | v3.0 | v3.1 | 2 | Staged out |
ipx | v4.16 | v4.18 | 3 | Staged out |
irda | v4.14 | v4.17 | 4 | Staged out |
media/lirc | v2.6.36 | v4.16 | 40 | Staged out |
media/mx2 | v4.6 | v4.8 | 3 | Staged out |
media/mx3 | v4.6 | v4.8 | 3 | Staged out |
media/omap1 | v4.6 | v4.8 | 3 | Staged out |
media/omap24xx | v3.14 | v3.19 | 6 | Staged out |
media/parport | v3.19 | v4.0 | 2 | Staged out |
media/sn9c102 | v3.14 | v3.17 | 4 | Staged out |
media/soc_camera | v5.1 | — | 3 | Staging out |
media/timb | v4.6 | v4.8 | 3 | Staged out |
media/tlg2300 | v3.19 | v4.0 | 2 | Staged out |
media/vino | v3.19 | v4.0 | 2 | Staged out |
media/zoran | v4.18 | v5.2 | 6 | Staged out |
ncpfs | v4.16 | v4.18 | 3 | Staged out |
rdma/amso1100 | v4.3 | v4.5 | 3 | Staged out |
rdma/ehca | v4.3 | v4.5 | 3 | Staged out |
rdma/ipath | v4.3 | v4.5 | 3 | Staged out |
se401 | v2.6.38 | v3.0 | 2 | Staged out |
serial | v3.2 | v3.5 | 4 | Staged out |
smbfs | v2.6.37 | v3.0 | 3 | Staged out |
stradis | v2.6.37 | v2.6.38 | 2 | Staged out |
telephony | v3.4 | v3.8 | 5 | Staged out |
tty | v3.0 | v3.1 | 2 | Staged out |
这27个模块,占比11%,都是来自kernel正式代码并最终惨遭删除的。删除不再需要的代码,肯定是件好事啊,所以这应该算是staging tree做的好事情。不过可惜只有很少数模块是这么stage out的。kernel里还有众多驱动其实也没有在用了,仍然保留在原位。
Hangers-on
最后一类,就是目前在5.3-rc7 kernel里面仍然保留在staging tree的模块了:
Module | Entry | Exit | Releases | Fate |
---|---|---|---|---|
android/ion | v3.14 | — | 31 | |
android/uapi | v3.14 | — | 31 | |
axis-fifo | v4.19 | — | 6 | |
bcm2835-audio | v4.11 | — | 11 | (now in vc04_services) |
board | v3.17 | — | 28 | |
clocking-wizard | v3.19 | — | 26 | |
comedi | v2.6.29 | — | 55 | |
emxx_udc | v3.17 | — | 28 | |
erofs | v4.19 | — | 6 | |
fbtft | v4.0 | — | 25 | |
fieldbus | v5.2 | — | 2 | |
fsl-dpaa2 | v4.12 | — | 13 | |
fwserial | v3.8 | — | 37 | |
gasket | v4.19 | — | 6 | |
gdm724x | v3.12 | — | 33 | |
goldfish | v3.9 | — | 36 | |
greybus | v4.9 | — | 16 | |
gs_fpgaboot | v3.15 | — | 30 | |
iio | v2.6.32 | — | 52 | |
iio/accel | v2.6.32 | — | 52 | |
iio/adc | v2.6.32 | — | 52 | |
iio/addac | v2.6.38 | — | 46 | |
iio/cdc | v3.2 | — | 43 | |
iio/frequency | v2.6.38 | — | 46 | |
iio/impedance-analyzer | v3.2 | — | 43 | |
iio/meter | v2.6.38 | — | 46 | |
iio/resolver | v2.6.38 | — | 46 | |
isdn | v5.3 | — | 1 | |
kpc2000 | v5.2 | — | 2 | |
ks7010 | v4.8 | — | 17 | |
media/allegro-dvt | v5.3 | — | 1 | |
media/bcm2048 | v3.14 | — | 31 | |
media/davinci_vpfe | v3.9 | — | 36 | |
media/hantro | v5.0 | — | 4 | |
media/imx | v4.13 | — | 12 | |
media/imx074 | v4.17 | — | 8 | |
media/ipu3 | v5.0 | — | 4 | |
media/meson | v5.3 | — | 1 | |
media/mt9t031 | v4.17 | — | 8 | |
media/omap4iss | v3.14 | — | 31 | |
media/platform | v4.11 | — | 15 | (now in vc04_services) |
media/sunxi | v4.20 | — | 5 | |
media/tegra-vde | v4.16 | — | 9 | |
most | v4.3 | — | 22 | |
mt7621-dma | v4.17 | — | 8 | |
mt7621-dts | v4.17 | — | 8 | |
mt7621-pci | v4.17 | — | 8 | |
mt7621-pci-phy | v5.1 | — | 3 | |
mt7621-pinctrl | v4.17 | — | 8 | |
netlogic | v3.10 | — | 35 | |
nvec | v3.0 | — | 45 | |
octeon | v2.6.31 | — | 53 | |
octeon-usb | v3.11 | — | 34 | |
olpc_dcon | v2.6.37 | — | 47 | |
pi433 | v4.14 | — | 11 | |
ralink-gdma | v5.1 | — | 3 | |
rtl8188eu | v3.12 | — | 33 | |
rtl8192e | v2.6.32 | — | 52 | |
rtl8192u | v2.6.33 | — | 51 | |
rtl8712 | v2.6.37 | — | 47 | |
rtl8723bs | v4.12 | — | 13 | |
rts5208 | v3.14 | — | 31 | |
sm750fb | v4.1 | — | 24 | |
speakup | v2.6.37 | — | 47 | |
unisys | v3.15 | — | 30 | |
vc04_services | v4.9 | — | 16 | |
vme | v2.6.32 | — | 52 | |
vt6655 | v2.6.31 | — | 53 | |
vt6656 | v2.6.32 | — | 52 | |
wilc1000 | v4.2 | — | 23 | |
wlan-ng | v2.6.28 | — | 56 |
所以在总共247个进入staging的 模块中,有71个仍然存在,占比29%。其中呆了最长时间的是comedi子系统,自从2008年11月加入之后,关于staging tree的全部53512个commit中有8673个都是关于comedi的,占了driver/staging目录下改动commit的16%。还有其他一些模块也在staging tree存在了很长时间,不知道staging tree是不是有年数限制,反正看起来不像是有。
其中有一些应该已经快要毕业了。Kroah-Hartman指出comedi, greybus, speakup都只要再做一点工作就可以毕业了。Greybus驱动应该会合入5.4。其他不少代码其实应该需要删掉的,Greg也说他其实已经有几年没有去清理一遍了。也会有不少代码会继续存在不少时间。
Exit stage right
所以目前的结论是:
Fate | Count | Percent |
---|---|---|
Graduated | 52 | 21% |
Superseded | 37 | 15% |
Failed | 60 | 24% |
Staged out | 27 | 11% |
Still present | 71 | 29% |
虽然没法回答起初的问题“staging tree是否对kernel开发有益处”,毕竟大家都理解通常一件事物都是对某些模块有好处却对其他模块没有好处。不过可以看出的是确实有不少代码都经过staging tree进入了正式kernel,整体上来说也帮助mainline kernel变得更加整洁。无论大家喜欢staging tree与否,它都是kernel开发流程中的一部分了。虽然随着大家对它的评价和压力变化,它的角色会不断改变,不过今后很长时间里面它应该都是kernel开发的一个重要部分。
全文完
LWN文章遵循CC BY-SA 4.0许可协议。
热烈欢迎转载以及基于现有协议修改再创作~
长按下面二维码关注:Linux News搬运工,希望每周的深度文章以及开源社区的各种新近言论,能够让大家满意~
今天的文章LWN: 内核staging目录的驱动们最后下场如何?分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/40151.html