From nobody Mon Feb 9 12:15:07 2026 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=1709033171; cv=none; d=zohomail.com; s=zohoarc; b=WaJvsDFv6UHGNoeEkijoz/7nQbTXSxn54i031DPZ8WKuzntEkxpKf8sD1glq5Ck4v1Ofh/8GM1mJTPXOqiL25jTSnIDBVVpAE1l/ymkGJszAGeM+Olr2D8R4M3T+tValjz8vQOyqLHZ2nqoRZCXpyxTl5YwylXbkCDzJEIYBVtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709033171; 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=xmVYxznNchZhLSEAgmjblx5ppkOHBquqKgG3mrrDbSE=; b=n8k4dUawUTb8/hGTEVdQPgOvsQTtQvm+tbaInsClN8HjShNPermbiYB7dQpLtw/NxDK/buqNL33Emcw+xNXdDX5sx5fBS53Tss5eF8nsT1xiA1BBFjK2kjBSHsceTXl3zj6w/VEmr1dDfM3Rs2MjJdxhvU0ngJgTrdgm68n3e1Y= 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 1709033171629565.1150091922151; Tue, 27 Feb 2024 03:26:11 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.686022.1067586 (Exim 4.92) (envelope-from ) id 1revaq-0000UZ-Oj; Tue, 27 Feb 2024 11:25:52 +0000 Received: by outflank-mailman (output) from mailman id 686022.1067586; Tue, 27 Feb 2024 11:25:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1revaq-0000Tk-KK; Tue, 27 Feb 2024 11:25:52 +0000 Received: by outflank-mailman (input) for mailman id 686022; Tue, 27 Feb 2024 11:25:51 +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 1revap-0007WG-Kx for xen-devel@lists.xenproject.org; Tue, 27 Feb 2024 11:25:51 +0000 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [2a00:1450:4864:20::130]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f63b87b1-d562-11ee-afd6-a90da7624cb6; Tue, 27 Feb 2024 12:25:51 +0100 (CET) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-512be9194b7so4262243e87.1 for ; Tue, 27 Feb 2024 03:25:51 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id jv2-20020a05622aa08200b0042e2002ed12sm3470912qtb.57.2024.02.27.03.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 03:25:49 -0800 (PST) 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: f63b87b1-d562-11ee-afd6-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1709033150; x=1709637950; 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=xmVYxznNchZhLSEAgmjblx5ppkOHBquqKgG3mrrDbSE=; b=dZI/PR5/KCLcfnBdWWtfQzqiaSa8azfG2+hkv8d4pMAggF+oqPbrdsyGO5rOkK80xY xeJlNBGvO5ij2M8yGlhi2jWOTlsK3CVjZygfDw+psbGzC7tpowAdoeKRk2y5WcW6uNJ3 YUo/akddZIqh6vcifk4q9djZPXZff3mKDcbIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709033150; x=1709637950; 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=xmVYxznNchZhLSEAgmjblx5ppkOHBquqKgG3mrrDbSE=; b=gkB8amPkAedFVIiGKRVYzPFgESYmYUhSfnqbPjdGiebPxFaRUN+EObVkcpv7XZTLig hKaMwDcNGEioEd6vAU25IpbzC9e5CPyxwTvsOD17YC36Q/5+K264zjhyKmPngCNkkXkX gZGbuSapTU25Ke7THDfbvBkF+esq5lY/ivsdHJi2We0yw7AZ1MUj30ulJnB3nlSFm/6J 08vLaMWOYAnqIWBc7SMU7CVdumcTs3k1JxyDMwMVBx1z6wJ01NclZfCCpFn1WAft5zXL ZXbarjwJNj2DEH3fMGRsMc3al8+7NyBUnzIol72MRkdH6lDkT6b3WuyW6VPKVibebrhK VKzw== X-Gm-Message-State: AOJu0YyxALu1GPR35EdH3dNNrCKvdFBHNmi714DPdYp6d7Knk9cF+q4X jWez9KlfP5Yc+28wOgMPNBrjUAn2m5xlw1IYT5CvrnpNMVabhLWfs9S9h6xJlnTJRqXS0WWWM/4 e X-Google-Smtp-Source: AGHT+IFqfmLFdna5wALovZCB6WfEyZOIy2tNf0bS6nbC4SyizxjX2j1beaVKH42Pb2NkuS8nqDeZMA== X-Received: by 2002:a05:6512:6d0:b0:512:fd8a:d0e1 with SMTP id u16-20020a05651206d000b00512fd8ad0e1mr4295594lff.45.1709033150026; Tue, 27 Feb 2024 03:25:50 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH v2 5/5] xen/livepatch: group and document payload hooks Date: Tue, 27 Feb 2024 12:25:28 +0100 Message-ID: <20240227112528.4540-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240227112528.4540-1-roger.pau@citrix.com> References: <20240227112528.4540-1-roger.pau@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: 1709033173163100001 Group the payload hooks between the pre/post handlers, and the apply/revert replacements. Also attempt to comment the context in which the hooks are executed. No functional change. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Ross Lagerwall --- Changes since v1: - New in this version. --- xen/include/xen/livepatch_payload.h | 37 ++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/xen/include/xen/livepatch_payload.h b/xen/include/xen/livepatc= h_payload.h index b9cd4f209670..472d6a4a63c1 100644 --- a/xen/include/xen/livepatch_payload.h +++ b/xen/include/xen/livepatch_payload.h @@ -82,6 +82,8 @@ struct payload { * collision. Since multiple hooks can be registered, the * .livepatch.hook.load section is a table of functions that will be * executed in series by the livepatch infrastructure at patch load time. + * + * Note the load hook is executed in quiesced context. */ #define LIVEPATCH_LOAD_HOOK(_fn) \ livepatch_loadcall_t *__weak \ @@ -96,14 +98,20 @@ struct payload { livepatch_unloadcall_t *__weak \ const livepatch_unload_data_##_fn __section(".livepatch.hooks.unlo= ad") =3D _fn; =20 +/* + * Pre/Post action hooks. + * + * This hooks are executed before or after the livepatch application. Pre = hooks + * can veto the application/revert of the livepatch. They are not execute= d in + * quiesced context. All of pre and post hooks are considered vetoing, and + * hence filling any of those will block the usage of the REPLACE action. + * + * Each of the hooks below can only be set once per livepatch payload. + */ #define LIVEPATCH_PREAPPLY_HOOK(_fn) \ livepatch_precall_t *__attribute__((weak, used)) \ const livepatch_preapply_data_##_fn __section(".livepatch.hooks.pr= eapply") =3D _fn; =20 -#define LIVEPATCH_APPLY_HOOK(_fn) \ - livepatch_actioncall_t *__attribute__((weak, used)) \ - const livepatch_apply_data_##_fn __section(".livepatch.hooks.apply= ") =3D _fn; - #define LIVEPATCH_POSTAPPLY_HOOK(_fn) \ livepatch_postcall_t *__attribute__((weak, used)) \ const livepatch_postapply_data_##_fn __section(".livepatch.hooks.p= ostapply") =3D _fn; @@ -112,14 +120,27 @@ struct payload { livepatch_precall_t *__attribute__((weak, used)) \ const livepatch_prerevert_data_##_fn __section(".livepatch.hooks.p= rerevert") =3D _fn; =20 -#define LIVEPATCH_REVERT_HOOK(_fn) \ - livepatch_actioncall_t *__attribute__((weak, used)) \ - const livepatch_revert_data_##_fn __section(".livepatch.hooks.reve= rt") =3D _fn; - #define LIVEPATCH_POSTREVERT_HOOK(_fn) \ livepatch_postcall_t *__attribute__((weak, used)) \ const livepatch_postrevert_data_##_fn __section(".livepatch.hooks.= postrevert") =3D _fn; =20 +/* + * Action replacement hooks. + * + * The following hooks replace the hypervisor implementation for the livep= atch + * application and revert routines. When filling the hooks below the nati= ve + * apply and revert routines will not be executed, so the provided hooks n= eed + * to make sure the state of the payload after apply or revert is as expec= ted + * by the livepatch logic. + */ +#define LIVEPATCH_APPLY_HOOK(_fn) \ + livepatch_actioncall_t *__attribute__((weak, used)) \ + const livepatch_apply_data_##_fn __section(".livepatch.hooks.apply= ") =3D _fn; + +#define LIVEPATCH_REVERT_HOOK(_fn) \ + livepatch_actioncall_t *__attribute__((weak, used)) \ + const livepatch_revert_data_##_fn __section(".livepatch.hooks.reve= rt") =3D _fn; + #endif /* __XEN_LIVEPATCH_PAYLOAD_H__ */ =20 /* --=20 2.44.0