From: Richard Weinberger <richard@nod.at>
To: Nicolai Stange <nicstange@gmail.com>
Cc: user-mode-linux-devel@lists.sourceforge.net,
Jeff Dike <jdike@addtoit.com>,
linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
user-mode-linux-user@lists.sourceforge.net,
Dan Williams <dan.j.williams@intel.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [uml-devel] [PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val()
Date: Sun, 31 Jan 2016 10:11:40 +0100 [thread overview]
Message-ID: <56ADCFCC.4030207@nod.at> (raw)
In-Reply-To: <87bn845ufn.fsf@gmail.com>
Am 29.01.2016 um 15:31 schrieb Nicolai Stange:
>>> Question 1: now that ->pte_high will be gone, do you want to have
>>> ->pte_low renamed to e.g. ->pte_val?
>>
>> So, with a freshly booted brain the story looks a bit different.
>> All this code needs a cleanup and we need to check what other archs do
>> before we change pte_val(). Are you ready for some research? :)
>
> So this is what arch/x86 does:
>
> 1.) typedef a pteval_t to a type matching the underlying hardware's
> native PTE size.
> Examples:
> - x86: arch/x86/include/asm/pgtable-2level_types.h -- unsigned long
> - x86(PAE): arch/x86/include/asm/pgtable-3level_types.h -- u64
> - x86_64: arch/x86/include/asm/pgtable_64_types.h -- unsigned long
>
> 2.) pte_t is typedefed to either a struct or union like this:
>
> typedef struct { pteval_t pte; } pte_t;
>
> In the case of a union (x86 and x86 w/ PAE), an additional member
> 'pte_low' is introduced, aliasing the low half of ->pte.
>
> Now, all three x86-arch cases define typedef a pgprotval_t matching their
> respective pteval_t type and have a common then
>
> typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;
>
> Basically, mk_pte(page, pgprot) shifts the page's physical address to
> some architecturally defined point (PAGE_SHIFT) within pteval_t and ors
> the architecturally defined protection flags (_PAGE_*) in.
>
> Of course, the protection flags are defined such that hardware
> eventually finds them at the expected place within the final PTE
> (c.f. arch/x86/include/asm/pgtable_types.h).
>
>
> Summarizing:
> The content of pteval_t is completely architecture dependent. The only
> semantics on pte values defined for out-of-arch users, e.g. mm/gup.c
> seems to be equality on a pte_val(pte).
>
Thanks for doing the research!
> Finally, the page protection flags defined for UML do not have any bit
> at a position greater than 9 assigned to them
> (c.g. arch/um/include/asm/pgtable.h). (If that had been the case, we had
> been in trouble already because protection flags are only or'ed into
> ->pte_low).
>
>
> Thus, under the assumption that with UML, physical addresses are always
> 32 bits, I would say that it is safe to change pte_t.
>
>
> Proposal:
> Introduce pteval_t and pgprotval_t like x86 does and do
>
> typedef struct { pteval_t pte; } pte_t;
> typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;
>
> Change the pte macros accordingly.
Makes sense.
> What about pgd_t and pmd_t?
What do you mean? AFAICT we can keep them as-is.
So, please redo your patch such that we can merge it as soon as possible
to have the build warning fixed.
Thanks,
//richard
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard@nod.at>
To: Nicolai Stange <nicstange@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jeff Dike <jdike@addtoit.com>,
Andrew Morton <akpm@linux-foundation.org>,
user-mode-linux-devel@lists.sourceforge.net,
user-mode-linux-user@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val()
Date: Sun, 31 Jan 2016 10:11:40 +0100 [thread overview]
Message-ID: <56ADCFCC.4030207@nod.at> (raw)
In-Reply-To: <87bn845ufn.fsf@gmail.com>
Am 29.01.2016 um 15:31 schrieb Nicolai Stange:
>>> Question 1: now that ->pte_high will be gone, do you want to have
>>> ->pte_low renamed to e.g. ->pte_val?
>>
>> So, with a freshly booted brain the story looks a bit different.
>> All this code needs a cleanup and we need to check what other archs do
>> before we change pte_val(). Are you ready for some research? :)
>
> So this is what arch/x86 does:
>
> 1.) typedef a pteval_t to a type matching the underlying hardware's
> native PTE size.
> Examples:
> - x86: arch/x86/include/asm/pgtable-2level_types.h -- unsigned long
> - x86(PAE): arch/x86/include/asm/pgtable-3level_types.h -- u64
> - x86_64: arch/x86/include/asm/pgtable_64_types.h -- unsigned long
>
> 2.) pte_t is typedefed to either a struct or union like this:
>
> typedef struct { pteval_t pte; } pte_t;
>
> In the case of a union (x86 and x86 w/ PAE), an additional member
> 'pte_low' is introduced, aliasing the low half of ->pte.
>
> Now, all three x86-arch cases define typedef a pgprotval_t matching their
> respective pteval_t type and have a common then
>
> typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;
>
> Basically, mk_pte(page, pgprot) shifts the page's physical address to
> some architecturally defined point (PAGE_SHIFT) within pteval_t and ors
> the architecturally defined protection flags (_PAGE_*) in.
>
> Of course, the protection flags are defined such that hardware
> eventually finds them at the expected place within the final PTE
> (c.f. arch/x86/include/asm/pgtable_types.h).
>
>
> Summarizing:
> The content of pteval_t is completely architecture dependent. The only
> semantics on pte values defined for out-of-arch users, e.g. mm/gup.c
> seems to be equality on a pte_val(pte).
>
Thanks for doing the research!
> Finally, the page protection flags defined for UML do not have any bit
> at a position greater than 9 assigned to them
> (c.g. arch/um/include/asm/pgtable.h). (If that had been the case, we had
> been in trouble already because protection flags are only or'ed into
> ->pte_low).
>
>
> Thus, under the assumption that with UML, physical addresses are always
> 32 bits, I would say that it is safe to change pte_t.
>
>
> Proposal:
> Introduce pteval_t and pgprotval_t like x86 does and do
>
> typedef struct { pteval_t pte; } pte_t;
> typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;
>
> Change the pte macros accordingly.
Makes sense.
> What about pgd_t and pmd_t?
What do you mean? AFAICT we can keep them as-is.
So, please redo your patch such that we can merge it as soon as possible
to have the build warning fixed.
Thanks,
//richard
next prev parent reply other threads:[~2016-01-31 9:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-28 23:56 [PATCH] um: asm/page.h: zero out a pte's high value in set_pte_val() Nicolai Stange
2016-01-29 0:44 ` Richard Weinberger
2016-01-29 1:32 ` Nicolai Stange
2016-01-29 8:47 ` Richard Weinberger
2016-01-29 14:31 ` Nicolai Stange
2016-01-31 9:11 ` Richard Weinberger [this message]
2016-01-31 9:11 ` Richard Weinberger
2016-01-31 15:09 ` [PATCH v2] um: asm/page.h: remove the pte_high member from struct pte_t Nicolai Stange
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=56ADCFCC.4030207@nod.at \
--to=richard@nod.at \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicstange@gmail.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=user-mode-linux-user@lists.sourceforge.net \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.