From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E8E6270EDF for ; Fri, 29 May 2026 16:36:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780072577; cv=none; b=NdD1qqOcFdLeDlZysFs2qrF9Jy5sFa5oc8Zw41MgIIKtxvrAj/rYCGrJJDbcN/g9OShGrGk/9pOFuNwRk87WB0VU2TpPxHDunltz0hy+QK32sbuIKtzZsxOdkWVfhNOy/tYpLOO4Bciam4s1VSliSTotUzXFwmPYGyvuaUfqA08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780072577; c=relaxed/simple; bh=1s4jCvq8oe7L8zTPt/8najNSgGP1x7KJi9la/FnhfuU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ajhvZB7Rr1CZj+9UtvKOYCi7ilfodeJAOb69XsUWNVU9ylwlSTgD9M+h3OCbrw9OluZDbTZCLpXkgejgp9MNare9SY8C2Vmsa6IdbJgrgx46C4jG6rnw9cv9K4EtFX51l301jZqHMhGIKoWCxoI9Jt49IYZuVmzgGYG6bFOQ80k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gKMhGYiT; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gKMhGYiT" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2b2e8b95bdbso1235ad.0 for ; Fri, 29 May 2026 09:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780072575; x=1780677375; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Hkl9oyaLQGMd1OIG8CqahDq2VdYTq3MPtBcULn0MWsI=; b=gKMhGYiTslcyry08LGr2vHz6kdTZjzvvCnLeRMIY/3anTKlRJy7Ty5Jiey+J1H6pIU CLro/qbert5uyQshVU8Vr+9MqqSyMdw/kpST1jfp3xE0ldWyMsE0MFtoYmI8zmsRkERX Scg35GmFTx4b63EUSp0wrnfegZBTaTXmaGKhgUrtPxT0mHGQuuiZwQ+S8RUdXdoc2ifk Ts3w767+6hkcY49jruiafI96Kt69WmTsma0+3Pt1LjZSFsFvBckyqfCl92KkXCSTCY5A fDBv+cZF+aueIVJ4oGBDRQ4jUlpbeYwuY13+0+DYkCQO6VFsEOkqiTFjgNJ6+5n38SH1 aDrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780072575; x=1780677375; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Hkl9oyaLQGMd1OIG8CqahDq2VdYTq3MPtBcULn0MWsI=; b=ljmsLdQ5jPbNEFiqq++g6P4tpbIZ8vRF1W3CsVIEym3F9jmb4XZqaIMvqpyIc2FlfK Eomd+TKZfCBC0uJFyFa6JIUjPof2pIwR0gspGWzr9haJ3XcAP3b4DFU7FE4aII3oS4Kt Gj3BFaP+t3ABEuSooGFJG7GvdYLcylhLw3GiiXHDgJpJpSV5y7rxuCmBo+uf6+rIiu1f mJZexT1qGeYB5pscD7P/3wvWRyhw7d9IY2rJYHUEuGf2UTcnaopUZN1fJQXwgFh+sBB2 RXovgrZ+8j5mTV8Kvl/QExpkPO5Ca8+FxN/weJuLF3OVecUl6BVGGsvi6gTTjV3sMFbO ajow== X-Forwarded-Encrypted: i=1; AFNElJ/WrJI+d/R2y7X1wt7NkK0dttT/wjc5wqQhRio8fwv9D7yRg7LQsDwy4Kq4e7nMUALRTMjFLqvwZzSa0d8=@vger.kernel.org X-Gm-Message-State: AOJu0YwhhQ4lY8kvtkSXQcpUr0pXVgnXHW5HKJ/OC9jgXu39V1MtpWi5 S0O7OpIygtUFl2B/x8To/d3UYdUMhPBPwTaOOZ/hlT9PvutUoKTC7OhkU8luXQ28mQ== X-Gm-Gg: Acq92OFSrFTtbYrstRP11SPC2f0ZqOEWXEE+oLmoJ407F3re7emXXlWxqwi3OfARkEc tcGmgzw498nMj9uFfavjJ6oT7p/bH63zlS+fs9On22Ah+NkSfsCU9cKmSsoc4nrosIShhfh5+Mv tzPeCFIgClT1NUwh3va9O744dhaqVGMovciiyxZ3Tn15Ysom/sskrVodEwTcQAyP+ZJYqXfogtu u+4thniSCrhGQU88OkZVScpyrR6N8VoArjBXOZLJ5yXpYs8sTrnubnNFcarJY9WaJB0tgUrmnk7 IxjWDKZ8ZEafvSI376Ew56n9KjargI2hYkJznyui3qq6CUF1MYHq2dCDHNWibQ+2A9NduIv69Jx y+Mo+wtoGD0rJeOrLeFRmr8XfIHlyTnYert2qiHzQSkTQFY1xcw2LOLy/OAqdoymSGWyJ6WZgDP U6NORNc/DWsRWlsK58Po1PG/ow4gChicNunp+jsUP5X/sZ+f8xQykenrXIDQ5mC5G88VNHjw== X-Received: by 2002:a17:902:ce92:b0:2bf:1000:d3ac with SMTP id d9443c01a7336-2bf22eb614amr2015775ad.11.1780072574937; Fri, 29 May 2026 09:36:14 -0700 (PDT) Received: from google.com (153.46.83.34.bc.googleusercontent.com. [34.83.46.153]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bf239e5d83sm26696345ad.8.2026.05.29.09.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 09:36:14 -0700 (PDT) Date: Fri, 29 May 2026 16:36:11 +0000 From: Samiullah Khawaja To: Ankit Soni Cc: Pranjal Shrivastava , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Jason Gunthorpe , Pasha Tatashin , Robin Murphy , Kevin Tian , Alex Williamson , Shuah Khan , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Saeed Mahameed , Adithya Jayachandran , Parav Pandit , Leon Romanovsky , William Tu , Pratyush Yadav , David Matlack , Andrew Morton , Chris Li , Vipin Sharma , YiFei Zhu Subject: Re: [PATCH v2 01/16] liveupdate: luo_file: Add internal APIs for file preservation Message-ID: References: <20260427175633.1978233-1-skhawaja@google.com> <20260427175633.1978233-2-skhawaja@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, May 29, 2026 at 04:12:20PM +0000, Ankit Soni wrote: >On Mon, May 18, 2026 at 07:08:01PM +0000, Samiullah Khawaja wrote: >> On Mon, May 18, 2026 at 11:40:58AM +0000, Pranjal Shrivastava wrote: >> > On Mon, Apr 27, 2026 at 05:56:18PM +0000, Samiullah Khawaja wrote: >> > > From: Pasha Tatashin >> > > >> > > The core liveupdate mechanism allows userspace to preserve file >> > > descriptors. However, kernel subsystems often manage struct file >> > > objects directly and need to participate in the preservation process >> > > programmatically without relying solely on userspace interaction. >> > > >> > > Signed-off-by: Pasha Tatashin >> > > Signed-off-by: Samiullah Khawaja >> > > >[..] > >> > > + * >> > > + * Context: It must be called with session mutex acquired of a restored session. >> > > + * Return: 0 on success. Returns -ENOENT if no file with the matching token is >> > > + * found, or any other negative errno on failure. >> > > + */ >> > > +int liveupdate_get_file_incoming(struct liveupdate_session *s, u64 token, >> > > + struct file **filep) >> > > +{ >> > > + return luo_retrieve_file(luo_file_set_from_session_locked(s), >> > > + token, filep); >> > > +} >> > >> > Nit: Shouldn't we export both of these functions via EXPORT_SYMBOL_GPL? >> > Since, these new APIs are intended for kernel subsystems to participate >> > programmatically, there could be IOMMU drivers (or others) that can be >> > compiled as loadable modules. Thus we should export these APIs via >> > EXPORT_SYMBOL_GPL(). If they aren't exported, any loadable module >> > attempting to use them will compile successfully (due to the header), but >> > will fail to load at runtime with an Unknown symbol error. >> > >> > IIUC, if a function isn't exported with EXPORT_SYMBOL, it remains hidden >> > inside vmlinux, (i.e. it isn't in the kernel's global symbol table used >> > during modprobe). >> >> Agreed. Will Update this. >> >> I think there are other LUO APIs that are not exported and can be used >> by modules. Let me check those also. > >Hi, >+1 to Pranjal's EXPORT_SYMBOL_GPL nit, and I'd like to extend it. >With CONFIG_IOMMUFD=m && CONFIG_IOMMU_LIVEUPDATE=y >the series fails at modpost, not at modprobe — kernel won't even build: > > ERROR: modpost: "memfd_get_seals" [iommufd.ko] undefined! > ERROR: modpost: "iommu_preserve_device" [iommufd.ko] undefined! > ERROR: modpost: "iommu_unpreserve_device" [iommufd.ko] undefined! > ERROR: modpost: "liveupdate_register_file_handler" [iommufd.ko] undefined! > ERROR: modpost: "liveupdate_get_token_outgoing" [iommufd.ko] undefined! > ERROR: modpost: "iommufd_liveupdate_register" [iommufd.ko] undefined! > ERROR: modpost: "iommufd_liveupdate_unregister" [iommufd.ko] undefined! > ERROR: modpost: "iommufd_hwpt_liveupdate_mark_preserve" [iommufd.ko] undefined! > >Two issues: >1) drivers/iommu/iommufd/Makefile (patch 12) builds liveupdate.o into vmlinux > instead of iommufd.ko — needs to be a composite member, not a top-level obj: > -obj-$(CONFIG_IOMMU_LIVEUPDATE) += liveupdate.o > +iommufd-$(CONFIG_IOMMU_LIVEUPDATE) += liveupdate.o Thanks for this, I will update and test this. > > This fixes the iommufd_liveupdate_{register,unregister} and > iommufd_hwpt_liveupdate_mark_preserve errors above. > > >2) Beyond the two LUO functions Pranjal mentioned, four more vmlinux symbols > need EXPORT_SYMBOL_GPL. Yes, we will have a commit for those in the VFIO series as it also uses those LUO symbols, and this series has a dependency on VFIO series. Please see the following commit from David: https://lore.kernel.org/kvm/20260323235817.1960573-2-dmatlack@google.com/ > >Thanks, >Ankit > >> > >> > Thanks, >> > Praan >> > >> > [1] https://elixir.bootlin.com/linux/v7.0-rc3/source/kernel/liveupdate/luo_file.c#L560 >> >