Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98403
b: refs/heads/master
c: 33852a1
h: refs/heads/master
i:
  98401: f146925
  98399: 7abdc7e
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jun 23, 2008
1 parent d70c62e commit 0fd6f48
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 165 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: 27f4837cbfd87126e733d098824544b6841a4eb8
refs/heads/master: 33852a1f2bb014e4047a844556c0d76a2f790c37
5 changes: 0 additions & 5 deletions trunk/arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,11 +1228,6 @@ asmlinkage void __init xen_start_kernel(void)
if (xen_feature(XENFEAT_supervisor_mode_kernel))
pv_info.kernel_rpl = 0;

/* Prevent unwanted bits from being set in PTEs. */
__supported_pte_mask &= ~_PAGE_GLOBAL;
if (!is_initial_xendomain())
__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);

/* set the limit of our address space */
xen_reserve_top();

Expand Down
56 changes: 26 additions & 30 deletions trunk/arch/x86/xen/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,54 +179,48 @@ void xen_set_pte_at(struct mm_struct *mm, unsigned long addr,
preempt_enable();
}

/* Assume pteval_t is equivalent to all the other *val_t types. */
static pteval_t pte_mfn_to_pfn(pteval_t val)
{
if (val & _PAGE_PRESENT) {
unsigned long mfn = (val & PTE_MASK) >> PAGE_SHIFT;
pteval_t flags = val & ~PTE_MASK;
val = (mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
}

return val;
}

static pteval_t pte_pfn_to_mfn(pteval_t val)
pteval_t xen_pte_val(pte_t pte)
{
if (val & _PAGE_PRESENT) {
unsigned long pfn = (val & PTE_MASK) >> PAGE_SHIFT;
pteval_t flags = val & ~PTE_MASK;
val = (pfn_to_mfn(pfn) << PAGE_SHIFT) | flags;
}
pteval_t ret = pte.pte;

return val;
}
if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;

pteval_t xen_pte_val(pte_t pte)
{
return pte_mfn_to_pfn(pte.pte);
return ret;
}

pgdval_t xen_pgd_val(pgd_t pgd)
{
return pte_mfn_to_pfn(pgd.pgd);
pgdval_t ret = pgd.pgd;
if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
return ret;
}

pte_t xen_make_pte(pteval_t pte)
{
pte = pte_pfn_to_mfn(pte);
return native_make_pte(pte);
if (pte & _PAGE_PRESENT) {
pte = phys_to_machine(XPADDR(pte)).maddr;
pte &= ~(_PAGE_PCD | _PAGE_PWT);
}

return (pte_t){ .pte = pte };
}

pgd_t xen_make_pgd(pgdval_t pgd)
{
pgd = pte_pfn_to_mfn(pgd);
return native_make_pgd(pgd);
if (pgd & _PAGE_PRESENT)
pgd = phys_to_machine(XPADDR(pgd)).maddr;

return (pgd_t){ pgd };
}

pmdval_t xen_pmd_val(pmd_t pmd)
{
return pte_mfn_to_pfn(pmd.pmd);
pmdval_t ret = native_pmd_val(pmd);
if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
return ret;
}
#ifdef CONFIG_X86_PAE
void xen_set_pud(pud_t *ptr, pud_t val)
Expand Down Expand Up @@ -273,7 +267,9 @@ void xen_pmd_clear(pmd_t *pmdp)

pmd_t xen_make_pmd(pmdval_t pmd)
{
pmd = pte_pfn_to_mfn(pmd);
if (pmd & _PAGE_PRESENT)
pmd = phys_to_machine(XPADDR(pmd)).maddr;

return native_make_pmd(pmd);
}
#else /* !PAE */
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/xen/xen-head.S
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ENTRY(startup_xen)

__FINIT

.pushsection .text
.pushsection .bss.page_aligned
.align PAGE_SIZE_asm
ENTRY(hypercall_page)
.skip 0x1000
Expand Down
6 changes: 1 addition & 5 deletions trunk/drivers/infiniband/hw/mthca/mthca_memfree.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ static int mthca_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_m
{
struct page *page;

/*
* Use __GFP_ZERO because buggy firmware assumes ICM pages are
* cleared, and subtle failures are seen if they aren't.
*/
page = alloc_pages(gfp_mask | __GFP_ZERO, order);
page = alloc_pages(gfp_mask, order);
if (!page)
return -ENOMEM;

Expand Down
15 changes: 6 additions & 9 deletions trunk/drivers/lguest/x86/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
* we set it now, so we can trap and pass that trap to the Guest if it
* uses the FPU. */
if (cpu->ts)
unlazy_fpu(current);
lguest_set_ts();

/* SYSENTER is an optimized way of doing system calls. We can't allow
* it because it always jumps to privilege level 0. A normal Guest
Expand All @@ -196,23 +196,20 @@ void lguest_arch_run_guest(struct lg_cpu *cpu)
* trap made the switcher code come back, and an error code which some
* traps set. */

/* Restore SYSENTER if it's supposed to be on. */
if (boot_cpu_has(X86_FEATURE_SEP))
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);

/* If the Guest page faulted, then the cr2 register will tell us the
* bad virtual address. We have to grab this now, because once we
* re-enable interrupts an interrupt could fault and thus overwrite
* cr2, or we could even move off to a different CPU. */
if (cpu->regs->trapnum == 14)
cpu->arch.last_pagefault = read_cr2();
/* Similarly, if we took a trap because the Guest used the FPU,
* we have to restore the FPU it expects to see.
* math_state_restore() may sleep and we may even move off to
* a different CPU. So all the critical stuff should be done
* before this. */
* we have to restore the FPU it expects to see. */
else if (cpu->regs->trapnum == 7)
math_state_restore();

/* Restore SYSENTER if it's supposed to be on. */
if (boot_cpu_has(X86_FEATURE_SEP))
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
}

/*H:130 Now we've examined the hypercall code; our Guest can make requests.
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)

#ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */
/* Clear master flag /before/ clearing selector flag. */
wmb();
rmb();
#endif
pending_words = xchg(&vcpu_info->evtchn_pending_sel, 0);
while (pending_words != 0) {
Expand Down
68 changes: 40 additions & 28 deletions trunk/fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,8 +1216,6 @@ static int nfs_validate_mount_data(void *options,
{
struct nfs_mount_data *data = (struct nfs_mount_data *)options;

memset(args, 0, sizeof(*args));

if (data == NULL)
goto out_no_data;

Expand Down Expand Up @@ -1585,24 +1583,29 @@ static int nfs_get_sb(struct file_system_type *fs_type,
{
struct nfs_server *server = NULL;
struct super_block *s;
struct nfs_fh mntfh;
struct nfs_parsed_mount_data data;
struct nfs_parsed_mount_data *data;
struct nfs_fh *mntfh;
struct dentry *mntroot;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
struct nfs_sb_mountdata sb_mntdata = {
.mntflags = flags,
};
int error;
int error = -ENOMEM;

security_init_mnt_opts(&data.lsm_opts);
data = kzalloc(sizeof(*data), GFP_KERNEL);
mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
if (data == NULL || mntfh == NULL)
goto out_free_fh;

security_init_mnt_opts(&data->lsm_opts);

/* Validate the mount data */
error = nfs_validate_mount_data(raw_data, &data, &mntfh, dev_name);
error = nfs_validate_mount_data(raw_data, data, mntfh, dev_name);
if (error < 0)
goto out;

/* Get a volume representation */
server = nfs_create_server(&data, &mntfh);
server = nfs_create_server(data, mntfh);
if (IS_ERR(server)) {
error = PTR_ERR(server);
goto out;
Expand Down Expand Up @@ -1630,16 +1633,16 @@ static int nfs_get_sb(struct file_system_type *fs_type,

if (!s->s_root) {
/* initial superblock/root creation */
nfs_fill_super(s, &data);
nfs_fill_super(s, data);
}

mntroot = nfs_get_root(s, &mntfh);
mntroot = nfs_get_root(s, mntfh);
if (IS_ERR(mntroot)) {
error = PTR_ERR(mntroot);
goto error_splat_super;
}

error = security_sb_set_mnt_opts(s, &data.lsm_opts);
error = security_sb_set_mnt_opts(s, &data->lsm_opts);
if (error)
goto error_splat_root;

Expand All @@ -1649,9 +1652,12 @@ static int nfs_get_sb(struct file_system_type *fs_type,
error = 0;

out:
kfree(data.nfs_server.hostname);
kfree(data.mount_server.hostname);
security_free_mnt_opts(&data.lsm_opts);
kfree(data->nfs_server.hostname);
kfree(data->mount_server.hostname);
security_free_mnt_opts(&data->lsm_opts);
out_free_fh:
kfree(mntfh);
kfree(data);
return error;

out_err_nosb:
Expand Down Expand Up @@ -1800,8 +1806,6 @@ static int nfs4_validate_mount_data(void *options,
struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
char *c;

memset(args, 0, sizeof(*args));

if (data == NULL)
goto out_no_data;

Expand Down Expand Up @@ -1959,26 +1963,31 @@ static int nfs4_validate_mount_data(void *options,
static int nfs4_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
{
struct nfs_parsed_mount_data data;
struct nfs_parsed_mount_data *data;
struct super_block *s;
struct nfs_server *server;
struct nfs_fh mntfh;
struct nfs_fh *mntfh;
struct dentry *mntroot;
int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
struct nfs_sb_mountdata sb_mntdata = {
.mntflags = flags,
};
int error;
int error = -ENOMEM;

security_init_mnt_opts(&data.lsm_opts);
data = kzalloc(sizeof(*data), GFP_KERNEL);
mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
if (data == NULL || mntfh == NULL)
goto out_free_fh;

security_init_mnt_opts(&data->lsm_opts);

/* Validate the mount data */
error = nfs4_validate_mount_data(raw_data, &data, dev_name);
error = nfs4_validate_mount_data(raw_data, data, dev_name);
if (error < 0)
goto out;

/* Get a volume representation */
server = nfs4_create_server(&data, &mntfh);
server = nfs4_create_server(data, mntfh);
if (IS_ERR(server)) {
error = PTR_ERR(server);
goto out;
Expand Down Expand Up @@ -2009,13 +2018,13 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
nfs4_fill_super(s);
}

mntroot = nfs4_get_root(s, &mntfh);
mntroot = nfs4_get_root(s, mntfh);
if (IS_ERR(mntroot)) {
error = PTR_ERR(mntroot);
goto error_splat_super;
}

error = security_sb_set_mnt_opts(s, &data.lsm_opts);
error = security_sb_set_mnt_opts(s, &data->lsm_opts);
if (error)
goto error_splat_root;

Expand All @@ -2025,10 +2034,13 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
error = 0;

out:
kfree(data.client_address);
kfree(data.nfs_server.export_path);
kfree(data.nfs_server.hostname);
security_free_mnt_opts(&data.lsm_opts);
kfree(data->client_address);
kfree(data->nfs_server.export_path);
kfree(data->nfs_server.hostname);
security_free_mnt_opts(&data->lsm_opts);
out_free_fh:
kfree(mntfh);
kfree(data);
return error;

out_free:
Expand Down
Loading

0 comments on commit 0fd6f48

Please sign in to comment.