From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.132 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290478; b=G/ncytmGccJN6qCg2F38z1RyRQKWqtm3kMzHRtdEEFS/RQmMeg/q7S6/sRtP0nxXborZ ymiqx4lwu6uxa030zejapjrOfCO5YDVgDN/+4lqLQMwoNnpuPNbqh7FFTM7eRNe+nRoGa 0T7LMwOi6RqVJDnpqKqF9fSKoS9kthKS8WudIeA+6nSgxNA9kPOXW0ymw7cuYr4zWCwNt NYavDjMpvFxxih3T4lrfljfKMn1LRW+mJQzb/PuKUC7lfYIXjCiJ1UbnyGso1OxMbejSF 4ZjREtlQCXXM0HE9fH6LEgyX0JxToijuDyY44RksWG9+Lq71fPJsbw8bh3rv/R2Rdsw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290478; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=JYAv5CswDMm0PdLW8xCOGSJB/vnpnEYEjQsNlbLAj+Q=; b=W8gHQW8CrWDRpFx+xp65LQWAlLsPIuCiO852Hfg2ELlUxqvLJn9Aq5xpu4uq+kobl1hD DB8uDqziIC5b3InJcJGdmfQx4xK1jGwaH2u8sY0UqhsXd0zxhDoH4VQgWuTyWWscjuvEW 6e08YF1HKP9W2xX88eCVDfZ8s0EmRrpXFoxxJNwNQITFg0OFiPdFPCVB7oI4QvZOcXm9l 1/DHgnFw5ASNua/DWJxAW7sGu5mpdmJZWP2CNXh+NYaQ5hWYpJGew0zWFPtkzzOnC1Qwr 1b1j51O8Gg8ACnyqamyWf1vrck0UsnWUGjQ9kFUwm+BDgV1WdypGpYZAhkz6A2HQ8Gg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=T5AhG9Gv; arc=none smtp.remote-ip=115.124.30.132 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAFD8606A687 for ; Thu, 3 Dec 2026 09:34:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AAFD8606A687 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=T5AhG9Gv DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796290475; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=JYAv5CswDMm0PdLW8xCOGSJB/vnpnEYEjQsNlbLAj+Q=; b=T5AhG9GvM7oKFdzZYjCCdaLjRAB7bNlEmv5W7KKh9dX4UnHzlzaGLWvWbayQKcfPOWHv2kxqA7a+Ao6Pe0rlrKVaxtFNcN97DiwsaAI6eJQLmognKbBNFxN+TgNbPvV8DZrzEchTxj3CsTLL6H+eIz/rmGzmWFXZ8UYTWUaRg1U= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R541e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033071064103;MF=jiangtianfeng@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0XGDuMnM_1796290463; Received: from h68d07384.sqa.eu95.tbsite.net(mailfrom:jiangtianfeng@linux.alibaba.com fp:SMTPD_---0XGDuMnM_1796290463 cluster:ay36) by smtp.aliyun-inc.com; Thu, 03 Dec 2026 17:34:34 +0800 From: Jiangtian Feng 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 Message-ID: <20261203093420.3433195-1-jiangtianfeng@linux.alibaba.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261102165421.3651202-1-andre.przywara@arm.com> References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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