lkml.org 
[lkml]   [2007]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] x86: unify pgtable*.h
Eduardo Habkost wrote:
> On Wed, Dec 19, 2007 at 02:35:36PM -0800, Jeremy Fitzhardinge wrote:
>
>> +static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
>> +static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
>> +static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
>> +static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; }
>> +static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
>> +static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
>> +static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
>> +static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; }
>> +static inline pte_t pte_clrhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_PSE)); return pte; }
>>
>
>
> Is set_pte() really supposed to be used here? pte_val() and __pte()
> are already hooked by paravirt_ops if needed, and it looks like we
> don't want to call paravirt_ops set_pte() here.
>

No, you're right. That looks pretty stupid. It will work, but it's
clearly sub-optimal.


> I don't know if I understood fully the semantics of set_pte(), but
> it seems that the paravirt_ops implementations expect set_pte() to be
> called for PTEs that are actually inside existing pagetables (and not
> for short-lived stack variables, like on this case).
>
> Was this tested under Xen and/or VMI?
>
Yes, Xen. It's always OK to use set_pte on something that isn't
actually part of a pagetable, since it can be used on pagetables which
are under construction. But it may end up doing too much work.

J


\
 
 \ /
  Last update: 2007-12-20 22:05    [W:0.154 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site