[RFC] Can we merge cpu states to a member in per_cpu structure?

1 view
Skip to first unread message

Zhangjun (V)

unread,
Apr 15, 2015, 2:11:05 AM4/15/15
to jailho...@googlegroups.com, Gongbinyang

Hi all,

 

In per_cpu structure, there are lots of members described the cpu state.

 

Such as, bool initialized, volatile bool suspend_cpu, volatile bool wait_for_sipi, volatile bool cpu_suspended.

 

Can we merge these numbers to a number?

 

Code like this:

 

Struct per_cpu {

 

u8 stack[PAGE_SIZE];

 

/** cpu state*/

 

U8 cpu_state;

};

 

Enum cpu_state {

         INITIALIZED = 0,

         SUSPEND,

         WAIT_FOR_SIPI,

    SHUTDOWN,

};

 

Cpu_data->cpu_state = INITIALIZED;

Jan Kiszka

unread,
Apr 15, 2015, 3:45:12 AM4/15/15
to Zhangjun (V), jailho...@googlegroups.com, Gongbinyang
On 2015-04-15 08:10, Zhangjun (V) wrote:
> Hi all,
>
> In per_cpu structure, there are lots of members described the cpu state.
>
> Such as, bool initialized, volatile bool suspend_cpu, volatile bool wait_for_sipi, volatile bool cpu_suspended.
>
> Can we merge these numbers to a number?
>
> Code like this:
>
> Struct per_cpu {
>
> u8 stack[PAGE_SIZE];
>
> ...
> /** cpu state*/
>
> U8 cpu_state;
> ...
> };
>
> Enum cpu_state {
> INITIALIZED = 0,
> SUSPEND,
> WAIT_FOR_SIPI,
> SHUTDOWN,
> };
>
> Cpu_data->cpu_state = INITIALIZED;
>

Some of these fields may have different locking requirements, some are
signaling flags, other may be required arch-independently. All that has
to be checked carefully. But I wouldn't be surprised if we could
consolidate some state variables. Cleanup patches are always welcome!
Maybe start with the simpler cases first (the non-volatile vars,
specifically).

Jan

--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

Zhangjun (V)

unread,
Apr 15, 2015, 5:06:33 AM4/15/15
to Jan Kiszka, jailho...@googlegroups.com, Gongbinyang
>Some of these fields may have different locking requirements, some are signaling flags, other may be required arch-independently. All that has to be checked carefully. But I wouldn't be surprised if we could consolidate some state variables. Cleanup patches are always welcome!
>Maybe start with the simpler cases first (the non-volatile vars, specifically).

Thanks. I will have a try.

-----邮件原件-----
发件人: jailho...@googlegroups.com [mailto:jailho...@googlegroups.com] 代表 Jan Kiszka
发送时间: 2015年4月15日 15:45
收件人: Zhangjun (V); jailho...@googlegroups.com; Gongbinyang
主题: Re: [RFC] Can we merge cpu states to a member in per_cpu structure?
--
You received this message because you are subscribed to the Google Groups "Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jailhouse-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages