2008-01-19 01:59:24

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 0/6] lguest patches for compiling x86_64

Right now, I have lguest in-tree module compiling on x86_64.
It's not yet on a sendable state, since the module itself isn't loading.

However, this subset of the series is pretty straightforward, and I'm sending it
now aiming at reducing the delta size in the future ;-)

Have fun,


2008-01-19 01:59:45

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 1/6] explicitly use ktime.h include

This patch adds the ktime.h header explicitly to hypercalls file,
and avoid depending on it being included somewhere else.

Signed-off-by: Glauber de Oliveira Costa <[email protected]>
---
drivers/lguest/hypercalls.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 32666d0..0f2cb4f 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -23,6 +23,7 @@
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/mm.h>
+#include <linux/ktime.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include "lg.h"
--
1.5.0.6

2008-01-19 01:59:59

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 2/6] explicitly use hrtimer.h include

This patch adds the hrtimer.h header explicitly to lg.h file,
and avoid depending on it being included somewhere else.

Signed-off-by: Glauber de Oliveira Costa <[email protected]>
---
drivers/lguest/lg.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index f9707cf..eb51fc2 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -8,6 +8,7 @@
#include <linux/lguest.h>
#include <linux/lguest_launcher.h>
#include <linux/wait.h>
+#include <linux/hrtimer.h>
#include <linux/err.h>
#include <asm/semaphore.h>

--
1.5.0.6

2008-01-19 02:00:42

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 3/6] explicitly use sched.h include

This patch adds the sched.h header explicitly to lguest_user file,
and avoid depending on it being included somewhere else.

Signed-off-by: Glauber de Oliveira Costa <[email protected]>
---
drivers/lguest/lguest_user.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index a87fca6..85d42d3 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -6,6 +6,7 @@
#include <linux/uaccess.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
+#include <linux/sched.h>
#include "lg.h"

/*L:055 When something happens, the Waker process needs a way to stop the
--
1.5.0.6

2008-01-19 02:00:55

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 4/6] use __PAGE_KERNEL instead of _PAGE_KERNEL

x86_64 don't expose the intermediate representation with one underline,
_PAGE_KERNEL, just the double-underlined one.

Use it, to get a common ground between 32 and 64-bit

Signed-off-by: Glauber de Oliveira Costa <[email protected]>
---
drivers/lguest/page_tables.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 399c05d..fb5ebd0 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -645,7 +645,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)

/* Make the last PGD entry for this Guest point to the Switcher's PTE
* page for this CPU (with appropriate flags). */
- switcher_pgd = __pgd(__pa(switcher_pte_page) | _PAGE_KERNEL);
+ switcher_pgd = __pgd(__pa(switcher_pte_page) | __PAGE_KERNEL);

cpu->lg->pgdirs[cpu->cpu_pgd].pgdir[SWITCHER_PGD_INDEX] = switcher_pgd;

@@ -657,7 +657,7 @@ void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
* page is already mapped there, we don't have to copy them out
* again. */
pfn = __pa(cpu->regs_page) >> PAGE_SHIFT;
- regs_pte = pfn_pte(pfn, __pgprot(_PAGE_KERNEL));
+ regs_pte = pfn_pte(pfn, __pgprot(__PAGE_KERNEL));
switcher_pte_page[(unsigned long)pages/PAGE_SIZE%PTRS_PER_PTE] = regs_pte;
}
/*:*/
--
1.5.0.6

2008-01-19 02:01:19

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 5/6] export check_tsc_unstable

Exporrt check_tsc_unstable function as GPL symbol. lguest is
a user of it.

Signed-off-by: Glauber de Oliveira Costa <[email protected]>
---
arch/x86/kernel/tsc_64.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index c62f3b6..947554d 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -92,10 +92,12 @@ sched_clock(void) __attribute__((alias("native_sched_clock")));

static int tsc_unstable;

-inline int check_tsc_unstable(void)
+int check_tsc_unstable(void)
{
return tsc_unstable;
}
+EXPORT_SYMBOL_GPL(check_tsc_unstable);
+
#ifdef CONFIG_CPU_FREQ

/* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
--
1.5.0.6

2008-01-19 02:01:36

by Glauber Costa

[permalink] [raw]
Subject: [PATCH 6/6] export __supported_pte_mask

export __supported_pte_mask variable as GPL symbol.
lguest is a user of it.

Signed-off-by: Glauber de Oliveira Costa <[email protected]>
---
arch/x86/kernel/setup64.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
index 8fa0de8..5cc1339 100644
--- a/arch/x86/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
@@ -41,6 +41,8 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));

unsigned long __supported_pte_mask __read_mostly = ~0UL;
+EXPORT_SYMBOL_GPL(__supported_pte_mask);
+
static int do_not_nx __cpuinitdata = 0;

/* noexec=on|off
--
1.5.0.6