From: Joel Stanley <joel@jms.id.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>,
michael@ellerman.id.au, Michael Neuling <mikey@neuling.org>,
shangw@linux.vnet.ibm.com, hegdevasant@linux.vnet.ibm.com,
paulus@samba.org, Anton Blanchard <anton@samba.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] powerpc/powernv: Add OPAL message log interface
Date: Tue, 1 Apr 2014 09:22:54 +1030 [thread overview]
Message-ID: <CACPK8Xfun6UHdHq_-308jGw5tmv53L-CPa=g-NWCya1WL_kVGw@mail.gmail.com> (raw)
In-Reply-To: <1396267178.11529.80.camel@pasglop>
On Mon, Mar 31, 2014 at 10:29 PM, Benjamin Herrenschmidt
<benh@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
next prev parent reply other threads:[~2014-03-31 22:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 23:50 [PATCH 0/2] OPAL message log interface Joel Stanley
2014-03-27 23:50 ` [PATCH 1/2] powerpc/powernv: Add " Joel Stanley
2014-03-30 22:21 ` Stewart Smith
2014-03-31 4:08 ` Michael Neuling
2014-03-31 4:21 ` Michael Neuling
2014-03-31 11:59 ` Benjamin Herrenschmidt
2014-03-31 22:52 ` Joel Stanley [this message]
2014-03-27 23:50 ` [PATCH 2/2] powerpc/powernv: Add invalid OPAL call Joel Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACPK8Xfun6UHdHq_-308jGw5tmv53L-CPa=g-NWCya1WL_kVGw@mail.gmail.com' \
--to=joel@jms.id.au \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=hegdevasant@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=michael@ellerman.id.au \
--cc=mikey@neuling.org \
--cc=paulus@samba.org \
--cc=shangw@linux.vnet.ibm.com \
--cc=stewart@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).