This is a note to let you know that I've just added the patch titled Revert KVM: MIPS: Drop other CPU ASIDs on guest MMU changes to the 4.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-kvm-mips-drop-other-cpu-asids-on-guest-mmu-changes.patch and it can be found in the queue-4.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sun Nov 13 12:16:15 CET 2016 Date: Sun, 13 Nov 2016 12:16:15 +0100 To: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Subject: Revert KVM: MIPS: Drop other CPU ASIDs on guest MMU changes This reverts commit d450527ad04ad180636679aeb3161ec58079f1ba which was commit 91e4f1b6073dd680d86cdb7e42d7cccca9db39d8 upstream as it was incorrect. A fixed version will be forthcoming. Reported-by: James Hogan <james.hogan@xxxxxxxxxx> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> Cc: "Radim Krčmář" <rkrcmar@xxxxxxxxxx> Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/mips/kvm/emulate.c | 63 +++++++----------------------------------------- 1 file changed, 10 insertions(+), 53 deletions(-) --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c @@ -807,47 +807,6 @@ enum emulation_result kvm_mips_emul_tlbr return EMULATE_FAIL; } -/** - * kvm_mips_invalidate_guest_tlb() - Indicates a change in guest MMU map. - * @vcpu: VCPU with changed mappings. - * @tlb: TLB entry being removed. - * - * This is called to indicate a single change in guest MMU mappings, so that we - * can arrange TLB flushes on this and other CPUs. - */ -static void kvm_mips_invalidate_guest_tlb(struct kvm_vcpu *vcpu, - struct kvm_mips_tlb *tlb) -{ - int cpu, i; - bool user; - - /* No need to flush for entries which are already invalid */ - if (!((tlb->tlb_lo[0] | tlb->tlb_lo[1]) & ENTRYLO_V)) - return; - /* User address space doesn't need flushing for KSeg2/3 changes */ - user = tlb->tlb_hi < KVM_GUEST_KSEG0; - - preempt_disable(); - - /* - * Probe the shadow host TLB for the entry being overwritten, if one - * matches, invalidate it - */ - kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi); - - /* Invalidate the whole ASID on other CPUs */ - cpu = smp_processor_id(); - for_each_possible_cpu(i) { - if (i == cpu) - continue; - if (user) - vcpu->arch.guest_user_asid[i] = 0; - vcpu->arch.guest_kernel_asid[i] = 0; - } - - preempt_enable(); -} - /* Write Guest TLB Entry @ Index */ enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu) { @@ -867,8 +826,11 @@ enum emulation_result kvm_mips_emul_tlbw } tlb = &vcpu->arch.guest_tlb[index]; - - kvm_mips_invalidate_guest_tlb(vcpu, tlb); + /* + * Probe the shadow host TLB for the entry being overwritten, if one + * matches, invalidate it + */ + kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi); tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0); tlb->tlb_hi = kvm_read_c0_guest_entryhi(cop0); @@ -897,7 +859,11 @@ enum emulation_result kvm_mips_emul_tlbw tlb = &vcpu->arch.guest_tlb[index]; - kvm_mips_invalidate_guest_tlb(vcpu, tlb); + /* + * Probe the shadow host TLB for the entry being overwritten, if one + * matches, invalidate it + */ + kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi); tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0); tlb->tlb_hi = kvm_read_c0_guest_entryhi(cop0); @@ -1016,7 +982,6 @@ enum emulation_result kvm_mips_emulate_C int32_t rt, rd, copz, sel, co_bit, op; uint32_t pc = vcpu->arch.pc; unsigned long curr_pc; - int cpu, i; /* * Update PC and hold onto current PC in case there is @@ -1124,16 +1089,8 @@ enum emulation_result kvm_mips_emulate_C vcpu->arch.gprs[rt] & ASID_MASK); - preempt_disable(); /* Blow away the shadow host TLBs */ kvm_mips_flush_host_tlb(1); - cpu = smp_processor_id(); - for_each_possible_cpu(i) - if (i != cpu) { - vcpu->arch.guest_user_asid[i] = 0; - vcpu->arch.guest_kernel_asid[i] = 0; - } - preempt_enable(); } kvm_write_c0_guest_entryhi(cop0, vcpu->arch.gprs[rt]); Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.4/drm-amdgpu-fix-dp-mode-validation.patch queue-4.4/ipmr-ip6mr-fix-scheduling-while-atomic-and-a-deadlock-with-ipmr_get_route.patch queue-4.4/of-silence-warnings-due-to-max-usage.patch queue-4.4/ip6_gre-fix-flowi6_proto-value-in-ip6gre_xmit_other.patch queue-4.4/drm-radeon-fix-dp-mode-validation.patch queue-4.4/rtnetlink-add-rtnexthop-offload-flag-to-compare-mask.patch queue-4.4/net-sctp-forbid-negative-length.patch queue-4.4/ip6_tunnel-fix-ip6_tnl_lookup.patch queue-4.4/net-sched-act_vlan-push-skb-data-to-mac_header-prior-calling-skb_vlan_-functions.patch queue-4.4/packet-call-fanout_release-while-unregistering-a-netdev.patch queue-4.4/tg3-avoid-null-pointer-dereference-in-tg3_io_error_detected.patch queue-4.4/kvm-mips-drop-other-cpu-asids-on-guest-mmu-changes.patch queue-4.4/net-add-recursion-limit-to-gro.patch queue-4.4/bridge-multicast-restore-perm-router-ports-on-multicast-enable.patch queue-4.4/tcp-fix-wrong-checksum-calculation-on-mtu-probing.patch queue-4.4/revert-kvm-mips-drop-other-cpu-asids-on-guest-mmu-changes.patch queue-4.4/net-sched-filters-fix-notification-of-filter-delete-with-proper-handle.patch queue-4.4/ipv4-use-the-right-lock-for-ping_group_range.patch queue-4.4/ipv4-disable-bh-in-set_ping_group_range.patch queue-4.4/drm-amdgpu-dp-add-back-special-handling-for-nutmeg.patch queue-4.4/tcp-fix-a-compile-error-in-dbgundo.patch queue-4.4/net-avoid-sk_forward_alloc-overflows.patch queue-4.4/udp-fix-ip_checksum-handling.patch queue-4.4/net-add-netdev-all_adj_list-refcnt-propagation-to-fix-panic.patch queue-4.4/netlink-do-not-enter-direct-reclaim-from-netlink_dump.patch queue-4.4/net-fec-set-mac-address-unconditionally.patch queue-4.4/ipv6-tcp-restore-ip6cb-for-pktoptions-skbs.patch queue-4.4/tcp-fix-overflow-in-__tcp_retransmit_skb.patch queue-4.4/ipv6-correctly-add-local-routes-when-lo-goes-up.patch queue-4.4/packet-on-direct_xmit-limit-tso-and-csum-to-supported-devices.patch queue-4.4/sctp-validate-chunk-len-before-actually-using-it.patch queue-4.4/net-pktgen-remove-rcu-locking-in-pktgen_change_name.patch queue-4.4/drm-radeon-dp-add-back-special-handling-for-nutmeg.patch queue-4.4/net-pktgen-fix-pkt_size.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html