public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Calculating kernel logical address ..
@ 2002-09-09 17:06 Imran Badr
  2002-09-09 17:29 ` Richard B. Johnson
  0 siblings, 1 reply; 49+ messages in thread
From: Imran Badr @ 2002-09-09 17:06 UTC (permalink / raw)
  To: 'David S. Miller', phillips; +Cc: linux-kernel


So, what you gurus suggest me to do? How can I get physical address of a
user buffer (which was originally mmap'ed() from a kmalloc() allocation) and
which would also be protable across multiple platforms?

Thanks.
Imran.


-----Original Message-----
From: David S. Miller [mailto:davem@redhat.com]
Sent: Sunday, September 08, 2002 10:28 PM
To: phillips@arcor.de
Cc: imran.badr@cavium.com; linux-kernel@vger.kernel.org
Subject: Re: Calculating kernel logical address ..


   From: Daniel Phillips <phillips@arcor.de>
   Date: Mon, 9 Sep 2002 07:17:30 +0200

   On Monday 09 September 2002 07:00, David S. Miller wrote:
   > Actually, KSEG0 the most Linux friendly design in the world
   > particularly in 64-bit mode.

   That's easy to say until you try and work with it (I assume you have,
   and forgot).  Just try to do a 3G/1G split on it, for example.

Maybe you missed the "64-bit mode" part of what I said. :-)

In 64-bit mode there is no need to do any kind of split.
You just use the KSEG mapping with full cache coherency for
all of physical memory as the PAGE_OFFSET area.

I forget if it was KSEG0 or some other number, but I know it
works.




^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Calculating kernel logical address ..
@ 2002-09-09 21:19 Manfred Spraul
  2002-09-09 21:47 ` Andrew Morton
  0 siblings, 1 reply; 49+ messages in thread
From: Manfred Spraul @ 2002-09-09 21:19 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton

Andrew Morton wrote:
> Nobody seems to have come forth to implement a thought-out scatter/gather,
> map-user-pages library infrastructure so I'd be a bit reluctant to
> break stuff without offering a replacement.
> 

We'd need one.

get_user_pages() is broken if a kernel module access the virtual address 
of the page and the cpu caches are not coherent:
Most of the flush functions need the vma pointer, but it's impossible to 
guarantee that it still exists when the get_user_pages() user calls 
page_cache_release().

--
	Manfred


^ permalink raw reply	[flat|nested] 49+ messages in thread
* RE: Calculating kernel logical address ..
@ 2002-09-09 21:02 Manfred Spraul
  2002-09-09 21:07 ` Imran Badr
  0 siblings, 1 reply; 49+ messages in thread
From: Manfred Spraul @ 2002-09-09 21:02 UTC (permalink / raw)
  To: Imran Badr, linux-kernel

>>As long as you can be sure they won't spontaneously vanish on you.
> 
>>--
>>Daniel
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>Please read the FAQ at  http://www.tux.org/lkml/
> 
> 
> 
> down(&current->mm->mmap_sem) would help.
> 

Wrong. Acquiring the mmap semaphore does NOT prevent the swapper from 
swapping out pages.

Only the page_table_lock prevents the swapper from touching a task.

--
	Manfred


^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: Calculating kernel logical address ..
@ 2002-09-06 15:44 Manfred Spraul
  2002-09-06 17:13 ` Imran Badr
  0 siblings, 1 reply; 49+ messages in thread
From: Manfred Spraul @ 2002-09-06 15:44 UTC (permalink / raw)
  To: Imran Badr; +Cc: linux-kernel

> adr = user_address;
> pgd_offset(current->mm, adr);
> 
> if (!pgd_none(*pgd)) {
> 	pmd = pmd_offset(pgd, adr);
> 	if (!pmd_none(*pmd)) {
> 		ptep = pte_offset(pmd, adr);
> 		pte = *ptep;
> 		if(pte_present(pte)) {
> 			kaddr  = (unsigned long) page_address(pte_page(pte));
> 			kaddr |= (adr & (PAGE_SIZE - 1));
> 		}
> 	}
> }
> 
> Will this code always give me correct kernel logical address?
> 
What about

	kmalloc_buffer+(user_address-vma->vm_start)

?
A driver should avoid accessing the page tables.

--
	Manfred


^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: side-by-side Re: BYTE Unix Benchmarks Version 3.6
@ 2002-09-06  3:23 Daniel Phillips
  2002-09-06  3:34 ` Calculating kernel logical address Imran Badr
  0 siblings, 1 reply; 49+ messages in thread
From: Daniel Phillips @ 2002-09-06  3:23 UTC (permalink / raw)
  To: bert hubert, Paolo Ciarrocchi; +Cc: linux-kernel

On Thursday 05 September 2002 15:48, bert hubert wrote:
> Arithmetic Test (type = arithoh)        3598100.4 lps    3435944.6 lps
> Arithmetic Test (type = register)        201521.0 lps     197870.4 lps
> Arithmetic Test (type = short)           190245.9 lps     145140.8 lps
> Arithmetic Test (type = int)             201904.5 lps     104440.5 lps
> Arithmetic Test (type = long)            201906.4 lps     177757.4 lps
> Arithmetic Test (type = float)           210562.7 lps     208476.4 lps
> Arithmetic Test (type = double)          210385.9 lps     208443.3 lps

What kind of arithmetic is this?  Why on earth would arithmetic vary
from one kernel to another?

-- 
Daniel

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

end of thread, other threads:[~2002-09-10 16:57 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-09 17:06 Calculating kernel logical address Imran Badr
2002-09-09 17:29 ` Richard B. Johnson
2002-09-09 17:23   ` David S. Miller
2002-09-09 17:34     ` Martin J. Bligh
2002-09-09 17:40     ` Daniel Phillips
2002-09-09 17:31   ` Imran Badr
2002-09-09 18:00     ` Richard B. Johnson
2002-09-09 18:12       ` Imran Badr
2002-09-09 18:27         ` Daniel Phillips
2002-09-09 18:41           ` Imran Badr
2002-09-09 21:55         ` Alan Cox
2002-09-09 22:52           ` Imran Badr
2002-09-09 23:09             ` Alan Cox
2002-09-09 18:13       ` Jesse Barnes
2002-09-09 18:25         ` Daniel Phillips
2002-09-09 19:40           ` Andrew Morton
2002-09-09 20:41             ` Daniel Phillips
2002-09-10  6:43               ` Jens Axboe
2002-09-10  7:12                 ` Andrew Morton
2002-09-09 18:42         ` Andrew Morton
2002-09-10  7:03           ` Gerd Knorr
2002-09-09 18:16       ` Kurt Ferreira
2002-09-09 18:17       ` David S. Miller
2002-09-09 18:17       ` Daniel Phillips
2002-09-09 18:43         ` Richard B. Johnson
2002-09-09 18:50           ` Daniel Phillips
2002-09-09 18:57             ` Richard B. Johnson
2002-09-09 18:08     ` Andrew Morton
2002-09-09 18:23       ` Daniel Phillips
2002-09-09 18:49         ` Imran Badr
2002-09-09 18:46           ` David S. Miller
2002-09-09 19:06           ` Daniel Phillips
2002-09-09 19:14             ` Andrew Morton
2002-09-09 19:23               ` Imran Badr
  -- strict thread matches above, loose matches on Subject: below --
2002-09-09 21:19 Manfred Spraul
2002-09-09 21:47 ` Andrew Morton
2002-09-10 17:01   ` Manfred Spraul
2002-09-09 21:02 Manfred Spraul
2002-09-09 21:07 ` Imran Badr
2002-09-06 15:44 Manfred Spraul
2002-09-06 17:13 ` Imran Badr
2002-09-07  1:57   ` Daniel Phillips
2002-09-06  3:23 side-by-side Re: BYTE Unix Benchmarks Version 3.6 Daniel Phillips
2002-09-06  3:34 ` Calculating kernel logical address Imran Badr
2002-09-07  1:44   ` Daniel Phillips
2002-09-08  0:01     ` David S. Miller
2002-09-08 18:44       ` Daniel Phillips
2002-09-09  5:00         ` David S. Miller
2002-09-09  5:17           ` Daniel Phillips
2002-09-09  5:28             ` David S. Miller

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