泰晓科技 -- 聚焦 Linux - 追本溯源,见微知著!
网站地址:https://tinylab.org

基于泰晓RISC-V实验箱的Linux公开课
请稍侯

泰晓资讯·11 月 / 第二期 / 2023

unicornx 创作于 2023/11/09

“泰晓资讯”,广泛报道 “Linux/开源” 业界资讯。欢迎广大读者投递相关资讯来源和素材,本站将进一步收集整理后发布给大家。

Linux 内核最新消息

本周是 5.7 merge windows,这周日估计 6.7-rc1 会如期发布。本周资讯继续介绍内核中的新进展。

https://www.kernel.org/ updated by 2023/11/08

分支类型版本发布时间
mainline6.62023-10-30
stable6.6.12023-11-08
stable6.5.112023-11-08
longterm6.1.622023-11-08
longterm5.15.1382023-11-08
longterm5.10.2002023-11-08
longterm5.4.2602023-11-08
longterm4.19.2982023-11-08
longterm4.14.3292023-11-08
linux-nextnext-202311082023-11-08

关键词: Linux

Linux 6.7 引入了 “make hardening.config” 来帮助构建加固内核

The hardening updates for the Linux 6.7 kernel bring a new hardening configuration profile to help in building a security hardened kernel with some sane defaults.

Linux 6.7 内核在 “加固(hardening)” 方面的更新为配置文件增加了新的选项,以帮助构建具有一些合理默认值的安全强化内核。

这部分更新在 Kconfig 中增加了一些代码,其中包含启用了一些的基本的 hardening 选项。运行 make hardening.config` 可开启建议的 hardening 选项。

Linux 内核构建的这些选项相当于开启了一组基本的和内核加固有关的选项,这些选项对性能的影响最小(或没有),并删除了一部分旧的 API

这些 hardening 选项包括

  • basic kernel memory permission enforcement
  • address space layout randomization
  • randomizing allocator freelists
  • hardening metadata
  • randomizing the kernel stack offset on syscall entry
  • basic frame overflow protection
  • basic buffer length bounds checking
  • basic array index bounds checking
  • linked list integrity checking
  • not allowing direct physical memory access to non-device memory
  • disabling user-space VDSO ASLR
  • only enabling the modern PTY interface
  • 以及启用许多其他安全可调参数和一些特定于架构的选项。

总的来说,改配置选项列出了各种推荐的默认值,同时又不影响性能。大多数 Linux 发行版供应商内核都已经启用了大部分或全部这些选项,这个工作对于那些希望自己构建 Linux 内核的人来说很友好。

新闻出处,“Linux 6.7 Introduces “make hardening.config” To Help Build A Hardened Kernel”: https://www.phoronix.com/news/Linux-6.7-Hardening

关键词: Linux, Security

Linux 6.7 中和调度相关的改进

Linux 6.6 saw EEVDF merged and Intel hybrid cluster scheduling re-introduced. The core scheduler improvements merged this past week for the in-development Linux 6.7 isn’t quite as exciting but still there are some healthy scheduler improvements this round.

Linux 6.6 中加入了 EEVDF,并重新引入了 Intel 混合集群调度。正在开发中的 Linux 6.7 也合并了一些和调度器相关的改进,虽然和 6.6 中的改动比起来并不那么令人兴奋,但这一轮仍然有一些有益的调度器方面的改进。

Ingo Molnar 在 Linux 6.7 合并窗口开启时提交的 PR 中包括了针对公平调度器的改进、NUMA 调度改进、能源调度改进、实时 (RT) 调度改进、调度器可扩展性改进和核心调度器基础设施工作。这一轮并不像 Linux 6.6 中引入的主要项目那样令人兴奋,但总的来说,本周合并了许多底层的调度增强功能。

值得关注的改动包括:作为集群调度程序(cluster scheduler)的一部分,在 wake-up 相关的代码执行中,在扫描最后一级缓存之前会增加扫描 cluster,这个改动应该有利于某些 ARM64 平台的设备;此外,譬如:来自 Linutronix 的几个 NUMA 调度程序方面的修复;当 CPU 离线时,在 x86 上禁用 Intel 的 Indirect Branch Restricted Speculation(简称 IBRS),这会提高单线程的性能;少量针对 PSI 代码的优化;以及各种调试增强功能。

新闻出处,“Linux 6.7 Boasts Some Scheduler Improvements & Intel IBRS Mitigation Change”: https://www.phoronix.com/news/Linux-6.7-Scheduler

关键词: Linux, Scheduler

Linux 6.7 删除了对 Intel Itanium IA-64 的支持

Overnight the mainline Linux kernel has retired support for Intel Itanium (IA-64) processors.

6.7 merge window 期间我们发现主线 Linux 内核已经删除了对 Intel Itanium (IA-64) 处理器的支持。

近年来,Linux 内核对 Itanium 的支持已经不再活跃,没有多少用户在老旧的 Itanium 服务器上测试新内核。也没有任何主要的活跃贡献者对 Itanium 代码进行维护并对架构代码进行任何重大改进。几个月来,人们一直在谈论从 Linux 内核中淘汰 Itanium,现在它终于发生了。

由于 Linux 6.6 有望成为今年的长期支持 (LTS) 内核版本,最近有人提议在 Linux 6.7 中删除 Itanium,目前看来确实成功实现了。和 Itanium 有关的大约有 65k 行代码已被删除。如果你仍然拥有 IA-64 硬件,那么估计最新的内核将截止到 6.6 LTS。

最新的 Itanium 处理器是 2017 年发布的 Itanium 9700 “Kitson” 处理器,采用 32nm 工艺,与 2012 年发布的 Itanium 9500 “Poulson” 处理器非常相似。虽然在 Itanium 的早期,人们希望它最终会取代 x86/x86_64,但随着 x86_64 的成功,这从未成为现实。我们和 Itanium 说再见吧!

新闻出处,“Intel Itanium IA-64 Support Removed With The Linux 6.7 Kernel”: https://www.phoronix.com/news/Intel-IA-64-Removed-Linux-6.7

关键词: Linux, Itanium

Linux 6.7 中继续对 printk 改进线程化处理

One of the last major blockers before the remaining real-time “PREEMPT_RT” patches can be upstreamed is sorting out threaded / atomic console printing. With the in-development Linux 6.7 kernel, there’s been more work upstreamed in that endeavor.

要实现实时 “PREEMPT_RT” 补丁完全进入上游主线,最后一个主要障碍之一是有关控制台打印的线程化和原子控制。随着 Linux 6.7 内核的开发,这项工作中又有更多的进展。

Linux 6.7 中现在正在引入为每个控制台实现一把锁,为 printk kthread 处理做进一步的准备。参考最近一个有关 printk 的 PR 中的描述,原文如下:

Another preparation step for introducing printk kthreads. The main piece is a per-console lock with several features:

  • Support three priorities: normal, emergency, and panic. They will be defined by a context where the lock is taken. A context with a higher priority is allowed to take over the lock from a context with a lower one.

The plan is to use the emergency context for Oops and WARN() messages, and also by watchdogs.

The panic() context will be used on panic CPU.

  • The owner might enter/exit regions where it is not safe to take over the lock. It allows the take over the lock a safe way in the middle of a message.

For example, serial drivers emit characters one by one. And the serial port is in a safe state in between.

Only the final console_flush_in_panic() will be allowed to take over the lock even in the unsafe state (last chance, pray, and hope).

  • A higher priority context might busy wait with a timeout. The current owner is informed about the waiter and releases the lock on exit from the unsafe state.

  • The new lock is safe even in atomic contexts, including NMI.

Another change is a safe manipulation of per-console sequence number counter under the new lock.

也许在 v6.8 开发周期中,我们会看到剩余的有关 printk 线程化工作完成,幸运的化,我们或许会同时看到 PREEMPT_RT 代码被最终完成。无论如何,实时内核补丁并没有在 2023 年进入上游,但希望它不会被耽搁太久,或许在 2024 年我们最终会看到这个长期追求的目标被实现。就目前而言,仍有数十个 RT 补丁在树外维护。

新闻出处,“Linux 6.7 Continues Work On printk Threaded Printing”: https://www.phoronix.com/news/Linux-6.7-printk

关键词: Linux, printk

Linux 6.7 中有关 KVM 的改进

The Kernel-based Virtual Machine (KVM) changes were sent out on Thursday for the Linux 6.7 merge window.

上周四,针对 Kernel-based Virtual Machine(KVM) 的更改已提交给 6.7。本次 KVM 更新包括 LoongArch 虚拟化支持,以及允许配置更高的 x86 vCPU 限制。

  • 对 LoongArch 的支持现在可用于 KVM 虚拟化。对 LoongArch 的虚拟化支持与 MIPS 非常相似。LoongArch 硬件使用与 x86 / s390 / RISC-V 相同的模型。
  • x86 上的 KVM 添加了 CONFIG_KVM_MAX_NR_VCPUS,最大值允许处理多达 4096 个 vCPU,同时允许较低的默认值,以避免额外的内存开销。默认值为 1024 个 vCPU。
  • 对 AMD Inception/SRSO 问题的修复。
  • KVM x86 安全加密虚拟化 (SEV) 修复。
  • RISC-V 上的 KVM 现在支持 Smstateen 和 Zicond 扩展。
  • ARM 上的 KVM 增加了对内存操作指令的 guest 支持和各种其他改进。
  • 各种其他清理和修复。

新闻出处,“KVM Virtualization With Linux 6.7 Adds LoongArch, Up To 4096 x86 vCPUs”: https://www.phoronix.com/news/Linux-6.7-KVM

关键词: Linux, KVM

一个新的 RFC 补丁可能深刻改变 Linux 内核的抢占模型

Ankur Arora of Oracle on Tuesday sent out a set of 86 patches for making the Linux kernel preemptible. This is based on earlier work by prominent Linux kernel engineer Thomas Gleixner.

来自 Oracle 的 Ankur Arora 本周二发布了一套包含 86 个补丁的补丁集,改动涉及 Linux 的内核抢占。该项工作基于著名的 Linux 内核工程师 Thomas Gleixner 的一些早期工作。

Arora 在他的 RFC 中解释了这个补丁中涉及 Linux 内核抢占的设计原因和思路,比较专业,原文如下供大家参考。大致的意思是希望将现有抢占模式中的 voluntary 和 full 两种方式合并起来,更加发挥内核调度器的主动性,而不是被动地依赖任务侧主动放弃处理器。

We have two models of preemption: voluntary and full (and RT which is a fuller form of full preemption.) In this series – which is based on Thomas’ PoC, we try to unify the two by letting the scheduler enforce policy for the voluntary preemption models as well.

(Note that this is about preemption when executing in the kernel. Userspace is always preemptible.)

Background

Why?: both of these preemption mechanisms are almost entirely disjoint. There are four main sets of preemption points in the kernel:

  1. return to user
  2. explicit preemption points (cond_resched() and its ilk)
  3. return to kernel (tick/IPI/irq at irqexit)
  4. end of non-preemptible sections at (preempt_count() == preempt_offset)

Voluntary preemption uses mechanisms 1 and 2. Full preemption uses 1, 3 and 4. In addition both use cond_resched_{rcu,lock,rwlock*} which can be all things to all people because they internally contain 2, and 4.

Now since there’s no ideal placement of explicit preemption points, they tend to be randomly spread over code and accumulate over time, as they are are added when latency problems are seen. Plus fear of regressions makes them difficult to remove. (Presumably, asymptotically they would spead out evenly across the instruction stream!)

In voluntary models, the scheduler’s job is to match the demand side of preemption points (a task that needs to be scheduled) with the supply side (a task which calls cond_resched().)

Full preemption models track preemption count so the scheduler can always knows if it is safe to preempt and can drive preemption itself (ex. via dynamic preemption points in 3.)

Design

As Thomas outlines, to unify the preemption models we want to: always have the preempt_count enabled and allow the scheduler to drive preemption policy based on the model in effect.

在应用该组补丁后,系统可以正常启动,性能 “非常接近” Linux 6.6 基线。但是现在有一些有待补充完整的部分,比如针对 x86 以外的其他架构,内核的 livepatching 机制和对其他功能的影响。

新闻出处,“New Set Of 86 Patches Overhaul The Linux Kernel’s Preemption Model”: https://www.phoronix.com/news/Overhaul-Linux-Preemptible-RFC

关键词: Linux, Preemption

联系我们

欢迎扫描二维码加微信联系我们:

tinylab wechat



Read Album:

Read Related:

Read Latest: