Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

686* driver/vminfo.c: Use CONFIG_COMPACTION to avoid compile time er…

…rors.
  • Loading branch information...
commit 30fc39c841852390bb8e3f66df3e5d9ad61d1b87 1 parent 9a2c47b
@dtrace4linux authored
View
6 .release
@@ -1,3 +1,3 @@
-date=Sat Feb 11 22:42:48 GMT 2012
-release=dtrace-20120211a
-build=375
+date=Sat Feb 25 22:05:33 GMT 2012
+release=dtrace-20120225
+build=376
View
13 Changes
@@ -1,3 +1,16 @@
+Fri Feb 24 19:21:39 2012 fox
+
+ 686* driver/vminfo.c: Use CONFIG_COMPACTION to avoid compile time errors.
+
+Fri Feb 17 23:43:53 2012 fox
+
+ 685* driver/x_call.c, driver/dtrace_linux.c: Changes to workaround
+ issues with accessing the GPL symbol apic.
+
+Thu Feb 16 21:00:48 2012 fox
+
+ 684* x_call.c: Make it GPL compliant.
+
Sat Feb 11 10:25:20 2012 fox
683* driver/dtrace_linux.h: Mark as CDDL driver.
View
12 driver/cyclic_linux.c
@@ -16,7 +16,7 @@
/* */
/* Paul Fox June 2008 */
/* */
-/* $Header: Last edited: 20-Mar-2011 1.3 $ */
+/* $Header: Last edited: 15-Feb-2012 1.4 $ */
/**********************************************************************/
#include "dtrace_linux.h"
@@ -111,6 +111,7 @@ static int (*fn_hrtimer_init)(struct hrtimer *timer, clockid_t which_clock,
static int (*fn_hrtimer_cancel)(struct hrtimer *);
static int (*fn_hrtimer_start)(struct hrtimer *timer, ktime_t tim,
const enum hrtimer_mode mode);
+static u64 (*fn_hrtimer_forward)(struct hrtimer *timer, ktime_t now, ktime_t interval);
#define TMR_ALIVE 1
#define TMR_RUNNING 2
@@ -144,6 +145,7 @@ init_cyclic()
fn_hrtimer_init = get_proc_addr("hrtimer_init");
fn_hrtimer_start = get_proc_addr("hrtimer_start");
fn_hrtimer_start = get_proc_addr("hrtimer_start");
+ fn_hrtimer_forward = get_proc_addr("hrtimer_forward");
if (fn_hrtimer_start == NULL) {
printk(KERN_WARNING "dtracedrv: Cannot locate hrtimer in this kernel\n");
@@ -255,12 +257,8 @@ be_callback(struct hrtimer *ptr)
/***********************************************/
/* Get ready for the next timer interval. */
/***********************************************/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
-# define hrtimer_forward_now(timer, interval) \
- hrtimer_forward(timer, timer->base->get_time(), interval)
-#endif
-
- hrtimer_forward_now(ptr, ktime_set(cp->c_sec, cp->c_nsec));
+ fn_hrtimer_forward(ptr, ptr->base->get_time(),
+ ktime_set(cp->c_sec, cp->c_nsec));
tasklet_schedule(&cyclic_tasklet);
View
28 driver/dtrace.c
@@ -6582,31 +6582,13 @@ HERE();
/***********************************************/
case DTRACEACT_TEST1:
PRINT_CASE("DTRACEACT_TEST1");
-{static int (*oprofile_start)(void);
-int err;
-if (oprofile_start == NULL)
- oprofile_start = get_proc_addr("oprofile_start");
-if (oprofile_start) {
- err = oprofile_start();
- printk("oprofile_start=%d\n", err);
-} else {
- printk("no oprofile_start loaded\n");
-}
-}
+val = native_read_pmc(0x79);
+size = sizeof (uint64_t);
+printk("rdpmc(%p)=%p\n", arg0, val);
+ DTRACE_STORE(uint64_t, tomax, offs, val);
continue;
case DTRACEACT_TEST2:
PRINT_CASE("DTRACEACT_TEST2");
-{static int (*oprofile_stop)(void);
-int err;
-if (oprofile_stop == NULL)
- oprofile_stop = get_proc_addr("oprofile_stop");
-if (oprofile_stop) {
- err = oprofile_stop();
- printk("oprofile_stop=%d\n", err);
-} else {
- printk("no oprofile_stop loaded\n");
-}
-}
continue;
#endif
@@ -10649,9 +10631,11 @@ PRINT_CASE("DTRACEACT_COMMIT");
#if linux
case DTRACEACT_TEST1:
PRINT_CASE("DTRACEACT_TEST1");
+ size = sizeof (uint64_t);
break;
case DTRACEACT_TEST2:
PRINT_CASE("DTRACEACT_TEST2");
+ size = sizeof (uint64_t);
break;
#endif
View
6 driver/dtrace_linux.c
@@ -281,6 +281,7 @@ void sdt_exit(void);
int systrace_init(void);
void systrace_exit(void);
void io_prov_init(void);
+void xcall_init(void);
//static void print_pte(pte_t *pte, int level);
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
@@ -634,7 +635,7 @@ dtrace_linux_init(void)
/* Let us grab the panics if we are in */
/* debug mode. */
/***********************************************/
-#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER
+#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER && 0
if (grab_panic)
atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier);
#endif
@@ -664,7 +665,7 @@ dtrace_linux_fini(void)
/***********************************************/
driver_initted = FALSE;
-#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER
+#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER && 0
if (grab_panic)
atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier);
#endif
@@ -1922,6 +1923,7 @@ syms_write(struct file *file, const char __user *buf,
hunt_init();
dtrace_linux_init();
+ xcall_init();
dtrace_profile_init();
dtrace_prcom_init();
dcpc_init();
View
5 driver/mutex.c
@@ -45,8 +45,11 @@ static const int disable_ints;
void
dmutex_init(mutex_t *mp)
{
+static DEFINE_SEMAPHORE(null_sema);
+
memset(mp, 0, sizeof *mp);
- sema_init(&mp->m_sem, 1);
+ mp->m_sem = null_sema;
+// sema_init(&mp->m_sem, 1);
mp->m_initted = TRUE;
}
View
4 driver/vminfo.c
@@ -13,7 +13,7 @@
/* each statistic, we provide a probe which intercepts the */
/* increment of that data item. */
/*--------------------------------------------------------------------*/
-/* $Header: Last edited: 26-Oct-2011 1.1 $ */
+/* $Header: Last edited: 24-Feb-2012 1.2 $ */
/**********************************************************************/
#include <linux/mm.h>
@@ -137,7 +137,7 @@ void vminfo_init(void)
sdt_add_locator(vm_event_addr(ALLOCSTALL), "vminfo:::allocstall");
sdt_add_locator(vm_event_addr(PGROTATED), "vminfo:::pgrotated");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
+#ifdef CONFIG_COMPACTION
sdt_add_locator(vm_event_addr(COMPACTBLOCKS), "vminfo:::compactblocks");
sdt_add_locator(vm_event_addr(COMPACTPAGES), "vminfo:::compactpages");
sdt_add_locator(vm_event_addr(COMPACTPAGEFAILED), "vminfo:::compactpagefailed");
View
59 driver/x_call.c
@@ -2,7 +2,20 @@
/* Code to implement cross-cpu calling for Dtrace. */
/* Author: Paul D. Fox */
/* Date: May 2011 */
+/* $Header: $ */
/**********************************************************************/
+
+/**********************************************************************/
+/* Bit of madness/strangeness here. If we are not GPL, then "apic" */
+/* (symbol) isnt accessible to us. We dont care, but theres a bug */
+/* in gcc/ld and <asm/ipi.h> because of static/inline functions */
+/* refer to "apic" even tho we dont use it. So, we #define it out */
+/* of harms way, and then, to avoid an undefined symbol reference */
+/* (which we didnt want), we define our own "hello_apic". I told */
+/* you it was strange. */
+/**********************************************************************/
+
+#define apic hello_apic
#include <linux/mm.h>
# undef zone
# define zone linux_zone
@@ -11,22 +24,13 @@
#include "dtrace_proto.h"
#include <linux/cpumask.h>
-#include <linux/errno.h>
-#include <linux/miscdevice.h>
-#include <linux/fs.h>
-#include <linux/proc_fs.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/sys.h>
-#include <linux/thread_info.h>
-#include <linux/smp.h>
#include <asm/smp.h>
-#include <linux/vmalloc.h>
-#include <asm/current.h>
-#include <asm/desc.h>
-#include <asm/hardirq.h>
#include <asm/ipi.h>
+struct apic *hello_apic; /* Define this because apic.h is broken when facing a */
+ /* non-GPL driver. We get an undefined, so define it. */
+ /* We use dynamic lookup instead. */
+struct apic *x_apic;
extern void dtrace_sync_func(void);
int in_xcall = -1;
@@ -98,6 +102,21 @@ static void send_ipi_interrupt(cpumask_t *mask, int vector);
void xcall_slave2(void);
/**********************************************************************/
+/* Called during driver startup to do one time initialisation, so */
+/* we dont end up doing symbol lookups in potentially critical */
+/* probe paths. */
+/**********************************************************************/
+void
+xcall_init(void)
+{
+ if ((x_apic = get_proc_addr("apic")) == NULL) {
+ dtrace_linux_panic("init_xcall: cannot locate 'apic'\n");
+ return;
+ }
+ x_apic = *(void **) x_apic;
+}
+
+/**********************************************************************/
/* Switch the interface from the orig dtrace_xcall code to the new */
/* code. As of 20110520, I cannot decide which one is worse. The */
/* orig code cannot come from a timer interrupt (hr_timer code */
@@ -531,7 +550,7 @@ send_ipi_interrupt(cpumask_t *mask, int vector)
# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
send_IPI_mask(*mask, vector);
# else
- apic->send_IPI_mask(mask, vector);
+ x_apic->send_IPI_mask(mask, vector);
# endif
}
/**********************************************************************/
@@ -547,7 +566,17 @@ xcall_slave(void)
smp_mb();
- ack_APIC_irq();
+ /***********************************************/
+ /* We want to call ack_APIC_irq, but we */
+ /* inline the expansion because of the GPL */
+ /* symbol issue. */
+ /* Once we do this, we can have more IPI */
+ /* interrupts arrive (but not until we exit */
+ /* the interrupt routine and re-enable */
+ /* interrupts). */
+ /***********************************************/
+ x_apic->write(APIC_EOI, 0);
+ //ack_APIC_irq();
}
void
xcall_slave2(void)
View
4 libdtrace/dt_open.c
@@ -310,9 +310,9 @@ static const dt_ident_t _dtrace_globals[] = {
DT_VERS_1_0, &dt_idops_func, "void(...)" },
#if linux
{ "test1", DT_IDENT_ACTFUNC, 0, DT_ACT_TEST1, DT_ATTR_STABCMN, DT_VERS_1_0,
- &dt_idops_func, "int()" },
+ &dt_idops_func, "uint64_t(uint64_t)" },
{ "test2", DT_IDENT_ACTFUNC, 0, DT_ACT_TEST2, DT_ATTR_STABCMN, DT_VERS_1_0,
- &dt_idops_func, "int()" },
+ &dt_idops_func, "uint64_t(uint64_t)" },
#endif
{ "panic", DT_IDENT_ACTFUNC, 0, DT_ACT_PANIC, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void()" },
Please sign in to comment.
Something went wrong with that request. Please try again.