Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp860232lqt; Tue, 19 Mar 2024 06:16:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3UpimzvwoA8OsWLuYQtOicnyS1etm4U1Qn5TXSxLVddUKf9jtfyn+lgOKkqnWXL+fIKznrRG1vI0ySKkNzNUF476zBCTet/p5NX7wZA== X-Google-Smtp-Source: AGHT+IGH5mNDCv6hxXFShzhneaenpSj0KhgFpw2AgDHboMFufUTbWO9S0w8DDYNA/yFFrydi27sj X-Received: by 2002:a05:6a00:a0c:b0:6e6:99b0:1813 with SMTP id p12-20020a056a000a0c00b006e699b01813mr20092118pfh.17.1710854161438; Tue, 19 Mar 2024 06:16:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710854161; cv=pass; d=google.com; s=arc-20160816; b=gujbxx5rPe5Zqhp5UKAEQKlelymQPpIJzOPiIS92VrdLFzh8Af1WsBa/eC85TdCTyz xrVHnFgNMYb1p4j2lqgiarbzv+UKDojvmpmwv9vjaqi13qz8mKFYSAPXv1pox1blInzX GNI9oVo+t15U8z6sIQqZE2iRmltuq2sJgZ9OW11cPX7EnadePxJW5ETlLhH5IPsHQmv7 cwpmqbbisfXGA366UQxp0BJ3d9SALEFnVsTU8WOjBwjBgtVZn6VE9zEFoeuE69LqviWX QmXtWMRU/d+t/Hm13l91u4sw6uu7dOR8XKcrdRqzH/z0Z2jv9Q0RDJr7vd9fes1xWuRJ tvLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Iy9c4kHlPN+YL7k6cDR7TckwLJz+xP7Q/3HFbDS5m8c=; fh=0paBP6eoBNrN2G5KmnyEu7DzaFVJLTFbCt/SkeQi7gw=; b=vd5VZ8IO8arOCU6x5X3dJexewVkosVgCHMaTFI2excQmqj5pR5mE6E8yqHIQEptdEw mfo1nJk/6SQr5o+cGt6TKITcm0jywgMrvzUt94IkIhNGqdz0K66R3tCT+u5re1slOlte BBJAV6K7PzPoCRlKH1+Rir/jhaDqa0ctqDmFoF7ZadTJUP2rKA3d2MsUErKmw5tOxRvk woPU/DWbvY89m5bNJmMGgFmHjGC2QMdUV0uhJzFX/j2kvPs0IBxnr1+mAdNiiw19fjml ZqTO8DyZ1free42ONRa3wmR2cFjImz8nMxJfeXXsorx7EKIYvU6qfb9pJMyqyRNiIWC+ Hxbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BvImBKnT; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-107570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id gx9-20020a056a001e0900b006e6bc5376a1si11092078pfb.20.2024.03.19.06.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 06:16:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BvImBKnT; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-107570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E2CD6B23616 for ; Tue, 19 Mar 2024 13:12:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8B1180023; Tue, 19 Mar 2024 13:10:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BvImBKnT" Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FC9958230 for ; Tue, 19 Mar 2024 13:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710853808; cv=none; b=B0dt4VMf0QL9i/6VvJuIIq6FjM+6UPf+7/2IfM1D6AoAZkvUBd1PkQqQR+dG3J3E7+fn5aJQz5KZ9GNpLL+jlFkIZtv80q53BDaEffTyRApIXTOOb8j9ZXT7DYw0WCN8RmRcpzedgTbwN4g79XhACFxPoOW68Jqe+7bDEfbz3W0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710853808; c=relaxed/simple; bh=0dvYBcaS+GLzeeTigmUeacFy9DSO3NmaRo/kJjo+lH4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=k9faYMb4NP7JtqW8l4H63iDYObz1R0v14VAhMhppCQ/ZRxZ3qs7ncMd1cO32RbPJvwHtgRELi1qohQmG8xgUKVmIosW7wFSyxq3fWHgQ+Z8JfZGp2v0joWRg5Go9Y9H/yWAgChP0zXZCVUnEinwq70uF2yGbwVV3kwsPYpA83Vs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BvImBKnT; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6e67d42422aso2496940a34.0 for ; Tue, 19 Mar 2024 06:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710853805; x=1711458605; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Iy9c4kHlPN+YL7k6cDR7TckwLJz+xP7Q/3HFbDS5m8c=; b=BvImBKnTrAIdxq5vfS+0BnP6sMfhtXEYeTU3duURtXpNNhYud18Nkebeq/fwzcYjKw xDJavSuRjHWt7x6aAAmNu4qeiOoXonlzVhhlcuYJb3BfofhNdQt+sSIwHbLHS871IAla W1Ds0CFiFZX2CnJcd9jY6g3BdVf8/ZZrsaHtpqop4YMH0TR/b0Z5oHsmWbiHxR4hMHei wFyQwfxR1ryCyZkcNWIcQuq5O/UWT2Zhe0apjsxQNigH//gdtMdYcKfqN/biZI5A3C0I ItPrr22NJWh0k8ZToIa4DoLw+y97JCVTmiDa8iVjDuDGgr0yDSe2JFYs8FJKrbc3tcAD gPaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710853805; x=1711458605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iy9c4kHlPN+YL7k6cDR7TckwLJz+xP7Q/3HFbDS5m8c=; b=naKHVhdyGoYHXvOrQlWsY4S2wfU26Za+ur86qwP79mjIoDYGtulxEs8BQTqpiauCGq Jmjej+8x6GIOS3QZ8lQlt230Jp9lkEH1jX+d1d0eAjHg7sXIwD6dg1Ap1FgCy35WHanj u4CwiAZmkGWWJjoFC4D5J9shc+hCXaIsuK1upkOtdiGzHQGmGGpLV8tQ6l0EZ6ffo8Ro RQmM+VFol0NkkG5ZdhUq2s9EZlI/eEz+PUAIQnRqKYosHNoH8PZ5q5Lqri3yFwT8hg3B 66xOuNAJ5YhR2YGQOVSkHX6PuaKh++OMjAJqL/B+ZZW0z6lDnp0c+6J3rTKA8u7++VF0 uLRQ== X-Forwarded-Encrypted: i=1; AJvYcCXj3hsHFNVakrF0aGr1Z93WMfOG85A4b1aCm9tF2yyxTFpPwmCekppcu2lXR+VoJA/P8BKQxQ63U/f4KVm14a4jjp6GJ9LhNE/K3ceG X-Gm-Message-State: AOJu0Yz8IGPvgmUUKo++BgA8Lv3GvIHIvhoqimp+0wCvS34idAAU8JOw FPxEoC7YZCZcC5kTh4J9wJoYmpfFZZla+R2syqK2j1OceW++vVsr2wBu7eD6q6NZEF7rm8F45UQ JdpPQxCXoc39Egwd3MItKJbOrjg== X-Received: by 2002:a05:6808:3843:b0:3c3:889b:9877 with SMTP id ej3-20020a056808384300b003c3889b9877mr8560204oib.37.1710853805539; Tue, 19 Mar 2024 06:10:05 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240319104418.284519-1-ubizjak@gmail.com> In-Reply-To: <20240319104418.284519-1-ubizjak@gmail.com> From: Brian Gerst Date: Tue, 19 Mar 2024 09:09:51 -0400 Message-ID: Subject: Re: [PATCH -tip 0/3] x86/asm: Use generic asm operand modifiers instead of %P in asm templates To: Uros Bizjak Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Denys Vlasenko , "H . Peter Anvin" , Linus Torvalds , Ingo Molnar , Josh Poimboeuf , Sean Christopherson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 19, 2024 at 6:44=E2=80=AFAM Uros Bizjak wro= te: > > The "P" asm operand modifier is a x86 target-specific modifier. > > For x86_64, when used with a symbol reference, the "P" modifier > emits "sym" instead of "sym(%rip)". When used with a constant, the > "P" modifier emits "cst" instead of "$cst". This property is used to > emit bare symbol references and bare constants without all > syntax-specific prefixes. > > The generic "c", "n" and "a" operand modifiers should be used instead. > The following table shows the modifiers supported by all targets and > their effects: > > Modifier Description > ----------------------------------------------------------- > 'c' Require a constant operand and print the > constant expression with no punctuation. > 'n' Like '%c' except that the value of the constant > is negated before printing. > 'a' Substitute a memory reference, with the actual > operand treated as the address. This may be > useful when outputting a "load address" > instruction, because often the assembler syntax > for such an instruction requires you to write > the operand as if it were a memory reference. > > Also note that unlike GCC, clang emits %rip-relative symbol > reference with "P" asm operand modifier, so the patch also unifies > symbol handling with both compilers. > > No functional changes intended. > > Signed-off-by: Uros Bizjak > Cc: Andy Lutomirski > Cc: Brian Gerst > Cc: Denys Vlasenko > Cc: H. Peter Anvin > Cc: Linus Torvalds > Cc: Ingo Molnar > Cc: Josh Poimboeuf > Cc: Sean Christopherson > > Uros Bizjak (3): > x86/asm: Remove %P operand modifier from altinstr asm templates > x86/asm: Use %c/%n instead of %P operand modifier in asm templates > x86/asm: Use %a instead of %P operand modifier in asm templates > > arch/x86/boot/main.c | 4 ++-- > arch/x86/include/asm/alternative.h | 22 +++++++++++----------- > arch/x86/include/asm/apic.h | 2 +- > arch/x86/include/asm/atomic64_32.h | 2 +- > arch/x86/include/asm/cpufeature.h | 4 ++-- > arch/x86/include/asm/irq_stack.h | 2 +- > arch/x86/include/asm/processor.h | 6 +++--- > arch/x86/include/asm/special_insns.h | 4 ++-- > arch/x86/include/asm/uaccess.h | 4 ++-- > 9 files changed, 25 insertions(+), 25 deletions(-) > > -- > 2.44.0 > My one concern is does this work with older compilers? Technically, GCC 5.1 is still supported. I seem to recall some issues around these modifiers in the past, but don't remember any details. Otherwise, it's a nice cleanup. Brian Gerst