Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp220809pxb; Wed, 3 Feb 2021 04:01:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzF2iv0wRI9s5N8KOj4e1H1nrRTrBadnbqXGRr2yawoRiF5NsGYoVsxkRnVzvcTwPE5Jq4 X-Received: by 2002:a05:6402:1ad0:: with SMTP id ba16mr2511489edb.287.1612353712947; Wed, 03 Feb 2021 04:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612353712; cv=none; d=google.com; s=arc-20160816; b=xzyQS4tD11MkO/x4o72//AEsHhu/1hHuniNz8jaI2un/VYtrdTIKb1uqijSSpQ3up1 QzE7/1KMquKQuJXsyduNC7QkZKGWnsV+Sc6+dRvv2V52zFyU4GSJLM964WtJmcV0uGIF TNvli3i1EKThHMCEIJm9hjS4P5HUgVfSPGVhHcBtA+iTmEC4aiGQj1NHKi017D8Pf01h dmeqlrnT+ka9HFeBiSC3kRtoenYvW/rt1sJ78TIcb49F6JvVDcEk/wbVwdNOwfRP0Lwu 3AvdWEbuJkm/x+QKiiCkFKpQaXRO1XdgQBU/+F+Piw0rQmO3F8FMIJ3s6YrUdaZdiRbw pUxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=u9U3VSpDQSD/KsDApyXK6tPmD8iQWbI6YSpXdCHYYUY=; b=GbpzE1Bq3okmf93cxxFqQCfB6XX8RwMsMK4HMBp8pqguawaT0JVvi0FwyDGvRuCZLv UofuuI81VHWkefjNvuUW0BeNf2Yd77efErmBmENub1VS3/QQTTXeo6PgRL4epreJfjCs 6voB84Kq/IbyyrpX8ayPNhltXagczbyFJYAl6mX+qhRc/G0bv/UpEu6OXclJCF8TueuP LEKLyc8o5fZHtHDy2KVZIxQlxs4S0t86ybhljwV4XYHTidyLRl7p/zPUIasxu+8RttiM eKiRk+YmrLrQKLT1qOFj9Xya6l7AaNc0VYZ6CdKyi15X390c2XRa4abzJVwHFo5wVh+6 WF8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="X/HUiZoJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy25si1106026ejc.530.2021.02.03.04.01.27; Wed, 03 Feb 2021 04:01:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="X/HUiZoJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234429AbhBCL7T (ORCPT + 99 others); Wed, 3 Feb 2021 06:59:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47941 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234421AbhBCL7M (ORCPT ); Wed, 3 Feb 2021 06:59:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612353466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u9U3VSpDQSD/KsDApyXK6tPmD8iQWbI6YSpXdCHYYUY=; b=X/HUiZoJvKm98YdQ25FvH9g5FxnfxRhR/dqVXXn7yTdmtlkLGd/a8UakGuII2q6lhoCHdc HYfCo2thn2+FLZnz8F4jKc9Iy+hCSNp4RxiDMCEPBuqy+F6R65HtL1BThkZK7kpgFDRUKQ NFwjAaQcqqwIAbJiLt5lChIaNzA3iJo= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-fi-yIYANMjSVqJyk0rNURw-1; Wed, 03 Feb 2021 06:57:44 -0500 X-MC-Unique: fi-yIYANMjSVqJyk0rNURw-1 Received: by mail-ej1-f72.google.com with SMTP id eb5so2147525ejc.6 for ; Wed, 03 Feb 2021 03:57:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=u9U3VSpDQSD/KsDApyXK6tPmD8iQWbI6YSpXdCHYYUY=; b=oB68gS8Q/JiJcpSFcVEWQ/82WQ4ErrtTf+Pf+BWRHTn684AG4Zg2ZQUi7O/rfAIovs TNoOOjrY64oAgQSQScV1Xl2enIJS51GcKHwBiwG62DbHOM2aSkVdQsH9+2wCqJ6j3m9p K4RVWxRCOZQHlhn61mdIixtU5vyUvWvgwokbGQwlZq4uU4g7xp9h8WHBKQXHYtxeviZu k1RpNpHaaHIuW7RsR97f/TqPSh03GQq+kRiSHTuOVWaK+LGp9XSbplo+DtzrxjgNhlDU zWQkG3UKFyDYrxj1RibRiw3V2iMxUFfcgyE9jQZeJDFVtfxzcotWlTYhIJmDOfhCXwCz skGg== X-Gm-Message-State: AOAM533lVE0KE+bZ35S5KcV+JcPo1f8mo+FbaCEb9zQyyDM7z+zzAHOk IfRIcJgWH/05vPKYfNu9TUOj14+gfB3rl1yNSOpkYdoaSXXL2Iuc575/9FTRsxgXaeB+P94a4Td XUZgukGdyWahXxlmhEf7JB6oP X-Received: by 2002:a05:6402:1642:: with SMTP id s2mr2435753edx.360.1612353463638; Wed, 03 Feb 2021 03:57:43 -0800 (PST) X-Received: by 2002:a05:6402:1642:: with SMTP id s2mr2435745edx.360.1612353463498; Wed, 03 Feb 2021 03:57:43 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id r4sm757194edv.27.2021.02.03.03.57.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Feb 2021 03:57:42 -0800 (PST) Subject: Re: [PATCH v15 07/14] KVM: VMX: Emulate reads and writes to CET MSRs To: Yang Weijiang , seanjc@google.com, jmattson@google.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yu.c.zhang@linux.intel.com References: <20210203113421.5759-1-weijiang.yang@intel.com> <20210203113421.5759-8-weijiang.yang@intel.com> From: Paolo Bonzini Message-ID: <6a743d57-8128-b5db-ddc1-9dd4c4c1004e@redhat.com> Date: Wed, 3 Feb 2021 12:57:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210203113421.5759-8-weijiang.yang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/02/21 12:34, Yang Weijiang wrote: > MSRs that are switched through XSAVES are especially annoying due to > the possibility of the kernel's FPU being used in IRQ context. Disable > IRQs and ensure the guest's FPU state is loaded when accessing such MSRs. Good catch! This should be in x86.h and named kvm_get/set_xsave_msr because it's not VMX specific. The commit message should also be there as a comment. In addition, > + case MSR_IA32_S_CET: > + if (!cet_is_control_msr_accessible(vcpu, msr_info)) > + return 1; > + msr_info->data = vmcs_readl(GUEST_S_CET); > + break; > + case MSR_IA32_U_CET: > + if (!cet_is_control_msr_accessible(vcpu, msr_info)) > + return 1; > + vmx_get_xsave_msr(msr_info); > + break; these two might as well be the same "case" for symmetry with the handling of WRMSR. I've fixed this up locally, since these patches will not be pushed to Linus until the corresponding bare metal support is there. Paolo