From: Greg Kroah-Hartman Date: Sun, 12 Dec 2021 12:20:28 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v4.4.295~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63ee7e5b1843f84b566f0c0acc74e3efbce10e6e;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: kvm-x86-wait-for-ipis-to-be-delivered-when-handling-hyper-v-tlb-flush-hypercall.patch mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch --- diff --git a/queue-5.10/kvm-x86-wait-for-ipis-to-be-delivered-when-handling-hyper-v-tlb-flush-hypercall.patch b/queue-5.10/kvm-x86-wait-for-ipis-to-be-delivered-when-handling-hyper-v-tlb-flush-hypercall.patch new file mode 100644 index 00000000000..ae5c75be721 --- /dev/null +++ b/queue-5.10/kvm-x86-wait-for-ipis-to-be-delivered-when-handling-hyper-v-tlb-flush-hypercall.patch @@ -0,0 +1,50 @@ +From 1ebfaa11ebb5b603a3c3f54b2e84fcf1030f5a14 Mon Sep 17 00:00:00 2001 +From: Vitaly Kuznetsov +Date: Thu, 9 Dec 2021 11:29:37 +0100 +Subject: KVM: x86: Wait for IPIs to be delivered when handling Hyper-V TLB flush hypercall + +From: Vitaly Kuznetsov + +commit 1ebfaa11ebb5b603a3c3f54b2e84fcf1030f5a14 upstream. + +Prior to commit 0baedd792713 ("KVM: x86: make Hyper-V PV TLB flush use +tlb_flush_guest()"), kvm_hv_flush_tlb() was using 'KVM_REQ_TLB_FLUSH | +KVM_REQUEST_NO_WAKEUP' when making a request to flush TLBs on other vCPUs +and KVM_REQ_TLB_FLUSH is/was defined as: + + (0 | KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) + +so KVM_REQUEST_WAIT was lost. Hyper-V TLFS, however, requires that +"This call guarantees that by the time control returns back to the +caller, the observable effects of all flushes on the specified virtual +processors have occurred." and without KVM_REQUEST_WAIT there's a small +chance that the vCPU making the TLB flush will resume running before +all IPIs get delivered to other vCPUs and a stale mapping can get read +there. + +Fix the issue by adding KVM_REQUEST_WAIT flag to KVM_REQ_TLB_FLUSH_GUEST: +kvm_hv_flush_tlb() is the sole caller which uses it for +kvm_make_all_cpus_request()/kvm_make_vcpus_request_mask() where +KVM_REQUEST_WAIT makes a difference. + +Cc: stable@kernel.org +Fixes: 0baedd792713 ("KVM: x86: make Hyper-V PV TLB flush use tlb_flush_guest()") +Signed-off-by: Vitaly Kuznetsov +Message-Id: <20211209102937.584397-1-vkuznets@redhat.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/include/asm/kvm_host.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/include/asm/kvm_host.h ++++ b/arch/x86/include/asm/kvm_host.h +@@ -85,7 +85,7 @@ + KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) + #define KVM_REQ_TLB_FLUSH_CURRENT KVM_ARCH_REQ(26) + #define KVM_REQ_TLB_FLUSH_GUEST \ +- KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_NO_WAKEUP) ++ KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) + #define KVM_REQ_APF_READY KVM_ARCH_REQ(28) + #define KVM_REQ_MSR_FILTER_CHANGED KVM_ARCH_REQ(29) + diff --git a/queue-5.10/mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch b/queue-5.10/mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch new file mode 100644 index 00000000000..310abf25cce --- /dev/null +++ b/queue-5.10/mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch @@ -0,0 +1,61 @@ +From 3c376dfafbf7a8ea0dea212d095ddd83e93280bb Mon Sep 17 00:00:00 2001 +From: Manjong Lee +Date: Fri, 10 Dec 2021 14:47:11 -0800 +Subject: mm: bdi: initialize bdi_min_ratio when bdi is unregistered + +From: Manjong Lee + +commit 3c376dfafbf7a8ea0dea212d095ddd83e93280bb upstream. + +Initialize min_ratio if it is set during bdi unregistration. This can +prevent problems that may occur a when bdi is removed without resetting +min_ratio. + +For example. +1) insert external sdcard +2) set external sdcard's min_ratio 70 +3) remove external sdcard without setting min_ratio 0 +4) insert external sdcard +5) set external sdcard's min_ratio 70 << error occur(can't set) + +Because when an sdcard is removed, the present bdi_min_ratio value will +remain. Currently, the only way to reset bdi_min_ratio is to reboot. + +[akpm@linux-foundation.org: tweak comment and coding style] + +Link: https://lkml.kernel.org/r/20211021161942.5983-1-mj0123.lee@samsung.com +Signed-off-by: Manjong Lee +Acked-by: Peter Zijlstra (Intel) +Cc: Changheun Lee +Cc: Jens Axboe +Cc: Christoph Hellwig +Cc: Matthew Wilcox +Cc: +Cc: +Cc: +Cc: +Cc: +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/backing-dev.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -872,6 +872,13 @@ void bdi_unregister(struct backing_dev_i + wb_shutdown(&bdi->wb); + cgwb_bdi_unregister(bdi); + ++ /* ++ * If this BDI's min ratio has been set, use bdi_set_min_ratio() to ++ * update the global bdi_min_ratio. ++ */ ++ if (bdi->min_ratio) ++ bdi_set_min_ratio(bdi, 0); ++ + if (bdi->dev) { + bdi_debug_unregister(bdi); + device_unregister(bdi->dev); diff --git a/queue-5.10/series b/queue-5.10/series index a0ef09f53bf..eb9db4a4983 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -40,3 +40,5 @@ iavf-fix-reporting-when-setting-descriptor-count.patch ib-hfi1-correct-guard-on-eager-buffer-deallocation.patch devlink-fix-netns-refcount-leak-in-devlink_nl_cmd_reload.patch net-sched-fq_pie-prevent-dismantle-issue.patch +kvm-x86-wait-for-ipis-to-be-delivered-when-handling-hyper-v-tlb-flush-hypercall.patch +mm-bdi-initialize-bdi_min_ratio-when-bdi-is-unregistered.patch