Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89068
b: refs/heads/master
c: c9caa02
h: refs/heads/master
v: v3
  • Loading branch information
Andi Kleen authored and Ingo Molnar committed Apr 17, 2008
1 parent 4eb6d02 commit 5a55e23
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc6150321903ca4c3bc9d53b0cdafb05d77d64d0
refs/heads/master: c9caa02c529d5e113e40cbc77254558fcdfa4215
20 changes: 16 additions & 4 deletions trunk/arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct cpa_data {
int numpages;
int flushtlb;
unsigned long pfn;
unsigned force_split : 1;
};

#ifdef CONFIG_X86_64
Expand Down Expand Up @@ -262,6 +263,9 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
int i, do_split = 1;
unsigned int level;

if (cpa->force_split)
return 1;

spin_lock_irqsave(&pgd_lock, flags);
/*
* Check for races, another CPU might have split this page
Expand Down Expand Up @@ -696,7 +700,8 @@ static inline int cache_attr(pgprot_t attr)
}

static int change_page_attr_set_clr(unsigned long addr, int numpages,
pgprot_t mask_set, pgprot_t mask_clr)
pgprot_t mask_set, pgprot_t mask_clr,
int force_split)
{
struct cpa_data cpa;
int ret, cache, checkalias;
Expand All @@ -707,7 +712,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
*/
mask_set = canon_pgprot(mask_set);
mask_clr = canon_pgprot(mask_clr);
if (!pgprot_val(mask_set) && !pgprot_val(mask_clr))
if (!pgprot_val(mask_set) && !pgprot_val(mask_clr) && !force_split)
return 0;

/* Ensure we are PAGE_SIZE aligned */
Expand All @@ -724,6 +729,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
cpa.mask_set = mask_set;
cpa.mask_clr = mask_clr;
cpa.flushtlb = 0;
cpa.force_split = force_split;

/* No alias checking for _NX bit modifications */
checkalias = (pgprot_val(mask_set) | pgprot_val(mask_clr)) != _PAGE_NX;
Expand Down Expand Up @@ -762,13 +768,13 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
static inline int change_page_attr_set(unsigned long addr, int numpages,
pgprot_t mask)
{
return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0));
return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0);
}

static inline int change_page_attr_clear(unsigned long addr, int numpages,
pgprot_t mask)
{
return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask);
return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0);
}

int _set_memory_uc(unsigned long addr, int numpages)
Expand Down Expand Up @@ -847,6 +853,12 @@ int set_memory_np(unsigned long addr, int numpages)
return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_PRESENT));
}

int set_memory_4k(unsigned long addr, int numpages)
{
return change_page_attr_set_clr(addr, numpages, __pgprot(0),
__pgprot(0), 1);
}

int set_pages_uc(struct page *page, int numpages)
{
unsigned long addr = (unsigned long)page_address(page);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-x86/cacheflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int set_memory_nx(unsigned long addr, int numpages);
int set_memory_ro(unsigned long addr, int numpages);
int set_memory_rw(unsigned long addr, int numpages);
int set_memory_np(unsigned long addr, int numpages);
int set_memory_4k(unsigned long addr, int numpages);

void clflush_cache_range(void *addr, unsigned int size);

Expand Down

0 comments on commit 5a55e23

Please sign in to comment.