GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — User-space part of a trace is not reported if Kernel symbols are unavailable · Issue #1044 · async-profiler/async-profiler

User-space part of a trace is not reported if Kernel symbols are unavailable #1044

New issue
Copy link
New issue
Copy link
Closed
Closed
User-space part of a trace is not reported if Kernel symbols are unavailable#1044
Copy link
Labels
bug

Description

@AntonIvanov87
AntonIvanov87
opened on Nov 1, 2024
Issue body actions

Describe the bug

Say there is a trace that leads into the kernel:

  ...
  [13] do_syscall_64_[k]
  [14] entry_SYSCALL_64_after_hwframe_[k]
  [15] send
  [16] io.netty.channel.unix.Socket.sendAddress

and consumes much CPU cycles.

If Kernel symbols are not available:

[WARN] Kernel symbols are unavailable due to restrictions. Try
  sysctl kernel.perf_event_paranoid=1
  sysctl kernel.kptr_restrict=0

such traces are not reported at all.

This creates an illusion that CPU is spend elsewhere.

Expected vs. actual behavior

Actual behaviour: such traces are ignored.

Expected behaviour: at least user-space part of such traces should be reported, e.g.:

  [0] send
  [1] io.netty.channel.unix.Socket.sendAddress

Or even:

  [0] Kernel symbols are unavailable
  [1] send
  [2] io.netty.channel.unix.Socket.sendAddress

Reproduction Steps

No response

Additional Information/Context

No response

Async-profiler version

3.0

Environment details

OS: CentOS 9, Linux 5.15.160
JDK: 11
CPU: x86_64

Activity

  1. AntonIvanov87
    added
    bug
    on Nov 1, 2024
  2. apangin
    added a commit that references this issue on Nov 4, 2024

    #1044: Fall back to ctimer for CPU profiling when perf_events are una…

    6c32ce9
  3. apangin commented on Nov 4, 2024

    @apangin
    apangin
    on Nov 4, 2024
    Collaborator
    More actions

    Previously, when /proc/sys/kernel/perf_event_paranoid settings allowed only user-space measurements (default since Linux 4.6), async-profiler automatically enabled alluser option, corresponding to perf_event_attr.exclude_kernel bit. It was a big oversight, because exclude_kernel option silently discarded all execution samples occurred in the kernel-space, leading to the issue you've described.

    If kernel-space measurements are not allowed by system configuration, it's better to switch to ctimer mode based on timer_create API. I've modified the logic of CPU profiling as follows:

    • perf_events availability is now automatically checked by trying to create a dummy perf_event.
    • If kernel-space profiling using perf_events is not available (including when restricted by perf_event_paranoid setting or by seccomp), async-profiler transparently falls back to ctimer mode.
    • If perf_events are available, but kernel symbols are hidden (e.g., by kptr_resitrct setting), async-profiler continues to use perf_events, emits a warning and does not show kernel stack traces.
    • To force using perf_events for user-space only profiling, specify -e cpu-clock --all-user instead of -e cpu.
    • allkernel option has been removed.
    • JFR recording now contains engine setting with the current profiling engine: perf_events, ctimer, wall, etc.
  4. apangin commented on Nov 4, 2024

    @apangin
    apangin
    on Nov 4, 2024
    Collaborator
    More actions

    The fix is already available in nightly builds.

    Reacted by Anton Ivanov
    Reacted by Anton Ivanov
    Reacted by Anton Ivanov
  5. AntonIvanov87 commented on Nov 5, 2024

    @AntonIvanov87
    AntonIvanov87
    on Nov 5, 2024
    Author
    More actions

    Thank you so much, @apangin, I've just verified it and it works great.

  6. AntonIvanov87
    closed this as completedon Nov 5, 2024
  7. apangin
    added a commit that references this issue on Nov 7, 2024

    #1044: Automatically switch on --all-user for non-CPU events if kerne…

    0cd9726
  8. apangin commented on Jul 8, 2025

    @apangin
    apangin
    on Jul 8, 2025
    Collaborator
    More actions

    @lisong2010 The issue your are commenting has been already closed, and your questions seems to be different. Could you please open a separate issue or start a new discussion, so it can be tracked separately? Thanks.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.