From nobody Mon Feb 9 17:21:53 2026 Received: from mail-qk1-f202.google.com (mail-qk1-f202.google.com [209.85.222.202]) (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 DF5CE2F6199 for ; Fri, 19 Dec 2025 11:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766143214; cv=none; b=k85O6qnHmnaxzkiH9W6k4o+7+4BZ9ga17baGCkTjTrGjxbiXLvqNoJIY45BQK5BLgzFyBYsWpsmXs8FG9xE5huqUUFbH1k4GBXinuQbSM5QG72rWo7BtvXxOpqOtWF6/BQIaklRlRT4fXpeVwRK/FZYOca8ztRG1nc38Q769Ikg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766143214; c=relaxed/simple; bh=2iXhpfp/aJABbrDRzG0FjAgcR+ufUymQ24M10dTOvYo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=copuG83Iyvc2KcKQYfIRzRW8//5esu626KmSEDeUDoAyLavuigCLT+bCxzzEVMcvF+K/Lhf5mCH+jXhkqqzb6S+qHiej2V0+ZnPZuEm1uES3/mmPmIHvUZdmO4rrKIKiLlMA0IJYHVkQJmdAnnyeTZHTVNxYmTZwW+WCQrLAtnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=J98PvK7H; arc=none smtp.client-ip=209.85.222.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="J98PvK7H" Received: by mail-qk1-f202.google.com with SMTP id af79cd13be357-8b259f0da04so365133085a.0 for ; Fri, 19 Dec 2025 03:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766143211; x=1766748011; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SSucSGSxJIEKPHcbjenWb72LitkKX+M2VvSq7chS5ig=; b=J98PvK7H86taC8uKuK/DjEkmMbI6KmDhjXQNFIVuYep7mOU7pnY4+1+oKUYGTC4NPF bofNoRVqh8XMX4NPeiQjsXRChtpq/vKqJ7AqyIBquyT4TvwaMy9Y63cZGLi5aeRYeUWR SeHq0gDDCXX+QLFmNX6cXlTSaIogJfgQdRljMGQX7eX8p8vy+HGUGp/ZQs6R0smYhe1e OV/nlmT8znBudEkkuQMkEr3alI0jBiMClH7CKo0evFh/h/F0CoukoSIBqm5ILp+OU9v3 Dj6Kn1b38bglhhfouogzCmOnsdrZ9k5z1F9yZMcXD7imvft7JKO27N/l8yVYF5C6ax4w fEPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766143211; x=1766748011; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SSucSGSxJIEKPHcbjenWb72LitkKX+M2VvSq7chS5ig=; b=IS5O6Ogq/6l2ewArsWsH18RrqLdNGDxn3qTaPoTj1sXGilYbl3yEr3wI9H9PKnqk3b IPnORmVd3DCQafxi+GJmTigB/ELLXJ6garv78Dn/oCg7syBcnisV1wS44U28+81//r6Q yzoMEktzZk3pjGc3LyjSZM/ChdILjN7L1+XJpXokKWU8RnldUJSWC+FAIxD1m4r6ppZh 5iuCa7S5bfr29ukuqnhcfy4N2jXFGFoUsNH1dRQ4NJfOJyFzJu8MMjIbw1r61g2EURUY tzFmRVJ4OwJXuQeHPx6IhtcxOvQPC1UcNLeC9yFL215BdduXpg3J4xmCWkWkTbRA7ak7 hjcA== X-Gm-Message-State: AOJu0YxQBGctVj2WBZGCFb0CzCdeqG9rWRKJNqFXWg+/oGJEpo0lu70+ EBUgNCgDiGdyvJQNklVu6WzaNbTlm6DypJd9xCgj+GOWbNFyhRqnVlvMi+yB6+62ix6QEDB/HYN iu6f1o6WYAV3gfg== X-Google-Smtp-Source: AGHT+IFoOSXeGtghRJMXRrF4J3HTURppkkwOHbfn3+ULqrAqx9DCt+GMs0OnHqm+zrkUyx6cABnFpqm4E8LpPw== X-Received: from qkau19-n1.prod.google.com ([2002:a05:620a:a1d3:10b0:8b2:217d:fc3]) (user=edumazet job=prod-delivery.src-stubby-dispatcher) by 2002:a05:620a:4711:b0:8b2:eea5:3324 with SMTP id af79cd13be357-8c08f664d7dmr403956385a.27.1766143210861; Fri, 19 Dec 2025 03:20:10 -0800 (PST) Date: Fri, 19 Dec 2025 11:20:06 +0000 In-Reply-To: <20251219112007.2827302-1-edumazet@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251219112007.2827302-1-edumazet@google.com> X-Mailer: git-send-email 2.52.0.322.g1dd061c0dc-goog Message-ID: <20251219112007.2827302-2-edumazet@google.com> Subject: [PATCH 1/2] clang: work around asm output constraint problems From: Eric Dumazet To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Uros Bizjak , Linus Torvalds , x86@kernel.org, "H . Peter Anvin" Cc: linux-kernel , Eric Dumazet , Eric Dumazet Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Work around clang problems with "=3Drm" asm constraint. clang seems to always chose the memory output, while it is almost always the worst choice. Add ASM_OUTPUT_RM so that we can replace "=3Drm" constraint where it maters for clang, while not penalizing gcc. Signed-off-by: Eric Dumazet Suggested-by: Uros Bizjak Cc: Linus Torvalds --- include/linux/compiler-clang.h | 7 +++++++ include/linux/compiler_types.h | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 107ce05bd16eb4a2ecb0f8cbf5c9efeab1845a1c..a82db8ab2812b9aa8851bf51dae= d3f81d2a41979 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -146,6 +146,13 @@ #define ASM_INPUT_G "ir" #define ASM_INPUT_RM "r" =20 +/* + * clang has non optimal behavior with "=3Drm" constraints for asm outputs. + * It favors memory operand, forcing additional logic in tail functions + * when CONFIG_STACKPROTECTOR_STRONG=3Dy. + */ +#define ASM_OUTPUT_RM "=3Dr" + /* * Declare compiler support for __typeof_unqual__() operator. * diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 1280693766b9dd844ec7ca83053381799be12456..b66aa58dacd595546b17582df03= a762dd23cb15c 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -548,13 +548,17 @@ struct ftrace_likely_data { =20 /* * Clang has trouble with constraints with multiple - * alternative behaviors (mainly "g" and "rm"). + * alternative behaviors ("g" , "rm" and "=3Drm"). */ #ifndef ASM_INPUT_G #define ASM_INPUT_G "g" #define ASM_INPUT_RM "rm" #endif =20 +#ifndef ASM_OUTPUT_RM + #define ASM_OUTPUT_RM "=3Drm" +#endif + #ifdef CONFIG_CC_HAS_ASM_INLINE #define asm_inline asm __inline #else --=20 2.52.0.322.g1dd061c0dc-goog