Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp865624lqt; Tue, 19 Mar 2024 06:24:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8ZektG48KeNgN2BKJwZ0UehHBB32od37bdb92Vfrj4QTgmZdkxOgJddoz0+qD3Ly2iXzoeLclf3tE24TNEVt7hdVlPou50IS6tKBLRg== X-Google-Smtp-Source: AGHT+IFzmXgvnQcSAimWwRnoUPVOejpO7r2sCM29JI/iguKx0MQCPwWDtq4fX39pXZ9E6Rb+5EOx X-Received: by 2002:a05:6820:1e10:b0:5a1:fb:f072 with SMTP id dh16-20020a0568201e1000b005a100fbf072mr2614863oob.3.1710854665736; Tue, 19 Mar 2024 06:24:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710854665; cv=pass; d=google.com; s=arc-20160816; b=Y/VS/KAOSnhZJxOA/xiGw/jqJHzF2OgCuxQ8EJ3D9/sckLEk81wHD1+E3YAAAFxeiE 0dZPJRafLbQNNsbvyK8+NH9+Gv3YC9tC0HBfu6MCV8fbbnjZ5yCfNzS0/YK/FheHkyt7 imKo9rY8TMVRu0eCjDsoM0XZrN4GXbI6KxQQ7ygDZW7sKfOjNUUJKubM1jVKEy03eGdb pKqb7/L3Dlzu832f0nM4cfN8KxrFjTrNNbBPydbfxIv6JlMUeFgoWK9ZlrN/itCghnzf A+yor+gnr7faotiSgcpQDA6hosogXPphzcZDBB2E76w/ChYuxmqiYaya0bCPPznyjTF/ TvtQ== 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=+zj3ZaLyAv3SkG5Vq41cklaD23PSmzrOWDDpGwJYwUE=; fh=qC0C2C6W/jNU/Cqfhm5KiEwmsaj3qOA6ktNNIsQKs5c=; b=ZxsfJqfktB8o1RC4HFXw5fQX0Otdk4Y3+YLvtBfEKGL/rIDQWH8zZmob0ad8RUwKzq 4moSvj+TO9ufhSoRjhf0Fbkqm+f5U2wu8R5eXEL2tpZwZrcM8IDDoSyJ/l5wTfp5eGMW Yt8nyCncxZnBup0AnowO1dI2qMuplfVTy4ycxXg4/lZGe9ymFduEmBBdR23X64rBgjz9 7N96vkSsJf4T/+wmPcMj0VkdwgHvC0u0BNcTo6O0fo6KDXBptXtKIBOy9FEtA45Kond6 0e7h9SaDniaJWtelYYRgvslSfx3zhlMRJT6yrEqT2WulpQmntHujymWvCzCz2RaAZz98 QdXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=noqT1yq0; 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-107584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gf9-20020a056214250900b00690068429b1si6700213qvb.349.2024.03.19.06.24.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 06:24:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=noqT1yq0; 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-107584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107584-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 675AE1C227A0 for ; Tue, 19 Mar 2024 13:24:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E21378002F; Tue, 19 Mar 2024 13:24:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="noqT1yq0" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 5502F5A782 for ; Tue, 19 Mar 2024 13:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710854660; cv=none; b=mbOYwol+ALjP1PnAjnNmXWqxQmcnaPcBtwaq0tI4p02M91ti0mww9jwBCQhbje6peBsaNEqy7xl8QPclEJvyEtYfmHB6pa3aoJbTxYjtiD+wjKqhXLyE5KHgW8AZ0W+a0DwyTQy0LvfohpqKtH5m25K59HEzbFcBhzwPXDH4h+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710854660; c=relaxed/simple; bh=IvLkjdjQGF/TCP6cddg87/pEKPLedEzEkFzH9n8rqcE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=hhjhwXseeeNJCdIByMUmK5Pr95gTI1e5NgqzuD0DYw8Dj2ZcFdAkBW/f1mTB13H+qPnqBBhHrB/K7Y/ZiI6fzmK0UqjoPlyx+HaF21UKKZjiWdgyvh0oa7xZittZ4D74F5Vud6wCHpWfRHC+J3tV35ZSU2ttUK5R0YzWX00Hcgw= 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=noqT1yq0; arc=none smtp.client-ip=209.85.208.176 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-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d24a727f78so64700411fa.0 for ; Tue, 19 Mar 2024 06:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710854656; x=1711459456; 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=+zj3ZaLyAv3SkG5Vq41cklaD23PSmzrOWDDpGwJYwUE=; b=noqT1yq0Vp0+bMsyyiWudJ60kPwxNNT6RE2SZ/5vbgR7vShw4NSe5wjExHVhmYgZ86 FPRAliLoIXxsUZrMWG+0fL+rIg9qoxWnRFmfiVyr4zMIoTscPdzsBiEOselQh9cdB9vo JGfZEyGBEaYCyv7FnRonrM5Igyl1zhlaTzXCAXa3h3LC7LpCVy5w1HCgy+wwnbHBsjFO 20ECycNjbPPR8yscOgfHAOWJbSr1qUB7Zpl5RoZyye1SmOhPftfbzM63A0eD1LxzSWyO dwp2/4f1+Js4FFqmvR24eaSdGrBe2E8tKkh4VkZZik1hlWWctancbW9DU8CcVlkN8V4n olyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710854656; x=1711459456; 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=+zj3ZaLyAv3SkG5Vq41cklaD23PSmzrOWDDpGwJYwUE=; b=p8P+/Z19cRmy/jD9AWNjvnG5EDI1AzgmtuzCSbA0ERJ+Wj7NnTzG9vIqvOF5HnyKC5 XGPORb7UmiuCB0/5Fq9h8KmXMxv6eYA5rAK6yhDbHdodu9ExwEcNk2hK1Ic6ksNd7sUG OGf2NdOtjhDoRLHFV0eldV2iUfatW5aDKbDHRgQxE4qhS4GR9SuVAVFtHP3EuVobIySx LjqZiQzuQ1rSpt8o94Okc32+eU/iGTryliVgXrwOUa/7qHkpEUjT5LIwHZTDcvgFuhYM J9WDhavtwf65jZTkUNSyKuHv1Yo/0hHLMLSOYqyUrLHTKLYD8S59pYh85aTSgXmLkX7r VvGg== X-Forwarded-Encrypted: i=1; AJvYcCXzfda8mhzpbMOPfAt9OOSkrajAV04dq8tzBXVtyFUocjLcnu8WU88uiGnOb/T18l8iAQv3/BxItq7WkxW7S/GxhAWkTBvJal4j5Zmi X-Gm-Message-State: AOJu0Yz+yQ3eu0uDOe/1WVd8RS3wheAJ8C/DkIcakgdbzebukDe4z4BH maKYaLbhKH/Bl3TZrEEXBU0f5lnK1hpwY0y3ITHZd1oFvZWDG6UTni9lWBxXC58ElN+3idwfssM dg6x6hoArCapMLdRzhzEU/ZCXDXg= X-Received: by 2002:a2e:9c07:0:b0:2d4:3dbc:16ec with SMTP id s7-20020a2e9c07000000b002d43dbc16ecmr11569534lji.20.1710854656221; Tue, 19 Mar 2024 06:24:16 -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: From: Uros Bizjak Date: Tue, 19 Mar 2024 14:24:04 +0100 Message-ID: Subject: Re: [PATCH -tip 0/3] x86/asm: Use generic asm operand modifiers instead of %P in asm templates To: Brian Gerst 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 2:10=E2=80=AFPM Brian Gerst wro= te: > > On Tue, Mar 19, 2024 at 6:44=E2=80=AFAM Uros Bizjak w= rote: > > > > 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. It will work. Please see [1] for a testcase. [1] https://godbolt.org/z/eb6rcz8YW Uros.