-
Notifications
You must be signed in to change notification settings - Fork 376
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
Reorg to factor mac entries setup and add a max entries test #2587
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! Yeah the hasMaps make sense, especially for fdinstall. In the singleKprobe part it looks a bit weird that we copy the info in this when it's available on the genericKprobe directly but overall with the multi_kprobe, it's better than this lonely fdinstall bool.
Thanks a lot for the test, I wanted to write something similar to check that those memory patch aren't broken! That's really cool :)
maybe we could document in this hasMap struct which are per kprobe and which are per sensor?
pkg/sensors/tracing/generickprobe.go
Outdated
@@ -272,14 +272,12 @@ func filterMaps(load *program.Program, pinPath string, kprobeEntry *genericKprob | |||
return maps | |||
} | |||
|
|||
func createMultiKprobeSensor(sensorPath, policyName string, multiIDs []idtable.EntryID, enableFDInstall bool) ([]*program.Program, []*program.Map, error) { | |||
func createMultiKprobeSensor(sensorPath, policyName string, multiIDs []idtable.EntryID, has *hasMaps) ([]*program.Program, []*program.Map, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe I would pass this by value for clarity that it's read only
pkg/sensors/tracing/generickprobe.go
Outdated
has.fdInstall = has.fdInstall || selectorsHaveFDInstall(kprobe.Selectors) | ||
if has.fdInstall { | ||
break | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could simplify it, we can always modify if this gets more complicated later
has.fdInstall = has.fdInstall || selectorsHaveFDInstall(kprobe.Selectors) | |
if has.fdInstall { | |
break | |
} | |
if selectorsHaveFDInstall(kprobe.Selectors) { | |
has.fdInstall = true | |
break | |
} |
or
has.fdInstall = has.fdInstall || selectorsHaveFDInstall(kprobe.Selectors) | |
if has.fdInstall { | |
break | |
} | |
if selectorsHaveFDInstall(kprobe.Selectors) { | |
return &hasMap{ | |
fdInstall: true, | |
} | |
} |
40e9d16
to
a7b3199
Compare
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! lgtm
Pass spec pointer directly to createGenericTracepointSensor, it will make following changes easier. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Centralizing maps 'has' config into hasMaps object, which gets initialized before we create the sensor and checked when we create sensor maps. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
a7b3199
to
20f86f7
Compare
We need enforcer map only when enforcer is configured, so making the map entries by default 1 and resizing it when it's needed. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
24920e3
to
e1b5c16
Compare
Adding max entries test for all maps that are resized based on configuration. Signed-off-by: Jiri Olsa <jolsa@kernel.org>
e1b5c16
to
6f50e69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep still like it!
centralizing map entries configuration and adding tests