tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kcpuset(9) questions



On Mon, Jan 28, 2013 at 02:34:32AM +0000, Mindaugas Rasiukevicius wrote:
> David Young <dyoung%pobox.com@localhost> wrote:
> > I was using kcpuset(9) a little bit today and I was surprised that
> > there was not a routine or a variable representing all of the attached
> > CPUs.  I see that there is such a MI variable declared in <sys/cpu.h>,
> > kcpuset_attached.  Should it be part of the API?
> 
> There are kcpuset_attached and kcpuset_running, which are MI.  All ports
> ought to switch to them replacing MD cpu_attached/cpu_running.  They can
> be wrapped into a routine, but globals seem harmless in this case too.

It seems that if they are not wrapped in routines, they should be
declared differently, e.g.,

extern const kcpuset_t * const kcpuset_attached;

> > 
> > Also, kcpuset iterator would have been useful.  Perhaps there should be
> > one?
> > 
> 
> There was no use case, when I added it.  Can you describe your use case?
> Usually we iterate all CPUs with CPU_INFO_FOREACH() anyway (which should
> also be replaced with a MI interface, but that requires non-trivial
> invasion into all ports).

Well, iterating all CPUs would be one use case.  Another case would be
to, say, iterate the CPUs where a message-signalled interrupt (MSI)
handler should be established.

I was trying to decide the other night whether iterating a kcpuset_t w/
a for-loop was unwieldy under my _first/_next proposal:

bool more;
cpuid_t cpuid;

for (more = kcpuset_first(kcpu, &cpuid);
     more;
     more = kcpuset_next(kcpu, &cpuid)) {
        // do sumthin
}

Not great, but ok?

Dave

-- 
David Young
dyoung%pobox.com@localhost    Urbana, IL    (217) 721-9981


Home | Main Index | Thread Index | Old Index