![应用 RT PREEMPT 内核补丁失败](https://linux22.com/image/127125/%E5%BA%94%E7%94%A8%20RT%20PREEMPT%20%E5%86%85%E6%A0%B8%E8%A1%A5%E4%B8%81%E5%A4%B1%E8%B4%A5.png)
我正在尝试为 Linux 内核应用 RT PREEMPT 补丁。正如指南中提到的这和这,你应该这样做:
zcat patch-4.14.15-rt13.patch.gz | patch -p1
(假设您位于包含内核源代码的目录中。)
但我收到很多消息,例如:
The next patch would create the file tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-createremove.tc,
which already exists! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
patching file virt/kvm/arm/arm.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file virt/kvm/arm/arm.c.rej
最终这个过程失败了。我在一个ubuntu:16.04
和一个docker容器中尝试过这个debian:stretch
,结果是一样的。
顺便说一句,我无法与修补过程交互,因为它是 bash 脚本的一部分。
我正在应用补丁Raspberry Pi 的内核源代码顺便提一句。
这里是完整的补丁输出。
我究竟做错了什么?如何正确应用补丁?
其内容virt/kvm/arm/arm.c.rej
为:
--- virt/kvm/arm/arm.c
+++ virt/kvm/arm/arm.c
@@ -650,7 +650,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
* involves poking the GIC, which must be done in a
* non-preemptible context.
*/
- preempt_disable();
+ migrate_disable();
kvm_pmu_flush_hwstate(vcpu);
@@ -687,7 +687,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
kvm_pmu_sync_hwstate(vcpu);
kvm_timer_sync_hwstate(vcpu);
kvm_vgic_sync_hwstate(vcpu);
- preempt_enable();
+ migrate_enable();
continue;
}
@@ -742,7 +742,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
kvm_vgic_sync_hwstate(vcpu);
- preempt_enable();
+ migrate_enable();
ret = handle_exit(vcpu, run, ret);
}
构建后。