9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] usb ohci question
@ 2011-02-22 15:10 rod
  2011-02-22 15:30 ` Francisco J Ballesteros
  2011-02-22 15:31 ` Philippe Anel
  0 siblings, 2 replies; 6+ messages in thread
From: rod @ 2011-02-22 15:10 UTC (permalink / raw)
  To: 9fans

I'm struggling to understand the ins and outs of the usb ohci driver
(usbohci.c) and have a question (well, several).

If one writes to an endpoint, then "epio" gets called. This in turn
does ilock(ctrl) which disables interrupts on my single-processor
machine. Then "epgettd" is called several times to allocate transfer
descriptors. Each call to epgettd copies a portion from the user space
buffer which was passed as a parameter to "epio".

What happens here if the user space buffer is in a page which is not
present? Is it possible for a page-in to happen even when interrupts
are disabled by the ilock?

Thanks for any insight.

rod



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] usb ohci question
  2011-02-22 15:10 [9fans] usb ohci question rod
@ 2011-02-22 15:30 ` Francisco J Ballesteros
  2011-02-22 16:42   ` rod
  2011-02-22 15:31 ` Philippe Anel
  1 sibling, 1 reply; 6+ messages in thread
From: Francisco J Ballesteros @ 2011-02-22 15:30 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'll look again (just did).
But I think you found a bug.

On Tue, Feb 22, 2011 at 4:10 PM,  <rod@hemiola.co.uk> wrote:
> I'm struggling to understand the ins and outs of the usb ohci driver
> (usbohci.c) and have a question (well, several).
>
> If one writes to an endpoint, then "epio" gets called. This in turn
> does ilock(ctrl) which disables interrupts on my single-processor
> machine. Then "epgettd" is called several times to allocate transfer
> descriptors. Each call to epgettd copies a portion from the user space
> buffer which was passed as a parameter to "epio".
>
> What happens here if the user space buffer is in a page which is not
> present? Is it possible for a page-in to happen even when interrupts
> are disabled by the ilock?
>
> Thanks for any insight.
>
> rod
>
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] usb ohci question
  2011-02-22 15:10 [9fans] usb ohci question rod
  2011-02-22 15:30 ` Francisco J Ballesteros
@ 2011-02-22 15:31 ` Philippe Anel
  2011-02-22 15:45   ` Philippe Anel
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Anel @ 2011-02-22 15:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

A 'page-in' occurs on page fault exception, which cannot be masked.

Phil;


Le 22/02/2011 16:10, rod@hemiola.co.uk a �crit :
> I'm struggling to understand the ins and outs of the usb ohci driver
> (usbohci.c) and have a question (well, several).
>
> If one writes to an endpoint, then "epio" gets called. This in turn
> does ilock(ctrl) which disables interrupts on my single-processor
> machine. Then "epgettd" is called several times to allocate transfer
> descriptors. Each call to epgettd copies a portion from the user space
> buffer which was passed as a parameter to "epio".
>
> What happens here if the user space buffer is in a page which is not
> present? Is it possible for a page-in to happen even when interrupts
> are disabled by the ilock?
>
> Thanks for any insight.
>
> rod
>
>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] usb ohci question
  2011-02-22 15:31 ` Philippe Anel
@ 2011-02-22 15:45   ` Philippe Anel
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Anel @ 2011-02-22 15:45 UTC (permalink / raw)
  To: 9fans


Oh, sorry, I forgot that the page-in operation might require an interrupt
from the disk or network controller in order to reload the page.

Phil;

Le 22/02/2011 16:31, Philippe Anel a �crit :
> Hello,
>
> A 'page-in' occurs on page fault exception, which cannot be masked.
>
> Phil;
>
>
> Le 22/02/2011 16:10, rod@hemiola.co.uk a �crit :
>> I'm struggling to understand the ins and outs of the usb ohci driver
>> (usbohci.c) and have a question (well, several).
>>
>> If one writes to an endpoint, then "epio" gets called. This in turn
>> does ilock(ctrl) which disables interrupts on my single-processor
>> machine. Then "epgettd" is called several times to allocate transfer
>> descriptors. Each call to epgettd copies a portion from the user space
>> buffer which was passed as a parameter to "epio".
>>
>> What happens here if the user space buffer is in a page which is not
>> present? Is it possible for a page-in to happen even when interrupts
>> are disabled by the ilock?
>>
>> Thanks for any insight.
>>
>> rod
>>
>>
>
>
>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] usb ohci question
  2011-02-22 15:30 ` Francisco J Ballesteros
@ 2011-02-22 16:42   ` rod
  2011-02-22 16:50     ` Francisco J Ballesteros
  0 siblings, 1 reply; 6+ messages in thread
From: rod @ 2011-02-22 16:42 UTC (permalink / raw)
  To: 9fans


>But I think you found a bug.

Ok, so maybe the first ilock/iunlock pair isn't needed? The controller
can't see the task descriptors that have been chained on to the
endpoint until the "tail" element of the endpoint descriptor is set,
so any potential interrupts during the sequence won't affect anything.

rod



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] usb ohci question
  2011-02-22 16:42   ` rod
@ 2011-02-22 16:50     ` Francisco J Ballesteros
  0 siblings, 0 replies; 6+ messages in thread
From: Francisco J Ballesteros @ 2011-02-22 16:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

In general, there are more ilocks than needed, out of paranoia.
I don't have the code here now, but you might be right.

thanks

On Tue, Feb 22, 2011 at 5:42 PM,  <rod@hemiola.co.uk> wrote:
>
>>But I think you found a bug.
>
> Ok, so maybe the first ilock/iunlock pair isn't needed? The controller
> can't see the task descriptors that have been chained on to the
> endpoint until the "tail" element of the endpoint descriptor is set,
> so any potential interrupts during the sequence won't affect anything.
>
> rod
>
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-22 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-22 15:10 [9fans] usb ohci question rod
2011-02-22 15:30 ` Francisco J Ballesteros
2011-02-22 16:42   ` rod
2011-02-22 16:50     ` Francisco J Ballesteros
2011-02-22 15:31 ` Philippe Anel
2011-02-22 15:45   ` Philippe Anel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).