Received: by 10.223.164.202 with SMTP id h10csp4874914wrb; Wed, 29 Nov 2017 13:24:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMZTnQfKFC3l35dc9K/a99fNDsv0wRx+e8WSq9mjhQ2nmykl7DzX6lluoesF43YIDvo0HiJG X-Received: by 10.99.108.66 with SMTP id h63mr254108pgc.362.1511990695471; Wed, 29 Nov 2017 13:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511990695; cv=none; d=google.com; s=arc-20160816; b=DgLP1xMKGmAIZ5gB45IY7912HoRFOxPkpCjEKmJwB3F7INxyD1XX12w7+ag6wMr3Jw YdoSOV+9K6fONbL3KtK4ox8Ad5O/t8aDF68Tv3ZsH6IFhbm3auW5I4eVk5mAPLrZBXnp ROurZelnaX9R60NQsBS75JlZly0HUHDzb9f+QaPgTo1G9ag4ATHmfkmvNDBnOAVN3hx4 LtIdW+XVcfuZDQnziBokAaPOugYrzMEu9EE6hRa8lIARVWXMhTqoIw+ATsLFhNbpzTfh DCwHD3NxFOieSgE7T+o0Gh2VEcYsAQgp/zrrYpPIjcv76+x/pVNOfYQ1oUyFLJ9/eN9A kzpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=t4n4BzbOuLC4F+hzNtvUspuhVnpQ+RnW+bnT+nhcxSw=; b=0NCLMjieSyp+zuBCB859aX1lrvj2UkUUU6yAqBhnWS9OqeJk4E5CbA4g7f/rP3BIfW uQ66edWs3nrwb/SI9LzXtf9++dURQ6ACc0QB7DVlqLWO0LOvuyHJl86BsiDv/mvE1p2B lnghmzoo3ueqCdhU/LbdPCpMi4TbL3WsPaFLj1ac1iscrjaFRaPX3sh1FYogNvi/Zst7 NdHGQj6enh2pCq9pSbmgJNgPAs2daRh3qi3PsU3ZnizkF+vGbcGX6PglaprStp6KRoQ8 JIqaTwPIX99aOFWtlhxU//Tnf2huUy8Ij3NijKBuUi4RkdXDWE7CFCHNtnj/tPkIcwaE FVJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si1832251pgm.393.2017.11.29.13.24.41; Wed, 29 Nov 2017 13:24:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753288AbdK2VYd (ORCPT + 99 others); Wed, 29 Nov 2017 16:24:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46626 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753216AbdK2VYa (ORCPT ); Wed, 29 Nov 2017 16:24:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1B0C85541; Wed, 29 Nov 2017 21:24:30 +0000 (UTC) Received: from flask (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with SMTP id 272EE60BE1; Wed, 29 Nov 2017 21:24:24 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Wed, 29 Nov 2017 22:24:24 +0100 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Borislav Petkov , Alexander Graf , "Michael S. Tsirkin" , =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= , KarimAllah Ahmed , Jim Mattson Subject: [PATCH v2 1/3] KVM: x86: prevent MWAIT in guest with buggy MONITOR Date: Wed, 29 Nov 2017 22:23:41 +0100 Message-Id: <20171129212343.23167-2-rkrcmar@redhat.com> In-Reply-To: <20171129212343.23167-1-rkrcmar@redhat.com> References: <20171129212343.23167-1-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 29 Nov 2017 21:24:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The bug prevents MWAIT from waking up after a write to the monitored cache line. KVM might emulate a CPU model that shouldn't have the bug, so the guest would not employ a workaround and possibly miss wakeups. Better to avoid the situation. Reviewed-by: Alexander Graf Signed-off-by: Radim Krčmář --- arch/x86/kvm/x86.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index d0b95b7a90b4..81f5f50794f6 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -281,6 +281,9 @@ static inline bool kvm_mwait_in_guest(void) return false; } + if (boot_cpu_has_bug(X86_BUG_MONITOR)) + return false; + /* * Intel CPUs without CPUID5_ECX_INTERRUPT_BREAK are problematic as * they would allow guest to stop the CPU completely by disabling -- 2.14.2 From 1585613814272946267@xxx Fri Dec 01 20:12:50 +0000 2017 X-GM-THRID: 1585613814272946267 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread