From nobody Tue May 21 12:54:50 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=1710759918; cv=none; d=zohomail.com; s=zohoarc; b=dE2GYV398yzKlF/U7sAl6g15YfJJgvQsxD0sRyEt8OOZyYX0epfTAx+TWkvc3sHet2LaytHEtPD4BZWMPvJZhOqShY4nPJj5x+D+NDoifD3ptt3A7OO3iKQan4WRh0Q9tLxaz73vBRuBmQxfwRams/oFWSKKWANFTr4fb06PukY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710759918; 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=at5KFl9nQfgpXq4Q7Iq5b9vyBtR/kiSx7kLCD84lTrQ=; b=bueSeXx2ALAwTHDvQ3MPEFXE4GZWYKkOBvPOBWZYAOHzWbquL4bMze5e4TmEJMtb47nnJ9uMWulPtzRFV2PF8M5T19EH9yuwaKw0cWtUBYGJVXbHxrRELOxtKx8rnL+yE/+64FFJJ/JnxKozEuBJcgdAtcUWFDUrkYISc9Ed8Ew= 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 1710759918668104.8875211317627; Mon, 18 Mar 2024 04:05:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.694588.1083437 (Exim 4.92) (envelope-from ) id 1rmAnV-0007Rp-J1; Mon, 18 Mar 2024 11:04:53 +0000 Received: by outflank-mailman (output) from mailman id 694588.1083437; Mon, 18 Mar 2024 11:04:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rmAnV-0007Ri-Ed; Mon, 18 Mar 2024 11:04:53 +0000 Received: by outflank-mailman (input) for mailman id 694588; Mon, 18 Mar 2024 11:04:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rmAnU-0007RW-EP for xen-devel@lists.xenproject.org; Mon, 18 Mar 2024 11:04:52 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 57c03b65-e517-11ee-afdd-a90da7624cb6; Mon, 18 Mar 2024 12:04:51 +0100 (CET) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-563bb51c36eso4809912a12.2 for ; Mon, 18 Mar 2024 04:04:51 -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 f22-20020aa7d856000000b0056b818544a9sm324882eds.90.2024.03.18.04.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 04:04:50 -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: 57c03b65-e517-11ee-afdd-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1710759891; x=1711364691; 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=at5KFl9nQfgpXq4Q7Iq5b9vyBtR/kiSx7kLCD84lTrQ=; b=lPTQZPylUVPwxdNBvHTjiD4ahw6dXqqaqzbcZPtRrLsO/9EX/ZV05Vxxtw9vBG5vEZ j2sZLGTEGGlpo9RZM+mwsnrt2IDTWGRP7Xszzud5opwbvhCpaW2T8rgzh241+/GXiA+0 EiQwSKYgzNns1yCG3qF+hKfiADMhJ2gUtBj7M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710759891; x=1711364691; 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=at5KFl9nQfgpXq4Q7Iq5b9vyBtR/kiSx7kLCD84lTrQ=; b=G//4kVwIlUD+gO35Qr/JTkiA8Rmal1J5heQqj+rfWu6D+VBc2ywHLUgOohbjUWdxQ2 OfCsZMjQrOb8IeW5FjSnCLv9xop7QkhT2X6Wq4x4EtglSzWsrofIgZ3p+P5mzaWhO8jb 7uswRehFtyEVSLPrBVqI2zJn72Zx0OynyTEWqgk8JDsA6ZbujH9zoGDQKa3n0qJXR2+k bXv3RYq5YLudts3+uOaTMEWj7bTgaQ4U46NdPJcccmcSqlQ120hUea0keNYW43J3Vr7t yiCeppOukhzFcG8GzuYVEIBeVL/8pGRT7TVibossS7qacEzITT2xFsisU3vWJoyfd/Y4 3rCw== X-Gm-Message-State: AOJu0YxRe2kjWqtXVgKPFc/Ol5dvBFNGN0yB4yD5VB4DTmuVIZOe1uiV bpUFqEJs2cve2DvvL0NJTgPVld2NRs6zUwxus2fHufraiK2xHivikMwgEsEGvJLtHmtMrlZ+4FY 7 X-Google-Smtp-Source: AGHT+IGbQXwmPyQQJOvSY/hRma7SWZ3N6q4E6jLJ4npsLQ3nMf71ZMxM4Mw8uBJpYE8qH3pUoz8dRg== X-Received: by 2002:a05:6402:3981:b0:568:9b13:77fe with SMTP id fk1-20020a056402398100b005689b1377femr10391077edb.37.1710759890780; Mon, 18 Mar 2024 04:04:50 -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 1/4] xen/link: Introduce a common BUGFRAMES definition Date: Mon, 18 Mar 2024 11:04:39 +0000 Message-Id: <20240318110442.3653997-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240318110442.3653997-1-andrew.cooper3@citrix.com> References: <20240318110442.3653997-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: 1710759920862100002 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 --- 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 05b6db272805..ca4d4a2b8adf 100644 --- a/xen/arch/ppc/xen.lds.S +++ b/xen/arch/ppc/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/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 8930e14fc40e..fa4e608f0f97 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -131,16 +131,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 06b7110837a1..decd6db5fc6d 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -104,6 +104,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 12:54:50 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=1710759918; cv=none; d=zohomail.com; s=zohoarc; b=MUnc+gUPuINVzfXux3J7iAHvrs8uo/WEaEK6IDJ03tvPdhn9QVOGThuVxTdj3l78RTk3bVcdHD/I3E/4zl37JZ0qDvOEB/axFVmBLiBDznLhB+aNDp8eFG8oqWEVbWlnskAXKl/aG+PYOnMsG28b0GEyXGCm8QN4/hxVVobHwLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710759918; 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=6AClSgW20j4Oof9oRGR4px4rDSNwV8dwcCuptcu56/k=; b=YRtDYheeoR3mkvO0ainkdhzFiRXehetSuLSNoLbB6xFieHsIhzU9A3HjvHQKPEzG+haMoc8c0MbTKSFGRogvFS2QFK6CWJYZFjJjnrYL2t83/nAZVdDnariXSdjKlMTjoWB1ABBYupYoasPEt6QMVw0RULaHRAw7abPLe9+BTrc= 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 1710759918790341.3984816253625; Mon, 18 Mar 2024 04:05:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.694590.1083456 (Exim 4.92) (envelope-from ) id 1rmAnY-0007vZ-1T; Mon, 18 Mar 2024 11:04:56 +0000 Received: by outflank-mailman (output) from mailman id 694590.1083456; Mon, 18 Mar 2024 11:04:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rmAnX-0007vS-UJ; Mon, 18 Mar 2024 11:04:55 +0000 Received: by outflank-mailman (input) for mailman id 694590; Mon, 18 Mar 2024 11:04:54 +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 1rmAnW-0007RX-Iz for xen-devel@lists.xenproject.org; Mon, 18 Mar 2024 11:04:54 +0000 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [2a00:1450:4864:20::230]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 58a83f6e-e517-11ee-a1ee-f123f15fe8a2; Mon, 18 Mar 2024 12:04:53 +0100 (CET) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2d46c44dcc0so51891901fa.2 for ; Mon, 18 Mar 2024 04:04:52 -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 f22-20020aa7d856000000b0056b818544a9sm324882eds.90.2024.03.18.04.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 04:04:51 -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: 58a83f6e-e517-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1710759892; x=1711364692; 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=6AClSgW20j4Oof9oRGR4px4rDSNwV8dwcCuptcu56/k=; b=ItN3jlNh7zJvOVQtMEbzjLKe5ggjLdecBcWzh9TNMph6Sp91s59laCHQzmLYi7W7GV LCYL/xYIt3G+RDDfjP2k2zm3zHNvAjF1B4tSEpaCNwSQmB/aYY9pCgXZXbfb0keft455 Anq6hVDRngml8w3JlTXGcXepQEZt1kFxEhtYQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710759892; x=1711364692; 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=6AClSgW20j4Oof9oRGR4px4rDSNwV8dwcCuptcu56/k=; b=CB/4+sQ1j0ekEQrf8kVAF4gTqV4O0p+hVqfWa/djqB1nRnSVHPac7hyPR7zu9O2qRp jx+qmr7H6R2kpjn+rjvGpmoqzDa90RspAdcvXVeXDJNJBXG4qCT6GmPBGIQ0Xb+ysWWV iVdxqrGLq6HkKG7wWUHslwzkvbyMmHJ2fteUIMUDlmxUI6TJEbtAmiP5/knBdWmFZZKs yEf2L5iIgcVSvwyAGBM5/zqB4uO28i0Ad1hQC7gCVlkXK37T3ELsidP5C1ca0UAbrclV ZRDP5Twqm3gzqErXZqhqC+QcpE+l7UAJq1MsTum0Iqrwpc9WxOkK+oWUMwjB0sDIINOn A8dA== X-Gm-Message-State: AOJu0YzX3Qg5dY/oz/FnBYV9Tf8G7A4g66HRTNdwpE9rGGlsthPQNzn3 HN+eSZElcaqrVNWAGAs8fheqj0x51Hn/najhs3/tpyOFDJYENDNTRfHUs+BAbV348IaObbFClI9 V X-Google-Smtp-Source: AGHT+IGjILct9cPcKheTXRHra5yIQEReuWJ6pyjCoLkoCxZHKBCtSluGbPbB5UYkJV5dQTWgacbxMg== X-Received: by 2002:a2e:874d:0:b0:2d4:6863:5072 with SMTP id q13-20020a2e874d000000b002d468635072mr7615283ljj.44.1710759891920; Mon, 18 Mar 2024 04:04:51 -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 2/4] xen/virtual-region: Rework how bugframe linkage works Date: Mon, 18 Mar 2024 11:04:40 +0000 Message-Id: <20240318110442.3653997-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240318110442.3653997-1-andrew.cooper3@citrix.com> References: <20240318110442.3653997-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: 1710759920878100005 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: Jan Beulich Reviewed-by: Ross Lagerwall --- 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 b4325bcda71e..eb9645daa99d 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 decd6db5fc6d..96f86ac58f38 100644 --- a/xen/include/xen/xen.lds.h +++ b/xen/include/xen/xen.lds.h @@ -105,13 +105,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 12:54:50 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=1710759919; cv=none; d=zohomail.com; s=zohoarc; b=bHxwovWLBt5MauXJw0xD6wbqfxXfig6+Gmbtvu4KkymlTol1suKu39QdW4Sj1LZhYaZnG/aSUqYy7Y7qOK3FAZM3qMzSULjNRJa84cgjxvzBvu+UzsuQz5mFwt8NKexB+kK03t0ayGmhQowTIM6Zy1Aye268ob5JJFRBgE38q7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710759919; 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=AWCsjWzVUd6sUyetSs9CWtqz4kTMclSOuQ/QVUP2fXQ=; b=CDy/iI+p2QDGHJlhKGW0ZS6LHdQaXPoUxvxXJwk3Y5eUKXRnYlFbN9rrzz5jld9LyJQmip/EB++bdNOEDCWf8VQyi+aRrKeDlHI3MUUpO7ClZc/g1mYHTh/B4+pDmyEdC1Wo6uRdKkM5clyDlSEqIMtiwYzpwjC3RBE4QMkR8Ao= 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 1710759919751416.27518024397943; Mon, 18 Mar 2024 04:05:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.694591.1083461 (Exim 4.92) (envelope-from ) id 1rmAnY-0007yy-Dq; Mon, 18 Mar 2024 11:04:56 +0000 Received: by outflank-mailman (output) from mailman id 694591.1083461; Mon, 18 Mar 2024 11:04:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rmAnY-0007xu-6K; Mon, 18 Mar 2024 11:04:56 +0000 Received: by outflank-mailman (input) for mailman id 694591; Mon, 18 Mar 2024 11:04:54 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rmAnW-0007RW-Kd for xen-devel@lists.xenproject.org; Mon, 18 Mar 2024 11:04:54 +0000 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [2a00:1450:4864:20::534]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5944d93b-e517-11ee-afdd-a90da7624cb6; Mon, 18 Mar 2024 12:04:54 +0100 (CET) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-563c403719cso5161527a12.2 for ; Mon, 18 Mar 2024 04:04:54 -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 f22-20020aa7d856000000b0056b818544a9sm324882eds.90.2024.03.18.04.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 04:04:52 -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: 5944d93b-e517-11ee-afdd-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1710759893; x=1711364693; 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=AWCsjWzVUd6sUyetSs9CWtqz4kTMclSOuQ/QVUP2fXQ=; b=W+TgMkZ8NmZt3fusV1/9lhb2JQoM9sEJIqY7GPGX5uYZ2zIPu7xetXvzH4c6oiGzWn ifx+sDZIjbyygSS5LsTPO9soshIE+N0O70HhWFLPZf+grseh62BoNh3vqoe/eiwDwplg qnWLY1eH6QwYZXizVSEW/0ap8h3WDhPFKhaiI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710759893; x=1711364693; 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=AWCsjWzVUd6sUyetSs9CWtqz4kTMclSOuQ/QVUP2fXQ=; b=KPPNR6C5j6gm7Echvnuj4cdjFLMfQx2M4XE8D/9Hz6xo9Wk6exmRTgKy3nM55A4aDj 2AOWLH6eUzujhxK1y7r+9fqdUI7KO43uUvXRPy+zDUjKGOsQTmsOWeAyDSg59mvcgZm+ TLEMBtcrF4NfKigrO9DtHHUId4EclakDVPAgYyy1NEHLl+8Cd0y6isMWeV0dQnLszUlB ZUFtvP17hCRH4kdtzIb5BS+JqwZ6uvTnibaLegCXrWB1Rsfrn3pfk47p/fEpwBjKEQxS iPBTY4JglHpLLZdwu9BlH1eb99IVCk6O7GhiTL1g3mt2HUPQcyePfj8cj91GDo5NoV9X j/GQ== X-Gm-Message-State: AOJu0Yw/YHP9B+U19ijMGXcu2naaISeJmHx3VqCTa6F/MT8AIu4R7vgp QXOJUUEao4AjLHJfmT+9hxwbtNRXAb24pGxKI+mr22gRQ7nDbqi/dQoWvFtqLhE3x6D1Sl0Y7mR 0 X-Google-Smtp-Source: AGHT+IHYOf7G6CCC/WpXt7wf04NgE600a46ujZCW14kFOdpdY1FfSSehIjbad2g+Xr0NJDLNscsEVQ== X-Received: by 2002:a05:6402:3784:b0:566:9fef:1ee9 with SMTP id et4-20020a056402378400b005669fef1ee9mr7994038edb.22.1710759893206; Mon, 18 Mar 2024 04:04:53 -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 3/4] xen/virtual-region: Link the list build time Date: Mon, 18 Mar 2024 11:04:41 +0000 Message-Id: <20240318110442.3653997-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240318110442.3653997-1-andrew.cooper3@citrix.com> References: <20240318110442.3653997-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: 1710759920864100003 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 --- 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/common/virtual_region.c | 45 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c index eb9645daa99d..ad39bb74e15c 100644 --- a/xen/common/virtual_region.c +++ b/xen/common/virtual_region.c @@ -15,8 +15,19 @@ 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. + */ +static struct list_head virtual_region_list; +static struct virtual_region core, core_init; + static struct virtual_region core =3D { - .list =3D LIST_HEAD_INIT(core.list), + .list =3D { + .next =3D &core_init.list, + .prev =3D &virtual_region_list, + }, + .text_start =3D _stext, .text_end =3D _etext, .rodata_start =3D _srodata, @@ -32,7 +43,11 @@ 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 { + .next =3D &virtual_region_list, + .prev =3D &core.list, + }, + .text_start =3D _sinittext, .text_end =3D _einittext, =20 @@ -50,7 +65,10 @@ 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 { + .next =3D &core.list, + .prev =3D &core_init.list, +}; static DEFINE_SPINLOCK(virtual_region_lock); static DEFINE_RCU_READ_LOCK(rcu_virtual_region_lock); =20 @@ -73,15 +91,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 +105,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 +173,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 12:54:50 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=1710759923; cv=none; d=zohomail.com; s=zohoarc; b=YY39nLdInmshBdSTJ5/2nVpfnctvXjpOGSRLBi7mBkjxy8BY6m5NmAo89pBI4G0csP+UuxIVdJ+yEqmDb36o8oSko+9luJMyHzwfiv1EkRhfjhNwDRyjpGVnbYxFDdKVqzn4T+sQpX+/wjUET8kHwb1c9jbW3s+k+PzEkd97aks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710759923; 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=LlCKlDfbOhZKV1J2ps7ot3moOOwpsbpj+o2HtA/2dsQ=; b=NA/EJl2ZvGcYDNA6q/1N2O7xOlkP4I3oJULrvF6xGWpDpfOQp5kx8deovSa/U9h+j+LDwx3pPs9scyAuWVtRS2RZLkmSwTYUfYyIHszXdTzBJgziSzmKnLV6eIR0lf4NHregNKg8qCJLbxY+q657IJtgZbHB2x+MMVWEBwpGmf0= 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 1710759922994780.8283686701326; Mon, 18 Mar 2024 04:05:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.694592.1083476 (Exim 4.92) (envelope-from ) id 1rmAna-0008Rx-QS; Mon, 18 Mar 2024 11:04:58 +0000 Received: by outflank-mailman (output) from mailman id 694592.1083476; Mon, 18 Mar 2024 11:04:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rmAna-0008Ro-MD; Mon, 18 Mar 2024 11:04:58 +0000 Received: by outflank-mailman (input) for mailman id 694592; Mon, 18 Mar 2024 11:04:57 +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 1rmAnZ-0007RX-3u for xen-devel@lists.xenproject.org; Mon, 18 Mar 2024 11:04:57 +0000 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [2a00:1450:4864:20::62e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5a40b7b6-e517-11ee-a1ee-f123f15fe8a2; Mon, 18 Mar 2024 12:04:55 +0100 (CET) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a466a1f9ea0so300097766b.1 for ; Mon, 18 Mar 2024 04:04:55 -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 f22-20020aa7d856000000b0056b818544a9sm324882eds.90.2024.03.18.04.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 04:04:53 -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: 5a40b7b6-e517-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1710759894; x=1711364694; 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=LlCKlDfbOhZKV1J2ps7ot3moOOwpsbpj+o2HtA/2dsQ=; b=Ip1clXr2Dhfpc+rr4dbYtc7lovnNLe3WxpJ/Has1xw/8Iu2izlozTgwB5ldJyW6hdw a6+sJRyZ3Pi1MznlWCwvb7XETM2gY3PHZsQBAM+ZqSTmBY1G4XfYDNJU7wnreoHKXCuw 7SMkB/Qpbcm/kqN/7wKds6DgmMTgEoV6Jpk70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710759894; x=1711364694; 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=LlCKlDfbOhZKV1J2ps7ot3moOOwpsbpj+o2HtA/2dsQ=; b=ZDKQde2GfKr6andkXfVUTcwhSaVc8nM5sr+TslgI89dbZjH6eAhdgrjVQXxkve9qsS dMY5HsfFuKwfvxLFApMzY0hwH9NrX5vGENiRDvAExKdbp79lVHl/bokwjIfmIQIq0c+D vwE4rhMWYfPiaex4Sumu+vqPIuotxUlIl/utlYp7dwhaWOCdF+8xPy4gD7mkfAItVBzs of8vlsWFvDJDy2I1/wtxQEcgnMJIT+YOhj1WN2XlyOEsDMBcUp/L9ObGzY5ZVYyNhf67 +A4rKBUFT7ynn63iIJ1U+Esb6gIUiPg1xuJlJrCSY3gFK5GT2pZEKUxstKhWdfknYw+D iu2w== X-Gm-Message-State: AOJu0YzKqyKgECnof3HJaal2SYkZNs1Uo4ob3vI1i6Ifw/RbizBfs0cA 3yrS0qB9nKrVW30kYnisoOJ0igr0sfxZfB5PSgIReTejIoT+Z31DEH3n9wfbRhKY+uRYXb7As/Z J X-Google-Smtp-Source: AGHT+IHMJ6j/otP77lTUgBDpwoiX+lsd05gj3mtFFuAjMNu82dHTyGRpN770FaBUz6STDrp4ntfLlQ== X-Received: by 2002:a05:6402:1d34:b0:568:29f8:1d79 with SMTP id dh20-20020a0564021d3400b0056829f81d79mr4412379edb.38.1710759894351; Mon, 18 Mar 2024 04:04:54 -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 4/4] xen/virtual-region: Drop setup_virtual_regions() Date: Mon, 18 Mar 2024 11:04:42 +0000 Message-Id: <20240318110442.3653997-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240318110442.3653997-1-andrew.cooper3@citrix.com> References: <20240318110442.3653997-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: 1710759924873100001 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. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- 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/setup.c | 1 - xen/arch/x86/setup.c | 2 -- xen/common/virtual_region.c | 17 ++++++++++------- xen/include/xen/virtual_region.h | 2 -- 4 files changed, 10 insertions(+), 12 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 a21984b1ccd8..801f5ca01a26 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 ad39bb74e15c..5322766ac765 100644 --- a/xen/common/virtual_region.c +++ b/xen/common/virtual_region.c @@ -39,6 +39,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_X86 + .ex =3D __start___ex_table, + .ex_end =3D __stop___ex_table, +#endif }; =20 /* Becomes irrelevant when __init sections are cleared. */ @@ -57,6 +62,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_X86 + .ex =3D __start___ex_table, + .ex_end =3D __stop___ex_table, +#endif }; =20 /* @@ -168,13 +178,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..2c4deaaa2889 100644 --- a/xen/include/xen/virtual_region.h +++ b/xen/include/xen/virtual_region.h @@ -37,8 +37,6 @@ struct virtual_region }; =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