[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7c86c4470811270530j4f3c5413j9e6e68cee08631a9@mail.gmail.com>
Date: Thu, 27 Nov 2008 14:30:31 +0100
From: "stephane eranian" <eranian@...glemail.com>
To: "Andi Kleen" <andi@...stfloor.org>
Cc: "Thomas Gleixner" <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
mingo@...e.hu, x86@...nel.org, sfr@...b.auug.org.au
Subject: Re: [patch 05/24] perfmon: X86 generic code (x86)
On Thu, Nov 27, 2008 at 1:45 PM, Andi Kleen <andi@...stfloor.org> wrote:
>> What if a threads reprograms the counters while another is reading them?
>
> In the worst case you get an invalid event, which is then discarded.
> I think. I've never tried to understand it in all details, but
> at least it seems to work.
>
>> How is the buffer reset?
>
> drivers/oprofile/cpu_buffer.c:
>
> /* Resets the cpu buffer to a sane state. */
> void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf)
> {
> /* reset these to invalid values; the next sample
> * collected will populate the buffer with proper
> * values to initialize the buffer
> */
> cpu_buf->last_is_kernel = -1;
> cpu_buf->last_task = NULL;
> }
>
What about a thread doing this and another one in the middle of read the buffer?
Or what about a thread trying to reset the buffer while you're processing an PMU
interrupt on another CPU. I know each buffer is per-CPU, but that does not
prevent two threads for trying to operate on it at the same time from
different CPUs.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists