[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a108a3ca-c8db-48be-8adb-3733257323d6@email.android.com>
Date: Sun, 17 Jan 2010 14:56:38 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
CC: rostedt@...dmis.org, Jason Baron <jbaron@...hat.com>,
linux-kernel@...r.kernel.org, mingo@...e.hu, tglx@...utronix.de,
andi@...stfloor.org, roland@...hat.com, rth@...hat.com,
mhiramat@...hat.com, Arjan van de Ven <arjan@...radead.org>
Subject: Re: [RFC PATCH 2/8] jump label v4 - x86: Introduce generic jump patching without stop_machine
If single-byte updates weren't atomic, then the int3 scheme would not be possible in the first place. Of course, if you want there to be a synchronization point beyond which the modification is guaranteed to have affected all CPUs, you need an IPI-IRET on all CPUs.
The other thing to watch out for is that the CPU itself is subject to text modification through a different alias, which means some of the hardware SMC protections are ineffective.
"Mathieu Desnoyers" <mathieu.desnoyers@...ymtl.ca> wrote:
>* H. Peter Anvin (hpa@...or.com) wrote:
>> On 01/14/2010 07:32 AM, Steven Rostedt wrote:
>> >> +
>> >> + /* Replacing 1 byte can be done atomically. */
>> >> + if (unlikely(len <= 1))
>> >> + return text_poke(addr, opcode, len);
>> >
>> > This part bothers me. The text_poke just writes over the text directly
>> > (using a separate mapping). But if that memory is in the pipeline of
>> > another CPU, I think this could cause a GPF.
>> >
>>
>> Could you clarify why you think that?
>
>Basically, what Steven and I were concerned about in this particular
>patch version is the fact that this code took a "shortcut" for
>single-byte text modification, thus bypassing the int3-bypass scheme
>altogether.
>
>As mere atomicity of the modification is not the only concern here
>(because we also have to deal with instruction trace cache coherency and
>so forth), then the int3 breakpoint scheme is, I think, also needed for
>single-byte updates.
>
>Thanks,
>
>Mathieu
>
>>
>> -hpa
>>
>> --
>> H. Peter Anvin, Intel Open Source Technology Center
>> I work for Intel. I don't speak on their behalf.
>>
>
>--
>Mathieu Desnoyers
>OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
Sent from my mobile phone, pardon any lack of formatting.
Powered by blists - more mailing lists