Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1793623rda; Tue, 24 Oct 2023 03:37:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfYW5uy76WNbZOJVWCWv1LK9wv1tgnFFpnKFiBC52GZgtlLDncUVE/XhItjiIUzJEredK2 X-Received: by 2002:a17:90a:19c4:b0:27d:1369:515e with SMTP id 4-20020a17090a19c400b0027d1369515emr14690894pjj.22.1698143838852; Tue, 24 Oct 2023 03:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698143838; cv=none; d=google.com; s=arc-20160816; b=j286mXXVBrVAWTkid67Mb5nSLPGgH+aIN7n6EvFBjX/AEQVTfBn1HNlPrp/+bbyK9U OfZzxuBkDHQIpBYJO3+VyH0Rm9FYBrkMgxIDJYc7YL14ofu642B55NHe+XmdJusj/iZt DUrDuC841YKMYFnIFTZsO4k8Sl8UHebcDZ3X4uyqOow51h4bsZv0ktfALkG7gtBmZS20 7J0DkcWuWYzCV+9TppuOfr1RoWOw+XoKFVexeczfdSsnrdn+gaFEuDe7zFW4GPeIF1yD 1R69kpo1rZhxygtj6kB178LhhRlIn2DmOdoKUjX8x0J+K+ipWVOqPWY1geRkMFUIGQzZ Olow== 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=KYIweJyPgr9jAYgFFkbgWAnl0FwkE/8DRBNzonPBpYs=; fh=FtUvlj3N+mHXQqmPX59TJy8Xsw0SZcoZZJJFTd27Pr0=; b=NX3DVESbgwQnbDpBOodULVLSzD8x4HwT9Yyl2oxF2vZfa8LsJ5Fg0zfb++vPlMr4q3 AwNHof5QBRzBEadkTWyVF9yq/jPQr31iT+kQANL9d44+syuz7PmYAOKyW2eSV7lHkwuM PIhP6gf0Rg0Bj56iKh8fABLsPVZdmhvak+1b0aKDR07uxKbpJl18V0cZBz5aK8iYvm1C CsXsamB7vC+jtdQShTHEL/xwb5CCAkuXLnoT8/5R2AJyrDzAA1YX7H4yaCWZ6qqs8MFD D+zZbOXA6JeyCOAy+aQTJGkcS9KPs5BCUcibZtwrq2uu+dXfJDj2VVBD7WoHG8Pq8Ofn y2vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=EvGpMu9X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l3-20020a17090aaa8300b00274ac850fbbsi10521406pjq.132.2023.10.24.03.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 03:37:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=EvGpMu9X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 12546805A898; Tue, 24 Oct 2023 03:37:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234088AbjJXKhE (ORCPT + 99 others); Tue, 24 Oct 2023 06:37:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231851AbjJXKhD (ORCPT ); Tue, 24 Oct 2023 06:37:03 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03283E5; Tue, 24 Oct 2023 03:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KYIweJyPgr9jAYgFFkbgWAnl0FwkE/8DRBNzonPBpYs=; b=EvGpMu9X6nvshe85ULHBCy5v/f C9JgwzXXscrhZXKuDcpU31k+pwk8Xm15cBQsSR9Q6fjRNN2uOWnCjDya2gRvha5K5qoSZUq6iafSb wkyDZ8aM2xJCPR/UqcplUsQuezVo+KNxc0LYsjSiLU2reYFfzjkTDUbutGKaqrg85T7w85/nrVInl UKuPLvzxP6YocbkDMLeWXfpylzjGF1/rNATP/3fk3gFOA2FwvtkXo7ZXnXOgbwETduTvsFqRk8RaL ObomnPC3uKC/KSGTznkeClCRgJ/qVDVyJe3bLutna/bZDDns3H3f3pVakwlHIGzK9df1n6wAnYNQa Tlj/SGng==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qvElX-00FR15-11; Tue, 24 Oct 2023 10:36:03 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id D6FCA300392; Tue, 24 Oct 2023 12:36:01 +0200 (CEST) Date: Tue, 24 Oct 2023 12:36:01 +0200 From: Peter Zijlstra To: Pawan Gupta 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: <20231024103601.GH31411@noisy.programming.kicks-ass.net> References: <20231024-delay-verw-v2-0-f1881340c807@linux.intel.com> <20231024-delay-verw-v2-1-f1881340c807@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024-delay-verw-v2-1-f1881340c807@linux.intel.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 morse.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 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 03:37:16 -0700 (PDT) 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 ? That gives much better code for the case where we don't need this.