Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3356731pxb; Mon, 6 Sep 2021 19:48:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM4BsWWxRmz2yCzsFjbds9pZv8K0neDVyMDBhJyAhqqH8sJ/krwoOK7Pb9lXGJt5ZKOkM/ X-Received: by 2002:a05:6602:1581:: with SMTP id e1mr11981053iow.49.1630982904435; Mon, 06 Sep 2021 19:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630982904; cv=none; d=google.com; s=arc-20160816; b=CSlHyRUaHbjhloKs6eSVXLZi/0s+zJGfQWxrpwufSS/wrG5eObnyNgVJ8o6dBx8YCA FxjRdLyQvWOagAa//h0ZJZwu8w5ptFzzOabNGQF9QtTnUbwLTVf/JBn7E86i/i08umIc XPCgthXEKkRTsaANPfEumSfqxAB4QdsRcwrZ9F0e2f5eW1jy1nMqhtkcNu8YxRR72E/Q tknrm9L7v3SxrlwbMhPsmZcTggyA4maBomzbhrs7TACJArdzGgTaSytDh9g6j7hYi/1c 9HTZBTBd/V+kvf5SeuFTLisYEUv0+7LzZW6O9rYjuhbHhmA3jWVijA6DTwwVNeav7h4I qZRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bcQBVvZ60mrnxPLYeY7PhO5GlFGEHyH0BOWX/UIfFug=; b=DGWxX46DG3RlLHAMSfP0Vc4dcGOIqDCBU1QyimmVZEOesR33hMZEyh+b7IiJKRTOKF bjvRyQOd6hSWXM2z37+u/zym8XDDjRFyeZnrKHX6dzMzq2Owctwm577AgQzRVRpRfRbe BX0KUGWb0uOBpeZf08cNIC4hJzFDMAWb15JpxFwhD5xMPfHcoXJDM6HZexrqpP7AOkq0 anx7g/V2QxjQuHY4M6f/cPJiPSOIvWMUnWqD9wodn1Iu3GI2woTWWC7Ar7VT48aLRYaR tk4CmJbaf3I+3Mc2UkGUUy3mwfBeg8kKa6jcKFK7MfHNvjb3Qft2L+6s9/Dz+Y5niwJt 4tmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=acdPWXKU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si9195466ioo.36.2021.09.06.19.48.12; Mon, 06 Sep 2021 19:48:24 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=acdPWXKU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbhIGChF (ORCPT + 99 others); Mon, 6 Sep 2021 22:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbhIGChF (ORCPT ); Mon, 6 Sep 2021 22:37:05 -0400 Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBBB0C061575 for ; Mon, 6 Sep 2021 19:35:59 -0700 (PDT) Received: by mail-ua1-x929.google.com with SMTP id l24so4749489uai.1 for ; Mon, 06 Sep 2021 19:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bcQBVvZ60mrnxPLYeY7PhO5GlFGEHyH0BOWX/UIfFug=; b=acdPWXKUEnxjE81lb8oAb8zJjypbygoxbca9ok7yBFqGHsCYtEqcC+vYw+UdszyNWS hE3yl+ty8GqLZujWrm4nGPtqIR7LzcaZjr3oT0nPnU8daAHe2Bq1JlsfuimX15l3NsnA l7rc6ST9Si6m+NaI5iYqXdz6lFhZTzy1cBqxUI4qBuhcjRq1EwlGsPAH3HEG3uuVbBaF rXPPq3J0gAE3fvxMLYgbdRgsWnIa7jMtXNrn1yNufTo3dLTWJoUaylDxKfjkXNRH2wuc STj7hL8Ad1qZYRtkv/TjybAcXmM4LSnpx+EFs2l0Ki6FIHy+s5ROkzlLAYYaPTrb4mTa 1AmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bcQBVvZ60mrnxPLYeY7PhO5GlFGEHyH0BOWX/UIfFug=; b=TE7q7xcn9K4QqeOQKcd7ryyK7U2QckM69DlpsMNqQgPioE7auN1NPjhPpaHPD7RZr0 utiQJ8cRtL7AHDNBlOs2pYwJLFgqZJKi4uTBs2z58BLMece1qPXt4OmUOGy591Ljezy+ 3bOoSuYqXSkwWq4FCQprAr2fy+yj/+ug0XzyFo8njgTHyZuihz995fBA3Fw06QsMWFF8 6MTOJIrKBMz66tC+5TIWUFz9b7Ym2HQuFX7GY08YMmAVD/G28Rd+pCGQMLfYYEdT9Idt KFMtgPKDN45MOTZBPSH/s/9HXzboi5i+ODVOL7ueZAkxCNWF/KIhWNtlI9zLbyGYeqL5 wBUA== X-Gm-Message-State: AOAM533+HhMi08hZ2DVwm9n9DkJvSZYDfr2KorGYSvohczeP804DKhSI IiutOUOco2N8kCcnq95sdeiyJJT80nfmvXoJWYZVtzNCX0rFnA== X-Received: by 2002:a9f:2429:: with SMTP id 38mr7556967uaq.67.1630982159026; Mon, 06 Sep 2021 19:35:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Hao Peng Date: Tue, 7 Sep 2021 10:35:31 +0800 Message-ID: Subject: Re: [PATCH] x86/tsx: clear RTM and HLE when MSR_IA32_TSX_CTRL is not supported To: Xiaoyao Li Cc: Borislav Petkov , tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, Pawan Gupta Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D TSX_CTRL_NOT_SUPPORTED; > >>> + > >>> + /* If hypervisor does not support MSR_IA32_TSX_CTRL e= mulation, > >>> + * but guest supports RTM and HLE features, it will a= ffect TAA > >>> + * =EF=BC=88tsx_async_abort=EF=BC=89mitigation. > >>> + */ > >>> + 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 bu= t > >> "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. > > Thanks. > >> -- > >> Regards/Gruss, > >> Boris. > >> > >> https://people.kernel.org/tglx/notes-about-netiquette >