mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
To: andre.przywara@arm.com
Cc: mark.rutland@arm.com, lpieralisi@kernel.org,
	sudeep.holla@kernel.org, salman.nabi@arm.com,
	vvidwans@nvidia.com, nirmoyd@nvidia.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [RFC] firmware: smccc: lfa: Inventory and notification failure recovery
Date: Thu,  3 Dec 2026 17:34:20 +0800	[thread overview]
Message-ID: <20261203093420.3433195-1-jiangtianfeng@linux.alibaba.com> (raw)
In-Reply-To: <20261102165421.3651202-1-andre.przywara@arm.com>

Hi Andre,

I would like to discuss the recovery semantics after an LFA activation
and after notification setup failures. This is a design discussion only;
I am not proposing to transplant an existing implementation.

1. Activation success versus inventory refresh failure

Once LFA_ACTIVATE has completed with CALL_AGAIN clear, the firmware
handover has succeeded. A subsequent inventory refresh failure does not
make that activation unsuccessful, and CANCEL cannot roll it back.

The public implementation already ignores the inventory-refresh return
value after a completed ACTIVATE and reports activation success. An
earlier downstream 6.6 implementation propagated refresh_ret, which
could invite userspace to retry a completed activation. I think the
safer model is to preserve the public success behavior while marking
the inventory as refresh-needed, logging the refresh error and
recovering it independently. Success here means that the firmware
handover completed, not that inventory refresh succeeded. Until a
complete refresh succeeds, all sequence-based operations should remain
unavailable.

Does this match the intended ABI? If a special error is still preferred,
how should userspace distinguish "activation completed, inventory needs
recovery" from a real activation failure without inviting a retry?

2. Refresh recovery model

Before any retry can be safe, refresh itself must become fail-closed:

- Invalidate all old sequence IDs immediately after activation, before
  any GET_INFO call.
- Treat an error from GET_INFO, any GET_INVENTORY, allocation or node
  update as making the whole refresh incomplete.
- Invalidate all sequence IDs again on error and keep sequence-based
  operations blocked.
- Never treat partial enumeration as success, publish a success event
  based on it, or merely delete the "missing" nodes as if the inventory
  were valid.

A possible model then is:

- Invalidate every old sequence ID before and after a failed refresh.
- Remove invalid nodes while keeping all sequence-based operations
  blocked.
- Only after that cleanup completes, attempt a bounded delayed
  re-enumeration, for example at most three times.
- Complete the inventory and cleanup before clearing refresh-needed.
  If userspace needs a recovery-complete notification, should we add a
  documented KOBJ_CHANGE event only after a complete successful refresh?
  That would be distinct from notifications for individual node changes.
- On persistent failure, remain fail-closed rather than allowing stale
  operations. Remove and probe rollback must synchronously cancel the
  delayed work.

This raises several questions:

- Should upstream attempt automatic recovery at all, or prefer an
  unbind/rebind recovery while remaining fail-closed?
- Is a delayed-work attempt limit an acceptable policy, and who owns it?
- Discard old candidate snapshots on invalidation and rescan after
  recovery. Before any automatic activation, revalidate the UUID, valid
  sequence ID, activation_capable, latest activation_pending and current
  auto_activate setting. Also clarify whether auto_activate and
  force_cpu_rendezvous are intentionally retained by UUID across node
  recreation or reset so an administrator must re-enable them.

A delayed retry is only best-effort recovery, not a guarantee that a
persistent firmware or allocation failure will eventually resolve.

3. Notification allocation failure

The notification path can lose an update when its candidate-array
allocation fails. Moving a GFP_KERNEL allocation outside the list
spinlock can reduce that failure rate, but it cannot eliminate ENOMEM or
guarantee that another edge-triggered notification will arrive.

If a pending update must eventually be handled, would a single
serialized work item for rescanning be preferable to a synchronous retry
inside the notification callback? The budget-exhaustion, remove and
probe-rollback semantics would need to be defined at the same time.
Would that work item share the inventory recovery path, or should
notification retry remain a separate mechanism?

Three concrete cases I am trying to avoid are:

- A utility repeats a completed activation because the write returned
  an error.
- A delayed retry survives remove or probe rollback and runs after the
  resources have been destroyed.
- A notification is lost after an allocation failure with no later edge
  interrupt to recover it.

My current preference is to agree first on activation/refresh-needed
semantics and fail-closed behavior. Only after that should we discuss a
bounded inventory retry. A small change to the notification allocation
context can be reviewed independently, but it must not be presented as
a reliability fix.

Real EL3 firmware, notification and fault-injection testing has not been
run for these cases. Userspace activate-write retry behavior after a
completed activation has also not been tested.

Qoder, an AI coding assistant, helped analyze the public LFA code and
these failure paths and draft this discussion. The submitter reviewed
the content and is responsible for it.

Best regards,
Jiangtian

      parent reply	other threads:[~2026-12-03  9:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 16:54 [PATCH v5 RESEND 0/6] Arm Live Firmware Activation (LFA) support Andre Przywara
2026-11-02 16:54 ` [PATCH v5 RESEND 1/6] dt-bindings: arm: Add Live Firmware Activation Andre Przywara
2026-11-02 16:54 ` [PATCH v5 RESEND 2/6] firmware: smccc: Add support for Live Firmware Activation (LFA) Andre Przywara
2026-11-04 22:50   ` Vedashree Vidwans
2026-11-02 16:54 ` [PATCH v5 RESEND 3/6] firmware: smccc: lfa: Register ACPI notification Andre Przywara
2026-11-04 20:03   ` Nirmoy Das
2026-11-04 23:02     ` Vedashree Vidwans
2026-11-02 16:54 ` [PATCH v5 RESEND 4/6] firmware: smccc: lfa: Add auto_activate sysfs file Andre Przywara
2026-11-02 16:54 ` [PATCH v5 RESEND 5/6] firmware: smccc: lfa: Register DT interrupt Andre Przywara
2026-11-03  4:20   ` kernel test robot
2026-11-03  7:50   ` kernel test robot
2026-11-03  9:25   ` kernel test robot
2026-11-02 16:54 ` [PATCH v5 RESEND 6/6] firmware: smccc: lfa: add sysfs ABI documentation Andre Przywara
2026-11-05  9:17 ` [PATCH v5 RESEND 0/6] Arm Live Firmware Activation (LFA) support Nirmoy Das
2026-12-03  1:38 ` [PATCH 0/4] firmware: smccc: lfa: Fix deterministic v5 issues Jiangtian Feng
2026-12-03  1:38   ` [PATCH 1/4] firmware: smccc: lfa: Stop PRIME retry after completion Jiangtian Feng
2026-12-03  5:56     ` [PATCH] firmware: smccc: lfa: Cancel PRIME after a partial failure Jiangtian Feng
2026-12-03  1:38   ` [PATCH 2/4] firmware: smccc: lfa: Drop nested CPU hotplug read lock Jiangtian Feng
2026-12-03  1:38   ` [PATCH 3/4] firmware: smccc: lfa: Fix probe and notification rollback Jiangtian Feng
2026-12-03  1:38   ` [PATCH 4/4] firmware: smccc: lfa: Close DT IRQ mapping lifetime Jiangtian Feng
2026-12-03  9:34 ` Jiangtian Feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203093420.3433195-1-jiangtianfeng@linux.alibaba.com \
    --to=jiangtianfeng@linux.alibaba.com \
    --cc=andre.przywara@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nirmoyd@nvidia.com \
    --cc=salman.nabi@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=vvidwans@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®