From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (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 A032A39CD15 for ; Thu, 16 Jul 2026 15:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.128.169 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784217558; cv=pass; b=aVtS/a+FxMxT4t7qFuuru+X/Kzdb3sgp4LofZIcuJcMprwordnyzH/m9+sjv9VwhtPTEGDDgwtfby796gWwQPYhT6Ojc1OvqTT+xYTlhu4YGHZ1efFUGdG90BGkRTxfh7dXr0R+flESTTLXOQC+jpYeedw1Ah1CR4yo8djtg9gQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784217558; c=relaxed/simple; bh=itGbq07Nr/3aREyFCWeD5PlpGayUnNhMCz8RB3pMWi0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qZ9iN99+wQRAt90/Pc4dCJJ0BbZrdZDDigI8nvxpCDKTq9Z7bS9L0jHz/xKA4+XuO0T/AcIpySdHJAFCPpjBbcEK81iMfLCHJbwWOOHroE+ILnZQ5zVlqGNH+8Q0Wajv4Bg565tmZK+IuCpEoNHDmShWXo8TLuU1x9SOOMTu+ys= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AioxyDwH; arc=pass smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AioxyDwH" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-80a123ef90aso14935147b3.0 for ; Thu, 16 Jul 2026 08:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1784217556; cv=none; d=google.com; s=arc-20260327; b=ONPJ/fhMQIhYye5psLQV27MNdZkhJCj1Qmjy7SmdQEyjHhlmXegiQrgavjYslq/AtN chIblw26HOYQkARu4Ye9abrzF9IRgNlgOQ06Pt0nEy6ElbFkS1Ea8FNKXKOBj4/5VByt 6Uk5KLZBtnkNYemPAuCntvJs8ogIIbK7+AYDI6AS28kAeOJm+Q8PLbbYg9LIm+KKUhis YNEB9wrg1nVH7Cq4FFmsoGF5bh0Cn4ss/DxNKYNp79k4KshHh0muBBj5tB10eGE9xN8c oaxWpeyj7/e57RIr8YuCFkFysfwBYTW9S9dTD/au0TSGTHkNGKqQisvZToMPnxvd1mz1 jPlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=itGbq07Nr/3aREyFCWeD5PlpGayUnNhMCz8RB3pMWi0=; fh=WC6Dl3JobWZCNmu1DmgEUQtCzGuOe+svyXT3Awk0u6c=; b=Uxpx2pBLnORdT/JbpkSASE+CnmvjAvTCuVQxp73xHLVuYymzMC1z90HH1luaZHGlq1 PPP2VXoeRwA0OgliVzwpdMdrMwiK8Blprh5PXZb7zPgjPLgyWdoKWklsDBBk+sCwSmgz Tu+NyVPF8f8UDrd3j/AcuxgNN6L+2tGKq+7eUov5vA8GzW1p/ACJ70p3l0u7cexLS6/X g3Gc1Wo3o05Akb+e1cISK9Y9w9oPT4FKPZfige03jAd5SGYGA73zyvz/k4sgPGP4HE3a WABdHg3NKBgqbaHkPVHmJwYfOiwDKB/efzSeysUWZ4XWH7xmxiS+ElHIwd4YwW/qBX1o rrJA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784217556; x=1784822356; darn=vger.kernel.org; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to :content-type; bh=itGbq07Nr/3aREyFCWeD5PlpGayUnNhMCz8RB3pMWi0=; b=AioxyDwHfE7s44E0tdidloFcwg8NLuGJ6fBJyG9FG3tLIaJVspk1L6gjrOLuRoakn/ XQlc/EEMpzxPSccnSIUizi4cgF9UP3rVe5Np4DGsp0jcF09zBOVc2vwU0YJU+oWM3f1l 8BaMeH5aO2Vl7/5jKkGn6Yu2jkjz0tpjdx8MbgFcIv8M4mEvATkhcJEnv3DyoXQQxc5L f0I7h48qSTmKtFoIZDQ54EwXnBvmTbNLkdrV9+m89i/GKmuvVii3PoDnqK2qeq5gBg1c DAjwXI2cdovqrDdrD72X6F1Rt/TFhSsc8kg9euK6ICItqjXdZB5j/KVecggGCr2zAaKN hVXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784217556; x=1784822356; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=itGbq07Nr/3aREyFCWeD5PlpGayUnNhMCz8RB3pMWi0=; b=I31S07MFMfgr+ZebTtUuniv462NDLUAdaruW+T2L+z8HsuSrMi/7Nn1CnaH2yYmh4a bb0HJYAyce80esYB5ZRbBXRd58Er/nKRfSKEBxZp8S7owWLeXKNYXjKpoV8ijZHBJKY5 aNNCO+mPgj0a/JH9Co61Od1vXWY9KFyonyiH2T48rLfBgdFIJuhagdospeibZaPNR09K goR0vCuCtxcX4aAqeiaf2cUiKOiM6So6TZurE1tcYDlgNVfTDl1xe72tR2GO5+q249Ak GpxnVPkSybJwrP1dl6YZYeWeCfQZbOM51HC6fEU477J6hrRUjIKFnS6++c6jpblXMvHj EE+A== X-Forwarded-Encrypted: i=1; AHgh+Rrg5ePsUKC4BP84QbuE5EEzZCcxK6ZCScjon1FLeIyFL4qPKiBMiggaRZg+rcYa89JRqQNISQmSObesJvw=@vger.kernel.org X-Gm-Message-State: AOJu0YzjM+Vta2iUi9yx9XXvmkNjgL+c08/t/CLgDGp2IxJ7/pVd6bbP Ogppb+JNuld36coKv5mKFpQMg430qFkTjsRYqf7ZuB+EYyOwB6E9TKgfZfmSjpJJeLPK34Osoe2 phwh46VLjE9jiadTTS984pRtniBuJvoU= X-Gm-Gg: AfdE7clvfSiGeKOFXw1CsaX1x460alzSyrG9Eb12jQKpF4VGh3xngfNeo/8nx/SapDy VYRMeXmdn4jD+emI5tYge3AFhgyoFZ1OPVUSDbbof85uQydyIGbgBKJcVXZiH0EAFaQiADQ1asT cIm0ylCxkAWk257zfdMDBUPRvnHg5d952M9bA2EFU7/ZhAtLp3pRPu1Dch8lFa6CX2CJkG/gau3 yQOou/lOyAanaCJ371BcLovcIJof5Rx62olwBZi6EYpvfYEJ2Ae8LWeECQJ1qfhlmdmWKl9X9vr 94YvW6cuiBBQjtG1b0dqx90B3HLQsgI= X-Received: by 2002:a05:690c:7283:b0:81e:bc7a:df50 with SMTP id 00721157ae682-81ee27da338mr22708687b3.3.1784217556404; Thu, 16 Jul 2026 08:59:16 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260714190356.190328-1-dmatlack@google.com> <2vxzy0fcicpi.fsf@kernel.org> <20260715172336.GC3775915@nvidia.com> <2vxzldbbhsb4.fsf@kernel.org> In-Reply-To: <2vxzldbbhsb4.fsf@kernel.org> From: Luca Boccassi Date: Thu, 16 Jul 2026 16:59:04 +0100 X-Gm-Features: AUfX_mzDCiilD7YNKNL42B1YJ1d5u9iOC0w12NRZaSOyWnithGXUwP5aTZQILLU Message-ID: Subject: Re: [RFC PATCH] liveupdate: Allow multiple openers for /dev/liveupdate To: Pratyush Yadav Cc: Jason Gunthorpe , David Matlack , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Mike Rapoport , Pasha Tatashin , Samiullah Khawaja , Shuah Khan Content-Type: text/plain; charset="UTF-8" On Thu, 16 Jul 2026 at 16:23, Pratyush Yadav wrote: > > On Wed, Jul 15 2026, Jason Gunthorpe wrote: > > > On Wed, Jul 15, 2026 at 03:50:33PM +0200, Pratyush Yadav wrote: > >> Hi David, > >> > >> On Tue, Jul 14 2026, David Matlack wrote: > >> > >> > Remove the single-opener restriction for /dev/liveupdate by removing the > >> > atomic in_use tracking and the exclusive open check in luo_open() that > >> > returned -EBUSY. Protect luo_session_deserialize() with a mutex guard so > >> > that concurrent open attempts by multiple processes safely executes > >> > deserialization only once. Update liveupdate selftest to verify that > >> > multiple concurrent openers succeed. > >> > > >> > LUO does not inherently require a single opener. There is some > >> > documentation about it simplifying state management, but the only thing > >> > it actually protects is the session deserialization during first open, > >> > which can be easily handled with a mutex. > >> > > >> > Relaxing the single-opener requirement avoids the kernel forcing a > >> > design pattern on userspace that it itself does not require, e.g. > >> > allowing multiple userspace processes to create and manage sessions. > >> > >> Agreed. When the kernel had a global state machine in the early versions > >> of LUO, this might have been more relevant. With sessions, even if we > >> later add a state machine, it likely will be per-session instead of > >> being global. So I think letting userspace open /dev/liveupdate multiple > >> times makes a lot of sense. > >> > >> Also, today's systemd only supports preserving individual files, and > >> does not hand out sessions. To get sessions, userspace must open > >> /dev/liveupdate and create a session. This opens up room for one bad > >> process to block every other process from creating sessions. It also > >> imposes a need for userspace to add a polling/retry logic for getting > >> sessions and serializes their execution around this point. > > > > Shouldn't systemd open and own /dev/liveupdate? That was at least what > > I originally expected here, you'd talk to it and get a session FD > > through dbus. > > AFAIK I doesn't do so today. You can either create FDs and save them via > FDStore, and systemd will put them in its global session, or you grab a > session directly from /dev/liveupdate and save the session via FDStore. > Maybe in the future it will add the capability to vend out sessions > through dbus as well, but at least today it doesn't do so. I've added it after Pasha asked for it, will be in the next release: https://www.freedesktop.org/software/systemd/man/devel/systemd.service.html#LUOSession=