Received: by 10.223.185.116 with SMTP id b49csp488250wrg; Wed, 14 Feb 2018 02:10:30 -0800 (PST) X-Google-Smtp-Source: AH8x225W8B+1K77GIGuHQOB4CkSYrbl0GZoOzB89+tIffKHaz1HS9olsZQIr2o7ui2Kkb8E6wper X-Received: by 10.99.117.66 with SMTP id f2mr3092314pgn.249.1518603030190; Wed, 14 Feb 2018 02:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518603030; cv=none; d=google.com; s=arc-20160816; b=Z1vsWR+DajW6/tmfHtqwDynT2q5FPFPQLcsDuVC19d+rvAD3+5kqjDQvK7HwmXs9pA LjFHQOzmsNoypRKqnqf6sorarGvrqVMDsgTRW0QBqcQVyqWabYB3NXWzAv4EW9/xeO4f jflPP5pzF+WxR5F1EU87CkKrg9GRzQwvwcHTkHDXkzyhgn0fqtqnW5wcaJmsxIe95ub3 t6O2HkxEZ+MCnTE0DsCpN/eznHKe0rKJ1AI7aSzjrBE967SGucfRXWVRXcQVeYAycWk1 gnnuPEOy6lCaLsyCnwFbXXio45ga0c6xF6pBc6SSYiD+byawFUnvcMzZFK9NfS+S1ZyW RCJg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=wAaIxdOOlEhd/W3PfIn+FtVNbUgiPspdLyvMKam+n1w=; b=yjkLWjLSTcL1dNqv5+sK7sFCxPtwZ/TP9mDKrpfIyvLvuwV3oAKA+3wpTkQYxUl2+W N3Dd/+G5ooKb+kdnEDeWXY9yjORqscNhIyIW6SoFNo7jrN+Bg3fF4yE3lvELZrPOvUwR gnoXmdX/9CP60uL34u9myCUkeh53Ty9nbWgS0FAt9XAxpHWgvuuAt0Qobf4gpS2U0K01 qWlngadzMk8F+Vhl4J8XU1+geNwrrsq/rRqpfOAgw5LscZW0bQuQ+cv8QKbaF2GuHXAn sEXXXzHs+idVNk2Lurq0QwurFHksRRhIRfmvjSgHO95xmI8h+MCk46E98dZcZ+cFx4uF KQOA== 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 m187si1387977pfb.291.2018.02.14.02.10.14; Wed, 14 Feb 2018 02:10:30 -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 S967119AbeBNKIi (ORCPT + 99 others); Wed, 14 Feb 2018 05:08:38 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41734 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966971AbeBNKIg (ORCPT ); Wed, 14 Feb 2018 05:08:36 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A1FE7CBA5; Wed, 14 Feb 2018 10:08:36 +0000 (UTC) Received: from [10.36.118.14] (unknown [10.36.118.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 838711010400; Wed, 14 Feb 2018 10:08:34 +0000 (UTC) Subject: Re: [RFC PATCH 2/2] KVM: SVM: Add MSR feature support for serializing LFENCE To: Tom Lendacky , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Joerg Roedel , Borislav Petkov , Thomas Gleixner , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <20180208225833.22074.25995.stgit@tlendack-t1.amdoffice.net> <20180208225856.22074.98252.stgit@tlendack-t1.amdoffice.net> <584e51cc-1a79-4e5d-45ef-1850bb6c155e@redhat.com> From: Paolo Bonzini Message-ID: <1e3e64dc-00e4-adbd-2dd7-c44f8886ea52@redhat.com> Date: Wed, 14 Feb 2018 11:08:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 14 Feb 2018 10:08:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 14 Feb 2018 10:08:36 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/02/2018 05:39, Tom Lendacky wrote: > On 2/13/2018 10:22 AM, Paolo Bonzini wrote: >> On 08/02/2018 23:58, Tom Lendacky wrote: >>> Create an entry in the new MSR as a feature framework to allow a guest to >>> recognize LFENCE as a serializing instruction on AMD processors. The MSR >>> can only be set by the host, any write by the guest will be ignored. A >>> read by the guest will return the value as set by the host. In this way, >>> the support to expose the feature to the guest is controlled by the >>> hypervisor. >>> >>> Signed-off-by: Tom Lendacky >>> --- >>> arch/x86/kvm/svm.c | 16 ++++++++++++++++ >>> arch/x86/kvm/x86.c | 6 ++++++ >>> 2 files changed, 22 insertions(+) >>> >>> @@ -4047,6 +4052,17 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) >>> case MSR_VM_IGNNE: >>> vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); >>> break; >>> + case MSR_F10H_DECFG: >>> + /* Only the host can set this MSR, silently ignore */ >>> + if (!msr->host_initiated) >>> + break; >> >> Just one thing I'm wondering, should we #GP if the guest attempts to >> clear MSR_F10H_DECFG_LFENCE_SERIALIZE? > > It would be more consistent with other entries to do "return 1" here > instead. The current kernel code that writes this bit is using > msr_set_bit(), so a #GP is caught and handled. That's also okay. We don't know about Windows though... Paolo