linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Andi Kleen <ak@suse.de>
Cc: lkml <linux-kernel@vger.kernel.org>, discuss@x86-64.org
Subject: Re: Question regarding x86_64 __PHYSICAL_MASK_SHIFT
Date: Wed, 05 Oct 2005 13:01:23 +0900	[thread overview]
Message-ID: <43435013.6040303@gmail.com> (raw)
In-Reply-To: <200510042127.21238.ak@suse.de>


  Hello, Andi.

Andi Kleen wrote:
> On Tuesday 04 October 2005 21:19, Tejun Heo wrote:
> 
> 
>>  Hmmm.. but, currently
>>
>>* PHYSICAL_PAGE_MASK == (~(PAGE_SIZE-1)&(__PHYSICAL_MASK << PAGE_SHIFT)
>>	== (0xffffffff_fffff000 & (0x00003fff_ffffffff << 12)
>>  	== 0x03ffffff_fffff000
>>  while it actually should be 0x00003fff_fffff000
> 
> 
> Right. Fixed now
> 
> 
>>* PTE_FILE_MAX_BITS == __PHYSICAL_MASK_SHIFT == 46, but only 40bits are
>>available in page table entries.
> 
> 
> The non linear mapping format is independent from the MMU, the number
> is pretty much arbitary, but it is consistent to make it the same as
> other ptes for easier sanity checking.

  Okay, please forgive me if I'm bugging you with something stupid but I 
still don't quite get it.  When using NONLINEAR mapping, pgoff is stored 
to pte to use later when faulting in the page.  Storing and reading 
pgoff are done with the following macros.

#define pte_to_pgoff(pte) \
	((pte_val(pte) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
#define pgoff_to_pte(off) \
	((pte_t) { ((off) << PAGE_SHIFT) | _PAGE_FILE })

  In pte_to_pgoff we're masking pte value with PHYSICAL_PAGE_MASK which 
gives us 34bits with patches applied.  This means that if a pgoff goes 
through pgoff_to_pte and then pte_to_pgoff only 34bits survive.

  sys_remap_file_pages() checks if required pgoff's fit in pte's using 
PTE_FILE_MAX_BITS.

#define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT

  Which is 46 with patches applied.  Meaning that we could end up 
shoving up value larger than 34bits into pte and losing information when 
reading back (and it's only 16GB!).

  So, IMHO, we should either shrink PTE_FILE_MAX_BITS to 36 or change 
pte_to_pgoff/pgoff_to_pte macros to carry more bits (as pte bits 52-62 
are available, we can shove 46bits easily).

  No?

-- 
tejun

      reply	other threads:[~2005-10-05  4:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-04 11:59 Question regarding x86_64 __PHYSICAL_MASK_SHIFT Tejun Heo
2005-10-04 12:02 ` Tejun Heo
2005-10-04 17:24 ` Andi Kleen
2005-10-04 18:52   ` Tejun Heo
2005-10-04 19:01     ` Andi Kleen
2005-10-04 19:19       ` Tejun Heo
2005-10-04 19:27         ` Andi Kleen
2005-10-05  4:01           ` Tejun Heo [this message]

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=43435013.6040303@gmail.com \
    --to=htejun@gmail.com \
    --cc=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).