Subject: Re: [PATCH v6 00/15] memory-hotplug: hot-remove physical memory

From: Tang Chen <[email-masked]>
Date: Fri, 01 Feb 2013 10:42:18 +0800

Hi Simon,

On 02/01/2013 10:17 AM, Simon Jeons wrote:
>> For example:
>>
>>                                          64TB, what ever
>>      xxxTB, what ever
>> logic address space:     |_____kernel_______|_________user_________________|
>>                                          \  \  /  /
>>                                           \  /\  /
>> physical address space:              |___\/__\/_____________|  4GB or
>> 8GB, what ever
>>                                             *****
>
> How much address space user process can have on x86_64? Also 8GB?

Usually, we don't say that.

8GB is your physical memory, right ?
But kernel space and user space is the logic conception in OS. They are 
in logic
address space.

So both the kernel space and the user space can use all the physical memory.
But if the page is already in use by either of them, the other one 
cannot use it.
For example, some pages are direct mapped to kernel, and is in use by 
kernel, the
user space cannot map it.

>
>>
>> The ***** part physical is mapped to user space in the process' own
>> pagetable.
>> It is also direct mapped in kernel's pagetable. So the kernel can also
>> access it. :)
>
> But how to protect user process not modify kernel memory?

This is the job of CPU. On intel cpus, user space code is running in 
level 3, and
kernel space code is running in level 0. So the code in level 3 cannot 
access the data
segment in level 0.

Thanks. :)