Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3361649pxb; Mon, 6 Sep 2021 19:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr6pe2nVbMoNLBgyKCKQP5HSGQVI4uxcc7fXS3rasAbGZ4NC/eddxxAIaTsW9YYTe9G9Wg X-Received: by 2002:a05:6602:730:: with SMTP id g16mr11929540iox.138.1630983462796; Mon, 06 Sep 2021 19:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630983462; cv=none; d=google.com; s=arc-20160816; b=foxMsa+4W7CgBvar7yr9DJm8A7YGfi5PRaGQS7sxH3JdW8dCZRlUbFy/OfDbtGmjjK 2KUgYXRXzLbDtM5qyzRJ+BePIQ6rD492UqaQd5jqlsCIP6eMHYY49nCKvmVtqSVdWuZm 4Og/Q9Sgp5oxFrEJ5TesB2zeqAiK9x3Fkv58wy6ezqOasXvFG8D06GfFfOhaDdX1Z/tP RFjlrPG4dq3Eg2WhK+Nqww4Etoo62dEz7sEZTv2Ztkszk0C7oY8xLIsqYggY84iR9zQ4 BE89E5fofE2jI3GstDSaeU/GRAAftDqL+IPwmuqJfMzh8RyyhMMyJk+BcIQcPbUtIsgP ydaw== 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; bh=bVe+bOfmNm9rv36rMg0T/SUjvRwNe3nCziz0cUK1wK8=; b=CFhs8IAnuQxTnRW5I28cZgdQijhg6lxstRg2lI2yJp/z3de1Wsmt8o1D1nskFPGooQ yfJFH/NZs0lXZr3olFTyO7O3H9LC1Uqh6vX5qNQIbhBYs8K/kWD14XJzVtdfemo/tT3u JoTUfLxJY0lgDVo2Vo81d7NAnXz4E+G5ueQg3tiFXzo8970DatNnCr3LL5dg6YFy+TlO 4wErC4Wj8ioM6J4vJsWRjXW2KogP/8MlSwohkhbaNkTiVxAekWCYkbylYNSkwnt8yXmn ITWEXIvKeiiHPHnCel/JkGS+4KGpYxWvm2YYedxyc7EiTczoP0DLyywJWLHjAI9B3OO1 IEjg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si9845686ioz.60.2021.09.06.19.57.30; Mon, 06 Sep 2021 19:57:42 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232548AbhIGC50 (ORCPT + 99 others); Mon, 6 Sep 2021 22:57:26 -0400 Received: from mga12.intel.com ([192.55.52.136]:26240 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbhIGC5Z (ORCPT ); Mon, 6 Sep 2021 22:57:25 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10099"; a="199611961" X-IronPort-AV: E=Sophos;i="5.85,273,1624345200"; d="scan'208";a="199611961" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2021 19:56:19 -0700 X-IronPort-AV: E=Sophos;i="5.85,273,1624345200"; d="scan'208";a="605033418" Received: from xiaoyaol-mobl.ccr.corp.intel.com (HELO [10.239.13.122]) ([10.239.13.122]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2021 19:56:17 -0700 Subject: Re: [PATCH] x86/tsx: clear RTM and HLE when MSR_IA32_TSX_CTRL is not supported To: Hao Peng , Xiaoyao Li Cc: Borislav Petkov , tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, Pawan Gupta References: From: Xiaoyao Li Message-ID: <77e8d483-4395-0017-300e-0886f75217bb@intel.com> Date: Tue, 7 Sep 2021 10:56:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/7/2021 10:35 AM, Hao Peng wrote: > On Tue, Sep 7, 2021 at 10:08 AM Xiaoyao Li wrote: >> >> On 9/7/2021 9:47 AM, Hao Peng wrote: >>> On Mon, Sep 6, 2021 at 5:30 PM Borislav Petkov wrote: >>>> >>>> On Mon, Sep 06, 2021 at 10:46:05AM +0800, Hao Peng wrote: >>>>> If hypervisor does not support MSR_IA32_TSX_CTRL, but guest supports >>>>> RTM and HLE features, it will affect TAA mitigation. >>>>> >>>>> Signed-off-by: Peng Hao >>>>> --- >>>>> arch/x86/kernel/cpu/tsx.c | 7 +++++++ >>>>> 1 file changed, 7 insertions(+) >>>>> >>>>> diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c >>>>> index 9c7a5f049292..5e852c14fef2 100644 >>>>> --- a/arch/x86/kernel/cpu/tsx.c >>>>> +++ b/arch/x86/kernel/cpu/tsx.c >>>>> @@ -122,6 +122,13 @@ void __init tsx_init(void) >>>>> >>>>> if (!tsx_ctrl_is_supported()) { >>>>> tsx_ctrl_state = TSX_CTRL_NOT_SUPPORTED; >>>>> + >>>>> + /* If hypervisor does not support MSR_IA32_TSX_CTRL emulation, >>>>> + * but guest supports RTM and HLE features, it will affect TAA >>>>> + * (tsx_async_abort)mitigation. >>>>> + */ >>>>> + setup_clear_cpu_cap(X86_FEATURE_RTM); >>>>> + setup_clear_cpu_cap(X86_FEATURE_HLE); >> >> anyway, IMHO, we shouldn't do anything here for TAA. It should be in >> taa_select_mitigation() >> >>>>> return; >>>>> } >>>> >>>> How does that even happen - the hypervisor does not support the MSR but >>>> "guest supports" TSX features?! >>>> >>>> I guess the guest is detecting it wrong. >>>> >>>> What hypervisor, what guest, how do I reproduce? >>>> >>> hypervisor is kvm, guest is linux too. >>>> Please give full details. >>>> >>> The host I used is kernel-5.4, and guest is kernel-5.13. >>> MSR_IA32_TSX_CTRL is exposed >>> to guest and guest to support RTM and HLE features, no direct >>> dependence. at the qemu I >>> started guest with -cpu host-model. >>> I have viewed the code of kernel-5.4, and MSR_IA32_TSX_CTRL is not >>> exposed to guest. >> >> Does guest see TAA_NO bit? >> > Guest can't see taa_no, which requires updating qemu to solve. But I think > there is a compatibility process here. Anyway, there should be some existing code in kernel already to handle the case that CPUID reports TRM while MSR_IA32_CORE_CAPABILITIES doesn't report MSR_TSX_CTRL nor TAA_NO. And the Patch itself makes no sense. >>> Thanks. >>>> -- >>>> Regards/Gruss, >>>> Boris. >>>> >>>> https://people.kernel.org/tglx/notes-about-netiquette >>