Skip to contentSkip to conversation

xenstat_vcpu_ns returns invalid value

Xen-devel Richard Kojedzinszky 2 participants 5 messages Jan 9, 2020

lore
Share & tools
lore
#0 lore raw

Dear Xen Devs,

commit 2529c850ea48f036727ca2f148caed89391311b8 introduces the XEN_RUNSTATE_UPDATE marker bit, which is not handled in vcpu_runstate_get() in xen/common/schedule.c. Relevant code:

    delta = NOW() - runstate->state_entry_time;
    if ( delta > 0 )
        runstate->time[runstate->state] += delta;

If state_entry_time has the bit set, it will be a negative value, so delta will be greater than 0, actually the marker bit
will appear in runstate->time too. This causes the MSB bit set in the return of xenstat_vcpu_ns(). Is it true, that when reading these values through xenstat, the user should take care of this bit, and reread, or is it a bug in the relevant code?

I am using xenstat.h interface, where I can only request statistics for the whole node. So, basically, walking through all vcpu of all domain, and checking that no one contains this bit seems a bit ugly solution.

Thanks in advance,
Richard Kojedzinszky

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 9 lines · Richard Kojedzinszky

Dear Xen Devs,

commit 2529c850ea48f036727ca2f148caed89391311b8 introduces the XEN_RUNSTATE_UPDATE marker bit, which is not handled in vcpu_runstate_get() in xen/common/schedule.c. Relevant code:

    delta = NOW() - runstate->state_entry_time;
    if ( delta > 0 )
        runstate->time[runstate->state] += delta;

That was found and fixed a while ago.  c/s f28c4c4c10 "sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()".

No changes in userspace should be necessary, although you might need to pester your distro for backports.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

2020-01-09 20:50 időpontban Andrew Cooper ezt írta:

Quoted 11 lines · Richard Kojedzinszky
Quoted 9 lines

Dear Xen Devs,

commit 2529c850ea48f036727ca2f148caed89391311b8 introduces the XEN_RUNSTATE_UPDATE marker bit, which is not handled in vcpu_runstate_get() in xen/common/schedule.c. Relevant code:

    delta = NOW() - runstate->state_entry_time;
    if ( delta > 0 )
        runstate->time[runstate->state] += delta;

Quoted 7 lines

That was found and fixed a while ago.  c/s f28c4c4c10 "sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()".

No changes in userspace should be necessary, although you might need to pester your distro for backports.

~Andrew

Hi,

Thanks for the quick reply,

Then, as it is just a leak, until a backport arrives to my distro, I can mask out that bit from the results with no other side-effects, am I right?

Regards,
Richard Kojedzinszky

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 20 lines · Richard Kojedzinszky

2020-01-09 20:50 időpontban Andrew Cooper ezt írta:

Quoted 11 lines · Richard Kojedzinszky
Quoted 9 lines

Dear Xen Devs,

commit 2529c850ea48f036727ca2f148caed89391311b8 introduces the XEN_RUNSTATE_UPDATE marker bit, which is not handled in vcpu_runstate_get() in xen/common/schedule.c. Relevant code:

    delta = NOW() - runstate->state_entry_time;
    if ( delta > 0 )
        runstate->time[runstate->state] += delta;

Quoted 7 lines

That was found and fixed a while ago.  c/s f28c4c4c10 "sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()".

No changes in userspace should be necessary, although you might need to pester your distro for backports.

~Andrew

Quoted 7 lines

Hi,

Thanks for the quick reply,

Then, as it is just a leak, until a backport arrives to my distro, I can mask out that bit from the results with no other side-effects, am I right?

Yes - that should be safe.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

2020-01-09 21:10 időpontban Andrew Cooper ezt írta:

Quoted 25 lines · Richard Kojedzinszky
Quoted 24 lines

2020-01-09 20:50 időpontban Andrew Cooper ezt írta:

Quoted 11 lines · Richard Kojedzinszky
Quoted 9 lines

Dear Xen Devs,

commit 2529c850ea48f036727ca2f148caed89391311b8 introduces the XEN_RUNSTATE_UPDATE marker bit, which is not handled in vcpu_runstate_get() in xen/common/schedule.c. Relevant code:

    delta = NOW() - runstate->state_entry_time;
    if ( delta > 0 )
        runstate->time[runstate->state] += delta;

Quoted 7 lines

That was found and fixed a while ago.  c/s f28c4c4c10 "sched: don't let XEN_RUNSTATE_UPDATE leak into vcpu_runstate_get()".

No changes in userspace should be necessary, although you might need to pester your distro for backports.

~Andrew

Hi,

Thanks for the quick reply,

Quoted 7 lines
Quoted 3 lines

Then, as it is just a leak, until a backport arrives to my distro, I can mask out that bit from the results with no other side-effects, am I right?

Yes - that should be safe.

~Andrew

Hi,

Many thanks, I will do that.

Regards,
Richard

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel