From nobody Wed Oct 8 17:29:50 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 671E229AAEA for ; Wed, 25 Jun 2025 15:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750866178; cv=none; b=pQU6/ZZM1Rpa0MhSg1eWiYDCXNMx9PpmK3/T/yOgQ0x4nbYWcdBWpweEpqWNe5G5P4WUeoYYN0Fez5e5caxvaBfpb7L/SSKMI/YjRQV43xryURvPrM3IkRLZdijw14Uo4sDc3L79BaGhGXwygXSdqqFOL07dYXNnLXd2JqQiZXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750866178; c=relaxed/simple; bh=M44cOwDSOzwK6ucelmjTStq0tllOXs3obltXPDfLdQ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mDf62FbvBhxqpgLGJiZQ2bxftJqMMDZiZqP+uMZePlH0jRP/1mqXOwPIFdXAmVfeEOf5LIcUzNbbj6DEzsYpM3tENXGaXO2lmLARMlAjB5BIzzcAlUOUULcpC0sgEpxuJUngnOGv9/8sKfdW+HGDhR2/Obqt5MpyuDQ1b64QifA= 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=iCXlHVN3; arc=none smtp.client-ip=148.163.156.1 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="iCXlHVN3" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55PAXcgd022278; Wed, 25 Jun 2025 15:42:45 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=vyEEqkmbNpakBZYSZ 1/rYXdlcg4gTMeSzG/cKgH2nlU=; b=iCXlHVN3yQocUdft/xe1wY5bAu2URlZ4b AJadqzJT69vck57uvHmk026pdX5S8nx39jNbN0x1gVBP56lDTWuPPyNzhvnNfBU4 klLoiHmGqiOKymVt4e0lxATmVY7rCaDsstPjJ2RZU3C1LZNet5/2oYsDUsaX8yri DH/U4gzjhq7P/7NtY51H2czUS40iY2BvTXj8QTXE01T72wcIHb/Xq4kJegLMul2T ziC5/+zACslSB15T/36ahgS5TDK6qS3LSoijwaGcmeyHZZkVZ09/JdeG5Zp/RoEn MkYKAd7UQI9oh4Nf3nstAuU2fZR2kNGIcKwpCxFvxMnuEeehnpF2g== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 47dme1gbpw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 15:42:45 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 55PD7n9Q014987; Wed, 25 Jun 2025 15:42:44 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 47e72tt9m4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 15:42:44 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 55PFge7m56492540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jun 2025 15:42:40 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B32FF20043; Wed, 25 Jun 2025 15:42:40 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 494A020040; Wed, 25 Jun 2025 15:42:40 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.87.147.188]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 25 Jun 2025 15:42:40 +0000 (GMT) From: Ilya Leoshkevich To: Jan Kiszka , Kieran Bingham Cc: linux-kernel@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Ilya Leoshkevich Subject: [PATCH 1/2] s390/boot: Introduce jump_to_kernel() function Date: Wed, 25 Jun 2025 17:36:51 +0200 Message-ID: <20250625154220.75300-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625154220.75300-1-iii@linux.ibm.com> References: <20250625154220.75300-1-iii@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-Authority-Analysis: v=2.4 cv=Tc6WtQQh c=1 sm=1 tr=0 ts=685c18f5 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=6IFa9wvqVegA:10 a=VnNF1IyMAAAA:8 a=kbgPvGLC2egfjOHORFIA:9 X-Proofpoint-GUID: nhiHWanJEGOS7HP6NvY5FqU6yn5WIlvk X-Proofpoint-ORIG-GUID: nhiHWanJEGOS7HP6NvY5FqU6yn5WIlvk X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjI1MDExMiBTYWx0ZWRfX6K7374vUKs2d edUFeugOzVOh7ioaNg/yUpOrCjeRqgwBT+T1KITOHWfDHiFt6F6VQ1Hu4nv1VbkZbfqjwyk7dOH F4GZZR6rQux3AzhI9hGO+319l187AjgklGu48qs7KI8BxIwgC88noUi919xndAOVoka7/dQsBuB Lj+eWNd9CMFGgoKsR3CXCoVxKLNp0o7Df/gz6rDIW62PWtD4sx5aZaErdN1w67/lXJT3Yq5Zd88 esLfN0sVLHplYPEULyxo0hUcfVT70qtN9v7dYlIvdTRoQj2Y57ylReFtm4kbXNLjNp4TGxF0LBL B+6qYDxU1rPYpMH+NY1YNEotE7V8Zfd/bSugoG7JORrbhA6Exz0cBsX8/cW+mVTXKvlm3tO8pmB URSlcoRxNUO4IUGq6kW30h3a0wBe6QTDciLPQ+H6oaLPW+Dh9L0g7LIPINrzodWuNOYIKKxZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-06-25_04,2025-06-25_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 malwarescore=0 suspectscore=0 impostorscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506250112 Content-Type: text/plain; charset="utf-8" Introduce a global function that jumps from the decompressor to the decompressed kernel. Put its address into svc_old_psw, from where GDB can take it without loading decompressor symbols. It should be available throughout the entire decompressor execution, because it's placed there statically, and nothing in the decompressor uses the SVC instruction. Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich Tested-by: Alexander Gordeev --- arch/s390/boot/Makefile | 2 +- arch/s390/boot/boot.h | 1 + arch/s390/boot/ipl_data.c | 9 ++++++++- arch/s390/boot/startup.c | 2 +- arch/s390/boot/trampoline.S | 9 +++++++++ 5 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 arch/s390/boot/trampoline.S diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile index bee49626be4b..30ceaa42224f 100644 --- a/arch/s390/boot/Makefile +++ b/arch/s390/boot/Makefile @@ -27,7 +27,7 @@ CFLAGS_sclp_early_core.o +=3D -I$(srctree)/drivers/s390/c= har obj-y :=3D head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o v= mem.o obj-y +=3D string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o obj-y +=3D version.o pgm_check.o ctype.o ipl_data.o relocs.o alternative.o -obj-y +=3D uv.o printk.o +obj-y +=3D uv.o printk.o trampoline.o obj-$(CONFIG_RANDOMIZE_BASE) +=3D kaslr.o obj-y +=3D $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o obj-$(CONFIG_KERNEL_ZSTD) +=3D clz_ctz.o diff --git a/arch/s390/boot/boot.h b/arch/s390/boot/boot.h index e045cae6e80a..7c1b9a21018a 100644 --- a/arch/s390/boot/boot.h +++ b/arch/s390/boot/boot.h @@ -74,6 +74,7 @@ void print_stacktrace(unsigned long sp); void error(char *m); int get_random(unsigned long limit, unsigned long *value); void boot_rb_dump(void); +void __noreturn jump_to_kernel(psw_t *psw); =20 #ifndef boot_fmt #define boot_fmt(fmt) fmt diff --git a/arch/s390/boot/ipl_data.c b/arch/s390/boot/ipl_data.c index 0846e2b249c6..c4130a80b058 100644 --- a/arch/s390/boot/ipl_data.c +++ b/arch/s390/boot/ipl_data.c @@ -16,7 +16,9 @@ struct ipl_lowcore { struct ccw0 ccwpgm[2]; /* 0x0008 */ u8 fill[56]; /* 0x0018 */ struct ccw0 ccwpgmcc[20]; /* 0x0050 */ - u8 pad_0xf0[0x01a0-0x00f0]; /* 0x00f0 */ + u8 pad_0xf0[0x0140-0x00f0]; /* 0x00f0 */ + psw_t svc_old_psw; /* 0x0140 */ + u8 pad_0x150[0x01a0-0x0150]; /* 0x0150 */ psw_t restart_psw; /* 0x01a0 */ psw_t external_new_psw; /* 0x01b0 */ psw_t svc_new_psw; /* 0x01c0 */ @@ -75,6 +77,11 @@ static struct ipl_lowcore ipl_lowcore __used __section("= .ipldata") =3D { [18] =3D CCW0(CCW_CMD_READ_IPL, 0x690, 0x50, CCW_FLAG_SLI | CCW_FLAG_CC), [19] =3D CCW0(CCW_CMD_READ_IPL, 0x6e0, 0x50, CCW_FLAG_SLI), }, + /* + * Let the GDB's lx-symbols command find the jump_to_kernel symbol + * without having to load decompressor symbols. + */ + .svc_old_psw =3D { .mask =3D 0, .addr =3D (unsigned long)jump_to_kernel= }, .restart_psw =3D { .mask =3D 0, .addr =3D IPL_START, }, .external_new_psw =3D { .mask =3D PSW_MASK_DISABLED, .addr =3D __LC_EXT_N= EW_PSW, }, .svc_new_psw =3D { .mask =3D PSW_MASK_DISABLED, .addr =3D __LC_SVC_NEW_= PSW, }, diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index da8337e63a3e..305e6c791071 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -642,5 +642,5 @@ void startup_kernel(void) psw.addr =3D __kaslr_offset + vmlinux.entry; psw.mask =3D PSW_KERNEL_BITS; boot_debug("Starting kernel at: 0x%016lx\n", psw.addr); - __load_psw(psw); + jump_to_kernel(&psw); } diff --git a/arch/s390/boot/trampoline.S b/arch/s390/boot/trampoline.S new file mode 100644 index 000000000000..1cb5adf005ea --- /dev/null +++ b/arch/s390/boot/trampoline.S @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include + +# This function is identical to __load_psw(), but the lx-symbols GDB comma= nd +# puts a breakpoint on it, so it needs to be kept separate. +SYM_CODE_START(jump_to_kernel) + lpswe 0(%r2) +SYM_CODE_END(jump_to_kernel) --=20 2.49.0 From nobody Wed Oct 8 17:29:50 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 9F0B62877F5 for ; Wed, 25 Jun 2025 15:42:54 +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=1750866176; cv=none; b=nnIlw8QAOSGcTMtpF1d338oYU24ZteFO/nrBgtTlrs6Wfl+P2KM2We7iy1uqrCQrux/CfPb96YMux5vydp2rbDvwLqukNu3teBQqCCrkSTvO1Yt39xWihxXnbjeWO3/JrK5SbT2K2bwbN9XHebnQg22Y1pQCQ73M48sGNwX/ikk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750866176; c=relaxed/simple; bh=Wn9xVclOO6c9XrNys31e6vPNP3zOlEHbzpKAygisWZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q/t9bFypVCf6BgktOzG4mT+RIZ9IXdQWDKRWXnsy1kxR5mgJLCvHqbBgU7fIVTx3SSUbqW6SPPv1nRIwdULEyxb8qjm3LwHZ7+XvRWD2ZvdxIta8cC6L2M+BeV0hs8gghXxm/9Oi7VYiJ4lt/891PCRw2gZsx7ye5IAo3F0t3CM= 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=rYBYKX7n; 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="rYBYKX7n" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55P9MgFp006910; Wed, 25 Jun 2025 15:42:49 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=SPaHW3Wr6lTghYYNQ 8GXHafq6cSyf1hkO4/UHD44/us=; b=rYBYKX7nrTAbZppTV3EZV0/6JKK8Rceky BnkXGKVMhbnl26Z0rqOtPM7XdRzsiC7b0Zb+7WJjJvpzyMjjV5oOzcSVTW8IEFoJ pp9y4e7rd+PkvmW/8nFnBysw+MwCWXjkKhetp0SRJvFu8ApZsRKE4YfIZUhL16Tw cQ5W8dUC82GNxa0peVjgpKdeZrrRKbaXfNqdz+2VFM5tfcK+f4DutLHA0+8UL0wt YjmeHTuYCBwL0xqnXk96BP3aLN5LUneGQaf3hTf/GzLC1Q42H3y4tpPCEfRb3/02 L/gcdTiTgIP6+01IREn+hW3trdmhMnvWS3ETpYdGAOKu0jYuMbEWg== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 47dmf382tt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 15:42:49 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 55PEPkIa002467; Wed, 25 Jun 2025 15:42:45 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 47e8jm9ycn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 15:42:45 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 55PFgfkg23527990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jun 2025 15:42:41 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F0BC20043; Wed, 25 Jun 2025 15:42:41 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C8BF420040; Wed, 25 Jun 2025 15:42:40 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.87.147.188]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 25 Jun 2025 15:42:40 +0000 (GMT) From: Ilya Leoshkevich To: Jan Kiszka , Kieran Bingham Cc: linux-kernel@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Ilya Leoshkevich Subject: [PATCH 2/2] scripts/gdb/symbols: make lx-symbols skip the s390 decompressor Date: Wed, 25 Jun 2025 17:36:52 +0200 Message-ID: <20250625154220.75300-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250625154220.75300-1-iii@linux.ibm.com> References: <20250625154220.75300-1-iii@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-Authority-Analysis: v=2.4 cv=M5FNKzws c=1 sm=1 tr=0 ts=685c18f9 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=6IFa9wvqVegA:10 a=VnNF1IyMAAAA:8 a=pW92laOuXE_AZismrzkA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjI1MDExMiBTYWx0ZWRfX/eD6vtc+hBVn lDzoXy0+cU/X6aGm+d6JvVK0wL6MJcVfJ62aLV+zX9aDZ5kxcZUBu7tnO7UVym970oJDwy+91IR C5ybP5ywr9Zgtqac1iJcWuSeu0Zc3xQL7qUiv6yAaVHt9bh8U2Rc3sKKXLC9u1eLJBBz0Zh/mbp BVzbmA/YCMsUpI6j4GjC1JOUFiqHzj0lYXVEONGUQL4Ag8kUtwXt6Ti9uBb7rV75XENFY0k9PSE LG3f1L8fw7geYtYfBw5gRU/QvG9LRZZkQ3YfAQrreH5hlVxR+Eou5RWro057xI2aWpDuCH2IW3z WWwkgqAzB4iHbm2YHWEIbJPr0O38/Y0B3LFqg4VOaqaLUT9sRXAo2YmtCbkq4AtGOt06WCQBhWW 5e3/pUMEvnlCIBym4Ildjnyg9T6pFFsKR9V1XyMs8VcDr/lKUNVkUuKdDMeuDuqag4DnQ0x+ X-Proofpoint-GUID: sqVWwh7JFh5hcdI87WTfH_OKgvBtMmJa X-Proofpoint-ORIG-GUID: sqVWwh7JFh5hcdI87WTfH_OKgvBtMmJa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-06-25_04,2025-06-25_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 impostorscore=0 suspectscore=0 priorityscore=1501 phishscore=0 spamscore=0 clxscore=1015 adultscore=0 mlxscore=0 mlxlogscore=957 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506250112 Content-Type: text/plain; charset="utf-8" When one starts QEMU with the -S flag and attaches GDB, the kernel is not yet loaded, and the current instruction is an entry point to the decompressor. In case the intention is to debug the early kernel boot, and not the decompressor, e.g., put a breakpoint on some kernel function and see all the invocations, one has to skip the decompressor. There are many ways to do this, and so far people wrote private scripts or memorized certain command sequences. Make it work out of the box like this: $ gdb -ex 'target remote :6812' -ex 'source vmlinux-gdb.py' vmlinux Remote debugging using :6812 0x0000000000010000 in ?? () (gdb) lx-symbols loading vmlinux (gdb) x/i $pc =3D> 0x3ffe0100000 : lghi %r2,0 Implement this by reading the address of the jump_to_kernel() function from the lowcore, and step until DAT is turned on. Signed-off-by: Ilya Leoshkevich Acked-by: Jan Kiszka Tested-by: Alexander Gordeev --- scripts/gdb/linux/symbols.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index 2332bd8eddf1..6edb99221675 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -84,6 +84,30 @@ def get_kerneloffset(): return None =20 =20 +def is_in_s390_decompressor(): + # DAT is always off in decompressor. Use this as an indicator. + # Note that in the kernel, DAT can be off during kexec() or restart. + # Accept this imprecision in order to avoid complicating things. + # It is unlikely that someone will run lx-symbols at these points. + pswm =3D int(gdb.parse_and_eval("$pswm")) + return (pswm & 0x0400000000000000) =3D=3D 0 + + +def skip_decompressor(): + if utils.is_target_arch("s390"): + if is_in_s390_decompressor(): + # The address of the jump_to_kernel function is statically pla= ced + # into svc_old_psw.addr (see ipl_data.c); read it from there. = DAT + # is off, so we do not need to care about lowcore relocation. + svc_old_pswa =3D 0x148 + jump_to_kernel =3D int(gdb.parse_and_eval("*(unsigned long lon= g *)" + + hex(svc_old_pswa))) + gdb.execute("tbreak *" + hex(jump_to_kernel)) + gdb.execute("continue") + while is_in_s390_decompressor(): + gdb.execute("stepi") + + class LxSymbols(gdb.Command): """(Re-)load symbols of Linux kernel and currently loaded modules. =20 @@ -204,6 +228,8 @@ lx-symbols command.""" saved_state['breakpoint'].enabled =3D saved_state['enabled'] =20 def invoke(self, arg, from_tty): + skip_decompressor() + self.module_paths =3D [os.path.abspath(os.path.expanduser(p)) for p in arg.split()] self.module_paths.append(os.getcwd()) --=20 2.49.0