perf kvm: Pass argument 'sample' to kvm_alloc_init_event()
This patch adds an argument 'sample' for kvm_alloc_init_event(), and its caller functions are updated as well for passing down the 'sample' pointer. This is a preparation change to allow later patch to create histograms entries for kvm event, no any functionality changes. Reviewed-by: James Clark <james.clark@arm.com> Signed-off-by: Leo Yan <leo.yan@linaro.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2d08124b08
commit
730651f717
|
@ -262,7 +262,8 @@ static bool kvm_event_expand(struct kvm_event *event, int vcpu_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kvm_event *kvm_alloc_init_event(struct perf_kvm_stat *kvm,
|
static struct kvm_event *kvm_alloc_init_event(struct perf_kvm_stat *kvm,
|
||||||
struct event_key *key)
|
struct event_key *key,
|
||||||
|
struct perf_sample *sample __maybe_unused)
|
||||||
{
|
{
|
||||||
struct kvm_event *event;
|
struct kvm_event *event;
|
||||||
|
|
||||||
|
@ -279,7 +280,8 @@ static struct kvm_event *kvm_alloc_init_event(struct perf_kvm_stat *kvm,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm,
|
static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm,
|
||||||
struct event_key *key)
|
struct event_key *key,
|
||||||
|
struct perf_sample *sample)
|
||||||
{
|
{
|
||||||
struct kvm_event *event;
|
struct kvm_event *event;
|
||||||
struct list_head *head;
|
struct list_head *head;
|
||||||
|
@ -292,7 +294,7 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm,
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
event = kvm_alloc_init_event(kvm, key);
|
event = kvm_alloc_init_event(kvm, key, sample);
|
||||||
if (!event)
|
if (!event)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -302,15 +304,16 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm,
|
||||||
|
|
||||||
static bool handle_begin_event(struct perf_kvm_stat *kvm,
|
static bool handle_begin_event(struct perf_kvm_stat *kvm,
|
||||||
struct vcpu_event_record *vcpu_record,
|
struct vcpu_event_record *vcpu_record,
|
||||||
struct event_key *key, u64 timestamp)
|
struct event_key *key,
|
||||||
|
struct perf_sample *sample)
|
||||||
{
|
{
|
||||||
struct kvm_event *event = NULL;
|
struct kvm_event *event = NULL;
|
||||||
|
|
||||||
if (key->key != INVALID_KEY)
|
if (key->key != INVALID_KEY)
|
||||||
event = find_create_kvm_event(kvm, key);
|
event = find_create_kvm_event(kvm, key, sample);
|
||||||
|
|
||||||
vcpu_record->last_event = event;
|
vcpu_record->last_event = event;
|
||||||
vcpu_record->start_time = timestamp;
|
vcpu_record->start_time = sample->time;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,12 +380,12 @@ static bool is_child_event(struct perf_kvm_stat *kvm,
|
||||||
static bool handle_child_event(struct perf_kvm_stat *kvm,
|
static bool handle_child_event(struct perf_kvm_stat *kvm,
|
||||||
struct vcpu_event_record *vcpu_record,
|
struct vcpu_event_record *vcpu_record,
|
||||||
struct event_key *key,
|
struct event_key *key,
|
||||||
struct perf_sample *sample __maybe_unused)
|
struct perf_sample *sample)
|
||||||
{
|
{
|
||||||
struct kvm_event *event = NULL;
|
struct kvm_event *event = NULL;
|
||||||
|
|
||||||
if (key->key != INVALID_KEY)
|
if (key->key != INVALID_KEY)
|
||||||
event = find_create_kvm_event(kvm, key);
|
event = find_create_kvm_event(kvm, key, sample);
|
||||||
|
|
||||||
vcpu_record->last_event = event;
|
vcpu_record->last_event = event;
|
||||||
|
|
||||||
|
@ -431,7 +434,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!event)
|
if (!event)
|
||||||
event = find_create_kvm_event(kvm, key);
|
event = find_create_kvm_event(kvm, key, sample);
|
||||||
|
|
||||||
if (!event)
|
if (!event)
|
||||||
return false;
|
return false;
|
||||||
|
@ -502,7 +505,7 @@ static bool handle_kvm_event(struct perf_kvm_stat *kvm,
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (kvm->events_ops->is_begin_event(evsel, sample, &key))
|
if (kvm->events_ops->is_begin_event(evsel, sample, &key))
|
||||||
return handle_begin_event(kvm, vcpu_record, &key, sample->time);
|
return handle_begin_event(kvm, vcpu_record, &key, sample);
|
||||||
|
|
||||||
if (is_child_event(kvm, evsel, sample, &key))
|
if (is_child_event(kvm, evsel, sample, &key))
|
||||||
return handle_child_event(kvm, vcpu_record, &key, sample);
|
return handle_child_event(kvm, vcpu_record, &key, sample);
|
||||||
|
|
Loading…
Reference in New Issue