Skip to contentSkip to conversation

cpufreq info propagation

DISCUSSION Jan Beulich 2 participants 4 messages Jul 23, 2008 – Jul 24, 2008

lore
Share & tools
lore
#0 lore raw

Now that I finally got around to update our sources, I had a closer look at those changes, and apart from stylistic issues on the Linux side (part of which I may have asked for, but the result was somewhat overdone so the code is hardly legible now - I've got a patch queued to streamline this a little) I find it rather odd (fragile) that the who-is-in-charge information gets propagated via a command line option rather than through the startup info. I think this should be adjusted before 3.3 gets frozen.

Besides that I continue to wonder what significance the support for Dom0-controlled cpufreq handling has now that Xen has the ability to handle that. I ask this not the least because so far we disabled the CPU_FREQ config option in our kernels, partly because of the unknown status of all of the different low level drivers (powernow-k8 supposedly works, acpi-cpufreq apparently might work, too, but most others I'm pretty unclear about), but also because of the massive (and afaict not upstream) changes to powernow-k8 (which we simply don't apply at present) as well as due to the extra constraints that are required/ enforced when Dom0 is in charge.

In any case there is an open question for me as to how current status is being reported to the user (at least in Dom0) on the current CPU frequency in use when CPU_FREQ is configured off (and I have to admit that while I didn't try it, I suspect it doesn't even work when CPU_FREQ is on - this is because the apparently only reporting function, processor_extcntl_get_performance(), is being called exclusively in the context of acpi_processor_start()). With that I wonder how I would be able to determine whether the code works at all.

As a minor observation, I also find the naming vs. meaning of the FREQCTL_none enumerator misleading - shouldn't this rather be FREQCTL_xen?

Jan

#1 lore raw
Quoted 10 lines

From: Jan Beulich
Sent: 2008年7月23日 16:21

Now that I finally got around to update our sources, I had a closer look at
those changes, and apart from stylistic issues on the Linux side (part of
which I may have asked for, but the result was somewhat overdone so the code is hardly legible now - I've got a patch queued to streamline this

thank you.

Quoted 4 lines

a little) I find it rather odd (fragile) that the who-is-in-charge information
gets propagated via a command line option rather than through the startup info. I think this should be adjusted before 3.3 gets frozen.

startup info is viable. But how fragile is the cmdline option?

Quoted 12 lines

Besides that I continue to wonder what significance the support for Dom0-controlled cpufreq handling has now that Xen has the ability to handle that. I ask this not the least because so far we disabled the CPU_FREQ config option in our kernels, partly because of the unknown status of all of the different low level drivers (powernow-k8 supposedly
works, acpi-cpufreq apparently might work, too, but most others I'm pretty unclear about), but also because of the massive (and afaict not upstream) changes to powernow-k8 (which we simply don't apply at present) as well as due to the extra constraints that are required/ enforced when Dom0 is in charge.

If no existing usage already with dom0-controlled cpufreq, I agree that support is not necessary. The aim in original design when adding Xen cpufreq control, is to not break compatibility if any usage or release sticks to that style already.

Quoted 4 lines

In any case there is an open question for me as to how current status is being reported to the user (at least in Dom0) on the current CPU frequency in use when CPU_FREQ is configured off (and I have to

If CPU_FREQ is off, error is returned when user tries to query cpufreq information from Xen.

Quoted 6 lines

admit that while I didn't try it, I suspect it doesn't even work when CPU_FREQ is on - this is because the apparently only reporting function, processor_extcntl_get_performance(), is being called exclusively in the context of acpi_processor_start()). With that I wonder how I would be able to determine whether the code works at all.

Not sure about your concern. Currently xen-controlled cpufreq isn't enabled by default. User needs pass xen cmdline and also enable dom0 CPU_FREQ. Once that's done, everything should work. The interface you cited is not the one to report freq statistics to user, which instead is the point to parse ACPI Px information which will be further hypercalled to Xen later when extcnl controller is notified. Statistics information is conveyed by sysctl interface by far.

Quoted 5 lines

As a minor observation, I also find the naming vs. meaning of the FREQCTL_none enumerator misleading - shouldn't this rather be FREQCTL_xen?

If user wants to disable cpufreq at all, a FREQCTL_none option is required.

Thanks,
Kevin

#2 lore raw
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

"Tian, Kevin" <[email protected]> 23.07.08 10:57 >>>

a little) I find it rather odd (fragile) that the who-is-in-charge information
gets propagated via a command line option rather than through the startup info. I think this should be adjusted before 3.3 gets frozen.

startup info is viable. But how fragile is the cmdline option?

If the user passes an option like this manually, depending on the particular kernel version's logic of parsing options, this may result in conflicts and hence misbehavior. Using the startup info avoids such collisions. Likewise, this method doesn't scale, since the command line cannot grow arbitrarily large.

Quoted 6 lines
Quoted 3 lines

In any case there is an open question for me as to how current status is being reported to the user (at least in Dom0) on the current CPU frequency in use when CPU_FREQ is configured off (and I have to

If CPU_FREQ is off, error is returned when user tries to query cpufreq information from Xen.

You mean when (in Xen) control is set to FREQCTL_dom0_kernel. But my question was how this works when CPU_FREQ is configured off in the kernel, but Xen is (told to [? - see below]) control(ling) cpufreq.

Quoted 10 lines
Quoted 6 lines

admit that while I didn't try it, I suspect it doesn't even work when CPU_FREQ is on - this is because the apparently only reporting function, processor_extcntl_get_performance(), is being called exclusively in the context of acpi_processor_start()). With that I wonder how I would be able to determine whether the code works at all.

Not sure about your concern. Currently xen-controlled cpufreq isn't enabled by default. User needs pass xen cmdline and also enable dom0 CPU_FREQ. Once that's done, everything should work.

At least as enabling in Xen is concerned, I can't see this is the case: the respective initializer functions are being called out of the XENPF_set_processor_pminfo handler unconditonally. I.e. I'm missing where this logic would be suppressed (kind of a

        ret = -ENOSYS;
        if ( cpufreq_controller != FREQCTL_xen )
            break;

missing at the top of the XEN_PM_PX sub-case).

Further, tying the functionality to CPU_FREQ being enabled in Dom0 seems odd to me, too: Who is controlling what then? I thought it's solely in the hypervisor's hands, and in that case involving the whole cpufreq machinery (including the governors) in the kernel appears pointless.

Additionally, there's nothing being done to prevent the collision with other low-level drivers. acpi-cpufreq and powernow-k8 have got an early-out clause into their startup inserted, but all other drivers have been left alone. And with Xen being the preferred cpufreq controller, in my opinion there ought to be an option to enable that in the kernel which would automatically suppress all low-level drivers.

Quoted 6 lines
Quoted 3 lines

As a minor observation, I also find the naming vs. meaning of the FREQCTL_none enumerator misleading - shouldn't this rather be FREQCTL_xen?

If user wants to disable cpufreq at all, a FREQCTL_none option is required.

Right, but I can't see where it's used (i.e. where a distinction is made between no and Xen-based cpufreq handling).

Jan

#3 lore raw
Quoted 11 lines

From: Jan Beulich
Sent: 2008年7月23日 18:13

Quoted 2 lines

startup info is viable. But how fragile is the cmdline option?

If the user passes an option like this manually, depending on the particular kernel version's logic of parsing options, this may result in
conflicts and hence misbehavior. Using the startup info avoids such collisions. Likewise, this method doesn't scale, since the command line cannot grow arbitrarily large.

Agree then. We'll send out a fix.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

In any case there is an open question for me as to how current status is being reported to the user (at least in Dom0) on the current CPU frequency in use when CPU_FREQ is configured off (and I have to

Quoted 7 lines
Quoted 2 lines

If CPU_FREQ is off, error is returned when user tries to query cpufreq information from Xen.

You mean when (in Xen) control is set to FREQCTL_dom0_kernel. But my question was how this works when CPU_FREQ is configured off in the kernel, but Xen is (told to [? - see below]) control(ling) cpufreq.

My answer was to xen controlled cpufreq. As I said below, xen cmd line option and dom0 CONFIG_CPU_FREQ are two conditions to enable xen controlled cpufreq. When FREQCTL_xen is set, cpufreq driver/governor within xen is enabled, which however doesn't start working until someone (dom0) notifies xen about processor freq info. When dom0 CPU_FREQ is enabled, extcnl logic then attempts to parse ACPI px info and then notify Xen by hypercall. After that, Xen cpufreq begins working.

I think we may enable CPU_FREQ in dom0's config by default, to eliminate such disconnected logic.

Quoted 18 lines
Quoted 11 lines
Quoted 7 lines

admit that while I didn't try it, I suspect it doesn't even work when CPU_FREQ is on - this is because the apparently only reporting function, processor_extcntl_get_performance(), is being called exclusively in the context of acpi_processor_start()). With that I wonder how I would be able to determine whether the code works at all.

Not sure about your concern. Currently xen-controlled cpufreq isn't enabled by default. User needs pass xen cmdline and also enable dom0 CPU_FREQ. Once that's done, everything should work.

At least as enabling in Xen is concerned, I can't see this is the case: the
respective initializer functions are being called out of the XENPF_set_processor_pminfo handler unconditonally. I.e. I'm missing where this logic would be suppressed (kind of a

Quoted 5 lines
       ret = -ENOSYS;
       if ( cpufreq_controller != FREQCTL_xen )
           break;

missing at the top of the XEN_PM_PX sub-case).

You're right. This is a bug to gracefully handle such corner case.

Quoted 6 lines

Further, tying the functionality to CPU_FREQ being enabled in Dom0 seems odd to me, too: Who is controlling what then? I thought it's solely
in the hypervisor's hands, and in that case involving the whole cpufreq machinery (including the governors) in the kernel appears pointless.

Processor freq info is contained in ACPI Px methods in AML style, and thus there's no way for Xen to retrieve them without dom0's help. However existing ACPI parse logic is only compiled when CPU_FREQ is configured. It'd be mess to copy those code out of CPU_FREQ.

Also enable CPU_FREQ in dom0 doesn't mean the control goes to dom0. Dom0 only tempts to control when cpufreq driver is loaded, and by far the driver is hacked from loading when extcnl is requesting. This is a bit hacky, and the cleaner way should move such check to generic cpufreq layer since there're so many drivers.

Note that similar story will be repeated in the future, if any feature is tightly coupled with ACPI, e.g. RAS.

Quoted 8 lines

Additionally, there's nothing being done to prevent the collision with other low-level drivers. acpi-cpufreq and powernow-k8 have got an early-out clause into their startup inserted, but all other drivers have
been left alone. And with Xen being the preferred cpufreq controller, in my opinion there ought to be an option to enable that in the kernel which would automatically suppress all low-level drivers.

Yes, we need handle it better. A patch will be made before 3.3.

As a summary, (if I have answered your concerns), both xen-controlled and dom0-controlled options are working in normal case, with some corner case conflicting not handled cleanly. They both require CPU_FREQ being enabled to work.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

As a minor observation, I also find the naming vs. meaning of the FREQCTL_none enumerator misleading - shouldn't this rather be FREQCTL_xen?

Quoted 7 lines
Quoted 2 lines

If user wants to disable cpufreq at all, a FREQCTL_none option is required.

Right, but I can't see where it's used (i.e. where a distinction is made
between no and Xen-based cpufreq handling).

Sorry that I didn't read code carefully, as I thought there should be a FREQCTL_xen already. It's a silly one, and should be fixed.

Thanks
Kevin