Skip to content

docs: Add daemon architecture documentation#331

Open
lool wants to merge 2 commits into
qualcomm:developmentfrom
lool:document-daemons
Open

docs: Add daemon architecture documentation#331
lool wants to merge 2 commits into
qualcomm:developmentfrom
lool:document-daemons

Conversation

@lool
Copy link
Copy Markdown
Contributor

@lool lool commented Apr 16, 2026

Document the role of FastRPC daemons (adsprpcd, cdsprpcd, etc.) and
clarify when they are needed. Explains that FastRPC works in two modes:

  • Basic mode (without daemons): All RPC calls work, but DSP exceptions
    are silent and DSP cannot access system services on APPS
  • Full-featured mode (with daemons): Adds exception logging, remote
    file I/O, and memory allocation services

Closes: #321

@lool
Copy link
Copy Markdown
Contributor Author

lool commented Apr 16, 2026

NB: This was generated by Claude Sonnet 4.5 and lightly edited.

Comment thread Docs/daemons.md Outdated
- DSP cannot call back to system services on APPS (no reverse RPC for system services)
- DSP cannot request additional memory from APPS heap (audio PD limitation)
- DSP cannot access files on the APPS filesystem
- FARF log messages from DSP code are lost
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last 4 points are specific to root PD and static PD(audio, sensors) of DSP.

Any dynamic pd will still be able to do all these things using the corresponding APPS process.

Comment thread Docs/daemons.md Outdated

## Overview

FastRPC daemons (`adsprpcd`, `cdsprpcd`, `sdsprpcd`, `gdsprpcd`) are optional system services that enhance FastRPC functionality. Each daemon corresponds to a specific DSP type (ADSP, CDSP, SDSP, GDSP) available on the SoC.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Daemons run on the CPU side (HLOS) and act as the “default listener” for the DSP static PDs(root PD, audio PD, sensors PD), handling reverse-RPC requests that require file-system, memory requests or privileged services the DSP cannot perform itself.

Comment thread Docs/daemons.md Outdated
- `adspmsgd` - DSP message logging interface
- `apps_std` - File I/O operations (fopen, fread, fwrite, etc.)
- `apps_mem` - Dynamic memory allocation from APPS
3. **Forwards DSP logs**: Receives FARF messages from DSP and writes them to syslog/dmesg
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all above points are mostly in context of root or static PDs.

Comment thread Docs/daemons.md
Comment thread Docs/daemons.md Outdated

### rootpd (Default)
- **Usage**: `cdsprpcd` or `cdsprpcd rootpd cdsp`
- **Provides**:
Copy link
Copy Markdown
Contributor

@ekanshibu ekanshibu Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying few details from my doc for PD specific daemons:

Root PD (Guest OS) - adsprpcd, cdsprpcd

  • Purpose:

    • Attaches to the DSP Root PD (Guest OS) and acts as the default listener for reverse-RPC.
    • Provides file operations and dynamic-loading support used by components that run in Root PD (e.g., preload features, shell not accessible by user process).
    • Helps create/maintain Root PD process context; from a user standpoint, you don’t call it directly, FastRPC does.
  • If adsprpcd isn’t running:

    • Root PD features that rely on file I/O or dynamic loading from HLOS can fail (preloads may not work, RootPD-side reverse-RPC requests will time out).
    • Audio PD dynamic loading may still work if audio-adsprpcd is up, but any RootPD-driven fastRPC services would be impacted.

Audio PD - adsprpcd with audiopd argument

  • Purpose:

    • Attaches to the Audio static PD and serves reverse-RPC for audio PD.
    • Performs dynamic loading of audio shared objects (.so) and reads calibration/config files (e.g., ACDB) on behalf of audio PD.
    • Handles remote heap growth / CMA donation flows needed by audio (kernel fastRPC driver may do qcom_scm_assign on buffers; the daemon coordinates the user-space side).
  • If audioadsprpcd isn’t running:

    • Audio dynamic module loading fails (dlopen/dlsym won’t resolve).
    • Calibration/config file accesses fail, and audio features/algorithms that depend on dynamically loaded code won’t start.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for sharing all of these remarks! I've integrated them in an updated version

@lool lool force-pushed the document-daemons branch from 18e7d25 to 7067b97 Compare April 16, 2026 10:47
@lool
Copy link
Copy Markdown
Contributor Author

lool commented Apr 16, 2026

Seeing that this is receiving some nice review, I'm going to ambitiously mark this as Ready for review and remove the Draft flag :)

@lool lool marked this pull request as ready for review April 16, 2026 10:48
@lool lool force-pushed the document-daemons branch from 7067b97 to cc5c0fd Compare April 16, 2026 10:59
@lool
Copy link
Copy Markdown
Contributor Author

lool commented Apr 16, 2026

I've fixed/clarified the number of sessions being 4 and being per process, as this was a key concern with the daemon presence.

Comment thread Docs/daemons.md
- **1 FastRPC session slot** - Each daemon holds one persistent session
open to the DSP. The user-space library enforces a per-process limit
(`NUM_SESSIONS`, default 4 in `inc/fastrpc_common.h`). Since the
daemon runs as a separate process, it uses 1 of its own 4-session
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Srinivas-Kandagatla . I was under the impression that daemon would also consume some 'global' resources/sessions, which does not seem to be the case reading this paragraph.

@lool
Copy link
Copy Markdown
Contributor Author

lool commented May 14, 2026

I've fixed/clarified the number of sessions being 4 and being per process, as this was a key concern with the daemon presence.

Hi all, is this ready for merging?

Comment thread Docs/daemons.md
sensors PD). Note that dynamic PDs can still perform these operations
using their corresponding APPS (Application Processor Subsystem) process.

- DSP static PD exceptions and crashes are silent - no error messages
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a dynamic user PD running on the DSP crashes, its exception handler sends all crash-related information to the root PD on the DSP before termination. The root PD then forwards this information to the root PD daemon, which logs it in the system log (syslog).

Logging user PD exception details to syslog is supported only for dynamic user PDs by the corresponding root daemon for the DSP (for example, adsprpcd for aDSP and cdsprpcd for CDSP). This feature is not available for static PDs.
By default, a crash in a static PD results in a DSP crash. On systems that support PDR for static PDs, the static PD is restarted instead.

Comment thread Docs/daemons.md Outdated

**What works with daemons enabled:**
- All basic FastRPC operations (same as without daemon)
- Static PD exception messages forwarded to system logs - critical for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exception logging is only supported for dynamic PDs by root PD daemons

Comment thread Docs/daemons.md Outdated
- **CPU usage**: Event-driven, blocks waiting for DSP callbacks. Negligible CPU consumption except when processing DSP exceptions or log messages.

**When to run:**
- **Development/debugging**: Always recommended - static PD errors otherwise disappear silently
Copy link
Copy Markdown
Contributor

@Chennak-quic Chennak-quic May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dynamic PD exception log disappears if root PD daemon is not run for that DSP.

Comment thread Docs/daemons.md Outdated

**When to run:**
- **Development/debugging**: Always recommended - static PD errors otherwise disappear silently
- **Production**: Recommended if static PD exception visibility is needed
Copy link
Copy Markdown
Contributor

@Chennak-quic Chennak-quic May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended to run root PD daemon if dynamic PD exception visibility is needed

Comment thread Docs/daemons.md Outdated
- **Development/debugging**: Always recommended - static PD errors otherwise disappear silently
- **Production**: Recommended if static PD exception visibility is needed
- **Resource-constrained**: Can safely omit if not using that DSP and logs aren't critical
- **Note**: Omitting the daemon doesn't break application functionality, only static PD observability
Copy link
Copy Markdown
Contributor

@Chennak-quic Chennak-quic May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rephrase to "Omitting the root PD daemon does not break application functionality, only dynamic PD exception visibility".
Static PD daemons are still needed if dynamic loading/file operations support is required.

Comment thread Docs/daemons.md Outdated
- Attaches to the DSP Root PD (Guest OS - typically QuRT, the Qualcomm
Real-Time OS running on the DSP) and acts as the default listener for
reverse-RPC
- Provides file operations and dynamic-loading support used by components that
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dlopen() is not supported on the root PD on the DSP due to security constraints; only file operations are permitted for components running in the root PD. Most of these use cases are internal to the FastRPC framework. please remove "dynamic loading support"

The primary client-facing use case from the root PD daemon is routing dynamic PD exception logs to syslog. Other use cases involve internal functionalities required by the FastRPC framework operating within the root PD on the DSP.

Comment thread Docs/daemons.md Outdated
- **Services provided**:
- Exception logging via `adspmsgd` framework (see [adspmsgd.md](adspmsgd.md))
- Remote file system access via `apps_std` interface
- Dynamic loading support (dlopen/dlsym/dlclose)
Copy link
Copy Markdown
Contributor

@Chennak-quic Chennak-quic May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dynamic loading (dlopen) is not supported on root PD running on the DSP. this point can be removed.
Dynamic loading (dlopen) is supported only on user PDs (static PD/dynamic PD).

lool added 2 commits May 19, 2026 22:47
Document the role of FastRPC daemons (adsprpcd, cdsprpcd, etc.) and
clarify when they are needed. Explains that FastRPC works in two modes:

- Basic mode (without daemons): All RPC calls work, but static PD
  exceptions are silent and static PDs cannot access system services on
  APPS (dynamic PDs are unaffected)
- Full-featured mode (with daemons): Adds exception logging, reverse RPC
  for file I/O and memory allocation, lifecycle management (SSR/PDR)

Clarifies the distinction between static PDs (root PD, audio PD, sensors
PD) which need daemons for system services, and dynamic PDs which
communicate directly with their APPS process.

Includes resource usage details with references to specific constants in
the source code (ADSP_LISTENER_MEM_CACHE_SIZE, DEFAULT_MEMORY_SIZE), and
defines technical terms (PDs, HLOS/Linux, APPS, FARF, QuRT, ACDB).

Closes: qualcomm#321

Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
Add Container Considerations section documenting filesystem
namespace implications for static vs dynamic PD workloads in
containerized environments. Most ML/compute workloads (dynamic PDs)
work fine; audio workloads (static PDs) need host filesystem
coordination.

Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>
@lool lool force-pushed the document-daemons branch from e637a61 to 6028a9d Compare May 19, 2026 20:47
@lool
Copy link
Copy Markdown
Contributor Author

lool commented May 19, 2026

@Chennak-quic thanks for the thorough review! I've pushed incremental fixup commits to address your feedback, pushed, then squashed them back to two commits and pushed again; hopefully this will make my latest changes easy for you to review. Would you mind taking another look?

@lool
Copy link
Copy Markdown
Contributor Author

lool commented May 19, 2026

@Chennak-quic thanks for the thorough review! I've pushed incremental fixup commits to address your feedback, pushed, then squashed them back to two commits and pushed again; hopefully this will make my latest changes easy for you to review. Would you mind taking another look?

Hmm somehow github is hiding the intermediate push, but you can see the commits here:
https://github.com/lool/fastrpc/commits/document-daemons-fixup/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing documentation on the need for fastrpc daemons

4 participants