selftests/bpf: Fix zero batch_hash on CPU 0 after batch_gen wraparound#12141
Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Open
selftests/bpf: Fix zero batch_hash on CPU 0 after batch_gen wraparound#12141kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: 3db0419 |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
Author
|
Forwarding comment 4502605065 via email |
ec31e3e to
b3beebb
Compare
Author
|
Upstream branch: b1fcdf9 |
commit fa747e9 ("selftests/bpf: Fix cold_lru producing zero batch_hash in XDP LB benchmark") claims the addition ensures the multiplier input is "always >= 1". This invariant does not hold after wraparound. batch_gen is __u32. After 2^32 increments it wraps to 0. On CPU 0, bpf_get_smp_processor_id() returns 0: batch_gen = 0 (after u32 wraparound) batch_hash = (0 + 0) * KNUTH_HASH_MULT = 0 *saddr ^= 0 -> no-op, cold_lru miss counter stays 0 Setting bit 0 before multiplying guarantees a non-zero odd result for all possible values of batch_gen and cpu_id, including after wraparound: (any_value | 1) >= 1 always, since bit 0 is always set Fixes: fa747e9 ("selftests/bpf: Fix cold_lru producing zero batch_hash in XDP LB benchmark") Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
60c5931 to
f99559b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: selftests/bpf: Fix zero batch_hash on CPU 0 after batch_gen wraparound
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1098273