From patchwork Fri Jan 17 12:01:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 3503681 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 053B09F2E9 for ; Fri, 17 Jan 2014 12:02:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0BEC20158 for ; Fri, 17 Jan 2014 12:02:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DE4F200D6 for ; Fri, 17 Jan 2014 12:02:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752449AbaAQMCA (ORCPT ); Fri, 17 Jan 2014 07:02:00 -0500 Received: from multi.imgtec.com ([194.200.65.239]:49259 "EHLO multi.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbaAQMB6 (ORCPT ); Fri, 17 Jan 2014 07:01:58 -0500 From: James Hogan To: John Crispin , Ralf Baechle , CC: James Hogan , Gleb Natapov , , Sanjay Lal Subject: [PATCH v2 1/2] MIPS: KVM: use common EHINV aware UNIQUE_ENTRYHI Date: Fri, 17 Jan 2014 12:01:30 +0000 Message-ID: <1389960091-8098-2-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1389960091-8098-1-git-send-email-james.hogan@imgtec.com> References: <1389960091-8098-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.65] X-SEF-Processed: 7_3_0_01192__2014_01_17_12_01_57 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When KVM is enabled and TLB invalidation is supported, kvm_mips_flush_host_tlb() can cause a machine check exception due to multiple matching TLB entries. This can occur on shutdown even when KVM hasn't been actively used. Commit adb78de9eae8 (MIPS: mm: Move UNIQUE_ENTRYHI macro to a header file) created a common UNIQUE_ENTRYHI in asm/tlb.h but it didn't update the copy of UNIQUE_ENTRYHI in kvm_tlb.c to use it. Commit 36b175451399 (MIPS: tlb: Set the EHINV bit for TLBINVF cores when invalidating the TLB) later added TLB invalidation (EHINV) support to the common UNIQUE_ENTRYHI. Therefore make kvm_tlb.c use the EHINV aware UNIQUE_ENTRYHI implementation in asm/tlb.h too. Signed-off-by: James Hogan Cc: Ralf Baechle Cc: John Crispin Cc: linux-mips@linux-mips.org Cc: Gleb Natapov Cc: kvm@vger.kernel.org Cc: Sanjay Lal Reviewed-by: Markos Chandras Acked-by: Paolo Bonzini --- This is based on John Crispin's mips-next-3.14 branch. I do not object to it being squashed into commit adb78de9eae8 (MIPS: mm: Move UNIQUE_ENTRYHI macro to a header file) since that commit hasn't reached mainline yet. --- arch/mips/kvm/kvm_tlb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c index c777dd36d4a8..52083ea7fddd 100644 --- a/arch/mips/kvm/kvm_tlb.c +++ b/arch/mips/kvm/kvm_tlb.c @@ -25,6 +25,7 @@ #include #include #include +#include #undef CONFIG_MIPS_MT #include @@ -35,9 +36,6 @@ #define PRIx64 "llx" -/* Use VZ EntryHi.EHINV to invalidate TLB entries */ -#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) - atomic_t kvm_mips_instance; EXPORT_SYMBOL(kvm_mips_instance);