[RFC][CFT] GEOM direct dispatch and fine-grained CAM locking

Nathan Whitehorn nwhitehorn at freebsd.org
Wed Sep 4 21:30:01 UTC 2013


On 09/04/13 11:00, John Baldwin wrote:
> On Wednesday, September 04, 2013 10:11:28 am Nathan Whitehorn wrote:
>> On 09/04/13 08:20, Ryan Stone wrote:
>>> On Wed, Sep 4, 2013 at 8:45 AM, Nathan Whitehorn <nwhitehorn at freebsd.org>
> wrote:
>>>> Could you describe what this macro is supposed to do so that we can do
> the
>>>> porting work?
>>>> -Nathan
>>> #define GET_STACK_USAGE(total, used)
>>>
>>> GET_STACK_USAGE sets the variable passed in total to the total amount
>>> of stack space available to the current thread.  used is set to the
>>> amount of stack space currently used (this does not have to have
>>> byte-precision).  Netgraph uses this to decide when to stop recursing
>>> and instead defer to a work queue (to prevent stack overflow).  I
>>> presume that Alexander is using it in a similar way.  It looks like
>>> the amd64 version could be ported to other architectures quite easily
>>> if you were to account for stacks that grow up and stacks that grow
>>> down:
>>>
>>>
> http://svnweb.freebsd.org/base/head/sys/amd64/include/proc.h?revision=233291&view=markup
>>> /* Get the current kernel thread stack usage. */
>>> #define GET_STACK_USAGE(total, used) do {                \
>>>       struct thread    *td = curthread;                \
>>>       (total) = td->td_kstack_pages * PAGE_SIZE;            \
>>>       (used) = (char *)td->td_kstack +                \
>>>           td->td_kstack_pages * PAGE_SIZE -                \
>>>           (char *)&td;                        \
>>> } while (0)
>>> _______________________________________________
>>> freebsd-hackers at freebsd.org mailing list
>>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>> I think that should be MI for us anyway. I'm not aware of any
>> architectures FreeBSD supports with stacks that grow up. I'll give it a
>> test on PPC.
> ia64 has the double stack thingie where the register stack spills into a stack
> that grows up rather than down.  Not sure how sparc64 window spills are
> handled either.
>

Ah, very well. That's weird. Should be fine for PPC, however.
-Nathan


More information about the freebsd-scsi mailing list