Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3322865pxb; Mon, 6 Sep 2021 18:49:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzas6t3JQ4h7bWmkObU7/imrqhC/9tujldvW2KFpDMeMhvYdC3ei6RfJHdNAboK9/cpqIlf X-Received: by 2002:a05:6638:59:: with SMTP id a25mr13075296jap.111.1630979373488; Mon, 06 Sep 2021 18:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630979373; cv=none; d=google.com; s=arc-20160816; b=jNj8LbFuyFn16JZgPM6JWEq1AyS5C/u6x8AwK9lIYoob7XE7H8NN4cGQxrXHko+MgI 8+KSoq/PjhYIdfeaS37VhCIVqAvQ+ttxoNx5D/si5Us/iGPfeLDk5MnzdipeutjVAcUu 4k2O7gIIWgTtx/IStwc1SJAw2E9xj5EEH/Y+yIRg4bXg7U9ldxgVcKLz68aDoBUlEGBQ lsdGVjFlpKV/l/7kPVBZ0YkHwqvVFnyx0myxt6FFokSapVyVvHIQe9B1Yxw4DaeVcu86 MDH8kf5YWPX8A+WDAQ2ya+eg6ezHwZYMHaZRkg2Ukwp9WPRkOzLx/UCr74VLBnG43/nI RU3g== 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=VRQ2NT5P6lslZai3b6+lYryp+86xw04llh15jxL+wkw=; b=CAaiSeWfurpKiHNapB7apJnaiOBNtEI1UfbDkXxy26BA5dmJGuVIvU2BKCx8f4I+FN sGxUfTHYeysAEdTkggE3XF1m4Oi0cR6EstmrUJN85B5wnBxi0HnZBZp5oLhPgC3Bq067 Le3Inma0SWVpstDcPUhSAiKHa4Guertn2CmJl4Lhm5ZGIukx12BR5EwKCEuGXRDbbqJt 2kkTPut3nnZigoH/4qJOrZrJocYDyMyIPm6eoL4GNn0omHDB6Q73BCbcf2NRUD85q0Og tve61BQgo0XiiWnLsyybjv/iG8srJKmYqb7An3TF06JYjmbscrcgps7H9/Orq4JY/k1d qqwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=h1X8Vt06; 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 i17si8497850ila.149.2021.09.06.18.49.22; Mon, 06 Sep 2021 18:49:33 -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=h1X8Vt06; 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 S239058AbhIGBs4 (ORCPT + 99 others); Mon, 6 Sep 2021 21:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbhIGBsz (ORCPT ); Mon, 6 Sep 2021 21:48:55 -0400 Received: from mail-vk1-xa2b.google.com (mail-vk1-xa2b.google.com [IPv6:2607:f8b0:4864:20::a2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD8FC061575 for ; Mon, 6 Sep 2021 18:47:49 -0700 (PDT) Received: by mail-vk1-xa2b.google.com with SMTP id j5so2773738vki.0 for ; Mon, 06 Sep 2021 18:47:49 -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=VRQ2NT5P6lslZai3b6+lYryp+86xw04llh15jxL+wkw=; b=h1X8Vt06g7Z0C3a1MlWO1uCmfRCmGVUxfezoabIMI00lbuF1qZsyulsC59wamiN993 5EwNJgieohQUCkQ2NaGmzgvwESKwZvY/q9lLoim3zMjfx+zRQUNh3405Yw5DoCfclfc9 +080+bfiyIJoG8f75F+Zqt3UpAHt53jpZekosFP2u6+N282gnvfeBPMtfFt3u0QCIVsE 92PXoqo6xD41Z4e9c/WjQoe4vwsV8VP1CvTa0iWKKhV7OIVKktNGZl2J+d+89e3b4AND HDcD8d21/dzC1Y/in9J43dPVeGNhTfy3LggYnZ2gembplNRS0a3K4bwkVxFKSkmIVmec kovw== 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=VRQ2NT5P6lslZai3b6+lYryp+86xw04llh15jxL+wkw=; b=qRkVDhSdiPUBBCraLjM0SAItTVquNoyH+6nh3XoBTGoRxllbG7e4Qv2ikELkHKEpDo Co/etzUdqEDsGlSAQT2Luqte/wHqaDHes+R0pWZt3PA9XcVHwrXSvB0ZH7XcLC2en0lU Qa+CvegeLUDuPZ4rpZodhFr8bHL9AZQ1g8vAxFJHnwZcl1+mv6f0ioEfnbwNjFp6u7dY +nw/hDqUpMQt9RiUV+hje7uJXC9w4IMPjl1Iuh53a+raEviz6Vz23NZKw6JEHD7TBMau AcelUQBMU8wz9TtnZfAZCpDqSWFDQ4YmUtNUWXIDHrNz4mvG4JgJ70OG2xhEUW8LAaVr FIcA== X-Gm-Message-State: AOAM530RSxTxfN9ub2bHE/yyXwyztxI+cwWNSKJNllRYknTYnDy8Se01 pPqCu9y+pgTnAHFi+qftrLamwdk3HeXWr9MiGhU= X-Received: by 2002:a1f:add0:: with SMTP id w199mr6851778vke.0.1630979269098; Mon, 06 Sep 2021 18:47:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Hao Peng Date: Tue, 7 Sep 2021 09:47:21 +0800 Message-ID: Subject: Re: [PATCH] x86/tsx: clear RTM and HLE when MSR_IA32_TSX_CTRL is not supported To: Borislav Petkov Cc: 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 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 emu= lation, > > + * but guest supports RTM and HLE features, it will aff= ect TAA > > + * =EF=BC=88tsx_async_abort=EF=BC=89mitigation. > > + */ > > + setup_clear_cpu_cap(X86_FEATURE_RTM); > > + setup_clear_cpu_cap(X86_FEATURE_HLE); > > 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. Thanks. > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette