Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: parallelize symbolize #4787

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

all: parallelize symbolize #4787

wants to merge 3 commits into from

Conversation

jiangenj
Copy link
Contributor

@jiangenj jiangenj commented May 9, 2024

  1. symbolize takes much time especially if there are hundreds of modules and many pcs.
  2. concurrent writing to slice without protection will result in race condition, see https://blog.sgkandale.com/appending-slice-from-multiple-goroutines-86bc1c821e9e.

The PR is to fix these two issues:

  1. by symbolize each module in different goroutine.
  2. protect concurrent writing to slice using channel.

Before sending a pull request, please review Contribution Guidelines:
https://github.com/google/syzkaller/blob/master/docs/contributing.md


Copy link
Collaborator

@dvyukov dvyukov left a comment

Choose a reason for hiding this comment

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

What exactly is the issue?
This type is not supposed to be used concurrently, perhaps there is a bug in the caller.
It's used in the symbolizer, which is not thread-safe either.

@jiangenj
Copy link
Contributor Author

jiangenj commented May 9, 2024 via email

@dvyukov
Copy link
Collaborator

dvyukov commented May 9, 2024

Please show the other changes where this is needed. Otherwise it's impossible to understand if this is the right approach or not.
There should be some synchronization in the symbolizer, possibly the interner should be protected by the same synchronization.
Symbolizer is also not used concurrently by manager now, so I would like to understand what you want to do with manager to use symbolizer concurrently.
Frequently using synchronization in the lowest-level primitives is the wrong approach.

@jiangenj jiangenj changed the title pkg/symbolizzer: use thread safe sync.Map to avoid concurrency issue all: parallelize symbolize May 13, 2024
Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 4.22535% with 68 lines in your changes are missing coverage. Please review.

Project coverage is 61.1%. Comparing base (9026e14) to head (bb831fb).

Additional details and impacted files
Files Coverage Δ
pkg/symbolizer/cache.go 100.0% <100.0%> (ø)
pkg/cover/backend/dwarf.go 11.3% <0.0%> (-0.8%) ⬇️

... and 1 file with indirect coverage changes

@jiangenj
Copy link
Contributor Author

Please show the other changes where this is needed. Otherwise it's impossible to understand if this is the right approach or not. There should be some synchronization in the symbolizer, possibly the interner should be protected by the same synchronization. Symbolizer is also not used concurrently by manager now, so I would like to understand what you want to do with manager to use symbolizer concurrently. Frequently using synchronization in the lowest-level primitives is the wrong approach.

updated the PR, please check again.

@jiangenj
Copy link
Contributor Author

@dvyukov Can you review this?

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.

None yet

2 participants