From nobody Fri Dec 19 16:18:23 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 E90132D6E62; Fri, 5 Dec 2025 17:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764954935; cv=none; b=LyBYF0YHSuDO+geKxT94Ag8BC6kFGxhmZUelLfsryeaaW8CDVfi1VohBPTeXjEJ+6Vd9LxV1JeamT1WMGSJusSyS0Q+mqQqqR016btR76g7GBWcKBSEcvT1I28VaxDUnYImK2Ton7VIPB44eOSvVD7owMN7qXXOyGD5gCO/ePkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764954935; c=relaxed/simple; bh=LO7KSqmRttHfDWSnaLJdttrenWkMfVNrb5asgKtJh94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LwqJd+uPLedAXAlQ2+RhcH2VfS/8Hd8k3Z/yQ+nArw0u+fpZHhUiZUYAkBpAhRP/ataItriuC+Kz0V+lCAxZ8J7OvZ4qtGfnLzD0VHT3xba0aUEBHmw72zpGlwOCRfZcqsXj3BOtsvOcpYajlpwzsVJPm5L0z4rvQPp0x0fjCjg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=AHL5+/vv; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="AHL5+/vv" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5B58nfPt029716; Fri, 5 Dec 2025 17:14:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ZrwD82QafFvHARSDa Xj8CqGCFuw2POsBCm8ZFs/aQCM=; b=AHL5+/vvaC/k8rb2yJ64JwTE9wmv/E9CR CwCzsUDD8TgnUW4GJyswkDFTsBU+gvzRIUBh3+tW+WPOuNsAsTrBkYwou0kLe/Z3 jd6jyPZKE/scU7mdDr6S0OEQM5qixtKPmab5KY74jCKEcZ5tP2hkfaFoZvGCDzdG VNjnZd+QyGE11YyH0z9/mIl31/hkJlrpkxojyQSxpz2fQtGXvWkAWlxRxeX9HTV9 nn6CPQir5QOYHnClaXa3PebrRVDCURFBwvoAUKYrSED1QfVrB6iPQ0Crb5Iu1eIg tSHt4mbDsnIFhwfgJc8jrkVG24G8ziv0ice0mahSOhTrlap946pYA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aqq8v664j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Dec 2025 17:14:54 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5B5HEr8n004196; Fri, 5 Dec 2025 17:14:54 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aqq8v664e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Dec 2025 17:14:53 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5B5FZ8v7029328; Fri, 5 Dec 2025 17:14:52 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4ardv1x350-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 Dec 2025 17:14:52 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5B5HEnfH61866414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 Dec 2025 17:14:49 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E83720040; Fri, 5 Dec 2025 17:14:49 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED2EE2004B; Fri, 5 Dec 2025 17:14:48 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 5 Dec 2025 17:14:48 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [RFC PATCH v2 02/15] unwind_user/fp: Use dummies instead of ifdef Date: Fri, 5 Dec 2025 18:14:33 +0100 Message-ID: <20251205171446.2814872-3-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251205171446.2814872-1-jremus@linux.ibm.com> References: <20251205171446.2814872-1-jremus@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hfxDijMk8zT6-2nFdHEnDhhwdft3gAug X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTI5MDAwOCBTYWx0ZWRfX7WDIoZH/Z1pc kVGluWZPiRJgnrV4SLpNrvQCvSAfFK2FnMbpr1QtHS2oihLE45L2Ei6uE/P9E+BZ5tWcrjVWTph RrB1uoOUjR22mbDqmI/wfNusrdp4aMWeS+a6DOstTGHPZaCp/fDLVtptFnPLx9q41MbDtbOlp+q j16zYQ+XFkuFVTpeLQDbwOuZ7Hu1zwu7U/c0wBJGc1/M+5YhvJGQuzBX72x2oZaeWU5OYHGnXpF wXIZSVKa4dDZvJ5yNegGntfQjlXnw1Hqq2vXe0zmaK6s9WjmEAyLhUiBHA/tJuzvCrYY+DX61kO V6nOekIw44Z5IUfrxgE9G3KvlK3S3soWE/kcsMlAZm3jlWgTdJRU1x6X6XujcVjnpABY09ZOhe5 2HB9QL3myHXDmC7KLuskPyXXOG/RMg== X-Authority-Analysis: v=2.4 cv=Scz6t/Ru c=1 sm=1 tr=0 ts=6933130e cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=pRS0VBzutSDFB64YrXgA:9 X-Proofpoint-GUID: mtk1nr0ebyrxbNXUxF_0U0ucU5oWzrKq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-05_06,2025-12-04_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511290008 Content-Type: text/plain; charset="utf-8" This simplifies the code. unwind_user_next_fp() does not need to return -EINVAL if config option HAVE_UNWIND_USER_FP is disabled, as unwind_user_start() will then not select this unwind method and unwind_user_next() will therefore not call it. Provide (1) a dummy definition of ARCH_INIT_USER_FP_FRAME, if the unwind user method HAVE_UNWIND_USER_FP is not enabled, (2) a common fallback definition of unwind_user_at_function_start() which returns false, and (3) a common dummy definition of ARCH_INIT_USER_FP_ENTRY_FRAME. Note that enabling the config option HAVE_UNWIND_USER_FP without defining ARCH_INIT_USER_FP_FRAME triggers a compile error, which is helpful when implementing support for this unwind user method in an architecture. Enabling the config option when providing an arch- specific unwind_user_at_function_start() definition makes it necessary to also provide an arch-specific ARCH_INIT_USER_FP_ENTRY_FRAME definition. Signed-off-by: Jens Remus --- Notes (jremus): Changes in v3: - Remove comment on #endif. (Ingo) =20 Changes in v2: - Add parameter ws to ARCH_INIT_USER_{FP_FRAME|FP_ENTRY_FRAME}. - Provide common fallback of unwind_user_at_function_start(). - Provide common dummy of ARCH_INIT_USER_FP_ENTRY_FRAME. - Reword commit message accordingly. arch/x86/include/asm/unwind_user.h | 1 + include/linux/unwind_user.h | 18 ++++++++++++++++-- kernel/unwind/user.c | 4 ---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwi= nd_user.h index f9a1c460150d..a528eee80dd6 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -37,6 +37,7 @@ static inline bool unwind_user_at_function_start(struct p= t_regs *regs) { return is_uprobe_at_func_entry(regs); } +#define unwind_user_at_function_start unwind_user_at_function_start =20 #endif /* CONFIG_HAVE_UNWIND_USER_FP */ =20 diff --git a/include/linux/unwind_user.h b/include/linux/unwind_user.h index 7f7282516bf5..64618618febd 100644 --- a/include/linux/unwind_user.h +++ b/include/linux/unwind_user.h @@ -5,8 +5,22 @@ #include #include =20 -#ifndef ARCH_INIT_USER_FP_FRAME - #define ARCH_INIT_USER_FP_FRAME +#ifndef CONFIG_HAVE_UNWIND_USER_FP + +#define ARCH_INIT_USER_FP_FRAME(ws) + +#endif + +#ifndef ARCH_INIT_USER_FP_ENTRY_FRAME +#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) +#endif + +#ifndef unwind_user_at_function_start +static inline bool unwind_user_at_function_start(struct pt_regs *regs) +{ + return false; +} +#define unwind_user_at_function_start unwind_user_at_function_start #endif =20 int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries); diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index f81c36ab2861..fdb1001e3750 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -74,7 +74,6 @@ static int unwind_user_next_common(struct unwind_user_sta= te *state, =20 static int unwind_user_next_fp(struct unwind_user_state *state) { -#ifdef CONFIG_HAVE_UNWIND_USER_FP struct pt_regs *regs =3D task_pt_regs(current); =20 if (state->topmost && unwind_user_at_function_start(regs)) { @@ -88,9 +87,6 @@ static int unwind_user_next_fp(struct unwind_user_state *= state) ARCH_INIT_USER_FP_FRAME(state->ws) }; return unwind_user_next_common(state, &fp_frame); -#else - return -EINVAL; -#endif } =20 static int unwind_user_next_sframe(struct unwind_user_state *state) --=20 2.51.0