Re: [PATCH] blktrace: Send BLK_TN_PROCESS events to all running traces

From: Jeff Moyer
Date: Mon Sep 23 2013 - 09:02:16 EST


Jan Kara <jack@xxxxxxx> writes:

> Currently each task sends BLK_TN_PROCESS event to the first traced
> device it interacts with after a new trace is started. When there are
> several traced devices and the task accesses more devices, this logic
> can result in BLK_TN_PROCESS being sent several times to some devices
> while it is never sent to other devices. Thus blkparse doesn't display
> command name when parsing some blktrace files.
>
> Fix the problem by sending BLK_TN_PROCESS event to all traced devices
> when a task interacts with any of them.
>
> Signed-off-by: Jan Kara <jack@xxxxxxx>

[snip]

> @@ -229,16 +241,15 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
> goto record_it;
> }
>
> + if (unlikely(tsk->btrace_seq != blktrace_seq))
> + trace_note_tsk(tsk);
> +
> /*
> * A word about the locking here - we disable interrupts to reserve
> * some space in the relay per-cpu buffer, to prevent an irq
> * from coming in and stepping on our toes.
> */
> local_irq_save(flags);
> -
> - if (unlikely(tsk->btrace_seq != blktrace_seq))
> - trace_note_tsk(bt, tsk);
> -
> t = relay_reserve(bt->rchan, sizeof(*t) + pdu_len);
> if (t) {
> sequence = per_cpu_ptr(bt->sequence, cpu);

I don't think moving the call site was strictly necessary. That
wouldn't really change anything, though. I also think that this
simplistic approach is good enough.

Reviewed-by: Jeff Moyer <jmoyer@xxxxxxxxxx>
--
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/