Re: cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-30 Thread Adrian Chadd
On 30 May 2014 07:57, John Baldwin  wrote:

>> Ugh. Ok. I was too deep in the trenches of device drivers and other
>> ancillary things doing bad things to char/short with cpu ids when
>> walking things. I totally missed kinfo_proc.
>>
>> I'll go think about it a bit more.
>
> It shouldn't be too hard to to handle kinfo_proc.  pf is another case.  It
> might be nice to have a way to auto-compute the right number of bits to
> reserve based on MAXCPU.

*nod*

ok. Let me go and start sprinkling things around.



-a
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-30 Thread John Baldwin
On Thursday, May 29, 2014 5:46:05 pm Adrian Chadd wrote:
> On 29 May 2014 14:29, John Baldwin  wrote:
> > On Thursday, May 29, 2014 5:09:05 pm Adrian Chadd wrote:
> >> On 29 May 2014 13:18, John Baldwin  wrote:
> >>
> >> >> anyway. Besides all of this - I'm thinking of just introducing:
> >> >>
> >> >> typedef uint32_t cpuid_t;
> >> >>
> >> >> .. then once we've converted all the users, we can make NOCPU
> >> >> something other than 255 (which is the other limiting factor here..)
> >> >>
> >> >> Any objections?
> >> >
> >> > This one is a bit harder as you'll have to do shims for kinfo_proc, but
> >> > I think this is fine.  You could also just use u_int, but a new foo_t
> >> > isn't that bad I guess.
> >>
> >> I don't think I'd modify any userland-facing ABI/KBI's just yet. I'm
> >> just worried that 11.0-REL will come out before we have made a decent
> >> inroads into this and we _can't_ support > 254 CPUs.
> >
> > Eh, that's one of the biggies to do actually.   Kind of pointless to
> > update td_oncpu/lastcpu and not fix kinfo_proc at the same time.  You'll
> > just have to add new int fields and populate the old ones with sane values
> > for CPUs < 255.
> 
> Ugh. Ok. I was too deep in the trenches of device drivers and other
> ancillary things doing bad things to char/short with cpu ids when
> walking things. I totally missed kinfo_proc.
> 
> I'll go think about it a bit more.

It shouldn't be too hard to to handle kinfo_proc.  pf is another case.  It 
might be nice to have a way to auto-compute the right number of bits to 
reserve based on MAXCPU.

-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-29 Thread Adrian Chadd
On 29 May 2014 14:29, John Baldwin  wrote:
> On Thursday, May 29, 2014 5:09:05 pm Adrian Chadd wrote:
>> On 29 May 2014 13:18, John Baldwin  wrote:
>>
>> >> anyway. Besides all of this - I'm thinking of just introducing:
>> >>
>> >> typedef uint32_t cpuid_t;
>> >>
>> >> .. then once we've converted all the users, we can make NOCPU
>> >> something other than 255 (which is the other limiting factor here..)
>> >>
>> >> Any objections?
>> >
>> > This one is a bit harder as you'll have to do shims for kinfo_proc, but
>> > I think this is fine.  You could also just use u_int, but a new foo_t
>> > isn't that bad I guess.
>>
>> I don't think I'd modify any userland-facing ABI/KBI's just yet. I'm
>> just worried that 11.0-REL will come out before we have made a decent
>> inroads into this and we _can't_ support > 254 CPUs.
>
> Eh, that's one of the biggies to do actually.   Kind of pointless to
> update td_oncpu/lastcpu and not fix kinfo_proc at the same time.  You'll
> just have to add new int fields and populate the old ones with sane values
> for CPUs < 255.

Ugh. Ok. I was too deep in the trenches of device drivers and other
ancillary things doing bad things to char/short with cpu ids when
walking things. I totally missed kinfo_proc.

I'll go think about it a bit more.



-a
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-29 Thread John Baldwin
On Thursday, May 29, 2014 5:09:05 pm Adrian Chadd wrote:
> On 29 May 2014 13:18, John Baldwin  wrote:
> 
> >> anyway. Besides all of this - I'm thinking of just introducing:
> >>
> >> typedef uint32_t cpuid_t;
> >>
> >> .. then once we've converted all the users, we can make NOCPU
> >> something other than 255 (which is the other limiting factor here..)
> >>
> >> Any objections?
> >
> > This one is a bit harder as you'll have to do shims for kinfo_proc, but
> > I think this is fine.  You could also just use u_int, but a new foo_t
> > isn't that bad I guess.
> 
> I don't think I'd modify any userland-facing ABI/KBI's just yet. I'm
> just worried that 11.0-REL will come out before we have made a decent
> inroads into this and we _can't_ support > 254 CPUs.

Eh, that's one of the biggies to do actually.   Kind of pointless to
update td_oncpu/lastcpu and not fix kinfo_proc at the same time.  You'll
just have to add new int fields and populate the old ones with sane values
for CPUs < 255.

-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-29 Thread Adrian Chadd
On 29 May 2014 13:18, John Baldwin  wrote:

>> anyway. Besides all of this - I'm thinking of just introducing:
>>
>> typedef uint32_t cpuid_t;
>>
>> .. then once we've converted all the users, we can make NOCPU
>> something other than 255 (which is the other limiting factor here..)
>>
>> Any objections?
>
> This one is a bit harder as you'll have to do shims for kinfo_proc, but
> I think this is fine.  You could also just use u_int, but a new foo_t
> isn't that bad I guess.

I don't think I'd modify any userland-facing ABI/KBI's just yet. I'm
just worried that 11.0-REL will come out before we have made a decent
inroads into this and we _can't_ support > 254 CPUs.


-a
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-29 Thread John Baldwin
On Thursday, May 29, 2014 4:05:49 pm Adrian Chadd wrote:
> On 29 May 2014 11:44, John Baldwin  wrote:
> > On Thursday, May 29, 2014 2:24:45 pm Adrian Chadd wrote:
> >> On 29 May 2014 10:18, John Baldwin  wrote:
> >>
> >> >> > It costs wired memory to increase it for the kernel.  The userland 
> >> >> > set size
> >> >> > can be increased rather arbitrarily, so we don't need to make it but 
> >> >> > so large
> >> >> > as it is easy to bump later (even with a branch).
> >> >>
> >> >> Well, what about making the API/KBI use cpuset_t pointers for things
> >> >> rather than including it as a bitmask? Do you think there'd be a
> >> >> noticable performance overhead for the bits where it's indirecting
> >> >> through a pointer to get to the bitmask data?
> >> >
> >> > The wired memory is not due to cpuset_t.  The wired memory usage is due 
> >> > to things
> >> > that do 'struct foo foo_bits[MAXCPU]'.  The KBI issues I mentioned above 
> >> > are
> >> > 'struct rmlock' (so now you want any rmlock users to malloc space, or you
> >> > want rmlock_init() call malloc?  (that seems like a bad idea)).  The 
> >> > other one
> >> > is smp_rendezvous.  Plus, it's not just a pointer, you really need a 
> >> > (pointer,
> >> > size_t) tuple similar to what cpuset_getaffinity(), etc. use.
> >>
> >> Why would calling malloc be a problem? Except for the initial setup of
> >> things, anything dynamically allocating structs with embedded things
> >> like rmlocks are already dynamically allocating them via malloc or
> >> uma.
> >>
> >> There's a larger fundamental problem with malloc, fragmentation and
> >> getting the required larger allocations for things. But even a 4096
> >> CPU box would require a 512 byte malloc. That shouldn't be that hard
> >> to do. It'd just be from some memory that isn't close to the rest of
> >> the lock state.
> >
> > Other similar APIs like mtx_init() don't call malloc(), so it would be
> > unusual behavior.  However, we have several other problems before we can
> > move beyond 256 anyway (like pf).
> 
> Maybe behaviour has to change over time. :(
> 
> anyway. Besides all of this - I'm thinking of just introducing:
> 
> typedef uint32_t cpuid_t;
> 
> .. then once we've converted all the users, we can make NOCPU
> something other than 255 (which is the other limiting factor here..)
> 
> Any objections?

This one is a bit harder as you'll have to do shims for kinfo_proc, but
I think this is fine.  You could also just use u_int, but a new foo_t
isn't that bad I guess.

-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


cpuid_t typedef? (was Re: Processor cores not properly detected/activated?)

2014-05-29 Thread Adrian Chadd
On 29 May 2014 11:44, John Baldwin  wrote:
> On Thursday, May 29, 2014 2:24:45 pm Adrian Chadd wrote:
>> On 29 May 2014 10:18, John Baldwin  wrote:
>>
>> >> > It costs wired memory to increase it for the kernel.  The userland set 
>> >> > size
>> >> > can be increased rather arbitrarily, so we don't need to make it but so 
>> >> > large
>> >> > as it is easy to bump later (even with a branch).
>> >>
>> >> Well, what about making the API/KBI use cpuset_t pointers for things
>> >> rather than including it as a bitmask? Do you think there'd be a
>> >> noticable performance overhead for the bits where it's indirecting
>> >> through a pointer to get to the bitmask data?
>> >
>> > The wired memory is not due to cpuset_t.  The wired memory usage is due to 
>> > things
>> > that do 'struct foo foo_bits[MAXCPU]'.  The KBI issues I mentioned above 
>> > are
>> > 'struct rmlock' (so now you want any rmlock users to malloc space, or you
>> > want rmlock_init() call malloc?  (that seems like a bad idea)).  The other 
>> > one
>> > is smp_rendezvous.  Plus, it's not just a pointer, you really need a 
>> > (pointer,
>> > size_t) tuple similar to what cpuset_getaffinity(), etc. use.
>>
>> Why would calling malloc be a problem? Except for the initial setup of
>> things, anything dynamically allocating structs with embedded things
>> like rmlocks are already dynamically allocating them via malloc or
>> uma.
>>
>> There's a larger fundamental problem with malloc, fragmentation and
>> getting the required larger allocations for things. But even a 4096
>> CPU box would require a 512 byte malloc. That shouldn't be that hard
>> to do. It'd just be from some memory that isn't close to the rest of
>> the lock state.
>
> Other similar APIs like mtx_init() don't call malloc(), so it would be
> unusual behavior.  However, we have several other problems before we can
> move beyond 256 anyway (like pf).

Maybe behaviour has to change over time. :(

anyway. Besides all of this - I'm thinking of just introducing:

typedef uint32_t cpuid_t;

.. then once we've converted all the users, we can make NOCPU
something other than 255 (which is the other limiting factor here..)

Any objections?



-a
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"