Skip to content

Commit 30fc39c

Browse files
committed
686* driver/vminfo.c: Use CONFIG_COMPACTION to avoid compile time errors.
1 parent 9a2c47b commit 30fc39c

9 files changed

Lines changed: 83 additions & 54 deletions

File tree

.release

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
date=Sat Feb 11 22:42:48 GMT 2012
2-
release=dtrace-20120211a
3-
build=375
1+
date=Sat Feb 25 22:05:33 GMT 2012
2+
release=dtrace-20120225
3+
build=376

Changes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
Fri Feb 24 19:21:39 2012 fox
2+
3+
686* driver/vminfo.c: Use CONFIG_COMPACTION to avoid compile time errors.
4+
5+
Fri Feb 17 23:43:53 2012 fox
6+
7+
685* driver/x_call.c, driver/dtrace_linux.c: Changes to workaround
8+
issues with accessing the GPL symbol apic.
9+
10+
Thu Feb 16 21:00:48 2012 fox
11+
12+
684* x_call.c: Make it GPL compliant.
13+
114
Sat Feb 11 10:25:20 2012 fox
215

316
683* driver/dtrace_linux.h: Mark as CDDL driver.

driver/cyclic_linux.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/* */
1717
/* Paul Fox June 2008 */
1818
/* */
19-
/* $Header: Last edited: 20-Mar-2011 1.3 $ */
19+
/* $Header: Last edited: 15-Feb-2012 1.4 $ */
2020
/**********************************************************************/
2121

2222
#include "dtrace_linux.h"
@@ -111,6 +111,7 @@ static int (*fn_hrtimer_init)(struct hrtimer *timer, clockid_t which_clock,
111111
static int (*fn_hrtimer_cancel)(struct hrtimer *);
112112
static int (*fn_hrtimer_start)(struct hrtimer *timer, ktime_t tim,
113113
const enum hrtimer_mode mode);
114+
static u64 (*fn_hrtimer_forward)(struct hrtimer *timer, ktime_t now, ktime_t interval);
114115

115116
#define TMR_ALIVE 1
116117
#define TMR_RUNNING 2
@@ -144,6 +145,7 @@ init_cyclic()
144145
fn_hrtimer_init = get_proc_addr("hrtimer_init");
145146
fn_hrtimer_start = get_proc_addr("hrtimer_start");
146147
fn_hrtimer_start = get_proc_addr("hrtimer_start");
148+
fn_hrtimer_forward = get_proc_addr("hrtimer_forward");
147149

148150
if (fn_hrtimer_start == NULL) {
149151
printk(KERN_WARNING "dtracedrv: Cannot locate hrtimer in this kernel\n");
@@ -255,12 +257,8 @@ be_callback(struct hrtimer *ptr)
255257
/***********************************************/
256258
/* Get ready for the next timer interval. */
257259
/***********************************************/
258-
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
259-
# define hrtimer_forward_now(timer, interval) \
260-
hrtimer_forward(timer, timer->base->get_time(), interval)
261-
#endif
262-
263-
hrtimer_forward_now(ptr, ktime_set(cp->c_sec, cp->c_nsec));
260+
fn_hrtimer_forward(ptr, ptr->base->get_time(),
261+
ktime_set(cp->c_sec, cp->c_nsec));
264262

265263
tasklet_schedule(&cyclic_tasklet);
266264

driver/dtrace.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6582,31 +6582,13 @@ HERE();
65826582
/***********************************************/
65836583
case DTRACEACT_TEST1:
65846584
PRINT_CASE("DTRACEACT_TEST1");
6585-
{static int (*oprofile_start)(void);
6586-
int err;
6587-
if (oprofile_start == NULL)
6588-
oprofile_start = get_proc_addr("oprofile_start");
6589-
if (oprofile_start) {
6590-
err = oprofile_start();
6591-
printk("oprofile_start=%d\n", err);
6592-
} else {
6593-
printk("no oprofile_start loaded\n");
6594-
}
6595-
}
6585+
val = native_read_pmc(0x79);
6586+
size = sizeof (uint64_t);
6587+
printk("rdpmc(%p)=%p\n", arg0, val);
6588+
DTRACE_STORE(uint64_t, tomax, offs, val);
65966589
continue;
65976590
case DTRACEACT_TEST2:
65986591
PRINT_CASE("DTRACEACT_TEST2");
6599-
{static int (*oprofile_stop)(void);
6600-
int err;
6601-
if (oprofile_stop == NULL)
6602-
oprofile_stop = get_proc_addr("oprofile_stop");
6603-
if (oprofile_stop) {
6604-
err = oprofile_stop();
6605-
printk("oprofile_stop=%d\n", err);
6606-
} else {
6607-
printk("no oprofile_stop loaded\n");
6608-
}
6609-
}
66106592
continue;
66116593
#endif
66126594

@@ -10649,9 +10631,11 @@ PRINT_CASE("DTRACEACT_COMMIT");
1064910631
#if linux
1065010632
case DTRACEACT_TEST1:
1065110633
PRINT_CASE("DTRACEACT_TEST1");
10634+
size = sizeof (uint64_t);
1065210635
break;
1065310636
case DTRACEACT_TEST2:
1065410637
PRINT_CASE("DTRACEACT_TEST2");
10638+
size = sizeof (uint64_t);
1065510639
break;
1065610640
#endif
1065710641

driver/dtrace_linux.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ void sdt_exit(void);
281281
int systrace_init(void);
282282
void systrace_exit(void);
283283
void io_prov_init(void);
284+
void xcall_init(void);
284285
//static void print_pte(pte_t *pte, int level);
285286

286287
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 21)
@@ -634,7 +635,7 @@ dtrace_linux_init(void)
634635
/* Let us grab the panics if we are in */
635636
/* debug mode. */
636637
/***********************************************/
637-
#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER
638+
#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER && 0
638639
if (grab_panic)
639640
atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier);
640641
#endif
@@ -664,7 +665,7 @@ dtrace_linux_fini(void)
664665
/***********************************************/
665666
driver_initted = FALSE;
666667

667-
#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER
668+
#if HAVE_ATOMIC_NOTIFIER_CHAIN_REGISTER && 0
668669
if (grab_panic)
669670
atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier);
670671
#endif
@@ -1922,6 +1923,7 @@ syms_write(struct file *file, const char __user *buf,
19221923
hunt_init();
19231924
dtrace_linux_init();
19241925

1926+
xcall_init();
19251927
dtrace_profile_init();
19261928
dtrace_prcom_init();
19271929
dcpc_init();

driver/mutex.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ static const int disable_ints;
4545
void
4646
dmutex_init(mutex_t *mp)
4747
{
48+
static DEFINE_SEMAPHORE(null_sema);
49+
4850
memset(mp, 0, sizeof *mp);
49-
sema_init(&mp->m_sem, 1);
51+
mp->m_sem = null_sema;
52+
// sema_init(&mp->m_sem, 1);
5053
mp->m_initted = TRUE;
5154
}
5255

driver/vminfo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/* each statistic, we provide a probe which intercepts the */
1414
/* increment of that data item. */
1515
/*--------------------------------------------------------------------*/
16-
/* $Header: Last edited: 26-Oct-2011 1.1 $ */
16+
/* $Header: Last edited: 24-Feb-2012 1.2 $ */
1717
/**********************************************************************/
1818

1919
#include <linux/mm.h>
@@ -137,7 +137,7 @@ void vminfo_init(void)
137137
sdt_add_locator(vm_event_addr(ALLOCSTALL), "vminfo:::allocstall");
138138
sdt_add_locator(vm_event_addr(PGROTATED), "vminfo:::pgrotated");
139139

140-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
140+
#ifdef CONFIG_COMPACTION
141141
sdt_add_locator(vm_event_addr(COMPACTBLOCKS), "vminfo:::compactblocks");
142142
sdt_add_locator(vm_event_addr(COMPACTPAGES), "vminfo:::compactpages");
143143
sdt_add_locator(vm_event_addr(COMPACTPAGEFAILED), "vminfo:::compactpagefailed");

driver/x_call.c

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22
/* Code to implement cross-cpu calling for Dtrace. */
33
/* Author: Paul D. Fox */
44
/* Date: May 2011 */
5+
/* $Header: $ */
56
/**********************************************************************/
7+
8+
/**********************************************************************/
9+
/* Bit of madness/strangeness here. If we are not GPL, then "apic" */
10+
/* (symbol) isnt accessible to us. We dont care, but theres a bug */
11+
/* in gcc/ld and <asm/ipi.h> because of static/inline functions */
12+
/* refer to "apic" even tho we dont use it. So, we #define it out */
13+
/* of harms way, and then, to avoid an undefined symbol reference */
14+
/* (which we didnt want), we define our own "hello_apic". I told */
15+
/* you it was strange. */
16+
/**********************************************************************/
17+
18+
#define apic hello_apic
619
#include <linux/mm.h>
720
# undef zone
821
# define zone linux_zone
@@ -11,22 +24,13 @@
1124
#include "dtrace_proto.h"
1225

1326
#include <linux/cpumask.h>
14-
#include <linux/errno.h>
15-
#include <linux/miscdevice.h>
16-
#include <linux/fs.h>
17-
#include <linux/proc_fs.h>
18-
#include <linux/module.h>
19-
#include <linux/slab.h>
20-
#include <linux/sys.h>
21-
#include <linux/thread_info.h>
22-
#include <linux/smp.h>
2327
#include <asm/smp.h>
24-
#include <linux/vmalloc.h>
25-
#include <asm/current.h>
26-
#include <asm/desc.h>
27-
#include <asm/hardirq.h>
2828
#include <asm/ipi.h>
2929

30+
struct apic *hello_apic; /* Define this because apic.h is broken when facing a */
31+
/* non-GPL driver. We get an undefined, so define it. */
32+
/* We use dynamic lookup instead. */
33+
struct apic *x_apic;
3034

3135
extern void dtrace_sync_func(void);
3236
int in_xcall = -1;
@@ -97,6 +101,21 @@ static void dump_xcalls(void);
97101
static void send_ipi_interrupt(cpumask_t *mask, int vector);
98102
void xcall_slave2(void);
99103

104+
/**********************************************************************/
105+
/* Called during driver startup to do one time initialisation, so */
106+
/* we dont end up doing symbol lookups in potentially critical */
107+
/* probe paths. */
108+
/**********************************************************************/
109+
void
110+
xcall_init(void)
111+
{
112+
if ((x_apic = get_proc_addr("apic")) == NULL) {
113+
dtrace_linux_panic("init_xcall: cannot locate 'apic'\n");
114+
return;
115+
}
116+
x_apic = *(void **) x_apic;
117+
}
118+
100119
/**********************************************************************/
101120
/* Switch the interface from the orig dtrace_xcall code to the new */
102121
/* code. As of 20110520, I cannot decide which one is worse. The */
@@ -531,7 +550,7 @@ send_ipi_interrupt(cpumask_t *mask, int vector)
531550
# elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
532551
send_IPI_mask(*mask, vector);
533552
# else
534-
apic->send_IPI_mask(mask, vector);
553+
x_apic->send_IPI_mask(mask, vector);
535554
# endif
536555
}
537556
/**********************************************************************/
@@ -547,7 +566,17 @@ xcall_slave(void)
547566

548567
smp_mb();
549568

550-
ack_APIC_irq();
569+
/***********************************************/
570+
/* We want to call ack_APIC_irq, but we */
571+
/* inline the expansion because of the GPL */
572+
/* symbol issue. */
573+
/* Once we do this, we can have more IPI */
574+
/* interrupts arrive (but not until we exit */
575+
/* the interrupt routine and re-enable */
576+
/* interrupts). */
577+
/***********************************************/
578+
x_apic->write(APIC_EOI, 0);
579+
//ack_APIC_irq();
551580
}
552581
void
553582
xcall_slave2(void)

libdtrace/dt_open.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ static const dt_ident_t _dtrace_globals[] = {
310310
DT_VERS_1_0, &dt_idops_func, "void(...)" },
311311
#if linux
312312
{ "test1", DT_IDENT_ACTFUNC, 0, DT_ACT_TEST1, DT_ATTR_STABCMN, DT_VERS_1_0,
313-
&dt_idops_func, "int()" },
313+
&dt_idops_func, "uint64_t(uint64_t)" },
314314
{ "test2", DT_IDENT_ACTFUNC, 0, DT_ACT_TEST2, DT_ATTR_STABCMN, DT_VERS_1_0,
315-
&dt_idops_func, "int()" },
315+
&dt_idops_func, "uint64_t(uint64_t)" },
316316
#endif
317317
{ "panic", DT_IDENT_ACTFUNC, 0, DT_ACT_PANIC, DT_ATTR_STABCMN, DT_VERS_1_0,
318318
&dt_idops_func, "void()" },

0 commit comments

Comments
 (0)