This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/14949] New: cannot use systemtap on linux 3.7 intel x86_64


http://sourceware.org/bugzilla/show_bug.cgi?id=14949

             Bug #: 14949
           Summary: cannot use systemtap on linux 3.7 intel x86_64
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: critical
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: zhengliweb@hotmail.com
    Classification: Unclassified


stap cannot use on linux 3.7 branch 

testcase:
stap -p4 -e 'probe begin { println("hello world") exit () }' 

/tmp/stapN9obop/stap_46722f234592a495b91f7627dd6fd935_947_src.c: In function
âfunction_exitâ:
/tmp/stapN9obop/stap_46722f234592a495b91f7627dd6fd935_947_src.c:72:5: error:
passing argument 1 of âatomic_setâ from incompatible pointer type [-Werror]
In file included from
/home/ivor/build/linux/linux-3.7/include/linux/atomic.h:4:0,
                 from
/home/ivor/build/linux/linux-3.7/arch/x86/include/asm/thread_info.h:24,
                 from
/home/ivor/build/linux/linux-3.7/include/linux/thread_info.h:54,
                 from
/home/ivor/build/linux/linux-3.7/include/linux/preempt.h:9,
                 from
/home/ivor/build/linux/linux-3.7/include/linux/spinlock.h:50,
                 from
/home/ivor/build/linux/linux-3.7/include/linux/seqlock.h:29,
                 from /home/ivor/build/linux/linux-3.7/include/linux/time.h:5,
                 from /home/ivor/build/linux/linux-3.7/include/linux/stat.h:18,
                 from
/home/ivor/build/linux/linux-3.7/include/linux/module.h:10,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:14,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from
/tmp/stapN9obop/stap_46722f234592a495b91f7627dd6fd935_947_src.c:20:
/home/ivor/build/linux/linux-3.7/arch/x86/include/asm/atomic.h:35:20: note:
expected âstruct atomic_t *â but argument is of type âstruct atomic_t *
(*)(void)â
cc1: all warnings being treated as errors
make[3]: *** [/tmp/stapN9obop/stap_46722f234592a495b91f7627dd6fd935_947_src.o]
Error 1
make[2]: *** [_module_/tmp/stapN9obop] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed.  Try again with another '--vp 0001' option.
    More error information at man page error::pass4(7stap)

+++++++
 72     atomic_set (&session_state, STAP_SESSION_STOPPING);
should be ??:
        atomic_set (&session_state(), STAP_SESSION_STOPPING);

########################################################################
stap -p3 -e 'probe begin { println("hello world") exit () }' 

  1 
  2 #define STAP_MSG_RUNTIME_H_01 "myproc-unprivileged tapset function called
without is_myproc ch    ecking for pid %d (euid %d)"
  3 #define STAP_MSG_LOC2C_01 "kernel read fault at 0x%p (%s)"
  4 #define STAP_MSG_LOC2C_02 "kernel write fault at 0x%p (%s)"
  5 #define STAP_MSG_LOC2C_03 "divide by zero in DWARF operand (%s)"
  6 #define STAP_VERSION(a, b) ( ((a) << 8) + (b) )
  7 #ifndef STAP_COMPAT_VERSION
  8 #define STAP_COMPAT_VERSION STAP_VERSION(2, 1)
  9 #endif
 10 #include "runtime_defines.h"
 11 #define STP_PR_STAPUSR 0x2
 12 #define STP_PR_STAPSYS 0x4
 13 #define STP_PR_STAPDEV 0x8
 14 #define STP_PRIVILEGE 0x8
 15 int stp_required_privilege __attribute__ ((section (".stap_privilege"))) =
STP_PRIVILEGE;
 16 #ifndef MAXNESTING
 17 #define MAXNESTING 1
 18 #endif
 19 #define STP_SKIP_BADVARS 0
 20 #include "runtime.h"
 21 
 22 #include "common_session_state.h"
 23 struct context {
 24   #include "common_probe_context.h"
 25   union {
 26     struct probe_2042_locals {
 27       union {
 28       };
 29     } probe_2042;
 30   } probe_locals;
 31   union {
 32     struct function_exit_locals {
 33       /* no return value */
 34     } function_exit;
 35   } locals [MAXNESTING+1];
 36   #if MAXNESTING < 0
 37   #error "MAXNESTING must be positive"
 38   #endif
 39   #ifndef STP_LEGACY_PRINT
 40   union {
 41   } printf_locals;
 42   #endif // STP_LEGACY_PRINT
 43 };
 44 
 45 #ifdef STAP_NEED_GETTIMEOFDAY
 46 #include "time.c"
 47 #endif
 48 #ifndef STP_LEGACY_PRINT
 49 #endif // STP_LEGACY_PRINT
 50 
 51 #include "runtime_context.h"
 52 #include "probe_lock.h"
 53 
 54 static void function_exit (struct context * __restrict__ c);
 55 
 56 static void function_exit (struct context* __restrict__ c) {
 57   __label__ out;
 58   struct function_exit_locals *  __restrict__ l = &
c->locals[c->nesting+1].function_exit;
 59   (void) l;
 60   #define CONTEXT c
 61   #define THIS l
 62   c->last_stmt = "identifier 'exit' at
/usr/local/share/systemtap/tapset/logging.stp:49:10";
 63   if (unlikely (c->nesting+1 >= MAXNESTING)) {
 64     c->last_error = "MAXNESTING exceeded";
 65     return;
 66   } else {
 67     c->nesting ++;
 68   }
 69   #define return goto out
 70   {
 71      /* unprivileged */
 72     atomic_set (&session_state, STAP_SESSION_STOPPING);
 73     _stp_exit ();
 74 
 75   }
 76   #undef return
 77 out:
 78   if (0) goto out;
 79   c->nesting --;
 80   #undef CONTEXT
 81   #undef THIS
 82   #undef STAP_RETVALUE
 83 }
 84 
 85 
 86 static void probe_2042 (struct context * __restrict__ c) {
 87   __label__ out;
 88   struct probe_2042_locals * __restrict__ l = & c->probe_locals.probe_2042;
 89   (void) l;
 90   {
 91     (void)
 92     ({
 93       _stp_print ("hello world""\n");
 94     });
 95 
 96     (void)
 97     ({
 98       function_exit (c);
 99       if (unlikely(c->last_error)) goto out;
100       (void) 0;
101     });
102 
103   }
104   c->actionremaining -= 2;
105   if (unlikely (c->actionremaining <= 0)) {
106     c->last_error = "MAXACTION exceeded";
107     c->last_stmt = "operator '{' at <input>:1:13";
108     goto out;
109   }
110 out:
111   _stp_print_flush();
112 }
113 
114 static struct stap_probe {
115   void (* const ph) (struct context*);
116   #ifdef STP_ALIBI
117   atomic_t alibi;
118   #define STAP_PROBE_INIT_ALIBI() .alibi=ATOMIC_INIT(0),
119   #else
120   #define STAP_PROBE_INIT_ALIBI()
121   #endif
122   #ifdef STP_TIMING
123   Stat timing;
124   #endif
125   #if defined(STP_TIMING) || defined(STP_ALIBI)
126   const char location[14];
127   const char derivation[15];
128   #define STAP_PROBE_INIT_TIMING(L, D) .location=(L), .derivation=(D),
129   #else
130   #define STAP_PROBE_INIT_TIMING(L, D)
131   #endif
132   const char pp[8];
133   #ifdef STP_NEED_PROBE_NAME
134   const char pn[8];
135   #define STAP_PROBE_INIT_NAME(PN) .pn=(PN),
136   #else
137   #define STAP_PROBE_INIT_NAME(PN)
138   #endif
139   #define STAP_PROBE_INIT(PH, PP, PN, L, D) { .ph=(PH), .pp=(PP),
STAP_PROBE_INIT_NAME(PN) STA    P_PROBE_INIT_ALIBI() STAP_PROBE_INIT_TIMING(L,
D) }
140 } stap_probes[] = {
141   STAP_PROBE_INIT(&probe_2042, "begin", "begin", "<input>:1:1", " from:
begin"),
142 };
143 
144 /* ---- begin/end/error probes ---- */
145 static struct stap_be_probe {
146   struct stap_probe * const probe;
147   int state, type;
148 } stap_be_probes[] = {
149   { .probe=(&stap_probes[0]), .state=STAP_SESSION_STARTING, .type=0 },
150 };
151 static void enter_be_probe (struct stap_be_probe *stp) {
152   #ifdef STP_ALIBI
153   atomic_inc(&(stp->probe->alibi));
154   #else
155   struct context* __restrict__ c;
156   #if !INTERRUPTIBLE
157   unsigned long flags;
158   #endif
159   #ifdef STP_TIMING
160   Stat stat = stp->probe->timing;
161   #endif
162   #ifdef STP_TIMING
163   cycles_t cycles_atstart = get_cycles ();
164   #endif
165   #if INTERRUPTIBLE
166   preempt_disable ();
167   #else
168   local_irq_save (flags);
169   #endif
170   if (unlikely ((((unsigned long) (& c)) & (THREAD_SIZE-1))
171     < (MINSTACKSPACE + sizeof (struct thread_info)))) {
172     atomic_inc (skipped_count());
173     #ifdef STP_TIMING
174     atomic_inc (skipped_count_lowstack());
175     #endif
176     goto probe_epilogue;
177   }
178   if (atomic_read (session_state()) != stp->state)
179     goto probe_epilogue;
180   c = _stp_runtime_entryfn_get_context();
181   if (atomic_inc_return (& c->busy) != 1) {
182     #if !INTERRUPTIBLE
183     atomic_inc (skipped_count());
184     #endif
185     #ifdef STP_TIMING
186     atomic_inc (skipped_count_reentrant());
187     #ifdef DEBUG_REENTRANCY
188     _stp_warn ("Skipped %s due to %s residency on cpu %u\n",
stp->probe->pp, c->probe_point ?:     "?", smp_processor_id());
189     #endif
190     #endif
191     atomic_dec (& c->busy);
192     goto probe_epilogue;
193   }
194 
195   c->last_stmt = 0;
196   c->last_error = 0;
197   c->nesting = -1;
198   c->uregs = 0;
199   c->kregs = 0;
200   #if defined __ia64__
201   c->unwaddr = 0;
202   #endif
203   c->probe_point = stp->probe->pp;
204   #ifdef STP_NEED_PROBE_NAME
205   c->probe_name = stp->probe->pn;
206   #endif
207   c->probe_type = stp_probe_type_been;
208   memset(&c->ips, 0, sizeof(c->ips));
209   c->user_mode_p = 0; c->full_uregs_p = 0;
210   #ifdef STAP_NEED_REGPARM
211   c->regparm = 0;
212   #endif
213   #if INTERRUPTIBLE
214   c->actionremaining = MAXACTION_INTERRUPTIBLE;
215   #else
216   c->actionremaining = MAXACTION;
217   #endif
218   #if defined(STP_NEED_UNWIND_DATA)
219   c->uwcache_user.state = uwcache_uninitialized;
220   c->uwcache_kernel.state = uwcache_uninitialized;
221   #endif
222   (*stp->probe->ph) (c);
223   #ifdef STP_TIMING
224   {
225     cycles_t cycles_atend = get_cycles ();
226     int32_t cycles_elapsed = ((int32_t)cycles_atend >
(int32_t)cycles_atstart)
227       ? ((int32_t)cycles_atend - (int32_t)cycles_atstart)
228       : (~(int32_t)0) - (int32_t)cycles_atstart + (int32_t)cycles_atend +
1;
229     #ifdef STP_TIMING
230     if (likely (stat)) _stp_stat_add(stat, cycles_elapsed);
231     #endif
232   }
233   #endif
234   c->probe_point = 0;
235   #ifdef STP_NEED_PROBE_NAME
236   c->probe_name = 0;
237   #endif
238   c->probe_type = 0;
239   if (unlikely (c->last_error && c->last_error[0])) {
240     if (c->last_stmt != NULL)
241       _stp_softerror ("%s near %s", c->last_error, c->last_stmt);
242     else
243       _stp_softerror ("%s", c->last_error);
244     atomic_inc (error_count());
245     if (atomic_read (error_count()) > MAXERRORS) {
246       atomic_set (session_state(), STAP_SESSION_ERROR);
247       _stp_exit ();
248     }
249   }
250   atomic_dec (&c->busy);
251 probe_epilogue:
252   _stp_runtime_entryfn_put_context();
253   if (unlikely (atomic_read (skipped_count()) > MAXSKIPPED)) {
254     if (unlikely (pseudo_atomic_cmpxchg(session_state(),
STAP_SESSION_RUNNING, STAP_SESSION_ER    ROR) == STAP_SESSION_RUNNING))
255     _stp_error ("Skipped too many probes, check MAXSKIPPED or try again
with stap -t for more     details.");
256   }
257   #if INTERRUPTIBLE
258   preempt_enable_no_resched ();
259   #else
260   local_irq_restore (flags);
261   #endif
262   #endif // STP_ALIBI
263 }
264 
265 static int systemtap_module_init (void) {
266   int rc = 0;
267   int cpu;
268   int i=0, j=0;
269   const char *probe_point = "";
270   {
271     const char* release = UTS_RELEASE;
272     #ifdef STAPCONF_GENERATED_COMPILE
273     const char* version = UTS_VERSION;
274     #endif
275     if (strcmp (release, "3.7.0-r458-systemtap")) {
276       _stp_error ("module release mismatch (%s vs %s)", release,
"3.7.0-r458-systemtap");
277       rc = -EINVAL;
278     }
279     #ifdef STAPCONF_GENERATED_COMPILE
280     if (strcmp (utsname()->version, version)) {
281       _stp_error ("module version mismatch (%s vs %s), release %s",
version, utsname()->versio    n, release);
282       rc = -EINVAL;
283     }
284     #endif
285     if (_stp_module_check()) rc = -EINVAL;
286     if (_stp_privilege_credentials == 0) {
287       if (STP_PRIVILEGE_CONTAINS(STP_PRIVILEGE, STP_PR_STAPDEV) ||
288           STP_PRIVILEGE_CONTAINS(STP_PRIVILEGE, STP_PR_STAPUSR)) {
289         _stp_privilege_credentials = STP_PRIVILEGE;
290         #ifdef DEBUG_PRIVILEGE
291           _dbug("User's privilege credentials default to %s\n",
292                 privilege_to_text(_stp_privilege_credentials));
293         #endif
294       }
295       else {
296         _stp_error ("Unable to verify that you have the required privilege
credentials to run     this module (%s required). You must use staprun version
1.7 or higher.",
297                     privilege_to_text(STP_PRIVILEGE));
298         rc = -EINVAL;
299       }
300     }
301     else {
302       #ifdef DEBUG_PRIVILEGE
303         _dbug("User's privilege credentials provided as %s\n",
304               privilege_to_text(_stp_privilege_credentials));
305       #endif
306       if (! STP_PRIVILEGE_CONTAINS(_stp_privilege_credentials,
STP_PRIVILEGE)) {
307         _stp_error ("Your privilege credentials (%s) are insufficient to
run this module (%s r    equired).",
308                     privilege_to_text(_stp_privilege_credentials),
privilege_to_text(STP_PRIVI    LEGE));
309         rc = -EINVAL;
310       }
311     }
312   }
313   if (rc) goto out;
314   rc = stp_session_init();
315   if (rc) {
316     _stp_error ("couldn't initialize the main session (rc %d)", rc);
317     goto out;
318   }
319   #ifdef STAP_NEED_GETTIMEOFDAY
320   rc = _stp_init_time();
321   if (rc) {
322     _stp_error ("couldn't initialize gettimeofday");
323     goto out;
324   }
325   #endif
326   (void) probe_point;
327   (void) i;
328   (void) j;
329   atomic_set (session_state(), STAP_SESSION_STARTING);
330   rc = _stp_runtime_contexts_alloc();
331   if (rc != 0)
332     goto out;
333   #ifdef STP_TIMING
334   for (i = 0; i < ARRAY_SIZE(stap_probes); ++i)
335     stap_probes[i].timing = _stp_stat_init (HIST_NONE);
336   #endif
337   _stp_print_kernel_info("2.1/0.153", (num_online_cpus() * sizeof(struct
context)), 1);
338   for (i=0; i<1; i++) {
339     struct stap_be_probe* stp = & stap_be_probes [i];
340     if (stp->type == 0)
341       enter_be_probe (stp); /* rc = 0 */
342   }
343   if (rc) {
344     if (probe_point)
345       _stp_error ("probe %s registration error (rc %d)", probe_point, rc);
346     atomic_set (session_state(), STAP_SESSION_ERROR);
347     goto out;
348   }
349   if (atomic_read (session_state()) == STAP_SESSION_STARTING)
350     atomic_set (session_state(), STAP_SESSION_RUNNING);
351   return 0;
352 out:
353   atomic_set (session_state(), STAP_SESSION_STOPPED);
354   #ifdef STAPCONF_SYNCHRONIZE_SCHED
355   synchronize_sched();
356   #endif
357   #ifdef STAP_NEED_GETTIMEOFDAY
358    _stp_kill_time();
359   #endif
360   _stp_runtime_contexts_free();
361   return rc;
362 }
363 
364 
365 static void systemtap_module_refresh (void) {
366   int i=0, j=0;
367   (void) i;
368   (void) j;
369 }
370 
371 
372 static void systemtap_module_exit (void) {
373   int i=0, j=0;
374   (void) i;
375   (void) j;
376   if (atomic_read (session_state()) == STAP_SESSION_STARTING)
377     return;
378   if (atomic_read (session_state()) == STAP_SESSION_RUNNING)
379     atomic_set (session_state(), STAP_SESSION_STOPPING);
380   for (i=0; i<1; i++) {
381     struct stap_be_probe* stp = & stap_be_probes [i];
382     if (stp->type == 1)
383       enter_be_probe (stp);
384   }
385   for (i=0; i<1; i++) {
386     struct stap_be_probe* stp = & stap_be_probes [i];
387     if (stp->type == 2)
388       enter_be_probe (stp);
389   }
390   #ifdef STAPCONF_SYNCHRONIZE_SCHED
391   synchronize_sched();
392   #endif
393   _stp_runtime_context_wait();
394   atomic_set (session_state(), STAP_SESSION_STOPPED);
395   #ifdef STAPCONF_SYNCHRONIZE_SCHED
396   synchronize_sched();
397   #endif
398   _stp_runtime_contexts_free();
399   #ifdef STAP_NEED_GETTIMEOFDAY
400    _stp_kill_time();
401   #endif
402   preempt_disable();
403   #if defined(STP_TIMING) || defined(STP_ALIBI)
404   _stp_printf("----- probe hit report: \n");
405   for (i = 0; i < ARRAY_SIZE(stap_probes); ++i) {
406     struct stap_probe *const p = &stap_probes[i];
407     #ifdef STP_ALIBI
408     int alibi = atomic_read(&(p->alibi));
409     if (alibi)
410       _stp_printf ("%s, (%s), hits: %d,%s\n",
411           p->pp, p->location, alibi, p->derivation);
412     #endif
413     #ifdef STP_TIMING
414     if (likely (p->timing)) {
415       struct stat_data *stats = _stp_stat_get (p->timing, 0);
416       if (stats->count) {
417         int64_t avg = _stp_div64 (NULL, stats->sum, stats->count);
418         _stp_printf ("%s, (%s), hits: %lld, cycles:
%lldmin/%lldavg/%lldmax,%s\n",
419             p->pp, p->location, (long long) stats->count,
420             (long long) stats->min, (long long) avg, (long long)
stats->max,
421             p->derivation);
422       }
423       _stp_stat_del (p->timing);
424     }
425     #endif
426   }
427   _stp_print_flush();
428   #endif
429   if (atomic_read (skipped_count()) || atomic_read (error_count()) ||
atomic_read (skipped_cou    nt_reentrant())) {
430     _stp_warn ("Number of errors: %d, skipped probes: %d\n", (int)
atomic_read (error_count())    , (int) atomic_read (skipped_count()));
431     #ifdef STP_TIMING
432     {
433       int ctr;
434       ctr = atomic_read (skipped_count_lowstack());
435       if (ctr) _stp_warn ("Skipped due to low stack: %d\n", ctr);
436       ctr = atomic_read (skipped_count_reentrant());
437       if (ctr) _stp_warn ("Skipped due to reentrancy: %d\n", ctr);
438       ctr = atomic_read (skipped_count_uprobe_reg());
439       if (ctr) _stp_warn ("Skipped due to uprobe register failure: %d\n",
ctr);
440       ctr = atomic_read (skipped_count_uprobe_unreg());
441       if (ctr) _stp_warn ("Skipped due to uprobe unregister failure: %d\n",
ctr);
442     }
443     #endif
444     _stp_print_flush();
445   }
446   preempt_enable_no_resched();
447 }
448 
449 
450 #include "stap-symbols.h"
451 MODULE_DESCRIPTION("systemtap-generated probe");
452 MODULE_LICENSE("GPL");

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]