Re: Getting Physical address of a buffer
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hKH77rQODiQAVUph5fNnvEuaIoVStl8VsOncC8fK5zE=; b=iDKrbdW/XPUXyBQk30nMwLY62x1KWjUoQUSaE+JGldBDodQYIx3z3gFvAf26nXKBMY gvZ900ox3PYDuw9di81gsd9J1kVGu4hpDveHFwJholoVpOnYLTN+7Jl2OPD+EEug7k6q dUi+D5mu31iQ/1yAoAXHDMqaG6nSmhtCOmrAU= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=A2rX6AHW9gugoikhGlIeKtYMBd1DqoWtSs3EJXpWfu2Ox62Vwx7zYe3u71zmXvwq+k CATyA0+ZKakpv7TZ5jLDV4vDkrzBRge3EuJXTanzM7Ef1z55dE5H7bBAx6tC0Y16pVU1 D+H24yMy09XIbIALR3ONpGJJxUI3g/jgUMsVg= On Mon, Aug 9, 2010 at 11:58 AM, chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil> wrote:
On Mon, 9 Aug 2010 11:38:54 -0700 shailesh jain <coolworldofshail@gmail.com> wrote:
@Mike - There are many instances where you will need physical addresses. Let me point out couple of them.
- Memory ballooning is a technique where in guest driver allocates pages in the guest and passes down PPNs to the hypervisor. Hypervisor takes this pages and gives it to another Virtual machine for its use. Hypervisor does Physical address to Machine address (actual address in Physical ram. w/o virtualization you would call this Physical address) mapping.
well you really dont need the physical addresses for these pages. you just need a mechanism to map the same physical range to multiple virtual ranges. you should probably be looking at the mach vm_* calls.
I am not sure I quite follow what you are talking about. This technique is more like pulling out one of the memory card from hardware and inserting into another physical box w/o any of the physical box knowing what happened. Because 1st box thinks that some driver is in need of memory and it is using it and 2nd box thinks "oh, I always had this memory." I clearly did not get what you are trying to say!
- Hypervisor wants to do fast IO - i.e read/write from/to guest memory directly. Again you need physical address (different from Machine address.)
cpu's generally do not operate on physical (or machine) addresses. they generally go through your page mapper. so even if you have the physical address, you will need to map it at some point so the hypervisor can actually do something with the memory. although, i suppose one could be passing around buffers from a driver but the driver would handle the virtual/physical issue.
@Terry - Things are all good only when you have OS being the bottom most layer (you have EFI et all, but still) . With virtualization - you have Hypervisor underneath. Things are complicated then.
Shailesh Jain
On Sat, Aug 7, 2010 at 2:42 PM, James C <james.from.wellington@gmail.com> wrote:
Hi Terry and Shailesh,
Re (4) below, hypothetically, could that include de-powering only some parts of physical memory, when they're not needed?
Shailesh, you know that the physical memory isn't contiguous. What would you think of being given the physical address of the first 0-byte segment? Why would that not meet your needs?
Regards, James.
Message: 4 Date: Fri, 6 Aug 2010 20:43:42 -0700 From: Terry Lambert <tlambert@apple.com> Subject: Re: Getting Physical address of a buffer To: shailesh jain <coolworldofshail@gmail.com> Cc: darwin-kernel@lists.apple.com Message-ID: <EC5425AB-CC65-4CF5-AFFA-1A015ED530B6@apple.com> Content-Type: text/plain; charset=us-ascii
This question gets asked every once in a while: "why do I have to use OS routines to talk to hardware?".
The basic answer is that there's virtual memory, there's wired memory, and then there's physical memory, and all three aren't the same thing.
There are several reasons that an OS that runs its kernel in a virtual address space doesn't want to give you physical address information directly; let's briefly hit the top four on my personal top ten list:
<snip>
(4) The OS likes to be kept informed of information for its own reasons so it can play tricks behind your back
The tricks themselves don't matter, what matters is that you enable performance and power management winds by following the rules; if you don't follow the rules, and try to avoid the OS interfaces, you also avoid the OS signaling mechanisms that are used to implement these optimization. Unfortunately for you, this is like declaring a variable that is modified out of scope, and not marking it volatile: failure to notify the OS of the nature of your access means the OS gets to do any optimization it wants. For a volatile variable, that may mean not exiting the work loop when the signal handler fires. For a device driver, it generally means a panic in the driver.
-- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/coolworldofshail%40gmai...
This email sent to coolworldofshail@gmail.com
-- Shailesh Jain _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
shailesh jain