Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

kcpuset(9) interface

2 views
Skip to first unread message

Mindaugas Rasiukevicius

unread,
Jul 31, 2011, 2:11:10 PM7/31/11
to
Hello,

Here is a reworked dynamic CPU set implementation for kernel (shared
cpuset.c in src/common will be moved to libc) - a kcpuset(9) interface:

http://www.netbsd.org/~rmind/kcpuset_ng.diff

It supports early use while the system is cold through a fix up mechanism,
see kcpuset_sysinit(). That would enable us to use kcpuset(9) in MD code,
such as pmap(9). The intention of interface is to: 1) replace hard-coded
parts (e.g. limited to uint32_t or MAXCPUS constant) with a more dynamic
mechanism 2) replace and unify duplicated CPU bitset code (e.g. in MIPS,
PowerPC, sparc64, which have own copies).

Comments?

--
Mindaugas

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-...@muc.de

YAMAMOTO Takashi

unread,
Aug 1, 2011, 11:17:08 PM8/1/11
to
hi,

> Hello,
>
> Here is a reworked dynamic CPU set implementation for kernel (shared
> cpuset.c in src/common will be moved to libc) - a kcpuset(9) interface:
>
> http://www.netbsd.org/~rmind/kcpuset_ng.diff
>
> It supports early use while the system is cold through a fix up mechanism,
> see kcpuset_sysinit(). That would enable us to use kcpuset(9) in MD code,
> such as pmap(9). The intention of interface is to: 1) replace hard-coded
> parts (e.g. limited to uint32_t or MAXCPUS constant) with a more dynamic
> mechanism 2) replace and unify duplicated CPU bitset code (e.g. in MIPS,
> PowerPC, sparc64, which have own copies).

thanks for working on this.
and sorry for commenting only on a minor point.

why did you change kcpuset_t to a pointer from a structure?
i always feel awkward to compare an opaque type with NULL.

YAMAMOTO Takashi

YAMAMOTO Takashi

unread,
Aug 2, 2011, 10:18:23 PM8/2/11
to
hi,

> ya...@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
>> > Here is a reworked dynamic CPU set implementation for kernel (shared
>> > cpuset.c in src/common will be moved to libc) - a kcpuset(9) interface:
>> >
>> > http://www.netbsd.org/~rmind/kcpuset_ng.diff
>> >
>> > It supports early use while the system is cold through a fix up
>> > mechanism, see kcpuset_sysinit(). That would enable us to use kcpuset
>> > (9) in MD code, such as pmap(9). The intention of interface is to: 1)
>> > replace hard-coded parts (e.g. limited to uint32_t or MAXCPUS constant)
>> > with a more dynamic mechanism 2) replace and unify duplicated CPU
>> > bitset code (e.g. in MIPS, PowerPC, sparc64, which have own copies).
>>
>> thanks for working on this.
>> and sorry for commenting only on a minor point.
>

> Your comments are always welcome. :)


>
>> why did you change kcpuset_t to a pointer from a structure?
>> i always feel awkward to compare an opaque type with NULL.
>

> The reason is that kcpuset_t now points directly to the bit field rather
> than opaque struct kcpuset_impl. Do you prefer wrapping, e.g. like this:
>
> struct kcpuset { uint32_t bitfield[0]; };
>
> Except this is not C99..

is it necessary to expose the fact that it's an array to the API users?
if it isn't, a dummy structure tag should just work.

btw, on second thought, i think it might be worth to allow kcpuset_t be
just a scalar type and avoid dynamic allocations for ports which can't
have large MAXCPUS. in that case, we should somehow abstract NULL
comparisons.

YAMAMOTO Takashi

Mindaugas Rasiukevicius

unread,
Aug 2, 2011, 3:28:44 PM8/2/11
to
ya...@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
> > Here is a reworked dynamic CPU set implementation for kernel (shared
> > cpuset.c in src/common will be moved to libc) - a kcpuset(9) interface:
> >
> > http://www.netbsd.org/~rmind/kcpuset_ng.diff
> >
> > It supports early use while the system is cold through a fix up
> > mechanism, see kcpuset_sysinit(). That would enable us to use kcpuset
> > (9) in MD code, such as pmap(9). The intention of interface is to: 1)
> > replace hard-coded parts (e.g. limited to uint32_t or MAXCPUS constant)
> > with a more dynamic mechanism 2) replace and unify duplicated CPU
> > bitset code (e.g. in MIPS, PowerPC, sparc64, which have own copies).
>
> thanks for working on this.
> and sorry for commenting only on a minor point.

Your comments are always welcome. :)

> why did you change kcpuset_t to a pointer from a structure?


> i always feel awkward to compare an opaque type with NULL.

The reason is that kcpuset_t now points directly to the bit field rather


than opaque struct kcpuset_impl. Do you prefer wrapping, e.g. like this:

struct kcpuset { uint32_t bitfield[0]; };

Except this is not C99..

--

Message has been deleted
Message has been deleted
0 new messages