Re: [PATCH 2/2] More precise timestamps for nested writes

From: Suresh E. Warrier
Date: Tue Apr 14 2015 - 20:33:16 EST


On 04/14/2015 12:13 PM, Peter Zijlstra wrote:
> On Mon, Apr 13, 2015 at 09:38:01PM -0500, Suresh E. Warrier wrote:
>> +static u64 *get_write_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
>> + unsigned long *flags)
>> +{
>> + if (rb_precise_nested_write_ts()) {
>> + /*
>> + * Ensure that we are not preempted until after we update
>> + * the write timestamp.
>> + */
>> + local_irq_save(*flags);
>> + return &cpu_buffer->last_stamp;
>
> Yeah, ever hear about NMIs? This isn't going to work.

That is a good point! If a NMI can come in and start running a handler
that can generate a trace event, this code is indeed broken.

Some architectures like PowerPC don't have NMIs like Intel and so
I hadn't thought of that. Thanks for catching that!

Let me update the patch to handle NMIs - trace events from NMI code
cannot be made precise (the behavior will be the same as without the
patch).

-suresh

--
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/