Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp234784pxb; Tue, 15 Feb 2022 12:06:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNrynmIBezsK4CYk/w11lAmF9vc6RA82oJL4Xun/k8qfm6EtQIHB2xDlRq6ygWS+WpaW0c X-Received: by 2002:a05:6402:2710:: with SMTP id y16mr598697edd.350.1644955590709; Tue, 15 Feb 2022 12:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644955590; cv=none; d=google.com; s=arc-20160816; b=nqEYvYs2jvetX6EdS9GiZy6FId7lLKOUM+XB9uUXBSgojsFsoZiw72kSsq4Ff7mh99 uzDCKZziamKRatyrXkzlqjGtJXJOTAQJvVHroFqFkn9f20H0zZna4ht04chsFae+x6CD BzRUVzfCC1IQJuqzZLHfvXtxNWF5GidAXQS20Ghadxz6Hyg5pDvom/8pL8I6mxdgPdPU 404mq4xZ914tMnB3bKLI0Oybz7i3WNMOqISPvdGrX4WoTB1mKp2Z2R2z/JKGASUK5gDz xGxUBt4QaCpVbQjtlWfZ9OmUq8TBb2QaOGqRoL7Z/TccZPAUjxzzFQVIIZNCfZTulrGG S6Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=P9zFJazI8GsRRCQz2MtpSRqxzmJPpB4uR+2Oqsy/Ww0=; b=T1DMKZQeJQCbO0dKi3liS5ZcZYjFMlsDZdp/ECqTa9+ScdNCic4kQYEEEWq2fWkkw3 Ks6lQhpfSIub/PqG47sOpv08x3edFYZ6q3hA3Dgdfvuuc2V/AHV/tBfJH1dOKzen3gkP T+NTx/JwCncNKMmd2uzokWjJADDvl7VdeTEGTxGQOBk+i9VJgOLGX53+JNHWHWKjrqMM xNhXFhwBdAkQP60jfG/xIOBeZDR6RE7rwfNO6ReM9SuETrMgdB9lxVLEssVUw+E5NFyj llYDWlcbJyjDZczoO1jX8tNLmZqL4xuHA8vgKV0OZRW5b2s8l9FwSIwROyMczBlWmaXB fNhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nHH4v6v/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16si464641edt.515.2022.02.15.12.06.07; Tue, 15 Feb 2022 12:06:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nHH4v6v/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237925AbiBOSTq (ORCPT + 99 others); Tue, 15 Feb 2022 13:19:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236752AbiBOSTo (ORCPT ); Tue, 15 Feb 2022 13:19:44 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43EAE119879; Tue, 15 Feb 2022 10:19:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644949174; x=1676485174; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=P9zFJazI8GsRRCQz2MtpSRqxzmJPpB4uR+2Oqsy/Ww0=; b=nHH4v6v/eKSTlmysgItDr1HqfPhRHbxdtXCUAwIjW2pgUmClolBSTuMO 2lQPYODyDY3bjZAY/OSpDRnD17ZBSzWSHkurB9XSY3sGFDoMe2MGApqKf /tuDqUyXpP5krGerZ7ErceZ09n0en/4Okw0AcFvqQKuAVgdcA9TRvtcGq GpApUuOeXj6cwUenpBxAXNDN601Ph9J2BIl1mNe18Ctvqt8C6kVwnl88i PyCXeE+fBHLcPxEJwktF3sTPoL8gBGDU1X32oBQeXdyPGYaiwKbLF5Tqr 7rjoAvrtzOwNYZqZ1xhl8/y8wd9TvOp2guV0Kii6PyQnlYr5lVKUDRRN5 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10259"; a="231051929" X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="231051929" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 10:19:33 -0800 X-IronPort-AV: E=Sophos;i="5.88,371,1635231600"; d="scan'208";a="486295210" Received: from guptapa-mobl1.amr.corp.intel.com ([10.212.198.79]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2022 10:19:33 -0800 Date: Tue, 15 Feb 2022 10:19:31 -0800 From: Pawan Gupta To: Borislav Petkov Cc: Andrew Cooper , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andi Kleen , Tony Luck , linux-kernel@vger.kernel.org, antonio.gomez.iglesias@linux.intel.com, neelima.krishnan@intel.com, stable@vger.kernel.org Subject: Re: [PATCH] x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits Message-ID: <20220215181931.wxfsn2a3npg7xmi2@guptapa-mobl1.amr.corp.intel.com> References: <5bd785a1d6ea0b572250add0c6617b4504bc24d1.1644440311.git.pawan.kumar.gupta@linux.intel.com> <20220214224121.ilhu23cfjdyhvahk@guptapa-mobl1.amr.corp.intel.com> <20220215002014.mb7g4y3hfefmyozx@guptapa-mobl1.amr.corp.intel.com> <20220215121103.vhb2lpoygxn3xywy@guptapa-mobl1.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.02.2022 17:31, Borislav Petkov wrote: >On Tue, Feb 15, 2022 at 04:11:03AM -0800, Pawan Gupta wrote: >> That is exactly what this patch is fixing. Please let me know if you >> have any questions. > >Just one: does the explanation I've written for this mess, sound about >right? I admit it has gotten complicated with so many bits associated with TSX. Your explanation is accurate. I just have a small suggestion below. >+/* >+ * Disabling TSX is not a trivial business. >+ * >+ * First of all, there's a CPUID bit: X86_FEATURE_RTM_ALWAYS_ABORT >+ * which says that TSX is practically disabled (all transactions are >+ * aborted by default). When that bit is set, the kernel unconditionally >+ * disables TSX. >+ * >+ * In order to do that, however, it needs to dance a bit: >+ * >+ * 1. The first method to disable it is through MSR_TSX_FORCE_ABORT and >+ * the MSR is present only when *two* CPUID bits are set: s/MSR/MSR bit MSR_TFA_TSX_CPUID_CLEAR/ Thanks, Pawan