From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC743606A33F for ; Tue, 10 Nov 2026 05:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Bz9K2ra8; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=LHISnBIz DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=daK/IkDIXVqnfjYl8/M+M9VjkzPIwCe5yl4tay+gSqg=; b=Bz9K2ra8JH4QaGvC6zsYTIQvbb 3VnttESZyx5g2xbVyTy9+0ULWC/insBzx8TXgZLw16UI+kA1oaKV+1AeNtBdi5bWnCr18JEoqlWVI fug3b4NtnHrmnPovob1pz5SEzZs9qgEftyXBkuePokVhKYq+vd59YSv8Hrn5cieNG16SrSRxW66i6 4lkyjMyPyzViGwoCNqcOvxRHKgSvAv+3OK2MUgCPM39IJGfq8Of/HJBcHNCDwW7UPHBubFCCP2f4o MuDAkBFmryxeHLXa9v85bdGRtH8frMasOyKcyBc/XFcIzJfnZvtFfWWok3b6LgSgO2+nNRXq1MJKo gA2oLWwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQe01-00000002RYx-1ujI; Tue, 10 Nov 2026 05:02:25 +0000 Received: from mail-ed1-x546.google.com ([2a00:1450:4864:20::546]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQdzo-00000002REw-0c28 for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2026 05:02:15 +0000 Received: by mail-ed1-x546.google.com with SMTP id 4fb4d7f45d1cf-6b564783d3fso1757102a12.0 for ; Mon, 09 Nov 2026 21:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1794286930; x=1794891730; darn=lists.infradead.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=daK/IkDIXVqnfjYl8/M+M9VjkzPIwCe5yl4tay+gSqg=; b=LHISnBIzBAJ8EpUBuvyzITi4lKKCP5gYClQ4OZ4ziVCZo6UvNDsqpq8RLKDXWpVV29 U8JmnoqUQozWC7aasFYMm914/7SGRquHrgWc1awzyOu2ywIPrOQEf1bhlN/2aOa28Bfh hZDGYIHYT1KsqC8O5yOUM6H4YDCBjoGPy4hgwg704cRUdWzWj4fW2t//GLVNIH8yVi4k 9CmTh4PnATxBtG4WGIVCiV2RgmQqiz02IEzupYZOcg1r+pr8/hTpWDDeMwyuvMjwS/AF 21Mti2eoo2SpjXZjFglmElvn4li2VuHVtR88GMlOtlM34UY1InzxZhoNjDij1NMhCdQz tWgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794286930; x=1794891730; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=daK/IkDIXVqnfjYl8/M+M9VjkzPIwCe5yl4tay+gSqg=; b=uxcDhOjF/0xzUmlpVFyLVXzD9PzNhO7aLHjUO+i7smm1czyj+D7Q5FreVTzY8HI9Aj SapySChquowp2ds0CXhO9qH0LnO2H8i5Ty4fb44ThYlMVPXMAlW3apmnJihIS1rSqwjj GdRJg3Z8R2yDPDIaKL5O2TQyWd2DgwwFntXh0a31VKxMtMegFpEWIlvkHsbTezrtOTRj GKehqulNkwgpyTsfOdq4P9zdJJVRUJok+ae6ZWYoDfnsIpR42D1z5HWcqf21eNE3zBlx h04bg/G3lctyA9yx3E2WA8HVfd4U8qbdv3IqTFL/gXdppnTEwqhwL/wRerOpRQJB9AfK PBCQ== X-Forwarded-Encrypted: i=1; AL+hErGmPKpjOvesFCnDhex96qrK6ixktFmht9rlLrYulWdVh1F1Jdg1ytvBed1kebDDxSSnlHwCsbI58IOcA3AP6AEz@lists.infradead.org X-Gm-Message-State: APuU4Z/Li53E1UHq5MYsjLcdmRdj11Eu+M1Sq3Ft/lXiFMVP3TG1abb1 0rVaOWuZFJ3jZwWPdZeKZbVawqHcsFpunM4H8WQe06m9GF7CQU3v2PhA4oZuVlY4wdtEBxvwl8u PuLxS8p+KAqP6dB5DqQ== X-Received: from edwl2.prod.google.com ([2002:a05:6402:1242:b0:6b3:bbb1:9405]) (user=tarunsahu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:a6c3:10b0:6b4:8ba2:83ba with SMTP id 4fb4d7f45d1cf-6b756addabfmr786498a12.43.1794286929585; Mon, 09 Nov 2026 21:02:09 -0800 (PST) Date: Tue, 10 Nov 2026 05:01:47 +0000 In-Reply-To: <20261110050202.529473-1-tarunsahu@google.com> X-Archived-By: Mime-Version: 1.0 References: <20261110050202.529473-1-tarunsahu@google.com> X-Mailer: git-send-email 2.56.0.506.g506a7eabc5-goog Message-ID: <20261110050202.529473-5-tarunsahu@google.com> Subject: [PATCH v4 04/19] liveupdate: Reference struct luo_file_set_ser via serialized pointer From: Tarun Sahu To: Pasha Tatashin , Mike Rapoport , robin.murphy@arm.com, maz@kernel.org, will@kernel.org, David Matlack , Alexander Graf , seanjc@google.com, jgg@nvidia.com, loganodell@google.com, arnd@arndb.de, dwmw2@infradead.org, baolu.lu@linux.intel.com, Bjorn Helgaas , oupton@kernel.org, alex@shazbot.org, gle.com@google.com, pbonzini@redhat.com, Andrew Morton , kevin.tian@intel.com, joro@8bytes.org Cc: kvmarm@lists.linux.dev, linux-pci@vger.kernel.org, Pratyush Yadav , kexec@lists.infradead.org, kvm@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, skhawaja@google.com, sagis@google.com, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Tarun Sahu Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261109_210212_227555_AD96EFB2 X-CRM114-Status: GOOD ( 17.63 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-26.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 struct luo_session_ser currently embeds struct luo_file_set_ser directly by value. Embedding struct luo_file_set_ser couples the session layout's size and field offsets to struct luo_file_set_ser, preventing either structure from appending fields independently across kexec. Convert struct luo_session_ser to hold a DECLARE_KHOSER_PTR pointer to struct luo_file_set_ser instead of embedding it by value. Reserve space for both structures in each session block-set entry, placing struct luo_file_set_ser immediately after struct luo_session_ser, and bump LUO_ABI_COMPATIBLE from luo-v5 to luo-v6. Signed-off-by: Tarun Sahu --- include/linux/kho/abi/luo.h | 9 +++++---- kernel/liveupdate/luo_session.c | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/include/linux/kho/abi/luo.h b/include/linux/kho/abi/luo.h index 721949374fa1..f1152470f71a 100644 --- a/include/linux/kho/abi/luo.h +++ b/include/linux/kho/abi/luo.h @@ -61,13 +61,14 @@ #include #include #include +#include #include /* * The LUO state is registered under this KHO entry name. */ #define LUO_KHO_ENTRY_NAME "LUO" -#define LUO_ABI_COMPATIBLE "luo-v5" +#define LUO_ABI_COMPATIBLE "luo-v6" #define LUO_ABI_COMPAT_LEN ALIGN(sizeof(LUO_ABI_COMPATIBLE), 8) /** @@ -133,7 +134,7 @@ static_assert(!IS_ENABLED(CONFIG_64BIT) || * struct luo_session_ser - Represents the serialized metadata for a LUO session. * @name: The unique name of the session, provided by the userspace at * the time of session creation. - * @file_set_ser: Serialized files belonging to this session, + * @file_set_ser: Serialized pointer to the files belonging to this session. * * This structure is used to package session-specific metadata for transfer * between kernels via Kexec Handover. An array of these structures (one per @@ -144,10 +145,10 @@ static_assert(!IS_ENABLED(CONFIG_64BIT) || */ struct luo_session_ser { char name[LIVEUPDATE_SESSION_NAME_LENGTH]; - struct luo_file_set_ser file_set_ser; + DECLARE_KHOSER_PTR(file_set_ser, struct luo_file_set_ser *); }; -static_assert(sizeof(struct luo_session_ser) == 80); +static_assert(sizeof(struct luo_session_ser) == 72); static_assert(!IS_ENABLED(CONFIG_64BIT) || __alignof__(struct luo_session_ser) == 8); diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c index 74bc66929f4b..df667fe15fb2 100644 --- a/kernel/liveupdate/luo_session.c +++ b/kernel/liveupdate/luo_session.c @@ -131,18 +131,21 @@ struct luo_session_global { struct luo_session_header outgoing; }; +#define LUO_SESSION_SER_SIZE (sizeof(struct luo_session_ser) + \ + sizeof(struct luo_file_set_ser)) + static struct luo_session_global luo_session_global = { .incoming = { .list = LIST_HEAD_INIT(luo_session_global.incoming.list), .rwsem = __RWSEM_INITIALIZER(luo_session_global.incoming.rwsem), .block_set = KHO_BLOCK_SET_INIT(luo_session_global.incoming.block_set, - sizeof(struct luo_session_ser)), + LUO_SESSION_SER_SIZE), }, .outgoing = { .list = LIST_HEAD_INIT(luo_session_global.outgoing.list), .rwsem = __RWSEM_INITIALIZER(luo_session_global.outgoing.rwsem), .block_set = KHO_BLOCK_SET_INIT(luo_session_global.outgoing.block_set, - sizeof(struct luo_session_ser)), + LUO_SESSION_SER_SIZE), }, }; @@ -223,14 +226,16 @@ static void luo_session_unfreeze_one(struct luo_session *session, struct luo_session_ser *ser) { guard(mutex)(&session->mutex); - luo_file_unfreeze(&session->file_set, &ser->file_set_ser); + luo_file_unfreeze(&session->file_set, + KHOSER_LOAD_PTR(ser->file_set_ser)); } static int luo_session_freeze_one(struct luo_session *session, struct luo_session_ser *ser) { guard(mutex)(&session->mutex); - return luo_file_freeze(&session->file_set, &ser->file_set_ser); + return luo_file_freeze(&session->file_set, + KHOSER_LOAD_PTR(ser->file_set_ser)); } static int luo_session_release(struct inode *inodep, struct file *filep) @@ -552,6 +557,17 @@ int __init luo_session_setup_incoming(u64 sessions_pa) return 0; } +static struct luo_session_ser *luo_session_ser_init(void *mem) +{ + struct luo_file_set_ser *file_set_ser; + struct luo_session_ser *ser = mem; + + file_set_ser = mem + sizeof(struct luo_session_ser); + KHOSER_STORE_PTR(ser->file_set_ser, file_set_ser); + + return ser; +} + static int luo_session_deserialize_one(struct luo_session_header *sh, struct luo_session_ser *ser) { @@ -575,7 +591,7 @@ static int luo_session_deserialize_one(struct luo_session_header *sh, scoped_guard(mutex, &session->mutex) { err = luo_file_deserialize(&session->file_set, - &ser->file_set_ser); + KHOSER_LOAD_PTR(ser->file_set_ser)); } if (err) { pr_warn("Failed to deserialize files for session [%s] %pe\n", @@ -657,6 +673,7 @@ int luo_session_serialize(void) goto err_undo; } + ser = luo_session_ser_init(ser); err = luo_session_freeze_one(session, ser); if (err) { kho_block_set_it_prev(&it); -- 2.56.0.506.g506a7eabc5-goog