Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1749660pxb; Fri, 10 Sep 2021 13:01:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxls0vh7dfzJ06P2aU2agHgxGxftHPBGkBpzS22jVvCUL/a83AmxHE79wMCE6CTEHNVlzvv X-Received: by 2002:a17:906:32d9:: with SMTP id k25mr11420726ejk.290.1631304115168; Fri, 10 Sep 2021 13:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631304115; cv=none; d=google.com; s=arc-20160816; b=i5meYBDk5el545bGU/oo+Wuq5iU9jY6jFL8+DFGZAsq3SedJMbUt5DU8X6WXr8r2vQ U3IylqvyFkz17a60aZpCA6ybBDR8xg2B8jXWPbx/G62jcmD92eLkjuzmXngqljQJfbmk 69JKHYXyVh735fuwk5z2O8EWFyJ5MKtAemE44825QHzVXVyuYBbiiqEeHibZT7Mdt4Wc R7Xrd9SZDhwar8ue5xPqNcpCIit0/r++TT4KBdCu3ChgoSkebrKEBrlDmSRXmP82z0Cb ZZKIsLRmtC3D8eM3biZuv6Nsf9loXGHip7scfaqkV0tEJdo9Axtix4kIX0uLqxZp8IbD 1sHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=chquAj+ypukLNoNPJFWYjEMUvJZHTqTclDYlmUvWdp0=; b=lh62nFy9AV9dGZEbrvGUtc+FRLaW38A1YN8+As7fNkTK8J0Zd6TeCI6Mj8ESN1ccV6 B2Dj3u26BAjKDakab16ojNLfsNuR85rTIC2Tj5kRidpz6rP6f2vTgiUrLo12ot0BM483 qQywy3y/E8cH1HUhVdCFk1+G1NkZpa2k3Q/Dg+DcVyN2ZCiZn+qi4S54SiCjgvJ9KVT2 xYnJLSO7I+NIcXbiDg9oynHnDSt6vxxSMFOH00YFKQ4vUTiwLdulxlWsfpuUPDxe2BGD A/I2vFdF2Gbhvv2IgJVY8qDu8isl0L13j48LFiVHbOivGNRf6CBbcMGLfjZmxnLJtaEK t/JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021083001 header.b=C+Go7moZ; 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=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si5941311edd.242.2021.09.10.13.01.07; Fri, 10 Sep 2021 13:01:55 -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=@zytor.com header.s=2021083001 header.b=C+Go7moZ; 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=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233398AbhIJUA6 (ORCPT + 99 others); Fri, 10 Sep 2021 16:00:58 -0400 Received: from terminus.zytor.com ([198.137.202.136]:59575 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbhIJUAt (ORCPT ); Fri, 10 Sep 2021 16:00:49 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8600:3c70:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 18AJxIMe517265 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 10 Sep 2021 12:59:25 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 18AJxIMe517265 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021083001; t=1631303967; bh=chquAj+ypukLNoNPJFWYjEMUvJZHTqTclDYlmUvWdp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+Go7moZYNAcJrZ3OGaA+/2RGNbqjfvGGstKaS+ypiEJWaZsFPKljh2LNeOiJhJ7d +7peCjQSrGQhp86PnToJfpvsUB6a0zvF2vCI0VRpCI2Hxx8rLR/OueiHTk9yMoh0bn 6mEY0eFlwAEEXhbKN65rH5eV3rXB11fiAVqJsIVoTxqFLtjUag29Sa2JFI9FJPEYVA SdAKReYBUnuI+HNkmV7X02pWbst5I8lpD3mDYkpZKKT6yWTMUCaMTEp298TZ8t9SwM pZ2LjhZC1V7fAcawpBWhjGy4UCh2bwS1dQ5MPvauuLjzjudSn2h2ojtZuyeCmD7MB7 Gq1Xtk2yzWQ8Q== From: "H. Peter Anvin (Intel)" To: Borislav Petkov , Ingo Molnar , Thomas Gleixner , Andy Lutomirski Cc: x86 mailing list , Linux Kernel Mailing List , "H. Peter Anvin (Intel)" Subject: [PATCH v3 0/2] x86/asm: avoid register pressure from the init case in static_cpu_has() Date: Fri, 10 Sep 2021 12:59:07 -0700 Message-Id: <20210910195910.2542662-1-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210908171716.3340120-1-hpa@zytor.com> References: <20210908171716.3340120-1-hpa@zytor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc will sometimes manifest the address of boot_cpu_data in a register as part of constant propagation. When multiple static_cpu_has() are used this may foul the mainline code with a register load which will only be used on the fallback path, which is unused after initialization. Explicitly force gcc to use immediate (rip-relative) addressing for the fallback path, thus removing any possible register use from static_cpu_has(). However, currently there is no convenient way to make gcc generate a %rip-relative immediate reference without splitting code into i386 and x86-64 versions, so add a new macro to for this purpose. Changes in v3: -------------- * Clarify the subject line Changes in v2: -------------- * Add new macro to * *Actually* generate the %rip-relative addressing mode. arch/x86/include/asm/asm.h | 5 +++++ arch/x86/include/asm/cpufeature.h | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-)