From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (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 B933731F98E for ; Thu, 21 May 2026 23:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779406025; cv=none; b=kmP8ogrkDgnQ1A24qYeMb8b3kNXF7rvKI7x5BSbWEr49BX4SH1M1SChaUl3ppkMLJbDL3TJj8RhRUNgo+xg0gH64wU/1MEQrI7IStg0BQaJ/n4M7+JUwZv3WFqYd8qoZQaN0ecali20TDIAQdYiqiTgAW34Ly0sFj0eXjXDJH5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779406025; c=relaxed/simple; bh=5q8rei/k3MoszO22/PeMIQ+4G4ql6WLKTEvVp3oaGaY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i7+Uq96d8vUplJyfMpJs3LyWjTYVh0nPiea3qDw3WTF6V4qS8wEc9Tnh1g4/1cLV/UFXTRS0jE3PUdI/Uvo6MthqRHuKKCei+rFVzwhot3a0LWWXxBRZUi9BjSPdkXY4l23ZsOk6B1nBgEkTTG5Q5snQoSuxsVS5Lkv1S7nGlLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=Iyg4kHQE; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="Iyg4kHQE" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-516cbe16bcfso6709241cf.2 for ; Thu, 21 May 2026 16:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1779406022; x=1780010822; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=N2d2XGchJMUeRdfEHZWQj8Yrh95g8jOeOZi4Dn5MU5Q=; b=Iyg4kHQEUvdHJboOmXc5m20zR6XngxDoW6QsLTHDlaDM3Uklv36QeiiCQiTtOm8tGi oD9HOyKnNL2VEjmGriv2TYozawTIARezZDmzB4dlAYxr2uCGdnYKfh5Rm5TswXOfbqjx 6wglZ1TXTZZFvoPAFgjNTAKfKnWpkIlKmTEvRU3yq7vFKo+fkW+dcrhl1RcMA/QEUl/Q QLjsPQiUQF2lXL3rwH/ueK6wHqpuoWMqEqfPeBVv9FIsoVYTi3aRCAUfbVyEGVEzNir4 CyypvLJI3Nh6tzkxYZNNOwkJ0QAO+st1w04wuFKi+nzRzTNP0ZHM8wxwYEs02kEvfkL8 rClA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779406022; x=1780010822; h=in-reply-to: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=N2d2XGchJMUeRdfEHZWQj8Yrh95g8jOeOZi4Dn5MU5Q=; b=l7T1B4sTYW8LayYQWHH+YhK1iw0HCkTJYGv3BgNOEOfxNEsQJ+g0OS1+E0Uxzz+iHI b9PEv7pK+rHDiQT3iMqqR2uWQI0CE+YUMsrVNtyeGyIEhKINSPKvu6JITPEeIUa1zMHP L8XMwhMeN6EuEPSxm26+TDFnXoEaWRcUx+OGFCtPDDInqy1QNryu8RVc91yI97wKbZcJ 3o0cBqbDgYud1McoZdCPMYmZuY7ZzJhDW/aDASkLFZZQdnvMlH//EM2lMmoBhaA//FMu HI/XhODwOGIy1m+h81cnLeHjJtJ6sC/iFTg+yZxNhNmPBCUbGhRz0tFlfKs2o+2efjPC NAmA== X-Forwarded-Encrypted: i=1; AFNElJ8i0B0kvz8ms8njbD86QYCRK3mugzNB5Kii08qn3OSt9a6mKvUd7KUOqjDv4hNVwYwVNqNASo6aA0EYHak=@vger.kernel.org X-Gm-Message-State: AOJu0YxWfYBahkGzQGCCOoc8ymV9NNnocutd+b1AftfcfdNDucoakDYp d2riH0GrOG8msisMyZEd9lzQwTdIcocj5sb2yUSZUYBoo8jarlRO3QF1vQSiIOxwSUg= X-Gm-Gg: Acq92OEK0mDderD9/Nu/AO+xnhvsjsDaICu5Dtr3/9kpila8/yyCWjVmVq8IoOpaCoG esUn2T19cZh5e7h4PsQuwk4vO1JES7mc5O7VSLOauxxXn11y9fWRPpLxbmLW2wyn6YdW79fMz34 U24BqR3lGYqQ9fwxxu9SyCID4NkeJOMa0Lrn45TkJx3sR0q9OTQC16jItlrjb+X/LFOwG1FAgSZ oBjNysgOKFurh61b142swyP2eQvkuanDNrs1bhRf5tvhuJjtOvk2i+oj+HUKKWRiw1bp3Zilzz3 +54fZ2g4Ab8nY3mB8+nH8UuZy6q+eoT7BV0unqGYYNWJIFWox6i+lTn1V2VcBA865i/1AEll5u5 rGz9GZyM3+MVNm9brDna/xiFDBjovdcAzbJ+uDWew9Hn95Jg2kzbLqfVOpByrgvow6Ge1DwvUJ9 X5XJXiA9nfwZzJtwWuNhgMaJbHCzNF7sDzXtRLf+Qz/9V9edcLmayzH2zvzUiP4g== X-Received: by 2002:a05:622a:a0b:b0:50d:83a4:2995 with SMTP id d75a77b69052e-516d42e2faamr22496001cf.21.1779406022521; Thu, 21 May 2026 16:27:02 -0700 (PDT) Received: from plex ([71.181.43.54]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-516d63015b0sm4856051cf.5.2026.05.21.16.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 16:27:02 -0700 (PDT) Date: Thu, 21 May 2026 23:27:01 +0000 From: Pasha Tatashin To: Pratyush Yadav Cc: Mike Rapoport , Pasha Tatashin , Alexander Graf , Muchun Song , Oscar Salvador , David Hildenbrand , Andrew Morton , Jason Miu , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/12] kho: store incoming radix tree in kho_in Message-ID: References: <20260429133928.850721-1-pratyush@kernel.org> <20260429133928.850721-3-pratyush@kernel.org> <2vxz4ikddi6y.fsf@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <2vxz4ikddi6y.fsf@kernel.org> On 05-11 18:28, Pratyush Yadav wrote: > On Mon, May 11 2026, Mike Rapoport wrote: > > > On Wed, Apr 29, 2026 at 03:39:04PM +0200, Pratyush Yadav wrote: > >> From: "Pratyush Yadav (Google)" > >> > >> This allows other functions to also use the radix tree. While at it, > >> also use kho_get_mem_map_phys() instead of duplicating the code to get > >> the radix tree root from the FDT. > >> > >> Signed-off-by: Pratyush Yadav (Google) > >> --- > >> kernel/liveupdate/kexec_handover.c | 27 ++++++++------------------- > >> 1 file changed, 8 insertions(+), 19 deletions(-) > >> > >> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > >> index ba568d34c5b4..5758dc6fab5d 100644 > >> --- a/kernel/liveupdate/kexec_handover.c > >> +++ b/kernel/liveupdate/kexec_handover.c > >> @@ -1294,6 +1294,7 @@ struct kho_in { > >> char previous_release[__NEW_UTS_LEN + 1]; > >> u32 kexec_count; > >> struct kho_debugfs dbg; > >> + struct kho_radix_tree radix_tree; > >> }; > >> > >> static struct kho_in kho_in = { > >> @@ -1373,24 +1374,10 @@ EXPORT_SYMBOL_GPL(kho_retrieve_subtree); > >> > >> static int __init kho_mem_retrieve(const void *fdt) > >> { > >> - struct kho_radix_tree tree; > >> - const phys_addr_t *mem; > >> - int len; > >> - > >> - /* Retrieve the KHO radix tree from passed-in FDT. */ > >> - mem = fdt_getprop(fdt, 0, KHO_FDT_MEMORY_MAP_PROP_NAME, &len); > >> - > >> - if (!mem || len != sizeof(*mem)) { > >> - pr_err("failed to get preserved KHO memory tree\n"); > >> - return -ENOENT; > >> - } > >> - > >> - if (!*mem) > >> - return -EINVAL; > >> - > >> - tree.root = phys_to_virt(*mem); > >> - mutex_init(&tree.lock); > >> - return kho_radix_walk_tree(&tree, kho_preserved_memory_reserve); > >> + kho_in.radix_tree.root = phys_to_virt(kho_get_mem_map_phys(fdt)); > > > > Do we really want to remove an explicit check for 0 and get a WARN() in > > kho_radix_walk_tree()? > > If mem_map_phys is 0 then kho_populate() never sets kho_in.scratch_phys > and thus kho_mem_retrieve() never gets called. So here it will never be > 0, and if it is, a WARN() is certainly warranted. > > Perhaps I should add a comment since this isn't so obvious? > > > > >> + mutex_init(&kho_in.radix_tree.lock); > >> + return kho_radix_walk_tree(&kho_in.radix_tree, > >> + kho_preserved_memory_reserve); > >> } > >> > >> static __init int kho_out_fdt_setup(void) > >> @@ -1597,8 +1584,10 @@ void __init kho_memory_init(void) > >> if (kho_in.scratch_phys) { > >> kho_scratch = phys_to_virt(kho_in.scratch_phys); > >> > >> - if (kho_mem_retrieve(kho_get_fdt())) > >> + if (kho_mem_retrieve(kho_get_fdt())) { > >> kho_in.fdt_phys = 0; > >> + kho_in.radix_tree.root = NULL; > > > > I'd make kho_mem_retrieve() void and put these there. > > Sure, will do. +1 on this one, otherwise LGTM. Pasha > > > > >> + } > >> } else { > >> kho_reserve_scratch(); > >> } > >> -- > >> 2.54.0.545.g6539524ca2-goog > >> > > -- > Regards, > Pratyush Yadav