public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* pages already locked on ia64
@ 2003-11-14 10:22 Christian Hinkelbein
  2003-11-17 23:40 ` David Mosberger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian Hinkelbein @ 2003-11-14 10:22 UTC (permalink / raw)
  To: linux-ia64

Hi,
i have the need to lock malloc'ed user mem between
kernel calls.

On ia32 i succesfully do a lock_page() on every
page returned by get_user_pages(), lateron i do
unlock_page().
On ia64 sometimes (on ia32 seemingly never) the first
page is already locked, just after malloc().
For a quick hack i check all pages before trying to
lock them, so that i am later just unlocking the
not previously locked ones.

I am quite shure that my approach is totally ill.
Could someone point me to some piece of information that
helps me get cured?

  christian


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

* Re: pages already locked on ia64
  2003-11-14 10:22 pages already locked on ia64 Christian Hinkelbein
@ 2003-11-17 23:40 ` David Mosberger
  2003-11-21 15:17 ` Christian Hinkelbein
  2003-11-24  4:58 ` Andrew Morton
  2 siblings, 0 replies; 4+ messages in thread
From: David Mosberger @ 2003-11-17 23:40 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Fri, 14 Nov 2003 11:22:23 +0100, Christian Hinkelbein <hinkelbein@ti.uni-mannheim.de> said:

  Christian> Hi, i have the need to lock malloc'ed user mem between
  Christian> kernel calls.

  Christian> On ia32 i succesfully do a lock_page() on every page
  Christian> returned by get_user_pages(), lateron i do unlock_page().
  Christian> On ia64 sometimes (on ia32 seemingly never) the first
  Christian> page is already locked, just after malloc().  For a quick
  Christian> hack i check all pages before trying to lock them, so
  Christian> that i am later just unlocking the not previously locked
  Christian> ones.

Umh, what page-size did you use?

In any case, a minimal test-program that reproduces the problem would
probably help you get an answer much faster.

Thanks,

	--david

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

* Re: pages already locked on ia64
  2003-11-14 10:22 pages already locked on ia64 Christian Hinkelbein
  2003-11-17 23:40 ` David Mosberger
@ 2003-11-21 15:17 ` Christian Hinkelbein
  2003-11-24  4:58 ` Andrew Morton
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Hinkelbein @ 2003-11-21 15:17 UTC (permalink / raw)
  To: linux-ia64

David Mosberger schrieb:

>>>>>>On Fri, 14 Nov 2003 11:22:23 +0100, Christian Hinkelbein <hinkelbein@ti.uni-mannheim.de> said:
> 
>   Christian> On ia32 i succesfully do a lock_page() on every page
>   Christian> returned by get_user_pages(), lateron i do unlock_page().
>   Christian> On ia64 sometimes (on ia32 seemingly never) the first
>   Christian> page is already locked, just after malloc().  For a quick
>   Christian> hack ......
> 
> Umh, what page-size did you use?
> 
> In any case, a minimal test-program that reproduces the problem would
> probably help you get an answer much faster.

Uuuh, thanks for the hint. It was the bigger page-size (16k) that 
triggered an old bug in my driver.

    christian


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

* Re: pages already locked on ia64
  2003-11-14 10:22 pages already locked on ia64 Christian Hinkelbein
  2003-11-17 23:40 ` David Mosberger
  2003-11-21 15:17 ` Christian Hinkelbein
@ 2003-11-24  4:58 ` Andrew Morton
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-11-24  4:58 UTC (permalink / raw)
  To: linux-ia64

Christian Hinkelbein <hinkelbein@ti.uni-mannheim.de> wrote:
>
> David Mosberger schrieb:
> 
> >>>>>>On Fri, 14 Nov 2003 11:22:23 +0100, Christian Hinkelbein <hinkelbein@ti.uni-mannheim.de> said:
> > 
> >   Christian> On ia32 i succesfully do a lock_page() on every page
> >   Christian> returned by get_user_pages(), lateron i do unlock_page().
> >   Christian> On ia64 sometimes (on ia32 seemingly never) the first
> >   Christian> page is already locked, just after malloc().  For a quick
> >   Christian> hack ......
> > 
> > Umh, what page-size did you use?
> > 
> > In any case, a minimal test-program that reproduces the problem would
> > probably help you get an answer much faster.
> 
> Uuuh, thanks for the hint. It was the bigger page-size (16k) that 
> triggered an old bug in my driver.
> 

Your driver is still buggy - you usually cannot lock more that one page at
a time.  Trivial case: mmap the same page of a file at two consecutive
addresses and ask your driver to access that 2*PAGE_SIZE chunk of memory. 
It will deadlock.

If you wish to make sure that the pages don't go away then elevating their
refcount is sufficient.


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

end of thread, other threads:[~2003-11-24  4:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-14 10:22 pages already locked on ia64 Christian Hinkelbein
2003-11-17 23:40 ` David Mosberger
2003-11-21 15:17 ` Christian Hinkelbein
2003-11-24  4:58 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox