Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp154776ybh; Fri, 6 Mar 2020 18:17:02 -0800 (PST) X-Google-Smtp-Source: ADFU+vvQbssmIjt20hyYk0QMYr1dGvKyodaDbsMRHedKnYbjsh8IaHRUdOfT3IhORiCYYvkAgzeR X-Received: by 2002:a9d:5d07:: with SMTP id b7mr5117496oti.209.1583547422759; Fri, 06 Mar 2020 18:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583547422; cv=none; d=google.com; s=arc-20160816; b=sNM9RN7MzjAq/2ZSl6gY156cLo1bmF4cn+Y45IrPa/eiSdz9UIliZMGEgjCyg29avC UMzFrdwqm22wuMBNgQj+u59VSdwV8oLSPvnHPsLG7Q7Yv7hvIaBP29ZS6bLkKU+Qvtmx 6DqArQB/QPmXFPE9tp0jt7+9+JklQXxdf0LVuiPi4FowR8UTey9NUsax8xeC5VIEvaai 98LMM+CGEW01FwlqwWSquqO9S6uRz5S48IDW7prlMg+H2T6SmnQY3ELH++VrFoAmqmls W1X8wv8TV1V2N51N1ErEDxsQWi31gxFk1iH/KQjbQAHXGqNZm+KEwqrP3vesixu8Bz7g VVFQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=52Uiuph6DZFqywRCwPe7yQX9HPGeJqGU3GzXAlJUZ/4=; b=jwQmsm2d6piYFm0kDiQC0jtNMLZ7/mYfkRXvVTCL48Vye94g8whk2HFwJNsSYGBFTu aPBTIz/kX3yyIO50pz2v0WSSCkJS7YC46SpGIT+1SPYFoC195JdYAfiry9pS4F3zkfyi g6yeVBq0VosDpTDORNa9ck6f0ijcg4X/uZAvJQ6zYZTVK7YriWdYxCFwCeItK4gMlpaV vyfpLoFhOzVWXen034m4jLuGCaY2uBuA2Lkz3SfLqnyg/mQJ3hOk6hgYCsP/Ax2YKI3j 30JJCZTD03z4jICjgpy280Faj1eBLSfSroxN8JlWKOsY1C/31C5qVlQWmW/cubGcna7M +v+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m7uWRUdr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c140si619337oib.195.2020.03.06.18.16.49; Fri, 06 Mar 2020 18:17:02 -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; dkim=pass header.i=@kernel.org header.s=default header.b=m7uWRUdr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbgCGCQc (ORCPT + 99 others); Fri, 6 Mar 2020 21:16:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:55656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbgCGCQc (ORCPT ); Fri, 6 Mar 2020 21:16:32 -0500 Received: from localhost (c-67-180-165-146.hsd1.ca.comcast.net [67.180.165.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E32EA2067C; Sat, 7 Mar 2020 02:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583547392; bh=ZIV6z1lwkiwcQzPHzg5HwO+jQAtalo0Uf9NvrIMC3qw=; h=From:To:Cc:Subject:Date:From; b=m7uWRUdrjOTLRGmZ4uhPFL/Scr9zbtshS1wDjuGwg54H8+1QaeZN5+r+Yh/gV+coV qCrIlI0dfVXZ/ma9a/eJalmZQhazh+o/Z5MuBinffJQBH/GNBSgYAfqM01Iaekb3gO RtIUVeBjktTdEgO99gcevvp20QlHi7Y9pfzYIFjo= From: Andy Lutomirski To: LKML , x86@kernel.org, kvm list , Paolo Bonzini Cc: Andy Lutomirski , stable@vger.kernel.org Subject: [PATCH] x86/kvm: Disable KVM_ASYNC_PF_SEND_ALWAYS Date: Fri, 6 Mar 2020 18:16:27 -0800 Message-Id: <25d5c6de22cabf6a4ecb44ce077f33aa5f10b4d4.1583547371.git.luto@kernel.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ABI is broken and we cannot support it properly. Turn it off. If this causes a meaningful performance regression for someone, KVM can introduce an improved ABI that is supportable. Cc: stable@vger.kernel.org Signed-off-by: Andy Lutomirski --- arch/x86/kernel/kvm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 93ab0cbd304e..71f9f39f93da 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -318,11 +318,16 @@ static void kvm_guest_cpu_init(void) pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason)); -#ifdef CONFIG_PREEMPTION - pa |= KVM_ASYNC_PF_SEND_ALWAYS; -#endif pa |= KVM_ASYNC_PF_ENABLED; + /* + * We do not set KVM_ASYNC_PF_SEND_ALWAYS. With the current + * KVM paravirt ABI, if an async page fault occurs on an early + * memory access in the normal (sync) #PF path or in an NMI + * that happens early in the #PF code, the combination of CR2 + * and the APF reason field will be corrupted. + */ + if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_VMEXIT)) pa |= KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT; -- 2.24.1