On Fri, 1 Oct 1999, Rodolphe Ortalo wrote:
> Andreas Beck wrote:
> > It just polls the accelIdle bit and waits for it to come up while the ioctl
> > is still running.
>
> Alternatively, some cards can also send an interrupt when the accel
> engine has finished, no ? (But you need to protect the critical
> section whatsoever.)
For good cards yes we could us a interrupt. But this doesn't still help
the fact a seperate process could be accessing the framebuffer.
> > On SMP machines, you will have to put an explicit lock there. This needs
> > some support in the kernel. The IMHO best implementation would be to
> > unmap the framebuffer for _all_ processes while an accel is running.
Yuk. On SMP machines I would have to remove the pages from the page
tables and flush the TBLs of every CPU before every accel access. This
would be a very very big performance hit.
> Why not use a kernel lock here then? IMHO there should exist already
> some way to control this: setting up a mutex (0/1 semaphore) or lock
> associated to the framebuffer. HW accelerated operations would acquire
> the lock (on behalf of the hw engine that surely cannot do it itself)
> and release it when it is idle (this can be done via interrupt notification).
> Normal MMIO operations should also acquire this lock IMO. (Maybe this
> is where there is a potential problem? There is no way to set up
> semaphore control for shared-MMIO areas?)
Nope. When you mmap the memory isn't really their. Once you access
that memory a page fault happens. Once a page fault happens the kernel
has no control over the memory. In fact their is clock alogrithm that is
called every so often that looks at each page that was faulted in. Their
is a age field for each page. If the is old meaning no one has accessed it
in a while then the page is removed from the page tables and goes to
swap. No you can lock the data structures representing memory regions.
This is you can't do things like page fault a page in a memory region
where another process on another CPU is unmmapping the nregion. This would
be bad.
By the way the semaphore idea isn't a bad idea. The big things is we have
to make sure only one process at a time is using the framebuffer or accel
engine. Basically one process hogs the whole card.