All of lore.kernel.org
 help / color / mirror / Atom feed
* Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
@ 2014-07-18 16:07 Mohammad Merajul Islam Molla
  2014-07-22 10:54 ` Mulyadi Santosa
  0 siblings, 1 reply; 6+ messages in thread
From: Mohammad Merajul Islam Molla @ 2014-07-18 16:07 UTC (permalink / raw)
  To: kernelnewbies

Hello,

In drivers/cpuidle/cpuidle.c, there are two functions
cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler. The
names seem confusing to me as they don't install any handler, rather
set 'initialized'  variable to 1/0.

In v3.0 kernel, these functions used to look as below where they
installed and uninstalled some handler function  -

void cpuidle_install_idle_handler(void)
123 {
124         if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
125                 /* Make sure all changes finished before we switch
to new idle */
126                 smp_wmb();
127                 pm_idle = cpuidle_idle_call;
128         }
129 }

void cpuidle_uninstall_idle_handler(void)
135 {
136         if (enabled_devices && pm_idle_old && (pm_idle != pm_idle_old)) {
137                 pm_idle = pm_idle_old;
138                 cpuidle_kick_cpus();
139         }
140 }

Do these names (and corresponding comments) still hold?

--
Thanks,
-Meraj

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
  2014-07-18 16:07 Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler Mohammad Merajul Islam Molla
@ 2014-07-22 10:54 ` Mulyadi Santosa
  2014-07-22 13:56   ` Mohammad Merajul Islam Molla
  0 siblings, 1 reply; 6+ messages in thread
From: Mulyadi Santosa @ 2014-07-22 10:54 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Jul 18, 2014 at 11:07 PM, Mohammad Merajul Islam Molla
<meraj.enigma@gmail.com> wrote:
> Hello,
>
> In drivers/cpuidle/cpuidle.c, there are two functions
> cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler. The
> names seem confusing to me as they don't install any handler, rather
> set 'initialized'  variable to 1/0.
>
> In v3.0 kernel, these functions used to look as below where they
> installed and uninstalled some handler function  -
>
> void cpuidle_install_idle_handler(void)
> 123 {
> 124         if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
> 125                 /* Make sure all changes finished before we switch
> to new idle */
> 126                 smp_wmb();
> 127                 pm_idle = cpuidle_idle_call;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pm_idle is the callback handler, and it is assigned to
cpuidle_idle_call. I think this what it means by "install"


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
  2014-07-22 10:54 ` Mulyadi Santosa
@ 2014-07-22 13:56   ` Mohammad Merajul Islam Molla
  2014-07-22 14:43     ` Anand Moon
  0 siblings, 1 reply; 6+ messages in thread
From: Mohammad Merajul Islam Molla @ 2014-07-22 13:56 UTC (permalink / raw)
  To: kernelnewbies

Hello,

As mentioned, the code excerpt was from kernel version 3.0.

In recent kernel (version 3.16.0-rc4), the code for the two mentioned
functions looks as below -

/**
 * cpuidle_install_idle_handler - installs the cpuidle idle loop handler
 */
void cpuidle_install_idle_handler(void)
{
        if (enabled_devices) {
                /* Make sure all changes finished before we switch to
new idle */
                smp_wmb();
                initialized = 1;
        }
}

/**
 * cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop
handler
 */
void cpuidle_uninstall_idle_handler(void)
{
        if (enabled_devices) {
                initialized = 0;
                kick_all_cpus_sync();
        }
}


That is the source of confusion. There is no pm_idle handler installed
(or uninstalled) anymore.

--
Thanks,
-Meraj



On Tue, Jul 22, 2014 at 4:54 PM, Mulyadi Santosa
<mulyadi.santosa@gmail.com> wrote:
> On Fri, Jul 18, 2014 at 11:07 PM, Mohammad Merajul Islam Molla
> <meraj.enigma@gmail.com> wrote:
>> Hello,
>>
>> In drivers/cpuidle/cpuidle.c, there are two functions
>> cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler. The
>> names seem confusing to me as they don't install any handler, rather
>> set 'initialized'  variable to 1/0.
>>
>> In v3.0 kernel, these functions used to look as below where they
>> installed and uninstalled some handler function  -
>>
>> void cpuidle_install_idle_handler(void)
>> 123 {
>> 124         if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
>> 125                 /* Make sure all changes finished before we switch
>> to new idle */
>> 126                 smp_wmb();
>> 127                 pm_idle = cpuidle_idle_call;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> pm_idle is the callback handler, and it is assigned to
> cpuidle_idle_call. I think this what it means by "install"
>
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
  2014-07-22 13:56   ` Mohammad Merajul Islam Molla
@ 2014-07-22 14:43     ` Anand Moon
  2014-07-22 15:07       ` Mohammad Merajul Islam Molla
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Moon @ 2014-07-22 14:43 UTC (permalink / raw)
  To: kernelnewbies

Hi Meraj,

Please look at the following commit this will help clear you confusion

git commit id : a0bfa1373859e9d11dc92561a8667588803e42d8 


patch :0001-cpuidle-stop-depending-on-pm_idle.patch

To generate following patch: 

#git format-patch -1 a0bfa1373859e9d11dc92561a8667588803e42d8

0001-cpuidle-stop-depending-on-pm_idle.patch


-Anand Moon


On Tuesday, July 22, 2014 7:28 PM, Mohammad Merajul Islam Molla <meraj.enigma@gmail.com> wrote:
Hello,

As mentioned, the code excerpt was from kernel version 3.0.

In recent kernel (version 3.16.0-rc4), the code for the two mentioned
functions looks as below -

/**
* cpuidle_install_idle_handler - installs the cpuidle idle loop handler
*/
void cpuidle_install_idle_handler(void)
{
? ? ? ? if (enabled_devices) {
? ? ? ? ? ? ? ? /* Make sure all changes finished before we switch to
new idle */
? ? ? ? ? ? ? ? smp_wmb();
? ? ? ? ? ? ? ? initialized = 1;
? ? ? ? }
}

/**
* cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop
handler
*/
void cpuidle_uninstall_idle_handler(void)
{
? ? ? ? if (enabled_devices) {
? ? ? ? ? ? ? ? initialized = 0;
? ? ? ? ? ? ? ? kick_all_cpus_sync();
? ? ? ? }
}


That is the source of confusion. There is no pm_idle handler installed
(or uninstalled) anymore.

--
Thanks,
-Meraj






On Tue, Jul 22, 2014 at 4:54 PM, Mulyadi Santosa
<mulyadi.santosa@gmail.com> wrote:
> On Fri, Jul 18, 2014 at 11:07 PM, Mohammad Merajul Islam Molla
> <meraj.enigma@gmail.com> wrote:
>> Hello,
>>
>> In drivers/cpuidle/cpuidle.c, there are two functions
>> cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler. The
>> names seem confusing to me as they don't install any handler, rather
>> set 'initialized'? variable to 1/0.
>>
>> In v3.0 kernel, these functions used to look as below where they
>> installed and uninstalled some handler function? -
>>
>> void cpuidle_install_idle_handler(void)
>> 123 {
>> 124? ? ? ?  if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
>> 125? ? ? ? ? ? ? ?  /* Make sure all changes finished before we switch
>> to new idle */
>> 126? ? ? ? ? ? ? ?  smp_wmb();
>> 127? ? ? ? ? ? ? ?  pm_idle = cpuidle_idle_call;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> pm_idle is the callback handler, and it is assigned to
> cpuidle_idle_call. I think this what it means by "install"
>
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
  2014-07-22 14:43     ` Anand Moon
@ 2014-07-22 15:07       ` Mohammad Merajul Islam Molla
  2014-07-22 15:43         ` Anand Moon
  0 siblings, 1 reply; 6+ messages in thread
From: Mohammad Merajul Islam Molla @ 2014-07-22 15:07 UTC (permalink / raw)
  To: kernelnewbies

Hi Anand,

Thanks for your reply. I looked up the patch.

Question:
                 Should these functions be renamed now that they don't
do what they used to do earlier?


--
Thanks,
-Meraj

On Tue, Jul 22, 2014 at 8:43 PM, Anand Moon <moon.linux@yahoo.com> wrote:
> Hi Meraj,
>
> Please look at the following commit this will help clear you confusion
>
> git commit id : a0bfa1373859e9d11dc92561a8667588803e42d8
>
>
> patch :0001-cpuidle-stop-depending-on-pm_idle.patch
>
> To generate following patch:
>
> #git format-patch -1 a0bfa1373859e9d11dc92561a8667588803e42d8
>
> 0001-cpuidle-stop-depending-on-pm_idle.patch
>
>
> -Anand Moon
>
>
> On Tuesday, July 22, 2014 7:28 PM, Mohammad Merajul Islam Molla <meraj.enigma@gmail.com> wrote:
> Hello,
>
> As mentioned, the code excerpt was from kernel version 3.0.
>
> In recent kernel (version 3.16.0-rc4), the code for the two mentioned
> functions looks as below -
>
> /**
> * cpuidle_install_idle_handler - installs the cpuidle idle loop handler
> */
> void cpuidle_install_idle_handler(void)
> {
>         if (enabled_devices) {
>                 /* Make sure all changes finished before we switch to
> new idle */
>                 smp_wmb();
>                 initialized = 1;
>         }
> }
>
> /**
> * cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop
> handler
> */
> void cpuidle_uninstall_idle_handler(void)
> {
>         if (enabled_devices) {
>                 initialized = 0;
>                 kick_all_cpus_sync();
>         }
> }
>
>
> That is the source of confusion. There is no pm_idle handler installed
> (or uninstalled) anymore.
>
> --
> Thanks,
> -Meraj
>
>
>
>
>
>
> On Tue, Jul 22, 2014 at 4:54 PM, Mulyadi Santosa
> <mulyadi.santosa@gmail.com> wrote:
>> On Fri, Jul 18, 2014 at 11:07 PM, Mohammad Merajul Islam Molla
>> <meraj.enigma@gmail.com> wrote:
>>> Hello,
>>>
>>> In drivers/cpuidle/cpuidle.c, there are two functions
>>> cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler. The
>>> names seem confusing to me as they don't install any handler, rather
>>> set 'initialized'  variable to 1/0.
>>>
>>> In v3.0 kernel, these functions used to look as below where they
>>> installed and uninstalled some handler function  -
>>>
>>> void cpuidle_install_idle_handler(void)
>>> 123 {
>>> 124         if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
>>> 125                 /* Make sure all changes finished before we switch
>>> to new idle */
>>> 126                 smp_wmb();
>>> 127                 pm_idle = cpuidle_idle_call;
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> pm_idle is the callback handler, and it is assigned to
>> cpuidle_idle_call. I think this what it means by "install"
>>
>>
>> --
>> regards,
>>
>> Mulyadi Santosa
>> Freelance Linux trainer and consultant
>>
>> blog: the-hydra.blogspot.com
>> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler
  2014-07-22 15:07       ` Mohammad Merajul Islam Molla
@ 2014-07-22 15:43         ` Anand Moon
  0 siblings, 0 replies; 6+ messages in thread
From: Anand Moon @ 2014-07-22 15:43 UTC (permalink / raw)
  To: kernelnewbies

Hi Meraj,

Look at the condition where they are called,
If they justify the meaning of the functions
it's ok to keep the name as it is.

Other wise if you have alternate name for these functions,
just send a patch to the maintainers of the code changes.

-Anand Moon


On Tuesday, July 22, 2014 8:38 PM, Mohammad Merajul Islam Molla <meraj.enigma@gmail.com> wrote:
Hi Anand,

Thanks for your reply. I looked up the patch.

Question:
? ? ? ? ? ? ? ?? Should these functions be renamed now that they don't
do what they used to do earlier?


--
Thanks,
-Meraj


On Tue, Jul 22, 2014 at 8:43 PM, Anand Moon <moon.linux@yahoo.com> wrote:
> Hi Meraj,
>
> Please look at the following commit this will help clear you confusion
>
> git commit id : a0bfa1373859e9d11dc92561a8667588803e42d8
>
>
> patch :0001-cpuidle-stop-depending-on-pm_idle.patch
>
> To generate following patch:
>
> #git format-patch -1 a0bfa1373859e9d11dc92561a8667588803e42d8
>
> 0001-cpuidle-stop-depending-on-pm_idle.patch
>
>
> -Anand Moon
>
>
> On Tuesday, July 22, 2014 7:28 PM, Mohammad Merajul Islam Molla <meraj.enigma@gmail.com> wrote:
> Hello,
>
> As mentioned, the code excerpt was from kernel version 3.0.
>
> In recent kernel (version 3.16.0-rc4), the code for the two mentioned
> functions looks as below -
>
> /**
> * cpuidle_install_idle_handler - installs the cpuidle idle loop handler
> */
> void cpuidle_install_idle_handler(void)
> {
>? ? ? ?? if (enabled_devices) {
>? ? ? ? ? ? ? ?? /* Make sure all changes finished before we switch to
> new idle */
>? ? ? ? ? ? ? ?? smp_wmb();
>? ? ? ? ? ? ? ?? initialized = 1;
>? ? ? ?? }
> }
>
> /**
> * cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop
> handler
> */
> void cpuidle_uninstall_idle_handler(void)
> {
>? ? ? ?? if (enabled_devices) {
>? ? ? ? ? ? ? ?? initialized = 0;
>? ? ? ? ? ? ? ?? kick_all_cpus_sync();
>? ? ? ?? }
> }
>
>
> That is the source of confusion. There is no pm_idle handler installed
> (or uninstalled) anymore.
>
> --
> Thanks,
> -Meraj
>
>
>
>
>
>
> On Tue, Jul 22, 2014 at 4:54 PM, Mulyadi Santosa
> <mulyadi.santosa@gmail.com> wrote:
>> On Fri, Jul 18, 2014 at 11:07 PM, Mohammad Merajul Islam Molla
>> <meraj.enigma@gmail.com> wrote:
>>> Hello,
>>>
>>> In drivers/cpuidle/cpuidle.c, there are two functions
>>> cpuidle_install_idle_handler & cpuidle_uninstall_idle_handler. The
>>> names seem confusing to me as they don't install any handler, rather
>>> set 'initialized'? variable to 1/0.
>>>
>>> In v3.0 kernel, these functions used to look as below where they
>>> installed and uninstalled some handler function? -
>>>
>>> void cpuidle_install_idle_handler(void)
>>> 123 {
>>> 124? ? ? ?? if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
>>> 125? ? ? ? ? ? ? ?? /* Make sure all changes finished before we switch
>>> to new idle */
>>> 126? ? ? ? ? ? ? ?? smp_wmb();
>>> 127? ? ? ? ? ? ? ?? pm_idle = cpuidle_idle_call;
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> pm_idle is the callback handler, and it is assigned to
>> cpuidle_idle_call. I think this what it means by "install"
>>
>>
>> --
>> regards,
>>
>> Mulyadi Santosa
>> Freelance Linux trainer and consultant
>>
>> blog: the-hydra.blogspot.com
>> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-22 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18 16:07 Confused by function names cpuidle_install_idle_handler/cpuidle_uninstall_idle_handler Mohammad Merajul Islam Molla
2014-07-22 10:54 ` Mulyadi Santosa
2014-07-22 13:56   ` Mohammad Merajul Islam Molla
2014-07-22 14:43     ` Anand Moon
2014-07-22 15:07       ` Mohammad Merajul Islam Molla
2014-07-22 15:43         ` Anand Moon

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.