Re: [PATCH v7 1/3] trace: Make removal of ring buffer pages atomic

From: Vaibhav Nagarnaik
Date: Mon May 07 2012 - 17:49:25 EST


On Mon, May 7, 2012 at 1:22 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> After applying this patch, I get this:
>
> # trace-cmd start -e all
> # echo 100 > /debug/tracing/buffer_size_kb
>
> BUG: scheduling while atomic: trace-cmd/2018/0x00000002
> no locks held by trace-cmd/2018.
> Modules linked in: ipt_MASQUERADE iptable_nat nf_nat sunrpc bridge stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipv6 kvm uinput snd_hda_codec_idt
>  snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc i2c_i801 shpchp microcode pata_acpi firewire_ohci firewire_core crc_itu
> _t ata_generic i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan]
> Pid: 2018, comm: trace-cmd Not tainted 3.4.0-rc2-test+ #2
> Call Trace:
>  [<ffffffff81480d52>] __schedule_bug+0x66/0x6a
>  [<ffffffff81487d16>] __schedule+0x93/0x605
>  [<ffffffff8107a045>] ? __lock_acquire+0x4dc/0xcf1
>  [<ffffffff8148833b>] schedule+0x64/0x66
>  [<ffffffff81486b28>] schedule_timeout+0x37/0xf7
>  [<ffffffff81489386>] ? _raw_spin_unlock_irq+0x2d/0x5e
>  [<ffffffff8107b117>] ? trace_hardirqs_on_caller+0x121/0x158
>  [<ffffffff81487b73>] wait_for_common+0x97/0xf1
>  [<ffffffff8105c922>] ? try_to_wake_up+0x1ec/0x1ec
>  [<ffffffff810a4d29>] ? call_rcu_bh+0x19/0x19
>  [<ffffffff810b4845>] ? tracing_iter_reset+0x8b/0x8b
>  [<ffffffff81487c81>] wait_for_completion+0x1d/0x1f
>  [<ffffffff8104ba3d>] wait_rcu_gp+0x5c/0x77
>  [<ffffffff8104ba58>] ? wait_rcu_gp+0x77/0x77
>  [<ffffffff810a39eb>] synchronize_sched+0x25/0x27
>  [<ffffffff810ae27f>] ring_buffer_reset_cpu+0x4e/0xd1

The following seems to be the culprit. I am guessing you have a preempt
kernel?

@@ -3662,8 +3808,12 @@ void ring_buffer_reset_cpu(struct ring_buffer
*buffer, int cpu)
if (!cpumask_test_cpu(cpu, buffer->cpumask))
return;

+ atomic_inc(&buffer->resize_disabled);
atomic_inc(&cpu_buffer->record_disabled);

+ /* Make sure all commits have finished */
+ synchronize_sched();
+
raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags);


I guess I can disable resizing in ring_buffer_record_disable(), that
seems to be a reasonable assumption.



Vaibhav Nagarnaik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/