From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0F1D189906 for ; Fri, 19 Dec 2025 02:37:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766111823; cv=none; b=OyAu5serctjR1Ny2TWOcm30Wz46mYP9Lp4uXlsiN56fTWfDn0xUn5VGJloQJBDTeEUFS42UD7t4SD9fCGBlU0y0u0Q5yuYrib2o69dDQH54mFI2lOi2i8czGzHomZZQZ9Q1cDtTqWfd24eKYcGDwUgGsTvKVJ1KsVjeqLqbnGhY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766111823; c=relaxed/simple; bh=X+YwzWCOh60oHo8bc6TUp/24v2nNpKPQBBb0/fSOWYQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cqKqeUvHJaHS4p+I7XKDYn17gOyw9xvK7m9GeJYq/gucgWCgrKd5smhEfw5sioa45jfR6zUL8G+U1x7zf9cc7l/e6k6J1dTBrLr88q6ukjPDe5BLuUALSz8Z38bE9udzi1f9DnFBrpafRkJ8vX1o7t/W5xua9cyCGk12vy1mq+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=n0GgV8P8; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="n0GgV8P8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1766111822; x=1797647822; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=X+YwzWCOh60oHo8bc6TUp/24v2nNpKPQBBb0/fSOWYQ=; b=n0GgV8P88vTc/CtNooGuGnZs0MRG0T1h4H30ISPMpKLSObfgw5jGXjBA dgiqYrj0ZZfJ7QS2hBmIi1IZG/MfVoFk+7GH9qOkm39g3nljCOmNIcvpl 2j5s8HoPKDpRm8ykKFBPWs9KMAMIUBau6pKIxOmenJqP0QDlwEwbzxTtc eG2nacED+WVcTM6j/nSugzAHHylqwWL6KM8HEQW/7TLKKy6+VMP6KhvgZ v2hLSpmnWE1iWntbA2qOhitXX83fHXkJ9K7uAY6a6xPC33yFYBjh535t4 n+8DAX69i0YjRzWambIqjn2wy7KhDQfYAePeugQ+0e7gn0WYAlbOocw6o w==; X-CSE-ConnectionGUID: yB3P2+l6SsKH+k0mFHveBw== X-CSE-MsgGUID: 8G+5ohZBTl+DurR0c4YMGQ== X-IronPort-AV: E=McAfee;i="6800,10657,11646"; a="78390935" X-IronPort-AV: E=Sophos;i="6.21,159,1763452800"; d="scan'208";a="78390935" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2025 18:37:02 -0800 X-CSE-ConnectionGUID: be/p+YKgQL22VTnvotngOg== X-CSE-MsgGUID: TDawHjBaRnSr63HrEZjweA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,159,1763452800"; d="scan'208";a="202918593" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orviesa003.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2025 18:37:01 -0800 Date: Thu, 18 Dec 2025 18:43:41 -0800 From: Ricardo Neri To: Pasha Tatashin Cc: akpm@linux-foundation.org, bhe@redhat.com, rppt@kernel.org, jasonmiu@google.com, arnd@arndb.de, coxu@redhat.com, dave@vasilevsky.ca, ebiggers@google.com, graf@amazon.com, kees@kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, ricardo.neri@intel.com Subject: Re: [PATCH v2 11/13] kho: Allow kexec load before KHO finalization Message-ID: <20251219024341.GC17600@ranerica-svr.sc.intel.com> References: <20251114190002.3311679-1-pasha.tatashin@soleen.com> <20251114190002.3311679-12-pasha.tatashin@soleen.com> <20251218215613.GA17304@ranerica-svr.sc.intel.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 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) On Thu, Dec 18, 2025 at 07:26:19PM -0500, Pasha Tatashin wrote: > On Thu, Dec 18, 2025 at 4:49 PM Ricardo Neri > wrote: > > > > On Fri, Nov 14, 2025 at 02:00:00PM -0500, Pasha Tatashin wrote: > > > Currently, kho_fill_kimage() checks kho_out.finalized and returns > > > early if KHO is not yet finalized. This enforces a strict ordering where > > > userspace must finalize KHO *before* loading the kexec image. > > > > > > This is restrictive, as standard workflows often involve loading the > > > target kernel early in the lifecycle and finalizing the state (FDT) > > > only immediately before the reboot. > > > > > > Since the KHO FDT resides at a physical address allocated during boot > > > (kho_init), its location is stable. We can attach this stable address > > > to the kimage regardless of whether the content has been finalized yet. > > > > > > Relax the check to only require kho_enable, allowing kexec_file_load > > > to proceed at any time. > > > > > > Signed-off-by: Pasha Tatashin > > > Reviewed-by: Mike Rapoport (Microsoft) > > > Reviewed-by: Pratyush Yadav > > > --- > > > kernel/liveupdate/kexec_handover.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > > > index 461d96084c12..4596e67de832 100644 > > > --- a/kernel/liveupdate/kexec_handover.c > > > +++ b/kernel/liveupdate/kexec_handover.c > > > @@ -1550,7 +1550,7 @@ int kho_fill_kimage(struct kimage *image) > > > int err = 0; > > > struct kexec_buf scratch; > > > > > > - if (!kho_out.finalized) > > > + if (!kho_enable) > > > return 0; > > > > Hi Pasha, > > > > Using v6.19-rc1 (which has this changeset) and with: > > > > CONFIG_KEXEC_HANDOVER=y > > CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=y > > CONFIG_LIVEUPDATE=n (i.e., nobody calling kho_finalize()) > > no reserve_mem= entries in the kernel command line > > > > I omit doing > > > > echo 1 > /sys/kernel/debug/kho/out/finalize > > > > before doing > > > > kexec -l --initrd= --commandline="$(cat /proc/cmdline)" > > kexec -e > > Hi Ricardo, > > Thank you for reporting this bug. I created a fix here: > https://lore.kernel.org/lkml/20251219002355.3323896-1-pasha.tatashin@soleen.com > > Please let me know if it works. Thanks for the quick reply, Pasha. Your patch does work for me (I saw you will post a v2). >From this patchset, I gather that kho_finalize() can be called multiple times and in-kernel users of KHO should call it when done preparing their subrees. Is that correct?