Revert "Revert "bpf: Fix possible race in inc_misses_counter""

This reverts commit bb592b6898.

It is no longer needed as we can modify the KABI at this point in time.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1467db884a714b1379d31d65e650efccbc17ac5c
This commit is contained in:
Greg Kroah-Hartman
2022-03-17 16:46:25 +01:00
committed by Todd Kjos
parent 57270a84df
commit 8aa6f1cde0

View File

@@ -541,11 +541,12 @@ static u64 notrace bpf_prog_start_time(void)
static void notrace inc_misses_counter(struct bpf_prog *prog)
{
struct bpf_prog_stats *stats;
unsigned int flags;
stats = this_cpu_ptr(prog->stats);
u64_stats_update_begin(&stats->syncp);
flags = u64_stats_update_begin_irqsave(&stats->syncp);
u64_stats_inc(&stats->misses);
u64_stats_update_end(&stats->syncp);
u64_stats_update_end_irqrestore(&stats->syncp, flags);
}
/* The logic is similar to bpf_prog_run(), but with an explicit