Re: Which should kcpuset use cpuid or cpu index?

2014-09-07 Thread Kengo NAKAHARA

Hi,

(2014/09/08 12:52), Matt Thomas wrote:


On Sep 7, 2014, at 8:51 PM, Kengo NAKAHARA  wrote:

(2014/09/08 12:34), Matt Thomas wrote:


ci_cpuid is MD and has no standard semantics.

Use cpu_index(ci) (curcpu()->ci_index)


I see. So, should kcpuset APIs use u_int (not cpuid_t)? As cpu_index()
which is MI function in sys/sys/cpu.h returns u_int type.


I don't think it matters since it's a u_long.


Surely, it does not matter for compile time and run time. But reading
source, it causes confusion as if kcpuset APIs use cpuid. In fact,
as you indicated, the APIs use cpu index.

I think it would avoid misunderstanding to use u_int for kcpuset APIs.
# It would be friendly to novice like me :)

Thanks,

--
//
Internet Initiative Japan Inc.

Device Engineering Section,
Core Product Development Department,
Product Division,
Technology Unit

Kengo NAKAHARA 


Re: Which should kcpuset use cpuid or cpu index?

2014-09-07 Thread Matt Thomas

On Sep 7, 2014, at 8:51 PM, Kengo NAKAHARA  wrote:

> Hi,
> 
> Thank you for answer.
> 
> (2014/09/08 12:34), Matt Thomas wrote:
>> 
>> On Sep 7, 2014, at 7:28 PM, Kengo NAKAHARA  wrote:
>> 
>>> I have a question about kcpuset. Referring "man 9 kcpuset", the APIs
>>> need cpuid (the type is cpuid_t) to identify CPU. However, the callers
>>> such as idle_loop() sys/kern/kern_idle.c use cpu index (the type is u_int).
>>> 
>>> cpu index means return value of cpu_index(), and cpu index is sequential
>>> number. On the other hand, cpuid means struct cpu_info.ci_cpuid and cpuid
>>> is non-sequential number at least x86 and sparc architectures. So, cpu index
>>> is different from cpuid. Which should kcpuset use cpuid or cpu index?
>> 
>> ci_cpuid is MD and has no standard semantics.
>> 
>> Use cpu_index(ci) (curcpu()->ci_index)
> 
> I see. So, should kcpuset APIs use u_int (not cpuid_t)? As cpu_index()
> which is MI function in sys/sys/cpu.h returns u_int type.

I don't think it matters since it's a u_long.

Re: Which should kcpuset use cpuid or cpu index?

2014-09-07 Thread Kengo NAKAHARA

Hi,

Thank you for answer.

(2014/09/08 12:34), Matt Thomas wrote:


On Sep 7, 2014, at 7:28 PM, Kengo NAKAHARA  wrote:


I have a question about kcpuset. Referring "man 9 kcpuset", the APIs
need cpuid (the type is cpuid_t) to identify CPU. However, the callers
such as idle_loop() sys/kern/kern_idle.c use cpu index (the type is u_int).

cpu index means return value of cpu_index(), and cpu index is sequential
number. On the other hand, cpuid means struct cpu_info.ci_cpuid and cpuid
is non-sequential number at least x86 and sparc architectures. So, cpu index
is different from cpuid. Which should kcpuset use cpuid or cpu index?


ci_cpuid is MD and has no standard semantics.

Use cpu_index(ci) (curcpu()->ci_index)


I see. So, should kcpuset APIs use u_int (not cpuid_t)? As cpu_index()
which is MI function in sys/sys/cpu.h returns u_int type.

Thanks,

--
//
Internet Initiative Japan Inc.

Device Engineering Section,
Core Product Development Department,
Product Division,
Technology Unit

Kengo NAKAHARA 


Re: Which should kcpuset use cpuid or cpu index?

2014-09-07 Thread Matt Thomas

On Sep 7, 2014, at 7:28 PM, Kengo NAKAHARA  wrote:

> I have a question about kcpuset. Referring "man 9 kcpuset", the APIs
> need cpuid (the type is cpuid_t) to identify CPU. However, the callers
> such as idle_loop() sys/kern/kern_idle.c use cpu index (the type is u_int).
> 
> cpu index means return value of cpu_index(), and cpu index is sequential
> number. On the other hand, cpuid means struct cpu_info.ci_cpuid and cpuid
> is non-sequential number at least x86 and sparc architectures. So, cpu index
> is different from cpuid. Which should kcpuset use cpuid or cpu index?

ci_cpuid is MD and has no standard semantics.

Use cpu_index(ci) (curcpu()->ci_index)

Which should kcpuset use cpuid or cpu index?

2014-09-07 Thread Kengo NAKAHARA
Hi,

I have a question about kcpuset. Referring "man 9 kcpuset", the APIs
need cpuid (the type is cpuid_t) to identify CPU. However, the callers
such as idle_loop() sys/kern/kern_idle.c use cpu index (the type is u_int).

cpu index means return value of cpu_index(), and cpu index is sequential
number. On the other hand, cpuid means struct cpu_info.ci_cpuid and cpuid
is non-sequential number at least x86 and sparc architectures. So, cpu index
is different from cpuid. Which should kcpuset use cpuid or cpu index?

I think kcpuset APIs should use sequentail u_int cpu index because of
efficient and easy-to-understand usage of bitmap. 
Could you comment this idea?

Thanks,

-- 
//
Internet Initiative Japan Inc.

Device Engineering Section,
Core Product Development Department,
Product Division,
Technology Unit

Kengo NAKAHARA