* Overall picture of cpufreq.. @ 2008-01-11 22:15 Saru Addep 2008-01-11 22:50 ` Leisner, Martin 2008-01-13 22:54 ` Thomas Renninger 0 siblings, 2 replies; 11+ messages in thread From: Saru Addep @ 2008-01-11 22:15 UTC (permalink / raw) To: cpufreq Hi All, 1) The kernel part of cpufreq seems quite understandable, but I am not able to get a complete picture of how an application/process in userspace can use/change a governor, with an interface to kernel ( not from command line), may be like an ioctl. Basically how can a userspace process change a governor at runtime. 2) What is the purpose of userspace governor. Thanks Saringni. ^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: Overall picture of cpufreq.. 2008-01-11 22:15 Overall picture of cpufreq Saru Addep @ 2008-01-11 22:50 ` Leisner, Martin 2008-01-13 22:54 ` Thomas Renninger 1 sibling, 0 replies; 11+ messages in thread From: Leisner, Martin @ 2008-01-11 22:50 UTC (permalink / raw) To: Saru Addep, cpufreq > -----Original Message----- > From: cpufreq-bounces@lists.linux.org.uk [mailto:cpufreq- > bounces@lists.linux.org.uk] On Behalf Of Saru Addep > Sent: Friday, January 11, 2008 5:15 PM > To: cpufreq@lists.linux.org.uk > Subject: Overall picture of cpufreq.. > > Hi All, > > 1) The kernel part of cpufreq seems quite understandable, but I am not > able > to get a complete picture of how an application/process in userspace can > use/change a governor, with an interface to kernel ( not from command > line), > may be like an ioctl. Basically how can a userspace process change a > governor at runtime. > You can either do system("echo ondemand >/sys/devices/system/cpu/cpu0/scaling_governor") or do fp = fopen("/sys/devices/system/cpu/cpu0/scaling_governor", "w"); if(!fp) error fprintf(fp, "ondemand"); fclose(fp); Very simple and (IMHO) elegant. Much better than obscure ioctls. marty ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-11 22:15 Overall picture of cpufreq Saru Addep 2008-01-11 22:50 ` Leisner, Martin @ 2008-01-13 22:54 ` Thomas Renninger 2008-01-14 2:12 ` Saru Addep 1 sibling, 1 reply; 11+ messages in thread From: Thomas Renninger @ 2008-01-13 22:54 UTC (permalink / raw) To: Saru Addep; +Cc: cpufreq On Fri, 2008-01-11 at 14:15 -0800, Saru Addep wrote: > Hi All, ... > 2) What is the purpose of userspace governor. You can set the frequency from userspace: /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed (or similar) pops up when you switch to userspace governor. The first dynamic cpufreq approaches were done in userspace. You have a daemon checking every some 100 ms for the CPU load (/proc/stats) and then decide whether to increase or decrease the freq. The ondemand governor is doing that in kernel, but has the sideeffect of not supporting HW (IIRC speedstep-lib, possibly longhaul, powernow-k7 (not sure) and other older ones) that takes too long for switching frequencies. Then you would still need the userspace governor for switching. Thomas ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-13 22:54 ` Thomas Renninger @ 2008-01-14 2:12 ` Saru Addep 2008-01-14 7:08 ` Tomasz Chmielewski 0 siblings, 1 reply; 11+ messages in thread From: Saru Addep @ 2008-01-14 2:12 UTC (permalink / raw) To: trenn; +Cc: cpufreq Hi Thomas, So that means if we have an ondemand governor properly instrumented, there is no need to have userspace governor. In the case of ondemand governor, the only work that will be left to userspace would be to set the min, and max freq. The complete intelligence of DVFS algoritm is present inside the ondemand governor. Is my understanding correct. Thanks Saringni. On Jan 13, 2008 5:54 PM, Thomas Renninger <trenn@suse.de> wrote: > > On Fri, 2008-01-11 at 14:15 -0800, Saru Addep wrote: > > Hi All, > ... > > 2) What is the purpose of userspace governor. > > You can set the frequency from userspace: > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed > (or similar) pops up when you switch to userspace governor. > > The first dynamic cpufreq approaches were done in userspace. You have a > daemon checking every some 100 ms for the CPU load (/proc/stats) and > then decide whether to increase or decrease the freq. > > The ondemand governor is doing that in kernel, but has the sideeffect of > not supporting HW (IIRC speedstep-lib, possibly longhaul, powernow-k7 > (not sure) and other older ones) that takes too long for switching > frequencies. Then you would still need the userspace governor for > switching. > > Thomas > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 2:12 ` Saru Addep @ 2008-01-14 7:08 ` Tomasz Chmielewski 2008-01-14 7:51 ` Saru Addep 2008-01-14 9:51 ` Thomas Renninger 0 siblings, 2 replies; 11+ messages in thread From: Tomasz Chmielewski @ 2008-01-14 7:08 UTC (permalink / raw) To: Saru Addep; +Cc: cpufreq, Martin.Leisner Saru Addep schrieb: > Hi Thomas, > > So that means if we have an ondemand governor properly instrumented, there > is no need to have userspace governor. In the case of ondemand governor, the > only work that will be left to userspace would be to set the min, and max > freq. The complete intelligence of DVFS algoritm is present inside the > ondemand governor. Is my understanding correct. It looks to me that ondemand governor doesn't have "the complete intelligence". For example, it doesn't detect CPU load coming from some kernel tasks, like kcryptd: reads/writes from a device crypted with dm-crypt will be very slow if one uses the ondemand governor, as CPU speed will always be set to the lowest possible (so there is not enough power to crypt/decrypt data). Ironically, this is the only case when starting bzip2 will speed up your disk access... Or, use a userspace governor. See also http://bugzilla.kernel.org/show_bug.cgi?id=9729 -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 7:08 ` Tomasz Chmielewski @ 2008-01-14 7:51 ` Saru Addep 2008-01-14 9:51 ` Thomas Renninger 1 sibling, 0 replies; 11+ messages in thread From: Saru Addep @ 2008-01-14 7:51 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: cpufreq, Martin.Leisner Thanks Tomasz for your info. I have following doubts. Looking at the ondemand governor code, it seems to be linked to a concept of cpu idletime. Assuming my understandiig is true, how does a particular functionality like crypto effect the decision making in the dvfs algorithm of ondemand governor. I didn't understand why the CPU speed will always be set to lowest value in case of crypto. If cryto requires more horse power, the algorithm should increase the freq to a higher value, between the limits of the policy. Why should the CPU speed be low in case of crypto. Can some one also please let me know the concept of operating points, and where in the kernel tree I can see that code. Governors are pretty easily locatable, but I have a little tough time locating operating points code. Thanks Saringni. On Jan 14, 2008 2:08 AM, Tomasz Chmielewski <mangoo@wpkg.org> wrote: > Saru Addep schrieb: > > Hi Thomas, > > > > So that means if we have an ondemand governor properly instrumented, > there > > is no need to have userspace governor. In the case of ondemand governor, > the > > only work that will be left to userspace would be to set the min, and > max > > freq. The complete intelligence of DVFS algoritm is present inside the > > ondemand governor. Is my understanding correct. > > It looks to me that ondemand governor doesn't have "the complete > intelligence". > > For example, it doesn't detect CPU load coming from some kernel tasks, > like kcryptd: reads/writes from a device crypted with dm-crypt will be > very slow if one uses the ondemand governor, as CPU speed will always be > set to the lowest possible (so there is not enough power to > crypt/decrypt data). > > Ironically, this is the only case when starting bzip2 will speed up your > disk access... Or, use a userspace governor. > > > See also http://bugzilla.kernel.org/show_bug.cgi?id=9729 > > > -- > Tomasz Chmielewski > http://wpkg.org > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 7:08 ` Tomasz Chmielewski 2008-01-14 7:51 ` Saru Addep @ 2008-01-14 9:51 ` Thomas Renninger 2008-01-14 10:16 ` Tomasz Chmielewski 1 sibling, 1 reply; 11+ messages in thread From: Thomas Renninger @ 2008-01-14 9:51 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: Martin.Leisner, cpufreq On Mon, 2008-01-14 at 08:08 +0100, Tomasz Chmielewski wrote: > Saru Addep schrieb: > > Hi Thomas, > > > > So that means if we have an ondemand governor properly instrumented, there > > is no need to have userspace governor. In the case of ondemand governor, the > > only work that will be left to userspace would be to set the min, and max > > freq. The complete intelligence of DVFS algoritm is present inside the > > ondemand governor. Is my understanding correct. Yes, this is correct. > It looks to me that ondemand governor doesn't have "the complete > intelligence". > > For example, it doesn't detect CPU load coming from some kernel tasks, > like kcryptd: reads/writes from a device crypted with dm-crypt will be > very slow if one uses the ondemand governor, as CPU speed will always be > set to the lowest possible (so there is not enough power to > crypt/decrypt data). > > Ironically, this is the only case when starting bzip2 will speed up your > disk access... Or, use a userspace governor. > > > See also http://bugzilla.kernel.org/show_bug.cgi?id=9729 I don't know about this one. AFAIK there has been some work done there, I expect the bug in the crypto area, not in cpufreq/ondemand layer. A Xeon processor stepped down from 2800 to 350 looks bogus (maybe the new ones even can, not sure), could it be that you are using p4-clockmode driver which is doing throttling, not frequency scaling, better try with acpi-cpufreq then. Thomas ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 9:51 ` Thomas Renninger @ 2008-01-14 10:16 ` Tomasz Chmielewski 2008-01-14 10:32 ` Thomas Renninger 0 siblings, 1 reply; 11+ messages in thread From: Tomasz Chmielewski @ 2008-01-14 10:16 UTC (permalink / raw) To: trenn; +Cc: Martin.Leisner, cpufreq Thomas Renninger schrieb: > On Mon, 2008-01-14 at 08:08 +0100, Tomasz Chmielewski wrote: (...) >> It looks to me that ondemand governor doesn't have "the complete >> intelligence". >> >> For example, it doesn't detect CPU load coming from some kernel tasks, >> like kcryptd: reads/writes from a device crypted with dm-crypt will be >> very slow if one uses the ondemand governor, as CPU speed will always be >> set to the lowest possible (so there is not enough power to >> crypt/decrypt data). >> >> Ironically, this is the only case when starting bzip2 will speed up your >> disk access... Or, use a userspace governor. >> >> >> See also http://bugzilla.kernel.org/show_bug.cgi?id=9729 > > I don't know about this one. > AFAIK there has been some work done there, I expect the bug in the > crypto area, not in cpufreq/ondemand layer. > > A Xeon processor stepped down from 2800 to 350 looks bogus (maybe the > new ones even can, not sure) Quite the contrary - it's a pretty old Xeon which is i386 only. Why does it look bogus to you, anyway? > could it be that you are using > p4-clockmode driver which is doing throttling, not frequency scaling, > better try with acpi-cpufreq then. Indeed, I am using p4-clockmod. acpi-cpufreq doesn't work for me on that machine (p4-clockmod not loaded when I try to insert acpi-cpufreq): # modprobe acpi-cpufreq FATAL: Error inserting acpi_cpufreq (/lib/modules/2.6.23.12-pata-1/kernel/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.ko): No such device -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 10:16 ` Tomasz Chmielewski @ 2008-01-14 10:32 ` Thomas Renninger 2008-01-14 10:59 ` Tomasz Chmielewski 0 siblings, 1 reply; 11+ messages in thread From: Thomas Renninger @ 2008-01-14 10:32 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: Martin.Leisner, cpufreq On Mon, 2008-01-14 at 11:16 +0100, Tomasz Chmielewski wrote: > Thomas Renninger schrieb: > > On Mon, 2008-01-14 at 08:08 +0100, Tomasz Chmielewski wrote: > > (...) > > >> It looks to me that ondemand governor doesn't have "the complete > >> intelligence". > >> > >> For example, it doesn't detect CPU load coming from some kernel tasks, > >> like kcryptd: reads/writes from a device crypted with dm-crypt will be > >> very slow if one uses the ondemand governor, as CPU speed will always be > >> set to the lowest possible (so there is not enough power to > >> crypt/decrypt data). > >> > >> Ironically, this is the only case when starting bzip2 will speed up your > >> disk access... Or, use a userspace governor. > >> > >> > >> See also http://bugzilla.kernel.org/show_bug.cgi?id=9729 > > > > I don't know about this one. > > AFAIK there has been some work done there, I expect the bug in the > > crypto area, not in cpufreq/ondemand layer. > > > > A Xeon processor stepped down from 2800 to 350 looks bogus (maybe the > > new ones even can, not sure) > > Quite the contrary - it's a pretty old Xeon which is i386 only. > Why does it look bogus to you, anyway? > > > > could it be that you are using > > p4-clockmode driver which is doing throttling, not frequency scaling, > > better try with acpi-cpufreq then. > > Indeed, I am using p4-clockmod. Sorry, but your bug report is invalid then. p4-clockmod is using throttling (means the CPU ignores cycles/ticks) and not CPU frequency/voltage reduction. There is another interface for that: /proc/acpi/processor/throttling (AFAIK there exists a brandnew sys interface also) If you have a userspace app making use of that you "double throttle" which can lead to very bad performance behavior. > acpi-cpufreq doesn't work for me on that machine (p4-clockmod not loaded > when I try to insert acpi-cpufreq): > > # modprobe acpi-cpufreq > FATAL: Error inserting acpi_cpufreq > (/lib/modules/2.6.23.12-pata-1/kernel/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.ko): > No such device Have you checked whether that the CPU is cpufreq capable at all? If yes, you might want to upgrade the BIOS. Still, it looks strange that frequency (in this case throttling) is not set to the highest state as measuring the idle time should be the same mechanism and low-level driver independent. So this may be a valid bug, but using p4-clockmode is not a good idea to work on it (p4-clockmode is not a good idea to work on in general, IMO it should vanish totally...). Thomas ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 10:32 ` Thomas Renninger @ 2008-01-14 10:59 ` Tomasz Chmielewski 2008-01-14 19:13 ` Saru Addep 0 siblings, 1 reply; 11+ messages in thread From: Tomasz Chmielewski @ 2008-01-14 10:59 UTC (permalink / raw) To: trenn; +Cc: Martin.Leisner, cpufreq Thomas Renninger schrieb: (...) >>> could it be that you are using >>> p4-clockmode driver which is doing throttling, not frequency scaling, >>> better try with acpi-cpufreq then. >> Indeed, I am using p4-clockmod. > Sorry, but your bug report is invalid then. > p4-clockmod is using throttling (means the CPU ignores cycles/ticks) and > not CPU frequency/voltage reduction. > There is another interface for that: > /proc/acpi/processor/throttling Umm, do I need to build/insert some additional modules here? # cat /proc/acpi/processor/CPU0/throttling <not supported> (...) >> acpi-cpufreq doesn't work for me on that machine (p4-clockmod not loaded >> when I try to insert acpi-cpufreq): >> >> # modprobe acpi-cpufreq >> FATAL: Error inserting acpi_cpufreq >> (/lib/modules/2.6.23.12-pata-1/kernel/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.ko): >> No such device > > Have you checked whether that the CPU is cpufreq capable at all? According to Documentation/cpu-freq/user-guide.txt, Intel Xeon is supported by cpufreq. Are there exceptions to that (i.e., some Xeons are not supported)? Anyway, "cat /dev/zero >/dev/null" scales the frequency up; reading from a dm-crypt device doesn't. > If yes, you might want to upgrade the BIOS. > > Still, it looks strange that frequency (in this case throttling) is not > set to the highest state as measuring the idle time should be the same > mechanism and low-level driver independent. So this may be a valid bug, > but using p4-clockmode is not a good idea to work on it (p4-clockmode is > not a good idea to work on in general, IMO it should vanish totally...). In that case, it's not documented very clearly (in "make menuconfig"). Basically, a P4 user can pick either: CONFIG_X86_ACPI_CPUFREQ: This driver adds a CPUFreq driver which utilizes the ACPI Processor Performance States. This driver also supports Intel Enhanced Speedstep. or: CONFIG_X86_P4_CLOCKMOD: This adds the CPUFreq driver for Intel Pentium 4 / XEON processors. CONFIG_X86_P4_CLOCKMOD is more explicit and implies that is the preferred module for a P4 CPU. -- Tomasz Chmielewski http://wpkg.org ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Overall picture of cpufreq.. 2008-01-14 10:59 ` Tomasz Chmielewski @ 2008-01-14 19:13 ` Saru Addep 0 siblings, 0 replies; 11+ messages in thread From: Saru Addep @ 2008-01-14 19:13 UTC (permalink / raw) To: Tomasz Chmielewski; +Cc: cpufreq, Martin.Leisner Can some one also please let me know the concept of operating points, and where in the kernel tree I can see that code. Governors are pretty easily locatable, but I have a little tough time locating operating points code. Thanks Saringni. On 1/14/08, Tomasz Chmielewski <mangoo@wpkg.org> wrote: > > Thomas Renninger schrieb: > > (...) > > >>> could it be that you are using > >>> p4-clockmode driver which is doing throttling, not frequency scaling, > >>> better try with acpi-cpufreq then. > >> Indeed, I am using p4-clockmod. > > Sorry, but your bug report is invalid then. > > p4-clockmod is using throttling (means the CPU ignores cycles/ticks) and > > not CPU frequency/voltage reduction. > > There is another interface for that: > > /proc/acpi/processor/throttling > > Umm, do I need to build/insert some additional modules here? > > # cat /proc/acpi/processor/CPU0/throttling > <not supported> > > (...) > > > >> acpi-cpufreq doesn't work for me on that machine (p4-clockmod not > loaded > >> when I try to insert acpi-cpufreq): > >> > >> # modprobe acpi-cpufreq > >> FATAL: Error inserting acpi_cpufreq > >> > (/lib/modules/2.6.23.12-pata-1/kernel/arch/i386/kernel/cpu/cpufreq/acpi- > cpufreq.ko): > >> No such device > > > > Have you checked whether that the CPU is cpufreq capable at all? > > According to Documentation/cpu-freq/user-guide.txt, Intel Xeon is > supported by cpufreq. Are there exceptions to that (i.e., some Xeons are > not supported)? > > Anyway, "cat /dev/zero >/dev/null" scales the frequency up; reading from > a dm-crypt device doesn't. > > > > If yes, you might want to upgrade the BIOS. > > > > Still, it looks strange that frequency (in this case throttling) is not > > set to the highest state as measuring the idle time should be the same > > mechanism and low-level driver independent. So this may be a valid bug, > > but using p4-clockmode is not a good idea to work on it (p4-clockmode is > > not a good idea to work on in general, IMO it should vanish totally...). > > In that case, it's not documented very clearly (in "make menuconfig"). > Basically, a P4 user can pick either: > > CONFIG_X86_ACPI_CPUFREQ: > > This driver adds a CPUFreq driver which utilizes the ACPI > > Processor Performance States. > > > > This driver also supports Intel Enhanced Speedstep. > > > > or: > > > CONFIG_X86_P4_CLOCKMOD: > > > This adds the CPUFreq driver for Intel Pentium 4 / XEON > > processors. > > > > CONFIG_X86_P4_CLOCKMOD is more explicit and implies that is the > preferred module for a P4 CPU. > > > > -- > Tomasz Chmielewski > http://wpkg.org > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-01-14 19:13 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-01-11 22:15 Overall picture of cpufreq Saru Addep 2008-01-11 22:50 ` Leisner, Martin 2008-01-13 22:54 ` Thomas Renninger 2008-01-14 2:12 ` Saru Addep 2008-01-14 7:08 ` Tomasz Chmielewski 2008-01-14 7:51 ` Saru Addep 2008-01-14 9:51 ` Thomas Renninger 2008-01-14 10:16 ` Tomasz Chmielewski 2008-01-14 10:32 ` Thomas Renninger 2008-01-14 10:59 ` Tomasz Chmielewski 2008-01-14 19:13 ` Saru Addep
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.