From nobody Tue May 21 11:56:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1712774565; cv=none; d=zohomail.com; s=zohoarc; b=XKu/ma4rGmaaLZDpQzU4cLB8N5RD6b9DvjCr7Yn4lQc2XYqlVP8FW4YkXnDl/oGIB2mj/BvmxpZoy9iheXzqDvFN+HZycD23Ur3ldvVXATrCmtA79IG0/5FycTcOSVhhOOhM25vD6wEIGfMgnNi8rzexkdcRRwgiBG/qEXJDX24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712774565; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TsNIZ9Ks155ZkwoUu/vGrjMHW6z4GukXwUvQ1y/Pu+A=; b=Qz2gNDUyHi8cDdgQqwMHuAgW2Aw4qMKx2eU0fYLjrby3GmXU3gTYYiLj+o6rxsrgTfzcZWdU9SmhikX6dDpVXGyrSD/qjVTRQUFaJCyA414O/P8HfhGQqz+IRIGIiGsPSCcdupf+IvbneYGCXMjcEVtBqiKJ/oRu5SzrbHWPc0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1712774565861635.9863572621242; Wed, 10 Apr 2024 11:42:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.703546.1099220 (Exim 4.92) (envelope-from ) id 1ructu-0002jR-Ki; Wed, 10 Apr 2024 18:42:26 +0000 Received: by outflank-mailman (output) from mailman id 703546.1099220; Wed, 10 Apr 2024 18:42:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructu-0002jI-Ge; Wed, 10 Apr 2024 18:42:26 +0000 Received: by outflank-mailman (input) for mailman id 703546; Wed, 10 Apr 2024 18:42:24 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructs-0002iK-Iv for xen-devel@lists.xenproject.org; Wed, 10 Apr 2024 18:42:24 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1158eca4-f76a-11ee-94a3-07e782e9044d; Wed, 10 Apr 2024 20:42:22 +0200 (CEST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a4715991c32so948951066b.1 for ; Wed, 10 Apr 2024 11:42:22 -0700 (PDT) Received: from andrewcoop.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id gv18-20020a170906f11200b00a4e1a9e1ab4sm7228404ejb.157.2024.04.10.11.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 11:42:20 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1158eca4-f76a-11ee-94a3-07e782e9044d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1712774542; x=1713379342; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TsNIZ9Ks155ZkwoUu/vGrjMHW6z4GukXwUvQ1y/Pu+A=; b=nME0t5WNiWTaNwhi7gBn+qrdeMzNQ0qwAVr8TTVLNNBtxb1lKFqma0JqZ4UsAnF7T9 y+J69MUl+ZrwuOJtVVnq1ECgnhwRfKy4T/A1vqldhX8OfdrUiIgWVjsvTIYpi23Uifrm qO4zxQEMRLD3gu+7fSdGKXWfJQZUfIzEtJj7s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712774542; x=1713379342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TsNIZ9Ks155ZkwoUu/vGrjMHW6z4GukXwUvQ1y/Pu+A=; b=wPCFIxD8uEpQmxPUqLj65IRnJJjwl9EjmllGxYw2d0/0DljworEOksdjpcYJpvjsSZ b7Wi2DlpE2SJoVpu6TE4/jX31+aA412kd2FVPLt+WHMALCNb+nKVK+wMzFvLY25SbnIP z2sk17aKVNZi5P6jTQoTXo1kt3C9ON7vHBSzCquaI7wl87FeGpG1Xs/OHHxR/Qhv5rYp egrpDKBo4tFZ2gyZEnQuEMNK1bBTAi1Buro9RxVk6nssNZ7I6dR0I+U/1rtO0+3o+CKA w2EAbFTnSDnid2t1+0+TOcrRrc5nCY0es7JR8m/zw4ABFO8XlqA17lJSentpcst9VeYi cf7Q== X-Gm-Message-State: AOJu0Yy2wwGIyQWk1a+A9kxzyHRPFYjyXZ6iQGDLrU54yN0RWQQcijQv 0/yX42hd27W1cFGMs+YxpLXXtdBTE3E7kHUzq8DFrGk6I4CydpyZFflBwj5UxJNDYbTeZZHnQpk 3/6M= X-Google-Smtp-Source: AGHT+IHvf+/DkK/dEiPklmW3RhoQi2EHNqyJPHqOJB+T+k6g2LGD0/+pwLJMh1zhFKIsvqQ8/KZcdg== X-Received: by 2002:a17:906:2352:b0:a51:d7b1:daa5 with SMTP id m18-20020a170906235200b00a51d7b1daa5mr1795559eja.65.1712774541645; Wed, 10 Apr 2024 11:42:21 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH v2 1/4] xen/link: Introduce a common BUGFRAMES definition Date: Wed, 10 Apr 2024 19:42:14 +0100 Message-Id: <20240410184217.1482366-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240410184217.1482366-1-andrew.cooper3@citrix.com> References: <20240410184217.1482366-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1712774566936100005 Bugframe linkage is identical in all architectures. This is not surprising given that it is (now) only consumed by common/virtual_region.c Introduce a common BUGFRAMES define in xen.lds.h ahead of rearranging their structure. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Acked-by: Michal Orzel Acked-by: Shawn Anastasio --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio CC: Konrad Rzeszutek Wilk CC: Ross Lagerwall --- xen/arch/arm/xen.lds.S | 13 +++---------- xen/arch/ppc/xen.lds.S | 13 +++---------- xen/arch/riscv/xen.lds.S | 13 +++---------- xen/arch/x86/xen.lds.S | 11 +---------- xen/include/xen/xen.lds.h | 11 +++++++++++ 5 files changed, 21 insertions(+), 40 deletions(-) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 2266c9536f05..bd884664adf6 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -55,16 +55,9 @@ SECTIONS . =3D ALIGN(PAGE_SIZE); .rodata : { _srodata =3D .; /* Read-only data */ - /* Bug frames table */ - __start_bug_frames =3D .; - *(.bug_frames.0) - __stop_bug_frames_0 =3D .; - *(.bug_frames.1) - __stop_bug_frames_1 =3D .; - *(.bug_frames.2) - __stop_bug_frames_2 =3D .; - *(.bug_frames.3) - __stop_bug_frames_3 =3D .; + + BUGFRAMES + *(.rodata) *(.rodata.*) *(.data.rel.ro) diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S index 8840a0044666..38cd857187e2 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/xen.lds.S @@ -45,16 +45,9 @@ SECTIONS . =3D ALIGN(PAGE_SIZE); DECL_SECTION(.rodata) { _srodata =3D .; /* Read-only data */ - /* Bug frames table */ - __start_bug_frames =3D .; - *(.bug_frames.0) - __stop_bug_frames_0 =3D .; - *(.bug_frames.1) - __stop_bug_frames_1 =3D .; - *(.bug_frames.2) - __stop_bug_frames_2 =3D .; - *(.bug_frames.3) - __stop_bug_frames_3 =3D .; + + BUGFRAMES + *(.rodata) *(.rodata.*) *(.data.rel.ro) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index ace6f49c579c..070b19d91503 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -42,16 +42,9 @@ SECTIONS . =3D ALIGN(PAGE_SIZE); .rodata : { _srodata =3D .; /* Read-only data */ - /* Bug frames table */ - __start_bug_frames =3D .; - *(.bug_frames.0) - __stop_bug_frames_0 =3D .; - *(.bug_frames.1) - __stop_bug_frames_1 =3D .; - *(.bug_frames.2) - __stop_bug_frames_2 =3D .; - *(.bug_frames.3) - __stop_bug_frames_3 =3D .; + + BUGFRAMES + *(.rodata) *(.rodata.*) *(.data.rel.ro) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 1ef6645128b2..9a1dfe1b340a 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -127,16 +127,7 @@ SECTIONS . =3D ALIGN(PAGE_SIZE); __ro_after_init_end =3D .; =20 - /* Bug frames table */ - __start_bug_frames =3D .; - *(.bug_frames.0) - __stop_bug_frames_0 =3D .; - *(.bug_frames.1) - __stop_bug_frames_1 =3D .; - *(.bug_frames.2) - __stop_bug_frames_2 =3D .; - *(.bug_frames.3) - __stop_bug_frames_3 =3D .; + BUGFRAMES =20 *(.rodata) *(.rodata.*) diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index be90f5ca0fdb..7ab7aa567872 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -114,6 +114,17 @@ =20 /* List of constructs other than *_SECTIONS in alphabetical order. */ =20 +#define BUGFRAMES \ + __start_bug_frames =3D .; \ + *(.bug_frames.0) \ + __stop_bug_frames_0 =3D .; \ + *(.bug_frames.1) \ + __stop_bug_frames_1 =3D .; \ + *(.bug_frames.2) \ + __stop_bug_frames_2 =3D .; \ + *(.bug_frames.3) \ + __stop_bug_frames_3 =3D .; + #ifdef CONFIG_HYPFS #define HYPFS_PARAM \ . =3D ALIGN(POINTER_ALIGN); \ --=20 2.30.2 From nobody Tue May 21 11:56:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1712774563; cv=none; d=zohomail.com; s=zohoarc; b=ne6T1Il0bkUFRlm9GyVU2ozkUm5HNeOttAAcPd0VaYvcpY32RU7yD6IwPK+lS5EmYN6h3/xGUrQCw6TIzo5Y7X3NKTZ6g7/m5evEdBitPfzK7HjhAcGJVU/xT3MJW5lhZkrxpeiDiOvgJUlOmVcxpIT2U5zSwC1TVoc5xQ+FnNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712774563; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ukDAjmcMpf650PdUhUxZlNvZY089aJWuIQPAP0FBqkA=; b=JRm6qBP+8J1DoSFUOYhgexgsZnYFGFtfYssul6W5I0SSuTc66kT8sB7bOlzN6QeCodh14rnAYnfr08usOxVLnzs1bsf6c6eVAASc3BeYlN6PsQrYInyy3tBs4rDffuzCUtu/wMId1erJEHkE9h34BfxzdIlwC6DjBAb2PSpRvWo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1712774563160497.32144524479406; Wed, 10 Apr 2024 11:42:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.703547.1099225 (Exim 4.92) (envelope-from ) id 1ructu-0002lb-T9; Wed, 10 Apr 2024 18:42:26 +0000 Received: by outflank-mailman (output) from mailman id 703547.1099225; Wed, 10 Apr 2024 18:42:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructu-0002kv-O0; Wed, 10 Apr 2024 18:42:26 +0000 Received: by outflank-mailman (input) for mailman id 703547; Wed, 10 Apr 2024 18:42:25 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructt-0002iK-Ph for xen-devel@lists.xenproject.org; Wed, 10 Apr 2024 18:42:25 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 122a496e-f76a-11ee-94a3-07e782e9044d; Wed, 10 Apr 2024 20:42:23 +0200 (CEST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-516d0c004b1so8389024e87.2 for ; Wed, 10 Apr 2024 11:42:23 -0700 (PDT) Received: from andrewcoop.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id gv18-20020a170906f11200b00a4e1a9e1ab4sm7228404ejb.157.2024.04.10.11.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 11:42:22 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 122a496e-f76a-11ee-94a3-07e782e9044d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1712774543; x=1713379343; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ukDAjmcMpf650PdUhUxZlNvZY089aJWuIQPAP0FBqkA=; b=s7kUJhfHxwmHk+Y5ecvys////TIrzyO14lA7bpavZp2T8PC/CGRv/cxOPjGioXxA8r OyehLb5mOmOnbRuAEo5DRMHxH5lU8HG3bEyP0AdUq9XztO/AHxD9mWLEArnUBy12jhff Tgn5DA69Pur/epPiKcBPVNdPM0j2nO1+wf10k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712774543; x=1713379343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ukDAjmcMpf650PdUhUxZlNvZY089aJWuIQPAP0FBqkA=; b=ASXQ7UBSXKELtbp82gTEGtxnjU7ttRz0DXBjmXlXDjHbcX+sjAn3rV7apv4kqx8fx4 NDsjyMDU0iXByW4/EhYBU44pRoWxT9cF5A20Zb0JyVQ9sUC2Ac5SBtXjUq7jNuYUzU0m mFEgYMoj0cJbp5sTBjHOe48JBn0bUylogk+x8XAxzujvpU+kY/abOed+W3jLK98ytCQB +9+k9BlETpwJx33eCX4gRpnZeqQN55FQX+Y+wNa9D7GnoBmn3YGK/xFITV/N3ghcSeEr LGRQXwUJZOfQ0A50e3HNBGM7frAim8Elljdld5R/A1dMBzBDPMSRWuoxKKSoytcsVug8 QD/w== X-Gm-Message-State: AOJu0Yyo9IOgS0VhgsAuj6pia+sM+MxjD2obRMeNcfgJLebYtGMumYMX 5M4UFkd0ZAFZyQUZizpgeCHrzT9oehbrRWqi2zs+gcCiHaU7QC6sTCrWyFg81IzpCi1vesHtwv1 H7Lg= X-Google-Smtp-Source: AGHT+IGDaH/9QknP6CAoXXWRXtTwYi3Gfw6NQpu6oJ7f3XDm1pyEE9CcWbhZL6WN8tVegXQD46jt7g== X-Received: by 2002:ac2:5df9:0:b0:516:afb5:6a71 with SMTP id z25-20020ac25df9000000b00516afb56a71mr2372510lfq.67.1712774542977; Wed, 10 Apr 2024 11:42:22 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Ross Lagerwall , Jan Beulich , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio , Konrad Rzeszutek Wilk Subject: [PATCH v2 2/4] xen/virtual-region: Rework how bugframe linkage works Date: Wed, 10 Apr 2024 19:42:15 +0100 Message-Id: <20240410184217.1482366-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240410184217.1482366-1-andrew.cooper3@citrix.com> References: <20240410184217.1482366-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1712774565037100001 The start/stop1/etc linkage scheme predates struct virtual_region, and as setup_virtual_regions() shows, it's awkward to express in the new scheme. Change the linker to provide explicit start/stop symbols for each bugframe type, and change virtual_region to have a stop pointer rather than a count. This marginly simplifies both do_bug_frame()s and prepare_payload(), but it massively simplifies setup_virtual_regions() by allowing the compiler to initialise the .frame[] array at build time. virtual_region.c is the only user of the linker symbols, and this is unlike= ly to change given the purpose of struct virtual_region, so move their externs out of bug.h No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Ross Lagerwall Reviewed-by: Jan Beulich Acked-by: Michal Orzel --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio CC: Konrad Rzeszutek Wilk CC: Ross Lagerwall --- xen/arch/arm/traps.c | 5 ++-- xen/common/bug.c | 5 ++-- xen/common/livepatch.c | 7 +++-- xen/common/virtual_region.c | 45 ++++++++++++++------------------ xen/include/xen/bug.h | 6 ----- xen/include/xen/virtual_region.h | 3 +-- xen/include/xen/xen.lds.h | 8 +++++- 7 files changed, 35 insertions(+), 44 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 9cffe7f79005..a8039087c805 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1226,10 +1226,9 @@ int do_bug_frame(const struct cpu_user_regs *regs, v= addr_t pc) for ( id =3D 0; id < BUGFRAME_NR; id++ ) { const struct bug_frame *b; - unsigned int i; =20 - for ( i =3D 0, b =3D region->frame[id].bugs; - i < region->frame[id].n_bugs; b++, i++ ) + for ( b =3D region->frame[id].start; + b < region->frame[id].stop; b++ ) { if ( ((vaddr_t)bug_loc(b)) =3D=3D pc ) { diff --git a/xen/common/bug.c b/xen/common/bug.c index c43e7c439735..b7c5d8fd4d4a 100644 --- a/xen/common/bug.c +++ b/xen/common/bug.c @@ -25,10 +25,9 @@ int do_bug_frame(const struct cpu_user_regs *regs, unsig= ned long pc) for ( id =3D 0; id < BUGFRAME_NR; id++ ) { const struct bug_frame *b; - size_t i; =20 - for ( i =3D 0, b =3D region->frame[id].bugs; - i < region->frame[id].n_bugs; b++, i++ ) + for ( b =3D region->frame[id].start; + b < region->frame[id].stop; b++ ) { if ( bug_loc(b) =3D=3D pc ) { diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index cabfb6391117..351a3e0b9a60 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -804,12 +804,11 @@ static int prepare_payload(struct payload *payload, if ( !sec ) continue; =20 - if ( !section_ok(elf, sec, sizeof(*region->frame[i].bugs)) ) + if ( !section_ok(elf, sec, sizeof(*region->frame[i].start)) ) return -EINVAL; =20 - region->frame[i].bugs =3D sec->load_addr; - region->frame[i].n_bugs =3D sec->sec->sh_size / - sizeof(*region->frame[i].bugs); + region->frame[i].start =3D sec->load_addr; + region->frame[i].stop =3D sec->load_addr + sec->sec->sh_size; } =20 sec =3D livepatch_elf_sec_by_name(elf, ".altinstructions"); diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c index 142f21e18153..7d8bdeb61282 100644 --- a/xen/common/virtual_region.c +++ b/xen/common/virtual_region.c @@ -9,12 +9,25 @@ #include #include =20 +extern const struct bug_frame + __start_bug_frames_0[], __stop_bug_frames_0[], + __start_bug_frames_1[], __stop_bug_frames_1[], + __start_bug_frames_2[], __stop_bug_frames_2[], + __start_bug_frames_3[], __stop_bug_frames_3[]; + static struct virtual_region core =3D { .list =3D LIST_HEAD_INIT(core.list), .text_start =3D _stext, .text_end =3D _etext, .rodata_start =3D _srodata, .rodata_end =3D _erodata, + + .frame =3D { + { __start_bug_frames_0, __stop_bug_frames_0 }, + { __start_bug_frames_1, __stop_bug_frames_1 }, + { __start_bug_frames_2, __stop_bug_frames_2 }, + { __start_bug_frames_3, __stop_bug_frames_3 }, + }, }; =20 /* Becomes irrelevant when __init sections are cleared. */ @@ -22,6 +35,13 @@ static struct virtual_region core_init __initdata =3D { .list =3D LIST_HEAD_INIT(core_init.list), .text_start =3D _sinittext, .text_end =3D _einittext, + + .frame =3D { + { __start_bug_frames_0, __stop_bug_frames_0 }, + { __start_bug_frames_1, __stop_bug_frames_1 }, + { __start_bug_frames_2, __stop_bug_frames_2 }, + { __start_bug_frames_3, __stop_bug_frames_3 }, + }, }; =20 /* @@ -133,31 +153,6 @@ void __init unregister_init_virtual_region(void) void __init setup_virtual_regions(const struct exception_table_entry *star= t, const struct exception_table_entry *end) { - size_t sz; - unsigned int i; - static const struct bug_frame *const __initconstrel bug_frames[] =3D { - __start_bug_frames, - __stop_bug_frames_0, - __stop_bug_frames_1, - __stop_bug_frames_2, - __stop_bug_frames_3, - NULL - }; - - for ( i =3D 1; bug_frames[i]; i++ ) - { - const struct bug_frame *s; - - s =3D bug_frames[i - 1]; - sz =3D bug_frames[i] - s; - - core.frame[i - 1].n_bugs =3D sz; - core.frame[i - 1].bugs =3D s; - - core_init.frame[i - 1].n_bugs =3D sz; - core_init.frame[i - 1].bugs =3D s; - } - core_init.ex =3D core.ex =3D start; core_init.ex_end =3D core.ex_end =3D end; =20 diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h index 77fe1e1ba840..99814c4bef36 100644 --- a/xen/include/xen/bug.h +++ b/xen/include/xen/bug.h @@ -155,12 +155,6 @@ int do_bug_frame(const struct cpu_user_regs *regs, uns= igned long pc); =20 #endif /* CONFIG_GENERIC_BUG_FRAME */ =20 -extern const struct bug_frame __start_bug_frames[], - __stop_bug_frames_0[], - __stop_bug_frames_1[], - __stop_bug_frames_2[], - __stop_bug_frames_3[]; - #endif /* !__ASSEMBLY__ */ =20 #endif /* __XEN_BUG_H__ */ diff --git a/xen/include/xen/virtual_region.h b/xen/include/xen/virtual_reg= ion.h index dcdc95ba494c..c8a90e3ef26d 100644 --- a/xen/include/xen/virtual_region.h +++ b/xen/include/xen/virtual_region.h @@ -29,8 +29,7 @@ struct virtual_region symbols_lookup_t *symbols_lookup; =20 struct { - const struct bug_frame *bugs; /* The pointer to array of bug frame= s. */ - size_t n_bugs; /* The number of them. */ + const struct bug_frame *start, *stop; /* Pointers to array of bug = frames. */ } frame[BUGFRAME_NR]; =20 const struct exception_table_entry *ex; diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h index 7ab7aa567872..a17810bb286f 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -115,13 +115,19 @@ /* List of constructs other than *_SECTIONS in alphabetical order. */ =20 #define BUGFRAMES \ - __start_bug_frames =3D .; \ + __start_bug_frames_0 =3D .; \ *(.bug_frames.0) \ __stop_bug_frames_0 =3D .; \ + \ + __start_bug_frames_1 =3D .; \ *(.bug_frames.1) \ __stop_bug_frames_1 =3D .; \ + \ + __start_bug_frames_2 =3D .; \ *(.bug_frames.2) \ __stop_bug_frames_2 =3D .; \ + \ + __start_bug_frames_3 =3D .; \ *(.bug_frames.3) \ __stop_bug_frames_3 =3D .; =20 --=20 2.30.2 From nobody Tue May 21 11:56:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1712774568; cv=none; d=zohomail.com; s=zohoarc; b=DOFtJ3dXSXBukOnRJJ7/u0nSnP3Q+D4nz/lMlW5VpjjQeJ7cFgttt1rsXyJP4Ceg0rQcHZTpxtFBZFehtfZYrI3xke0evN2u6pKRFJhMhh13AoBpWODbpBMPYkJ056oz2X2Oo7JLuh7hN5/wvXVI4Fhnu+AP+sOO0iqnAlw++QA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712774568; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=825D0q9VW5ChJA7t5t0rSUJnwEdMxB4Mm0IclQ3mWnY=; b=Q42fmgauT5ifDjK6Vmzw6zSCbcmSfQRHfUsdHvsLX4GAYR0W81T/NZjvGpO7r0GHFNYCNxl6D5IRtSBSGV0K72BIjODUYNNiavpNT5Y7W17AXwi5/LjjY2VeCdqEYNWlW8W9lVP6m/8rYoQSTJJoigW3sMlhqMnsn2AA75iJyq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 171277456806840.1543157394583; Wed, 10 Apr 2024 11:42:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.703548.1099240 (Exim 4.92) (envelope-from ) id 1ructw-0003CU-4M; Wed, 10 Apr 2024 18:42:28 +0000 Received: by outflank-mailman (output) from mailman id 703548.1099240; Wed, 10 Apr 2024 18:42:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructw-0003Bl-0E; Wed, 10 Apr 2024 18:42:28 +0000 Received: by outflank-mailman (input) for mailman id 703548; Wed, 10 Apr 2024 18:42:27 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructu-0002iK-TE for xen-devel@lists.xenproject.org; Wed, 10 Apr 2024 18:42:26 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 12f3b1ce-f76a-11ee-94a3-07e782e9044d; Wed, 10 Apr 2024 20:42:25 +0200 (CEST) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-516db2214e6so6155088e87.1 for ; Wed, 10 Apr 2024 11:42:25 -0700 (PDT) Received: from andrewcoop.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id gv18-20020a170906f11200b00a4e1a9e1ab4sm7228404ejb.157.2024.04.10.11.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 11:42:23 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 12f3b1ce-f76a-11ee-94a3-07e782e9044d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1712774544; x=1713379344; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=825D0q9VW5ChJA7t5t0rSUJnwEdMxB4Mm0IclQ3mWnY=; b=ZlpJCR3kA3JJ4C8tb279F5A39f7VMLGwBaFxRYI6X+MBzTb1Z8gNOOF0B22HPMHnyo X5Vwc2OLaQGvtern9v4yEKN8p6j2Quhs03uCg0ew9DgT8FA9zTX/KwJonSFSheRZJdBQ QIufEnXzAropYUlBgi0fYbVmO+IimsgW++QWc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712774544; x=1713379344; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=825D0q9VW5ChJA7t5t0rSUJnwEdMxB4Mm0IclQ3mWnY=; b=WJ+S892U3shatG+qnB1lSUEsafvoDSsqYnaljy1wBhH2PTkgWLSLVzTxt6nhWOqnKK ufuq4EqWoVU7c+Egb8VIq9+/0E70Z/lfp1sCdUpPRYSBC4zQ1atAMqrzCZV7jm6NXfs7 akz0ShUvJKoVGvm0YbWQ4OGjZvKEOBvXdFP8TE6pIJ8PigkMkA8P2cxynZTr5OiJCzLB p+xRpvZtFyHA0NmgYQzr/scVkLYYWr1gPGCiX2hzqPSW4xs/f2EtQ3JM8gmakSojevNj 1Meikv5xAmVcZwMPMjolREDYKpp4opc3IdzjhUguvAs/WEHgI3J+BHPlknxKjKU8GilA YEIg== X-Gm-Message-State: AOJu0YzMXZV9z4kkZrH/hXgfFlxulyzByaOxmblKUSK4cWIyqqoAJ4Op dCtXxQGDwzL5vb/l1W4GUWAgbknzI8Jlc89cio88GiH8QjK0nAytn5TuRuk2wDdex5rBy82IMoU /LxQ= X-Google-Smtp-Source: AGHT+IGqZhwABSKKcqmSHOPFUjTJJI3TOiGeH+PGNXLx6+NV8wjKCSy22eFNHisUlWOHJFhe20f19w== X-Received: by 2002:a19:914c:0:b0:516:d09b:cbd6 with SMTP id y12-20020a19914c000000b00516d09bcbd6mr1878645lfj.15.1712774544347; Wed, 10 Apr 2024 11:42:24 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH v2 3/4] xen/virtual-region: Link the list build time Date: Wed, 10 Apr 2024 19:42:16 +0100 Message-Id: <20240410184217.1482366-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240410184217.1482366-1-andrew.cooper3@citrix.com> References: <20240410184217.1482366-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1712774568914100007 Given 3 statically initialised objects, its easy to link the list at build time. There's no need to do it during runtime at boot (and with IRQs-off, even). As a consequence, register_virtual_region() can now move inside ifdef CONFIG_LIVEPATCH like unregister_virtual_region(). Signed-off-by: Andrew Cooper Reviewed-by: Michal Orzel --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio CC: Konrad Rzeszutek Wilk CC: Ross Lagerwall v2: * Collect the initialisers togoether too. --- xen/common/virtual_region.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c index 7d8bdeb61282..db3e0dc9fe74 100644 --- a/xen/common/virtual_region.c +++ b/xen/common/virtual_region.c @@ -15,8 +15,18 @@ extern const struct bug_frame __start_bug_frames_2[], __stop_bug_frames_2[], __start_bug_frames_3[], __stop_bug_frames_3[]; =20 +/* + * For the built-in regions, the double linked list can be constructed at + * build time. Forward-declare the elements and their initialisers. + */ +static struct list_head virtual_region_list; +static struct virtual_region core, core_init; +#define LIST_ENTRY_HEAD() { .next =3D &core.list, .prev =3D &cor= e_init.list } +#define LIST_ENTRY_CORE() { .next =3D &core_init.list, .prev =3D &vir= tual_region_list } +#define LIST_ENTRY_INIT() { .next =3D &virtual_region_list, .prev =3D &cor= e.list } + static struct virtual_region core =3D { - .list =3D LIST_HEAD_INIT(core.list), + .list =3D LIST_ENTRY_CORE(), .text_start =3D _stext, .text_end =3D _etext, .rodata_start =3D _srodata, @@ -32,7 +42,7 @@ static struct virtual_region core =3D { =20 /* Becomes irrelevant when __init sections are cleared. */ static struct virtual_region core_init __initdata =3D { - .list =3D LIST_HEAD_INIT(core_init.list), + .list =3D LIST_ENTRY_INIT(), .text_start =3D _sinittext, .text_end =3D _einittext, =20 @@ -50,7 +60,7 @@ static struct virtual_region core_init __initdata =3D { * * All readers of virtual_region_list MUST use list_for_each_entry_rcu. */ -static LIST_HEAD(virtual_region_list); +static struct list_head virtual_region_list =3D LIST_ENTRY_HEAD(); static DEFINE_SPINLOCK(virtual_region_lock); static DEFINE_RCU_READ_LOCK(rcu_virtual_region_lock); =20 @@ -73,15 +83,6 @@ const struct virtual_region *find_text_region(unsigned l= ong addr) return region; } =20 -void register_virtual_region(struct virtual_region *r) -{ - unsigned long flags; - - spin_lock_irqsave(&virtual_region_lock, flags); - list_add_tail_rcu(&r->list, &virtual_region_list); - spin_unlock_irqrestore(&virtual_region_lock, flags); -} - /* * Suggest inline so when !CONFIG_LIVEPATCH the function is not left * unreachable after init code is removed. @@ -96,6 +97,15 @@ static void inline remove_virtual_region(struct virtual_= region *r) } =20 #ifdef CONFIG_LIVEPATCH +void register_virtual_region(struct virtual_region *r) +{ + unsigned long flags; + + spin_lock_irqsave(&virtual_region_lock, flags); + list_add_tail_rcu(&r->list, &virtual_region_list); + spin_unlock_irqrestore(&virtual_region_lock, flags); +} + void unregister_virtual_region(struct virtual_region *r) { remove_virtual_region(r); @@ -155,9 +165,6 @@ void __init setup_virtual_regions(const struct exceptio= n_table_entry *start, { core_init.ex =3D core.ex =3D start; core_init.ex_end =3D core.ex_end =3D end; - - register_virtual_region(&core_init); - register_virtual_region(&core); } =20 /* --=20 2.30.2 From nobody Tue May 21 11:56:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1712774571; cv=none; d=zohomail.com; s=zohoarc; b=bopvUYt4VEf/0JxLozIaa0WIJoBQy5r6H0GtuwgXEHbBjcEZs7n9HwzYXJGfwjUd099yRfvAkC+yc0q6M/dznVcGs1Fb/Cpr7aIP9+HMSDSTQrFMk+3KE/DamCc59q9ogT1+mPCJkjO31V1TfOjnNMvvAkgjFGQ5kjqL8l7n7GU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712774571; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=s+pmAYkyO8mBQKZUy/WOmEI9YmJh2MHSDjUgBLRaceg=; b=Ii6pMONbQ+wZMKYJmtFSrEJUUSeER55ytZeERVTRlDdNFoVqW1EO3LsOy2ToAY9waCTPlJnxLe+zGMBqVWuXqTgCqAtR86xzlWddmVA8cPELG9CgQZ6+jYhQmkQEC6NTYWaQKq1ZY2FTupiu2FT3Af6QctK3x5nCjMibfwIC1k8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 171277457180029.950973778224125; Wed, 10 Apr 2024 11:42:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.703549.1099250 (Exim 4.92) (envelope-from ) id 1ructx-0003US-It; Wed, 10 Apr 2024 18:42:29 +0000 Received: by outflank-mailman (output) from mailman id 703549.1099250; Wed, 10 Apr 2024 18:42:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructx-0003UA-EZ; Wed, 10 Apr 2024 18:42:29 +0000 Received: by outflank-mailman (input) for mailman id 703549; Wed, 10 Apr 2024 18:42:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ructw-0002iK-64 for xen-devel@lists.xenproject.org; Wed, 10 Apr 2024 18:42:28 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 13b4e167-f76a-11ee-94a3-07e782e9044d; Wed, 10 Apr 2024 20:42:26 +0200 (CEST) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-56e47843cc7so4513665a12.0 for ; Wed, 10 Apr 2024 11:42:26 -0700 (PDT) Received: from andrewcoop.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id gv18-20020a170906f11200b00a4e1a9e1ab4sm7228404ejb.157.2024.04.10.11.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 11:42:24 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 13b4e167-f76a-11ee-94a3-07e782e9044d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1712774545; x=1713379345; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s+pmAYkyO8mBQKZUy/WOmEI9YmJh2MHSDjUgBLRaceg=; b=JquiehXUbQH9CQFeM0NvNzwfFJgjDk0M53fxUk7DWyVUnONfzWFj7za+dxxIASbwK+ ww68RlSdFfgSNJs+6ESzW59mKecNc6YzEn51A3Fef7weO5yqQMznlnaQTo1Y+OZjHVku oK+7Kb5ZWI2E46CbClLtbU92AFOKZttrm28+8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712774545; x=1713379345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s+pmAYkyO8mBQKZUy/WOmEI9YmJh2MHSDjUgBLRaceg=; b=CN+cMEvVMeUQ1XCVo3sJBJ4jAur3G3xpod6uUcKmO1l5QnogMZ0Cc1f9Q29lk2WMv2 8sPNnFnM6a4zN7KjfLDZ7wQRuhoc4znYP2eNDmABxSRxjSuruCha/A09HmBOveg1w/eD ifNMDI6p2qeEXRZyb9CE+bLU4TDdBuLCM4896cSIvLin66BZKQKJAr7mKdFqd4oMutij xftWarA6fX5l89WLd3nJ91Y9uM5uKeYjgZfCouGZpETzSObB2r8GYMdG+L/QKSsJAnKy tU0aNl5RwvFY+HCvnLLOfwUAoyvlUGtu+xmChSNgMGPDfnzyoXrLtpP+8L5XiCtLVR0+ Ypkw== X-Gm-Message-State: AOJu0YzzUAoN90A1ysbck8oO0+j8yLqBTrDwaRZu61aGIx1iPvRXfoHr nkWU1nm3wvMdtHP7gOIU8SIKk/F7IxQTYDr/nW3p8QJUEmjQNlJSv1HMbr1PkGcRP2GT/h4QJgJ OqVU= X-Google-Smtp-Source: AGHT+IFqjGHSfSQxb97+Z0xxY3mHpK1V/Kc7/GWcChZDG6kmo9ZVl3EdBpDQU8y8S2GWq9BRQrQ93Q== X-Received: by 2002:a17:907:20ec:b0:a51:deec:483c with SMTP id rh12-20020a17090720ec00b00a51deec483cmr1915598ejb.6.1712774545655; Wed, 10 Apr 2024 11:42:25 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH v2 4/4] xen/virtual-region: Drop setup_virtual_regions() Date: Wed, 10 Apr 2024 19:42:17 +0100 Message-Id: <20240410184217.1482366-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240410184217.1482366-1-andrew.cooper3@citrix.com> References: <20240410184217.1482366-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1712774572966100001 All other actions it used to perform have been converted to build-time initialisation. The extable setup can done at build time too. This is one fewer setup step required to get exceptions working. Take the opportunity to move 'core' into read_mostly, where it probably sho= uld have lived all along. Signed-off-by: Andrew Cooper Reviewed-by: Luca Fancellu #arm Tested-by: Luca Fancellu --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio CC: Konrad Rzeszutek Wilk CC: Ross Lagerwall v2: * Use CONFIG_HAS_EX_TABLE --- xen/arch/arm/setup.c | 1 - xen/arch/x86/setup.c | 2 -- xen/common/virtual_region.c | 19 +++++++++++-------- xen/include/xen/virtual_region.h | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 424744ad5e1a..b9a7f61f73ef 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -719,7 +719,6 @@ void asmlinkage __init start_xen(unsigned long boot_phy= s_offset, percpu_init_areas(); set_processor_id(0); /* needed early, for smp_processor_id() */ =20 - setup_virtual_regions(NULL, NULL); /* Initialize traps early allow us to get backtrace when an error occu= rred */ init_traps(); =20 diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index ac983ddc6977..86cd8b999774 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1014,8 +1014,6 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) smp_prepare_boot_cpu(); sort_exception_tables(); =20 - setup_virtual_regions(__start___ex_table, __stop___ex_table); - /* Full exception support from here on in. */ =20 rdmsrl(MSR_EFER, this_cpu(efer)); diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c index db3e0dc9fe74..0d0a3df0b669 100644 --- a/xen/common/virtual_region.c +++ b/xen/common/virtual_region.c @@ -25,7 +25,7 @@ static struct virtual_region core, core_init; #define LIST_ENTRY_CORE() { .next =3D &core_init.list, .prev =3D &vir= tual_region_list } #define LIST_ENTRY_INIT() { .next =3D &virtual_region_list, .prev =3D &cor= e.list } =20 -static struct virtual_region core =3D { +static struct virtual_region core __read_mostly =3D { .list =3D LIST_ENTRY_CORE(), .text_start =3D _stext, .text_end =3D _etext, @@ -38,6 +38,11 @@ static struct virtual_region core =3D { { __start_bug_frames_2, __stop_bug_frames_2 }, { __start_bug_frames_3, __stop_bug_frames_3 }, }, + +#ifdef CONFIG_HAS_EX_TABLE + .ex =3D __start___ex_table, + .ex_end =3D __stop___ex_table, +#endif }; =20 /* Becomes irrelevant when __init sections are cleared. */ @@ -52,6 +57,11 @@ static struct virtual_region core_init __initdata =3D { { __start_bug_frames_2, __stop_bug_frames_2 }, { __start_bug_frames_3, __stop_bug_frames_3 }, }, + +#ifdef CONFIG_HAS_EX_TABLE + .ex =3D __start___ex_table, + .ex_end =3D __stop___ex_table, +#endif }; =20 /* @@ -160,13 +170,6 @@ void __init unregister_init_virtual_region(void) remove_virtual_region(&core_init); } =20 -void __init setup_virtual_regions(const struct exception_table_entry *star= t, - const struct exception_table_entry *end) -{ - core_init.ex =3D core.ex =3D start; - core_init.ex_end =3D core.ex_end =3D end; -} - /* * Local variables: * mode: C diff --git a/xen/include/xen/virtual_region.h b/xen/include/xen/virtual_reg= ion.h index c8a90e3ef26d..a18dfb6fb05e 100644 --- a/xen/include/xen/virtual_region.h +++ b/xen/include/xen/virtual_region.h @@ -32,13 +32,13 @@ struct virtual_region const struct bug_frame *start, *stop; /* Pointers to array of bug = frames. */ } frame[BUGFRAME_NR]; =20 +#ifdef CONFIG_HAS_EX_TABLE const struct exception_table_entry *ex; const struct exception_table_entry *ex_end; +#endif }; =20 const struct virtual_region *find_text_region(unsigned long addr); -void setup_virtual_regions(const struct exception_table_entry *start, - const struct exception_table_entry *end); void unregister_init_virtual_region(void); void register_virtual_region(struct virtual_region *r); void unregister_virtual_region(struct virtual_region *r); --=20 2.30.2