Bug 19955 - on rawhide, getting 'BUG: sleeping function called from invalid context' on perf probes
Summary: on rawhide, getting 'BUG: sleeping function called from invalid context' on p...
Status: RESOLVED DUPLICATE of bug 17055
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-15 16:09 UTC by David Smith
Modified: 2016-05-05 14:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2016-04-15 16:09:31 UTC
On rawhide (4.6.0-0.rc2.git4.1.fc25.x86_64), I'm getting the following on the console:

====
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: BUG: sleeping function called from invalid context at /usr/local/share/systemtap/runtime/linux/perf.c:268
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: in_atomic(): 1, irqs_disabled(): 0, pid: 30122, name: find
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: INFO: lockdep is turned off.
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: CPU: 0 PID: 30122 Comm: find Tainted: G           OE   4.6.0-0.rc2.git4.1.fc25.x86_64 #1
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: 0000000000000286 000000001621c757 ffff880072163d58 ffffffff8145a015
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: ffff880025c48000 ffffffffc0704258 ffff880072163d80 ffffffff810e17a9
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: ffffffffc0704258 000000000000010c 0000000000000000 ffff880072163da8
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: Call Trace:
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff8145a015>] dump_stack+0x86/0xc1
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff810e17a9>] ___might_sleep+0x179/0x230
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff810e18a9>] __might_sleep+0x49/0x80
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffffc06fc7f0>] _stp_perf_read.isra.69+0x50/0xb0 [stap_4f7d987ad6aab55c580904401f7a7b6_30119]
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffffc06fcc27>] probe_2834+0x17/0x2c0 [stap_4f7d987ad6aab55c580904401f7a7b6_30119]
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffffc06fdeae>] stapiu_probe_prehandler+0x24e/0x3e0 [stap_4f7d987ad6aab55c580904401f7a7b6_30119]
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff811eea91>] uprobe_notify_resume+0x411/0xb30
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff8107041b>] ? arch_uprobe_exception_notify+0x3b/0x50
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff810db9f0>] ? notifier_call_chain+0x40/0xb0
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff81003279>] exit_to_usermode_loop+0x89/0xd0
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff81003e96>] prepare_exit_to_usermode+0x76/0x80
Apr 15 09:41:44 kvm-rawhide-64-1 kernel: [<ffffffff818cdbbe>] retint_user+0x8/0x20
====

Here's the offending function from runtime/linux/perf.c. Line 268 is the might_sleep() call right before the return.

====
long _stp_perf_read (int ncpu, unsigned i)                                      
{                                                                               
  /* Choose the stap_perf_probes entry */                                       
  struct stap_perf_probe* stp;                                                  
  u64 enabled, running;                                                         
                                                                                
  if (i > sizeof(stap_perf_probes)/sizeof(struct stap_perf_probe))              
    {                                                                           
      _stp_error ("_stp_perf_read - out of range");                             
      return 0;                                                                 
    }                                                                           
  stp = & stap_perf_probes[i];                                                  
                                                                                
  if (stp == NULL || stp->e.t.per_thread_event == NULL)                         
    {                                                                           
      _stp_error ("_stp_perf_read - probe '%s' is not supported by this kernel"\
,                                                                               
#ifdef STP_NEED_PROBE_NAME                                                      
                  (stp ? stp->probe->pn : "unknown")                            
#else                                                                           
                  (stp ? stp->probe->pp : "unknown")                            
#endif                                                                          
              );                                                                
      return 0;                                                                 
    }                                                                           
                                                                                
  might_sleep();                                                                
  return perf_event_read_value (stp->e.t.per_thread_event, &enabled, &running); 
                                                                                
}                                                                               
====
Comment 1 Josh Stone 2016-04-27 17:42:22 UTC
I suspect this is the same as PR17055.
Comment 2 David Smith 2016-05-05 14:05:21 UTC
(In reply to Josh Stone from comment #1)
> I suspect this is the same as PR17055.

It appears that it is. I'll close this one.

*** This bug has been marked as a duplicate of bug 17055 ***