Re: [RFC PATCH 02/41] perf: Support guest enter/exit interfaces

From: Raghavendra Rao Ananta
Date: Wed Mar 20 2024 - 12:40:57 EST


Hi Kan,

>
> +static void __perf_force_exclude_guest_pmu(struct perf_event_pmu_context *pmu_ctx,
> + struct perf_event *event)
> +{
> + struct perf_event_context *ctx = pmu_ctx->ctx;
> + struct perf_event *sibling;
> + bool include_guest = false;
> +
> + event_sched_out(event, ctx);
> + if (!event->attr.exclude_guest)
> + include_guest = true;
> + for_each_sibling_event(sibling, event) {
> + event_sched_out(sibling, ctx);
> + if (!sibling->attr.exclude_guest)
> + include_guest = true;
> + }
> + if (include_guest) {
> + perf_event_set_state(event, PERF_EVENT_STATE_ERROR);
> + for_each_sibling_event(sibling, event)
> + perf_event_set_state(event, PERF_EVENT_STATE_ERROR);
> + }
Does the perf core revert the PERF_EVENT_STATE_ERROR state somewhere
from the perf_guest_exit() path, or is it expected to remain in this
state?
IIUC, in the perf_guest_exit() path, when we land into
merge_sched_in(), we never schedule the event back if event->state <=
PERF_EVENT_STATE_OFF.

Thank you.
Raghavendra