Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2011503rda; Tue, 24 Oct 2023 09:35:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7pccL6Bo48cauVP75INY5G0KQu3YLibT6SwQKOPE7k8/uGRYCjrd2XmiqD0QafkJWbS9c X-Received: by 2002:a05:6a20:e120:b0:16b:8498:7d29 with SMTP id kr32-20020a056a20e12000b0016b84987d29mr3704056pzb.27.1698165355977; Tue, 24 Oct 2023 09:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698165355; cv=none; d=google.com; s=arc-20160816; b=HDZVgGWnehfRtrR5jGTsBfwYLOr6izMmkf/3R801/5Q1CaS9HT0tMDPr6pT2hPyyUi 9KMq81XP4dwHenC+HTGL8zL765eeCe0QRS/+hJqnjxXhHgMTg1o8Vzyu46GsUZ/4cnBE DiIaZqhVlrZaBPbpjKxlSz3TtlT14yK/P2VJK2hVcRXNjHWN3s1svM8EMMrO2a8Rir1k dNF4jG2uShatISpRMklCLh6G2562c6tGH7zbWtRwsDuYlx1RwmoOwWcig13biljVy0UJ wDxAfno5zxGSOHOUeGQDiORcJDYpY79whnpF6NeAsit5dpqQgmwrLscrZlvR4fOZ94Lq xIUw== 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=1P6U1Eqbo3XGHHcUufZ4tvISNoTUxwwAwH5iWPtHp1E=; fh=q22FrE+3HPFqgIfGSDy85ckjMt4+7YeUp/9thyDx+2k=; b=UUJogfT2HMnQUx3fZZrRg8Glcq5iIuQ1j5KYTtjAD4QaCvbXTiAJecSkERkjZnTC7N jFwIQNhKPsi6MWtjXGjMMWg4tRe+/JzUQdi9mz0LCKpgD7TN1YmyuwWiTK2w/dJimNN3 6kYxll9aiCgLNdnjnYwoqF2vTra0thOvfkPPsU6p2nfOZCwzHFjOpKj/rXQ1gojkG+Uh 2GYLEDYo7bCFPyzJ8rNo5ZGMs/EVuQ5aWt05uSn7QtBi/BIDlO+9IHcIi9TgvGZ2Yspl 9fIzqNY/s2V3e8iNqlinSxrCPTfkjZ7R+CHyh7E2oGcHQkeTSDKcPJjhiYz4vsB7isxw NllA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fLyULUq7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z24-20020a656658000000b00565360714f0si8163976pgv.902.2023.10.24.09.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:35:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fLyULUq7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 664688082DD6; Tue, 24 Oct 2023 09:35:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344008AbjJXQf1 (ORCPT + 99 others); Tue, 24 Oct 2023 12:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234833AbjJXQfY (ORCPT ); Tue, 24 Oct 2023 12:35:24 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF38110C9; Tue, 24 Oct 2023 09:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698165318; x=1729701318; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vHBCAUM4hc+mv/WCTAYZTH9LHpXPIFgRr4vgKJHjnS4=; b=fLyULUq7KDymHT1vNpyTKdOPF4G3JZp/y/dTJn3Jss/cI8Knw00vfbI9 Yipno6Lt9dwXLl5EWWX94ES/gFTatAKi+S5YVkANVCqkURnezx8Z6Q2R7 j0YDg1lFjUmj7bkRpF4uaFUkrd7BFt1bOfCyKftRynSRQ78noKbhFPwhg nIyAHcJg6pVUBasGNTithF+qzHjX7NzyYj6IT4/xWl4PpfOZiHPSSxFDV n1X81BIk0IZ15ZL6HZPWg8Uum1dh1ce5XbyYLrg3Gr1e8Msb8upMjObX7 TznnOL6AsDSudLaXRmng0BN7cg2yvD6FM6P6MwekfK0/RKzFq2k3kYCd0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="453581497" X-IronPort-AV: E=Sophos;i="6.03,248,1694761200"; d="scan'208";a="453581497" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2023 09:35:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="932088939" X-IronPort-AV: E=Sophos;i="6.03,248,1694761200"; d="scan'208";a="932088939" Received: from zijianw1-mobl.amr.corp.intel.com (HELO desk) ([10.209.109.187]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2023 09:35:17 -0700 Date: Tue, 24 Oct 2023 09:35:15 -0700 From: Pawan Gupta To: Peter Zijlstra Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Josh Poimboeuf , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , tony.luck@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com, Alyssa Milburn Subject: Re: [PATCH v2 1/6] x86/bugs: Add asm helpers for executing VERW Message-ID: <20231024163515.aivo2xfmwmbmlm7z@desk> References: <20231024-delay-verw-v2-0-f1881340c807@linux.intel.com> <20231024-delay-verw-v2-1-f1881340c807@linux.intel.com> <20231024103601.GH31411@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024103601.GH31411@noisy.programming.kicks-ass.net> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 09:35:39 -0700 (PDT) On Tue, Oct 24, 2023 at 12:36:01PM +0200, Peter Zijlstra wrote: > On Tue, Oct 24, 2023 at 01:08:21AM -0700, Pawan Gupta wrote: > > > +.macro CLEAR_CPU_BUFFERS > > + ALTERNATIVE "jmp .Lskip_verw_\@;", "jmp .Ldo_verw_\@", X86_FEATURE_CLEAR_CPU_BUF > > + /* nopl __KERNEL_DS(%rax) */ > > + .byte 0x0f, 0x1f, 0x80, 0x00, 0x00; > > +.Lverw_arg_\@: .word __KERNEL_DS; > > +.Ldo_verw_\@: verw _ASM_RIP(.Lverw_arg_\@); > > +.Lskip_verw_\@: > > +.endm > > Why can't this be: > > ALTERNATIVE "". "verw _ASM_RIP(mds_verw_sel)", X86_FEATURE_CLEAR_CPU_BUF > > And have that mds_verw_sel thing be out-of-line ? I haven't done this way because its a tad bit fragile as it depends on modules being within 4GB of kernel. > That gives much better code for the case where we don't need this. If this is the preferred way let me test this and roll a new revision.