Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Mark Lobo <ntdeveloper2002@yahoo.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: kernel addresses
Date: 28 Oct 2002 22:26:27 +0000	[thread overview]
Message-ID: <1035843987.1965.75.camel@irongate.swansea.linux.org.uk> (raw)
In-Reply-To: <20021028212220.80695.qmail@web80312.mail.yahoo.com>

On Mon, 2002-10-28 at 21:22, Mark Lobo wrote:
> Had a couple of simple questions.
> 1) What exactly is the difference between Kernel
> logical and kernel virtual addresses? is the kernel
> logical address the address space of the kernel? 
> Seems like kernel logical address have a constant
> offset from the physical address, and kernel virtual
> addresses dont. Its slightly confusing on why have
> these two separate terms at all? a kmalloced buffer
> gives a logical address, but a vmalloced gives a
> kernel virtual address. This kind of terminology
> confused me!

[Intel]
The kernel is mapped at 0xC0000000. It occupies a physically contiguous 
space somewhere aroud 0x100000. Memory you alloc with kmalloc comes out
of that mapping and is physically linear. So an 8K block consists of two
physically adjacent pages. Vmalloc allocates stuff by grabbing random
pages, mapping them again into the memory map and giving you something
which is seen as one linear range by virtual address but in fact
consists of multiple randomly distributed physical pages.

[General Purpose Answer]
You don't need to care. Anything you are using for DMA should go via the
PCI mapping API (see Documentation/DMA*). That will hand you back both
virtual addresses and DMA addresses.

> 2) If a SCSI command is passed by a user level app, is
> there a buffer copy involved before it gets to the
> scsi initiator? I saw something about bounce buffers,
> but wasnt quite sure what it meant. So what are bounce
> buffers used for? 
> Does the original buffer allocated by the user get
> mapped into a kernel virtual ( or logical???) address,
> locked down and passed down the stack? 

By the time it hits your SCSI driver it is locked into memory. Where it
came from you don't know and don't need to know. It may be locked user
memory it may be kernel space.

We use bounce buffers when something is at an address the card thinks it
cannot reach. Eg above 16Mb for ISA or above 4Gb for non DAC PCI cards


  reply	other threads:[~2002-10-28 22:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-28 21:22 kernel addresses Mark Lobo
2002-10-28 22:26 ` Alan Cox [this message]
     [not found] <20021028230140.79410.qmail@web80305.mail.yahoo.com>
2002-10-28 23:26 ` Alan Cox
2002-10-28 23:54   ` Mark Lobo
2002-10-29  0:22     ` Alan Cox
2002-10-29  0:36       ` Mark Lobo
2002-10-29  1:07         ` Alan Cox
     [not found] <20021029010744.83318.qmail@web80301.mail.yahoo.com>
2002-10-29  9:46 ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1035843987.1965.75.camel@irongate.swansea.linux.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ntdeveloper2002@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox