List Info

Thread: hwpmc dealing with sparse cpu systems.




hwpmc dealing with sparse cpu systems.
country flaguser name
United States
2007-10-12 15:00:06
One of the engineers here seems to have found a bug in the
hwpmc_mod.c module.  The problem we have is that cpuids can
be greater than mp_ncpus due to sparseness.

Does the fix here make sense?  (replace mp_ncpus with
MAXCPU)

I would like to commit it.

-Alfred

----- Forwarded message from Alfred Perlstein
<perlsteinjuniper.net> -----

From: "Sunil Mudunuri"
Subject: Re: hwpmc on mpsdk.
Date: Thu, 11 Oct 2007 18:11:27 -0700
Message-ID: <470EC9BF.5070607juniper.net>
User-Agent: Mozilla Thunderbird 1.0 (X11/20041206)

Looking at the code in hwpmc_mod.c, I feel that
the mp_ncpus (global) is wrongly used in this module.

While mp_ncpus is the count of active cpus in the system,
this is being used to range check a cpu id(active/inactive)
which can be 
greater than mp_ncpus.

The code works fine in systems which has all the cpu's
active eg. 
SPU(australia), but is causing crashes
in mpsdk where we have the active cpus interleaved with idle
cpu's.

I replaced mp_ncpus with MAXCPU in almost all the places and
it works fine.

So this should be fixed in the FreeBSD proper, I guess.

Alfred/Girish, can you push this to be fixed in FreeBSD

Thanks,
Sunil



----- End forwarded message -----

-- 
- Alfred Perlstein
_______________________________________________
freebsd-smpfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-smp
To unsubscribe, send any mail to
"freebsd-smp-unsubscribefreebsd.org"

Re: hwpmc dealing with sparse cpu systems.
country flaguser name
United States
2007-10-12 15:23:38
On Friday 12 October 2007 04:00:06 pm Alfred Perlstein
wrote:
> One of the engineers here seems to have found a bug in
the
> hwpmc_mod.c module.  The problem we have is that cpuids
can
> be greater than mp_ncpus due to sparseness.
> 
> Does the fix here make sense?  (replace mp_ncpus with
MAXCPU)
> 
> I would like to commit it.

Actually, mp_maxid is what you should use.  It is guaranteed
that all CPU IDs 
are <= mp_maxid.
 
> -Alfred
> 
> ----- Forwarded message from Alfred Perlstein
<perlsteinjuniper.net> -----
> 
> From: "Sunil Mudunuri"
> Subject: Re: hwpmc on mpsdk.
> Date: Thu, 11 Oct 2007 18:11:27 -0700
> Message-ID: <470EC9BF.5070607juniper.net>
> User-Agent: Mozilla Thunderbird 1.0 (X11/20041206)
> 
> Looking at the code in hwpmc_mod.c, I feel that
> the mp_ncpus (global) is wrongly used in this module.
> 
> While mp_ncpus is the count of active cpus in the
system,
> this is being used to range check a cpu
id(active/inactive) which can be 
> greater than mp_ncpus.
> 
> The code works fine in systems which has all the cpu's
active eg. 
> SPU(australia), but is causing crashes
> in mpsdk where we have the active cpus interleaved with
idle cpu's.
> 
> I replaced mp_ncpus with MAXCPU in almost all the
places and it works fine.
> 
> So this should be fixed in the FreeBSD proper, I
guess.
> 
> Alfred/Girish, can you push this to be fixed in
FreeBSD
> 
> Thanks,
> Sunil
> 
> 
> 
> ----- End forwarded message -----
> 
> -- 
> - Alfred Perlstein
> 



-- 
John Baldwin
_______________________________________________
freebsd-smpfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-smp
To unsubscribe, send any mail to
"freebsd-smp-unsubscribefreebsd.org"

Re: hwpmc dealing with sparse cpu systems.
country flaguser name
India
2007-10-12 23:07:15
> One of the engineers here seems to have found a bug in
the
> hwpmc_mod.c module.  The problem we have is that cpuids
can be
> greater than mp_ncpus due to sparseness.

> Does the fix here make sense?  (replace mp_ncpus with
MAXCPU)

No, a simple global substitution would probably be incorrect
because
it would allow userland to get hwpmc to attempt operations
on
non-existent CPUs.

I will look into this.

Regards,
Koshy
<jkoshyfreebsd.org>
_______________________________________________
freebsd-smpfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-smp
To unsubscribe, send any mail to
"freebsd-smp-unsubscribefreebsd.org"

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )