[PATCH 1/2] powerpc/powernv: Add OPAL message log interface

Joel Stanley joel at jms.id.au
Tue Apr 1 09:52:54 EST 2014


On Mon, Mar 31, 2014 at 10:29 PM, Benjamin Herrenschmidt
<benh at kernel.crashing.org> wrote:
>> > +   conbuf = phys_to_virt(be64_to_cpu(mc->obuf_phys));
>> > +   wrapped = be32_to_cpu(mc->out_pos) & MEMCONS_OUT_POS_WRAP;
>> > +   out_pos = be32_to_cpu(mc->out_pos) & MEMCONS_OUT_POS_MASK;
>> > +
>>
>> Are there ordering issues we need to think about here with reading
>> these?  Can the messages be written on another CPU at the same time as
>> these are being read?
>
> Good point. out_pos should probably be read only once into a local
> variable using the ACCESS_ONCE macro, and then only be broken up.

I've got a V2 that fixes this and the other issues Mikey pointed out.

I found that the log would get corrupted from Linux's point of view
once full. Dumping the memory suggests that the contents of the
circular buffer is fine, and it's just our pointer (out_pos) that is
incorrect. It's not clear why this is happening; I'll do some more
testing before sending out the updated patch.

Cheers,

Joel


More information about the Linuxppc-dev mailing list