Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp626405lqh; Fri, 31 May 2024 11:09:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVgzRSMSI/g3wcmyc1abNdOhftW1OhvpLNIZwCK31mgaKaaBgFpGxriJ812WylnVqrPpPdKBIQeR/yn6gjSQ7YkTeJ0wJxItS52r6mBg== X-Google-Smtp-Source: AGHT+IEWAwD5gZx98v3jKg2BieUhX5ZoG9Xa1Z+p6GnIclT3K7PnR6WJaozOaPQe4OTVtx3EtkId X-Received: by 2002:a17:902:d2c4:b0:1f4:f1c1:647b with SMTP id d9443c01a7336-1f6370c1dafmr28024545ad.61.1717178968020; Fri, 31 May 2024 11:09:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717178968; cv=pass; d=google.com; s=arc-20160816; b=L7046p6EUe8oUjmQfNNPAFiwpMkzLR3yBbr/kpTUREmQSxV0gs3Y/ikA38R5y1WPFj sudzbefXYXRj482bUhYZwqt3wwwHj8e5Z8EEu+AOS1mlAc+oDle+jGmm3xLnjASfCzsD Hfm/td9YEQMvTVomQFw2GZkVfGCToFDa4xVt8aL5vAPD+SLrc3Qp5Pz4ZUU7QmUS9GwR hZJFOZg25qSp1zNKiNUqOmLyso5XQ7jql/cZ6fKnNNywmafleVL+atU3aBkdFkTfUBbm Q2qhVE9qAzcNeE5fSJh5Z9HjCg1xNdhUqRff1ywsTMVHBF4XPTb8zC2UuAGfbNQuEmGt pv/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=J4DABAwt9coRNe7HDAtpj5tKME6dpO4QUrZcyz3DXg8=; fh=SPVRSz1eZWHQaJjfdFJ8XEoqjNh1d6SjkQQ1RoigLdk=; b=mYwlE/D9pgj/jlL8212jU3ysL14H0Vdv1pI7vYw6JwPXjetI+2pWaGo8KqSCu9QPsg wfdxo0olSoa5c5Plc/7tlXSsaYcnQ2CGNDCIpM0r5aYnkUxl/NIvXV/Oax7lx+f6l+b1 P5I2rUrUSqCaV5OyqSNJ9Y7C2vpKU5c1yJIhHaMoQq3QMd5wjfknnkd+ShWWo2D5NfoT Zt9UE6HlnZq1KVPKfnbb/9d6dU+bD7qVkXeK/rlkrI/BWkfl8GvfU2YYGxcCO3Gc5UsI LbyI3U5xLcEp4aQNlesy4JaPN6GAup0qQ4lBT9dJm45QEW9nBHKV/ZzlVoqmjq7BNzTn 56cQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=ZPvdsPem; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-197284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323eb07asi20052155ad.395.2024.05.31.11.09.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 11:09:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=ZPvdsPem; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-197284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 47AAA287F8A for ; Fri, 31 May 2024 18:09:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB5CE17C7D4; Fri, 31 May 2024 18:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="ZPvdsPem" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E895F7BB01 for ; Fri, 31 May 2024 18:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717178961; cv=none; b=RP7fnCr788bXXFWV5CH9KKwhont4C3GUeGdrgPxDeDIp2vvtjYnnlADz4kqpur8q6ESO76+QWgLXXgXiIkxl1PNCMZMDptmcy9Ipb1Jo2KRb3+K4G/9mJqTtwgowbT8rsZrwgaZXZlSYU2mvcFJPaq5qBuocV0sSXYxR2C2ar1I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717178961; c=relaxed/simple; bh=VHiIPCuoa5EL7gZuqB1esPlDNysxs2fgLHDuYQMVg/I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AgfYg7YQaO+tOORGWTMyuauBEiBYsZFyF/4F9sQSXyB1U+2hUjhclFVOazF20N1/qNRA6bmnduCYfbUuyG0V++XNRUOJgZvJn0yjlJsOSzPCceC/hZqymTJIADH592FCGZxkOXuFGfSfaSDzva8+l5Tb36Hw9OtYIV3X2pUSdvM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=ZPvdsPem; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id C844840E02B7; Fri, 31 May 2024 18:09:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aNypjB9DdzFc; Fri, 31 May 2024 18:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1717178954; bh=J4DABAwt9coRNe7HDAtpj5tKME6dpO4QUrZcyz3DXg8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZPvdsPempdOH0eAePPcF9ueKJllAYwHqEpQ8w9cEOAkDdbF/a8PPIRt4cFYNsUNxd khQgxVYHc28S7J4XlE51Nmul9ogQKLN5ZbxnF4LgCaqcdVjdE9+1TmQk75e9ro6wUM 1P7lA4yLOFFq0ADzc/yFKZHoO+KChXXZsvuTforuZ890M7113cFGhm6FU6s/wIdgXx 8OQmc27Lki8POrwu8LVJko5UkdjORML3SFpr/oLP9lB6dIC6dH8nKTwGJW8kpiP4dT 4F9FQTvINzXHqSSTBbHHvfshWkqdjVRK4xjnHaLZXC7/DmSlMdB0DnJO09uU14bALp J1S9XmuTMRB7qyigOU3Rc7iN/qD+MvKcuUvmtWgf6mExQunTnnXSad0NsmVihjHRgc ia5JrFp75z7cF472Rsy0Uj70MWSI+pCV1+klMOFbJuy3jBu1VArQnOA96nwJXUV8gB IjB8p+sCrOxBfRvOKRmjnDxI4+abkUXu85g2D3wKVzTLc8PBS1HYHj6FEVlrjNK+eP Baq/IdPeh7ksd13VNRPjAIVN+zrEqdTh/8EqQDLKMCO3CnxPkAxPcD/N3dSsljVxOY 2ejifBJgEW3LAYKngZxRWB0fnYFLtFGQEUUuYY/BeUde8y/4k1OzZIVXODtgIMRwnp Cy96aJrA5qiDCqAkXf2EvHkk= Received: from zn.tnic (p5de8ee85.dip0.t-ipconnect.de [93.232.238.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 86C8740E02B2; Fri, 31 May 2024 18:09:09 +0000 (UTC) Date: Fri, 31 May 2024 20:09:08 +0200 From: Borislav Petkov To: Uros Bizjak Cc: Borislav Petkov , X86 ML , LKML , Peter Zijlstra Subject: Re: [PATCH 02/14] x86/alternatives: Add nested alternatives macros Message-ID: <20240531180908.GJZloSRENyzcJzW8bv@fat_crate.local> References: <20240531123512.21427-1-bp@kernel.org> <20240531123512.21427-3-bp@kernel.org> <3a86f790-3194-4ea0-de8d-0af231ec7525@gmail.com> <20240531143625.GHZlngaQfx6CiJlujI@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, May 31, 2024 at 05:10:08PM +0200, Uros Bizjak wrote: > The intention of '%P' operand modifier is primarily to be used with PIC, > where ... Ok, I'll fold in the following. I'd like to have this documented somewhere in the tree too. Thx. diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index f02867092a49..4973edbe9289 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -236,9 +236,18 @@ static inline int alternatives_text_reserved(void *start, void *end) asm_inline volatile(ALTERNATIVE(oldinstr, newinstr, ft_flags) \ : output : "i" (0), ## input) -/* Like alternative_io, but for replacing a direct call with another one. */ +/* + * Like alternative_io, but for replacing a direct call with another one. + * + * Use the %c operand modifier which is the generic way to print a bare + * constant expression with all syntax-specific punctuation omitted. %P + * is the x86-specific variant which can handle constants too, for + * historical reasons, but it should be used primarily for PIC + * references: i.e., if used for a function, it would add the PLT + * suffix. + */ #define alternative_call(oldfunc, newfunc, ft_flags, output, input...) \ - asm_inline volatile(ALTERNATIVE("call %P[old]", "call %P[new]", ft_flags) \ + asm_inline volatile(ALTERNATIVE("call %c[old]", "call %c[new]", ft_flags) \ : output : [old] "i" (oldfunc), [new] "i" (newfunc), ## input) /* @@ -249,8 +258,8 @@ static inline int alternatives_text_reserved(void *start, void *end) */ #define alternative_call_2(oldfunc, newfunc1, ft_flags1, newfunc2, ft_flags2, \ output, input...) \ - asm_inline volatile(ALTERNATIVE_2("call %P[old]", "call %P[new1]", ft_flags1, \ - "call %P[new2]", ft_flags2) \ + asm_inline volatile(ALTERNATIVE_2("call %c[old]", "call %c[new1]", ft_flags1, \ + "call %c[new2]", ft_flags2) \ : output, ASM_CALL_CONSTRAINT \ : [old] "i" (oldfunc), [new1] "i" (newfunc1), \ [new2] "i" (newfunc2), ## input) -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette