Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp44191rwb; Thu, 6 Oct 2022 14:14:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lXA0bx1+0CUt+vS9c6w3TGVUERlf7sn8UMaCkv1Kub1y0ZoP9/RUAP+ShiqL9wjHT27h7 X-Received: by 2002:a17:902:d714:b0:17f:5813:1df4 with SMTP id w20-20020a170902d71400b0017f58131df4mr1816587ply.148.1665090896802; Thu, 06 Oct 2022 14:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665090896; cv=none; d=google.com; s=arc-20160816; b=TTGsztMcH3/DftQ7PVokAHdKsyv9Hv7/aL8uRuEOV6n1jNYEy+VSh5wlG9pY0H9Mil jozLWTpwUJiGoerpQmCUUggUk5hSEr6wwr0vqhiI64FcRQQx/wPzxx2Rsxic9bKnjKF/ 0LBMvWk39uBiXOcJxNABH1chZETVZziWE2wr+akTQK/pVQmHo7HnzDNrQKBu+n5rAECR Jnq/Vf618b8QqepQVwGrfVUakZ8rNsXTywgO2AGWaoeDh49T1FjHc00OWyTLgO12Tuwx N5i4jhnhaQK39XOJwFDtGVpq0khqizQrtx4DJm0k0HtiEMiBZhb1/frDNMGSzALAX3e/ Ue2A== 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=Tes0madONZScJefM8sUzOGl1lgaC9WI0wDedhGmunZU=; b=WqKibGoCSoC+GI870Ppg1B+oiuYrdCN1+ANJWpyvyfocG4Vj/he3wNvbx7BZiOJk4y RGmMdzG28CAYUnlAscVpZIiZsUGPoQ2cM7qgQujciZ6xPrc7A13J7IzG1yvGYQWqEmt7 bKqK8bVFCApU+hcdrw9ByMfNSdAEEbK2F5ltveqlHJxPu7icnLDGPxRfbQKKzOFuxJvb H688J/K/QQrqDGHK/KNi8GFYRFzb+nIQj84ymml+//1yza9DUJTrsMdY2xVGO/qZoDCP JMUwMRIwNWR7h02EFk9GJgcyYdAyCkIWG9QXCV9tzAzY918UgWVW6TH5FsRopsxABg3P rG6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="fcgI/2O6"; 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 b35-20020a630c23000000b00450283e2ae6si603129pgl.623.2022.10.06.14.14.44; Thu, 06 Oct 2022 14:14:56 -0700 (PDT) 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="fcgI/2O6"; 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 S232138AbiJFU1Q (ORCPT + 99 others); Thu, 6 Oct 2022 16:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbiJFU1H (ORCPT ); Thu, 6 Oct 2022 16:27:07 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14890BEAC4; Thu, 6 Oct 2022 13:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665088026; x=1696624026; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Tes0madONZScJefM8sUzOGl1lgaC9WI0wDedhGmunZU=; b=fcgI/2O6CVq8TmeiYdipyySAxtBBcrPIwDToi+bQPZMiFhK4aTj/gMXd PlGvrAD9YhnvusHb2oRFF32PnmiTRLmzObDnYyPU1h9NLjdIu7lEuyz9r 3wZheAv4e+idnep/UnG38qdlhl7UJON1mt4mnLwS+/AbMhSvPBGsLeSDe MHYxK7PMdWIa4LEwq+WIPZ74g+HW/Oj4AmTW/nylknkzOAXivUnjEfnES pWyd4h96KiW9jDcif6Uon5nOIvrxVdbpPQCQTECTeGLTU116tISzbQcqV iVgoFjGtNKsUwB0B0ZBUNUtfbnEhy/353dLpdxSdLnQoaPt8AhNc2DHcr g==; X-IronPort-AV: E=McAfee;i="6500,9779,10492"; a="367688852" X-IronPort-AV: E=Sophos;i="5.95,164,1661842800"; d="scan'208";a="367688852" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2022 13:27:05 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10492"; a="655763947" X-IronPort-AV: E=Sophos;i="5.95,164,1661842800"; d="scan'208";a="655763947" Received: from spvenkat-mobl.amr.corp.intel.com (HELO desk) ([10.209.50.56]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2022 13:27:05 -0700 Date: Thu, 6 Oct 2022 13:27:03 -0700 From: "pawan.kumar.gupta@linux.intel.com" To: David Laight Cc: 'Jim Mattson' , Suraj Jitindar Singh , "kvm@vger.kernel.org" , "sjitindarsingh@gmail.com" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@suse.de" , "dave.hansen@linux.intel.com" , "seanjc@google.com" , "pbonzini@redhat.com" , "peterz@infradead.org" , "jpoimboe@kernel.org" , "daniel.sneddon@linux.intel.com" , "benh@kernel.crashing.org" , "stable@vger.kernel.org" Subject: Re: [PATCH] x86/speculation: Mitigate eIBRS PBRSB predictions with WRMSR Message-ID: <20221006202703.efa3ovs4eckevire@desk> References: <20221005220227.1959-1-surajjs@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.3 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 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 Thu, Oct 06, 2022 at 08:25:15AM +0000, David Laight wrote: >From: Jim Mattson >> Sent: 05 October 2022 23:29 >> >> On Wed, Oct 5, 2022 at 3:03 PM Suraj Jitindar Singh wrote: >> > >> > tl;dr: The existing mitigation for eIBRS PBRSB predictions uses an INT3 to >> > ensure a call instruction retires before a following unbalanced RET. Replace >> > this with a WRMSR serialising instruction which has a lower performance >> > penalty. >> >> The INT3 is only on a speculative path and should not impact performance. > >Doesn't that depend on how quickly the cpu can abort the >decode and execution of the INT3 instruction? >INT3 is bound to generate a lot of uops and/or be microcoded. > >Old cpu couldn't abort fpu instructions. >IIRC the Intel performance guide even suggested not interleaving >code and data because the data might get speculatively executed >and take a long time to abort. > >I actually wonder whether 'JMPS .' (eb fe) shouldn't be used >instead of INT3 (cc) because it is fast to decode and execute. >But I'm no expect here. I have been told that INT3 is better in this case because 'JMP .' would waste CPU resources.